@@ -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 | } |
@@ -107,8 +107,7 @@ discard block |
||
107 | 107 | $cache->set(self::TEMPLATE_CACHE_PREFIX.$fileName,array($template,$timestamps)); |
108 | 108 | return $template; |
109 | 109 | } |
110 | - } |
|
111 | - else |
|
110 | + } else |
|
112 | 111 | return null; |
113 | 112 | } |
114 | 113 | |
@@ -357,8 +356,7 @@ discard block |
||
357 | 356 | $component->createdOnTemplate($parent); |
358 | 357 | if($component->getAllowChildControls()) |
359 | 358 | $controls[$key]=$component; |
360 | - } |
|
361 | - else if($component instanceof TComponent) |
|
359 | + } else if($component instanceof TComponent) |
|
362 | 360 | { |
363 | 361 | $controls[$key]=$component; |
364 | 362 | if(isset($properties['id'])) |
@@ -376,8 +374,7 @@ discard block |
||
376 | 374 | else |
377 | 375 | $component->createdOnTemplate($parent); |
378 | 376 | } |
379 | - } |
|
380 | - else |
|
377 | + } else |
|
381 | 378 | { |
382 | 379 | if($object[1] instanceof TCompositeLiteral) |
383 | 380 | { |
@@ -388,8 +385,7 @@ discard block |
||
388 | 385 | $directChildren[]=$o; |
389 | 386 | else |
390 | 387 | $parent->addParsedObject($o); |
391 | - } |
|
392 | - else |
|
388 | + } else |
|
393 | 389 | { |
394 | 390 | if($parent===$parentControl) |
395 | 391 | $directChildren[]=$object[1]; |
@@ -500,8 +496,7 @@ discard block |
||
500 | 496 | throw new TConfigurationException('template_tag_unexpected',$name,$value[1]); |
501 | 497 | break; |
502 | 498 | } |
503 | - } |
|
504 | - else |
|
499 | + } else |
|
505 | 500 | { |
506 | 501 | if (substr($name,0,2)=='js') |
507 | 502 | if ($value and !($value instanceof TJavaScriptLiteral)) |
@@ -549,8 +544,7 @@ discard block |
||
549 | 544 | throw new TConfigurationException('template_tag_unexpected',$name,$value[1]); |
550 | 545 | break; |
551 | 546 | } |
552 | - } |
|
553 | - else |
|
547 | + } else |
|
554 | 548 | $component->setSubProperty($name,$value); |
555 | 549 | } |
556 | 550 | |
@@ -611,8 +605,7 @@ discard block |
||
611 | 605 | $stack[] = $type; |
612 | 606 | $container=$c-1; |
613 | 607 | } |
614 | - } |
|
615 | - else if(strpos($str,'</com:')===0) // closing component tag |
|
608 | + } else if(strpos($str,'</com:')===0) // closing component tag |
|
616 | 609 | { |
617 | 610 | if($expectPropEnd) |
618 | 611 | continue; |
@@ -631,8 +624,7 @@ discard block |
||
631 | 624 | throw new TConfigurationException('template_closingtag_expected',$tag); |
632 | 625 | } |
633 | 626 | $container=$tpl[$container][0]; |
634 | - } |
|
635 | - else if(strpos($str,'<%@')===0) // directive |
|
627 | + } else if(strpos($str,'<%@')===0) // directive |
|
636 | 628 | { |
637 | 629 | if($expectPropEnd) |
638 | 630 | continue; |
@@ -642,8 +634,7 @@ discard block |
||
642 | 634 | if(isset($tpl[0]) || $this->_directive!==null) |
643 | 635 | throw new TConfigurationException('template_directive_nonunique'); |
644 | 636 | $this->_directive=$this->parseAttributes($match[4][0],$match[4][1]); |
645 | - } |
|
646 | - else if(strpos($str,'<%')===0) // expression |
|
637 | + } else if(strpos($str,'<%')===0) // expression |
|
647 | 638 | { |
648 | 639 | if($expectPropEnd) |
649 | 640 | continue; |
@@ -668,8 +659,7 @@ discard block |
||
668 | 659 | $literal=strtr(trim(substr($literal,0,strlen($literal)-1)),array("'"=>"\'","\\"=>"\\\\")); |
669 | 660 | $tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"Prado::localize('$literal')")); |
670 | 661 | } |
671 | - } |
|
672 | - else if(strpos($str,'<prop:')===0) // opening property |
|
662 | + } else if(strpos($str,'<prop:')===0) // opening property |
|
673 | 663 | { |
674 | 664 | if(strrpos($str,'/>')===strlen($str)-2) //subproperties |
675 | 665 | { |
@@ -691,8 +681,7 @@ discard block |
||
691 | 681 | throw new TConfigurationException('template_property_duplicated',$name); |
692 | 682 | $tpl[$container][2][$name]=$value; |
693 | 683 | } |
694 | - } |
|
695 | - else // regular property |
|
684 | + } else // regular property |
|
696 | 685 | { |
697 | 686 | $prop=strtolower($match[3][0]); |
698 | 687 | $stack[] = '@'.$prop; |
@@ -704,8 +693,7 @@ discard block |
||
704 | 693 | $expectPropEnd=true; |
705 | 694 | } |
706 | 695 | } |
707 | - } |
|
708 | - else if(strpos($str,'</prop:')===0) // closing property |
|
696 | + } else if(strpos($str,'</prop:')===0) // closing property |
|
709 | 697 | { |
710 | 698 | $prop=strtolower($match[3][0]); |
711 | 699 | if(empty($stack)) |
@@ -732,23 +720,20 @@ discard block |
||
732 | 720 | if(isset($tpl[$container][2][$prop])) |
733 | 721 | throw new TConfigurationException('template_property_duplicated',$prop); |
734 | 722 | $tpl[$container][2][$prop]=$value; |
735 | - } |
|
736 | - else // a property for the template control |
|
723 | + } else // a property for the template control |
|
737 | 724 | $this->_directive[$prop]=$value; |
738 | 725 | $textStart=$matchEnd+1; |
739 | 726 | } |
740 | 727 | $expectPropEnd=false; |
741 | 728 | } |
742 | - } |
|
743 | - else if(strpos($str,'<!--')===0) // comments |
|
729 | + } else if(strpos($str,'<!--')===0) // comments |
|
744 | 730 | { |
745 | 731 | if($expectPropEnd) |
746 | 732 | throw new TConfigurationException('template_comments_forbidden'); |
747 | 733 | if($matchStart>$textStart) |
748 | 734 | $tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart)); |
749 | 735 | $textStart=$matchEnd+1; |
750 | - } |
|
751 | - else |
|
736 | + } else |
|
752 | 737 | throw new TConfigurationException('template_matching_unexpected',$match); |
753 | 738 | } |
754 | 739 | if(!empty($stack)) |
@@ -759,8 +744,7 @@ discard block |
||
759 | 744 | } |
760 | 745 | if($textStart<strlen($input)) |
761 | 746 | $tpl[$c++]=array($container,substr($input,$textStart)); |
762 | - } |
|
763 | - catch(Exception $e) |
|
747 | + } catch(Exception $e) |
|
764 | 748 | { |
765 | 749 | if(($e instanceof TException) && ($e instanceof TTemplateException)) |
766 | 750 | throw $e; |
@@ -793,14 +777,12 @@ discard block |
||
793 | 777 | { |
794 | 778 | $parent=null; |
795 | 779 | $objects[$id]=$object; |
796 | - } |
|
797 | - else |
|
780 | + } else |
|
798 | 781 | { |
799 | 782 | $parent=$object[0]; |
800 | 783 | $merged=array($parent,array($object[1])); |
801 | 784 | } |
802 | - } |
|
803 | - else |
|
785 | + } else |
|
804 | 786 | $merged[1][]=$object[1]; |
805 | 787 | } |
806 | 788 | if($parent!==null) |
@@ -839,8 +821,7 @@ discard block |
||
839 | 821 | $attributes[$name]=$this->parseTemplateProperty(substr($value,1,strlen($value)-2),$match[2][1]+1); |
840 | 822 | else |
841 | 823 | $attributes[$name]=$this->parseTemplateProperty($value,$match[2][1]); |
842 | - } |
|
843 | - else |
|
824 | + } else |
|
844 | 825 | { |
845 | 826 | if($value[0]==='\'' || $value[0]==='"') |
846 | 827 | $attributes[$name]=$this->parseAttribute(substr($value,1,strlen($value)-2)); |
@@ -889,8 +870,7 @@ discard block |
||
889 | 870 | return array(self::CONFIG_DATABIND,ltrim($expr,'.')); |
890 | 871 | else |
891 | 872 | return array(self::CONFIG_EXPRESSION,ltrim($expr,'.')); |
892 | - } |
|
893 | - else if(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS',$value,$matches) && $matches[0]===$value) |
|
873 | + } else if(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS',$value,$matches) && $matches[0]===$value) |
|
894 | 874 | { |
895 | 875 | $value=$matches[1]; |
896 | 876 | if($value[2]==='~') |
@@ -903,8 +883,7 @@ discard block |
||
903 | 883 | $literal = trim(substr($value,3,strlen($value)-5)); |
904 | 884 | return array(self::CONFIG_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '/').'/$literal'"); |
905 | 885 | } |
906 | - } |
|
907 | - else |
|
886 | + } else |
|
908 | 887 | return $value; |
909 | 888 | } |
910 | 889 | |
@@ -926,16 +905,14 @@ discard block |
||
926 | 905 | $subname=substr($name,0,$pos); |
927 | 906 | if(!$class->hasMethod('get'.$subname)) |
928 | 907 | throw new TConfigurationException('template_property_unknown',$type,$subname); |
929 | - } |
|
930 | - else if(strncasecmp($name,'on',2)===0) |
|
908 | + } else if(strncasecmp($name,'on',2)===0) |
|
931 | 909 | { |
932 | 910 | // an event |
933 | 911 | if(!$class->hasMethod($name)) |
934 | 912 | throw new TConfigurationException('template_event_unknown',$type,$name); |
935 | 913 | else if(!is_string($att)) |
936 | 914 | throw new TConfigurationException('template_eventhandler_invalid',$type,$name); |
937 | - } |
|
938 | - else |
|
915 | + } else |
|
939 | 916 | { |
940 | 917 | // a simple property |
941 | 918 | if (! ($class->hasMethod('set'.$name) || $class->hasMethod('setjs'.$name) || $this->isClassBehaviorMethod($class,'set'.$name)) ) |
@@ -944,8 +921,7 @@ discard block |
||
944 | 921 | throw new TConfigurationException('template_property_readonly',$type,$name); |
945 | 922 | else |
946 | 923 | throw new TConfigurationException('template_property_unknown',$type,$name); |
947 | - } |
|
948 | - else if(is_array($att) && $att[0]!==self::CONFIG_EXPRESSION) |
|
924 | + } else if(is_array($att) && $att[0]!==self::CONFIG_EXPRESSION) |
|
949 | 925 | { |
950 | 926 | if(strcasecmp($name,'id')===0) |
951 | 927 | throw new TConfigurationException('template_controlid_invalid',$type); |
@@ -954,8 +930,7 @@ discard block |
||
954 | 930 | } |
955 | 931 | } |
956 | 932 | } |
957 | - } |
|
958 | - else if(is_subclass_of($className,'TComponent') || $className==='TComponent') |
|
933 | + } else if(is_subclass_of($className,'TComponent') || $className==='TComponent') |
|
959 | 934 | { |
960 | 935 | foreach($attributes as $name=>$att) |
961 | 936 | { |
@@ -967,8 +942,7 @@ discard block |
||
967 | 942 | $subname=substr($name,0,$pos); |
968 | 943 | if(!$class->hasMethod('get'.$subname)) |
969 | 944 | throw new TConfigurationException('template_property_unknown',$type,$subname); |
970 | - } |
|
971 | - else if(strncasecmp($name,'on',2)===0) |
|
945 | + } else if(strncasecmp($name,'on',2)===0) |
|
972 | 946 | throw new TConfigurationException('template_event_forbidden',$type,$name); |
973 | 947 | else |
974 | 948 | { |
@@ -982,8 +956,7 @@ discard block |
||
982 | 956 | } |
983 | 957 | } |
984 | 958 | } |
985 | - } |
|
986 | - else |
|
959 | + } else |
|
987 | 960 | throw new TConfigurationException('template_component_required',$type); |
988 | 961 | } |
989 | 962 | |
@@ -1018,8 +991,7 @@ discard block |
||
1018 | 991 | $line=$line-$this->_includeAtLine[$i]+1; |
1019 | 992 | $srcFile=$this->_includedFiles[$i]; |
1020 | 993 | break; |
1021 | - } |
|
1022 | - else |
|
994 | + } else |
|
1023 | 995 | $line=$line-$this->_includeLines[$i]+1; |
1024 | 996 | } |
1025 | 997 | } |
@@ -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 | } |
@@ -226,8 +226,7 @@ discard block |
||
226 | 226 | $base = $dir; |
227 | 227 | } |
228 | 228 | return array($assets->getPublishedPath($base), $assets->publishFilePath($base)); |
229 | - } |
|
230 | - else |
|
229 | + } else |
|
231 | 230 | { |
232 | 231 | return array($assets->getBasePath().str_replace($assets->getBaseUrl(),'',$base), $base); |
233 | 232 | } |
@@ -748,8 +747,7 @@ discard block |
||
748 | 747 | { |
749 | 748 | foreach($value as $v) |
750 | 749 | $str.='<input type="hidden" name="'.$name.'[]" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n"; |
751 | - } |
|
752 | - else |
|
750 | + } else |
|
753 | 751 | { |
754 | 752 | $str.='<input type="hidden" name="'.$name.'" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n"; |
755 | 753 | } |
@@ -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 | } |
@@ -61,8 +61,7 @@ discard block |
||
61 | 61 | foreach (explode(".", $field) as $f) |
62 | 62 | $tmp = $tmp[$f]; |
63 | 63 | return $tmp; |
64 | - } |
|
65 | - else if(is_object($data)) |
|
64 | + } else if(is_object($data)) |
|
66 | 65 | { |
67 | 66 | if(strpos($field,'.')===false) // simple field |
68 | 67 | { |
@@ -70,8 +69,7 @@ discard block |
||
70 | 69 | return call_user_func(array($data,'get'.$field)); |
71 | 70 | else |
72 | 71 | return $data->{$field}; |
73 | - } |
|
74 | - else // field in the format of xxx.yyy.zzz |
|
72 | + } else // field in the format of xxx.yyy.zzz |
|
75 | 73 | { |
76 | 74 | $object=$data; |
77 | 75 | foreach(explode('.',$field) as $f) |
@@ -79,8 +77,7 @@ discard block |
||
79 | 77 | return $object; |
80 | 78 | } |
81 | 79 | } |
82 | - } |
|
83 | - catch(Exception $e) |
|
80 | + } catch(Exception $e) |
|
84 | 81 | { |
85 | 82 | throw new TInvalidDataValueException('datafieldaccessor_datafield_invalid',$field,$e->getMessage()); |
86 | 83 | } |
@@ -71,14 +71,12 @@ discard block |
||
71 | 71 | $configFile->loadFromFile($this->_paramFile); |
72 | 72 | $cache->set($cacheKey,$configFile,0,new TFileCacheDependency($this->_paramFile)); |
73 | 73 | } |
74 | - } |
|
75 | - else |
|
74 | + } else |
|
76 | 75 | { |
77 | 76 | if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP) |
78 | 77 | { |
79 | 78 | $configFile = include $this->_paramFile; |
80 | - } |
|
81 | - else |
|
79 | + } else |
|
82 | 80 | { |
83 | 81 | $configFile=new TXmlDocument; |
84 | 82 | $configFile->loadFromFile($this->_paramFile); |
@@ -105,14 +103,12 @@ discard block |
||
105 | 103 | { |
106 | 104 | $properties = isset($parameter['properties'])?$parameter['properties']:array(); |
107 | 105 | $parameters[$id]=array($parameter['class'],$properties); |
108 | - } |
|
109 | - else |
|
106 | + } else |
|
110 | 107 | { |
111 | 108 | $parameters[$id] = $parameter; |
112 | 109 | } |
113 | 110 | } |
114 | - } |
|
115 | - else if($config instanceof TXmlElement) |
|
111 | + } else if($config instanceof TXmlElement) |
|
116 | 112 | { |
117 | 113 | foreach($config->getElementsByTagName('parameter') as $node) |
118 | 114 | { |
@@ -125,8 +121,7 @@ discard block |
||
125 | 121 | $parameters[$id]=$node; |
126 | 122 | else |
127 | 123 | $parameters[$id]=$value; |
128 | - } |
|
129 | - else |
|
124 | + } else |
|
130 | 125 | $parameters[$id]=array($type,$properties->toArray()); |
131 | 126 | } |
132 | 127 | } |
@@ -140,8 +135,7 @@ discard block |
||
140 | 135 | foreach($parameter[1] as $name=>$value) |
141 | 136 | $component->setSubProperty($name,$value); |
142 | 137 | $appParams->add($id,$component); |
143 | - } |
|
144 | - else |
|
138 | + } else |
|
145 | 139 | $appParams->add($id,$parameter); |
146 | 140 | } |
147 | 141 | } |
@@ -65,15 +65,13 @@ discard block |
||
65 | 65 | { |
66 | 66 | $phpConfig = include $this->_configFile; |
67 | 67 | $this->loadConfig($phpConfig); |
68 | - } |
|
69 | - else |
|
68 | + } else |
|
70 | 69 | { |
71 | 70 | $dom=new TXmlDocument; |
72 | 71 | $dom->loadFromFile($this->_configFile); |
73 | 72 | $this->loadConfig($dom); |
74 | 73 | } |
75 | - } |
|
76 | - else |
|
74 | + } else |
|
77 | 75 | throw new TConfigurationException('logrouter_configfile_invalid',$this->_configFile); |
78 | 76 | } |
79 | 77 | $this->loadConfig($config); |
@@ -105,8 +103,7 @@ discard block |
||
105 | 103 | $route->init($route); |
106 | 104 | } |
107 | 105 | } |
108 | - } |
|
109 | - else |
|
106 | + } else |
|
110 | 107 | { |
111 | 108 | foreach($config->getElementsByTagName('route') as $routeConfig) |
112 | 109 | { |
@@ -647,8 +644,7 @@ discard block |
||
647 | 644 | { |
648 | 645 | $timing['delta'] = $logs[$i+1][3] - $logs[$i][3]; |
649 | 646 | $timing['total'] = $logs[$i+1][3] - $first; |
650 | - } |
|
651 | - else |
|
647 | + } else |
|
652 | 648 | { |
653 | 649 | $timing['delta'] = '?'; |
654 | 650 | $timing['total'] = $logs[$i][3] - $first; |
@@ -691,8 +687,7 @@ discard block |
||
691 | 687 | <th>Category</th><th>Message</th><th>Time Spent (s)</th><th>Cumulated Time Spent (s)</th> |
692 | 688 | </tr> |
693 | 689 | EOD; |
694 | - } |
|
695 | - else |
|
690 | + } else |
|
696 | 691 | { |
697 | 692 | $string = <<<EOD |
698 | 693 | <table cellspacing="0" cellpadding="2" border="0" width="100%" style="table-layout:auto"> |
@@ -729,8 +724,7 @@ discard block |
||
729 | 724 | <td class="cumulatedtime">{$total}</td> |
730 | 725 | </tr> |
731 | 726 | EOD; |
732 | - } |
|
733 | - else |
|
727 | + } else |
|
734 | 728 | { |
735 | 729 | $bgcolor = $info['even'] ? "#fff" : "#eee"; |
736 | 730 | $color = $this->getColorLevel($log[1]); |
@@ -772,8 +766,7 @@ discard block |
||
772 | 766 | { |
773 | 767 | $string .= '<span class="level'.$level.'">'.strtoupper($name)."</span>"; |
774 | 768 | } |
775 | - } |
|
776 | - else |
|
769 | + } else |
|
777 | 770 | { |
778 | 771 | $string .= "<tr><td colspan=\"5\" style=\"text-align:center; background-color:black; border-top: 1px solid #ccc; padding:0.2em;\">"; |
779 | 772 | foreach(self::$_levelValues as $name => $level) |
@@ -858,8 +851,7 @@ discard block |
||
858 | 851 | try |
859 | 852 | { |
860 | 853 | $db->createCommand($sql)->query()->close(); |
861 | - } |
|
862 | - catch(Exception $e) |
|
854 | + } catch(Exception $e) |
|
863 | 855 | { |
864 | 856 | // DB table not exists |
865 | 857 | if($this->_autoCreate) |
@@ -925,8 +917,7 @@ discard block |
||
925 | 917 | return $config->getDbConnection(); |
926 | 918 | else |
927 | 919 | throw new TConfigurationException('dblogroute_connectionid_invalid',$this->_connID); |
928 | - } |
|
929 | - else |
|
920 | + } else |
|
930 | 921 | { |
931 | 922 | $db=new TDbConnection; |
932 | 923 | // default to SQLite3 database |
@@ -1138,8 +1129,7 @@ discard block |
||
1138 | 1129 | { |
1139 | 1130 | $delta = $logs[$i+1][3] - $logs[$i][3]; |
1140 | 1131 | $total = $logs[$i+1][3] - $first; |
1141 | - } |
|
1142 | - else |
|
1132 | + } else |
|
1143 | 1133 | { |
1144 | 1134 | $delta = '?'; |
1145 | 1135 | $total = $logs[$i][3] - $first; |
@@ -155,8 +155,9 @@ discard block |
||
155 | 155 | $this->_temp_tarname = ''; |
156 | 156 | return false; |
157 | 157 | } |
158 | - while ($v_data = @fread($v_file_from, 1024)) |
|
159 | - @fwrite($v_file_to, $v_data); |
|
158 | + while ($v_data = @fread($v_file_from, 1024)) { |
|
159 | + @fwrite($v_file_to, $v_data); |
|
160 | + } |
|
160 | 161 | @fclose($v_file_from); |
161 | 162 | @fclose($v_file_to); |
162 | 163 | } |
@@ -410,8 +411,9 @@ discard block |
||
410 | 411 | $v_header['filename'] = substr($v_header['filename'], |
411 | 412 | $p_remove_path_size); |
412 | 413 | if (($p_path != './') && ($p_path != '/')) { |
413 | - while (substr($p_path, -1) == '/') |
|
414 | - $p_path = substr($p_path, 0, strlen($p_path)-1); |
|
414 | + while (substr($p_path, -1) == '/') { |
|
415 | + $p_path = substr($p_path, 0, strlen($p_path)-1); |
|
416 | + } |
|
415 | 417 | |
416 | 418 | if (substr($v_header['filename'], 0, 1) == '/') |
417 | 419 | $v_header['filename'] = $p_path.$v_header['filename']; |