You are here

function oembedprovider_formats in oEmbed 8

Same name and namespace in other branches
  1. 6.0 oembedprovider.module \oembedprovider_formats()
  2. 7 modules/oembedprovider/oembedprovider.inc \oembedprovider_formats()
  3. 7.0 oembedprovider/oembedprovider.inc \oembedprovider_formats()

Returns all the registered response formats

Return value

array

1 call to oembedprovider_formats()
oembedprovider_deliver_response in modules/oembedprovider/oembedprovider.inc
oEmbed response delivery callback.

File

modules/oembedprovider/oembedprovider.inc, line 108
Functions for the oEmbed provider

Code

function oembedprovider_formats($reset = FALSE) {
  $formats =& drupal_static(__FUNCTION__, array());
  if (!$formats) {
    $cache_key = 'oembedprovider:formats';
    if (!$reset && ($cache = cache_get($cache_key)) && isset($cache->data)) {
      $formats = $cache->data;
    }
    else {
      $formats = array(
        'json' => array(
          'mime' => 'application/json',
          'callback' => 'drupal_json_encode',
        ),
        'jsonp' => array(
          'mime' => 'text/javascript',
          'callback' => '_oembedprovider_formats_jsonp',
        ),
        'xml' => array(
          'mime' => 'text/xml',
          'callback' => '_oembedprovider_formats_xml',
        ),
      );
      drupal_alter('oembedprovider_formats', $formats);
      cache_set($cache_key, $formats);
    }
  }
  return $formats;
}