Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ENHANCEMENT Oembed.enabled config property

  • Loading branch information...
commit c0b3512fd44b5f5e81cfad7acba0301ae8b06520 1 parent f7ac4e3
@chillu chillu authored
Showing with 9 additions and 0 deletions.
  1. +2 −0  _config/Oembed.yml
  2. +7 −0 oembed/Oembed.php
View
2  _config/Oembed.yml
@@ -20,3 +20,5 @@ Oembed:
'https://api.twitter.com/1/statuses/oembed.json'
autodiscover:
true
+ enabled:
+ true
View
7 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 @@ protected static function autodiscover_from_url($url) {
* @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;
Please sign in to comment.
Something went wrong with that request. Please try again.