mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54: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
|
||||
- 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);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -1,17 +1,17 @@
|
||||
<?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
|
||||
@@ -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); ?>";
|
||||
|
@@ -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)
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user