Adjust some parts of Context class for better integration with Router

This commit is contained in:
Kijin Sung 2020-06-12 14:54:05 +09:00
parent baddbd3cba
commit a680f89326
3 changed files with 28 additions and 20 deletions

View file

@ -44,9 +44,10 @@ class Router
/**
* Extract request arguments from the current URL.
*
* @param int $rewrite_level
* @return array
*/
public static function getRequestArguments(): array
public static function getRequestArguments(int $rewrite_level): array
{
// Get the local part of the current URL.
$url = $_SERVER['REQUEST_URI'];
@ -71,6 +72,17 @@ class Router
return array();
}
// Try to detect the prefix. This might be $mid.
if ($rewrite_level > 0 && preg_match('#^([a-zA-Z0-9_-]+)#', $url, $matches))
{
$prefix = $matches[1];
$module_info = \ModuleModel::getModuleInfoByMid($prefix);
if ($module_info && $module_info->module)
{
// TODO
}
}
// Try XE-compatible rules.
foreach (self::$_xe_compatible_rules as $regexp => $additional_args)
{