function video_embed_get_handler in Video Embed Field 7.2
Retrieves the video handler for a video URL.
Parameters
string $url: The video URL.
Return value
string|bool The handler name for the URL, FALSE in case there is no handler.
4 calls to video_embed_get_handler()
- template_preprocess_video_embed_field_embed_code in ./
video_embed_field.module - Processes variables to format a video player.
- video_embed_field_get_ajax_url in ./
video_embed_field.module - Generates the AJAX path array from the video URL and the video_style.
- video_embed_field_get_video_data in ./
video_embed_field.module - Gets a video data array for a given video url.
- video_embed_field_thumbnail_url in ./
video_embed_field.module - Gets the thumbnail url for a given video url.
File
- ./
video_embed_field.module, line 249 - Provides a simple field for easily embedding videos from youtube or vimeo
Code
function video_embed_get_handler($url) {
// Process video URL.
if (!stristr($url, 'http://') && !stristr($url, 'https://')) {
$url = 'http://' . $url;
}
$parts = parse_url($url);
if (!isset($parts['host'])) {
return FALSE;
}
$host = $parts['host'];
if (stripos($host, 'www.') > -1) {
$host = substr($host, 4);
}
$domains = _video_embed_field_get_provider_domains();
$handlers = video_embed_get_handlers();
if (isset($domains[$host])) {
$handler_name = $domains[$host];
$handler = $handlers[$handler_name];
$handler['name'] = $handler_name;
return $handler;
}
else {
return FALSE;
}
}