function _video_embed_brightcove_get_video_properties in Video Embed Field 7.2
Helper function to take a brightcove video url and return its id.
Parameters
string $url: The full brightcove video url.
Return value
array The video properties.
1 call to _video_embed_brightcove_get_video_properties()
- video_embed_brightcove_handle_video in video_embed_brightcove/
video_embed_brightcove.module - The video handler.
File
- video_embed_brightcove/
video_embed_brightcove.module, line 141 - Add a handler for brightcove videos to Video Embed Field.
Code
function _video_embed_brightcove_get_video_properties($url) {
// Easy way to break a url into its components.
$components = array(
'id' => array(
'start' => 'bcpid',
'finish' => '\\?bckey',
),
'key' => array(
'start' => 'bckey=',
'finish' => '&bctid',
),
'player' => array(
'start' => 'bctid=',
'finish' => '',
),
);
$matches = array();
$return = array();
foreach ($components as $key => $component) {
$string = "/(.*){$component['start']}(.*){$component['finish']}/";
preg_match($string, $url, $matches);
if ($matches && !empty($matches[2])) {
$return[$key] = check_plain($matches[2]);
}
}
return $return;
}