Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define('LIB_SIMPLEAUTOLOAD_AUTOLOAD_PATHS', [
- 'Your\\Plugin\\Namespace\\' => __DIR__ . '/src',
- ]);
- spl_autoload_register(function($class) {
- $logicalPath = strtr($class, '\\', DIRECTORY_SEPARATOR) . '.php';
- foreach (LIB_SIMPLEAUTOLOAD_AUTOLOAD_PATHS as $prefix => $path) {
- if (strpos($class, $prefix) !== 0)
- continue;
- $path = rtrim($path, '\\/');
- if (file_exists($dir = $path . DIRECTORY_SEPARATOR . substr($logicalPath, strlen($prefix))))
- include $dir;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement