Skip to content
This repository
Browse code

ENHANCEMENT Oembed.enabled config property

  • Loading branch information...
commit c0b3512fd44b5f5e81cfad7acba0301ae8b06520 1 parent f7ac4e3
Ingo Schommer authored June 08, 2012
2  _config/Oembed.yml
@@ -20,3 +20,5 @@ Oembed:
20 20
       'https://api.twitter.com/1/statuses/oembed.json'
21 21
   autodiscover:
22 22
     true
  23
+  enabled:
  24
+    true
7  oembed/Oembed.php
@@ -13,6 +13,11 @@
13 13
  */
14 14
 
15 15
 class Oembed {
  16
+
  17
+	public static function is_enabled() {
  18
+		return Config::inst()->get('Oembed', 'enabled');
  19
+	}
  20
+
16 21
 	/**
17 22
 	 * Gets the autodiscover setting from the config.
18 23
 	 */
@@ -111,6 +116,8 @@ protected static function autodiscover_from_url($url) {
111 116
 	 * @returns Oembed_Result/bool An Oembed descriptor, or false
112 117
 	 */
113 118
 	public static function get_oembed_from_url($url, $type = false, array $options = array()) {
  119
+		if(!self::is_enabled()) return false;
  120
+
114 121
 		// Find or build the Oembed URL.
115 122
 		$endpoint = self::find_endpoint($url);
116 123
 		$oembedUrl = false;

0 notes on commit c0b3512

Please sign in to comment.
Something went wrong with that request. Please try again.