You are here

function mimedetect_settings in MimeDetect 5

Same name and namespace in other branches
  1. 6 mimedetect.admin.inc \mimedetect_settings()
  2. 7 mimedetect.admin.inc \mimedetect_settings()
1 string reference to 'mimedetect_settings'
mimedetect_menu in ./mimedetect.module
@file Provide server side mime type detection.

File

./mimedetect.module, line 64
Provide server side mime type detection.

Code

function mimedetect_settings() {

  // Check if fileinfo is available so we don't present the file options if
  // they can't use them
  if (extension_loaded('fileinfo')) {
    $form['file'] = array(
      '#value' => t("The MimeDetect module is using PHP's fileinfo extension to detect MIME types. There are no settings for the extension."),
    );
  }
  else {
    $form['file'] = array(
      '#type' => 'fieldset',
      '#title' => t("UNIX 'file' command"),
    );
    $form['file']['mimedetect_enable_file_binary'] = array(
      '#type' => 'checkbox',
      '#title' => t("Use UNIX 'file' command to detect mime type?"),
      '#description' => t("The UNIX 'file' command will be used for mime detection only if the PHP Fileinfo extension is not installed or fails to load."),
      '#default_value' => variable_get('mimedetect_enable_file_binary', FALSE),
    );
    $form['file']['mimedetect_file_binary'] = array(
      '#type' => 'textfield',
      '#title' => t("Path to the 'file' command"),
      '#description' => t("The path to the executable 'file' binary."),
      '#default_value' => variable_get('mimedetect_file_binary', '/usr/bin/file'),
    );
    $form = system_settings_form($form);
  }
  return $form;
}