From: Mikael Nordfeldth <mmn@hethane.se>
Date: Tue, 11 Jul 2017 19:58:24 +0000 (+0200)
Subject: Issue #279 raises the point of missing newlines
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=56e2b0007c00b85b80c85da072def1f9e832e05b;p=quix0rs-gnu-social.git

Issue #279 raises the point of missing newlines
---

diff --git a/lib/util.php b/lib/util.php
index e5cc780688..b67df923d9 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -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);
     }