summaryrefslogtreecommitdiff
path: root/framework/Web/TUrlMapping.php
diff options
context:
space:
mode:
authorxue <>2007-08-11 23:37:28 +0000
committerxue <>2007-08-11 23:37:28 +0000
commit237411ea575639987ab0522eb3be672bc9edee78 (patch)
tree9d46679c930eb51f9f9e5eac084988a7212f049a /framework/Web/TUrlMapping.php
parent8011f9cec174c781bd975bb4c7094da2e0209bae (diff)
more fix on TUrlMapping
Diffstat (limited to 'framework/Web/TUrlMapping.php')
-rw-r--r--framework/Web/TUrlMapping.php27
1 files changed, 24 insertions, 3 deletions
diff --git a/framework/Web/TUrlMapping.php b/framework/Web/TUrlMapping.php
index 987e725d..126a3b38 100644
--- a/framework/Web/TUrlMapping.php
+++ b/framework/Web/TUrlMapping.php
@@ -398,6 +398,8 @@ class TUrlMappingPattern extends TComponent
private $_manager;
+ private $_caseSensitive=true;
+
/**
* Constructor.
* @param TUrlManager the URL manager instance
@@ -444,8 +446,11 @@ class TUrlMappingPattern extends TComponent
}
$params[]='/';
$values[]='\\/';
- $regexp=str_replace($params,$values,trim($this->getPattern(),'/'));
- return '/^'.$regexp.'$/u';
+ $regexp=str_replace($params,$values,trim($this->getPattern(),'/').'/');
+ $regexp='/^'.$regexp.'$/u';
+ if(!$this->getCaseSensitive())
+ $regexp.='i';
+ return $regexp;
}
/**
@@ -465,6 +470,22 @@ class TUrlMappingPattern extends TComponent
}
/**
+ * @return boolean whether the {@link getPattern Pattern} should be treated as case sensititve. Defaults to true.
+ */
+ public function getCaseSensitive()
+ {
+ return $this->_caseSensitive;
+ }
+
+ /**
+ * @param boolean whether the {@link getPattern Pattern} should be treated as case sensititve.
+ */
+ public function setCaseSensitive($value)
+ {
+ $this->_caseSensitive=TPropertyValue::ensureBoolean($value);
+ }
+
+ /**
* @param string service parameter, such as page class name.
*/
public function setServiceParameter($value)
@@ -540,7 +561,7 @@ class TUrlMappingPattern extends TComponent
if(($pattern=$this->getRegularExpression())!=='')
preg_match($pattern,$request->getPathInfo(),$matches);
else
- preg_match($this->getParameterizedPattern(),trim($request->getPathInfo(),'/'),$matches);
+ preg_match($this->getParameterizedPattern(),trim($request->getPathInfo(),'/').'/',$matches);
return $matches;
}