You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

smarty_internal_method_unloadfilter.php 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Smarty Method UnloadFilter
  4. *
  5. * Smarty::unloadFilter() method
  6. *
  7. * @package Smarty
  8. * @subpackage PluginsInternal
  9. * @author Uwe Tews
  10. */
  11. class Smarty_Internal_Method_UnloadFilter extends Smarty_Internal_Method_LoadFilter
  12. {
  13. /**
  14. * load a filter of specified type and name
  15. *
  16. * @api Smarty::unloadFilter()
  17. *
  18. * @link http://www.smarty.net/docs/en/api.unload.filter.tpl
  19. *
  20. * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
  21. * @param string $type filter type
  22. * @param string $name filter name
  23. *
  24. * @return Smarty_Internal_TemplateBase
  25. * @throws \SmartyException
  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. }