Issue #279 raises the point of missing newlines

This commit is contained in:
Mikael Nordfeldth 2017-07-11 21:58:24 +02:00
parent a75b1df627
commit 56e2b0007c
1 changed files with 3 additions and 0 deletions

View 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);
}