|
1
|
|
|
<?php |
|
2
|
|
|
function requireComponent( $_path, $_local = true, $_stack = null ) { |
|
|
|
|
|
|
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
|
|
|
} |
|
9
|
|
|
function requireComponents( $_path, $_local = true, $_stack = null ) { |
|
|
|
|
|
|
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, 0); |
|
16
|
|
|
} |
|
17
|
|
|
} else |
|
18
|
|
|
requireError($_path); |
|
19
|
|
|
} |
|
20
|
|
|
function requireError( $_path ) { |
|
21
|
|
|
global $jConfig; |
|
|
|
|
|
|
22
|
|
|
if( $jConfig->DEBUG == 1 ) |
|
23
|
|
|
echo "Error load ($_path)<br>"; |
|
24
|
|
|
} |
|
25
|
|
|
function isPhp ( $_file ) { |
|
26
|
|
|
if(!is_file($_file)) return false; |
|
27
|
|
|
$info = pathinfo($_file); |
|
28
|
|
|
return ($info["extension"] == "php") || ($info["extension"] == "PHP"); |
|
29
|
|
|
} |
|
30
|
|
|
function requireModules( $_path, $_local = true, $_stack = null ) { |
|
|
|
|
|
|
31
|
|
|
$path = getJFolder($_path, $_local, debug_backtrace()); |
|
32
|
|
|
$subFolders = subFolderDir($path); |
|
33
|
|
|
foreach ($subFolders as $i) { |
|
34
|
|
|
requireComponents($path."/".$i, false, 0); |
|
35
|
|
|
} |
|
36
|
|
|
} |
|
37
|
|
|
function jRequire( $_path, $_local = true, $_stack = null ) { |
|
38
|
|
|
$path = getJFolder($_path, $_local, debug_backtrace()); |
|
39
|
|
|
require_once( $path ); |
|
40
|
|
|
} |
|
41
|
|
|
function getJFolder( $_path, $_local, $_stack ) { |
|
42
|
|
|
if($_local) { |
|
43
|
|
|
$stackInfo = $_stack; |
|
44
|
|
|
$folder = dirname($stackInfo[0]["file"]); |
|
45
|
|
|
$file = "$folder/$_path"; |
|
46
|
|
|
} else |
|
47
|
|
|
$file = $_path; |
|
48
|
|
|
return $file; |
|
49
|
|
|
} |
|
50
|
|
|
?> |
|
|
|
|
|
|
51
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.