mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
Generate mid/act URLs, too
This commit is contained in:
parent
607de73a76
commit
7fc3d83888
1 changed files with 7 additions and 4 deletions
|
|
@ -159,16 +159,16 @@ class Router
|
||||||
}
|
}
|
||||||
|
|
||||||
// If $mid and $act exist, try routes defined in the module.
|
// If $mid and $act exist, try routes defined in the module.
|
||||||
if (isset($args['mid']) && isset($args['act']))
|
if (isset($args['mid']) && isset($args['act']) && $rewrite_level == 2)
|
||||||
{
|
{
|
||||||
|
// Remove $mid and $act from arguments and work with the remainder.
|
||||||
|
$remaining_args = array_diff_key($args, ['mid' => 'mid', 'act' => 'act']);
|
||||||
|
|
||||||
// Check if $act has any routes defined.
|
// Check if $act has any routes defined.
|
||||||
$action_info = self::_getModuleActionInfo($args['mid']);
|
$action_info = self::_getModuleActionInfo($args['mid']);
|
||||||
$action = $action_info->action->{$args['act']};
|
$action = $action_info->action->{$args['act']};
|
||||||
if ($action->route)
|
if ($action->route)
|
||||||
{
|
{
|
||||||
// Remove $mid and $act from arguments and work with the remainder.
|
|
||||||
$remaining_args = array_diff_key($args, ['mid' => 'mid', 'act' => 'act']);
|
|
||||||
|
|
||||||
// If the action only has one route, select it.
|
// If the action only has one route, select it.
|
||||||
if (count($action->route) == 1)
|
if (count($action->route) == 1)
|
||||||
{
|
{
|
||||||
|
|
@ -209,6 +209,9 @@ class Router
|
||||||
// Add a query string for the remaining arguments.
|
// Add a query string for the remaining arguments.
|
||||||
return $replaced_route . (count($remaining_args) ? ('?' . http_build_query($remaining_args)) : '');
|
return $replaced_route . (count($remaining_args) ? ('?' . http_build_query($remaining_args)) : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Otherwise, try the generic mid/act pattern.
|
||||||
|
return $args['mid'] . '/' . $args['act'] . (count($remaining_args) ? ('?' . http_build_query($remaining_args)) : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no route matches, just create a query string.
|
// If no route matches, just create a query string.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue