Skip to content

Commit

Permalink
remove preserve block by side effect
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandr-ru committed Jun 10, 2020
1 parent 777cc74 commit 46eb7ce
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions TemplateObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @link https://pear.php.net/package/HTML_Template_IT Original HTML_Template_IT
* @link http://aleksandr.ru Author's website
*
* @version 2.5
* @version 2.6
*/
class TemplateObject
{
Expand Down Expand Up @@ -344,18 +344,12 @@ function setVarArray($arr)
$b = $this->setBlock($key) and $b->setVarArray($value);
}
elseif(is_array($value)) { // multiblock
foreach($value as $vv) {
//TODO: remove set block in next release
//see https://github.com/Aleksandr-ru/TemplateObject/commit/4520ffffaa0864bd8503813b1f65a5e9630a2a95
if($b = $this->setBlock($key)) {
if(is_array($vv) && self::array_has_string_keys($vv)) {
$b->setVarArray($vv);
}
else {
$this->debug and trigger_error("Incorrect variables array for block '$key'", E_USER_WARNING);
}
}
}
foreach($value as $vv) if(is_array($vv) && self::array_has_string_keys($vv)) {
$b = $this->setBlock($key) and $b->setVarArray($vv);
}
else {
$this->debug and trigger_error("Incorrect variables array for block '$key'", E_USER_WARNING);
}
}
elseif(is_null($value)) { // emptyblock
$this->setBlock($key);
Expand Down

0 comments on commit 46eb7ce

Please sign in to comment.