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