static function init($options) { switch ($options['type']) { case self::CACHE_TYPE: self::$_instance = new RM_Cache_Loader($options['filepath']); break; case self::SIMPLE_TYPE: self::$_instance = new RM_Simple_Loader(); break; default: throw new RM_Exception('Wrong autoloader type'); } spl_autoload_register(array('RM_AutoLoader', 'autoload')); }
public function initAutoload() { $rootPath = $this->_rootPath; $pathes = array(); $pathes[] = implode(DIRECTORY_SEPARATOR, array($rootPath, 'RM', 'system', 'application', 'classes')); $pathes[] = implode(DIRECTORY_SEPARATOR, array($rootPath, 'RM', 'system', 'application', 'controllers')); $pathes[] = implode(DIRECTORY_SEPARATOR, array($rootPath, 'RM', 'system', 'application', 'models')); $pathes[] = implode(DIRECTORY_SEPARATOR, array($rootPath, 'RM', 'system', 'libs')); $pathes[] = implode(DIRECTORY_SEPARATOR, array($rootPath, 'RM', 'system', 'libs', 'Dwoo')); $pathes[] = implode(DIRECTORY_SEPARATOR, array($rootPath, 'RM', 'system', 'libs', 'pclZip')); $pathes = array_merge($pathes, $this->_getExtraPathes()); $pathes[] = get_include_path(); $pathString = implode(PATH_SEPARATOR, $pathes); set_include_path($pathString); //Old: Zend_Autoloader //include_once "Zend".DIRECTORY_SEPARATOR."Loader".DIRECTORY_SEPARATOR."Autoloader.php"; //$autoloader = Zend_Loader_Autoloader::getInstance(); //$autoloader->registerNamespace(array('RM_', 'Dwoo_')); include_once implode(DIRECTORY_SEPARATOR, array($rootPath, 'RM', 'system', 'application', 'classes', 'RM', 'AutoLoader.php')); RM_AutoLoader::init($this->_getAutoloaderOptions()); include_once "Dwoo.php"; include_once "pclzip.lib.php"; }