Diaspora internal GUID links are now converted correctly.

This commit is contained in:
Michael Vogel 2015-02-02 20:26:05 +01:00
parent 86afc21841
commit 46dd453e5b

View file

@ -664,6 +664,12 @@ function GetProfileUsername($profile, $username, $compact = false, $getnetwork =
return($username); return($username);
} }
function bb_DiasporaLinks($match) {
$a = get_app();
return "[url=".$a->get_baseurl()."/display/".$match[1]."]".$match[2]."[/url]";
}
function bb_RemovePictureLinks($match) { function bb_RemovePictureLinks($match) {
$text = Cache::get($match[1]); $text = Cache::get($match[1]);
@ -880,6 +886,9 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
else else
$Text = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",'[url=$1]$2[/url]',$Text); $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 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) if (!$forplaintext)
$Text = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1<a href="$2" target="_blank">$2</a>', $Text); $Text = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1<a href="$2" target="_blank">$2</a>', $Text);