mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-07-05 07:54:24 +03:00
improved func_htmlSpecialChars array walker
This commit is contained in:
parent
67d78e0ded
commit
707c587d13
|
@ -130,20 +130,20 @@ function func_generator($iLength=10) {
|
|||
/**
|
||||
* htmlspecialchars умеющая обрабатывать массивы
|
||||
*
|
||||
* @param unknown_type $data
|
||||
* @param mixed $data
|
||||
* @param int %walkIndex - represents the key/index of the array being recursively htmlspecialchars'ed
|
||||
* @return void
|
||||
*/
|
||||
function func_htmlspecialchars(&$data) {
|
||||
if (is_array($data)) {
|
||||
foreach ($data as $sKey => $value) {
|
||||
if (is_array($value)) {
|
||||
func_htmlspecialchars($data[$sKey]);
|
||||
} else {
|
||||
$data[$sKey]=htmlspecialchars($value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$data=htmlspecialchars($data);
|
||||
function func_htmlspecialchars(&$data, $walkIndex = null)
|
||||
{
|
||||
if (!is_array($data))
|
||||
{
|
||||
$data = htmlspecialchars(&$data);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
array_walk($data, __FUNCTION__);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue