From c0b3512fd44b5f5e81cfad7acba0301ae8b06520 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 8 Jun 2012 18:30:02 +0200 Subject: [PATCH] ENHANCEMENT Oembed.enabled config property --- _config/Oembed.yml | 2 ++ oembed/Oembed.php | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/_config/Oembed.yml b/_config/Oembed.yml index 41226d09b..cbea56f9d 100644 --- a/_config/Oembed.yml +++ b/_config/Oembed.yml @@ -20,3 +20,5 @@ Oembed: 'https://api.twitter.com/1/statuses/oembed.json' autodiscover: true + enabled: + true \ No newline at end of file diff --git a/oembed/Oembed.php b/oembed/Oembed.php index f07fe53a4..7017a3d24 100644 --- a/oembed/Oembed.php +++ b/oembed/Oembed.php @@ -13,6 +13,11 @@ */ class Oembed { + + public static function is_enabled() { + return Config::inst()->get('Oembed', 'enabled'); + } + /** * Gets the autodiscover setting from the config. */ @@ -111,6 +116,8 @@ class Oembed { * @returns Oembed_Result/bool An Oembed descriptor, or false */ 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. $endpoint = self::find_endpoint($url); $oembedUrl = false;