From 0b47f4e306337d5a420642bff0b2fb4b8c446a11 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 8 Mar 2015 14:31:31 +0100 Subject: autoloader: support multiple search paths Signed-off-by: Florian Pritz --- application/libraries/Customautoloader.php | 15 ++++++++++----- 1 file 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; + } } } } -?> -- cgit v1.2.3-24-g4f1b