Last active
August 29, 2015 13:57
-
-
Save code-poel/9608459 to your computer and use it in GitHub Desktop.
Magento Autoload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| static public function register() | |
| { | |
| spl_autoload_register(array(self::instance(), 'autoload')); | |
| } | |
| /** | |
| * Load class source code | |
| * | |
| * @param string $class | |
| */ | |
| public function autoload($class) | |
| { | |
| if ($this->_collectClasses) { | |
| $this->_arrLoadedClasses[self::$_scope][] = $class; | |
| } | |
| if ($this->_isIncludePathDefined) { | |
| $classFile = COMPILER_INCLUDE_PATH . DIRECTORY_SEPARATOR . $class; | |
| } else { | |
| $classFile = str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('_', ' ', $class))); | |
| } | |
| $classFile.= '.php'; | |
| //echo $classFile;die(); | |
| return include $classFile; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment