summaryrefslogtreecommitdiff
path: root/lib/smarty3/sysplugins/smarty_internal_runtime_updatescope.php
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2018-10-18 02:40:38 +0200
committeremkael <emkael@tlen.pl>2018-10-18 02:40:38 +0200
commiteab8a101e7a3fcbb41e01a574985e06c5a3775de (patch)
tree60f201da5984b0c3638d10da02bba42b61aa3177 /lib/smarty3/sysplugins/smarty_internal_runtime_updatescope.php
parent7f38be342c1495aeca418286c15c25c18ac9e142 (diff)
Updating Smarty
Diffstat (limited to 'lib/smarty3/sysplugins/smarty_internal_runtime_updatescope.php')
-rw-r--r--lib/smarty3/sysplugins/smarty_internal_runtime_updatescope.php36
1 files changed, 18 insertions, 18 deletions
diff --git a/lib/smarty3/sysplugins/smarty_internal_runtime_updatescope.php b/lib/smarty3/sysplugins/smarty_internal_runtime_updatescope.php
index 04f2d3d..2240f97 100644
--- a/lib/smarty3/sysplugins/smarty_internal_runtime_updatescope.php
+++ b/lib/smarty3/sysplugins/smarty_internal_runtime_updatescope.php
@@ -6,25 +6,24 @@
* @package Smarty
* @subpackage PluginsInternal
* @author Uwe Tews
- *
**/
class Smarty_Internal_Runtime_UpdateScope
{
-
/**
* Update new assigned template or config variable in other effected scopes
*
- * @param Smarty_Internal_Template $tpl data object
- * @param string|null $varName variable name
- * @param int $tagScope tag scope to which bubble up variable value
- *
+ * @param Smarty_Internal_Template $tpl data object
+ * @param string|null $varName variable name
+ * @param int $tagScope tag scope to which bubble up variable value
*/
public function _updateScope(Smarty_Internal_Template $tpl, $varName, $tagScope = 0)
{
if ($tagScope) {
$this->_updateVarStack($tpl, $varName);
$tagScope = $tagScope & ~Smarty::SCOPE_LOCAL;
- if (!$tpl->scope && !$tagScope) return;
+ if (!$tpl->scope && !$tagScope) {
+ return;
+ }
}
$mergedScope = $tagScope | $tpl->scope;
if ($mergedScope) {
@@ -34,8 +33,9 @@ class Smarty_Internal_Runtime_UpdateScope
// update scopes
foreach ($this->_getAffectedScopes($tpl, $mergedScope) as $ptr) {
$this->_updateVariableInOtherScope($ptr->tpl_vars, $tpl, $varName);
- if($tagScope && $ptr->_objType == 2 && isset($tpl->_cache[ 'varStack' ])) {
- $this->_updateVarStack($ptr, $varName); }
+ if ($tagScope && $ptr->_isTplObj() && isset($tpl->_cache[ 'varStack' ])) {
+ $this->_updateVarStack($ptr, $varName);
+ }
}
}
}
@@ -52,7 +52,7 @@ class Smarty_Internal_Runtime_UpdateScope
{
$_stack = array();
$ptr = $tpl->parent;
- if ($mergedScope && isset($ptr) && $ptr->_objType == 2) {
+ if ($mergedScope && isset($ptr) && $ptr->_isTplObj()) {
$_stack[] = $ptr;
$mergedScope = $mergedScope & ~Smarty::SCOPE_PARENT;
if (!$mergedScope) {
@@ -61,9 +61,9 @@ class Smarty_Internal_Runtime_UpdateScope
}
$ptr = $ptr->parent;
}
- while (isset($ptr) && $ptr->_objType == 2) {
- $_stack[] = $ptr;
- $ptr = $ptr->parent;
+ while (isset($ptr) && $ptr->_isTplObj()) {
+ $_stack[] = $ptr;
+ $ptr = $ptr->parent;
}
if ($mergedScope & Smarty::SCOPE_SMARTY) {
if (isset($tpl->smarty)) {
@@ -71,7 +71,7 @@ class Smarty_Internal_Runtime_UpdateScope
}
} elseif ($mergedScope & Smarty::SCOPE_ROOT) {
while (isset($ptr)) {
- if ($ptr->_objType != 2) {
+ if (!$ptr->_isTplObj()) {
$_stack[] = $ptr;
break;
}
@@ -82,11 +82,11 @@ class Smarty_Internal_Runtime_UpdateScope
}
/**
- * Update varibale in other scope
+ * Update variable in other scope
*
- * @param array $tpl_vars template variable array
+ * @param array $tpl_vars template variable array
* @param \Smarty_Internal_Template $from
- * @param string $varName variable name
+ * @param string $varName variable name
*/
public function _updateVariableInOtherScope(&$tpl_vars, Smarty_Internal_Template $from, $varName)
{
@@ -109,7 +109,7 @@ class Smarty_Internal_Runtime_UpdateScope
$i = 0;
while (isset($tpl->_cache[ 'varStack' ][ $i ])) {
$this->_updateVariableInOtherScope($tpl->_cache[ 'varStack' ][ $i ][ 'tpl' ], $tpl, $varName);
- $i ++;
+ $i++;
}
}
}