Deutschland United States United Kingdom
ContentLion - Open Source CMS

internalcompilenocache.php

Blame | Last modification | View Log

<?php
/**
 * Smarty Internal Plugin Compile Nocache
 *
 * Compiles the {nocache} {/nocache} tags.
 *
 * @package Smarty
 * @subpackage Compiler
 * @author Uwe Tews
 */


/**
 * Smarty Internal Plugin Compile Nocache Classv
 *
 * @package Smarty
 * @subpackage Compiler
 */

class Plugin_Smarty_InternalCompileNocache extends Plugin_Smarty_InternalCompileBase
{
    /**
     * Compiles code for the {nocache} tag
     *
     * This tag does not generate compiled output. It only sets a compiler flag.
     *
     * @param  array  $args     array with attributes from parser
     * @param  object $compiler compiler object
     * @return bool
     */

    public function compile($args, $compiler)
    {
        $_attr = $this->getAttributes($compiler, $args);
        if ($_attr['nocache'] === true) {
            $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);
        }
        if ($compiler->template->caching) {
        // enter nocache mode
        $this->openTag($compiler, 'nocache', $compiler->nocache);
        $compiler->nocache = true;
        }
        // this tag does not return compiled code
        $compiler->has_code = false;

        return true;
    }

}