From 7b26aa2b84d5679168cfa0b61d3329a173377cce Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 1 Dec 2014 22:45:13 +0100 Subject: [PATCH] When exporting shared posts to diaspora now removed hashtags will be added again. --- include/bb2diaspora.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 39742291fd..d836f325e8 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -56,6 +56,8 @@ function diaspora2bb($s) { function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) { + $OriginalText = $Text; + // Since Diaspora is creating a summary for links, this function removes them before posting if ($fordiaspora) $Text = bb_remove_share_information($Text); @@ -73,9 +75,20 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) { $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $Text); // Convert it to HTML - don't try oembed - if ($fordiaspora) + if ($fordiaspora) { $Text = bbcode($Text, $preserve_nl, false, 3); - else { + + // Add all tags that maybe were removed + if (preg_match_all("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",$OriginalText, $tags)) { + $tagline = ""; + foreach($tags[2] as $tag) + if (!strpos($Text, "#".$tag)) + $tagline .= "#".$tag." "; + + $Text = $Text."
".$tagline; + } + + } else { $Text = bbcode($Text, $preserve_nl, false, 4); // Libertree doesn't convert a harizontal rule if there isn't a linefeed $Text = str_replace("
", "

", $Text); -- 2.39.5