You are here

function emfield_media in Embedded Media Field 6.2

Builds and returns a media object based on the parsed URL.

File

./emfield.module, line 986
Embedded Media Field is a CCK-based framework for 3rd party media files.

Code

function emfield_media($url, $overrides = array()) {
  global $emfield_registered_classes;

  // First parse the URL.
  foreach ($emfield_registered_classes as $provider => $class) {
    if ($class['parse callback'] && $class['class_name']) {
      if ($parsed = $class['parse callback']($url, $overrides)) {

        // If we have a provider class, then implement and return it.
        return new $class['class_name']($parsed['code'], $overrides);
      }
    }
  }
}