Changeset 28191
- Timestamp:
- 04/23/2014 10:04:03 PM (10 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r28182 r28191 2696 2696 } 2697 2697 2698 $audio = $video = 0;2699 $counts = (array) wp_count_attachments();2700 foreach ( $counts as $mime => $total ) {2701 if ( 0 === strpos( $mime, 'audio/' ) ) {2702 $audio += (int) $total;2703 } elseif ( 0 === strpos( $mime, 'video/' ) ) {2704 $video += (int) $total;2705 }2706 }2707 2708 2698 $settings = array( 2709 2699 'tabs' => $tabs, … … 2720 2710 'defaultProps' => $props, 2721 2711 'attachmentCounts' => array( 2722 'audio' => $audio,2723 'video' => $video2712 'audio' => wp_has_mime_type_attachments( 'audio' ) ? 1 : 0, 2713 'video' => wp_has_mime_type_attachments( 'video' ) ? 1 : 0 2724 2714 ), 2725 2715 'embedExts' => $exts, -
trunk/src/wp-includes/post.php
r28106 r28191 2293 2293 2294 2294 /** 2295 * Determine if at least one attachment of a particular mime-type has been uploaded 2296 * 2297 * @global wpdb $wpdb 2298 * 2299 * @since 3.9.1 2300 * 2301 * @param string $mime_type The mime-type string to check. 2302 * 2303 * @return int|null If exist, the post ID of the first found attachment. 2304 */ 2305 function wp_has_mime_type_attachments( $mime_type ) { 2306 global $wpdb; 2307 $sql = sprintf( "SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND post_mime_type LIKE '%s%%' LIMIT 1", like_escape( $mime_type ) ); 2308 return $wpdb->get_var( $sql ); 2309 } 2310 2311 /** 2295 2312 * Get default post mime types 2296 2313 *
Note: See TracChangeset
for help on using the changeset viewer.