public function compile($args, $compiler) { $compiler->has_code = true; $_attr = $this->getAttributes($compiler, $args); $saved_data = $this->closeTag($compiler, array('block')); $_name = trim($saved_data[0]['name'], "\"'"); if (isset($compiler->template->block_data[$_name]) && !isset($compiler->template->block_data[$_name]['compiled'])) { $_output = Smarty_Internal_Compile_Block::compileChildBlock($compiler, $_name); } else { if (isset($saved_data[0]['hide']) && !isset($compiler->template->block_data[$_name]['source'])) { $_output = ''; } else { $_output = $compiler->parser->current_buffer->to_smarty_php(); } unset($compiler->template->block_data[$_name]['compiled']); } $compiler->parser->current_buffer = $saved_data[1]; $compiler->nocache = $saved_data[2]; $compiler->smarty->merge_compiled_includes = $saved_data[3]; $compiler->inheritance = false; $compiler->suppressNocacheProcessing = true; return $_output; }
/** * Compiles code for the {/block} tag * * @param array $args array with attributes from parser * @param object $compiler compiler object * @return string compiled code */ public function compile($args, $compiler) { $compiler->has_code = true; // check and get attributes $_attr = $this->getAttributes($compiler, $args); $saved_data = $this->closeTag($compiler, array('block')); $_name = trim($saved_data[0]['name'], "\"'"); if (isset($compiler->template->block_data[$_name]) && !isset($compiler->template->block_data[$_name]['compiled'])) { // restore to status before {block} tag as new subtemplate code of parent {block} is not needed // TODO: Below code was disabled in 3.1.8 because of problems with {include} in nested {block} tags in child templates // combined with append/prepend or $smarty.block.parent // For later versions it should be checked under which conditions it could run for optimisation // //$compiler->merged_templates = $saved_data[4]; //$compiler->smarty->merged_templates_func = $saved_data[5]; //$compiler->template->properties = $saved_data[6]; //$compiler->template->has_nocache_code = $saved_data[7]; $_output = Smarty_Internal_Compile_Block::compileChildBlock($compiler, $_name); } else { if (isset($saved_data[0]['hide']) && !isset($compiler->template->block_data[$_name]['source'])) { $_output = ''; } else { $_output = $compiler->parser->current_buffer->to_smarty_php(); } unset($compiler->template->block_data[$_name]['compiled']); } // reset flags $compiler->parser->current_buffer = $saved_data[1]; $compiler->nocache = $saved_data[2]; $compiler->smarty->merge_compiled_includes = $saved_data[3]; // reset flag for {block} tag $compiler->inheritance = false; // $_output content has already nocache code processed $compiler->suppressNocacheProcessing = true; return $_output; }
/** * Compiles code for the {/block} tag * * @param array $args array with attributes from parser * @param object $compiler compiler object * @return string compiled code */ public function compile($args, $compiler) { $compiler->has_code = true; // check and get attributes $_attr = $this->getAttributes($compiler, $args); $saved_data = $this->closeTag($compiler, array('block')); $_name = trim($saved_data[0]['name'], "\"'"); // reset flag for {block} tag $compiler->inheritance = $saved_data[1]; // check if we process an inheritance child template if ($compiler->inheritance_child) { $name1 = Smarty_Internal_Compile_Block::$nested_block_names[0]; Smarty_Internal_Compile_Block::$block_data[$name1]['source'] .= "{$compiler->smarty->left_delimiter}/private_child_block{$compiler->smarty->right_delimiter}"; $level = count(Smarty_Internal_Compile_Block::$nested_block_names); array_shift(Smarty_Internal_Compile_Block::$nested_block_names); if (!empty(Smarty_Internal_Compile_Block::$nested_block_names)) { $name2 = Smarty_Internal_Compile_Block::$nested_block_names[0]; if (isset($compiler->template->block_data[$name1]) || !$saved_data[0]['hide']) { if (isset(Smarty_Internal_Compile_Block::$block_data[$name1]['child']) || !isset($compiler->template->block_data[$name1])) { Smarty_Internal_Compile_Block::$block_data[$name2]['source'] .= Smarty_Internal_Compile_Block::$block_data[$name1]['source']; } else { if ($compiler->template->block_data[$name1]['mode'] == 'append') { Smarty_Internal_Compile_Block::$block_data[$name2]['source'] .= Smarty_Internal_Compile_Block::$block_data[$name1]['source'] . $compiler->template->block_data[$name1]['source']; } elseif ($compiler->template->block_data[$name1]['mode'] == 'prepend') { Smarty_Internal_Compile_Block::$block_data[$name2]['source'] .= $compiler->template->block_data[$name1]['source'] . Smarty_Internal_Compile_Block::$block_data[$name1]['source']; } else { Smarty_Internal_Compile_Block::$block_data[$name2]['source'] .= $compiler->template->block_data[$name1]['source']; } } } unset(Smarty_Internal_Compile_Block::$block_data[$name1]); $compiler->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBLOCK); } else { if (isset($compiler->template->block_data[$name1]) || !$saved_data[0]['hide']) { if (isset($compiler->template->block_data[$name1]) && !isset(Smarty_Internal_Compile_Block::$block_data[$name1]['child'])) { if (strpos($compiler->template->block_data[$name1]['source'], Smarty_Internal_Compile_Block::parent) !== false) { $compiler->template->block_data[$name1]['source'] = str_replace(Smarty_Internal_Compile_Block::parent, Smarty_Internal_Compile_Block::$block_data[$name1]['source'], $compiler->template->block_data[$name1]['source']); } elseif ($compiler->template->block_data[$name1]['mode'] == 'prepend') { $compiler->template->block_data[$name1]['source'] .= Smarty_Internal_Compile_Block::$block_data[$name1]['source']; } elseif ($compiler->template->block_data[$name1]['mode'] == 'append') { $compiler->template->block_data[$name1]['source'] = Smarty_Internal_Compile_Block::$block_data[$name1]['source'] . $compiler->template->block_data[$name1]['source']; } } else { $compiler->template->block_data[$name1]['source'] = Smarty_Internal_Compile_Block::$block_data[$name1]['source']; } $compiler->template->block_data[$name1]['mode'] = 'replace'; if ($saved_data[0]['append']) { $compiler->template->block_data[$name1]['mode'] = 'append'; } if ($saved_data[0]['prepend']) { $compiler->template->block_data[$name1]['mode'] = 'prepend'; } } unset(Smarty_Internal_Compile_Block::$block_data[$name1]); $compiler->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBODY); } $compiler->has_code = false; return; } if (isset($compiler->template->block_data[$_name]) && !isset($compiler->template->block_data[$_name]['compiled'])) { $_output = Smarty_Internal_Compile_Block::compileChildBlock($compiler, $_name); } else { if ($saved_data[0]['hide'] && !isset($compiler->template->block_data[$_name]['source'])) { $_output = ''; } else { $_output = $compiler->parser->current_buffer->to_smarty_php(); } } unset($compiler->template->block_data[$_name]['compiled']); // reset flags $compiler->parser->current_buffer = $saved_data[2]; if ($compiler->nocache) { $compiler->tag_nocache = true; } $compiler->nocache = $saved_data[3]; // $_output content has already nocache code processed $compiler->suppressNocacheProcessing = true; return $_output; }
/** * Compiles code for the {/block} tag * * @param array $args array with attributes from parser * @param object $compiler compiler object * @return string compiled code */ public function compile($args, $compiler) { $this->compiler = $compiler; $this->smarty = $compiler->smarty; $this->compiler->has_code = true; // check and get attributes $_attr = $this->_get_attributes($args); $saved_data = $this->_close_tag(array('block')); $_name = trim($saved_data[0]['name'], "\"'"); if (isset($compiler->template->block_data[$_name]) && !isset($compiler->template->block_data[$_name]['compiled'])) { $_output = Smarty_Internal_Compile_Block::compileChildBlock($compiler, $_name); } else { $_output = $compiler->parser->current_buffer->to_smarty_php(); unset($compiler->template->block_data[$_name]['compiled']); } // reset flags $compiler->parser->current_buffer = $saved_data[1]; $compiler->nocache = $saved_data[2]; $compiler->smarty->merge_compiled_includes = $saved_data[3]; $compiler->smarty->inheritance = $saved_data[4]; // $_output content has already nocache code processed $compiler->suppressNocacheProcessing = true; return $_output; }
/** * Compiles code for the {/block} tag * * @param array $args array with attributes from parser * @param object $compiler compiler object * @return string compiled code */ public function compile($args, $compiler) { $compiler->has_code = true; // check and get attributes $_attr = $this->getAttributes($compiler, $args); $saved_data = $this->closeTag($compiler, array('block')); $_name = trim($saved_data[0]['name'], "\"'"); if (isset($compiler->template->block_data[$_name]) && !isset($compiler->template->block_data[$_name]['compiled'])) { // restore to status before {block} tag as new subtemplate code of parent {block} is not needed $compiler->merged_templates = $saved_data[4]; $compiler->smarty->merged_templates_func = $saved_data[5]; $compiler->template->properties = $saved_data[6]; $compiler->template->has_nocache_code = $saved_data[7]; $_output = Smarty_Internal_Compile_Block::compileChildBlock($compiler, $_name); } else { if (isset($saved_data[0]['hide']) && !isset($compiler->template->block_data[$_name]['source'])) { $_output = ''; } else { $_output = $compiler->parser->current_buffer->to_smarty_php(); } unset($compiler->template->block_data[$_name]['compiled']); } // reset flags $compiler->parser->current_buffer = $saved_data[1]; $compiler->nocache = $saved_data[2]; $compiler->smarty->merge_compiled_includes = $saved_data[3]; // reset flag for {block} tag $compiler->inheritance = false; // $_output content has already nocache code processed $compiler->suppressNocacheProcessing = true; return $_output; }
function yy_r50() { $j = strrpos($this->yystack[$this->yyidx + 0]->minor, '.'); if ($this->yystack[$this->yyidx + 0]->minor[$j + 1] == 'c') { // {$smarty.block.child} $this->_retvalue = Smarty_Internal_Compile_Block::compileChildBlock($this->compiler); } else { // {$smarty.block.parent} $this->_retvalue = Smarty_Internal_Compile_Block::compileParentBlock($this->compiler); } }