diff --git a/class2.php b/class2.php index edfd97aaa..a38c3966b 100755 --- a/class2.php +++ b/class2.php @@ -261,73 +261,6 @@ $e107 = e107::getInstance()->initCore($e107_paths, e_ROOT, $sql_info, varset($E1 e107::getSingleton('eIPHandler'); // This auto-handles bans etc - -### NEW Register Autoload - do it asap -if(!function_exists('spl_autoload_register')) -{ - // PHP >= 5.1.2 required - die('Fatal exception - spl_autoload_* required.'); -} - - -// allow disable of autoloading - may be removed as e107::autoload_register() is flexible enough -if(!defset('E107_DISABLE_AUTOLOAD', false)) -{ - /** - * Generic autoloader. (didn't work while in e107_class.php) - * @example if your plugin calls 'use Xxxxx\Yyyyy\Zzzzz;' it will attempt to load: ./vendor/Xxxxx/Yyyyy/Zzzzz.php - */ - function autoloadPsr0($className) - { - $className = str_replace("_", "\\", $className); - $className = ltrim($className, '\\'); - $fileName = ''; - $namespace = ''; - - if ($lastNsPos = strripos($className, '\\')) - { - $namespace = substr($className, 0, $lastNsPos); - $className = substr($className, $lastNsPos + 1); - $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; - } - - $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; - - $fullPath = 'vendor'. DIRECTORY_SEPARATOR . $fileName; - - if(file_exists($fullPath)) - { - e107_require_once($fullPath); - } - else - { - return false; - } - - } - - e107::autoload_register(array('e107', 'autoload')); -// e107::autoload_register('autoloadPsr0'); // Generic 'use xxxx\yyyy\zzzz;' fix/solution for plugin developers. - -} - - function genericAutoload($className) - { - $className = str_replace("_", "\\", $className); - $className = ltrim($className, '\\'); - $fileName = ''; - $namespace = ''; - if ($lastNsPos = strripos($className, '\\')) - { - $namespace = substr($className, 0, $lastNsPos); - $className = substr($className, $lastNsPos + 1); - $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; - } - $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; - - e107_require_once($fileName); - } - /** * NEW - system security levels * Could be overridden by e107_config.php OR $CLASS2_INCLUDE script (if not set earlier) diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index 7119e5f30..74d60343f 100755 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -4830,6 +4830,13 @@ class e107 */ public static function autoload_register($function, $prepend = false) { + ### NEW Register Autoload - do it asap + if(!function_exists('spl_autoload_register')) + { + // PHP >= 5.1.2 required + die_fatal_error('Fatal exception - spl_autoload_* required.'); + } + if(!$prepend || false === ($registered = spl_autoload_functions())) { return spl_autoload_register($function); @@ -5155,3 +5162,5 @@ class e107 } + +e107::autoload_register(array(e107::class, 'autoload')); \ No newline at end of file diff --git a/install.php b/install.php index 4f89a2c24..8074303af 100644 --- a/install.php +++ b/install.php @@ -163,18 +163,6 @@ if($e107->initInstall($e107_paths, $ebase, $override)===false) unset($e107_paths,$override,$ebase); - - -### NEW Register Autoload - do it asap -if(!function_exists('spl_autoload_register')) -{ - // PHP >= 5.1.2 required - die_fatal_error('Fatal exception - spl_autoload_* required.'); -} - -// register core autoload -e107::autoload_register(array('e107', 'autoload')); - // NEW - session handler require_once(e_HANDLER.'session_handler.php'); define('e_SECURITY_LEVEL', e_session::SECURITY_LEVEL_NONE); diff --git a/thumb.php b/thumb.php index 07201ad98..1fafa0d81 100755 --- a/thumb.php +++ b/thumb.php @@ -156,7 +156,6 @@ class e_thumbpage @require($tmp.DIRECTORY_SEPARATOR.'core_functions.php'); //e107 class @require($tmp.DIRECTORY_SEPARATOR.'e107_class.php'); - e107::autoload_register(array('e107', 'autoload')); $e107_paths = compact( 'ADMIN_DIRECTORY',