]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Issue #279 raises the point of missing newlines
authorMikael Nordfeldth <mmn@hethane.se>
Tue, 11 Jul 2017 19:58:24 +0000 (21:58 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Tue, 11 Jul 2017 19:58:24 +0000 (21:58 +0200)
lib/util.php

index e5cc78068860a00513429e970bda406356f0fbe9..b67df923d915ceb025a4994cad0290551c89ec01 100644 (file)
@@ -2611,6 +2611,9 @@ function common_log_delta($comment=null)
 
 function common_strip_html($html, $trim=true, $save_whitespace=false)
 {
+    // first replace <br /> with \n
+    $html = preg_replace('/\<(\s*)?br(\s*)?\/?(\s*)?\>/i', "\n", $html); 
+    // then, unless explicitly avoided, remove excessive whitespace
     if (!$save_whitespace) {
         $html = preg_replace('/\s+/', ' ', $html);
     }