mirror of
https://github.com/friendica/friendica
synced 2025-04-22 13:10:11 +00:00
The title of bookmark links is now taken instead of the data that was fetched via oembed
This commit is contained in:
parent
25237c0929
commit
72eee45b92
2 changed files with 23 additions and 4 deletions
|
@ -64,7 +64,7 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
|
|||
else {
|
||||
$text = sprintf('<span class="type-%s">', $type);
|
||||
|
||||
$bookmark = array(sprintf('[bookmark=%s]%s[/bookmark]', $url, $title), $title, $url);
|
||||
$bookmark = array(sprintf('[bookmark=%s]%s[/bookmark]', $url, $title), $url, $title);
|
||||
if ($tryoembed)
|
||||
$oembed = tryoembed($bookmark);
|
||||
else
|
||||
|
@ -197,7 +197,8 @@ function stripcode_br_cb($s) {
|
|||
}
|
||||
|
||||
function tryoembed($match){
|
||||
$url = ((count($match)==2)?$match[1]:$match[2]);
|
||||
//$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/"),
|
||||
|
@ -207,6 +208,9 @@ function tryoembed($match){
|
|||
|
||||
$o = oembed_fetch_url($url);
|
||||
|
||||
if (isset($match[2]))
|
||||
$o->title = $match[2];
|
||||
|
||||
//echo "<pre>"; var_dump($match, $url, $o); killme();
|
||||
|
||||
if ($o->type=="error") return $match[0];
|
||||
|
@ -792,7 +796,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
|
||||
// Perform URL Search
|
||||
if ($tryoembed)
|
||||
$Text = preg_replace_callback("/\[bookmark\=([^\]]*)\].*?\[\/bookmark\]/ism",'tryoembed',$Text);
|
||||
$Text = preg_replace_callback("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",'tryoembed',$Text);
|
||||
|
||||
if ($simplehtml == 5)
|
||||
$Text = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",'[url]$1[/url]',$Text);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue