К новейшей редакции | Содержимое файла | Последнее изменение | Открыть журнал | RSS
Редакция | Автор | № строки | Строка |
---|---|---|---|
304 | alex-w | 1 | <?php |
2 | /** |
||
3 | * Smarty Internal Plugin Compile Function Plugin |
||
4 | * |
||
5 | * Compiles code for the execution of function plugin |
||
6 | * |
||
7 | * @package Smarty |
||
8 | * @subpackage Compiler |
||
9 | * @author Uwe Tews |
||
10 | */ |
||
11 | /** |
||
12 | * Smarty Internal Plugin Compile Function Plugin Class |
||
13 | */ |
||
14 | class Smarty_Internal_Compile_Function_Plugin extends Smarty_Internal_CompileBase { |
||
15 | /** |
||
16 | * Compiles code for the execution of function plugin |
||
17 | * |
||
18 | * @param array $args array with attributes from parser |
||
19 | * @param string $tag name of function |
||
20 | * @param object $compiler compiler object |
||
21 | * @return string compiled code |
||
22 | */ |
||
23 | public function compile($args, $tag, $compiler) |
||
24 | { |
||
25 | $this->compiler = $compiler; |
||
26 | // This tag does create output |
||
27 | $this->compiler->has_output = true; |
||
28 | |||
29 | $this->required_attributes = array(); |
||
30 | $this->optional_attributes = array('_any'); |
||
31 | // check and get attributes |
||
32 | $_attr = $this->_get_attributes($args); |
||
33 | // not cachable? |
||
34 | if (isset($this->compiler->smarty->registered_plugins[$tag]) && !$this->compiler->smarty->registered_plugins[$tag][2]) { |
||
35 | $this->compiler->tag_nocache = true; |
||
36 | } |
||
37 | // convert attributes into parameter array string |
||
38 | $_paramsArray = array(); |
||
39 | foreach ($_attr as $_key => $_value) { |
||
40 | $_paramsArray[] = "'$_key'=>$_value"; |
||
41 | } |
||
42 | $_params = 'array(' . implode(",", $_paramsArray) . ')'; |
||
43 | // compile code |
||
44 | $output = '<?php echo $_smarty_tpl->smarty->plugin_handler->' . $tag . '(array(' . $_params . ',$_smarty_tpl->smarty,$_smarty_tpl),\'function\');?>'; |
||
45 | |||
46 | return $output; |
||
47 | } |
||
48 | } |
||
49 | |||
50 | ?> |