smarty_internal_compile_nocache.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * Smarty Internal Plugin Compile Nocache
  4. *
  5. * Compiles the {nocache} {/nocache} tags.
  6. *
  7. * @package Smarty
  8. * @subpackage Compiler
  9. * @author Uwe Tews
  10. */
  11. /**
  12. * Smarty Internal Plugin Compile Nocache Classv
  13. *
  14. * @package Smarty
  15. * @subpackage Compiler
  16. */
  17. class Smarty_Internal_Compile_Nocache extends Smarty_Internal_CompileBase {
  18. /**
  19. * Compiles code for the {nocache} tag
  20. *
  21. * This tag does not generate compiled output. It only sets a compiler flag.
  22. *
  23. * @param array $args array with attributes from parser
  24. * @param object $compiler compiler object
  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. * Compiles code for the {/nocache} tag
  49. *
  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. * @return bool
  55. */
  56. public function compile($args, $compiler)
  57. {
  58. $_attr = $this->getAttributes($compiler, $args);
  59. // leave nocache mode
  60. $compiler->nocache = false;
  61. // this tag does not return compiled code
  62. $compiler->has_code = false;
  63. return true;
  64. }
  65. }
  66. ?>