function emvideo_vimeo_extract in Embedded Media Field 6
Same name and namespace in other branches
- 6.3 contrib/emvideo/providers/vimeo.inc \emvideo_vimeo_extract()
hook emvideo_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/
emvideo/ providers/ vimeo.inc, line 114 - Provide support for the Vimeo provider to the emfield.module.
Code
function emvideo_vimeo_extract($embed = '') {
// http://vimeo.com/123456
// http://www.vimeo.com/123456
// http://vimeo.com/channels/hd#6912147
//<object width="400" height="270"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=4106135&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=4106135&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="270"></embed></object><br /><a href="http://vimeo.com/4106135">Two Knives One Motive</a> from <a href="http://vimeo.com/x351">Tyler Capehart</a> on <a href="http://vimeo.com">Vimeo</a>.
return array(
'@vimeo\\.com/moogaloop\\.swf\\?clip_id\\=([^\\"\\&]+)@i',
'@vimeo\\.com/[^\\"\\&\\d]*([^\\"\\&]+)@i',
);
}