From b7fb490cb1e7f4d0fa72067ec2a4a206e396336b Mon Sep 17 00:00:00 2001 From: uwetews Date: Sat, 24 Oct 2015 05:16:54 +0200 Subject: [PATCH] - improve compiled code --- .../smarty_internal_compile_include_php.php | 4 ++-- ...internal_compile_private_object_block_function.php | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libs/sysplugins/smarty_internal_compile_include_php.php b/libs/sysplugins/smarty_internal_compile_include_php.php index 99fbc588..e7e62997 100644 --- a/libs/sysplugins/smarty_internal_compile_include_php.php +++ b/libs/sysplugins/smarty_internal_compile_include_php.php @@ -43,7 +43,7 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase /** * Compiles code for the {include_php} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string @@ -103,7 +103,7 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase } if (isset($_assign)) { - return "assign({$_assign},ob_get_contents()); ob_end_clean();?>"; + return "assign({$_assign},ob_get_clean());\n?>"; } else { return "\n"; } diff --git a/libs/sysplugins/smarty_internal_compile_private_object_block_function.php b/libs/sysplugins/smarty_internal_compile_private_object_block_function.php index c6cf488d..d2bc5d60 100644 --- a/libs/sysplugins/smarty_internal_compile_private_object_block_function.php +++ b/libs/sysplugins/smarty_internal_compile_private_object_block_function.php @@ -60,7 +60,8 @@ class Smarty_Internal_Compile_Private_Object_Block_Function extends Smarty_Inter // maybe nocache because of nocache variables or nocache plugin $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; // compile code - $output = "smarty->_cache['tag_stack'][] = array('{$tag}->{$method}', {$_params}); \$_block_repeat=true; echo \$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>"; + $output = + "smarty->_cache['tag_stack'][] = array('{$tag}->{$method}', {$_params}); \$_block_repeat=true; echo \$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>"; } else { $base_tag = substr($tag, 0, - 5); // must endblock be nocache? @@ -76,11 +77,11 @@ class Smarty_Internal_Compile_Private_Object_Block_Function extends Smarty_Inter $mod_pre = $mod_post = ''; } else { $mod_pre = ' ob_start(); '; - $mod_post = 'echo ' . - $compiler->compileTag('private_modifier', array(), array('modifierlist' => $parameter['modifier_list'], - 'value' => 'ob_get_clean()')) . ';'; + $mod_post = 'echo ' . $compiler->compileTag('private_modifier', array(), + array('modifierlist' => $parameter['modifier_list'], + 'value' => 'ob_get_clean()')) . ';'; } - $output = "smarty->registered_objects['{$base_tag}'][0]->{$method}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); " . $mod_post . " } array_pop(\$_smarty_tpl->smarty->_cache['tag_stack']);?>"; }