mirror of
https://github.com/dannyvankooten/AltoRouter.git
synced 2025-08-05 16:07:32 +02:00
Fixed generate() replacing leaving [s, made empty optional parameters blank
This commit is contained in:
@@ -65,8 +65,14 @@ class AltoRouter {
|
||||
foreach($matches as $match) {
|
||||
list($block, $pre, $type, $param, $optional) = $match;
|
||||
|
||||
if ($pre) {
|
||||
$block = substr($block, 1);
|
||||
}
|
||||
|
||||
if(isset($params[$param])) {
|
||||
$url = str_replace(substr($block,1), $params[$param], $url);
|
||||
$url = str_replace($block, $params[$param], $url);
|
||||
} elseif ($optional) {
|
||||
$url = str_replace($block, '', $url);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user