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