- new feature {parent} = {$smarty.block.parent} {child} = {$smarty.block.child}

This commit is contained in:
Uwe Tews
2018-03-26 22:35:31 +02:00
parent c81948d602
commit 0dbace8321
14 changed files with 2012 additions and 1707 deletions

View File

@@ -1,4 +1,11 @@
3.1.31-dev 3.1.3"
New tags for inheritance parent and chilD
{parent} == {$smarty.block.parent}
{child} == {$smarty.block.child}
Both tags support the assign attribute like
{child assign=foo}
3.1.31
New tags for inheritance parent and child New tags for inheritance parent and child
{block_parent} == {$smarty.block.parent} {block_parent} == {$smarty.block.parent}
{block_child} == {$smarty.block.child} {block_child} == {$smarty.block.child}

View File

@@ -2,7 +2,12 @@
This file contains a brief description of new features which have been added to Smarty 3.1 This file contains a brief description of new features which have been added to Smarty 3.1
Smarty 3.1.32 Smarty 3.1.32 New tags for inheritance parent and child
=========================================
{parent} == {$smarty.block.parent}
{child} == {$smarty.block.child}
Both tags support the assign attribute like
{child assign=foo}
Deprecate functions Smarty::muteExpectedErrors() and Smarty::unmuteExpectedErrors() Deprecate functions Smarty::muteExpectedErrors() and Smarty::unmuteExpectedErrors()
=================================================================================== ===================================================================================

View File

@@ -1,4 +1,7 @@
===== 3.1.32 - dev === ===== 3.1.32 - dev ===
26.03.2018
- new feature {parent} = {$smarty.block.parent} {child} = {$smarty.block.child}
23.03.2018 23.03.2018
- bugfix preg_replace could fail on large content resulting in a blank page https://github.com/smarty-php/smarty/issues/417 - bugfix preg_replace could fail on large content resulting in a blank page https://github.com/smarty-php/smarty/issues/417

View File

@@ -112,7 +112,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/** /**
* smarty version * smarty version
*/ */
const SMARTY_VERSION = '3.1.32-dev-43'; const SMARTY_VERSION = '3.1.32-dev-44';
/** /**
* define variable scopes * define variable scopes
*/ */

View File

