From a55ec97650341930cd5fee6f1fd2831d7ccca358 Mon Sep 17 00:00:00 2001 From: javalizard <> Date: Sun, 18 Apr 2010 04:43:44 +0000 Subject: Ensured parent::__construct calls within Web and Services --- framework/Web/Services/TRpcService.php | 2 + framework/Web/Services/TSoapService.php | 1 + framework/Web/THttpRequest.php | 1 + framework/Web/THttpResponseAdapter.php | 1 + framework/Web/TUrlMapping.php | 173 ++++++++++++++++---------------- 5 files changed, 92 insertions(+), 86 deletions(-) diff --git a/framework/Web/Services/TRpcService.php b/framework/Web/Services/TRpcService.php index 7310725a..96bdc86b 100644 --- a/framework/Web/Services/TRpcService.php +++ b/framework/Web/Services/TRpcService.php @@ -165,6 +165,7 @@ class TRpcServer extends TModule */ public function __construct(TRpcProtocol $protocolHandler) { + parent::__construct(); $this->handler = $protocolHandler; } @@ -245,6 +246,7 @@ abstract class TRpcApiProvider extends TModule public function __construct(TRpcServer $rpcServer) { + parent::__construct(); $this->rpcServer = $rpcServer; foreach($this->registerMethods() as $_methodName => $_methodDetails) diff --git a/framework/Web/Services/TSoapService.php b/framework/Web/Services/TSoapService.php index ddb5cecb..4db97544 100644 --- a/framework/Web/Services/TSoapService.php +++ b/framework/Web/Services/TSoapService.php @@ -101,6 +101,7 @@ class TSoapService extends TService */ public function __construct() { + parent::__construct(); $this->setID('soap'); } diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php index 34ba3f75..26630c8c 100644 --- a/framework/Web/THttpRequest.php +++ b/framework/Web/THttpRequest.php @@ -844,6 +844,7 @@ class THttpCookieCollection extends TList public function __construct($owner=null) { $this->_o=$owner; + parent::__construct(); } /** diff --git a/framework/Web/THttpResponseAdapter.php b/framework/Web/THttpResponseAdapter.php index 6aaaf775..2d06d620 100644 --- a/framework/Web/THttpResponseAdapter.php +++ b/framework/Web/THttpResponseAdapter.php @@ -34,6 +34,7 @@ class THttpResponseAdapter extends TApplicationComponent */ public function __construct($response) { + parent::__construct(); $this->_response=$response; } diff --git a/framework/Web/TUrlMapping.php b/framework/Web/TUrlMapping.php index 09e45d99..be3545c7 100644 --- a/framework/Web/TUrlMapping.php +++ b/framework/Web/TUrlMapping.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web @@ -328,8 +328,8 @@ class TUrlMapping extends TUrlManager if(!(is_array($getItems) || ($getItems instanceof Traversable))) $getItems=array(); $key=$serviceID.':'.$serviceParam; - $wildCardKey = ($pos=strrpos($serviceParam,'.'))!==false ? - $serviceID.':'.substr($serviceParam,0,$pos).'.*' : $serviceID.':*'; + $wildCardKey = ($pos=strrpos($serviceParam,'.'))!==false ? + $serviceID.':'.substr($serviceParam,0,$pos).'.*' : $serviceID.':*'; if(isset($this->_constructRules[$key])) { foreach($this->_constructRules[$key] as $rule) @@ -337,16 +337,16 @@ class TUrlMapping extends TUrlManager if($rule->supportCustomUrl($getItems)) return $rule->constructUrl($getItems,$encodeAmpersand,$encodeGetItems); } - } - elseif(isset($this->_constructRules[$wildCardKey])) - { + } + elseif(isset($this->_constructRules[$wildCardKey])) + { foreach($this->_constructRules[$wildCardKey] as $rule) { if($rule->supportCustomUrl($getItems)) - { - $getItems['*']= $pos ? substr($serviceParam,$pos+1) : $serviceParam; + { + $getItems['*']= $pos ? substr($serviceParam,$pos+1) : $serviceParam; return $rule->constructUrl($getItems,$encodeAmpersand,$encodeGetItems); - } + } } } } @@ -408,42 +408,42 @@ class TUrlMapping extends TUrlManager * The {@link setServiceParameter ServiceParameter} and {@link setServiceID ServiceID} * (the default ID is 'page') set the service parameter and service id respectively. * - * Since 3.1.4 you can also use simplyfied wildcard patterns to match multiple - * ServiceParameters with a single rule. The pattern must contain the placeholder - * {*} for the ServiceParameter. For example - * - * - * - * This rule will match an URL like http://example.com/index.php/admin/edituser - * and resolve it to the page Application.pages.admin.edituser. The wildcard matching - * is non-recursive. That means you have to add a rule for every subdirectory you - * want to access pages in: - * - * - * - * It is still possible to define an explicit rule for a page in the wildcard path. - * This rule has to preceed the wildcard rule. - * - * You can also use parameters with wildcard patterns. The parameters are then - * available with every matching page: - * - * - * - * To enable automatic parameter encoding in a path format fro wildcard patterns you can set - * {@setUrlFormat UrlFormat} to 'Path': - * - * - * - * This will create and parse URLs of the form - * .../index.php/admin/listuser/param1/value1/param2/value2. - * - * Use {@setUrlParamSeparator} to define another separator character between parameter - * name and value. Parameter/value pairs are always separated by a '/'. - * - * - * - * .../index.php/admin/listuser/param1-value1/param2-value2. - * + * Since 3.1.4 you can also use simplyfied wildcard patterns to match multiple + * ServiceParameters with a single rule. The pattern must contain the placeholder + * {*} for the ServiceParameter. For example + * + * + * + * This rule will match an URL like http://example.com/index.php/admin/edituser + * and resolve it to the page Application.pages.admin.edituser. The wildcard matching + * is non-recursive. That means you have to add a rule for every subdirectory you + * want to access pages in: + * + * + * + * It is still possible to define an explicit rule for a page in the wildcard path. + * This rule has to preceed the wildcard rule. + * + * You can also use parameters with wildcard patterns. The parameters are then + * available with every matching page: + * + * + * + * To enable automatic parameter encoding in a path format fro wildcard patterns you can set + * {@setUrlFormat UrlFormat} to 'Path': + * + * + * + * This will create and parse URLs of the form + * .../index.php/admin/listuser/param1/value1/param2/value2. + * + * Use {@setUrlParamSeparator} to define another separator character between parameter + * name and value. Parameter/value pairs are always separated by a '/'. + * + * + * + * .../index.php/admin/listuser/param1-value1/param2-value2. + * * @author Wei Zhuo * @version $Id$ * @package System.Web @@ -477,7 +477,7 @@ class TUrlMappingPattern extends TComponent private $_manager; private $_caseSensitive=true; - + private $_isWildCardPattern=false; private $_urlFormat=THttpRequestUrlFormat::Get; @@ -490,6 +490,7 @@ class TUrlMappingPattern extends TComponent */ public function __construct(TUrlManager $manager) { + parent::__construct(); $this->_manager=$manager; $this->_parameters=new TAttributeCollection; $this->_parameters->setCaseSensitive(true); @@ -512,8 +513,8 @@ class TUrlMappingPattern extends TComponent { if($this->_serviceParameter===null) throw new TConfigurationException('urlmappingpattern_serviceparameter_required', $this->getPattern()); - if(strpos($this->_serviceParameter,'*')!==false) - $this->_isWildCardPattern=true; + if(strpos($this->_serviceParameter,'*')!==false) + $this->_isWildCardPattern=true; } /** @@ -530,19 +531,19 @@ class TUrlMappingPattern extends TComponent $params[]='{'.$key.'}'; $values[]='(?P<'.$key.'>'.$value.')'; } - if ($this->getIsWildCardPattern()) { - $params[]='{*}'; - // service parameter must not contain '=' and '/' - $values[]='(?P<'.$this->getServiceID().'>[^=/]+)'; - } + if ($this->getIsWildCardPattern()) { + $params[]='{*}'; + // service parameter must not contain '=' and '/' + $values[]='(?P<'.$this->getServiceID().'>[^=/]+)'; + } $params[]='/'; $values[]='\\/'; $regexp=str_replace($params,$values,trim($this->getPattern(),'/').'/'); - if ($this->_urlFormat===THttpRequestUrlFormat::Get) + if ($this->_urlFormat===THttpRequestUrlFormat::Get) $regexp='/^'.$regexp.'$/u'; - else + else $regexp='/^'.$regexp.'(?P.*)$/u'; - + if(!$this->getCaseSensitive()) $regexp.='i'; return $regexp; @@ -657,30 +658,30 @@ class TUrlMappingPattern extends TComponent preg_match($pattern,$request->getPathInfo(),$matches); else preg_match($this->getParameterizedPattern(),trim($request->getPathInfo(),'/').'/',$matches); - - if($this->getIsWildCardPattern() && isset($matches[$this->_serviceID])) - $matches[$this->_serviceID]=str_replace('*',$matches[$this->_serviceID],$this->_serviceParameter); - - if (isset($matches['urlparams'])) - { - $params=explode('/',$matches['urlparams']); - if ($this->_separator==='/') - { - while($key=array_shift($params)) - $matches2[$key]=($value=array_shift($params)) ? $value : ''; - } - else - { - array_pop($params); - foreach($params as $param) - { - list($key,$value)=explode($this->_separator,$param,2); - $matches[$key]=$value; - } - } - unset($matches['urlparams']); - } - + + if($this->getIsWildCardPattern() && isset($matches[$this->_serviceID])) + $matches[$this->_serviceID]=str_replace('*',$matches[$this->_serviceID],$this->_serviceParameter); + + if (isset($matches['urlparams'])) + { + $params=explode('/',$matches['urlparams']); + if ($this->_separator==='/') + { + while($key=array_shift($params)) + $matches2[$key]=($value=array_shift($params)) ? $value : ''; + } + else + { + array_pop($params); + foreach($params as $param) + { + list($key,$value)=explode($this->_separator,$param,2); + $matches[$key]=$value; + } + } + unset($matches['urlparams']); + } + return $matches; } @@ -798,12 +799,12 @@ class TUrlMappingPattern extends TComponent // for the rest of the GET variables, put them in the query string if(count($extra)>0) { - if ($this->_urlFormat===THttpRequestUrlFormat::Path && $this->getIsWildCardPattern()) { - foreach ($extra as $name=>$value) - $url.='/'.$name.$this->_separator.($encodeGetItems?rawurlencode($value):$value); - return $url; - } - + if ($this->_urlFormat===THttpRequestUrlFormat::Path && $this->getIsWildCardPattern()) { + foreach ($extra as $name=>$value) + $url.='/'.$name.$this->_separator.($encodeGetItems?rawurlencode($value):$value); + return $url; + } + $url2=''; $amp=$encodeAmpersand?'&':'&'; if($encodeGetItems) -- cgit v1.2.3