mirror of
https://github.com/Karaka-Management/Build.git
synced 2026-01-11 19:58:41 +00:00
58 lines
1.5 KiB
PHP
Executable File
58 lines
1.5 KiB
PHP
Executable File
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
function module_autoloader($class) {
|
|
$paths = [
|
|
__DIR__ . '/../../',
|
|
__DIR__ . '/../../MainRepository/',
|
|
__DIR__ . '/../../MainRepository/Resources',
|
|
__DIR__ . '/../../MainRepository/Resources/tcpdf',
|
|
__DIR__ . '/../../MainRepository/Resources/Stripe',
|
|
__DIR__ . '/../../Resources',
|
|
__DIR__ . '/../../Resources/tcpdf',
|
|
__DIR__ . '/../../Resources/Stripe',
|
|
];
|
|
|
|
$class = \ltrim($class, '\\');
|
|
$class = \strtr($class, '_\\', '//');
|
|
|
|
if (\stripos($class, 'Web/Backend') !== false || \stripos($class, 'Web/Api') !== false) {
|
|
$class = \str_replace('Web/', 'Install/Application/', $class);
|
|
}
|
|
|
|
$class2 = $class;
|
|
$class3 = $class;
|
|
|
|
$pos = \stripos($class, '/');
|
|
if ($pos !== false) {
|
|
$class2 = \substr($class, $pos + 1);
|
|
}
|
|
|
|
if ($pos !== false) {
|
|
$pos = \stripos($class, '/', $pos + 1);
|
|
|
|
if ($pos !== false) {
|
|
$class3 = \substr($class, $pos + 1);
|
|
}
|
|
}
|
|
|
|
foreach ($paths as $path) {
|
|
if (\is_file($file = $path . $class2 . '.php') && \stripos($file, $class2) !== false) {
|
|
include_once $file;
|
|
|
|
return;
|
|
} elseif (\is_file($file = $path . $class3 . '.php') && \stripos($file, $class3) !== false) {
|
|
include_once $file;
|
|
|
|
return;
|
|
} elseif (\is_file($file = $path . $class . '.php')) {
|
|
include_once $file;
|
|
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
spl_autoload_register('module_autoloader');
|