1: | <?php
|
2: | |
3: | |
4: | |
5: | |
6: | |
7: | |
8: | |
9: |
|
10: |
|
11: | |
12: | |
13: | |
14: | |
15: | |
16: |
|
17: | class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase
|
18: | {
|
19: | |
20: | |
21: | |
22: | |
23: | |
24: |
|
25: | public $shorttag_order = array('name');
|
26: |
|
27: | |
28: | |
29: | |
30: | |
31: | |
32: |
|
33: | public $optional_attributes = array('name', 'assign', 'append');
|
34: |
|
35: | |
36: | |
37: | |
38: | |
39: | |
40: | |
41: | |
42: | |
43: |
|
44: | public static function compileSpecialVariable(
|
45: | $args,
|
46: | Smarty_Internal_TemplateCompilerBase $compiler,
|
47: | $parameter = null
|
48: | ) {
|
49: | return '$_smarty_tpl->smarty->ext->_capture->getBuffer($_smarty_tpl' .
|
50: | (isset($parameter[ 1 ]) ? ", {$parameter[ 1 ]})" : ')');
|
51: | }
|
52: |
|
53: | |
54: | |
55: | |
56: | |
57: | |
58: | |
59: | |
60: | |
61: |
|
62: | public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter = null)
|
63: | {
|
64: |
|
65: | $_attr = $this->getAttributes($compiler, $args, $parameter, 'capture');
|
66: | $buffer = isset($_attr[ 'name' ]) ? $_attr[ 'name' ] : "'default'";
|
67: | $assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : 'null';
|
68: | $append = isset($_attr[ 'append' ]) ? $_attr[ 'append' ] : 'null';
|
69: | $compiler->_cache[ 'capture_stack' ][] = array($compiler->nocache);
|
70: |
|
71: | $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
|
72: | $_output = "<?php \$_smarty_tpl->smarty->ext->_capture->open(\$_smarty_tpl, $buffer, $assign, $append);?>";
|
73: | return $_output;
|
74: | }
|
75: | }
|
76: |
|
77: | |
78: | |
79: | |
80: | |
81: | |
82: |
|
83: | class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase
|
84: | {
|
85: | |
86: | |
87: | |
88: | |
89: | |
90: | |
91: | |
92: | |
93: |
|
94: | public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
|
95: | {
|
96: |
|
97: | $_attr = $this->getAttributes($compiler, $args, $parameter, '/capture');
|
98: |
|
99: | if ($compiler->nocache) {
|
100: | $compiler->tag_nocache = true;
|
101: | }
|
102: | list($compiler->nocache) = array_pop($compiler->_cache[ 'capture_stack' ]);
|
103: | return "<?php \$_smarty_tpl->smarty->ext->_capture->close(\$_smarty_tpl);?>";
|
104: | }
|
105: | }
|
106: | |