Files
smarty/libs/sysplugins/smarty_internal_compile_nocache.php

79 lines
2.0 KiB
PHP
Raw Normal View History

<?php
/**
2010-08-17 15:39:51 +00:00
* Smarty Internal Plugin Compile Nocache
*
2011-09-16 14:19:56 +00:00
* Compiles the {nocache} {/nocache} tags.
*
2010-08-17 15:39:51 +00:00
* @package Smarty
* @subpackage Compiler
* @author Uwe Tews
*/
/**
2011-09-16 14:19:56 +00:00
* Smarty Internal Plugin Compile Nocache Classv
*
* @package Smarty
* @subpackage Compiler
*/
class Smarty_Internal_Compile_Nocache extends Smarty_Internal_CompileBase
{
/**
2010-08-17 15:39:51 +00:00
* Compiles code for the {nocache} tag
*
2011-09-16 14:19:56 +00:00
* 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
2011-09-16 14:19:56 +00:00
* @return bool
2010-08-17 15:39:51 +00:00
*/
public function compile($args, $compiler)
{
2011-09-16 14:19:56 +00:00
$_attr = $this->getAttributes($compiler, $args);
if ($_attr['nocache'] === true) {
2011-09-16 14:19:56 +00:00
$compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);
}
if ($compiler->template->caching) {
// enter nocache mode
$this->openTag($compiler, 'nocache', $compiler->nocache);
2011-09-16 14:19:56 +00:00
$compiler->nocache = true;
}
// this tag does not return compiled code
2011-09-16 14:19:56 +00:00
$compiler->has_code = false;
return true;
2011-09-16 14:19:56 +00:00
}
}
/**
2010-08-17 15:39:51 +00:00
* Smarty Internal Plugin Compile Nocacheclose Class
2011-09-16 14:19:56 +00:00
*
* @package Smarty
* @subpackage Compiler
*/
class Smarty_Internal_Compile_Nocacheclose extends Smarty_Internal_CompileBase
{
/**
2010-08-17 15:39:51 +00:00
* Compiles code for the {/nocache} tag
*
2011-09-16 14:19:56 +00:00
* 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
2011-09-16 14:19:56 +00:00
* @return bool
2010-08-17 15:39:51 +00:00
*/
public function compile($args, $compiler)
{
2011-09-16 14:19:56 +00:00
$_attr = $this->getAttributes($compiler, $args);
if ($compiler->template->caching) {
// restore old nocache mode
$compiler->nocache = $this->closeTag($compiler, 'nocache');
}
// this tag does not return compiled code
2011-09-16 14:19:56 +00:00
$compiler->has_code = false;
return true;
2011-09-16 14:19:56 +00:00
}
}