diff options
author | vipsoft <vipsoft@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2009-06-15 19:35:51 +0400 |
---|---|---|
committer | vipsoft <vipsoft@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2009-06-15 19:35:51 +0400 |
commit | 1543bf05e2c3b90613937d4f6832d853bd46656e (patch) | |
tree | a1bc6a52960be9a42850974e61b72f6e7794386c /index.php | |
parent | 02fd4ef95602bfe3d45a197d1b806d61cc24fd90 (diff) |
refs #620, refs #803 - refactor autoloader into core/Loader.php (class
Piwik_Loader); remove unnecessary require_once in core/Common.php
Diffstat (limited to 'index.php')
-rwxr-xr-x | index.php | 40 |
1 files changed, 2 insertions, 38 deletions
@@ -26,44 +26,6 @@ if((@include "Version.php") === false || !class_exists('Piwik_Version', false)) . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/plugins'); } -function piwikAutoloader($class) -{ - $class = str_replace('_', '/', $class) . '.php'; - if(substr($class, 0, 6) === 'Piwik/') - { - $class = substr($class, 6); - if(file_exists(PIWIK_INCLUDE_PATH . "/core/" . $class)) - { - include_once PIWIK_INCLUDE_PATH . "/core/" . $class; - } - else - { - include_once PIWIK_INCLUDE_PATH . "/plugins/" . $class; - } - } - else - { - include_once PIWIK_INCLUDE_PATH . "/libs/" . $class; - } -} - -// Note: only one __autoload per PHP instance -if(function_exists('spl_autoload_register')) -{ - spl_autoload_register('piwikAutoloader'); // use the SPL autoload stack - if(function_exists('__autoload')) - { - spl_auto_register('__autoload'); - } -} -else -{ - function __autoload($class) - { - piwikAutoloader($class); - } -} - require_once "core/testMinimumPhpVersion.php"; // NOTE: the code above this comment must be PHP4 compatible @@ -86,6 +48,8 @@ if(strlen(session_id()) === 0) if(!defined('PIWIK_ENABLE_DISPATCH') || PIWIK_ENABLE_DISPATCH) { + require_once "core/Loader.php"; + $controller = Piwik_FrontController::getInstance(); $controller->init(); $controller->dispatch(); |