You are here

function swftools_admin_mime_type_submit in SWF Tools 6.3

Explodes a string of file extensions and converts them back in to an array.

1 string reference to 'swftools_admin_mime_type_submit'
swftools_admin_handling_form in includes/swftools.admin.inc

File

includes/swftools.admin.inc, line 824
Configuration settings for SWF Tools.

Code

function swftools_admin_mime_type_submit($form, &$form_state) {

  // Explode the separate list back to an array of strings
  $temp = explode("\n", $form_state['values']['swftools_mime_types_input']);

  // Now create the array of mime types
  $mime_types = array();

  // Iterate over each piece
  foreach ($temp as $setting) {

    // Explode each item again
    $setting = explode(' ', $setting);

    // Only valid if we have two pieces
    if (count($setting) == 2) {

      // Trim white space
      $setting = array_map('trim', $setting);

      // Store the result
      $mime_types[$setting[0]] = $setting[1];
    }
  }

  // Store the result as a new variable
  $form_state['values']['swftools_mime_types'] = $mime_types;
}