Adjusted time.php to honor note on separate row option.
[timetracker.git] / WEB-INF / lib / smarty / sysplugins / smarty_internal_function_call_handler.php
1 <?php
2 /**
3  * Smarty Internal Plugin Function Call Handler
4  * 
5  * @package Smarty
6  * @subpackage PluginsInternal
7  * @author Uwe Tews 
8  */
9
10 /**
11  * This class does call function defined with the {function} tag
12  */
13 class Smarty_Internal_Function_Call_Handler extends Smarty_Internal_Template {
14     static function call ($_name, $_template, $_params, $_hash, $_nocache)
15     {
16         if ($_nocache) {
17             $_function = "smarty_template_function_{$_name}_nocache";
18             $_template->smarty->template_functions[$_name]['called_nocache'] = true;
19         } else {
20             $_function = "smarty_template_function_{$_hash}_{$_name}";
21         } 
22         if (!is_callable($_function)) {
23             $_code = "function {$_function}(\$_smarty_tpl,\$params) {
24     \$saved_tpl_vars = \$_smarty_tpl->tpl_vars;
25     foreach (\$_smarty_tpl->template_functions['{$_name}']['parameter'] as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(trim(\$value,'\''));};
26     foreach (\$params as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(\$value);}?>";
27             if ($_nocache) {
28                 $_code .= preg_replace(array("!<\?php echo \\'/\*%%SmartyNocache:{$_template->smarty->template_functions[$_name]['nocache_hash']}%%\*/|/\*/%%SmartyNocache:{$_template->smarty->template_functions[$_name]['nocache_hash']}%%\*/\\';\?>!",
29                         "!\\\'!"), array('', "'"), $_template->smarty->template_functions[$_name]['compiled']);
30             } else {
31                 $_code .= preg_replace("/{$_template->smarty->template_functions[$_name]['nocache_hash']}/", $_template->properties['nocache_hash'], $_template->smarty->template_functions[$_name]['compiled']);
32             } 
33             $_code .= "<?php \$_smarty_tpl->tpl_vars = \$saved_tpl_vars;}";
34             eval($_code);
35         } 
36         $_function($_template, $_params);
37     } 
38
39
40 ?>