Ticket #31071: 31071b.diff
File 31071b.diff, 1.1 KB (added by , 9 years ago) |
---|
-
wp-includes/media.php
3160 3160 } 3161 3161 } 3162 3162 3163 // Get mime types 3164 $mime_types = wp_get_mime_types(); 3165 3166 // Get audio mime types and query for them 3167 $audio_mime_types = preg_grep( 'audio*', $mime_types ); 3168 $audio_mime_types = array_values( $audio_mime_types ); 3163 3169 $has_audio = $wpdb->get_var( " 3164 3170 SELECT ID 3165 3171 FROM $wpdb->posts 3166 3172 WHERE post_type = 'attachment' 3167 AND post_mime_type LIKE 'audio%'3173 AND post_mime_type IN ($audio_mime_types) 3168 3174 LIMIT 1 3169 3175 " ); 3176 3177 // Get video mime types and query for them 3178 $video_mime_types = preg_grep( 'video*', $mime_types ); 3179 $video_mime_types = array_values($video_mime_types); 3170 3180 $has_video = $wpdb->get_var( " 3171 3181 SELECT ID 3172 3182 FROM $wpdb->posts 3173 3183 WHERE post_type = 'attachment' 3174 AND post_mime_type LIKE 'video%'3184 AND post_mime_type IN ($video_mime_types) 3175 3185 LIMIT 1 3176 3186 " ); 3187 3177 3188 $months = $wpdb->get_results( $wpdb->prepare( " 3178 3189 SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month 3179 3190 FROM $wpdb->posts