]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/media.php
WordPress 3.9.1
[autoinstalls/wordpress.git] / wp-includes / media.php
index d4061170deb9b945b1b341b2750811b17196803b..974aa7995c2c2115aeb9a6436f7e52e073caf684 100644 (file)
@@ -1353,6 +1353,8 @@ function wp_playlist_shortcode( $attr ) {
                echo (int) $theme_width;
        ?>"<?php if ( 'video' === $safe_type ):
                echo ' height="', (int) $theme_height, '"';
+       else:
+               echo ' style="visibility: hidden"';
        endif; ?>></<?php echo $safe_type ?>>
        <div class="wp-playlist-next"></div>
        <div class="wp-playlist-prev"></div>
@@ -1555,7 +1557,7 @@ function wp_audio_shortcode( $attr, $content = '' ) {
                'loop'     => $loop,
                'autoplay' => $autoplay,
                'preload'  => $preload,
-               'style'    => 'width: 100%',
+               'style'    => 'width: 100%; visibility: hidden;',
        );
 
        // These ones should just be omitted altogether if they are blank
@@ -2654,7 +2656,7 @@ function wp_enqueue_media( $args = array() ) {
        if ( did_action( 'wp_enqueue_media' ) )
                return;
 
-       global $content_width;
+       global $content_width, $wpdb;
 
        $defaults = array(
                'post' => null,
@@ -2693,15 +2695,20 @@ function wp_enqueue_media( $args = array() ) {
                }
        }
 
-       $audio = $video = 0;
-       $counts = (array) wp_count_attachments();
-       foreach ( $counts as $mime => $total ) {
-               if ( 0 === strpos( $mime, 'audio/' ) ) {
-                       $audio += (int) $total;
-               } elseif ( 0 === strpos( $mime, 'video/' ) ) {
-                       $video += (int) $total;
-               }
-       }
+       $has_audio = $wpdb->get_var( "
+               SELECT ID
+               FROM $wpdb->posts
+               WHERE post_type = 'attachment'
+               AND post_mime_type LIKE 'audio%'
+               LIMIT 1
+       " );
+       $has_video = $wpdb->get_var( "
+               SELECT ID
+               FROM $wpdb->posts
+               WHERE post_type = 'attachment'
+               AND post_mime_type LIKE 'video%'
+               LIMIT 1
+       " );
 
        $settings = array(
                'tabs'      => $tabs,
@@ -2717,8 +2724,8 @@ function wp_enqueue_media( $args = array() ) {
                ),
                'defaultProps' => $props,
                'attachmentCounts' => array(
-                       'audio' => $audio,
-                       'video' => $video
+                       'audio' => (int) $has_audio,
+                       'video' => (int) $has_video,
                ),
                'embedExts'    => $exts,
                'embedMimes'   => $ext_mimes,
@@ -2829,7 +2836,7 @@ function wp_enqueue_media( $args = array() ) {
                'videoReplaceTitle'     => __( 'Replace Video' ),
                'videoAddSourceTitle'   => __( 'Add Video Source' ),
                'videoDetailsCancel'    => __( 'Cancel Edit' ),
-               'videoSelectPosterImageTitle' => _( 'Select Poster Image' ),
+               'videoSelectPosterImageTitle' => __( 'Select Poster Image' ),
                'videoAddTrackTitle'    => __( 'Add Subtitles' ),
 
                // Playlist