From 56e2b0007c00b85b80c85da072def1f9e832e05b Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Tue, 11 Jul 2017 21:58:24 +0200 Subject: [PATCH] Issue #279 raises the point of missing newlines --- lib/util.php | 3 +++ 1 file changed, 3 insertions(+) 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
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); }