You are here

function emvideo_vimeo_extract in Media: Vimeo 6

hook emvideo_PROVIDER_extract this is called to extract the video code from a pasted URL or embed code.

Parameters

$video_code: 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

includes/providers/emvideo/vimeo.inc, line 56
media_vimeo/includes/providers/vimeo.inc Provide support for the Vimeo provider to the emfield.module.

Code

function emvideo_vimeo_extract($video_code = '') {

  // 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&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=4106135&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;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',
  );
}