diff options
Diffstat (limited to 'application/Utils.php')
-rw-r--r-- | application/Utils.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/application/Utils.php b/application/Utils.php index bcf5bdb5..5b8ca508 100644 --- a/application/Utils.php +++ b/application/Utils.php | |||
@@ -63,14 +63,22 @@ function endsWith($haystack, $needle, $case=true) | |||
63 | 63 | ||
64 | /** | 64 | /** |
65 | * Htmlspecialchars wrapper | 65 | * Htmlspecialchars wrapper |
66 | * Support multidimensional array of strings. | ||
66 | * | 67 | * |
67 | * @param string $str the string to escape. | 68 | * @param mixed $input Data to escape: a single string or an array of strings. |
68 | * | 69 | * |
69 | * @return string escaped. | 70 | * @return string escaped. |
70 | */ | 71 | */ |
71 | function escape($str) | 72 | function escape($input) |
72 | { | 73 | { |
73 | return htmlspecialchars($str, ENT_COMPAT, 'UTF-8', false); | 74 | if (is_array($input)) { |
75 | $out = array(); | ||
76 | foreach($input as $key => $value) { | ||
77 | $out[$key] = escape($value); | ||
78 | } | ||
79 | return $out; | ||
80 | } | ||
81 | return htmlspecialchars($input, ENT_COMPAT, 'UTF-8', false); | ||
74 | } | 82 | } |
75 | 83 | ||
76 | /** | 84 | /** |