@@ -1,4 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | + /** |
|
3 | + * @param string $_path |
|
4 | + */ |
|
2 | 5 | function requireComponent( $_path, $_local = true ) { |
3 | 6 | $path = getJFolder($_path, $_local, debug_backtrace()); |
4 | 7 | if(file_exists($path) && isPhp($path)) |
@@ -6,6 +9,10 @@ discard block |
||
6 | 9 | else |
7 | 10 | requireError($_path); |
8 | 11 | } |
12 | + |
|
13 | + /** |
|
14 | + * @param string $_path |
|
15 | + */ |
|
9 | 16 | function requireComponents( $_path, $_local = true ) { |
10 | 17 | $path = getJFolder($_path, $_local, debug_backtrace()); |
11 | 18 | if(file_exists($path)) { |
@@ -38,6 +45,10 @@ discard block |
||
38 | 45 | $path = getJFolder($_path, $_local, debug_backtrace()); |
39 | 46 | require_once( $path ); |
40 | 47 | } |
48 | + |
|
49 | + /** |
|
50 | + * @param boolean $_local |
|
51 | + */ |
|
41 | 52 | function getJFolder( $_path, $_local, $_stack ) { |
42 | 53 | if($_local) { |
43 | 54 | $stackInfo = $_stack; |
@@ -1,45 +1,45 @@ |
||
1 | 1 | <?php |
2 | - function requireComponent( $_path, $_local = true ) { |
|
2 | + function requireComponent($_path, $_local = true) { |
|
3 | 3 | $path = getJFolder($_path, $_local, debug_backtrace()); |
4 | - if(file_exists($path) && isPhp($path)) |
|
4 | + if (file_exists($path) && isPhp($path)) |
|
5 | 5 | jRequire($path, false, 0); |
6 | 6 | else |
7 | 7 | requireError($_path); |
8 | 8 | } |
9 | - function requireComponents( $_path, $_local = true ) { |
|
9 | + function requireComponents($_path, $_local = true) { |
|
10 | 10 | $path = getJFolder($_path, $_local, debug_backtrace()); |
11 | - if(file_exists($path)) { |
|
11 | + if (file_exists($path)) { |
|
12 | 12 | $files = subFolderFile($path); |
13 | 13 | foreach ($files as $i) { |
14 | - if(isPhp($path."/".$i)) |
|
14 | + if (isPhp($path."/".$i)) |
|
15 | 15 | requireComponent($path."/".$i, false, 0); |
16 | 16 | } |
17 | 17 | } else |
18 | 18 | requireError($_path); |
19 | 19 | } |
20 | - function requireError( $_path ) { |
|
20 | + function requireError($_path) { |
|
21 | 21 | global $jConfig; |
22 | - if( $jConfig->DEBUG == 1 ) |
|
22 | + if ($jConfig->DEBUG == 1) |
|
23 | 23 | echo "Error load ($_path)<br>"; |
24 | 24 | } |
25 | - function isPhp ( $_file ) { |
|
26 | - if(!is_file($_file)) return false; |
|
25 | + function isPhp($_file) { |
|
26 | + if (!is_file($_file)) return false; |
|
27 | 27 | $info = pathinfo($_file); |
28 | 28 | return ($info["extension"] == "php") || ($info["extension"] == "PHP"); |
29 | 29 | } |
30 | - function requireModules( $_path, $_local = true ) { |
|
30 | + function requireModules($_path, $_local = true) { |
|
31 | 31 | $path = getJFolder($_path, $_local, debug_backtrace()); |
32 | 32 | $subFolders = subFolderDir($path); |
33 | 33 | foreach ($subFolders as $i) { |
34 | 34 | requireComponents($path."/".$i, false, 0); |
35 | 35 | } |
36 | 36 | } |
37 | - function jRequire( $_path, $_local = true ) { |
|
37 | + function jRequire($_path, $_local = true) { |
|
38 | 38 | $path = getJFolder($_path, $_local, debug_backtrace()); |
39 | - require_once( $path ); |
|
39 | + require_once($path); |
|
40 | 40 | } |
41 | - function getJFolder( $_path, $_local, $_stack ) { |
|
42 | - if($_local) { |
|
41 | + function getJFolder($_path, $_local, $_stack) { |
|
42 | + if ($_local) { |
|
43 | 43 | $stackInfo = $_stack; |
44 | 44 | $folder = dirname($stackInfo[0]["file"]); |
45 | 45 | $file = "$folder/$_path"; |
@@ -1,41 +1,41 @@ |
||
1 | 1 | <?php |
2 | - function subFolder( $_dir = "./" ) { |
|
2 | + function subFolder($_dir = "./") { |
|
3 | 3 | $temp = fetchInSubFolder($_dir, function() { |
4 | 4 | return true; |
5 | 5 | }); |
6 | 6 | return $temp; |
7 | 7 | } |
8 | - function subFolderFile( $_dir = "./" ) { |
|
9 | - $temp = fetchInSubFolder($_dir, function( $_file ) { |
|
8 | + function subFolderFile($_dir = "./") { |
|
9 | + $temp = fetchInSubFolder($_dir, function($_file) { |
|
10 | 10 | return !is_dir($_file); |
11 | 11 | }); |
12 | 12 | return $temp; |
13 | 13 | } |
14 | - function subFolderDir( $_dir = "./" ) { |
|
15 | - $temp = fetchInSubFolder($_dir, function( $_file ) { |
|
14 | + function subFolderDir($_dir = "./") { |
|
15 | + $temp = fetchInSubFolder($_dir, function($_file) { |
|
16 | 16 | return !is_file($_file); |
17 | 17 | }); |
18 | 18 | return $temp; |
19 | 19 | } |
20 | - function fetchInSubFolder( $_dir = "./", $_function) { |
|
20 | + function fetchInSubFolder($_dir = "./", $_function) { |
|
21 | 21 | $temp = []; |
22 | 22 | if (is_dir($_dir)) { |
23 | 23 | if ($dirOpened = opendir($_dir)) { |
24 | 24 | while (($file = readdir($dirOpened)) !== false) |
25 | - if( ($file !='.')&&($file !='..') ) |
|
26 | - if($_function($file)) |
|
27 | - array_push($temp,$file); |
|
25 | + if (($file != '.') && ($file != '..')) |
|
26 | + if ($_function($file)) |
|
27 | + array_push($temp, $file); |
|
28 | 28 | closedir($dirOpened); |
29 | 29 | } |
30 | 30 | } |
31 | 31 | return $temp; |
32 | 32 | } |
33 | - function requireSubfolder( $_dir = "./" ) { |
|
33 | + function requireSubfolder($_dir = "./") { |
|
34 | 34 | $temp = subFolderFile($_dir); |
35 | 35 | foreach ($temp as $i) |
36 | 36 | jRequire($_dir."/".$i); |
37 | 37 | } |
38 | - function require_js( $_dir = "./" ) { |
|
38 | + function require_js($_dir = "./") { |
|
39 | 39 | $tempArray = []; |
40 | 40 | $temp = subFolderFile($_dir); |
41 | 41 | foreach ($temp as $i) |