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

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