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_make_nocache.php 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * Smarty Internal Plugin Compile Make_Nocache
  4. * Compiles the {make_nocache} tag
  5. *
  6. * @package Smarty
  7. * @subpackage Compiler
  8. * @author Uwe Tews
  9. */
  10. /**
  11. * Smarty Internal Plugin Compile Make_Nocache Class
  12. *
  13. * @package Smarty
  14. * @subpackage Compiler
  15. */
  16. class Smarty_Internal_Compile_Make_Nocache extends Smarty_Internal_CompileBase
  17. {
  18. /**
  19. * Attribute definition: Overwrites base class.
  20. *
  21. * @var array
  22. * @see Smarty_Internal_CompileBase
  23. */
  24. public $option_flags = array();
  25. /**
  26. * Array of names of required attribute required by tag
  27. *
  28. * @var array
  29. */
  30. public $required_attributes = array('var');
  31. /**
  32. * Shorttag attribute order defined by its names
  33. *
  34. * @var array
  35. */
  36. public $shorttag_order = array('var');
  37. /**
  38. * Compiles code for the {make_nocache} tag
  39. *
  40. * @param array $args array with attributes from parser
  41. * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
  42. *
  43. * @return string compiled code
  44. */
  45. public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
  46. {
  47. // check and get attributes
  48. $_attr = $this->getAttributes($compiler, $args);
  49. if ($compiler->template->caching) {
  50. $output = "<?php \$_smarty_tpl->smarty->ext->_make_nocache->save(\$_smarty_tpl, {$_attr[ 'var' ]});\n?>\n";
  51. $compiler->template->compiled->has_nocache_code = true;
  52. $compiler->suppressNocacheProcessing = true;
  53. return $output;
  54. } else {
  55. return true;
  56. }
  57. }
  58. }