diff options
author | Florian Pritz <bluewind@xinu.at> | 2015-03-08 14:31:31 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2015-03-08 14:31:31 +0100 |
commit | 0b47f4e306337d5a420642bff0b2fb4b8c446a11 (patch) | |
tree | 71a0ee3850f10a674c5a3f83ec918032d3be188f /application/libraries | |
parent | 579b7946c93058b2f028c8b68f76724915dcdd8e (diff) |
autoloader: support multiple search paths
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/libraries')
-rw-r--r-- | application/libraries/Customautoloader.php | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/application/libraries/Customautoloader.php b/application/libraries/Customautoloader.php index 1904977d7..91be09066 100644 --- a/application/libraries/Customautoloader.php +++ b/application/libraries/Customautoloader.php @@ -16,11 +16,16 @@ class CustomAutoloader{ public function loader($className) { - $path = APPPATH.str_replace('\\', DIRECTORY_SEPARATOR, $className).'.php'; - if (file_exists($path)) { - require $path; - return; + $base_paths = array( + APPPATH, + ); + + foreach ($base_paths as $base_path) { + $path = $base_path.str_replace('\\', DIRECTORY_SEPARATOR, $className).'.php'; + if (file_exists($path)) { + require $path; + return; + } } } } -?> |