You are here

function apachesolr_attachments_allowed_mime in Apache Solr Attachments 6

Same name and namespace in other branches
  1. 6.3 apachesolr_attachments.index.inc \apachesolr_attachments_allowed_mime()
  2. 6.2 apachesolr_attachments.admin.inc \apachesolr_attachments_allowed_mime()
  3. 7 apachesolr_attachments.index.inc \apachesolr_attachments_allowed_mime()
1 call to apachesolr_attachments_allowed_mime()
apachesolr_attachments_get_indexable_files in ./apachesolr_attachments.admin.inc
Return all non-excluded file attachments for a particular node

File

./apachesolr_attachments.admin.inc, line 358
Provides a file attachment search implementation for use with the Apache Solr module

Code

function apachesolr_attachments_allowed_mime($filemime) {
  $excluded = variable_get('apachesolr_attachment_excluded_mime', FALSE);
  if ($excluded === FALSE) {

    // Build the list of excluded MIME types.
    $excluded = array();
    $extensions = variable_get('apachesolr_attachment_excluded_extensions', FALSE);
    if ($extensions !== FALSE) {
      $extensions = explode(' ', $extensions);
    }
    else {
      $extensions = apachesolr_attachments_default_excluded();
    }
    foreach ($extensions as $ext) {
      $ext = trim($ext);
      if ($ext) {
        $mime = file_get_mimetype('dummy.' . $ext);
        $excluded[$mime] = 1;
      }
    }
    variable_set('apachesolr_attachment_excluded_mime', $excluded);
  }
  return empty($excluded[$filemime]);
}