1: | <?php
|
2: | |
3: | |
4: | |
5: | |
6: | |
7: | |
8: | |
9: |
|
10: |
|
11: | |
12: | |
13: | |
14: | |
15: | |
16: |
|
17: | class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase
|
18: | {
|
19: | |
20: | |
21: | |
22: | |
23: | |
24: |
|
25: | public $required_attributes = array('name');
|
26: |
|
27: | |
28: | |
29: | |
30: | |
31: | |
32: |
|
33: | public $shorttag_order = array('name');
|
34: |
|
35: | |
36: | |
37: | |
38: | |
39: | |
40: |
|
41: | public $optional_attributes = array('_any');
|
42: |
|
43: | |
44: | |
45: | |
46: | |
47: | |
48: | |
49: | |
50: |
|
51: | public function compile($args, $compiler)
|
52: | {
|
53: |
|
54: | $_attr = $this->getAttributes($compiler, $args);
|
55: |
|
56: | if (isset($_attr[ 'assign' ])) {
|
57: |
|
58: | $_assign = $_attr[ 'assign' ];
|
59: | }
|
60: |
|
61: | $_name = $_attr[ 'name' ];
|
62: | unset($_attr[ 'name' ], $_attr[ 'assign' ], $_attr[ 'nocache' ]);
|
63: |
|
64: | if (!$compiler->template->caching || $compiler->nocache || $compiler->tag_nocache) {
|
65: | $_nocache = 'true';
|
66: | } else {
|
67: | $_nocache = 'false';
|
68: | }
|
69: | $_paramsArray = array();
|
70: | foreach ($_attr as $_key => $_value) {
|
71: | if (is_int($_key)) {
|
72: | $_paramsArray[] = "$_key=>$_value";
|
73: | } else {
|
74: | $_paramsArray[] = "'$_key'=>$_value";
|
75: | }
|
76: | }
|
77: | $_params = 'array(' . implode(',', $_paramsArray) . ')';
|
78: |
|
79: |
|
80: | if (isset($_assign)) {
|
81: | $_output =
|
82: | "<?php ob_start();\n\$_smarty_tpl->smarty->ext->_tplFunction->callTemplateFunction(\$_smarty_tpl, {$_name}, {$_params}, {$_nocache});\n\$_smarty_tpl->assign({$_assign}, ob_get_clean());?>\n";
|
83: | } else {
|
84: | $_output =
|
85: | "<?php \$_smarty_tpl->smarty->ext->_tplFunction->callTemplateFunction(\$_smarty_tpl, {$_name}, {$_params}, {$_nocache});?>\n";
|
86: | }
|
87: | return $_output;
|
88: | }
|
89: | }
|
90: | |