function video_cck_youtube_extract in Embedded Media Field 5
hook video_cck_PROVIDER_extract this is called to extract the video code from a pasted URL or embed code.
Parameters
$embed: an optional string with the pasted URL or embed code
Return value
either an array of regex expressions to be tested, or a string with the video code to be used if the hook tests the code itself, it should return either the string of the video code (if matched), or an empty array. otherwise, the calling function will handle testing the embed code against each regex string in the returned array.
File
- contrib/
video_cck/ providers/ youtube.inc, line 229
Code
function video_cck_youtube_extract($embed = '') {
// src="http://www.youtube.com/v/nvbQQnvxXDk"
// http://youtube.com/watch?v=nvbQQnvxXDk
// http://www.youtube.com/watch?v=YzFCA-xUc8w&feature=dir
return array(
'@youtube\\.com/v/([^"\\&]+)@i',
'@youtube\\.com/watch\\?v=([^"\\&]+)@i',
'@youtube\\.com/\\?v=([^"\\&]+)@i',
);
}