You are here

protected static function AcquiaDAMStreamWrapper::getMimetypeOverrides in Media: Acquia DAM 7

Get a list of extensions mapped to other filetypes.

Return value

array An array keyed by original extensions and the file types they shuld be treated as.

1 call to AcquiaDAMStreamWrapper::getMimetypeOverrides()
AcquiaDAMStreamWrapper::getMimeType in includes/AcquiaDAMStreamWrapper.inc
Get the mimetype of the file.

File

includes/AcquiaDAMStreamWrapper.inc, line 163
Create an Acquia DAM Stream Wrapper class for the Media/Resource module.

Class

AcquiaDAMStreamWrapper
Provides a remote stream wrapper for Acquia DAM assets.

Code

protected static function getMimetypeOverrides() {
  $parsed_overrides =& drupal_static(__CLASS__ . ':' . __METHOD__);
  if (is_null($parsed_overrides)) {
    $parsed_overrides = [];
    $extension_overrides = drupal_strtolower(variable_get('media_acquiadam_extension_overrides', 'eps png'));
    if (!empty($extension_overrides)) {

      // We need to convert a multiline "key value" pairing into a key value
      // array for ease of checking in extension/mimetype lists.
      $extension_overrides = explode("\n", $extension_overrides);
      foreach ($extension_overrides as $pairing) {
        if (!empty($pairing)) {
          list($source, $target) = explode(' ', $pairing, 2);
          $parsed_overrides[trim($source)] = trim($target);
        }
      }
    }
  }
  return $parsed_overrides;
}