]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/media-template.php
WordPress 4.7.1-scripts
[autoinstalls/wordpress.git] / wp-includes / media-template.php
index afb690e89f5a48482ae02e5058323627ef15daa6..f12b11cff31144687c9ff4a4c8c5675d7f102516 100644 (file)
@@ -50,9 +50,14 @@ function wp_underscore_audio_template() {
 function wp_underscore_video_template() {
        $video_types = wp_get_video_extensions();
 ?>
-<#  var w_rule = h_rule = '',
+<#  var w_rule = '', classes = [],
                w, h, settings = wp.media.view.settings,
-               isYouTube = ! _.isEmpty( data.model.src ) && data.model.src.match(/youtube|youtu\.be/);
+               isYouTube = isVimeo = false;
+
+       if ( ! _.isEmpty( data.model.src ) ) {
+               isYouTube = data.model.src.match(/youtube|youtu\.be/);
+               isVimeo = -1 !== data.model.src.indexOf('vimeo');
+       }
 
        if ( settings.contentWidth && data.model.width >= settings.contentWidth ) {
                w = settings.contentWidth;
@@ -64,18 +69,24 @@ function wp_underscore_video_template() {
                h = Math.ceil( ( data.model.height * w ) / data.model.width );
        } else {
                h = data.model.height;
-       }
+       }
 
        if ( w ) {
                w_rule = 'width: ' + w + 'px; ';
        }
-       if ( h ) {
-               h_rule = 'height: ' + h + 'px;';
+
+       if ( isYouTube ) {
+               classes.push( 'youtube-video' );
        }
+
+       if ( isVimeo ) {
+               classes.push( 'vimeo-video' );
+       }
+
 #>
-<div style="{{ w_rule }}{{ h_rule }}" class="wp-video">
+<div style="{{ w_rule }}" class="wp-video">
 <video controls
-       class="wp-video-shortcode{{ isYouTube ? ' youtube-video' : '' }}"
+       class="wp-video-shortcode {{ classes.join( ' ' ) }}"
        <# if ( w ) { #>width="{{ w }}"<# } #>
        <# if ( h ) { #>height="{{ h }}"<# } #>
        <?php
@@ -100,6 +111,8 @@ function wp_underscore_video_template() {
        <# if ( ! _.isEmpty( data.model.src ) ) {
                if ( isYouTube ) { #>
                <source src="{{ data.model.src }}" type="video/youtube" />
+               <# } else if ( isVimeo ) { #>
+               <source src="{{ data.model.src }}" type="video/vimeo" />
                <# } else { #>
                <source src="{{ data.model.src }}" type="{{ settings.embedMimes[ data.model.src.split('.').pop() ] }}" />
                <# }
@@ -120,6 +133,8 @@ function wp_underscore_video_template() {
  * Prints the templates used in the media manager.
  *
  * @since 3.5.0
+ *
+ * @global bool $is_IE
  */
 function wp_print_media_templates() {
        global $is_IE;
@@ -148,7 +163,7 @@ function wp_print_media_templates() {
 
        <script type="text/html" id="tmpl-media-modal">
                <div class="<?php echo $class; ?>">
-                       <a class="media-modal-close" href="#"><span class="media-modal-icon"><span class="screen-reader-text"><?php _e( 'Close media panel' ); ?></span></span></a>
+                       <button type="button" class="button-link media-modal-close"><span class="media-modal-icon"><span class="screen-reader-text"><?php _e( 'Close media panel' ); ?></span></span></button>
                        <div class="media-modal-content"></div>
                </div>
                <div class="media-modal-backdrop"></div>
@@ -156,7 +171,7 @@ function wp_print_media_templates() {
 
        <script type="text/html" id="tmpl-uploader-window">
                <div class="uploader-window-content">
-                       <h3><?php _e( 'Drop files to upload' ); ?></h3>
+                       <h1><?php _e( 'Drop files to upload' ); ?></h1>
                </div>
        </script>
 
@@ -173,21 +188,21 @@ function wp_print_media_templates() {
                <# } #>
                <div class="uploader-inline-content {{ messageClass }}">
                <# if ( data.message ) { #>
-                       <h3 class="upload-message">{{ data.message }}</h3>
+                       <h2 class="upload-message">{{ data.message }}</h2>
                <# } #>
                <?php if ( ! _device_can_upload() ) : ?>
-                       <h3 class="upload-instructions"><?php printf( __('The web browser on your device cannot be used to upload files. You may be able to use the <a href="%s">native app for your device</a> instead.'), 'http://apps.wordpress.org/' ); ?></h3>
+                       <h2 class="upload-instructions"><?php printf( __( 'The web browser on your device cannot be used to upload files. You may be able to use the <a href="%s">native app for your device</a> instead.' ), 'https://apps.wordpress.org/' ); ?></h2>
                <?php elseif ( is_multisite() && ! is_upload_space_available() ) : ?>
-                       <h3 class="upload-instructions"><?php _e( 'Upload Limit Exceeded' ); ?></h3>
+                       <h2 class="upload-instructions"><?php _e( 'Upload Limit Exceeded' ); ?></h2>
                        <?php
                        /** This action is documented in wp-admin/includes/media.php */
                        do_action( 'upload_ui_over_quota' ); ?>
 
                <?php else : ?>
                        <div class="upload-ui">
-                               <h3 class="upload-instructions drop-instructions"><?php _e( 'Drop files anywhere to upload' ); ?></h3>
+                               <h2 class="upload-instructions drop-instructions"><?php _e( 'Drop files anywhere to upload' ); ?></h2>
                                <p class="upload-instructions drop-instructions"><?php _ex( 'or', 'Uploader: Drop files here - or - Select Files' ); ?></p>
-                               <a href="#" class="browser button button-hero"><?php _e( 'Select Files' ); ?></a>
+                               <button type="button" class="browser button button-hero"><?php _e( 'Select Files' ); ?></button>
                        </div>
 
                        <div class="upload-inline-status"></div>
@@ -242,8 +257,8 @@ function wp_print_media_templates() {
        </script>
 
        <script type="text/html" id="tmpl-uploader-status">
-               <h3><?php _e( 'Uploading' ); ?></h3>
-               <a class="upload-dismiss-errors" href="#"><?php _e('Dismiss Errors'); ?></a>
+               <h2><?php _e( 'Uploading' ); ?></h2>
+               <button type="button" class="button-link upload-dismiss-errors"><span class="screen-reader-text"><?php _e( 'Dismiss Errors' ); ?></span></button>
 
                <div class="media-progress-bar"><div></div></div>
                <div class="upload-details">
@@ -257,7 +272,6 @@ function wp_print_media_templates() {
        </script>
 
        <script type="text/html" id="tmpl-uploader-status-error">
-               <span class="upload-error-label"><?php _e('Error'); ?></span>
                <span class="upload-error-filename">{{{ data.filename }}}</span>
                <span class="upload-error-message">{{ data.message }}</span>
        </script>
@@ -276,12 +290,12 @@ function wp_print_media_templates() {
                        <div class="thumbnail thumbnail-{{ data.type }}">
                                <# if ( data.uploading ) { #>
                                        <div class="media-progress-bar"><div></div></div>
-                               <# } else if ( 'image' === data.type && data.sizes && data.sizes.large ) { #>
-                                       <img class="details-image" src="{{ data.sizes.large.url }}" draggable="false" />
-                               <# } else if ( 'image' === data.type && data.sizes && data.sizes.full ) { #>
-                                       <img class="details-image" src="{{ data.sizes.full.url }}" draggable="false" />
+                               <# } else if ( data.sizes && data.sizes.large ) { #>
+                                       <img class="details-image" src="{{ data.sizes.large.url }}" draggable="false" alt="" />
+                               <# } else if ( data.sizes && data.sizes.full ) { #>
+                                       <img class="details-image" src="{{ data.sizes.full.url }}" draggable="false" alt="" />
                                <# } else if ( -1 === jQuery.inArray( data.type, [ 'audio', 'video' ] ) ) { #>
-                                       <img class="details-image" src="{{ data.icon }}" class="icon" draggable="false" />
+                                       <img class="details-image icon" src="{{ data.icon }}" draggable="false" alt="" />
                                <# } #>
 
                                <# if ( 'audio' === data.type ) { #>
@@ -291,17 +305,14 @@ function wp_print_media_templates() {
                                        </audio>
                                </div>
                                <# } else if ( 'video' === data.type ) {
-                                       var w_rule = h_rule = '';
+                                       var w_rule = '';
                                        if ( data.width ) {
                                                w_rule = 'width: ' + data.width + 'px;';
                                        } else if ( wp.media.view.settings.contentWidth ) {
                                                w_rule = 'width: ' + wp.media.view.settings.contentWidth + 'px;';
                                        }
-                                       if ( data.height ) {
-                                               h_rule = 'height: ' + data.height + 'px;';
-                                       }
                                #>
-                               <div style="{{ w_rule }}{{ h_rule }}" class="wp-media-wrapper wp-video">
+                               <div style="{{ w_rule }}" class="wp-media-wrapper wp-video">
                                        <video controls="controls" class="wp-video-shortcode" preload="metadata"
                                                <# if ( data.width ) { #>width="{{ data.width }}"<# } #>
                                                <# if ( data.height ) { #>height="{{ data.height }}"<# } #>
@@ -312,8 +323,10 @@ function wp_print_media_templates() {
                                <# } #>
 
                                <div class="attachment-actions">
-                                       <# if ( 'image' === data.type && ! data.uploading && data.sizes ) { #>
-                                               <a class="button edit-attachment" href="#"><?php _e( 'Edit Image' ); ?></a>
+                                       <# if ( 'image' === data.type && ! data.uploading && data.sizes && data.can.save ) { #>
+                                       <button type="button" class="button edit-attachment"><?php _e( 'Edit Image' ); ?></button>
+                                       <# } else if ( 'pdf' === data.subtype && data.sizes ) { #>
+                                       <?php _e( 'Document Preview' ); ?>
                                        <# } #>
                                </div>
                        </div>
@@ -361,10 +374,12 @@ function wp_print_media_templates() {
                                        <input type="text" value="{{ data.url }}" readonly />
                                </label>
                                <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
+                               <?php if ( post_type_supports( 'attachment', 'title' ) ) : ?>
                                <label class="setting" data-setting="title">
                                        <span class="name"><?php _e('Title'); ?></span>
                                        <input type="text" value="{{ data.title }}" {{ maybeReadOnly }} />
                                </label>
+                               <?php endif; ?>
                                <# if ( 'audio' === data.type ) { #>
                                <?php foreach ( array(
                                        'artist' => __( 'Artist' ),
@@ -394,7 +409,7 @@ function wp_print_media_templates() {
                                        <span class="name"><?php _e( 'Uploaded By' ); ?></span>
                                        <span class="value">{{ data.authorName }}</span>
                                </label>
-                               <# if ( data.uploadedTo ) { #>
+                               <# if ( data.uploadedToTitle ) { #>
                                        <label class="setting">
                                                <span class="name"><?php _e( 'Uploaded To' ); ?></span>
                                                <# if ( data.uploadedToLink ) { #>
@@ -408,19 +423,21 @@ function wp_print_media_templates() {
                        </div>
 
                        <div class="actions">
-                               <a class="view-attachment" href="{{ data.link }}"><?php _e( 'View attachment page' ); ?></a> |
-                               <a href="post.php?post={{ data.id }}&action=edit"><?php _e( 'Edit more details' ); ?></a>
+                               <a class="view-attachment" href="{{ data.link }}"><?php _e( 'View attachment page' ); ?></a>
+                               <# if ( data.can.save ) { #> |
+                                       <a href="post.php?post={{ data.id }}&action=edit"><?php _e( 'Edit more details' ); ?></a>
+                               <# } #>
                                <# if ( ! data.uploading && data.can.remove ) { #> |
-                                               <?php if ( MEDIA_TRASH ): ?>
+                                       <?php if ( MEDIA_TRASH ): ?>
                                                <# if ( 'trash' === data.status ) { #>
-                                                       <a class="untrash-attachment" href="#"><?php _e( 'Untrash' ); ?></a>
+                                                       <button type="button" class="button-link untrash-attachment"><?php _e( 'Untrash' ); ?></button>
                                                <# } else { #>
-                                                       <a class="trash-attachment" href="#"><?php _e( 'Trash' ); ?></a>
+                                                       <button type="button" class="button-link trash-attachment"><?php _ex( 'Trash', 'verb' ); ?></button>
                                                <# } #>
-                                               <?php else: ?>
-                                                       <a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ); ?></a>
-                                               <?php endif; ?>
-                                       <# } #>
+                                       <?php else: ?>
+                                               <button type="button" class="button-link delete-attachment"><?php _e( 'Delete Permanently' ); ?></button>
+                                       <?php endif; ?>
+                               <# } #>
                        </div>
 
                </div>
@@ -438,9 +455,11 @@ function wp_print_media_templates() {
                                <# } else { #>
                                        <div class="centered">
                                                <# if ( data.image && data.image.src && data.image.src !== data.icon ) { #>
-                                                       <img src="{{ data.image.src }}" class="thumbnail" draggable="false" />
+                                                       <img src="{{ data.image.src }}" class="thumbnail" draggable="false" alt="" />
+                                               <# } else if ( data.sizes && data.sizes.medium ) { #>
+                                                       <img src="{{ data.sizes.medium.url }}" class="thumbnail" draggable="false" alt="" />
                                                <# } else { #>
-                                                       <img src="{{ data.icon }}" class="icon" draggable="false" />
+                                                       <img src="{{ data.icon }}" class="icon" draggable="false" alt="" />
                                                <# } #>
                                        </div>
                                        <div class="filename">
@@ -449,11 +468,11 @@ function wp_print_media_templates() {
                                <# } #>
                        </div>
                        <# if ( data.buttons.close ) { #>
-                               <a class="close media-modal-icon" href="#" title="<?php esc_attr_e('Remove'); ?>"></a>
+                               <button type="button" class="button-link attachment-close media-modal-icon"><span class="screen-reader-text"><?php _e( 'Remove' ); ?></span></button>
                        <# } #>
                </div>
                <# if ( data.buttons.check ) { #>
-                       <a class="check" href="#" title="<?php esc_attr_e('Deselect'); ?>" tabindex="-1"><div class="media-modal-icon"></div></a>
+                       <button type="button" class="button-link check" tabindex="-1"><span class="media-modal-icon"></span><span class="screen-reader-text"><?php _e( 'Deselect' ); ?></span></button>
                <# } #>
                <#
                var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly';
@@ -475,22 +494,21 @@ function wp_print_media_templates() {
        </script>
 
        <script type="text/html" id="tmpl-attachment-details">
-               <h3>
-                       <?php _e('Attachment Details'); ?>
-
+               <h2>
+                       <?php _e( 'Attachment Details' ); ?>
                        <span class="settings-save-status">
                                <span class="spinner"></span>
                                <span class="saved"><?php esc_html_e('Saved.'); ?></span>
                        </span>
-               </h3>
+               </h2>
                <div class="attachment-info">
                        <div class="thumbnail thumbnail-{{ data.type }}">
                                <# if ( data.uploading ) { #>
                                        <div class="media-progress-bar"><div></div></div>
                                <# } else if ( 'image' === data.type && data.sizes ) { #>
-                                       <img src="{{ data.size.url }}" draggable="false" />
+                                       <img src="{{ data.size.url }}" draggable="false" alt="" />
                                <# } else { #>
-                                       <img src="{{ data.icon }}" class="icon" draggable="false" />
+                                       <img src="{{ data.icon }}" class="icon" draggable="false" alt="" />
                                <# } #>
                        </div>
                        <div class="details">
@@ -505,7 +523,6 @@ function wp_print_media_templates() {
 
                                        <# if ( data.can.save && data.sizes ) { #>
                                                <a class="edit-attachment" href="{{ data.editLink }}&amp;image-editor" target="_blank"><?php _e( 'Edit Image' ); ?></a>
-                                               <a class="refresh-attachment" href="#"><?php _e( 'Refresh' ); ?></a>
                                        <# } #>
                                <# } #>
 
@@ -516,12 +533,12 @@ function wp_print_media_templates() {
                                <# if ( ! data.uploading && data.can.remove ) { #>
                                        <?php if ( MEDIA_TRASH ): ?>
                                        <# if ( 'trash' === data.status ) { #>
-                                               <a class="untrash-attachment" href="#"><?php _e( 'Untrash' ); ?></a>
+                                               <button type="button" class="button-link untrash-attachment"><?php _e( 'Untrash' ); ?></button>
                                        <# } else { #>
-                                               <a class="trash-attachment" href="#"><?php _e( 'Trash' ); ?></a>
+                                               <button type="button" class="button-link trash-attachment"><?php _ex( 'Trash', 'verb' ); ?></button>
                                        <# } #>
                                        <?php else: ?>
-                                               <a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ); ?></a>
+                                               <button type="button" class="button-link delete-attachment"><?php _e( 'Delete Permanently' ); ?></button>
                                        <?php endif; ?>
                                <# } #>
 
@@ -538,10 +555,12 @@ function wp_print_media_templates() {
                        <input type="text" value="{{ data.url }}" readonly />
                </label>
                <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
+               <?php if ( post_type_supports( 'attachment', 'title' ) ) : ?>
                <label class="setting" data-setting="title">
                        <span class="name"><?php _e('Title'); ?></span>
                        <input type="text" value="{{ data.title }}" {{ maybeReadOnly }} />
                </label>
+               <?php endif; ?>
                <# if ( 'audio' === data.type ) { #>
                <?php foreach ( array(
                        'artist' => __( 'Artist' ),
@@ -573,17 +592,17 @@ function wp_print_media_templates() {
                <div class="selection-info">
                        <span class="count"></span>
                        <# if ( data.editable ) { #>
-                               <a class="edit-selection" href="#"><?php _e('Edit'); ?></a>
+                               <button type="button" class="button-link edit-selection"><?php _e( 'Edit Selection' ); ?></button>
                        <# } #>
                        <# if ( data.clearable ) { #>
-                               <a class="clear-selection" href="#"><?php _e('Clear'); ?></a>
+                               <button type="button" class="button-link clear-selection"><?php _e( 'Clear' ); ?></button>
                        <# } #>
                </div>
                <div class="selection-view"></div>
        </script>
 
        <script type="text/html" id="tmpl-attachment-display-settings">
-               <h3><?php _e('Attachment Display Settings'); ?></h3>
+               <h2><?php _e( 'Attachment Display Settings' ); ?></h2>
 
                <# if ( 'image' === data.type ) { #>
                        <label class="setting">
@@ -595,16 +614,16 @@ function wp_print_media_templates() {
                                        <# } #>>
 
                                        <option value="left">
-                                               <?php esc_attr_e('Left'); ?>
+                                               <?php esc_html_e( 'Left' ); ?>
                                        </option>
                                        <option value="center">
-                                               <?php esc_attr_e('Center'); ?>
+                                               <?php esc_html_e( 'Center' ); ?>
                                        </option>
                                        <option value="right">
-                                               <?php esc_attr_e('Right'); ?>
+                                               <?php esc_html_e( 'Right' ); ?>
                                        </option>
                                        <option value="none" selected>
-                                               <?php esc_attr_e('None'); ?>
+                                               <?php esc_html_e( 'None' ); ?>
                                        </option>
                                </select>
                        </label>
@@ -626,31 +645,31 @@ function wp_print_media_templates() {
 
                                <# if ( data.model.canEmbed ) { #>
                                        <option value="embed" selected>
-                                               <?php esc_attr_e('Embed Media Player'); ?>
+                                               <?php esc_html_e( 'Embed Media Player' ); ?>
                                        </option>
                                        <option value="file">
                                <# } else { #>
-                                       <option value="file" selected>
+                                       <option value="none" selected>
+                                               <?php esc_html_e( 'None' ); ?>
+                                       </option>
+                                       <option value="file">
                                <# } #>
                                        <# if ( data.model.canEmbed ) { #>
-                                               <?php esc_attr_e('Link to Media File'); ?>
+                                               <?php esc_html_e( 'Link to Media File' ); ?>
                                        <# } else { #>
-                                               <?php esc_attr_e('Media File'); ?>
+                                               <?php esc_html_e( 'Media File' ); ?>
                                        <# } #>
                                        </option>
                                        <option value="post">
                                        <# if ( data.model.canEmbed ) { #>
-                                               <?php esc_attr_e('Link to Attachment Page'); ?>
+                                               <?php esc_html_e( 'Link to Attachment Page' ); ?>
                                        <# } else { #>
-                                               <?php esc_attr_e('Attachment Page'); ?>
+                                               <?php esc_html_e( 'Attachment Page' ); ?>
                                        <# } #>
                                        </option>
                                <# if ( 'image' === data.type ) { #>
                                        <option value="custom">
-                                               <?php esc_attr_e('Custom URL'); ?>
-                                       </option>
-                                       <option value="none">
-                                               <?php esc_attr_e('None'); ?>
+                                               <?php esc_html_e( 'Custom URL' ); ?>
                                        </option>
                                <# } #>
                                </select>
@@ -690,7 +709,7 @@ function wp_print_media_templates() {
        </script>
 
        <script type="text/html" id="tmpl-gallery-settings">
-               <h3><?php _e('Gallery Settings'); ?></h3>
+               <h2><?php _e( 'Gallery Settings' ); ?></h2>
 
                <label class="setting">
                        <span><?php _e('Link To'); ?></span>
@@ -703,13 +722,13 @@ function wp_print_media_templates() {
                                <option value="post" <# if ( ! wp.media.galleryDefaults.link || 'post' == wp.media.galleryDefaults.link ) {
                                        #>selected="selected"<# }
                                #>>
-                                       <?php esc_attr_e('Attachment Page'); ?>
+                                       <?php esc_html_e( 'Attachment Page' ); ?>
                                </option>
                                <option value="file" <# if ( 'file' == wp.media.galleryDefaults.link ) { #>selected="selected"<# } #>>
-                                       <?php esc_attr_e('Media File'); ?>
+                                       <?php esc_html_e( 'Media File' ); ?>
                                </option>
                                <option value="none" <# if ( 'none' == wp.media.galleryDefaults.link ) { #>selected="selected"<# } #>>
-                                       <?php esc_attr_e('None'); ?>
+                                       <?php esc_html_e( 'None' ); ?>
                                </option>
                        </select>
                </label>
@@ -732,10 +751,35 @@ function wp_print_media_templates() {
                        <span><?php _e( 'Random Order' ); ?></span>
                        <input type="checkbox" data-setting="_orderbyRandom" />
                </label>
+
+               <label class="setting size">
+                       <span><?php _e( 'Size' ); ?></span>
+                       <select class="size" name="size"
+                               data-setting="size"
+                               <# if ( data.userSettings ) { #>
+                                       data-user-setting="imgsize"
+                               <# } #>
+                               >
+                               <?php
+                               // This filter is documented in wp-admin/includes/media.php
+                               $size_names = apply_filters( 'image_size_names_choose', array(
+                                       'thumbnail' => __( 'Thumbnail' ),
+                                       'medium'    => __( 'Medium' ),
+                                       'large'     => __( 'Large' ),
+                                       'full'      => __( 'Full Size' ),
+                               ) );
+
+                               foreach ( $size_names as $size => $label ) : ?>
+                                       <option value="<?php echo esc_attr( $size ); ?>">
+                                               <?php echo esc_html( $label ); ?>
+                                       </option>
+                               <?php endforeach; ?>
+                       </select>
+               </label>
        </script>
 
        <script type="text/html" id="tmpl-playlist-settings">
-               <h3><?php _e( 'Playlist Settings' ); ?></h3>
+               <h2><?php _e( 'Playlist Settings' ); ?></h2>
 
                <# var emptyModel = _.isEmpty( data.model ),
                        isVideo = 'video' === data.controller.get('library').props.get('type'); #>
@@ -769,9 +813,9 @@ function wp_print_media_templates() {
        </script>
 
        <script type="text/html" id="tmpl-embed-link-settings">
-               <label class="setting title">
-                       <span><?php _e( 'Title' ); ?></span>
-                       <input type="text" class="alignment" data-setting="title" />
+               <label class="setting link-text">
+                       <span><?php _e( 'Link Text' ); ?></span>
+                       <input type="text" class="alignment" data-setting="linkText" />
                </label>
                <div class="embed-container" style="display: none;">
                        <div class="embed-preview"></div>
@@ -780,7 +824,7 @@ function wp_print_media_templates() {
 
        <script type="text/html" id="tmpl-embed-image-settings">
                <div class="thumbnail">
-                       <img src="{{ data.model.url }}" draggable="false" />
+                       <img src="{{ data.model.url }}" draggable="false" alt="" />
                </div>
 
                <?php
@@ -801,16 +845,16 @@ function wp_print_media_templates() {
                        <span><?php _e('Align'); ?></span>
                        <div class="button-group button-large" data-setting="align">
                                <button class="button" value="left">
-                                       <?php esc_attr_e('Left'); ?>
+                                       <?php esc_html_e( 'Left' ); ?>
                                </button>
                                <button class="button" value="center">
-                                       <?php esc_attr_e('Center'); ?>
+                                       <?php esc_html_e( 'Center' ); ?>
                                </button>
                                <button class="button" value="right">
-                                       <?php esc_attr_e('Right'); ?>
+                                       <?php esc_html_e( 'Right' ); ?>
                                </button>
                                <button class="button active" value="none">
-                                       <?php esc_attr_e('None'); ?>
+                                       <?php esc_html_e( 'None' ); ?>
                                </button>
                        </div>
                </div>
@@ -819,13 +863,13 @@ function wp_print_media_templates() {
                        <span><?php _e('Link To'); ?></span>
                        <div class="button-group button-large" data-setting="link">
                                <button class="button" value="file">
-                                       <?php esc_attr_e('Image URL'); ?>
+                                       <?php esc_html_e( 'Image URL' ); ?>
                                </button>
                                <button class="button" value="custom">
-                                       <?php esc_attr_e('Custom URL'); ?>
+                                       <?php esc_html_e( 'Custom URL' ); ?>
                                </button>
                                <button class="button active" value="none">
-                                       <?php esc_attr_e('None'); ?>
+                                       <?php esc_html_e( 'None' ); ?>
                                </button>
                        </div>
                        <input type="text" class="link-to-custom" data-setting="linkUrl" />
@@ -837,7 +881,7 @@ function wp_print_media_templates() {
                        <div class="embed-media-settings">
                                <div class="column-image">
                                        <div class="image">
-                                               <img src="{{ data.model.url }}" draggable="false" />
+                                               <img src="{{ data.model.url }}" draggable="false" alt="" />
 
                                                <# if ( data.attachment && window.imageEdit ) { #>
                                                        <div class="actions">
@@ -862,21 +906,21 @@ function wp_print_media_templates() {
                                                <input type="text" data-setting="alt" value="{{ data.model.alt }}" />
                                        </label>
 
-                                       <h3><?php _e( 'Display Settings' ); ?></h3>
+                                       <h2><?php _e( 'Display Settings' ); ?></h2>
                                        <div class="setting align">
                                                <span><?php _e('Align'); ?></span>
                                                <div class="button-group button-large" data-setting="align">
                                                        <button class="button" value="left">
-                                                               <?php esc_attr_e('Left'); ?>
+                                                               <?php esc_html_e( 'Left' ); ?>
                                                        </button>
                                                        <button class="button" value="center">
-                                                               <?php esc_attr_e('Center'); ?>
+                                                               <?php esc_html_e( 'Center' ); ?>
                                                        </button>
                                                        <button class="button" value="right">
-                                                               <?php esc_attr_e('Right'); ?>
+                                                               <?php esc_html_e( 'Right' ); ?>
                                                        </button>
                                                        <button class="button active" value="none">
-                                                               <?php esc_attr_e('None'); ?>
+                                                               <?php esc_html_e( 'None' ); ?>
                                                        </button>
                                                </div>
                                        </div>
@@ -924,27 +968,27 @@ function wp_print_media_templates() {
                                                <select data-setting="link">
                                                <# if ( data.attachment ) { #>
                                                        <option value="file">
-                                                               <?php esc_attr_e('Media File'); ?>
+                                                               <?php esc_html_e( 'Media File' ); ?>
                                                        </option>
                                                        <option value="post">
-                                                               <?php esc_attr_e('Attachment Page'); ?>
+                                                               <?php esc_html_e( 'Attachment Page' ); ?>
                                                        </option>
                                                <# } else { #>
                                                        <option value="file">
-                                                               <?php esc_attr_e('Image URL'); ?>
+                                                               <?php esc_html_e( 'Image URL' ); ?>
                                                        </option>
                                                <# } #>
                                                        <option value="custom">
-                                                               <?php esc_attr_e('Custom URL'); ?>
+                                                               <?php esc_html_e( 'Custom URL' ); ?>
                                                        </option>
                                                        <option value="none">
-                                                               <?php esc_attr_e('None'); ?>
+                                                               <?php esc_html_e( 'None' ); ?>
                                                        </option>
                                                </select>
                                                <input type="text" class="link-to-custom" data-setting="linkUrl" />
                                        </div>
                                        <div class="advanced-section">
-                                               <h3><a class="advanced-toggle" href="#"><?php _e('Advanced Options'); ?></a></h3>
+                                               <h2><button type="button" class="button-link advanced-toggle"><?php _e( 'Advanced Options' ); ?></button></h2>
                                                <div class="advanced-settings hidden">
                                                        <div class="advanced-image">
                                                                <label class="setting title-text">
@@ -958,7 +1002,7 @@ function wp_print_media_templates() {
                                                        </div>
                                                        <div class="advanced-link">
                                                                <div class="setting link-target">
-                                                                       <label><input type="checkbox" data-setting="linkTargetBlank" value="_blank" <# if ( data.model.linkTargetBlank ) { #>checked="checked"<# } #>><?php _e( 'Open link in a new window/tab' ); ?></label>
+                                                                       <label><input type="checkbox" data-setting="linkTargetBlank" value="_blank" <# if ( data.model.linkTargetBlank ) { #>checked="checked"<# } #>><?php _e( 'Open link in a new tab' ); ?></label>
                                                                </div>
                                                                <label class="setting link-rel">
                                                                        <span><?php _e('Link Rel'); ?></span>
@@ -1001,7 +1045,7 @@ function wp_print_media_templates() {
                                <label class="setting">
                                        <span>SRC</span>
                                        <input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" />
-                                       <a class="remove-setting"><?php _e( 'Remove' ); ?></a>
+                                       <button type="button" class="button-link remove-setting"><?php _e( 'Remove audio source' ); ?></button>
                                </label>
                                <# } #>
                                <?php
@@ -1015,7 +1059,7 @@ function wp_print_media_templates() {
                                <label class="setting">
                                        <span><?php echo strtoupper( $type ) ?></span>
                                        <input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" />
-                                       <a class="remove-setting"><?php _e( 'Remove' ); ?></a>
+                                       <button type="button" class="button-link remove-setting"><?php _e( 'Remove audio source' ); ?></button>
                                </label>
                                <# } #>
                                <?php endforeach ?>
@@ -1065,8 +1109,7 @@ function wp_print_media_templates() {
                        <div class="embed-media-settings embed-video-settings">
                                <div class="wp-video-holder">
                                <#
-                               var isYouTube = ! _.isEmpty( data.model.src ) && data.model.src.match(/youtube|youtu\.be/);
-                                       w = ! data.model.width || data.model.width > 640 ? 640 : data.model.width,
+                               var w = ! data.model.width || data.model.width > 640 ? 640 : data.model.width,
                                        h = ! data.model.height ? 360 : data.model.height;
 
                                if ( data.model.width && w !== data.model.width ) {
@@ -1085,7 +1128,7 @@ function wp_print_media_templates() {
                                <label class="setting">
                                        <span>SRC</span>
                                        <input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" />
-                                       <a class="remove-setting"><?php _e( 'Remove' ); ?></a>
+                                       <button type="button" class="button-link remove-setting"><?php _e( 'Remove video source' ); ?></button>
                                </label>
                                <# } #>
                                <?php foreach ( $video_types as $type ):
@@ -1097,7 +1140,7 @@ function wp_print_media_templates() {
                                <label class="setting">
                                        <span><?php echo strtoupper( $type ) ?></span>
                                        <input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" />
-                                       <a class="remove-setting"><?php _e( 'Remove' ); ?></a>
+                                       <button type="button" class="button-link remove-setting"><?php _e( 'Remove video source' ); ?></button>
                                </label>
                                <# } #>
                                <?php endforeach ?>
@@ -1118,7 +1161,7 @@ function wp_print_media_templates() {
                                <label class="setting">
                                        <span><?php _e( 'Poster Image' ); ?></span>
                                        <input type="text" disabled="disabled" data-setting="poster" value="{{ data.model.poster }}" />
-                                       <a class="remove-setting"><?php _e( 'Remove' ); ?></a>
+                                       <button type="button" class="button-link remove-setting"><?php _e( 'Remove poster image' ); ?></button>
                                </label>
                                <# } #>
                                <div class="setting preload">
@@ -1150,7 +1193,7 @@ function wp_print_media_templates() {
                                                        content += track.outerHTML; #>
                                                <p>
                                                        <input class="content-track" type="text" value="{{ track.outerHTML }}" />
-                                                       <a class="remove-setting remove-track"><?php _e( 'Remove' ); ?></a>
+                                                       <button type="button" class="button-link remove-setting remove-track"><?php _ex( 'Remove video track', 'media' ); ?></button>
                                                </p>
                                                <# } ); #>
                                        <# } else { #>
@@ -1163,20 +1206,20 @@ function wp_print_media_templates() {
        </script>
 
        <script type="text/html" id="tmpl-editor-gallery">
-               <# if ( data.attachments ) { #>
+               <# if ( data.attachments.length ) { #>
                        <div class="gallery gallery-columns-{{ data.columns }}">
                                <# _.each( data.attachments, function( attachment, index ) { #>
                                        <dl class="gallery-item">
                                                <dt class="gallery-icon">
                                                        <# if ( attachment.thumbnail ) { #>
-                                                               <img src="{{ attachment.thumbnail.url }}" width="{{ attachment.thumbnail.width }}" height="{{ attachment.thumbnail.height }}" />
+                                                               <img src="{{ attachment.thumbnail.url }}" width="{{ attachment.thumbnail.width }}" height="{{ attachment.thumbnail.height }}" alt="" />
                                                        <# } else { #>
-                                                               <img src="{{ attachment.url }}" />
+                                                               <img src="{{ attachment.url }}" alt="" />
                                                        <# } #>
                                                </dt>
                                                <# if ( attachment.caption ) { #>
                                                        <dd class="wp-caption-text gallery-caption">
-                                                               {{ attachment.caption }}
+                                                               {{{ data.verifyHTML( attachment.caption ) }}}
                                                        </dd>
                                                <# } #>
                                        </dl>
@@ -1193,10 +1236,28 @@ function wp_print_media_templates() {
        </script>
 
        <script type="text/html" id="tmpl-crop-content">
-               <img class="crop-image" src="{{ data.url }}">
+               <img class="crop-image" src="{{ data.url }}" alt="<?php esc_attr_e( 'Image crop area preview. Requires mouse interaction.' ); ?>">
                <div class="upload-errors"></div>
        </script>
 
+       <script type="text/html" id="tmpl-site-icon-preview">
+               <h2><?php _e( 'Preview' ); ?></h2>
+               <strong aria-hidden="true"><?php _e( 'As a browser icon' ); ?></strong>
+               <div class="favicon-preview">
+                       <img src="<?php echo esc_url( admin_url( 'images/' . ( is_rtl() ? 'browser-rtl.png' : 'browser.png' ) ) ); ?>" class="browser-preview" width="182" height="" alt="" />
+
+                       <div class="favicon">
+                               <img id="preview-favicon" src="{{ data.url }}" alt="<?php esc_attr_e( 'Preview as a browser icon' ); ?>"/>
+                       </div>
+                       <span class="browser-title" aria-hidden="true"><?php bloginfo( 'name' ); ?></span>
+               </div>
+
+               <strong aria-hidden="true"><?php _e( 'As an app icon' ); ?></strong>
+               <div class="app-icon-preview">
+                       <img id="preview-app-icon" src="{{ data.url }}" alt="<?php esc_attr_e( 'Preview as an app icon' ); ?>"/>
+               </div>
+       </script>
+
        <?php
 
        /**