mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 19:04:27 +02:00
- bugfix passing scope attributes in doublequoted strings did not work at {include} {assign} and {append}
This commit is contained in:
@@ -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
|
25/07/2010
|
||||||
- another bugfix of change from 23/07/2010 when compiling modifer
|
- another bugfix of change from 23/07/2010 when compiling modifer
|
||||||
|
|
||||||
|
@@ -41,11 +41,12 @@ class Smarty_Internal_Compile_Append extends Smarty_Internal_CompileBase {
|
|||||||
$_attr = $this->_get_attributes($args);
|
$_attr = $this->_get_attributes($args);
|
||||||
|
|
||||||
if (isset($_attr['scope'])) {
|
if (isset($_attr['scope'])) {
|
||||||
if ($_attr['scope'] == '\'parent\'') {
|
$_attr['scope'] = trim($_attr['scope'], "'\"");
|
||||||
|
if ($_attr['scope'] == 'parent') {
|
||||||
$_scope = SMARTY_PARENT_SCOPE;
|
$_scope = SMARTY_PARENT_SCOPE;
|
||||||
} elseif ($_attr['scope'] == '\'root\'') {
|
} elseif ($_attr['scope'] == 'root') {
|
||||||
$_scope = SMARTY_ROOT_SCOPE;
|
$_scope = SMARTY_ROOT_SCOPE;
|
||||||
} elseif ($_attr['scope'] == '\'global\'') {
|
} elseif ($_attr['scope'] == 'global') {
|
||||||
$_scope = SMARTY_GLOBAL_SCOPE;
|
$_scope = SMARTY_GLOBAL_SCOPE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -58,4 +59,4 @@ class Smarty_Internal_Compile_Append extends Smarty_Internal_CompileBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@@ -41,11 +41,12 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase {
|
|||||||
$_attr = $this->_get_attributes($args);
|
$_attr = $this->_get_attributes($args);
|
||||||
|
|
||||||
if (isset($_attr['scope'])) {
|
if (isset($_attr['scope'])) {
|
||||||
if ($_attr['scope'] == '\'parent\'') {
|
$_attr['scope'] = trim($_attr['scope'], "'\"");
|
||||||
|
if ($_attr['scope'] == 'parent') {
|
||||||
$_scope = SMARTY_PARENT_SCOPE;
|
$_scope = SMARTY_PARENT_SCOPE;
|
||||||
} elseif ($_attr['scope'] == '\'root\'') {
|
} elseif ($_attr['scope'] == 'root') {
|
||||||
$_scope = SMARTY_ROOT_SCOPE;
|
$_scope = SMARTY_ROOT_SCOPE;
|
||||||
} elseif ($_attr['scope'] == '\'global\'') {
|
} elseif ($_attr['scope'] == 'global') {
|
||||||
$_scope = SMARTY_GLOBAL_SCOPE;
|
$_scope = SMARTY_GLOBAL_SCOPE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,25 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty Internal Plugin Compile Config Load
|
* Smarty Internal Plugin Compile Config Load
|
||||||
*
|
*
|
||||||
* Compiles the {config load} tag
|
* Compiles the {config load} tag
|
||||||
*
|
*
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage Compiler
|
* @subpackage Compiler
|
||||||
* @author Uwe Tews
|
* @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 {
|
class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase {
|
||||||
/**
|
/**
|
||||||
* Compiles code for the {config_load} tag
|
* Compiles code for the {config_load} tag
|
||||||
*
|
*
|
||||||
* @param array $args array with attributes from parser
|
* @param array $args array with attributes from parser
|
||||||
* @param object $compiler compiler object
|
* @param object $compiler compiler object
|
||||||
* @return string compiled code
|
* @return string compiled code
|
||||||
*/
|
*/
|
||||||
public function compile($args, $compiler)
|
public function compile($args, $compiler)
|
||||||
{
|
{
|
||||||
$this->compiler = $compiler;
|
$this->compiler = $compiler;
|
||||||
@@ -36,13 +36,13 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase {
|
|||||||
}
|
}
|
||||||
$scope = '$_smarty_tpl->smarty';
|
$scope = '$_smarty_tpl->smarty';
|
||||||
if (isset($_attr['scope'])) {
|
if (isset($_attr['scope'])) {
|
||||||
if ($_attr['scope'] == '\'local\'') {
|
$_attr['scope'] = trim($_attr['scope'], "'\"");
|
||||||
|
if ($_attr['scope'] == 'local') {
|
||||||
$scope = '$_smarty_tpl';
|
$scope = '$_smarty_tpl';
|
||||||
} elseif ($_attr['scope'] == '\'parent\'') {
|
} elseif ($_attr['scope'] == 'parent') {
|
||||||
$scope = '$_smarty_tpl->parent';
|
$scope = '$_smarty_tpl->parent';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create config object
|
// create config object
|
||||||
$_output = "<?php \$_config = new Smarty_Internal_Config($conf_file, \$_smarty_tpl->smarty, \$_smarty_tpl);";
|
$_output = "<?php \$_config = new Smarty_Internal_Config($conf_file, \$_smarty_tpl->smarty, \$_smarty_tpl);";
|
||||||
$_output .= "\$_config->loadConfigVars($section, $scope); ?>";
|
$_output .= "\$_config->loadConfigVars($section, $scope); ?>";
|
||||||
@@ -50,4 +50,4 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@@ -67,7 +67,7 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_CompileBase {
|
|||||||
$compiler->template->template_source = $_template->getTemplateSource();
|
$compiler->template->template_source = $_template->getTemplateSource();
|
||||||
$compiler->template->template_filepath = $_template->getTemplateFilepath();
|
$compiler->template->template_filepath = $_template->getTemplateFilepath();
|
||||||
$compiler->abort_and_recompile = true;
|
$compiler->abort_and_recompile = true;
|
||||||
return ' ';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function saveBlockData($block_content, $block_tag, $template)
|
protected function saveBlockData($block_content, $block_tag, $template)
|
||||||
|
@@ -40,13 +40,13 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
|
|||||||
// needs code for cached page but no cache file
|
// needs code for cached page but no cache file
|
||||||
$tpl->caching = 9999;
|
$tpl->caching = 9999;
|
||||||
}
|
}
|
||||||
if ($this->compiler->template->mustCompile) {
|
if ($this->compiler->template->mustCompile) {
|
||||||
// make sure whole chain gest compiled
|
// make sure whole chain gest compiled
|
||||||
$tpl->mustCompile = true;
|
$tpl->mustCompile = true;
|
||||||
}
|
}
|
||||||
if ($tpl->resource_object->usesCompiler && $tpl->isExisting()) {
|
if ($tpl->resource_object->usesCompiler && $tpl->isExisting()) {
|
||||||
// get compiled code
|
// get compiled code
|
||||||
$compiled_tpl = $tpl->getCompiledTemplate();
|
$compiled_tpl = $tpl->getCompiledTemplate();
|
||||||
// merge compiled code for {function} tags
|
// merge compiled code for {function} tags
|
||||||
$compiler->template->properties['function'] = array_merge($compiler->template->properties['function'], $tpl->properties['function']);
|
$compiler->template->properties['function'] = array_merge($compiler->template->properties['function'], $tpl->properties['function']);
|
||||||
// merge filedependency by evaluating header code
|
// merge filedependency by evaluating header code
|
||||||
@@ -77,11 +77,12 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
|
|||||||
|
|
||||||
$_parent_scope = SMARTY_LOCAL_SCOPE;
|
$_parent_scope = SMARTY_LOCAL_SCOPE;
|
||||||
if (isset($_attr['scope'])) {
|
if (isset($_attr['scope'])) {
|
||||||
if ($_attr['scope'] == '\'parent\'') {
|
$_attr['scope'] = trim($_attr['scope'], "'\"");
|
||||||
|
if ($_attr['scope'] == 'parent') {
|
||||||
$_parent_scope = SMARTY_PARENT_SCOPE;
|
$_parent_scope = SMARTY_PARENT_SCOPE;
|
||||||
} elseif ($_attr['scope'] == '\'root\'') {
|
} elseif ($_attr['scope'] == 'root') {
|
||||||
$_parent_scope = SMARTY_ROOT_SCOPE;
|
$_parent_scope = SMARTY_ROOT_SCOPE;
|
||||||
} elseif ($_attr['scope'] == '\'global\'') {
|
} elseif ($_attr['scope'] == 'global') {
|
||||||
$_parent_scope = SMARTY_GLOBAL_SCOPE;
|
$_parent_scope = SMARTY_GLOBAL_SCOPE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,13 +104,13 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
|
|||||||
$_cache_lifetime = 'null';
|
$_cache_lifetime = 'null';
|
||||||
}
|
}
|
||||||
if (isset($_attr['nocache'])) {
|
if (isset($_attr['nocache'])) {
|
||||||
if ($_attr['nocache'] == 'true') {
|
if (trim($_attr['nocache'], "'\"") == 'true') {
|
||||||
$this->compiler->tag_nocache = true;
|
$this->compiler->tag_nocache = true;
|
||||||
$_caching = SMARTY_CACHING_OFF;
|
$_caching = SMARTY_CACHING_OFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($_attr['caching'])) {
|
if (isset($_attr['caching'])) {
|
||||||
if ($_attr['caching'] == 'true') {
|
if (trim($_attr['caching'], "'\"") == 'true') {
|
||||||
$_caching = SMARTY_CACHING_LIFETIME_CURRENT;
|
$_caching = SMARTY_CACHING_LIFETIME_CURRENT;
|
||||||
} else {
|
} else {
|
||||||
$this->compiler->tag_nocache = true;
|
$this->compiler->tag_nocache = true;
|
||||||
@@ -128,7 +129,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
|
|||||||
$_output .= "\$_template->assign('$_key',$_value);";
|
$_output .= "\$_template->assign('$_key',$_value);";
|
||||||
}
|
}
|
||||||
} else {
|
} 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
|
// was there an assign attribute
|
||||||
@@ -152,4 +153,4 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Reference in New Issue
Block a user