Subversion Repositories ALCASAR

Rev

Go to most recent revision | Details | Last modification | View Log

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