mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
- bugfix output filter should not run on individually cached subtemplates
- add unloadFilter() method
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
04.10.2011
|
||||
- bugfix assign() in plugins called in subtemplates did change value also in parent template
|
||||
- bugfix of problem introduced with r4342 on math plugin
|
||||
- bugfix output filter should not run on individually cached subtemplates
|
||||
- add unloadFilter() method
|
||||
|
||||
===== Smarty-3.1.2 =====
|
||||
03.10.2011
|
||||
|
@@ -230,7 +230,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
$output .= preg_replace("!/\*/?%%SmartyNocache:{$_template->properties['nocache_hash']}%%\*/!", '', $cache_parts[0][$curr_idx]);
|
||||
}
|
||||
}
|
||||
if (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output'])) {
|
||||
if (!$no_output_filter && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) {
|
||||
$output = Smarty_Internal_Filter_Handler::runFilter('output', $output, $_template);
|
||||
}
|
||||
// rendering (must be done before writing cache file because of {function} nocache handling)
|
||||
@@ -651,13 +651,32 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
$_plugin = array($_plugin, 'execute');
|
||||
}
|
||||
if (is_callable($_plugin)) {
|
||||
return $this->smarty->registered_filters[$type][$_filter_name] = $_plugin;
|
||||
$this->smarty->registered_filters[$type][$_filter_name] = $_plugin;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
throw new SmartyException("{$type}filter \"{$name}\" not callable");
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* unload a filter of specified type and name
|
||||
*
|
||||
* @param string $type filter type
|
||||
* @param string $name filter name
|
||||
* @return bool
|
||||
*/
|
||||
public function unloadFilter($type, $name)
|
||||
{
|
||||
$_filter_name = "smarty_{$type}filter_{$name}";
|
||||
if (isset($this->smarty->registered_filters[$type][$_filter_name])) {
|
||||
unset ($this->smarty->registered_filters[$type][$_filter_name]);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* preg_replace callback to convert camelcase getter/setter to underscore property names
|
||||
*
|
||||
@@ -679,7 +698,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
static $_prefixes = array('set' => true, 'get' => true);
|
||||
static $_resolved_property_name = array();
|
||||
static $_resolved_property_source = array();
|
||||
|
||||
|
||||
// method of Smarty object?
|
||||
if (method_exists($this->smarty, $name)) {
|
||||
return call_user_func_array(array($this->smarty, $name), $args);
|
||||
|
Reference in New Issue
Block a user