Хранилища Subversion ant

Редакция

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

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