smarty_internal_compile_nocache.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * Smarty Internal Plugin Compile Nocache
  4. * Compiles the {nocache} {/nocache} tags.
  5. *
  6. * @package Smarty
  7. * @subpackage Compiler
  8. * @author Uwe Tews
  9. */
  10. /**
  11. * Smarty Internal Plugin Compile Nocache Class
  12. *
  13. * @package Smarty
  14. * @subpackage Compiler
  15. */
  16. class Smarty_Internal_Compile_Nocache extends Smarty_Internal_CompileBase
  17. {
  18. /**
  19. * Compiles code for the {nocache} tag
  20. * This tag does not generate compiled output. It only sets a compiler flag.
  21. *
  22. * @param array $args array with attributes from parser
  23. * @param object $compiler compiler object
  24. *
  25. * @return bool
  26. */
  27. public function compile($args, $compiler)
  28. {
  29. $_attr = $this->getAttributes($compiler, $args);
  30. if ($_attr['nocache'] === true) {
  31. $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);
  32. }
  33. // enter nocache mode
  34. $compiler->nocache = true;
  35. // this tag does not return compiled code
  36. $compiler->has_code = false;
  37. return true;
  38. }
  39. }
  40. /**
  41. * Smarty Internal Plugin Compile Nocacheclose Class
  42. *
  43. * @package Smarty
  44. * @subpackage Compiler
  45. */
  46. class Smarty_Internal_Compile_Nocacheclose extends Smarty_Internal_CompileBase
  47. {
  48. /**
  49. * Compiles code for the {/nocache} tag
  50. * This tag does not generate compiled output. It only sets a compiler flag.
  51. *
  52. * @param array $args array with attributes from parser
  53. * @param object $compiler compiler object
  54. *
  55. * @return bool
  56. */
  57. public function compile($args, $compiler)
  58. {
  59. $_attr = $this->getAttributes($compiler, $args);
  60. // leave nocache mode
  61. $compiler->nocache = false;
  62. // this tag does not return compiled code
  63. $compiler->has_code = false;
  64. return true;
  65. }
  66. }