@@ -4169,10 +4169,10 @@ discard block |
||
| 4169 | 4169 | { |
| 4170 | 4170 | $value=TPropertyValue::ensureEnum($value,'THttpSessionCookieMode'); |
| 4171 | 4171 | if($value===THttpSessionCookieMode::None) |
| 4172 | - { |
|
| 4172 | + { |
|
| 4173 | 4173 | ini_set('session.use_cookies','0'); |
| 4174 | 4174 | ini_set('session.use_only_cookies','0'); |
| 4175 | - } |
|
| 4175 | + } |
|
| 4176 | 4176 | else if($value===THttpSessionCookieMode::Allow) |
| 4177 | 4177 | { |
| 4178 | 4178 | ini_set('session.use_cookies','1'); |
@@ -5847,7 +5847,7 @@ discard block |
||
| 5847 | 5847 | } |
| 5848 | 5848 | public function __construct($style=null) |
| 5849 | 5849 | { |
| 5850 | - parent::__construct(); |
|
| 5850 | + parent::__construct(); |
|
| 5851 | 5851 | if($style!==null) |
| 5852 | 5852 | $this->copyFrom($style); |
| 5853 | 5853 | } |
@@ -6837,77 +6837,77 @@ discard block |
||
| 6837 | 6837 | throw new TConfigurationException('templatecontrol_mastercontrol_required',get_class($this)); |
| 6838 | 6838 | parent::initRecursive($namingContainer); |
| 6839 | 6839 | } |
| 6840 | - public function tryToUpdateView($arObj, $throwExceptions = false) |
|
| 6841 | - { |
|
| 6842 | - $objAttrs = get_class_vars(get_class($arObj)); |
|
| 6843 | - foreach (array_keys($objAttrs) as $key) |
|
| 6844 | - { |
|
| 6845 | - try |
|
| 6846 | - { |
|
| 6847 | - if ($key != "RELATIONS") |
|
| 6848 | - { |
|
| 6849 | - $control = $this->{$key}; |
|
| 6850 | - if ($control instanceof TTextBox) |
|
| 6851 | - $control->Text = $arObj->{$key}; |
|
| 6852 | - elseif ($control instanceof TCheckBox) |
|
| 6853 | - $control->Checked = (boolean) $arObj->{$key}; |
|
| 6854 | - elseif ($control instanceof TDatePicker) |
|
| 6855 | - $control->Date = $arObj->{$key}; |
|
| 6856 | - } |
|
| 6857 | - else |
|
| 6858 | - { |
|
| 6859 | - foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) |
|
| 6860 | - { |
|
| 6861 | - $relControl = $this->{$relKey}; |
|
| 6862 | - switch ($relValues[0]) |
|
| 6863 | - { |
|
| 6864 | - case TActiveRecord::BELONGS_TO: |
|
| 6865 | - case TActiveRecord::HAS_ONE: |
|
| 6866 | - $relControl->Text = $arObj->{$relKey}; |
|
| 6867 | - break; |
|
| 6868 | - case TActiveRecord::HAS_MANY: |
|
| 6869 | - if ($relControl instanceof TListControl) |
|
| 6870 | - { |
|
| 6871 | - $relControl->DataSource = $arObj->{$relKey}; |
|
| 6872 | - $relControl->dataBind(); |
|
| 6873 | - } |
|
| 6874 | - break; |
|
| 6875 | - } |
|
| 6876 | - } |
|
| 6877 | - break; |
|
| 6878 | - } |
|
| 6879 | - } |
|
| 6880 | - catch (Exception $ex) |
|
| 6881 | - { |
|
| 6882 | - if ($throwExceptions) |
|
| 6883 | - throw $ex; |
|
| 6884 | - } |
|
| 6885 | - } |
|
| 6886 | - } |
|
| 6887 | - public function tryToUpdateAR($arObj, $throwExceptions = false) |
|
| 6888 | - { |
|
| 6889 | - $objAttrs = get_class_vars(get_class($arObj)); |
|
| 6890 | - foreach (array_keys($objAttrs) as $key) |
|
| 6891 | - { |
|
| 6892 | - try |
|
| 6893 | - { |
|
| 6894 | - if ($key == "RELATIONS") |
|
| 6895 | - break; |
|
| 6896 | - $control = $this->{$key}; |
|
| 6897 | - if ($control instanceof TTextBox) |
|
| 6898 | - $arObj->{$key} = $control->Text; |
|
| 6899 | - elseif ($control instanceof TCheckBox) |
|
| 6900 | - $arObj->{$key} = $control->Checked; |
|
| 6901 | - elseif ($control instanceof TDatePicker) |
|
| 6902 | - $arObj->{$key} = $control->Date; |
|
| 6903 | - } |
|
| 6904 | - catch (Exception $ex) |
|
| 6905 | - { |
|
| 6906 | - if ($throwExceptions) |
|
| 6907 | - throw $ex; |
|
| 6908 | - } |
|
| 6909 | - } |
|
| 6910 | - } |
|
| 6840 | + public function tryToUpdateView($arObj, $throwExceptions = false) |
|
| 6841 | + { |
|
| 6842 | + $objAttrs = get_class_vars(get_class($arObj)); |
|
| 6843 | + foreach (array_keys($objAttrs) as $key) |
|
| 6844 | + { |
|
| 6845 | + try |
|
| 6846 | + { |
|
| 6847 | + if ($key != "RELATIONS") |
|
| 6848 | + { |
|
| 6849 | + $control = $this->{$key}; |
|
| 6850 | + if ($control instanceof TTextBox) |
|
| 6851 | + $control->Text = $arObj->{$key}; |
|
| 6852 | + elseif ($control instanceof TCheckBox) |
|
| 6853 | + $control->Checked = (boolean) $arObj->{$key}; |
|
| 6854 | + elseif ($control instanceof TDatePicker) |
|
| 6855 | + $control->Date = $arObj->{$key}; |
|
| 6856 | + } |
|
| 6857 | + else |
|
| 6858 | + { |
|
| 6859 | + foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) |
|
| 6860 | + { |
|
| 6861 | + $relControl = $this->{$relKey}; |
|
| 6862 | + switch ($relValues[0]) |
|
| 6863 | + { |
|
| 6864 | + case TActiveRecord::BELONGS_TO: |
|
| 6865 | + case TActiveRecord::HAS_ONE: |
|
| 6866 | + $relControl->Text = $arObj->{$relKey}; |
|
| 6867 | + break; |
|
| 6868 | + case TActiveRecord::HAS_MANY: |
|
| 6869 | + if ($relControl instanceof TListControl) |
|
| 6870 | + { |
|
| 6871 | + $relControl->DataSource = $arObj->{$relKey}; |
|
| 6872 | + $relControl->dataBind(); |
|
| 6873 | + } |
|
| 6874 | + break; |
|
| 6875 | + } |
|
| 6876 | + } |
|
| 6877 | + break; |
|
| 6878 | + } |
|
| 6879 | + } |
|
| 6880 | + catch (Exception $ex) |
|
| 6881 | + { |
|
| 6882 | + if ($throwExceptions) |
|
| 6883 | + throw $ex; |
|
| 6884 | + } |
|
| 6885 | + } |
|
| 6886 | + } |
|
| 6887 | + public function tryToUpdateAR($arObj, $throwExceptions = false) |
|
| 6888 | + { |
|
| 6889 | + $objAttrs = get_class_vars(get_class($arObj)); |
|
| 6890 | + foreach (array_keys($objAttrs) as $key) |
|
| 6891 | + { |
|
| 6892 | + try |
|
| 6893 | + { |
|
| 6894 | + if ($key == "RELATIONS") |
|
| 6895 | + break; |
|
| 6896 | + $control = $this->{$key}; |
|
| 6897 | + if ($control instanceof TTextBox) |
|
| 6898 | + $arObj->{$key} = $control->Text; |
|
| 6899 | + elseif ($control instanceof TCheckBox) |
|
| 6900 | + $arObj->{$key} = $control->Checked; |
|
| 6901 | + elseif ($control instanceof TDatePicker) |
|
| 6902 | + $arObj->{$key} = $control->Date; |
|
| 6903 | + } |
|
| 6904 | + catch (Exception $ex) |
|
| 6905 | + { |
|
| 6906 | + if ($throwExceptions) |
|
| 6907 | + throw $ex; |
|
| 6908 | + } |
|
| 6909 | + } |
|
| 6910 | + } |
|
| 6911 | 6911 | } |
| 6912 | 6912 | class TForm extends TControl |
| 6913 | 6913 | { |
@@ -7620,13 +7620,13 @@ discard block |
||
| 7620 | 7620 | Prado::using('System.Web.UI.ActiveControls.TActivePageAdapter'); |
| 7621 | 7621 | Prado::using('System.Web.UI.JuiControls.TJuiControlOptions'); |
| 7622 | 7622 | $this->setAdapter(new TActivePageAdapter($this)); |
| 7623 | - $callbackEventParameter = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER); |
|
| 7624 | - if(strlen($callbackEventParameter) > 0) |
|
| 7625 | - $this->_postData[TPage::FIELD_CALLBACK_PARAMETER]=TJavaScript::jsonDecode((string)$callbackEventParameter); |
|
| 7626 | - if (($g=$this->getApplication()->getGlobalization(false))!==null && |
|
| 7627 | - strtoupper($enc=$g->getCharset())!='UTF-8') |
|
| 7628 | - foreach ($this->_postData as $k=>$v) |
|
| 7629 | - $this->_postData[$k]=self::decodeUTF8($v, $enc); |
|
| 7623 | + $callbackEventParameter = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER); |
|
| 7624 | + if(strlen($callbackEventParameter) > 0) |
|
| 7625 | + $this->_postData[TPage::FIELD_CALLBACK_PARAMETER]=TJavaScript::jsonDecode((string)$callbackEventParameter); |
|
| 7626 | + if (($g=$this->getApplication()->getGlobalization(false))!==null && |
|
| 7627 | + strtoupper($enc=$g->getCharset())!='UTF-8') |
|
| 7628 | + foreach ($this->_postData as $k=>$v) |
|
| 7629 | + $this->_postData[$k]=self::decodeUTF8($v, $enc); |
|
| 7630 | 7630 | $this->onPreInit(null); |
| 7631 | 7631 | $this->initRecursive(); |
| 7632 | 7632 | $this->onInitComplete(null); |
@@ -9211,15 +9211,15 @@ discard block |
||
| 9211 | 9211 | $component=new ReflectionClass('TComponent'); |
| 9212 | 9212 | $behaviors=$component->getStaticProperties(); |
| 9213 | 9213 | if(!isset($behaviors['_um'])) |
| 9214 | - return false; |
|
| 9214 | + return false; |
|
| 9215 | 9215 | foreach($behaviors['_um'] as $name=>$list) |
| 9216 | 9216 | { |
| 9217 | - if(strtolower($class->getShortName())!==$name && !$class->isSubclassOf($name)) continue; |
|
| 9218 | - foreach($list as $param) |
|
| 9219 | - { |
|
| 9220 | - if(method_exists($param->getBehavior(),$method)) |
|
| 9221 | - return true; |
|
| 9222 | - } |
|
| 9217 | + if(strtolower($class->getShortName())!==$name && !$class->isSubclassOf($name)) continue; |
|
| 9218 | + foreach($list as $param) |
|
| 9219 | + { |
|
| 9220 | + if(method_exists($param->getBehavior(),$method)) |
|
| 9221 | + return true; |
|
| 9222 | + } |
|
| 9223 | 9223 | } |
| 9224 | 9224 | return false; |
| 9225 | 9225 | } |
@@ -45,8 +45,7 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | $am=self::$_application->getAssetManager(); |
| 47 | 47 | $url=$am->publishFilePath(self::getPathOfNamespace('System.'.$logoName,'.gif')); |
| 48 | - } |
|
| 49 | - else |
|
| 48 | + } else |
|
| 50 | 49 | $url='http://pradosoft.github.io/docs/'.$logoName.'.gif'; |
| 51 | 50 | return '<a title="Powered by PRADO" href="https://github.com/pradosoft/prado" target="_blank"><img src="'.$url.'" style="border-width:0px;" alt="Powered by PRADO" /></a>'; |
| 52 | 51 | } |
@@ -70,8 +69,7 @@ discard block |
||
| 70 | 69 | if(self::$_application!==null && ($errorHandler=self::$_application->getErrorHandler())!==null) |
| 71 | 70 | { |
| 72 | 71 | $errorHandler->handleError(null,$exception); |
| 73 | - } |
|
| 74 | - else |
|
| 72 | + } else |
|
| 75 | 73 | { |
| 76 | 74 | echo $exception; |
| 77 | 75 | } |
@@ -125,8 +123,7 @@ discard block |
||
| 125 | 123 | return $component; |
| 126 | 124 | break; |
| 127 | 125 | } |
| 128 | - } |
|
| 129 | - else |
|
| 126 | + } else |
|
| 130 | 127 | return new $type; |
| 131 | 128 | } |
| 132 | 129 | public static function using($namespace,$checkClassExistence=true) |
@@ -137,31 +134,27 @@ discard block |
||
| 137 | 134 | try |
| 138 | 135 | { |
| 139 | 136 | include_once($namespace.self::CLASS_FILE_EXT); |
| 140 | - } |
|
| 141 | - catch(Exception $e) |
|
| 137 | + } catch(Exception $e) |
|
| 142 | 138 | { |
| 143 | 139 | if($checkClassExistence && !class_exists($namespace,false)) |
| 144 | 140 | throw new TInvalidOperationException('prado_component_unknown',$namespace,$e->getMessage()); |
| 145 | 141 | else |
| 146 | 142 | throw $e; |
| 147 | 143 | } |
| 148 | - } |
|
| 149 | - else if(($path=self::getPathOfNamespace($namespace,self::CLASS_FILE_EXT))!==null) |
|
| 144 | + } else if(($path=self::getPathOfNamespace($namespace,self::CLASS_FILE_EXT))!==null) |
|
| 150 | 145 | { |
| 151 | 146 | $className=substr($namespace,$pos+1); |
| 152 | 147 | if($className==='*') { |
| 153 | 148 | self::$_usings[$namespace]=$path; |
| 154 | 149 | set_include_path(get_include_path().PATH_SEPARATOR.$path); |
| 155 | - } |
|
| 156 | - else { |
|
| 150 | + } else { |
|
| 157 | 151 | self::$_usings[$namespace]=$path; |
| 158 | 152 | if(!$checkClassExistence || !class_exists($className,false)) |
| 159 | 153 | { |
| 160 | 154 | try |
| 161 | 155 | { |
| 162 | 156 | include_once($path); |
| 163 | - } |
|
| 164 | - catch(Exception $e) |
|
| 157 | + } catch(Exception $e) |
|
| 165 | 158 | { |
| 166 | 159 | if($checkClassExistence && !class_exists($className,false)) |
| 167 | 160 | throw new TInvalidOperationException('prado_component_unknown',$className,$e->getMessage()); |
@@ -170,8 +163,7 @@ discard block |
||
| 170 | 163 | } |
| 171 | 164 | } |
| 172 | 165 | } |
| 173 | - } |
|
| 174 | - else |
|
| 166 | + } else |
|
| 175 | 167 | throw new TInvalidDataValueException('prado_using_invalid',$namespace); |
| 176 | 168 | } |
| 177 | 169 | public static function getPathOfNamespace($namespace, $ext='') |
@@ -207,8 +199,7 @@ discard block |
||
| 207 | 199 | self::$_aliases[$alias]=$rp; |
| 208 | 200 | else |
| 209 | 201 | throw new TInvalidDataValueException('prado_aliasname_invalid',$alias); |
| 210 | - } |
|
| 211 | - else |
|
| 202 | + } else |
|
| 212 | 203 | throw new TInvalidDataValueException('prado_alias_invalid',$alias,$path); |
| 213 | 204 | } |
| 214 | 205 | public static function fatalError($msg) |
@@ -245,8 +236,7 @@ discard block |
||
| 245 | 236 | echo "'". substr($str, 0, 70) . "...'"; |
| 246 | 237 | else |
| 247 | 238 | echo "'" . $str . "'"; |
| 248 | - } |
|
| 249 | - else if (is_int($item) || is_float($item)) |
|
| 239 | + } else if (is_int($item) || is_float($item)) |
|
| 250 | 240 | echo $item; |
| 251 | 241 | else if (is_object($item)) |
| 252 | 242 | echo get_class($item); |
@@ -315,8 +305,7 @@ discard block |
||
| 315 | 305 | if(isset($trace[0]['file']) && isset($trace[0]['line'])) |
| 316 | 306 | $msg.=" (line {$trace[0]['line']}, {$trace[0]['file']})"; |
| 317 | 307 | $level=TLogger::DEBUG; |
| 318 | - } |
|
| 319 | - else |
|
| 308 | + } else |
|
| 320 | 309 | $level=TLogger::INFO; |
| 321 | 310 | self::log($msg,$level,$category,$ctl); |
| 322 | 311 | } |
@@ -621,8 +610,7 @@ discard block |
||
| 621 | 610 | echo "<body><h1>Recursive Error</h1>\n"; |
| 622 | 611 | echo "<pre>".$exception->__toString()."</pre>\n"; |
| 623 | 612 | echo "</body></html>"; |
| 624 | - } |
|
| 625 | - else |
|
| 613 | + } else |
|
| 626 | 614 | { |
| 627 | 615 | error_log("Error happened while processing an existing error:\n".$exception->__toString()); |
| 628 | 616 | header('HTTP/1.0 500 Internal Error'); |
@@ -644,15 +632,13 @@ discard block |
||
| 644 | 632 | if($fileName==='') |
| 645 | 633 | $fileName='---embedded template---'; |
| 646 | 634 | $errorLine=$exception->getLineNumber(); |
| 647 | - } |
|
| 648 | - else |
|
| 635 | + } else |
|
| 649 | 636 | { |
| 650 | 637 | if(($trace=$this->getExactTrace($exception))!==null) |
| 651 | 638 | { |
| 652 | 639 | $fileName=$trace['file']; |
| 653 | 640 | $errorLine=$trace['line']; |
| 654 | - } |
|
| 655 | - else |
|
| 641 | + } else |
|
| 656 | 642 | { |
| 657 | 643 | $fileName=$exception->getFile(); |
| 658 | 644 | $errorLine=$exception->getLine(); |
@@ -711,8 +697,7 @@ discard block |
||
| 711 | 697 | $result=$trace[0]; |
| 712 | 698 | elseif(isset($trace[1])) |
| 713 | 699 | $result=$trace[1]; |
| 714 | - } |
|
| 715 | - else if($exception instanceof TInvalidOperationException) |
|
| 700 | + } else if($exception instanceof TInvalidOperationException) |
|
| 716 | 701 | { |
| 717 | 702 | if(($result=$this->getPropertyAccessTrace($trace,'__get'))===null) |
| 718 | 703 | $result=$this->getPropertyAccessTrace($trace,'__set'); |
@@ -744,8 +729,7 @@ discard block |
||
| 744 | 729 | { |
| 745 | 730 | $line=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",' ',$lines[$i]))); |
| 746 | 731 | $source.="<div class=\"error\">".$line."</div>"; |
| 747 | - } |
|
| 748 | - else |
|
| 732 | + } else |
|
| 749 | 733 | $source.=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",' ',$lines[$i]))); |
| 750 | 734 | } |
| 751 | 735 | return $source; |
@@ -809,11 +793,9 @@ discard block |
||
| 809 | 793 | { |
| 810 | 794 | array_splice($this->_d,$index,0,array($item)); |
| 811 | 795 | $this->_c++; |
| 812 | - } |
|
| 813 | - else |
|
| 796 | + } else |
|
| 814 | 797 | throw new TInvalidDataValueException('list_index_invalid',$index); |
| 815 | - } |
|
| 816 | - else |
|
| 798 | + } else |
|
| 817 | 799 | throw new TInvalidOperationException('list_readonly',get_class($this)); |
| 818 | 800 | } |
| 819 | 801 | public function remove($item) |
@@ -824,11 +806,9 @@ discard block |
||
| 824 | 806 | { |
| 825 | 807 | $this->removeAt($index); |
| 826 | 808 | return $index; |
| 827 | - } |
|
| 828 | - else |
|
| 809 | + } else |
|
| 829 | 810 | throw new TInvalidDataValueException('list_item_inexistent'); |
| 830 | - } |
|
| 831 | - else |
|
| 811 | + } else |
|
| 832 | 812 | throw new TInvalidOperationException('list_readonly',get_class($this)); |
| 833 | 813 | } |
| 834 | 814 | public function removeAt($index) |
@@ -846,11 +826,9 @@ discard block |
||
| 846 | 826 | array_splice($this->_d,$index,1); |
| 847 | 827 | return $item; |
| 848 | 828 | } |
| 849 | - } |
|
| 850 | - else |
|
| 829 | + } else |
|
| 851 | 830 | throw new TInvalidDataValueException('list_index_invalid',$index); |
| 852 | - } |
|
| 853 | - else |
|
| 831 | + } else |
|
| 854 | 832 | throw new TInvalidOperationException('list_readonly',get_class($this)); |
| 855 | 833 | } |
| 856 | 834 | public function clear() |
@@ -877,8 +855,7 @@ discard block |
||
| 877 | 855 | throw new TInvalidDataValueException('list_item_inexistent'); |
| 878 | 856 | $this->insertAt($index, $item); |
| 879 | 857 | return $index; |
| 880 | - } |
|
| 881 | - else |
|
| 858 | + } else |
|
| 882 | 859 | throw new TInvalidOperationException('list_readonly',get_class($this)); |
| 883 | 860 | } |
| 884 | 861 | public function insertAfter($baseitem, $item) |
@@ -889,8 +866,7 @@ discard block |
||
| 889 | 866 | throw new TInvalidDataValueException('list_item_inexistent'); |
| 890 | 867 | $this->insertAt($index + 1, $item); |
| 891 | 868 | return $index + 1; |
| 892 | - } |
|
| 893 | - else |
|
| 869 | + } else |
|
| 894 | 870 | throw new TInvalidOperationException('list_readonly',get_class($this)); |
| 895 | 871 | } |
| 896 | 872 | public function toArray() |
@@ -905,8 +881,7 @@ discard block |
||
| 905 | 881 | $this->clear(); |
| 906 | 882 | foreach($data as $item) |
| 907 | 883 | $this->add($item); |
| 908 | - } |
|
| 909 | - else if($data!==null) |
|
| 884 | + } else if($data!==null) |
|
| 910 | 885 | throw new TInvalidDataTypeException('list_data_not_iterable'); |
| 911 | 886 | } |
| 912 | 887 | public function mergeWith($data) |
@@ -915,8 +890,7 @@ discard block |
||
| 915 | 890 | { |
| 916 | 891 | foreach($data as $item) |
| 917 | 892 | $this->add($item); |
| 918 | - } |
|
| 919 | - else if($data!==null) |
|
| 893 | + } else if($data!==null) |
|
| 920 | 894 | throw new TInvalidDataTypeException('list_data_not_iterable'); |
| 921 | 895 | } |
| 922 | 896 | public function offsetExists($offset) |
@@ -1130,8 +1104,7 @@ discard block |
||
| 1130 | 1104 | { |
| 1131 | 1105 | if(($this->_recursiveLevel<0 || $level<$this->_recursiveLevel) && $this->validateDirectory($path)) |
| 1132 | 1106 | $timestamps=array_merge($this->generateTimestamps($path,$level+1)); |
| 1133 | - } |
|
| 1134 | - else if($this->validateFile($path)) |
|
| 1107 | + } else if($this->validateFile($path)) |
|
| 1135 | 1108 | $timestamps[$path]=filemtime($path); |
| 1136 | 1109 | } |
| 1137 | 1110 | closedir($dir); |
@@ -1392,8 +1365,7 @@ discard block |
||
| 1392 | 1365 | } |
| 1393 | 1366 | $this->removeAtIndexInPriority($p[1],$p[0]); |
| 1394 | 1367 | return $p[2]; |
| 1395 | - } |
|
| 1396 | - else |
|
| 1368 | + } else |
|
| 1397 | 1369 | throw new TInvalidDataValueException('list_item_inexistent'); |
| 1398 | 1370 | } |
| 1399 | 1371 | public function removeAt($index) |
@@ -1551,13 +1523,11 @@ discard block |
||
| 1551 | 1523 | foreach($data->itemsAtPriority($priority) as $index=>$item) |
| 1552 | 1524 | $this->insertAtIndexInPriority($item,false,$priority); |
| 1553 | 1525 | } |
| 1554 | - } |
|
| 1555 | - else if(is_array($data)||$data instanceof Traversable) |
|
| 1526 | + } else if(is_array($data)||$data instanceof Traversable) |
|
| 1556 | 1527 | { |
| 1557 | 1528 | foreach($data as $priority=>$item) |
| 1558 | 1529 | $this->add($item); |
| 1559 | - } |
|
| 1560 | - else if($data!==null) |
|
| 1530 | + } else if($data!==null) |
|
| 1561 | 1531 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
| 1562 | 1532 | } |
| 1563 | 1533 | public function offsetExists($offset) |
@@ -1648,11 +1618,9 @@ discard block |
||
| 1648 | 1618 | $value=$this->_d[$key]; |
| 1649 | 1619 | unset($this->_d[$key]); |
| 1650 | 1620 | return $value; |
| 1651 | - } |
|
| 1652 | - else |
|
| 1621 | + } else |
|
| 1653 | 1622 | return null; |
| 1654 | - } |
|
| 1655 | - else |
|
| 1623 | + } else |
|
| 1656 | 1624 | throw new TInvalidOperationException('map_readonly',get_class($this)); |
| 1657 | 1625 | } |
| 1658 | 1626 | public function clear() |
@@ -1676,8 +1644,7 @@ discard block |
||
| 1676 | 1644 | $this->clear(); |
| 1677 | 1645 | foreach($data as $key=>$value) |
| 1678 | 1646 | $this->add($key,$value); |
| 1679 | - } |
|
| 1680 | - else if($data!==null) |
|
| 1647 | + } else if($data!==null) |
|
| 1681 | 1648 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
| 1682 | 1649 | } |
| 1683 | 1650 | public function mergeWith($data) |
@@ -1686,8 +1653,7 @@ discard block |
||
| 1686 | 1653 | { |
| 1687 | 1654 | foreach($data as $key=>$value) |
| 1688 | 1655 | $this->add($key,$value); |
| 1689 | - } |
|
| 1690 | - else if($data!==null) |
|
| 1656 | + } else if($data!==null) |
|
| 1691 | 1657 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
| 1692 | 1658 | } |
| 1693 | 1659 | public function offsetExists($offset) |
@@ -1861,13 +1827,11 @@ discard block |
||
| 1861 | 1827 | if(!isset($this->_d[$priority])) { |
| 1862 | 1828 | $this->_d[$priority]=array($key=>$value); |
| 1863 | 1829 | $this->_o=false; |
| 1864 | - } |
|
| 1865 | - else |
|
| 1830 | + } else |
|
| 1866 | 1831 | $this->_d[$priority][$key]=$value; |
| 1867 | 1832 | $this->_c++; |
| 1868 | 1833 | $this->_fd=null; |
| 1869 | - } |
|
| 1870 | - else |
|
| 1834 | + } else |
|
| 1871 | 1835 | throw new TInvalidOperationException('map_readonly',get_class($this)); |
| 1872 | 1836 | return $priority; |
| 1873 | 1837 | } |
@@ -1895,8 +1859,7 @@ discard block |
||
| 1895 | 1859 | return $value; |
| 1896 | 1860 | } |
| 1897 | 1861 | return null; |
| 1898 | - } |
|
| 1899 | - else |
|
| 1862 | + } else |
|
| 1900 | 1863 | { |
| 1901 | 1864 | $priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p); |
| 1902 | 1865 | if(isset($this->_d[$priority])&&(isset($this->_d[$priority][$key])||array_key_exists($key,$this->_d[$priority]))) |
@@ -1910,12 +1873,10 @@ discard block |
||
| 1910 | 1873 | } |
| 1911 | 1874 | $this->_fd=null; |
| 1912 | 1875 | return $value; |
| 1913 | - } |
|
| 1914 | - else |
|
| 1876 | + } else |
|
| 1915 | 1877 | return null; |
| 1916 | 1878 | } |
| 1917 | - } |
|
| 1918 | - else |
|
| 1879 | + } else |
|
| 1919 | 1880 | throw new TInvalidOperationException('map_readonly',get_class($this)); |
| 1920 | 1881 | } |
| 1921 | 1882 | public function clear() |
@@ -1968,15 +1929,13 @@ discard block |
||
| 1968 | 1929 | $this->add($key,$value,$priority); |
| 1969 | 1930 | } |
| 1970 | 1931 | } |
| 1971 | - } |
|
| 1972 | - else if(is_array($data)||$data instanceof Traversable) |
|
| 1932 | + } else if(is_array($data)||$data instanceof Traversable) |
|
| 1973 | 1933 | { |
| 1974 | 1934 | if($this->getCount()>0) |
| 1975 | 1935 | $this->clear(); |
| 1976 | 1936 | foreach($data as $key=>$value) |
| 1977 | 1937 | $this->add($key,$value); |
| 1978 | - } |
|
| 1979 | - else if($data!==null) |
|
| 1938 | + } else if($data!==null) |
|
| 1980 | 1939 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
| 1981 | 1940 | } |
| 1982 | 1941 | public function mergeWith($data) |
@@ -1988,13 +1947,11 @@ discard block |
||
| 1988 | 1947 | foreach($data->itemsAtPriority($priority) as $key => $value) |
| 1989 | 1948 | $this->add($key,$value,$priority); |
| 1990 | 1949 | } |
| 1991 | - } |
|
| 1992 | - else if(is_array($data)||$data instanceof Traversable) |
|
| 1950 | + } else if(is_array($data)||$data instanceof Traversable) |
|
| 1993 | 1951 | { |
| 1994 | 1952 | foreach($data as $key=>$value) |
| 1995 | 1953 | $this->add($key,$value); |
| 1996 | - } |
|
| 1997 | - else if($data!==null) |
|
| 1954 | + } else if($data!==null) |
|
| 1998 | 1955 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
| 1999 | 1956 | } |
| 2000 | 1957 | public function offsetExists($offset) |
@@ -2037,8 +1994,7 @@ discard block |
||
| 2037 | 1994 | $this->_d[]=$item; |
| 2038 | 1995 | ++$this->_c; |
| 2039 | 1996 | } |
| 2040 | - } |
|
| 2041 | - else if($data!==null) |
|
| 1997 | + } else if($data!==null) |
|
| 2042 | 1998 | throw new TInvalidDataTypeException('stack_data_not_iterable'); |
| 2043 | 1999 | } |
| 2044 | 2000 | public function clear() |
@@ -2223,13 +2179,11 @@ discard block |
||
| 2223 | 2179 | $str.=$element->toString($indent+1)."\n"; |
| 2224 | 2180 | $str.=$prefix."</{$this->_tagName}>"; |
| 2225 | 2181 | return $str; |
| 2226 | - } |
|
| 2227 | - else if(($value=$this->getValue())!=='') |
|
| 2182 | + } else if(($value=$this->getValue())!=='') |
|
| 2228 | 2183 | { |
| 2229 | 2184 | $value=$this->xmlEncode($value); |
| 2230 | 2185 | return $prefix."<{$this->_tagName}$attr>$value</{$this->_tagName}>"; |
| 2231 | - } |
|
| 2232 | - else |
|
| 2186 | + } else |
|
| 2233 | 2187 | return $prefix."<{$this->_tagName}$attr />"; |
| 2234 | 2188 | } |
| 2235 | 2189 | public function __toString() |
@@ -2326,8 +2280,7 @@ discard block |
||
| 2326 | 2280 | { |
| 2327 | 2281 | fwrite($fw,$this->saveToString()); |
| 2328 | 2282 | fclose($fw); |
| 2329 | - } |
|
| 2330 | - else |
|
| 2283 | + } else |
|
| 2331 | 2284 | throw new TIOException('xmldocument_file_write_failed',$file); |
| 2332 | 2285 | } |
| 2333 | 2286 | public function saveToString() |
@@ -2373,8 +2326,7 @@ discard block |
||
| 2373 | 2326 | if($item->getParent()!==null) |
| 2374 | 2327 | $item->getParent()->getElements()->remove($item); |
| 2375 | 2328 | $item->setParent($this->_o); |
| 2376 | - } |
|
| 2377 | - else |
|
| 2329 | + } else |
|
| 2378 | 2330 | throw new TInvalidDataTypeException('xmlelementlist_xmlelement_required'); |
| 2379 | 2331 | } |
| 2380 | 2332 | public function removeAt($index) |
@@ -2418,8 +2370,7 @@ discard block |
||
| 2418 | 2370 | { |
| 2419 | 2371 | $this->_everyone=true; |
| 2420 | 2372 | break; |
| 2421 | - } |
|
| 2422 | - else if($user==='?') |
|
| 2373 | + } else if($user==='?') |
|
| 2423 | 2374 | $this->_guest=true; |
| 2424 | 2375 | else if($user==='@') |
| 2425 | 2376 | $this->_authenticated=true; |
@@ -2529,8 +2480,7 @@ discard block |
||
| 2529 | 2480 | return ($decision>0); |
| 2530 | 2481 | } |
| 2531 | 2482 | return true; |
| 2532 | - } |
|
| 2533 | - else |
|
| 2483 | + } else |
|
| 2534 | 2484 | return false; |
| 2535 | 2485 | } |
| 2536 | 2486 | public function insertAt($index,$item) |
@@ -2660,8 +2610,7 @@ discard block |
||
| 2660 | 2610 | if($module===false) |
| 2661 | 2611 | throw new TNotSupportedException('securitymanager_mcryptextension_initfailed'); |
| 2662 | 2612 | return $module; |
| 2663 | - } |
|
| 2664 | - else |
|
| 2613 | + } else |
|
| 2665 | 2614 | throw new TNotSupportedException('securitymanager_mcryptextension_required'); |
| 2666 | 2615 | } |
| 2667 | 2616 | public function hashData($data) |
@@ -2801,8 +2750,7 @@ discard block |
||
| 2801 | 2750 | } |
| 2802 | 2751 | } |
| 2803 | 2752 | return '{'.$results.'}'; |
| 2804 | - } |
|
| 2805 | - else |
|
| 2753 | + } else |
|
| 2806 | 2754 | { |
| 2807 | 2755 | foreach($value as $v) |
| 2808 | 2756 | { |
@@ -2815,8 +2763,7 @@ discard block |
||
| 2815 | 2763 | } |
| 2816 | 2764 | return '['.$results.']'; |
| 2817 | 2765 | } |
| 2818 | - } |
|
| 2819 | - else if(is_integer($value)) |
|
| 2766 | + } else if(is_integer($value)) |
|
| 2820 | 2767 | return "$value"; |
| 2821 | 2768 | else if(is_float($value)) |
| 2822 | 2769 | { |
@@ -2836,8 +2783,7 @@ discard block |
||
| 2836 | 2783 | return str_replace($locale['decimal_point'], '.', "$value"); |
| 2837 | 2784 | break; |
| 2838 | 2785 | } |
| 2839 | - } |
|
| 2840 | - else if(is_object($value)) |
|
| 2786 | + } else if(is_object($value)) |
|
| 2841 | 2787 | if ($value instanceof TJavaScriptLiteral) |
| 2842 | 2788 | return $value->toJavaScriptLiteral(); |
| 2843 | 2789 | else |
@@ -2924,12 +2870,10 @@ discard block |
||
| 2924 | 2870 | $name=urlencode($name.'[]'); |
| 2925 | 2871 | foreach($value as $v) |
| 2926 | 2872 | $url.=$amp.$name.'='.urlencode($v); |
| 2927 | - } |
|
| 2928 | - else |
|
| 2873 | + } else |
|
| 2929 | 2874 | $url.=$amp.urlencode($name).'='.urlencode($value); |
| 2930 | 2875 | } |
| 2931 | - } |
|
| 2932 | - else |
|
| 2876 | + } else |
|
| 2933 | 2877 | { |
| 2934 | 2878 | foreach($getItems as $name=>$value) |
| 2935 | 2879 | { |
@@ -2937,8 +2881,7 @@ discard block |
||
| 2937 | 2881 | { |
| 2938 | 2882 | foreach($value as $v) |
| 2939 | 2883 | $url.=$amp.$name.'[]='.$v; |
| 2940 | - } |
|
| 2941 | - else |
|
| 2884 | + } else |
|
| 2942 | 2885 | $url.=$amp.$name.'='.$value; |
| 2943 | 2886 | } |
| 2944 | 2887 | } |
@@ -2976,14 +2919,12 @@ discard block |
||
| 2976 | 2919 | $getVariables[substr($name,0,$pos)][]=$value; |
| 2977 | 2920 | else |
| 2978 | 2921 | $getVariables[$name]=$value; |
| 2979 | - } |
|
| 2980 | - else |
|
| 2922 | + } else |
|
| 2981 | 2923 | $getVariables[$path]=''; |
| 2982 | 2924 | } |
| 2983 | 2925 | } |
| 2984 | 2926 | return $getVariables; |
| 2985 | - } |
|
| 2986 | - else |
|
| 2927 | + } else |
|
| 2987 | 2928 | return array(); |
| 2988 | 2929 | } |
| 2989 | 2930 | } |
@@ -3067,8 +3008,7 @@ discard block |
||
| 3067 | 3008 | $port=$_SERVER['SERVER_PORT']; |
| 3068 | 3009 | if(($port!=80 && !$secure) || ($port!=443 && $secure)) |
| 3069 | 3010 | $url.=':'.$port; |
| 3070 | - } |
|
| 3071 | - else |
|
| 3011 | + } else |
|
| 3072 | 3012 | $url.=$_SERVER['HTTP_HOST']; |
| 3073 | 3013 | $url.=$this->getRequestUri(); |
| 3074 | 3014 | $this->_url=new TUri($url); |
@@ -3138,8 +3078,7 @@ discard block |
||
| 3138 | 3078 | { |
| 3139 | 3079 | $this->_urlManager=new TUrlManager; |
| 3140 | 3080 | $this->_urlManager->init(null); |
| 3141 | - } |
|
| 3142 | - else |
|
| 3081 | + } else |
|
| 3143 | 3082 | { |
| 3144 | 3083 | $this->_urlManager=$this->getApplication()->getModule($this->_urlManagerID); |
| 3145 | 3084 | if($this->_urlManager===null) |
@@ -3204,8 +3143,7 @@ discard block |
||
| 3204 | 3143 | static $result; |
| 3205 | 3144 | if($result === null && function_exists('apache_request_headers')) { |
| 3206 | 3145 | $result = apache_request_headers(); |
| 3207 | - } |
|
| 3208 | - elseif($result === null) { |
|
| 3146 | + } elseif($result === null) { |
|
| 3209 | 3147 | $result = array(); |
| 3210 | 3148 | foreach($_SERVER as $key=>$value) { |
| 3211 | 3149 | if(strncasecmp($key, 'HTTP_', 5) !== 0) continue; |
@@ -3260,8 +3198,7 @@ discard block |
||
| 3260 | 3198 | try |
| 3261 | 3199 | { |
| 3262 | 3200 | return get_browser(); |
| 3263 | - } |
|
| 3264 | - catch(TPhpErrorException $e) |
|
| 3201 | + } catch(TPhpErrorException $e) |
|
| 3265 | 3202 | { |
| 3266 | 3203 | throw new TConfigurationException('httprequest_browscap_required'); |
| 3267 | 3204 | } |
@@ -3315,8 +3252,7 @@ discard block |
||
| 3315 | 3252 | if(($value=$sm->validateData($value))!==false) |
| 3316 | 3253 | $this->_cookies->add(new THttpCookie($key,$value)); |
| 3317 | 3254 | } |
| 3318 | - } |
|
| 3319 | - else |
|
| 3255 | + } else |
|
| 3320 | 3256 | { |
| 3321 | 3257 | foreach($_COOKIE as $key=>$value) |
| 3322 | 3258 | $this->_cookies->add(new THttpCookie($key,$value)); |
@@ -3419,8 +3355,7 @@ discard block |
||
| 3419 | 3355 | $value=$this->_items[$key]; |
| 3420 | 3356 | unset($this->_items[$key]); |
| 3421 | 3357 | return $value; |
| 3422 | - } |
|
| 3423 | - else |
|
| 3358 | + } else |
|
| 3424 | 3359 | return null; |
| 3425 | 3360 | } |
| 3426 | 3361 | public function clear() |
@@ -3467,8 +3402,7 @@ discard block |
||
| 3467 | 3402 | parent::insertAt($index,$item); |
| 3468 | 3403 | if($this->_o instanceof THttpResponse) |
| 3469 | 3404 | $this->_o->addCookie($item); |
| 3470 | - } |
|
| 3471 | - else |
|
| 3405 | + } else |
|
| 3472 | 3406 | throw new TInvalidDataTypeException('httpcookiecollection_httpcookie_required'); |
| 3473 | 3407 | } |
| 3474 | 3408 | public function removeAt($index) |
@@ -3598,8 +3532,7 @@ discard block |
||
| 3598 | 3532 | $this->_query=isset($ret['query'])?$ret['query']:''; |
| 3599 | 3533 | $this->_fragment=isset($ret['fragment'])?$ret['fragment']:''; |
| 3600 | 3534 | $this->_uri=$uri; |
| 3601 | - } |
|
| 3602 | - else |
|
| 3535 | + } else |
|
| 3603 | 3536 | { |
| 3604 | 3537 | throw new TInvalidDataValueException('uri_format_invalid',$uri); |
| 3605 | 3538 | } |
@@ -3771,7 +3704,7 @@ discard block |
||
| 3771 | 3704 | $status=TPropertyValue::ensureInteger($status); |
| 3772 | 3705 | if(isset(self::$HTTP_STATUS_CODES[$status])) { |
| 3773 | 3706 | $this->_reason=self::$HTTP_STATUS_CODES[$status]; |
| 3774 | - }else{ |
|
| 3707 | + } else{ |
|
| 3775 | 3708 | if($reason===null || $reason==='') { |
| 3776 | 3709 | throw new TInvalidDataValueException("response_status_reason_missing"); |
| 3777 | 3710 | } |
@@ -3835,8 +3768,7 @@ discard block |
||
| 3835 | 3768 | { |
| 3836 | 3769 | foreach($headers as $h) |
| 3837 | 3770 | header($h); |
| 3838 | - } |
|
| 3839 | - else |
|
| 3771 | + } else |
|
| 3840 | 3772 | { |
| 3841 | 3773 | header('Pragma: public'); |
| 3842 | 3774 | header('Expires: 0'); |
@@ -3899,13 +3831,11 @@ discard block |
||
| 3899 | 3831 | { |
| 3900 | 3832 | $this->_bufferOutput = false; |
| 3901 | 3833 | ob_end_flush(); |
| 3902 | - } |
|
| 3903 | - else |
|
| 3834 | + } else |
|
| 3904 | 3835 | ob_flush(); |
| 3905 | 3836 | flush(); |
| 3906 | 3837 | } |
| 3907 | - } |
|
| 3908 | - else |
|
| 3838 | + } else |
|
| 3909 | 3839 | flush(); |
| 3910 | 3840 | } |
| 3911 | 3841 | protected function ensureHttpHeaderSent() |
@@ -3991,8 +3921,7 @@ discard block |
||
| 3991 | 3921 | $cookie->getSecure(), |
| 3992 | 3922 | $cookie->getHttpOnly() |
| 3993 | 3923 | ); |
| 3994 | - } |
|
| 3995 | - else { |
|
| 3924 | + } else { |
|
| 3996 | 3925 | setcookie( |
| 3997 | 3926 | $cookie->getName(), |
| 3998 | 3927 | $cookie->getValue(), |
@@ -4172,13 +4101,11 @@ discard block |
||
| 4172 | 4101 | { |
| 4173 | 4102 | ini_set('session.use_cookies','0'); |
| 4174 | 4103 | ini_set('session.use_only_cookies','0'); |
| 4175 | - } |
|
| 4176 | - else if($value===THttpSessionCookieMode::Allow) |
|
| 4104 | + } else if($value===THttpSessionCookieMode::Allow) |
|
| 4177 | 4105 | { |
| 4178 | 4106 | ini_set('session.use_cookies','1'); |
| 4179 | 4107 | ini_set('session.use_only_cookies','0'); |
| 4180 | - } |
|
| 4181 | - else |
|
| 4108 | + } else |
|
| 4182 | 4109 | { |
| 4183 | 4110 | ini_set('session.use_cookies','1'); |
| 4184 | 4111 | ini_set('session.use_only_cookies','1'); |
@@ -4212,8 +4139,7 @@ discard block |
||
| 4212 | 4139 | { |
| 4213 | 4140 | ini_set('session.gc_probability',$value); |
| 4214 | 4141 | ini_set('session.gc_divisor','100'); |
| 4215 | - } |
|
| 4216 | - else |
|
| 4142 | + } else |
|
| 4217 | 4143 | throw new TInvalidDataValueException('httpsession_gcprobability_invalid',$value); |
| 4218 | 4144 | } |
| 4219 | 4145 | } |
@@ -4299,8 +4225,7 @@ discard block |
||
| 4299 | 4225 | $value=$_SESSION[$key]; |
| 4300 | 4226 | unset($_SESSION[$key]); |
| 4301 | 4227 | return $value; |
| 4302 | - } |
|
| 4303 | - else |
|
| 4228 | + } else |
|
| 4304 | 4229 | return null; |
| 4305 | 4230 | } |
| 4306 | 4231 | public function clear() |
@@ -4623,10 +4548,8 @@ discard block |
||
| 4623 | 4548 | return $this->_id; |
| 4624 | 4549 | else |
| 4625 | 4550 | return ($this->_uid=$prefix.self::ID_SEPARATOR.$this->_id); |
| 4626 | - } |
|
| 4627 | - else return $this->_id; |
|
| 4628 | - } |
|
| 4629 | - else |
|
| 4551 | + } else return $this->_id; |
|
| 4552 | + } else |
|
| 4630 | 4553 | return $this->_uid; |
| 4631 | 4554 | } |
| 4632 | 4555 | public function focus() |
@@ -4702,8 +4625,7 @@ discard block |
||
| 4702 | 4625 | if(!$control->getVisible(false)) |
| 4703 | 4626 | return false; |
| 4704 | 4627 | return true; |
| 4705 | - } |
|
| 4706 | - else |
|
| 4628 | + } else |
|
| 4707 | 4629 | return $this->getViewState('Visible',true); |
| 4708 | 4630 | } |
| 4709 | 4631 | public function setVisible($value) |
@@ -4718,8 +4640,7 @@ discard block |
||
| 4718 | 4640 | if(!$control->getViewState('Enabled',true)) |
| 4719 | 4641 | return false; |
| 4720 | 4642 | return true; |
| 4721 | - } |
|
| 4722 | - else |
|
| 4643 | + } else |
|
| 4723 | 4644 | return $this->getViewState('Enabled',true); |
| 4724 | 4645 | } |
| 4725 | 4646 | public function setEnabled($value) |
@@ -4777,8 +4698,7 @@ discard block |
||
| 4777 | 4698 | if($control->_flags & self::IS_DISABLE_VIEWSTATE) |
| 4778 | 4699 | return false; |
| 4779 | 4700 | return true; |
| 4780 | - } |
|
| 4781 | - else |
|
| 4701 | + } else |
|
| 4782 | 4702 | return !($this->_flags & self::IS_DISABLE_VIEWSTATE); |
| 4783 | 4703 | } |
| 4784 | 4704 | public function setEnableViewState($value) |
@@ -4816,8 +4736,7 @@ discard block |
||
| 4816 | 4736 | if(is_object($this->_tempState[$key]) && $this->_trackViewState) |
| 4817 | 4737 | $this->_viewState[$key]=$this->_tempState[$key]; |
| 4818 | 4738 | return $this->_tempState[$key]; |
| 4819 | - } |
|
| 4820 | - else |
|
| 4739 | + } else |
|
| 4821 | 4740 | return $defaultValue; |
| 4822 | 4741 | } |
| 4823 | 4742 | public function setViewState($key,$value,$defaultValue=null) |
@@ -4826,8 +4745,7 @@ discard block |
||
| 4826 | 4745 | { |
| 4827 | 4746 | unset($this->_tempState[$key]); |
| 4828 | 4747 | $this->_viewState[$key]=$value; |
| 4829 | - } |
|
| 4830 | - else |
|
| 4748 | + } else |
|
| 4831 | 4749 | { |
| 4832 | 4750 | unset($this->_viewState[$key]); |
| 4833 | 4751 | if($value===$defaultValue) |
@@ -4916,8 +4834,7 @@ discard block |
||
| 4916 | 4834 | $this->createChildControls(); |
| 4917 | 4835 | $this->_flags &= ~self::IS_CREATING_CHILD; |
| 4918 | 4836 | $this->_flags |= self::IS_CHILD_CREATED; |
| 4919 | - } |
|
| 4920 | - catch(Exception $e) |
|
| 4837 | + } catch(Exception $e) |
|
| 4921 | 4838 | { |
| 4922 | 4839 | $this->_flags &= ~self::IS_CREATING_CHILD; |
| 4923 | 4840 | $this->_flags |= self::IS_CHILD_CREATED; |
@@ -5041,8 +4958,9 @@ discard block |
||
| 5041 | 4958 | final protected function isDescendentOf($ancestor) |
| 5042 | 4959 | { |
| 5043 | 4960 | $control=$this; |
| 5044 | - while($control!==$ancestor && $control->_parent) |
|
| 5045 | - $control=$control->_parent; |
|
| 4961 | + while($control!==$ancestor && $control->_parent) { |
|
| 4962 | + $control=$control->_parent; |
|
| 4963 | + } |
|
| 5046 | 4964 | return $control===$ancestor; |
| 5047 | 4965 | } |
| 5048 | 4966 | public function addedControl($control) |
@@ -5070,8 +4988,7 @@ discard block |
||
| 5070 | 4988 | { |
| 5071 | 4989 | $state=$this->_rf[self::RF_CHILD_STATE][$control->_id]; |
| 5072 | 4990 | unset($this->_rf[self::RF_CHILD_STATE][$control->_id]); |
| 5073 | - } |
|
| 5074 | - else |
|
| 4991 | + } else |
|
| 5075 | 4992 | $state=null; |
| 5076 | 4993 | $control->loadStateRecursive($state,!($this->_flags & self::IS_DISABLE_VIEWSTATE)); |
| 5077 | 4994 | if($this->_stage>=self::CS_LOADED) |
@@ -5304,8 +5221,7 @@ discard block |
||
| 5304 | 5221 | { |
| 5305 | 5222 | $this->_rf[self::RF_CONTROLSTATE]=&$state[1]; |
| 5306 | 5223 | unset($state[1]); |
| 5307 | - } |
|
| 5308 | - else |
|
| 5224 | + } else |
|
| 5309 | 5225 | unset($this->_rf[self::RF_CONTROLSTATE]); |
| 5310 | 5226 | if($needViewState) |
| 5311 | 5227 | { |
@@ -5369,8 +5285,7 @@ discard block |
||
| 5369 | 5285 | { |
| 5370 | 5286 | $page->applyControlStyleSheet($this); |
| 5371 | 5287 | $this->_flags |= self::IS_STYLESHEET_APPLIED; |
| 5372 | - } |
|
| 5373 | - else if($this->_flags & self::IS_STYLESHEET_APPLIED) |
|
| 5288 | + } else if($this->_flags & self::IS_STYLESHEET_APPLIED) |
|
| 5374 | 5289 | throw new TInvalidOperationException('control_stylesheet_applied',get_class($this)); |
| 5375 | 5290 | } |
| 5376 | 5291 | private function clearCachedUniqueID($recursive) |
@@ -5433,8 +5348,7 @@ discard block |
||
| 5433 | 5348 | { |
| 5434 | 5349 | parent::insertAt($index,$item); |
| 5435 | 5350 | $this->_o->addedControl($item); |
| 5436 | - } |
|
| 5437 | - else if(is_string($item) || ($item instanceof IRenderable)) |
|
| 5351 | + } else if(is_string($item) || ($item instanceof IRenderable)) |
|
| 5438 | 5352 | parent::insertAt($index,$item); |
| 5439 | 5353 | else |
| 5440 | 5354 | throw new TInvalidDataTypeException('controlcollection_control_required'); |
@@ -5594,8 +5508,7 @@ discard block |
||
| 5594 | 5508 | else if($item[0]===self::TYPE_DATABINDING) |
| 5595 | 5509 | $this->_bindings[$id]=$item[1]; |
| 5596 | 5510 | $this->_items[$id]=''; |
| 5597 | - } |
|
| 5598 | - else |
|
| 5511 | + } else |
|
| 5599 | 5512 | $this->_items[$id]=$item; |
| 5600 | 5513 | } |
| 5601 | 5514 | } |
@@ -6743,8 +6656,7 @@ discard block |
||
| 6743 | 6656 | if(!isset(self::$_template[$class])) |
| 6744 | 6657 | self::$_template[$class]=$this->loadTemplate(); |
| 6745 | 6658 | return self::$_template[$class]; |
| 6746 | - } |
|
| 6747 | - else |
|
| 6659 | + } else |
|
| 6748 | 6660 | return $this->_localTemplate; |
| 6749 | 6661 | } |
| 6750 | 6662 | public function setTemplate($value) |
@@ -6818,8 +6730,7 @@ discard block |
||
| 6818 | 6730 | $controls=$placeholder->getParent()->getControls(); |
| 6819 | 6731 | $loc=$controls->remove($placeholder); |
| 6820 | 6732 | $controls->insertAt($loc,$content); |
| 6821 | - } |
|
| 6822 | - else |
|
| 6733 | + } else |
|
| 6823 | 6734 | throw new TConfigurationException('templatecontrol_placeholder_inexistent',$id); |
| 6824 | 6735 | } |
| 6825 | 6736 | protected function initRecursive($namingContainer=null) |
@@ -6836,8 +6747,7 @@ discard block |
||
| 6836 | 6747 | $master->ensureChildControls(); |
| 6837 | 6748 | foreach($this->_contents as $id=>$content) |
| 6838 | 6749 | $master->injectContent($id,$content); |
| 6839 | - } |
|
| 6840 | - else if(!empty($this->_contents)) |
|
| 6750 | + } else if(!empty($this->_contents)) |
|
| 6841 | 6751 | throw new TConfigurationException('templatecontrol_mastercontrol_required',get_class($this)); |
| 6842 | 6752 | parent::initRecursive($namingContainer); |
| 6843 | 6753 | } |
@@ -6857,8 +6767,7 @@ discard block |
||
| 6857 | 6767 | $control->Checked = (boolean) $arObj->{$key}; |
| 6858 | 6768 | elseif ($control instanceof TDatePicker) |
| 6859 | 6769 | $control->Date = $arObj->{$key}; |
| 6860 | - } |
|
| 6861 | - else |
|
| 6770 | + } else |
|
| 6862 | 6771 | { |
| 6863 | 6772 | foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) |
| 6864 | 6773 | { |
@@ -6880,8 +6789,7 @@ discard block |
||
| 6880 | 6789 | } |
| 6881 | 6790 | break; |
| 6882 | 6791 | } |
| 6883 | - } |
|
| 6884 | - catch (Exception $ex) |
|
| 6792 | + } catch (Exception $ex) |
|
| 6885 | 6793 | { |
| 6886 | 6794 | if ($throwExceptions) |
| 6887 | 6795 | throw $ex; |
@@ -6904,8 +6812,7 @@ discard block |
||
| 6904 | 6812 | $arObj->{$key} = $control->Checked; |
| 6905 | 6813 | elseif ($control instanceof TDatePicker) |
| 6906 | 6814 | $arObj->{$key} = $control->Date; |
| 6907 | - } |
|
| 6908 | - catch (Exception $ex) |
|
| 6815 | + } catch (Exception $ex) |
|
| 6909 | 6816 | { |
| 6910 | 6817 | if ($throwExceptions) |
| 6911 | 6818 | throw $ex; |
@@ -6956,8 +6863,7 @@ discard block |
||
| 6956 | 6863 | $page->endFormRender($writer); |
| 6957 | 6864 | $cs->renderScriptFilesEnd($writer); |
| 6958 | 6865 | $cs->renderEndScripts($writer); |
| 6959 | - } |
|
| 6960 | - else |
|
| 6866 | + } else |
|
| 6961 | 6867 | { |
| 6962 | 6868 | $cs->renderHiddenFieldsBegin($writer); |
| 6963 | 6869 | $page->beginFormRender($writer); |
@@ -7120,8 +7026,7 @@ discard block |
||
| 7120 | 7026 | $base = $dir; |
| 7121 | 7027 | } |
| 7122 | 7028 | return array($assets->getPublishedPath($base), $assets->publishFilePath($base)); |
| 7123 | - } |
|
| 7124 | - else |
|
| 7029 | + } else |
|
| 7125 | 7030 | { |
| 7126 | 7031 | return array($assets->getBasePath().str_replace($assets->getBaseUrl(),'',$base), $base); |
| 7127 | 7032 | } |
@@ -7455,8 +7360,7 @@ discard block |
||
| 7455 | 7360 | { |
| 7456 | 7361 | foreach($value as $v) |
| 7457 | 7362 | $str.='<input type="hidden" name="'.$name.'[]" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n"; |
| 7458 | - } |
|
| 7459 | - else |
|
| 7363 | + } else |
|
| 7460 | 7364 | { |
| 7461 | 7365 | $str.='<input type="hidden" name="'.$name.'" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n"; |
| 7462 | 7366 | } |
@@ -7565,8 +7469,7 @@ discard block |
||
| 7565 | 7469 | $this->processCallbackRequest($writer); |
| 7566 | 7470 | else |
| 7567 | 7471 | $this->processPostBackRequest($writer); |
| 7568 | - } |
|
| 7569 | - else |
|
| 7472 | + } else |
|
| 7570 | 7473 | $this->processNormalRequest($writer); |
| 7571 | 7474 | $this->_writer = null; |
| 7572 | 7475 | } |
@@ -7712,8 +7615,7 @@ discard block |
||
| 7712 | 7615 | { |
| 7713 | 7616 | foreach($this->_validators as $validator) |
| 7714 | 7617 | $validator->validate(); |
| 7715 | - } |
|
| 7716 | - else |
|
| 7618 | + } else |
|
| 7717 | 7619 | { |
| 7718 | 7620 | foreach($this->_validators as $validator) |
| 7719 | 7621 | { |
@@ -7734,8 +7636,7 @@ discard block |
||
| 7734 | 7636 | return false; |
| 7735 | 7637 | } |
| 7736 | 7638 | return true; |
| 7737 | - } |
|
| 7738 | - else |
|
| 7639 | + } else |
|
| 7739 | 7640 | throw new TInvalidOperationException('page_isvalid_unknown'); |
| 7740 | 7641 | } |
| 7741 | 7642 | public function getTheme() |
@@ -7920,14 +7821,12 @@ discard block |
||
| 7920 | 7821 | { |
| 7921 | 7822 | if($control->loadPostData($key,$postData)) |
| 7922 | 7823 | $this->_controlsPostDataChanged[]=$control; |
| 7923 | - } |
|
| 7924 | - else if($control instanceof IPostBackEventHandler && |
|
| 7824 | + } else if($control instanceof IPostBackEventHandler && |
|
| 7925 | 7825 | empty($this->_postData[self::FIELD_POSTBACK_TARGET])) |
| 7926 | 7826 | { |
| 7927 | 7827 | $this->_postData->add(self::FIELD_POSTBACK_TARGET,$key); } |
| 7928 | 7828 | unset($this->_controlsRequiringPostData[$key]); |
| 7929 | - } |
|
| 7930 | - else if($beforeLoad) |
|
| 7829 | + } else if($beforeLoad) |
|
| 7931 | 7830 | $this->_restPostData->add($key,$value); |
| 7932 | 7831 | } |
| 7933 | 7832 | foreach($this->_controlsRequiringPostData as $key=>$value) |
@@ -7938,8 +7837,7 @@ discard block |
||
| 7938 | 7837 | { |
| 7939 | 7838 | if($control->loadPostData($key,$this->_postData)) |
| 7940 | 7839 | $this->_controlsPostDataChanged[]=$control; |
| 7941 | - } |
|
| 7942 | - else |
|
| 7840 | + } else |
|
| 7943 | 7841 | throw new TInvalidDataValueException('page_postbackcontrol_invalid',$key); |
| 7944 | 7842 | unset($this->_controlsRequiringPostData[$key]); |
| 7945 | 7843 | } |
@@ -7988,8 +7886,7 @@ discard block |
||
| 7988 | 7886 | else |
| 7989 | 7887 | $focus=$this->_focus; |
| 7990 | 7888 | $this->getClientScript()->registerFocusControl($focus); |
| 7991 | - } |
|
| 7992 | - else if($this->_postData && ($lastFocus=$this->_postData->itemAt(self::FIELD_LASTFOCUS))!==null) |
|
| 7889 | + } else if($this->_postData && ($lastFocus=$this->_postData->itemAt(self::FIELD_LASTFOCUS))!==null) |
|
| 7993 | 7890 | $this->getClientScript()->registerFocusControl($lastFocus); |
| 7994 | 7891 | $this->_inFormRender=false; |
| 7995 | 7892 | } |
@@ -8155,8 +8052,7 @@ discard block |
||
| 8155 | 8052 | { |
| 8156 | 8053 | if(($str=$sm->validateData($str))!==false) |
| 8157 | 8054 | return unserialize($str); |
| 8158 | - } |
|
| 8159 | - else |
|
| 8055 | + } else |
|
| 8160 | 8056 | return unserialize($str); |
| 8161 | 8057 | } |
| 8162 | 8058 | return null; |
@@ -8197,8 +8093,7 @@ discard block |
||
| 8197 | 8093 | $this->_cache=$this->getApplication()->getModule($this->_cacheModuleID); |
| 8198 | 8094 | if(!($this->_cache instanceof ICache)) |
| 8199 | 8095 | throw new TConfigurationException('outputcache_cachemoduleid_invalid',$this->_cacheModuleID); |
| 8200 | - } |
|
| 8201 | - else |
|
| 8096 | + } else |
|
| 8202 | 8097 | $this->_cache=$this->getApplication()->getCache(); |
| 8203 | 8098 | if($this->_cache!==null) |
| 8204 | 8099 | { |
@@ -8210,8 +8105,7 @@ discard block |
||
| 8210 | 8105 | $param->setCacheTime(isset($data[3])?$data[3]:0); |
| 8211 | 8106 | $this->onCheckDependency($param); |
| 8212 | 8107 | $this->_dataCached=$param->getIsValid(); |
| 8213 | - } |
|
| 8214 | - else |
|
| 8108 | + } else |
|
| 8215 | 8109 | $this->_dataCached=false; |
| 8216 | 8110 | if($this->_dataCached) |
| 8217 | 8111 | list($this->_contents,$this->_state,$this->_actions,$this->_cacheTime)=$data; |
@@ -8227,8 +8121,7 @@ discard block |
||
| 8227 | 8121 | $stack->push($this); |
| 8228 | 8122 | parent::initRecursive($namingContainer); |
| 8229 | 8123 | $stack->pop(); |
| 8230 | - } |
|
| 8231 | - else |
|
| 8124 | + } else |
|
| 8232 | 8125 | parent::initRecursive($namingContainer); |
| 8233 | 8126 | } |
| 8234 | 8127 | protected function loadRecursive() |
@@ -8239,8 +8132,7 @@ discard block |
||
| 8239 | 8132 | $stack->push($this); |
| 8240 | 8133 | parent::loadRecursive(); |
| 8241 | 8134 | $stack->pop(); |
| 8242 | - } |
|
| 8243 | - else |
|
| 8135 | + } else |
|
| 8244 | 8136 | { |
| 8245 | 8137 | if($this->_dataCached) |
| 8246 | 8138 | $this->performActions(); |
@@ -8269,8 +8161,7 @@ discard block |
||
| 8269 | 8161 | $stack->push($this); |
| 8270 | 8162 | parent::preRenderRecursive(); |
| 8271 | 8163 | $stack->pop(); |
| 8272 | - } |
|
| 8273 | - else |
|
| 8164 | + } else |
|
| 8274 | 8165 | parent::preRenderRecursive(); |
| 8275 | 8166 | } |
| 8276 | 8167 | protected function loadStateRecursive(&$state,$needViewState=true) |
@@ -8406,8 +8297,7 @@ discard block |
||
| 8406 | 8297 | $content=$textwriter->flush(); |
| 8407 | 8298 | $data=array($content,$this->_state,$this->_actions,time()); |
| 8408 | 8299 | $this->_cache->set($this->getCacheKey(),$data,$this->getDuration(),$this->getCacheDependency()); |
| 8409 | - } |
|
| 8410 | - else |
|
| 8300 | + } else |
|
| 8411 | 8301 | parent::render($writer); |
| 8412 | 8302 | } |
| 8413 | 8303 | } |
@@ -8512,8 +8402,7 @@ discard block |
||
| 8512 | 8402 | $cache->set(self::TEMPLATE_CACHE_PREFIX.$fileName,array($template,$timestamps)); |
| 8513 | 8403 | return $template; |
| 8514 | 8404 | } |
| 8515 | - } |
|
| 8516 | - else |
|
| 8405 | + } else |
|
| 8517 | 8406 | return null; |
| 8518 | 8407 | } |
| 8519 | 8408 | protected function getLocalizedTemplate($filename) |
@@ -8633,8 +8522,7 @@ discard block |
||
| 8633 | 8522 | $component->createdOnTemplate($parent); |
| 8634 | 8523 | if($component->getAllowChildControls()) |
| 8635 | 8524 | $controls[$key]=$component; |
| 8636 | - } |
|
| 8637 | - else if($component instanceof TComponent) |
|
| 8525 | + } else if($component instanceof TComponent) |
|
| 8638 | 8526 | { |
| 8639 | 8527 | $controls[$key]=$component; |
| 8640 | 8528 | if(isset($properties['id'])) |
@@ -8652,8 +8540,7 @@ discard block |
||
| 8652 | 8540 | else |
| 8653 | 8541 | $component->createdOnTemplate($parent); |
| 8654 | 8542 | } |
| 8655 | - } |
|
| 8656 | - else |
|
| 8543 | + } else |
|
| 8657 | 8544 | { |
| 8658 | 8545 | if($object[1] instanceof TCompositeLiteral) |
| 8659 | 8546 | { |
@@ -8663,8 +8550,7 @@ discard block |
||
| 8663 | 8550 | $directChildren[]=$o; |
| 8664 | 8551 | else |
| 8665 | 8552 | $parent->addParsedObject($o); |
| 8666 | - } |
|
| 8667 | - else |
|
| 8553 | + } else |
|
| 8668 | 8554 | { |
| 8669 | 8555 | if($parent===$parentControl) |
| 8670 | 8556 | $directChildren[]=$object[1]; |
@@ -8735,8 +8621,7 @@ discard block |
||
| 8735 | 8621 | default: throw new TConfigurationException('template_tag_unexpected',$name,$value[1]); |
| 8736 | 8622 | break; |
| 8737 | 8623 | } |
| 8738 | - } |
|
| 8739 | - else |
|
| 8624 | + } else |
|
| 8740 | 8625 | { |
| 8741 | 8626 | if (substr($name,0,2)=='js') |
| 8742 | 8627 | if ($value and !($value instanceof TJavaScriptLiteral)) |
@@ -8772,8 +8657,7 @@ discard block |
||
| 8772 | 8657 | default: throw new TConfigurationException('template_tag_unexpected',$name,$value[1]); |
| 8773 | 8658 | break; |
| 8774 | 8659 | } |
| 8775 | - } |
|
| 8776 | - else |
|
| 8660 | + } else |
|
| 8777 | 8661 | $component->setSubProperty($name,$value); |
| 8778 | 8662 | } |
| 8779 | 8663 | protected function parse($input) |
@@ -8810,8 +8694,7 @@ discard block |
||
| 8810 | 8694 | $stack[] = $type; |
| 8811 | 8695 | $container=$c-1; |
| 8812 | 8696 | } |
| 8813 | - } |
|
| 8814 | - else if(strpos($str,'</com:')===0) { |
|
| 8697 | + } else if(strpos($str,'</com:')===0) { |
|
| 8815 | 8698 | if($expectPropEnd) |
| 8816 | 8699 | continue; |
| 8817 | 8700 | if($matchStart>$textStart) |
@@ -8827,8 +8710,7 @@ discard block |
||
| 8827 | 8710 | throw new TConfigurationException('template_closingtag_expected',$tag); |
| 8828 | 8711 | } |
| 8829 | 8712 | $container=$tpl[$container][0]; |
| 8830 | - } |
|
| 8831 | - else if(strpos($str,'<%@')===0) { |
|
| 8713 | + } else if(strpos($str,'<%@')===0) { |
|
| 8832 | 8714 | if($expectPropEnd) |
| 8833 | 8715 | continue; |
| 8834 | 8716 | if($matchStart>$textStart) |
@@ -8837,8 +8719,7 @@ discard block |
||
| 8837 | 8719 | if(isset($tpl[0]) || $this->_directive!==null) |
| 8838 | 8720 | throw new TConfigurationException('template_directive_nonunique'); |
| 8839 | 8721 | $this->_directive=$this->parseAttributes($match[4][0],$match[4][1]); |
| 8840 | - } |
|
| 8841 | - else if(strpos($str,'<%')===0) { |
|
| 8722 | + } else if(strpos($str,'<%')===0) { |
|
| 8842 | 8723 | if($expectPropEnd) |
| 8843 | 8724 | continue; |
| 8844 | 8725 | if($matchStart>$textStart) |
@@ -8860,8 +8741,7 @@ discard block |
||
| 8860 | 8741 | $literal=strtr(trim(substr($literal,0,strlen($literal)-1)),array("'"=>"\'","\\"=>"\\\\")); |
| 8861 | 8742 | $tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"Prado::localize('$literal')")); |
| 8862 | 8743 | } |
| 8863 | - } |
|
| 8864 | - else if(strpos($str,'<prop:')===0) { |
|
| 8744 | + } else if(strpos($str,'<prop:')===0) { |
|
| 8865 | 8745 | if(strrpos($str,'/>')===strlen($str)-2) { |
| 8866 | 8746 | if($expectPropEnd) |
| 8867 | 8747 | continue; |
@@ -8881,8 +8761,7 @@ discard block |
||
| 8881 | 8761 | throw new TConfigurationException('template_property_duplicated',$name); |
| 8882 | 8762 | $tpl[$container][2][$name]=$value; |
| 8883 | 8763 | } |
| 8884 | - } |
|
| 8885 | - else { |
|
| 8764 | + } else { |
|
| 8886 | 8765 | $prop=strtolower($match[3][0]); |
| 8887 | 8766 | $stack[] = '@'.$prop; |
| 8888 | 8767 | if(!$expectPropEnd) |
@@ -8893,8 +8772,7 @@ discard block |
||
| 8893 | 8772 | $expectPropEnd=true; |
| 8894 | 8773 | } |
| 8895 | 8774 | } |
| 8896 | - } |
|
| 8897 | - else if(strpos($str,'</prop:')===0) { |
|
| 8775 | + } else if(strpos($str,'</prop:')===0) { |
|
| 8898 | 8776 | $prop=strtolower($match[3][0]); |
| 8899 | 8777 | if(empty($stack)) |
| 8900 | 8778 | throw new TConfigurationException('template_closingtag_unexpected',"</prop:$prop>"); |
@@ -8920,21 +8798,18 @@ discard block |
||
| 8920 | 8798 | if(isset($tpl[$container][2][$prop])) |
| 8921 | 8799 | throw new TConfigurationException('template_property_duplicated',$prop); |
| 8922 | 8800 | $tpl[$container][2][$prop]=$value; |
| 8923 | - } |
|
| 8924 | - else $this->_directive[$prop]=$value; |
|
| 8801 | + } else $this->_directive[$prop]=$value; |
|
| 8925 | 8802 | $textStart=$matchEnd+1; |
| 8926 | 8803 | } |
| 8927 | 8804 | $expectPropEnd=false; |
| 8928 | 8805 | } |
| 8929 | - } |
|
| 8930 | - else if(strpos($str,'<!--')===0) { |
|
| 8806 | + } else if(strpos($str,'<!--')===0) { |
|
| 8931 | 8807 | if($expectPropEnd) |
| 8932 | 8808 | throw new TConfigurationException('template_comments_forbidden'); |
| 8933 | 8809 | if($matchStart>$textStart) |
| 8934 | 8810 | $tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart)); |
| 8935 | 8811 | $textStart=$matchEnd+1; |
| 8936 | - } |
|
| 8937 | - else |
|
| 8812 | + } else |
|
| 8938 | 8813 | throw new TConfigurationException('template_matching_unexpected',$match); |
| 8939 | 8814 | } |
| 8940 | 8815 | if(!empty($stack)) |
@@ -8945,8 +8820,7 @@ discard block |
||
| 8945 | 8820 | } |
| 8946 | 8821 | if($textStart<strlen($input)) |
| 8947 | 8822 | $tpl[$c++]=array($container,substr($input,$textStart)); |
| 8948 | - } |
|
| 8949 | - catch(Exception $e) |
|
| 8823 | + } catch(Exception $e) |
|
| 8950 | 8824 | { |
| 8951 | 8825 | if(($e instanceof TException) && ($e instanceof TTemplateException)) |
| 8952 | 8826 | throw $e; |
@@ -8976,14 +8850,12 @@ discard block |
||
| 8976 | 8850 | { |
| 8977 | 8851 | $parent=null; |
| 8978 | 8852 | $objects[$id]=$object; |
| 8979 | - } |
|
| 8980 | - else |
|
| 8853 | + } else |
|
| 8981 | 8854 | { |
| 8982 | 8855 | $parent=$object[0]; |
| 8983 | 8856 | $merged=array($parent,array($object[1])); |
| 8984 | 8857 | } |
| 8985 | - } |
|
| 8986 | - else |
|
| 8858 | + } else |
|
| 8987 | 8859 | $merged[1][]=$object[1]; |
| 8988 | 8860 | } |
| 8989 | 8861 | if($parent!==null) |
@@ -9016,8 +8888,7 @@ discard block |
||
| 9016 | 8888 | $attributes[$name]=$this->parseTemplateProperty(substr($value,1,strlen($value)-2),$match[2][1]+1); |
| 9017 | 8889 | else |
| 9018 | 8890 | $attributes[$name]=$this->parseTemplateProperty($value,$match[2][1]); |
| 9019 | - } |
|
| 9020 | - else |
|
| 8891 | + } else |
|
| 9021 | 8892 | { |
| 9022 | 8893 | if($value[0]==='\'' || $value[0]==='"') |
| 9023 | 8894 | $attributes[$name]=$this->parseAttribute(substr($value,1,strlen($value)-2)); |
@@ -9059,8 +8930,7 @@ discard block |
||
| 9059 | 8930 | return array(self::CONFIG_DATABIND,ltrim($expr,'.')); |
| 9060 | 8931 | else |
| 9061 | 8932 | return array(self::CONFIG_EXPRESSION,ltrim($expr,'.')); |
| 9062 | - } |
|
| 9063 | - else if(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS',$value,$matches) && $matches[0]===$value) |
|
| 8933 | + } else if(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS',$value,$matches) && $matches[0]===$value) |
|
| 9064 | 8934 | { |
| 9065 | 8935 | $value=$matches[1]; |
| 9066 | 8936 | if($value[2]==='~') |
@@ -9073,8 +8943,7 @@ discard block |
||
| 9073 | 8943 | $literal = trim(substr($value,3,strlen($value)-5)); |
| 9074 | 8944 | return array(self::CONFIG_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '/').'/$literal'"); |
| 9075 | 8945 | } |
| 9076 | - } |
|
| 9077 | - else |
|
| 8946 | + } else |
|
| 9078 | 8947 | return $value; |
| 9079 | 8948 | } |
| 9080 | 8949 | protected function validateAttributes($type,$attributes) |
@@ -9094,15 +8963,13 @@ discard block |
||
| 9094 | 8963 | $subname=substr($name,0,$pos); |
| 9095 | 8964 | if(!$class->hasMethod('get'.$subname)) |
| 9096 | 8965 | throw new TConfigurationException('template_property_unknown',$type,$subname); |
| 9097 | - } |
|
| 9098 | - else if(strncasecmp($name,'on',2)===0) |
|
| 8966 | + } else if(strncasecmp($name,'on',2)===0) |
|
| 9099 | 8967 | { |
| 9100 | 8968 | if(!$class->hasMethod($name)) |
| 9101 | 8969 | throw new TConfigurationException('template_event_unknown',$type,$name); |
| 9102 | 8970 | else if(!is_string($att)) |
| 9103 | 8971 | throw new TConfigurationException('template_eventhandler_invalid',$type,$name); |
| 9104 | - } |
|
| 9105 | - else |
|
| 8972 | + } else |
|
| 9106 | 8973 | { |
| 9107 | 8974 | if (! ($class->hasMethod('set'.$name) || $class->hasMethod('setjs'.$name) || $this->isClassBehaviorMethod($class,'set'.$name)) ) |
| 9108 | 8975 | { |
@@ -9110,8 +8977,7 @@ discard block |
||
| 9110 | 8977 | throw new TConfigurationException('template_property_readonly',$type,$name); |
| 9111 | 8978 | else |
| 9112 | 8979 | throw new TConfigurationException('template_property_unknown',$type,$name); |
| 9113 | - } |
|
| 9114 | - else if(is_array($att) && $att[0]!==self::CONFIG_EXPRESSION) |
|
| 8980 | + } else if(is_array($att) && $att[0]!==self::CONFIG_EXPRESSION) |
|
| 9115 | 8981 | { |
| 9116 | 8982 | if(strcasecmp($name,'id')===0) |
| 9117 | 8983 | throw new TConfigurationException('template_controlid_invalid',$type); |
@@ -9120,8 +8986,7 @@ discard block |
||
| 9120 | 8986 | } |
| 9121 | 8987 | } |
| 9122 | 8988 | } |
| 9123 | - } |
|
| 9124 | - else if(is_subclass_of($className,'TComponent') || $className==='TComponent') |
|
| 8989 | + } else if(is_subclass_of($className,'TComponent') || $className==='TComponent') |
|
| 9125 | 8990 | { |
| 9126 | 8991 | foreach($attributes as $name=>$att) |
| 9127 | 8992 | { |
@@ -9132,8 +8997,7 @@ discard block |
||
| 9132 | 8997 | $subname=substr($name,0,$pos); |
| 9133 | 8998 | if(!$class->hasMethod('get'.$subname)) |
| 9134 | 8999 | throw new TConfigurationException('template_property_unknown',$type,$subname); |
| 9135 | - } |
|
| 9136 | - else if(strncasecmp($name,'on',2)===0) |
|
| 9000 | + } else if(strncasecmp($name,'on',2)===0) |
|
| 9137 | 9001 | throw new TConfigurationException('template_event_forbidden',$type,$name); |
| 9138 | 9002 | else |
| 9139 | 9003 | { |
@@ -9146,8 +9010,7 @@ discard block |
||
| 9146 | 9010 | } |
| 9147 | 9011 | } |
| 9148 | 9012 | } |
| 9149 | - } |
|
| 9150 | - else |
|
| 9013 | + } else |
|
| 9151 | 9014 | throw new TConfigurationException('template_component_required',$type); |
| 9152 | 9015 | } |
| 9153 | 9016 | public function getIncludedFiles() |
@@ -9167,8 +9030,7 @@ discard block |
||
| 9167 | 9030 | $line=$line-$this->_includeAtLine[$i]+1; |
| 9168 | 9031 | $srcFile=$this->_includedFiles[$i]; |
| 9169 | 9032 | break; |
| 9170 | - } |
|
| 9171 | - else |
|
| 9033 | + } else |
|
| 9172 | 9034 | $line=$line-$this->_includeLines[$i]+1; |
| 9173 | 9035 | } |
| 9174 | 9036 | } |
@@ -9354,8 +9216,7 @@ discard block |
||
| 9354 | 9216 | closedir($dir); |
| 9355 | 9217 | if($cacheValid) |
| 9356 | 9218 | $this->_skins=$skins; |
| 9357 | - } |
|
| 9358 | - else |
|
| 9219 | + } else |
|
| 9359 | 9220 | { |
| 9360 | 9221 | $cacheValid=true; |
| 9361 | 9222 | $this->_cssFiles=$cssFiles; |
@@ -9480,19 +9341,15 @@ discard block |
||
| 9480 | 9341 | { |
| 9481 | 9342 | $setter='set'.$name; |
| 9482 | 9343 | $control->$setter($value); |
| 9483 | - } |
|
| 9484 | - else |
|
| 9344 | + } else |
|
| 9485 | 9345 | throw new TConfigurationException('theme_property_readonly',$type,$name); |
| 9486 | - } |
|
| 9487 | - else |
|
| 9346 | + } else |
|
| 9488 | 9347 | throw new TConfigurationException('theme_property_undefined',$type,$name); |
| 9489 | - } |
|
| 9490 | - else $control->setSubProperty($name,$value); |
|
| 9348 | + } else $control->setSubProperty($name,$value); |
|
| 9491 | 9349 | } |
| 9492 | 9350 | } |
| 9493 | 9351 | return true; |
| 9494 | - } |
|
| 9495 | - else |
|
| 9352 | + } else |
|
| 9496 | 9353 | return false; |
| 9497 | 9354 | } |
| 9498 | 9355 | public function getStyleSheetFiles() |
@@ -9585,8 +9442,7 @@ discard block |
||
| 9585 | 9442 | $pageConfig->loadPageConfigurationFromXml($config,$application->getBasePath(),''); |
| 9586 | 9443 | } |
| 9587 | 9444 | $pageConfig->loadFromFiles($this->getBasePath()); |
| 9588 | - } |
|
| 9589 | - else |
|
| 9445 | + } else |
|
| 9590 | 9446 | { |
| 9591 | 9447 | $configCached=true; |
| 9592 | 9448 | $currentTimestamp=array(); |
@@ -9603,8 +9459,7 @@ discard block |
||
| 9603 | 9459 | $currentTimestamp[0]=$appConfigFile===null?0:@filemtime($appConfigFile); |
| 9604 | 9460 | if($currentTimestamp[0]>$timestamp || ($timestamp>0 && !$currentTimestamp[0])) |
| 9605 | 9461 | $configCached=false; |
| 9606 | - } |
|
| 9607 | - else |
|
| 9462 | + } else |
|
| 9608 | 9463 | { |
| 9609 | 9464 | $currentTimestamp[$fileName]=@filemtime($fileName); |
| 9610 | 9465 | if($currentTimestamp[$fileName]>$timestamp || ($timestamp>0 && !$currentTimestamp[$fileName])) |
@@ -9612,8 +9467,7 @@ discard block |
||
| 9612 | 9467 | } |
| 9613 | 9468 | } |
| 9614 | 9469 | } |
| 9615 | - } |
|
| 9616 | - else |
|
| 9470 | + } else |
|
| 9617 | 9471 | { |
| 9618 | 9472 | $configCached=false; |
| 9619 | 9473 | $paths=explode('.',$pagePath); |
@@ -9756,8 +9610,7 @@ discard block |
||
| 9756 | 9610 | $className=basename($path); |
| 9757 | 9611 | if(!class_exists($className,false)) |
| 9758 | 9612 | include_once($path.Prado::CLASS_FILE_EXT); |
| 9759 | - } |
|
| 9760 | - else |
|
| 9613 | + } else |
|
| 9761 | 9614 | { |
| 9762 | 9615 | $className=$this->getBasePageClass(); |
| 9763 | 9616 | Prado::using($className); |
@@ -9839,8 +9692,7 @@ discard block |
||
| 9839 | 9692 | { |
| 9840 | 9693 | $fcontent = include $fname; |
| 9841 | 9694 | $this->loadFromPhp($fcontent,dirname($fname),$configPagePath); |
| 9842 | - } |
|
| 9843 | - else |
|
| 9695 | + } else |
|
| 9844 | 9696 | { |
| 9845 | 9697 | $dom=new TXmlDocument; |
| 9846 | 9698 | if($dom->loadFromFile($fname)) |
@@ -10083,8 +9935,7 @@ discard block |
||
| 10083 | 9935 | if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
| 10084 | 9936 | $this->copyFile($fullpath,$dst); |
| 10085 | 9937 | return $this->_published[$path]=$this->_baseUrl.'/'.$dir.'/'.$fileName; |
| 10086 | - } |
|
| 10087 | - else |
|
| 9938 | + } else |
|
| 10088 | 9939 | { |
| 10089 | 9940 | $dir=$this->hash($fullpath); |
| 10090 | 9941 | if(!is_dir($this->_basePath.DIRECTORY_SEPARATOR.$dir) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
@@ -10155,8 +10006,7 @@ discard block |
||
| 10155 | 10006 | @copy($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file); |
| 10156 | 10007 | @chmod($dst.DIRECTORY_SEPARATOR.$file, PRADO_CHMOD); |
| 10157 | 10008 | } |
| 10158 | - } |
|
| 10159 | - else |
|
| 10009 | + } else |
|
| 10160 | 10010 | $this->copyDirectory($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file); |
| 10161 | 10011 | } |
| 10162 | 10012 | closedir($folder); |
@@ -10285,8 +10135,7 @@ discard block |
||
| 10285 | 10135 | throw new TConfigurationException('globalization_source_path_failed', |
| 10286 | 10136 | $config['source']); |
| 10287 | 10137 | chmod($config['source'], PRADO_CHMOD); } |
| 10288 | - } |
|
| 10289 | - else |
|
| 10138 | + } else |
|
| 10290 | 10139 | { |
| 10291 | 10140 | throw new TConfigurationException("invalid source dir '{$config['source']}'"); |
| 10292 | 10141 | } |
@@ -10300,8 +10149,7 @@ discard block |
||
| 10300 | 10149 | throw new TConfigurationException('globalization_cache_path_failed', |
| 10301 | 10150 | $config['cache']); |
| 10302 | 10151 | chmod($config['cache'], PRADO_CHMOD); } |
| 10303 | - } |
|
| 10304 | - else |
|
| 10152 | + } else |
|
| 10305 | 10153 | { |
| 10306 | 10154 | unset($config['cache']); |
| 10307 | 10155 | } |
@@ -10421,8 +10269,7 @@ discard block |
||
| 10421 | 10269 | { |
| 10422 | 10270 | $configFile=$basePath; |
| 10423 | 10271 | $basePath=dirname($configFile); |
| 10424 | - } |
|
| 10425 | - else |
|
| 10272 | + } else |
|
| 10426 | 10273 | $configFile=null; |
| 10427 | 10274 | $runtimePath=$basePath.DIRECTORY_SEPARATOR.self::RUNTIME_PATH; |
| 10428 | 10275 | if(is_writable($runtimePath)) |
@@ -10439,8 +10286,7 @@ discard block |
||
| 10439 | 10286 | } |
| 10440 | 10287 | $this->setBasePath($basePath); |
| 10441 | 10288 | $this->setRuntimePath($runtimePath); |
| 10442 | - } |
|
| 10443 | - else |
|
| 10289 | + } else |
|
| 10444 | 10290 | throw new TConfigurationException('application_runtimepath_invalid',$runtimePath); |
| 10445 | 10291 | } |
| 10446 | 10292 | public function run() |
@@ -10461,8 +10307,7 @@ discard block |
||
| 10461 | 10307 | $this->$method(); |
| 10462 | 10308 | $this->_step++; |
| 10463 | 10309 | } |
| 10464 | - } |
|
| 10465 | - catch(Exception $e) |
|
| 10310 | + } catch(Exception $e) |
|
| 10466 | 10311 | { |
| 10467 | 10312 | $this->onError($e); |
| 10468 | 10313 | } |
@@ -10806,8 +10651,7 @@ discard block |
||
| 10806 | 10651 | foreach($parameter[1] as $name=>$value) |
| 10807 | 10652 | $component->setSubProperty($name,$value); |
| 10808 | 10653 | $this->_parameters->add($id,$component); |
| 10809 | - } |
|
| 10810 | - else |
|
| 10654 | + } else |
|
| 10811 | 10655 | $this->_parameters->add($id,$parameter); |
| 10812 | 10656 | } |
| 10813 | 10657 | $modules=array(); |
@@ -10848,8 +10692,7 @@ discard block |
||
| 10848 | 10692 | $config->loadFromFile($this->_configFile); |
| 10849 | 10693 | if($this->_cacheFile!==null) |
| 10850 | 10694 | file_put_contents($this->_cacheFile,serialize($config),LOCK_EX); |
| 10851 | - } |
|
| 10852 | - else |
|
| 10695 | + } else |
|
| 10853 | 10696 | $config=unserialize(file_get_contents($this->_cacheFile)); |
| 10854 | 10697 | $this->applyConfiguration($config,false); |
| 10855 | 10698 | } |
@@ -10881,8 +10724,7 @@ discard block |
||
| 10881 | 10724 | $this->applyConfiguration($config,true); |
| 10882 | 10725 | } |
| 10883 | 10726 | $service->init($configElement); |
| 10884 | - } |
|
| 10885 | - else |
|
| 10727 | + } else |
|
| 10886 | 10728 | throw new THttpException(500,'application_service_unknown',$serviceID); |
| 10887 | 10729 | } |
| 10888 | 10730 | public function onError($param) |
@@ -10974,8 +10816,7 @@ discard block |
||
| 10974 | 10816 | { |
| 10975 | 10817 | $fcontent = include $fname; |
| 10976 | 10818 | $this->loadFromPhp($fcontent,dirname($fname)); |
| 10977 | - } |
|
| 10978 | - else |
|
| 10819 | + } else |
|
| 10979 | 10820 | { |
| 10980 | 10821 | $dom=new TXmlDocument; |
| 10981 | 10822 | $dom->loadFromFile($fname); |
@@ -11082,8 +10923,7 @@ discard block |
||
| 11082 | 10923 | if(isset($this->_aliases[$id])) |
| 11083 | 10924 | throw new TConfigurationException('appconfig_alias_redefined',$id); |
| 11084 | 10925 | $this->_aliases[$id]=$p; |
| 11085 | - } |
|
| 11086 | - else |
|
| 10926 | + } else |
|
| 11087 | 10927 | throw new TConfigurationException('appconfig_alias_invalid'); |
| 11088 | 10928 | $this->_empty=false; |
| 11089 | 10929 | break; |
@@ -11138,8 +10978,7 @@ discard block |
||
| 11138 | 10978 | else |
| 11139 | 10979 | $this->_modules[$id]=array($type,$properties->toArray(),$element); |
| 11140 | 10980 | $this->_empty=false; |
| 11141 | - } |
|
| 11142 | - else |
|
| 10981 | + } else |
|
| 11143 | 10982 | throw new TConfigurationException('appconfig_modules_invalid',$element->getTagName()); |
| 11144 | 10983 | } |
| 11145 | 10984 | } |
@@ -11171,8 +11010,7 @@ discard block |
||
| 11171 | 11010 | $element->setParent(null); |
| 11172 | 11011 | $this->_services[$id]=array($type,$properties->toArray(),$element); |
| 11173 | 11012 | $this->_empty=false; |
| 11174 | - } |
|
| 11175 | - else |
|
| 11013 | + } else |
|
| 11176 | 11014 | throw new TConfigurationException('appconfig_services_invalid',$element->getTagName()); |
| 11177 | 11015 | } |
| 11178 | 11016 | } |
@@ -11190,8 +11028,7 @@ discard block |
||
| 11190 | 11028 | $properties['id'] = $id; |
| 11191 | 11029 | $this->_parameters[$id] = array($type,$properties); |
| 11192 | 11030 | } |
| 11193 | - } |
|
| 11194 | - else |
|
| 11031 | + } else |
|
| 11195 | 11032 | { |
| 11196 | 11033 | $this->_parameters[$id] = $parameter; |
| 11197 | 11034 | } |
@@ -11212,12 +11049,10 @@ discard block |
||
| 11212 | 11049 | $this->_parameters[$id]=$element; |
| 11213 | 11050 | else |
| 11214 | 11051 | $this->_parameters[$id]=$value; |
| 11215 | - } |
|
| 11216 | - else |
|
| 11052 | + } else |
|
| 11217 | 11053 | $this->_parameters[$id]=array($type,$properties->toArray()); |
| 11218 | 11054 | $this->_empty=false; |
| 11219 | - } |
|
| 11220 | - else |
|
| 11055 | + } else |
|
| 11221 | 11056 | throw new TConfigurationException('appconfig_parameters_invalid',$element->getTagName()); |
| 11222 | 11057 | } |
| 11223 | 11058 | } |