mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-15 15:09:51 +01:00
- change of filenames in sysplugins folder for internal spl_autoload function
- lexer/parser changed for increased compilation speed
This commit is contained in:
37
libs/sysplugins/smarty_method_clear_assign.php
Normal file
37
libs/sysplugins/smarty_method_clear_assign.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty method Clear_Assign
|
||||
*
|
||||
* Deletes a assigned Smarty variable or array of variables at current level
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage SmartyMethod
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* Delete a Smarty variable or array of variables
|
||||
*
|
||||
* @param object $smarty
|
||||
* @param string $ |array $varname variable name or array of variable names
|
||||
* @param object $data_object object which holds tpl_vars
|
||||
*/
|
||||
function clear_assign($smarty, $varname, $data_object = null)
|
||||
{
|
||||
foreach ((array)$varname as $variable) {
|
||||
if (isset($data_object)) {
|
||||
$ptr = $data_object;
|
||||
} else {
|
||||
$ptr = $smarty;
|
||||
} while ($ptr != null) {
|
||||
if (isset($ptr->tpl_vars[$variable])) {
|
||||
unset($ptr->tpl_vars[$variable]);
|
||||
}
|
||||
$ptr = $ptr->parent;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user