|
1 <?php |
|
2 /** |
|
3 * Smarty Internal Plugin Compile Setfilter |
|
4 * Compiles code for setfilter tag |
|
5 * |
|
6 * @package Smarty |
|
7 * @subpackage Compiler |
|
8 * @author Uwe Tews |
|
9 */ |
|
10 |
|
11 /** |
|
12 * Smarty Internal Plugin Compile Setfilter Class |
|
13 * |
|
14 * @package Smarty |
|
15 * @subpackage Compiler |
|
16 */ |
|
17 class Smarty_Internal_Compile_Setfilter extends Smarty_Internal_CompileBase { |
|
18 /** |
|
19 * Compiles code for setfilter tag |
|
20 * |
|
21 * @param array $args array with attributes from parser |
|
22 * @param object $compiler compiler object |
|
23 * @param array $parameter array with compilation parameter |
|
24 * |
|
25 * @return string compiled code |
|
26 */ |
|
27 public function compile($args, $compiler, $parameter) { |
|
28 $compiler->variable_filter_stack[] = $compiler->template->variable_filters; |
|
29 $compiler->template->variable_filters = $parameter['modifier_list']; |
|
30 // this tag does not return compiled code |
|
31 $compiler->has_code = false; |
|
32 |
|
33 return true; |
|
34 } |
|
35 } |
|
36 |
|
37 /** |
|
38 * Smarty Internal Plugin Compile Setfilterclose Class |
|
39 * |
|
40 * @package Smarty |
|
41 * @subpackage Compiler |
|
42 */ |
|
43 class Smarty_Internal_Compile_Setfilterclose extends Smarty_Internal_CompileBase { |
|
44 /** |
|
45 * Compiles code for the {/setfilter} tag |
|
46 * This tag does not generate compiled output. It resets variable filter. |
|
47 * |
|
48 * @param array $args array with attributes from parser |
|
49 * @param object $compiler compiler object |
|
50 * |
|
51 * @return string compiled code |
|
52 */ |
|
53 public function compile($args, $compiler) { |
|
54 $_attr = $this->getAttributes($compiler, $args); |
|
55 // reset variable filter to previous state |
|
56 if (count($compiler->variable_filter_stack)) { |
|
57 $compiler->template->variable_filters = array_pop($compiler->variable_filter_stack); |
|
58 } else { |
|
59 $compiler->template->variable_filters = array(); |
|
60 } |
|
61 // this tag does not return compiled code |
|
62 $compiler->has_code = false; |
|
63 |
|
64 return true; |
|
65 } |
|
66 } |