@@ -1,64 +1,64 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | function requireComponent( $_path, $_local = true ) { |
| 3 | - $path = getJFolder($_path, $_local, debug_backtrace()); |
|
| 4 | - if(file_exists($path) && isPhp($path)) |
|
| 5 | - jRequire($path, false, 0); |
|
| 6 | - else |
|
| 7 | - requireError($_path); |
|
| 3 | + $path = getJFolder($_path, $_local, debug_backtrace()); |
|
| 4 | + if(file_exists($path) && isPhp($path)) |
|
| 5 | + jRequire($path, false, 0); |
|
| 6 | + else |
|
| 7 | + requireError($_path); |
|
| 8 | 8 | } |
| 9 | 9 | function requireComponents( $_path, $_local = true ) { |
| 10 | - $path = getJFolder($_path, $_local, debug_backtrace()); |
|
| 11 | - if(file_exists($path)) { |
|
| 12 | - $files = subFolderFile($path); |
|
| 13 | - foreach ($files as $i) |
|
| 14 | - if(isPhp("$path/$i")) |
|
| 15 | - requireComponent($path."/".$i, false); |
|
| 16 | - } else |
|
| 17 | - requireError($_path); |
|
| 10 | + $path = getJFolder($_path, $_local, debug_backtrace()); |
|
| 11 | + if(file_exists($path)) { |
|
| 12 | + $files = subFolderFile($path); |
|
| 13 | + foreach ($files as $i) |
|
| 14 | + if(isPhp("$path/$i")) |
|
| 15 | + requireComponent($path."/".$i, false); |
|
| 16 | + } else |
|
| 17 | + requireError($_path); |
|
| 18 | 18 | } |
| 19 | 19 | function requireError( $_path ) { |
| 20 | - global $DEBUG; |
|
| 21 | - if( $DEBUG == 1 ) |
|
| 22 | - echo "Error load ($_path)<br>"; |
|
| 20 | + global $DEBUG; |
|
| 21 | + if( $DEBUG == 1 ) |
|
| 22 | + echo "Error load ($_path)<br>"; |
|
| 23 | 23 | } |
| 24 | 24 | function isPhp ( $_file ) { |
| 25 | - if(!is_file($_file)) return false; |
|
| 26 | - $info = pathinfo($_file); |
|
| 27 | - return ($info["extension"] == "php") || ($info["extension"] == "PHP"); |
|
| 25 | + if(!is_file($_file)) return false; |
|
| 26 | + $info = pathinfo($_file); |
|
| 27 | + return ($info["extension"] == "php") || ($info["extension"] == "PHP"); |
|
| 28 | 28 | } |
| 29 | 29 | function requireModules( $_path, $_local = true ) { |
| 30 | - $path = getJFolder($_path, $_local, debug_backtrace()); |
|
| 31 | - $subFolders = subFolderDir($path); |
|
| 32 | - foreach ($subFolders as $i) |
|
| 33 | - requireComponents("$path/$i", false); |
|
| 30 | + $path = getJFolder($_path, $_local, debug_backtrace()); |
|
| 31 | + $subFolders = subFolderDir($path); |
|
| 32 | + foreach ($subFolders as $i) |
|
| 33 | + requireComponents("$path/$i", false); |
|
| 34 | 34 | } |
| 35 | 35 | function jRequire( $_path, $_local = true ) { |
| 36 | - $path = getJFolder($_path, $_local, debug_backtrace()); |
|
| 37 | - require_once( $path ); |
|
| 36 | + $path = getJFolder($_path, $_local, debug_backtrace()); |
|
| 37 | + require_once( $path ); |
|
| 38 | 38 | } |
| 39 | 39 | function getJFolder( $_path, $_local, $_stack ) { |
| 40 | - if($_local) { |
|
| 41 | - $stackInfo = $_stack; |
|
| 42 | - $folder = dirname($stackInfo[0]["file"]); |
|
| 43 | - $file = "$folder/$_path"; |
|
| 44 | - } else |
|
| 45 | - $file = $_path; |
|
| 46 | - return $file; |
|
| 40 | + if($_local) { |
|
| 41 | + $stackInfo = $_stack; |
|
| 42 | + $folder = dirname($stackInfo[0]["file"]); |
|
| 43 | + $file = "$folder/$_path"; |
|
| 44 | + } else |
|
| 45 | + $file = $_path; |
|
| 46 | + return $file; |
|
| 47 | 47 | } |
| 48 | 48 | function requireModulesList( $_path ) { |
| 49 | - if(!file_exists($_path)) |
|
| 50 | - return; |
|
| 51 | - $data = file_get_contents($_path); |
|
| 52 | - $data = json_decode($data); |
|
| 53 | - if($data === NULL) |
|
| 54 | - throw new Exception("Error in the file format [$_path]", 1); |
|
| 55 | - foreach ($data as $item) { |
|
| 56 | - if(substr($item, -1) == "*") |
|
| 57 | - requireModules(substr($item, 0, -2), false); |
|
| 58 | - else { |
|
| 59 | - $path = getJFolder($item, false, debug_backtrace()); |
|
| 60 | - requireComponents("$path", false); |
|
| 61 | - } |
|
| 62 | - } |
|
| 49 | + if(!file_exists($_path)) |
|
| 50 | + return; |
|
| 51 | + $data = file_get_contents($_path); |
|
| 52 | + $data = json_decode($data); |
|
| 53 | + if($data === NULL) |
|
| 54 | + throw new Exception("Error in the file format [$_path]", 1); |
|
| 55 | + foreach ($data as $item) { |
|
| 56 | + if(substr($item, -1) == "*") |
|
| 57 | + requireModules(substr($item, 0, -2), false); |
|
| 58 | + else { |
|
| 59 | + $path = getJFolder($item, false, debug_backtrace()); |
|
| 60 | + requireComponents("$path", false); |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | 63 | } |
| 64 | 64 | ?> |
@@ -1,43 +1,43 @@ discard block |
||
| 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); |
| 16 | 16 | } else |
| 17 | 17 | requireError($_path); |
| 18 | 18 | } |
| 19 | - function requireError( $_path ) { |
|
| 19 | + function requireError($_path) { |
|
| 20 | 20 | global $DEBUG; |
| 21 | - if( $DEBUG == 1 ) |
|
| 21 | + if ($DEBUG == 1) |
|
| 22 | 22 | echo "Error load ($_path)<br>"; |
| 23 | 23 | } |
| 24 | - function isPhp ( $_file ) { |
|
| 25 | - if(!is_file($_file)) return false; |
|
| 24 | + function isPhp($_file) { |
|
| 25 | + if (!is_file($_file)) return false; |
|
| 26 | 26 | $info = pathinfo($_file); |
| 27 | 27 | return ($info["extension"] == "php") || ($info["extension"] == "PHP"); |
| 28 | 28 | } |
| 29 | - function requireModules( $_path, $_local = true ) { |
|
| 29 | + function requireModules($_path, $_local = true) { |
|
| 30 | 30 | $path = getJFolder($_path, $_local, debug_backtrace()); |
| 31 | 31 | $subFolders = subFolderDir($path); |
| 32 | 32 | foreach ($subFolders as $i) |
| 33 | 33 | requireComponents("$path/$i", false); |
| 34 | 34 | } |
| 35 | - function jRequire( $_path, $_local = true ) { |
|
| 35 | + function jRequire($_path, $_local = true) { |
|
| 36 | 36 | $path = getJFolder($_path, $_local, debug_backtrace()); |
| 37 | - require_once( $path ); |
|
| 37 | + require_once($path); |
|
| 38 | 38 | } |
| 39 | - function getJFolder( $_path, $_local, $_stack ) { |
|
| 40 | - if($_local) { |
|
| 39 | + function getJFolder($_path, $_local, $_stack) { |
|
| 40 | + if ($_local) { |
|
| 41 | 41 | $stackInfo = $_stack; |
| 42 | 42 | $folder = dirname($stackInfo[0]["file"]); |
| 43 | 43 | $file = "$folder/$_path"; |
@@ -45,15 +45,15 @@ discard block |
||
| 45 | 45 | $file = $_path; |
| 46 | 46 | return $file; |
| 47 | 47 | } |
| 48 | - function requireModulesList( $_path ) { |
|
| 49 | - if(!file_exists($_path)) |
|
| 48 | + function requireModulesList($_path) { |
|
| 49 | + if (!file_exists($_path)) |
|
| 50 | 50 | return; |
| 51 | 51 | $data = file_get_contents($_path); |
| 52 | 52 | $data = json_decode($data); |
| 53 | - if($data === NULL) |
|
| 53 | + if ($data === NULL) |
|
| 54 | 54 | throw new Exception("Error in the file format [$_path]", 1); |
| 55 | 55 | foreach ($data as $item) { |
| 56 | - if(substr($item, -1) == "*") |
|
| 56 | + if (substr($item, -1) == "*") |
|
| 57 | 57 | requireModules(substr($item, 0, -2), false); |
| 58 | 58 | else { |
| 59 | 59 | $path = getJFolder($item, false, debug_backtrace()); |
@@ -1,36 +1,43 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | function requireComponent( $_path, $_local = true ) { |
| 3 | 3 | $path = getJFolder($_path, $_local, debug_backtrace()); |
| 4 | - if(file_exists($path) && isPhp($path)) |
|
| 5 | - jRequire($path, false, 0); |
|
| 6 | - else |
|
| 7 | - requireError($_path); |
|
| 4 | + if(file_exists($path) && isPhp($path)) { |
|
| 5 | + jRequire($path, false, 0); |
|
| 6 | + } else { |
|
| 7 | + requireError($_path); |
|
| 8 | + } |
|
| 8 | 9 | } |
| 9 | 10 | function requireComponents( $_path, $_local = true ) { |
| 10 | 11 | $path = getJFolder($_path, $_local, debug_backtrace()); |
| 11 | 12 | if(file_exists($path)) { |
| 12 | 13 | $files = subFolderFile($path); |
| 13 | - foreach ($files as $i) |
|
| 14 | - if(isPhp("$path/$i")) |
|
| 14 | + foreach ($files as $i) { |
|
| 15 | + if(isPhp("$path/$i")) |
|
| 15 | 16 | requireComponent($path."/".$i, false); |
| 16 | - } else |
|
| 17 | - requireError($_path); |
|
| 17 | + } |
|
| 18 | + } else { |
|
| 19 | + requireError($_path); |
|
| 20 | + } |
|
| 18 | 21 | } |
| 19 | 22 | function requireError( $_path ) { |
| 20 | 23 | global $DEBUG; |
| 21 | - if( $DEBUG == 1 ) |
|
| 22 | - echo "Error load ($_path)<br>"; |
|
| 24 | + if( $DEBUG == 1 ) { |
|
| 25 | + echo "Error load ($_path)<br>"; |
|
| 26 | + } |
|
| 23 | 27 | } |
| 24 | 28 | function isPhp ( $_file ) { |
| 25 | - if(!is_file($_file)) return false; |
|
| 29 | + if(!is_file($_file)) { |
|
| 30 | + return false; |
|
| 31 | + } |
|
| 26 | 32 | $info = pathinfo($_file); |
| 27 | 33 | return ($info["extension"] == "php") || ($info["extension"] == "PHP"); |
| 28 | 34 | } |
| 29 | 35 | function requireModules( $_path, $_local = true ) { |
| 30 | 36 | $path = getJFolder($_path, $_local, debug_backtrace()); |
| 31 | 37 | $subFolders = subFolderDir($path); |
| 32 | - foreach ($subFolders as $i) |
|
| 33 | - requireComponents("$path/$i", false); |
|
| 38 | + foreach ($subFolders as $i) { |
|
| 39 | + requireComponents("$path/$i", false); |
|
| 40 | + } |
|
| 34 | 41 | } |
| 35 | 42 | function jRequire( $_path, $_local = true ) { |
| 36 | 43 | $path = getJFolder($_path, $_local, debug_backtrace()); |
@@ -41,21 +48,24 @@ discard block |
||
| 41 | 48 | $stackInfo = $_stack; |
| 42 | 49 | $folder = dirname($stackInfo[0]["file"]); |
| 43 | 50 | $file = "$folder/$_path"; |
| 44 | - } else |
|
| 45 | - $file = $_path; |
|
| 51 | + } else { |
|
| 52 | + $file = $_path; |
|
| 53 | + } |
|
| 46 | 54 | return $file; |
| 47 | 55 | } |
| 48 | 56 | function requireModulesList( $_path ) { |
| 49 | - if(!file_exists($_path)) |
|
| 50 | - return; |
|
| 57 | + if(!file_exists($_path)) { |
|
| 58 | + return; |
|
| 59 | + } |
|
| 51 | 60 | $data = file_get_contents($_path); |
| 52 | 61 | $data = json_decode($data); |
| 53 | - if($data === NULL) |
|
| 54 | - throw new Exception("Error in the file format [$_path]", 1); |
|
| 62 | + if($data === NULL) { |
|
| 63 | + throw new Exception("Error in the file format [$_path]", 1); |
|
| 64 | + } |
|
| 55 | 65 | foreach ($data as $item) { |
| 56 | - if(substr($item, -1) == "*") |
|
| 57 | - requireModules(substr($item, 0, -2), false); |
|
| 58 | - else { |
|
| 66 | + if(substr($item, -1) == "*") { |
|
| 67 | + requireModules(substr($item, 0, -2), false); |
|
| 68 | + } else { |
|
| 59 | 69 | $path = getJFolder($item, false, debug_backtrace()); |
| 60 | 70 | requireComponents("$path", false); |
| 61 | 71 | } |