From: Michael Vogel Date: Mon, 2 Feb 2015 19:26:05 +0000 (+0100) Subject: Diaspora internal GUID links are now converted correctly. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=46dd453e5bfbe1d36061b0c2b6a131b0c0082d51;p=friendica.git Diaspora internal GUID links are now converted correctly. --- diff --git a/include/bbcode.php b/include/bbcode.php index c2ebf35e63..c08c6d4d95 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -664,6 +664,12 @@ function GetProfileUsername($profile, $username, $compact = false, $getnetwork = return($username); } +function bb_DiasporaLinks($match) { + $a = get_app(); + + return "[url=".$a->get_baseurl()."/display/".$match[1]."]".$match[2]."[/url]"; +} + function bb_RemovePictureLinks($match) { $text = Cache::get($match[1]); @@ -880,6 +886,9 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal else $Text = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",'[url=$1]$2[/url]',$Text); + // Handle Diaspora posts + $Text = preg_replace_callback("&\[url=/posts/([^\[\]]*)\](.*)\[\/url\]&Usi", 'bb_DiasporaLinks', $Text); + // if the HTML is used to generate plain text, then don't do this search, but replace all URL of that kind to text if (!$forplaintext) $Text = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1$2', $Text);