]> git.mxchange.org Git - friendica.git/blob - vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_make_nocache.php
Add Smarty to Composer
[friendica.git] / vendor / smarty / smarty / libs / sysplugins / smarty_internal_compile_make_nocache.php
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      * @param  array                                $parameter array with compilation parameter
47      *
48      * @return string compiled code
49      * @throws \SmartyCompilerException
50      */
51     public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
52     {
53         // check and get attributes
54         $_attr = $this->getAttributes($compiler, $args);
55         if ($compiler->template->caching) {
56             $output = "<?php \$_smarty_tpl->smarty->ext->_make_nocache->save(\$_smarty_tpl, {$_attr[ 'var' ]});\n?>\n";
57             $compiler->has_code = true;
58             $compiler->suppressNocacheProcessing = true;
59             return $output;
60         } else {
61             return true;
62         }
63     }
64 }