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_adddefaultmodifiers.php 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * Smarty Method AddDefaultModifiers
  4. *
  5. * Smarty::addDefaultModifiers() method
  6. *
  7. * @package Smarty
  8. * @subpackage PluginsInternal
  9. * @author Uwe Tews
  10. */
  11. class Smarty_Internal_Method_AddDefaultModifiers
  12. {
  13. /**
  14. * Valid for Smarty and template object
  15. *
  16. * @var int
  17. */
  18. public $objMap = 3;
  19. /**
  20. * Add default modifiers
  21. *
  22. * @api Smarty::addDefaultModifiers()
  23. *
  24. * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
  25. * @param array|string $modifiers modifier or list of modifiers
  26. * to add
  27. *
  28. * @return \Smarty|\Smarty_Internal_Template
  29. */
  30. public function addDefaultModifiers(Smarty_Internal_TemplateBase $obj, $modifiers)
  31. {
  32. $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
  33. if (is_array($modifiers)) {
  34. $this->default_modifiers = array_merge($smarty->default_modifiers, $modifiers);
  35. } else {
  36. $smarty->default_modifiers[] = $modifiers;
  37. }
  38. return $obj;
  39. }
  40. }