From 7900c5e550acafaf0b877635840a8a270eb06078 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 12 Aug 2014 21:56:34 +0200 Subject: Move htmlspecialchars_utf8 from Request to Helper And remove html_chars_utf8 to use htmlspecialchars_utf8 instead in importExportController --- lib/Minz/Helper.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/Minz/Helper.php') diff --git a/lib/Minz/Helper.php b/lib/Minz/Helper.php index b058211d3..13bfdd93e 100644 --- a/lib/Minz/Helper.php +++ b/lib/Minz/Helper.php @@ -19,4 +19,15 @@ class Minz_Helper { return stripslashes($var); } } + + /** + * Wrapper for htmlspecialchars. + * Force UTf-8 value and can be used on array too. + */ + public static function htmlspecialchars_utf8($p) { + if (is_array($p)) { + return array_map('self::htmlspecialchars_utf8', $p); + } + return htmlspecialchars($p, ENT_COMPAT, 'UTF-8'); + } } -- cgit v1.2.3 From 93b2a5f240b061103fce5cf563a3cd5cae2c6bfe Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 12 Aug 2014 21:59:07 +0200 Subject: Coding style in Minz_Helper --- lib/Minz/Helper.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/Minz/Helper.php') diff --git a/lib/Minz/Helper.php b/lib/Minz/Helper.php index 13bfdd93e..8d8b177ae 100644 --- a/lib/Minz/Helper.php +++ b/lib/Minz/Helper.php @@ -12,9 +12,9 @@ class Minz_Helper { * Annule les effets des magic_quotes pour une variable donnée * @param $var variable à traiter (tableau ou simple variable) */ - public static function stripslashes_r ($var) { - if (is_array ($var)){ - return array_map (array ('Helper', 'stripslashes_r'), $var); + public static function stripslashes_r($var) { + if (is_array($var)){ + return array_map(array('Helper', 'stripslashes_r'), $var); } else { return stripslashes($var); } @@ -24,10 +24,10 @@ class Minz_Helper { * Wrapper for htmlspecialchars. * Force UTf-8 value and can be used on array too. */ - public static function htmlspecialchars_utf8($p) { - if (is_array($p)) { - return array_map('self::htmlspecialchars_utf8', $p); + public static function htmlspecialchars_utf8($var) { + if (is_array($var)) { + return array_map(array('Helper', 'htmlspecialchars_utf8'), $var); } - return htmlspecialchars($p, ENT_COMPAT, 'UTF-8'); + return htmlspecialchars($var, ENT_COMPAT, 'UTF-8'); } } -- cgit v1.2.3 From f2b1826b475a7ad71ee68b13d22c03259e631195 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 12 Aug 2014 22:27:07 +0200 Subject: Fix missing Minz_ prefix in Minz_Helper Nice bug :) It means another hidden bug is now corrected! --- lib/Minz/Helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/Minz/Helper.php') diff --git a/lib/Minz/Helper.php b/lib/Minz/Helper.php index 8d8b177ae..f4a547c4e 100644 --- a/lib/Minz/Helper.php +++ b/lib/Minz/Helper.php @@ -14,7 +14,7 @@ class Minz_Helper { */ public static function stripslashes_r($var) { if (is_array($var)){ - return array_map(array('Helper', 'stripslashes_r'), $var); + return array_map(array('Minz_Helper', 'stripslashes_r'), $var); } else { return stripslashes($var); } @@ -26,7 +26,7 @@ class Minz_Helper { */ public static function htmlspecialchars_utf8($var) { if (is_array($var)) { - return array_map(array('Helper', 'htmlspecialchars_utf8'), $var); + return array_map(array('Minz_Helper', 'htmlspecialchars_utf8'), $var); } return htmlspecialchars($var, ENT_COMPAT, 'UTF-8'); } -- cgit v1.2.3