Хранилища Subversion ant

Редакция

Содержимое файла | Последнее изменение | Открыть журнал | RSS

Редакция Автор № строки Строка
304 alex-w 1
<?php
2
 
3
/**
4
* Smarty method Register_Function
5
*
6
* Registers a PHP function as Smarty function plugin
7
*
8
* @package Smarty
9
* @subpackage SmartyMethod
10
* @author Uwe Tews
11
*/
12
 
13
/**
14
* Registers custom function to be used in templates
15
*
16
* @param object $smarty
17
* @param string $function_tag the name of the template function
18
* @param string $function_impl the name of the PHP function to register
19
* @param boolean $cacheable if true (default) this fuction is cachable
20
*/
21
function register_function($smarty, $function_tag, $function_impl, $cacheable = true, $cache_attr = array())
22
{
23
    if (isset($smarty->registered_plugins[$function_tag])) {
24
        throw new Exception("Plugin tag \"{$function_tag}\" already registered");
25
    } elseif (!is_callable($function_impl)) {
26
        throw new Exception("Plugin \"{$function_tag}\" not callable");
27
    } else {
28
        $smarty->registered_plugins[$function_tag] =
29
        array('function', $function_impl, $cacheable, $cache_attr);
30
    }
31
}
32
 
33
?>