Fix Twitter quote tweet display

- Transforms twitter share tags into rich OEmbed attachments
This commit is contained in:
Hypolite Petovan 2018-01-06 00:39:59 -05:00
parent 9593cac2d1
commit 9e54d8d4b4

View File

@ -76,7 +76,7 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) {
$oembed = $bookmark[0];
}
if (strstr(strtolower($oembed), "<iframe ")) {
if (stripos($oembed, "<iframe ") !== false) {
$text = $oembed;
} else {
if (($data["image"] != "") && !strstr(strtolower($oembed), "<img ")) {
@ -541,7 +541,7 @@ function bb_ShareAttributes($share, $simplehtml)
$text .= "<hr />";
}
if (substr(normalise_link($link), 0, 19) != "http://twitter.com/") {
if (stripos(normalise_link($link), 'http://twitter.com/') === 0) {
$text .= $headline . '<blockquote>' . trim($share[3]) . "</blockquote><br />";
if ($link != "") {
@ -586,6 +586,11 @@ function bb_ShareAttributes($share, $simplehtml)
}
break;
default:
// Transforms quoted tweets in rich attachments to avoid nested tweetsx
if (stripos(normalise_link($link), 'http://twitter.com/') === 0) {
$bookmark = array(sprintf('[bookmark=%s]%s[/bookmark]', $link, $preshare), $link, $preshare);
$text = $preshare . tryoembed($bookmark);
} else {
$text = trim($share[1]) . "\n";
$avatar = proxy_url($avatar, false, PROXY_SIZE_THUMB);
@ -600,6 +605,7 @@ function bb_ShareAttributes($share, $simplehtml)
'$content' => trim($share[3])
)
);
}
break;
}