You are here

function video_cck_zzz_custom_url_data in Embedded Media Field 5

1 call to video_cck_zzz_custom_url_data()
video_cck_zzz_custom_url_rss in contrib/video_cck/providers/zzz_custom_url.inc
hook emfield_PROVIDER_rss

File

contrib/video_cck/providers/zzz_custom_url.inc, line 56

Code

function video_cck_zzz_custom_url_data($field, $item) {
  $data = array();

  // adding the version control
  $data['video_cck_zzz_custom_url_data_version'] = 1;

  // attempt to get info from headers
  $response = emfield_request_header('zzz_custom_url', $item['embed']);
  if ($response->code == 200) {
    $data['url'] = $item['embed'];
    $data['size'] = $response->headers['Content-Length'];
    $data['mime'] = $response->headers['Content-Type'];
  }

  // @todo replace ['type'] with converted mime info if available
  $types = _video_cck_zzz_custom_url_implode_types();
  $regex = '@\\.(' . $types . ')@i';
  if (preg_match($regex, $item['embed'], $matches)) {
    $data['type'] = $matches[1];
  }
  return $data;
}