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_clearassign.php 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Smarty Method ClearAssign
  4. *
  5. * Smarty::clearAssign() method
  6. *
  7. * @package Smarty
  8. * @subpackage PluginsInternal
  9. * @author Uwe Tews
  10. */
  11. class Smarty_Internal_Method_ClearAssign
  12. {
  13. /**
  14. * Valid for all objects
  15. *
  16. * @var int
  17. */
  18. public $objMap = 7;
  19. /**
  20. * clear the given assigned template variable(s).
  21. *
  22. * @api Smarty::clearAssign()
  23. * @link http://www.smarty.net/docs/en/api.clear.assign.tpl
  24. *
  25. * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
  26. * @param string|array $tpl_var the template variable(s) to clear
  27. *
  28. * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
  29. */
  30. public function clearAssign(Smarty_Internal_Data $data, $tpl_var)
  31. {
  32. if (is_array($tpl_var)) {
  33. foreach ($tpl_var as $curr_var) {
  34. unset($data->tpl_vars[$curr_var]);
  35. }
  36. } else {
  37. unset($data->tpl_vars[$tpl_var]);
  38. }
  39. return $data;
  40. }
  41. }