mirror of
https://github.com/smarty-php/smarty.git
synced 2026-05-04 03:40:53 +02:00
- update scope handling
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user