public static function register($base = false) { /* deprecated since 2.19.0 if (defined('COMPILER_INCLUDE_PATH')) { $paths = array(); $paths[] = BP . DS . 'app' . DS . 'code' . DS . 'local'; $paths[] = BP . DS . 'app' . DS . 'code' . DS . 'community'; #$paths[] = BP . DS . 'app' . DS . 'code' . DS . 'core'; #$paths[] = BP . DS . 'lib'; $appPath = implode(PS, $paths); set_include_path($appPath . PS . get_include_path()); } */ $rewriter = new Aitoc_Aitsys_Model_Rewriter(); $rewriter->preRegisterAutoloader($base); // unregistering all, and varien autoloaders to make our performing first $autoloaders = spl_autoload_functions(); if ($autoloaders and is_array($autoloaders) && !empty($autoloaders)) { foreach ($autoloaders as $autoloader) { spl_autoload_unregister($autoloader); } } if (version_compare(Mage::getVersion(), '1.3.1', '>')) { spl_autoload_unregister(array(Varien_Autoload::instance(), 'autoload')); } spl_autoload_register(array(self::instance(), 'autoload'), false); if (version_compare(Mage::getVersion(), '1.3.1', '>')) { Varien_Autoload::register(); } else { spl_autoload_register(array(self::instance(), 'performStandardAutoload')); #self::_loadOverwrittenClasses(); } }
public static function bootMagento($path = '.') { if (!self::isLoaded()) { foreach (self::$magento as $file) { require_once $path . $file; } \Varien_Autoload::register(); require_once $path . '/app/Mage.php'; $app = \Mage::app('default', 'store', array()); $app->getConfig()->loadEventObservers('global'); $app->getConfig()->loadEventObservers('front'); self::$loaded = true; } }
public static function register() { if (self::instance()->getIsRegistered()) { return; } $path = BP . DS . 'var' . DS . 'goodahead' . DS . 'etm' . DS . 'includes'; set_include_path($path . PS . get_include_path()); if (version_compare(PHP_VERSION, '5.3.0') >= 0) { spl_autoload_register(array(self::instance(), 'autoload'), false, true); } else { spl_autoload_register(array(self::instance(), 'autoload'), false); spl_autoload_unregister(array(Varien_Autoload::instance(), 'autoload')); Varien_Autoload::register(); } self::instance()->setIsRegistered(true); }
public function testRegisterClassmap() { define('OPTIMIZED_COMPOSER', true); $testClassname = 'c' . uniqid(); $testClassfilename = BP . '/lib/' . $testClassname . '.php'; $testClass = <<<CLASS <?php class {$testClassname} {} CLASS; testfuncs\create_structure(); file_put_contents($testClassfilename, $testClass); // Generate the classmap require BP . '/../src/classmap_generator.php'; Varien_Autoload::register(); $loader = (require __DIR__ . '/../vendor/autoload.php'); $classMap = $loader->getClassMap(); $this->assertArrayHasKey($testClassname, $classMap); unlink($testClassfilename); testfuncs\destroy_structure(); }
public static function register($base = false) { Mage::register('aitsys_autoload_initialized', true); $rewriter = new Aitoc_Aitsys_Model_Rewriter(); $rewriter->preRegisterAutoloader($base); // unregistering all, and varien autoloaders to make our performing first $autoloaders = spl_autoload_functions(); if ($autoloaders and is_array($autoloaders) && !empty($autoloaders)) { foreach ($autoloaders as $autoloader) { spl_autoload_unregister($autoloader); } } if (version_compare(Mage::getVersion(), '1.3.1', '>')) { spl_autoload_unregister(array(Varien_Autoload::instance(), 'autoload')); } spl_autoload_register(array(self::instance(), 'autoload'), false); if (version_compare(Mage::getVersion(), '1.3.1', '>')) { Varien_Autoload::register(); } else { spl_autoload_register(array(self::instance(), 'performStandardAutoload')); } }
include_once "Mage_Core_functions.php"; include_once "Varien_Autoload.php"; } else { /** * Set include path */ $paths[] = BP . DS . 'app' . DS . 'code' . DS . 'local'; $paths[] = BP . DS . 'app' . DS . 'code' . DS . 'community'; $paths[] = BP . DS . 'app' . DS . 'code' . DS . 'core'; $paths[] = BP . DS . 'lib'; $appPath = implode(PS, $paths); set_include_path($appPath . PS . Mage::registry('original_include_path')); include_once "Mage/Core/functions.php"; include_once "Varien/Autoload.php"; } Varien_Autoload::register(); /** * Main Mage hub class * * @author Magento Core Team <*****@*****.**> */ final class Mage { /** * Registry collection * * @var array */ private static $_registry = array(); /** * Application root absolute path