You are here

function _mimetype_mapping in Taxonomy File Tree 8

Same name and namespace in other branches
  1. 3.x tft.module \_mimetype_mapping()

Help function to return file extension.

1 call to _mimetype_mapping()
tft_preprocess_media in ./tft.module
Implements hook_preprocess_media().

File

./tft.module, line 747
Contains tft.module.

Code

function _mimetype_mapping($index) {
  $mime_type = [
    'application/vnd.oasis.opendocument.presentation' => 'odp',
    'application/vnd.oasis.opendocument.spreadsheet' => 'ods',
    'application/vnd.oasis.opendocument.text' => 'odt',
    'application/vnd.ms-powerpoint' => 'ppt',
    'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx',
    'application/pdf' => 'pdf',
    'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx',
    'application/vnd.ms-excel' => 'xls',
    'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx',
    'application/msword' => 'doc',
    'text/plain' => 'txt',
  ];
  if (isset($mime_type[$index])) {
    return $mime_type[$index];
  }
  return false;
}