Helper.php 847 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * MINZ - Copyright 2011 Marien Fressinaud
  4. * Sous licence AGPL3 <http://www.gnu.org/licenses/>
  5. */
  6. /**
  7. * La classe Helper représente une aide pour des tâches récurrentes
  8. */
  9. class Minz_Helper {
  10. /**
  11. * Annule les effets des magic_quotes pour une variable donnée
  12. * @param $var variable à traiter (tableau ou simple variable)
  13. */
  14. public static function stripslashes_r($var) {
  15. if (is_array($var)){
  16. return array_map(array('Minz_Helper', 'stripslashes_r'), $var);
  17. } else {
  18. return stripslashes($var);
  19. }
  20. }
  21. /**
  22. * Wrapper for htmlspecialchars.
  23. * Force UTf-8 value and can be used on array too.
  24. */
  25. public static function htmlspecialchars_utf8($var) {
  26. if (is_array($var)) {
  27. return array_map(array('Minz_Helper', 'htmlspecialchars_utf8'), $var);
  28. }
  29. return htmlspecialchars($var, ENT_COMPAT, 'UTF-8');
  30. }
  31. }