Allow plugins to define autoloaded classes - a class such as Foobar\Class will load addon/foobar/Class.php and also Foobar\Category\Class.php will load addon/foobar/Category/Class.php
This commit is contained in:
parent
269055e71c
commit
b497faee27
11
boot.php
11
boot.php
@ -632,6 +632,17 @@ class ZotlabsAutoloader {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
$arr = explode('\\',$className);
|
||||
if($arr && count($arr) > 1) {
|
||||
$filename = 'addon/' . lcfirst($arr[0]) . '/' . ucfirst($arr[1]) . ((count($arr) === 2) ? '.php' : '/' . ucfirst($arr[2]) . ".php");
|
||||
if (file_exists($filename)) {
|
||||
include($filename);
|
||||
if (class_exists($className)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user