- bugfix experimental getTags() method did not work

This commit is contained in:
uwe.tews@googlemail.com
2011-07-26 18:09:31 +00:00
parent c64813beb5
commit c4c0cd254c
5 changed files with 73 additions and 57 deletions

View File

@@ -1,4 +1,7 @@
===== SVN trunk =====
26/07/2011
- bugfix experimental getTags() method did not work
15/07/2011
- bugfix individual cache_lifetime of {include} did not work correctly inside {block} tags

View File

@@ -236,6 +236,8 @@ class Smarty extends Smarty_Internal_Data {
public $inheritance = false;
// generate deprecated function call notices?
public $deprecation_notices = true;
// internal flag for getTags()
public $get_used_tags = false;
// Smarty 2 BC
public $_version = self::SMARTY_VERSION;
// self pointer to Smarty object
@@ -714,6 +716,17 @@ class Smarty extends Smarty_Internal_Data {
return false;
}
/**
* Return array of tag/attributes of all tags used by an template
*
* @param object $templae template object
* @return array of tag/attributes
*/
public function getTags(Smarty_Internal_Template $template)
{
return Smarty_Internal_Utility::getTags($template);
}
/**
* clean up properties on cloned object
*/

View File

@@ -70,6 +70,8 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
// blocks for template inheritance
public $block_data = array();
public $wrapper = null;
// optional log of tag/attributes
public $used_tags = array();
/**
* Create template data object
*

View File

@@ -23,8 +23,6 @@ class Smarty_Internal_TemplateCompilerBase {
public $_tag_stack = array();
// current template
public $template = null;
// optional log of tag/attributes
public $used_tags = array();
/**
* Initialize compiler
@@ -114,7 +112,7 @@ class Smarty_Internal_TemplateCompilerBase {
$this->has_output = false;
// log tag/attributes
if (isset($this->smarty->get_used_tags) && $this->smarty->get_used_tags) {
$this->used_tags[] = array($tag,$args);
$this->template->used_tags[] = array($tag,$args);
}
// check nocache option flag
if (in_array("'nocache'",$args) || in_array(array('nocache'=>'true'),$args)

View File

@@ -224,11 +224,11 @@ class Smarty_Internal_Utility {
* @param object $templae template object
* @return array of tag/attributes
*/
function getTags(Smarty_Internal_Template $template)
public static function getTags(Smarty_Internal_Template $template)
{
$template->smarty->get_used_tags = true;
$template->compileTemplateSource();
return $template->compiler_object->used_tags;
return $template->used_tags;
}
function testInstall()