You are here

function oembedprovider_formats in oEmbed 6.0

Same name and namespace in other branches
  1. 8 modules/oembedprovider/oembedprovider.inc \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_handle_request in ./oembedprovider.inc
Callback handler for oembed requests.

File

./oembedprovider.module, line 93
Module for providing content as defined in the oEmbed specification

Code

function oembedprovider_formats() {
  static $formats;
  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' => 'text/javascript',
          'callback' => '_oembedprovider_formats_json',
        ),
        'xml' => array(
          'mime' => 'text/xml',
          'callback' => '_oembedprovider_formats_xml',
        ),
      );
      drupal_alter('oembedprovider_formats', $formats);
      cache_set($cache_key, $formats);
    }
  }
  return $formats;
}