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 Smarty_Internal_TemplateBase
26: * @throws \SmartyException
27: */
28: public function unloadFilter(Smarty_Internal_TemplateBase $obj, $type, $name)
29: {
30: $smarty = $obj->_getSmartyObj();
31: $this->_checkFilterType($type);
32: if (isset($smarty->registered_filters[ $type ])) {
33: $_filter_name = "smarty_{$type}filter_{$name}";
34: if (isset($smarty->registered_filters[ $type ][ $_filter_name ])) {
35: unset($smarty->registered_filters[ $type ][ $_filter_name ]);
36: if (empty($smarty->registered_filters[ $type ])) {
37: unset($smarty->registered_filters[ $type ]);
38: }
39: }
40: }
41: return $obj;
42: }
43: }
44: