mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT Oembed.enabled config property
This commit is contained in:
parent
f7ac4e34e7
commit
c0b3512fd4
@ -20,3 +20,5 @@ Oembed:
|
|||||||
'https://api.twitter.com/1/statuses/oembed.json'
|
'https://api.twitter.com/1/statuses/oembed.json'
|
||||||
autodiscover:
|
autodiscover:
|
||||||
true
|
true
|
||||||
|
enabled:
|
||||||
|
true
|
@ -13,6 +13,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class Oembed {
|
class Oembed {
|
||||||
|
|
||||||
|
public static function is_enabled() {
|
||||||
|
return Config::inst()->get('Oembed', 'enabled');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the autodiscover setting from the config.
|
* Gets the autodiscover setting from the config.
|
||||||
*/
|
*/
|
||||||
@ -111,6 +116,8 @@ class Oembed {
|
|||||||
* @returns Oembed_Result/bool An Oembed descriptor, or false
|
* @returns Oembed_Result/bool An Oembed descriptor, or false
|
||||||
*/
|
*/
|
||||||
public static function get_oembed_from_url($url, $type = false, array $options = array()) {
|
public static function get_oembed_from_url($url, $type = false, array $options = array()) {
|
||||||
|
if(!self::is_enabled()) return false;
|
||||||
|
|
||||||
// Find or build the Oembed URL.
|
// Find or build the Oembed URL.
|
||||||
$endpoint = self::find_endpoint($url);
|
$endpoint = self::find_endpoint($url);
|
||||||
$oembedUrl = false;
|
$oembedUrl = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user