1: | <?php
|
2: | |
3: | |
4: | |
5: | |
6: | |
7: | |
8: | |
9: |
|
10: |
|
11: | |
12: | |
13: | |
14: | |
15: | |
16: |
|
17: | class Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_Compile_Private_Block_Plugin
|
18: | {
|
19: | |
20: | |
21: | |
22: | |
23: | |
24: | |
25: | |
26: | |
27: | |
28: |
|
29: | public function setup(Smarty_Internal_TemplateCompilerBase $compiler, $_attr, $tag, $function)
|
30: | {
|
31: | if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ])) {
|
32: | $tag_info = $compiler->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ];
|
33: | $callback = $tag_info[ 0 ];
|
34: | if (is_array($callback)) {
|
35: | if (is_object($callback[ 0 ])) {
|
36: | $callable = "array(\$_block_plugin{$this->nesting}, '{$callback[1]}')";
|
37: | $callback =
|
38: | array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]", "->{$callback[1]}");
|
39: | } else {
|
40: | $callable = "array(\$_block_plugin{$this->nesting}, '{$callback[1]}')";
|
41: | $callback =
|
42: | array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]", "::{$callback[1]}");
|
43: | }
|
44: | } else {
|
45: | $callable = "\$_block_plugin{$this->nesting}";
|
46: | $callback = array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0]", '');
|
47: | }
|
48: | } else {
|
49: | $tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ];
|
50: | $callback = $tag_info[ 0 ];
|
51: | if (is_array($callback)) {
|
52: | $callable = "array('{$callback[0]}', '{$callback[1]}')";
|
53: | $callback = "{$callback[1]}::{$callback[1]}";
|
54: | } else {
|
55: | $callable = null;
|
56: | }
|
57: | }
|
58: | $compiler->tag_nocache = !$tag_info[ 1 ] | $compiler->tag_nocache;
|
59: | $_paramsArray = array();
|
60: | foreach ($_attr as $_key => $_value) {
|
61: | if (is_int($_key)) {
|
62: | $_paramsArray[] = "$_key=>$_value";
|
63: | } elseif ($compiler->template->caching && in_array($_key, $tag_info[ 2 ])) {
|
64: | $_value = str_replace('\'', "^#^", $_value);
|
65: | $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^";
|
66: | } else {
|
67: | $_paramsArray[] = "'$_key'=>$_value";
|
68: | }
|
69: | }
|
70: | return array($callback, $_paramsArray, $callable);
|
71: | }
|
72: | }
|
73: | |