mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
- bugfix problems when {function}{/function} defined a template function in a cached subtemplate and it was called {call} from a not cached subtemplate {forum topic 25468}
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
===== 3.1.22-dev ===== (xx.xx.2015)
|
===== 3.1.22-dev ===== (xx.xx.2015)
|
||||||
|
23.03.2015
|
||||||
|
- bugfix problems when {function}{/function} defined a template function in a cached subtemplate and it was called {call}
|
||||||
|
from a not cached subtemplate {forum topic 25468}
|
||||||
|
|
||||||
20.03.2015
|
20.03.2015
|
||||||
- bugfix make sure that function properties get saved only in compiled files containing the fuction definition {forum topic 25452}
|
- bugfix make sure that function properties get saved only in compiled files containing the fuction definition {forum topic 25452}
|
||||||
- bugfix correct update of global variable values on exit of template functions. (reported under Smarty Developers)
|
- bugfix correct update of global variable values on exit of template functions. (reported under Smarty Developers)
|
||||||
|
@@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* smarty version
|
* smarty version
|
||||||
*/
|
*/
|
||||||
const SMARTY_VERSION = '3.1.22-dev/16';
|
const SMARTY_VERSION = '3.1.22-dev/17';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* define variable scopes
|
* define variable scopes
|
||||||
|
@@ -564,14 +564,12 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
$function ($_smarty_tpl, $params);
|
$function ($_smarty_tpl, $params);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($_smarty_tpl->caching) {
|
|
||||||
// try to load template function dynamically
|
// try to load template function dynamically
|
||||||
if (Smarty_Internal_Function_Call_Handler::call($name, $_smarty_tpl, $function, $params, $nocache)) {
|
if (Smarty_Internal_Function_Call_Handler::call($name, $_smarty_tpl, $function, $params, $nocache)) {
|
||||||
$function ($_smarty_tpl, $params);
|
$function ($_smarty_tpl, $params);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
throw new SmartyException("Unable to find template function '{$name}'");
|
throw new SmartyException("Unable to find template function '{$name}'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -304,6 +304,19 @@ class Smarty_Template_Cached
|
|||||||
$_template->properties['cache_lifetime'] = $_template->cache_lifetime;
|
$_template->properties['cache_lifetime'] = $_template->cache_lifetime;
|
||||||
$_template->properties['unifunc'] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
|
$_template->properties['unifunc'] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
|
||||||
$content = Smarty_Internal_Extension_CodeFrame::create($_template, $content, true);
|
$content = Smarty_Internal_Extension_CodeFrame::create($_template, $content, true);
|
||||||
|
if (!empty($_template->properties['tpl_function'])) {
|
||||||
|
foreach ($_template->properties['tpl_function'] as $funcParam) {
|
||||||
|
if (is_file($funcParam['compiled_filepath'])) {
|
||||||
|
// read compiled file
|
||||||
|
$code = file_get_contents($funcParam['compiled_filepath']);
|
||||||
|
// grab template function
|
||||||
|
if (preg_match("/\/\* {$funcParam['call_name']} \*\/([\S\s]*?)\/\*\/ {$funcParam['call_name']} \*\//", $code, $match)) {
|
||||||
|
unset($code);
|
||||||
|
$content .= "<?php " . $match[0] . "?>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return $this->write($_template, $content);
|
return $this->write($_template, $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user