function _video_embed_facebook_get_video_id in Video Embed Field 7.2
Helper function to get the Facebook video's id.
Parameters
string $url: The video URL.
Return value
string|bool The video ID, or FALSE in case the ID can't be retrieved from the URL.
2 calls to _video_embed_facebook_get_video_id()
- video_embed_facebook_handle_thumbnail in video_embed_facebook/
video_embed_facebook.module - Gets the thumbnail url for Facebook videos.
- video_embed_facebook_handle_video in video_embed_facebook/
video_embed_facebook.module - Handler for Facebook videos.
File
- video_embed_facebook/
video_embed_facebook.module, line 146 - Adds a handler for Facebook videos to Video Embed Field.
Code
function _video_embed_facebook_get_video_id($url) {
// Parse_url is an easy way to break a url into its components.
$matches = array();
preg_match('/(?:.*)(?:v=|video_id=|videos\\/|videos\\/v.\\.\\d+\\/)(\\d+).*/', $url, $matches);
// If the v or video_id get parameters are set, return it.
if ($matches && !empty($matches[1])) {
return check_plain($matches[1]);
}
// Otherwise return false.
return FALSE;
}