mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-02 21:31:48 +01:00
- bugfix {strip} must keep space between hmtl tags. Broken by changes of 10.2.2016 https://github.com/smarty-php/smarty/issues/184
- new feature/bugfix {foreach}{section} new attribute 'property' to force compilation of loop property
read NEW_FEATURES.txt https://github.com/smarty-php/smarty/issues/189 (reverted from commit 4958deaf09)
This commit is contained in:
@@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
/**
|
||||
* smarty version
|
||||
*/
|
||||
const SMARTY_VERSION = '3.1.30-dev/47';
|
||||
const SMARTY_VERSION = '3.1.30-dev/46';
|
||||
|
||||
/**
|
||||
* define variable scopes
|
||||
|
||||
@@ -30,7 +30,7 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo
|
||||
* @var array
|
||||
* @see Smarty_Internal_CompileBase
|
||||
*/
|
||||
public $optional_attributes = array('name', 'key', 'properties');
|
||||
public $optional_attributes = array('name', 'key');
|
||||
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
@@ -137,24 +137,6 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo
|
||||
if (!empty($this->matchResults[ 'named' ])) {
|
||||
$namedAttr = $this->matchResults[ 'named' ];
|
||||
}
|
||||
if (isset($_attr[ 'properties' ]) && preg_match_all("/['](.*?)[']/", $_attr[ 'properties' ], $match)) {
|
||||
foreach ($match[ 1 ] as $prop) {
|
||||
if (in_array($prop, $this->itemProperties)) {
|
||||
$itemAttr[ $prop ] = true;
|
||||
} else {
|
||||
$compiler->trigger_template_error("Invalid property '{$prop}'", null, true);
|
||||
}
|
||||
}
|
||||
if ($this->isNamed) {
|
||||
foreach ($match[ 1 ] as $prop) {
|
||||
if (in_array($prop, $this->nameProperties)) {
|
||||
$nameAttr[ $prop ] = true;
|
||||
} else {
|
||||
$compiler->trigger_template_error("Invalid property '{$prop}'", null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($itemAttr[ 'first' ])) {
|
||||
$itemAttr[ 'index' ] = true;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo
|
||||
* @var array
|
||||
* @see Smarty_Internal_CompileBase
|
||||
*/
|
||||
public $optional_attributes = array('start', 'step', 'max', 'show', 'properties');
|
||||
public $optional_attributes = array('start', 'step', 'max', 'show');
|
||||
|
||||
/**
|
||||
* counter
|
||||
@@ -119,15 +119,6 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo
|
||||
if (!empty($this->matchResults[ 'named' ])) {
|
||||
$namedAttr = $this->matchResults[ 'named' ];
|
||||
}
|
||||
if (isset($_attr[ 'properties' ]) && preg_match_all("/['](.*?)[']/", $_attr[ 'properties' ], $match)) {
|
||||
foreach ($match[ 1 ] as $prop) {
|
||||
if (in_array($prop, $this->nameProperties)) {
|
||||
$namedAttr[ $prop ] = true;
|
||||
} else {
|
||||
$compiler->trigger_template_error("Invalid property '{$prop}'", null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
$namedAttr[ 'index' ] = true;
|
||||
$output = "<?php\n";
|
||||
foreach ($_attr as $attr_name => $attr_value) {
|
||||
|
||||
Reference in New Issue
Block a user