|
|
@ -12,13 +12,13 @@ |
|
|
|
* The mimetype whose extension is required. |
|
|
|
* The mimetype whose extension is required. |
|
|
|
* |
|
|
|
* |
|
|
|
* @return string |
|
|
|
* @return string |
|
|
|
* The extension mapped to the given mimetype. |
|
|
|
* The extension mapped to the given mimetype. Defaults to 'bin'. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function islandora_get_extension_for_mimetype($mimetype) { |
|
|
|
function islandora_get_extension_for_mimetype($mimetype) { |
|
|
|
// file.mimetypes.inc is a part of Drupal core, however is not |
|
|
|
// file.mimetypes.inc is a part of Drupal core, however is not |
|
|
|
// automatically loaded. Manually require it. |
|
|
|
// automatically loaded. Manually require it. |
|
|
|
require_once DRUPAL_ROOT . "/includes/file.mimetypes.inc"; |
|
|
|
require_once DRUPAL_ROOT . "/includes/file.mimetypes.inc"; |
|
|
|
|
|
|
|
$extension = 'bin'; |
|
|
|
$mimetype_mapping = file_mimetype_mapping(); |
|
|
|
$mimetype_mapping = file_mimetype_mapping(); |
|
|
|
$extension_index = array_search($mimetype, $mimetype_mapping['mimetypes']); |
|
|
|
$extension_index = array_search($mimetype, $mimetype_mapping['mimetypes']); |
|
|
|
if ($extension_index !== FALSE) { |
|
|
|
if ($extension_index !== FALSE) { |
|
|
|