Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Plugin autoloader. Coverts class name to path and loads it
- * @param string $className
- */
- function autoload($className)
- {
- if (class_exists($className))
- return;
- if (self::$pluginAbsolutePath == NULL)
- self::$pluginAbsolutePath = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR
- . 'foo' . DIRECTORY_SEPARATOR;
- $medium = str_replace('bar', 'classes', strtolower($className));
- $path = str_replace('_', DIRECTORY_SEPARATOR, $medium);
- // Putting altogether
- $path = self::$pluginAbsolutePath . $path . '.php';
- if (file_exists($path) and is_readable($path))
- require_once $path;
- }
Add Comment
Please, Sign In to add comment