Содержимое файла | Последнее изменение | Открыть журнал | RSS
Редакция | Автор | № строки | Строка |
---|---|---|---|
304 | alex-w | 1 | <?php |
2 | |||
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 | */ |
||
12 | |||
13 | /** |
||
14 | * Register a PHP function as Smarty compiler function plugin |
||
15 | */ |
||
16 | |||
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 register_compiler_function($smarty, $compiler_tag, $compiler_impl, $cacheable = true) |
||
24 | { |
||
25 | if (isset($smarty->registered_plugins[$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_tag] = |
||
31 | array('compiler', $compiler_impl, $cacheable); |
||
32 | } |
||
33 | } |
||
34 | |||
35 | ?> |