X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/41578db67d72562346e4dbb2a14889b23d522813..0f684a09c03e547d3132bddc970cbeafcd1102f4:/wp-includes/media.php?ds=sidebyside diff --git a/wp-includes/media.php b/wp-includes/media.php index d4061170..974aa799 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -1353,6 +1353,8 @@ function wp_playlist_shortcode( $attr ) { echo (int) $theme_width; ?>">>
@@ -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