Code

Updated smarty
[gosa.git] / gosa-core / include / smarty / sysplugins / smarty_method_load_filter.php
1 <?php
3 /**
4 * Smarty method Load_Filter
5
6 * Loads a filter plugin
7
8 * @package Smarty
9 * @subpackage SmartyMethod
10 * @author Uwe Tews 
11 */
13 /**
14 * load a filter of specified type and name
15
16 * @param string $type filter type
17 * @param string $name filter name
18 */
19 function  Smarty_Method_Load_Filter($smarty, $type, $name)
20 {
21     $_plugin = "smarty_{$type}filter_{$name}";
22     $_filter_name = $_plugin;
23     if ($smarty->loadPlugin($_plugin)) {
24         if (class_exists($_plugin, false)) {
25             $_plugin = array($_plugin, 'execute');
26         } 
27         if (is_callable($_plugin)) {
28             $smarty->registered_filters[$type][$_filter_name] = $_plugin;
29             return;
30         } 
31     } 
32     throw new Exception("{$type}filter \"{$name}\" not callable");
33
35 ?>