You are here

function emvideo_zzz_custom_url_data in Embedded Media Field 6

Same name and namespace in other branches
  1. 6.3 contrib/emvideo/providers/zzz_custom_url.inc \emvideo_zzz_custom_url_data()
1 call to emvideo_zzz_custom_url_data()
emvideo_zzz_custom_url_rss in contrib/emvideo/providers/zzz_custom_url.inc
hook emfield_PROVIDER_rss

File

contrib/emvideo/providers/zzz_custom_url.inc, line 67
This is an include file used by emfield.module.

Code

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

  // adding the version control
  $data['emvideo_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 = _emvideo_zzz_custom_url_implode_types();
  $regex = '@\\.(' . $types . ')$@i';
  if (preg_match($regex, $item['embed'], $matches)) {
    $data['type'] = $matches[1];
  }
  return $data;
}