]> git.mxchange.org Git - friendica.git/blob - vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php
Add Smarty to Composer
[friendica.git] / vendor / smarty / smarty / libs / sysplugins / smarty_internal_method_unloadfilter.php
1 <?php
2
3 /**
4  * Smarty Method UnloadFilter
5  *
6  * Smarty::unloadFilter() method
7  *
8  * @package    Smarty
9  * @subpackage PluginsInternal
10  * @author     Uwe Tews
11  */
12 class Smarty_Internal_Method_UnloadFilter extends Smarty_Internal_Method_LoadFilter
13 {
14     /**
15      * load a filter of specified type and name
16      *
17      * @api  Smarty::unloadFilter()
18      *
19      * @link http://www.smarty.net/docs/en/api.unload.filter.tpl
20      *
21      * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
22      * @param  string                                                         $type filter type
23      * @param  string                                                         $name filter name
24      *
25      * @return bool
26      */
27     public function unloadFilter(Smarty_Internal_TemplateBase $obj, $type, $name)
28     {
29         $smarty = $obj->_getSmartyObj();
30         $this->_checkFilterType($type);
31         if (isset($smarty->registered_filters[ $type ])) {
32             $_filter_name = "smarty_{$type}filter_{$name}";
33             if (isset($smarty->registered_filters[ $type ][ $_filter_name ])) {
34                 unset ($smarty->registered_filters[ $type ][ $_filter_name ]);
35                 if (empty($smarty->registered_filters[ $type ])) {
36                     unset($smarty->registered_filters[ $type ]);
37                 }
38             }
39         }
40         return $obj;
41     }
42 }