From 209343d883d59dd7dd4c97056e32d6fdeae7ccec Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 24 Aug 2013 14:54:07 +0200 Subject: [PATCH] If "remove_multiplicated_lines" is set then some more linefeeds in lists are removed. --- include/bbcode.php | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/include/bbcode.php b/include/bbcode.php index 62759d192e..a536b53649 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -423,8 +423,8 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal // removing multiplicated newlines if (get_config("system", "remove_multiplicated_lines")) { - $search = array("\n\n\n", "\n ", " \n", "[/quote]\n\n", "\n[/quote]"); - $replace = array("\n\n", "\n", "\n", "[/quote]\n", "[/quote]"); + $search = array("\n\n\n", "\n ", " \n", "[/quote]\n\n", "\n[/quote]", "[/li]\n", "\n[li]", "\n[ul]", "[/ul]\n"); + $replace = array("\n\n", "\n", "\n", "[/quote]\n", "[/quote]", "[/li]", "[li]", "[ul]", "[/ul]"); do { $oldtext = $Text; $Text = str_replace($search, $replace, $Text); @@ -713,22 +713,29 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal // Only do it when it has to be done - for performance reasons // Update: Now it is done every time - since bad structured html can break a whole page //if (!$tryoembed) { -// $doc = new DOMDocument(); -// $doc->preserveWhiteSpace = false; + // $doc = new DOMDocument(); + // $doc->preserveWhiteSpace = false; -// $Text = mb_convert_encoding($Text, 'HTML-ENTITIES', "UTF-8"); + // $Text = mb_convert_encoding($Text, 'HTML-ENTITIES', "UTF-8"); -// $doctype = ''; -// @$doc->loadHTML($doctype."".$Text.""); + // $doctype = ''; + // @$doc->loadHTML($doctype."".$Text.""); -// $Text = $doc->saveHTML(); -// $Text = str_replace(array("", "", $doctype), array("", "", ""), $Text); + // $Text = $doc->saveHTML(); + // $Text = str_replace(array("", "", $doctype), array("", "", ""), $Text); -// $Text = str_replace('
','', $Text); + // $Text = str_replace('
','', $Text); -// $Text = mb_convert_encoding($Text, "UTF-8", 'HTML-ENTITIES'); + // $Text = mb_convert_encoding($Text, "UTF-8", 'HTML-ENTITIES'); //} + // Clean up some useless linebreaks in lists + //$Text = str_replace('

','', $Text); + //$Text = str_replace('
','', $Text); + //$Text = str_replace('
  • ','
  • ', $Text); + // $Text = str_replace('