@@ -25,15 +25,20 @@ public function __construct($fnames = null, $wdir = null)
25
25
// print "\n<br/>Loading sources..";
26
26
$ this ->load_sources ();
27
27
// print "\n<br/>Loaded sources..";
28
- }
28
+ $ this ->include_autoloads ();
29
+ // print "\n<br/>Loaded autoloads..";
30
+ }
29
31
30
32
public function default_source () {
31
33
if (file_exists ( $ v = ($ this ->workingDir . "/ " . dependency_manager::DEPXML ))) return $ v ;
32
34
if (file_exists ( $ v = (__DIR__ . "/ " . dependency_manager::DEPXML ))) return $ v ;
33
- $ d = __DIR__ ;
35
+ $ d = realpath ( __DIR__ ) ;
34
36
while (strlen ($ d ) >= strlen ($ _SERVER ["DOCUMENT_ROOT " ])) {
35
- $ d = dirname ($ d );
36
- print ("\nd= $ d " );
37
+ if ($ d == ". " ) break ;
38
+ $ dd = dirname ($ d );
39
+ if ($ dd == $ d ) break ;
40
+ $ d = $ dd ;
41
+ //print ("\nd=$d");
37
42
if (file_exists ( $ v = ("$ d/ " . dependency_manager::DEPXML ))) return $ v ;
38
43
}
39
44
return __DIR__ . "/ " . dependency_manager::DEPXML ;
@@ -43,9 +48,10 @@ public function default_source() {
43
48
public function load_sources () {
44
49
require_once ("phar:// " . __DIR__ . "/xml-file.phar/src/class-xml-file.php " );
45
50
$ this ->dependencies = array ();
46
- foreach ($ this ->sources as $ source ) {
47
- $ this ->dependencies [] = new xml_file ($ source );
48
- }
51
+ if (is_array ($ this ->sources ))
52
+ foreach ($ this ->sources as $ source ) {
53
+ $ this ->dependencies [] = new xml_file ($ source );
54
+ }
49
55
$ this ->ensure_dependencies ();
50
56
}
51
57
@@ -164,6 +170,8 @@ public function include($fname)
164
170
public function include_once ($ fname ) { return $ this ->include ($ fname ); }
165
171
public function require ($ fname ) { return $ this ->include ($ fname ); }
166
172
public function require_once ($ fname ) { return $ this ->include ($ fname ); }
173
+
174
+ public function include_autoloads () { $ this ->include ("autoload.php " ); }
167
175
}
168
176
169
177
if (!function_exists ("dependency_manager " )) {
0 commit comments