- bugfix passing scope attributes in doublequoted strings did not work at {include} {assign} and {append}

This commit is contained in:
Uwe.Tews
2010-07-30 13:09:52 +00:00
parent 7c7d65eb32
commit b52cbe9adb
6 changed files with 43 additions and 37 deletions

View File

@@ -1,3 +1,6 @@
30/07/2010
- bugfix passing scope attributes in doublequoted strings did not work at {include} {assign} and {append}
25/07/2010
- another bugfix of change from 23/07/2010 when compiling modifer

View File

@@ -41,11 +41,12 @@ class Smarty_Internal_Compile_Append extends Smarty_Internal_CompileBase {
$_attr = $this->_get_attributes($args);
if (isset($_attr['scope'])) {
if ($_attr['scope'] == '\'parent\'') {
$_attr['scope'] = trim($_attr['scope'], "'\"");
if ($_attr['scope'] == 'parent') {
$_scope = SMARTY_PARENT_SCOPE;
} elseif ($_attr['scope'] == '\'root\'') {
} elseif ($_attr['scope'] == 'root') {
$_scope = SMARTY_ROOT_SCOPE;
} elseif ($_attr['scope'] == '\'global\'') {
} elseif ($_attr['scope'] == 'global') {
$_scope = SMARTY_GLOBAL_SCOPE;
}
}

View File

@@ -41,11 +41,12 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase {
$_attr = $this->_get_attributes($args);
if (isset($_attr['scope'])) {
if ($_attr['scope'] == '\'parent\'') {
$_attr['scope'] = trim($_attr['scope'], "'\"");
if ($_attr['scope'] == 'parent') {
$_scope = SMARTY_PARENT_SCOPE;
} elseif ($_attr['scope'] == '\'root\'') {
} elseif ($_attr['scope'] == 'root') {
$_scope = SMARTY_ROOT_SCOPE;
} elseif ($_attr['scope'] == '\'global\'') {
} elseif ($_attr['scope'] == 'global') {
$_scope = SMARTY_GLOBAL_SCOPE;
}
}

View File

@@ -36,13 +36,13 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase {
}
$scope = '$_smarty_tpl->smarty';
if (isset($_attr['scope'])) {
if ($_attr['scope'] == '\'local\'') {
$_attr['scope'] = trim($_attr['scope'], "'\"");
if ($_attr['scope'] == 'local') {
$scope = '$_smarty_tpl';
} elseif ($_attr['scope'] == '\'parent\'') {
} elseif ($_attr['scope'] == 'parent') {
$scope = '$_smarty_tpl->parent';
}
}
// create config object
$_output = "<?php \$_config = new Smarty_Internal_Config($conf_file, \$_smarty_tpl->smarty, \$_smarty_tpl);";
$_output .= "\$_config->loadConfigVars($section, $scope); ?>";

View File

@@ -77,11 +77,12 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
$_parent_scope = SMARTY_LOCAL_SCOPE;
if (isset($_attr['scope'])) {
if ($_attr['scope'] == '\'parent\'') {
$_attr['scope'] = trim($_attr['scope'], "'\"");
if ($_attr['scope'] == 'parent') {
$_parent_scope = SMARTY_PARENT_SCOPE;
} elseif ($_attr['scope'] == '\'root\'') {
} elseif ($_attr['scope'] == 'root') {
$_parent_scope = SMARTY_ROOT_SCOPE;
} elseif ($_attr['scope'] == '\'global\'') {
} elseif ($_attr['scope'] == 'global') {
$_parent_scope = SMARTY_GLOBAL_SCOPE;
}
}
@@ -103,13 +104,13 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
$_cache_lifetime = 'null';
}
if (isset($_attr['nocache'])) {
if ($_attr['nocache'] == 'true') {
if (trim($_attr['nocache'], "'\"") == 'true') {
$this->compiler->tag_nocache = true;
$_caching = SMARTY_CACHING_OFF;
}
}
if (isset($_attr['caching'])) {
if ($_attr['caching'] == 'true') {
if (trim($_attr['caching'], "'\"") == 'true') {
$_caching = SMARTY_CACHING_LIFETIME_CURRENT;
} else {
$this->compiler->tag_nocache = true;
@@ -128,7 +129,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
$_output .= "\$_template->assign('$_key',$_value);";
}
} else {
$this->compiler->trigger_template_error('variable passing not allowed in parent/global scope');
$this->compiler->trigger_template_error('variable passing not allowed in parent/global scope', $this->compiler->lex->taglineno);
}
}
// was there an assign attribute