From 14ea4b972ecddbf66f9661a62983e007a452b700 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 2 Nov 2014 17:35:49 +0100 Subject: [PATCH] BBCode: Newlines under attachments are now removed --- include/bbcode.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/include/bbcode.php b/include/bbcode.php index 8efeabb8bf..ee607cf6a9 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -825,9 +825,6 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal // Rearrange shares to attachments $Text = preg_replace_callback("((.*?)\[class=(.*?)\](.*?)\[\/class\])ism", "bb_rearrange_share",$Text); - // Handle attached links or videos - $Text = bb_attachment($Text, ($simplehtml != 4) AND ($simplehtml != 0), $tryoembed); - // Rearrange shared links // if (get_config("system", "rearrange_shared_links") AND (!$simplehtml OR $tryoembed)) // $Text = preg_replace_callback("(\[class=(.*?)\](.*?)\[\/class\])ism","bb_rearrange_link",$Text); @@ -848,8 +845,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]", "[/li]\n", "\n[li]", "\n[ul]", "[/ul]\n", "\n\n[share "); - $replace = array("\n\n", "\n", "\n", "[/quote]\n", "[/quote]", "[/li]", "[li]", "[ul]", "[/ul]", "\n[share "); + $search = array("\n\n\n", "\n ", " \n", "[/quote]\n\n", "\n[/quote]", "[/li]\n", "\n[li]", "\n[ul]", "[/ul]\n", "\n\n[share ", "[/attachment]\n"); + $replace = array("\n\n", "\n", "\n", "[/quote]\n", "[/quote]", "[/li]", "[li]", "[ul]", "[/ul]", "\n[share ", "[/attachment]"); do { $oldtext = $Text; $Text = str_replace($search, $replace, $Text); @@ -861,7 +858,8 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal if($preserve_nl) $Text = str_replace(array("\n","\r"), array('',''),$Text); - + // Handle attached links or videos + $Text = bb_attachment($Text, ($simplehtml != 4) AND ($simplehtml != 0), $tryoembed); // Set up the parameters for a URL search string $URLSearchString = "^\[\]";