Make WordPress Core


Ignore:
Timestamp:
10/26/2009 05:56:28 PM (17 years ago)
Author:
markjaquith
Message:

Consolidate post_mime_type code. props scribu. fixes #10992

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/media.php

    r12098 r12110  
    11061106 */
    11071107function get_media_item( $attachment_id, $args = null ) {
    1108         global $post_mime_types, $redir_tab;
     1108        global $redir_tab;
    11091109
    11101110        if ( ( $attachment_id = intval($attachment_id) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) )
     
    11311131        }
    11321132
    1133         $type = '';
    1134         if ( isset($post_mime_types) ) {
    1135                 $keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type));
    1136                 $type = array_shift($keys);
    1137                 $type_html = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />";
    1138         }
     1133        $post_mime_types = get_post_mime_types();
     1134        $keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type));
     1135        $type = array_shift($keys);
     1136        $type_html = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />";
    11391137
    11401138        $form_fields = get_attachment_fields_to_edit($post, $errors);
Note: See TracChangeset for help on using the changeset viewer.