]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
Unifying HTML stripping functions to common_strip_html
[quix0rs-gnu-social.git] / lib / util.php
index dd4be87849510dd7027e1d992ae05b8445c7a39b..fd89bb491cd44d2e3351854ae16654029b783ae1 100644 (file)
@@ -2360,3 +2360,12 @@ function common_log_delta($comment=null)
 
     common_debug(sprintf("%s: %d %d", $comment, $mtotal, round($ttotal * 1000000)));
 }
+
+function common_strip_html($html, $trim=true, $save_whitespace=false)
+{
+    if (!$save_whitespace) {
+        $html = preg_replace('/\s+/', ' ', $html);
+    }
+    $text = html_entity_decode(strip_tags($html), ENT_QUOTES, 'UTF-8');
+    return $trim ? trim($text) : $text;
+}