summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorxue <>2007-08-07 00:25:36 +0000
committerxue <>2007-08-07 00:25:36 +0000
commitd7392f14a02853481909f05e0f8cb11e5f3e6989 (patch)
treee28742ebfe3ab1b9a7ab60fe4995760daf3f8ea3 /framework
parente64a94e8694845adbcfdecfdae4af7a3a7d269a1 (diff)
added TUrlMapping.DefaultMappingClass
Diffstat (limited to 'framework')
-rw-r--r--framework/Web/TUrlMapping.php23
1 files changed, 22 insertions, 1 deletions
diff --git a/framework/Web/TUrlMapping.php b/framework/Web/TUrlMapping.php
index 433764c9..eada097f 100644
--- a/framework/Web/TUrlMapping.php
+++ b/framework/Web/TUrlMapping.php
@@ -87,6 +87,8 @@ class TUrlMapping extends TUrlManager
private $_urlPrefix='';
+ private $_defaultMappingClass='TUrlMappingPattern';
+
/**
* Initializes this module.
* This method is required by the IModule interface.
@@ -182,6 +184,25 @@ class TUrlMapping extends TUrlManager
}
/**
+ * @return string the default class of URL mapping patterns. Defaults to TUrlMappingPattern.
+ */
+ public function getDefaultMappingClass()
+ {
+ return $this->_defaultMappingClass;
+ }
+
+ /**
+ * Sets the default class of URL mapping patterns.
+ * When a URL matching pattern does not specify "class" attribute, it will default to the class
+ * specified by this property. You may use either a class name or a namespace format of class (if the class needs to be included first.)
+ * @param string the default class of URL mapping patterns.
+ */
+ public function setDefaultMappingClass($value)
+ {
+ $this->_defaultMappingClass=$value;
+ }
+
+ /**
* Load and configure each url mapping pattern.
* @param TXmlElement configuration node
* @throws TConfigurationException if specific pattern class is invalid
@@ -192,7 +213,7 @@ class TUrlMapping extends TUrlManager
{
$properties=$url->getAttributes();
if(($class=$properties->remove('class'))===null)
- $class='TUrlMappingPattern';
+ $class=$this->getDefaultMappingClass();
$pattern = Prado::createComponent($class,$this);
if(!($pattern instanceof TUrlMappingPattern))
throw new TConfigurationException('urlmapping_urlmappingpattern_required');