X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fbbcode.php;h=6a44e19ec446e87bcef9b83f53cab95d4af85299;hb=c5f2157eb2914de06ae098907b1dfb68fc4d03e3;hp=98c1f11991208e35ce0bcb4c94aad011dfd77c53;hpb=643e228d6bee06ba354fe55df2ad9444678595e3;p=friendica.git diff --git a/include/bbcode.php b/include/bbcode.php index 98c1f11991..6a44e19ec4 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -3,6 +3,7 @@ require_once("include/oembed.php"); require_once('include/event.php'); require_once('include/map.php'); require_once('mod/proxy.php'); +require_once('include/Contact.php'); function bb_PictureCacheExt($matches) { if (strpos($matches[3], "data:image/") === 0) @@ -101,9 +102,13 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) { if ($simplehtml == 7) { $title2 = $title; + + $test1 = trim(html_entity_decode($match[1],ENT_QUOTES,'UTF-8')); + $test2 = trim(html_entity_decode($title,ENT_QUOTES,'UTF-8')); + // If the link description is similar to the text above then don't add the link description - if (($title != "") AND ((strpos($match[1],$title) !== false) OR - (similar_text($match[1],$title) / strlen($title)) > 0.9)) + if (($title != "") AND ((strpos($test1,$test2) !== false) OR + (similar_text($test1,$test2) / strlen($title)) > 0.9)) $title2 = $url; $text = sprintf('%s
', $url, $title, $title2); @@ -297,14 +302,12 @@ function bb_onelinecode_cb($match) { } function tryoembed($match){ - //$url = ((count($match)==2)?$match[1]:$match[2]); $url = $match[1]; // Always embed the SSL version $url = str_replace(array("http://www.youtube.com/", "http://player.vimeo.com/"), array("https://www.youtube.com/", "https://player.vimeo.com/"), $url); - //logger("tryoembed: $url"); $o = oembed_fetch_url($url); @@ -314,7 +317,7 @@ function tryoembed($match){ if ($o->type=="error") return $match[0]; $html = oembed_format_object($o); - return $html; //oembed_iframe($html,$o->width,$o->height); + return $html; } @@ -539,8 +542,23 @@ function bb_ShareAttributes($share, $simplehtml) { $reldate = (($posted) ? " " . relative_date($posted) : ''); } - $userid = GetProfileUsername($profile,$author, false); - $userid_compact = GetProfileUsername($profile,$author, true); + $data = get_contact_details_by_url($profile); + + if (isset($data["name"]) AND isset($data["addr"])) + $userid_compact = $data["name"]." (".$data["addr"].")"; + else + $userid_compact = GetProfileUsername($profile,$author, true); + + if (isset($data["addr"])) + $userid = $data["addr"]; + else + $userid = GetProfileUsername($profile,$author, false); + + if (isset($data["name"])) + $author = $data["name"]; + + if (isset($data["photo"])) + $avatar = $data["photo"]; $preshare = trim($share[1]); @@ -955,14 +973,14 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal $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 ($simplehtml != 7) { +// if ($simplehtml != 7) { if (!$forplaintext) $Text = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1$2', $Text); else { $Text = preg_replace("(\[url\]([$URLSearchString]*)\[\/url\])ism"," $1 ",$Text); $Text = preg_replace_callback("&\[url=([^\[\]]*)\]\[img\](.*)\[\/img\]\[\/url\]&Usi", 'bb_RemovePictureLinks', $Text); } - } +// } if ($tryoembed) $Text = preg_replace_callback("/\[url\]([$URLSearchString]*)\[\/url\]/ism",'tryoembed',$Text);