- update scope handling

This commit is contained in:
uwetews
2016-01-02 02:47:32 +01:00
parent bdf9f41da8
commit 59343127f7
8 changed files with 82 additions and 91 deletions
@@ -83,10 +83,17 @@ class Smarty_Internal_Method_ConfigLoad
{
$this->_assignConfigVars($tpl->parent, $tpl, $_config_vars);
$scope = $tpl->source->scope;
if (!$scope && !$tpl->scope) {
$scopes = array();
if ($scope) {
$scopes[] = $scope;
}
if ($tpl->scope) {
$scopes[] = $tpl->scope;
}
if (empty($scopes)) {
return;
}
foreach (array($scope, $tpl->scope) as $s) {
foreach ($scopes as $s) {
$s = ($bubble_up = $s >= Smarty::SCOPE_BUBBLE_UP) ? $s - Smarty::SCOPE_BUBBLE_UP : $s;
if ($bubble_up && $s) {
$ptr = $tpl->parent->parent;
@@ -103,15 +110,11 @@ class Smarty_Internal_Method_ConfigLoad
}
if ($s == Smarty::SCOPE_TPL_ROOT) {
continue;
} elseif ($s == Smarty::SCOPE_SMARTY) {
$this->_assignConfigVars($tpl->smarty, $tpl, $_config_vars);
} elseif ($s == Smarty::SCOPE_GLOBAL) {
$this->_assignConfigVars($tpl->smarty, $tpl, $_config_vars);
} elseif ($s == Smarty::SCOPE_ROOT) {
while (isset($ptr->parent)) {
$ptr = $ptr->parent;
$this->_assignConfigVars($ptr, $tpl, $_config_vars);
}
$this->_assignConfigVars($ptr, $tpl, $_config_vars);
}
}
}