Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Automatically load the given classes.
- *
- * Note: This function automaticly searches in the
- * ./library/PhpBakery and ./app folder.
- *
- * @param string $className The name of the class to be loaded.
- * @return boolean
- */
- function __autoload($className) {
- $className = ltrim($className, '\\');
- $fileName = '';
- $namespace = '';
- if ($pos = strripos($className, '\\')) {
- $namespace = substr($className, 0, $pos);
- $className = substr($className, $pos + 1);
- $fileName = str_replace('\\', DS, $namespace) . DS;
- }
- $fileName .= str_replace('_', DS, $className . EXT);
- if (file_exists(BASE_PATH . 'app' . DS . $fileName)) {
- require (BASE_PATH . 'app' . DS . $fileName);
- return TRUE;
- } else {
- require (SYS_PATH . $fileName);
- return TRUE;
- }
- return FALSE;
- }
Advertisement
Add Comment
Please, Sign In to add comment