You are here

function asset_embed_dailymotion_extract_id in Asset 6

Same name and namespace in other branches
  1. 5 asset_embed/providers/dailymotion.inc \asset_embed_dailymotion_extract_id()

File

asset_embed/providers/dailymotion.inc, line 11

Code

function asset_embed_dailymotion_extract_id($text) {
  $matches = array();

  // first try to match the embed tag
  preg_match('!param[^>]*value=\\"http://www.dailymotion.com/swf/([^\\"]*).*href=\\"http://www.dailymotion.com/video/([^\\"]*)!', $text, $matches);
  $data = array();
  if ($matches[1]) {
    $data['id'] = $matches[1];
  }
  if ($matches[2]) {
    $data['thumbnail_id'] = $matches[2];
  }
  return $data;
}