/**
  * Update the file extension to icon type (e.g., xls => spreadsheet, doc => document) array
  *
  * Note that the calling function, wp_ext2type, takes an extension and returns an icon type.
  * This filter updates the array of possible matches to support the calling function.
  *
  * Called from /wp-includes/functions.php, function wp_ext2type(). That function is called from
  * /wp-admin/includes/ajax-actions.php, function wp_ajax_send_link_to_editor(), 
  * /wp-admin/includes/media.php, function wp_media_upload_handler(), and
  * /wp-includes/post.php, function wp_mime_type_icon(). The first two calls look for "audio"
  * and "video" files to call the appropriate filter. The third call assigns the appropriate icon
  * to the file for display purposes.
  *
  * Defined as public because it's a filter.
  *
  * @since 1.40
  *
  * @param array The type => ( extensions ) associations.
  *
  * @return array The updated associations array.
  */
 public static function mla_ext2type_filter($standard_types)
 {
     global $wp_filter;
     if (self::$disable_mla_filtering) {
         self::$mla_core_icon_types = $standard_types;
         return $standard_types;
     }
     if (NULL != self::$mla_icon_type_associations) {
         return self::$mla_icon_type_associations;
     }
     if (!self::_get_upload_mime_templates()) {
         return $standard_types;
     }
     /*
      * Build and sort the type => extensions list
      */
     $items = self::mla_query_upload_items(array('mla_upload_view' => 'active'), 0, 0);
     $pairs = array();
     foreach ($items as $value) {
         if ('checked' == MLAOptions::mla_get_option(MLAOptions::MLA_ENABLE_MLA_ICONS)) {
             $pairs[$value->slug] = $value->icon_type;
         } else {
             $pairs[$value->slug] = $value->wp_icon_type;
         }
     }
     asort($pairs);
     /*
      * Compress the list, grouping by icon_type
      */
     self::$mla_icon_type_associations = array();
     $icon_type = '.bad.value.';
     // prime the pump
     $extensions = array('xxx');
     foreach ($pairs as $this_extension => $this_type) {
         if ($this_type != $icon_type) {
             self::$mla_icon_type_associations[$icon_type] = $extensions;
             $extensions = array($this_extension);
             $icon_type = $this_type;
         } else {
             $extensions[] = $this_extension;
         }
     }
     self::$mla_icon_type_associations[$icon_type] = $extensions;
     unset(self::$mla_icon_type_associations['.bad.value.']);
     return self::$mla_icon_type_associations;
 }