@@ -22,7 +22,6 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher
* @see Smarty_Internal_CompileBase * @see Smarty_Internal_CompileBase
*/ */
public $required_attributes = array('name'); public $required_attributes = array('name');
/** /**
* Attribute definition: Overwrites base class. * Attribute definition: Overwrites base class.
* *
@@ -30,7 +29,6 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher
* @see Smarty_Internal_CompileBase * @see Smarty_Internal_CompileBase
*/ */
public $shorttag_order = array('name'); public $shorttag_order = array('name');
/** /**
* Attribute definition: Overwrites base class. * Attribute definition: Overwrites base class.
* *
@@ -38,7 +36,6 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher
* @see Smarty_Internal_CompileBase * @see Smarty_Internal_CompileBase
*/ */
public $option_flags = array('hide', 'nocache'); public $option_flags = array('hide', 'nocache');
/** /**
* Attribute definition: Overwrites base class. * Attribute definition: Overwrites base class.
* *
@@ -47,22 +44,15 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher
*/ */
public $optional_attributes = array('assign'); public $optional_attributes = array('assign');
/**
* Saved compiler object
*
* @var Smarty_Internal_TemplateCompilerBase
*/
public $compiler = null;
/** /**
* Compiles code for the {block} tag * Compiles code for the {block} tag
* *
* @param array $args array with attributes from parser * @param array $args array with attributes from parser
* @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
* @param array $parameter array with compilation parameter
* *
* @return string compiled code
*/ */
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
{ {
if (!isset($compiler->_cache[ 'blockNesting' ])) { if (!isset($compiler->_cache[ 'blockNesting' ])) {
$compiler->_cache[ 'blockNesting' ] = 0; $compiler->_cache[ 'blockNesting' ] = 0;
@@ -76,7 +66,7 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher
} }
// check and get attributes // check and get attributes
$_attr = $this->getAttributes($compiler, $args); $_attr = $this->getAttributes($compiler, $args);
$compiler->_cache['blockNesting']++; ++$compiler->_cache[ 'blockNesting' ];
$_className = 'Block_' . preg_replace('![^\w]+!', '_', uniqid(rand(), true)); $_className = 'Block_' . preg_replace('![^\w]+!', '_', uniqid(rand(), true));
$compiler->_cache[ 'blockName' ][ $compiler->_cache[ 'blockNesting' ] ] = $_attr[ 'name' ]; $compiler->_cache[ 'blockName' ][ $compiler->_cache[ 'blockNesting' ] ] = $_attr[ 'name' ];
$compiler->_cache[ 'blockClass' ][ $compiler->_cache[ 'blockNesting' ] ] = $_className; $compiler->_cache[ 'blockClass' ][ $compiler->_cache[ 'blockNesting' ] ] = $_className;
@@ -87,59 +77,12 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher
array($_attr, $compiler->nocache, $compiler->parser->current_buffer, array($_attr, $compiler->nocache, $compiler->parser->current_buffer,
$compiler->template->compiled->has_nocache_code, $compiler->template->compiled->has_nocache_code,
$compiler->template->caching)); $compiler->template->caching));
// must whole block be nocache ?
if ($compiler->tag_nocache) {
$i = 0;
}
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache; $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
// $compiler->suppressNocacheProcessing = true;
if ($_attr['nocache'] === true) {
//$compiler->trigger_template_error('nocache option not allowed', $compiler->parser->lex->taglineno);
}
$compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
$compiler->template->compiled->has_nocache_code = false; $compiler->template->compiled->has_nocache_code = false;
$compiler->suppressNocacheProcessing = true; $compiler->suppressNocacheProcessing = true;
} }
/**
* Compiles code for the {$smarty.block.parent} or {$smarty.block.child}tag
*
* @param array $args array with attributes from parser
* @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
* @param array $parameter array with compilation parameter
*
* @return string compiled code
* @throws \SmartyCompilerException
*/
public function compileSpecialVariable($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
{
$name = isset($parameter[1]) ? $compiler->getId($parameter[1]) : false;
if (!$name) {
$compiler->trigger_template_error("invalid '\$smarty.block' expected '\$smarty.block.child' or '\$smarty.block.parent'",
null,
true);
} }
if (!isset($compiler->_cache['blockNesting'])) {
$compiler->trigger_template_error(" '\$smarty.block.{$name}' used outside {block} tags ",
$compiler->parser->lex->taglineno);
}
$compiler->suppressNocacheProcessing = true;
switch ($name) {
case 'child':
$compiler->_cache['blockParams'][ $compiler->_cache['blockNesting'] ]['callsChild'] = 'true';
return '$_smarty_tpl->inheritance->callChild($_smarty_tpl, $this, true)';
break;
case 'parent':
return '$_smarty_tpl->inheritance->callParent($_smarty_tpl, $this, null, true)';
break;
default:
$compiler->trigger_template_error("invalid '\$smarty.block.{$name}' expected '\$smarty.block.child' or '\$smarty.block.parent'",
null,
true);
}
}
}
/** /**
* Smarty Internal Plugin Compile BlockClose Class * Smarty Internal Plugin Compile BlockClose Class
* *
@@ -151,11 +94,11 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_
* *
* @param array $args array with attributes from parser * @param array $args array with attributes from parser
* @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
* @param array $parameter array with compilation parameter
* *
* @return string compiled code * @return bool true
* @internal param array $parameter array with compilation parameter
*/ */
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
{ {
list($_attr, $_nocache, $_buffer, $_has_nocache_code, $_caching) = $this->closeTag($compiler, array('block')); list($_attr, $_nocache, $_buffer, $_has_nocache_code, $_caching) = $this->closeTag($compiler, array('block'));
// init block parameter // init block parameter
@@ -206,7 +149,7 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_
$compiler->parser->current_buffer->append_subtree($compiler->parser, $compiler->parser->current_buffer->append_subtree($compiler->parser,
new Smarty_Internal_ParseTree_Tag($compiler->parser, new Smarty_Internal_ParseTree_Tag($compiler->parser,
$output)); $output));
$compiler->blockOrFunctionCode .= $f = $compiler->parser->current_buffer->to_smarty_php($compiler->parser); $compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser);
$compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
// nocache plugins must be copied // nocache plugins must be copied
if (!empty($compiler->template->compiled->required_plugins[ 'nocache' ])) { if (!empty($compiler->template->compiled->required_plugins[ 'nocache' ])) {
@@ -230,10 +173,11 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_
$output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name, \$this->tplIndex);\n"; $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name, \$this->tplIndex);\n";
} }
$output .= "?>\n"; $output .= "?>\n";
$compiler->_cache['blockNesting']--; --$compiler->_cache[ 'blockNesting' ];
if ($compiler->_cache[ 'blockNesting' ] === 0) { if ($compiler->_cache[ 'blockNesting' ] === 0) {
unset($compiler->_cache[ 'blockNesting' ]); unset($compiler->_cache[ 'blockNesting' ]);
} }
$compiler->has_code = true;
$compiler->suppressNocacheProcessing = true; $compiler->suppressNocacheProcessing = true;
return $output; return $output;
} }

