Code

e38ee4b8b32bef2a1f78edcbd3df16b949b03e99
[gosa.git] / gosa-core / include / smarty / sysplugins / smarty_internal_compile_private_registered_function.php
1 <?php\r
2 /**\r
3 * Smarty Internal Plugin Compile Registered Function\r
4\r
5 * Compiles code for the execution of a registered function\r
6\r
7 * @package Smarty\r
8 * @subpackage Compiler\r
9 * @author Uwe Tews \r
10 */\r
11 /**\r
12 * Smarty Internal Plugin Compile Registered Function Class\r
13 */\r
14 class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Internal_CompileBase {\r
15     /**\r
16     * Compiles code for the execution of a registered function\r
17     * \r
18     * @param array $args array with attributes from parser\r
19     * @param string $tag name of function\r
20     * @param object $compiler compiler object\r
21     * @return string compiled code\r
22     */\r
23     public function compile($args, $compiler, $tag)\r
24     {\r
25         $this->compiler = $compiler; \r
26         // This tag does create output\r
27         $this->compiler->has_output = true;\r
28 \r
29         $this->required_attributes = array();\r
30         $this->optional_attributes = array('_any'); \r
31         // check and get attributes\r
32         $_attr = $this->_get_attributes($args); \r
33         // not cachable?\r
34         $this->compiler->tag_nocache = !$compiler->smarty->registered_plugins['function'][$tag][1]; \r
35         // convert attributes into parameter array string\r
36         $_paramsArray = array();\r
37         foreach ($_attr as $_key => $_value) {\r
38             if (is_int($_key)) {\r
39                 $_paramsArray[] = "$_key=>$_value";\r
40             } else {\r
41                 $_paramsArray[] = "'$_key'=>$_value";\r
42             } \r
43         } \r
44         $_params = 'array(' . implode(",", $_paramsArray) . ')'; \r
45         // compile code\r
46         $output = '<?php echo call_user_func_array($_smarty_tpl->smarty->registered_plugins[\'function\'][\'' . $tag . '\'][0],array(' . $_params . ',$_smarty_tpl->smarty,$_smarty_tpl));?>';\r
47         return $output;\r
48     } \r
49\r
50 \r
51 ?>\r