mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 19:04:27 +02:00
Moved $_smarty_sections and $_smarty_conf_obj into Smarty class.
This commit is contained in:
8
NEWS
8
NEWS
@@ -1,5 +1,9 @@
|
|||||||
- configs directory missing from 1.4.1 release, added back in (Monte)
|
- cleaned up compiled templates global scope by moving some variables into
|
||||||
- added windows include_path setup instructions to FAQ & QUICKSTART
|
the class itself. (Andrei)
|
||||||
|
- fixed a bug that would not allow referring to a section in the including
|
||||||
|
file from the included file. (Andrei)
|
||||||
|
- configs directory missing from 1.4.1 release, added back in. (Monte)
|
||||||
|
- added windows include_path setup instructions to FAQ & QUICKSTART.
|
||||||
(Monte)
|
(Monte)
|
||||||
|
|
||||||
Version 1.4.1
|
Version 1.4.1
|
||||||
|
@@ -147,6 +147,8 @@ class Smarty
|
|||||||
// internal vars
|
// internal vars
|
||||||
var $_error_msg = false; // error messages. true/false
|
var $_error_msg = false; // error messages. true/false
|
||||||
var $_tpl_vars = array(); // where assigned template vars are kept
|
var $_tpl_vars = array(); // where assigned template vars are kept
|
||||||
|
var $_sections = array(); // keeps track of sections
|
||||||
|
var $_conf_obj = null; // configuration object
|
||||||
var $_smarty_md5 = 'f8d698aea36fcbead2b9d5359ffca76f'; // md5 checksum of the string 'Smarty'
|
var $_smarty_md5 = 'f8d698aea36fcbead2b9d5359ffca76f'; // md5 checksum of the string 'Smarty'
|
||||||
|
|
||||||
|
|
||||||
@@ -173,6 +175,11 @@ class Smarty
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Prepare the configuration object. */
|
||||||
|
if (!class_exists('Config_File'))
|
||||||
|
include_once 'Config_File.class.php';
|
||||||
|
$this->_conf_obj = new Config_File($this->config_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -258,6 +258,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _compile_compiler_tag
|
Function: _compile_compiler_tag
|
||||||
Purpose: compile the custom compiler tag
|
Purpose: compile the custom compiler tag
|
||||||
@@ -274,6 +275,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return '<?php' . $function($tag_args, $this) . ' ?>';
|
return '<?php' . $function($tag_args, $this) . ' ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _compile_custom_tag
|
Function: _compile_custom_tag
|
||||||
Purpose: compile custom function tag
|
Purpose: compile custom function tag
|
||||||
@@ -297,6 +299,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return "<?php $function(array(".implode(',', (array)$arg_list)."), \$this); ?>";
|
return "<?php $function(array(".implode(',', (array)$arg_list)."), \$this); ?>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _compile_insert_tag
|
Function: _compile_insert_tag
|
||||||
Purpose: Compile {insert ...} tag
|
Purpose: Compile {insert ...} tag
|
||||||
@@ -337,18 +340,15 @@ class Smarty_Compiler extends Smarty {
|
|||||||
else
|
else
|
||||||
$update_parent = false;
|
$update_parent = false;
|
||||||
|
|
||||||
$output = "<?php if (!class_exists('Config_File'))\n" .
|
$output = "<?php\n" .
|
||||||
" include_once 'Config_File.class.php';\n" .
|
"\$_smarty_config = array_merge((array)\$_smarty_config, \$this->_conf_obj->get(".$attrs['file']."));\n";
|
||||||
"if (!is_object(\$GLOBALS['_smarty_conf_obj']) || get_class(\$GLOBALS['_smarty_conf_obj']) != 'config_file')\n" .
|
|
||||||
" \$GLOBALS['_smarty_conf_obj'] = new Config_File('".$this->config_dir."');\n" .
|
|
||||||
"\$_smarty_config = array_merge((array)\$_smarty_config, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file']."));\n";
|
|
||||||
if ($update_parent)
|
if ($update_parent)
|
||||||
$output .= "\$_smarty_config_parent = array_merge((array)\$_smarty_config_parent, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file']."));\n";
|
$output .= "\$_smarty_config_parent = array_merge((array)\$_smarty_config_parent, \$this->_conf_obj->get(".$attrs['file']."));\n";
|
||||||
|
|
||||||
if (!empty($attrs['section'])) {
|
if (!empty($attrs['section'])) {
|
||||||
$output .= "\$_smarty_config = array_merge((array)\$_smarty_config, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file'].", ".$attrs['section']."));\n";
|
$output .= "\$_smarty_config = array_merge((array)\$_smarty_config, \$this->_conf_obj->get(".$attrs['file'].", ".$attrs['section']."));\n";
|
||||||
if ($update_parent)
|
if ($update_parent)
|
||||||
$output .= "\$_smarty_config_parent = array_merge((array)\$_smarty_config_parent, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file'].", ".$attrs['section']."));\n";
|
$output .= "\$_smarty_config_parent = array_merge((array)\$_smarty_config_parent, \$this->_conf_obj->get(".$attrs['file'].", ".$attrs['section']."));\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$output .= '?>';
|
$output .= '?>';
|
||||||
@@ -356,6 +356,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _compile_include_tag
|
Function: _compile_include_tag
|
||||||
Purpose: Compile {include ...} tag
|
Purpose: Compile {include ...} tag
|
||||||
@@ -370,7 +371,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
|
|
||||||
foreach ($attrs as $arg_name => $arg_value) {
|
foreach ($attrs as $arg_name => $arg_value) {
|
||||||
if ($arg_name == 'file') {
|
if ($arg_name == 'file') {
|
||||||
$_smarty_include_tpl_file = $arg_value;
|
$include_file = $arg_value;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (is_bool($arg_value))
|
if (is_bool($arg_value))
|
||||||
@@ -380,11 +381,12 @@ class Smarty_Compiler extends Smarty {
|
|||||||
|
|
||||||
return "<?php " .
|
return "<?php " .
|
||||||
"\$_smarty_tpl_vars = \$this->_tpl_vars;\n" .
|
"\$_smarty_tpl_vars = \$this->_tpl_vars;\n" .
|
||||||
"\$this->_smarty_include(".$_smarty_include_tpl_file.", array(".implode(',', (array)$arg_list)."), \$_smarty_config);\n" .
|
"\$this->_smarty_include(".$include_file.", array(".implode(',', (array)$arg_list)."), \$_smarty_config);\n" .
|
||||||
"\$this->_tpl_vars = \$_smarty_tpl_vars;\n" .
|
"\$this->_tpl_vars = \$_smarty_tpl_vars;\n" .
|
||||||
"unset(\$_smarty_tpl_vars); ?>";
|
"unset(\$_smarty_tpl_vars); ?>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _compile_section_start
|
Function: _compile_section_start
|
||||||
Purpose: Compile {section ...} tag
|
Purpose: Compile {section ...} tag
|
||||||
@@ -399,8 +401,8 @@ class Smarty_Compiler extends Smarty {
|
|||||||
$this->_syntax_error("missing section name");
|
$this->_syntax_error("missing section name");
|
||||||
}
|
}
|
||||||
|
|
||||||
$output .= "if (isset(\$_smarty_sections[$section_name])) unset(\$_smarty_sections[$section_name]);\n";
|
$output .= "if (isset(\$this->_sections[$section_name])) unset(\$this->_sections[$section_name]);\n";
|
||||||
$section_props = "\$_smarty_sections[$section_name]['properties']";
|
$section_props = "\$this->_sections[$section_name]['properties']";
|
||||||
|
|
||||||
foreach ($attrs as $attr_name => $attr_value) {
|
foreach ($attrs as $attr_name => $attr_value) {
|
||||||
switch ($attr_name) {
|
switch ($attr_name) {
|
||||||
@@ -449,6 +451,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _compile_if_tag
|
Function: _compile_if_tag
|
||||||
Purpose: Compile {if ...} tag
|
Purpose: Compile {if ...} tag
|
||||||
@@ -553,6 +556,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return '<?php if ('.implode(' ', $tokens).'): ?>';
|
return '<?php if ('.implode(' ', $tokens).'): ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _parse_is_expr
|
Function: _parse_is_expr
|
||||||
Purpose: Parse is expression
|
Purpose: Parse is expression
|
||||||
@@ -612,6 +616,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return $tokens;
|
return $tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _parse_attrs
|
Function: _parse_attrs
|
||||||
Purpose: Parse attribute string
|
Purpose: Parse attribute string
|
||||||
@@ -685,6 +690,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return $attrs;
|
return $attrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _parse_vars_props
|
Function: _parse_vars_props
|
||||||
Purpose: compile variables and section properties tokens into
|
Purpose: compile variables and section properties tokens into
|
||||||
@@ -717,6 +723,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _parse_var
|
Function: _parse_var
|
||||||
Purpose: parse variable expression into PHP code
|
Purpose: parse variable expression into PHP code
|
||||||
@@ -738,7 +745,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
$parts = explode('.', substr($index, 1, -1));
|
$parts = explode('.', substr($index, 1, -1));
|
||||||
$section = $parts[0];
|
$section = $parts[0];
|
||||||
$section_prop = isset($parts[1]) ? $parts[1] : 'index';
|
$section_prop = isset($parts[1]) ? $parts[1] : 'index';
|
||||||
$output .= "[\$_smarty_sections['$section']['properties']['$section_prop']]";
|
$output .= "[\$this->_sections['$section']['properties']['$section_prop']]";
|
||||||
} else if ($index{0} == '.') {
|
} else if ($index{0} == '.') {
|
||||||
$output .= "['" . substr($index, 1) . "']";
|
$output .= "['" . substr($index, 1) . "']";
|
||||||
} else {
|
} else {
|
||||||
@@ -751,6 +758,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _parse_conf_var
|
Function: _parse_conf_var
|
||||||
Purpose: parse configuration variable expression into PHP code
|
Purpose: parse configuration variable expression into PHP code
|
||||||
@@ -770,6 +778,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _parse_section_prop
|
Function: _parse_section_prop
|
||||||
Purpose: parse section property expression into PHP code
|
Purpose: parse section property expression into PHP code
|
||||||
@@ -784,13 +793,14 @@ class Smarty_Compiler extends Smarty {
|
|||||||
$section_name = $match[1];
|
$section_name = $match[1];
|
||||||
$prop_name = $match[2];
|
$prop_name = $match[2];
|
||||||
|
|
||||||
$output = "\$_smarty_sections['$section_name']['properties']['$prop_name']";
|
$output = "\$this->_sections['$section_name']['properties']['$prop_name']";
|
||||||
|
|
||||||
$this->_parse_modifiers($output, $modifiers);
|
$this->_parse_modifiers($output, $modifiers);
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _parse_modifiers
|
Function: _parse_modifiers
|
||||||
Purpose: parse modifier chain into PHP code
|
Purpose: parse modifier chain into PHP code
|
||||||
@@ -841,6 +851,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _syntax_error
|
Function: _syntax_error
|
||||||
Purpose: display Smarty syntax error
|
Purpose: display Smarty syntax error
|
||||||
|
@@ -147,6 +147,8 @@ class Smarty
|
|||||||
// internal vars
|
// internal vars
|
||||||
var $_error_msg = false; // error messages. true/false
|
var $_error_msg = false; // error messages. true/false
|
||||||
var $_tpl_vars = array(); // where assigned template vars are kept
|
var $_tpl_vars = array(); // where assigned template vars are kept
|
||||||
|
var $_sections = array(); // keeps track of sections
|
||||||
|
var $_conf_obj = null; // configuration object
|
||||||
var $_smarty_md5 = 'f8d698aea36fcbead2b9d5359ffca76f'; // md5 checksum of the string 'Smarty'
|
var $_smarty_md5 = 'f8d698aea36fcbead2b9d5359ffca76f'; // md5 checksum of the string 'Smarty'
|
||||||
|
|
||||||
|
|
||||||
@@ -173,6 +175,11 @@ class Smarty
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Prepare the configuration object. */
|
||||||
|
if (!class_exists('Config_File'))
|
||||||
|
include_once 'Config_File.class.php';
|
||||||
|
$this->_conf_obj = new Config_File($this->config_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -258,6 +258,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _compile_compiler_tag
|
Function: _compile_compiler_tag
|
||||||
Purpose: compile the custom compiler tag
|
Purpose: compile the custom compiler tag
|
||||||
@@ -274,6 +275,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return '<?php' . $function($tag_args, $this) . ' ?>';
|
return '<?php' . $function($tag_args, $this) . ' ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _compile_custom_tag
|
Function: _compile_custom_tag
|
||||||
Purpose: compile custom function tag
|
Purpose: compile custom function tag
|
||||||
@@ -297,6 +299,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return "<?php $function(array(".implode(',', (array)$arg_list)."), \$this); ?>";
|
return "<?php $function(array(".implode(',', (array)$arg_list)."), \$this); ?>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _compile_insert_tag
|
Function: _compile_insert_tag
|
||||||
Purpose: Compile {insert ...} tag
|
Purpose: Compile {insert ...} tag
|
||||||
@@ -337,18 +340,15 @@ class Smarty_Compiler extends Smarty {
|
|||||||
else
|
else
|
||||||
$update_parent = false;
|
$update_parent = false;
|
||||||
|
|
||||||
$output = "<?php if (!class_exists('Config_File'))\n" .
|
$output = "<?php\n" .
|
||||||
" include_once 'Config_File.class.php';\n" .
|
"\$_smarty_config = array_merge((array)\$_smarty_config, \$this->_conf_obj->get(".$attrs['file']."));\n";
|
||||||
"if (!is_object(\$GLOBALS['_smarty_conf_obj']) || get_class(\$GLOBALS['_smarty_conf_obj']) != 'config_file')\n" .
|
|
||||||
" \$GLOBALS['_smarty_conf_obj'] = new Config_File('".$this->config_dir."');\n" .
|
|
||||||
"\$_smarty_config = array_merge((array)\$_smarty_config, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file']."));\n";
|
|
||||||
if ($update_parent)
|
if ($update_parent)
|
||||||
$output .= "\$_smarty_config_parent = array_merge((array)\$_smarty_config_parent, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file']."));\n";
|
$output .= "\$_smarty_config_parent = array_merge((array)\$_smarty_config_parent, \$this->_conf_obj->get(".$attrs['file']."));\n";
|
||||||
|
|
||||||
if (!empty($attrs['section'])) {
|
if (!empty($attrs['section'])) {
|
||||||
$output .= "\$_smarty_config = array_merge((array)\$_smarty_config, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file'].", ".$attrs['section']."));\n";
|
$output .= "\$_smarty_config = array_merge((array)\$_smarty_config, \$this->_conf_obj->get(".$attrs['file'].", ".$attrs['section']."));\n";
|
||||||
if ($update_parent)
|
if ($update_parent)
|
||||||
$output .= "\$_smarty_config_parent = array_merge((array)\$_smarty_config_parent, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file'].", ".$attrs['section']."));\n";
|
$output .= "\$_smarty_config_parent = array_merge((array)\$_smarty_config_parent, \$this->_conf_obj->get(".$attrs['file'].", ".$attrs['section']."));\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$output .= '?>';
|
$output .= '?>';
|
||||||
@@ -356,6 +356,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _compile_include_tag
|
Function: _compile_include_tag
|
||||||
Purpose: Compile {include ...} tag
|
Purpose: Compile {include ...} tag
|
||||||
@@ -370,7 +371,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
|
|
||||||
foreach ($attrs as $arg_name => $arg_value) {
|
foreach ($attrs as $arg_name => $arg_value) {
|
||||||
if ($arg_name == 'file') {
|
if ($arg_name == 'file') {
|
||||||
$_smarty_include_tpl_file = $arg_value;
|
$include_file = $arg_value;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (is_bool($arg_value))
|
if (is_bool($arg_value))
|
||||||
@@ -380,11 +381,12 @@ class Smarty_Compiler extends Smarty {
|
|||||||
|
|
||||||
return "<?php " .
|
return "<?php " .
|
||||||
"\$_smarty_tpl_vars = \$this->_tpl_vars;\n" .
|
"\$_smarty_tpl_vars = \$this->_tpl_vars;\n" .
|
||||||
"\$this->_smarty_include(".$_smarty_include_tpl_file.", array(".implode(',', (array)$arg_list)."), \$_smarty_config);\n" .
|
"\$this->_smarty_include(".$include_file.", array(".implode(',', (array)$arg_list)."), \$_smarty_config);\n" .
|
||||||
"\$this->_tpl_vars = \$_smarty_tpl_vars;\n" .
|
"\$this->_tpl_vars = \$_smarty_tpl_vars;\n" .
|
||||||
"unset(\$_smarty_tpl_vars); ?>";
|
"unset(\$_smarty_tpl_vars); ?>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _compile_section_start
|
Function: _compile_section_start
|
||||||
Purpose: Compile {section ...} tag
|
Purpose: Compile {section ...} tag
|
||||||
@@ -399,8 +401,8 @@ class Smarty_Compiler extends Smarty {
|
|||||||
$this->_syntax_error("missing section name");
|
$this->_syntax_error("missing section name");
|
||||||
}
|
}
|
||||||
|
|
||||||
$output .= "if (isset(\$_smarty_sections[$section_name])) unset(\$_smarty_sections[$section_name]);\n";
|
$output .= "if (isset(\$this->_sections[$section_name])) unset(\$this->_sections[$section_name]);\n";
|
||||||
$section_props = "\$_smarty_sections[$section_name]['properties']";
|
$section_props = "\$this->_sections[$section_name]['properties']";
|
||||||
|
|
||||||
foreach ($attrs as $attr_name => $attr_value) {
|
foreach ($attrs as $attr_name => $attr_value) {
|
||||||
switch ($attr_name) {
|
switch ($attr_name) {
|
||||||
@@ -449,6 +451,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _compile_if_tag
|
Function: _compile_if_tag
|
||||||
Purpose: Compile {if ...} tag
|
Purpose: Compile {if ...} tag
|
||||||
@@ -553,6 +556,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return '<?php if ('.implode(' ', $tokens).'): ?>';
|
return '<?php if ('.implode(' ', $tokens).'): ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _parse_is_expr
|
Function: _parse_is_expr
|
||||||
Purpose: Parse is expression
|
Purpose: Parse is expression
|
||||||
@@ -612,6 +616,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return $tokens;
|
return $tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _parse_attrs
|
Function: _parse_attrs
|
||||||
Purpose: Parse attribute string
|
Purpose: Parse attribute string
|
||||||
@@ -685,6 +690,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return $attrs;
|
return $attrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _parse_vars_props
|
Function: _parse_vars_props
|
||||||
Purpose: compile variables and section properties tokens into
|
Purpose: compile variables and section properties tokens into
|
||||||
@@ -717,6 +723,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _parse_var
|
Function: _parse_var
|
||||||
Purpose: parse variable expression into PHP code
|
Purpose: parse variable expression into PHP code
|
||||||
@@ -738,7 +745,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
$parts = explode('.', substr($index, 1, -1));
|
$parts = explode('.', substr($index, 1, -1));
|
||||||
$section = $parts[0];
|
$section = $parts[0];
|
||||||
$section_prop = isset($parts[1]) ? $parts[1] : 'index';
|
$section_prop = isset($parts[1]) ? $parts[1] : 'index';
|
||||||
$output .= "[\$_smarty_sections['$section']['properties']['$section_prop']]";
|
$output .= "[\$this->_sections['$section']['properties']['$section_prop']]";
|
||||||
} else if ($index{0} == '.') {
|
} else if ($index{0} == '.') {
|
||||||
$output .= "['" . substr($index, 1) . "']";
|
$output .= "['" . substr($index, 1) . "']";
|
||||||
} else {
|
} else {
|
||||||
@@ -751,6 +758,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _parse_conf_var
|
Function: _parse_conf_var
|
||||||
Purpose: parse configuration variable expression into PHP code
|
Purpose: parse configuration variable expression into PHP code
|
||||||
@@ -770,6 +778,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _parse_section_prop
|
Function: _parse_section_prop
|
||||||
Purpose: parse section property expression into PHP code
|
Purpose: parse section property expression into PHP code
|
||||||
@@ -784,13 +793,14 @@ class Smarty_Compiler extends Smarty {
|
|||||||
$section_name = $match[1];
|
$section_name = $match[1];
|
||||||
$prop_name = $match[2];
|
$prop_name = $match[2];
|
||||||
|
|
||||||
$output = "\$_smarty_sections['$section_name']['properties']['$prop_name']";
|
$output = "\$this->_sections['$section_name']['properties']['$prop_name']";
|
||||||
|
|
||||||
$this->_parse_modifiers($output, $modifiers);
|
$this->_parse_modifiers($output, $modifiers);
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _parse_modifiers
|
Function: _parse_modifiers
|
||||||
Purpose: parse modifier chain into PHP code
|
Purpose: parse modifier chain into PHP code
|
||||||
@@ -841,6 +851,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*======================================================================*\
|
/*======================================================================*\
|
||||||
Function: _syntax_error
|
Function: _syntax_error
|
||||||
Purpose: display Smarty syntax error
|
Purpose: display Smarty syntax error
|
||||||
|
Reference in New Issue
Block a user