diff options
author | Mario Vavti <mario@mariovavti.com> | 2015-12-06 20:12:05 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2015-12-06 20:12:05 +0100 |
commit | c23ce16cafb826c8bb4fe7aaf2a5525b29052b23 (patch) | |
tree | 2230b03cfa6b74f3898b57bee647bc6276fd5a53 /library/Smarty/libs/sysplugins/smarty_internal_compile_block.php | |
parent | 78a70fed2f7cf9a53e6e4fab516b00cece12fbf0 (diff) | |
download | volse-hubzilla-c23ce16cafb826c8bb4fe7aaf2a5525b29052b23.tar.gz volse-hubzilla-c23ce16cafb826c8bb4fe7aaf2a5525b29052b23.tar.bz2 volse-hubzilla-c23ce16cafb826c8bb4fe7aaf2a5525b29052b23.zip |
update smarty library - seems to bring some performance improvement
Diffstat (limited to 'library/Smarty/libs/sysplugins/smarty_internal_compile_block.php')
-rw-r--r-- | library/Smarty/libs/sysplugins/smarty_internal_compile_block.php | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_compile_block.php b/library/Smarty/libs/sysplugins/smarty_internal_compile_block.php index 8c2fb975f..93c90a91e 100644 --- a/library/Smarty/libs/sysplugins/smarty_internal_compile_block.php +++ b/library/Smarty/libs/sysplugins/smarty_internal_compile_block.php @@ -113,7 +113,7 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase $compiler->inheritance = true; $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; - $compiler->parser->current_buffer = new _smarty_template_buffer($compiler->parser); + $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template($compiler->parser); $compiler->has_code = false; return true; @@ -143,7 +143,7 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase // if called by {$smarty.block.child} we must search the name of enclosing {block} if ($_name == null) { $stack_count = count($compiler->_tag_stack); - while (--$stack_count >= 0) { + while (-- $stack_count >= 0) { if ($compiler->_tag_stack[$stack_count][0] == 'block') { $_name = trim($compiler->_tag_stack[$stack_count][1][0]['name'], "\"'"); break; @@ -173,20 +173,18 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase $_tpl->compiler->suppressHeader = true; $_tpl->compiler->suppressFilter = true; $_tpl->compiler->suppressTemplatePropertyHeader = true; - $_tpl->compiler->suppressMergedTemplates = true; $nocache = $compiler->nocache || $compiler->tag_nocache; if (strpos($compiler->template->block_data[$_name]['source'], self::parent) !== false) { - $_output = str_replace(self::parent, $compiler->parser->current_buffer->to_smarty_php(), $_tpl->compiler->compileTemplate($_tpl, $nocache)); + $_output = str_replace(self::parent, $compiler->parser->current_buffer->to_smarty_php(), $_tpl->compiler->compileTemplate($_tpl, $nocache, $compiler->parent_compiler)); } elseif ($compiler->template->block_data[$_name]['mode'] == 'prepend') { - $_output = $_tpl->compiler->compileTemplate($_tpl, $nocache) . $compiler->parser->current_buffer->to_smarty_php(); + $_output = $_tpl->compiler->compileTemplate($_tpl, $nocache, $compiler->parent_compiler) . $compiler->parser->current_buffer->to_smarty_php(); } elseif ($compiler->template->block_data[$_name]['mode'] == 'append') { - $_output = $compiler->parser->current_buffer->to_smarty_php() . $_tpl->compiler->compileTemplate($_tpl, $nocache); + $_output = $compiler->parser->current_buffer->to_smarty_php() . $_tpl->compiler->compileTemplate($_tpl, $nocache, $compiler->parent_compiler); } elseif (!empty($compiler->template->block_data[$_name])) { - $_output = $_tpl->compiler->compileTemplate($_tpl, $nocache); + $_output = $_tpl->compiler->compileTemplate($_tpl, $nocache, $compiler->parent_compiler); } $compiler->template->properties['file_dependency'] = array_merge($compiler->template->properties['file_dependency'], $_tpl->properties['file_dependency']); - $compiler->template->properties['function'] = array_merge($compiler->template->properties['function'], $_tpl->properties['function']); - $compiler->merged_templates = array_merge($compiler->merged_templates, $_tpl->compiler->merged_templates); + $compiler->template->properties['tpl_function'] = array_merge($compiler->template->properties['tpl_function'], $_tpl->properties['tpl_function']); $compiler->template->variable_filters = $_tpl->variable_filters; if ($_tpl->has_nocache_code) { $compiler->template->has_nocache_code = true; @@ -221,7 +219,7 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase // if called by {$smarty.block.parent} we must search the name of enclosing {block} if ($_name == null) { $stack_count = count($compiler->_tag_stack); - while (--$stack_count >= 0) { + while (-- $stack_count >= 0) { if ($compiler->_tag_stack[$stack_count][0] == 'block') { $_name = trim($compiler->_tag_stack[$stack_count][1][0]['name'], "\"'"); break; @@ -245,7 +243,6 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase * * @param $compiler * @param string $source source text - * */ static function blockSource($compiler, $source) { @@ -337,7 +334,9 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase $_output = $compiler->parser->current_buffer->to_smarty_php(); } } - unset($compiler->template->block_data[$_name]['compiled']); + if (isset($compiler->template->block_data[$_name]['compiled'])) { + unset($compiler->template->block_data[$_name]['compiled']); + } // reset flags $compiler->parser->current_buffer = $saved_data[2]; if ($compiler->nocache) { |