mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
added assign_by_ref() and append_by_ref() functions
This commit is contained in:
2
NEWS
2
NEWS
@@ -1,3 +1,5 @@
|
||||
- added assign_by_ref() and append_by_ref() functions
|
||||
(Monte)
|
||||
- changed default warning type for plugin errors from
|
||||
E_USER_WARNING to E_USER_ERROR (Monte)
|
||||
- added $all_extra, $hour_extra, $minute_extra,
|
||||
|
@@ -240,17 +240,27 @@ class Smarty
|
||||
$this->_extract = true;
|
||||
}
|
||||
|
||||
|
||||
/*======================================================================*\
|
||||
Function: assign_by_ref()
|
||||
Purpose: assigns values to template variables by reference
|
||||
\*======================================================================*/
|
||||
function assign_by_ref($tpl_var, &$value)
|
||||
{
|
||||
if ($tpl_var != '' && isset($value))
|
||||
$this->_tpl_vars[$tpl_var] = &$value;
|
||||
$this->_extract = true;
|
||||
}
|
||||
|
||||
/*======================================================================*\
|
||||
Function: append
|
||||
Purpose: appens values to template variables
|
||||
Purpose: appends values to template variables
|
||||
\*======================================================================*/
|
||||
function append($tpl_var, $value = NULL)
|
||||
{
|
||||
if (is_array($tpl_var)) {
|
||||
foreach ($tpl_var as $key => $val) {
|
||||
if ($key != '') {
|
||||
if(!is_array($this->_tpl_vars[$key])) {
|
||||
if(!@is_array($this->_tpl_vars[$key])) {
|
||||
settype($this->_tpl_vars[$key],'array');
|
||||
}
|
||||
$this->_tpl_vars[$key][] = $val;
|
||||
@@ -258,7 +268,7 @@ class Smarty
|
||||
}
|
||||
} else {
|
||||
if ($tpl_var != '' && isset($value)) {
|
||||
if(!is_array($this->_tpl_vars[$tpl_var])) {
|
||||
if(!@is_array($this->_tpl_vars[$tpl_var])) {
|
||||
settype($this->_tpl_vars[$tpl_var],'array');
|
||||
}
|
||||
$this->_tpl_vars[$tpl_var][] = $value;
|
||||
@@ -267,6 +277,21 @@ class Smarty
|
||||
$this->_extract = true;
|
||||
}
|
||||
|
||||
/*======================================================================*\
|
||||
Function: append_by_ref
|
||||
Purpose: appends values to template variables by reference
|
||||
\*======================================================================*/
|
||||
function append_by_ref($tpl_var, &$value)
|
||||
{
|
||||
if ($tpl_var != '' && isset($value)) {
|
||||
if(!@is_array($this->_tpl_vars[$tpl_var])) {
|
||||
settype($this->_tpl_vars[$tpl_var],'array');
|
||||
}
|
||||
$this->_tpl_vars[$tpl_var][] = &$value;
|
||||
}
|
||||
$this->_extract = true;
|
||||
}
|
||||
|
||||
|
||||
/*======================================================================*\
|
||||
Function: clear_assign()
|
||||
|
@@ -240,17 +240,27 @@ class Smarty
|
||||
$this->_extract = true;
|
||||
}
|
||||
|
||||
|
||||
/*======================================================================*\
|
||||
Function: assign_by_ref()
|
||||
Purpose: assigns values to template variables by reference
|
||||
\*======================================================================*/
|
||||
function assign_by_ref($tpl_var, &$value)
|
||||
{
|
||||
if ($tpl_var != '' && isset($value))
|
||||
$this->_tpl_vars[$tpl_var] = &$value;
|
||||
$this->_extract = true;
|
||||
}
|
||||
|
||||
/*======================================================================*\
|
||||
Function: append
|
||||
Purpose: appens values to template variables
|
||||
Purpose: appends values to template variables
|
||||
\*======================================================================*/
|
||||
function append($tpl_var, $value = NULL)
|
||||
{
|
||||
if (is_array($tpl_var)) {
|
||||
foreach ($tpl_var as $key => $val) {
|
||||
if ($key != '') {
|
||||
if(!is_array($this->_tpl_vars[$key])) {
|
||||
if(!@is_array($this->_tpl_vars[$key])) {
|
||||
settype($this->_tpl_vars[$key],'array');
|
||||
}
|
||||
$this->_tpl_vars[$key][] = $val;
|
||||
@@ -258,7 +268,7 @@ class Smarty
|
||||
}
|
||||
} else {
|
||||
if ($tpl_var != '' && isset($value)) {
|
||||
if(!is_array($this->_tpl_vars[$tpl_var])) {
|
||||
if(!@is_array($this->_tpl_vars[$tpl_var])) {
|
||||
settype($this->_tpl_vars[$tpl_var],'array');
|
||||
}
|
||||
$this->_tpl_vars[$tpl_var][] = $value;
|
||||
@@ -267,6 +277,21 @@ class Smarty
|
||||
$this->_extract = true;
|
||||
}
|
||||
|
||||
/*======================================================================*\
|
||||
Function: append_by_ref
|
||||
Purpose: appends values to template variables by reference
|
||||
\*======================================================================*/
|
||||
function append_by_ref($tpl_var, &$value)
|
||||
{
|
||||
if ($tpl_var != '' && isset($value)) {
|
||||
if(!@is_array($this->_tpl_vars[$tpl_var])) {
|
||||
settype($this->_tpl_vars[$tpl_var],'array');
|
||||
}
|
||||
$this->_tpl_vars[$tpl_var][] = &$value;
|
||||
}
|
||||
$this->_extract = true;
|
||||
}
|
||||
|
||||
|
||||
/*======================================================================*\
|
||||
Function: clear_assign()
|
||||
|
Reference in New Issue
Block a user