- improvement replaced some calls of preg_replace with str_replace (Issue 73)

This commit is contained in:
uwe.tews@googlemail.com
2012-02-06 20:53:57 +00:00
parent e91ee4c5ec
commit 53df807220
3 changed files with 3 additions and 2 deletions

View File

@@ -3,6 +3,7 @@
- improvement stream_resolve_include_path() added to Smarty_Internal_Get_Include_Path (Forum Topic 20980) - improvement stream_resolve_include_path() added to Smarty_Internal_Get_Include_Path (Forum Topic 20980)
- bugfix fetch('extends:foo.tpl') always yielded $source->exists == true (Forum Topic 20980) - bugfix fetch('extends:foo.tpl') always yielded $source->exists == true (Forum Topic 20980)
- added modifier unescape:"url", fix (Forum Topic 20980) - added modifier unescape:"url", fix (Forum Topic 20980)
- improvement replaced some calls of preg_replace with str_replace (Issue 73)
30.01.2012 30.01.2012
- bugfix Smarty_Security internal $_resource_dir cache wasn't properly propagated - bugfix Smarty_Security internal $_resource_dir cache wasn't properly propagated

View File

@@ -155,7 +155,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
$compiled_code = preg_replace("/(<\?php \/\*%%SmartyHeaderCode:{$tpl->properties['nocache_hash']}%%\*\/(.+?)\/\*\/%%SmartyHeaderCode%%\*\/\?>\n)/s", '', $compiled_code); $compiled_code = preg_replace("/(<\?php \/\*%%SmartyHeaderCode:{$tpl->properties['nocache_hash']}%%\*\/(.+?)\/\*\/%%SmartyHeaderCode%%\*\/\?>\n)/s", '', $compiled_code);
if ($tpl->has_nocache_code) { if ($tpl->has_nocache_code) {
// replace nocache_hash // replace nocache_hash
$compiled_code = preg_replace("/{$tpl->properties['nocache_hash']}/", $compiler->template->properties['nocache_hash'], $compiled_code); $compiled_code = str_replace("{$tpl->properties['nocache_hash']}", $compiler->template->properties['nocache_hash'], $compiled_code);
$compiler->template->has_nocache_code = true; $compiler->template->has_nocache_code = true;
} }
$compiler->merged_templates[$tpl->properties['unifunc']] = $compiled_code; $compiler->merged_templates[$tpl->properties['unifunc']] = $compiled_code;

View File

@@ -264,7 +264,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
// var_dump('renderTemplate', $_template->has_nocache_code, $_template->template_resource, $_template->properties['nocache_hash'], $_template->parent->properties['nocache_hash'], $_output); // var_dump('renderTemplate', $_template->has_nocache_code, $_template->template_resource, $_template->properties['nocache_hash'], $_template->parent->properties['nocache_hash'], $_output);
if (!empty($_template->properties['nocache_hash']) && !empty($_template->parent->properties['nocache_hash'])) { if (!empty($_template->properties['nocache_hash']) && !empty($_template->parent->properties['nocache_hash'])) {
// replace nocache_hash // replace nocache_hash
$_output = preg_replace("/{$_template->properties['nocache_hash']}/", $_template->parent->properties['nocache_hash'], $_output); $_output = str_replace("{$_template->properties['nocache_hash']}", $_template->parent->properties['nocache_hash'], $_output);
$_template->parent->has_nocache_code = $_template->parent->has_nocache_code || $_template->has_nocache_code; $_template->parent->has_nocache_code = $_template->parent->has_nocache_code || $_template->has_nocache_code;
} }
} }