summaryrefslogtreecommitdiffstats
path: root/system/classes
diff options
context:
space:
mode:
Diffstat (limited to 'system/classes')
-rw-r--r--system/classes/route.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/system/classes/route.php b/system/classes/route.php
index c1b9457..244a0c7 100644
--- a/system/classes/route.php
+++ b/system/classes/route.php
@@ -80,13 +80,19 @@ class Route {
$url = is_array($this->rule)?$this->rule[0]:$this->rule;
- $replace = array('(' => '', ')' => '');
+ $replace = array();
$params = array_merge($this->defaults, $params);
foreach($params as $key => $value)
$replace["<{$key}>"] = $value;
-
$url = str_replace(array_keys($replace), array_values($replace), $url);
+ $count = 1;
+ $chars='[^\(\)]*?';
+ while($count>0)
+ $url = preg_replace("#\({$chars}<{$chars}>{$chars}\)#", '', $url, -1, $count);
+
+ $url = str_replace(array('(', ')'), '', $url);
+
if ($absolute)
$url = $protocol.'://'.$_SERVER['HTTP_HOST'].$url;