View File

@@ -0,0 +1,24 @@
<?php
/*
* This file is part of Smarty.
*
* (c) 2015 Uwe Tews
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Smarty Internal Plugin Compile Block Child Class
*
* @author Uwe Tews <uwe.tews@googlemail.com>
*/
class Smarty_Internal_Compile_Block_Child extends Smarty_Internal_Compile_Child
{
/**
* Tag name
*
* @var string
*/
public $tag = 'block_child';
}

View File

@@ -0,0 +1,31 @@
<?php
/*
* This file is part of Smarty.
*
* (c) 2015 Uwe Tews
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Smarty Internal Plugin Compile Block Parent Class
*
* @author Uwe Tews <uwe.tews@googlemail.com>
*/
class Smarty_Internal_Compile_Block_Parent extends Smarty_Internal_Compile_Child
{
/**
* Tag name
*
* @var string
*/
public $tag = 'block_parent';
/**
* Block type
*
* @var string
*/
public $blockType = 'Parent';
}

View File

@@ -0,0 +1,77 @@
<?php
/*
* This file is part of Smarty.
*
* (c) 2015 Uwe Tews
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Smarty Internal Plugin Compile Child Class
*
* @author Uwe Tews <uwe.tews@googlemail.com>
*/
class Smarty_Internal_Compile_Child extends Smarty_Internal_CompileBase
{
/**
* Attribute definition: Overwrites base class.
*
* @var array
* @see Smarty_Internal_CompileBase
*/
public $optional_attributes = array('assign');
/**
* Tag name
*
* @var string
*/
public $tag = 'child';
/**
* Block type
*
* @var string
*/
public $blockType = 'Child';
/**
* Compiles code for the {child} tag
*
* @param array $args array with attributes from parser
* @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
* @param array $parameter array with compilation parameter
*
* @return string compiled code
* @throws \SmartyCompilerException
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
{
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
$tag = isset($parameter[0]) ? "'{$parameter[0]}'" : "'{{$this->tag}}'";
if (!isset($compiler->_cache[ 'blockNesting' ])) {
$compiler->trigger_template_error("{$tag} used outside {block} tags ",
$compiler->parser->lex->taglineno);
}
$compiler->has_code = true;
$compiler->suppressNocacheProcessing = true;
if ($this->blockType === 'Child') {
$compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ][ 'callsChild' ] = 'true';
}
$_assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : null;
$output = "<?php \n";
if (isset($_assign)) {
$output .= "ob_start();\n";
}
$output .= '$_smarty_tpl->inheritance->call' . $this->blockType . '($_smarty_tpl, $this' .
($this->blockType === 'Child' ? '' : ", {$tag}"). ");\n";
if (isset($_assign)) {
$output .= "\$_smarty_tpl->assign({$_assign}, ob_get_clean());\n";
}
$output .="?>\n";
return $output;
}
}

View File

@@ -0,0 +1,32 @@
<?php
/*
* This file is part of Smarty.
*
* (c) 2015 Uwe Tews
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Smarty Internal Plugin Compile Parent Class
*
* @author Uwe Tews <uwe.tews@googlemail.com>
*/
class Smarty_Internal_Compile_Parent extends Smarty_Internal_Compile_Child
{
/**
* Tag name
*
* @var string
*/
public $tag = 'parent';
/**
* Block type
*
* @var string
*/
public $blockType = 'Parent';
}

View File

@@ -51,9 +51,6 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C
return ''; return '';
case 'now': case 'now':
return 'time()'; return 'time()';
case 'block':
$tag = $compiler->getTagCompiler('block');
return $tag->compileSpecialVariable(array(), $compiler, $_index);
case 'cookies': case 'cookies':
if (isset($compiler->smarty->security_policy) && if (isset($compiler->smarty->security_policy) &&
!$compiler->smarty->security_policy->allow_super_globals !$compiler->smarty->security_policy->allow_super_globals
@@ -114,7 +111,7 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C
case 'rdelim': case 'rdelim':
return "\$_smarty_tpl->smarty->right_delimiter"; return "\$_smarty_tpl->smarty->right_delimiter";
default: default:
$compiler->trigger_template_error('$smarty.' . trim($_index[ 0 ], '\'') . ' is not defined'); $compiler->trigger_template_error('$smarty.' . trim($_index[ 0 ], "'") . ' is not defined');
break; break;
} }
if (isset($_index[ 1 ])) { if (isset($_index[ 1 ])) {

View File

@@ -46,7 +46,6 @@ class Smarty_Internal_Runtime_Inheritance
/** /**
* Array of template source objects * Array of template source objects
* - key template index
* *
* @var Smarty_Template_Source[] * @var Smarty_Template_Source[]
*/ */
@@ -75,7 +74,7 @@ class Smarty_Internal_Runtime_Inheritance
$tpl->inheritance->init($tpl, $initChild, $blockNames); $tpl->inheritance->init($tpl, $initChild, $blockNames);
return; return;
} }
$this->tplIndex++; ++$this->tplIndex;
$this->sources[ $this->tplIndex ] = $tpl->source; $this->sources[ $this->tplIndex ] = $tpl->source;
// start of child sub template(s) // start of child sub template(s)
@@ -85,7 +84,7 @@ class Smarty_Internal_Runtime_Inheritance
//grab any output of child templates //grab any output of child templates
ob_start(); ob_start();
} }
$this->inheritanceLevel++; ++$this->inheritanceLevel;
// $tpl->startRenderCallbacks[ 'inheritance' ] = array($this, 'subTemplateStart'); // $tpl->startRenderCallbacks[ 'inheritance' ] = array($this, 'subTemplateStart');
// $tpl->endRenderCallbacks[ 'inheritance' ] = array($this, 'subTemplateEnd'); // $tpl->endRenderCallbacks[ 'inheritance' ] = array($this, 'subTemplateEnd');
} }
@@ -109,7 +108,7 @@ class Smarty_Internal_Runtime_Inheritance
*/ */
public function endChild(Smarty_Internal_Template $tpl, $template = null, $uid = null, $func = null) public function endChild(Smarty_Internal_Template $tpl, $template = null, $uid = null, $func = null)
{ {
$this->inheritanceLevel--; --$this->inheritanceLevel;
if (!$this->inheritanceLevel) { if (!$this->inheritanceLevel) {
ob_end_clean(); ob_end_clean();
$this->state = 2; $this->state = 2;
@@ -167,8 +166,7 @@ class Smarty_Internal_Runtime_Inheritance
* *
* @throws \SmartyException * @throws \SmartyException
*/ */
public function process(Smarty_Internal_Template $tpl, public function process(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block,
Smarty_Internal_Block $block,
Smarty_Internal_Block $parent = null) Smarty_Internal_Block $parent = null)
{ {
if ($block->hide && !isset($block->child)) { if ($block->hide && !isset($block->child)) {
@@ -179,7 +177,7 @@ class Smarty_Internal_Runtime_Inheritance
} }
$block->parent = $parent; $block->parent = $parent;
if ($block->append && !$block->prepend && isset($parent)) { if ($block->append && !$block->prepend && isset($parent)) {
$this->callParent($tpl, $block); $this->callParent($tpl, $block, '\'{block append}\'');
} }
if ($block->callsChild || !isset($block->child) || ($block->child->hide && !isset($block->child->child))) { if ($block->callsChild || !isset($block->child) || ($block->child->hide && !isset($block->child->child))) {
$this->callBlock($block, $tpl); $this->callBlock($block, $tpl);
@@ -187,7 +185,7 @@ class Smarty_Internal_Runtime_Inheritance
$this->process($tpl, $block->child, $block); $this->process($tpl, $block->child, $block);
} }
if ($block->prepend && isset($parent)) { if ($block->prepend && isset($parent)) {
$this->callParent($tpl, $block); $this->callParent($tpl, $block, '{block prepend}');
if ($block->append) { if ($block->append) {
if ($block->callsChild || !isset($block->child) || if ($block->callsChild || !isset($block->child) ||
($block->child->hide && !isset($block->child->child)) ($block->child->hide && !isset($block->child->child))
@@ -202,70 +200,42 @@ class Smarty_Internal_Runtime_Inheritance
} }
/** /**
* Render child on $smarty.block.child * Render child on \$smarty.block.child
* *
* @param \Smarty_Internal_Template $tpl * @param \Smarty_Internal_Template $tpl
* @param \Smarty_Internal_Block $block * @param \Smarty_Internal_Block $block
* @param boolean $returnContent flag if content shall be returned
* *
* @return null|string null or block content dependent on $returnContent * @return null|string block content
* @throws \SmartyException * @throws \SmartyException
*/ */
public function callChild(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block, $returnContent = false) public function callChild(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block)
{ {
if ($returnContent) {
ob_start();
}
if (isset($block->child)) { if (isset($block->child)) {
$this->process($tpl, $block->child, $block); $this->process($tpl, $block->child, $block);
} }
if ($returnContent) {
return ob_get_clean();
}
return;
} }
/** /**
* Render parent block on $smarty.block.parent or {block append/prepend} * Render parent block on \$smarty.block.parent or {block append/prepend}
* *
* @param \Smarty_Internal_Template $tpl * @param \Smarty_Internal_Template $tpl
* @param \Smarty_Internal_Block $block * @param \Smarty_Internal_Block $block
* @param null|string $name * @param string $tag
* @param boolean $returnContent flag if content shall be returned
* *
* @return null|string null or block content dependent on $returnContent * @return null|string block content
* @throws \SmartyException * @throws \SmartyException
*/ */
public function callParent(Smarty_Internal_Template $tpl, public function callParent(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block, $tag)
Smarty_Internal_Block $block,
$name = null,
$returnContent = false)
{ {
if ($returnContent) { if (isset($block->parent)) {
ob_start();
}
if (isset($name)) {
$block = $block->parent;
while (isset($block)) {
if (isset($block->subBlocks[ $name ])) {
} else {
$block = $block->parent;
}
}
return;
} else if (isset($block->parent)) {
$this->callBlock($block->parent, $tpl); $this->callBlock($block->parent, $tpl);
} else { } else {
throw new SmartyException("inheritance: illegal '\$smarty.block.parent' or {block append/prepend} used in parent template '{$tpl->inheritance->sources[$block->tplIndex]->filepath}' block '{$block->name}'"); throw new SmartyException("inheritance: illegal '{$tag}' used in child template '{$tpl->inheritance->sources[$block->tplIndex]->filepath}' block '{$block->name}'");
} }
if ($returnContent) {
return ob_get_clean();
}
return;
} }
/** /**
* redender block * render block
* *
* @param \Smarty_Internal_Block $block * @param \Smarty_Internal_Block $block
* @param \Smarty_Internal_Template $tpl * @param \Smarty_Internal_Template $tpl

View File

@@ -424,7 +424,7 @@ class Smarty_Internal_Templatelexer
{ {
if (!isset($this->yy_global_pattern2)) { if (!isset($this->yy_global_pattern2)) {
$this->yy_global_pattern2 = $this->yy_global_pattern2 =
$this->replace("/\G((SMARTYldel)SMARTYal(if|elseif|else if|while)\\s+)|\G((SMARTYldel)SMARTYalfor\\s+)|\G((SMARTYldel)SMARTYalforeach(?![^\s]))|\G((SMARTYldel)SMARTYalsetfilter\\s+)|\G((SMARTYldel)SMARTYalmake_nocache\\s+)|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/](?:(?!block)[0-9]*[a-zA-Z_]\\w*)\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[$][0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal)/isS"); $this->replace("/\G((SMARTYldel)SMARTYal(if|elseif|else if|while)\\s+)|\G((SMARTYldel)SMARTYalfor\\s+)|\G((SMARTYldel)SMARTYalforeach(?![^\s]))|\G((SMARTYldel)SMARTYalsetfilter\\s+)|\G((SMARTYldel)SMARTYalmake_nocache\\s+)|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[$]smarty\\.block\\.(child|parent)\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/][0-9]*[a-zA-Z_]\\w*\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[$][0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal)/isS");
} }
if (!isset($this->dataLength)) { if (!isset($this->dataLength)) {
$this->dataLength = strlen($this->data); $this->dataLength = strlen($this->data);
@@ -518,13 +518,20 @@ class Smarty_Internal_Templatelexer
} }
function yy_r2_15() function yy_r2_15()
{
$this->yypopstate();
$this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
$this->taglineno = $this->line;
}
function yy_r2_18()
{ {
$this->yypopstate(); $this->yypopstate();
$this->token = Smarty_Internal_Templateparser::TP_CLOSETAG; $this->token = Smarty_Internal_Templateparser::TP_CLOSETAG;
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
function yy_r2_17() function yy_r2_20()
{ {
if ($this->_yy_stack[ count($this->_yy_stack) - 1 ] === self::TEXT) { if ($this->_yy_stack[ count($this->_yy_stack) - 1 ] === self::TEXT) {
$this->yypopstate(); $this->yypopstate();
@@ -538,14 +545,14 @@ class Smarty_Internal_Templatelexer
} }
} // end function } // end function
function yy_r2_20() function yy_r2_23()
{ {
$this->token = Smarty_Internal_Templateparser::TP_LDELSLASH; $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
$this->yybegin(self::TAGBODY); $this->yybegin(self::TAGBODY);
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
function yy_r2_22() function yy_r2_25()
{ {
$this->token = Smarty_Internal_Templateparser::TP_LDEL; $this->token = Smarty_Internal_Templateparser::TP_LDEL;
$this->yybegin(self::TAGBODY); $this->yybegin(self::TAGBODY);

File diff suppressed because it is too large Load Diff

View File

@@ -200,7 +200,7 @@ class Smarty_Internal_TestInstall
} else { } else {
$errors[ 'plugins_dir' ] = $message; $errors[ 'plugins_dir' ] = $message;
} }
} else if ($_core_plugins_dir && $_core_plugins_dir === realpath($plugin_dir)) { } else if ($_core_plugins_dir && $_core_plugins_dir == realpath($plugin_dir)) {
$_core_plugins_available = true; $_core_plugins_available = true;
if ($errors === null) { if ($errors === null) {
echo "$plugin_dir is OK.\n"; echo "$plugin_dir is OK.\n";
@@ -332,8 +332,7 @@ class Smarty_Internal_TestInstall
// test if sysplugins are available // test if sysplugins are available
$source = SMARTY_SYSPLUGINS_DIR; $source = SMARTY_SYSPLUGINS_DIR;
if (is_dir($source)) { if (is_dir($source)) {
$expectedSysplugins = array( $expectedSysplugins = array('smartycompilerexception.php' => true,
'smartycompilerexception.php' => true,
'smartyexception.php' => true, 'smartyexception.php' => true,
'smarty_cacheresource.php' => true, 'smarty_cacheresource.php' => true,
'smarty_cacheresource_custom.php' => true, 'smarty_cacheresource_custom.php' => true,
@@ -345,6 +344,10 @@ class Smarty_Internal_TestInstall
'smarty_internal_compile_append.php' => true, 'smarty_internal_compile_append.php' => true,
'smarty_internal_compile_assign.php' => true, 'smarty_internal_compile_assign.php' => true,
'smarty_internal_compile_block.php' => true, 'smarty_internal_compile_block.php' => true,
'smarty_internal_compile_block_child.php' => true,
'smarty_internal_compile_block_parent.php' => true,
'smarty_internal_compile_child.php' => true,
'smarty_internal_compile_parent.php' => true,
'smarty_internal_compile_break.php' => true, 'smarty_internal_compile_break.php' => true,
'smarty_internal_compile_call.php' => true, 'smarty_internal_compile_call.php' => true,
'smarty_internal_compile_capture.php' => true, 'smarty_internal_compile_capture.php' => true,
@@ -481,8 +484,7 @@ class Smarty_Internal_TestInstall
'smarty_template_resource_base.php' => true, 'smarty_template_resource_base.php' => true,
'smarty_template_source.php' => true, 'smarty_template_source.php' => true,
'smarty_undefined_variable.php' => true, 'smarty_undefined_variable.php' => true,
'smarty_variable.php' => true, 'smarty_variable.php' => true,);
);
$iterator = new DirectoryIterator($source); $iterator = new DirectoryIterator($source);
foreach ($iterator as $file) { foreach ($iterator as $file) {
if (!$file->isDot()) { if (!$file->isDot()) {