@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
69 | 69 | * @param array $parameter array with compilation parameter |
70 | 70 | * |
71 | - * @return bool true |
|
71 | + * @return boolean|null true |
|
72 | 72 | */ |
73 | 73 | public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
74 | 74 | { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
159 | 159 | * @param array $parameter array with compilation parameter |
160 | 160 | * |
161 | - * @return bool true |
|
161 | + * @return string true |
|
162 | 162 | */ |
163 | 163 | public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
164 | 164 | { |
@@ -15,134 +15,134 @@ discard block |
||
15 | 15 | */ |
16 | 16 | class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inheritance |
17 | 17 | { |
18 | - /** |
|
19 | - * Attribute definition: Overwrites base class. |
|
20 | - * |
|
21 | - * @var array |
|
22 | - * @see Smarty_Internal_CompileBase |
|
23 | - */ |
|
24 | - public $required_attributes = array('name'); |
|
18 | + /** |
|
19 | + * Attribute definition: Overwrites base class. |
|
20 | + * |
|
21 | + * @var array |
|
22 | + * @see Smarty_Internal_CompileBase |
|
23 | + */ |
|
24 | + public $required_attributes = array('name'); |
|
25 | 25 | |
26 | - /** |
|
27 | - * Attribute definition: Overwrites base class. |
|
28 | - * |
|
29 | - * @var array |
|
30 | - * @see Smarty_Internal_CompileBase |
|
31 | - */ |
|
32 | - public $shorttag_order = array('name'); |
|
26 | + /** |
|
27 | + * Attribute definition: Overwrites base class. |
|
28 | + * |
|
29 | + * @var array |
|
30 | + * @see Smarty_Internal_CompileBase |
|
31 | + */ |
|
32 | + public $shorttag_order = array('name'); |
|
33 | 33 | |
34 | - /** |
|
35 | - * Attribute definition: Overwrites base class. |
|
36 | - * |
|
37 | - * @var array |
|
38 | - * @see Smarty_Internal_CompileBase |
|
39 | - */ |
|
40 | - public $option_flags = array('hide', 'nocache'); |
|
34 | + /** |
|
35 | + * Attribute definition: Overwrites base class. |
|
36 | + * |
|
37 | + * @var array |
|
38 | + * @see Smarty_Internal_CompileBase |
|
39 | + */ |
|
40 | + public $option_flags = array('hide', 'nocache'); |
|
41 | 41 | |
42 | - /** |
|
43 | - * Attribute definition: Overwrites base class. |
|
44 | - * |
|
45 | - * @var array |
|
46 | - * @see Smarty_Internal_CompileBase |
|
47 | - */ |
|
48 | - public $optional_attributes = array('assign'); |
|
42 | + /** |
|
43 | + * Attribute definition: Overwrites base class. |
|
44 | + * |
|
45 | + * @var array |
|
46 | + * @see Smarty_Internal_CompileBase |
|
47 | + */ |
|
48 | + public $optional_attributes = array('assign'); |
|
49 | 49 | |
50 | - /** |
|
51 | - * nesting level of block tags |
|
52 | - * |
|
53 | - * @var int |
|
54 | - */ |
|
55 | - public static $blockTagNestingLevel = 0; |
|
50 | + /** |
|
51 | + * nesting level of block tags |
|
52 | + * |
|
53 | + * @var int |
|
54 | + */ |
|
55 | + public static $blockTagNestingLevel = 0; |
|
56 | 56 | |
57 | - /** |
|
58 | - * Saved compiler object |
|
59 | - * |
|
60 | - * @var Smarty_Internal_TemplateCompilerBase |
|
61 | - */ |
|
62 | - public $compiler = null; |
|
57 | + /** |
|
58 | + * Saved compiler object |
|
59 | + * |
|
60 | + * @var Smarty_Internal_TemplateCompilerBase |
|
61 | + */ |
|
62 | + public $compiler = null; |
|
63 | 63 | |
64 | - /** |
|
65 | - * Compiles code for the {block} tag |
|
66 | - * |
|
67 | - * @param array $args array with attributes from parser |
|
68 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
69 | - * @param array $parameter array with compilation parameter |
|
70 | - * |
|
71 | - * @return bool true |
|
72 | - */ |
|
73 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
74 | - { |
|
75 | - if (!isset($compiler->_cache[ 'blockNesting' ])) { |
|
76 | - $compiler->_cache[ 'blockNesting' ] = 0; |
|
77 | - } |
|
78 | - if ($compiler->_cache[ 'blockNesting' ] == 0) { |
|
79 | - // make sure that inheritance gets initialized in template code |
|
80 | - $this->registerInit($compiler); |
|
81 | - $this->option_flags = array('hide', 'nocache', 'append', 'prepend'); |
|
82 | - } else { |
|
83 | - $this->option_flags = array('hide', 'nocache'); |
|
84 | - } |
|
85 | - // check and get attributes |
|
86 | - $_attr = $this->getAttributes($compiler, $args); |
|
87 | - $compiler->_cache[ 'blockNesting' ] ++; |
|
88 | - $compiler->_cache[ 'blockName' ][ $compiler->_cache[ 'blockNesting' ] ] = $_attr[ 'name' ]; |
|
89 | - $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ] = array(); |
|
90 | - $this->openTag($compiler, 'block', array($_attr, $compiler->nocache, $compiler->parser->current_buffer, |
|
91 | - $compiler->template->compiled->has_nocache_code, |
|
92 | - $compiler->template->caching)); |
|
93 | - // must whole block be nocache ? |
|
94 | - if ($compiler->tag_nocache) { |
|
95 | - $i = 0; |
|
96 | - } |
|
97 | - $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; |
|
98 | - if ($_attr[ 'nocache' ] === true) { |
|
64 | + /** |
|
65 | + * Compiles code for the {block} tag |
|
66 | + * |
|
67 | + * @param array $args array with attributes from parser |
|
68 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
69 | + * @param array $parameter array with compilation parameter |
|
70 | + * |
|
71 | + * @return bool true |
|
72 | + */ |
|
73 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
74 | + { |
|
75 | + if (!isset($compiler->_cache[ 'blockNesting' ])) { |
|
76 | + $compiler->_cache[ 'blockNesting' ] = 0; |
|
77 | + } |
|
78 | + if ($compiler->_cache[ 'blockNesting' ] == 0) { |
|
79 | + // make sure that inheritance gets initialized in template code |
|
80 | + $this->registerInit($compiler); |
|
81 | + $this->option_flags = array('hide', 'nocache', 'append', 'prepend'); |
|
82 | + } else { |
|
83 | + $this->option_flags = array('hide', 'nocache'); |
|
84 | + } |
|
85 | + // check and get attributes |
|
86 | + $_attr = $this->getAttributes($compiler, $args); |
|
87 | + $compiler->_cache[ 'blockNesting' ] ++; |
|
88 | + $compiler->_cache[ 'blockName' ][ $compiler->_cache[ 'blockNesting' ] ] = $_attr[ 'name' ]; |
|
89 | + $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ] = array(); |
|
90 | + $this->openTag($compiler, 'block', array($_attr, $compiler->nocache, $compiler->parser->current_buffer, |
|
91 | + $compiler->template->compiled->has_nocache_code, |
|
92 | + $compiler->template->caching)); |
|
93 | + // must whole block be nocache ? |
|
94 | + if ($compiler->tag_nocache) { |
|
95 | + $i = 0; |
|
96 | + } |
|
97 | + $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; |
|
98 | + if ($_attr[ 'nocache' ] === true) { |
|
99 | 99 | |
100 | - } |
|
101 | - $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); |
|
102 | - $compiler->template->compiled->has_nocache_code = false; |
|
103 | - $compiler->suppressNocacheProcessing = true; |
|
104 | - } |
|
100 | + } |
|
101 | + $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); |
|
102 | + $compiler->template->compiled->has_nocache_code = false; |
|
103 | + $compiler->suppressNocacheProcessing = true; |
|
104 | + } |
|
105 | 105 | |
106 | - /** |
|
107 | - * Compile saved child block source |
|
108 | - * |
|
109 | - * @param \Smarty_Internal_TemplateCompilerBase compiler object |
|
110 | - * @param string $_name optional name of child block |
|
111 | - * |
|
112 | - * @return string compiled code of child block |
|
113 | - */ |
|
114 | - static function compileChildBlock(Smarty_Internal_TemplateCompilerBase $compiler, $_name = null) |
|
115 | - { |
|
116 | - if (!isset($compiler->_cache[ 'blockNesting' ])) { |
|
117 | - $compiler->trigger_template_error(' tag {$smarty.block.child} used outside {block} tags ', |
|
118 | - $compiler->parser->lex->taglineno); |
|
119 | - } |
|
120 | - $compiler->has_code = true; |
|
121 | - $compiler->suppressNocacheProcessing = true; |
|
122 | - $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ][ 'callsChild' ] = 'true'; |
|
123 | - $output = "<?php \n\$_smarty_tpl->inheritance->callChild(\$_smarty_tpl, \$this);\n?>\n"; |
|
124 | - return $output; |
|
125 | - } |
|
106 | + /** |
|
107 | + * Compile saved child block source |
|
108 | + * |
|
109 | + * @param \Smarty_Internal_TemplateCompilerBase compiler object |
|
110 | + * @param string $_name optional name of child block |
|
111 | + * |
|
112 | + * @return string compiled code of child block |
|
113 | + */ |
|
114 | + static function compileChildBlock(Smarty_Internal_TemplateCompilerBase $compiler, $_name = null) |
|
115 | + { |
|
116 | + if (!isset($compiler->_cache[ 'blockNesting' ])) { |
|
117 | + $compiler->trigger_template_error(' tag {$smarty.block.child} used outside {block} tags ', |
|
118 | + $compiler->parser->lex->taglineno); |
|
119 | + } |
|
120 | + $compiler->has_code = true; |
|
121 | + $compiler->suppressNocacheProcessing = true; |
|
122 | + $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ][ 'callsChild' ] = 'true'; |
|
123 | + $output = "<?php \n\$_smarty_tpl->inheritance->callChild(\$_smarty_tpl, \$this);\n?>\n"; |
|
124 | + return $output; |
|
125 | + } |
|
126 | 126 | |
127 | - /** |
|
128 | - * Compile $smarty.block.parent |
|
129 | - * |
|
130 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
131 | - * @param string $_name optional name of child block |
|
132 | - * |
|
133 | - * @return string compiled code of child block |
|
134 | - */ |
|
135 | - static function compileParentBlock(Smarty_Internal_TemplateCompilerBase $compiler, $_name = null) |
|
136 | - { |
|
137 | - if (!isset($compiler->_cache[ 'blockNesting' ])) { |
|
138 | - $compiler->trigger_template_error(' tag {$smarty.block.parent} used outside {block} tags ', |
|
139 | - $compiler->parser->lex->taglineno); |
|
140 | - } |
|
141 | - $compiler->suppressNocacheProcessing = true; |
|
142 | - $compiler->has_code = true; |
|
143 | - $output = "<?php \n\$_smarty_tpl->inheritance->callParent(\$_smarty_tpl, \$this);\n?>\n"; |
|
144 | - return $output; |
|
145 | - } |
|
127 | + /** |
|
128 | + * Compile $smarty.block.parent |
|
129 | + * |
|
130 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
131 | + * @param string $_name optional name of child block |
|
132 | + * |
|
133 | + * @return string compiled code of child block |
|
134 | + */ |
|
135 | + static function compileParentBlock(Smarty_Internal_TemplateCompilerBase $compiler, $_name = null) |
|
136 | + { |
|
137 | + if (!isset($compiler->_cache[ 'blockNesting' ])) { |
|
138 | + $compiler->trigger_template_error(' tag {$smarty.block.parent} used outside {block} tags ', |
|
139 | + $compiler->parser->lex->taglineno); |
|
140 | + } |
|
141 | + $compiler->suppressNocacheProcessing = true; |
|
142 | + $compiler->has_code = true; |
|
143 | + $output = "<?php \n\$_smarty_tpl->inheritance->callParent(\$_smarty_tpl, \$this);\n?>\n"; |
|
144 | + return $output; |
|
145 | + } |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -151,95 +151,95 @@ discard block |
||
151 | 151 | */ |
152 | 152 | class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_Inheritance |
153 | 153 | { |
154 | - /** |
|
155 | - * Compiles code for the {/block} tag |
|
156 | - * |
|
157 | - * @param array $args array with attributes from parser |
|
158 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
159 | - * @param array $parameter array with compilation parameter |
|
160 | - * |
|
161 | - * @return bool true |
|
162 | - */ |
|
163 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
164 | - { |
|
165 | - list($_attr, $_nocache, $_buffer, $_has_nocache_code, $_caching) = $this->closeTag($compiler, array('block')); |
|
166 | - // init block parameter |
|
167 | - $_block = $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ]; |
|
168 | - unset($compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ]); |
|
169 | - $_name = $_attr[ 'name' ]; |
|
170 | - $_assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : null; |
|
171 | - unset($_attr[ 'assign' ], $_attr[ 'name' ]); |
|
172 | - foreach ($_attr as $name => $stat) { |
|
173 | - if ((is_bool($stat) && $stat !== false) || (!is_bool($stat) && $stat != 'false')) { |
|
174 | - $_block[ $name ] = 'true'; |
|
175 | - } |
|
176 | - } |
|
177 | - $_className = 'Block_' . preg_replace('![^\w]+!', '_', uniqid(rand(), true)); |
|
178 | - // get compiled block code |
|
179 | - $_functionCode = $compiler->parser->current_buffer; |
|
180 | - // setup buffer for template function code |
|
181 | - $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); |
|
154 | + /** |
|
155 | + * Compiles code for the {/block} tag |
|
156 | + * |
|
157 | + * @param array $args array with attributes from parser |
|
158 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
159 | + * @param array $parameter array with compilation parameter |
|
160 | + * |
|
161 | + * @return bool true |
|
162 | + */ |
|
163 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
164 | + { |
|
165 | + list($_attr, $_nocache, $_buffer, $_has_nocache_code, $_caching) = $this->closeTag($compiler, array('block')); |
|
166 | + // init block parameter |
|
167 | + $_block = $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ]; |
|
168 | + unset($compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ]); |
|
169 | + $_name = $_attr[ 'name' ]; |
|
170 | + $_assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : null; |
|
171 | + unset($_attr[ 'assign' ], $_attr[ 'name' ]); |
|
172 | + foreach ($_attr as $name => $stat) { |
|
173 | + if ((is_bool($stat) && $stat !== false) || (!is_bool($stat) && $stat != 'false')) { |
|
174 | + $_block[ $name ] = 'true'; |
|
175 | + } |
|
176 | + } |
|
177 | + $_className = 'Block_' . preg_replace('![^\w]+!', '_', uniqid(rand(), true)); |
|
178 | + // get compiled block code |
|
179 | + $_functionCode = $compiler->parser->current_buffer; |
|
180 | + // setup buffer for template function code |
|
181 | + $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); |
|
182 | 182 | |
183 | - $output = "<?php\n"; |
|
184 | - $output .= "/* {block {$_name}} */\n"; |
|
185 | - $output .= "class {$_className} extends Smarty_Internal_Block\n"; |
|
186 | - $output .= "{\n"; |
|
187 | - foreach ($_block as $property => $value) { |
|
188 | - $output .= "public \${$property} = {$value};\n"; |
|
189 | - } |
|
190 | - $output .= "public function callBlock(Smarty_Internal_Template \$_smarty_tpl) {\n"; |
|
191 | - if ($compiler->template->compiled->has_nocache_code) { |
|
192 | - $output .= "\$_smarty_tpl->cached->hashes['{$compiler->template->compiled->nocache_hash}'] = true;\n"; |
|
193 | - } |
|
194 | - if (isset($_assign)) { |
|
195 | - $output .= "ob_start();\n"; |
|
196 | - } |
|
197 | - $output .= "?>\n"; |
|
198 | - $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
199 | - new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
200 | - $output)); |
|
201 | - $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode); |
|
202 | - $output = "<?php\n"; |
|
203 | - if (isset($_assign)) { |
|
204 | - $output .= "\$_smarty_tpl->assign({$_assign}, ob_get_clean());\n"; |
|
205 | - } |
|
206 | - $output .= "}\n"; |
|
207 | - $output .= "}\n"; |
|
208 | - $output .= "/* {/block {$_name}} */\n\n"; |
|
209 | - $output .= "?>\n"; |
|
210 | - $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
211 | - new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
212 | - $output)); |
|
213 | - $compiler->blockOrFunctionCode .= $f = $compiler->parser->current_buffer->to_smarty_php($compiler->parser); |
|
214 | - $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); |
|
215 | - // nocache plugins must be copied |
|
216 | - if (!empty($compiler->template->compiled->required_plugins[ 'nocache' ])) { |
|
217 | - foreach ($compiler->template->compiled->required_plugins[ 'nocache' ] as $plugin => $tmp) { |
|
218 | - foreach ($tmp as $type => $data) { |
|
219 | - $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin ][ $type ] = |
|
220 | - $data; |
|
221 | - } |
|
222 | - } |
|
223 | - } |
|
183 | + $output = "<?php\n"; |
|
184 | + $output .= "/* {block {$_name}} */\n"; |
|
185 | + $output .= "class {$_className} extends Smarty_Internal_Block\n"; |
|
186 | + $output .= "{\n"; |
|
187 | + foreach ($_block as $property => $value) { |
|
188 | + $output .= "public \${$property} = {$value};\n"; |
|
189 | + } |
|
190 | + $output .= "public function callBlock(Smarty_Internal_Template \$_smarty_tpl) {\n"; |
|
191 | + if ($compiler->template->compiled->has_nocache_code) { |
|
192 | + $output .= "\$_smarty_tpl->cached->hashes['{$compiler->template->compiled->nocache_hash}'] = true;\n"; |
|
193 | + } |
|
194 | + if (isset($_assign)) { |
|
195 | + $output .= "ob_start();\n"; |
|
196 | + } |
|
197 | + $output .= "?>\n"; |
|
198 | + $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
199 | + new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
200 | + $output)); |
|
201 | + $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode); |
|
202 | + $output = "<?php\n"; |
|
203 | + if (isset($_assign)) { |
|
204 | + $output .= "\$_smarty_tpl->assign({$_assign}, ob_get_clean());\n"; |
|
205 | + } |
|
206 | + $output .= "}\n"; |
|
207 | + $output .= "}\n"; |
|
208 | + $output .= "/* {/block {$_name}} */\n\n"; |
|
209 | + $output .= "?>\n"; |
|
210 | + $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
211 | + new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
212 | + $output)); |
|
213 | + $compiler->blockOrFunctionCode .= $f = $compiler->parser->current_buffer->to_smarty_php($compiler->parser); |
|
214 | + $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); |
|
215 | + // nocache plugins must be copied |
|
216 | + if (!empty($compiler->template->compiled->required_plugins[ 'nocache' ])) { |
|
217 | + foreach ($compiler->template->compiled->required_plugins[ 'nocache' ] as $plugin => $tmp) { |
|
218 | + foreach ($tmp as $type => $data) { |
|
219 | + $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin ][ $type ] = |
|
220 | + $data; |
|
221 | + } |
|
222 | + } |
|
223 | + } |
|
224 | 224 | |
225 | - // restore old status |
|
226 | - $compiler->template->compiled->has_nocache_code = $_has_nocache_code; |
|
227 | - $compiler->tag_nocache = $compiler->nocache; |
|
228 | - $compiler->nocache = $_nocache; |
|
229 | - $compiler->parser->current_buffer = $_buffer; |
|
230 | - $output = "<?php \n"; |
|
231 | - if ($compiler->_cache[ 'blockNesting' ] == 1) { |
|
232 | - $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name);\n"; |
|
233 | - } else { |
|
234 | - $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name, \$this->tplIndex);\n"; |
|
235 | - } |
|
236 | - $output .= "?>\n"; |
|
237 | - $compiler->_cache[ 'blockNesting' ] --; |
|
238 | - if ($compiler->_cache[ 'blockNesting' ] == 0) { |
|
239 | - unset($compiler->_cache[ 'blockNesting' ]); |
|
240 | - } |
|
241 | - $compiler->has_code = true; |
|
242 | - $compiler->suppressNocacheProcessing = true; |
|
243 | - return $output; |
|
244 | - } |
|
225 | + // restore old status |
|
226 | + $compiler->template->compiled->has_nocache_code = $_has_nocache_code; |
|
227 | + $compiler->tag_nocache = $compiler->nocache; |
|
228 | + $compiler->nocache = $_nocache; |
|
229 | + $compiler->parser->current_buffer = $_buffer; |
|
230 | + $output = "<?php \n"; |
|
231 | + if ($compiler->_cache[ 'blockNesting' ] == 1) { |
|
232 | + $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name);\n"; |
|
233 | + } else { |
|
234 | + $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name, \$this->tplIndex);\n"; |
|
235 | + } |
|
236 | + $output .= "?>\n"; |
|
237 | + $compiler->_cache[ 'blockNesting' ] --; |
|
238 | + if ($compiler->_cache[ 'blockNesting' ] == 0) { |
|
239 | + unset($compiler->_cache[ 'blockNesting' ]); |
|
240 | + } |
|
241 | + $compiler->has_code = true; |
|
242 | + $compiler->suppressNocacheProcessing = true; |
|
243 | + return $output; |
|
244 | + } |
|
245 | 245 | } |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
74 | 74 | { |
75 | - if (!isset($compiler->_cache[ 'blockNesting' ])) { |
|
76 | - $compiler->_cache[ 'blockNesting' ] = 0; |
|
75 | + if (!isset($compiler->_cache['blockNesting'])) { |
|
76 | + $compiler->_cache['blockNesting'] = 0; |
|
77 | 77 | } |
78 | - if ($compiler->_cache[ 'blockNesting' ] == 0) { |
|
78 | + if ($compiler->_cache['blockNesting'] == 0) { |
|
79 | 79 | // make sure that inheritance gets initialized in template code |
80 | 80 | $this->registerInit($compiler); |
81 | 81 | $this->option_flags = array('hide', 'nocache', 'append', 'prepend'); |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | } |
85 | 85 | // check and get attributes |
86 | 86 | $_attr = $this->getAttributes($compiler, $args); |
87 | - $compiler->_cache[ 'blockNesting' ] ++; |
|
88 | - $compiler->_cache[ 'blockName' ][ $compiler->_cache[ 'blockNesting' ] ] = $_attr[ 'name' ]; |
|
89 | - $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ] = array(); |
|
87 | + $compiler->_cache['blockNesting']++; |
|
88 | + $compiler->_cache['blockName'][$compiler->_cache['blockNesting']] = $_attr['name']; |
|
89 | + $compiler->_cache['blockParams'][$compiler->_cache['blockNesting']] = array(); |
|
90 | 90 | $this->openTag($compiler, 'block', array($_attr, $compiler->nocache, $compiler->parser->current_buffer, |
91 | 91 | $compiler->template->compiled->has_nocache_code, |
92 | 92 | $compiler->template->caching)); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $i = 0; |
96 | 96 | } |
97 | 97 | $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; |
98 | - if ($_attr[ 'nocache' ] === true) { |
|
98 | + if ($_attr['nocache'] === true) { |
|
99 | 99 | |
100 | 100 | } |
101 | 101 | $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | */ |
114 | 114 | static function compileChildBlock(Smarty_Internal_TemplateCompilerBase $compiler, $_name = null) |
115 | 115 | { |
116 | - if (!isset($compiler->_cache[ 'blockNesting' ])) { |
|
116 | + if (!isset($compiler->_cache['blockNesting'])) { |
|
117 | 117 | $compiler->trigger_template_error(' tag {$smarty.block.child} used outside {block} tags ', |
118 | 118 | $compiler->parser->lex->taglineno); |
119 | 119 | } |
120 | 120 | $compiler->has_code = true; |
121 | 121 | $compiler->suppressNocacheProcessing = true; |
122 | - $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ][ 'callsChild' ] = 'true'; |
|
122 | + $compiler->_cache['blockParams'][$compiler->_cache['blockNesting']]['callsChild'] = 'true'; |
|
123 | 123 | $output = "<?php \n\$_smarty_tpl->inheritance->callChild(\$_smarty_tpl, \$this);\n?>\n"; |
124 | 124 | return $output; |
125 | 125 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | static function compileParentBlock(Smarty_Internal_TemplateCompilerBase $compiler, $_name = null) |
136 | 136 | { |
137 | - if (!isset($compiler->_cache[ 'blockNesting' ])) { |
|
137 | + if (!isset($compiler->_cache['blockNesting'])) { |
|
138 | 138 | $compiler->trigger_template_error(' tag {$smarty.block.parent} used outside {block} tags ', |
139 | 139 | $compiler->parser->lex->taglineno); |
140 | 140 | } |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | { |
165 | 165 | list($_attr, $_nocache, $_buffer, $_has_nocache_code, $_caching) = $this->closeTag($compiler, array('block')); |
166 | 166 | // init block parameter |
167 | - $_block = $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ]; |
|
168 | - unset($compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ]); |
|
169 | - $_name = $_attr[ 'name' ]; |
|
170 | - $_assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : null; |
|
171 | - unset($_attr[ 'assign' ], $_attr[ 'name' ]); |
|
167 | + $_block = $compiler->_cache['blockParams'][$compiler->_cache['blockNesting']]; |
|
168 | + unset($compiler->_cache['blockParams'][$compiler->_cache['blockNesting']]); |
|
169 | + $_name = $_attr['name']; |
|
170 | + $_assign = isset($_attr['assign']) ? $_attr['assign'] : null; |
|
171 | + unset($_attr['assign'], $_attr['name']); |
|
172 | 172 | foreach ($_attr as $name => $stat) { |
173 | 173 | if ((is_bool($stat) && $stat !== false) || (!is_bool($stat) && $stat != 'false')) { |
174 | - $_block[ $name ] = 'true'; |
|
174 | + $_block[$name] = 'true'; |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | $_className = 'Block_' . preg_replace('![^\w]+!', '_', uniqid(rand(), true)); |
@@ -213,10 +213,10 @@ discard block |
||
213 | 213 | $compiler->blockOrFunctionCode .= $f = $compiler->parser->current_buffer->to_smarty_php($compiler->parser); |
214 | 214 | $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); |
215 | 215 | // nocache plugins must be copied |
216 | - if (!empty($compiler->template->compiled->required_plugins[ 'nocache' ])) { |
|
217 | - foreach ($compiler->template->compiled->required_plugins[ 'nocache' ] as $plugin => $tmp) { |
|
216 | + if (!empty($compiler->template->compiled->required_plugins['nocache'])) { |
|
217 | + foreach ($compiler->template->compiled->required_plugins['nocache'] as $plugin => $tmp) { |
|
218 | 218 | foreach ($tmp as $type => $data) { |
219 | - $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin ][ $type ] = |
|
219 | + $compiler->parent_compiler->template->compiled->required_plugins['compiled'][$plugin][$type] = |
|
220 | 220 | $data; |
221 | 221 | } |
222 | 222 | } |
@@ -228,15 +228,15 @@ discard block |
||
228 | 228 | $compiler->nocache = $_nocache; |
229 | 229 | $compiler->parser->current_buffer = $_buffer; |
230 | 230 | $output = "<?php \n"; |
231 | - if ($compiler->_cache[ 'blockNesting' ] == 1) { |
|
231 | + if ($compiler->_cache['blockNesting'] == 1) { |
|
232 | 232 | $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name);\n"; |
233 | 233 | } else { |
234 | 234 | $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name, \$this->tplIndex);\n"; |
235 | 235 | } |
236 | 236 | $output .= "?>\n"; |
237 | - $compiler->_cache[ 'blockNesting' ] --; |
|
238 | - if ($compiler->_cache[ 'blockNesting' ] == 0) { |
|
239 | - unset($compiler->_cache[ 'blockNesting' ]); |
|
237 | + $compiler->_cache['blockNesting']--; |
|
238 | + if ($compiler->_cache['blockNesting'] == 0) { |
|
239 | + unset($compiler->_cache['blockNesting']); |
|
240 | 240 | } |
241 | 241 | $compiler->has_code = true; |
242 | 242 | $compiler->suppressNocacheProcessing = true; |
@@ -119,7 +119,7 @@ |
||
119 | 119 | /** |
120 | 120 | * Create source code for {extends} from source components array |
121 | 121 | * |
122 | - * @param []\Smarty_Internal_Template_Source $components |
|
122 | + * @param Smarty_Template_Source[] $components |
|
123 | 123 | * |
124 | 124 | * @return string |
125 | 125 | */ |
@@ -17,118 +17,118 @@ |
||
17 | 17 | */ |
18 | 18 | class Smarty_Internal_Compile_Extends extends Smarty_Internal_Compile_Shared_Inheritance |
19 | 19 | { |
20 | - /** |
|
21 | - * Attribute definition: Overwrites base class. |
|
22 | - * |
|
23 | - * @var array |
|
24 | - * @see Smarty_Internal_CompileBase |
|
25 | - */ |
|
26 | - public $required_attributes = array('file'); |
|
20 | + /** |
|
21 | + * Attribute definition: Overwrites base class. |
|
22 | + * |
|
23 | + * @var array |
|
24 | + * @see Smarty_Internal_CompileBase |
|
25 | + */ |
|
26 | + public $required_attributes = array('file'); |
|
27 | 27 | |
28 | - /** |
|
29 | - * Array of names of optional attribute required by tag |
|
30 | - * use array('_any') if there is no restriction of attributes names |
|
31 | - * |
|
32 | - * @var array |
|
33 | - */ |
|
34 | - public $optional_attributes = array('extends_resource'); |
|
28 | + /** |
|
29 | + * Array of names of optional attribute required by tag |
|
30 | + * use array('_any') if there is no restriction of attributes names |
|
31 | + * |
|
32 | + * @var array |
|
33 | + */ |
|
34 | + public $optional_attributes = array('extends_resource'); |
|
35 | 35 | |
36 | - /** |
|
37 | - * Attribute definition: Overwrites base class. |
|
38 | - * |
|
39 | - * @var array |
|
40 | - * @see Smarty_Internal_CompileBase |
|
41 | - */ |
|
42 | - public $shorttag_order = array('file'); |
|
36 | + /** |
|
37 | + * Attribute definition: Overwrites base class. |
|
38 | + * |
|
39 | + * @var array |
|
40 | + * @see Smarty_Internal_CompileBase |
|
41 | + */ |
|
42 | + public $shorttag_order = array('file'); |
|
43 | 43 | |
44 | - /** |
|
45 | - * Compiles code for the {extends} tag extends: resource |
|
46 | - * |
|
47 | - * @param array $args array with attributes from parser |
|
48 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
49 | - * |
|
50 | - * @return string compiled code |
|
51 | - * @throws \SmartyCompilerException |
|
52 | - * @throws \SmartyException |
|
53 | - */ |
|
54 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) |
|
55 | - { |
|
56 | - // check and get attributes |
|
57 | - $_attr = $this->getAttributes($compiler, $args); |
|
58 | - if ($_attr[ 'nocache' ] === true) { |
|
59 | - $compiler->trigger_template_error('nocache option not allowed', $compiler->parser->lex->line - 1); |
|
60 | - } |
|
61 | - if (strpos($_attr[ 'file' ], '$_tmp') !== false) { |
|
62 | - $compiler->trigger_template_error('illegal value for file attribute', $compiler->parser->lex->line - 1); |
|
63 | - } |
|
64 | - // add code to initialize inheritance |
|
65 | - $this->registerInit($compiler, true); |
|
66 | - $file = trim($_attr[ 'file' ], '\'"'); |
|
67 | - if (strlen($file) > 8 && substr($file, 0, 8) == 'extends:') { |
|
68 | - // generate code for each template |
|
69 | - $files = array_reverse(explode('|', substr($file, 8))); |
|
70 | - $i = 0; |
|
71 | - foreach ($files as $file) { |
|
72 | - if ($file[ 0 ] == '"') { |
|
73 | - $file = trim($file, '".'); |
|
74 | - } else { |
|
75 | - $file = "'{$file}'"; |
|
76 | - } |
|
77 | - $i ++; |
|
78 | - if ($i == count($files) && isset($_attr[ 'extends_resource' ])) { |
|
79 | - $this->compileEndChild($compiler); |
|
80 | - } |
|
81 | - $this->compileInclude($compiler, $file); |
|
82 | - } |
|
83 | - if (!isset($_attr[ 'extends_resource' ])) { |
|
84 | - $this->compileEndChild($compiler); |
|
85 | - } |
|
86 | - } else { |
|
87 | - $this->compileEndChild($compiler); |
|
88 | - $this->compileInclude($compiler, $_attr[ 'file' ]); |
|
89 | - } |
|
90 | - $compiler->has_code = false; |
|
91 | - return ''; |
|
92 | - } |
|
44 | + /** |
|
45 | + * Compiles code for the {extends} tag extends: resource |
|
46 | + * |
|
47 | + * @param array $args array with attributes from parser |
|
48 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
49 | + * |
|
50 | + * @return string compiled code |
|
51 | + * @throws \SmartyCompilerException |
|
52 | + * @throws \SmartyException |
|
53 | + */ |
|
54 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) |
|
55 | + { |
|
56 | + // check and get attributes |
|
57 | + $_attr = $this->getAttributes($compiler, $args); |
|
58 | + if ($_attr[ 'nocache' ] === true) { |
|
59 | + $compiler->trigger_template_error('nocache option not allowed', $compiler->parser->lex->line - 1); |
|
60 | + } |
|
61 | + if (strpos($_attr[ 'file' ], '$_tmp') !== false) { |
|
62 | + $compiler->trigger_template_error('illegal value for file attribute', $compiler->parser->lex->line - 1); |
|
63 | + } |
|
64 | + // add code to initialize inheritance |
|
65 | + $this->registerInit($compiler, true); |
|
66 | + $file = trim($_attr[ 'file' ], '\'"'); |
|
67 | + if (strlen($file) > 8 && substr($file, 0, 8) == 'extends:') { |
|
68 | + // generate code for each template |
|
69 | + $files = array_reverse(explode('|', substr($file, 8))); |
|
70 | + $i = 0; |
|
71 | + foreach ($files as $file) { |
|
72 | + if ($file[ 0 ] == '"') { |
|
73 | + $file = trim($file, '".'); |
|
74 | + } else { |
|
75 | + $file = "'{$file}'"; |
|
76 | + } |
|
77 | + $i ++; |
|
78 | + if ($i == count($files) && isset($_attr[ 'extends_resource' ])) { |
|
79 | + $this->compileEndChild($compiler); |
|
80 | + } |
|
81 | + $this->compileInclude($compiler, $file); |
|
82 | + } |
|
83 | + if (!isset($_attr[ 'extends_resource' ])) { |
|
84 | + $this->compileEndChild($compiler); |
|
85 | + } |
|
86 | + } else { |
|
87 | + $this->compileEndChild($compiler); |
|
88 | + $this->compileInclude($compiler, $_attr[ 'file' ]); |
|
89 | + } |
|
90 | + $compiler->has_code = false; |
|
91 | + return ''; |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * Add code for inheritance endChild() method to end of template |
|
96 | - * |
|
97 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler |
|
98 | - */ |
|
99 | - private function compileEndChild(Smarty_Internal_TemplateCompilerBase $compiler) |
|
100 | - { |
|
101 | - $compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
102 | - "<?php \$_smarty_tpl->inheritance->endChild();\n?>\n"); |
|
103 | - } |
|
94 | + /** |
|
95 | + * Add code for inheritance endChild() method to end of template |
|
96 | + * |
|
97 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler |
|
98 | + */ |
|
99 | + private function compileEndChild(Smarty_Internal_TemplateCompilerBase $compiler) |
|
100 | + { |
|
101 | + $compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
102 | + "<?php \$_smarty_tpl->inheritance->endChild();\n?>\n"); |
|
103 | + } |
|
104 | 104 | |
105 | - /** |
|
106 | - * Add code for including subtemplate to end of template |
|
107 | - * |
|
108 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler |
|
109 | - * @param string $file subtemplate name |
|
110 | - */ |
|
111 | - private function compileInclude(Smarty_Internal_TemplateCompilerBase $compiler, $file) |
|
112 | - { |
|
113 | - $compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
114 | - $compiler->compileTag('include', |
|
115 | - array($file, |
|
116 | - array('scope' => 'parent')))); |
|
117 | - } |
|
105 | + /** |
|
106 | + * Add code for including subtemplate to end of template |
|
107 | + * |
|
108 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler |
|
109 | + * @param string $file subtemplate name |
|
110 | + */ |
|
111 | + private function compileInclude(Smarty_Internal_TemplateCompilerBase $compiler, $file) |
|
112 | + { |
|
113 | + $compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
114 | + $compiler->compileTag('include', |
|
115 | + array($file, |
|
116 | + array('scope' => 'parent')))); |
|
117 | + } |
|
118 | 118 | |
119 | - /** |
|
120 | - * Create source code for {extends} from source components array |
|
121 | - * |
|
122 | - * @param []\Smarty_Internal_Template_Source $components |
|
123 | - * |
|
124 | - * @return string |
|
125 | - */ |
|
126 | - public static function extendsSourceArrayCode($components) |
|
127 | - { |
|
128 | - $resources = array(); |
|
129 | - foreach ($components as $source) { |
|
130 | - $resources[] = $source->resource; |
|
131 | - } |
|
132 | - return '{extends file=\'extends:' . join('|', $resources) . '\' extends_resource=true}'; |
|
133 | - } |
|
119 | + /** |
|
120 | + * Create source code for {extends} from source components array |
|
121 | + * |
|
122 | + * @param []\Smarty_Internal_Template_Source $components |
|
123 | + * |
|
124 | + * @return string |
|
125 | + */ |
|
126 | + public static function extendsSourceArrayCode($components) |
|
127 | + { |
|
128 | + $resources = array(); |
|
129 | + foreach ($components as $source) { |
|
130 | + $resources[] = $source->resource; |
|
131 | + } |
|
132 | + return '{extends file=\'extends:' . join('|', $resources) . '\' extends_resource=true}'; |
|
133 | + } |
|
134 | 134 | } |
@@ -55,37 +55,37 @@ |
||
55 | 55 | { |
56 | 56 | // check and get attributes |
57 | 57 | $_attr = $this->getAttributes($compiler, $args); |
58 | - if ($_attr[ 'nocache' ] === true) { |
|
58 | + if ($_attr['nocache'] === true) { |
|
59 | 59 | $compiler->trigger_template_error('nocache option not allowed', $compiler->parser->lex->line - 1); |
60 | 60 | } |
61 | - if (strpos($_attr[ 'file' ], '$_tmp') !== false) { |
|
61 | + if (strpos($_attr['file'], '$_tmp') !== false) { |
|
62 | 62 | $compiler->trigger_template_error('illegal value for file attribute', $compiler->parser->lex->line - 1); |
63 | 63 | } |
64 | 64 | // add code to initialize inheritance |
65 | 65 | $this->registerInit($compiler, true); |
66 | - $file = trim($_attr[ 'file' ], '\'"'); |
|
66 | + $file = trim($_attr['file'], '\'"'); |
|
67 | 67 | if (strlen($file) > 8 && substr($file, 0, 8) == 'extends:') { |
68 | 68 | // generate code for each template |
69 | 69 | $files = array_reverse(explode('|', substr($file, 8))); |
70 | 70 | $i = 0; |
71 | 71 | foreach ($files as $file) { |
72 | - if ($file[ 0 ] == '"') { |
|
72 | + if ($file[0] == '"') { |
|
73 | 73 | $file = trim($file, '".'); |
74 | 74 | } else { |
75 | 75 | $file = "'{$file}'"; |
76 | 76 | } |
77 | - $i ++; |
|
78 | - if ($i == count($files) && isset($_attr[ 'extends_resource' ])) { |
|
77 | + $i++; |
|
78 | + if ($i == count($files) && isset($_attr['extends_resource'])) { |
|
79 | 79 | $this->compileEndChild($compiler); |
80 | 80 | } |
81 | 81 | $this->compileInclude($compiler, $file); |
82 | 82 | } |
83 | - if (!isset($_attr[ 'extends_resource' ])) { |
|
83 | + if (!isset($_attr['extends_resource'])) { |
|
84 | 84 | $this->compileEndChild($compiler); |
85 | 85 | } |
86 | 86 | } else { |
87 | 87 | $this->compileEndChild($compiler); |
88 | - $this->compileInclude($compiler, $_attr[ 'file' ]); |
|
88 | + $this->compileInclude($compiler, $_attr['file']); |
|
89 | 89 | } |
90 | 90 | $compiler->has_code = false; |
91 | 91 | return ''; |
@@ -92,7 +92,7 @@ |
||
92 | 92 | * Compiles code for the {/function} tag |
93 | 93 | * |
94 | 94 | * @param array $args array with attributes from parser |
95 | - * @param object|\Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
95 | + * @param Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
96 | 96 | * @param array $parameter array with compilation parameter |
97 | 97 | * |
98 | 98 | * @return bool true |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | // check and get attributes |
57 | 57 | $_attr = $this->getAttributes($compiler, $args); |
58 | 58 | |
59 | - if ($_attr[ 'nocache' ] === true) { |
|
59 | + if ($_attr['nocache'] === true) { |
|
60 | 60 | $compiler->trigger_template_error('nocache option not allowed', null, true); |
61 | 61 | } |
62 | - unset($_attr[ 'nocache' ]); |
|
63 | - $_name = trim($_attr[ 'name' ], "'\""); |
|
64 | - $compiler->parent_compiler->tpl_function[ $_name ] = array(); |
|
62 | + unset($_attr['nocache']); |
|
63 | + $_name = trim($_attr['name'], "'\""); |
|
64 | + $compiler->parent_compiler->tpl_function[$_name] = array(); |
|
65 | 65 | $save = array($_attr, $compiler->parser->current_buffer, $compiler->template->compiled->has_nocache_code, |
66 | 66 | $compiler->template->caching); |
67 | 67 | $this->openTag($compiler, 'function', $save); |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | { |
102 | 102 | $this->compiler = $compiler; |
103 | 103 | $saved_data = $this->closeTag($compiler, array('function')); |
104 | - $_attr = $saved_data[ 0 ]; |
|
105 | - $_name = trim($_attr[ 'name' ], "'\""); |
|
106 | - $compiler->parent_compiler->tpl_function[ $_name ][ 'compiled_filepath' ] = |
|
104 | + $_attr = $saved_data[0]; |
|
105 | + $_name = trim($_attr['name'], "'\""); |
|
106 | + $compiler->parent_compiler->tpl_function[$_name]['compiled_filepath'] = |
|
107 | 107 | $compiler->parent_compiler->template->compiled->filepath; |
108 | - $compiler->parent_compiler->tpl_function[ $_name ][ 'uid' ] = $compiler->template->source->uid; |
|
108 | + $compiler->parent_compiler->tpl_function[$_name]['uid'] = $compiler->template->source->uid; |
|
109 | 109 | $_parameter = $_attr; |
110 | - unset($_parameter[ 'name' ]); |
|
110 | + unset($_parameter['name']); |
|
111 | 111 | // default parameter |
112 | 112 | $_paramsArray = array(); |
113 | 113 | foreach ($_parameter as $_key => $_value) { |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $_funcName = "smarty_template_function_{$_name}_{$compiler->template->compiled->nocache_hash}"; |
131 | 131 | $_funcNameCaching = $_funcName . '_nocache'; |
132 | 132 | if ($compiler->template->compiled->has_nocache_code) { |
133 | - $compiler->parent_compiler->tpl_function[ $_name ][ 'call_name_caching' ] = $_funcNameCaching; |
|
133 | + $compiler->parent_compiler->tpl_function[$_name]['call_name_caching'] = $_funcNameCaching; |
|
134 | 134 | $output = "<?php\n"; |
135 | 135 | $output .= "/* {$_funcNameCaching} */\n"; |
136 | 136 | $output .= "if (!function_exists('{$_funcNameCaching}')) {\n"; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | array($this, 'removeNocache'), |
163 | 163 | $_functionCode->to_smarty_php($compiler->parser))); |
164 | 164 | } |
165 | - $compiler->parent_compiler->tpl_function[ $_name ][ 'call_name' ] = $_funcName; |
|
165 | + $compiler->parent_compiler->tpl_function[$_name]['call_name'] = $_funcName; |
|
166 | 166 | $output = "<?php\n"; |
167 | 167 | $output .= "/* {$_funcName} */\n"; |
168 | 168 | $output .= "if (!function_exists('{$_funcName}')) {\n"; |
@@ -181,20 +181,20 @@ discard block |
||
181 | 181 | $output)); |
182 | 182 | $compiler->parent_compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser); |
183 | 183 | // nocache plugins must be copied |
184 | - if (!empty($compiler->template->compiled->required_plugins[ 'nocache' ])) { |
|
185 | - foreach ($compiler->template->compiled->required_plugins[ 'nocache' ] as $plugin => $tmp) { |
|
184 | + if (!empty($compiler->template->compiled->required_plugins['nocache'])) { |
|
185 | + foreach ($compiler->template->compiled->required_plugins['nocache'] as $plugin => $tmp) { |
|
186 | 186 | foreach ($tmp as $type => $data) { |
187 | - $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin ][ $type ] = |
|
187 | + $compiler->parent_compiler->template->compiled->required_plugins['compiled'][$plugin][$type] = |
|
188 | 188 | $data; |
189 | 189 | } |
190 | 190 | } |
191 | 191 | } |
192 | 192 | // restore old buffer |
193 | 193 | |
194 | - $compiler->parser->current_buffer = $saved_data[ 1 ]; |
|
194 | + $compiler->parser->current_buffer = $saved_data[1]; |
|
195 | 195 | // restore old status |
196 | - $compiler->template->compiled->has_nocache_code = $saved_data[ 2 ]; |
|
197 | - $compiler->template->caching = $saved_data[ 3 ]; |
|
196 | + $compiler->template->compiled->has_nocache_code = $saved_data[2]; |
|
197 | + $compiler->template->caching = $saved_data[3]; |
|
198 | 198 | return true; |
199 | 199 | } |
200 | 200 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | { |
210 | 210 | $code = |
211 | 211 | preg_replace("/((<\?php )?echo '\/\*%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/)|(\/\*\/%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", |
212 | - '', $match[ 0 ]); |
|
212 | + '', $match[0]); |
|
213 | 213 | $code = str_replace(array('\\\'', '\\\\\''), array('\'', '\\\''), $code); |
214 | 214 | return $code; |
215 | 215 | } |
@@ -17,59 +17,59 @@ discard block |
||
17 | 17 | class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * Attribute definition: Overwrites base class. |
|
22 | - * |
|
23 | - * @var array |
|
24 | - * @see Smarty_Internal_CompileBase |
|
25 | - */ |
|
26 | - public $required_attributes = array('name'); |
|
20 | + /** |
|
21 | + * Attribute definition: Overwrites base class. |
|
22 | + * |
|
23 | + * @var array |
|
24 | + * @see Smarty_Internal_CompileBase |
|
25 | + */ |
|
26 | + public $required_attributes = array('name'); |
|
27 | 27 | |
28 | - /** |
|
29 | - * Attribute definition: Overwrites base class. |
|
30 | - * |
|
31 | - * @var array |
|
32 | - * @see Smarty_Internal_CompileBase |
|
33 | - */ |
|
34 | - public $shorttag_order = array('name'); |
|
28 | + /** |
|
29 | + * Attribute definition: Overwrites base class. |
|
30 | + * |
|
31 | + * @var array |
|
32 | + * @see Smarty_Internal_CompileBase |
|
33 | + */ |
|
34 | + public $shorttag_order = array('name'); |
|
35 | 35 | |
36 | - /** |
|
37 | - * Attribute definition: Overwrites base class. |
|
38 | - * |
|
39 | - * @var array |
|
40 | - * @see Smarty_Internal_CompileBase |
|
41 | - */ |
|
42 | - public $optional_attributes = array('_any'); |
|
36 | + /** |
|
37 | + * Attribute definition: Overwrites base class. |
|
38 | + * |
|
39 | + * @var array |
|
40 | + * @see Smarty_Internal_CompileBase |
|
41 | + */ |
|
42 | + public $optional_attributes = array('_any'); |
|
43 | 43 | |
44 | - /** |
|
45 | - * Compiles code for the {function} tag |
|
46 | - * |
|
47 | - * @param array $args array with attributes from parser |
|
48 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
49 | - * @param array $parameter array with compilation parameter |
|
50 | - * |
|
51 | - * @return bool true |
|
52 | - * @throws \SmartyCompilerException |
|
53 | - */ |
|
54 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
55 | - { |
|
56 | - // check and get attributes |
|
57 | - $_attr = $this->getAttributes($compiler, $args); |
|
44 | + /** |
|
45 | + * Compiles code for the {function} tag |
|
46 | + * |
|
47 | + * @param array $args array with attributes from parser |
|
48 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
49 | + * @param array $parameter array with compilation parameter |
|
50 | + * |
|
51 | + * @return bool true |
|
52 | + * @throws \SmartyCompilerException |
|
53 | + */ |
|
54 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
55 | + { |
|
56 | + // check and get attributes |
|
57 | + $_attr = $this->getAttributes($compiler, $args); |
|
58 | 58 | |
59 | - if ($_attr[ 'nocache' ] === true) { |
|
60 | - $compiler->trigger_template_error('nocache option not allowed', null, true); |
|
61 | - } |
|
62 | - unset($_attr[ 'nocache' ]); |
|
63 | - $_name = trim($_attr[ 'name' ], "'\""); |
|
64 | - $compiler->parent_compiler->tpl_function[ $_name ] = array(); |
|
65 | - $save = array($_attr, $compiler->parser->current_buffer, $compiler->template->compiled->has_nocache_code, |
|
66 | - $compiler->template->caching); |
|
67 | - $this->openTag($compiler, 'function', $save); |
|
68 | - // Init temporary context |
|
69 | - $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); |
|
70 | - $compiler->template->compiled->has_nocache_code = false; |
|
71 | - return true; |
|
72 | - } |
|
59 | + if ($_attr[ 'nocache' ] === true) { |
|
60 | + $compiler->trigger_template_error('nocache option not allowed', null, true); |
|
61 | + } |
|
62 | + unset($_attr[ 'nocache' ]); |
|
63 | + $_name = trim($_attr[ 'name' ], "'\""); |
|
64 | + $compiler->parent_compiler->tpl_function[ $_name ] = array(); |
|
65 | + $save = array($_attr, $compiler->parser->current_buffer, $compiler->template->compiled->has_nocache_code, |
|
66 | + $compiler->template->caching); |
|
67 | + $this->openTag($compiler, 'function', $save); |
|
68 | + // Init temporary context |
|
69 | + $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); |
|
70 | + $compiler->template->compiled->has_nocache_code = false; |
|
71 | + return true; |
|
72 | + } |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -81,136 +81,136 @@ discard block |
||
81 | 81 | class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase |
82 | 82 | { |
83 | 83 | |
84 | - /** |
|
85 | - * Compiler object |
|
86 | - * |
|
87 | - * @var object |
|
88 | - */ |
|
89 | - private $compiler = null; |
|
84 | + /** |
|
85 | + * Compiler object |
|
86 | + * |
|
87 | + * @var object |
|
88 | + */ |
|
89 | + private $compiler = null; |
|
90 | 90 | |
91 | - /** |
|
92 | - * Compiles code for the {/function} tag |
|
93 | - * |
|
94 | - * @param array $args array with attributes from parser |
|
95 | - * @param object|\Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
96 | - * @param array $parameter array with compilation parameter |
|
97 | - * |
|
98 | - * @return bool true |
|
99 | - */ |
|
100 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
101 | - { |
|
102 | - $this->compiler = $compiler; |
|
103 | - $saved_data = $this->closeTag($compiler, array('function')); |
|
104 | - $_attr = $saved_data[ 0 ]; |
|
105 | - $_name = trim($_attr[ 'name' ], "'\""); |
|
106 | - $compiler->parent_compiler->tpl_function[ $_name ][ 'compiled_filepath' ] = |
|
107 | - $compiler->parent_compiler->template->compiled->filepath; |
|
108 | - $compiler->parent_compiler->tpl_function[ $_name ][ 'uid' ] = $compiler->template->source->uid; |
|
109 | - $_parameter = $_attr; |
|
110 | - unset($_parameter[ 'name' ]); |
|
111 | - // default parameter |
|
112 | - $_paramsArray = array(); |
|
113 | - foreach ($_parameter as $_key => $_value) { |
|
114 | - if (is_int($_key)) { |
|
115 | - $_paramsArray[] = "$_key=>$_value"; |
|
116 | - } else { |
|
117 | - $_paramsArray[] = "'$_key'=>$_value"; |
|
118 | - } |
|
119 | - } |
|
120 | - if (!empty($_paramsArray)) { |
|
121 | - $_params = 'array(' . implode(",", $_paramsArray) . ')'; |
|
122 | - $_paramsCode = "\$params = array_merge($_params, \$params);\n"; |
|
123 | - } else { |
|
124 | - $_paramsCode = ''; |
|
125 | - } |
|
126 | - $_functionCode = $compiler->parser->current_buffer; |
|
127 | - // setup buffer for template function code |
|
128 | - $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); |
|
91 | + /** |
|
92 | + * Compiles code for the {/function} tag |
|
93 | + * |
|
94 | + * @param array $args array with attributes from parser |
|
95 | + * @param object|\Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
96 | + * @param array $parameter array with compilation parameter |
|
97 | + * |
|
98 | + * @return bool true |
|
99 | + */ |
|
100 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
101 | + { |
|
102 | + $this->compiler = $compiler; |
|
103 | + $saved_data = $this->closeTag($compiler, array('function')); |
|
104 | + $_attr = $saved_data[ 0 ]; |
|
105 | + $_name = trim($_attr[ 'name' ], "'\""); |
|
106 | + $compiler->parent_compiler->tpl_function[ $_name ][ 'compiled_filepath' ] = |
|
107 | + $compiler->parent_compiler->template->compiled->filepath; |
|
108 | + $compiler->parent_compiler->tpl_function[ $_name ][ 'uid' ] = $compiler->template->source->uid; |
|
109 | + $_parameter = $_attr; |
|
110 | + unset($_parameter[ 'name' ]); |
|
111 | + // default parameter |
|
112 | + $_paramsArray = array(); |
|
113 | + foreach ($_parameter as $_key => $_value) { |
|
114 | + if (is_int($_key)) { |
|
115 | + $_paramsArray[] = "$_key=>$_value"; |
|
116 | + } else { |
|
117 | + $_paramsArray[] = "'$_key'=>$_value"; |
|
118 | + } |
|
119 | + } |
|
120 | + if (!empty($_paramsArray)) { |
|
121 | + $_params = 'array(' . implode(",", $_paramsArray) . ')'; |
|
122 | + $_paramsCode = "\$params = array_merge($_params, \$params);\n"; |
|
123 | + } else { |
|
124 | + $_paramsCode = ''; |
|
125 | + } |
|
126 | + $_functionCode = $compiler->parser->current_buffer; |
|
127 | + // setup buffer for template function code |
|
128 | + $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); |
|
129 | 129 | |
130 | - $_funcName = "smarty_template_function_{$_name}_{$compiler->template->compiled->nocache_hash}"; |
|
131 | - $_funcNameCaching = $_funcName . '_nocache'; |
|
132 | - if ($compiler->template->compiled->has_nocache_code) { |
|
133 | - $compiler->parent_compiler->tpl_function[ $_name ][ 'call_name_caching' ] = $_funcNameCaching; |
|
134 | - $output = "<?php\n"; |
|
135 | - $output .= "/* {$_funcNameCaching} */\n"; |
|
136 | - $output .= "if (!function_exists('{$_funcNameCaching}')) {\n"; |
|
137 | - $output .= "function {$_funcNameCaching} (\$_smarty_tpl,\$params) {\n"; |
|
138 | - $output .= "ob_start();\n"; |
|
139 | - $output .= "\$_smarty_tpl->compiled->has_nocache_code = true;\n"; |
|
140 | - $output .= $_paramsCode; |
|
141 | - $output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}"; |
|
142 | - $output .= "\$params = var_export(\$params, true);\n"; |
|
143 | - $output .= "echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php "; |
|
144 | - $output .= "\\\$_smarty_tpl->ext->_tplFunction->saveTemplateVariables(\\\$_smarty_tpl, '{$_name}');\nforeach (\$params as \\\$key => \\\$value) {\n\\\$_smarty_tpl->tpl_vars[\\\$key] = new Smarty_Variable(\\\$value, \\\$_smarty_tpl->isRenderingCache);\n}\n?>"; |
|
145 | - $output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\n\";?>"; |
|
146 | - $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
147 | - new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
148 | - $output)); |
|
149 | - $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode); |
|
150 | - $output = "<?php echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php "; |
|
151 | - $output .= "\\\$_smarty_tpl->ext->_tplFunction->restoreTemplateVariables(\\\$_smarty_tpl, '{$_name}');?>\n"; |
|
152 | - $output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\";\n?>"; |
|
153 | - $output .= "<?php echo str_replace('{$compiler->template->compiled->nocache_hash}', \$_smarty_tpl->compiled->nocache_hash, ob_get_clean());\n"; |
|
154 | - $output .= "}\n}\n"; |
|
155 | - $output .= "/*/ {$_funcName}_nocache */\n\n"; |
|
156 | - $output .= "?>\n"; |
|
157 | - $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
158 | - new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
159 | - $output)); |
|
160 | - $_functionCode = new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
161 | - preg_replace_callback("/((<\?php )?echo '\/\*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/([\S\s]*?)\/\*\/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", |
|
162 | - array($this, 'removeNocache'), |
|
163 | - $_functionCode->to_smarty_php($compiler->parser))); |
|
164 | - } |
|
165 | - $compiler->parent_compiler->tpl_function[ $_name ][ 'call_name' ] = $_funcName; |
|
166 | - $output = "<?php\n"; |
|
167 | - $output .= "/* {$_funcName} */\n"; |
|
168 | - $output .= "if (!function_exists('{$_funcName}')) {\n"; |
|
169 | - $output .= "function {$_funcName}(\$_smarty_tpl,\$params) {\n"; |
|
170 | - $output .= $_paramsCode; |
|
171 | - $output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}?>"; |
|
172 | - $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
173 | - new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
174 | - $output)); |
|
175 | - $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode); |
|
176 | - $output = "<?php\n}}\n"; |
|
177 | - $output .= "/*/ {$_funcName} */\n\n"; |
|
178 | - $output .= "?>\n"; |
|
179 | - $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
180 | - new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
181 | - $output)); |
|
182 | - $compiler->parent_compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser); |
|
183 | - // nocache plugins must be copied |
|
184 | - if (!empty($compiler->template->compiled->required_plugins[ 'nocache' ])) { |
|
185 | - foreach ($compiler->template->compiled->required_plugins[ 'nocache' ] as $plugin => $tmp) { |
|
186 | - foreach ($tmp as $type => $data) { |
|
187 | - $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin ][ $type ] = |
|
188 | - $data; |
|
189 | - } |
|
190 | - } |
|
191 | - } |
|
192 | - // restore old buffer |
|
130 | + $_funcName = "smarty_template_function_{$_name}_{$compiler->template->compiled->nocache_hash}"; |
|
131 | + $_funcNameCaching = $_funcName . '_nocache'; |
|
132 | + if ($compiler->template->compiled->has_nocache_code) { |
|
133 | + $compiler->parent_compiler->tpl_function[ $_name ][ 'call_name_caching' ] = $_funcNameCaching; |
|
134 | + $output = "<?php\n"; |
|
135 | + $output .= "/* {$_funcNameCaching} */\n"; |
|
136 | + $output .= "if (!function_exists('{$_funcNameCaching}')) {\n"; |
|
137 | + $output .= "function {$_funcNameCaching} (\$_smarty_tpl,\$params) {\n"; |
|
138 | + $output .= "ob_start();\n"; |
|
139 | + $output .= "\$_smarty_tpl->compiled->has_nocache_code = true;\n"; |
|
140 | + $output .= $_paramsCode; |
|
141 | + $output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}"; |
|
142 | + $output .= "\$params = var_export(\$params, true);\n"; |
|
143 | + $output .= "echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php "; |
|
144 | + $output .= "\\\$_smarty_tpl->ext->_tplFunction->saveTemplateVariables(\\\$_smarty_tpl, '{$_name}');\nforeach (\$params as \\\$key => \\\$value) {\n\\\$_smarty_tpl->tpl_vars[\\\$key] = new Smarty_Variable(\\\$value, \\\$_smarty_tpl->isRenderingCache);\n}\n?>"; |
|
145 | + $output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\n\";?>"; |
|
146 | + $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
147 | + new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
148 | + $output)); |
|
149 | + $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode); |
|
150 | + $output = "<?php echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php "; |
|
151 | + $output .= "\\\$_smarty_tpl->ext->_tplFunction->restoreTemplateVariables(\\\$_smarty_tpl, '{$_name}');?>\n"; |
|
152 | + $output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\";\n?>"; |
|
153 | + $output .= "<?php echo str_replace('{$compiler->template->compiled->nocache_hash}', \$_smarty_tpl->compiled->nocache_hash, ob_get_clean());\n"; |
|
154 | + $output .= "}\n}\n"; |
|
155 | + $output .= "/*/ {$_funcName}_nocache */\n\n"; |
|
156 | + $output .= "?>\n"; |
|
157 | + $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
158 | + new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
159 | + $output)); |
|
160 | + $_functionCode = new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
161 | + preg_replace_callback("/((<\?php )?echo '\/\*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/([\S\s]*?)\/\*\/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", |
|
162 | + array($this, 'removeNocache'), |
|
163 | + $_functionCode->to_smarty_php($compiler->parser))); |
|
164 | + } |
|
165 | + $compiler->parent_compiler->tpl_function[ $_name ][ 'call_name' ] = $_funcName; |
|
166 | + $output = "<?php\n"; |
|
167 | + $output .= "/* {$_funcName} */\n"; |
|
168 | + $output .= "if (!function_exists('{$_funcName}')) {\n"; |
|
169 | + $output .= "function {$_funcName}(\$_smarty_tpl,\$params) {\n"; |
|
170 | + $output .= $_paramsCode; |
|
171 | + $output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}?>"; |
|
172 | + $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
173 | + new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
174 | + $output)); |
|
175 | + $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode); |
|
176 | + $output = "<?php\n}}\n"; |
|
177 | + $output .= "/*/ {$_funcName} */\n\n"; |
|
178 | + $output .= "?>\n"; |
|
179 | + $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
180 | + new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
181 | + $output)); |
|
182 | + $compiler->parent_compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser); |
|
183 | + // nocache plugins must be copied |
|
184 | + if (!empty($compiler->template->compiled->required_plugins[ 'nocache' ])) { |
|
185 | + foreach ($compiler->template->compiled->required_plugins[ 'nocache' ] as $plugin => $tmp) { |
|
186 | + foreach ($tmp as $type => $data) { |
|
187 | + $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin ][ $type ] = |
|
188 | + $data; |
|
189 | + } |
|
190 | + } |
|
191 | + } |
|
192 | + // restore old buffer |
|
193 | 193 | |
194 | - $compiler->parser->current_buffer = $saved_data[ 1 ]; |
|
195 | - // restore old status |
|
196 | - $compiler->template->compiled->has_nocache_code = $saved_data[ 2 ]; |
|
197 | - $compiler->template->caching = $saved_data[ 3 ]; |
|
198 | - return true; |
|
199 | - } |
|
194 | + $compiler->parser->current_buffer = $saved_data[ 1 ]; |
|
195 | + // restore old status |
|
196 | + $compiler->template->compiled->has_nocache_code = $saved_data[ 2 ]; |
|
197 | + $compiler->template->caching = $saved_data[ 3 ]; |
|
198 | + return true; |
|
199 | + } |
|
200 | 200 | |
201 | - /** |
|
202 | - * Remove nocache code |
|
203 | - * |
|
204 | - * @param $match |
|
205 | - * |
|
206 | - * @return string |
|
207 | - */ |
|
208 | - public function removeNocache($match) |
|
209 | - { |
|
210 | - $code = |
|
211 | - preg_replace("/((<\?php )?echo '\/\*%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/)|(\/\*\/%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", |
|
212 | - '', $match[ 0 ]); |
|
213 | - $code = str_replace(array('\\\'', '\\\\\''), array('\'', '\\\''), $code); |
|
214 | - return $code; |
|
215 | - } |
|
201 | + /** |
|
202 | + * Remove nocache code |
|
203 | + * |
|
204 | + * @param $match |
|
205 | + * |
|
206 | + * @return string |
|
207 | + */ |
|
208 | + public function removeNocache($match) |
|
209 | + { |
|
210 | + $code = |
|
211 | + preg_replace("/((<\?php )?echo '\/\*%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/)|(\/\*\/%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", |
|
212 | + '', $match[ 0 ]); |
|
213 | + $code = str_replace(array('\\\'', '\\\\\''), array('\'', '\\\''), $code); |
|
214 | + return $code; |
|
215 | + } |
|
216 | 216 | } |
@@ -111,7 +111,7 @@ |
||
111 | 111 | * |
112 | 112 | * This code has been moved from lexer here fo easier debugging and maintenance |
113 | 113 | * |
114 | - * @param $lex |
|
114 | + * @param Smarty_Internal_Templatelexer $lex |
|
115 | 115 | */ |
116 | 116 | public function parsePhp($lex) |
117 | 117 | { |
@@ -17,204 +17,204 @@ |
||
17 | 17 | class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * Attribute definition: Overwrites base class. |
|
22 | - * |
|
23 | - * @var array |
|
24 | - * @see Smarty_Internal_CompileBase |
|
25 | - */ |
|
26 | - public $required_attributes = array('code', 'type'); |
|
20 | + /** |
|
21 | + * Attribute definition: Overwrites base class. |
|
22 | + * |
|
23 | + * @var array |
|
24 | + * @see Smarty_Internal_CompileBase |
|
25 | + */ |
|
26 | + public $required_attributes = array('code', 'type'); |
|
27 | 27 | |
28 | - /** |
|
29 | - * Compiles code for generating output from any expression |
|
30 | - * |
|
31 | - * @param array $args array with attributes from parser |
|
32 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
33 | - * @param array $parameter array with compilation parameter |
|
34 | - * |
|
35 | - * @return string |
|
36 | - * @throws \SmartyException |
|
37 | - */ |
|
38 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
39 | - { |
|
40 | - // check and get attributes |
|
41 | - $_attr = $this->getAttributes($compiler, $args); |
|
42 | - $compiler->has_code = false; |
|
43 | - if ($_attr[ 'type' ] == 'xml') { |
|
44 | - $compiler->tag_nocache = true; |
|
45 | - $save = $compiler->template->compiled->has_nocache_code; |
|
46 | - $output = addcslashes($_attr[ 'code' ], "'\\"); |
|
47 | - $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
48 | - new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
49 | - $compiler->processNocacheCode("<?php echo '" . |
|
50 | - $output . |
|
51 | - "';?>", |
|
52 | - true))); |
|
53 | - $compiler->template->compiled->has_nocache_code = $save; |
|
54 | - return ''; |
|
55 | - } |
|
56 | - if ($_attr[ 'type' ] != 'tag') { |
|
57 | - if ($compiler->php_handling == Smarty::PHP_REMOVE) { |
|
58 | - return ''; |
|
59 | - } elseif ($compiler->php_handling == Smarty::PHP_QUOTE) { |
|
60 | - $output = |
|
61 | - preg_replace_callback('#(<\?(?:php|=)?)|(<%)|(<script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*>)|(\?>)|(%>)|(<\/script>)#i', |
|
62 | - array($this, 'quote'), $_attr[ 'code' ]); |
|
63 | - $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
64 | - new Smarty_Internal_ParseTree_Text($output)); |
|
65 | - return ''; |
|
66 | - } elseif ($compiler->php_handling == Smarty::PHP_PASSTHRU || $_attr[ 'type' ] == 'unmatched') { |
|
67 | - $compiler->tag_nocache = true; |
|
68 | - $save = $compiler->template->compiled->has_nocache_code; |
|
69 | - $output = addcslashes($_attr[ 'code' ], "'\\"); |
|
70 | - $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
71 | - new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
72 | - $compiler->processNocacheCode("<?php echo '" . |
|
73 | - $output . |
|
74 | - "';?>", |
|
75 | - true))); |
|
76 | - $compiler->template->compiled->has_nocache_code = $save; |
|
77 | - return ''; |
|
78 | - } elseif ($compiler->php_handling == Smarty::PHP_ALLOW) { |
|
79 | - if (!($compiler->smarty instanceof SmartyBC)) { |
|
80 | - $compiler->trigger_template_error('$smarty->php_handling PHP_ALLOW not allowed. Use SmartyBC to enable it', |
|
81 | - null, true); |
|
82 | - } |
|
83 | - $compiler->has_code = true; |
|
84 | - return $_attr[ 'code' ]; |
|
85 | - } else { |
|
86 | - $compiler->trigger_template_error('Illegal $smarty->php_handling value', null, true); |
|
87 | - } |
|
88 | - } else { |
|
89 | - $compiler->has_code = true; |
|
90 | - if (!($compiler->smarty instanceof SmartyBC)) { |
|
91 | - $compiler->trigger_template_error('{php}{/php} tags not allowed. Use SmartyBC to enable them', null, |
|
92 | - true); |
|
93 | - } |
|
94 | - $ldel = preg_quote($compiler->smarty->left_delimiter, '#'); |
|
95 | - $rdel = preg_quote($compiler->smarty->right_delimiter, '#'); |
|
96 | - preg_match("#^({$ldel}php\\s*)((.)*?)({$rdel})#", $_attr[ 'code' ], $match); |
|
97 | - if (!empty($match[ 2 ])) { |
|
98 | - if ('nocache' == trim($match[ 2 ])) { |
|
99 | - $compiler->tag_nocache = true; |
|
100 | - } else { |
|
101 | - $compiler->trigger_template_error("illegal value of option flag \"{$match[2]}\"", null, true); |
|
102 | - } |
|
103 | - } |
|
104 | - return preg_replace(array("#^{$ldel}\\s*php\\s*(.)*?{$rdel}#", "#{$ldel}\\s*/\\s*php\\s*{$rdel}$#"), |
|
105 | - array('<?php ', '?>'), $_attr[ 'code' ]); |
|
106 | - } |
|
107 | - } |
|
28 | + /** |
|
29 | + * Compiles code for generating output from any expression |
|
30 | + * |
|
31 | + * @param array $args array with attributes from parser |
|
32 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
33 | + * @param array $parameter array with compilation parameter |
|
34 | + * |
|
35 | + * @return string |
|
36 | + * @throws \SmartyException |
|
37 | + */ |
|
38 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
39 | + { |
|
40 | + // check and get attributes |
|
41 | + $_attr = $this->getAttributes($compiler, $args); |
|
42 | + $compiler->has_code = false; |
|
43 | + if ($_attr[ 'type' ] == 'xml') { |
|
44 | + $compiler->tag_nocache = true; |
|
45 | + $save = $compiler->template->compiled->has_nocache_code; |
|
46 | + $output = addcslashes($_attr[ 'code' ], "'\\"); |
|
47 | + $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
48 | + new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
49 | + $compiler->processNocacheCode("<?php echo '" . |
|
50 | + $output . |
|
51 | + "';?>", |
|
52 | + true))); |
|
53 | + $compiler->template->compiled->has_nocache_code = $save; |
|
54 | + return ''; |
|
55 | + } |
|
56 | + if ($_attr[ 'type' ] != 'tag') { |
|
57 | + if ($compiler->php_handling == Smarty::PHP_REMOVE) { |
|
58 | + return ''; |
|
59 | + } elseif ($compiler->php_handling == Smarty::PHP_QUOTE) { |
|
60 | + $output = |
|
61 | + preg_replace_callback('#(<\?(?:php|=)?)|(<%)|(<script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*>)|(\?>)|(%>)|(<\/script>)#i', |
|
62 | + array($this, 'quote'), $_attr[ 'code' ]); |
|
63 | + $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
64 | + new Smarty_Internal_ParseTree_Text($output)); |
|
65 | + return ''; |
|
66 | + } elseif ($compiler->php_handling == Smarty::PHP_PASSTHRU || $_attr[ 'type' ] == 'unmatched') { |
|
67 | + $compiler->tag_nocache = true; |
|
68 | + $save = $compiler->template->compiled->has_nocache_code; |
|
69 | + $output = addcslashes($_attr[ 'code' ], "'\\"); |
|
70 | + $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
71 | + new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
72 | + $compiler->processNocacheCode("<?php echo '" . |
|
73 | + $output . |
|
74 | + "';?>", |
|
75 | + true))); |
|
76 | + $compiler->template->compiled->has_nocache_code = $save; |
|
77 | + return ''; |
|
78 | + } elseif ($compiler->php_handling == Smarty::PHP_ALLOW) { |
|
79 | + if (!($compiler->smarty instanceof SmartyBC)) { |
|
80 | + $compiler->trigger_template_error('$smarty->php_handling PHP_ALLOW not allowed. Use SmartyBC to enable it', |
|
81 | + null, true); |
|
82 | + } |
|
83 | + $compiler->has_code = true; |
|
84 | + return $_attr[ 'code' ]; |
|
85 | + } else { |
|
86 | + $compiler->trigger_template_error('Illegal $smarty->php_handling value', null, true); |
|
87 | + } |
|
88 | + } else { |
|
89 | + $compiler->has_code = true; |
|
90 | + if (!($compiler->smarty instanceof SmartyBC)) { |
|
91 | + $compiler->trigger_template_error('{php}{/php} tags not allowed. Use SmartyBC to enable them', null, |
|
92 | + true); |
|
93 | + } |
|
94 | + $ldel = preg_quote($compiler->smarty->left_delimiter, '#'); |
|
95 | + $rdel = preg_quote($compiler->smarty->right_delimiter, '#'); |
|
96 | + preg_match("#^({$ldel}php\\s*)((.)*?)({$rdel})#", $_attr[ 'code' ], $match); |
|
97 | + if (!empty($match[ 2 ])) { |
|
98 | + if ('nocache' == trim($match[ 2 ])) { |
|
99 | + $compiler->tag_nocache = true; |
|
100 | + } else { |
|
101 | + $compiler->trigger_template_error("illegal value of option flag \"{$match[2]}\"", null, true); |
|
102 | + } |
|
103 | + } |
|
104 | + return preg_replace(array("#^{$ldel}\\s*php\\s*(.)*?{$rdel}#", "#{$ldel}\\s*/\\s*php\\s*{$rdel}$#"), |
|
105 | + array('<?php ', '?>'), $_attr[ 'code' ]); |
|
106 | + } |
|
107 | + } |
|
108 | 108 | |
109 | - /** |
|
110 | - * Lexer code for PHP tags |
|
111 | - * |
|
112 | - * This code has been moved from lexer here fo easier debugging and maintenance |
|
113 | - * |
|
114 | - * @param $lex |
|
115 | - */ |
|
116 | - public function parsePhp($lex) |
|
117 | - { |
|
118 | - $lex->token = Smarty_Internal_Templateparser::TP_PHP; |
|
119 | - $close = 0; |
|
120 | - $lex->taglineno = $lex->line; |
|
121 | - $closeTag = '?>'; |
|
122 | - if (strpos($lex->value, '<?xml') === 0) { |
|
123 | - $lex->is_xml = true; |
|
124 | - $lex->token = Smarty_Internal_Templateparser::TP_NOCACHE; |
|
125 | - return; |
|
126 | - } elseif (strpos($lex->value, '<?') === 0) { |
|
127 | - $lex->phpType = 'php'; |
|
128 | - } elseif (strpos($lex->value, '<%') === 0) { |
|
129 | - $lex->phpType = 'asp'; |
|
130 | - $closeTag = '%>'; |
|
131 | - } elseif (strpos($lex->value, '%>') === 0) { |
|
132 | - $lex->phpType = 'unmatched'; |
|
133 | - } elseif (strpos($lex->value, '?>') === 0) { |
|
134 | - if ($lex->is_xml) { |
|
135 | - $lex->is_xml = false; |
|
136 | - $lex->token = Smarty_Internal_Templateparser::TP_NOCACHE; |
|
137 | - return; |
|
138 | - } |
|
139 | - $lex->phpType = 'unmatched'; |
|
140 | - } elseif (strpos($lex->value, '<s') === 0) { |
|
141 | - $lex->phpType = 'script'; |
|
142 | - $closeTag = '</script>'; |
|
143 | - } elseif (strpos($lex->value, $lex->smarty->left_delimiter) === 0) { |
|
144 | - if ($lex->isAutoLiteral()) { |
|
145 | - $lex->token = Smarty_Internal_Templateparser::TP_TEXT; |
|
146 | - return; |
|
147 | - } |
|
148 | - $closeTag = "{$lex->smarty->left_delimiter}/php{$lex->smarty->right_delimiter}"; |
|
149 | - if ($lex->value == $closeTag) { |
|
150 | - $lex->compiler->trigger_template_error("unexpected closing tag '{$closeTag}'"); |
|
151 | - } |
|
152 | - $lex->phpType = 'tag'; |
|
153 | - } |
|
154 | - if ($lex->phpType == 'unmatched') { |
|
155 | - return; |
|
156 | - } |
|
157 | - if (($lex->phpType == 'php' || $lex->phpType == 'asp') && |
|
158 | - ($lex->compiler->php_handling == Smarty::PHP_PASSTHRU || $lex->compiler->php_handling == Smarty::PHP_QUOTE) |
|
159 | - ) { |
|
160 | - return; |
|
161 | - } |
|
162 | - $start = $lex->counter + strlen($lex->value); |
|
163 | - $body = true; |
|
164 | - if (preg_match('~' . preg_quote($closeTag, '~') . '~i', $lex->data, $match, PREG_OFFSET_CAPTURE, $start)) { |
|
165 | - $close = $match[ 0 ][ 1 ]; |
|
166 | - } else { |
|
167 | - $lex->compiler->trigger_template_error("missing closing tag '{$closeTag}'"); |
|
168 | - } |
|
169 | - while ($body) { |
|
170 | - if (preg_match('~([/][*])|([/][/][^\n]*)|(\'[^\'\\\\]*(?:\\.[^\'\\\\]*)*\')|("[^"\\\\]*(?:\\.[^"\\\\]*)*")~', |
|
171 | - $lex->data, $match, PREG_OFFSET_CAPTURE, $start)) { |
|
172 | - $value = $match[ 0 ][ 0 ]; |
|
173 | - $from = $pos = $match[ 0 ][ 1 ]; |
|
174 | - if ($pos > $close) { |
|
175 | - $body = false; |
|
176 | - } else { |
|
177 | - $start = $pos + strlen($value); |
|
178 | - $phpCommentStart = $value == '/*'; |
|
179 | - if ($phpCommentStart) { |
|
180 | - $phpCommentEnd = preg_match('~([*][/])~', $lex->data, $match, PREG_OFFSET_CAPTURE, $start); |
|
181 | - if ($phpCommentEnd) { |
|
182 | - $pos2 = $match[ 0 ][ 1 ]; |
|
183 | - $start = $pos2 + strlen($match[ 0 ][ 0 ]); |
|
184 | - } |
|
185 | - } |
|
186 | - while ($close > $pos && $close < $start) { |
|
187 | - if (preg_match('~' . preg_quote($closeTag, '~') . '~i', $lex->data, $match, PREG_OFFSET_CAPTURE, |
|
188 | - $from)) { |
|
189 | - $close = $match[ 0 ][ 1 ]; |
|
190 | - $from = $close + strlen($match[ 0 ][ 0 ]); |
|
191 | - } else { |
|
192 | - $lex->compiler->trigger_template_error("missing closing tag '{$closeTag}'"); |
|
193 | - } |
|
194 | - } |
|
195 | - if ($phpCommentStart && (!$phpCommentEnd || $pos2 > $close)) { |
|
196 | - $lex->taglineno = $lex->line + substr_count(substr($lex->data, $lex->counter, $start), "\n"); |
|
197 | - $lex->compiler->trigger_template_error("missing PHP comment closing tag '*/'"); |
|
198 | - } |
|
199 | - } |
|
200 | - } else { |
|
201 | - $body = false; |
|
202 | - } |
|
203 | - } |
|
204 | - $lex->value = substr($lex->data, $lex->counter, $close + strlen($closeTag) - $lex->counter); |
|
205 | - } |
|
109 | + /** |
|
110 | + * Lexer code for PHP tags |
|
111 | + * |
|
112 | + * This code has been moved from lexer here fo easier debugging and maintenance |
|
113 | + * |
|
114 | + * @param $lex |
|
115 | + */ |
|
116 | + public function parsePhp($lex) |
|
117 | + { |
|
118 | + $lex->token = Smarty_Internal_Templateparser::TP_PHP; |
|
119 | + $close = 0; |
|
120 | + $lex->taglineno = $lex->line; |
|
121 | + $closeTag = '?>'; |
|
122 | + if (strpos($lex->value, '<?xml') === 0) { |
|
123 | + $lex->is_xml = true; |
|
124 | + $lex->token = Smarty_Internal_Templateparser::TP_NOCACHE; |
|
125 | + return; |
|
126 | + } elseif (strpos($lex->value, '<?') === 0) { |
|
127 | + $lex->phpType = 'php'; |
|
128 | + } elseif (strpos($lex->value, '<%') === 0) { |
|
129 | + $lex->phpType = 'asp'; |
|
130 | + $closeTag = '%>'; |
|
131 | + } elseif (strpos($lex->value, '%>') === 0) { |
|
132 | + $lex->phpType = 'unmatched'; |
|
133 | + } elseif (strpos($lex->value, '?>') === 0) { |
|
134 | + if ($lex->is_xml) { |
|
135 | + $lex->is_xml = false; |
|
136 | + $lex->token = Smarty_Internal_Templateparser::TP_NOCACHE; |
|
137 | + return; |
|
138 | + } |
|
139 | + $lex->phpType = 'unmatched'; |
|
140 | + } elseif (strpos($lex->value, '<s') === 0) { |
|
141 | + $lex->phpType = 'script'; |
|
142 | + $closeTag = '</script>'; |
|
143 | + } elseif (strpos($lex->value, $lex->smarty->left_delimiter) === 0) { |
|
144 | + if ($lex->isAutoLiteral()) { |
|
145 | + $lex->token = Smarty_Internal_Templateparser::TP_TEXT; |
|
146 | + return; |
|
147 | + } |
|
148 | + $closeTag = "{$lex->smarty->left_delimiter}/php{$lex->smarty->right_delimiter}"; |
|
149 | + if ($lex->value == $closeTag) { |
|
150 | + $lex->compiler->trigger_template_error("unexpected closing tag '{$closeTag}'"); |
|
151 | + } |
|
152 | + $lex->phpType = 'tag'; |
|
153 | + } |
|
154 | + if ($lex->phpType == 'unmatched') { |
|
155 | + return; |
|
156 | + } |
|
157 | + if (($lex->phpType == 'php' || $lex->phpType == 'asp') && |
|
158 | + ($lex->compiler->php_handling == Smarty::PHP_PASSTHRU || $lex->compiler->php_handling == Smarty::PHP_QUOTE) |
|
159 | + ) { |
|
160 | + return; |
|
161 | + } |
|
162 | + $start = $lex->counter + strlen($lex->value); |
|
163 | + $body = true; |
|
164 | + if (preg_match('~' . preg_quote($closeTag, '~') . '~i', $lex->data, $match, PREG_OFFSET_CAPTURE, $start)) { |
|
165 | + $close = $match[ 0 ][ 1 ]; |
|
166 | + } else { |
|
167 | + $lex->compiler->trigger_template_error("missing closing tag '{$closeTag}'"); |
|
168 | + } |
|
169 | + while ($body) { |
|
170 | + if (preg_match('~([/][*])|([/][/][^\n]*)|(\'[^\'\\\\]*(?:\\.[^\'\\\\]*)*\')|("[^"\\\\]*(?:\\.[^"\\\\]*)*")~', |
|
171 | + $lex->data, $match, PREG_OFFSET_CAPTURE, $start)) { |
|
172 | + $value = $match[ 0 ][ 0 ]; |
|
173 | + $from = $pos = $match[ 0 ][ 1 ]; |
|
174 | + if ($pos > $close) { |
|
175 | + $body = false; |
|
176 | + } else { |
|
177 | + $start = $pos + strlen($value); |
|
178 | + $phpCommentStart = $value == '/*'; |
|
179 | + if ($phpCommentStart) { |
|
180 | + $phpCommentEnd = preg_match('~([*][/])~', $lex->data, $match, PREG_OFFSET_CAPTURE, $start); |
|
181 | + if ($phpCommentEnd) { |
|
182 | + $pos2 = $match[ 0 ][ 1 ]; |
|
183 | + $start = $pos2 + strlen($match[ 0 ][ 0 ]); |
|
184 | + } |
|
185 | + } |
|
186 | + while ($close > $pos && $close < $start) { |
|
187 | + if (preg_match('~' . preg_quote($closeTag, '~') . '~i', $lex->data, $match, PREG_OFFSET_CAPTURE, |
|
188 | + $from)) { |
|
189 | + $close = $match[ 0 ][ 1 ]; |
|
190 | + $from = $close + strlen($match[ 0 ][ 0 ]); |
|
191 | + } else { |
|
192 | + $lex->compiler->trigger_template_error("missing closing tag '{$closeTag}'"); |
|
193 | + } |
|
194 | + } |
|
195 | + if ($phpCommentStart && (!$phpCommentEnd || $pos2 > $close)) { |
|
196 | + $lex->taglineno = $lex->line + substr_count(substr($lex->data, $lex->counter, $start), "\n"); |
|
197 | + $lex->compiler->trigger_template_error("missing PHP comment closing tag '*/'"); |
|
198 | + } |
|
199 | + } |
|
200 | + } else { |
|
201 | + $body = false; |
|
202 | + } |
|
203 | + } |
|
204 | + $lex->value = substr($lex->data, $lex->counter, $close + strlen($closeTag) - $lex->counter); |
|
205 | + } |
|
206 | 206 | |
207 | - /* |
|
207 | + /* |
|
208 | 208 | * Call back function for $php_handling = PHP_QUOTE |
209 | 209 | * |
210 | 210 | */ |
211 | - /** |
|
212 | - * @param $match |
|
213 | - * |
|
214 | - * @return string |
|
215 | - */ |
|
216 | - private function quote($match) |
|
217 | - { |
|
218 | - return htmlspecialchars($match[ 0 ], ENT_QUOTES); |
|
219 | - } |
|
211 | + /** |
|
212 | + * @param $match |
|
213 | + * |
|
214 | + * @return string |
|
215 | + */ |
|
216 | + private function quote($match) |
|
217 | + { |
|
218 | + return htmlspecialchars($match[ 0 ], ENT_QUOTES); |
|
219 | + } |
|
220 | 220 | } |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | // check and get attributes |
41 | 41 | $_attr = $this->getAttributes($compiler, $args); |
42 | 42 | $compiler->has_code = false; |
43 | - if ($_attr[ 'type' ] == 'xml') { |
|
43 | + if ($_attr['type'] == 'xml') { |
|
44 | 44 | $compiler->tag_nocache = true; |
45 | 45 | $save = $compiler->template->compiled->has_nocache_code; |
46 | - $output = addcslashes($_attr[ 'code' ], "'\\"); |
|
46 | + $output = addcslashes($_attr['code'], "'\\"); |
|
47 | 47 | $compiler->parser->current_buffer->append_subtree($compiler->parser, |
48 | 48 | new Smarty_Internal_ParseTree_Tag($compiler->parser, |
49 | 49 | $compiler->processNocacheCode("<?php echo '" . |
@@ -53,20 +53,20 @@ discard block |
||
53 | 53 | $compiler->template->compiled->has_nocache_code = $save; |
54 | 54 | return ''; |
55 | 55 | } |
56 | - if ($_attr[ 'type' ] != 'tag') { |
|
56 | + if ($_attr['type'] != 'tag') { |
|
57 | 57 | if ($compiler->php_handling == Smarty::PHP_REMOVE) { |
58 | 58 | return ''; |
59 | 59 | } elseif ($compiler->php_handling == Smarty::PHP_QUOTE) { |
60 | 60 | $output = |
61 | 61 | preg_replace_callback('#(<\?(?:php|=)?)|(<%)|(<script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*>)|(\?>)|(%>)|(<\/script>)#i', |
62 | - array($this, 'quote'), $_attr[ 'code' ]); |
|
62 | + array($this, 'quote'), $_attr['code']); |
|
63 | 63 | $compiler->parser->current_buffer->append_subtree($compiler->parser, |
64 | 64 | new Smarty_Internal_ParseTree_Text($output)); |
65 | 65 | return ''; |
66 | - } elseif ($compiler->php_handling == Smarty::PHP_PASSTHRU || $_attr[ 'type' ] == 'unmatched') { |
|
66 | + } elseif ($compiler->php_handling == Smarty::PHP_PASSTHRU || $_attr['type'] == 'unmatched') { |
|
67 | 67 | $compiler->tag_nocache = true; |
68 | 68 | $save = $compiler->template->compiled->has_nocache_code; |
69 | - $output = addcslashes($_attr[ 'code' ], "'\\"); |
|
69 | + $output = addcslashes($_attr['code'], "'\\"); |
|
70 | 70 | $compiler->parser->current_buffer->append_subtree($compiler->parser, |
71 | 71 | new Smarty_Internal_ParseTree_Tag($compiler->parser, |
72 | 72 | $compiler->processNocacheCode("<?php echo '" . |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | null, true); |
82 | 82 | } |
83 | 83 | $compiler->has_code = true; |
84 | - return $_attr[ 'code' ]; |
|
84 | + return $_attr['code']; |
|
85 | 85 | } else { |
86 | 86 | $compiler->trigger_template_error('Illegal $smarty->php_handling value', null, true); |
87 | 87 | } |
@@ -93,16 +93,16 @@ discard block |
||
93 | 93 | } |
94 | 94 | $ldel = preg_quote($compiler->smarty->left_delimiter, '#'); |
95 | 95 | $rdel = preg_quote($compiler->smarty->right_delimiter, '#'); |
96 | - preg_match("#^({$ldel}php\\s*)((.)*?)({$rdel})#", $_attr[ 'code' ], $match); |
|
97 | - if (!empty($match[ 2 ])) { |
|
98 | - if ('nocache' == trim($match[ 2 ])) { |
|
96 | + preg_match("#^({$ldel}php\\s*)((.)*?)({$rdel})#", $_attr['code'], $match); |
|
97 | + if (!empty($match[2])) { |
|
98 | + if ('nocache' == trim($match[2])) { |
|
99 | 99 | $compiler->tag_nocache = true; |
100 | 100 | } else { |
101 | 101 | $compiler->trigger_template_error("illegal value of option flag \"{$match[2]}\"", null, true); |
102 | 102 | } |
103 | 103 | } |
104 | 104 | return preg_replace(array("#^{$ldel}\\s*php\\s*(.)*?{$rdel}#", "#{$ldel}\\s*/\\s*php\\s*{$rdel}$#"), |
105 | - array('<?php ', '?>'), $_attr[ 'code' ]); |
|
105 | + array('<?php ', '?>'), $_attr['code']); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
@@ -162,15 +162,15 @@ discard block |
||
162 | 162 | $start = $lex->counter + strlen($lex->value); |
163 | 163 | $body = true; |
164 | 164 | if (preg_match('~' . preg_quote($closeTag, '~') . '~i', $lex->data, $match, PREG_OFFSET_CAPTURE, $start)) { |
165 | - $close = $match[ 0 ][ 1 ]; |
|
165 | + $close = $match[0][1]; |
|
166 | 166 | } else { |
167 | 167 | $lex->compiler->trigger_template_error("missing closing tag '{$closeTag}'"); |
168 | 168 | } |
169 | 169 | while ($body) { |
170 | 170 | if (preg_match('~([/][*])|([/][/][^\n]*)|(\'[^\'\\\\]*(?:\\.[^\'\\\\]*)*\')|("[^"\\\\]*(?:\\.[^"\\\\]*)*")~', |
171 | 171 | $lex->data, $match, PREG_OFFSET_CAPTURE, $start)) { |
172 | - $value = $match[ 0 ][ 0 ]; |
|
173 | - $from = $pos = $match[ 0 ][ 1 ]; |
|
172 | + $value = $match[0][0]; |
|
173 | + $from = $pos = $match[0][1]; |
|
174 | 174 | if ($pos > $close) { |
175 | 175 | $body = false; |
176 | 176 | } else { |
@@ -179,15 +179,15 @@ discard block |
||
179 | 179 | if ($phpCommentStart) { |
180 | 180 | $phpCommentEnd = preg_match('~([*][/])~', $lex->data, $match, PREG_OFFSET_CAPTURE, $start); |
181 | 181 | if ($phpCommentEnd) { |
182 | - $pos2 = $match[ 0 ][ 1 ]; |
|
183 | - $start = $pos2 + strlen($match[ 0 ][ 0 ]); |
|
182 | + $pos2 = $match[0][1]; |
|
183 | + $start = $pos2 + strlen($match[0][0]); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | while ($close > $pos && $close < $start) { |
187 | 187 | if (preg_match('~' . preg_quote($closeTag, '~') . '~i', $lex->data, $match, PREG_OFFSET_CAPTURE, |
188 | 188 | $from)) { |
189 | - $close = $match[ 0 ][ 1 ]; |
|
190 | - $from = $close + strlen($match[ 0 ][ 0 ]); |
|
189 | + $close = $match[0][1]; |
|
190 | + $from = $close + strlen($match[0][0]); |
|
191 | 191 | } else { |
192 | 192 | $lex->compiler->trigger_template_error("missing closing tag '{$closeTag}'"); |
193 | 193 | } |
@@ -215,6 +215,6 @@ discard block |
||
215 | 215 | */ |
216 | 216 | private function quote($match) |
217 | 217 | { |
218 | - return htmlspecialchars($match[ 0 ], ENT_QUOTES); |
|
218 | + return htmlspecialchars($match[0], ENT_QUOTES); |
|
219 | 219 | } |
220 | 220 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
24 | 24 | * @param array $parameter array with compilation parameter |
25 | 25 | * |
26 | - * @return string compiled code |
|
26 | + * @return boolean compiled code |
|
27 | 27 | */ |
28 | 28 | public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
29 | 29 | { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @param array $args array with attributes from parser |
52 | 52 | * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
53 | 53 | * |
54 | - * @return string compiled code |
|
54 | + * @return boolean compiled code |
|
55 | 55 | */ |
56 | 56 | public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) |
57 | 57 | { |
@@ -16,24 +16,24 @@ discard block |
||
16 | 16 | */ |
17 | 17 | class Smarty_Internal_Compile_Setfilter extends Smarty_Internal_CompileBase |
18 | 18 | { |
19 | - /** |
|
20 | - * Compiles code for setfilter tag |
|
21 | - * |
|
22 | - * @param array $args array with attributes from parser |
|
23 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
24 | - * @param array $parameter array with compilation parameter |
|
25 | - * |
|
26 | - * @return string compiled code |
|
27 | - */ |
|
28 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
29 | - { |
|
30 | - $compiler->variable_filter_stack[] = $compiler->variable_filters; |
|
31 | - $compiler->variable_filters = $parameter[ 'modifier_list' ]; |
|
32 | - // this tag does not return compiled code |
|
33 | - $compiler->has_code = false; |
|
19 | + /** |
|
20 | + * Compiles code for setfilter tag |
|
21 | + * |
|
22 | + * @param array $args array with attributes from parser |
|
23 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
24 | + * @param array $parameter array with compilation parameter |
|
25 | + * |
|
26 | + * @return string compiled code |
|
27 | + */ |
|
28 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
29 | + { |
|
30 | + $compiler->variable_filter_stack[] = $compiler->variable_filters; |
|
31 | + $compiler->variable_filters = $parameter[ 'modifier_list' ]; |
|
32 | + // this tag does not return compiled code |
|
33 | + $compiler->has_code = false; |
|
34 | 34 | |
35 | - return true; |
|
36 | - } |
|
35 | + return true; |
|
36 | + } |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -44,27 +44,27 @@ discard block |
||
44 | 44 | */ |
45 | 45 | class Smarty_Internal_Compile_Setfilterclose extends Smarty_Internal_CompileBase |
46 | 46 | { |
47 | - /** |
|
48 | - * Compiles code for the {/setfilter} tag |
|
49 | - * This tag does not generate compiled output. It resets variable filter. |
|
50 | - * |
|
51 | - * @param array $args array with attributes from parser |
|
52 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
53 | - * |
|
54 | - * @return string compiled code |
|
55 | - */ |
|
56 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) |
|
57 | - { |
|
58 | - $_attr = $this->getAttributes($compiler, $args); |
|
59 | - // reset variable filter to previous state |
|
60 | - if (count($compiler->variable_filter_stack)) { |
|
61 | - $compiler->variable_filters = array_pop($compiler->variable_filter_stack); |
|
62 | - } else { |
|
63 | - $compiler->variable_filters = array(); |
|
64 | - } |
|
65 | - // this tag does not return compiled code |
|
66 | - $compiler->has_code = false; |
|
47 | + /** |
|
48 | + * Compiles code for the {/setfilter} tag |
|
49 | + * This tag does not generate compiled output. It resets variable filter. |
|
50 | + * |
|
51 | + * @param array $args array with attributes from parser |
|
52 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
53 | + * |
|
54 | + * @return string compiled code |
|
55 | + */ |
|
56 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) |
|
57 | + { |
|
58 | + $_attr = $this->getAttributes($compiler, $args); |
|
59 | + // reset variable filter to previous state |
|
60 | + if (count($compiler->variable_filter_stack)) { |
|
61 | + $compiler->variable_filters = array_pop($compiler->variable_filter_stack); |
|
62 | + } else { |
|
63 | + $compiler->variable_filters = array(); |
|
64 | + } |
|
65 | + // this tag does not return compiled code |
|
66 | + $compiler->has_code = false; |
|
67 | 67 | |
68 | - return true; |
|
69 | - } |
|
68 | + return true; |
|
69 | + } |
|
70 | 70 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
29 | 29 | { |
30 | 30 | $compiler->variable_filter_stack[] = $compiler->variable_filters; |
31 | - $compiler->variable_filters = $parameter[ 'modifier_list' ]; |
|
31 | + $compiler->variable_filters = $parameter['modifier_list']; |
|
32 | 32 | // this tag does not return compiled code |
33 | 33 | $compiler->has_code = false; |
34 | 34 |
@@ -152,6 +152,9 @@ discard block |
||
152 | 152 | $this->configBooleanize = $this->smarty->config_booleanize; |
153 | 153 | } |
154 | 154 | |
155 | + /** |
|
156 | + * @param Smarty_Internal_Configfilelexer $new_instance |
|
157 | + */ |
|
155 | 158 | public static function &instance($new_instance = null) |
156 | 159 | { |
157 | 160 | static $instance = null; |
@@ -176,6 +179,9 @@ discard block |
||
176 | 179 | return $this->{'yylex' . $this->_yy_state}(); |
177 | 180 | } |
178 | 181 | |
182 | + /** |
|
183 | + * @param integer $state |
|
184 | + */ |
|
179 | 185 | public function yypushstate($state) |
180 | 186 | { |
181 | 187 | if ($this->yyTraceFILE) { |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $this->data = $data . "\n"; //now all lines are \n-terminated |
145 | 145 | $this->counter = 0; |
146 | 146 | if (preg_match('/^\xEF\xBB\xBF/', $this->data, $match)) { |
147 | - $this->counter += strlen($match[ 0 ]); |
|
147 | + $this->counter += strlen($match[0]); |
|
148 | 148 | } |
149 | 149 | $this->line = 1; |
150 | 150 | $this->compiler = $compiler; |
@@ -180,15 +180,13 @@ discard block |
||
180 | 180 | { |
181 | 181 | if ($this->yyTraceFILE) { |
182 | 182 | fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, |
183 | - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : |
|
184 | - $this->_yy_state); |
|
183 | + isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); |
|
185 | 184 | } |
186 | 185 | array_push($this->_yy_stack, $this->_yy_state); |
187 | 186 | $this->_yy_state = $state; |
188 | 187 | if ($this->yyTraceFILE) { |
189 | 188 | fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, |
190 | - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : |
|
191 | - $this->_yy_state); |
|
189 | + isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); |
|
192 | 190 | } |
193 | 191 | } |
194 | 192 | |
@@ -196,14 +194,12 @@ discard block |
||
196 | 194 | { |
197 | 195 | if ($this->yyTraceFILE) { |
198 | 196 | fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt, |
199 | - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : |
|
200 | - $this->_yy_state); |
|
197 | + isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); |
|
201 | 198 | } |
202 | 199 | $this->_yy_state = array_pop($this->_yy_stack); |
203 | 200 | if ($this->yyTraceFILE) { |
204 | 201 | fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, |
205 | - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : |
|
206 | - $this->_yy_state); |
|
202 | + isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); |
|
207 | 203 | } |
208 | 204 | } |
209 | 205 | |
@@ -212,8 +208,7 @@ discard block |
||
212 | 208 | $this->_yy_state = $state; |
213 | 209 | if ($this->yyTraceFILE) { |
214 | 210 | fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, |
215 | - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : |
|
216 | - $this->_yy_state); |
|
211 | + isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); |
|
217 | 212 | } |
218 | 213 | } |
219 | 214 | |
@@ -230,7 +225,7 @@ discard block |
||
230 | 225 | do { |
231 | 226 | if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, null, $this->counter)) { |
232 | 227 | $yysubmatches = $yymatches; |
233 | - if (strlen($yysubmatches[ 0 ]) < 200) { |
|
228 | + if (strlen($yysubmatches[0]) < 200) { |
|
234 | 229 | $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
235 | 230 | } else { |
236 | 231 | $yymatches = array_filter($yymatches, 'strlen'); |
@@ -262,7 +257,7 @@ discard block |
||
262 | 257 | continue; |
263 | 258 | } |
264 | 259 | } else { |
265 | - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); |
|
260 | + throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]); |
|
266 | 261 | } |
267 | 262 | break; |
268 | 263 | } |
@@ -335,7 +330,7 @@ discard block |
||
335 | 330 | do { |
336 | 331 | if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, null, $this->counter)) { |
337 | 332 | $yysubmatches = $yymatches; |
338 | - if (strlen($yysubmatches[ 0 ]) < 200) { |
|
333 | + if (strlen($yysubmatches[0]) < 200) { |
|
339 | 334 | $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
340 | 335 | } else { |
341 | 336 | $yymatches = array_filter($yymatches, 'strlen'); |
@@ -367,7 +362,7 @@ discard block |
||
367 | 362 | continue; |
368 | 363 | } |
369 | 364 | } else { |
370 | - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); |
|
365 | + throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]); |
|
371 | 366 | } |
372 | 367 | break; |
373 | 368 | } |
@@ -459,7 +454,7 @@ discard block |
||
459 | 454 | do { |
460 | 455 | if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, null, $this->counter)) { |
461 | 456 | $yysubmatches = $yymatches; |
462 | - if (strlen($yysubmatches[ 0 ]) < 200) { |
|
457 | + if (strlen($yysubmatches[0]) < 200) { |
|
463 | 458 | $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
464 | 459 | } else { |
465 | 460 | $yymatches = array_filter($yymatches, 'strlen'); |
@@ -491,7 +486,7 @@ discard block |
||
491 | 486 | continue; |
492 | 487 | } |
493 | 488 | } else { |
494 | - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); |
|
489 | + throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]); |
|
495 | 490 | } |
496 | 491 | break; |
497 | 492 | } |
@@ -519,7 +514,7 @@ discard block |
||
519 | 514 | do { |
520 | 515 | if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, null, $this->counter)) { |
521 | 516 | $yysubmatches = $yymatches; |
522 | - if (strlen($yysubmatches[ 0 ]) < 200) { |
|
517 | + if (strlen($yysubmatches[0]) < 200) { |
|
523 | 518 | $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
524 | 519 | } else { |
525 | 520 | $yymatches = array_filter($yymatches, 'strlen'); |
@@ -551,7 +546,7 @@ discard block |
||
551 | 546 | continue; |
552 | 547 | } |
553 | 548 | } else { |
554 | - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); |
|
549 | + throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]); |
|
555 | 550 | } |
556 | 551 | break; |
557 | 552 | } |
@@ -591,7 +586,7 @@ discard block |
||
591 | 586 | do { |
592 | 587 | if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, null, $this->counter)) { |
593 | 588 | $yysubmatches = $yymatches; |
594 | - if (strlen($yysubmatches[ 0 ]) < 200) { |
|
589 | + if (strlen($yysubmatches[0]) < 200) { |
|
595 | 590 | $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
596 | 591 | } else { |
597 | 592 | $yymatches = array_filter($yymatches, 'strlen'); |
@@ -623,7 +618,7 @@ discard block |
||
623 | 618 | continue; |
624 | 619 | } |
625 | 620 | } else { |
626 | - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); |
|
621 | + throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]); |
|
627 | 622 | } |
628 | 623 | break; |
629 | 624 | } |
@@ -657,7 +652,7 @@ discard block |
||
657 | 652 | do { |
658 | 653 | if (preg_match($this->yy_global_pattern6, $this->data, $yymatches, null, $this->counter)) { |
659 | 654 | $yysubmatches = $yymatches; |
660 | - if (strlen($yysubmatches[ 0 ]) < 200) { |
|
655 | + if (strlen($yysubmatches[0]) < 200) { |
|
661 | 656 | $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
662 | 657 | } else { |
663 | 658 | $yymatches = array_filter($yymatches, 'strlen'); |
@@ -689,7 +684,7 @@ discard block |
||
689 | 684 | continue; |
690 | 685 | } |
691 | 686 | } else { |
692 | - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); |
|
687 | + throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]); |
|
693 | 688 | } |
694 | 689 | break; |
695 | 690 | } |
@@ -711,8 +706,8 @@ discard block |
||
711 | 706 | |
712 | 707 | $to = strlen($this->data); |
713 | 708 | preg_match("/\"\"\"[ \t\r]*[\n#;]/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); |
714 | - if (isset($match[ 0 ][ 1 ])) { |
|
715 | - $to = $match[ 0 ][ 1 ]; |
|
709 | + if (isset($match[0][1])) { |
|
710 | + $to = $match[0][1]; |
|
716 | 711 | } else { |
717 | 712 | $this->compiler->trigger_template_error("missing or misspelled literal closing tag"); |
718 | 713 | } |
@@ -21,703 +21,703 @@ |
||
21 | 21 | */ |
22 | 22 | class Smarty_Internal_Configfilelexer |
23 | 23 | { |
24 | - /** |
|
25 | - * Source |
|
26 | - * |
|
27 | - * @var string |
|
28 | - */ |
|
29 | - public $data; |
|
30 | - |
|
31 | - /** |
|
32 | - * byte counter |
|
33 | - * |
|
34 | - * @var int |
|
35 | - */ |
|
36 | - public $counter; |
|
37 | - |
|
38 | - /** |
|
39 | - * token number |
|
40 | - * |
|
41 | - * @var int |
|
42 | - */ |
|
43 | - public $token; |
|
44 | - |
|
45 | - /** |
|
46 | - * token value |
|
47 | - * |
|
48 | - * @var string |
|
49 | - */ |
|
50 | - public $value; |
|
51 | - |
|
52 | - /** |
|
53 | - * current line |
|
54 | - * |
|
55 | - * @var int |
|
56 | - */ |
|
57 | - public $line; |
|
58 | - |
|
59 | - /** |
|
60 | - * state number |
|
61 | - * |
|
62 | - * @var int |
|
63 | - */ |
|
64 | - public $state = 1; |
|
65 | - |
|
66 | - /** |
|
67 | - * Smarty object |
|
68 | - * |
|
69 | - * @var Smarty |
|
70 | - */ |
|
71 | - public $smarty = null; |
|
72 | - |
|
73 | - /** |
|
74 | - * compiler object |
|
75 | - * |
|
76 | - * @var Smarty_Internal_Config_File_Compiler |
|
77 | - */ |
|
78 | - private $compiler = null; |
|
79 | - |
|
80 | - /** |
|
81 | - * copy of config_booleanize |
|
82 | - * |
|
83 | - * @var bool |
|
84 | - */ |
|
85 | - private $configBooleanize = false; |
|
86 | - |
|
87 | - /** |
|
88 | - * trace file |
|
89 | - * |
|
90 | - * @var resource |
|
91 | - */ |
|
92 | - public $yyTraceFILE; |
|
93 | - |
|
94 | - /** |
|
95 | - * trace prompt |
|
96 | - * |
|
97 | - * @var string |
|
98 | - */ |
|
99 | - public $yyTracePrompt; |
|
100 | - |
|
101 | - /** |
|
102 | - * state names |
|
103 | - * |
|
104 | - * @var array |
|
105 | - */ |
|
106 | - public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', |
|
107 | - 6 => 'TRIPPLE'); |
|
108 | - |
|
109 | - /** |
|
110 | - * storage for assembled token patterns |
|
111 | - * |
|
112 | - * @var sring |
|
113 | - */ |
|
114 | - private $yy_global_pattern1 = null; |
|
115 | - |
|
116 | - private $yy_global_pattern2 = null; |
|
117 | - |
|
118 | - private $yy_global_pattern3 = null; |
|
119 | - |
|
120 | - private $yy_global_pattern4 = null; |
|
121 | - |
|
122 | - private $yy_global_pattern5 = null; |
|
123 | - |
|
124 | - private $yy_global_pattern6 = null; |
|
125 | - |
|
126 | - /** |
|
127 | - * token names |
|
128 | - * |
|
129 | - * @var array |
|
130 | - */ |
|
131 | - public $smarty_token_names = array( // Text for parser error messages |
|
132 | - ); |
|
133 | - |
|
134 | - /** |
|
135 | - * constructor |
|
136 | - * |
|
137 | - * @param string $data template source |
|
138 | - * @param Smarty_Internal_Config_File_Compiler $compiler |
|
139 | - */ |
|
140 | - public function __construct($data, Smarty_Internal_Config_File_Compiler $compiler) |
|
141 | - { |
|
142 | - // set instance object |
|
143 | - self::instance($this); |
|
144 | - $this->data = $data . "\n"; //now all lines are \n-terminated |
|
145 | - $this->counter = 0; |
|
146 | - if (preg_match('/^\xEF\xBB\xBF/', $this->data, $match)) { |
|
147 | - $this->counter += strlen($match[ 0 ]); |
|
148 | - } |
|
149 | - $this->line = 1; |
|
150 | - $this->compiler = $compiler; |
|
151 | - $this->smarty = $compiler->smarty; |
|
152 | - $this->configBooleanize = $this->smarty->config_booleanize; |
|
153 | - } |
|
154 | - |
|
155 | - public static function &instance($new_instance = null) |
|
156 | - { |
|
157 | - static $instance = null; |
|
158 | - if (isset($new_instance) && is_object($new_instance)) { |
|
159 | - $instance = $new_instance; |
|
160 | - } |
|
161 | - return $instance; |
|
162 | - } |
|
163 | - |
|
164 | - public function PrintTrace() |
|
165 | - { |
|
166 | - $this->yyTraceFILE = fopen('php://output', 'w'); |
|
167 | - $this->yyTracePrompt = '<br>'; |
|
168 | - } |
|
169 | - |
|
170 | - private $_yy_state = 1; |
|
171 | - |
|
172 | - private $_yy_stack = array(); |
|
173 | - |
|
174 | - public function yylex() |
|
175 | - { |
|
176 | - return $this->{'yylex' . $this->_yy_state}(); |
|
177 | - } |
|
178 | - |
|
179 | - public function yypushstate($state) |
|
180 | - { |
|
181 | - if ($this->yyTraceFILE) { |
|
182 | - fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, |
|
183 | - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : |
|
184 | - $this->_yy_state); |
|
185 | - } |
|
186 | - array_push($this->_yy_stack, $this->_yy_state); |
|
187 | - $this->_yy_state = $state; |
|
188 | - if ($this->yyTraceFILE) { |
|
189 | - fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, |
|
190 | - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : |
|
191 | - $this->_yy_state); |
|
192 | - } |
|
193 | - } |
|
194 | - |
|
195 | - public function yypopstate() |
|
196 | - { |
|
197 | - if ($this->yyTraceFILE) { |
|
198 | - fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt, |
|
199 | - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : |
|
200 | - $this->_yy_state); |
|
201 | - } |
|
202 | - $this->_yy_state = array_pop($this->_yy_stack); |
|
203 | - if ($this->yyTraceFILE) { |
|
204 | - fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, |
|
205 | - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : |
|
206 | - $this->_yy_state); |
|
207 | - } |
|
208 | - } |
|
209 | - |
|
210 | - public function yybegin($state) |
|
211 | - { |
|
212 | - $this->_yy_state = $state; |
|
213 | - if ($this->yyTraceFILE) { |
|
214 | - fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, |
|
215 | - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : |
|
216 | - $this->_yy_state); |
|
217 | - } |
|
218 | - } |
|
219 | - |
|
220 | - public function yylex1() |
|
221 | - { |
|
222 | - if (!isset($this->yy_global_pattern1)) { |
|
223 | - $this->yy_global_pattern1 = |
|
224 | - "/\G(#|;)|\G(\\[)|\G(\\])|\G(=)|\G([ \t\r]+)|\G(\n)|\G([0-9]*[a-zA-Z_]\\w*)|\G([\S\s])/isS"; |
|
225 | - } |
|
226 | - if ($this->counter >= strlen($this->data)) { |
|
227 | - return false; // end of input |
|
228 | - } |
|
229 | - |
|
230 | - do { |
|
231 | - if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, null, $this->counter)) { |
|
232 | - $yysubmatches = $yymatches; |
|
233 | - if (strlen($yysubmatches[ 0 ]) < 200) { |
|
234 | - $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
|
235 | - } else { |
|
236 | - $yymatches = array_filter($yymatches, 'strlen'); |
|
237 | - } |
|
238 | - if (empty($yymatches)) { |
|
239 | - throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . |
|
240 | - substr($this->data, $this->counter, 5) . '... state START'); |
|
241 | - } |
|
242 | - next($yymatches); // skip global match |
|
243 | - $this->token = key($yymatches); // token number |
|
244 | - $this->value = current($yymatches); // token value |
|
245 | - $r = $this->{'yy_r1_' . $this->token}(); |
|
246 | - if ($r === null) { |
|
247 | - $this->counter += strlen($this->value); |
|
248 | - $this->line += substr_count($this->value, "\n"); |
|
249 | - // accept this token |
|
250 | - return true; |
|
251 | - } elseif ($r === true) { |
|
252 | - // we have changed state |
|
253 | - // process this token in the new state |
|
254 | - return $this->yylex(); |
|
255 | - } elseif ($r === false) { |
|
256 | - $this->counter += strlen($this->value); |
|
257 | - $this->line += substr_count($this->value, "\n"); |
|
258 | - if ($this->counter >= strlen($this->data)) { |
|
259 | - return false; // end of input |
|
260 | - } |
|
261 | - // skip this token |
|
262 | - continue; |
|
263 | - } |
|
264 | - } else { |
|
265 | - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); |
|
266 | - } |
|
267 | - break; |
|
268 | - } |
|
269 | - while (true); |
|
270 | - } // end function |
|
271 | - |
|
272 | - const START = 1; |
|
273 | - |
|
274 | - public function yy_r1_1() |
|
275 | - { |
|
276 | - |
|
277 | - $this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART; |
|
278 | - $this->yypushstate(self::COMMENT); |
|
279 | - } |
|
280 | - |
|
281 | - public function yy_r1_2() |
|
282 | - { |
|
283 | - |
|
284 | - $this->token = Smarty_Internal_Configfileparser::TPC_OPENB; |
|
285 | - $this->yypushstate(self::SECTION); |
|
286 | - } |
|
287 | - |
|
288 | - public function yy_r1_3() |
|
289 | - { |
|
290 | - |
|
291 | - $this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB; |
|
292 | - } |
|
293 | - |
|
294 | - public function yy_r1_4() |
|
295 | - { |
|
296 | - |
|
297 | - $this->token = Smarty_Internal_Configfileparser::TPC_EQUAL; |
|
298 | - $this->yypushstate(self::VALUE); |
|
299 | - } |
|
300 | - |
|
301 | - public function yy_r1_5() |
|
302 | - { |
|
303 | - |
|
304 | - return false; |
|
305 | - } |
|
306 | - |
|
307 | - public function yy_r1_6() |
|
308 | - { |
|
309 | - |
|
310 | - $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE; |
|
311 | - } |
|
312 | - |
|
313 | - public function yy_r1_7() |
|
314 | - { |
|
315 | - |
|
316 | - $this->token = Smarty_Internal_Configfileparser::TPC_ID; |
|
317 | - } |
|
318 | - |
|
319 | - public function yy_r1_8() |
|
320 | - { |
|
321 | - |
|
322 | - $this->token = Smarty_Internal_Configfileparser::TPC_OTHER; |
|
323 | - } |
|
324 | - |
|
325 | - public function yylex2() |
|
326 | - { |
|
327 | - if (!isset($this->yy_global_pattern2)) { |
|
328 | - $this->yy_global_pattern2 = |
|
329 | - "/\G([ \t\r]+)|\G(\\d+\\.\\d+(?=[ \t\r]*[\n#;]))|\G(\\d+(?=[ \t\r]*[\n#;]))|\G(\"\"\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#;]))|\G(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#;]))|\G([a-zA-Z]+(?=[ \t\r]*[\n#;]))|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS"; |
|
330 | - } |
|
331 | - if ($this->counter >= strlen($this->data)) { |
|
332 | - return false; // end of input |
|
333 | - } |
|
334 | - |
|
335 | - do { |
|
336 | - if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, null, $this->counter)) { |
|
337 | - $yysubmatches = $yymatches; |
|
338 | - if (strlen($yysubmatches[ 0 ]) < 200) { |
|
339 | - $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
|
340 | - } else { |
|
341 | - $yymatches = array_filter($yymatches, 'strlen'); |
|
342 | - } |
|
343 | - if (empty($yymatches)) { |
|
344 | - throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . |
|
345 | - substr($this->data, $this->counter, 5) . '... state VALUE'); |
|
346 | - } |
|
347 | - next($yymatches); // skip global match |
|
348 | - $this->token = key($yymatches); // token number |
|
349 | - $this->value = current($yymatches); // token value |
|
350 | - $r = $this->{'yy_r2_' . $this->token}(); |
|
351 | - if ($r === null) { |
|
352 | - $this->counter += strlen($this->value); |
|
353 | - $this->line += substr_count($this->value, "\n"); |
|
354 | - // accept this token |
|
355 | - return true; |
|
356 | - } elseif ($r === true) { |
|
357 | - // we have changed state |
|
358 | - // process this token in the new state |
|
359 | - return $this->yylex(); |
|
360 | - } elseif ($r === false) { |
|
361 | - $this->counter += strlen($this->value); |
|
362 | - $this->line += substr_count($this->value, "\n"); |
|
363 | - if ($this->counter >= strlen($this->data)) { |
|
364 | - return false; // end of input |
|
365 | - } |
|
366 | - // skip this token |
|
367 | - continue; |
|
368 | - } |
|
369 | - } else { |
|
370 | - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); |
|
371 | - } |
|
372 | - break; |
|
373 | - } |
|
374 | - while (true); |
|
375 | - } // end function |
|
376 | - |
|
377 | - const VALUE = 2; |
|
378 | - |
|
379 | - public function yy_r2_1() |
|
380 | - { |
|
381 | - |
|
382 | - return false; |
|
383 | - } |
|
384 | - |
|
385 | - public function yy_r2_2() |
|
386 | - { |
|
387 | - |
|
388 | - $this->token = Smarty_Internal_Configfileparser::TPC_FLOAT; |
|
389 | - $this->yypopstate(); |
|
390 | - } |
|
391 | - |
|
392 | - public function yy_r2_3() |
|
393 | - { |
|
394 | - |
|
395 | - $this->token = Smarty_Internal_Configfileparser::TPC_INT; |
|
396 | - $this->yypopstate(); |
|
397 | - } |
|
398 | - |
|
399 | - public function yy_r2_4() |
|
400 | - { |
|
401 | - |
|
402 | - $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES; |
|
403 | - $this->yypushstate(self::TRIPPLE); |
|
404 | - } |
|
405 | - |
|
406 | - public function yy_r2_5() |
|
407 | - { |
|
408 | - |
|
409 | - $this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING; |
|
410 | - $this->yypopstate(); |
|
411 | - } |
|
412 | - |
|
413 | - public function yy_r2_6() |
|
414 | - { |
|
415 | - |
|
416 | - $this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING; |
|
417 | - $this->yypopstate(); |
|
418 | - } |
|
419 | - |
|
420 | - public function yy_r2_7() |
|
421 | - { |
|
422 | - |
|
423 | - if (!$this->configBooleanize || |
|
424 | - !in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes", "no")) |
|
425 | - ) { |
|
426 | - $this->yypopstate(); |
|
427 | - $this->yypushstate(self::NAKED_STRING_VALUE); |
|
428 | - return true; //reprocess in new state |
|
429 | - } else { |
|
430 | - $this->token = Smarty_Internal_Configfileparser::TPC_BOOL; |
|
431 | - $this->yypopstate(); |
|
432 | - } |
|
433 | - } |
|
434 | - |
|
435 | - public function yy_r2_8() |
|
436 | - { |
|
437 | - |
|
438 | - $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; |
|
439 | - $this->yypopstate(); |
|
440 | - } |
|
441 | - |
|
442 | - public function yy_r2_9() |
|
443 | - { |
|
444 | - |
|
445 | - $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; |
|
446 | - $this->value = ""; |
|
447 | - $this->yypopstate(); |
|
448 | - } |
|
449 | - |
|
450 | - public function yylex3() |
|
451 | - { |
|
452 | - if (!isset($this->yy_global_pattern3)) { |
|
453 | - $this->yy_global_pattern3 = "/\G([^\n]+?(?=[ \t\r]*\n))/isS"; |
|
454 | - } |
|
455 | - if ($this->counter >= strlen($this->data)) { |
|
456 | - return false; // end of input |
|
457 | - } |
|
458 | - |
|
459 | - do { |
|
460 | - if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, null, $this->counter)) { |
|
461 | - $yysubmatches = $yymatches; |
|
462 | - if (strlen($yysubmatches[ 0 ]) < 200) { |
|
463 | - $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
|
464 | - } else { |
|
465 | - $yymatches = array_filter($yymatches, 'strlen'); |
|
466 | - } |
|
467 | - if (empty($yymatches)) { |
|
468 | - throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . |
|
469 | - substr($this->data, $this->counter, 5) . '... state NAKED_STRING_VALUE'); |
|
470 | - } |
|
471 | - next($yymatches); // skip global match |
|
472 | - $this->token = key($yymatches); // token number |
|
473 | - $this->value = current($yymatches); // token value |
|
474 | - $r = $this->{'yy_r3_' . $this->token}(); |
|
475 | - if ($r === null) { |
|
476 | - $this->counter += strlen($this->value); |
|
477 | - $this->line += substr_count($this->value, "\n"); |
|
478 | - // accept this token |
|
479 | - return true; |
|
480 | - } elseif ($r === true) { |
|
481 | - // we have changed state |
|
482 | - // process this token in the new state |
|
483 | - return $this->yylex(); |
|
484 | - } elseif ($r === false) { |
|
485 | - $this->counter += strlen($this->value); |
|
486 | - $this->line += substr_count($this->value, "\n"); |
|
487 | - if ($this->counter >= strlen($this->data)) { |
|
488 | - return false; // end of input |
|
489 | - } |
|
490 | - // skip this token |
|
491 | - continue; |
|
492 | - } |
|
493 | - } else { |
|
494 | - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); |
|
495 | - } |
|
496 | - break; |
|
497 | - } |
|
498 | - while (true); |
|
499 | - } // end function |
|
500 | - |
|
501 | - const NAKED_STRING_VALUE = 3; |
|
502 | - |
|
503 | - public function yy_r3_1() |
|
504 | - { |
|
505 | - |
|
506 | - $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; |
|
507 | - $this->yypopstate(); |
|
508 | - } |
|
509 | - |
|
510 | - public function yylex4() |
|
511 | - { |
|
512 | - if (!isset($this->yy_global_pattern4)) { |
|
513 | - $this->yy_global_pattern4 = "/\G([ \t\r]+)|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS"; |
|
514 | - } |
|
515 | - if ($this->counter >= strlen($this->data)) { |
|
516 | - return false; // end of input |
|
517 | - } |
|
518 | - |
|
519 | - do { |
|
520 | - if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, null, $this->counter)) { |
|
521 | - $yysubmatches = $yymatches; |
|
522 | - if (strlen($yysubmatches[ 0 ]) < 200) { |
|
523 | - $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
|
524 | - } else { |
|
525 | - $yymatches = array_filter($yymatches, 'strlen'); |
|
526 | - } |
|
527 | - if (empty($yymatches)) { |
|
528 | - throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . |
|
529 | - substr($this->data, $this->counter, 5) . '... state COMMENT'); |
|
530 | - } |
|
531 | - next($yymatches); // skip global match |
|
532 | - $this->token = key($yymatches); // token number |
|
533 | - $this->value = current($yymatches); // token value |
|
534 | - $r = $this->{'yy_r4_' . $this->token}(); |
|
535 | - if ($r === null) { |
|
536 | - $this->counter += strlen($this->value); |
|
537 | - $this->line += substr_count($this->value, "\n"); |
|
538 | - // accept this token |
|
539 | - return true; |
|
540 | - } elseif ($r === true) { |
|
541 | - // we have changed state |
|
542 | - // process this token in the new state |
|
543 | - return $this->yylex(); |
|
544 | - } elseif ($r === false) { |
|
545 | - $this->counter += strlen($this->value); |
|
546 | - $this->line += substr_count($this->value, "\n"); |
|
547 | - if ($this->counter >= strlen($this->data)) { |
|
548 | - return false; // end of input |
|
549 | - } |
|
550 | - // skip this token |
|
551 | - continue; |
|
552 | - } |
|
553 | - } else { |
|
554 | - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); |
|
555 | - } |
|
556 | - break; |
|
557 | - } |
|
558 | - while (true); |
|
559 | - } // end function |
|
560 | - |
|
561 | - const COMMENT = 4; |
|
562 | - |
|
563 | - public function yy_r4_1() |
|
564 | - { |
|
565 | - |
|
566 | - return false; |
|
567 | - } |
|
568 | - |
|
569 | - public function yy_r4_2() |
|
570 | - { |
|
571 | - |
|
572 | - $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; |
|
573 | - } |
|
574 | - |
|
575 | - public function yy_r4_3() |
|
576 | - { |
|
577 | - |
|
578 | - $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE; |
|
579 | - $this->yypopstate(); |
|
580 | - } |
|
581 | - |
|
582 | - public function yylex5() |
|
583 | - { |
|
584 | - if (!isset($this->yy_global_pattern5)) { |
|
585 | - $this->yy_global_pattern5 = "/\G(\\.)|\G(.*?(?=[\.=[\]\r\n]))/isS"; |
|
586 | - } |
|
587 | - if ($this->counter >= strlen($this->data)) { |
|
588 | - return false; // end of input |
|
589 | - } |
|
590 | - |
|
591 | - do { |
|
592 | - if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, null, $this->counter)) { |
|
593 | - $yysubmatches = $yymatches; |
|
594 | - if (strlen($yysubmatches[ 0 ]) < 200) { |
|
595 | - $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
|
596 | - } else { |
|
597 | - $yymatches = array_filter($yymatches, 'strlen'); |
|
598 | - } |
|
599 | - if (empty($yymatches)) { |
|
600 | - throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . |
|
601 | - substr($this->data, $this->counter, 5) . '... state SECTION'); |
|
602 | - } |
|
603 | - next($yymatches); // skip global match |
|
604 | - $this->token = key($yymatches); // token number |
|
605 | - $this->value = current($yymatches); // token value |
|
606 | - $r = $this->{'yy_r5_' . $this->token}(); |
|
607 | - if ($r === null) { |
|
608 | - $this->counter += strlen($this->value); |
|
609 | - $this->line += substr_count($this->value, "\n"); |
|
610 | - // accept this token |
|
611 | - return true; |
|
612 | - } elseif ($r === true) { |
|
613 | - // we have changed state |
|
614 | - // process this token in the new state |
|
615 | - return $this->yylex(); |
|
616 | - } elseif ($r === false) { |
|
617 | - $this->counter += strlen($this->value); |
|
618 | - $this->line += substr_count($this->value, "\n"); |
|
619 | - if ($this->counter >= strlen($this->data)) { |
|
620 | - return false; // end of input |
|
621 | - } |
|
622 | - // skip this token |
|
623 | - continue; |
|
624 | - } |
|
625 | - } else { |
|
626 | - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); |
|
627 | - } |
|
628 | - break; |
|
629 | - } |
|
630 | - while (true); |
|
631 | - } // end function |
|
632 | - |
|
633 | - const SECTION = 5; |
|
634 | - |
|
635 | - public function yy_r5_1() |
|
636 | - { |
|
637 | - |
|
638 | - $this->token = Smarty_Internal_Configfileparser::TPC_DOT; |
|
639 | - } |
|
640 | - |
|
641 | - public function yy_r5_2() |
|
642 | - { |
|
643 | - |
|
644 | - $this->token = Smarty_Internal_Configfileparser::TPC_SECTION; |
|
645 | - $this->yypopstate(); |
|
646 | - } |
|
647 | - |
|
648 | - public function yylex6() |
|
649 | - { |
|
650 | - if (!isset($this->yy_global_pattern6)) { |
|
651 | - $this->yy_global_pattern6 = "/\G(\"\"\"(?=[ \t\r]*[\n#;]))|\G([\S\s])/isS"; |
|
652 | - } |
|
653 | - if ($this->counter >= strlen($this->data)) { |
|
654 | - return false; // end of input |
|
655 | - } |
|
656 | - |
|
657 | - do { |
|
658 | - if (preg_match($this->yy_global_pattern6, $this->data, $yymatches, null, $this->counter)) { |
|
659 | - $yysubmatches = $yymatches; |
|
660 | - if (strlen($yysubmatches[ 0 ]) < 200) { |
|
661 | - $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
|
662 | - } else { |
|
663 | - $yymatches = array_filter($yymatches, 'strlen'); |
|
664 | - } |
|
665 | - if (empty($yymatches)) { |
|
666 | - throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . |
|
667 | - substr($this->data, $this->counter, 5) . '... state TRIPPLE'); |
|
668 | - } |
|
669 | - next($yymatches); // skip global match |
|
670 | - $this->token = key($yymatches); // token number |
|
671 | - $this->value = current($yymatches); // token value |
|
672 | - $r = $this->{'yy_r6_' . $this->token}(); |
|
673 | - if ($r === null) { |
|
674 | - $this->counter += strlen($this->value); |
|
675 | - $this->line += substr_count($this->value, "\n"); |
|
676 | - // accept this token |
|
677 | - return true; |
|
678 | - } elseif ($r === true) { |
|
679 | - // we have changed state |
|
680 | - // process this token in the new state |
|
681 | - return $this->yylex(); |
|
682 | - } elseif ($r === false) { |
|
683 | - $this->counter += strlen($this->value); |
|
684 | - $this->line += substr_count($this->value, "\n"); |
|
685 | - if ($this->counter >= strlen($this->data)) { |
|
686 | - return false; // end of input |
|
687 | - } |
|
688 | - // skip this token |
|
689 | - continue; |
|
690 | - } |
|
691 | - } else { |
|
692 | - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); |
|
693 | - } |
|
694 | - break; |
|
695 | - } |
|
696 | - while (true); |
|
697 | - } // end function |
|
698 | - |
|
699 | - const TRIPPLE = 6; |
|
700 | - |
|
701 | - public function yy_r6_1() |
|
702 | - { |
|
703 | - |
|
704 | - $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END; |
|
705 | - $this->yypopstate(); |
|
706 | - $this->yypushstate(self::START); |
|
707 | - } |
|
708 | - |
|
709 | - public function yy_r6_2() |
|
710 | - { |
|
711 | - |
|
712 | - $to = strlen($this->data); |
|
713 | - preg_match("/\"\"\"[ \t\r]*[\n#;]/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); |
|
714 | - if (isset($match[ 0 ][ 1 ])) { |
|
715 | - $to = $match[ 0 ][ 1 ]; |
|
716 | - } else { |
|
717 | - $this->compiler->trigger_template_error("missing or misspelled literal closing tag"); |
|
718 | - } |
|
719 | - $this->value = substr($this->data, $this->counter, $to - $this->counter); |
|
720 | - $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT; |
|
721 | - } |
|
24 | + /** |
|
25 | + * Source |
|
26 | + * |
|
27 | + * @var string |
|
28 | + */ |
|
29 | + public $data; |
|
30 | + |
|
31 | + /** |
|
32 | + * byte counter |
|
33 | + * |
|
34 | + * @var int |
|
35 | + */ |
|
36 | + public $counter; |
|
37 | + |
|
38 | + /** |
|
39 | + * token number |
|
40 | + * |
|
41 | + * @var int |
|
42 | + */ |
|
43 | + public $token; |
|
44 | + |
|
45 | + /** |
|
46 | + * token value |
|
47 | + * |
|
48 | + * @var string |
|
49 | + */ |
|
50 | + public $value; |
|
51 | + |
|
52 | + /** |
|
53 | + * current line |
|
54 | + * |
|
55 | + * @var int |
|
56 | + */ |
|
57 | + public $line; |
|
58 | + |
|
59 | + /** |
|
60 | + * state number |
|
61 | + * |
|
62 | + * @var int |
|
63 | + */ |
|
64 | + public $state = 1; |
|
65 | + |
|
66 | + /** |
|
67 | + * Smarty object |
|
68 | + * |
|
69 | + * @var Smarty |
|
70 | + */ |
|
71 | + public $smarty = null; |
|
72 | + |
|
73 | + /** |
|
74 | + * compiler object |
|
75 | + * |
|
76 | + * @var Smarty_Internal_Config_File_Compiler |
|
77 | + */ |
|
78 | + private $compiler = null; |
|
79 | + |
|
80 | + /** |
|
81 | + * copy of config_booleanize |
|
82 | + * |
|
83 | + * @var bool |
|
84 | + */ |
|
85 | + private $configBooleanize = false; |
|
86 | + |
|
87 | + /** |
|
88 | + * trace file |
|
89 | + * |
|
90 | + * @var resource |
|
91 | + */ |
|
92 | + public $yyTraceFILE; |
|
93 | + |
|
94 | + /** |
|
95 | + * trace prompt |
|
96 | + * |
|
97 | + * @var string |
|
98 | + */ |
|
99 | + public $yyTracePrompt; |
|
100 | + |
|
101 | + /** |
|
102 | + * state names |
|
103 | + * |
|
104 | + * @var array |
|
105 | + */ |
|
106 | + public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', |
|
107 | + 6 => 'TRIPPLE'); |
|
108 | + |
|
109 | + /** |
|
110 | + * storage for assembled token patterns |
|
111 | + * |
|
112 | + * @var sring |
|
113 | + */ |
|
114 | + private $yy_global_pattern1 = null; |
|
115 | + |
|
116 | + private $yy_global_pattern2 = null; |
|
117 | + |
|
118 | + private $yy_global_pattern3 = null; |
|
119 | + |
|
120 | + private $yy_global_pattern4 = null; |
|
121 | + |
|
122 | + private $yy_global_pattern5 = null; |
|
123 | + |
|
124 | + private $yy_global_pattern6 = null; |
|
125 | + |
|
126 | + /** |
|
127 | + * token names |
|
128 | + * |
|
129 | + * @var array |
|
130 | + */ |
|
131 | + public $smarty_token_names = array( // Text for parser error messages |
|
132 | + ); |
|
133 | + |
|
134 | + /** |
|
135 | + * constructor |
|
136 | + * |
|
137 | + * @param string $data template source |
|
138 | + * @param Smarty_Internal_Config_File_Compiler $compiler |
|
139 | + */ |
|
140 | + public function __construct($data, Smarty_Internal_Config_File_Compiler $compiler) |
|
141 | + { |
|
142 | + // set instance object |
|
143 | + self::instance($this); |
|
144 | + $this->data = $data . "\n"; //now all lines are \n-terminated |
|
145 | + $this->counter = 0; |
|
146 | + if (preg_match('/^\xEF\xBB\xBF/', $this->data, $match)) { |
|
147 | + $this->counter += strlen($match[ 0 ]); |
|
148 | + } |
|
149 | + $this->line = 1; |
|
150 | + $this->compiler = $compiler; |
|
151 | + $this->smarty = $compiler->smarty; |
|
152 | + $this->configBooleanize = $this->smarty->config_booleanize; |
|
153 | + } |
|
154 | + |
|
155 | + public static function &instance($new_instance = null) |
|
156 | + { |
|
157 | + static $instance = null; |
|
158 | + if (isset($new_instance) && is_object($new_instance)) { |
|
159 | + $instance = $new_instance; |
|
160 | + } |
|
161 | + return $instance; |
|
162 | + } |
|
163 | + |
|
164 | + public function PrintTrace() |
|
165 | + { |
|
166 | + $this->yyTraceFILE = fopen('php://output', 'w'); |
|
167 | + $this->yyTracePrompt = '<br>'; |
|
168 | + } |
|
169 | + |
|
170 | + private $_yy_state = 1; |
|
171 | + |
|
172 | + private $_yy_stack = array(); |
|
173 | + |
|
174 | + public function yylex() |
|
175 | + { |
|
176 | + return $this->{'yylex' . $this->_yy_state}(); |
|
177 | + } |
|
178 | + |
|
179 | + public function yypushstate($state) |
|
180 | + { |
|
181 | + if ($this->yyTraceFILE) { |
|
182 | + fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, |
|
183 | + isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : |
|
184 | + $this->_yy_state); |
|
185 | + } |
|
186 | + array_push($this->_yy_stack, $this->_yy_state); |
|
187 | + $this->_yy_state = $state; |
|
188 | + if ($this->yyTraceFILE) { |
|
189 | + fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, |
|
190 | + isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : |
|
191 | + $this->_yy_state); |
|
192 | + } |
|
193 | + } |
|
194 | + |
|
195 | + public function yypopstate() |
|
196 | + { |
|
197 | + if ($this->yyTraceFILE) { |
|
198 | + fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt, |
|
199 | + isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : |
|
200 | + $this->_yy_state); |
|
201 | + } |
|
202 | + $this->_yy_state = array_pop($this->_yy_stack); |
|
203 | + if ($this->yyTraceFILE) { |
|
204 | + fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, |
|
205 | + isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : |
|
206 | + $this->_yy_state); |
|
207 | + } |
|
208 | + } |
|
209 | + |
|
210 | + public function yybegin($state) |
|
211 | + { |
|
212 | + $this->_yy_state = $state; |
|
213 | + if ($this->yyTraceFILE) { |
|
214 | + fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, |
|
215 | + isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : |
|
216 | + $this->_yy_state); |
|
217 | + } |
|
218 | + } |
|
219 | + |
|
220 | + public function yylex1() |
|
221 | + { |
|
222 | + if (!isset($this->yy_global_pattern1)) { |
|
223 | + $this->yy_global_pattern1 = |
|
224 | + "/\G(#|;)|\G(\\[)|\G(\\])|\G(=)|\G([ \t\r]+)|\G(\n)|\G([0-9]*[a-zA-Z_]\\w*)|\G([\S\s])/isS"; |
|
225 | + } |
|
226 | + if ($this->counter >= strlen($this->data)) { |
|
227 | + return false; // end of input |
|
228 | + } |
|
229 | + |
|
230 | + do { |
|
231 | + if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, null, $this->counter)) { |
|
232 | + $yysubmatches = $yymatches; |
|
233 | + if (strlen($yysubmatches[ 0 ]) < 200) { |
|
234 | + $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
|
235 | + } else { |
|
236 | + $yymatches = array_filter($yymatches, 'strlen'); |
|
237 | + } |
|
238 | + if (empty($yymatches)) { |
|
239 | + throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . |
|
240 | + substr($this->data, $this->counter, 5) . '... state START'); |
|
241 | + } |
|
242 | + next($yymatches); // skip global match |
|
243 | + $this->token = key($yymatches); // token number |
|
244 | + $this->value = current($yymatches); // token value |
|
245 | + $r = $this->{'yy_r1_' . $this->token}(); |
|
246 | + if ($r === null) { |
|
247 | + $this->counter += strlen($this->value); |
|
248 | + $this->line += substr_count($this->value, "\n"); |
|
249 | + // accept this token |
|
250 | + return true; |
|
251 | + } elseif ($r === true) { |
|
252 | + // we have changed state |
|
253 | + // process this token in the new state |
|
254 | + return $this->yylex(); |
|
255 | + } elseif ($r === false) { |
|
256 | + $this->counter += strlen($this->value); |
|
257 | + $this->line += substr_count($this->value, "\n"); |
|
258 | + if ($this->counter >= strlen($this->data)) { |
|
259 | + return false; // end of input |
|
260 | + } |
|
261 | + // skip this token |
|
262 | + continue; |
|
263 | + } |
|
264 | + } else { |
|
265 | + throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); |
|
266 | + } |
|
267 | + break; |
|
268 | + } |
|
269 | + while (true); |
|
270 | + } // end function |
|
271 | + |
|
272 | + const START = 1; |
|
273 | + |
|
274 | + public function yy_r1_1() |
|
275 | + { |
|
276 | + |
|
277 | + $this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART; |
|
278 | + $this->yypushstate(self::COMMENT); |
|
279 | + } |
|
280 | + |
|
281 | + public function yy_r1_2() |
|
282 | + { |
|
283 | + |
|
284 | + $this->token = Smarty_Internal_Configfileparser::TPC_OPENB; |
|
285 | + $this->yypushstate(self::SECTION); |
|
286 | + } |
|
287 | + |
|
288 | + public function yy_r1_3() |
|
289 | + { |
|
290 | + |
|
291 | + $this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB; |
|
292 | + } |
|
293 | + |
|
294 | + public function yy_r1_4() |
|
295 | + { |
|
296 | + |
|
297 | + $this->token = Smarty_Internal_Configfileparser::TPC_EQUAL; |
|
298 | + $this->yypushstate(self::VALUE); |
|
299 | + } |
|
300 | + |
|
301 | + public function yy_r1_5() |
|
302 | + { |
|
303 | + |
|
304 | + return false; |
|
305 | + } |
|
306 | + |
|
307 | + public function yy_r1_6() |
|
308 | + { |
|
309 | + |
|
310 | + $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE; |
|
311 | + } |
|
312 | + |
|
313 | + public function yy_r1_7() |
|
314 | + { |
|
315 | + |
|
316 | + $this->token = Smarty_Internal_Configfileparser::TPC_ID; |
|
317 | + } |
|
318 | + |
|
319 | + public function yy_r1_8() |
|
320 | + { |
|
321 | + |
|
322 | + $this->token = Smarty_Internal_Configfileparser::TPC_OTHER; |
|
323 | + } |
|
324 | + |
|
325 | + public function yylex2() |
|
326 | + { |
|
327 | + if (!isset($this->yy_global_pattern2)) { |
|
328 | + $this->yy_global_pattern2 = |
|
329 | + "/\G([ \t\r]+)|\G(\\d+\\.\\d+(?=[ \t\r]*[\n#;]))|\G(\\d+(?=[ \t\r]*[\n#;]))|\G(\"\"\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#;]))|\G(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#;]))|\G([a-zA-Z]+(?=[ \t\r]*[\n#;]))|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS"; |
|
330 | + } |
|
331 | + if ($this->counter >= strlen($this->data)) { |
|
332 | + return false; // end of input |
|
333 | + } |
|
334 | + |
|
335 | + do { |
|
336 | + if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, null, $this->counter)) { |
|
337 | + $yysubmatches = $yymatches; |
|
338 | + if (strlen($yysubmatches[ 0 ]) < 200) { |
|
339 | + $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
|
340 | + } else { |
|
341 | + $yymatches = array_filter($yymatches, 'strlen'); |
|
342 | + } |
|
343 | + if (empty($yymatches)) { |
|
344 | + throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . |
|
345 | + substr($this->data, $this->counter, 5) . '... state VALUE'); |
|
346 | + } |
|
347 | + next($yymatches); // skip global match |
|
348 | + $this->token = key($yymatches); // token number |
|
349 | + $this->value = current($yymatches); // token value |
|
350 | + $r = $this->{'yy_r2_' . $this->token}(); |
|
351 | + if ($r === null) { |
|
352 | + $this->counter += strlen($this->value); |
|
353 | + $this->line += substr_count($this->value, "\n"); |
|
354 | + // accept this token |
|
355 | + return true; |
|
356 | + } elseif ($r === true) { |
|
357 | + // we have changed state |
|
358 | + // process this token in the new state |
|
359 | + return $this->yylex(); |
|
360 | + } elseif ($r === false) { |
|
361 | + $this->counter += strlen($this->value); |
|
362 | + $this->line += substr_count($this->value, "\n"); |
|
363 | + if ($this->counter >= strlen($this->data)) { |
|
364 | + return false; // end of input |
|
365 | + } |
|
366 | + // skip this token |
|
367 | + continue; |
|
368 | + } |
|
369 | + } else { |
|
370 | + throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); |
|
371 | + } |
|
372 | + break; |
|
373 | + } |
|
374 | + while (true); |
|
375 | + } // end function |
|
376 | + |
|
377 | + const VALUE = 2; |
|
378 | + |
|
379 | + public function yy_r2_1() |
|
380 | + { |
|
381 | + |
|
382 | + return false; |
|
383 | + } |
|
384 | + |
|
385 | + public function yy_r2_2() |
|
386 | + { |
|
387 | + |
|
388 | + $this->token = Smarty_Internal_Configfileparser::TPC_FLOAT; |
|
389 | + $this->yypopstate(); |
|
390 | + } |
|
391 | + |
|
392 | + public function yy_r2_3() |
|
393 | + { |
|
394 | + |
|
395 | + $this->token = Smarty_Internal_Configfileparser::TPC_INT; |
|
396 | + $this->yypopstate(); |
|
397 | + } |
|
398 | + |
|
399 | + public function yy_r2_4() |
|
400 | + { |
|
401 | + |
|
402 | + $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES; |
|
403 | + $this->yypushstate(self::TRIPPLE); |
|
404 | + } |
|
405 | + |
|
406 | + public function yy_r2_5() |
|
407 | + { |
|
408 | + |
|
409 | + $this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING; |
|
410 | + $this->yypopstate(); |
|
411 | + } |
|
412 | + |
|
413 | + public function yy_r2_6() |
|
414 | + { |
|
415 | + |
|
416 | + $this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING; |
|
417 | + $this->yypopstate(); |
|
418 | + } |
|
419 | + |
|
420 | + public function yy_r2_7() |
|
421 | + { |
|
422 | + |
|
423 | + if (!$this->configBooleanize || |
|
424 | + !in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes", "no")) |
|
425 | + ) { |
|
426 | + $this->yypopstate(); |
|
427 | + $this->yypushstate(self::NAKED_STRING_VALUE); |
|
428 | + return true; //reprocess in new state |
|
429 | + } else { |
|
430 | + $this->token = Smarty_Internal_Configfileparser::TPC_BOOL; |
|
431 | + $this->yypopstate(); |
|
432 | + } |
|
433 | + } |
|
434 | + |
|
435 | + public function yy_r2_8() |
|
436 | + { |
|
437 | + |
|
438 | + $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; |
|
439 | + $this->yypopstate(); |
|
440 | + } |
|
441 | + |
|
442 | + public function yy_r2_9() |
|
443 | + { |
|
444 | + |
|
445 | + $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; |
|
446 | + $this->value = ""; |
|
447 | + $this->yypopstate(); |
|
448 | + } |
|
449 | + |
|
450 | + public function yylex3() |
|
451 | + { |
|
452 | + if (!isset($this->yy_global_pattern3)) { |
|
453 | + $this->yy_global_pattern3 = "/\G([^\n]+?(?=[ \t\r]*\n))/isS"; |
|
454 | + } |
|
455 | + if ($this->counter >= strlen($this->data)) { |
|
456 | + return false; // end of input |
|
457 | + } |
|
458 | + |
|
459 | + do { |
|
460 | + if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, null, $this->counter)) { |
|
461 | + $yysubmatches = $yymatches; |
|
462 | + if (strlen($yysubmatches[ 0 ]) < 200) { |
|
463 | + $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
|
464 | + } else { |
|
465 | + $yymatches = array_filter($yymatches, 'strlen'); |
|
466 | + } |
|
467 | + if (empty($yymatches)) { |
|
468 | + throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . |
|
469 | + substr($this->data, $this->counter, 5) . '... state NAKED_STRING_VALUE'); |
|
470 | + } |
|
471 | + next($yymatches); // skip global match |
|
472 | + $this->token = key($yymatches); // token number |
|
473 | + $this->value = current($yymatches); // token value |
|
474 | + $r = $this->{'yy_r3_' . $this->token}(); |
|
475 | + if ($r === null) { |
|
476 | + $this->counter += strlen($this->value); |
|
477 | + $this->line += substr_count($this->value, "\n"); |
|
478 | + // accept this token |
|
479 | + return true; |
|
480 | + } elseif ($r === true) { |
|
481 | + // we have changed state |
|
482 | + // process this token in the new state |
|
483 | + return $this->yylex(); |
|
484 | + } elseif ($r === false) { |
|
485 | + $this->counter += strlen($this->value); |
|
486 | + $this->line += substr_count($this->value, "\n"); |
|
487 | + if ($this->counter >= strlen($this->data)) { |
|
488 | + return false; // end of input |
|
489 | + } |
|
490 | + // skip this token |
|
491 | + continue; |
|
492 | + } |
|
493 | + } else { |
|
494 | + throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); |
|
495 | + } |
|
496 | + break; |
|
497 | + } |
|
498 | + while (true); |
|
499 | + } // end function |
|
500 | + |
|
501 | + const NAKED_STRING_VALUE = 3; |
|
502 | + |
|
503 | + public function yy_r3_1() |
|
504 | + { |
|
505 | + |
|
506 | + $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; |
|
507 | + $this->yypopstate(); |
|
508 | + } |
|
509 | + |
|
510 | + public function yylex4() |
|
511 | + { |
|
512 | + if (!isset($this->yy_global_pattern4)) { |
|
513 | + $this->yy_global_pattern4 = "/\G([ \t\r]+)|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS"; |
|
514 | + } |
|
515 | + if ($this->counter >= strlen($this->data)) { |
|
516 | + return false; // end of input |
|
517 | + } |
|
518 | + |
|
519 | + do { |
|
520 | + if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, null, $this->counter)) { |
|
521 | + $yysubmatches = $yymatches; |
|
522 | + if (strlen($yysubmatches[ 0 ]) < 200) { |
|
523 | + $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
|
524 | + } else { |
|
525 | + $yymatches = array_filter($yymatches, 'strlen'); |
|
526 | + } |
|
527 | + if (empty($yymatches)) { |
|
528 | + throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . |
|
529 | + substr($this->data, $this->counter, 5) . '... state COMMENT'); |
|
530 | + } |
|
531 | + next($yymatches); // skip global match |
|
532 | + $this->token = key($yymatches); // token number |
|
533 | + $this->value = current($yymatches); // token value |
|
534 | + $r = $this->{'yy_r4_' . $this->token}(); |
|
535 | + if ($r === null) { |
|
536 | + $this->counter += strlen($this->value); |
|
537 | + $this->line += substr_count($this->value, "\n"); |
|
538 | + // accept this token |
|
539 | + return true; |
|
540 | + } elseif ($r === true) { |
|
541 | + // we have changed state |
|
542 | + // process this token in the new state |
|
543 | + return $this->yylex(); |
|
544 | + } elseif ($r === false) { |
|
545 | + $this->counter += strlen($this->value); |
|
546 | + $this->line += substr_count($this->value, "\n"); |
|
547 | + if ($this->counter >= strlen($this->data)) { |
|
548 | + return false; // end of input |
|
549 | + } |
|
550 | + // skip this token |
|
551 | + continue; |
|
552 | + } |
|
553 | + } else { |
|
554 | + throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); |
|
555 | + } |
|
556 | + break; |
|
557 | + } |
|
558 | + while (true); |
|
559 | + } // end function |
|
560 | + |
|
561 | + const COMMENT = 4; |
|
562 | + |
|
563 | + public function yy_r4_1() |
|
564 | + { |
|
565 | + |
|
566 | + return false; |
|
567 | + } |
|
568 | + |
|
569 | + public function yy_r4_2() |
|
570 | + { |
|
571 | + |
|
572 | + $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; |
|
573 | + } |
|
574 | + |
|
575 | + public function yy_r4_3() |
|
576 | + { |
|
577 | + |
|
578 | + $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE; |
|
579 | + $this->yypopstate(); |
|
580 | + } |
|
581 | + |
|
582 | + public function yylex5() |
|
583 | + { |
|
584 | + if (!isset($this->yy_global_pattern5)) { |
|
585 | + $this->yy_global_pattern5 = "/\G(\\.)|\G(.*?(?=[\.=[\]\r\n]))/isS"; |
|
586 | + } |
|
587 | + if ($this->counter >= strlen($this->data)) { |
|
588 | + return false; // end of input |
|
589 | + } |
|
590 | + |
|
591 | + do { |
|
592 | + if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, null, $this->counter)) { |
|
593 | + $yysubmatches = $yymatches; |
|
594 | + if (strlen($yysubmatches[ 0 ]) < 200) { |
|
595 | + $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
|
596 | + } else { |
|
597 | + $yymatches = array_filter($yymatches, 'strlen'); |
|
598 | + } |
|
599 | + if (empty($yymatches)) { |
|
600 | + throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . |
|
601 | + substr($this->data, $this->counter, 5) . '... state SECTION'); |
|
602 | + } |
|
603 | + next($yymatches); // skip global match |
|
604 | + $this->token = key($yymatches); // token number |
|
605 | + $this->value = current($yymatches); // token value |
|
606 | + $r = $this->{'yy_r5_' . $this->token}(); |
|
607 | + if ($r === null) { |
|
608 | + $this->counter += strlen($this->value); |
|
609 | + $this->line += substr_count($this->value, "\n"); |
|
610 | + // accept this token |
|
611 | + return true; |
|
612 | + } elseif ($r === true) { |
|
613 | + // we have changed state |
|
614 | + // process this token in the new state |
|
615 | + return $this->yylex(); |
|
616 | + } elseif ($r === false) { |
|
617 | + $this->counter += strlen($this->value); |
|
618 | + $this->line += substr_count($this->value, "\n"); |
|
619 | + if ($this->counter >= strlen($this->data)) { |
|
620 | + return false; // end of input |
|
621 | + } |
|
622 | + // skip this token |
|
623 | + continue; |
|
624 | + } |
|
625 | + } else { |
|
626 | + throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); |
|
627 | + } |
|
628 | + break; |
|
629 | + } |
|
630 | + while (true); |
|
631 | + } // end function |
|
632 | + |
|
633 | + const SECTION = 5; |
|
634 | + |
|
635 | + public function yy_r5_1() |
|
636 | + { |
|
637 | + |
|
638 | + $this->token = Smarty_Internal_Configfileparser::TPC_DOT; |
|
639 | + } |
|
640 | + |
|
641 | + public function yy_r5_2() |
|
642 | + { |
|
643 | + |
|
644 | + $this->token = Smarty_Internal_Configfileparser::TPC_SECTION; |
|
645 | + $this->yypopstate(); |
|
646 | + } |
|
647 | + |
|
648 | + public function yylex6() |
|
649 | + { |
|
650 | + if (!isset($this->yy_global_pattern6)) { |
|
651 | + $this->yy_global_pattern6 = "/\G(\"\"\"(?=[ \t\r]*[\n#;]))|\G([\S\s])/isS"; |
|
652 | + } |
|
653 | + if ($this->counter >= strlen($this->data)) { |
|
654 | + return false; // end of input |
|
655 | + } |
|
656 | + |
|
657 | + do { |
|
658 | + if (preg_match($this->yy_global_pattern6, $this->data, $yymatches, null, $this->counter)) { |
|
659 | + $yysubmatches = $yymatches; |
|
660 | + if (strlen($yysubmatches[ 0 ]) < 200) { |
|
661 | + $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
|
662 | + } else { |
|
663 | + $yymatches = array_filter($yymatches, 'strlen'); |
|
664 | + } |
|
665 | + if (empty($yymatches)) { |
|
666 | + throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . |
|
667 | + substr($this->data, $this->counter, 5) . '... state TRIPPLE'); |
|
668 | + } |
|
669 | + next($yymatches); // skip global match |
|
670 | + $this->token = key($yymatches); // token number |
|
671 | + $this->value = current($yymatches); // token value |
|
672 | + $r = $this->{'yy_r6_' . $this->token}(); |
|
673 | + if ($r === null) { |
|
674 | + $this->counter += strlen($this->value); |
|
675 | + $this->line += substr_count($this->value, "\n"); |
|
676 | + // accept this token |
|
677 | + return true; |
|
678 | + } elseif ($r === true) { |
|
679 | + // we have changed state |
|
680 | + // process this token in the new state |
|
681 | + return $this->yylex(); |
|
682 | + } elseif ($r === false) { |
|
683 | + $this->counter += strlen($this->value); |
|
684 | + $this->line += substr_count($this->value, "\n"); |
|
685 | + if ($this->counter >= strlen($this->data)) { |
|
686 | + return false; // end of input |
|
687 | + } |
|
688 | + // skip this token |
|
689 | + continue; |
|
690 | + } |
|
691 | + } else { |
|
692 | + throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); |
|
693 | + } |
|
694 | + break; |
|
695 | + } |
|
696 | + while (true); |
|
697 | + } // end function |
|
698 | + |
|
699 | + const TRIPPLE = 6; |
|
700 | + |
|
701 | + public function yy_r6_1() |
|
702 | + { |
|
703 | + |
|
704 | + $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END; |
|
705 | + $this->yypopstate(); |
|
706 | + $this->yypushstate(self::START); |
|
707 | + } |
|
708 | + |
|
709 | + public function yy_r6_2() |
|
710 | + { |
|
711 | + |
|
712 | + $to = strlen($this->data); |
|
713 | + preg_match("/\"\"\"[ \t\r]*[\n#;]/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); |
|
714 | + if (isset($match[ 0 ][ 1 ])) { |
|
715 | + $to = $match[ 0 ][ 1 ]; |
|
716 | + } else { |
|
717 | + $this->compiler->trigger_template_error("missing or misspelled literal closing tag"); |
|
718 | + } |
|
719 | + $this->value = substr($this->data, $this->counter, $to - $this->counter); |
|
720 | + $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT; |
|
721 | + } |
|
722 | 722 | |
723 | 723 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
181 | - * @param null $new_instance |
|
181 | + * @param Smarty_Internal_Configfileparser $new_instance |
|
182 | 182 | * |
183 | 183 | * @return null |
184 | 184 | */ |
@@ -949,6 +949,9 @@ discard block |
||
949 | 949 | $this->retvalue = $this->_retvalue; |
950 | 950 | } |
951 | 951 | |
952 | + /** |
|
953 | + * @param integer $yymajor |
|
954 | + */ |
|
952 | 955 | public function doParse($yymajor, $yytokenvalue) |
953 | 956 | { |
954 | 957 | $yyerrorhit = 0; /* True if yymajor has invoked an error */ |
@@ -28,18 +28,18 @@ discard block |
||
28 | 28 | |
29 | 29 | public function offsetExists($offset) |
30 | 30 | { |
31 | - return isset($this->metadata[ $offset ]); |
|
31 | + return isset($this->metadata[$offset]); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | public function offsetGet($offset) |
35 | 35 | { |
36 | - return $this->metadata[ $offset ]; |
|
36 | + return $this->metadata[$offset]; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public function offsetSet($offset, $value) |
40 | 40 | { |
41 | 41 | if ($offset === null) { |
42 | - if (isset($value[ 0 ])) { |
|
42 | + if (isset($value[0])) { |
|
43 | 43 | $x = ($value instanceof TPC_yyToken) ? $value->metadata : $value; |
44 | 44 | $this->metadata = array_merge($this->metadata, $x); |
45 | 45 | |
@@ -52,23 +52,23 @@ discard block |
||
52 | 52 | } |
53 | 53 | if ($value instanceof TPC_yyToken) { |
54 | 54 | if ($value->metadata) { |
55 | - $this->metadata[ $offset ] = $value->metadata; |
|
55 | + $this->metadata[$offset] = $value->metadata; |
|
56 | 56 | } |
57 | 57 | } elseif ($value) { |
58 | - $this->metadata[ $offset ] = $value; |
|
58 | + $this->metadata[$offset] = $value; |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | 62 | public function offsetUnset($offset) |
63 | 63 | { |
64 | - unset($this->metadata[ $offset ]); |
|
64 | + unset($this->metadata[$offset]); |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | 68 | class TPC_yyStackEntry |
69 | 69 | { |
70 | - public $stateno; /* The state-number */ |
|
71 | - public $major; /* The major token value. This is the code |
|
70 | + public $stateno; /* The state-number */ |
|
71 | + public $major; /* The major token value. This is the code |
|
72 | 72 | ** number for the token at this stack level */ |
73 | 73 | public $minor; /* The user-supplied minor token value. This |
74 | 74 | ** is the value of the token */ |
@@ -226,9 +226,9 @@ discard block |
||
226 | 226 | |
227 | 227 | $str = ""; |
228 | 228 | foreach ($ss as $s) { |
229 | - if (strlen($s) === 2 && $s[ 0 ] === '\\') { |
|
230 | - if (isset(self::$escapes_single[ $s[ 1 ] ])) { |
|
231 | - $s = self::$escapes_single[ $s[ 1 ] ]; |
|
229 | + if (strlen($s) === 2 && $s[0] === '\\') { |
|
230 | + if (isset(self::$escapes_single[$s[1]])) { |
|
231 | + $s = self::$escapes_single[$s[1]]; |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | $str .= $s; |
@@ -269,14 +269,14 @@ discard block |
||
269 | 269 | */ |
270 | 270 | private function set_var(Array $var, Array &$target_array) |
271 | 271 | { |
272 | - $key = $var[ "key" ]; |
|
273 | - $value = $var[ "value" ]; |
|
272 | + $key = $var["key"]; |
|
273 | + $value = $var["value"]; |
|
274 | 274 | |
275 | - if ($this->configOverwrite || !isset($target_array[ 'vars' ][ $key ])) { |
|
276 | - $target_array[ 'vars' ][ $key ] = $value; |
|
275 | + if ($this->configOverwrite || !isset($target_array['vars'][$key])) { |
|
276 | + $target_array['vars'][$key] = $value; |
|
277 | 277 | } else { |
278 | - settype($target_array[ 'vars' ][ $key ], 'array'); |
|
279 | - $target_array[ 'vars' ][ $key ][] = $value; |
|
278 | + settype($target_array['vars'][$key], 'array'); |
|
279 | + $target_array['vars'][$key][] = $value; |
|
280 | 280 | } |
281 | 281 | } |
282 | 282 | |
@@ -287,8 +287,8 @@ discard block |
||
287 | 287 | */ |
288 | 288 | private function add_global_vars(Array $vars) |
289 | 289 | { |
290 | - if (!isset($this->compiler->config_data[ 'vars' ])) { |
|
291 | - $this->compiler->config_data[ 'vars' ] = Array(); |
|
290 | + if (!isset($this->compiler->config_data['vars'])) { |
|
291 | + $this->compiler->config_data['vars'] = Array(); |
|
292 | 292 | } |
293 | 293 | foreach ($vars as $var) { |
294 | 294 | $this->set_var($var, $this->compiler->config_data); |
@@ -303,11 +303,11 @@ discard block |
||
303 | 303 | */ |
304 | 304 | private function add_section_vars($section_name, Array $vars) |
305 | 305 | { |
306 | - if (!isset($this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ])) { |
|
307 | - $this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ] = Array(); |
|
306 | + if (!isset($this->compiler->config_data['sections'][$section_name]['vars'])) { |
|
307 | + $this->compiler->config_data['sections'][$section_name]['vars'] = Array(); |
|
308 | 308 | } |
309 | 309 | foreach ($vars as $var) { |
310 | - $this->set_var($var, $this->compiler->config_data[ 'sections' ][ $section_name ]); |
|
310 | + $this->set_var($var, $this->compiler->config_data['sections'][$section_name]); |
|
311 | 311 | } |
312 | 312 | } |
313 | 313 | |
@@ -365,14 +365,14 @@ discard block |
||
365 | 365 | |
366 | 366 | const YY_SHIFT_MAX = 19; |
367 | 367 | |
368 | - static public $yy_shift_ofst = array(- 8, 1, 1, 1, - 7, - 3, - 3, 30, - 8, - 8, - 8, 19, 5, 3, 15, 16, 24, 25, 32, |
|
368 | + static public $yy_shift_ofst = array(-8, 1, 1, 1, - 7, - 3, - 3, 30, - 8, - 8, - 8, 19, 5, 3, 15, 16, 24, 25, 32, |
|
369 | 369 | 20,); |
370 | 370 | |
371 | 371 | const YY_REDUCE_USE_DFLT = - 21; |
372 | 372 | |
373 | 373 | const YY_REDUCE_MAX = 10; |
374 | 374 | |
375 | - static public $yy_reduce_ofst = array(- 10, - 1, - 1, - 1, - 20, 10, 12, 8, 14, 7, - 11,); |
|
375 | + static public $yy_reduce_ofst = array(-10, - 1, - 1, - 1, - 20, 10, 12, 8, 14, 7, - 11,); |
|
376 | 376 | |
377 | 377 | static public $yyExpectedTokens = array(array(), array(5, 17, 18,), array(5, 17, 18,), array(5, 17, 18,), |
378 | 378 | array(7, 8, 9, 10, 11, 12, 15, 16,), array(17, 18,), array(17, 18,), |
@@ -422,9 +422,9 @@ discard block |
||
422 | 422 | |
423 | 423 | public $yyTracePrompt; |
424 | 424 | |
425 | - public $yyidx; /* Index of top element in stack */ |
|
426 | - public $yyerrcnt; /* Shifts left before out of the error */ |
|
427 | - public $yystack = array(); /* The parser's stack */ |
|
425 | + public $yyidx; /* Index of top element in stack */ |
|
426 | + public $yyerrcnt; /* Shifts left before out of the error */ |
|
427 | + public $yystack = array(); /* The parser's stack */ |
|
428 | 428 | |
429 | 429 | public $yyTokenName = array('$', 'OPENB', 'SECTION', 'CLOSEB', 'DOT', 'ID', 'EQUAL', 'FLOAT', 'INT', 'BOOL', |
430 | 430 | 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING', 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT', |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | return 'End of Input'; |
450 | 450 | } |
451 | 451 | if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) { |
452 | - return $this->yyTokenName[ $tokenType ]; |
|
452 | + return $this->yyTokenName[$tokenType]; |
|
453 | 453 | } else { |
454 | 454 | return "Unknown"; |
455 | 455 | } |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | { |
460 | 460 | switch ($yymajor) { |
461 | 461 | default: |
462 | - break; /* If no destructor action specified: do nothing */ |
|
462 | + break; /* If no destructor action specified: do nothing */ |
|
463 | 463 | } |
464 | 464 | } |
465 | 465 | |
@@ -470,11 +470,11 @@ discard block |
||
470 | 470 | } |
471 | 471 | $yytos = array_pop($this->yystack); |
472 | 472 | if ($this->yyTraceFILE && $this->yyidx >= 0) { |
473 | - fwrite($this->yyTraceFILE, $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . "\n"); |
|
473 | + fwrite($this->yyTraceFILE, $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[$yytos->major] . "\n"); |
|
474 | 474 | } |
475 | 475 | $yymajor = $yytos->major; |
476 | 476 | self::yy_destructor($yymajor, $yytos->minor); |
477 | - $this->yyidx --; |
|
477 | + $this->yyidx--; |
|
478 | 478 | |
479 | 479 | return $yymajor; |
480 | 480 | } |
@@ -493,14 +493,14 @@ discard block |
||
493 | 493 | { |
494 | 494 | static $res3 = array(); |
495 | 495 | static $res4 = array(); |
496 | - $state = $this->yystack[ $this->yyidx ]->stateno; |
|
497 | - $expected = self::$yyExpectedTokens[ $state ]; |
|
498 | - if (isset($res3[ $state ][ $token ])) { |
|
499 | - if ($res3[ $state ][ $token ]) { |
|
496 | + $state = $this->yystack[$this->yyidx]->stateno; |
|
497 | + $expected = self::$yyExpectedTokens[$state]; |
|
498 | + if (isset($res3[$state][$token])) { |
|
499 | + if ($res3[$state][$token]) { |
|
500 | 500 | return $expected; |
501 | 501 | } |
502 | 502 | } else { |
503 | - if ($res3[ $state ][ $token ] = in_array($token, self::$yyExpectedTokens[ $state ], true)) { |
|
503 | + if ($res3[$state][$token] = in_array($token, self::$yyExpectedTokens[$state], true)) { |
|
504 | 504 | return $expected; |
505 | 505 | } |
506 | 506 | } |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | // reduce action |
513 | 513 | $done = 0; |
514 | 514 | do { |
515 | - if ($done ++ == 100) { |
|
515 | + if ($done++ == 100) { |
|
516 | 516 | $this->yyidx = $yyidx; |
517 | 517 | $this->yystack = $stack; |
518 | 518 | // too much recursion prevents proper detection |
@@ -520,20 +520,20 @@ discard block |
||
520 | 520 | return array_unique($expected); |
521 | 521 | } |
522 | 522 | $yyruleno = $yyact - self::YYNSTATE; |
523 | - $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ]; |
|
524 | - $nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, |
|
525 | - self::$yyRuleInfo[ $yyruleno ][ 0 ]); |
|
526 | - if (isset(self::$yyExpectedTokens[ $nextstate ])) { |
|
527 | - $expected = array_merge($expected, self::$yyExpectedTokens[ $nextstate ]); |
|
528 | - if (isset($res4[ $nextstate ][ $token ])) { |
|
529 | - if ($res4[ $nextstate ][ $token ]) { |
|
523 | + $this->yyidx -= self::$yyRuleInfo[$yyruleno][1]; |
|
524 | + $nextstate = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, |
|
525 | + self::$yyRuleInfo[$yyruleno][0]); |
|
526 | + if (isset(self::$yyExpectedTokens[$nextstate])) { |
|
527 | + $expected = array_merge($expected, self::$yyExpectedTokens[$nextstate]); |
|
528 | + if (isset($res4[$nextstate][$token])) { |
|
529 | + if ($res4[$nextstate][$token]) { |
|
530 | 530 | $this->yyidx = $yyidx; |
531 | 531 | $this->yystack = $stack; |
532 | 532 | return array_unique($expected); |
533 | 533 | } |
534 | 534 | } else { |
535 | - if ($res4[ $nextstate ][ $token ] = |
|
536 | - in_array($token, self::$yyExpectedTokens[ $nextstate ], true) |
|
535 | + if ($res4[$nextstate][$token] = |
|
536 | + in_array($token, self::$yyExpectedTokens[$nextstate], true) |
|
537 | 537 | ) { |
538 | 538 | $this->yyidx = $yyidx; |
539 | 539 | $this->yystack = $stack; |
@@ -543,11 +543,11 @@ discard block |
||
543 | 543 | } |
544 | 544 | if ($nextstate < self::YYNSTATE) { |
545 | 545 | // we need to shift a non-terminal |
546 | - $this->yyidx ++; |
|
546 | + $this->yyidx++; |
|
547 | 547 | $x = new TPC_yyStackEntry; |
548 | 548 | $x->stateno = $nextstate; |
549 | - $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ]; |
|
550 | - $this->yystack[ $this->yyidx ] = $x; |
|
549 | + $x->major = self::$yyRuleInfo[$yyruleno][0]; |
|
550 | + $this->yystack[$this->yyidx] = $x; |
|
551 | 551 | continue 2; |
552 | 552 | } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) { |
553 | 553 | $this->yyidx = $yyidx; |
@@ -583,13 +583,13 @@ discard block |
||
583 | 583 | if ($token === 0) { |
584 | 584 | return true; // 0 is not part of this |
585 | 585 | } |
586 | - $state = $this->yystack[ $this->yyidx ]->stateno; |
|
587 | - if (isset($res[ $state ][ $token ])) { |
|
588 | - if ($res[ $state ][ $token ]) { |
|
586 | + $state = $this->yystack[$this->yyidx]->stateno; |
|
587 | + if (isset($res[$state][$token])) { |
|
588 | + if ($res[$state][$token]) { |
|
589 | 589 | return true; |
590 | 590 | } |
591 | 591 | } else { |
592 | - if ($res[ $state ][ $token ] = in_array($token, self::$yyExpectedTokens[ $state ], true)) { |
|
592 | + if ($res[$state][$token] = in_array($token, self::$yyExpectedTokens[$state], true)) { |
|
593 | 593 | return true; |
594 | 594 | } |
595 | 595 | } |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | // reduce action |
602 | 602 | $done = 0; |
603 | 603 | do { |
604 | - if ($done ++ == 100) { |
|
604 | + if ($done++ == 100) { |
|
605 | 605 | $this->yyidx = $yyidx; |
606 | 606 | $this->yystack = $stack; |
607 | 607 | // too much recursion prevents proper detection |
@@ -609,18 +609,18 @@ discard block |
||
609 | 609 | return true; |
610 | 610 | } |
611 | 611 | $yyruleno = $yyact - self::YYNSTATE; |
612 | - $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ]; |
|
613 | - $nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, |
|
614 | - self::$yyRuleInfo[ $yyruleno ][ 0 ]); |
|
615 | - if (isset($res2[ $nextstate ][ $token ])) { |
|
616 | - if ($res2[ $nextstate ][ $token ]) { |
|
612 | + $this->yyidx -= self::$yyRuleInfo[$yyruleno][1]; |
|
613 | + $nextstate = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, |
|
614 | + self::$yyRuleInfo[$yyruleno][0]); |
|
615 | + if (isset($res2[$nextstate][$token])) { |
|
616 | + if ($res2[$nextstate][$token]) { |
|
617 | 617 | $this->yyidx = $yyidx; |
618 | 618 | $this->yystack = $stack; |
619 | 619 | return true; |
620 | 620 | } |
621 | 621 | } else { |
622 | - if ($res2[ $nextstate ][ $token ] = (isset(self::$yyExpectedTokens[ $nextstate ]) && |
|
623 | - in_array($token, self::$yyExpectedTokens[ $nextstate ], |
|
622 | + if ($res2[$nextstate][$token] = (isset(self::$yyExpectedTokens[$nextstate]) && |
|
623 | + in_array($token, self::$yyExpectedTokens[$nextstate], |
|
624 | 624 | true)) |
625 | 625 | ) { |
626 | 626 | $this->yyidx = $yyidx; |
@@ -630,11 +630,11 @@ discard block |
||
630 | 630 | } |
631 | 631 | if ($nextstate < self::YYNSTATE) { |
632 | 632 | // we need to shift a non-terminal |
633 | - $this->yyidx ++; |
|
633 | + $this->yyidx++; |
|
634 | 634 | $x = new TPC_yyStackEntry; |
635 | 635 | $x->stateno = $nextstate; |
636 | - $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ]; |
|
637 | - $this->yystack[ $this->yyidx ] = $x; |
|
636 | + $x->major = self::$yyRuleInfo[$yyruleno][0]; |
|
637 | + $this->yystack[$this->yyidx] = $x; |
|
638 | 638 | continue 2; |
639 | 639 | } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) { |
640 | 640 | $this->yyidx = $yyidx; |
@@ -669,37 +669,37 @@ discard block |
||
669 | 669 | |
670 | 670 | public function yy_find_shift_action($iLookAhead) |
671 | 671 | { |
672 | - $stateno = $this->yystack[ $this->yyidx ]->stateno; |
|
672 | + $stateno = $this->yystack[$this->yyidx]->stateno; |
|
673 | 673 | |
674 | 674 | /* if ($this->yyidx < 0) return self::YY_NO_ACTION; */ |
675 | - if (!isset(self::$yy_shift_ofst[ $stateno ])) { |
|
675 | + if (!isset(self::$yy_shift_ofst[$stateno])) { |
|
676 | 676 | // no shift actions |
677 | - return self::$yy_default[ $stateno ]; |
|
677 | + return self::$yy_default[$stateno]; |
|
678 | 678 | } |
679 | - $i = self::$yy_shift_ofst[ $stateno ]; |
|
679 | + $i = self::$yy_shift_ofst[$stateno]; |
|
680 | 680 | if ($i === self::YY_SHIFT_USE_DFLT) { |
681 | - return self::$yy_default[ $stateno ]; |
|
681 | + return self::$yy_default[$stateno]; |
|
682 | 682 | } |
683 | 683 | if ($iLookAhead == self::YYNOCODE) { |
684 | 684 | return self::YY_NO_ACTION; |
685 | 685 | } |
686 | 686 | $i += $iLookAhead; |
687 | - if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[ $i ] != $iLookAhead) { |
|
687 | + if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[$i] != $iLookAhead) { |
|
688 | 688 | if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback) && |
689 | - ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0 |
|
689 | + ($iFallback = self::$yyFallback[$iLookAhead]) != 0 |
|
690 | 690 | ) { |
691 | 691 | if ($this->yyTraceFILE) { |
692 | 692 | fwrite($this->yyTraceFILE, |
693 | - $this->yyTracePrompt . "FALLBACK " . $this->yyTokenName[ $iLookAhead ] . " => " . |
|
694 | - $this->yyTokenName[ $iFallback ] . "\n"); |
|
693 | + $this->yyTracePrompt . "FALLBACK " . $this->yyTokenName[$iLookAhead] . " => " . |
|
694 | + $this->yyTokenName[$iFallback] . "\n"); |
|
695 | 695 | } |
696 | 696 | |
697 | 697 | return $this->yy_find_shift_action($iFallback); |
698 | 698 | } |
699 | 699 | |
700 | - return self::$yy_default[ $stateno ]; |
|
700 | + return self::$yy_default[$stateno]; |
|
701 | 701 | } else { |
702 | - return self::$yy_action[ $i ]; |
|
702 | + return self::$yy_action[$i]; |
|
703 | 703 | } |
704 | 704 | } |
705 | 705 | |
@@ -707,29 +707,29 @@ discard block |
||
707 | 707 | { |
708 | 708 | /* $stateno = $this->yystack[$this->yyidx]->stateno; */ |
709 | 709 | |
710 | - if (!isset(self::$yy_reduce_ofst[ $stateno ])) { |
|
711 | - return self::$yy_default[ $stateno ]; |
|
710 | + if (!isset(self::$yy_reduce_ofst[$stateno])) { |
|
711 | + return self::$yy_default[$stateno]; |
|
712 | 712 | } |
713 | - $i = self::$yy_reduce_ofst[ $stateno ]; |
|
713 | + $i = self::$yy_reduce_ofst[$stateno]; |
|
714 | 714 | if ($i == self::YY_REDUCE_USE_DFLT) { |
715 | - return self::$yy_default[ $stateno ]; |
|
715 | + return self::$yy_default[$stateno]; |
|
716 | 716 | } |
717 | 717 | if ($iLookAhead == self::YYNOCODE) { |
718 | 718 | return self::YY_NO_ACTION; |
719 | 719 | } |
720 | 720 | $i += $iLookAhead; |
721 | - if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[ $i ] != $iLookAhead) { |
|
722 | - return self::$yy_default[ $stateno ]; |
|
721 | + if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[$i] != $iLookAhead) { |
|
722 | + return self::$yy_default[$stateno]; |
|
723 | 723 | } else { |
724 | - return self::$yy_action[ $i ]; |
|
724 | + return self::$yy_action[$i]; |
|
725 | 725 | } |
726 | 726 | } |
727 | 727 | |
728 | 728 | public function yy_shift($yyNewState, $yyMajor, $yypMinor) |
729 | 729 | { |
730 | - $this->yyidx ++; |
|
730 | + $this->yyidx++; |
|
731 | 731 | if ($this->yyidx >= self::YYSTACKDEPTH) { |
732 | - $this->yyidx --; |
|
732 | + $this->yyidx--; |
|
733 | 733 | if ($this->yyTraceFILE) { |
734 | 734 | fprintf($this->yyTraceFILE, "%sStack Overflow!\n", $this->yyTracePrompt); |
735 | 735 | } |
@@ -751,8 +751,8 @@ discard block |
||
751 | 751 | if ($this->yyTraceFILE && $this->yyidx > 0) { |
752 | 752 | fprintf($this->yyTraceFILE, "%sShift %d\n", $this->yyTracePrompt, $yyNewState); |
753 | 753 | fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt); |
754 | - for ($i = 1; $i <= $this->yyidx; $i ++) { |
|
755 | - fprintf($this->yyTraceFILE, " %s", $this->yyTokenName[ $this->yystack[ $i ]->major ]); |
|
754 | + for ($i = 1; $i <= $this->yyidx; $i++) { |
|
755 | + fprintf($this->yyTraceFILE, " %s", $this->yyTokenName[$this->yystack[$i]->major]); |
|
756 | 756 | } |
757 | 757 | fwrite($this->yyTraceFILE, "\n"); |
758 | 758 | } |
@@ -780,14 +780,14 @@ discard block |
||
780 | 780 | #line 266 "../smarty/lexer/smarty_internal_configfileparser.y" |
781 | 781 | function yy_r1() |
782 | 782 | { |
783 | - $this->add_global_vars($this->yystack[ $this->yyidx + 0 ]->minor); |
|
783 | + $this->add_global_vars($this->yystack[$this->yyidx + 0]->minor); |
|
784 | 784 | $this->_retvalue = null; |
785 | 785 | } |
786 | 786 | |
787 | 787 | #line 280 "../smarty/lexer/smarty_internal_configfileparser.y" |
788 | 788 | function yy_r4() |
789 | 789 | { |
790 | - $this->add_section_vars($this->yystack[ $this->yyidx + - 3 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor); |
|
790 | + $this->add_section_vars($this->yystack[$this->yyidx + - 3]->minor, $this->yystack[$this->yyidx + 0]->minor); |
|
791 | 791 | $this->_retvalue = null; |
792 | 792 | } |
793 | 793 | |
@@ -795,8 +795,8 @@ discard block |
||
795 | 795 | function yy_r5() |
796 | 796 | { |
797 | 797 | if ($this->configReadHidden) { |
798 | - $this->add_section_vars($this->yystack[ $this->yyidx + - 3 ]->minor, |
|
799 | - $this->yystack[ $this->yyidx + 0 ]->minor); |
|
798 | + $this->add_section_vars($this->yystack[$this->yyidx + - 3]->minor, |
|
799 | + $this->yystack[$this->yyidx + 0]->minor); |
|
800 | 800 | } |
801 | 801 | $this->_retvalue = null; |
802 | 802 | } |
@@ -804,14 +804,14 @@ discard block |
||
804 | 804 | #line 293 "../smarty/lexer/smarty_internal_configfileparser.y" |
805 | 805 | function yy_r6() |
806 | 806 | { |
807 | - $this->_retvalue = $this->yystack[ $this->yyidx + - 1 ]->minor; |
|
807 | + $this->_retvalue = $this->yystack[$this->yyidx + - 1]->minor; |
|
808 | 808 | } |
809 | 809 | |
810 | 810 | #line 297 "../smarty/lexer/smarty_internal_configfileparser.y" |
811 | 811 | function yy_r7() |
812 | 812 | { |
813 | 813 | $this->_retvalue = |
814 | - array_merge($this->yystack[ $this->yyidx + - 1 ]->minor, Array($this->yystack[ $this->yyidx + 0 ]->minor)); |
|
814 | + array_merge($this->yystack[$this->yyidx + - 1]->minor, Array($this->yystack[$this->yyidx + 0]->minor)); |
|
815 | 815 | } |
816 | 816 | |
817 | 817 | #line 301 "../smarty/lexer/smarty_internal_configfileparser.y" |
@@ -823,44 +823,44 @@ discard block |
||
823 | 823 | #line 307 "../smarty/lexer/smarty_internal_configfileparser.y" |
824 | 824 | function yy_r9() |
825 | 825 | { |
826 | - $this->_retvalue = Array("key" => $this->yystack[ $this->yyidx + - 2 ]->minor, |
|
827 | - "value" => $this->yystack[ $this->yyidx + 0 ]->minor); |
|
826 | + $this->_retvalue = Array("key" => $this->yystack[$this->yyidx + - 2]->minor, |
|
827 | + "value" => $this->yystack[$this->yyidx + 0]->minor); |
|
828 | 828 | } |
829 | 829 | |
830 | 830 | #line 312 "../smarty/lexer/smarty_internal_configfileparser.y" |
831 | 831 | function yy_r10() |
832 | 832 | { |
833 | - $this->_retvalue = (float) $this->yystack[ $this->yyidx + 0 ]->minor; |
|
833 | + $this->_retvalue = (float) $this->yystack[$this->yyidx + 0]->minor; |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | #line 316 "../smarty/lexer/smarty_internal_configfileparser.y" |
837 | 837 | function yy_r11() |
838 | 838 | { |
839 | - $this->_retvalue = (int) $this->yystack[ $this->yyidx + 0 ]->minor; |
|
839 | + $this->_retvalue = (int) $this->yystack[$this->yyidx + 0]->minor; |
|
840 | 840 | } |
841 | 841 | |
842 | 842 | #line 320 "../smarty/lexer/smarty_internal_configfileparser.y" |
843 | 843 | function yy_r12() |
844 | 844 | { |
845 | - $this->_retvalue = $this->parse_bool($this->yystack[ $this->yyidx + 0 ]->minor); |
|
845 | + $this->_retvalue = $this->parse_bool($this->yystack[$this->yyidx + 0]->minor); |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | #line 324 "../smarty/lexer/smarty_internal_configfileparser.y" |
849 | 849 | function yy_r13() |
850 | 850 | { |
851 | - $this->_retvalue = self::parse_single_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor); |
|
851 | + $this->_retvalue = self::parse_single_quoted_string($this->yystack[$this->yyidx + 0]->minor); |
|
852 | 852 | } |
853 | 853 | |
854 | 854 | #line 328 "../smarty/lexer/smarty_internal_configfileparser.y" |
855 | 855 | function yy_r14() |
856 | 856 | { |
857 | - $this->_retvalue = self::parse_double_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor); |
|
857 | + $this->_retvalue = self::parse_double_quoted_string($this->yystack[$this->yyidx + 0]->minor); |
|
858 | 858 | } |
859 | 859 | |
860 | 860 | #line 332 "../smarty/lexer/smarty_internal_configfileparser.y" |
861 | 861 | function yy_r15() |
862 | 862 | { |
863 | - $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[ $this->yyidx + - 1 ]->minor); |
|
863 | + $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[$this->yyidx + - 1]->minor); |
|
864 | 864 | } |
865 | 865 | |
866 | 866 | #line 336 "../smarty/lexer/smarty_internal_configfileparser.y" |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | #line 340 "../smarty/lexer/smarty_internal_configfileparser.y" |
873 | 873 | function yy_r17() |
874 | 874 | { |
875 | - $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; |
|
875 | + $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; |
|
876 | 876 | } |
877 | 877 | |
878 | 878 | private $_retvalue; |
@@ -881,32 +881,32 @@ discard block |
||
881 | 881 | { |
882 | 882 | if ($this->yyTraceFILE && $yyruleno >= 0 && $yyruleno < count(self::$yyRuleName)) { |
883 | 883 | fprintf($this->yyTraceFILE, "%sReduce (%d) [%s].\n", $this->yyTracePrompt, $yyruleno, |
884 | - self::$yyRuleName[ $yyruleno ]); |
|
884 | + self::$yyRuleName[$yyruleno]); |
|
885 | 885 | } |
886 | 886 | |
887 | 887 | $this->_retvalue = $yy_lefthand_side = null; |
888 | - if (isset(self::$yyReduceMap[ $yyruleno ])) { |
|
888 | + if (isset(self::$yyReduceMap[$yyruleno])) { |
|
889 | 889 | // call the action |
890 | 890 | $this->_retvalue = null; |
891 | - $this->{'yy_r' . self::$yyReduceMap[ $yyruleno ]}(); |
|
891 | + $this->{'yy_r' . self::$yyReduceMap[$yyruleno]}(); |
|
892 | 892 | $yy_lefthand_side = $this->_retvalue; |
893 | 893 | } |
894 | - $yygoto = self::$yyRuleInfo[ $yyruleno ][ 0 ]; |
|
895 | - $yysize = self::$yyRuleInfo[ $yyruleno ][ 1 ]; |
|
894 | + $yygoto = self::$yyRuleInfo[$yyruleno][0]; |
|
895 | + $yysize = self::$yyRuleInfo[$yyruleno][1]; |
|
896 | 896 | $this->yyidx -= $yysize; |
897 | - for ($i = $yysize; $i; $i --) { |
|
897 | + for ($i = $yysize; $i; $i--) { |
|
898 | 898 | // pop all of the right-hand side parameters |
899 | 899 | array_pop($this->yystack); |
900 | 900 | } |
901 | - $yyact = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, $yygoto); |
|
901 | + $yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto); |
|
902 | 902 | if ($yyact < self::YYNSTATE) { |
903 | 903 | if (!$this->yyTraceFILE && $yysize) { |
904 | - $this->yyidx ++; |
|
904 | + $this->yyidx++; |
|
905 | 905 | $x = new TPC_yyStackEntry; |
906 | 906 | $x->stateno = $yyact; |
907 | 907 | $x->major = $yygoto; |
908 | 908 | $x->minor = $yy_lefthand_side; |
909 | - $this->yystack[ $this->yyidx ] = $x; |
|
909 | + $this->yystack[$this->yyidx] = $x; |
|
910 | 910 | } else { |
911 | 911 | $this->yy_shift($yyact, $yygoto, $yy_lefthand_side); |
912 | 912 | } |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | |
952 | 952 | public function doParse($yymajor, $yytokenvalue) |
953 | 953 | { |
954 | - $yyerrorhit = 0; /* True if yymajor has invoked an error */ |
|
954 | + $yyerrorhit = 0; /* True if yymajor has invoked an error */ |
|
955 | 955 | |
956 | 956 | if ($this->yyidx === null || $this->yyidx < 0) { |
957 | 957 | $this->yyidx = 0; |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | $yyendofinput = ($yymajor == 0); |
966 | 966 | |
967 | 967 | if ($this->yyTraceFILE) { |
968 | - fprintf($this->yyTraceFILE, "%sInput %s\n", $this->yyTracePrompt, $this->yyTokenName[ $yymajor ]); |
|
968 | + fprintf($this->yyTraceFILE, "%sInput %s\n", $this->yyTracePrompt, $this->yyTokenName[$yymajor]); |
|
969 | 969 | } |
970 | 970 | |
971 | 971 | do { |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | } |
977 | 977 | if ($yyact < self::YYNSTATE) { |
978 | 978 | $this->yy_shift($yyact, $yymajor, $yytokenvalue); |
979 | - $this->yyerrcnt --; |
|
979 | + $this->yyerrcnt--; |
|
980 | 980 | if ($yyendofinput && $this->yyidx >= 0) { |
981 | 981 | $yymajor = 0; |
982 | 982 | } else { |
@@ -992,11 +992,11 @@ discard block |
||
992 | 992 | if ($this->yyerrcnt < 0) { |
993 | 993 | $this->yy_syntax_error($yymajor, $yytokenvalue); |
994 | 994 | } |
995 | - $yymx = $this->yystack[ $this->yyidx ]->major; |
|
995 | + $yymx = $this->yystack[$this->yyidx]->major; |
|
996 | 996 | if ($yymx == self::YYERRORSYMBOL || $yyerrorhit) { |
997 | 997 | if ($this->yyTraceFILE) { |
998 | 998 | fprintf($this->yyTraceFILE, "%sDiscard input token %s\n", $this->yyTracePrompt, |
999 | - $this->yyTokenName[ $yymajor ]); |
|
999 | + $this->yyTokenName[$yymajor]); |
|
1000 | 1000 | } |
1001 | 1001 | $this->yy_destructor($yymajor, $yytokenvalue); |
1002 | 1002 | $yymajor = self::YYNOCODE; |
@@ -2,75 +2,75 @@ discard block |
||
2 | 2 | |
3 | 3 | class TPC_yyToken implements ArrayAccess |
4 | 4 | { |
5 | - public $string = ''; |
|
6 | - |
|
7 | - public $metadata = array(); |
|
8 | - |
|
9 | - public function __construct($s, $m = array()) |
|
10 | - { |
|
11 | - if ($s instanceof TPC_yyToken) { |
|
12 | - $this->string = $s->string; |
|
13 | - $this->metadata = $s->metadata; |
|
14 | - } else { |
|
15 | - $this->string = (string) $s; |
|
16 | - if ($m instanceof TPC_yyToken) { |
|
17 | - $this->metadata = $m->metadata; |
|
18 | - } elseif (is_array($m)) { |
|
19 | - $this->metadata = $m; |
|
20 | - } |
|
21 | - } |
|
22 | - } |
|
23 | - |
|
24 | - public function __toString() |
|
25 | - { |
|
26 | - return $this->string; |
|
27 | - } |
|
28 | - |
|
29 | - public function offsetExists($offset) |
|
30 | - { |
|
31 | - return isset($this->metadata[ $offset ]); |
|
32 | - } |
|
33 | - |
|
34 | - public function offsetGet($offset) |
|
35 | - { |
|
36 | - return $this->metadata[ $offset ]; |
|
37 | - } |
|
38 | - |
|
39 | - public function offsetSet($offset, $value) |
|
40 | - { |
|
41 | - if ($offset === null) { |
|
42 | - if (isset($value[ 0 ])) { |
|
43 | - $x = ($value instanceof TPC_yyToken) ? $value->metadata : $value; |
|
44 | - $this->metadata = array_merge($this->metadata, $x); |
|
45 | - |
|
46 | - return; |
|
47 | - } |
|
48 | - $offset = count($this->metadata); |
|
49 | - } |
|
50 | - if ($value === null) { |
|
51 | - return; |
|
52 | - } |
|
53 | - if ($value instanceof TPC_yyToken) { |
|
54 | - if ($value->metadata) { |
|
55 | - $this->metadata[ $offset ] = $value->metadata; |
|
56 | - } |
|
57 | - } elseif ($value) { |
|
58 | - $this->metadata[ $offset ] = $value; |
|
59 | - } |
|
60 | - } |
|
61 | - |
|
62 | - public function offsetUnset($offset) |
|
63 | - { |
|
64 | - unset($this->metadata[ $offset ]); |
|
65 | - } |
|
5 | + public $string = ''; |
|
6 | + |
|
7 | + public $metadata = array(); |
|
8 | + |
|
9 | + public function __construct($s, $m = array()) |
|
10 | + { |
|
11 | + if ($s instanceof TPC_yyToken) { |
|
12 | + $this->string = $s->string; |
|
13 | + $this->metadata = $s->metadata; |
|
14 | + } else { |
|
15 | + $this->string = (string) $s; |
|
16 | + if ($m instanceof TPC_yyToken) { |
|
17 | + $this->metadata = $m->metadata; |
|
18 | + } elseif (is_array($m)) { |
|
19 | + $this->metadata = $m; |
|
20 | + } |
|
21 | + } |
|
22 | + } |
|
23 | + |
|
24 | + public function __toString() |
|
25 | + { |
|
26 | + return $this->string; |
|
27 | + } |
|
28 | + |
|
29 | + public function offsetExists($offset) |
|
30 | + { |
|
31 | + return isset($this->metadata[ $offset ]); |
|
32 | + } |
|
33 | + |
|
34 | + public function offsetGet($offset) |
|
35 | + { |
|
36 | + return $this->metadata[ $offset ]; |
|
37 | + } |
|
38 | + |
|
39 | + public function offsetSet($offset, $value) |
|
40 | + { |
|
41 | + if ($offset === null) { |
|
42 | + if (isset($value[ 0 ])) { |
|
43 | + $x = ($value instanceof TPC_yyToken) ? $value->metadata : $value; |
|
44 | + $this->metadata = array_merge($this->metadata, $x); |
|
45 | + |
|
46 | + return; |
|
47 | + } |
|
48 | + $offset = count($this->metadata); |
|
49 | + } |
|
50 | + if ($value === null) { |
|
51 | + return; |
|
52 | + } |
|
53 | + if ($value instanceof TPC_yyToken) { |
|
54 | + if ($value->metadata) { |
|
55 | + $this->metadata[ $offset ] = $value->metadata; |
|
56 | + } |
|
57 | + } elseif ($value) { |
|
58 | + $this->metadata[ $offset ] = $value; |
|
59 | + } |
|
60 | + } |
|
61 | + |
|
62 | + public function offsetUnset($offset) |
|
63 | + { |
|
64 | + unset($this->metadata[ $offset ]); |
|
65 | + } |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | class TPC_yyStackEntry |
69 | 69 | { |
70 | - public $stateno; /* The state-number */ |
|
71 | - public $major; /* The major token value. This is the code |
|
70 | + public $stateno; /* The state-number */ |
|
71 | + public $major; /* The major token value. This is the code |
|
72 | 72 | ** number for the token at this stack level */ |
73 | - public $minor; /* The user-supplied minor token value. This |
|
73 | + public $minor; /* The user-supplied minor token value. This |
|
74 | 74 | ** is the value of the token */ |
75 | 75 | } |
76 | 76 | |
@@ -90,952 +90,952 @@ discard block |
||
90 | 90 | */ |
91 | 91 | class Smarty_Internal_Configfileparser |
92 | 92 | { |
93 | - #line 25 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
94 | - |
|
95 | - /** |
|
96 | - * result status |
|
97 | - * |
|
98 | - * @var bool |
|
99 | - */ |
|
100 | - public $successful = true; |
|
101 | - |
|
102 | - /** |
|
103 | - * return value |
|
104 | - * |
|
105 | - * @var mixed |
|
106 | - */ |
|
107 | - public $retvalue = 0; |
|
108 | - |
|
109 | - /** |
|
110 | - * @var |
|
111 | - */ |
|
112 | - public $yymajor; |
|
113 | - |
|
114 | - /** |
|
115 | - * lexer object |
|
116 | - * |
|
117 | - * @var Smarty_Internal_Configfilelexer |
|
118 | - */ |
|
119 | - private $lex; |
|
120 | - |
|
121 | - /** |
|
122 | - * internal error flag |
|
123 | - * |
|
124 | - * @var bool |
|
125 | - */ |
|
126 | - private $internalError = false; |
|
127 | - |
|
128 | - /** |
|
129 | - * compiler object |
|
130 | - * |
|
131 | - * @var Smarty_Internal_Config_File_Compiler |
|
132 | - */ |
|
133 | - public $compiler = null; |
|
134 | - |
|
135 | - /** |
|
136 | - * smarty object |
|
137 | - * |
|
138 | - * @var Smarty |
|
139 | - */ |
|
140 | - public $smarty = null; |
|
141 | - |
|
142 | - /** |
|
143 | - * copy of config_overwrite property |
|
144 | - * |
|
145 | - * @var bool |
|
146 | - */ |
|
147 | - private $configOverwrite = false; |
|
148 | - |
|
149 | - /** |
|
150 | - * copy of config_read_hidden property |
|
151 | - * |
|
152 | - * @var bool |
|
153 | - */ |
|
154 | - private $configReadHidden = false; |
|
155 | - |
|
156 | - /** |
|
157 | - * helper map |
|
158 | - * |
|
159 | - * @var array |
|
160 | - */ |
|
161 | - private static $escapes_single = Array('\\' => '\\', '\'' => '\''); |
|
162 | - |
|
163 | - /** |
|
164 | - * constructor |
|
165 | - * |
|
166 | - * @param Smarty_Internal_Configfilelexer $lex |
|
167 | - * @param Smarty_Internal_Config_File_Compiler $compiler |
|
168 | - */ |
|
169 | - public function __construct(Smarty_Internal_Configfilelexer $lex, Smarty_Internal_Config_File_Compiler $compiler) |
|
170 | - { |
|
171 | - // set instance object |
|
172 | - self::instance($this); |
|
173 | - $this->lex = $lex; |
|
174 | - $this->smarty = $compiler->smarty; |
|
175 | - $this->compiler = $compiler; |
|
176 | - $this->configOverwrite = $this->smarty->config_overwrite; |
|
177 | - $this->configReadHidden = $this->smarty->config_read_hidden; |
|
178 | - } |
|
179 | - |
|
180 | - /** |
|
181 | - * @param null $new_instance |
|
182 | - * |
|
183 | - * @return null |
|
184 | - */ |
|
185 | - public static function &instance($new_instance = null) |
|
186 | - { |
|
187 | - static $instance = null; |
|
188 | - if (isset($new_instance) && is_object($new_instance)) { |
|
189 | - $instance = $new_instance; |
|
190 | - } |
|
191 | - return $instance; |
|
192 | - } |
|
193 | - |
|
194 | - /** |
|
195 | - * parse optional boolean keywords |
|
196 | - * |
|
197 | - * @param string $str |
|
198 | - * |
|
199 | - * @return bool |
|
200 | - */ |
|
201 | - private function parse_bool($str) |
|
202 | - { |
|
203 | - $str = strtolower($str); |
|
204 | - if (in_array($str, array('on', 'yes', 'true'))) { |
|
205 | - $res = true; |
|
206 | - } else { |
|
207 | - $res = false; |
|
208 | - } |
|
209 | - return $res; |
|
210 | - } |
|
211 | - |
|
212 | - /** |
|
213 | - * parse single quoted string |
|
214 | - * remove outer quotes |
|
215 | - * unescape inner quotes |
|
216 | - * |
|
217 | - * @param string $qstr |
|
218 | - * |
|
219 | - * @return string |
|
220 | - */ |
|
221 | - private static function parse_single_quoted_string($qstr) |
|
222 | - { |
|
223 | - $escaped_string = substr($qstr, 1, strlen($qstr) - 2); //remove outer quotes |
|
224 | - |
|
225 | - $ss = preg_split('/(\\\\.)/', $escaped_string, - 1, PREG_SPLIT_DELIM_CAPTURE); |
|
226 | - |
|
227 | - $str = ""; |
|
228 | - foreach ($ss as $s) { |
|
229 | - if (strlen($s) === 2 && $s[ 0 ] === '\\') { |
|
230 | - if (isset(self::$escapes_single[ $s[ 1 ] ])) { |
|
231 | - $s = self::$escapes_single[ $s[ 1 ] ]; |
|
232 | - } |
|
233 | - } |
|
234 | - $str .= $s; |
|
235 | - } |
|
236 | - return $str; |
|
237 | - } |
|
238 | - |
|
239 | - /** |
|
240 | - * parse double quoted string |
|
241 | - * |
|
242 | - * @param string $qstr |
|
243 | - * |
|
244 | - * @return string |
|
245 | - */ |
|
246 | - private static function parse_double_quoted_string($qstr) |
|
247 | - { |
|
248 | - $inner_str = substr($qstr, 1, strlen($qstr) - 2); |
|
249 | - return stripcslashes($inner_str); |
|
250 | - } |
|
251 | - |
|
252 | - /** |
|
253 | - * parse triple quoted string |
|
254 | - * |
|
255 | - * @param string $qstr |
|
256 | - * |
|
257 | - * @return string |
|
258 | - */ |
|
259 | - private static function parse_tripple_double_quoted_string($qstr) |
|
260 | - { |
|
261 | - return stripcslashes($qstr); |
|
262 | - } |
|
263 | - |
|
264 | - /** |
|
265 | - * set a config variable in target array |
|
266 | - * |
|
267 | - * @param array $var |
|
268 | - * @param array $target_array |
|
269 | - */ |
|
270 | - private function set_var(Array $var, Array &$target_array) |
|
271 | - { |
|
272 | - $key = $var[ "key" ]; |
|
273 | - $value = $var[ "value" ]; |
|
274 | - |
|
275 | - if ($this->configOverwrite || !isset($target_array[ 'vars' ][ $key ])) { |
|
276 | - $target_array[ 'vars' ][ $key ] = $value; |
|
277 | - } else { |
|
278 | - settype($target_array[ 'vars' ][ $key ], 'array'); |
|
279 | - $target_array[ 'vars' ][ $key ][] = $value; |
|
280 | - } |
|
281 | - } |
|
282 | - |
|
283 | - /** |
|
284 | - * add config variable to global vars |
|
285 | - * |
|
286 | - * @param array $vars |
|
287 | - */ |
|
288 | - private function add_global_vars(Array $vars) |
|
289 | - { |
|
290 | - if (!isset($this->compiler->config_data[ 'vars' ])) { |
|
291 | - $this->compiler->config_data[ 'vars' ] = Array(); |
|
292 | - } |
|
293 | - foreach ($vars as $var) { |
|
294 | - $this->set_var($var, $this->compiler->config_data); |
|
295 | - } |
|
296 | - } |
|
297 | - |
|
298 | - /** |
|
299 | - * add config variable to section |
|
300 | - * |
|
301 | - * @param string $section_name |
|
302 | - * @param array $vars |
|
303 | - */ |
|
304 | - private function add_section_vars($section_name, Array $vars) |
|
305 | - { |
|
306 | - if (!isset($this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ])) { |
|
307 | - $this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ] = Array(); |
|
308 | - } |
|
309 | - foreach ($vars as $var) { |
|
310 | - $this->set_var($var, $this->compiler->config_data[ 'sections' ][ $section_name ]); |
|
311 | - } |
|
312 | - } |
|
313 | - |
|
314 | - const TPC_OPENB = 1; |
|
93 | + #line 25 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
94 | + |
|
95 | + /** |
|
96 | + * result status |
|
97 | + * |
|
98 | + * @var bool |
|
99 | + */ |
|
100 | + public $successful = true; |
|
101 | + |
|
102 | + /** |
|
103 | + * return value |
|
104 | + * |
|
105 | + * @var mixed |
|
106 | + */ |
|
107 | + public $retvalue = 0; |
|
108 | + |
|
109 | + /** |
|
110 | + * @var |
|
111 | + */ |
|
112 | + public $yymajor; |
|
113 | + |
|
114 | + /** |
|
115 | + * lexer object |
|
116 | + * |
|
117 | + * @var Smarty_Internal_Configfilelexer |
|
118 | + */ |
|
119 | + private $lex; |
|
120 | + |
|
121 | + /** |
|
122 | + * internal error flag |
|
123 | + * |
|
124 | + * @var bool |
|
125 | + */ |
|
126 | + private $internalError = false; |
|
127 | + |
|
128 | + /** |
|
129 | + * compiler object |
|
130 | + * |
|
131 | + * @var Smarty_Internal_Config_File_Compiler |
|
132 | + */ |
|
133 | + public $compiler = null; |
|
134 | + |
|
135 | + /** |
|
136 | + * smarty object |
|
137 | + * |
|
138 | + * @var Smarty |
|
139 | + */ |
|
140 | + public $smarty = null; |
|
141 | + |
|
142 | + /** |
|
143 | + * copy of config_overwrite property |
|
144 | + * |
|
145 | + * @var bool |
|
146 | + */ |
|
147 | + private $configOverwrite = false; |
|
148 | + |
|
149 | + /** |
|
150 | + * copy of config_read_hidden property |
|
151 | + * |
|
152 | + * @var bool |
|
153 | + */ |
|
154 | + private $configReadHidden = false; |
|
155 | + |
|
156 | + /** |
|
157 | + * helper map |
|
158 | + * |
|
159 | + * @var array |
|
160 | + */ |
|
161 | + private static $escapes_single = Array('\\' => '\\', '\'' => '\''); |
|
162 | + |
|
163 | + /** |
|
164 | + * constructor |
|
165 | + * |
|
166 | + * @param Smarty_Internal_Configfilelexer $lex |
|
167 | + * @param Smarty_Internal_Config_File_Compiler $compiler |
|
168 | + */ |
|
169 | + public function __construct(Smarty_Internal_Configfilelexer $lex, Smarty_Internal_Config_File_Compiler $compiler) |
|
170 | + { |
|
171 | + // set instance object |
|
172 | + self::instance($this); |
|
173 | + $this->lex = $lex; |
|
174 | + $this->smarty = $compiler->smarty; |
|
175 | + $this->compiler = $compiler; |
|
176 | + $this->configOverwrite = $this->smarty->config_overwrite; |
|
177 | + $this->configReadHidden = $this->smarty->config_read_hidden; |
|
178 | + } |
|
179 | + |
|
180 | + /** |
|
181 | + * @param null $new_instance |
|
182 | + * |
|
183 | + * @return null |
|
184 | + */ |
|
185 | + public static function &instance($new_instance = null) |
|
186 | + { |
|
187 | + static $instance = null; |
|
188 | + if (isset($new_instance) && is_object($new_instance)) { |
|
189 | + $instance = $new_instance; |
|
190 | + } |
|
191 | + return $instance; |
|
192 | + } |
|
193 | + |
|
194 | + /** |
|
195 | + * parse optional boolean keywords |
|
196 | + * |
|
197 | + * @param string $str |
|
198 | + * |
|
199 | + * @return bool |
|
200 | + */ |
|
201 | + private function parse_bool($str) |
|
202 | + { |
|
203 | + $str = strtolower($str); |
|
204 | + if (in_array($str, array('on', 'yes', 'true'))) { |
|
205 | + $res = true; |
|
206 | + } else { |
|
207 | + $res = false; |
|
208 | + } |
|
209 | + return $res; |
|
210 | + } |
|
211 | + |
|
212 | + /** |
|
213 | + * parse single quoted string |
|
214 | + * remove outer quotes |
|
215 | + * unescape inner quotes |
|
216 | + * |
|
217 | + * @param string $qstr |
|
218 | + * |
|
219 | + * @return string |
|
220 | + */ |
|
221 | + private static function parse_single_quoted_string($qstr) |
|
222 | + { |
|
223 | + $escaped_string = substr($qstr, 1, strlen($qstr) - 2); //remove outer quotes |
|
224 | + |
|
225 | + $ss = preg_split('/(\\\\.)/', $escaped_string, - 1, PREG_SPLIT_DELIM_CAPTURE); |
|
226 | + |
|
227 | + $str = ""; |
|
228 | + foreach ($ss as $s) { |
|
229 | + if (strlen($s) === 2 && $s[ 0 ] === '\\') { |
|
230 | + if (isset(self::$escapes_single[ $s[ 1 ] ])) { |
|
231 | + $s = self::$escapes_single[ $s[ 1 ] ]; |
|
232 | + } |
|
233 | + } |
|
234 | + $str .= $s; |
|
235 | + } |
|
236 | + return $str; |
|
237 | + } |
|
238 | + |
|
239 | + /** |
|
240 | + * parse double quoted string |
|
241 | + * |
|
242 | + * @param string $qstr |
|
243 | + * |
|
244 | + * @return string |
|
245 | + */ |
|
246 | + private static function parse_double_quoted_string($qstr) |
|
247 | + { |
|
248 | + $inner_str = substr($qstr, 1, strlen($qstr) - 2); |
|
249 | + return stripcslashes($inner_str); |
|
250 | + } |
|
251 | + |
|
252 | + /** |
|
253 | + * parse triple quoted string |
|
254 | + * |
|
255 | + * @param string $qstr |
|
256 | + * |
|
257 | + * @return string |
|
258 | + */ |
|
259 | + private static function parse_tripple_double_quoted_string($qstr) |
|
260 | + { |
|
261 | + return stripcslashes($qstr); |
|
262 | + } |
|
263 | + |
|
264 | + /** |
|
265 | + * set a config variable in target array |
|
266 | + * |
|
267 | + * @param array $var |
|
268 | + * @param array $target_array |
|
269 | + */ |
|
270 | + private function set_var(Array $var, Array &$target_array) |
|
271 | + { |
|
272 | + $key = $var[ "key" ]; |
|
273 | + $value = $var[ "value" ]; |
|
274 | + |
|
275 | + if ($this->configOverwrite || !isset($target_array[ 'vars' ][ $key ])) { |
|
276 | + $target_array[ 'vars' ][ $key ] = $value; |
|
277 | + } else { |
|
278 | + settype($target_array[ 'vars' ][ $key ], 'array'); |
|
279 | + $target_array[ 'vars' ][ $key ][] = $value; |
|
280 | + } |
|
281 | + } |
|
282 | + |
|
283 | + /** |
|
284 | + * add config variable to global vars |
|
285 | + * |
|
286 | + * @param array $vars |
|
287 | + */ |
|
288 | + private function add_global_vars(Array $vars) |
|
289 | + { |
|
290 | + if (!isset($this->compiler->config_data[ 'vars' ])) { |
|
291 | + $this->compiler->config_data[ 'vars' ] = Array(); |
|
292 | + } |
|
293 | + foreach ($vars as $var) { |
|
294 | + $this->set_var($var, $this->compiler->config_data); |
|
295 | + } |
|
296 | + } |
|
297 | + |
|
298 | + /** |
|
299 | + * add config variable to section |
|
300 | + * |
|
301 | + * @param string $section_name |
|
302 | + * @param array $vars |
|
303 | + */ |
|
304 | + private function add_section_vars($section_name, Array $vars) |
|
305 | + { |
|
306 | + if (!isset($this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ])) { |
|
307 | + $this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ] = Array(); |
|
308 | + } |
|
309 | + foreach ($vars as $var) { |
|
310 | + $this->set_var($var, $this->compiler->config_data[ 'sections' ][ $section_name ]); |
|
311 | + } |
|
312 | + } |
|
313 | + |
|
314 | + const TPC_OPENB = 1; |
|
315 | 315 | |
316 | - const TPC_SECTION = 2; |
|
316 | + const TPC_SECTION = 2; |
|
317 | 317 | |
318 | - const TPC_CLOSEB = 3; |
|
318 | + const TPC_CLOSEB = 3; |
|
319 | 319 | |
320 | - const TPC_DOT = 4; |
|
320 | + const TPC_DOT = 4; |
|
321 | 321 | |
322 | - const TPC_ID = 5; |
|
322 | + const TPC_ID = 5; |
|
323 | 323 | |
324 | - const TPC_EQUAL = 6; |
|
324 | + const TPC_EQUAL = 6; |
|
325 | 325 | |
326 | - const TPC_FLOAT = 7; |
|
326 | + const TPC_FLOAT = 7; |
|
327 | 327 | |
328 | - const TPC_INT = 8; |
|
328 | + const TPC_INT = 8; |
|
329 | 329 | |
330 | - const TPC_BOOL = 9; |
|
330 | + const TPC_BOOL = 9; |
|
331 | 331 | |
332 | - const TPC_SINGLE_QUOTED_STRING = 10; |
|
332 | + const TPC_SINGLE_QUOTED_STRING = 10; |
|
333 | 333 | |
334 | - const TPC_DOUBLE_QUOTED_STRING = 11; |
|
334 | + const TPC_DOUBLE_QUOTED_STRING = 11; |
|
335 | 335 | |
336 | - const TPC_TRIPPLE_QUOTES = 12; |
|
336 | + const TPC_TRIPPLE_QUOTES = 12; |
|
337 | 337 | |
338 | - const TPC_TRIPPLE_TEXT = 13; |
|
338 | + const TPC_TRIPPLE_TEXT = 13; |
|
339 | 339 | |
340 | - const TPC_TRIPPLE_QUOTES_END = 14; |
|
340 | + const TPC_TRIPPLE_QUOTES_END = 14; |
|
341 | 341 | |
342 | - const TPC_NAKED_STRING = 15; |
|
342 | + const TPC_NAKED_STRING = 15; |
|
343 | 343 | |
344 | - const TPC_OTHER = 16; |
|
344 | + const TPC_OTHER = 16; |
|
345 | 345 | |
346 | - const TPC_NEWLINE = 17; |
|
346 | + const TPC_NEWLINE = 17; |
|
347 | 347 | |
348 | - const TPC_COMMENTSTART = 18; |
|
348 | + const TPC_COMMENTSTART = 18; |
|
349 | 349 | |
350 | - const YY_NO_ACTION = 60; |
|
350 | + const YY_NO_ACTION = 60; |
|
351 | 351 | |
352 | - const YY_ACCEPT_ACTION = 59; |
|
352 | + const YY_ACCEPT_ACTION = 59; |
|
353 | 353 | |
354 | - const YY_ERROR_ACTION = 58; |
|
354 | + const YY_ERROR_ACTION = 58; |
|
355 | 355 | |
356 | - const YY_SZ_ACTTAB = 38; |
|
356 | + const YY_SZ_ACTTAB = 38; |
|
357 | 357 | |
358 | - static public $yy_action = array(29, 30, 34, 33, 24, 13, 19, 25, 35, 21, 59, 8, 3, 1, 20, 12, 14, 31, 20, 12, 15, |
|
359 | - 17, 23, 18, 27, 26, 4, 5, 6, 32, 2, 11, 28, 22, 16, 9, 7, 10,); |
|
358 | + static public $yy_action = array(29, 30, 34, 33, 24, 13, 19, 25, 35, 21, 59, 8, 3, 1, 20, 12, 14, 31, 20, 12, 15, |
|
359 | + 17, 23, 18, 27, 26, 4, 5, 6, 32, 2, 11, 28, 22, 16, 9, 7, 10,); |
|
360 | 360 | |
361 | - static public $yy_lookahead = array(7, 8, 9, 10, 11, 12, 5, 27, 15, 16, 20, 21, 23, 23, 17, 18, 13, 14, 17, 18, 15, |
|
362 | - 2, 17, 4, 25, 26, 6, 3, 3, 14, 23, 1, 24, 17, 2, 25, 22, 25,); |
|
361 | + static public $yy_lookahead = array(7, 8, 9, 10, 11, 12, 5, 27, 15, 16, 20, 21, 23, 23, 17, 18, 13, 14, 17, 18, 15, |
|
362 | + 2, 17, 4, 25, 26, 6, 3, 3, 14, 23, 1, 24, 17, 2, 25, 22, 25,); |
|
363 | 363 | |
364 | - const YY_SHIFT_USE_DFLT = - 8; |
|
364 | + const YY_SHIFT_USE_DFLT = - 8; |
|
365 | 365 | |
366 | - const YY_SHIFT_MAX = 19; |
|
366 | + const YY_SHIFT_MAX = 19; |
|
367 | 367 | |
368 | - static public $yy_shift_ofst = array(- 8, 1, 1, 1, - 7, - 3, - 3, 30, - 8, - 8, - 8, 19, 5, 3, 15, 16, 24, 25, 32, |
|
369 | - 20,); |
|
368 | + static public $yy_shift_ofst = array(- 8, 1, 1, 1, - 7, - 3, - 3, 30, - 8, - 8, - 8, 19, 5, 3, 15, 16, 24, 25, 32, |
|
369 | + 20,); |
|
370 | 370 | |
371 | - const YY_REDUCE_USE_DFLT = - 21; |
|
371 | + const YY_REDUCE_USE_DFLT = - 21; |
|
372 | 372 | |
373 | - const YY_REDUCE_MAX = 10; |
|
373 | + const YY_REDUCE_MAX = 10; |
|
374 | 374 | |
375 | - static public $yy_reduce_ofst = array(- 10, - 1, - 1, - 1, - 20, 10, 12, 8, 14, 7, - 11,); |
|
375 | + static public $yy_reduce_ofst = array(- 10, - 1, - 1, - 1, - 20, 10, 12, 8, 14, 7, - 11,); |
|
376 | 376 | |
377 | - static public $yyExpectedTokens = array(array(), array(5, 17, 18,), array(5, 17, 18,), array(5, 17, 18,), |
|
378 | - array(7, 8, 9, 10, 11, 12, 15, 16,), array(17, 18,), array(17, 18,), |
|
379 | - array(1,), array(), array(), array(), array(2, 4,), array(15, 17,), |
|
380 | - array(13, 14,), array(14,), array(17,), array(3,), array(3,), array(2,), |
|
381 | - array(6,), array(), array(), array(), array(), array(), array(), array(), |
|
382 | - array(), array(), array(), array(), array(), array(), array(), array(), |
|
383 | - array(),); |
|
377 | + static public $yyExpectedTokens = array(array(), array(5, 17, 18,), array(5, 17, 18,), array(5, 17, 18,), |
|
378 | + array(7, 8, 9, 10, 11, 12, 15, 16,), array(17, 18,), array(17, 18,), |
|
379 | + array(1,), array(), array(), array(), array(2, 4,), array(15, 17,), |
|
380 | + array(13, 14,), array(14,), array(17,), array(3,), array(3,), array(2,), |
|
381 | + array(6,), array(), array(), array(), array(), array(), array(), array(), |
|
382 | + array(), array(), array(), array(), array(), array(), array(), array(), |
|
383 | + array(),); |
|
384 | 384 | |
385 | - static public $yy_default = array(44, 37, 41, 40, 58, 58, 58, 36, 39, 44, 44, 58, 58, 58, 58, 58, 58, 58, 58, 58, |
|
386 | - 55, 54, 57, 56, 50, 45, 43, 42, 38, 46, 47, 52, 51, 49, 48, 53,); |
|
385 | + static public $yy_default = array(44, 37, 41, 40, 58, 58, 58, 36, 39, 44, 44, 58, 58, 58, 58, 58, 58, 58, 58, 58, |
|
386 | + 55, 54, 57, 56, 50, 45, 43, 42, 38, 46, 47, 52, 51, 49, 48, 53,); |
|
387 | 387 | |
388 | - const YYNOCODE = 29; |
|
388 | + const YYNOCODE = 29; |
|
389 | 389 | |
390 | - const YYSTACKDEPTH = 100; |
|
390 | + const YYSTACKDEPTH = 100; |
|
391 | 391 | |
392 | - const YYNSTATE = 36; |
|
392 | + const YYNSTATE = 36; |
|
393 | 393 | |
394 | - const YYNRULE = 22; |
|
394 | + const YYNRULE = 22; |
|
395 | 395 | |
396 | - const YYERRORSYMBOL = 19; |
|
396 | + const YYERRORSYMBOL = 19; |
|
397 | 397 | |
398 | - const YYERRSYMDT = 'yy0'; |
|
398 | + const YYERRSYMDT = 'yy0'; |
|
399 | 399 | |
400 | - const YYFALLBACK = 0; |
|
400 | + const YYFALLBACK = 0; |
|
401 | 401 | |
402 | - public static $yyFallback = array(); |
|
402 | + public static $yyFallback = array(); |
|
403 | 403 | |
404 | - public function Trace($TraceFILE, $zTracePrompt) |
|
405 | - { |
|
406 | - if (!$TraceFILE) { |
|
407 | - $zTracePrompt = 0; |
|
408 | - } elseif (!$zTracePrompt) { |
|
409 | - $TraceFILE = 0; |
|
410 | - } |
|
411 | - $this->yyTraceFILE = $TraceFILE; |
|
412 | - $this->yyTracePrompt = $zTracePrompt; |
|
413 | - } |
|
404 | + public function Trace($TraceFILE, $zTracePrompt) |
|
405 | + { |
|
406 | + if (!$TraceFILE) { |
|
407 | + $zTracePrompt = 0; |
|
408 | + } elseif (!$zTracePrompt) { |
|
409 | + $TraceFILE = 0; |
|
410 | + } |
|
411 | + $this->yyTraceFILE = $TraceFILE; |
|
412 | + $this->yyTracePrompt = $zTracePrompt; |
|
413 | + } |
|
414 | 414 | |
415 | - public function PrintTrace() |
|
416 | - { |
|
417 | - $this->yyTraceFILE = fopen('php://output', 'w'); |
|
418 | - $this->yyTracePrompt = '<br>'; |
|
419 | - } |
|
415 | + public function PrintTrace() |
|
416 | + { |
|
417 | + $this->yyTraceFILE = fopen('php://output', 'w'); |
|
418 | + $this->yyTracePrompt = '<br>'; |
|
419 | + } |
|
420 | 420 | |
421 | - public $yyTraceFILE; |
|
421 | + public $yyTraceFILE; |
|
422 | 422 | |
423 | - public $yyTracePrompt; |
|
423 | + public $yyTracePrompt; |
|
424 | 424 | |
425 | - public $yyidx; /* Index of top element in stack */ |
|
426 | - public $yyerrcnt; /* Shifts left before out of the error */ |
|
427 | - public $yystack = array(); /* The parser's stack */ |
|
425 | + public $yyidx; /* Index of top element in stack */ |
|
426 | + public $yyerrcnt; /* Shifts left before out of the error */ |
|
427 | + public $yystack = array(); /* The parser's stack */ |
|
428 | 428 | |
429 | - public $yyTokenName = array('$', 'OPENB', 'SECTION', 'CLOSEB', 'DOT', 'ID', 'EQUAL', 'FLOAT', 'INT', 'BOOL', |
|
430 | - 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING', 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT', |
|
431 | - 'TRIPPLE_QUOTES_END', 'NAKED_STRING', 'OTHER', 'NEWLINE', 'COMMENTSTART', 'error', |
|
432 | - 'start', 'global_vars', 'sections', 'var_list', 'section', 'newline', 'var', 'value',); |
|
429 | + public $yyTokenName = array('$', 'OPENB', 'SECTION', 'CLOSEB', 'DOT', 'ID', 'EQUAL', 'FLOAT', 'INT', 'BOOL', |
|
430 | + 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING', 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT', |
|
431 | + 'TRIPPLE_QUOTES_END', 'NAKED_STRING', 'OTHER', 'NEWLINE', 'COMMENTSTART', 'error', |
|
432 | + 'start', 'global_vars', 'sections', 'var_list', 'section', 'newline', 'var', 'value',); |
|
433 | 433 | |
434 | - public static $yyRuleName = array('start ::= global_vars sections', 'global_vars ::= var_list', |
|
435 | - 'sections ::= sections section', 'sections ::=', |
|
436 | - 'section ::= OPENB SECTION CLOSEB newline var_list', |
|
437 | - 'section ::= OPENB DOT SECTION CLOSEB newline var_list', |
|
438 | - 'var_list ::= var_list newline', 'var_list ::= var_list var', 'var_list ::=', |
|
439 | - 'var ::= ID EQUAL value', 'value ::= FLOAT', 'value ::= INT', 'value ::= BOOL', |
|
440 | - 'value ::= SINGLE_QUOTED_STRING', 'value ::= DOUBLE_QUOTED_STRING', |
|
441 | - 'value ::= TRIPPLE_QUOTES TRIPPLE_TEXT TRIPPLE_QUOTES_END', |
|
442 | - 'value ::= TRIPPLE_QUOTES TRIPPLE_QUOTES_END', 'value ::= NAKED_STRING', |
|
443 | - 'value ::= OTHER', 'newline ::= NEWLINE', 'newline ::= COMMENTSTART NEWLINE', |
|
444 | - 'newline ::= COMMENTSTART NAKED_STRING NEWLINE',); |
|
434 | + public static $yyRuleName = array('start ::= global_vars sections', 'global_vars ::= var_list', |
|
435 | + 'sections ::= sections section', 'sections ::=', |
|
436 | + 'section ::= OPENB SECTION CLOSEB newline var_list', |
|
437 | + 'section ::= OPENB DOT SECTION CLOSEB newline var_list', |
|
438 | + 'var_list ::= var_list newline', 'var_list ::= var_list var', 'var_list ::=', |
|
439 | + 'var ::= ID EQUAL value', 'value ::= FLOAT', 'value ::= INT', 'value ::= BOOL', |
|
440 | + 'value ::= SINGLE_QUOTED_STRING', 'value ::= DOUBLE_QUOTED_STRING', |
|
441 | + 'value ::= TRIPPLE_QUOTES TRIPPLE_TEXT TRIPPLE_QUOTES_END', |
|
442 | + 'value ::= TRIPPLE_QUOTES TRIPPLE_QUOTES_END', 'value ::= NAKED_STRING', |
|
443 | + 'value ::= OTHER', 'newline ::= NEWLINE', 'newline ::= COMMENTSTART NEWLINE', |
|
444 | + 'newline ::= COMMENTSTART NAKED_STRING NEWLINE',); |
|
445 | 445 | |
446 | - public function tokenName($tokenType) |
|
447 | - { |
|
448 | - if ($tokenType === 0) { |
|
449 | - return 'End of Input'; |
|
450 | - } |
|
446 | + public function tokenName($tokenType) |
|
447 | + { |
|
448 | + if ($tokenType === 0) { |
|
449 | + return 'End of Input'; |
|
450 | + } |
|
451 | 451 | $countYyTokenName = count($this->yyTokenName); |
452 | - if ($tokenType > 0 && $tokenType < $countYyTokenName) { |
|
453 | - return $this->yyTokenName[ $tokenType ]; |
|
454 | - } else { |
|
455 | - return "Unknown"; |
|
456 | - } |
|
457 | - } |
|
458 | - |
|
459 | - public static function yy_destructor($yymajor, $yypminor) |
|
460 | - { |
|
461 | - switch ($yymajor) { |
|
462 | - default: |
|
463 | - break; /* If no destructor action specified: do nothing */ |
|
464 | - } |
|
465 | - } |
|
466 | - |
|
467 | - public function yy_pop_parser_stack() |
|
468 | - { |
|
469 | - if (empty($this->yystack)) { |
|
470 | - return; |
|
471 | - } |
|
472 | - $yytos = array_pop($this->yystack); |
|
473 | - if ($this->yyTraceFILE && $this->yyidx >= 0) { |
|
474 | - fwrite($this->yyTraceFILE, $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . "\n"); |
|
475 | - } |
|
476 | - $yymajor = $yytos->major; |
|
477 | - self::yy_destructor($yymajor, $yytos->minor); |
|
478 | - $this->yyidx --; |
|
479 | - |
|
480 | - return $yymajor; |
|
481 | - } |
|
482 | - |
|
483 | - public function __destruct() |
|
484 | - { |
|
485 | - while ($this->yystack !== Array()) { |
|
486 | - $this->yy_pop_parser_stack(); |
|
487 | - } |
|
488 | - if (is_resource($this->yyTraceFILE)) { |
|
489 | - fclose($this->yyTraceFILE); |
|
490 | - } |
|
491 | - } |
|
492 | - |
|
493 | - public function yy_get_expected_tokens($token) |
|
494 | - { |
|
495 | - static $res3 = array(); |
|
496 | - static $res4 = array(); |
|
497 | - $state = $this->yystack[ $this->yyidx ]->stateno; |
|
498 | - $expected = self::$yyExpectedTokens[ $state ]; |
|
499 | - if (isset($res3[ $state ][ $token ])) { |
|
500 | - if ($res3[ $state ][ $token ]) { |
|
501 | - return $expected; |
|
502 | - } |
|
503 | - } else { |
|
504 | - if ($res3[ $state ][ $token ] = in_array($token, self::$yyExpectedTokens[ $state ], true)) { |
|
505 | - return $expected; |
|
506 | - } |
|
507 | - } |
|
508 | - $stack = $this->yystack; |
|
509 | - $yyidx = $this->yyidx; |
|
510 | - do { |
|
511 | - $yyact = $this->yy_find_shift_action($token); |
|
512 | - if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) { |
|
513 | - // reduce action |
|
514 | - $done = 0; |
|
515 | - do { |
|
516 | - if ($done ++ == 100) { |
|
517 | - $this->yyidx = $yyidx; |
|
518 | - $this->yystack = $stack; |
|
519 | - // too much recursion prevents proper detection |
|
520 | - // so give up |
|
521 | - return array_unique($expected); |
|
522 | - } |
|
523 | - $yyruleno = $yyact - self::YYNSTATE; |
|
524 | - $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ]; |
|
525 | - $nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, |
|
526 | - self::$yyRuleInfo[ $yyruleno ][ 0 ]); |
|
527 | - if (isset(self::$yyExpectedTokens[ $nextstate ])) { |
|
528 | - $expected = array_merge($expected, self::$yyExpectedTokens[ $nextstate ]); |
|
529 | - if (isset($res4[ $nextstate ][ $token ])) { |
|
530 | - if ($res4[ $nextstate ][ $token ]) { |
|
531 | - $this->yyidx = $yyidx; |
|
532 | - $this->yystack = $stack; |
|
533 | - return array_unique($expected); |
|
534 | - } |
|
535 | - } else { |
|
536 | - if ($res4[ $nextstate ][ $token ] = |
|
537 | - in_array($token, self::$yyExpectedTokens[ $nextstate ], true) |
|
538 | - ) { |
|
539 | - $this->yyidx = $yyidx; |
|
540 | - $this->yystack = $stack; |
|
541 | - return array_unique($expected); |
|
542 | - } |
|
543 | - } |
|
544 | - } |
|
545 | - if ($nextstate < self::YYNSTATE) { |
|
546 | - // we need to shift a non-terminal |
|
547 | - $this->yyidx ++; |
|
548 | - $x = new TPC_yyStackEntry; |
|
549 | - $x->stateno = $nextstate; |
|
550 | - $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ]; |
|
551 | - $this->yystack[ $this->yyidx ] = $x; |
|
552 | - continue 2; |
|
553 | - } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) { |
|
554 | - $this->yyidx = $yyidx; |
|
555 | - $this->yystack = $stack; |
|
556 | - // the last token was just ignored, we can't accept |
|
557 | - // by ignoring input, this is in essence ignoring a |
|
558 | - // syntax error! |
|
559 | - return array_unique($expected); |
|
560 | - } elseif ($nextstate === self::YY_NO_ACTION) { |
|
561 | - $this->yyidx = $yyidx; |
|
562 | - $this->yystack = $stack; |
|
563 | - // input accepted, but not shifted (I guess) |
|
564 | - return $expected; |
|
565 | - } else { |
|
566 | - $yyact = $nextstate; |
|
567 | - } |
|
568 | - } |
|
569 | - while (true); |
|
570 | - } |
|
571 | - break; |
|
572 | - } |
|
573 | - while (true); |
|
574 | - $this->yyidx = $yyidx; |
|
575 | - $this->yystack = $stack; |
|
576 | - |
|
577 | - return array_unique($expected); |
|
578 | - } |
|
579 | - |
|
580 | - public function yy_is_expected_token($token) |
|
581 | - { |
|
582 | - static $res = array(); |
|
583 | - static $res2 = array(); |
|
584 | - if ($token === 0) { |
|
585 | - return true; // 0 is not part of this |
|
586 | - } |
|
587 | - $state = $this->yystack[ $this->yyidx ]->stateno; |
|
588 | - if (isset($res[ $state ][ $token ])) { |
|
589 | - if ($res[ $state ][ $token ]) { |
|
590 | - return true; |
|
591 | - } |
|
592 | - } else { |
|
593 | - if ($res[ $state ][ $token ] = in_array($token, self::$yyExpectedTokens[ $state ], true)) { |
|
594 | - return true; |
|
595 | - } |
|
596 | - } |
|
597 | - $stack = $this->yystack; |
|
598 | - $yyidx = $this->yyidx; |
|
599 | - do { |
|
600 | - $yyact = $this->yy_find_shift_action($token); |
|
601 | - if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) { |
|
602 | - // reduce action |
|
603 | - $done = 0; |
|
604 | - do { |
|
605 | - if ($done ++ == 100) { |
|
606 | - $this->yyidx = $yyidx; |
|
607 | - $this->yystack = $stack; |
|
608 | - // too much recursion prevents proper detection |
|
609 | - // so give up |
|
610 | - return true; |
|
611 | - } |
|
612 | - $yyruleno = $yyact - self::YYNSTATE; |
|
613 | - $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ]; |
|
614 | - $nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, |
|
615 | - self::$yyRuleInfo[ $yyruleno ][ 0 ]); |
|
616 | - if (isset($res2[ $nextstate ][ $token ])) { |
|
617 | - if ($res2[ $nextstate ][ $token ]) { |
|
618 | - $this->yyidx = $yyidx; |
|
619 | - $this->yystack = $stack; |
|
620 | - return true; |
|
621 | - } |
|
622 | - } else { |
|
623 | - if ($res2[ $nextstate ][ $token ] = (isset(self::$yyExpectedTokens[ $nextstate ]) && |
|
624 | - in_array($token, self::$yyExpectedTokens[ $nextstate ], |
|
625 | - true)) |
|
626 | - ) { |
|
627 | - $this->yyidx = $yyidx; |
|
628 | - $this->yystack = $stack; |
|
629 | - return true; |
|
630 | - } |
|
631 | - } |
|
632 | - if ($nextstate < self::YYNSTATE) { |
|
633 | - // we need to shift a non-terminal |
|
634 | - $this->yyidx ++; |
|
635 | - $x = new TPC_yyStackEntry; |
|
636 | - $x->stateno = $nextstate; |
|
637 | - $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ]; |
|
638 | - $this->yystack[ $this->yyidx ] = $x; |
|
639 | - continue 2; |
|
640 | - } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) { |
|
641 | - $this->yyidx = $yyidx; |
|
642 | - $this->yystack = $stack; |
|
643 | - if (!$token) { |
|
644 | - // end of input: this is valid |
|
645 | - return true; |
|
646 | - } |
|
647 | - // the last token was just ignored, we can't accept |
|
648 | - // by ignoring input, this is in essence ignoring a |
|
649 | - // syntax error! |
|
650 | - return false; |
|
651 | - } elseif ($nextstate === self::YY_NO_ACTION) { |
|
652 | - $this->yyidx = $yyidx; |
|
653 | - $this->yystack = $stack; |
|
654 | - // input accepted, but not shifted (I guess) |
|
655 | - return true; |
|
656 | - } else { |
|
657 | - $yyact = $nextstate; |
|
658 | - } |
|
659 | - } |
|
660 | - while (true); |
|
661 | - } |
|
662 | - break; |
|
663 | - } |
|
664 | - while (true); |
|
665 | - $this->yyidx = $yyidx; |
|
666 | - $this->yystack = $stack; |
|
667 | - |
|
668 | - return true; |
|
669 | - } |
|
670 | - |
|
671 | - public function yy_find_shift_action($iLookAhead) |
|
672 | - { |
|
673 | - $stateno = $this->yystack[ $this->yyidx ]->stateno; |
|
674 | - |
|
675 | - /* if ($this->yyidx < 0) return self::YY_NO_ACTION; */ |
|
676 | - if (!isset(self::$yy_shift_ofst[ $stateno ])) { |
|
677 | - // no shift actions |
|
678 | - return self::$yy_default[ $stateno ]; |
|
679 | - } |
|
680 | - $i = self::$yy_shift_ofst[ $stateno ]; |
|
681 | - if ($i === self::YY_SHIFT_USE_DFLT) { |
|
682 | - return self::$yy_default[ $stateno ]; |
|
683 | - } |
|
684 | - if ($iLookAhead == self::YYNOCODE) { |
|
685 | - return self::YY_NO_ACTION; |
|
686 | - } |
|
687 | - $i += $iLookAhead; |
|
688 | - if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[ $i ] != $iLookAhead) { |
|
452 | + if ($tokenType > 0 && $tokenType < $countYyTokenName) { |
|
453 | + return $this->yyTokenName[ $tokenType ]; |
|
454 | + } else { |
|
455 | + return "Unknown"; |
|
456 | + } |
|
457 | + } |
|
458 | + |
|
459 | + public static function yy_destructor($yymajor, $yypminor) |
|
460 | + { |
|
461 | + switch ($yymajor) { |
|
462 | + default: |
|
463 | + break; /* If no destructor action specified: do nothing */ |
|
464 | + } |
|
465 | + } |
|
466 | + |
|
467 | + public function yy_pop_parser_stack() |
|
468 | + { |
|
469 | + if (empty($this->yystack)) { |
|
470 | + return; |
|
471 | + } |
|
472 | + $yytos = array_pop($this->yystack); |
|
473 | + if ($this->yyTraceFILE && $this->yyidx >= 0) { |
|
474 | + fwrite($this->yyTraceFILE, $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . "\n"); |
|
475 | + } |
|
476 | + $yymajor = $yytos->major; |
|
477 | + self::yy_destructor($yymajor, $yytos->minor); |
|
478 | + $this->yyidx --; |
|
479 | + |
|
480 | + return $yymajor; |
|
481 | + } |
|
482 | + |
|
483 | + public function __destruct() |
|
484 | + { |
|
485 | + while ($this->yystack !== Array()) { |
|
486 | + $this->yy_pop_parser_stack(); |
|
487 | + } |
|
488 | + if (is_resource($this->yyTraceFILE)) { |
|
489 | + fclose($this->yyTraceFILE); |
|
490 | + } |
|
491 | + } |
|
492 | + |
|
493 | + public function yy_get_expected_tokens($token) |
|
494 | + { |
|
495 | + static $res3 = array(); |
|
496 | + static $res4 = array(); |
|
497 | + $state = $this->yystack[ $this->yyidx ]->stateno; |
|
498 | + $expected = self::$yyExpectedTokens[ $state ]; |
|
499 | + if (isset($res3[ $state ][ $token ])) { |
|
500 | + if ($res3[ $state ][ $token ]) { |
|
501 | + return $expected; |
|
502 | + } |
|
503 | + } else { |
|
504 | + if ($res3[ $state ][ $token ] = in_array($token, self::$yyExpectedTokens[ $state ], true)) { |
|
505 | + return $expected; |
|
506 | + } |
|
507 | + } |
|
508 | + $stack = $this->yystack; |
|
509 | + $yyidx = $this->yyidx; |
|
510 | + do { |
|
511 | + $yyact = $this->yy_find_shift_action($token); |
|
512 | + if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) { |
|
513 | + // reduce action |
|
514 | + $done = 0; |
|
515 | + do { |
|
516 | + if ($done ++ == 100) { |
|
517 | + $this->yyidx = $yyidx; |
|
518 | + $this->yystack = $stack; |
|
519 | + // too much recursion prevents proper detection |
|
520 | + // so give up |
|
521 | + return array_unique($expected); |
|
522 | + } |
|
523 | + $yyruleno = $yyact - self::YYNSTATE; |
|
524 | + $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ]; |
|
525 | + $nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, |
|
526 | + self::$yyRuleInfo[ $yyruleno ][ 0 ]); |
|
527 | + if (isset(self::$yyExpectedTokens[ $nextstate ])) { |
|
528 | + $expected = array_merge($expected, self::$yyExpectedTokens[ $nextstate ]); |
|
529 | + if (isset($res4[ $nextstate ][ $token ])) { |
|
530 | + if ($res4[ $nextstate ][ $token ]) { |
|
531 | + $this->yyidx = $yyidx; |
|
532 | + $this->yystack = $stack; |
|
533 | + return array_unique($expected); |
|
534 | + } |
|
535 | + } else { |
|
536 | + if ($res4[ $nextstate ][ $token ] = |
|
537 | + in_array($token, self::$yyExpectedTokens[ $nextstate ], true) |
|
538 | + ) { |
|
539 | + $this->yyidx = $yyidx; |
|
540 | + $this->yystack = $stack; |
|
541 | + return array_unique($expected); |
|
542 | + } |
|
543 | + } |
|
544 | + } |
|
545 | + if ($nextstate < self::YYNSTATE) { |
|
546 | + // we need to shift a non-terminal |
|
547 | + $this->yyidx ++; |
|
548 | + $x = new TPC_yyStackEntry; |
|
549 | + $x->stateno = $nextstate; |
|
550 | + $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ]; |
|
551 | + $this->yystack[ $this->yyidx ] = $x; |
|
552 | + continue 2; |
|
553 | + } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) { |
|
554 | + $this->yyidx = $yyidx; |
|
555 | + $this->yystack = $stack; |
|
556 | + // the last token was just ignored, we can't accept |
|
557 | + // by ignoring input, this is in essence ignoring a |
|
558 | + // syntax error! |
|
559 | + return array_unique($expected); |
|
560 | + } elseif ($nextstate === self::YY_NO_ACTION) { |
|
561 | + $this->yyidx = $yyidx; |
|
562 | + $this->yystack = $stack; |
|
563 | + // input accepted, but not shifted (I guess) |
|
564 | + return $expected; |
|
565 | + } else { |
|
566 | + $yyact = $nextstate; |
|
567 | + } |
|
568 | + } |
|
569 | + while (true); |
|
570 | + } |
|
571 | + break; |
|
572 | + } |
|
573 | + while (true); |
|
574 | + $this->yyidx = $yyidx; |
|
575 | + $this->yystack = $stack; |
|
576 | + |
|
577 | + return array_unique($expected); |
|
578 | + } |
|
579 | + |
|
580 | + public function yy_is_expected_token($token) |
|
581 | + { |
|
582 | + static $res = array(); |
|
583 | + static $res2 = array(); |
|
584 | + if ($token === 0) { |
|
585 | + return true; // 0 is not part of this |
|
586 | + } |
|
587 | + $state = $this->yystack[ $this->yyidx ]->stateno; |
|
588 | + if (isset($res[ $state ][ $token ])) { |
|
589 | + if ($res[ $state ][ $token ]) { |
|
590 | + return true; |
|
591 | + } |
|
592 | + } else { |
|
593 | + if ($res[ $state ][ $token ] = in_array($token, self::$yyExpectedTokens[ $state ], true)) { |
|
594 | + return true; |
|
595 | + } |
|
596 | + } |
|
597 | + $stack = $this->yystack; |
|
598 | + $yyidx = $this->yyidx; |
|
599 | + do { |
|
600 | + $yyact = $this->yy_find_shift_action($token); |
|
601 | + if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) { |
|
602 | + // reduce action |
|
603 | + $done = 0; |
|
604 | + do { |
|
605 | + if ($done ++ == 100) { |
|
606 | + $this->yyidx = $yyidx; |
|
607 | + $this->yystack = $stack; |
|
608 | + // too much recursion prevents proper detection |
|
609 | + // so give up |
|
610 | + return true; |
|
611 | + } |
|
612 | + $yyruleno = $yyact - self::YYNSTATE; |
|
613 | + $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ]; |
|
614 | + $nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, |
|
615 | + self::$yyRuleInfo[ $yyruleno ][ 0 ]); |
|
616 | + if (isset($res2[ $nextstate ][ $token ])) { |
|
617 | + if ($res2[ $nextstate ][ $token ]) { |
|
618 | + $this->yyidx = $yyidx; |
|
619 | + $this->yystack = $stack; |
|
620 | + return true; |
|
621 | + } |
|
622 | + } else { |
|
623 | + if ($res2[ $nextstate ][ $token ] = (isset(self::$yyExpectedTokens[ $nextstate ]) && |
|
624 | + in_array($token, self::$yyExpectedTokens[ $nextstate ], |
|
625 | + true)) |
|
626 | + ) { |
|
627 | + $this->yyidx = $yyidx; |
|
628 | + $this->yystack = $stack; |
|
629 | + return true; |
|
630 | + } |
|
631 | + } |
|
632 | + if ($nextstate < self::YYNSTATE) { |
|
633 | + // we need to shift a non-terminal |
|
634 | + $this->yyidx ++; |
|
635 | + $x = new TPC_yyStackEntry; |
|
636 | + $x->stateno = $nextstate; |
|
637 | + $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ]; |
|
638 | + $this->yystack[ $this->yyidx ] = $x; |
|
639 | + continue 2; |
|
640 | + } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) { |
|
641 | + $this->yyidx = $yyidx; |
|
642 | + $this->yystack = $stack; |
|
643 | + if (!$token) { |
|
644 | + // end of input: this is valid |
|
645 | + return true; |
|
646 | + } |
|
647 | + // the last token was just ignored, we can't accept |
|
648 | + // by ignoring input, this is in essence ignoring a |
|
649 | + // syntax error! |
|
650 | + return false; |
|
651 | + } elseif ($nextstate === self::YY_NO_ACTION) { |
|
652 | + $this->yyidx = $yyidx; |
|
653 | + $this->yystack = $stack; |
|
654 | + // input accepted, but not shifted (I guess) |
|
655 | + return true; |
|
656 | + } else { |
|
657 | + $yyact = $nextstate; |
|
658 | + } |
|
659 | + } |
|
660 | + while (true); |
|
661 | + } |
|
662 | + break; |
|
663 | + } |
|
664 | + while (true); |
|
665 | + $this->yyidx = $yyidx; |
|
666 | + $this->yystack = $stack; |
|
667 | + |
|
668 | + return true; |
|
669 | + } |
|
670 | + |
|
671 | + public function yy_find_shift_action($iLookAhead) |
|
672 | + { |
|
673 | + $stateno = $this->yystack[ $this->yyidx ]->stateno; |
|
674 | + |
|
675 | + /* if ($this->yyidx < 0) return self::YY_NO_ACTION; */ |
|
676 | + if (!isset(self::$yy_shift_ofst[ $stateno ])) { |
|
677 | + // no shift actions |
|
678 | + return self::$yy_default[ $stateno ]; |
|
679 | + } |
|
680 | + $i = self::$yy_shift_ofst[ $stateno ]; |
|
681 | + if ($i === self::YY_SHIFT_USE_DFLT) { |
|
682 | + return self::$yy_default[ $stateno ]; |
|
683 | + } |
|
684 | + if ($iLookAhead == self::YYNOCODE) { |
|
685 | + return self::YY_NO_ACTION; |
|
686 | + } |
|
687 | + $i += $iLookAhead; |
|
688 | + if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[ $i ] != $iLookAhead) { |
|
689 | 689 | $countYyFallback = count(self::$yyFallback); |
690 | - if (count(self::$yyFallback) && $iLookAhead < $countYyFallback && |
|
691 | - ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0 |
|
692 | - ) { |
|
693 | - if ($this->yyTraceFILE) { |
|
694 | - fwrite($this->yyTraceFILE, |
|
695 | - $this->yyTracePrompt . "FALLBACK " . $this->yyTokenName[ $iLookAhead ] . " => " . |
|
696 | - $this->yyTokenName[ $iFallback ] . "\n"); |
|
697 | - } |
|
698 | - |
|
699 | - return $this->yy_find_shift_action($iFallback); |
|
700 | - } |
|
701 | - |
|
702 | - return self::$yy_default[ $stateno ]; |
|
703 | - } else { |
|
704 | - return self::$yy_action[ $i ]; |
|
705 | - } |
|
706 | - } |
|
707 | - |
|
708 | - public function yy_find_reduce_action($stateno, $iLookAhead) |
|
709 | - { |
|
710 | - /* $stateno = $this->yystack[$this->yyidx]->stateno; */ |
|
711 | - |
|
712 | - if (!isset(self::$yy_reduce_ofst[ $stateno ])) { |
|
713 | - return self::$yy_default[ $stateno ]; |
|
714 | - } |
|
715 | - $i = self::$yy_reduce_ofst[ $stateno ]; |
|
716 | - if ($i == self::YY_REDUCE_USE_DFLT) { |
|
717 | - return self::$yy_default[ $stateno ]; |
|
718 | - } |
|
719 | - if ($iLookAhead == self::YYNOCODE) { |
|
720 | - return self::YY_NO_ACTION; |
|
721 | - } |
|
722 | - $i += $iLookAhead; |
|
723 | - if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[ $i ] != $iLookAhead) { |
|
724 | - return self::$yy_default[ $stateno ]; |
|
725 | - } else { |
|
726 | - return self::$yy_action[ $i ]; |
|
727 | - } |
|
728 | - } |
|
729 | - |
|
730 | - public function yy_shift($yyNewState, $yyMajor, $yypMinor) |
|
731 | - { |
|
732 | - $this->yyidx ++; |
|
733 | - if ($this->yyidx >= self::YYSTACKDEPTH) { |
|
734 | - $this->yyidx --; |
|
735 | - if ($this->yyTraceFILE) { |
|
736 | - fprintf($this->yyTraceFILE, "%sStack Overflow!\n", $this->yyTracePrompt); |
|
737 | - } |
|
738 | - while ($this->yyidx >= 0) { |
|
739 | - $this->yy_pop_parser_stack(); |
|
740 | - } |
|
741 | - #line 255 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
742 | - |
|
743 | - $this->internalError = true; |
|
744 | - $this->compiler->trigger_config_file_error("Stack overflow in configfile parser"); |
|
745 | - |
|
746 | - return; |
|
747 | - } |
|
748 | - $yytos = new TPC_yyStackEntry; |
|
749 | - $yytos->stateno = $yyNewState; |
|
750 | - $yytos->major = $yyMajor; |
|
751 | - $yytos->minor = $yypMinor; |
|
752 | - $this->yystack[] = $yytos; |
|
753 | - if ($this->yyTraceFILE && $this->yyidx > 0) { |
|
754 | - fprintf($this->yyTraceFILE, "%sShift %d\n", $this->yyTracePrompt, $yyNewState); |
|
755 | - fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt); |
|
756 | - for ($i = 1; $i <= $this->yyidx; $i ++) { |
|
757 | - fprintf($this->yyTraceFILE, " %s", $this->yyTokenName[ $this->yystack[ $i ]->major ]); |
|
758 | - } |
|
759 | - fwrite($this->yyTraceFILE, "\n"); |
|
760 | - } |
|
761 | - } |
|
762 | - |
|
763 | - public static $yyRuleInfo = array(array(0 => 20, 1 => 2), array(0 => 21, 1 => 1), array(0 => 22, 1 => 2), |
|
764 | - array(0 => 22, 1 => 0), array(0 => 24, 1 => 5), array(0 => 24, 1 => 6), |
|
765 | - array(0 => 23, 1 => 2), array(0 => 23, 1 => 2), array(0 => 23, 1 => 0), |
|
766 | - array(0 => 26, 1 => 3), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), |
|
767 | - array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), |
|
768 | - array(0 => 27, 1 => 3), array(0 => 27, 1 => 2), array(0 => 27, 1 => 1), |
|
769 | - array(0 => 27, 1 => 1), array(0 => 25, 1 => 1), array(0 => 25, 1 => 2), |
|
770 | - array(0 => 25, 1 => 3),); |
|
771 | - |
|
772 | - public static $yyReduceMap = array(0 => 0, 2 => 0, 3 => 0, 19 => 0, 20 => 0, 21 => 0, 1 => 1, 4 => 4, 5 => 5, |
|
773 | - 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14, |
|
774 | - 15 => 15, 16 => 16, 17 => 17, 18 => 17,); |
|
775 | - |
|
776 | - #line 261 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
777 | - public function yy_r0() |
|
778 | - { |
|
779 | - $this->_retvalue = null; |
|
780 | - } |
|
781 | - |
|
782 | - #line 266 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
783 | - public function yy_r1() |
|
784 | - { |
|
785 | - $this->add_global_vars($this->yystack[ $this->yyidx + 0 ]->minor); |
|
786 | - $this->_retvalue = null; |
|
787 | - } |
|
788 | - |
|
789 | - #line 280 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
790 | - public function yy_r4() |
|
791 | - { |
|
792 | - $this->add_section_vars($this->yystack[ $this->yyidx + - 3 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor); |
|
793 | - $this->_retvalue = null; |
|
794 | - } |
|
795 | - |
|
796 | - #line 285 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
797 | - public function yy_r5() |
|
798 | - { |
|
799 | - if ($this->configReadHidden) { |
|
800 | - $this->add_section_vars($this->yystack[ $this->yyidx + - 3 ]->minor, |
|
801 | - $this->yystack[ $this->yyidx + 0 ]->minor); |
|
802 | - } |
|
803 | - $this->_retvalue = null; |
|
804 | - } |
|
805 | - |
|
806 | - #line 293 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
807 | - public function yy_r6() |
|
808 | - { |
|
809 | - $this->_retvalue = $this->yystack[ $this->yyidx + - 1 ]->minor; |
|
810 | - } |
|
811 | - |
|
812 | - #line 297 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
813 | - public function yy_r7() |
|
814 | - { |
|
815 | - $this->_retvalue = |
|
816 | - array_merge($this->yystack[ $this->yyidx + - 1 ]->minor, Array($this->yystack[ $this->yyidx + 0 ]->minor)); |
|
817 | - } |
|
818 | - |
|
819 | - #line 301 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
820 | - public function yy_r8() |
|
821 | - { |
|
822 | - $this->_retvalue = Array(); |
|
823 | - } |
|
824 | - |
|
825 | - #line 307 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
826 | - public function yy_r9() |
|
827 | - { |
|
828 | - $this->_retvalue = Array("key" => $this->yystack[ $this->yyidx + - 2 ]->minor, |
|
829 | - "value" => $this->yystack[ $this->yyidx + 0 ]->minor); |
|
830 | - } |
|
831 | - |
|
832 | - #line 312 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
833 | - public function yy_r10() |
|
834 | - { |
|
835 | - $this->_retvalue = (float) $this->yystack[ $this->yyidx + 0 ]->minor; |
|
836 | - } |
|
837 | - |
|
838 | - #line 316 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
839 | - public function yy_r11() |
|
840 | - { |
|
841 | - $this->_retvalue = (int) $this->yystack[ $this->yyidx + 0 ]->minor; |
|
842 | - } |
|
843 | - |
|
844 | - #line 320 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
845 | - public function yy_r12() |
|
846 | - { |
|
847 | - $this->_retvalue = $this->parse_bool($this->yystack[ $this->yyidx + 0 ]->minor); |
|
848 | - } |
|
849 | - |
|
850 | - #line 324 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
851 | - public function yy_r13() |
|
852 | - { |
|
853 | - $this->_retvalue = self::parse_single_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor); |
|
854 | - } |
|
855 | - |
|
856 | - #line 328 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
857 | - public function yy_r14() |
|
858 | - { |
|
859 | - $this->_retvalue = self::parse_double_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor); |
|
860 | - } |
|
861 | - |
|
862 | - #line 332 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
863 | - public function yy_r15() |
|
864 | - { |
|
865 | - $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[ $this->yyidx + - 1 ]->minor); |
|
866 | - } |
|
867 | - |
|
868 | - #line 336 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
869 | - public function yy_r16() |
|
870 | - { |
|
871 | - $this->_retvalue = ''; |
|
872 | - } |
|
873 | - |
|
874 | - #line 340 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
875 | - public function yy_r17() |
|
876 | - { |
|
877 | - $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; |
|
878 | - } |
|
879 | - |
|
880 | - private $_retvalue; |
|
881 | - |
|
882 | - public function yy_reduce($yyruleno) |
|
883 | - { |
|
690 | + if (count(self::$yyFallback) && $iLookAhead < $countYyFallback && |
|
691 | + ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0 |
|
692 | + ) { |
|
693 | + if ($this->yyTraceFILE) { |
|
694 | + fwrite($this->yyTraceFILE, |
|
695 | + $this->yyTracePrompt . "FALLBACK " . $this->yyTokenName[ $iLookAhead ] . " => " . |
|
696 | + $this->yyTokenName[ $iFallback ] . "\n"); |
|
697 | + } |
|
698 | + |
|
699 | + return $this->yy_find_shift_action($iFallback); |
|
700 | + } |
|
701 | + |
|
702 | + return self::$yy_default[ $stateno ]; |
|
703 | + } else { |
|
704 | + return self::$yy_action[ $i ]; |
|
705 | + } |
|
706 | + } |
|
707 | + |
|
708 | + public function yy_find_reduce_action($stateno, $iLookAhead) |
|
709 | + { |
|
710 | + /* $stateno = $this->yystack[$this->yyidx]->stateno; */ |
|
711 | + |
|
712 | + if (!isset(self::$yy_reduce_ofst[ $stateno ])) { |
|
713 | + return self::$yy_default[ $stateno ]; |
|
714 | + } |
|
715 | + $i = self::$yy_reduce_ofst[ $stateno ]; |
|
716 | + if ($i == self::YY_REDUCE_USE_DFLT) { |
|
717 | + return self::$yy_default[ $stateno ]; |
|
718 | + } |
|
719 | + if ($iLookAhead == self::YYNOCODE) { |
|
720 | + return self::YY_NO_ACTION; |
|
721 | + } |
|
722 | + $i += $iLookAhead; |
|
723 | + if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[ $i ] != $iLookAhead) { |
|
724 | + return self::$yy_default[ $stateno ]; |
|
725 | + } else { |
|
726 | + return self::$yy_action[ $i ]; |
|
727 | + } |
|
728 | + } |
|
729 | + |
|
730 | + public function yy_shift($yyNewState, $yyMajor, $yypMinor) |
|
731 | + { |
|
732 | + $this->yyidx ++; |
|
733 | + if ($this->yyidx >= self::YYSTACKDEPTH) { |
|
734 | + $this->yyidx --; |
|
735 | + if ($this->yyTraceFILE) { |
|
736 | + fprintf($this->yyTraceFILE, "%sStack Overflow!\n", $this->yyTracePrompt); |
|
737 | + } |
|
738 | + while ($this->yyidx >= 0) { |
|
739 | + $this->yy_pop_parser_stack(); |
|
740 | + } |
|
741 | + #line 255 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
742 | + |
|
743 | + $this->internalError = true; |
|
744 | + $this->compiler->trigger_config_file_error("Stack overflow in configfile parser"); |
|
745 | + |
|
746 | + return; |
|
747 | + } |
|
748 | + $yytos = new TPC_yyStackEntry; |
|
749 | + $yytos->stateno = $yyNewState; |
|
750 | + $yytos->major = $yyMajor; |
|
751 | + $yytos->minor = $yypMinor; |
|
752 | + $this->yystack[] = $yytos; |
|
753 | + if ($this->yyTraceFILE && $this->yyidx > 0) { |
|
754 | + fprintf($this->yyTraceFILE, "%sShift %d\n", $this->yyTracePrompt, $yyNewState); |
|
755 | + fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt); |
|
756 | + for ($i = 1; $i <= $this->yyidx; $i ++) { |
|
757 | + fprintf($this->yyTraceFILE, " %s", $this->yyTokenName[ $this->yystack[ $i ]->major ]); |
|
758 | + } |
|
759 | + fwrite($this->yyTraceFILE, "\n"); |
|
760 | + } |
|
761 | + } |
|
762 | + |
|
763 | + public static $yyRuleInfo = array(array(0 => 20, 1 => 2), array(0 => 21, 1 => 1), array(0 => 22, 1 => 2), |
|
764 | + array(0 => 22, 1 => 0), array(0 => 24, 1 => 5), array(0 => 24, 1 => 6), |
|
765 | + array(0 => 23, 1 => 2), array(0 => 23, 1 => 2), array(0 => 23, 1 => 0), |
|
766 | + array(0 => 26, 1 => 3), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), |
|
767 | + array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), |
|
768 | + array(0 => 27, 1 => 3), array(0 => 27, 1 => 2), array(0 => 27, 1 => 1), |
|
769 | + array(0 => 27, 1 => 1), array(0 => 25, 1 => 1), array(0 => 25, 1 => 2), |
|
770 | + array(0 => 25, 1 => 3),); |
|
771 | + |
|
772 | + public static $yyReduceMap = array(0 => 0, 2 => 0, 3 => 0, 19 => 0, 20 => 0, 21 => 0, 1 => 1, 4 => 4, 5 => 5, |
|
773 | + 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14, |
|
774 | + 15 => 15, 16 => 16, 17 => 17, 18 => 17,); |
|
775 | + |
|
776 | + #line 261 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
777 | + public function yy_r0() |
|
778 | + { |
|
779 | + $this->_retvalue = null; |
|
780 | + } |
|
781 | + |
|
782 | + #line 266 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
783 | + public function yy_r1() |
|
784 | + { |
|
785 | + $this->add_global_vars($this->yystack[ $this->yyidx + 0 ]->minor); |
|
786 | + $this->_retvalue = null; |
|
787 | + } |
|
788 | + |
|
789 | + #line 280 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
790 | + public function yy_r4() |
|
791 | + { |
|
792 | + $this->add_section_vars($this->yystack[ $this->yyidx + - 3 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor); |
|
793 | + $this->_retvalue = null; |
|
794 | + } |
|
795 | + |
|
796 | + #line 285 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
797 | + public function yy_r5() |
|
798 | + { |
|
799 | + if ($this->configReadHidden) { |
|
800 | + $this->add_section_vars($this->yystack[ $this->yyidx + - 3 ]->minor, |
|
801 | + $this->yystack[ $this->yyidx + 0 ]->minor); |
|
802 | + } |
|
803 | + $this->_retvalue = null; |
|
804 | + } |
|
805 | + |
|
806 | + #line 293 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
807 | + public function yy_r6() |
|
808 | + { |
|
809 | + $this->_retvalue = $this->yystack[ $this->yyidx + - 1 ]->minor; |
|
810 | + } |
|
811 | + |
|
812 | + #line 297 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
813 | + public function yy_r7() |
|
814 | + { |
|
815 | + $this->_retvalue = |
|
816 | + array_merge($this->yystack[ $this->yyidx + - 1 ]->minor, Array($this->yystack[ $this->yyidx + 0 ]->minor)); |
|
817 | + } |
|
818 | + |
|
819 | + #line 301 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
820 | + public function yy_r8() |
|
821 | + { |
|
822 | + $this->_retvalue = Array(); |
|
823 | + } |
|
824 | + |
|
825 | + #line 307 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
826 | + public function yy_r9() |
|
827 | + { |
|
828 | + $this->_retvalue = Array("key" => $this->yystack[ $this->yyidx + - 2 ]->minor, |
|
829 | + "value" => $this->yystack[ $this->yyidx + 0 ]->minor); |
|
830 | + } |
|
831 | + |
|
832 | + #line 312 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
833 | + public function yy_r10() |
|
834 | + { |
|
835 | + $this->_retvalue = (float) $this->yystack[ $this->yyidx + 0 ]->minor; |
|
836 | + } |
|
837 | + |
|
838 | + #line 316 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
839 | + public function yy_r11() |
|
840 | + { |
|
841 | + $this->_retvalue = (int) $this->yystack[ $this->yyidx + 0 ]->minor; |
|
842 | + } |
|
843 | + |
|
844 | + #line 320 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
845 | + public function yy_r12() |
|
846 | + { |
|
847 | + $this->_retvalue = $this->parse_bool($this->yystack[ $this->yyidx + 0 ]->minor); |
|
848 | + } |
|
849 | + |
|
850 | + #line 324 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
851 | + public function yy_r13() |
|
852 | + { |
|
853 | + $this->_retvalue = self::parse_single_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor); |
|
854 | + } |
|
855 | + |
|
856 | + #line 328 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
857 | + public function yy_r14() |
|
858 | + { |
|
859 | + $this->_retvalue = self::parse_double_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor); |
|
860 | + } |
|
861 | + |
|
862 | + #line 332 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
863 | + public function yy_r15() |
|
864 | + { |
|
865 | + $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[ $this->yyidx + - 1 ]->minor); |
|
866 | + } |
|
867 | + |
|
868 | + #line 336 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
869 | + public function yy_r16() |
|
870 | + { |
|
871 | + $this->_retvalue = ''; |
|
872 | + } |
|
873 | + |
|
874 | + #line 340 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
875 | + public function yy_r17() |
|
876 | + { |
|
877 | + $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; |
|
878 | + } |
|
879 | + |
|
880 | + private $_retvalue; |
|
881 | + |
|
882 | + public function yy_reduce($yyruleno) |
|
883 | + { |
|
884 | 884 | $countYyRuleName = count(self::$yyRuleName); |
885 | - if ($this->yyTraceFILE && $yyruleno >= 0 && $yyruleno < $countYyRuleName) { |
|
886 | - fprintf($this->yyTraceFILE, "%sReduce (%d) [%s].\n", $this->yyTracePrompt, $yyruleno, |
|
887 | - self::$yyRuleName[ $yyruleno ]); |
|
888 | - } |
|
889 | - |
|
890 | - $this->_retvalue = $yy_lefthand_side = null; |
|
891 | - if (isset(self::$yyReduceMap[ $yyruleno ])) { |
|
892 | - // call the action |
|
893 | - $this->_retvalue = null; |
|
894 | - $this->{'yy_r' . self::$yyReduceMap[ $yyruleno ]}(); |
|
895 | - $yy_lefthand_side = $this->_retvalue; |
|
896 | - } |
|
897 | - $yygoto = self::$yyRuleInfo[ $yyruleno ][ 0 ]; |
|
898 | - $yysize = self::$yyRuleInfo[ $yyruleno ][ 1 ]; |
|
899 | - $this->yyidx -= $yysize; |
|
900 | - for ($i = $yysize; $i; $i --) { |
|
901 | - // pop all of the right-hand side parameters |
|
902 | - array_pop($this->yystack); |
|
903 | - } |
|
904 | - $yyact = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, $yygoto); |
|
905 | - if ($yyact < self::YYNSTATE) { |
|
906 | - if (!$this->yyTraceFILE && $yysize) { |
|
907 | - $this->yyidx ++; |
|
908 | - $x = new TPC_yyStackEntry; |
|
909 | - $x->stateno = $yyact; |
|
910 | - $x->major = $yygoto; |
|
911 | - $x->minor = $yy_lefthand_side; |
|
912 | - $this->yystack[ $this->yyidx ] = $x; |
|
913 | - } else { |
|
914 | - $this->yy_shift($yyact, $yygoto, $yy_lefthand_side); |
|
915 | - } |
|
916 | - } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) { |
|
917 | - $this->yy_accept(); |
|
918 | - } |
|
919 | - } |
|
920 | - |
|
921 | - public function yy_parse_failed() |
|
922 | - { |
|
923 | - if ($this->yyTraceFILE) { |
|
924 | - fprintf($this->yyTraceFILE, "%sFail!\n", $this->yyTracePrompt); |
|
925 | - } |
|
926 | - while ($this->yyidx >= 0) { |
|
927 | - $this->yy_pop_parser_stack(); |
|
928 | - } |
|
929 | - } |
|
930 | - |
|
931 | - public function yy_syntax_error($yymajor, $TOKEN) |
|
932 | - { |
|
933 | - #line 248 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
934 | - |
|
935 | - $this->internalError = true; |
|
936 | - $this->yymajor = $yymajor; |
|
937 | - $this->compiler->trigger_config_file_error(); |
|
938 | - } |
|
939 | - |
|
940 | - public function yy_accept() |
|
941 | - { |
|
942 | - if ($this->yyTraceFILE) { |
|
943 | - fprintf($this->yyTraceFILE, "%sAccept!\n", $this->yyTracePrompt); |
|
944 | - } |
|
945 | - while ($this->yyidx >= 0) { |
|
946 | - $this->yy_pop_parser_stack(); |
|
947 | - } |
|
948 | - #line 241 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
949 | - |
|
950 | - $this->successful = !$this->internalError; |
|
951 | - $this->internalError = false; |
|
952 | - $this->retvalue = $this->_retvalue; |
|
953 | - } |
|
954 | - |
|
955 | - public function doParse($yymajor, $yytokenvalue) |
|
956 | - { |
|
957 | - $yyerrorhit = 0; /* True if yymajor has invoked an error */ |
|
958 | - |
|
959 | - if ($this->yyidx === null || $this->yyidx < 0) { |
|
960 | - $this->yyidx = 0; |
|
961 | - $this->yyerrcnt = - 1; |
|
962 | - $x = new TPC_yyStackEntry; |
|
963 | - $x->stateno = 0; |
|
964 | - $x->major = 0; |
|
965 | - $this->yystack = array(); |
|
966 | - $this->yystack[] = $x; |
|
967 | - } |
|
968 | - $yyendofinput = ($yymajor == 0); |
|
969 | - |
|
970 | - if ($this->yyTraceFILE) { |
|
971 | - fprintf($this->yyTraceFILE, "%sInput %s\n", $this->yyTracePrompt, $this->yyTokenName[ $yymajor ]); |
|
972 | - } |
|
973 | - |
|
974 | - do { |
|
975 | - $yyact = $this->yy_find_shift_action($yymajor); |
|
976 | - if ($yymajor < self::YYERRORSYMBOL && !$this->yy_is_expected_token($yymajor)) { |
|
977 | - // force a syntax error |
|
978 | - $yyact = self::YY_ERROR_ACTION; |
|
979 | - } |
|
980 | - if ($yyact < self::YYNSTATE) { |
|
981 | - $this->yy_shift($yyact, $yymajor, $yytokenvalue); |
|
982 | - $this->yyerrcnt --; |
|
983 | - if ($yyendofinput && $this->yyidx >= 0) { |
|
984 | - $yymajor = 0; |
|
985 | - } else { |
|
986 | - $yymajor = self::YYNOCODE; |
|
987 | - } |
|
988 | - } elseif ($yyact < self::YYNSTATE + self::YYNRULE) { |
|
989 | - $this->yy_reduce($yyact - self::YYNSTATE); |
|
990 | - } elseif ($yyact == self::YY_ERROR_ACTION) { |
|
991 | - if ($this->yyTraceFILE) { |
|
992 | - fprintf($this->yyTraceFILE, "%sSyntax Error!\n", $this->yyTracePrompt); |
|
993 | - } |
|
994 | - if (self::YYERRORSYMBOL) { |
|
995 | - if ($this->yyerrcnt < 0) { |
|
996 | - $this->yy_syntax_error($yymajor, $yytokenvalue); |
|
997 | - } |
|
998 | - $yymx = $this->yystack[ $this->yyidx ]->major; |
|
999 | - if ($yymx == self::YYERRORSYMBOL || $yyerrorhit) { |
|
1000 | - if ($this->yyTraceFILE) { |
|
1001 | - fprintf($this->yyTraceFILE, "%sDiscard input token %s\n", $this->yyTracePrompt, |
|
1002 | - $this->yyTokenName[ $yymajor ]); |
|
1003 | - } |
|
1004 | - $this->yy_destructor($yymajor, $yytokenvalue); |
|
1005 | - $yymajor = self::YYNOCODE; |
|
1006 | - } else { |
|
1007 | - while ($this->yyidx >= 0 && $yymx != self::YYERRORSYMBOL && |
|
1008 | - ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE) { |
|
1009 | - $this->yy_pop_parser_stack(); |
|
1010 | - } |
|
1011 | - if ($this->yyidx < 0 || $yymajor == 0) { |
|
1012 | - $this->yy_destructor($yymajor, $yytokenvalue); |
|
1013 | - $this->yy_parse_failed(); |
|
1014 | - $yymajor = self::YYNOCODE; |
|
1015 | - } elseif ($yymx != self::YYERRORSYMBOL) { |
|
1016 | - $u2 = 0; |
|
1017 | - $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2); |
|
1018 | - } |
|
1019 | - } |
|
1020 | - $this->yyerrcnt = 3; |
|
1021 | - $yyerrorhit = 1; |
|
1022 | - } else { |
|
1023 | - if ($this->yyerrcnt <= 0) { |
|
1024 | - $this->yy_syntax_error($yymajor, $yytokenvalue); |
|
1025 | - } |
|
1026 | - $this->yyerrcnt = 3; |
|
1027 | - $this->yy_destructor($yymajor, $yytokenvalue); |
|
1028 | - if ($yyendofinput) { |
|
1029 | - $this->yy_parse_failed(); |
|
1030 | - } |
|
1031 | - $yymajor = self::YYNOCODE; |
|
1032 | - } |
|
1033 | - } else { |
|
1034 | - $this->yy_accept(); |
|
1035 | - $yymajor = self::YYNOCODE; |
|
1036 | - } |
|
1037 | - } |
|
1038 | - while ($yymajor != self::YYNOCODE && $this->yyidx >= 0); |
|
1039 | - } |
|
885 | + if ($this->yyTraceFILE && $yyruleno >= 0 && $yyruleno < $countYyRuleName) { |
|
886 | + fprintf($this->yyTraceFILE, "%sReduce (%d) [%s].\n", $this->yyTracePrompt, $yyruleno, |
|
887 | + self::$yyRuleName[ $yyruleno ]); |
|
888 | + } |
|
889 | + |
|
890 | + $this->_retvalue = $yy_lefthand_side = null; |
|
891 | + if (isset(self::$yyReduceMap[ $yyruleno ])) { |
|
892 | + // call the action |
|
893 | + $this->_retvalue = null; |
|
894 | + $this->{'yy_r' . self::$yyReduceMap[ $yyruleno ]}(); |
|
895 | + $yy_lefthand_side = $this->_retvalue; |
|
896 | + } |
|
897 | + $yygoto = self::$yyRuleInfo[ $yyruleno ][ 0 ]; |
|
898 | + $yysize = self::$yyRuleInfo[ $yyruleno ][ 1 ]; |
|
899 | + $this->yyidx -= $yysize; |
|
900 | + for ($i = $yysize; $i; $i --) { |
|
901 | + // pop all of the right-hand side parameters |
|
902 | + array_pop($this->yystack); |
|
903 | + } |
|
904 | + $yyact = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, $yygoto); |
|
905 | + if ($yyact < self::YYNSTATE) { |
|
906 | + if (!$this->yyTraceFILE && $yysize) { |
|
907 | + $this->yyidx ++; |
|
908 | + $x = new TPC_yyStackEntry; |
|
909 | + $x->stateno = $yyact; |
|
910 | + $x->major = $yygoto; |
|
911 | + $x->minor = $yy_lefthand_side; |
|
912 | + $this->yystack[ $this->yyidx ] = $x; |
|
913 | + } else { |
|
914 | + $this->yy_shift($yyact, $yygoto, $yy_lefthand_side); |
|
915 | + } |
|
916 | + } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) { |
|
917 | + $this->yy_accept(); |
|
918 | + } |
|
919 | + } |
|
920 | + |
|
921 | + public function yy_parse_failed() |
|
922 | + { |
|
923 | + if ($this->yyTraceFILE) { |
|
924 | + fprintf($this->yyTraceFILE, "%sFail!\n", $this->yyTracePrompt); |
|
925 | + } |
|
926 | + while ($this->yyidx >= 0) { |
|
927 | + $this->yy_pop_parser_stack(); |
|
928 | + } |
|
929 | + } |
|
930 | + |
|
931 | + public function yy_syntax_error($yymajor, $TOKEN) |
|
932 | + { |
|
933 | + #line 248 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
934 | + |
|
935 | + $this->internalError = true; |
|
936 | + $this->yymajor = $yymajor; |
|
937 | + $this->compiler->trigger_config_file_error(); |
|
938 | + } |
|
939 | + |
|
940 | + public function yy_accept() |
|
941 | + { |
|
942 | + if ($this->yyTraceFILE) { |
|
943 | + fprintf($this->yyTraceFILE, "%sAccept!\n", $this->yyTracePrompt); |
|
944 | + } |
|
945 | + while ($this->yyidx >= 0) { |
|
946 | + $this->yy_pop_parser_stack(); |
|
947 | + } |
|
948 | + #line 241 "../smarty/lexer/smarty_internal_configfileparser.y" |
|
949 | + |
|
950 | + $this->successful = !$this->internalError; |
|
951 | + $this->internalError = false; |
|
952 | + $this->retvalue = $this->_retvalue; |
|
953 | + } |
|
954 | + |
|
955 | + public function doParse($yymajor, $yytokenvalue) |
|
956 | + { |
|
957 | + $yyerrorhit = 0; /* True if yymajor has invoked an error */ |
|
958 | + |
|
959 | + if ($this->yyidx === null || $this->yyidx < 0) { |
|
960 | + $this->yyidx = 0; |
|
961 | + $this->yyerrcnt = - 1; |
|
962 | + $x = new TPC_yyStackEntry; |
|
963 | + $x->stateno = 0; |
|
964 | + $x->major = 0; |
|
965 | + $this->yystack = array(); |
|
966 | + $this->yystack[] = $x; |
|
967 | + } |
|
968 | + $yyendofinput = ($yymajor == 0); |
|
969 | + |
|
970 | + if ($this->yyTraceFILE) { |
|
971 | + fprintf($this->yyTraceFILE, "%sInput %s\n", $this->yyTracePrompt, $this->yyTokenName[ $yymajor ]); |
|
972 | + } |
|
973 | + |
|
974 | + do { |
|
975 | + $yyact = $this->yy_find_shift_action($yymajor); |
|
976 | + if ($yymajor < self::YYERRORSYMBOL && !$this->yy_is_expected_token($yymajor)) { |
|
977 | + // force a syntax error |
|
978 | + $yyact = self::YY_ERROR_ACTION; |
|
979 | + } |
|
980 | + if ($yyact < self::YYNSTATE) { |
|
981 | + $this->yy_shift($yyact, $yymajor, $yytokenvalue); |
|
982 | + $this->yyerrcnt --; |
|
983 | + if ($yyendofinput && $this->yyidx >= 0) { |
|
984 | + $yymajor = 0; |
|
985 | + } else { |
|
986 | + $yymajor = self::YYNOCODE; |
|
987 | + } |
|
988 | + } elseif ($yyact < self::YYNSTATE + self::YYNRULE) { |
|
989 | + $this->yy_reduce($yyact - self::YYNSTATE); |
|
990 | + } elseif ($yyact == self::YY_ERROR_ACTION) { |
|
991 | + if ($this->yyTraceFILE) { |
|
992 | + fprintf($this->yyTraceFILE, "%sSyntax Error!\n", $this->yyTracePrompt); |
|
993 | + } |
|
994 | + if (self::YYERRORSYMBOL) { |
|
995 | + if ($this->yyerrcnt < 0) { |
|
996 | + $this->yy_syntax_error($yymajor, $yytokenvalue); |
|
997 | + } |
|
998 | + $yymx = $this->yystack[ $this->yyidx ]->major; |
|
999 | + if ($yymx == self::YYERRORSYMBOL || $yyerrorhit) { |
|
1000 | + if ($this->yyTraceFILE) { |
|
1001 | + fprintf($this->yyTraceFILE, "%sDiscard input token %s\n", $this->yyTracePrompt, |
|
1002 | + $this->yyTokenName[ $yymajor ]); |
|
1003 | + } |
|
1004 | + $this->yy_destructor($yymajor, $yytokenvalue); |
|
1005 | + $yymajor = self::YYNOCODE; |
|
1006 | + } else { |
|
1007 | + while ($this->yyidx >= 0 && $yymx != self::YYERRORSYMBOL && |
|
1008 | + ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE) { |
|
1009 | + $this->yy_pop_parser_stack(); |
|
1010 | + } |
|
1011 | + if ($this->yyidx < 0 || $yymajor == 0) { |
|
1012 | + $this->yy_destructor($yymajor, $yytokenvalue); |
|
1013 | + $this->yy_parse_failed(); |
|
1014 | + $yymajor = self::YYNOCODE; |
|
1015 | + } elseif ($yymx != self::YYERRORSYMBOL) { |
|
1016 | + $u2 = 0; |
|
1017 | + $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2); |
|
1018 | + } |
|
1019 | + } |
|
1020 | + $this->yyerrcnt = 3; |
|
1021 | + $yyerrorhit = 1; |
|
1022 | + } else { |
|
1023 | + if ($this->yyerrcnt <= 0) { |
|
1024 | + $this->yy_syntax_error($yymajor, $yytokenvalue); |
|
1025 | + } |
|
1026 | + $this->yyerrcnt = 3; |
|
1027 | + $this->yy_destructor($yymajor, $yytokenvalue); |
|
1028 | + if ($yyendofinput) { |
|
1029 | + $this->yy_parse_failed(); |
|
1030 | + } |
|
1031 | + $yymajor = self::YYNOCODE; |
|
1032 | + } |
|
1033 | + } else { |
|
1034 | + $this->yy_accept(); |
|
1035 | + $yymajor = self::YYNOCODE; |
|
1036 | + } |
|
1037 | + } |
|
1038 | + while ($yymajor != self::YYNOCODE && $this->yyidx >= 0); |
|
1039 | + } |
|
1040 | 1040 | } |
1041 | 1041 |
@@ -117,7 +117,7 @@ |
||
117 | 117 | * @link http://www.smarty.net/docs/en/api.append.tpl |
118 | 118 | * |
119 | 119 | * @param array|string $tpl_var the template variable name(s) |
120 | - * @param mixed $value the value to append |
|
120 | + * @param string $value the value to append |
|
121 | 121 | * @param bool $merge flag if array elements shall be merged |
122 | 122 | * @param bool $nocache if true any output of this variable will |
123 | 123 | * be not cached |
@@ -28,216 +28,216 @@ |
||
28 | 28 | */ |
29 | 29 | class Smarty_Internal_Data |
30 | 30 | { |
31 | - /** |
|
32 | - * This object type (Smarty = 1, template = 2, data = 4) |
|
33 | - * |
|
34 | - * @var int |
|
35 | - */ |
|
36 | - public $_objType = 4; |
|
37 | - |
|
38 | - /** |
|
39 | - * name of class used for templates |
|
40 | - * |
|
41 | - * @var string |
|
42 | - */ |
|
43 | - public $template_class = 'Smarty_Internal_Template'; |
|
44 | - |
|
45 | - /** |
|
46 | - * template variables |
|
47 | - * |
|
48 | - * @var Smarty_Variable[] |
|
49 | - */ |
|
50 | - public $tpl_vars = array(); |
|
51 | - |
|
52 | - /** |
|
53 | - * parent template (if any) |
|
54 | - * |
|
55 | - * @var Smarty|Smarty_Internal_Template|Smarty_Internal_Data |
|
56 | - */ |
|
57 | - public $parent = null; |
|
58 | - |
|
59 | - /** |
|
60 | - * configuration settings |
|
61 | - * |
|
62 | - * @var string[] |
|
63 | - */ |
|
64 | - public $config_vars = array(); |
|
65 | - |
|
66 | - /** |
|
67 | - * extension handler |
|
68 | - * |
|
69 | - * @var Smarty_Internal_Extension_Handler |
|
70 | - */ |
|
71 | - public $ext = null; |
|
72 | - |
|
73 | - /** |
|
74 | - * Smarty_Internal_Data constructor. |
|
75 | - * |
|
76 | - * Install extension handler |
|
77 | - */ |
|
78 | - public function __construct() |
|
79 | - { |
|
80 | - $this->ext = new Smarty_Internal_Extension_Handler(); |
|
81 | - $this->ext->objType = $this->_objType; |
|
82 | - } |
|
83 | - |
|
84 | - /** |
|
85 | - * assigns a Smarty variable |
|
86 | - * |
|
87 | - * @param array|string $tpl_var the template variable name(s) |
|
88 | - * @param mixed $value the value to assign |
|
89 | - * @param boolean $nocache if true any output of this variable will be not cached |
|
90 | - * |
|
91 | - * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for |
|
92 | - * chaining |
|
93 | - */ |
|
94 | - public function assign($tpl_var, $value = null, $nocache = false) |
|
95 | - { |
|
96 | - if (is_array($tpl_var)) { |
|
97 | - foreach ($tpl_var as $_key => $_val) { |
|
98 | - $this->assign($_key, $_val, $nocache); |
|
99 | - } |
|
100 | - } else { |
|
101 | - if ($tpl_var != '') { |
|
102 | - if ($this->_objType == 2) { |
|
103 | - /** @var Smarty_Internal_Template $this */ |
|
104 | - $this->_assignInScope($tpl_var, $value, $nocache); |
|
105 | - } else { |
|
106 | - $this->tpl_vars[ $tpl_var ] = new Smarty_Variable($value, $nocache); |
|
107 | - } |
|
108 | - } |
|
109 | - } |
|
110 | - return $this; |
|
111 | - } |
|
112 | - |
|
113 | - /** |
|
114 | - * appends values to template variables |
|
115 | - * |
|
116 | - * @api Smarty::append() |
|
117 | - * @link http://www.smarty.net/docs/en/api.append.tpl |
|
118 | - * |
|
119 | - * @param array|string $tpl_var the template variable name(s) |
|
120 | - * @param mixed $value the value to append |
|
121 | - * @param bool $merge flag if array elements shall be merged |
|
122 | - * @param bool $nocache if true any output of this variable will |
|
123 | - * be not cached |
|
124 | - * |
|
125 | - * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty |
|
126 | - */ |
|
127 | - public function append($tpl_var, $value = null, $merge = false, $nocache = false) |
|
128 | - { |
|
129 | - return $this->ext->append->append($this, $tpl_var, $value, $merge, $nocache); |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * assigns a global Smarty variable |
|
134 | - * |
|
135 | - * @param string $varName the global variable name |
|
136 | - * @param mixed $value the value to assign |
|
137 | - * @param boolean $nocache if true any output of this variable will be not cached |
|
138 | - * |
|
139 | - * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty |
|
140 | - */ |
|
141 | - public function assignGlobal($varName, $value = null, $nocache = false) |
|
142 | - { |
|
143 | - return $this->ext->assignGlobal->assignGlobal($this, $varName, $value, $nocache); |
|
144 | - } |
|
145 | - |
|
146 | - /** |
|
147 | - * appends values to template variables by reference |
|
148 | - * |
|
149 | - * @param string $tpl_var the template variable name |
|
150 | - * @param mixed &$value the referenced value to append |
|
151 | - * @param boolean $merge flag if array elements shall be merged |
|
152 | - * |
|
153 | - * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty |
|
154 | - */ |
|
155 | - public function appendByRef($tpl_var, &$value, $merge = false) |
|
156 | - { |
|
157 | - return $this->ext->appendByRef->appendByRef($this, $tpl_var, $value, $merge); |
|
158 | - } |
|
159 | - |
|
160 | - /** |
|
161 | - * assigns values to template variables by reference |
|
162 | - * |
|
163 | - * @param string $tpl_var the template variable name |
|
164 | - * @param $value |
|
165 | - * @param boolean $nocache if true any output of this variable will be not cached |
|
166 | - * |
|
167 | - * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty |
|
168 | - */ |
|
169 | - public function assignByRef($tpl_var, &$value, $nocache = false) |
|
170 | - { |
|
171 | - return $this->ext->assignByRef->assignByRef($this, $tpl_var, $value, $nocache); |
|
172 | - } |
|
173 | - |
|
174 | - /** |
|
175 | - * Returns a single or all template variables |
|
176 | - * |
|
177 | - * @api Smarty::getTemplateVars() |
|
178 | - * @link http://www.smarty.net/docs/en/api.get.template.vars.tpl |
|
179 | - * |
|
180 | - * @param string $varName variable name or null |
|
181 | - * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr optional pointer to data object |
|
182 | - * @param bool $searchParents include parent templates? |
|
183 | - * |
|
184 | - * @return mixed variable value or or array of variables |
|
185 | - */ |
|
186 | - public function getTemplateVars($varName = null, Smarty_Internal_Data $_ptr = null, $searchParents = true) |
|
187 | - { |
|
188 | - return $this->ext->getTemplateVars->getTemplateVars($this, $varName, $_ptr, $searchParents); |
|
189 | - } |
|
190 | - |
|
191 | - /** |
|
192 | - * gets the object of a Smarty variable |
|
193 | - * |
|
194 | - * @param string $variable the name of the Smarty variable |
|
195 | - * @param Smarty_Internal_Data $_ptr optional pointer to data object |
|
196 | - * @param boolean $searchParents search also in parent data |
|
197 | - * @param bool $error_enable |
|
198 | - * |
|
199 | - * @return Smarty_Variable|Smarty_Undefined_Variable the object of the variable |
|
200 | - * @deprecated since 3.1.28 please use Smarty_Internal_Data::getTemplateVars() instead. |
|
201 | - */ |
|
202 | - public function getVariable($variable = null, Smarty_Internal_Data $_ptr = null, $searchParents = true, |
|
203 | - $error_enable = true) |
|
204 | - { |
|
205 | - return $this->ext->getTemplateVars->_getVariable($this, $variable, $_ptr, $searchParents, $error_enable); |
|
206 | - } |
|
207 | - |
|
208 | - /** |
|
209 | - * Follow the parent chain an merge template and config variables |
|
210 | - * |
|
211 | - * @param \Smarty_Internal_Data|null $data |
|
212 | - */ |
|
213 | - public function _mergeVars(Smarty_Internal_Data $data = null) |
|
214 | - { |
|
215 | - if (isset($data)) { |
|
216 | - if (!empty($this->tpl_vars)) { |
|
217 | - $data->tpl_vars = array_merge($this->tpl_vars, $data->tpl_vars); |
|
218 | - } |
|
219 | - if (!empty($this->config_vars)) { |
|
220 | - $data->config_vars = array_merge($this->config_vars, $data->config_vars); |
|
221 | - } |
|
222 | - } else { |
|
223 | - $data = $this; |
|
224 | - } |
|
225 | - if (isset($this->parent)) { |
|
226 | - $this->parent->_mergeVars($data); |
|
227 | - } |
|
228 | - } |
|
229 | - |
|
230 | - /** |
|
231 | - * Handle unknown class methods |
|
232 | - * |
|
233 | - * @param string $name unknown method-name |
|
234 | - * @param array $args argument array |
|
235 | - * |
|
236 | - * @return mixed |
|
237 | - * @throws SmartyException |
|
238 | - */ |
|
239 | - public function __call($name, $args) |
|
240 | - { |
|
241 | - return $this->ext->_callExternalMethod($this, $name, $args); |
|
242 | - } |
|
31 | + /** |
|
32 | + * This object type (Smarty = 1, template = 2, data = 4) |
|
33 | + * |
|
34 | + * @var int |
|
35 | + */ |
|
36 | + public $_objType = 4; |
|
37 | + |
|
38 | + /** |
|
39 | + * name of class used for templates |
|
40 | + * |
|
41 | + * @var string |
|
42 | + */ |
|
43 | + public $template_class = 'Smarty_Internal_Template'; |
|
44 | + |
|
45 | + /** |
|
46 | + * template variables |
|
47 | + * |
|
48 | + * @var Smarty_Variable[] |
|
49 | + */ |
|
50 | + public $tpl_vars = array(); |
|
51 | + |
|
52 | + /** |
|
53 | + * parent template (if any) |
|
54 | + * |
|
55 | + * @var Smarty|Smarty_Internal_Template|Smarty_Internal_Data |
|
56 | + */ |
|
57 | + public $parent = null; |
|
58 | + |
|
59 | + /** |
|
60 | + * configuration settings |
|
61 | + * |
|
62 | + * @var string[] |
|
63 | + */ |
|
64 | + public $config_vars = array(); |
|
65 | + |
|
66 | + /** |
|
67 | + * extension handler |
|
68 | + * |
|
69 | + * @var Smarty_Internal_Extension_Handler |
|
70 | + */ |
|
71 | + public $ext = null; |
|
72 | + |
|
73 | + /** |
|
74 | + * Smarty_Internal_Data constructor. |
|
75 | + * |
|
76 | + * Install extension handler |
|
77 | + */ |
|
78 | + public function __construct() |
|
79 | + { |
|
80 | + $this->ext = new Smarty_Internal_Extension_Handler(); |
|
81 | + $this->ext->objType = $this->_objType; |
|
82 | + } |
|
83 | + |
|
84 | + /** |
|
85 | + * assigns a Smarty variable |
|
86 | + * |
|
87 | + * @param array|string $tpl_var the template variable name(s) |
|
88 | + * @param mixed $value the value to assign |
|
89 | + * @param boolean $nocache if true any output of this variable will be not cached |
|
90 | + * |
|
91 | + * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for |
|
92 | + * chaining |
|
93 | + */ |
|
94 | + public function assign($tpl_var, $value = null, $nocache = false) |
|
95 | + { |
|
96 | + if (is_array($tpl_var)) { |
|
97 | + foreach ($tpl_var as $_key => $_val) { |
|
98 | + $this->assign($_key, $_val, $nocache); |
|
99 | + } |
|
100 | + } else { |
|
101 | + if ($tpl_var != '') { |
|
102 | + if ($this->_objType == 2) { |
|
103 | + /** @var Smarty_Internal_Template $this */ |
|
104 | + $this->_assignInScope($tpl_var, $value, $nocache); |
|
105 | + } else { |
|
106 | + $this->tpl_vars[ $tpl_var ] = new Smarty_Variable($value, $nocache); |
|
107 | + } |
|
108 | + } |
|
109 | + } |
|
110 | + return $this; |
|
111 | + } |
|
112 | + |
|
113 | + /** |
|
114 | + * appends values to template variables |
|
115 | + * |
|
116 | + * @api Smarty::append() |
|
117 | + * @link http://www.smarty.net/docs/en/api.append.tpl |
|
118 | + * |
|
119 | + * @param array|string $tpl_var the template variable name(s) |
|
120 | + * @param mixed $value the value to append |
|
121 | + * @param bool $merge flag if array elements shall be merged |
|
122 | + * @param bool $nocache if true any output of this variable will |
|
123 | + * be not cached |
|
124 | + * |
|
125 | + * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty |
|
126 | + */ |
|
127 | + public function append($tpl_var, $value = null, $merge = false, $nocache = false) |
|
128 | + { |
|
129 | + return $this->ext->append->append($this, $tpl_var, $value, $merge, $nocache); |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * assigns a global Smarty variable |
|
134 | + * |
|
135 | + * @param string $varName the global variable name |
|
136 | + * @param mixed $value the value to assign |
|
137 | + * @param boolean $nocache if true any output of this variable will be not cached |
|
138 | + * |
|
139 | + * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty |
|
140 | + */ |
|
141 | + public function assignGlobal($varName, $value = null, $nocache = false) |
|
142 | + { |
|
143 | + return $this->ext->assignGlobal->assignGlobal($this, $varName, $value, $nocache); |
|
144 | + } |
|
145 | + |
|
146 | + /** |
|
147 | + * appends values to template variables by reference |
|
148 | + * |
|
149 | + * @param string $tpl_var the template variable name |
|
150 | + * @param mixed &$value the referenced value to append |
|
151 | + * @param boolean $merge flag if array elements shall be merged |
|
152 | + * |
|
153 | + * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty |
|
154 | + */ |
|
155 | + public function appendByRef($tpl_var, &$value, $merge = false) |
|
156 | + { |
|
157 | + return $this->ext->appendByRef->appendByRef($this, $tpl_var, $value, $merge); |
|
158 | + } |
|
159 | + |
|
160 | + /** |
|
161 | + * assigns values to template variables by reference |
|
162 | + * |
|
163 | + * @param string $tpl_var the template variable name |
|
164 | + * @param $value |
|
165 | + * @param boolean $nocache if true any output of this variable will be not cached |
|
166 | + * |
|
167 | + * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty |
|
168 | + */ |
|
169 | + public function assignByRef($tpl_var, &$value, $nocache = false) |
|
170 | + { |
|
171 | + return $this->ext->assignByRef->assignByRef($this, $tpl_var, $value, $nocache); |
|
172 | + } |
|
173 | + |
|
174 | + /** |
|
175 | + * Returns a single or all template variables |
|
176 | + * |
|
177 | + * @api Smarty::getTemplateVars() |
|
178 | + * @link http://www.smarty.net/docs/en/api.get.template.vars.tpl |
|
179 | + * |
|
180 | + * @param string $varName variable name or null |
|
181 | + * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr optional pointer to data object |
|
182 | + * @param bool $searchParents include parent templates? |
|
183 | + * |
|
184 | + * @return mixed variable value or or array of variables |
|
185 | + */ |
|
186 | + public function getTemplateVars($varName = null, Smarty_Internal_Data $_ptr = null, $searchParents = true) |
|
187 | + { |
|
188 | + return $this->ext->getTemplateVars->getTemplateVars($this, $varName, $_ptr, $searchParents); |
|
189 | + } |
|
190 | + |
|
191 | + /** |
|
192 | + * gets the object of a Smarty variable |
|
193 | + * |
|
194 | + * @param string $variable the name of the Smarty variable |
|
195 | + * @param Smarty_Internal_Data $_ptr optional pointer to data object |
|
196 | + * @param boolean $searchParents search also in parent data |
|
197 | + * @param bool $error_enable |
|
198 | + * |
|
199 | + * @return Smarty_Variable|Smarty_Undefined_Variable the object of the variable |
|
200 | + * @deprecated since 3.1.28 please use Smarty_Internal_Data::getTemplateVars() instead. |
|
201 | + */ |
|
202 | + public function getVariable($variable = null, Smarty_Internal_Data $_ptr = null, $searchParents = true, |
|
203 | + $error_enable = true) |
|
204 | + { |
|
205 | + return $this->ext->getTemplateVars->_getVariable($this, $variable, $_ptr, $searchParents, $error_enable); |
|
206 | + } |
|
207 | + |
|
208 | + /** |
|
209 | + * Follow the parent chain an merge template and config variables |
|
210 | + * |
|
211 | + * @param \Smarty_Internal_Data|null $data |
|
212 | + */ |
|
213 | + public function _mergeVars(Smarty_Internal_Data $data = null) |
|
214 | + { |
|
215 | + if (isset($data)) { |
|
216 | + if (!empty($this->tpl_vars)) { |
|
217 | + $data->tpl_vars = array_merge($this->tpl_vars, $data->tpl_vars); |
|
218 | + } |
|
219 | + if (!empty($this->config_vars)) { |
|
220 | + $data->config_vars = array_merge($this->config_vars, $data->config_vars); |
|
221 | + } |
|
222 | + } else { |
|
223 | + $data = $this; |
|
224 | + } |
|
225 | + if (isset($this->parent)) { |
|
226 | + $this->parent->_mergeVars($data); |
|
227 | + } |
|
228 | + } |
|
229 | + |
|
230 | + /** |
|
231 | + * Handle unknown class methods |
|
232 | + * |
|
233 | + * @param string $name unknown method-name |
|
234 | + * @param array $args argument array |
|
235 | + * |
|
236 | + * @return mixed |
|
237 | + * @throws SmartyException |
|
238 | + */ |
|
239 | + public function __call($name, $args) |
|
240 | + { |
|
241 | + return $this->ext->_callExternalMethod($this, $name, $args); |
|
242 | + } |
|
243 | 243 | } |
@@ -103,7 +103,7 @@ |
||
103 | 103 | /** @var Smarty_Internal_Template $this */ |
104 | 104 | $this->_assignInScope($tpl_var, $value, $nocache); |
105 | 105 | } else { |
106 | - $this->tpl_vars[ $tpl_var ] = new Smarty_Variable($value, $nocache); |
|
106 | + $this->tpl_vars[$tpl_var] = new Smarty_Variable($value, $nocache); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * Start logging template |
49 | 49 | * |
50 | 50 | * @param \Smarty_Internal_Template $template template |
51 | - * @param null $mode true: display false: fetch null: subtemplate |
|
51 | + * @param null|boolean $mode true: display false: fetch null: subtemplate |
|
52 | 52 | */ |
53 | 53 | public function start_template(Smarty_Internal_Template $template, $mode = null) |
54 | 54 | { |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | /** |
191 | 191 | * Opens a window for the Smarty Debugging Console and display the data |
192 | 192 | * |
193 | - * @param Smarty_Internal_Template|Smarty $obj object to debug |
|
193 | + * @param Smarty_Internal_Template $obj object to debug |
|
194 | 194 | * @param bool $full |
195 | 195 | */ |
196 | 196 | public function display_debug($obj, $full = false) |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | public function start_template(Smarty_Internal_Template $template, $mode = null) |
54 | 54 | { |
55 | 55 | if (isset($mode)) { |
56 | - $this->index ++; |
|
57 | - $this->offset ++; |
|
58 | - $this->template_data[ $this->index ] = null; |
|
56 | + $this->index++; |
|
57 | + $this->offset++; |
|
58 | + $this->template_data[$this->index] = null; |
|
59 | 59 | } |
60 | 60 | $key = $this->get_key($template); |
61 | - $this->template_data[ $this->index ][ $key ][ 'start_template_time' ] = microtime(true); |
|
61 | + $this->template_data[$this->index][$key]['start_template_time'] = microtime(true); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | public function end_template(Smarty_Internal_Template $template) |
70 | 70 | { |
71 | 71 | $key = $this->get_key($template); |
72 | - $this->template_data[ $this->index ][ $key ][ 'total_time' ] += |
|
73 | - microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_template_time' ]; |
|
72 | + $this->template_data[$this->index][$key]['total_time'] += |
|
73 | + microtime(true) - $this->template_data[$this->index][$key]['start_template_time']; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -83,24 +83,24 @@ discard block |
||
83 | 83 | static $_is_stringy = array('string' => true, 'eval' => true); |
84 | 84 | if (!empty($template->compiler->trace_uid)) { |
85 | 85 | $key = $template->compiler->trace_uid; |
86 | - if (!isset($this->template_data[ $this->index ][ $key ])) { |
|
87 | - if (isset($_is_stringy[ $template->source->type ])) { |
|
88 | - $this->template_data[ $this->index ][ $key ][ 'name' ] = |
|
86 | + if (!isset($this->template_data[$this->index][$key])) { |
|
87 | + if (isset($_is_stringy[$template->source->type])) { |
|
88 | + $this->template_data[$this->index][$key]['name'] = |
|
89 | 89 | '\'' . substr($template->source->name, 0, 25) . '...\''; |
90 | 90 | } else { |
91 | - $this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath; |
|
91 | + $this->template_data[$this->index][$key]['name'] = $template->source->filepath; |
|
92 | 92 | } |
93 | - $this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0; |
|
94 | - $this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0; |
|
95 | - $this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0; |
|
93 | + $this->template_data[$this->index][$key]['compile_time'] = 0; |
|
94 | + $this->template_data[$this->index][$key]['render_time'] = 0; |
|
95 | + $this->template_data[$this->index][$key]['cache_time'] = 0; |
|
96 | 96 | } |
97 | 97 | } else { |
98 | - if (isset($this->ignore_uid[ $template->source->uid ])) { |
|
98 | + if (isset($this->ignore_uid[$template->source->uid])) { |
|
99 | 99 | return; |
100 | 100 | } |
101 | 101 | $key = $this->get_key($template); |
102 | 102 | } |
103 | - $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true); |
|
103 | + $this->template_data[$this->index][$key]['start_time'] = microtime(true); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -113,14 +113,14 @@ discard block |
||
113 | 113 | if (!empty($template->compiler->trace_uid)) { |
114 | 114 | $key = $template->compiler->trace_uid; |
115 | 115 | } else { |
116 | - if (isset($this->ignore_uid[ $template->source->uid ])) { |
|
116 | + if (isset($this->ignore_uid[$template->source->uid])) { |
|
117 | 117 | return; |
118 | 118 | } |
119 | 119 | |
120 | 120 | $key = $this->get_key($template); |
121 | 121 | } |
122 | - $this->template_data[ $this->index ][ $key ][ 'compile_time' ] += |
|
123 | - microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ]; |
|
122 | + $this->template_data[$this->index][$key]['compile_time'] += |
|
123 | + microtime(true) - $this->template_data[$this->index][$key]['start_time']; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | public function start_render(Smarty_Internal_Template $template) |
132 | 132 | { |
133 | 133 | $key = $this->get_key($template); |
134 | - $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true); |
|
134 | + $this->template_data[$this->index][$key]['start_time'] = microtime(true); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | public function end_render(Smarty_Internal_Template $template) |
143 | 143 | { |
144 | 144 | $key = $this->get_key($template); |
145 | - $this->template_data[ $this->index ][ $key ][ 'render_time' ] += |
|
146 | - microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ]; |
|
145 | + $this->template_data[$this->index][$key]['render_time'] += |
|
146 | + microtime(true) - $this->template_data[$this->index][$key]['start_time']; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | public function start_cache(Smarty_Internal_Template $template) |
155 | 155 | { |
156 | 156 | $key = $this->get_key($template); |
157 | - $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true); |
|
157 | + $this->template_data[$this->index][$key]['start_time'] = microtime(true); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | public function end_cache(Smarty_Internal_Template $template) |
166 | 166 | { |
167 | 167 | $key = $this->get_key($template); |
168 | - $this->template_data[ $this->index ][ $key ][ 'cache_time' ] += |
|
169 | - microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ]; |
|
168 | + $this->template_data[$this->index][$key]['cache_time'] += |
|
169 | + microtime(true) - $this->template_data[$this->index][$key]['start_time']; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | public function display_debug($obj, $full = false) |
197 | 197 | { |
198 | 198 | if (!$full) { |
199 | - $this->offset ++; |
|
199 | + $this->offset++; |
|
200 | 200 | $savedIndex = $this->index; |
201 | 201 | $this->index = 9999; |
202 | 202 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $_template->assign('template_name', $obj->source->type . ':' . $obj->source->name); |
244 | 244 | } |
245 | 245 | if ($obj->_objType == 1 || $full) { |
246 | - $_template->assign('template_data', $this->template_data[ $this->index ]); |
|
246 | + $_template->assign('template_data', $this->template_data[$this->index]); |
|
247 | 247 | } else { |
248 | 248 | $_template->assign('template_data', null); |
249 | 249 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $_template->assign('offset', $this->offset * 50); |
255 | 255 | echo $_template->fetch(); |
256 | 256 | if (isset($full)) { |
257 | - $this->index --; |
|
257 | + $this->index--; |
|
258 | 258 | } |
259 | 259 | if (!$full) { |
260 | 260 | $this->index = $savedIndex; |
@@ -272,53 +272,53 @@ discard block |
||
272 | 272 | { |
273 | 273 | $config_vars = array(); |
274 | 274 | foreach ($obj->config_vars as $key => $var) { |
275 | - $config_vars[ $key ][ 'value' ] = $var; |
|
275 | + $config_vars[$key]['value'] = $var; |
|
276 | 276 | if ($obj->_objType == 2) { |
277 | - $config_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name; |
|
277 | + $config_vars[$key]['scope'] = $obj->source->type . ':' . $obj->source->name; |
|
278 | 278 | } elseif ($obj->_objType == 4) { |
279 | - $tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName; |
|
279 | + $tpl_vars[$key]['scope'] = $obj->dataObjectName; |
|
280 | 280 | } else { |
281 | - $config_vars[ $key ][ 'scope' ] = 'Smarty object'; |
|
281 | + $config_vars[$key]['scope'] = 'Smarty object'; |
|
282 | 282 | } |
283 | 283 | } |
284 | 284 | $tpl_vars = array(); |
285 | 285 | foreach ($obj->tpl_vars as $key => $var) { |
286 | 286 | foreach ($var as $varkey => $varvalue) { |
287 | 287 | if ($varkey == 'value') { |
288 | - $tpl_vars[ $key ][ $varkey ] = $varvalue; |
|
288 | + $tpl_vars[$key][$varkey] = $varvalue; |
|
289 | 289 | } else { |
290 | 290 | if ($varkey == 'nocache') { |
291 | 291 | if ($varvalue == true) { |
292 | - $tpl_vars[ $key ][ $varkey ] = $varvalue; |
|
292 | + $tpl_vars[$key][$varkey] = $varvalue; |
|
293 | 293 | } |
294 | 294 | } else { |
295 | 295 | if ($varkey != 'scope' || $varvalue !== 0) { |
296 | - $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue; |
|
296 | + $tpl_vars[$key]['attributes'][$varkey] = $varvalue; |
|
297 | 297 | } |
298 | 298 | } |
299 | 299 | } |
300 | 300 | } |
301 | 301 | if ($obj->_objType == 2) { |
302 | - $tpl_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name; |
|
302 | + $tpl_vars[$key]['scope'] = $obj->source->type . ':' . $obj->source->name; |
|
303 | 303 | } elseif ($obj->_objType == 4) { |
304 | - $tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName; |
|
304 | + $tpl_vars[$key]['scope'] = $obj->dataObjectName; |
|
305 | 305 | } else { |
306 | - $tpl_vars[ $key ][ 'scope' ] = 'Smarty object'; |
|
306 | + $tpl_vars[$key]['scope'] = 'Smarty object'; |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | |
310 | 310 | if (isset($obj->parent)) { |
311 | 311 | $parent = $this->get_debug_vars($obj->parent); |
312 | 312 | foreach ($parent->tpl_vars as $name => $pvar) { |
313 | - if (isset($tpl_vars[ $name ]) && $tpl_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) { |
|
314 | - $tpl_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ]; |
|
313 | + if (isset($tpl_vars[$name]) && $tpl_vars[$name]['value'] === $pvar['value']) { |
|
314 | + $tpl_vars[$name]['scope'] = $pvar['scope']; |
|
315 | 315 | } |
316 | 316 | } |
317 | 317 | $tpl_vars = array_merge($parent->tpl_vars, $tpl_vars); |
318 | 318 | |
319 | 319 | foreach ($parent->config_vars as $name => $pvar) { |
320 | - if (isset($config_vars[ $name ]) && $config_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) { |
|
321 | - $config_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ]; |
|
320 | + if (isset($config_vars[$name]) && $config_vars[$name]['value'] === $pvar['value']) { |
|
321 | + $config_vars[$name]['scope'] = $pvar['scope']; |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | $config_vars = array_merge($parent->config_vars, $config_vars); |
@@ -327,20 +327,20 @@ discard block |
||
327 | 327 | if (!array_key_exists($key, $tpl_vars)) { |
328 | 328 | foreach ($var as $varkey => $varvalue) { |
329 | 329 | if ($varkey == 'value') { |
330 | - $tpl_vars[ $key ][ $varkey ] = $varvalue; |
|
330 | + $tpl_vars[$key][$varkey] = $varvalue; |
|
331 | 331 | } else { |
332 | 332 | if ($varkey == 'nocache') { |
333 | 333 | if ($varvalue == true) { |
334 | - $tpl_vars[ $key ][ $varkey ] = $varvalue; |
|
334 | + $tpl_vars[$key][$varkey] = $varvalue; |
|
335 | 335 | } |
336 | 336 | } else { |
337 | 337 | if ($varkey != 'scope' || $varvalue !== 0) { |
338 | - $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue; |
|
338 | + $tpl_vars[$key]['attributes'][$varkey] = $varvalue; |
|
339 | 339 | } |
340 | 340 | } |
341 | 341 | } |
342 | 342 | } |
343 | - $tpl_vars[ $key ][ 'scope' ] = 'Global'; |
|
343 | + $tpl_vars[$key]['scope'] = 'Global'; |
|
344 | 344 | } |
345 | 345 | } |
346 | 346 | } |
@@ -363,19 +363,19 @@ discard block |
||
363 | 363 | $template->source->filepath; |
364 | 364 | } |
365 | 365 | $key = $template->source->uid; |
366 | - if (isset($this->template_data[ $this->index ][ $key ])) { |
|
366 | + if (isset($this->template_data[$this->index][$key])) { |
|
367 | 367 | return $key; |
368 | 368 | } else { |
369 | - if (isset($_is_stringy[ $template->source->type ])) { |
|
370 | - $this->template_data[ $this->index ][ $key ][ 'name' ] = |
|
369 | + if (isset($_is_stringy[$template->source->type])) { |
|
370 | + $this->template_data[$this->index][$key]['name'] = |
|
371 | 371 | '\'' . substr($template->source->name, 0, 25) . '...\''; |
372 | 372 | } else { |
373 | - $this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath; |
|
373 | + $this->template_data[$this->index][$key]['name'] = $template->source->filepath; |
|
374 | 374 | } |
375 | - $this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0; |
|
376 | - $this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0; |
|
377 | - $this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0; |
|
378 | - $this->template_data[ $this->index ][ $key ][ 'total_time' ] = 0; |
|
375 | + $this->template_data[$this->index][$key]['compile_time'] = 0; |
|
376 | + $this->template_data[$this->index][$key]['render_time'] = 0; |
|
377 | + $this->template_data[$this->index][$key]['cache_time'] = 0; |
|
378 | + $this->template_data[$this->index][$key]['total_time'] = 0; |
|
379 | 379 | |
380 | 380 | return $key; |
381 | 381 | } |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | if ($template->source->uid == '') { |
393 | 393 | $template->source->filepath; |
394 | 394 | } |
395 | - $this->ignore_uid[ $template->source->uid ] = true; |
|
395 | + $this->ignore_uid[$template->source->uid] = true; |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | /** |
@@ -402,8 +402,8 @@ discard block |
||
402 | 402 | */ |
403 | 403 | public function debugUrl(Smarty $smarty) |
404 | 404 | { |
405 | - if (isset($_SERVER[ 'QUERY_STRING' ])) { |
|
406 | - $_query_string = $_SERVER[ 'QUERY_STRING' ]; |
|
405 | + if (isset($_SERVER['QUERY_STRING'])) { |
|
406 | + $_query_string = $_SERVER['QUERY_STRING']; |
|
407 | 407 | } else { |
408 | 408 | $_query_string = ''; |
409 | 409 | } |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | $smarty->debugging = true; |
422 | 422 | } |
423 | 423 | } else { |
424 | - if (isset($_COOKIE[ 'SMARTY_DEBUG' ])) { |
|
424 | + if (isset($_COOKIE['SMARTY_DEBUG'])) { |
|
425 | 425 | $smarty->debugging = true; |
426 | 426 | } |
427 | 427 | } |
@@ -16,414 +16,414 @@ |
||
16 | 16 | */ |
17 | 17 | class Smarty_Internal_Debug extends Smarty_Internal_Data |
18 | 18 | { |
19 | - /** |
|
20 | - * template data |
|
21 | - * |
|
22 | - * @var array |
|
23 | - */ |
|
24 | - public $template_data = array(); |
|
19 | + /** |
|
20 | + * template data |
|
21 | + * |
|
22 | + * @var array |
|
23 | + */ |
|
24 | + public $template_data = array(); |
|
25 | 25 | |
26 | - /** |
|
27 | - * List of uid's which shall be ignored |
|
28 | - * |
|
29 | - * @var array |
|
30 | - */ |
|
31 | - public $ignore_uid = array(); |
|
26 | + /** |
|
27 | + * List of uid's which shall be ignored |
|
28 | + * |
|
29 | + * @var array |
|
30 | + */ |
|
31 | + public $ignore_uid = array(); |
|
32 | 32 | |
33 | - /** |
|
34 | - * Index of display() and fetch() calls |
|
35 | - * |
|
36 | - * @var int |
|
37 | - */ |
|
38 | - public $index = 0; |
|
33 | + /** |
|
34 | + * Index of display() and fetch() calls |
|
35 | + * |
|
36 | + * @var int |
|
37 | + */ |
|
38 | + public $index = 0; |
|
39 | 39 | |
40 | - /** |
|
41 | - * Counter for window offset |
|
42 | - * |
|
43 | - * @var int |
|
44 | - */ |
|
45 | - public $offset = 0; |
|
40 | + /** |
|
41 | + * Counter for window offset |
|
42 | + * |
|
43 | + * @var int |
|
44 | + */ |
|
45 | + public $offset = 0; |
|
46 | 46 | |
47 | - /** |
|
48 | - * Start logging template |
|
49 | - * |
|
50 | - * @param \Smarty_Internal_Template $template template |
|
51 | - * @param null $mode true: display false: fetch null: subtemplate |
|
52 | - */ |
|
53 | - public function start_template(Smarty_Internal_Template $template, $mode = null) |
|
54 | - { |
|
55 | - if (isset($mode)) { |
|
56 | - $this->index ++; |
|
57 | - $this->offset ++; |
|
58 | - $this->template_data[ $this->index ] = null; |
|
59 | - } |
|
60 | - $key = $this->get_key($template); |
|
61 | - $this->template_data[ $this->index ][ $key ][ 'start_template_time' ] = microtime(true); |
|
62 | - } |
|
47 | + /** |
|
48 | + * Start logging template |
|
49 | + * |
|
50 | + * @param \Smarty_Internal_Template $template template |
|
51 | + * @param null $mode true: display false: fetch null: subtemplate |
|
52 | + */ |
|
53 | + public function start_template(Smarty_Internal_Template $template, $mode = null) |
|
54 | + { |
|
55 | + if (isset($mode)) { |
|
56 | + $this->index ++; |
|
57 | + $this->offset ++; |
|
58 | + $this->template_data[ $this->index ] = null; |
|
59 | + } |
|
60 | + $key = $this->get_key($template); |
|
61 | + $this->template_data[ $this->index ][ $key ][ 'start_template_time' ] = microtime(true); |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * End logging of cache time |
|
66 | - * |
|
67 | - * @param \Smarty_Internal_Template $template cached template |
|
68 | - */ |
|
69 | - public function end_template(Smarty_Internal_Template $template) |
|
70 | - { |
|
71 | - $key = $this->get_key($template); |
|
72 | - $this->template_data[ $this->index ][ $key ][ 'total_time' ] += |
|
73 | - microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_template_time' ]; |
|
74 | - } |
|
64 | + /** |
|
65 | + * End logging of cache time |
|
66 | + * |
|
67 | + * @param \Smarty_Internal_Template $template cached template |
|
68 | + */ |
|
69 | + public function end_template(Smarty_Internal_Template $template) |
|
70 | + { |
|
71 | + $key = $this->get_key($template); |
|
72 | + $this->template_data[ $this->index ][ $key ][ 'total_time' ] += |
|
73 | + microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_template_time' ]; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * Start logging of compile time |
|
78 | - * |
|
79 | - * @param \Smarty_Internal_Template $template |
|
80 | - */ |
|
81 | - public function start_compile(Smarty_Internal_Template $template) |
|
82 | - { |
|
83 | - static $_is_stringy = array('string' => true, 'eval' => true); |
|
84 | - if (!empty($template->compiler->trace_uid)) { |
|
85 | - $key = $template->compiler->trace_uid; |
|
86 | - if (!isset($this->template_data[ $this->index ][ $key ])) { |
|
87 | - if (isset($_is_stringy[ $template->source->type ])) { |
|
88 | - $this->template_data[ $this->index ][ $key ][ 'name' ] = |
|
89 | - '\'' . substr($template->source->name, 0, 25) . '...\''; |
|
90 | - } else { |
|
91 | - $this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath; |
|
92 | - } |
|
93 | - $this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0; |
|
94 | - $this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0; |
|
95 | - $this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0; |
|
96 | - } |
|
97 | - } else { |
|
98 | - if (isset($this->ignore_uid[ $template->source->uid ])) { |
|
99 | - return; |
|
100 | - } |
|
101 | - $key = $this->get_key($template); |
|
102 | - } |
|
103 | - $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true); |
|
104 | - } |
|
76 | + /** |
|
77 | + * Start logging of compile time |
|
78 | + * |
|
79 | + * @param \Smarty_Internal_Template $template |
|
80 | + */ |
|
81 | + public function start_compile(Smarty_Internal_Template $template) |
|
82 | + { |
|
83 | + static $_is_stringy = array('string' => true, 'eval' => true); |
|
84 | + if (!empty($template->compiler->trace_uid)) { |
|
85 | + $key = $template->compiler->trace_uid; |
|
86 | + if (!isset($this->template_data[ $this->index ][ $key ])) { |
|
87 | + if (isset($_is_stringy[ $template->source->type ])) { |
|
88 | + $this->template_data[ $this->index ][ $key ][ 'name' ] = |
|
89 | + '\'' . substr($template->source->name, 0, 25) . '...\''; |
|
90 | + } else { |
|
91 | + $this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath; |
|
92 | + } |
|
93 | + $this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0; |
|
94 | + $this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0; |
|
95 | + $this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0; |
|
96 | + } |
|
97 | + } else { |
|
98 | + if (isset($this->ignore_uid[ $template->source->uid ])) { |
|
99 | + return; |
|
100 | + } |
|
101 | + $key = $this->get_key($template); |
|
102 | + } |
|
103 | + $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true); |
|
104 | + } |
|
105 | 105 | |
106 | - /** |
|
107 | - * End logging of compile time |
|
108 | - * |
|
109 | - * @param \Smarty_Internal_Template $template |
|
110 | - */ |
|
111 | - public function end_compile(Smarty_Internal_Template $template) |
|
112 | - { |
|
113 | - if (!empty($template->compiler->trace_uid)) { |
|
114 | - $key = $template->compiler->trace_uid; |
|
115 | - } else { |
|
116 | - if (isset($this->ignore_uid[ $template->source->uid ])) { |
|
117 | - return; |
|
118 | - } |
|
106 | + /** |
|
107 | + * End logging of compile time |
|
108 | + * |
|
109 | + * @param \Smarty_Internal_Template $template |
|
110 | + */ |
|
111 | + public function end_compile(Smarty_Internal_Template $template) |
|
112 | + { |
|
113 | + if (!empty($template->compiler->trace_uid)) { |
|
114 | + $key = $template->compiler->trace_uid; |
|
115 | + } else { |
|
116 | + if (isset($this->ignore_uid[ $template->source->uid ])) { |
|
117 | + return; |
|
118 | + } |
|
119 | 119 | |
120 | - $key = $this->get_key($template); |
|
121 | - } |
|
122 | - $this->template_data[ $this->index ][ $key ][ 'compile_time' ] += |
|
123 | - microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ]; |
|
124 | - } |
|
120 | + $key = $this->get_key($template); |
|
121 | + } |
|
122 | + $this->template_data[ $this->index ][ $key ][ 'compile_time' ] += |
|
123 | + microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ]; |
|
124 | + } |
|
125 | 125 | |
126 | - /** |
|
127 | - * Start logging of render time |
|
128 | - * |
|
129 | - * @param \Smarty_Internal_Template $template |
|
130 | - */ |
|
131 | - public function start_render(Smarty_Internal_Template $template) |
|
132 | - { |
|
133 | - $key = $this->get_key($template); |
|
134 | - $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true); |
|
135 | - } |
|
126 | + /** |
|
127 | + * Start logging of render time |
|
128 | + * |
|
129 | + * @param \Smarty_Internal_Template $template |
|
130 | + */ |
|
131 | + public function start_render(Smarty_Internal_Template $template) |
|
132 | + { |
|
133 | + $key = $this->get_key($template); |
|
134 | + $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true); |
|
135 | + } |
|
136 | 136 | |
137 | - /** |
|
138 | - * End logging of compile time |
|
139 | - * |
|
140 | - * @param \Smarty_Internal_Template $template |
|
141 | - */ |
|
142 | - public function end_render(Smarty_Internal_Template $template) |
|
143 | - { |
|
144 | - $key = $this->get_key($template); |
|
145 | - $this->template_data[ $this->index ][ $key ][ 'render_time' ] += |
|
146 | - microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ]; |
|
147 | - } |
|
137 | + /** |
|
138 | + * End logging of compile time |
|
139 | + * |
|
140 | + * @param \Smarty_Internal_Template $template |
|
141 | + */ |
|
142 | + public function end_render(Smarty_Internal_Template $template) |
|
143 | + { |
|
144 | + $key = $this->get_key($template); |
|
145 | + $this->template_data[ $this->index ][ $key ][ 'render_time' ] += |
|
146 | + microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ]; |
|
147 | + } |
|
148 | 148 | |
149 | - /** |
|
150 | - * Start logging of cache time |
|
151 | - * |
|
152 | - * @param \Smarty_Internal_Template $template cached template |
|
153 | - */ |
|
154 | - public function start_cache(Smarty_Internal_Template $template) |
|
155 | - { |
|
156 | - $key = $this->get_key($template); |
|
157 | - $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true); |
|
158 | - } |
|
149 | + /** |
|
150 | + * Start logging of cache time |
|
151 | + * |
|
152 | + * @param \Smarty_Internal_Template $template cached template |
|
153 | + */ |
|
154 | + public function start_cache(Smarty_Internal_Template $template) |
|
155 | + { |
|
156 | + $key = $this->get_key($template); |
|
157 | + $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true); |
|
158 | + } |
|
159 | 159 | |
160 | - /** |
|
161 | - * End logging of cache time |
|
162 | - * |
|
163 | - * @param \Smarty_Internal_Template $template cached template |
|
164 | - */ |
|
165 | - public function end_cache(Smarty_Internal_Template $template) |
|
166 | - { |
|
167 | - $key = $this->get_key($template); |
|
168 | - $this->template_data[ $this->index ][ $key ][ 'cache_time' ] += |
|
169 | - microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ]; |
|
170 | - } |
|
160 | + /** |
|
161 | + * End logging of cache time |
|
162 | + * |
|
163 | + * @param \Smarty_Internal_Template $template cached template |
|
164 | + */ |
|
165 | + public function end_cache(Smarty_Internal_Template $template) |
|
166 | + { |
|
167 | + $key = $this->get_key($template); |
|
168 | + $this->template_data[ $this->index ][ $key ][ 'cache_time' ] += |
|
169 | + microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ]; |
|
170 | + } |
|
171 | 171 | |
172 | - /** |
|
173 | - * Register template object |
|
174 | - * |
|
175 | - * @param \Smarty_Internal_Template $template cached template |
|
176 | - */ |
|
177 | - public function register_template(Smarty_Internal_Template $template) |
|
178 | - { |
|
179 | - } |
|
172 | + /** |
|
173 | + * Register template object |
|
174 | + * |
|
175 | + * @param \Smarty_Internal_Template $template cached template |
|
176 | + */ |
|
177 | + public function register_template(Smarty_Internal_Template $template) |
|
178 | + { |
|
179 | + } |
|
180 | 180 | |
181 | - /** |
|
182 | - * Register data object |
|
183 | - * |
|
184 | - * @param \Smarty_Data $data data object |
|
185 | - */ |
|
186 | - public static function register_data(Smarty_Data $data) |
|
187 | - { |
|
188 | - } |
|
181 | + /** |
|
182 | + * Register data object |
|
183 | + * |
|
184 | + * @param \Smarty_Data $data data object |
|
185 | + */ |
|
186 | + public static function register_data(Smarty_Data $data) |
|
187 | + { |
|
188 | + } |
|
189 | 189 | |
190 | - /** |
|
191 | - * Opens a window for the Smarty Debugging Console and display the data |
|
192 | - * |
|
193 | - * @param Smarty_Internal_Template|Smarty $obj object to debug |
|
194 | - * @param bool $full |
|
195 | - */ |
|
196 | - public function display_debug($obj, $full = false) |
|
197 | - { |
|
198 | - if (!$full) { |
|
199 | - $this->offset ++; |
|
200 | - $savedIndex = $this->index; |
|
201 | - $this->index = 9999; |
|
202 | - } |
|
203 | - if ($obj->_objType == 1) { |
|
204 | - $smarty = $obj; |
|
205 | - } else { |
|
206 | - $smarty = $obj->smarty; |
|
207 | - } |
|
208 | - // create fresh instance of smarty for displaying the debug console |
|
209 | - // to avoid problems if the application did overload the Smarty class |
|
210 | - $debObj = new Smarty(); |
|
211 | - // copy the working dirs from application |
|
212 | - $debObj->setCompileDir($smarty->getCompileDir()); |
|
213 | - // init properties by hand as user may have edited the original Smarty class |
|
214 | - $debObj->setPluginsDir(is_dir(__DIR__ . '/../plugins') ? __DIR__ . '/../plugins' : $smarty->getPluginsDir()); |
|
215 | - $debObj->force_compile = false; |
|
216 | - $debObj->compile_check = true; |
|
217 | - $debObj->left_delimiter = '{'; |
|
218 | - $debObj->right_delimiter = '}'; |
|
219 | - $debObj->security_policy = null; |
|
220 | - $debObj->debugging = false; |
|
221 | - $debObj->debugging_ctrl = 'NONE'; |
|
222 | - $debObj->error_reporting = E_ALL & ~E_NOTICE; |
|
223 | - $debObj->debug_tpl = isset($smarty->debug_tpl) ? $smarty->debug_tpl : 'file:' . __DIR__ . '/../debug.tpl'; |
|
224 | - $debObj->registered_plugins = array(); |
|
225 | - $debObj->registered_resources = array(); |
|
226 | - $debObj->registered_filters = array(); |
|
227 | - $debObj->autoload_filters = array(); |
|
228 | - $debObj->default_modifiers = array(); |
|
229 | - $debObj->escape_html = true; |
|
230 | - $debObj->caching = false; |
|
231 | - $debObj->compile_id = null; |
|
232 | - $debObj->cache_id = null; |
|
233 | - // prepare information of assigned variables |
|
234 | - $ptr = $this->get_debug_vars($obj); |
|
235 | - $_assigned_vars = $ptr->tpl_vars; |
|
236 | - ksort($_assigned_vars); |
|
237 | - $_config_vars = $ptr->config_vars; |
|
238 | - ksort($_config_vars); |
|
239 | - $debugging = $smarty->debugging; |
|
190 | + /** |
|
191 | + * Opens a window for the Smarty Debugging Console and display the data |
|
192 | + * |
|
193 | + * @param Smarty_Internal_Template|Smarty $obj object to debug |
|
194 | + * @param bool $full |
|
195 | + */ |
|
196 | + public function display_debug($obj, $full = false) |
|
197 | + { |
|
198 | + if (!$full) { |
|
199 | + $this->offset ++; |
|
200 | + $savedIndex = $this->index; |
|
201 | + $this->index = 9999; |
|
202 | + } |
|
203 | + if ($obj->_objType == 1) { |
|
204 | + $smarty = $obj; |
|
205 | + } else { |
|
206 | + $smarty = $obj->smarty; |
|
207 | + } |
|
208 | + // create fresh instance of smarty for displaying the debug console |
|
209 | + // to avoid problems if the application did overload the Smarty class |
|
210 | + $debObj = new Smarty(); |
|
211 | + // copy the working dirs from application |
|
212 | + $debObj->setCompileDir($smarty->getCompileDir()); |
|
213 | + // init properties by hand as user may have edited the original Smarty class |
|
214 | + $debObj->setPluginsDir(is_dir(__DIR__ . '/../plugins') ? __DIR__ . '/../plugins' : $smarty->getPluginsDir()); |
|
215 | + $debObj->force_compile = false; |
|
216 | + $debObj->compile_check = true; |
|
217 | + $debObj->left_delimiter = '{'; |
|
218 | + $debObj->right_delimiter = '}'; |
|
219 | + $debObj->security_policy = null; |
|
220 | + $debObj->debugging = false; |
|
221 | + $debObj->debugging_ctrl = 'NONE'; |
|
222 | + $debObj->error_reporting = E_ALL & ~E_NOTICE; |
|
223 | + $debObj->debug_tpl = isset($smarty->debug_tpl) ? $smarty->debug_tpl : 'file:' . __DIR__ . '/../debug.tpl'; |
|
224 | + $debObj->registered_plugins = array(); |
|
225 | + $debObj->registered_resources = array(); |
|
226 | + $debObj->registered_filters = array(); |
|
227 | + $debObj->autoload_filters = array(); |
|
228 | + $debObj->default_modifiers = array(); |
|
229 | + $debObj->escape_html = true; |
|
230 | + $debObj->caching = false; |
|
231 | + $debObj->compile_id = null; |
|
232 | + $debObj->cache_id = null; |
|
233 | + // prepare information of assigned variables |
|
234 | + $ptr = $this->get_debug_vars($obj); |
|
235 | + $_assigned_vars = $ptr->tpl_vars; |
|
236 | + ksort($_assigned_vars); |
|
237 | + $_config_vars = $ptr->config_vars; |
|
238 | + ksort($_config_vars); |
|
239 | + $debugging = $smarty->debugging; |
|
240 | 240 | |
241 | - $_template = new Smarty_Internal_Template($debObj->debug_tpl, $debObj); |
|
242 | - if ($obj->_objType == 2) { |
|
243 | - $_template->assign('template_name', $obj->source->type . ':' . $obj->source->name); |
|
244 | - } |
|
245 | - if ($obj->_objType == 1 || $full) { |
|
246 | - $_template->assign('template_data', $this->template_data[ $this->index ]); |
|
247 | - } else { |
|
248 | - $_template->assign('template_data', null); |
|
249 | - } |
|
250 | - $_template->assign('assigned_vars', $_assigned_vars); |
|
251 | - $_template->assign('config_vars', $_config_vars); |
|
252 | - $_template->assign('execution_time', microtime(true) - $smarty->start_time); |
|
253 | - $_template->assign('display_mode', $debugging == 2 || !$full); |
|
254 | - $_template->assign('offset', $this->offset * 50); |
|
255 | - echo $_template->fetch(); |
|
256 | - if (isset($full)) { |
|
257 | - $this->index --; |
|
258 | - } |
|
259 | - if (!$full) { |
|
260 | - $this->index = $savedIndex; |
|
261 | - } |
|
262 | - } |
|
241 | + $_template = new Smarty_Internal_Template($debObj->debug_tpl, $debObj); |
|
242 | + if ($obj->_objType == 2) { |
|
243 | + $_template->assign('template_name', $obj->source->type . ':' . $obj->source->name); |
|
244 | + } |
|
245 | + if ($obj->_objType == 1 || $full) { |
|
246 | + $_template->assign('template_data', $this->template_data[ $this->index ]); |
|
247 | + } else { |
|
248 | + $_template->assign('template_data', null); |
|
249 | + } |
|
250 | + $_template->assign('assigned_vars', $_assigned_vars); |
|
251 | + $_template->assign('config_vars', $_config_vars); |
|
252 | + $_template->assign('execution_time', microtime(true) - $smarty->start_time); |
|
253 | + $_template->assign('display_mode', $debugging == 2 || !$full); |
|
254 | + $_template->assign('offset', $this->offset * 50); |
|
255 | + echo $_template->fetch(); |
|
256 | + if (isset($full)) { |
|
257 | + $this->index --; |
|
258 | + } |
|
259 | + if (!$full) { |
|
260 | + $this->index = $savedIndex; |
|
261 | + } |
|
262 | + } |
|
263 | 263 | |
264 | - /** |
|
265 | - * Recursively gets variables from all template/data scopes |
|
266 | - * |
|
267 | - * @param Smarty_Internal_Template|Smarty_Data $obj object to debug |
|
268 | - * |
|
269 | - * @return StdClass |
|
270 | - */ |
|
271 | - public function get_debug_vars($obj) |
|
272 | - { |
|
273 | - $config_vars = array(); |
|
274 | - foreach ($obj->config_vars as $key => $var) { |
|
275 | - $config_vars[ $key ][ 'value' ] = $var; |
|
276 | - if ($obj->_objType == 2) { |
|
277 | - $config_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name; |
|
278 | - } elseif ($obj->_objType == 4) { |
|
279 | - $tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName; |
|
280 | - } else { |
|
281 | - $config_vars[ $key ][ 'scope' ] = 'Smarty object'; |
|
282 | - } |
|
283 | - } |
|
284 | - $tpl_vars = array(); |
|
285 | - foreach ($obj->tpl_vars as $key => $var) { |
|
286 | - foreach ($var as $varkey => $varvalue) { |
|
287 | - if ($varkey == 'value') { |
|
288 | - $tpl_vars[ $key ][ $varkey ] = $varvalue; |
|
289 | - } else { |
|
290 | - if ($varkey == 'nocache') { |
|
291 | - if ($varvalue === true) { |
|
292 | - $tpl_vars[ $key ][ $varkey ] = $varvalue; |
|
293 | - } |
|
294 | - } else { |
|
295 | - if ($varkey != 'scope' || $varvalue !== 0) { |
|
296 | - $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue; |
|
297 | - } |
|
298 | - } |
|
299 | - } |
|
300 | - } |
|
301 | - if ($obj->_objType == 2) { |
|
302 | - $tpl_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name; |
|
303 | - } elseif ($obj->_objType == 4) { |
|
304 | - $tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName; |
|
305 | - } else { |
|
306 | - $tpl_vars[ $key ][ 'scope' ] = 'Smarty object'; |
|
307 | - } |
|
308 | - } |
|
264 | + /** |
|
265 | + * Recursively gets variables from all template/data scopes |
|
266 | + * |
|
267 | + * @param Smarty_Internal_Template|Smarty_Data $obj object to debug |
|
268 | + * |
|
269 | + * @return StdClass |
|
270 | + */ |
|
271 | + public function get_debug_vars($obj) |
|
272 | + { |
|
273 | + $config_vars = array(); |
|
274 | + foreach ($obj->config_vars as $key => $var) { |
|
275 | + $config_vars[ $key ][ 'value' ] = $var; |
|
276 | + if ($obj->_objType == 2) { |
|
277 | + $config_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name; |
|
278 | + } elseif ($obj->_objType == 4) { |
|
279 | + $tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName; |
|
280 | + } else { |
|
281 | + $config_vars[ $key ][ 'scope' ] = 'Smarty object'; |
|
282 | + } |
|
283 | + } |
|
284 | + $tpl_vars = array(); |
|
285 | + foreach ($obj->tpl_vars as $key => $var) { |
|
286 | + foreach ($var as $varkey => $varvalue) { |
|
287 | + if ($varkey == 'value') { |
|
288 | + $tpl_vars[ $key ][ $varkey ] = $varvalue; |
|
289 | + } else { |
|
290 | + if ($varkey == 'nocache') { |
|
291 | + if ($varvalue === true) { |
|
292 | + $tpl_vars[ $key ][ $varkey ] = $varvalue; |
|
293 | + } |
|
294 | + } else { |
|
295 | + if ($varkey != 'scope' || $varvalue !== 0) { |
|
296 | + $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue; |
|
297 | + } |
|
298 | + } |
|
299 | + } |
|
300 | + } |
|
301 | + if ($obj->_objType == 2) { |
|
302 | + $tpl_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name; |
|
303 | + } elseif ($obj->_objType == 4) { |
|
304 | + $tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName; |
|
305 | + } else { |
|
306 | + $tpl_vars[ $key ][ 'scope' ] = 'Smarty object'; |
|
307 | + } |
|
308 | + } |
|
309 | 309 | |
310 | - if (isset($obj->parent)) { |
|
311 | - $parent = $this->get_debug_vars($obj->parent); |
|
312 | - foreach ($parent->tpl_vars as $name => $pvar) { |
|
313 | - if (isset($tpl_vars[ $name ]) && $tpl_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) { |
|
314 | - $tpl_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ]; |
|
315 | - } |
|
316 | - } |
|
317 | - $tpl_vars = array_merge($parent->tpl_vars, $tpl_vars); |
|
310 | + if (isset($obj->parent)) { |
|
311 | + $parent = $this->get_debug_vars($obj->parent); |
|
312 | + foreach ($parent->tpl_vars as $name => $pvar) { |
|
313 | + if (isset($tpl_vars[ $name ]) && $tpl_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) { |
|
314 | + $tpl_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ]; |
|
315 | + } |
|
316 | + } |
|
317 | + $tpl_vars = array_merge($parent->tpl_vars, $tpl_vars); |
|
318 | 318 | |
319 | - foreach ($parent->config_vars as $name => $pvar) { |
|
320 | - if (isset($config_vars[ $name ]) && $config_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) { |
|
321 | - $config_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ]; |
|
322 | - } |
|
323 | - } |
|
324 | - $config_vars = array_merge($parent->config_vars, $config_vars); |
|
325 | - } else { |
|
326 | - foreach (Smarty::$global_tpl_vars as $key => $var) { |
|
327 | - if (!array_key_exists($key, $tpl_vars)) { |
|
328 | - foreach ($var as $varkey => $varvalue) { |
|
329 | - if ($varkey == 'value') { |
|
330 | - $tpl_vars[ $key ][ $varkey ] = $varvalue; |
|
331 | - } else { |
|
332 | - if ($varkey == 'nocache') { |
|
333 | - if ($varvalue === true) { |
|
334 | - $tpl_vars[ $key ][ $varkey ] = $varvalue; |
|
335 | - } |
|
336 | - } else { |
|
337 | - if ($varkey != 'scope' || $varvalue !== 0) { |
|
338 | - $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue; |
|
339 | - } |
|
340 | - } |
|
341 | - } |
|
342 | - } |
|
343 | - $tpl_vars[ $key ][ 'scope' ] = 'Global'; |
|
344 | - } |
|
345 | - } |
|
346 | - } |
|
319 | + foreach ($parent->config_vars as $name => $pvar) { |
|
320 | + if (isset($config_vars[ $name ]) && $config_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) { |
|
321 | + $config_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ]; |
|
322 | + } |
|
323 | + } |
|
324 | + $config_vars = array_merge($parent->config_vars, $config_vars); |
|
325 | + } else { |
|
326 | + foreach (Smarty::$global_tpl_vars as $key => $var) { |
|
327 | + if (!array_key_exists($key, $tpl_vars)) { |
|
328 | + foreach ($var as $varkey => $varvalue) { |
|
329 | + if ($varkey == 'value') { |
|
330 | + $tpl_vars[ $key ][ $varkey ] = $varvalue; |
|
331 | + } else { |
|
332 | + if ($varkey == 'nocache') { |
|
333 | + if ($varvalue === true) { |
|
334 | + $tpl_vars[ $key ][ $varkey ] = $varvalue; |
|
335 | + } |
|
336 | + } else { |
|
337 | + if ($varkey != 'scope' || $varvalue !== 0) { |
|
338 | + $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue; |
|
339 | + } |
|
340 | + } |
|
341 | + } |
|
342 | + } |
|
343 | + $tpl_vars[ $key ][ 'scope' ] = 'Global'; |
|
344 | + } |
|
345 | + } |
|
346 | + } |
|
347 | 347 | |
348 | - return (object) array('tpl_vars' => $tpl_vars, 'config_vars' => $config_vars); |
|
349 | - } |
|
348 | + return (object) array('tpl_vars' => $tpl_vars, 'config_vars' => $config_vars); |
|
349 | + } |
|
350 | 350 | |
351 | - /** |
|
352 | - * Return key into $template_data for template |
|
353 | - * |
|
354 | - * @param \Smarty_Internal_Template $template template object |
|
355 | - * |
|
356 | - * @return string key into $template_data |
|
357 | - */ |
|
358 | - private function get_key(Smarty_Internal_Template $template) |
|
359 | - { |
|
360 | - static $_is_stringy = array('string' => true, 'eval' => true); |
|
361 | - // calculate Uid if not already done |
|
362 | - if ($template->source->uid == '') { |
|
363 | - $template->source->filepath; |
|
364 | - } |
|
365 | - $key = $template->source->uid; |
|
366 | - if (isset($this->template_data[ $this->index ][ $key ])) { |
|
367 | - return $key; |
|
368 | - } else { |
|
369 | - if (isset($_is_stringy[ $template->source->type ])) { |
|
370 | - $this->template_data[ $this->index ][ $key ][ 'name' ] = |
|
371 | - '\'' . substr($template->source->name, 0, 25) . '...\''; |
|
372 | - } else { |
|
373 | - $this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath; |
|
374 | - } |
|
375 | - $this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0; |
|
376 | - $this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0; |
|
377 | - $this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0; |
|
378 | - $this->template_data[ $this->index ][ $key ][ 'total_time' ] = 0; |
|
351 | + /** |
|
352 | + * Return key into $template_data for template |
|
353 | + * |
|
354 | + * @param \Smarty_Internal_Template $template template object |
|
355 | + * |
|
356 | + * @return string key into $template_data |
|
357 | + */ |
|
358 | + private function get_key(Smarty_Internal_Template $template) |
|
359 | + { |
|
360 | + static $_is_stringy = array('string' => true, 'eval' => true); |
|
361 | + // calculate Uid if not already done |
|
362 | + if ($template->source->uid == '') { |
|
363 | + $template->source->filepath; |
|
364 | + } |
|
365 | + $key = $template->source->uid; |
|
366 | + if (isset($this->template_data[ $this->index ][ $key ])) { |
|
367 | + return $key; |
|
368 | + } else { |
|
369 | + if (isset($_is_stringy[ $template->source->type ])) { |
|
370 | + $this->template_data[ $this->index ][ $key ][ 'name' ] = |
|
371 | + '\'' . substr($template->source->name, 0, 25) . '...\''; |
|
372 | + } else { |
|
373 | + $this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath; |
|
374 | + } |
|
375 | + $this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0; |
|
376 | + $this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0; |
|
377 | + $this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0; |
|
378 | + $this->template_data[ $this->index ][ $key ][ 'total_time' ] = 0; |
|
379 | 379 | |
380 | - return $key; |
|
381 | - } |
|
382 | - } |
|
380 | + return $key; |
|
381 | + } |
|
382 | + } |
|
383 | 383 | |
384 | - /** |
|
385 | - * Ignore template |
|
386 | - * |
|
387 | - * @param \Smarty_Internal_Template $template |
|
388 | - */ |
|
389 | - public function ignore(Smarty_Internal_Template $template) |
|
390 | - { |
|
391 | - // calculate Uid if not already done |
|
392 | - if ($template->source->uid == '') { |
|
393 | - $template->source->filepath; |
|
394 | - } |
|
395 | - $this->ignore_uid[ $template->source->uid ] = true; |
|
396 | - } |
|
384 | + /** |
|
385 | + * Ignore template |
|
386 | + * |
|
387 | + * @param \Smarty_Internal_Template $template |
|
388 | + */ |
|
389 | + public function ignore(Smarty_Internal_Template $template) |
|
390 | + { |
|
391 | + // calculate Uid if not already done |
|
392 | + if ($template->source->uid == '') { |
|
393 | + $template->source->filepath; |
|
394 | + } |
|
395 | + $this->ignore_uid[ $template->source->uid ] = true; |
|
396 | + } |
|
397 | 397 | |
398 | - /** |
|
399 | - * handle 'URL' debugging mode |
|
400 | - * |
|
401 | - * @param Smarty $smarty |
|
402 | - */ |
|
403 | - public function debugUrl(Smarty $smarty) |
|
404 | - { |
|
405 | - if (isset($_SERVER[ 'QUERY_STRING' ])) { |
|
406 | - $_query_string = $_SERVER[ 'QUERY_STRING' ]; |
|
407 | - } else { |
|
408 | - $_query_string = ''; |
|
409 | - } |
|
410 | - if (false !== strpos($_query_string, $smarty->smarty_debug_id)) { |
|
411 | - if (false !== strpos($_query_string, $smarty->smarty_debug_id . '=on')) { |
|
412 | - // enable debugging for this browser session |
|
413 | - setcookie('SMARTY_DEBUG', true); |
|
414 | - $smarty->debugging = true; |
|
415 | - } elseif (false !== strpos($_query_string, $smarty->smarty_debug_id . '=off')) { |
|
416 | - // disable debugging for this browser session |
|
417 | - setcookie('SMARTY_DEBUG', false); |
|
418 | - $smarty->debugging = false; |
|
419 | - } else { |
|
420 | - // enable debugging for this page |
|
421 | - $smarty->debugging = true; |
|
422 | - } |
|
423 | - } else { |
|
424 | - if (isset($_COOKIE[ 'SMARTY_DEBUG' ])) { |
|
425 | - $smarty->debugging = true; |
|
426 | - } |
|
427 | - } |
|
428 | - } |
|
398 | + /** |
|
399 | + * handle 'URL' debugging mode |
|
400 | + * |
|
401 | + * @param Smarty $smarty |
|
402 | + */ |
|
403 | + public function debugUrl(Smarty $smarty) |
|
404 | + { |
|
405 | + if (isset($_SERVER[ 'QUERY_STRING' ])) { |
|
406 | + $_query_string = $_SERVER[ 'QUERY_STRING' ]; |
|
407 | + } else { |
|
408 | + $_query_string = ''; |
|
409 | + } |
|
410 | + if (false !== strpos($_query_string, $smarty->smarty_debug_id)) { |
|
411 | + if (false !== strpos($_query_string, $smarty->smarty_debug_id . '=on')) { |
|
412 | + // enable debugging for this browser session |
|
413 | + setcookie('SMARTY_DEBUG', true); |
|
414 | + $smarty->debugging = true; |
|
415 | + } elseif (false !== strpos($_query_string, $smarty->smarty_debug_id . '=off')) { |
|
416 | + // disable debugging for this browser session |
|
417 | + setcookie('SMARTY_DEBUG', false); |
|
418 | + $smarty->debugging = false; |
|
419 | + } else { |
|
420 | + // enable debugging for this page |
|
421 | + $smarty->debugging = true; |
|
422 | + } |
|
423 | + } else { |
|
424 | + if (isset($_COOKIE[ 'SMARTY_DEBUG' ])) { |
|
425 | + $smarty->debugging = true; |
|
426 | + } |
|
427 | + } |
|
428 | + } |
|
429 | 429 | } |