Fall back to normal twitter share if rich OEmbed is disabled
- Fix typo
This commit is contained in:
parent
9e54d8d4b4
commit
1cd8001833
2 changed files with 23 additions and 22 deletions
|
@ -586,8 +586,8 @@ function bb_ShareAttributes($share, $simplehtml)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Transforms quoted tweets in rich attachments to avoid nested tweetsx
|
// Transforms quoted tweets in rich attachments to avoid nested tweets
|
||||||
if (stripos(normalise_link($link), 'http://twitter.com/') === 0) {
|
if (stripos(normalise_link($link), 'http://twitter.com/') === 0 && OEmbed::isAllowedURL($link)) {
|
||||||
$bookmark = array(sprintf('[bookmark=%s]%s[/bookmark]', $link, $preshare), $link, $preshare);
|
$bookmark = array(sprintf('[bookmark=%s]%s[/bookmark]', $link, $preshare), $link, $preshare);
|
||||||
$text = $preshare . tryoembed($bookmark);
|
$text = $preshare . tryoembed($bookmark);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -284,6 +284,27 @@ class OEmbed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines if rich content OEmbed is allowed for the provided URL
|
||||||
|
*
|
||||||
|
* @brief Determines if rich content OEmbed is allowed for the provided URL
|
||||||
|
* @param string $url
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function isAllowedURL($url)
|
||||||
|
{
|
||||||
|
if (!Config::get('system', 'no_oembed_rich_content')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$domain = parse_url($url, PHP_URL_HOST);
|
||||||
|
|
||||||
|
$str_allowed = Config::get('system', 'allowed_oembed', '');
|
||||||
|
$allowed = explode(',', $str_allowed);
|
||||||
|
|
||||||
|
return allowed_domain($domain, $allowed, true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Generates the iframe HTML for an oembed attachment.
|
* @brief Generates the iframe HTML for an oembed attachment.
|
||||||
*
|
*
|
||||||
|
@ -352,24 +373,4 @@ class OEmbed
|
||||||
return $innerHTML;
|
return $innerHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines if rich content OEmbed is allowed for the provided URL
|
|
||||||
*
|
|
||||||
* @brief Determines if rich content OEmbed is allowed for the provided URL
|
|
||||||
* @param string $url
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
private static function isAllowedURL($url)
|
|
||||||
{
|
|
||||||
if (!Config::get('system', 'no_oembed_rich_content')) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$domain = parse_url($url, PHP_URL_HOST);
|
|
||||||
|
|
||||||
$str_allowed = Config::get('system', 'allowed_oembed', '');
|
|
||||||
$allowed = explode(',', $str_allowed);
|
|
||||||
|
|
||||||
return allowed_domain($domain, $allowed, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue