Code

Updated smarty
[gosa.git] / gosa-core / include / smarty / sysplugins / smarty_method_register_compiler_function.php
1 <?php
3 /**
4 * Smarty method Register_Compiler_Function
5
6 * Registers a PHP function as Smarty compiler function plugin
7
8 * @package Smarty
9 * @subpackage SmartyMethod
10 * @author Uwe Tews 
11 */
13 /**
14 * Register a PHP function as Smarty compiler function plugin
15 */
17 /**
18 * Registers compiler function
19
20 * @param string $compiler_tag of template function
21 * @param string $compiler_impl name of PHP function to register
22 */
23 function  Smarty_Method_Register_Compiler_Function($smarty, $compiler_tag, $compiler_impl, $cacheable = true)
24 {
25     if (isset($smarty->registered_plugins['compiler'][$compiler_tag])) {
26         throw new Exception("Plugin tag \"{$compiler_tag}\" already registered");
27     } elseif (!is_callable($compiler_impl)) {
28         throw new Exception("Plugin \"{$compiler_tag}\" not callable");
29     } else {
30         $smarty->registered_plugins['compiler'][$compiler_tag] =
31         array($compiler_impl, $cacheable);
32     } 
33
35 ?>