You are here

function video_cck_metacafe_extract in Embedded Media Field 5

we're going to handle our own matches, unless someone can come up with a regex that will match this better

File

contrib/video_cck/providers/metacafe.inc, line 29

Code

function video_cck_metacafe_extract($embed) {

  // http://www.metacafe.com/watch/479957/gorilla_prank/
  if ($embed && preg_match('@metacafe\\.com/watch/(.[^/]*)/(.[^/]*)/@i', $embed, $matches)) {
    return $matches[1] . '/' . $matches[2];
  }
  else {
    if ($embed && preg_match('@metacafe\\.com/watch/(.[^/]*)/(.*)@i', $embed, $matches)) {
      return $matches[1] . '/' . $matches[2];
    }
    else {
      if ($embed && preg_match('@metacafe\\.com/fplayer/(.[^/]*)/(.[^\\.]*)\\.@i', $embed, $matches)) {
        return $matches[1] . '/' . $matches[2];
      }
    }
  }
  return false;
}