1: | <?php
|
2: | |
3: | |
4: | |
5: | |
6: | |
7: | |
8: | |
9: |
|
10: |
|
11: | |
12: | |
13: | |
14: | |
15: | |
16: |
|
17: | class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_CompileBase
|
18: | {
|
19: | |
20: | |
21: | |
22: | |
23: | |
24: |
|
25: | public $optional_attributes = array('_any');
|
26: |
|
27: | |
28: | |
29: | |
30: | |
31: | |
32: | |
33: | |
34: | |
35: | |
36: | |
37: | |
38: | |
39: |
|
40: | public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag, $method)
|
41: | {
|
42: |
|
43: | $_attr = $this->getAttributes($compiler, $args);
|
44: | unset($_attr[ 'nocache' ]);
|
45: | $_assign = null;
|
46: | if (isset($_attr[ 'assign' ])) {
|
47: | $_assign = $_attr[ 'assign' ];
|
48: | unset($_attr[ 'assign' ]);
|
49: | }
|
50: |
|
51: | if (is_callable(array($compiler->smarty->registered_objects[ $tag ][ 0 ], $method))) {
|
52: |
|
53: | if ($compiler->smarty->registered_objects[ $tag ][ 2 ]) {
|
54: | $_paramsArray = array();
|
55: | foreach ($_attr as $_key => $_value) {
|
56: | if (is_int($_key)) {
|
57: | $_paramsArray[] = "$_key=>$_value";
|
58: | } else {
|
59: | $_paramsArray[] = "'$_key'=>$_value";
|
60: | }
|
61: | }
|
62: | $_params = 'array(' . implode(',', $_paramsArray) . ')';
|
63: | $output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params},\$_smarty_tpl)";
|
64: | } else {
|
65: | $_params = implode(',', $_attr);
|
66: | $output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params})";
|
67: | }
|
68: | } else {
|
69: |
|
70: | $output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}";
|
71: | }
|
72: | if (!empty($parameter[ 'modifierlist' ])) {
|
73: | $output = $compiler->compileTag(
|
74: | 'private_modifier',
|
75: | array(),
|
76: | array('modifierlist' => $parameter[ 'modifierlist' ], 'value' => $output)
|
77: | );
|
78: | }
|
79: | if (empty($_assign)) {
|
80: | return "<?php echo {$output};?>\n";
|
81: | } else {
|
82: | return "<?php \$_smarty_tpl->assign({$_assign},{$output});?>\n";
|
83: | }
|
84: | }
|
85: | }
|
86: | |