mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
update cache_lifetime logic: -1 = never expire, 0 = always expire
This commit is contained in:
@@ -95,7 +95,8 @@ class Smarty
|
||||
var $caching = false; // enable caching. true/false default false.
|
||||
var $cache_dir = 'cache'; // name of directory for template cache files
|
||||
var $cache_lifetime = 3600; // number of seconds cached content will persist.
|
||||
// 0 = never expires. default is one hour (3600)
|
||||
// 0 = always regenerate cache,
|
||||
// -1 = never expires. default is one hour (3600)
|
||||
var $cache_handler_func = null; // function used for cached content. this is
|
||||
// an alternative to using the built-in file
|
||||
// based caching.
|
||||
@@ -1478,7 +1479,7 @@ function _run_insert_handler($args)
|
||||
|
||||
$this->_cache_info = unserialize($cache_header);
|
||||
|
||||
if ($this->cache_lifetime < 0 && (time() - $this->_cache_info['timestamp'] > $this->cache_lifetime)) {
|
||||
if ($this->cache_lifetime > -1 && (time() - $this->_cache_info['timestamp'] > $this->cache_lifetime)) {
|
||||
// cache expired, regenerate
|
||||
return false;
|
||||
}
|
||||
|
@@ -95,7 +95,8 @@ class Smarty
|
||||
var $caching = false; // enable caching. true/false default false.
|
||||
var $cache_dir = 'cache'; // name of directory for template cache files
|
||||
var $cache_lifetime = 3600; // number of seconds cached content will persist.
|
||||
// 0 = never expires. default is one hour (3600)
|
||||
// 0 = always regenerate cache,
|
||||
// -1 = never expires. default is one hour (3600)
|
||||
var $cache_handler_func = null; // function used for cached content. this is
|
||||
// an alternative to using the built-in file
|
||||
// based caching.
|
||||
@@ -1478,7 +1479,7 @@ function _run_insert_handler($args)
|
||||
|
||||
$this->_cache_info = unserialize($cache_header);
|
||||
|
||||
if ($this->cache_lifetime < 0 && (time() - $this->_cache_info['timestamp'] > $this->cache_lifetime)) {
|
||||
if ($this->cache_lifetime > -1 && (time() - $this->_cache_info['timestamp'] > $this->cache_lifetime)) {
|
||||
// cache expired, regenerate
|
||||
return false;
|
||||
}
|
||||
|
@@ -8,12 +8,12 @@
|
||||
* Purpose: strip html tags from text
|
||||
* -------------------------------------------------------------
|
||||
*/
|
||||
function smarty_modifier_strip_tags($string, $replace_with_space = true)
|
||||
function smarty_modifier_strip_tags($string, $replace_with_space = true, $allowed = "<i><b><br>")
|
||||
{
|
||||
if ($replace_with_space)
|
||||
return preg_replace('!<[^>]*?>!', ' ', $string);
|
||||
else
|
||||
return strip_tags($string);
|
||||
return strip_tags($string, $allowed);
|
||||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
@@ -8,12 +8,12 @@
|
||||
* Purpose: strip html tags from text
|
||||
* -------------------------------------------------------------
|
||||
*/
|
||||
function smarty_modifier_strip_tags($string, $replace_with_space = true)
|
||||
function smarty_modifier_strip_tags($string, $replace_with_space = true, $allowed = "<i><b><br>")
|
||||
{
|
||||
if ($replace_with_space)
|
||||
return preg_replace('!<[^>]*?>!', ' ', $string);
|
||||
else
|
||||
return strip_tags($string);
|
||||
return strip_tags($string, $allowed);
|
||||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
Reference in New Issue
Block a user