- 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

@@ -1,25 +1,25 @@
<?php
/**
* Smarty Internal Plugin Compile Config Load
*
* Compiles the {config load} tag
*
* @package Smarty
* @subpackage Compiler
* @author Uwe Tews
*/
* Smarty Internal Plugin Compile Config Load
*
* Compiles the {config load} tag
*
* @package Smarty
* @subpackage Compiler
* @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Config Load Class
*/
* Smarty Internal Plugin Compile Config Load Class
*/
class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase {
/**
* Compiles code for the {config_load} tag
*
* @param array $args array with attributes from parser
* @param object $compiler compiler object
* @return string compiled code
*/
* Compiles code for the {config_load} tag
*
* @param array $args array with attributes from parser
* @param object $compiler compiler object
* @return string compiled code
*/
public function compile($args, $compiler)
{
$this->compiler = $compiler;
@@ -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

@@ -67,7 +67,7 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_CompileBase {
$compiler->template->template_source = $_template->getTemplateSource();
$compiler->template->template_filepath = $_template->getTemplateFilepath();
$compiler->abort_and_recompile = true;
return ' ';
return '';
}
protected function saveBlockData($block_content, $block_tag, $template)

View File

@@ -40,7 +40,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
// needs code for cached page but no cache file
$tpl->caching = 9999;
}
if ($this->compiler->template->mustCompile) {
if ($this->compiler->template->mustCompile) {
// make sure whole chain gest compiled
$tpl->mustCompile = true;
}
@@ -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