|
|
@ -1113,22 +1113,16 @@ function islandora_download_clip(AbstractObject $object) { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Implements hook_file_mimetype_mapping_alter(). |
|
|
|
* Implements hook_file_mimetype_mapping_alter(). |
|
|
|
* |
|
|
|
* |
|
|
|
* Grab custom islandora mime type list and add any missing ext/mimes to the drupal mapping |
|
|
|
* Grab custom islandora mime type list |
|
|
|
* |
|
|
|
* and add any missing ext/mimes to the drupal mapping |
|
|
|
* @param array $mapping |
|
|
|
|
|
|
|
* The Drupal mimetype mapping. |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function islandora_file_mimetype_mapping_alter(&$mapping) { |
|
|
|
function islandora_file_mimetype_mapping_alter(&$mapping) { |
|
|
|
$mime_detect = new MimeDetect(); |
|
|
|
$mime_detect = new MimeDetect(); |
|
|
|
$types = $mime_detect->getMimeTypes(); |
|
|
|
$types = $mime_detect->getMimeTypes(); |
|
|
|
$diff = array_diff_key($types, $mapping['extensions']); |
|
|
|
$diff = array_diff_key($types, $mapping['extensions']); |
|
|
|
foreach ($diff as $ext => $mime) { |
|
|
|
foreach ($diff as $ext => $mime) { |
|
|
|
if (!isset($mapping['extensions'][$ext])) { |
|
|
|
$mapping['mimetypes'][] = $mime; |
|
|
|
$mapping['mimetypes'][] = $mime; |
|
|
|
end($mapping['mimetypes']); |
|
|
|
$last = end($mapping['mimetypes']); |
|
|
|
$mapping['extensions'][$ext] = key($mapping['mimetypes']); |
|
|
|
reset($mapping['mimetypes']); |
|
|
|
|
|
|
|
$key = array_search($mime, $mapping['mimetypes']); |
|
|
|
|
|
|
|
$mapping['extensions'][$ext] = $key; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|