From d7392f14a02853481909f05e0f8cb11e5f3e6989 Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 7 Aug 2007 00:25:36 +0000 Subject: added TUrlMapping.DefaultMappingClass --- framework/Web/TUrlMapping.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'framework') 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. @@ -181,6 +183,25 @@ class TUrlMapping extends TUrlManager throw new TConfigurationException('urlpath_configfile_invalid',$value); } + /** + * @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 @@ -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'); -- cgit v1.2.3