function emaudio_custom_url_data in Embedded Media Field 6
Same name and namespace in other branches
- 6.3 contrib/emaudio/providers/custom_url.inc \emaudio_custom_url_data()
1 call to emaudio_custom_url_data()
- emaudio_custom_url_rss in contrib/
emaudio/ providers/ custom_url.inc - hook emfield_PROVIDER_rss
File
- contrib/
emaudio/ providers/ custom_url.inc, line 66 - This is an include file used by emfield.module.
Code
function emaudio_custom_url_data($field, $item) {
$data = array();
// adding the version control
$data['emaudio_custom_url_data_version'] = 1;
// attempt to get info from headers
$response = emfield_request_header('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 = implode('|', _emaudio_custom_url_supported_types());
$regex = '@\\.(' . $types . ')@i';
if (preg_match($regex, $item['embed'], $matches)) {
$data['type'] = $matches[1];
}
return $data;
}