]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/media-template.php
WordPress 4.2.4-scripts
[autoinstalls/wordpress.git] / wp-includes / media-template.php
index afb690e89f5a48482ae02e5058323627ef15daa6..6999f1bdf34f4669ee6ce93c6e42e1c42091f6e4 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 = h_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;
@@ -72,10 +77,19 @@ function wp_underscore_video_template() {
        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">
 <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 +114,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() ] }}" />
                <# }
@@ -176,7 +192,7 @@ function wp_print_media_templates() {
                        <h3 class="upload-message">{{ data.message }}</h3>
                <# } #>
                <?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>
+                       <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.'), 'https://apps.wordpress.org/' ); ?></h3>
                <?php elseif ( is_multisite() && ! is_upload_space_available() ) : ?>
                        <h3 class="upload-instructions"><?php _e( 'Upload Limit Exceeded' ); ?></h3>
                        <?php
@@ -312,7 +328,7 @@ function wp_print_media_templates() {
                                <# } #>
 
                                <div class="attachment-actions">
-                                       <# if ( 'image' === data.type && ! data.uploading && data.sizes ) { #>
+                                       <# if ( 'image' === data.type && ! data.uploading && data.sizes && data.can.save ) { #>
                                                <a class="button edit-attachment" href="#"><?php _e( 'Edit Image' ); ?></a>
                                        <# } #>
                                </div>
@@ -394,7 +410,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 +424,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>
                                                <# } else { #>
-                                                       <a class="trash-attachment" href="#"><?php _e( 'Trash' ); ?></a>
+                                                       <a class="trash-attachment" href="#"><?php _ex( 'Trash', 'verb' ); ?></a>
                                                <# } #>
-                                               <?php else: ?>
-                                                       <a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ); ?></a>
-                                               <?php endif; ?>
-                                       <# } #>
+                                       <?php else: ?>
+                                               <a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ); ?></a>
+                                       <?php endif; ?>
+                               <# } #>
                        </div>
 
                </div>
@@ -518,7 +536,7 @@ function wp_print_media_templates() {
                                        <# if ( 'trash' === data.status ) { #>
                                                <a class="untrash-attachment" href="#"><?php _e( 'Untrash' ); ?></a>
                                        <# } else { #>
-                                               <a class="trash-attachment" href="#"><?php _e( 'Trash' ); ?></a>
+                                               <a class="trash-attachment" href="#"><?php _ex( 'Trash', 'verb' ); ?></a>
                                        <# } #>
                                        <?php else: ?>
                                                <a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ); ?></a>
@@ -573,7 +591,7 @@ 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>
+                               <a class="edit-selection" href="#"><?php _e( 'Edit Selection' ); ?></a>
                        <# } #>
                        <# if ( data.clearable ) { #>
                                <a class="clear-selection" href="#"><?php _e('Clear'); ?></a>
@@ -732,6 +750,31 @@ 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">
@@ -769,9 +812,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>
@@ -1065,8 +1108,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 ) {
@@ -1163,7 +1205,7 @@ 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">