@@ -606,6 +606,7 @@ discard block |
||
606 | 606 | |
607 | 607 | /** |
608 | 608 | * @param string full regular expression mapping pattern. |
609 | + * @param string $value |
|
609 | 610 | */ |
610 | 611 | public function setRegularExpression($value) |
611 | 612 | { |
@@ -715,6 +716,7 @@ discard block |
||
715 | 716 | * Uses URL pattern (or full regular expression if available) to |
716 | 717 | * match the given url path. |
717 | 718 | * @param THttpRequest the request module |
719 | + * @param THttpRequest $request |
|
718 | 720 | * @return array matched parameters, empty if no matches. |
719 | 721 | */ |
720 | 722 | public function getPatternMatches($request) |
@@ -785,7 +787,7 @@ discard block |
||
785 | 787 | } |
786 | 788 | |
787 | 789 | /** |
788 | - * @return THttpRequestUrlFormat the format of URLs. Defaults to THttpRequestUrlFormat::Get. |
|
790 | + * @return string the format of URLs. Defaults to THttpRequestUrlFormat::Get. |
|
789 | 791 | */ |
790 | 792 | public function getUrlFormat() |
791 | 793 | { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $this->_urlPrefix=$request->getApplicationUrl(); |
117 | 117 | } |
118 | 118 | } |
119 | - $this->_urlPrefix=rtrim($this->_urlPrefix,'/'); |
|
119 | + $this->_urlPrefix=rtrim($this->_urlPrefix, '/'); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | { |
130 | 130 | if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP) |
131 | 131 | { |
132 | - $config = include $this->_configFile; |
|
132 | + $config=include $this->_configFile; |
|
133 | 133 | $this->loadUrlMappings($dom); |
134 | 134 | } |
135 | 135 | else |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | } |
141 | 141 | } |
142 | 142 | else |
143 | - throw new TConfigurationException('urlmapping_configfile_inexistent',$this->_configFile); |
|
143 | + throw new TConfigurationException('urlmapping_configfile_inexistent', $this->_configFile); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function setConfigFile($value) |
203 | 203 | { |
204 | - if(($this->_configFile=Prado::getPathOfNamespace($value,$this->getApplication()->getConfigurationFileExt()))===null) |
|
205 | - throw new TConfigurationException('urlmapping_configfile_invalid',$value); |
|
204 | + if(($this->_configFile=Prado::getPathOfNamespace($value, $this->getApplication()->getConfigurationFileExt()))===null) |
|
205 | + throw new TConfigurationException('urlmapping_configfile_invalid', $value); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | protected function loadUrlMappings($config) |
235 | 235 | { |
236 | - $defaultClass = $this->getDefaultMappingClass(); |
|
236 | + $defaultClass=$this->getDefaultMappingClass(); |
|
237 | 237 | |
238 | 238 | if(is_array($config)) |
239 | 239 | { |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | { |
242 | 242 | foreach($config['urls'] as $url) |
243 | 243 | { |
244 | - $class=isset($url['class'])?$url['class']:$defaultClass; |
|
245 | - $properties = isset($url['properties'])?$url['properties']:array(); |
|
246 | - $this->buildUrlMapping($class,$properties,$url); |
|
244 | + $class=isset($url['class']) ? $url['class'] : $defaultClass; |
|
245 | + $properties=isset($url['properties']) ? $url['properties'] : array(); |
|
246 | + $this->buildUrlMapping($class, $properties, $url); |
|
247 | 247 | } |
248 | 248 | } |
249 | 249 | } |
@@ -254,24 +254,24 @@ discard block |
||
254 | 254 | $properties=$url->getAttributes(); |
255 | 255 | if(($class=$properties->remove('class'))===null) |
256 | 256 | $class=$defaultClass; |
257 | - $this->buildUrlMapping($class,$properties,$url); |
|
257 | + $this->buildUrlMapping($class, $properties, $url); |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | } |
261 | 261 | |
262 | 262 | private function buildUrlMapping($class, $properties, $url) |
263 | 263 | { |
264 | - $pattern=Prado::createComponent($class,$this); |
|
264 | + $pattern=Prado::createComponent($class, $this); |
|
265 | 265 | if(!($pattern instanceof TUrlMappingPattern)) |
266 | 266 | throw new TConfigurationException('urlmapping_urlmappingpattern_required'); |
267 | 267 | foreach($properties as $name=>$value) |
268 | - $pattern->setSubproperty($name,$value); |
|
268 | + $pattern->setSubproperty($name, $value); |
|
269 | 269 | |
270 | 270 | if($url instanceof TXmlElement) { |
271 | - $text = $url -> getValue(); |
|
271 | + $text=$url -> getValue(); |
|
272 | 272 | if($text) { |
273 | - $text = preg_replace('/(\s+)/S', '', $text); |
|
274 | - if(($regExp = $pattern->getRegularExpression()) !== '') |
|
273 | + $text=preg_replace('/(\s+)/S', '', $text); |
|
274 | + if(($regExp=$pattern->getRegularExpression())!=='') |
|
275 | 275 | trigger_error(sPrintF('%s.RegularExpression property value "%s" for ServiceID="%s" and ServiceParameter="%s" was replaced by node value "%s"', |
276 | 276 | get_class($pattern), |
277 | 277 | $regExp, |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | foreach($this->_patterns as $pattern) |
305 | 305 | { |
306 | 306 | $matches=$pattern->getPatternMatches($request); |
307 | - if(count($matches)>0) |
|
307 | + if(count($matches) > 0) |
|
308 | 308 | { |
309 | 309 | $this->_matched=$pattern; |
310 | 310 | $params=array(); |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | if(is_string($key)) |
314 | 314 | $params[$key]=$value; |
315 | 315 | } |
316 | - if (!$pattern->getIsWildCardPattern()) |
|
316 | + if(!$pattern->getIsWildCardPattern()) |
|
317 | 317 | $params[$pattern->getServiceID()]=$pattern->getServiceParameter(); |
318 | 318 | return $params; |
319 | 319 | } |
@@ -345,21 +345,21 @@ discard block |
||
345 | 345 | * @see parseUrl |
346 | 346 | * @since 3.1.1 |
347 | 347 | */ |
348 | - public function constructUrl($serviceID,$serviceParam,$getItems,$encodeAmpersand,$encodeGetItems) |
|
348 | + public function constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems) |
|
349 | 349 | { |
350 | 350 | if($this->_customUrl) |
351 | 351 | { |
352 | 352 | if(!(is_array($getItems) || ($getItems instanceof Traversable))) |
353 | 353 | $getItems=array(); |
354 | 354 | $key=$serviceID.':'.$serviceParam; |
355 | - $wildCardKey = ($pos=strrpos($serviceParam,'.'))!==false ? |
|
356 | - $serviceID.':'.substr($serviceParam,0,$pos).'.*' : $serviceID.':*'; |
|
355 | + $wildCardKey=($pos=strrpos($serviceParam, '.'))!==false ? |
|
356 | + $serviceID.':'.substr($serviceParam, 0, $pos).'.*' : $serviceID.':*'; |
|
357 | 357 | if(isset($this->_constructRules[$key])) |
358 | 358 | { |
359 | 359 | foreach($this->_constructRules[$key] as $rule) |
360 | 360 | { |
361 | 361 | if($rule->supportCustomUrl($getItems)) |
362 | - return $rule->constructUrl($getItems,$encodeAmpersand,$encodeGetItems); |
|
362 | + return $rule->constructUrl($getItems, $encodeAmpersand, $encodeGetItems); |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 | elseif(isset($this->_constructRules[$wildCardKey])) |
@@ -368,13 +368,13 @@ discard block |
||
368 | 368 | { |
369 | 369 | if($rule->supportCustomUrl($getItems)) |
370 | 370 | { |
371 | - $getItems['*']= $pos ? substr($serviceParam,$pos+1) : $serviceParam; |
|
372 | - return $rule->constructUrl($getItems,$encodeAmpersand,$encodeGetItems); |
|
371 | + $getItems['*']=$pos ? substr($serviceParam, $pos + 1) : $serviceParam; |
|
372 | + return $rule->constructUrl($getItems, $encodeAmpersand, $encodeGetItems); |
|
373 | 373 | } |
374 | 374 | } |
375 | 375 | } |
376 | 376 | } |
377 | - return parent::constructUrl($serviceID,$serviceParam,$getItems,$encodeAmpersand,$encodeGetItems); |
|
377 | + return parent::constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | /** |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | * @var TUrlMappingPatternSecureConnection |
529 | 529 | * @since 3.2 |
530 | 530 | */ |
531 | - private $_secureConnection = TUrlMappingPatternSecureConnection::Automatic; |
|
531 | + private $_secureConnection=TUrlMappingPatternSecureConnection::Automatic; |
|
532 | 532 | |
533 | 533 | /** |
534 | 534 | * Constructor. |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | { |
557 | 557 | if($this->_serviceParameter===null) |
558 | 558 | throw new TConfigurationException('urlmappingpattern_serviceparameter_required', $this->getPattern()); |
559 | - if(strpos($this->_serviceParameter,'*')!==false) |
|
559 | + if(strpos($this->_serviceParameter, '*')!==false) |
|
560 | 560 | $this->_isWildCardPattern=true; |
561 | 561 | } |
562 | 562 | |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | { |
570 | 570 | $params=array(); |
571 | 571 | $values=array(); |
572 | - if ($this->_parameters) |
|
572 | + if($this->_parameters) |
|
573 | 573 | { |
574 | 574 | foreach($this->_parameters as $key=>$value) |
575 | 575 | { |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | $values[]='(?P<'.$key.'>'.$value.')'; |
578 | 578 | } |
579 | 579 | } |
580 | - if ($this->getIsWildCardPattern()) |
|
580 | + if($this->getIsWildCardPattern()) |
|
581 | 581 | { |
582 | 582 | $params[]='{*}'; |
583 | 583 | // service parameter must not contain '=' and '/' |
@@ -585,8 +585,8 @@ discard block |
||
585 | 585 | } |
586 | 586 | $params[]='/'; |
587 | 587 | $values[]='\\/'; |
588 | - $regexp=str_replace($params,$values,trim($this->getPattern(),'/').'/'); |
|
589 | - if ($this->_urlFormat===THttpRequestUrlFormat::Get) |
|
588 | + $regexp=str_replace($params, $values, trim($this->getPattern(), '/').'/'); |
|
589 | + if($this->_urlFormat===THttpRequestUrlFormat::Get) |
|
590 | 590 | $regexp='/^'.$regexp.'$/u'; |
591 | 591 | else |
592 | 592 | $regexp='/^'.$regexp.'(?P<urlparams>.*)$/u'; |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | */ |
674 | 674 | public function setPattern($value) |
675 | 675 | { |
676 | - $this->_pattern = $value; |
|
676 | + $this->_pattern=$value; |
|
677 | 677 | } |
678 | 678 | |
679 | 679 | /** |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | */ |
682 | 682 | public function getParameters() |
683 | 683 | { |
684 | - if (!$this->_parameters) |
|
684 | + if(!$this->_parameters) |
|
685 | 685 | { |
686 | 686 | $this->_parameters=new TAttributeCollection; |
687 | 687 | $this->_parameters->setCaseSensitive(true); |
@@ -703,9 +703,9 @@ discard block |
||
703 | 703 | */ |
704 | 704 | public function getConstants() |
705 | 705 | { |
706 | - if (!$this->_constants) |
|
706 | + if(!$this->_constants) |
|
707 | 707 | { |
708 | - $this->_constants = new TAttributeCollection; |
|
708 | + $this->_constants=new TAttributeCollection; |
|
709 | 709 | $this->_constants->setCaseSensitive(true); |
710 | 710 | } |
711 | 711 | return $this->_constants; |
@@ -721,17 +721,17 @@ discard block |
||
721 | 721 | { |
722 | 722 | $matches=array(); |
723 | 723 | if(($pattern=$this->getRegularExpression())!=='') |
724 | - preg_match($pattern,$request->getPathInfo(),$matches); |
|
724 | + preg_match($pattern, $request->getPathInfo(), $matches); |
|
725 | 725 | else |
726 | - preg_match($this->getParameterizedPattern(),trim($request->getPathInfo(),'/').'/',$matches); |
|
726 | + preg_match($this->getParameterizedPattern(), trim($request->getPathInfo(), '/').'/', $matches); |
|
727 | 727 | |
728 | 728 | if($this->getIsWildCardPattern() && isset($matches[$this->_serviceID])) |
729 | - $matches[$this->_serviceID]=str_replace('*',$matches[$this->_serviceID],$this->_serviceParameter); |
|
729 | + $matches[$this->_serviceID]=str_replace('*', $matches[$this->_serviceID], $this->_serviceParameter); |
|
730 | 730 | |
731 | - if (isset($matches['urlparams'])) |
|
731 | + if(isset($matches['urlparams'])) |
|
732 | 732 | { |
733 | - $params=explode('/',$matches['urlparams']); |
|
734 | - if ($this->_separator==='/') |
|
733 | + $params=explode('/', $matches['urlparams']); |
|
734 | + if($this->_separator==='/') |
|
735 | 735 | { |
736 | 736 | while($key=array_shift($params)) |
737 | 737 | $matches[$key]=($value=array_shift($params)) ? $value : ''; |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | array_pop($params); |
742 | 742 | foreach($params as $param) |
743 | 743 | { |
744 | - list($key,$value)=explode($this->_separator,$param,2); |
|
744 | + list($key, $value)=explode($this->_separator, $param, 2); |
|
745 | 745 | $matches[$key]=$value; |
746 | 746 | } |
747 | 747 | } |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | if(count($matches) > 0 && $this->_constants) |
752 | 752 | { |
753 | 753 | foreach($this->_constants->toArray() as $key=>$value) |
754 | - $matches[$key] = $value; |
|
754 | + $matches[$key]=$value; |
|
755 | 755 | } |
756 | 756 | |
757 | 757 | return $matches; |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | */ |
806 | 806 | public function setUrlFormat($value) |
807 | 807 | { |
808 | - $this->_urlFormat=TPropertyValue::ensureEnum($value,'THttpRequestUrlFormat'); |
|
808 | + $this->_urlFormat=TPropertyValue::ensureEnum($value, 'THttpRequestUrlFormat'); |
|
809 | 809 | } |
810 | 810 | |
811 | 811 | /** |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | */ |
844 | 844 | public function setSecureConnection($value) |
845 | 845 | { |
846 | - $this->_secureConnection = TPropertyValue::ensureEnum($value, 'TUrlMappingPatternSecureConnection'); |
|
846 | + $this->_secureConnection=TPropertyValue::ensureEnum($value, 'TUrlMappingPatternSecureConnection'); |
|
847 | 847 | } |
848 | 848 | |
849 | 849 | /** |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | { |
856 | 856 | if(!$this->_customUrl || $this->getPattern()===null) |
857 | 857 | return false; |
858 | - if ($this->_parameters) |
|
858 | + if($this->_parameters) |
|
859 | 859 | { |
860 | 860 | foreach($this->_parameters as $key=>$value) |
861 | 861 | { |
@@ -864,13 +864,13 @@ discard block |
||
864 | 864 | } |
865 | 865 | } |
866 | 866 | |
867 | - if ($this->_constants) |
|
867 | + if($this->_constants) |
|
868 | 868 | { |
869 | 869 | foreach($this->_constants->toArray() as $key=>$value) |
870 | 870 | { |
871 | - if (!isset($getItems[$key])) |
|
871 | + if(!isset($getItems[$key])) |
|
872 | 872 | return false; |
873 | - if ($getItems[$key]!=$value) |
|
873 | + if($getItems[$key]!=$value) |
|
874 | 874 | return false; |
875 | 875 | } |
876 | 876 | } |
@@ -885,9 +885,9 @@ discard block |
||
885 | 885 | * @return string the constructed URL |
886 | 886 | * @since 3.1.1 |
887 | 887 | */ |
888 | - public function constructUrl($getItems,$encodeAmpersand,$encodeGetItems) |
|
888 | + public function constructUrl($getItems, $encodeAmpersand, $encodeGetItems) |
|
889 | 889 | { |
890 | - if ($this->_constants) |
|
890 | + if($this->_constants) |
|
891 | 891 | { |
892 | 892 | foreach($this->_constants->toArray() as $key=>$value) |
893 | 893 | { |
@@ -906,19 +906,19 @@ discard block |
||
906 | 906 | $extra[$key]=$value; |
907 | 907 | } |
908 | 908 | |
909 | - $url=$this->_manager->getUrlPrefix().'/'.ltrim(strtr($this->getPattern(),$replace),'/'); |
|
909 | + $url=$this->_manager->getUrlPrefix().'/'.ltrim(strtr($this->getPattern(), $replace), '/'); |
|
910 | 910 | |
911 | 911 | // for the rest of the GET variables, put them in the query string |
912 | - if(count($extra)>0) |
|
912 | + if(count($extra) > 0) |
|
913 | 913 | { |
914 | - if ($this->_urlFormat===THttpRequestUrlFormat::Path && $this->getIsWildCardPattern()) { |
|
915 | - foreach ($extra as $name=>$value) |
|
916 | - $url.='/'.$name.$this->_separator.($encodeGetItems?rawurlencode($value):$value); |
|
914 | + if($this->_urlFormat===THttpRequestUrlFormat::Path && $this->getIsWildCardPattern()) { |
|
915 | + foreach($extra as $name=>$value) |
|
916 | + $url.='/'.$name.$this->_separator.($encodeGetItems ? rawurlencode($value) : $value); |
|
917 | 917 | return $url; |
918 | 918 | } |
919 | 919 | |
920 | 920 | $url2=''; |
921 | - $amp=$encodeAmpersand?'&':'&'; |
|
921 | + $amp=$encodeAmpersand ? '&' : '&'; |
|
922 | 922 | if($encodeGetItems) |
923 | 923 | { |
924 | 924 | foreach($extra as $name=>$value) |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | $url2.=$amp.$name.'='.$value; |
947 | 947 | } |
948 | 948 | } |
949 | - $url=$url.'?'.substr($url2,strlen($amp)); |
|
949 | + $url=$url.'?'.substr($url2, strlen($amp)); |
|
950 | 950 | } |
951 | 951 | return $this -> applySecureConnectionPrefix($url); |
952 | 952 | } |
@@ -962,26 +962,26 @@ discard block |
||
962 | 962 | protected function applySecureConnectionPrefix($url) |
963 | 963 | { |
964 | 964 | static $request; |
965 | - if($request === null) $request = Prado::getApplication() -> getRequest(); |
|
965 | + if($request===null) $request=Prado::getApplication() -> getRequest(); |
|
966 | 966 | |
967 | 967 | static $isSecureConnection; |
968 | - if($isSecureConnection === null) $isSecureConnection = $request -> getIsSecureConnection(); |
|
968 | + if($isSecureConnection===null) $isSecureConnection=$request -> getIsSecureConnection(); |
|
969 | 969 | |
970 | 970 | switch($this -> getSecureConnection()) |
971 | 971 | { |
972 | 972 | case TUrlMappingPatternSecureConnection::EnableIfNotSecure: |
973 | 973 | if($isSecureConnection) return $url; |
974 | - return $request -> getBaseUrl(true) . $url; |
|
974 | + return $request -> getBaseUrl(true).$url; |
|
975 | 975 | break; |
976 | 976 | case TUrlMappingPatternSecureConnection::DisableIfSecure: |
977 | 977 | if(!$isSecureConnection) return $url; |
978 | - return $request -> getBaseUrl(false) . $url; |
|
978 | + return $request -> getBaseUrl(false).$url; |
|
979 | 979 | break; |
980 | 980 | case TUrlMappingPatternSecureConnection::Enable: |
981 | - return $request -> getBaseUrl(true) . $url; |
|
981 | + return $request -> getBaseUrl(true).$url; |
|
982 | 982 | break; |
983 | 983 | case TUrlMappingPatternSecureConnection::Disable: |
984 | - return $request -> getBaseUrl(false) . $url; |
|
984 | + return $request -> getBaseUrl(false).$url; |
|
985 | 985 | break; |
986 | 986 | case TUrlMappingPatternSecureConnection::Automatic: |
987 | 987 | default: |
@@ -1007,29 +1007,29 @@ discard block |
||
1007 | 1007 | * Keep current SecureConnection status |
1008 | 1008 | * means no prefixing |
1009 | 1009 | */ |
1010 | - const Automatic = 'Automatic'; |
|
1010 | + const Automatic='Automatic'; |
|
1011 | 1011 | |
1012 | 1012 | /** |
1013 | 1013 | * Force use secured connection |
1014 | 1014 | * always prefixing with https://example.com/path/to/app |
1015 | 1015 | */ |
1016 | - const Enable = 'Enable'; |
|
1016 | + const Enable='Enable'; |
|
1017 | 1017 | |
1018 | 1018 | /** |
1019 | 1019 | * Force use unsecured connection |
1020 | 1020 | * always prefixing with http://example.com/path/to/app |
1021 | 1021 | */ |
1022 | - const Disable = 'Disable'; |
|
1022 | + const Disable='Disable'; |
|
1023 | 1023 | |
1024 | 1024 | /** |
1025 | 1025 | * Force use secured connection, if in unsecured mode |
1026 | 1026 | * prefixing with https://example.com/path/to/app |
1027 | 1027 | */ |
1028 | - const EnableIfNotSecure = 'EnableIfNotSecure'; |
|
1028 | + const EnableIfNotSecure='EnableIfNotSecure'; |
|
1029 | 1029 | |
1030 | 1030 | /** |
1031 | 1031 | * Force use unsecured connection, if in secured mode |
1032 | 1032 | * prefixing with https://example.com/path/to/app |
1033 | 1033 | */ |
1034 | - const DisableIfSecure = 'DisableIfSecure'; |
|
1034 | + const DisableIfSecure='DisableIfSecure'; |
|
1035 | 1035 | } |
@@ -131,15 +131,13 @@ discard block |
||
131 | 131 | { |
132 | 132 | $config = include $this->_configFile; |
133 | 133 | $this->loadUrlMappings($dom); |
134 | - } |
|
135 | - else |
|
134 | + } else |
|
136 | 135 | { |
137 | 136 | $dom=new TXmlDocument; |
138 | 137 | $dom->loadFromFile($this->_configFile); |
139 | 138 | $this->loadUrlMappings($dom); |
140 | 139 | } |
141 | - } |
|
142 | - else |
|
140 | + } else |
|
143 | 141 | throw new TConfigurationException('urlmapping_configfile_inexistent',$this->_configFile); |
144 | 142 | } |
145 | 143 | |
@@ -246,8 +244,7 @@ discard block |
||
246 | 244 | $this->buildUrlMapping($class,$properties,$url); |
247 | 245 | } |
248 | 246 | } |
249 | - } |
|
250 | - else |
|
247 | + } else |
|
251 | 248 | { |
252 | 249 | foreach($config->getElementsByTagName('url') as $url) |
253 | 250 | { |
@@ -361,8 +358,7 @@ discard block |
||
361 | 358 | if($rule->supportCustomUrl($getItems)) |
362 | 359 | return $rule->constructUrl($getItems,$encodeAmpersand,$encodeGetItems); |
363 | 360 | } |
364 | - } |
|
365 | - elseif(isset($this->_constructRules[$wildCardKey])) |
|
361 | + } elseif(isset($this->_constructRules[$wildCardKey])) |
|
366 | 362 | { |
367 | 363 | foreach($this->_constructRules[$wildCardKey] as $rule) |
368 | 364 | { |
@@ -733,10 +729,10 @@ discard block |
||
733 | 729 | $params=explode('/',$matches['urlparams']); |
734 | 730 | if ($this->_separator==='/') |
735 | 731 | { |
736 | - while($key=array_shift($params)) |
|
737 | - $matches[$key]=($value=array_shift($params)) ? $value : ''; |
|
738 | - } |
|
739 | - else |
|
732 | + while($key=array_shift($params)) { |
|
733 | + $matches[$key]=($value=array_shift($params)) ? $value : ''; |
|
734 | + } |
|
735 | + } else |
|
740 | 736 | { |
741 | 737 | array_pop($params); |
742 | 738 | foreach($params as $param) |
@@ -928,12 +924,10 @@ discard block |
||
928 | 924 | $name=rawurlencode($name.'[]'); |
929 | 925 | foreach($value as $v) |
930 | 926 | $url2.=$amp.$name.'='.rawurlencode($v); |
931 | - } |
|
932 | - else |
|
927 | + } else |
|
933 | 928 | $url2.=$amp.rawurlencode($name).'='.rawurlencode($value); |
934 | 929 | } |
935 | - } |
|
936 | - else |
|
930 | + } else |
|
937 | 931 | { |
938 | 932 | foreach($extra as $name=>$value) |
939 | 933 | { |
@@ -941,8 +935,7 @@ discard block |
||
941 | 935 | { |
942 | 936 | foreach($value as $v) |
943 | 937 | $url2.=$amp.$name.'[]='.$v; |
944 | - } |
|
945 | - else |
|
938 | + } else |
|
946 | 939 | $url2.=$amp.$name.'='.$value; |
947 | 940 | } |
948 | 941 | } |
@@ -261,6 +261,7 @@ discard block |
||
261 | 261 | * Sets the page for a control. |
262 | 262 | * Only framework developers should use this method. |
263 | 263 | * @param TPage the page that contains this control |
264 | + * @param TPage $page |
|
264 | 265 | */ |
265 | 266 | public function setPage($page) |
266 | 267 | { |
@@ -542,6 +543,7 @@ discard block |
||
542 | 543 | |
543 | 544 | /** |
544 | 545 | * @param boolean whether the control is visible |
546 | + * @param boolean $value |
|
545 | 547 | */ |
546 | 548 | public function setVisible($value) |
547 | 549 | { |
@@ -609,6 +611,7 @@ discard block |
||
609 | 611 | } |
610 | 612 | |
611 | 613 | /** |
614 | + * @param string $name |
|
612 | 615 | * @return boolean whether the named attribute exists |
613 | 616 | */ |
614 | 617 | public function hasAttribute($name) |
@@ -620,6 +623,7 @@ discard block |
||
620 | 623 | } |
621 | 624 | |
622 | 625 | /** |
626 | + * @param string $name |
|
623 | 627 | * @return string attribute value, null if attribute does not exist |
624 | 628 | */ |
625 | 629 | public function getAttribute($name) |
@@ -634,6 +638,7 @@ discard block |
||
634 | 638 | * Sets a custom control attribute. |
635 | 639 | * @param string attribute name |
636 | 640 | * @param string value of the attribute |
641 | + * @param string $name |
|
637 | 642 | */ |
638 | 643 | public function setAttribute($name,$value) |
639 | 644 | { |
@@ -671,6 +676,7 @@ discard block |
||
671 | 676 | |
672 | 677 | /** |
673 | 678 | * @param boolean set whether to enable viewstate |
679 | + * @param boolean $value |
|
674 | 680 | */ |
675 | 681 | public function setEnableViewState($value) |
676 | 682 | { |
@@ -687,6 +693,8 @@ discard block |
||
687 | 693 | * that must be kept in controlstate. |
688 | 694 | * @param string the name of the controlstate value to be returned |
689 | 695 | * @param mixed the default value. If $key is not found in controlstate, $defaultValue will be returned |
696 | + * @param string $key |
|
697 | + * @param integer $defaultValue |
|
690 | 698 | * @return mixed the controlstate value corresponding to $key |
691 | 699 | */ |
692 | 700 | protected function getControlState($key,$defaultValue=null) |
@@ -703,6 +711,8 @@ discard block |
||
703 | 711 | * @param string the name of the controlstate value |
704 | 712 | * @param mixed the controlstate value to be set |
705 | 713 | * @param mixed default value. If $value===$defaultValue, the item will be cleared from controlstate |
714 | + * @param string $key |
|
715 | + * @param integer $defaultValue |
|
706 | 716 | */ |
707 | 717 | protected function setControlState($key,$value,$defaultValue=null) |
708 | 718 | { |
@@ -726,6 +736,7 @@ discard block |
||
726 | 736 | * When it is false, data saved via setViewState() will not be persisted. |
727 | 737 | * By default, it is true, meaning data will be persisted across postbacks. |
728 | 738 | * @param boolean whether data should be persisted |
739 | + * @param boolean $enabled |
|
729 | 740 | */ |
730 | 741 | public function trackViewState($enabled) |
731 | 742 | { |
@@ -764,6 +775,7 @@ discard block |
||
764 | 775 | * @param string the name of the viewstate value |
765 | 776 | * @param mixed the viewstate value to be set |
766 | 777 | * @param mixed default value. If $value===$defaultValue, the item will be cleared from the viewstate. |
778 | + * @param string $key |
|
767 | 779 | */ |
768 | 780 | public function setViewState($key,$value,$defaultValue=null) |
769 | 781 | { |
@@ -788,6 +800,7 @@ discard block |
||
788 | 800 | /** |
789 | 801 | * Clears a viewstate value. |
790 | 802 | * @param string the name of the viewstate value to be cleared |
803 | + * @param string $key |
|
791 | 804 | */ |
792 | 805 | public function clearViewState($key) |
793 | 806 | { |
@@ -893,6 +906,7 @@ discard block |
||
893 | 906 | * Sets a value indicating whether child controls are created. |
894 | 907 | * If false, any existing child controls will be cleared up. |
895 | 908 | * @param boolean whether child controls are created |
909 | + * @param boolean $value |
|
896 | 910 | */ |
897 | 911 | final protected function setChildControlsCreated($value) |
898 | 912 | { |
@@ -983,6 +997,7 @@ discard block |
||
983 | 997 | * Finds all child and grand-child controls that are of the specified type. |
984 | 998 | * @param string the class name |
985 | 999 | * @param boolean whether the type comparison is strict or not. If false, controls of the parent classes of the specified class will also be returned. |
1000 | + * @param string $type |
|
986 | 1001 | * @return array list of controls found |
987 | 1002 | */ |
988 | 1003 | public function findControlsByType($type,$strict=true) |
@@ -1117,6 +1132,7 @@ discard block |
||
1117 | 1132 | * A component with explicit ID on a template will be registered to |
1118 | 1133 | * the template owner. This method allows you to obtain this component |
1119 | 1134 | * with the ID. |
1135 | + * @param string $name |
|
1120 | 1136 | * @return mixed the named registered object. Null if object is not found. |
1121 | 1137 | */ |
1122 | 1138 | public function getRegisteredObject($name) |
@@ -1174,6 +1190,7 @@ discard block |
||
1174 | 1190 | * Control lifecycles will be caught up during the addition. |
1175 | 1191 | * Only framework developers should use this method. |
1176 | 1192 | * @param TControl the new child control |
1193 | + * @param TControl $control |
|
1177 | 1194 | */ |
1178 | 1195 | public function addedControl($control) |
1179 | 1196 | { |
@@ -1219,6 +1236,7 @@ discard block |
||
1219 | 1236 | * Removes a control from the child collection of the control. |
1220 | 1237 | * Only framework developers should use this method. |
1221 | 1238 | * @param TControl the child control removed |
1239 | + * @param TControl $control |
|
1222 | 1240 | */ |
1223 | 1241 | public function removedControl($control) |
1224 | 1242 | { |
@@ -1470,6 +1488,7 @@ discard block |
||
1470 | 1488 | * @param string name of the broadcast event |
1471 | 1489 | * @param TControl sender of the event |
1472 | 1490 | * @param TBroadcastEventParameter event parameter |
1491 | + * @param TBroadcastEventParameter $param |
|
1473 | 1492 | */ |
1474 | 1493 | private function broadcastEventInternal($name,$sender,$param) |
1475 | 1494 | { |
@@ -1694,6 +1713,7 @@ discard block |
||
1694 | 1713 | * Clears the cached UniqueID. |
1695 | 1714 | * If $recursive=true, all children's cached UniqueID will be cleared as well. |
1696 | 1715 | * @param boolean whether the clearing is recursive. |
1716 | + * @param boolean $recursive |
|
1697 | 1717 | */ |
1698 | 1718 | private function clearCachedUniqueID($recursive) |
1699 | 1719 | { |
@@ -1731,6 +1751,7 @@ discard block |
||
1731 | 1751 | * Updates the list of the controls whose IDs are managed by the specified naming container. |
1732 | 1752 | * @param TControl the naming container |
1733 | 1753 | * @param TControlCollection list of controls |
1754 | + * @param TControl $container |
|
1734 | 1755 | * @throws TInvalidDataValueException if a control's ID is not unique within its naming container. |
1735 | 1756 | */ |
1736 | 1757 | private function fillNameTable($container,$controls) |
@@ -1900,6 +1921,7 @@ discard block |
||
1900 | 1921 | * The implementation of this function should raise appropriate event(s) (e.g. OnClick, OnCommand) |
1901 | 1922 | * indicating the component is responsible for the postback event. |
1902 | 1923 | * @param string the parameter associated with the postback event |
1924 | + * @return void |
|
1903 | 1925 | */ |
1904 | 1926 | public function raisePostBackEvent($param); |
1905 | 1927 | } |
@@ -1928,6 +1950,7 @@ discard block |
||
1928 | 1950 | * Raises postdata changed event. |
1929 | 1951 | * The implementation of this function should raise appropriate event(s) (e.g. OnTextChanged) |
1930 | 1952 | * indicating the control data is changed. |
1953 | + * @return void |
|
1931 | 1954 | */ |
1932 | 1955 | public function raisePostDataChangedEvent(); |
1933 | 1956 | /** |
@@ -1961,6 +1984,7 @@ discard block |
||
1961 | 1984 | public function getIsValid(); |
1962 | 1985 | /** |
1963 | 1986 | * @param boolean whether the validator validates successfully |
1987 | + * @return void |
|
1964 | 1988 | */ |
1965 | 1989 | public function setIsValid($value); |
1966 | 1990 | /** |
@@ -1969,6 +1993,7 @@ discard block |
||
1969 | 1993 | public function getErrorMessage(); |
1970 | 1994 | /** |
1971 | 1995 | * @param string error message for the validation |
1996 | + * @return void |
|
1972 | 1997 | */ |
1973 | 1998 | public function setErrorMessage($value); |
1974 | 1999 | } |
@@ -2036,6 +2061,7 @@ discard block |
||
2036 | 2061 | /** |
2037 | 2062 | * Applies this theme to the specified control. |
2038 | 2063 | * @param TControl the control to be applied with this theme |
2064 | + * @return boolean |
|
2039 | 2065 | */ |
2040 | 2066 | public function applySkin($control); |
2041 | 2067 | } |
@@ -2057,6 +2083,7 @@ discard block |
||
2057 | 2083 | * Content in the template will be instantiated as components and text strings |
2058 | 2084 | * and passed to the specified parent control. |
2059 | 2085 | * @param TControl the parent control |
2086 | + * @return void |
|
2060 | 2087 | */ |
2061 | 2088 | public function instantiateIn($parent); |
2062 | 2089 | } |
@@ -2081,6 +2108,8 @@ discard block |
||
2081 | 2108 | |
2082 | 2109 | /** |
2083 | 2110 | * @param string caption of the button |
2111 | + * @param string $value |
|
2112 | + * @return void |
|
2084 | 2113 | */ |
2085 | 2114 | public function setText($value); |
2086 | 2115 | |
@@ -2091,6 +2120,7 @@ discard block |
||
2091 | 2120 | |
2092 | 2121 | /** |
2093 | 2122 | * @param boolean whether postback event trigger by this button will cause input validation |
2123 | + * @return void |
|
2094 | 2124 | */ |
2095 | 2125 | public function setCausesValidation($value); |
2096 | 2126 | |
@@ -2101,6 +2131,7 @@ discard block |
||
2101 | 2131 | |
2102 | 2132 | /** |
2103 | 2133 | * @param string the command name associated with the {@link onCommand OnCommand} event. |
2134 | + * @return void |
|
2104 | 2135 | */ |
2105 | 2136 | public function setCommandName($value); |
2106 | 2137 | |
@@ -2111,6 +2142,7 @@ discard block |
||
2111 | 2142 | |
2112 | 2143 | /** |
2113 | 2144 | * @param string the parameter associated with the {@link onCommand OnCommand} event. |
2145 | + * @return void |
|
2114 | 2146 | */ |
2115 | 2147 | public function setCommandParameter($value); |
2116 | 2148 | |
@@ -2121,23 +2153,27 @@ discard block |
||
2121 | 2153 | |
2122 | 2154 | /** |
2123 | 2155 | * @param string the group of validators which the button causes validation upon postback |
2156 | + * @return void |
|
2124 | 2157 | */ |
2125 | 2158 | public function setValidationGroup($value); |
2126 | 2159 | |
2127 | 2160 | /** |
2128 | 2161 | * Raises <b>OnClick</b> event. |
2129 | 2162 | * @param TEventParameter event parameter to be passed to the event handlers |
2163 | + * @return void |
|
2130 | 2164 | */ |
2131 | 2165 | public function onClick($param); |
2132 | 2166 | |
2133 | 2167 | /** |
2134 | 2168 | * Raises <b>OnCommand</b> event. |
2135 | 2169 | * @param TCommandEventParameter event parameter to be passed to the event handlers |
2170 | + * @return void |
|
2136 | 2171 | */ |
2137 | 2172 | public function onCommand($param); |
2138 | 2173 | |
2139 | 2174 | /** |
2140 | 2175 | * @param boolean set by a panel to register this button as the default button for the panel. |
2176 | + * @return void |
|
2141 | 2177 | */ |
2142 | 2178 | public function setIsDefaultButton($value); |
2143 | 2179 |
@@ -110,17 +110,17 @@ discard block |
||
110 | 110 | * Indexes for the rare fields. |
111 | 111 | * In order to save memory, rare fields will only be created if they are needed. |
112 | 112 | */ |
113 | - const RF_CONTROLS=0; // child controls |
|
114 | - const RF_CHILD_STATE=1; // child state field |
|
115 | - const RF_NAMED_CONTROLS=2; // list of controls whose namingcontainer is this control |
|
116 | - const RF_NAMED_CONTROLS_ID=3; // counter for automatic id |
|
117 | - const RF_SKIN_ID=4; // skin ID |
|
118 | - const RF_DATA_BINDINGS=5; // data bindings |
|
119 | - const RF_EVENTS=6; // event handlers |
|
120 | - const RF_CONTROLSTATE=7; // controlstate |
|
121 | - const RF_NAMED_OBJECTS=8; // controls declared with ID on template |
|
122 | - const RF_ADAPTER=9; // adapter |
|
123 | - const RF_AUTO_BINDINGS=10; // auto data bindings |
|
113 | + const RF_CONTROLS=0; // child controls |
|
114 | + const RF_CHILD_STATE=1; // child state field |
|
115 | + const RF_NAMED_CONTROLS=2; // list of controls whose namingcontainer is this control |
|
116 | + const RF_NAMED_CONTROLS_ID=3; // counter for automatic id |
|
117 | + const RF_SKIN_ID=4; // skin ID |
|
118 | + const RF_DATA_BINDINGS=5; // data bindings |
|
119 | + const RF_EVENTS=6; // event handlers |
|
120 | + const RF_CONTROLSTATE=7; // controlstate |
|
121 | + const RF_NAMED_OBJECTS=8; // controls declared with ID on template |
|
122 | + const RF_ADAPTER=9; // adapter |
|
123 | + const RF_AUTO_BINDINGS=10; // auto data bindings |
|
124 | 124 | |
125 | 125 | /** |
126 | 126 | * @var string control ID |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function getAdapter() |
210 | 210 | { |
211 | - return isset($this->_rf[self::RF_ADAPTER])?$this->_rf[self::RF_ADAPTER]:null; |
|
211 | + return isset($this->_rf[self::RF_ADAPTER]) ? $this->_rf[self::RF_ADAPTER] : null; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -348,10 +348,10 @@ discard block |
||
348 | 348 | */ |
349 | 349 | public function setID($id) |
350 | 350 | { |
351 | - if(!preg_match(self::ID_FORMAT,$id)) |
|
352 | - throw new TInvalidDataValueException('control_id_invalid',get_class($this),$id); |
|
351 | + if(!preg_match(self::ID_FORMAT, $id)) |
|
352 | + throw new TInvalidDataValueException('control_id_invalid', get_class($this), $id); |
|
353 | 353 | $this->_id=$id; |
354 | - $this->_flags |= self::IS_ID_SET; |
|
354 | + $this->_flags|=self::IS_ID_SET; |
|
355 | 355 | $this->clearCachedUniqueID($this instanceof INamingContainer); |
356 | 356 | if($this->_namingContainer) |
357 | 357 | $this->_namingContainer->clearNameTable(); |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | { |
369 | 369 | if($this->_uid==='' || $this->_uid===null) // need to build the UniqueID |
370 | 370 | { |
371 | - $this->_uid=''; // set to not-null, so that clearCachedUniqueID() may take action |
|
371 | + $this->_uid=''; // set to not-null, so that clearCachedUniqueID() may take action |
|
372 | 372 | if($namingContainer=$this->getNamingContainer()) |
373 | 373 | { |
374 | 374 | if($this->getPage()===$namingContainer) |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | */ |
403 | 403 | public function getClientID() |
404 | 404 | { |
405 | - return strtr($this->getUniqueID(),self::ID_SEPARATOR,self::CLIENT_ID_SEPARATOR); |
|
405 | + return strtr($this->getUniqueID(), self::ID_SEPARATOR, self::CLIENT_ID_SEPARATOR); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | /** |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | */ |
413 | 413 | public static function convertUniqueIdToClientId($uniqueID) |
414 | 414 | { |
415 | - return strtr($uniqueID,self::ID_SEPARATOR,self::CLIENT_ID_SEPARATOR); |
|
415 | + return strtr($uniqueID, self::ID_SEPARATOR, self::CLIENT_ID_SEPARATOR); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | /** |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | */ |
421 | 421 | public function getSkinID() |
422 | 422 | { |
423 | - return isset($this->_rf[self::RF_SKIN_ID])?$this->_rf[self::RF_SKIN_ID]:''; |
|
423 | + return isset($this->_rf[self::RF_SKIN_ID]) ? $this->_rf[self::RF_SKIN_ID] : ''; |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | /** |
@@ -429,8 +429,8 @@ discard block |
||
429 | 429 | */ |
430 | 430 | public function setSkinID($value) |
431 | 431 | { |
432 | - if(($this->_flags & self::IS_SKIN_APPLIED) || $this->_stage>=self::CS_CHILD_INITIALIZED) |
|
433 | - throw new TInvalidOperationException('control_skinid_unchangeable',get_class($this)); |
|
432 | + if(($this->_flags & self::IS_SKIN_APPLIED) || $this->_stage >= self::CS_CHILD_INITIALIZED) |
|
433 | + throw new TInvalidOperationException('control_skinid_unchangeable', get_class($this)); |
|
434 | 434 | else |
435 | 435 | $this->_rf[self::RF_SKIN_ID]=$value; |
436 | 436 | } |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | if($this->_flags & self::IS_DISABLE_THEMING) |
454 | 454 | return false; |
455 | 455 | else |
456 | - return $this->_parent?$this->_parent->getEnableTheming():true; |
|
456 | + return $this->_parent ? $this->_parent->getEnableTheming() : true; |
|
457 | 457 | } |
458 | 458 | |
459 | 459 | /** |
@@ -462,12 +462,12 @@ discard block |
||
462 | 462 | */ |
463 | 463 | public function setEnableTheming($value) |
464 | 464 | { |
465 | - if($this->_stage>=self::CS_CHILD_INITIALIZED) |
|
466 | - throw new TInvalidOperationException('control_enabletheming_unchangeable',get_class($this),$this->getUniqueID()); |
|
465 | + if($this->_stage >= self::CS_CHILD_INITIALIZED) |
|
466 | + throw new TInvalidOperationException('control_enabletheming_unchangeable', get_class($this), $this->getUniqueID()); |
|
467 | 467 | else if(TPropertyValue::ensureBoolean($value)) |
468 | - $this->_flags &= ~self::IS_DISABLE_THEMING; |
|
468 | + $this->_flags&=~self::IS_DISABLE_THEMING; |
|
469 | 469 | else |
470 | - $this->_flags |= self::IS_DISABLE_THEMING; |
|
470 | + $this->_flags|=self::IS_DISABLE_THEMING; |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | /** |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | */ |
480 | 480 | public function getCustomData() |
481 | 481 | { |
482 | - return $this->getViewState('CustomData',null); |
|
482 | + return $this->getViewState('CustomData', null); |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | /** |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | */ |
490 | 490 | public function setCustomData($value) |
491 | 491 | { |
492 | - $this->setViewState('CustomData',$value,null); |
|
492 | + $this->setViewState('CustomData', $value, null); |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | /** |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | */ |
498 | 498 | public function getHasControls() |
499 | 499 | { |
500 | - return isset($this->_rf[self::RF_CONTROLS]) && $this->_rf[self::RF_CONTROLS]->getCount()>0; |
|
500 | + return isset($this->_rf[self::RF_CONTROLS]) && $this->_rf[self::RF_CONTROLS]->getCount() > 0; |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | /** |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | */ |
518 | 518 | protected function createControlCollection() |
519 | 519 | { |
520 | - return $this->getAllowChildControls()?new TControlCollection($this):new TEmptyControlCollection($this); |
|
520 | + return $this->getAllowChildControls() ? new TControlCollection($this) : new TEmptyControlCollection($this); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | /** |
@@ -531,13 +531,13 @@ discard block |
||
531 | 531 | { |
532 | 532 | if($checkParents) |
533 | 533 | { |
534 | - for($control=$this;$control;$control=$control->_parent) |
|
534 | + for($control=$this; $control; $control=$control->_parent) |
|
535 | 535 | if(!$control->getVisible(false)) |
536 | 536 | return false; |
537 | 537 | return true; |
538 | 538 | } |
539 | 539 | else |
540 | - return $this->getViewState('Visible',true); |
|
540 | + return $this->getViewState('Visible', true); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | /** |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | */ |
546 | 546 | public function setVisible($value) |
547 | 547 | { |
548 | - $this->setViewState('Visible',TPropertyValue::ensureBoolean($value),true); |
|
548 | + $this->setViewState('Visible', TPropertyValue::ensureBoolean($value), true); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | /** |
@@ -562,13 +562,13 @@ discard block |
||
562 | 562 | { |
563 | 563 | if($checkParents) |
564 | 564 | { |
565 | - for($control=$this;$control;$control=$control->_parent) |
|
566 | - if(!$control->getViewState('Enabled',true)) |
|
565 | + for($control=$this; $control; $control=$control->_parent) |
|
566 | + if(!$control->getViewState('Enabled', true)) |
|
567 | 567 | return false; |
568 | 568 | return true; |
569 | 569 | } |
570 | 570 | else |
571 | - return $this->getViewState('Enabled',true); |
|
571 | + return $this->getViewState('Enabled', true); |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | /** |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | */ |
577 | 577 | public function setEnabled($value) |
578 | 578 | { |
579 | - $this->setViewState('Enabled',TPropertyValue::ensureBoolean($value),true); |
|
579 | + $this->setViewState('Enabled', TPropertyValue::ensureBoolean($value), true); |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | /** |
@@ -584,8 +584,8 @@ discard block |
||
584 | 584 | */ |
585 | 585 | public function getHasAttributes() |
586 | 586 | { |
587 | - if($attributes=$this->getViewState('Attributes',null)) |
|
588 | - return $attributes->getCount()>0; |
|
587 | + if($attributes=$this->getViewState('Attributes', null)) |
|
588 | + return $attributes->getCount() > 0; |
|
589 | 589 | else |
590 | 590 | return false; |
591 | 591 | } |
@@ -598,12 +598,12 @@ discard block |
||
598 | 598 | */ |
599 | 599 | public function getAttributes() |
600 | 600 | { |
601 | - if($attributes=$this->getViewState('Attributes',null)) |
|
601 | + if($attributes=$this->getViewState('Attributes', null)) |
|
602 | 602 | return $attributes; |
603 | 603 | else |
604 | 604 | { |
605 | 605 | $attributes=new TAttributeCollection; |
606 | - $this->setViewState('Attributes',$attributes,null); |
|
606 | + $this->setViewState('Attributes', $attributes, null); |
|
607 | 607 | return $attributes; |
608 | 608 | } |
609 | 609 | } |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | */ |
614 | 614 | public function hasAttribute($name) |
615 | 615 | { |
616 | - if($attributes=$this->getViewState('Attributes',null)) |
|
616 | + if($attributes=$this->getViewState('Attributes', null)) |
|
617 | 617 | return $attributes->contains($name); |
618 | 618 | else |
619 | 619 | return false; |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | */ |
625 | 625 | public function getAttribute($name) |
626 | 626 | { |
627 | - if($attributes=$this->getViewState('Attributes',null)) |
|
627 | + if($attributes=$this->getViewState('Attributes', null)) |
|
628 | 628 | return $attributes->itemAt($name); |
629 | 629 | else |
630 | 630 | return null; |
@@ -635,9 +635,9 @@ discard block |
||
635 | 635 | * @param string attribute name |
636 | 636 | * @param string value of the attribute |
637 | 637 | */ |
638 | - public function setAttribute($name,$value) |
|
638 | + public function setAttribute($name, $value) |
|
639 | 639 | { |
640 | - $this->getAttributes()->add($name,$value); |
|
640 | + $this->getAttributes()->add($name, $value); |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | /** |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | */ |
648 | 648 | public function removeAttribute($name) |
649 | 649 | { |
650 | - if($attributes=$this->getViewState('Attributes',null)) |
|
650 | + if($attributes=$this->getViewState('Attributes', null)) |
|
651 | 651 | return $attributes->remove($name); |
652 | 652 | else |
653 | 653 | return null; |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | { |
661 | 661 | if($checkParents) |
662 | 662 | { |
663 | - for($control=$this;$control!==null;$control=$control->getParent()) |
|
663 | + for($control=$this; $control!==null; $control=$control->getParent()) |
|
664 | 664 | if($control->_flags & self::IS_DISABLE_VIEWSTATE) |
665 | 665 | return false; |
666 | 666 | return true; |
@@ -675,9 +675,9 @@ discard block |
||
675 | 675 | public function setEnableViewState($value) |
676 | 676 | { |
677 | 677 | if(TPropertyValue::ensureBoolean($value)) |
678 | - $this->_flags &= ~self::IS_DISABLE_VIEWSTATE; |
|
678 | + $this->_flags&=~self::IS_DISABLE_VIEWSTATE; |
|
679 | 679 | else |
680 | - $this->_flags |= self::IS_DISABLE_VIEWSTATE; |
|
680 | + $this->_flags|=self::IS_DISABLE_VIEWSTATE; |
|
681 | 681 | } |
682 | 682 | |
683 | 683 | /** |
@@ -689,9 +689,9 @@ discard block |
||
689 | 689 | * @param mixed the default value. If $key is not found in controlstate, $defaultValue will be returned |
690 | 690 | * @return mixed the controlstate value corresponding to $key |
691 | 691 | */ |
692 | - protected function getControlState($key,$defaultValue=null) |
|
692 | + protected function getControlState($key, $defaultValue=null) |
|
693 | 693 | { |
694 | - return isset($this->_rf[self::RF_CONTROLSTATE][$key])?$this->_rf[self::RF_CONTROLSTATE][$key]:$defaultValue; |
|
694 | + return isset($this->_rf[self::RF_CONTROLSTATE][$key]) ? $this->_rf[self::RF_CONTROLSTATE][$key] : $defaultValue; |
|
695 | 695 | } |
696 | 696 | |
697 | 697 | /** |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | * @param mixed the controlstate value to be set |
705 | 705 | * @param mixed default value. If $value===$defaultValue, the item will be cleared from controlstate |
706 | 706 | */ |
707 | - protected function setControlState($key,$value,$defaultValue=null) |
|
707 | + protected function setControlState($key, $value, $defaultValue=null) |
|
708 | 708 | { |
709 | 709 | if($value===$defaultValue) |
710 | 710 | unset($this->_rf[self::RF_CONTROLSTATE][$key]); |
@@ -741,10 +741,10 @@ discard block |
||
741 | 741 | * @param mixed the default value. If $key is not found in viewstate, $defaultValue will be returned |
742 | 742 | * @return mixed the viewstate value corresponding to $key |
743 | 743 | */ |
744 | - public function getViewState($key,$defaultValue=null) |
|
744 | + public function getViewState($key, $defaultValue=null) |
|
745 | 745 | { |
746 | 746 | if(isset($this->_viewState[$key])) |
747 | - return $this->_viewState[$key]!==null?$this->_viewState[$key]:$defaultValue; |
|
747 | + return $this->_viewState[$key]!==null ? $this->_viewState[$key] : $defaultValue; |
|
748 | 748 | else if(isset($this->_tempState[$key])) |
749 | 749 | { |
750 | 750 | if(is_object($this->_tempState[$key]) && $this->_trackViewState) |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | * @param mixed the viewstate value to be set |
766 | 766 | * @param mixed default value. If $value===$defaultValue, the item will be cleared from the viewstate. |
767 | 767 | */ |
768 | - public function setViewState($key,$value,$defaultValue=null) |
|
768 | + public function setViewState($key, $value, $defaultValue=null) |
|
769 | 769 | { |
770 | 770 | if($this->_trackViewState) |
771 | 771 | { |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | * @param string the property name, or property path |
802 | 802 | * @param string the expression |
803 | 803 | */ |
804 | - public function bindProperty($name,$expression) |
|
804 | + public function bindProperty($name, $expression) |
|
805 | 805 | { |
806 | 806 | $this->_rf[self::RF_DATA_BINDINGS][$name]=$expression; |
807 | 807 | } |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | * @param string the property name, or property path |
824 | 824 | * @param string the expression |
825 | 825 | */ |
826 | - public function autoBindProperty($name,$expression) |
|
826 | + public function autoBindProperty($name, $expression) |
|
827 | 827 | { |
828 | 828 | $this->_rf[self::RF_AUTO_BINDINGS][$name]=$expression; |
829 | 829 | } |
@@ -843,13 +843,13 @@ discard block |
||
843 | 843 | */ |
844 | 844 | protected function dataBindProperties() |
845 | 845 | { |
846 | - Prado::trace("Data bind properties",'System.Web.UI.TControl'); |
|
846 | + Prado::trace("Data bind properties", 'System.Web.UI.TControl'); |
|
847 | 847 | if(isset($this->_rf[self::RF_DATA_BINDINGS])) |
848 | 848 | { |
849 | 849 | if(($context=$this->getTemplateControl())===null) |
850 | 850 | $context=$this; |
851 | 851 | foreach($this->_rf[self::RF_DATA_BINDINGS] as $property=>$expression) |
852 | - $this->setSubProperty($property,$context->evaluateExpression($expression)); |
|
852 | + $this->setSubProperty($property, $context->evaluateExpression($expression)); |
|
853 | 853 | } |
854 | 854 | } |
855 | 855 | |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | if(($context=$this->getTemplateControl())===null) |
864 | 864 | $context=$this; |
865 | 865 | foreach($this->_rf[self::RF_AUTO_BINDINGS] as $property=>$expression) |
866 | - $this->setSubProperty($property,$context->evaluateExpression($expression)); |
|
866 | + $this->setSubProperty($property, $context->evaluateExpression($expression)); |
|
867 | 867 | } |
868 | 868 | } |
869 | 869 | |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | */ |
873 | 873 | protected function dataBindChildren() |
874 | 874 | { |
875 | - Prado::trace("dataBindChildren()",'System.Web.UI.TControl'); |
|
875 | + Prado::trace("dataBindChildren()", 'System.Web.UI.TControl'); |
|
876 | 876 | if(isset($this->_rf[self::RF_CONTROLS])) |
877 | 877 | { |
878 | 878 | foreach($this->_rf[self::RF_CONTROLS] as $control) |
@@ -897,12 +897,12 @@ discard block |
||
897 | 897 | final protected function setChildControlsCreated($value) |
898 | 898 | { |
899 | 899 | if($value) |
900 | - $this->_flags |= self::IS_CHILD_CREATED; |
|
900 | + $this->_flags|=self::IS_CHILD_CREATED; |
|
901 | 901 | else |
902 | 902 | { |
903 | 903 | if($this->getHasControls() && ($this->_flags & self::IS_CHILD_CREATED)) |
904 | 904 | $this->getControls()->clear(); |
905 | - $this->_flags &= ~self::IS_CHILD_CREATED; |
|
905 | + $this->_flags&=~self::IS_CHILD_CREATED; |
|
906 | 906 | } |
907 | 907 | } |
908 | 908 | |
@@ -917,18 +917,18 @@ discard block |
||
917 | 917 | { |
918 | 918 | try |
919 | 919 | { |
920 | - $this->_flags |= self::IS_CREATING_CHILD; |
|
920 | + $this->_flags|=self::IS_CREATING_CHILD; |
|
921 | 921 | if(isset($this->_rf[self::RF_ADAPTER])) |
922 | 922 | $this->_rf[self::RF_ADAPTER]->createChildControls(); |
923 | 923 | else |
924 | 924 | $this->createChildControls(); |
925 | - $this->_flags &= ~self::IS_CREATING_CHILD; |
|
926 | - $this->_flags |= self::IS_CHILD_CREATED; |
|
925 | + $this->_flags&=~self::IS_CREATING_CHILD; |
|
926 | + $this->_flags|=self::IS_CHILD_CREATED; |
|
927 | 927 | } |
928 | 928 | catch(Exception $e) |
929 | 929 | { |
930 | - $this->_flags &= ~self::IS_CREATING_CHILD; |
|
931 | - $this->_flags |= self::IS_CHILD_CREATED; |
|
930 | + $this->_flags&=~self::IS_CREATING_CHILD; |
|
931 | + $this->_flags|=self::IS_CHILD_CREATED; |
|
932 | 932 | throw $e; |
933 | 933 | } |
934 | 934 | } |
@@ -957,21 +957,21 @@ discard block |
||
957 | 957 | */ |
958 | 958 | public function findControl($id) |
959 | 959 | { |
960 | - $id=strtr($id,'.',self::ID_SEPARATOR); |
|
961 | - $container=($this instanceof INamingContainer)?$this:$this->getNamingContainer(); |
|
960 | + $id=strtr($id, '.', self::ID_SEPARATOR); |
|
961 | + $container=($this instanceof INamingContainer) ? $this : $this->getNamingContainer(); |
|
962 | 962 | if(!$container || !$container->getHasControls()) |
963 | 963 | return null; |
964 | 964 | if(!isset($container->_rf[self::RF_NAMED_CONTROLS])) |
965 | 965 | { |
966 | 966 | $container->_rf[self::RF_NAMED_CONTROLS]=array(); |
967 | - $container->fillNameTable($container,$container->_rf[self::RF_CONTROLS]); |
|
967 | + $container->fillNameTable($container, $container->_rf[self::RF_CONTROLS]); |
|
968 | 968 | } |
969 | - if(($pos=strpos($id,self::ID_SEPARATOR))===false) |
|
970 | - return isset($container->_rf[self::RF_NAMED_CONTROLS][$id])?$container->_rf[self::RF_NAMED_CONTROLS][$id]:null; |
|
969 | + if(($pos=strpos($id, self::ID_SEPARATOR))===false) |
|
970 | + return isset($container->_rf[self::RF_NAMED_CONTROLS][$id]) ? $container->_rf[self::RF_NAMED_CONTROLS][$id] : null; |
|
971 | 971 | else |
972 | 972 | { |
973 | - $cid=substr($id,0,$pos); |
|
974 | - $sid=substr($id,$pos+1); |
|
973 | + $cid=substr($id, 0, $pos); |
|
974 | + $sid=substr($id, $pos + 1); |
|
975 | 975 | if(isset($container->_rf[self::RF_NAMED_CONTROLS][$cid])) |
976 | 976 | return $container->_rf[self::RF_NAMED_CONTROLS][$cid]->findControl($sid); |
977 | 977 | else |
@@ -985,7 +985,7 @@ discard block |
||
985 | 985 | * @param boolean whether the type comparison is strict or not. If false, controls of the parent classes of the specified class will also be returned. |
986 | 986 | * @return array list of controls found |
987 | 987 | */ |
988 | - public function findControlsByType($type,$strict=true) |
|
988 | + public function findControlsByType($type, $strict=true) |
|
989 | 989 | { |
990 | 990 | $controls=array(); |
991 | 991 | if($this->getHasControls()) |
@@ -995,7 +995,7 @@ discard block |
||
995 | 995 | if(is_object($control) && (get_class($control)===$type || (!$strict && ($control instanceof $type)))) |
996 | 996 | $controls[]=$control; |
997 | 997 | if(($control instanceof TControl) && $control->getHasControls()) |
998 | - $controls=array_merge($controls,$control->findControlsByType($type,$strict)); |
|
998 | + $controls=array_merge($controls, $control->findControlsByType($type, $strict)); |
|
999 | 999 | } |
1000 | 1000 | } |
1001 | 1001 | return $controls; |
@@ -1021,7 +1021,7 @@ discard block |
||
1021 | 1021 | { |
1022 | 1022 | if($control->_id===$id) |
1023 | 1023 | $controls[]=$control; |
1024 | - $controls=array_merge($controls,$control->findControlsByID($id)); |
|
1024 | + $controls=array_merge($controls, $control->findControlsByID($id)); |
|
1025 | 1025 | } |
1026 | 1026 | } |
1027 | 1027 | } |
@@ -1046,10 +1046,10 @@ discard block |
||
1046 | 1046 | * @param object object to be declared |
1047 | 1047 | * @see __get |
1048 | 1048 | */ |
1049 | - public function registerObject($name,$object) |
|
1049 | + public function registerObject($name, $object) |
|
1050 | 1050 | { |
1051 | 1051 | if(isset($this->_rf[self::RF_NAMED_OBJECTS][$name])) |
1052 | - throw new TInvalidOperationException('control_object_reregistered',$name); |
|
1052 | + throw new TInvalidOperationException('control_object_reregistered', $name); |
|
1053 | 1053 | $this->_rf[self::RF_NAMED_OBJECTS][$name]=$object; |
1054 | 1054 | } |
1055 | 1055 | |
@@ -1121,7 +1121,7 @@ discard block |
||
1121 | 1121 | */ |
1122 | 1122 | public function getRegisteredObject($name) |
1123 | 1123 | { |
1124 | - return isset($this->_rf[self::RF_NAMED_OBJECTS][$name])?$this->_rf[self::RF_NAMED_OBJECTS][$name]:null; |
|
1124 | + return isset($this->_rf[self::RF_NAMED_OBJECTS][$name]) ? $this->_rf[self::RF_NAMED_OBJECTS][$name] : null; |
|
1125 | 1125 | } |
1126 | 1126 | |
1127 | 1127 | /** |
@@ -1181,7 +1181,7 @@ discard block |
||
1181 | 1181 | $control->_parent->getControls()->remove($control); |
1182 | 1182 | $control->_parent=$this; |
1183 | 1183 | $control->_page=$this->getPage(); |
1184 | - $namingContainer=($this instanceof INamingContainer)?$this:$this->_namingContainer; |
|
1184 | + $namingContainer=($this instanceof INamingContainer) ? $this : $this->_namingContainer; |
|
1185 | 1185 | if($namingContainer) |
1186 | 1186 | { |
1187 | 1187 | $control->_namingContainer=$namingContainer; |
@@ -1192,10 +1192,10 @@ discard block |
||
1192 | 1192 | $control->clearCachedUniqueID($control instanceof INamingContainer); |
1193 | 1193 | } |
1194 | 1194 | |
1195 | - if($this->_stage>=self::CS_CHILD_INITIALIZED) |
|
1195 | + if($this->_stage >= self::CS_CHILD_INITIALIZED) |
|
1196 | 1196 | { |
1197 | 1197 | $control->initRecursive($namingContainer); |
1198 | - if($this->_stage>=self::CS_STATE_LOADED) |
|
1198 | + if($this->_stage >= self::CS_STATE_LOADED) |
|
1199 | 1199 | { |
1200 | 1200 | if(isset($this->_rf[self::RF_CHILD_STATE][$control->_id])) |
1201 | 1201 | { |
@@ -1204,11 +1204,11 @@ discard block |
||
1204 | 1204 | } |
1205 | 1205 | else |
1206 | 1206 | $state=null; |
1207 | - $control->loadStateRecursive($state,!($this->_flags & self::IS_DISABLE_VIEWSTATE)); |
|
1208 | - if($this->_stage>=self::CS_LOADED) |
|
1207 | + $control->loadStateRecursive($state, !($this->_flags & self::IS_DISABLE_VIEWSTATE)); |
|
1208 | + if($this->_stage >= self::CS_LOADED) |
|
1209 | 1209 | { |
1210 | 1210 | $control->loadRecursive(); |
1211 | - if($this->_stage>=self::CS_PRERENDERED) |
|
1211 | + if($this->_stage >= self::CS_PRERENDERED) |
|
1212 | 1212 | $control->preRenderRecursive(); |
1213 | 1213 | } |
1214 | 1214 | } |
@@ -1262,13 +1262,13 @@ discard block |
||
1262 | 1262 | } |
1263 | 1263 | } |
1264 | 1264 | } |
1265 | - if($this->_stage<self::CS_INITIALIZED) |
|
1265 | + if($this->_stage < self::CS_INITIALIZED) |
|
1266 | 1266 | { |
1267 | 1267 | $this->_stage=self::CS_CHILD_INITIALIZED; |
1268 | 1268 | if(($page=$this->getPage()) && $this->getEnableTheming() && !($this->_flags & self::IS_SKIN_APPLIED)) |
1269 | 1269 | { |
1270 | 1270 | $page->applyControlSkin($this); |
1271 | - $this->_flags |= self::IS_SKIN_APPLIED; |
|
1271 | + $this->_flags|=self::IS_SKIN_APPLIED; |
|
1272 | 1272 | } |
1273 | 1273 | if(isset($this->_rf[self::RF_ADAPTER])) |
1274 | 1274 | $this->_rf[self::RF_ADAPTER]->onInit(null); |
@@ -1284,7 +1284,7 @@ discard block |
||
1284 | 1284 | */ |
1285 | 1285 | protected function loadRecursive() |
1286 | 1286 | { |
1287 | - if($this->_stage<self::CS_LOADED) |
|
1287 | + if($this->_stage < self::CS_LOADED) |
|
1288 | 1288 | { |
1289 | 1289 | if(isset($this->_rf[self::RF_ADAPTER])) |
1290 | 1290 | $this->_rf[self::RF_ADAPTER]->onLoad(null); |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | $control->loadRecursive(); |
1300 | 1300 | } |
1301 | 1301 | } |
1302 | - if($this->_stage<self::CS_LOADED) |
|
1302 | + if($this->_stage < self::CS_LOADED) |
|
1303 | 1303 | $this->_stage=self::CS_LOADED; |
1304 | 1304 | } |
1305 | 1305 | |
@@ -1360,7 +1360,7 @@ discard block |
||
1360 | 1360 | */ |
1361 | 1361 | public function onInit($param) |
1362 | 1362 | { |
1363 | - $this->raiseEvent('OnInit',$this,$param); |
|
1363 | + $this->raiseEvent('OnInit', $this, $param); |
|
1364 | 1364 | } |
1365 | 1365 | |
1366 | 1366 | /** |
@@ -1372,7 +1372,7 @@ discard block |
||
1372 | 1372 | */ |
1373 | 1373 | public function onLoad($param) |
1374 | 1374 | { |
1375 | - $this->raiseEvent('OnLoad',$this,$param); |
|
1375 | + $this->raiseEvent('OnLoad', $this, $param); |
|
1376 | 1376 | } |
1377 | 1377 | |
1378 | 1378 | /** |
@@ -1382,8 +1382,8 @@ discard block |
||
1382 | 1382 | */ |
1383 | 1383 | public function onDataBinding($param) |
1384 | 1384 | { |
1385 | - Prado::trace("onDataBinding()",'System.Web.UI.TControl'); |
|
1386 | - $this->raiseEvent('OnDataBinding',$this,$param); |
|
1385 | + Prado::trace("onDataBinding()", 'System.Web.UI.TControl'); |
|
1386 | + $this->raiseEvent('OnDataBinding', $this, $param); |
|
1387 | 1387 | } |
1388 | 1388 | |
1389 | 1389 | |
@@ -1396,7 +1396,7 @@ discard block |
||
1396 | 1396 | */ |
1397 | 1397 | public function onUnload($param) |
1398 | 1398 | { |
1399 | - $this->raiseEvent('OnUnload',$this,$param); |
|
1399 | + $this->raiseEvent('OnUnload', $this, $param); |
|
1400 | 1400 | } |
1401 | 1401 | |
1402 | 1402 | /** |
@@ -1408,7 +1408,7 @@ discard block |
||
1408 | 1408 | */ |
1409 | 1409 | public function onPreRender($param) |
1410 | 1410 | { |
1411 | - $this->raiseEvent('OnPreRender',$this,$param); |
|
1411 | + $this->raiseEvent('OnPreRender', $this, $param); |
|
1412 | 1412 | } |
1413 | 1413 | |
1414 | 1414 | /** |
@@ -1418,12 +1418,12 @@ discard block |
||
1418 | 1418 | * @param TEventParameter event parameter |
1419 | 1419 | * @see bubbleEvent |
1420 | 1420 | */ |
1421 | - protected function raiseBubbleEvent($sender,$param) |
|
1421 | + protected function raiseBubbleEvent($sender, $param) |
|
1422 | 1422 | { |
1423 | 1423 | $control=$this; |
1424 | 1424 | while($control=$control->_parent) |
1425 | 1425 | { |
1426 | - if($control->bubbleEvent($sender,$param)) |
|
1426 | + if($control->bubbleEvent($sender, $param)) |
|
1427 | 1427 | break; |
1428 | 1428 | } |
1429 | 1429 | } |
@@ -1437,7 +1437,7 @@ discard block |
||
1437 | 1437 | * @return boolean true if the event bubbling is handled and no more bubbling. |
1438 | 1438 | * @see raiseBubbleEvent |
1439 | 1439 | */ |
1440 | - public function bubbleEvent($sender,$param) |
|
1440 | + public function bubbleEvent($sender, $param) |
|
1441 | 1441 | { |
1442 | 1442 | return false; |
1443 | 1443 | } |
@@ -1458,10 +1458,10 @@ discard block |
||
1458 | 1458 | * @param TControl sender of this event |
1459 | 1459 | * @param TEventParameter event parameter |
1460 | 1460 | */ |
1461 | - public function broadcastEvent($name,$sender,$param) |
|
1461 | + public function broadcastEvent($name, $sender, $param) |
|
1462 | 1462 | { |
1463 | - $rootControl=(($page=$this->getPage())===null)?$this:$page; |
|
1464 | - $rootControl->broadcastEventInternal($name,$sender,new TBroadcastEventParameter($name,$param)); |
|
1463 | + $rootControl=(($page=$this->getPage())===null) ? $this : $page; |
|
1464 | + $rootControl->broadcastEventInternal($name, $sender, new TBroadcastEventParameter($name, $param)); |
|
1465 | 1465 | } |
1466 | 1466 | |
1467 | 1467 | /** |
@@ -1471,18 +1471,18 @@ discard block |
||
1471 | 1471 | * @param TControl sender of the event |
1472 | 1472 | * @param TBroadcastEventParameter event parameter |
1473 | 1473 | */ |
1474 | - private function broadcastEventInternal($name,$sender,$param) |
|
1474 | + private function broadcastEventInternal($name, $sender, $param) |
|
1475 | 1475 | { |
1476 | 1476 | if($this->hasEvent($name)) |
1477 | - $this->raiseEvent($name,$sender,$param->getParameter()); |
|
1477 | + $this->raiseEvent($name, $sender, $param->getParameter()); |
|
1478 | 1478 | if($this instanceof IBroadcastEventReceiver) |
1479 | - $this->broadcastEventReceived($sender,$param); |
|
1479 | + $this->broadcastEventReceived($sender, $param); |
|
1480 | 1480 | if($this->getHasControls()) |
1481 | 1481 | { |
1482 | 1482 | foreach($this->_rf[self::RF_CONTROLS] as $control) |
1483 | 1483 | { |
1484 | 1484 | if($control instanceof TControl) |
1485 | - $control->broadcastEventInternal($name,$sender,$param); |
|
1485 | + $control->broadcastEventInternal($name, $sender, $param); |
|
1486 | 1486 | } |
1487 | 1487 | } |
1488 | 1488 | } |
@@ -1504,22 +1504,22 @@ discard block |
||
1504 | 1504 | * @param callback callback invoked before traversing child controls. If null, it is ignored. |
1505 | 1505 | * @param callback callback invoked after traversing child controls. If null, it is ignored. |
1506 | 1506 | */ |
1507 | - protected function traverseChildControls($param,$preCallback=null,$postCallback=null) |
|
1507 | + protected function traverseChildControls($param, $preCallback=null, $postCallback=null) |
|
1508 | 1508 | { |
1509 | 1509 | if($preCallback!==null) |
1510 | - call_user_func($preCallback,$this,$param); |
|
1510 | + call_user_func($preCallback, $this, $param); |
|
1511 | 1511 | if($this->getHasControls()) |
1512 | 1512 | { |
1513 | 1513 | foreach($this->_rf[self::RF_CONTROLS] as $control) |
1514 | 1514 | { |
1515 | 1515 | if($control instanceof TControl) |
1516 | 1516 | { |
1517 | - $control->traverseChildControls($param,$preCallback,$postCallback); |
|
1517 | + $control->traverseChildControls($param, $preCallback, $postCallback); |
|
1518 | 1518 | } |
1519 | 1519 | } |
1520 | 1520 | } |
1521 | 1521 | if($postCallback!==null) |
1522 | - call_user_func($postCallback,$this,$param); |
|
1522 | + call_user_func($postCallback, $this, $param); |
|
1523 | 1523 | } |
1524 | 1524 | |
1525 | 1525 | /** |
@@ -1596,7 +1596,7 @@ discard block |
||
1596 | 1596 | * @param array the collection of the state |
1597 | 1597 | * @param boolean whether the viewstate should be loaded |
1598 | 1598 | */ |
1599 | - protected function loadStateRecursive(&$state,$needViewState=true) |
|
1599 | + protected function loadStateRecursive(&$state, $needViewState=true) |
|
1600 | 1600 | { |
1601 | 1601 | if(is_array($state)) |
1602 | 1602 | { |
@@ -1626,7 +1626,7 @@ discard block |
||
1626 | 1626 | { |
1627 | 1627 | if(isset($state[$control->_id])) |
1628 | 1628 | { |
1629 | - $control->loadStateRecursive($state[$control->_id],$needViewState); |
|
1629 | + $control->loadStateRecursive($state[$control->_id], $needViewState); |
|
1630 | 1630 | unset($state[$control->_id]); |
1631 | 1631 | } |
1632 | 1632 | } |
@@ -1662,7 +1662,7 @@ discard block |
||
1662 | 1662 | { |
1663 | 1663 | if($control instanceof TControl) |
1664 | 1664 | { |
1665 | - if(count($tmp = &$control->saveStateRecursive($needViewState))) |
|
1665 | + if(count($tmp=&$control->saveStateRecursive($needViewState))) |
|
1666 | 1666 | $state[$control->_id]=$tmp; |
1667 | 1667 | } |
1668 | 1668 | } |
@@ -1684,10 +1684,10 @@ discard block |
||
1684 | 1684 | if($page && !($this->_flags & self::IS_STYLESHEET_APPLIED)) |
1685 | 1685 | { |
1686 | 1686 | $page->applyControlStyleSheet($this); |
1687 | - $this->_flags |= self::IS_STYLESHEET_APPLIED; |
|
1687 | + $this->_flags|=self::IS_STYLESHEET_APPLIED; |
|
1688 | 1688 | } |
1689 | 1689 | else if($this->_flags & self::IS_STYLESHEET_APPLIED) |
1690 | - throw new TInvalidOperationException('control_stylesheet_applied',get_class($this)); |
|
1690 | + throw new TInvalidOperationException('control_stylesheet_applied', get_class($this)); |
|
1691 | 1691 | } |
1692 | 1692 | |
1693 | 1693 | /** |
@@ -1711,11 +1711,11 @@ discard block |
||
1711 | 1711 | */ |
1712 | 1712 | private function generateAutomaticID() |
1713 | 1713 | { |
1714 | - $this->_flags &= ~self::IS_ID_SET; |
|
1714 | + $this->_flags&=~self::IS_ID_SET; |
|
1715 | 1715 | if(!isset($this->_namingContainer->_rf[self::RF_NAMED_CONTROLS_ID])) |
1716 | 1716 | $this->_namingContainer->_rf[self::RF_NAMED_CONTROLS_ID]=0; |
1717 | 1717 | $id=$this->_namingContainer->_rf[self::RF_NAMED_CONTROLS_ID]++; |
1718 | - $this->_id=self::AUTOMATIC_ID_PREFIX . $id; |
|
1718 | + $this->_id=self::AUTOMATIC_ID_PREFIX.$id; |
|
1719 | 1719 | $this->_namingContainer->clearNameTable(); |
1720 | 1720 | } |
1721 | 1721 | |
@@ -1733,7 +1733,7 @@ discard block |
||
1733 | 1733 | * @param TControlCollection list of controls |
1734 | 1734 | * @throws TInvalidDataValueException if a control's ID is not unique within its naming container. |
1735 | 1735 | */ |
1736 | - private function fillNameTable($container,$controls) |
|
1736 | + private function fillNameTable($container, $controls) |
|
1737 | 1737 | { |
1738 | 1738 | foreach($controls as $control) |
1739 | 1739 | { |
@@ -1742,12 +1742,12 @@ discard block |
||
1742 | 1742 | if($control->_id!=='') |
1743 | 1743 | { |
1744 | 1744 | if(isset($container->_rf[self::RF_NAMED_CONTROLS][$control->_id])) |
1745 | - throw new TInvalidDataValueException('control_id_nonunique',get_class($control),$control->_id); |
|
1745 | + throw new TInvalidDataValueException('control_id_nonunique', get_class($control), $control->_id); |
|
1746 | 1746 | else |
1747 | 1747 | $container->_rf[self::RF_NAMED_CONTROLS][$control->_id]=$control; |
1748 | 1748 | } |
1749 | 1749 | if(!($control instanceof INamingContainer) && $control->getHasControls()) |
1750 | - $this->fillNameTable($container,$control->_rf[self::RF_CONTROLS]); |
|
1750 | + $this->fillNameTable($container, $control->_rf[self::RF_CONTROLS]); |
|
1751 | 1751 | } |
1752 | 1752 | } |
1753 | 1753 | } |
@@ -1777,10 +1777,10 @@ discard block |
||
1777 | 1777 | * @param TControl the control that owns this collection. |
1778 | 1778 | * @param boolean whether the list is read-only |
1779 | 1779 | */ |
1780 | - public function __construct(TControl $owner,$readOnly=false) |
|
1780 | + public function __construct(TControl $owner, $readOnly=false) |
|
1781 | 1781 | { |
1782 | 1782 | $this->_o=$owner; |
1783 | - parent::__construct(null,$readOnly); |
|
1783 | + parent::__construct(null, $readOnly); |
|
1784 | 1784 | } |
1785 | 1785 | |
1786 | 1786 | /** |
@@ -1799,15 +1799,15 @@ discard block |
||
1799 | 1799 | * @param mixed new item |
1800 | 1800 | * @throws TInvalidDataTypeException if the item to be inserted is neither a string nor a TControl. |
1801 | 1801 | */ |
1802 | - public function insertAt($index,$item) |
|
1802 | + public function insertAt($index, $item) |
|
1803 | 1803 | { |
1804 | 1804 | if($item instanceof TControl) |
1805 | 1805 | { |
1806 | - parent::insertAt($index,$item); |
|
1806 | + parent::insertAt($index, $item); |
|
1807 | 1807 | $this->_o->addedControl($item); |
1808 | 1808 | } |
1809 | 1809 | else if(is_string($item) || ($item instanceof IRenderable)) |
1810 | - parent::insertAt($index,$item); |
|
1810 | + parent::insertAt($index, $item); |
|
1811 | 1811 | else |
1812 | 1812 | throw new TInvalidDataTypeException('controlcollection_control_required'); |
1813 | 1813 | } |
@@ -1856,7 +1856,7 @@ discard block |
||
1856 | 1856 | */ |
1857 | 1857 | public function __construct(TControl $owner) |
1858 | 1858 | { |
1859 | - parent::__construct($owner,true); |
|
1859 | + parent::__construct($owner, true); |
|
1860 | 1860 | } |
1861 | 1861 | |
1862 | 1862 | /** |
@@ -1865,10 +1865,10 @@ discard block |
||
1865 | 1865 | * @param integer the speicified position. |
1866 | 1866 | * @param mixed new item |
1867 | 1867 | */ |
1868 | - public function insertAt($index,$item) |
|
1868 | + public function insertAt($index, $item) |
|
1869 | 1869 | { |
1870 | 1870 | if(!is_string($item)) // string is possible if property tag is used. we simply ignore it in this case |
1871 | - parent::insertAt($index,$item); // this will generate an exception in parent implementation |
|
1871 | + parent::insertAt($index, $item); // this will generate an exception in parent implementation |
|
1872 | 1872 | } |
1873 | 1873 | } |
1874 | 1874 | |
@@ -1923,7 +1923,7 @@ discard block |
||
1923 | 1923 | * @param array the input data collection |
1924 | 1924 | * @return boolean whether the data of the control has been changed |
1925 | 1925 | */ |
1926 | - public function loadPostData($key,$values); |
|
1926 | + public function loadPostData($key, $values); |
|
1927 | 1927 | /** |
1928 | 1928 | * Raises postdata changed event. |
1929 | 1929 | * The implementation of this function should raise appropriate event(s) (e.g. OnTextChanged) |
@@ -2019,7 +2019,7 @@ discard block |
||
2019 | 2019 | * @param TControl sender of the event |
2020 | 2020 | * @param TBroadCastEventParameter event parameter |
2021 | 2021 | */ |
2022 | - public function broadcastEventReceived($sender,$param); |
|
2022 | + public function broadcastEventReceived($sender, $param); |
|
2023 | 2023 | } |
2024 | 2024 | |
2025 | 2025 | /** |
@@ -2192,7 +2192,7 @@ discard block |
||
2192 | 2192 | * @param string name of the broadcast event |
2193 | 2193 | * @param mixed parameter of the broadcast event |
2194 | 2194 | */ |
2195 | - public function __construct($name='',$parameter=null) |
|
2195 | + public function __construct($name='', $parameter=null) |
|
2196 | 2196 | { |
2197 | 2197 | $this->_name=$name; |
2198 | 2198 | $this->_param=$parameter; |
@@ -2253,7 +2253,7 @@ discard block |
||
2253 | 2253 | * @param string name of the command |
2254 | 2254 | * @param string parameter of the command |
2255 | 2255 | */ |
2256 | - public function __construct($name='',$parameter='') |
|
2256 | + public function __construct($name='', $parameter='') |
|
2257 | 2257 | { |
2258 | 2258 | $this->_name=$name; |
2259 | 2259 | $this->_param=$parameter; |
@@ -2345,7 +2345,7 @@ discard block |
||
2345 | 2345 | */ |
2346 | 2346 | public function evaluateDynamicContent() |
2347 | 2347 | { |
2348 | - $context=$this->_container===null?$this:$this->_container; |
|
2348 | + $context=$this->_container===null ? $this : $this->_container; |
|
2349 | 2349 | foreach($this->_expressions as $id=>$expression) |
2350 | 2350 | $this->_items[$id]=$context->evaluateExpression($expression); |
2351 | 2351 | foreach($this->_statements as $id=>$statement) |
@@ -2358,7 +2358,7 @@ discard block |
||
2358 | 2358 | */ |
2359 | 2359 | public function dataBind() |
2360 | 2360 | { |
2361 | - $context=$this->_container===null?$this:$this->_container; |
|
2361 | + $context=$this->_container===null ? $this : $this->_container; |
|
2362 | 2362 | foreach($this->_bindings as $id=>$binding) |
2363 | 2363 | $this->_items[$id]=$context->evaluateExpression($binding); |
2364 | 2364 | } |
@@ -2370,7 +2370,7 @@ discard block |
||
2370 | 2370 | */ |
2371 | 2371 | public function render($writer) |
2372 | 2372 | { |
2373 | - $writer->write(implode('',$this->_items)); |
|
2373 | + $writer->write(implode('', $this->_items)); |
|
2374 | 2374 | } |
2375 | 2375 | } |
2376 | 2376 |
@@ -377,11 +377,9 @@ discard block |
||
377 | 377 | return $this->_id; |
378 | 378 | else |
379 | 379 | return ($this->_uid=$prefix.self::ID_SEPARATOR.$this->_id); |
380 | - } |
|
381 | - else // no naming container |
|
380 | + } else // no naming container |
|
382 | 381 | return $this->_id; |
383 | - } |
|
384 | - else |
|
382 | + } else |
|
385 | 383 | return $this->_uid; |
386 | 384 | } |
387 | 385 | |
@@ -535,8 +533,7 @@ discard block |
||
535 | 533 | if(!$control->getVisible(false)) |
536 | 534 | return false; |
537 | 535 | return true; |
538 | - } |
|
539 | - else |
|
536 | + } else |
|
540 | 537 | return $this->getViewState('Visible',true); |
541 | 538 | } |
542 | 539 | |
@@ -566,8 +563,7 @@ discard block |
||
566 | 563 | if(!$control->getViewState('Enabled',true)) |
567 | 564 | return false; |
568 | 565 | return true; |
569 | - } |
|
570 | - else |
|
566 | + } else |
|
571 | 567 | return $this->getViewState('Enabled',true); |
572 | 568 | } |
573 | 569 | |
@@ -664,8 +660,7 @@ discard block |
||
664 | 660 | if($control->_flags & self::IS_DISABLE_VIEWSTATE) |
665 | 661 | return false; |
666 | 662 | return true; |
667 | - } |
|
668 | - else |
|
663 | + } else |
|
669 | 664 | return !($this->_flags & self::IS_DISABLE_VIEWSTATE); |
670 | 665 | } |
671 | 666 | |
@@ -750,8 +745,7 @@ discard block |
||
750 | 745 | if(is_object($this->_tempState[$key]) && $this->_trackViewState) |
751 | 746 | $this->_viewState[$key]=$this->_tempState[$key]; |
752 | 747 | return $this->_tempState[$key]; |
753 | - } |
|
754 | - else |
|
748 | + } else |
|
755 | 749 | return $defaultValue; |
756 | 750 | } |
757 | 751 | |
@@ -774,8 +768,7 @@ discard block |
||
774 | 768 | unset($this->_viewState[$key]); |
775 | 769 | else |
776 | 770 | $this->_viewState[$key]=$value; |
777 | - } |
|
778 | - else |
|
771 | + } else |
|
779 | 772 | { |
780 | 773 | unset($this->_viewState[$key]); |
781 | 774 | if($value===$defaultValue) |
@@ -924,8 +917,7 @@ discard block |
||
924 | 917 | $this->createChildControls(); |
925 | 918 | $this->_flags &= ~self::IS_CREATING_CHILD; |
926 | 919 | $this->_flags |= self::IS_CHILD_CREATED; |
927 | - } |
|
928 | - catch(Exception $e) |
|
920 | + } catch(Exception $e) |
|
929 | 921 | { |
930 | 922 | $this->_flags &= ~self::IS_CREATING_CHILD; |
931 | 923 | $this->_flags |= self::IS_CHILD_CREATED; |
@@ -1164,8 +1156,9 @@ discard block |
||
1164 | 1156 | final protected function isDescendentOf($ancestor) |
1165 | 1157 | { |
1166 | 1158 | $control=$this; |
1167 | - while($control!==$ancestor && $control->_parent) |
|
1168 | - $control=$control->_parent; |
|
1159 | + while($control!==$ancestor && $control->_parent) { |
|
1160 | + $control=$control->_parent; |
|
1161 | + } |
|
1169 | 1162 | return $control===$ancestor; |
1170 | 1163 | } |
1171 | 1164 | |
@@ -1201,8 +1194,7 @@ discard block |
||
1201 | 1194 | { |
1202 | 1195 | $state=$this->_rf[self::RF_CHILD_STATE][$control->_id]; |
1203 | 1196 | unset($this->_rf[self::RF_CHILD_STATE][$control->_id]); |
1204 | - } |
|
1205 | - else |
|
1197 | + } else |
|
1206 | 1198 | $state=null; |
1207 | 1199 | $control->loadStateRecursive($state,!($this->_flags & self::IS_DISABLE_VIEWSTATE)); |
1208 | 1200 | if($this->_stage>=self::CS_LOADED) |
@@ -1607,8 +1599,7 @@ discard block |
||
1607 | 1599 | { |
1608 | 1600 | $this->_rf[self::RF_CONTROLSTATE]=&$state[1]; |
1609 | 1601 | unset($state[1]); |
1610 | - } |
|
1611 | - else |
|
1602 | + } else |
|
1612 | 1603 | unset($this->_rf[self::RF_CONTROLSTATE]); |
1613 | 1604 | if($needViewState) |
1614 | 1605 | { |
@@ -1685,8 +1676,7 @@ discard block |
||
1685 | 1676 | { |
1686 | 1677 | $page->applyControlStyleSheet($this); |
1687 | 1678 | $this->_flags |= self::IS_STYLESHEET_APPLIED; |
1688 | - } |
|
1689 | - else if($this->_flags & self::IS_STYLESHEET_APPLIED) |
|
1679 | + } else if($this->_flags & self::IS_STYLESHEET_APPLIED) |
|
1690 | 1680 | throw new TInvalidOperationException('control_stylesheet_applied',get_class($this)); |
1691 | 1681 | } |
1692 | 1682 | |
@@ -1805,8 +1795,7 @@ discard block |
||
1805 | 1795 | { |
1806 | 1796 | parent::insertAt($index,$item); |
1807 | 1797 | $this->_o->addedControl($item); |
1808 | - } |
|
1809 | - else if(is_string($item) || ($item instanceof IRenderable)) |
|
1798 | + } else if(is_string($item) || ($item instanceof IRenderable)) |
|
1810 | 1799 | parent::insertAt($index,$item); |
1811 | 1800 | else |
1812 | 1801 | throw new TInvalidDataTypeException('controlcollection_control_required'); |
@@ -2318,8 +2307,7 @@ discard block |
||
2318 | 2307 | else if($item[0]===self::TYPE_DATABINDING) |
2319 | 2308 | $this->_bindings[$id]=$item[1]; |
2320 | 2309 | $this->_items[$id]=''; |
2321 | - } |
|
2322 | - else |
|
2310 | + } else |
|
2323 | 2311 | $this->_items[$id]=$item; |
2324 | 2312 | } |
2325 | 2313 | } |
@@ -220,6 +220,7 @@ discard block |
||
220 | 220 | * If you override this method, be sure to call the parent implementation |
221 | 221 | * so that the event handler can be invoked. |
222 | 222 | * @param TImageClickEventParameter event parameter to be passed to the event handlers |
223 | + * @param TImageClickEventParameter $param |
|
223 | 224 | */ |
224 | 225 | public function onClick($param) |
225 | 226 | { |
@@ -232,6 +233,7 @@ discard block |
||
232 | 233 | * If you override this method, be sure to call the parent implementation |
233 | 234 | * so that the event handlers can be invoked. |
234 | 235 | * @param TCommandEventParameter event parameter to be passed to the event handlers |
236 | + * @param TCommandEventParameter $param |
|
235 | 237 | */ |
236 | 238 | public function onCommand($param) |
237 | 239 | { |
@@ -324,6 +326,7 @@ discard block |
||
324 | 326 | |
325 | 327 | /** |
326 | 328 | * @param string the group of validators which the button causes validation upon postback |
329 | + * @param string $value |
|
327 | 330 | */ |
328 | 331 | public function setValidationGroup($value) |
329 | 332 | { |
@@ -396,6 +399,8 @@ discard block |
||
396 | 399 | * Constructor. |
397 | 400 | * @param integer X coordinate of the clicking point |
398 | 401 | * @param integer Y coordinate of the clicking point |
402 | + * @param integer $x |
|
403 | + * @param integer $y |
|
399 | 404 | */ |
400 | 405 | public function __construct($x,$y) |
401 | 406 | { |
@@ -106,8 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | if($this->getEnableClientScript() && $this->needPostBackScript()) |
108 | 108 | $this->renderClientControlScript($writer); |
109 | - } |
|
110 | - else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
109 | + } else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
111 | 110 | $writer->addAttribute('disabled','disabled'); |
112 | 111 | parent::addAttributesToRender($writer); |
113 | 112 | } |
@@ -141,8 +140,7 @@ discard block |
||
141 | 140 | { |
142 | 141 | $group=$this->getValidationGroup(); |
143 | 142 | return $this->getPage()->getValidators($group)->getCount()>0; |
144 | - } |
|
145 | - else |
|
143 | + } else |
|
146 | 144 | return false; |
147 | 145 | } |
148 | 146 |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function getEnableClientScript() |
81 | 81 | { |
82 | - return $this->getViewState('EnableClientScript',true); |
|
82 | + return $this->getViewState('EnableClientScript', true); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function setEnableClientScript($value) |
89 | 89 | { |
90 | - $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true); |
|
90 | + $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -99,16 +99,16 @@ discard block |
||
99 | 99 | { |
100 | 100 | $page=$this->getPage(); |
101 | 101 | $page->ensureRenderInForm($this); |
102 | - $writer->addAttribute('type','image'); |
|
102 | + $writer->addAttribute('type', 'image'); |
|
103 | 103 | if(($uniqueID=$this->getUniqueID())!=='') |
104 | - $writer->addAttribute('name',$uniqueID); |
|
104 | + $writer->addAttribute('name', $uniqueID); |
|
105 | 105 | if($this->getEnabled(true)) |
106 | 106 | { |
107 | 107 | if($this->getEnableClientScript() && $this->needPostBackScript()) |
108 | 108 | $this->renderClientControlScript($writer); |
109 | 109 | } |
110 | 110 | else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
111 | - $writer->addAttribute('disabled','disabled'); |
|
111 | + $writer->addAttribute('disabled', 'disabled'); |
|
112 | 112 | parent::addAttributesToRender($writer); |
113 | 113 | } |
114 | 114 | |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected function renderClientControlScript($writer) |
119 | 119 | { |
120 | - $writer->addAttribute('id',$this->getClientID()); |
|
121 | - $cs = $this->getPage()->getClientScript(); |
|
122 | - $cs->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); |
|
120 | + $writer->addAttribute('id', $this->getClientID()); |
|
121 | + $cs=$this->getPage()->getClientScript(); |
|
122 | + $cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | if($this->getCausesValidation()) |
141 | 141 | { |
142 | 142 | $group=$this->getValidationGroup(); |
143 | - return $this->getPage()->getValidators($group)->getCount()>0; |
|
143 | + return $this->getPage()->getValidators($group)->getCount() > 0; |
|
144 | 144 | } |
145 | 145 | else |
146 | 146 | return false; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function setIsDefaultButton($value) |
153 | 153 | { |
154 | - $this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value),false); |
|
154 | + $this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value), false); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | */ |
178 | 178 | protected function getPostBackOptions() |
179 | 179 | { |
180 | - $options['ID'] = $this->getClientID(); |
|
181 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
182 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
183 | - $options['EventTarget'] = $this->getUniqueID(); |
|
180 | + $options['ID']=$this->getClientID(); |
|
181 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
182 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
183 | + $options['EventTarget']=$this->getUniqueID(); |
|
184 | 184 | |
185 | 185 | return $options; |
186 | 186 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @param array the input data collection |
193 | 193 | * @return boolean whether the data of the component has been changed |
194 | 194 | */ |
195 | - public function loadPostData($key,$values) |
|
195 | + public function loadPostData($key, $values) |
|
196 | 196 | { |
197 | 197 | $uid=$this->getUniqueID(); |
198 | 198 | if(isset($values["{$uid}_x"]) && isset($values["{$uid}_y"])) |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public function onClick($param) |
225 | 225 | { |
226 | - $this->raiseEvent('OnClick',$this,$param); |
|
226 | + $this->raiseEvent('OnClick', $this, $param); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function onCommand($param) |
237 | 237 | { |
238 | - $this->raiseEvent('OnCommand',$this,$param); |
|
239 | - $this->raiseBubbleEvent($this,$param); |
|
238 | + $this->raiseEvent('OnCommand', $this, $param); |
|
239 | + $this->raiseBubbleEvent($this, $param); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | { |
253 | 253 | if($this->getCausesValidation()) |
254 | 254 | $this->getPage()->validate($this->getValidationGroup()); |
255 | - $this->onClick(new TImageClickEventParameter($this->_x,$this->_y)); |
|
256 | - $this->onCommand(new TCommandEventParameter($this->getCommandName(),$this->getCommandParameter())); |
|
255 | + $this->onClick(new TImageClickEventParameter($this->_x, $this->_y)); |
|
256 | + $this->onCommand(new TCommandEventParameter($this->getCommandName(), $this->getCommandParameter())); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | */ |
272 | 272 | public function getCausesValidation() |
273 | 273 | { |
274 | - return $this->getViewState('CausesValidation',true); |
|
274 | + return $this->getViewState('CausesValidation', true); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | */ |
280 | 280 | public function setCausesValidation($value) |
281 | 281 | { |
282 | - $this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
282 | + $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | */ |
288 | 288 | public function getCommandName() |
289 | 289 | { |
290 | - return $this->getViewState('CommandName',''); |
|
290 | + return $this->getViewState('CommandName', ''); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | */ |
296 | 296 | public function setCommandName($value) |
297 | 297 | { |
298 | - $this->setViewState('CommandName',$value,''); |
|
298 | + $this->setViewState('CommandName', $value, ''); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | */ |
304 | 304 | public function getCommandParameter() |
305 | 305 | { |
306 | - return $this->getViewState('CommandParameter',''); |
|
306 | + return $this->getViewState('CommandParameter', ''); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | /** |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | */ |
312 | 312 | public function setCommandParameter($value) |
313 | 313 | { |
314 | - $this->setViewState('CommandParameter',$value,''); |
|
314 | + $this->setViewState('CommandParameter', $value, ''); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | public function getValidationGroup() |
321 | 321 | { |
322 | - return $this->getViewState('ValidationGroup',''); |
|
322 | + return $this->getViewState('ValidationGroup', ''); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | /** |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | public function setValidationGroup($value) |
329 | 329 | { |
330 | - $this->setViewState('ValidationGroup',$value,''); |
|
330 | + $this->setViewState('ValidationGroup', $value, ''); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | /** |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | * @param integer X coordinate of the clicking point |
398 | 398 | * @param integer Y coordinate of the clicking point |
399 | 399 | */ |
400 | - public function __construct($x,$y) |
|
400 | + public function __construct($x, $y) |
|
401 | 401 | { |
402 | 402 | $this->_x=$x; |
403 | 403 | $this->_y=$y; |
@@ -92,6 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | /** |
94 | 94 | * @param boolean whether the item is enabled |
95 | + * @param boolean $value |
|
95 | 96 | */ |
96 | 97 | public function setEnabled($value) |
97 | 98 | { |
@@ -108,6 +109,7 @@ discard block |
||
108 | 109 | |
109 | 110 | /** |
110 | 111 | * @param boolean whether the item is selected |
112 | + * @param boolean $value |
|
111 | 113 | */ |
112 | 114 | public function setSelected($value) |
113 | 115 | { |
@@ -184,6 +186,7 @@ discard block |
||
184 | 186 | /** |
185 | 187 | * @param string attribute name |
186 | 188 | * @param string value of the attribute |
189 | + * @param string $name |
|
187 | 190 | */ |
188 | 191 | public function setAttribute($name,$value) |
189 | 192 | { |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * TListItem class file |
|
4 | - * |
|
5 | - * @author Qiang Xue <[email protected]> |
|
6 | - * @link https://github.com/pradosoft/prado |
|
7 | - * @copyright Copyright © 2005-2015 The PRADO Group |
|
8 | - * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | - * @package System.Web.UI.WebControls |
|
10 | - */ |
|
3 | + * TListItem class file |
|
4 | + * |
|
5 | + * @author Qiang Xue <[email protected]> |
|
6 | + * @link https://github.com/pradosoft/prado |
|
7 | + * @copyright Copyright © 2005-2015 The PRADO Group |
|
8 | + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | + * @package System.Web.UI.WebControls |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * TListItem class. |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param boolean whether the item is enabled |
54 | 54 | * @param boolean whether the item is selected |
55 | 55 | */ |
56 | - public function __construct($text='',$value='',$enabled=true,$selected=false) |
|
56 | + public function __construct($text='', $value='', $enabled=true, $selected=false) |
|
57 | 57 | { |
58 | 58 | $this->setText($text); |
59 | 59 | $this->setValue($value); |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | protected function __getZappableSleepProps(&$exprops) |
71 | 71 | { |
72 | 72 | parent::__getZappableSleepProps($exprops); |
73 | - if ($this->_attributes===null) |
|
74 | - $exprops[] = "\0TListItem\0_attributes"; |
|
73 | + if($this->_attributes===null) |
|
74 | + $exprops[]="\0TListItem\0_attributes"; |
|
75 | 75 | if($this->_text==='') |
76 | - $exprops[] = "\0TListItem\0_text"; |
|
76 | + $exprops[]="\0TListItem\0_text"; |
|
77 | 77 | if($this->_value==='') |
78 | - $exprops[] = "\0TListItem\0_value"; |
|
79 | - if ($this->_enabled===true) |
|
80 | - $exprops[] = "\0TListItem\0_enabled"; |
|
81 | - if ($this->_selected===false) |
|
82 | - $exprops[] = "\0TListItem\0_selected"; |
|
78 | + $exprops[]="\0TListItem\0_value"; |
|
79 | + if($this->_enabled===true) |
|
80 | + $exprops[]="\0TListItem\0_enabled"; |
|
81 | + if($this->_selected===false) |
|
82 | + $exprops[]="\0TListItem\0_selected"; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function getText() |
121 | 121 | { |
122 | - return $this->_text===''?$this->_value:$this->_text; |
|
122 | + return $this->_text==='' ? $this->_value : $this->_text; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function getValue() |
137 | 137 | { |
138 | - return $this->_value===''?$this->_text:$this->_value; |
|
138 | + return $this->_value==='' ? $this->_text : $this->_value; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function getHasAttributes() |
163 | 163 | { |
164 | - return $this->_attributes && $this->_attributes->getCount()>0; |
|
164 | + return $this->_attributes && $this->_attributes->getCount() > 0; |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function hasAttribute($name) |
172 | 172 | { |
173 | - return $this->_attributes?$this->_attributes->contains($name):false; |
|
173 | + return $this->_attributes ? $this->_attributes->contains($name) : false; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -178,16 +178,16 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function getAttribute($name) |
180 | 180 | { |
181 | - return $this->_attributes?$this->_attributes->itemAt($name):null; |
|
181 | + return $this->_attributes ? $this->_attributes->itemAt($name) : null; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
185 | 185 | * @param string attribute name |
186 | 186 | * @param string value of the attribute |
187 | 187 | */ |
188 | - public function setAttribute($name,$value) |
|
188 | + public function setAttribute($name, $value) |
|
189 | 189 | { |
190 | - $this->getAttributes()->add($name,$value); |
|
190 | + $this->getAttributes()->add($name, $value); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | */ |
198 | 198 | public function removeAttribute($name) |
199 | 199 | { |
200 | - return $this->_attributes?$this->_attributes->remove($name):null; |
|
200 | + return $this->_attributes ? $this->_attributes->remove($name) : null; |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 |
@@ -58,8 +58,7 @@ |
||
58 | 58 | if ($this->sourcepath === NULL) |
59 | 59 | { |
60 | 60 | $this->sourcepath = $sourcepath; |
61 | - } |
|
62 | - else |
|
61 | + } else |
|
63 | 62 | { |
64 | 63 | $this->sourcepath->append($sourcepath); |
65 | 64 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | case 'datetime': case 'timestamp': |
34 | 34 | return $this->createDateTimeControl($container, $column, $record); |
35 | 35 | default: |
36 | - return $this->createDefaultControl($container,$column, $record); |
|
36 | + return $this->createDefaultControl($container, $column, $record); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
@@ -50,16 +50,16 @@ discard block |
||
50 | 50 | case 'time': |
51 | 51 | return $this->getTimeValue($container, $column, $record); |
52 | 52 | case 'datetime': case 'timestamp': |
53 | - return $this->getDateTimeValue($container,$column, $record); |
|
53 | + return $this->getDateTimeValue($container, $column, $record); |
|
54 | 54 | default: |
55 | - return $this->getDefaultControlValue($container,$column, $record); |
|
55 | + return $this->getDefaultControlValue($container, $column, $record); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | 59 | protected function createDateControl($container, $column, $record) |
60 | 60 | { |
61 | - $control = parent::createDateControl($container, $column, $record); |
|
62 | - $value = $this->getRecordPropertyValue($column, $record); |
|
61 | + $control=parent::createDateControl($container, $column, $record); |
|
62 | + $value=$this->getRecordPropertyValue($column, $record); |
|
63 | 63 | if(!empty($value) && preg_match('/timestamp/i', $column->getDbType())) |
64 | 64 | $control->setTimestamp(intval($value)); |
65 | 65 | return $control; |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | |
68 | 68 | protected function createDateTimeControl($container, $column, $record) |
69 | 69 | { |
70 | - $value = $this->getRecordPropertyValue($column, $record); |
|
71 | - $time = parent::createDateTimeControl($container, $column, $record); |
|
70 | + $value=$this->getRecordPropertyValue($column, $record); |
|
71 | + $time=parent::createDateTimeControl($container, $column, $record); |
|
72 | 72 | if(!empty($value) && preg_match('/timestamp/i', $column->getDbType())) |
73 | 73 | { |
74 | - $s = Prado::createComponent('System.Util.TDateTimeStamp'); |
|
75 | - $date = $s->getDate(intval($value)); |
|
74 | + $s=Prado::createComponent('System.Util.TDateTimeStamp'); |
|
75 | + $date=$s->getDate(intval($value)); |
|
76 | 76 | $time[1]->setSelectedValue($date['hours']); |
77 | 77 | $time[2]->setSelectedValue($date['minutes']); |
78 | 78 | $time[3]->setSelectedValue($date['seconds']); |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | { |
85 | 85 | if(preg_match('/timestamp/i', $column->getDbType())) |
86 | 86 | { |
87 | - $time = $container->findControl(self::DEFAULT_ID)->getTimestamp(); |
|
88 | - $s = Prado::createComponent('System.Util.TDateTimeStamp'); |
|
89 | - $date = $s->getDate($time); |
|
90 | - $hour = $container->findControl('scaffold_time_hour')->getSelectedValue(); |
|
91 | - $mins = $container->findControl('scaffold_time_min')->getSelectedValue(); |
|
92 | - $secs = $container->findControl('scaffold_time_sec')->getSelectedValue(); |
|
93 | - return $s->getTimeStamp($hour,$mins,$secs,$date['mon'],$date['mday'],$date['year']); |
|
87 | + $time=$container->findControl(self::DEFAULT_ID)->getTimestamp(); |
|
88 | + $s=Prado::createComponent('System.Util.TDateTimeStamp'); |
|
89 | + $date=$s->getDate($time); |
|
90 | + $hour=$container->findControl('scaffold_time_hour')->getSelectedValue(); |
|
91 | + $mins=$container->findControl('scaffold_time_min')->getSelectedValue(); |
|
92 | + $secs=$container->findControl('scaffold_time_sec')->getSelectedValue(); |
|
93 | + return $s->getTimeStamp($hour, $mins, $secs, $date['mon'], $date['mday'], $date['year']); |
|
94 | 94 | } |
95 | 95 | else |
96 | 96 | return parent::getDateTimeValue($container, $column, $record); |
@@ -61,8 +61,7 @@ discard block |
||
61 | 61 | $object = $object[$prop]; |
62 | 62 | else |
63 | 63 | throw new TInvalidPropertyException('sqlmap_invalid_property',$path); |
64 | - } |
|
65 | - else if(is_object($object)) |
|
64 | + } else if(is_object($object)) |
|
66 | 65 | { |
67 | 66 | $getter = 'get'.$prop; |
68 | 67 | if(method_exists($object, $getter) && is_callable(array($object, $getter))) |
@@ -73,8 +72,7 @@ discard block |
||
73 | 72 | $object = $object->{$prop}; |
74 | 73 | else |
75 | 74 | throw new TInvalidPropertyException('sqlmap_invalid_property',$path); |
76 | - } |
|
77 | - else |
|
75 | + } else |
|
78 | 76 | throw new TInvalidPropertyException('sqlmap_invalid_property',$path); |
79 | 77 | } |
80 | 78 | return $object; |
@@ -98,8 +96,7 @@ discard block |
||
98 | 96 | $object = $object[$prop]; |
99 | 97 | else |
100 | 98 | return false; |
101 | - } |
|
102 | - else if(is_object($object)) |
|
99 | + } else if(is_object($object)) |
|
103 | 100 | { |
104 | 101 | $getter = 'get'.$prop; |
105 | 102 | if(method_exists($object, $getter) && is_callable(array($object, $getter))) |
@@ -110,8 +107,7 @@ discard block |
||
110 | 107 | $object = $object->{$prop}; |
111 | 108 | else |
112 | 109 | return false; |
113 | - } |
|
114 | - else |
|
110 | + } else |
|
115 | 111 | return false; |
116 | 112 | } |
117 | 113 | return true; |
@@ -136,16 +132,14 @@ discard block |
||
136 | 132 | if(is_array($object) || $object instanceof ArrayAccess) |
137 | 133 | { |
138 | 134 | $object[$prop] = $value; |
139 | - } |
|
140 | - else if(is_object($object)) |
|
135 | + } else if(is_object($object)) |
|
141 | 136 | { |
142 | 137 | $setter = 'set'.$prop; |
143 | 138 | if (method_exists($object, $setter) && is_callable(array($object, $setter))) |
144 | 139 | $object->{$setter}($value); |
145 | 140 | else |
146 | 141 | $object->{$prop} = $value; |
147 | - } |
|
148 | - else |
|
142 | + } else |
|
149 | 143 | throw new TInvalidPropertyException('sqlmap_invalid_property_type',$path); |
150 | 144 | } |
151 | 145 |
@@ -48,34 +48,34 @@ discard block |
||
48 | 48 | * @return mixed property value. |
49 | 49 | * @throws TInvalidDataValueException if property path is invalid. |
50 | 50 | */ |
51 | - public static function get($object,$path) |
|
51 | + public static function get($object, $path) |
|
52 | 52 | { |
53 | 53 | if(!is_array($object) && !is_object($object)) |
54 | 54 | return $object; |
55 | - $properties = explode('.', $path); |
|
55 | + $properties=explode('.', $path); |
|
56 | 56 | foreach($properties as $prop) |
57 | 57 | { |
58 | 58 | if(is_array($object) || $object instanceof ArrayAccess) |
59 | 59 | { |
60 | 60 | if(array_key_exists($prop, $object)) |
61 | - $object = $object[$prop]; |
|
61 | + $object=$object[$prop]; |
|
62 | 62 | else |
63 | - throw new TInvalidPropertyException('sqlmap_invalid_property',$path); |
|
63 | + throw new TInvalidPropertyException('sqlmap_invalid_property', $path); |
|
64 | 64 | } |
65 | 65 | else if(is_object($object)) |
66 | 66 | { |
67 | - $getter = 'get'.$prop; |
|
67 | + $getter='get'.$prop; |
|
68 | 68 | if(method_exists($object, $getter) && is_callable(array($object, $getter))) |
69 | - $object = $object->{$getter}(); |
|
69 | + $object=$object->{$getter}(); |
|
70 | 70 | else if(in_array($prop, array_keys(get_object_vars($object)))) |
71 | - $object = $object->{$prop}; |
|
71 | + $object=$object->{$prop}; |
|
72 | 72 | elseif(method_exists($object, '__get') && is_callable(array($object, '__get'))) |
73 | - $object = $object->{$prop}; |
|
73 | + $object=$object->{$prop}; |
|
74 | 74 | else |
75 | - throw new TInvalidPropertyException('sqlmap_invalid_property',$path); |
|
75 | + throw new TInvalidPropertyException('sqlmap_invalid_property', $path); |
|
76 | 76 | } |
77 | 77 | else |
78 | - throw new TInvalidPropertyException('sqlmap_invalid_property',$path); |
|
78 | + throw new TInvalidPropertyException('sqlmap_invalid_property', $path); |
|
79 | 79 | } |
80 | 80 | return $object; |
81 | 81 | } |
@@ -89,25 +89,25 @@ discard block |
||
89 | 89 | { |
90 | 90 | if(!is_array($object) && !is_object($object)) |
91 | 91 | return false; |
92 | - $properties = explode('.', $path); |
|
92 | + $properties=explode('.', $path); |
|
93 | 93 | foreach($properties as $prop) |
94 | 94 | { |
95 | 95 | if(is_array($object) || $object instanceof ArrayAccess) |
96 | 96 | { |
97 | 97 | if(array_key_exists($prop, $object)) |
98 | - $object = $object[$prop]; |
|
98 | + $object=$object[$prop]; |
|
99 | 99 | else |
100 | 100 | return false; |
101 | 101 | } |
102 | 102 | else if(is_object($object)) |
103 | 103 | { |
104 | - $getter = 'get'.$prop; |
|
104 | + $getter='get'.$prop; |
|
105 | 105 | if(method_exists($object, $getter) && is_callable(array($object, $getter))) |
106 | - $object = $object->{$getter}(); |
|
106 | + $object=$object->{$getter}(); |
|
107 | 107 | else if(in_array($prop, array_keys(get_object_vars($object)))) |
108 | - $object = $object->{$prop}; |
|
108 | + $object=$object->{$prop}; |
|
109 | 109 | elseif(method_exists($object, '__get') && is_callable(array($object, '__get'))) |
110 | - $object = $object->{$prop}; |
|
110 | + $object=$object->{$prop}; |
|
111 | 111 | else |
112 | 112 | return false; |
113 | 113 | } |
@@ -126,27 +126,27 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public static function set(&$originalObject, $path, $value) |
128 | 128 | { |
129 | - $properties = explode('.', $path); |
|
130 | - $prop = array_pop($properties); |
|
129 | + $properties=explode('.', $path); |
|
130 | + $prop=array_pop($properties); |
|
131 | 131 | if(count($properties) > 0) |
132 | - $object = self::get($originalObject, implode('.',$properties)); |
|
132 | + $object=self::get($originalObject, implode('.', $properties)); |
|
133 | 133 | else |
134 | - $object = &$originalObject; |
|
134 | + $object=&$originalObject; |
|
135 | 135 | |
136 | 136 | if(is_array($object) || $object instanceof ArrayAccess) |
137 | 137 | { |
138 | - $object[$prop] = $value; |
|
138 | + $object[$prop]=$value; |
|
139 | 139 | } |
140 | 140 | else if(is_object($object)) |
141 | 141 | { |
142 | - $setter = 'set'.$prop; |
|
143 | - if (method_exists($object, $setter) && is_callable(array($object, $setter))) |
|
142 | + $setter='set'.$prop; |
|
143 | + if(method_exists($object, $setter) && is_callable(array($object, $setter))) |
|
144 | 144 | $object->{$setter}($value); |
145 | 145 | else |
146 | - $object->{$prop} = $value; |
|
146 | + $object->{$prop}=$value; |
|
147 | 147 | } |
148 | 148 | else |
149 | - throw new TInvalidPropertyException('sqlmap_invalid_property_type',$path); |
|
149 | + throw new TInvalidPropertyException('sqlmap_invalid_property_type', $path); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | } |
@@ -164,8 +164,7 @@ |
||
164 | 164 | return $handler->createNewInstance(); |
165 | 165 | else |
166 | 166 | return $registry->createInstanceOf($this->getClass()); |
167 | - } |
|
168 | - catch (TSqlMapException $e) |
|
167 | + } catch (TSqlMapException $e) |
|
169 | 168 | { |
170 | 169 | throw new TSqlMapException( |
171 | 170 | 'sqlmap_unable_to_create_new_instance', |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function setClass($value) |
83 | 83 | { |
84 | - $this->_class = $value; |
|
84 | + $this->_class=$value; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function setExtends($value) |
107 | 107 | { |
108 | - $this->_extends = $value; |
|
108 | + $this->_extends=$value; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function setGroupBy($value) |
123 | 123 | { |
124 | - $this->_groupBy = $value; |
|
124 | + $this->_groupBy=$value; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function setDiscriminator(TDiscriminator $value) |
139 | 139 | { |
140 | - $this->_discriminator = $value; |
|
140 | + $this->_discriminator=$value; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function addResultProperty(TResultProperty $property) |
148 | 148 | { |
149 | - $this->_columns[$property->getProperty()] = $property; |
|
149 | + $this->_columns[$property->getProperty()]=$property; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function createInstanceOfResult($registry) |
159 | 159 | { |
160 | - $handler = $registry->getTypeHandler($this->getClass()); |
|
160 | + $handler=$registry->getTypeHandler($this->getClass()); |
|
161 | 161 | try |
162 | 162 | { |
163 | 163 | if($handler!==null) |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | else |
166 | 166 | return $registry->createInstanceOf($this->getClass()); |
167 | 167 | } |
168 | - catch (TSqlMapException $e) |
|
168 | + catch(TSqlMapException $e) |
|
169 | 169 | { |
170 | 170 | throw new TSqlMapException( |
171 | 171 | 'sqlmap_unable_to_create_new_instance', |
@@ -179,18 +179,18 @@ discard block |
||
179 | 179 | * @param array row data. |
180 | 180 | * @return TResultMap result sub-map. |
181 | 181 | */ |
182 | - public function resolveSubMap($registry,$row) |
|
182 | + public function resolveSubMap($registry, $row) |
|
183 | 183 | { |
184 | - $subMap = $this; |
|
185 | - if(($disc = $this->getDiscriminator())!==null) |
|
184 | + $subMap=$this; |
|
185 | + if(($disc=$this->getDiscriminator())!==null) |
|
186 | 186 | { |
187 | - $value = $disc->getMapping()->getPropertyValue($registry,$row); |
|
188 | - $subMap = $disc->getSubMap((string)$value); |
|
187 | + $value=$disc->getMapping()->getPropertyValue($registry, $row); |
|
188 | + $subMap=$disc->getSubMap((string) $value); |
|
189 | 189 | |
190 | 190 | if($subMap===null) |
191 | - $subMap = $this; |
|
192 | - else if($subMap !== $this) |
|
193 | - $subMap = $subMap->resolveSubMap($registry,$row); |
|
191 | + $subMap=$this; |
|
192 | + else if($subMap!==$this) |
|
193 | + $subMap=$subMap->resolveSubMap($registry, $row); |
|
194 | 194 | } |
195 | 195 | return $subMap; |
196 | 196 | } |
@@ -199,8 +199,7 @@ discard block |
||
199 | 199 | $this -> _createCheck = true; |
200 | 200 | $this -> getApplication() -> setGlobalState($key, time()); |
201 | 201 | } |
202 | - } |
|
203 | - catch(Exception $e) |
|
202 | + } catch(Exception $e) |
|
204 | 203 | { |
205 | 204 | // DB table not exists |
206 | 205 | if($this->_autoCreate) |
@@ -223,8 +222,7 @@ discard block |
||
223 | 222 | |
224 | 223 | $this -> _createCheck = true; |
225 | 224 | $this -> getApplication() -> setGlobalState($key, time()); |
226 | - } |
|
227 | - else |
|
225 | + } else |
|
228 | 226 | throw new TConfigurationException('db_cachetable_inexistent',$this->_cacheTable); |
229 | 227 | } |
230 | 228 | $this->_cacheInitialized = true; |
@@ -293,8 +291,7 @@ discard block |
||
293 | 291 | return $config->getDbConnection(); |
294 | 292 | else |
295 | 293 | throw new TConfigurationException('dbcache_connectionid_invalid',$this->_connID); |
296 | - } |
|
297 | - else |
|
294 | + } else |
|
298 | 295 | { |
299 | 296 | $db=new TDbConnection; |
300 | 297 | if($this->_connectionString!=='') |
@@ -304,8 +301,7 @@ discard block |
||
304 | 301 | $db->setUsername($this->_username); |
305 | 302 | if($this->_password!=='') |
306 | 303 | $db->setPassword($this->_password); |
307 | - } |
|
308 | - else |
|
304 | + } else |
|
309 | 305 | { |
310 | 306 | // default to SQLite3 database |
311 | 307 | $dbFile=$this->getApplication()->getRuntimePath().'/sqlite3.cache'; |
@@ -462,8 +458,7 @@ discard block |
||
462 | 458 | $sql='SELECT value FROM '.$this->_cacheTable.' WHERE itemkey=\''.$key.'\' AND (expire=0 OR expire>'.time().') ORDER BY expire DESC'; |
463 | 459 | $command=$this->getDbConnection()->createCommand($sql); |
464 | 460 | return unserialize($command->queryScalar()); |
465 | - } |
|
466 | - catch(Exception $e) |
|
461 | + } catch(Exception $e) |
|
467 | 462 | { |
468 | 463 | $this->initializeCache(true); |
469 | 464 | return unserialize($command->queryScalar()); |
@@ -506,16 +501,14 @@ discard block |
||
506 | 501 | $command->bindValue(':value',serialize($value),PDO::PARAM_LOB); |
507 | 502 | $command->execute(); |
508 | 503 | return true; |
509 | - } |
|
510 | - catch(Exception $e) |
|
504 | + } catch(Exception $e) |
|
511 | 505 | { |
512 | 506 | try |
513 | 507 | { |
514 | 508 | $this->initializeCache(true); |
515 | 509 | $command->execute(); |
516 | 510 | return true; |
517 | - } |
|
518 | - catch(Exception $e) |
|
511 | + } catch(Exception $e) |
|
519 | 512 | { |
520 | 513 | return false; |
521 | 514 | } |
@@ -537,8 +530,7 @@ discard block |
||
537 | 530 | $command->bindValue(':key',$key,PDO::PARAM_STR); |
538 | 531 | $command->execute(); |
539 | 532 | return true; |
540 | - } |
|
541 | - catch(Exception $e) |
|
533 | + } catch(Exception $e) |
|
542 | 534 | { |
543 | 535 | $this->initializeCache(true); |
544 | 536 | $command->execute(); |
@@ -557,16 +549,14 @@ discard block |
||
557 | 549 | { |
558 | 550 | $command = $this->getDbConnection()->createCommand("DELETE FROM {$this->_cacheTable}"); |
559 | 551 | $command->execute(); |
560 | - } |
|
561 | - catch(Exception $e) |
|
552 | + } catch(Exception $e) |
|
562 | 553 | { |
563 | 554 | try |
564 | 555 | { |
565 | 556 | $this->initializeCache(true); |
566 | 557 | $command->execute(); |
567 | 558 | return true; |
568 | - } |
|
569 | - catch(Exception $e) |
|
559 | + } catch(Exception $e) |
|
570 | 560 | { |
571 | 561 | return false; |
572 | 562 | } |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | /** |
106 | 106 | * @var boolean |
107 | 107 | */ |
108 | - private $_cacheInitialized = false; |
|
108 | + private $_cacheInitialized=false; |
|
109 | 109 | /** |
110 | 110 | * @var boolean |
111 | 111 | */ |
112 | - private $_createCheck= false; |
|
112 | + private $_createCheck=false; |
|
113 | 113 | /** |
114 | 114 | * @var boolean whether the cache DB table should be created automatically |
115 | 115 | */ |
@@ -183,20 +183,20 @@ discard block |
||
183 | 183 | $db=$this->getDbConnection(); |
184 | 184 | try |
185 | 185 | { |
186 | - $key = 'TDbCache:' . $this->_cacheTable . ':created'; |
|
186 | + $key='TDbCache:'.$this->_cacheTable.':created'; |
|
187 | 187 | if($force) |
188 | - $this -> _createCheck = false; |
|
188 | + $this -> _createCheck=false; |
|
189 | 189 | else |
190 | - $this -> _createCheck = $this -> getApplication() -> getGlobalState($key, 0); |
|
190 | + $this -> _createCheck=$this -> getApplication() -> getGlobalState($key, 0); |
|
191 | 191 | |
192 | 192 | if($this->_autoCreate && !$this -> _createCheck) { |
193 | 193 | |
194 | - Prado::trace(($force ? 'Force initializing: ' : 'Initializing: ') . $this -> id . ', ' . $this->_cacheTable, 'System.Caching.TDbCache'); |
|
194 | + Prado::trace(($force ? 'Force initializing: ' : 'Initializing: ').$this -> id.', '.$this->_cacheTable, 'System.Caching.TDbCache'); |
|
195 | 195 | |
196 | 196 | $sql='SELECT 1 FROM '.$this->_cacheTable.' WHERE 0=1'; |
197 | 197 | $db->createCommand($sql)->queryScalar(); |
198 | 198 | |
199 | - $this -> _createCheck = true; |
|
199 | + $this -> _createCheck=true; |
|
200 | 200 | $this -> getApplication() -> setGlobalState($key, time()); |
201 | 201 | } |
202 | 202 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | // DB table not exists |
206 | 206 | if($this->_autoCreate) |
207 | 207 | { |
208 | - Prado::trace('Autocreate: ' . $this->_cacheTable, 'System.Caching.TDbCache'); |
|
208 | + Prado::trace('Autocreate: '.$this->_cacheTable, 'System.Caching.TDbCache'); |
|
209 | 209 | |
210 | 210 | $driver=$db->getDriverName(); |
211 | 211 | if($driver==='mysql') |
@@ -218,16 +218,16 @@ discard block |
||
218 | 218 | $sql='CREATE TABLE '.$this->_cacheTable." (itemkey CHAR(128) PRIMARY KEY, value $blob, expire INTEGER)"; |
219 | 219 | $db->createCommand($sql)->execute(); |
220 | 220 | |
221 | - $sql='CREATE INDEX IX_expire ON ' . $this->_cacheTable . ' (expire)'; |
|
221 | + $sql='CREATE INDEX IX_expire ON '.$this->_cacheTable.' (expire)'; |
|
222 | 222 | $db->createCommand($sql)->execute(); |
223 | 223 | |
224 | - $this -> _createCheck = true; |
|
224 | + $this -> _createCheck=true; |
|
225 | 225 | $this -> getApplication() -> setGlobalState($key, time()); |
226 | 226 | } |
227 | 227 | else |
228 | - throw new TConfigurationException('db_cachetable_inexistent',$this->_cacheTable); |
|
228 | + throw new TConfigurationException('db_cachetable_inexistent', $this->_cacheTable); |
|
229 | 229 | } |
230 | - $this->_cacheInitialized = true; |
|
230 | + $this->_cacheInitialized=true; |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -238,17 +238,17 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function flushCacheExpired($force=false) |
240 | 240 | { |
241 | - $interval = $this -> getFlushInterval(); |
|
242 | - if(!$force && $interval === 0) return; |
|
241 | + $interval=$this -> getFlushInterval(); |
|
242 | + if(!$force && $interval===0) return; |
|
243 | 243 | |
244 | - $key = 'TDbCache:' . $this->_cacheTable . ':flushed'; |
|
245 | - $now = time(); |
|
246 | - $next = $interval + (integer)$this -> getApplication() -> getGlobalState($key, 0); |
|
244 | + $key='TDbCache:'.$this->_cacheTable.':flushed'; |
|
245 | + $now=time(); |
|
246 | + $next=$interval + (integer) $this -> getApplication() -> getGlobalState($key, 0); |
|
247 | 247 | |
248 | 248 | if($force || $next <= $now) |
249 | 249 | { |
250 | 250 | if(!$this->_cacheInitialized) $this->initializeCache(); |
251 | - Prado::trace(($force ? 'Force flush of expired items: ' : 'Flush expired items: ') . $this -> id . ', ' . $this->_cacheTable, 'System.Caching.TDbCache'); |
|
251 | + Prado::trace(($force ? 'Force flush of expired items: ' : 'Flush expired items: ').$this -> id.', '.$this->_cacheTable, 'System.Caching.TDbCache'); |
|
252 | 252 | $sql='DELETE FROM '.$this->_cacheTable.' WHERE expire<>0 AND expire<'.$now; |
253 | 253 | $this->getDbConnection()->createCommand($sql)->execute(); |
254 | 254 | $this -> getApplication() -> setGlobalState($key, $now); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | */ |
276 | 276 | public function setFlushInterval($value) |
277 | 277 | { |
278 | - $this->_flushInterval = (integer) $value; |
|
278 | + $this->_flushInterval=(integer) $value; |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | if($config instanceof TDataSourceConfig) |
293 | 293 | return $config->getDbConnection(); |
294 | 294 | else |
295 | - throw new TConfigurationException('dbcache_connectionid_invalid',$this->_connID); |
|
295 | + throw new TConfigurationException('dbcache_connectionid_invalid', $this->_connID); |
|
296 | 296 | } |
297 | 297 | else |
298 | 298 | { |
@@ -479,10 +479,10 @@ discard block |
||
479 | 479 | * @param integer the number of seconds in which the cached value will expire. 0 means never expire. |
480 | 480 | * @return boolean true if the value is successfully stored into cache, false otherwise |
481 | 481 | */ |
482 | - protected function setValue($key,$value,$expire) |
|
482 | + protected function setValue($key, $value, $expire) |
|
483 | 483 | { |
484 | 484 | $this->deleteValue($key); |
485 | - return $this->addValue($key,$value,$expire); |
|
485 | + return $this->addValue($key, $value, $expire); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | /** |
@@ -494,16 +494,16 @@ discard block |
||
494 | 494 | * @param integer the number of seconds in which the cached value will expire. 0 means never expire. |
495 | 495 | * @return boolean true if the value is successfully stored into cache, false otherwise |
496 | 496 | */ |
497 | - protected function addValue($key,$value,$expire) |
|
497 | + protected function addValue($key, $value, $expire) |
|
498 | 498 | { |
499 | 499 | if(!$this->_cacheInitialized) $this->initializeCache(); |
500 | - $expire=($expire<=0)?0:time()+$expire; |
|
500 | + $expire=($expire <= 0) ? 0 : time() + $expire; |
|
501 | 501 | $sql="INSERT INTO {$this->_cacheTable} (itemkey,value,expire) VALUES(:key,:value,$expire)"; |
502 | 502 | try |
503 | 503 | { |
504 | 504 | $command=$this->getDbConnection()->createCommand($sql); |
505 | - $command->bindValue(':key',$key,PDO::PARAM_STR); |
|
506 | - $command->bindValue(':value',serialize($value),PDO::PARAM_LOB); |
|
505 | + $command->bindValue(':key', $key, PDO::PARAM_STR); |
|
506 | + $command->bindValue(':value', serialize($value), PDO::PARAM_LOB); |
|
507 | 507 | $command->execute(); |
508 | 508 | return true; |
509 | 509 | } |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | try |
535 | 535 | { |
536 | 536 | $command=$this->getDbConnection()->createCommand("DELETE FROM {$this->_cacheTable} WHERE itemkey=:key"); |
537 | - $command->bindValue(':key',$key,PDO::PARAM_STR); |
|
537 | + $command->bindValue(':key', $key, PDO::PARAM_STR); |
|
538 | 538 | $command->execute(); |
539 | 539 | return true; |
540 | 540 | } |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | if(!$this->_cacheInitialized) $this->initializeCache(); |
556 | 556 | try |
557 | 557 | { |
558 | - $command = $this->getDbConnection()->createCommand("DELETE FROM {$this->_cacheTable}"); |
|
558 | + $command=$this->getDbConnection()->createCommand("DELETE FROM {$this->_cacheTable}"); |
|
559 | 559 | $command->execute(); |
560 | 560 | } |
561 | 561 | catch(Exception $e) |
@@ -113,8 +113,7 @@ discard block |
||
113 | 113 | { |
114 | 114 | $userFile = include $this->_userFile; |
115 | 115 | $this->loadUserDataFromPhp($userFile); |
116 | - } |
|
117 | - else |
|
116 | + } else |
|
118 | 117 | { |
119 | 118 | $dom=new TXmlDocument; |
120 | 119 | $dom->loadFromFile($this->_userFile); |
@@ -310,8 +309,7 @@ discard block |
||
310 | 309 | $user=new TUser($this); |
311 | 310 | $user->setIsGuest(true); |
312 | 311 | return $user; |
313 | - } |
|
314 | - else |
|
312 | + } else |
|
315 | 313 | { |
316 | 314 | $username=strtolower($username); |
317 | 315 | if(isset($this->_users[$username])) |
@@ -322,8 +320,7 @@ discard block |
||
322 | 320 | if(isset($this->_roles[$username])) |
323 | 321 | $user->setRoles($this->_roles[$username]); |
324 | 322 | return $user; |
325 | - } |
|
326 | - else |
|
323 | + } else |
|
327 | 324 | return null; |
328 | 325 | } |
329 | 326 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP) |
113 | 113 | { |
114 | - $userFile = include $this->_userFile; |
|
114 | + $userFile=include $this->_userFile; |
|
115 | 115 | $this->loadUserDataFromPhp($userFile); |
116 | 116 | } |
117 | 117 | else |
@@ -146,13 +146,13 @@ discard block |
||
146 | 146 | { |
147 | 147 | foreach($config['users'] as $user) |
148 | 148 | { |
149 | - $name = trim(strtolower(isset($user['name'])?$user['name']:'')); |
|
150 | - $password = isset($user['password'])?$user['password']:''; |
|
151 | - $this->_users[$name] = $password; |
|
152 | - $roles = isset($user['roles'])?$user['roles']:''; |
|
149 | + $name=trim(strtolower(isset($user['name']) ? $user['name'] : '')); |
|
150 | + $password=isset($user['password']) ? $user['password'] : ''; |
|
151 | + $this->_users[$name]=$password; |
|
152 | + $roles=isset($user['roles']) ? $user['roles'] : ''; |
|
153 | 153 | if($roles!=='') |
154 | 154 | { |
155 | - foreach(explode(',',$roles) as $role) |
|
155 | + foreach(explode(',', $roles) as $role) |
|
156 | 156 | { |
157 | 157 | if(($role=trim($role))!=='') |
158 | 158 | $this->_roles[$name][]=$role; |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | { |
165 | 165 | foreach($config['roles'] as $role) |
166 | 166 | { |
167 | - $name = isset($role['name'])?$role['name']:''; |
|
168 | - $users = isset($role['users'])?$role['users']:''; |
|
169 | - foreach(explode(',',$users) as $user) |
|
167 | + $name=isset($role['name']) ? $role['name'] : ''; |
|
168 | + $users=isset($role['users']) ? $role['users'] : ''; |
|
169 | + foreach(explode(',', $users) as $user) |
|
170 | 170 | { |
171 | 171 | if(($user=trim($user))!=='') |
172 | 172 | $this->_roles[strtolower($user)][]=$name; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $this->_users[$name]=$node->getAttribute('password'); |
188 | 188 | if(($roles=trim($node->getAttribute('roles')))!=='') |
189 | 189 | { |
190 | - foreach(explode(',',$roles) as $role) |
|
190 | + foreach(explode(',', $roles) as $role) |
|
191 | 191 | { |
192 | 192 | if(($role=trim($role))!=='') |
193 | 193 | $this->_roles[$name][]=$role; |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | } |
197 | 197 | foreach($xmlNode->getElementsByTagName('role') as $node) |
198 | 198 | { |
199 | - foreach(explode(',',$node->getAttribute('users')) as $user) |
|
199 | + foreach(explode(',', $node->getAttribute('users')) as $user) |
|
200 | 200 | { |
201 | 201 | if(($user=trim($user))!=='') |
202 | 202 | $this->_roles[strtolower($user)][]=$node->getAttribute('name'); |
@@ -246,8 +246,8 @@ discard block |
||
246 | 246 | { |
247 | 247 | if($this->_initialized) |
248 | 248 | throw new TInvalidOperationException('usermanager_userfile_unchangeable'); |
249 | - else if(($this->_userFile=Prado::getPathOfNamespace($value,self::USER_FILE_EXT))===null || !is_file($this->_userFile)) |
|
250 | - throw new TConfigurationException('usermanager_userfile_invalid',$value); |
|
249 | + else if(($this->_userFile=Prado::getPathOfNamespace($value, self::USER_FILE_EXT))===null || !is_file($this->_userFile)) |
|
250 | + throw new TConfigurationException('usermanager_userfile_invalid', $value); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | */ |
280 | 280 | public function setPasswordMode($value) |
281 | 281 | { |
282 | - $this->_passwordMode=TPropertyValue::ensureEnum($value,'TUserManagerPasswordMode'); |
|
282 | + $this->_passwordMode=TPropertyValue::ensureEnum($value, 'TUserManagerPasswordMode'); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * @param string password |
289 | 289 | * @return boolean true if validation is successful, false otherwise. |
290 | 290 | */ |
291 | - public function validateUser($username,$password) |
|
291 | + public function validateUser($username, $password) |
|
292 | 292 | { |
293 | 293 | if($this->_passwordMode===TUserManagerPasswordMode::MD5) |
294 | 294 | $password=md5($password); |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $data=unserialize($data); |
342 | 342 | if(is_array($data) && count($data)===2) |
343 | 343 | { |
344 | - list($username,$token)=$data; |
|
344 | + list($username, $token)=$data; |
|
345 | 345 | if(isset($this->_users[$username]) && $token===md5($username.$this->_users[$username])) |
346 | 346 | return $this->getUser($username); |
347 | 347 | } |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $username=strtolower($user->getName()); |
361 | 361 | if(isset($this->_users[$username])) |
362 | 362 | { |
363 | - $data=array($username,md5($username.$this->_users[$username])); |
|
363 | + $data=array($username, md5($username.$this->_users[$username])); |
|
364 | 364 | $cookie->setValue(serialize($data)); |
365 | 365 | } |
366 | 366 | } |