3 * Template Lite compile custom function - template internal module
6 * Name: compile_custom_function
9 function compile_compile_custom_function($function, $modifiers, $arguments, &$_result, &$object)
11 if ($function = $object->_plugin_exists($function, "function"))
13 $_args = $object->_parse_arguments($arguments);
14 foreach($_args as $key => $value)
18 $value = $value ?
'true' : 'false';
20 elseif (is_null($value))
24 elseif ($value[0] != '$' && $value[0] != '"')
26 $value = '"'.addslashes($value).'"';
29 $_args[$key] = "'$key' => $value";
32 if (is_array($function))
34 if (!is_string($function[0]))
36 throw new Template_Exception("Unsupported callback.");
39 $function = implode('::', $function);
42 $_result = '<?php echo ';
43 if (!empty($modifiers))
45 $_result .= $object->_parse_modifier($function . '(array(' . implode(',', (array)$_args) . '), $this)', $modifiers) . '; ';
49 $_result .= $function . '(array(' . implode(',', (array)$_args) . '), $this);';