Refactor project structure
This commit is contained in:
30
autoload.php
Normal file
30
autoload.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* luxtools plugin autoloader.
|
||||
*
|
||||
* DokuWiki will often load plugin entrypoints (syntax.php, action.php, ...)
|
||||
* directly. We keep those files small and place reusable code in src/.
|
||||
*
|
||||
* This file registers a minimal autoloader for the plugin namespace.
|
||||
*/
|
||||
|
||||
spl_autoload_register(static function ($class) {
|
||||
$prefix = 'dokuwiki\\plugin\\luxtools\\';
|
||||
$prefixLen = strlen($prefix);
|
||||
|
||||
if (strncmp($class, $prefix, $prefixLen) !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$relative = substr($class, $prefixLen);
|
||||
if ($relative === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$file = __DIR__ . '/src/' . str_replace('\\', '/', $relative) . '.php';
|
||||
|
||||
if (is_file($file)) {
|
||||
require_once $file;
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user