@@ -243,8 +243,7 @@ discard block |
||
| 243 | 243 | $component->createdOnTemplate($parent); |
| 244 | 244 | if($component->getAllowChildControls()) |
| 245 | 245 | $controls[$key]=$component; |
| 246 | - } |
|
| 247 | - else if($component instanceof TComponent) |
|
| 246 | + } else if($component instanceof TComponent) |
|
| 248 | 247 | { |
| 249 | 248 | $controls[$key]=$component; |
| 250 | 249 | if(isset($properties['id'])) |
@@ -262,8 +261,7 @@ discard block |
||
| 262 | 261 | else |
| 263 | 262 | $component->createdOnTemplate($parent); |
| 264 | 263 | } |
| 265 | - } |
|
| 266 | - else |
|
| 264 | + } else |
|
| 267 | 265 | { |
| 268 | 266 | if($object[1] instanceof TCompositeLiteral) |
| 269 | 267 | { |
@@ -274,8 +272,7 @@ discard block |
||
| 274 | 272 | $directChildren[]=$o; |
| 275 | 273 | else |
| 276 | 274 | $parent->addParsedObject($o); |
| 277 | - } |
|
| 278 | - else |
|
| 275 | + } else |
|
| 279 | 276 | { |
| 280 | 277 | if($parent===$parentControl) |
| 281 | 278 | $directChildren[]=$object[1]; |
@@ -386,8 +383,7 @@ discard block |
||
| 386 | 383 | throw new TConfigurationException('template_tag_unexpected',$name,$value[1]); |
| 387 | 384 | break; |
| 388 | 385 | } |
| 389 | - } |
|
| 390 | - else |
|
| 386 | + } else |
|
| 391 | 387 | { |
| 392 | 388 | if (substr($name,0,2)=='js') |
| 393 | 389 | if ($value and !($value instanceof TJavaScriptLiteral)) |
@@ -435,8 +431,7 @@ discard block |
||
| 435 | 431 | throw new TConfigurationException('template_tag_unexpected',$name,$value[1]); |
| 436 | 432 | break; |
| 437 | 433 | } |
| 438 | - } |
|
| 439 | - else |
|
| 434 | + } else |
|
| 440 | 435 | $component->setSubProperty($name,$value); |
| 441 | 436 | } |
| 442 | 437 | |
@@ -497,8 +492,7 @@ discard block |
||
| 497 | 492 | $stack[] = $type; |
| 498 | 493 | $container=$c-1; |
| 499 | 494 | } |
| 500 | - } |
|
| 501 | - else if(strpos($str,'</com:')===0) // closing component tag |
|
| 495 | + } else if(strpos($str,'</com:')===0) // closing component tag |
|
| 502 | 496 | { |
| 503 | 497 | if($expectPropEnd) |
| 504 | 498 | continue; |
@@ -517,8 +511,7 @@ discard block |
||
| 517 | 511 | throw new TConfigurationException('template_closingtag_expected',$tag, "</com:$type>"); |
| 518 | 512 | } |
| 519 | 513 | $container=$tpl[$container][0]; |
| 520 | - } |
|
| 521 | - else if(strpos($str,'<%@')===0) // directive |
|
| 514 | + } else if(strpos($str,'<%@')===0) // directive |
|
| 522 | 515 | { |
| 523 | 516 | if($expectPropEnd) |
| 524 | 517 | continue; |
@@ -528,8 +521,7 @@ discard block |
||
| 528 | 521 | if(isset($tpl[0]) || $this->_directive!==null) |
| 529 | 522 | throw new TConfigurationException('template_directive_nonunique'); |
| 530 | 523 | $this->_directive=$this->parseAttributes($match[4][0],$match[4][1]); |
| 531 | - } |
|
| 532 | - else if(strpos($str,'<%')===0) // expression |
|
| 524 | + } else if(strpos($str,'<%')===0) // expression |
|
| 533 | 525 | { |
| 534 | 526 | if($expectPropEnd) |
| 535 | 527 | continue; |
@@ -554,8 +546,7 @@ discard block |
||
| 554 | 546 | $literal=strtr(trim(substr($literal,0,strlen($literal)-1)),array("'"=>"\'","\\"=>"\\\\")); |
| 555 | 547 | $tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"Prado::localize('$literal')")); |
| 556 | 548 | } |
| 557 | - } |
|
| 558 | - else if(strpos($str,'<prop:')===0) // opening property |
|
| 549 | + } else if(strpos($str,'<prop:')===0) // opening property |
|
| 559 | 550 | { |
| 560 | 551 | if(strrpos($str,'/>')===strlen($str)-2) //subproperties |
| 561 | 552 | { |
@@ -577,8 +568,7 @@ discard block |
||
| 577 | 568 | throw new TConfigurationException('template_property_duplicated',$name); |
| 578 | 569 | $tpl[$container][2][$name]=$value; |
| 579 | 570 | } |
| 580 | - } |
|
| 581 | - else // regular property |
|
| 571 | + } else // regular property |
|
| 582 | 572 | { |
| 583 | 573 | $prop=strtolower($match[3][0]); |
| 584 | 574 | $stack[] = '@'.$prop; |
@@ -590,8 +580,7 @@ discard block |
||
| 590 | 580 | $expectPropEnd=true; |
| 591 | 581 | } |
| 592 | 582 | } |
| 593 | - } |
|
| 594 | - else if(strpos($str,'</prop:')===0) // closing property |
|
| 583 | + } else if(strpos($str,'</prop:')===0) // closing property |
|
| 595 | 584 | { |
| 596 | 585 | $prop=strtolower($match[3][0]); |
| 597 | 586 | if(empty($stack)) |
@@ -618,23 +607,20 @@ discard block |
||
| 618 | 607 | if(isset($tpl[$container][2][$prop])) |
| 619 | 608 | throw new TConfigurationException('template_property_duplicated',$prop); |
| 620 | 609 | $tpl[$container][2][$prop]=$value; |
| 621 | - } |
|
| 622 | - else // a property for the template control |
|
| 610 | + } else // a property for the template control |
|
| 623 | 611 | $this->_directive[$prop]=$value; |
| 624 | 612 | $textStart=$matchEnd+1; |
| 625 | 613 | } |
| 626 | 614 | $expectPropEnd=false; |
| 627 | 615 | } |
| 628 | - } |
|
| 629 | - else if(strpos($str,'<!--')===0) // comments |
|
| 616 | + } else if(strpos($str,'<!--')===0) // comments |
|
| 630 | 617 | { |
| 631 | 618 | if($expectPropEnd) |
| 632 | 619 | throw new TConfigurationException('template_comments_forbidden'); |
| 633 | 620 | if($matchStart>$textStart) |
| 634 | 621 | $tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart)); |
| 635 | 622 | $textStart=$matchEnd+1; |
| 636 | - } |
|
| 637 | - else |
|
| 623 | + } else |
|
| 638 | 624 | throw new TConfigurationException('template_matching_unexpected',$match); |
| 639 | 625 | } |
| 640 | 626 | if(!empty($stack)) |
@@ -645,8 +631,7 @@ discard block |
||
| 645 | 631 | } |
| 646 | 632 | if($textStart<strlen($input)) |
| 647 | 633 | $tpl[$c++]=array($container,substr($input,$textStart)); |
| 648 | - } |
|
| 649 | - catch(\Exception $e) |
|
| 634 | + } catch(\Exception $e) |
|
| 650 | 635 | { |
| 651 | 636 | if(($e instanceof TException) && ($e instanceof TTemplateException)) |
| 652 | 637 | throw $e; |
@@ -679,14 +664,12 @@ discard block |
||
| 679 | 664 | { |
| 680 | 665 | $parent=null; |
| 681 | 666 | $objects[$id]=$object; |
| 682 | - } |
|
| 683 | - else |
|
| 667 | + } else |
|
| 684 | 668 | { |
| 685 | 669 | $parent=$object[0]; |
| 686 | 670 | $merged=array($parent,array($object[1])); |
| 687 | 671 | } |
| 688 | - } |
|
| 689 | - else |
|
| 672 | + } else |
|
| 690 | 673 | $merged[1][]=$object[1]; |
| 691 | 674 | } |
| 692 | 675 | if($parent!==null) |
@@ -725,8 +708,7 @@ discard block |
||
| 725 | 708 | $attributes[$name]=$this->parseTemplateProperty(substr($value,1,strlen($value)-2),$match[2][1]+1); |
| 726 | 709 | else |
| 727 | 710 | $attributes[$name]=$this->parseTemplateProperty($value,$match[2][1]); |
| 728 | - } |
|
| 729 | - else |
|
| 711 | + } else |
|
| 730 | 712 | { |
| 731 | 713 | if($value[0]==='\'' || $value[0]==='"') |
| 732 | 714 | $attributes[$name]=$this->parseAttribute(substr($value,1,strlen($value)-2)); |
@@ -775,8 +757,7 @@ discard block |
||
| 775 | 757 | return array(self::CONFIG_DATABIND,ltrim($expr,'.')); |
| 776 | 758 | else |
| 777 | 759 | return array(self::CONFIG_EXPRESSION,ltrim($expr,'.')); |
| 778 | - } |
|
| 779 | - else if(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS',$value,$matches) && $matches[0]===$value) |
|
| 760 | + } else if(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS',$value,$matches) && $matches[0]===$value) |
|
| 780 | 761 | { |
| 781 | 762 | $value=$matches[1]; |
| 782 | 763 | if($value[2]==='~') |
@@ -789,8 +770,7 @@ discard block |
||
| 789 | 770 | $literal = trim(substr($value,3,strlen($value)-5)); |
| 790 | 771 | return array(self::CONFIG_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '\/').'/$literal'"); |
| 791 | 772 | } |
| 792 | - } |
|
| 793 | - else |
|
| 773 | + } else |
|
| 794 | 774 | return $value; |
| 795 | 775 | } |
| 796 | 776 | |
@@ -812,16 +792,14 @@ discard block |
||
| 812 | 792 | $subname=substr($name,0,$pos); |
| 813 | 793 | if(!$class->hasMethod('get'.$subname)) |
| 814 | 794 | throw new TConfigurationException('template_property_unknown',$type,$subname); |
| 815 | - } |
|
| 816 | - else if(strncasecmp($name,'on',2)===0) |
|
| 795 | + } else if(strncasecmp($name,'on',2)===0) |
|
| 817 | 796 | { |
| 818 | 797 | // an event |
| 819 | 798 | if(!$class->hasMethod($name)) |
| 820 | 799 | throw new TConfigurationException('template_event_unknown',$type,$name); |
| 821 | 800 | else if(!is_string($att)) |
| 822 | 801 | throw new TConfigurationException('template_eventhandler_invalid',$type,$name); |
| 823 | - } |
|
| 824 | - else |
|
| 802 | + } else |
|
| 825 | 803 | { |
| 826 | 804 | // a simple property |
| 827 | 805 | if (! ($class->hasMethod('set'.$name) || $class->hasMethod('setjs'.$name) || $this->isClassBehaviorMethod($class,'set'.$name)) ) |
@@ -830,8 +808,7 @@ discard block |
||
| 830 | 808 | throw new TConfigurationException('template_property_readonly',$type,$name); |
| 831 | 809 | else |
| 832 | 810 | throw new TConfigurationException('template_property_unknown',$type,$name); |
| 833 | - } |
|
| 834 | - else if(is_array($att) && $att[0]!==self::CONFIG_EXPRESSION) |
|
| 811 | + } else if(is_array($att) && $att[0]!==self::CONFIG_EXPRESSION) |
|
| 835 | 812 | { |
| 836 | 813 | if(strcasecmp($name,'id')===0) |
| 837 | 814 | throw new TConfigurationException('template_controlid_invalid',$type); |
@@ -840,8 +817,7 @@ discard block |
||
| 840 | 817 | } |
| 841 | 818 | } |
| 842 | 819 | } |
| 843 | - } |
|
| 844 | - else if(is_subclass_of($className,'\Prado\TComponent') || $className==='\Prado\TComponent') |
|
| 820 | + } else if(is_subclass_of($className,'\Prado\TComponent') || $className==='\Prado\TComponent') |
|
| 845 | 821 | { |
| 846 | 822 | foreach($attributes as $name=>$att) |
| 847 | 823 | { |
@@ -853,8 +829,7 @@ discard block |
||
| 853 | 829 | $subname=substr($name,0,$pos); |
| 854 | 830 | if(!$class->hasMethod('get'.$subname)) |
| 855 | 831 | throw new TConfigurationException('template_property_unknown',$type,$subname); |
| 856 | - } |
|
| 857 | - else if(strncasecmp($name,'on',2)===0) |
|
| 832 | + } else if(strncasecmp($name,'on',2)===0) |
|
| 858 | 833 | throw new TConfigurationException('template_event_forbidden',$type,$name); |
| 859 | 834 | else |
| 860 | 835 | { |
@@ -868,8 +843,7 @@ discard block |
||
| 868 | 843 | } |
| 869 | 844 | } |
| 870 | 845 | } |
| 871 | - } |
|
| 872 | - else |
|
| 846 | + } else |
|
| 873 | 847 | throw new TConfigurationException('template_component_required',$type); |
| 874 | 848 | return $class->getName(); |
| 875 | 849 | } |
@@ -905,8 +879,7 @@ discard block |
||
| 905 | 879 | $line=$line-$this->_includeAtLine[$i]+1; |
| 906 | 880 | $srcFile=$this->_includedFiles[$i]; |
| 907 | 881 | break; |
| 908 | - } |
|
| 909 | - else |
|
| 882 | + } else |
|
| 910 | 883 | $line=$line-$this->_includeLines[$i]+1; |
| 911 | 884 | } |
| 912 | 885 | } |