| @@ 3769-3785 (lines=17) @@ | ||
| 3766 | /** |
|
| 3767 | * The closed block handler for with blocks |
|
| 3768 | */ |
|
| 3769 | function ClosedBlock_Handle_With(&$res) { |
|
| 3770 | if ($res['ArgumentCount'] != 1) { |
|
| 3771 | throw new SSTemplateParseException('Either no or too many arguments in with block. Must be one ' . |
|
| 3772 | 'argument only.', $this); |
|
| 3773 | } |
|
| 3774 | ||
| 3775 | $arg = $res['Arguments'][0]; |
|
| 3776 | if ($arg['ArgumentMode'] == 'string') { |
|
| 3777 | throw new SSTemplateParseException('Control block cant take string as argument.', $this); |
|
| 3778 | } |
|
| 3779 | ||
| 3780 | $on = str_replace('$$FINAL', 'obj', ($arg['ArgumentMode'] == 'default') ? $arg['lookup_php'] : $arg['php']); |
|
| 3781 | return |
|
| 3782 | $on . '; $scope->pushScope();' . PHP_EOL . |
|
| 3783 | $res['Template']['php'] . PHP_EOL . |
|
| 3784 | '; $scope->popScope(); '; |
|
| 3785 | } |
|
| 3786 | ||
| 3787 | /* OpenBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > '%>' */ |
|
| 3788 | protected $match_OpenBlock_typestack = array('OpenBlock'); |
|
| @@ 938-954 (lines=17) @@ | ||
| 935 | /** |
|
| 936 | * The closed block handler for with blocks |
|
| 937 | */ |
|
| 938 | function ClosedBlock_Handle_With(&$res) { |
|
| 939 | if ($res['ArgumentCount'] != 1) { |
|
| 940 | throw new SSTemplateParseException('Either no or too many arguments in with block. Must be one ' . |
|
| 941 | 'argument only.', $this); |
|
| 942 | } |
|
| 943 | ||
| 944 | $arg = $res['Arguments'][0]; |
|
| 945 | if ($arg['ArgumentMode'] == 'string') { |
|
| 946 | throw new SSTemplateParseException('Control block cant take string as argument.', $this); |
|
| 947 | } |
|
| 948 | ||
| 949 | $on = str_replace('$$FINAL', 'obj', ($arg['ArgumentMode'] == 'default') ? $arg['lookup_php'] : $arg['php']); |
|
| 950 | return |
|
| 951 | $on . '; $scope->pushScope();' . PHP_EOL . |
|
| 952 | $res['Template']['php'] . PHP_EOL . |
|
| 953 | '; $scope->popScope(); '; |
|
| 954 | } |
|
| 955 | ||
| 956 | /*!* |
|
| 957 | ||