Ticket #10992: get_post_mime_types.diff
| File get_post_mime_types.diff, 4.0 KB (added by scribu, 4 years ago) |
|---|
-
wp-admin/includes/post.php
837 837 } 838 838 839 839 /** 840 * Get default post mime types 841 * 842 * @since 2.9.0 843 * 844 * @return array 845 */ 846 function get_post_mime_types() { 847 $post_mime_types = array( // array( adj, noun ) 848 'image' => array(__('Images'), __('Manage Images'), _n_noop('Image <span class="count">(%s)</span>', 'Images <span class="count">(%s)</span>')), 849 'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio <span class="count">(%s)</span>', 'Audio <span class="count">(%s)</span>')), 850 'video' => array(__('Video'), __('Manage Video'), _n_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')), 851 ); 852 853 return apply_filters('post_mime_types', $post_mime_types); 854 } 855 856 /** 840 857 * {@internal Missing Short Description}} 841 858 * 842 859 * @since unknown … … 871 888 if ( empty($media_per_page) ) 872 889 $media_per_page = 20; 873 890 $q['posts_per_page'] = $media_per_page; 874 $post_mime_types = array( // array( adj, noun )875 'image' => array(__('Images'), __('Manage Images'), _n_noop('Image <span class="count">(%s)</span>', 'Images <span class="count">(%s)</span>')),876 'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio <span class="count">(%s)</span>', 'Audio <span class="count">(%s)</span>')),877 'video' => array(__('Video'), __('Manage Video'), _n_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')),878 );879 $post_mime_types = apply_filters('post_mime_types', $post_mime_types);880 891 892 $post_mime_types = get_post_mime_types(); 881 893 $avail_post_mime_types = get_available_post_mime_types('attachment'); 882 894 883 895 if ( isset($q['post_mime_type']) && !array_intersect( (array) $q['post_mime_type'], array_keys($post_mime_types) ) ) -
wp-admin/includes/media.php
1101 1101 * @return string HTML form for attachment. 1102 1102 */ 1103 1103 function get_media_item( $attachment_id, $args = null ) { 1104 global $ post_mime_types, $redir_tab;1104 global $redir_tab; 1105 1105 1106 1106 if ( ( $attachment_id = intval($attachment_id) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) ) 1107 1107 $thumb_url = $thumb_url[0]; … … 1126 1126 $tags = esc_attr(join(', ', $tags)); 1127 1127 } 1128 1128 1129 $type = ''; 1130 if ( isset($post_mime_types) ) { 1131 $keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type)); 1132 $type = array_shift($keys); 1133 $type_html = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />"; 1134 } 1129 $post_mime_types = get_post_mime_types(); 1130 $keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type)); 1131 $type = array_shift($keys); 1132 $type_html = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />"; 1135 1133 1136 1134 $form_fields = get_attachment_fields_to_edit($post, $errors); 1137 1135 -
wp-admin/upload.php
146 146 $page_links_total = ceil($wpdb->get_var( "SELECT FOUND_ROWS()" ) / 25); 147 147 } 148 148 149 $post_mime_types = array( 150 'image' => array(__('Images'), __('Manage Images'), _n_noop('Image (%s)', 'Images (%s)')), 151 'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio (%s)', 'Audio (%s)')), 152 'video' => array(__('Video'), __('Manage Video'), _n_noop('Video (%s)', 'Video (%s)')), 153 ); 154 $post_mime_types = apply_filters('post_mime_types', $post_mime_types); 155 149 $post_mime_types = get_post_mime_types(); 156 150 $avail_post_mime_types = get_available_post_mime_types('attachment'); 157 151 158 152 if ( isset($_GET['post_mime_type']) && !array_intersect( (array) $_GET['post_mime_type'], array_keys($post_mime_types) ) )
