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_compile_setfilter.php 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * Smarty Internal Plugin Compile Setfilter
  4. * Compiles code for setfilter tag
  5. *
  6. * @package Smarty
  7. * @subpackage Compiler
  8. * @author Uwe Tews
  9. */
  10. /**
  11. * Smarty Internal Plugin Compile Setfilter Class
  12. *
  13. * @package Smarty
  14. * @subpackage Compiler
  15. */
  16. class Smarty_Internal_Compile_Setfilter extends Smarty_Internal_CompileBase
  17. {
  18. /**
  19. * Compiles code for setfilter tag
  20. *
  21. * @param array $args array with attributes from parser
  22. * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
  23. * @param array $parameter array with compilation parameter
  24. *
  25. * @return string compiled code
  26. */
  27. public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
  28. {
  29. $compiler->variable_filter_stack[] = $compiler->variable_filters;
  30. $compiler->variable_filters = $parameter[ 'modifier_list' ];
  31. // this tag does not return compiled code
  32. $compiler->has_code = false;
  33. return true;
  34. }
  35. }
  36. /**
  37. * Smarty Internal Plugin Compile Setfilterclose Class
  38. *
  39. * @package Smarty
  40. * @subpackage Compiler
  41. */
  42. class Smarty_Internal_Compile_Setfilterclose extends Smarty_Internal_CompileBase
  43. {
  44. /**
  45. * Compiles code for the {/setfilter} tag
  46. * This tag does not generate compiled output. It resets variable filter.
  47. *
  48. * @param array $args array with attributes from parser
  49. * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
  50. *
  51. * @return string compiled code
  52. */
  53. public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
  54. {
  55. $_attr = $this->getAttributes($compiler, $args);
  56. // reset variable filter to previous state
  57. if (count($compiler->variable_filter_stack)) {
  58. $compiler->variable_filters = array_pop($compiler->variable_filter_stack);
  59. } else {
  60. $compiler->variable_filters = array();
  61. }
  62. // this tag does not return compiled code
  63. $compiler->has_code = false;
  64. return true;
  65. }
  66. }