summaryrefslogtreecommitdiff
path: root/lib/smarty3/sysplugins/smarty_template_cached.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/smarty3/sysplugins/smarty_template_cached.php')
-rw-r--r--lib/smarty3/sysplugins/smarty_template_cached.php25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/smarty3/sysplugins/smarty_template_cached.php b/lib/smarty3/sysplugins/smarty_template_cached.php
index 58f0daf..508d27f 100644
--- a/lib/smarty3/sysplugins/smarty_template_cached.php
+++ b/lib/smarty3/sysplugins/smarty_template_cached.php
@@ -83,6 +83,8 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base
* create Cached Object container
*
* @param Smarty_Internal_Template $_template template object
+ *
+ * @throws \SmartyException
*/
public function __construct(Smarty_Internal_Template $_template)
{
@@ -90,7 +92,7 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base
$this->cache_id = $_template->cache_id;
$this->source = $_template->source;
if (!class_exists('Smarty_CacheResource', false)) {
- require SMARTY_SYSPLUGINS_DIR . 'smarty_cacheresource.php';
+ include SMARTY_SYSPLUGINS_DIR . 'smarty_cacheresource.php';
}
$this->handler = Smarty_CacheResource::load($_template->smarty);
}
@@ -100,13 +102,12 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base
*
* @return Smarty_Template_Cached
*/
- static function load(Smarty_Internal_Template $_template)
+ public static function load(Smarty_Internal_Template $_template)
{
$_template->cached = new Smarty_Template_Cached($_template);
$_template->cached->handler->populate($_template->cached, $_template);
// caching enabled ?
- if (!($_template->caching == Smarty::CACHING_LIFETIME_CURRENT ||
- $_template->caching == Smarty::CACHING_LIFETIME_SAVED) || $_template->source->handler->recompiled
+ if (!$_template->caching || $_template->source->handler->recompiled
) {
$_template->cached->valid = false;
}
@@ -117,7 +118,7 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base
* Render cache template
*
* @param \Smarty_Internal_Template $_template
- * @param bool $no_output_filter
+ * @param bool $no_output_filter
*
* @throws \Exception
*/
@@ -162,14 +163,14 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base
} else {
$this->valid = true;
}
- if ($this->valid && $_template->caching == Smarty::CACHING_LIFETIME_CURRENT &&
- $_template->cache_lifetime >= 0 && time() > ($this->timestamp + $_template->cache_lifetime)
+ if ($this->valid && $_template->caching === Smarty::CACHING_LIFETIME_CURRENT
+ && $_template->cache_lifetime >= 0 && time() > ($this->timestamp + $_template->cache_lifetime)
) {
// lifetime expired
$this->valid = false;
}
- if ($this->valid && $_template->smarty->compile_check == 1 &&
- $_template->source->getTimeStamp() > $this->timestamp
+ if ($this->valid && $_template->compile_check === Smarty::COMPILECHECK_ON
+ && $_template->source->getTimeStamp() > $this->timestamp
) {
$this->valid = false;
}
@@ -203,9 +204,9 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base
} else {
return $this->valid;
}
- if ($this->valid && $_template->caching === Smarty::CACHING_LIFETIME_SAVED &&
- $_template->cached->cache_lifetime >= 0 &&
- (time() > ($_template->cached->timestamp + $_template->cached->cache_lifetime))
+ if ($this->valid && $_template->caching === Smarty::CACHING_LIFETIME_SAVED
+ && $_template->cached->cache_lifetime >= 0
+ && (time() > ($_template->cached->timestamp + $_template->cached->cache_lifetime))
) {
$this->valid = false;
}