From 57b8469e674ef082c30b7d1de40d5d53d50b251b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 15 Mar 2013 14:15:06 +0400 Subject: [PATCH] db: use builtin classloader, lowercase class files --- classes/{Db/Abstract.php => db/abstract.php} | 0 classes/{Db/Interface.php => db/interface.php} | 0 classes/{Db/Mysql.php => db/mysql.php} | 0 classes/{Db/Pgsql.php => db/pgsql.php} | 0 include/classloader.php | 15 +++++++++++++++ include/db.php | 10 +++------- include/functions.php | 16 ++-------------- 7 files changed, 20 insertions(+), 21 deletions(-) rename classes/{Db/Abstract.php => db/abstract.php} (100%) rename classes/{Db/Interface.php => db/interface.php} (100%) rename classes/{Db/Mysql.php => db/mysql.php} (100%) rename classes/{Db/Pgsql.php => db/pgsql.php} (100%) create mode 100644 include/classloader.php diff --git a/classes/Db/Abstract.php b/classes/db/abstract.php similarity index 100% rename from classes/Db/Abstract.php rename to classes/db/abstract.php diff --git a/classes/Db/Interface.php b/classes/db/interface.php similarity index 100% rename from classes/Db/Interface.php rename to classes/db/interface.php diff --git a/classes/Db/Mysql.php b/classes/db/mysql.php similarity index 100% rename from classes/Db/Mysql.php rename to classes/db/mysql.php diff --git a/classes/Db/Pgsql.php b/classes/db/pgsql.php similarity index 100% rename from classes/Db/Pgsql.php rename to classes/db/pgsql.php diff --git a/include/classloader.php b/include/classloader.php new file mode 100644 index 00000000..4b8b3738 --- /dev/null +++ b/include/classloader.php @@ -0,0 +1,15 @@ + diff --git a/include/db.php b/include/db.php index 28718fb0..020fd08a 100644 --- a/include/db.php +++ b/include/db.php @@ -1,13 +1,9 @@ quote($str); } -?> \ No newline at end of file +?> diff --git a/include/functions.php b/include/functions.php index 4dc286eb..caea2576 100644 --- a/include/functions.php +++ b/include/functions.php @@ -5,19 +5,7 @@ $fetch_last_error = false; $pluginhost = false; - 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; - } - } + require_once "classloader.php"; mb_internal_encoding("UTF-8"); date_default_timezone_set('UTC'); @@ -3903,4 +3891,4 @@ return in_array($interface, class_implements($class)); } -?> \ No newline at end of file +?> -- 2.39.5