X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fbb2diaspora.php;h=7107c4913950f130e3638c7cb59a40293b386af3;hb=9d920033e82a1108af93db2debad990c0851358a;hp=b70a056619f9b8f927fc53032982e11dd859bf7f;hpb=3600ab1ffcf637b1e170d364b792cce2fc77d87f;p=friendica.git
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index b70a056619..7107c49139 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -21,7 +21,7 @@ function diaspora2bb($s) {
$s = str_replace("\r","",$s);
//
is invalid. Replace it with the valid expression
- $s = str_replace(array("
", "
"),array("
", "
", "
"),$s);
+ $s = str_replace(array("
", "
", '
'),array("
", "
", "
", "
"),$s);
$s = preg_replace('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s);
@@ -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,12 +75,24 @@ 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("