summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwei <>2006-09-24 23:30:54 +0000
committerwei <>2006-09-24 23:30:54 +0000
commitd8b4c4f055f51d23aa5a728bbf7a5c1ef99893a4 (patch)
treeb080bd4d503ee6e3fb8ed2f72c4b2b694991505e
parent547b51265c9be5771c8282229bb9d4d7cfaec15b (diff)
Add case sensitive modifiers to TUrlMappingPattern
-rw-r--r--framework/Web/TUrlMapping.php34
1 files changed, 33 insertions, 1 deletions
diff --git a/framework/Web/TUrlMapping.php b/framework/Web/TUrlMapping.php
index 62656563..90acfd13 100644
--- a/framework/Web/TUrlMapping.php
+++ b/framework/Web/TUrlMapping.php
@@ -262,6 +262,10 @@ class TUrlMappingPattern extends TComponent
* @var string regular expression pattern.
*/
private $_regexp;
+ /**
+ * @var boolean case sensitive matching, default is true
+ */
+ private $_caseSensitive=true;
public function __construct()
{
@@ -359,6 +363,22 @@ class TUrlMappingPattern extends TComponent
}
/**
+ * @param boolean case sensitive pattern matching, default is true.
+ */
+ public function setCaseSensitive($value)
+ {
+ $this->_caseSensitive=TPropertyValue::ensureBoolean($value);
+ }
+
+ /**
+ * @return boolean case sensitive pattern matching, default is true.
+ */
+ public function getCaseSensitive()
+ {
+ return $this->_caseSensitive;
+ }
+
+ /**
* @return TAttributeCollection parameter key value pairs.
*/
public function getParameters()
@@ -384,9 +404,21 @@ class TUrlMappingPattern extends TComponent
$path = $url->getPath();
$matches=array();
$pattern = str_replace('/', '\\/', $this->getRegExpPattern());
- preg_match('/'.$pattern.'/', $path, $matches);
+ $modifiers = $this->getModifiers();
+ preg_match('/'.$pattern.'/'.$modifiers, $path, $matches);
return $matches;
}
+
+ /**
+ * @return string regular expression matching modifiers.
+ */
+ protected function getModifiers()
+ {
+ $modifiers = 'u';
+ if(!$this->getCaseSensitive())
+ $modifiers .= 'i';
+ return $modifiers;
+ }
}
?> \ No newline at end of file