From 707c587d136cbf556a080f4d08ab1516c4bb9a5b Mon Sep 17 00:00:00 2001 From: Alexander Raskin Date: Wed, 8 Feb 2012 01:35:47 +0200 Subject: [PATCH] improved func_htmlSpecialChars array walker --- engine/include/function.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/engine/include/function.php b/engine/include/function.php index 8f55f224..4d8b4bb6 100644 --- a/engine/include/function.php +++ b/engine/include/function.php @@ -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__); } /**