mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
add $smarty.config.foo var, handle embedded smarty var correctly
This commit is contained in:
3
NEWS
3
NEWS
@@ -1,3 +1,6 @@
|
||||
- handle embedded "$smarty.config.foo.tpl" correctly (Monte)
|
||||
- add $smarty.config.varname variable for accessing config vars (Paul
|
||||
Lockaby, Monte)
|
||||
- silence PHP warnings in function.fetch.php (Eduardo,
|
||||
Monte)
|
||||
- added get_config_vars(), same basic functionality as
|
||||
|
@@ -1446,7 +1446,7 @@ class Smarty_Compiler extends Smarty {
|
||||
function _expand_quoted_text($var_expr)
|
||||
{
|
||||
// if contains unescaped $, expand it
|
||||
if(preg_match_all('%(?<!\\\\)\$(?:smarty(?:\.\w+)+|\w+(?:' . $this->_var_bracket_regexp . ')*)%', $var_expr, $match)) {
|
||||
if(preg_match_all('%(?<!\\\\)\$(?:smarty(?:\.\w+){1,2}|\w+(?:' . $this->_var_bracket_regexp . ')*)%', $var_expr, $match)) {
|
||||
rsort($match[0]);
|
||||
reset($match[0]);
|
||||
foreach($match[0] as $var) {
|
||||
@@ -1770,6 +1770,14 @@ class Smarty_Compiler extends Smarty {
|
||||
$compiled_ref = '(defined("' . substr($indexes[0],1) . '") ? ' . substr($indexes[0],1) . ' : null)';
|
||||
break;
|
||||
|
||||
case 'config':
|
||||
array_shift($indexes);
|
||||
$name = substr($indexes[0], 1);
|
||||
$compiled_ref = "\$this->_config[0]['vars']";
|
||||
if ($name = substr($indexes[0], 1))
|
||||
$compiled_ref .= "['$name']";
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->_syntax_error('$smarty.' . $ref . ' is an unknown reference', E_USER_ERROR, __FILE__, __LINE__);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user