diff options
Diffstat (limited to 'include/functions.php')
-rw-r--r-- | include/functions.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/include/functions.php b/include/functions.php index caea2576a..4dc286eb6 100644 --- a/include/functions.php +++ b/include/functions.php @@ -5,7 +5,19 @@ $fetch_last_error = false; $pluginhost = false; - require_once "classloader.php"; + function __autoload($class) { + $class_file1 = str_replace("_", "/", basename($class)); // PSR-0 + $class_file2 = str_replace("_", "/", strtolower(basename($class))); + + $file1 = dirname(__FILE__)."/../classes/$class_file1.php"; + $file2 = dirname(__FILE__)."/../classes/$class_file2.php"; + + if (file_exists($file1)) { + require $file1; + } elseif (file_exists($file2)) { + require $file2; + } + } mb_internal_encoding("UTF-8"); date_default_timezone_set('UTC'); @@ -3891,4 +3903,4 @@ return in_array($interface, class_implements($class)); } -?> +?>
\ No newline at end of file |