Skip to content

Commit

Permalink
ENHANCEMENT Oembed.enabled config property
Browse files Browse the repository at this point in the history
  • Loading branch information
chillu committed Jun 8, 2012
1 parent f7ac4e3 commit c0b3512
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions _config/Oembed.yml
Expand Up @@ -20,3 +20,5 @@ Oembed:
'https://api.twitter.com/1/statuses/oembed.json'
autodiscover:
true
enabled:
true
7 changes: 7 additions & 0 deletions oembed/Oembed.php
Expand Up @@ -13,6 +13,11 @@
*/

class Oembed {

public static function is_enabled() {
return Config::inst()->get('Oembed', 'enabled');
}

/**
* Gets the autodiscover setting from the config.
*/
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c0b3512

Please sign in to comment.