mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Support custom namespaces in autoloader
This commit is contained in:
parent
4f9f641067
commit
32832d1ab2
2 changed files with 18 additions and 0 deletions
|
|
@ -120,6 +120,18 @@ spl_autoload_register(function($class_name)
|
|||
$lang_path = RX_BASEDIR . strtolower($matches[1]) . '/' . $lang_plugin . '/lang';
|
||||
}
|
||||
}
|
||||
elseif (isset($GLOBALS['RX_NAMESPACES']) && preg_match($GLOBALS['RX_NAMESPACES']['regexp'], $class_name, $matches))
|
||||
{
|
||||
$plugin_path = $GLOBALS['RX_NAMESPACES'][strtr($matches[1], '/', '\\')] ?? '';
|
||||
$dir = RX_BASEDIR . $plugin_path . '/' . strtolower($matches[2]);
|
||||
$filename1 = $dir . $matches[3] . '.php';
|
||||
$filename2 = $dir . strtolower($matches[3]) . '.php';
|
||||
if ($matches[1] !== 'Framework' && !empty($matches[3]))
|
||||
{
|
||||
$lang_plugin = array_last(explode('/', $plugin_path));
|
||||
$lang_path = RX_BASEDIR . $plugin_path . '/lang';
|
||||
}
|
||||
}
|
||||
elseif (isset($GLOBALS['RX_AUTOLOAD_FILE_MAP'][$lc_class_name = strtolower($class_name)]))
|
||||
{
|
||||
$filename1 = RX_BASEDIR . $GLOBALS['RX_AUTOLOAD_FILE_MAP'][$lc_class_name];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue