From b857717fa6532611c4bfe5ff184781a0a795c6b6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 19 Mar 2007 16:38:32 +0000 Subject: [PATCH] Ajout de la fonction clean_html qui permettra de nettoyer le code html lors de l'exportation au format XLS ou CVS pour les accents ou lorsqu'on utilise Fckeditor --- htdocs/lib/functions.inc.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index c027ecad58f..0de18110f6f 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -2300,11 +2300,20 @@ function weight_units_string($unit) \brief Nettoie le code HTML \param string StringHtml \return string CleanString - \todo nettoyer les balises html */ function clean_html($StringHtml) { - $CleanString = html_entity_decode($StringHtml); + $pattern = "<[^>]+>"; + $temp = html_entity_decode($StringHtml); + $temp = ereg_replace($pattern,"",$temp); + // Supprime aussi les retours + $temp=str_replace("\n"," ",$temp); + // et les espaces doubles + while(STRPOS($temp," ")) + { + $temp = STR_REPLACE(" "," ",$temp); + } + $CleanString = $temp; return $CleanString; }