You are here

function emapi_parse in Embedded Media Field 6.3

Parses a URL or embed code into a media object.

Parameters

string $url: The URL or embed code to parse.

Return value

mixed The fully populated media object, or FALSE.

1 call to emapi_parse()
emapi_parse_json in emapi/includes/emapi.parse.inc
Callback for /emapi/parse/json.

File

emapi/emapi.module, line 215
Provides an API for parsing, storage, and display of third party media.

Code

function emapi_parse($url) {
  foreach (emapi_get_provider_classes() as $class) {
    if (class_exists($class['class_name'])) {
      $media = new $class['class_name']();
      if ($media
        ->parse($url)) {
        $media = emapi_media_from_uri($media->uri);
        return $media;
      }
    }
  }
  return FALSE;
}