update cache_lifetime logic: -1 = never expire, 0 = always expire

This commit is contained in:
mohrt
2002-04-12 14:41:04 +00:00
parent 59e06a38e7
commit fc9846c319
4 changed files with 10 additions and 8 deletions

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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: */

View File

@@ -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: */