function hook_media_parse

cis7 media.api.php hook_media_parse($url)
cle7 media.api.php hook_media_parse($url)
elmsmedia7 media.api.php hook_media_parse($url)
icor7 media.api.php hook_media_parse($url)
meedjum_blog7 media.api.php hook_media_parse($url)
mooc7 media.api.php hook_media_parse($url)

Parses a url or embedded code into a unique URI.

Parameters

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

Return value

array The unique URI for the file, based on its stream wrapper, or NULL.

See also

media_parse_to_file()

media_add_from_url_validate()

1 invocation of hook_media_parse()
media_parse_to_uri in sites/all/modules/ulmus/media/media.module
This will parse a url or embedded code into a unique URI.

File

sites/all/modules/ulmus/media/media.api.php, line 20
Hooks provided by the Media module.

Code

function hook_media_parse($url) {
  // Only parse URLs from our website of choice: examplevideo.com
  if (substr($url, 0, 27) == 'http://www.examplevideo.com') {
    // Each video has a 5 digit ID, i.e. http://www.examplevideo.com/12345
    // Grab the ID and use it in our URI.
    $id = substr($url, 28, 33);
    return file_stream_wrapper_uri_normalize('examplevideo://video/' . $id);
  }
}