added optional parameter $cache_attrs to register_function() and

register_block(). $cache_attrs is an array containing attribute- names
that should be cached on calls to functions that have $cacheable set
to false.
This commit is contained in:
messju
2003-08-06 11:35:59 +00:00
parent 4aa9036e73
commit f15be25a42
4 changed files with 67 additions and 27 deletions

View File

@@ -1,4 +1,5 @@
<?php
/**
* Project: Smarty: the PHP compiling template engine
* File: Smarty.class.php
@@ -578,6 +579,14 @@ class Smarty
*/
var $_cache_include = null;
/**
* indicate if the current code is used in a compiled
* include
*
* @var string
*/
var $_cache_including = false;
/**
* cached file paths
*
@@ -737,10 +746,11 @@ class Smarty
* @param string $function the name of the template function
* @param string $function_impl the name of the PHP function to register
*/
function register_function($function, $function_impl, $cacheable=true)
function register_function($function, $function_impl, $cacheable=true, $cache_attrs=null)
{
$this->_plugins['function'][$function] =
array($function_impl, null, null, false, $cacheable);
array($function_impl, null, null, false, $cacheable, $cache_attrs);
}
/**
@@ -787,10 +797,10 @@ class Smarty
* @param string $block name of template block
* @param string $block_impl PHP function to register
*/
function register_block($block, $block_impl, $cacheable=true)
function register_block($block, $block_impl, $cacheable=true, $cache_attrs=null)
{
$this->_plugins['block'][$block] =
array($block_impl, null, null, false, $cacheable);
array($block_impl, null, null, false, $cacheable, $cache_attrs);
}
/**