]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-includes/media-template.php
WordPress 4.0-scripts
[autoinstalls/wordpress.git] / wp-includes / media-template.php
1 <?php
2 /**
3  * WordPress media templates.
4  *
5  * @package WordPress
6  * @subpackage Media
7  * @since 3.5.0
8  */
9
10 /**
11  * Output the markup for a audio tag to be used in an Underscore template
12  * when data.model is passed.
13  *
14  * @since 3.9.0
15  */
16 function wp_underscore_audio_template() {
17         $audio_types = wp_get_audio_extensions();
18 ?>
19 <audio style="visibility: hidden"
20         controls
21         class="wp-audio-shortcode"
22         width="{{ _.isUndefined( data.model.width ) ? 400 : data.model.width }}"
23         preload="{{ _.isUndefined( data.model.preload ) ? 'none' : data.model.preload }}"
24         <#
25         <?php foreach ( array( 'autoplay', 'loop' ) as $attr ):
26         ?>if ( ! _.isUndefined( data.model.<?php echo $attr ?> ) && data.model.<?php echo $attr ?> ) {
27                 #> <?php echo $attr ?><#
28         }
29         <?php endforeach ?>#>
30 >
31         <# if ( ! _.isEmpty( data.model.src ) ) { #>
32         <source src="{{ data.model.src }}" type="{{ wp.media.view.settings.embedMimes[ data.model.src.split('.').pop() ] }}" />
33         <# } #>
34
35         <?php foreach ( $audio_types as $type ):
36         ?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) { #>
37         <source src="{{ data.model.<?php echo $type ?> }}" type="{{ wp.media.view.settings.embedMimes[ '<?php echo $type ?>' ] }}" />
38         <# } #>
39         <?php endforeach;
40 ?></audio>
41 <?php
42 }
43
44 /**
45  * Output the markup for a video tag to be used in an Underscore template
46  * when data.model is passed.
47  *
48  * @since 3.9.0
49  */
50 function wp_underscore_video_template() {
51         $video_types = wp_get_video_extensions();
52 ?>
53 <#  var w_rule = h_rule = '',
54                 w, h, settings = wp.media.view.settings,
55                 isYouTube = ! _.isEmpty( data.model.src ) && data.model.src.match(/youtube|youtu\.be/);
56
57         if ( settings.contentWidth && data.model.width >= settings.contentWidth ) {
58                 w = settings.contentWidth;
59         } else {
60                 w = data.model.width;
61         }
62
63         if ( w !== data.model.width ) {
64                 h = Math.ceil( ( data.model.height * w ) / data.model.width );
65         } else {
66                 h = data.model.height;
67         }
68
69         if ( w ) {
70                 w_rule = 'width: ' + w + 'px; ';
71         }
72         if ( h ) {
73                 h_rule = 'height: ' + h + 'px;';
74         }
75 #>
76 <div style="{{ w_rule }}{{ h_rule }}" class="wp-video">
77 <video controls
78         class="wp-video-shortcode{{ isYouTube ? ' youtube-video' : '' }}"
79         <# if ( w ) { #>width="{{ w }}"<# } #>
80         <# if ( h ) { #>height="{{ h }}"<# } #>
81         <?php
82         $props = array( 'poster' => '', 'preload' => 'metadata' );
83         foreach ( $props as $key => $value ):
84                 if ( empty( $value ) ) {
85                 ?><#
86                 if ( ! _.isUndefined( data.model.<?php echo $key ?> ) && data.model.<?php echo $key ?> ) {
87                         #> <?php echo $key ?>="{{ data.model.<?php echo $key ?> }}"<#
88                 } #>
89                 <?php } else {
90                         echo $key ?>="{{ _.isUndefined( data.model.<?php echo $key ?> ) ? '<?php echo $value ?>' : data.model.<?php echo $key ?> }}"<?php
91                 }
92         endforeach;
93         ?><#
94         <?php foreach ( array( 'autoplay', 'loop' ) as $attr ):
95         ?> if ( ! _.isUndefined( data.model.<?php echo $attr ?> ) && data.model.<?php echo $attr ?> ) {
96                 #> <?php echo $attr ?><#
97         }
98         <?php endforeach ?>#>
99 >
100         <# if ( ! _.isEmpty( data.model.src ) ) {
101                 if ( isYouTube ) { #>
102                 <source src="{{ data.model.src }}" type="video/youtube" />
103                 <# } else { #>
104                 <source src="{{ data.model.src }}" type="{{ settings.embedMimes[ data.model.src.split('.').pop() ] }}" />
105                 <# }
106         } #>
107
108         <?php foreach ( $video_types as $type ):
109         ?><# if ( data.model.<?php echo $type ?> ) { #>
110         <source src="{{ data.model.<?php echo $type ?> }}" type="{{ settings.embedMimes[ '<?php echo $type ?>' ] }}" />
111         <# } #>
112         <?php endforeach; ?>
113         {{{ data.model.content }}}
114 </video>
115 </div>
116 <?php
117 }
118
119 /**
120  * Prints the templates used in the media manager.
121  *
122  * @since 3.5.0
123  */
124 function wp_print_media_templates() {
125         global $is_IE;
126         $class = 'media-modal wp-core-ui';
127         if ( $is_IE && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false )
128                 $class .= ' ie7';
129         ?>
130         <!--[if lte IE 8]>
131         <style>
132                 .attachment:focus {
133                         outline: #1e8cbe solid;
134                 }
135                 .selected.attachment {
136                         outline: #1e8cbe solid;
137                 }
138         </style>
139         <![endif]-->
140         <script type="text/html" id="tmpl-media-frame">
141                 <div class="media-frame-menu"></div>
142                 <div class="media-frame-title"></div>
143                 <div class="media-frame-router"></div>
144                 <div class="media-frame-content"></div>
145                 <div class="media-frame-toolbar"></div>
146                 <div class="media-frame-uploader"></div>
147         </script>
148
149         <script type="text/html" id="tmpl-media-modal">
150                 <div class="<?php echo $class; ?>">
151                         <a class="media-modal-close" href="#"><span class="media-modal-icon"><span class="screen-reader-text"><?php _e( 'Close media panel' ); ?></span></span></a>
152                         <div class="media-modal-content"></div>
153                 </div>
154                 <div class="media-modal-backdrop"></div>
155         </script>
156
157         <script type="text/html" id="tmpl-uploader-window">
158                 <div class="uploader-window-content">
159                         <h3><?php _e( 'Drop files to upload' ); ?></h3>
160                 </div>
161         </script>
162
163         <script type="text/html" id="tmpl-uploader-editor">
164                 <div class="uploader-editor-content">
165                         <div class="uploader-editor-title"><?php _e( 'Drop files to upload' ); ?></div>
166                 </div>
167         </script>
168
169         <script type="text/html" id="tmpl-uploader-inline">
170                 <# var messageClass = data.message ? 'has-upload-message' : 'no-upload-message'; #>
171                 <# if ( data.canClose ) { #>
172                 <button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close uploader' ); ?></span></button>
173                 <# } #>
174                 <div class="uploader-inline-content {{ messageClass }}">
175                 <# if ( data.message ) { #>
176                         <h3 class="upload-message">{{ data.message }}</h3>
177                 <# } #>
178                 <?php if ( ! _device_can_upload() ) : ?>
179                         <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>
180                 <?php elseif ( is_multisite() && ! is_upload_space_available() ) : ?>
181                         <h3 class="upload-instructions"><?php _e( 'Upload Limit Exceeded' ); ?></h3>
182                         <?php
183                         /** This action is documented in wp-admin/includes/media.php */
184                         do_action( 'upload_ui_over_quota' ); ?>
185
186                 <?php else : ?>
187                         <div class="upload-ui">
188                                 <h3 class="upload-instructions drop-instructions"><?php _e( 'Drop files anywhere to upload' ); ?></h3>
189                                 <p class="upload-instructions drop-instructions"><?php _ex( 'or', 'Uploader: Drop files here - or - Select Files' ); ?></p>
190                                 <a href="#" class="browser button button-hero"><?php _e( 'Select Files' ); ?></a>
191                         </div>
192
193                         <div class="upload-inline-status"></div>
194
195                         <div class="post-upload-ui">
196                                 <?php
197                                 /** This action is documented in wp-admin/includes/media.php */
198                                 do_action( 'pre-upload-ui' );
199                                 /** This action is documented in wp-admin/includes/media.php */
200                                 do_action( 'pre-plupload-upload-ui' );
201
202                                 if ( 10 === remove_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' ) ) {
203                                         /** This action is documented in wp-admin/includes/media.php */
204                                         do_action( 'post-plupload-upload-ui' );
205                                         add_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' );
206                                 } else {
207                                         /** This action is documented in wp-admin/includes/media.php */
208                                         do_action( 'post-plupload-upload-ui' );
209                                 }
210
211                                 $max_upload_size = wp_max_upload_size();
212                                 if ( ! $max_upload_size ) {
213                                         $max_upload_size = 0;
214                                 }
215                                 ?>
216
217                                 <p class="max-upload-size"><?php
218                                         printf( __( 'Maximum upload file size: %s.' ), esc_html( size_format( $max_upload_size ) ) );
219                                 ?></p>
220
221                                 <# if ( data.suggestedWidth && data.suggestedHeight ) { #>
222                                         <p class="suggested-dimensions">
223                                                 <?php _e( 'Suggested image dimensions:' ); ?> {{data.suggestedWidth}} &times; {{data.suggestedHeight}}
224                                         </p>
225                                 <# } #>
226
227                                 <?php
228                                 /** This action is documented in wp-admin/includes/media.php */
229                                 do_action( 'post-upload-ui' ); ?>
230                         </div>
231                 <?php endif; ?>
232                 </div>
233         </script>
234
235         <script type="text/html" id="tmpl-media-library-view-switcher">
236                 <a href="<?php echo esc_url( add_query_arg( 'mode', 'list', $_SERVER['REQUEST_URI'] ) ) ?>" class="view-list">
237                         <span class="screen-reader-text"><?php _e( 'List View' ); ?></span>
238                 </a>
239                 <a href="<?php echo esc_url( add_query_arg( 'mode', 'grid', $_SERVER['REQUEST_URI'] ) ) ?>" class="view-grid current">
240                         <span class="screen-reader-text"><?php _e( 'Grid View' ); ?></span>
241                 </a>
242         </script>
243
244         <script type="text/html" id="tmpl-uploader-status">
245                 <h3><?php _e( 'Uploading' ); ?></h3>
246                 <a class="upload-dismiss-errors" href="#"><?php _e('Dismiss Errors'); ?></a>
247
248                 <div class="media-progress-bar"><div></div></div>
249                 <div class="upload-details">
250                         <span class="upload-count">
251                                 <span class="upload-index"></span> / <span class="upload-total"></span>
252                         </span>
253                         <span class="upload-detail-separator">&ndash;</span>
254                         <span class="upload-filename"></span>
255                 </div>
256                 <div class="upload-errors"></div>
257         </script>
258
259         <script type="text/html" id="tmpl-uploader-status-error">
260                 <span class="upload-error-label"><?php _e('Error'); ?></span>
261                 <span class="upload-error-filename">{{{ data.filename }}}</span>
262                 <span class="upload-error-message">{{ data.message }}</span>
263         </script>
264
265         <script type="text/html" id="tmpl-edit-attachment-frame">
266                 <div class="edit-media-header">
267                         <button class="left dashicons <# if ( ! data.hasPrevious ) { #> disabled <# } #>"><span class="screen-reader-text"><?php _e( 'Edit previous media item' ); ?></span></button>
268                         <button class="right dashicons <# if ( ! data.hasNext ) { #> disabled <# } #>"><span class="screen-reader-text"><?php _e( 'Edit next media item' ); ?></span></button>
269                 </div>
270                 <div class="media-frame-title"></div>
271                 <div class="media-frame-content"></div>
272         </script>
273
274         <script type="text/html" id="tmpl-attachment-details-two-column">
275                 <div class="attachment-media-view {{ data.orientation }}">
276                         <div class="thumbnail thumbnail-{{ data.type }}">
277                                 <# if ( data.uploading ) { #>
278                                         <div class="media-progress-bar"><div></div></div>
279                                 <# } else if ( 'image' === data.type && data.sizes && data.sizes.large ) { #>
280                                         <img class="details-image" src="{{ data.sizes.large.url }}" draggable="false" />
281                                 <# } else if ( 'image' === data.type && data.sizes && data.sizes.full ) { #>
282                                         <img class="details-image" src="{{ data.sizes.full.url }}" draggable="false" />
283                                 <# } else if ( -1 === jQuery.inArray( data.type, [ 'audio', 'video' ] ) ) { #>
284                                         <img class="details-image" src="{{ data.icon }}" class="icon" draggable="false" />
285                                 <# } #>
286
287                                 <# if ( 'audio' === data.type ) { #>
288                                 <div class="wp-media-wrapper">
289                                         <audio style="visibility: hidden" controls class="wp-audio-shortcode" width="100%" preload="none">
290                                                 <source type="{{ data.mime }}" src="{{ data.url }}"/>
291                                         </audio>
292                                 </div>
293                                 <# } else if ( 'video' === data.type ) {
294                                         var w_rule = h_rule = '';
295                                         if ( data.width ) {
296                                                 w_rule = 'width: ' + data.width + 'px;';
297                                         } else if ( wp.media.view.settings.contentWidth ) {
298                                                 w_rule = 'width: ' + wp.media.view.settings.contentWidth + 'px;';
299                                         }
300                                         if ( data.height ) {
301                                                 h_rule = 'height: ' + data.height + 'px;';
302                                         }
303                                 #>
304                                 <div style="{{ w_rule }}{{ h_rule }}" class="wp-media-wrapper wp-video">
305                                         <video controls="controls" class="wp-video-shortcode" preload="metadata"
306                                                 <# if ( data.width ) { #>width="{{ data.width }}"<# } #>
307                                                 <# if ( data.height ) { #>height="{{ data.height }}"<# } #>
308                                                 <# if ( data.image && data.image.src !== data.icon ) { #>poster="{{ data.image.src }}"<# } #>>
309                                                 <source type="{{ data.mime }}" src="{{ data.url }}"/>
310                                         </video>
311                                 </div>
312                                 <# } #>
313
314                                 <div class="attachment-actions">
315                                         <# if ( 'image' === data.type && ! data.uploading && data.sizes ) { #>
316                                                 <a class="button edit-attachment" href="#"><?php _e( 'Edit Image' ); ?></a>
317                                         <# } #>
318                                 </div>
319                         </div>
320                 </div>
321                 <div class="attachment-info">
322                         <span class="settings-save-status">
323                                 <span class="spinner"></span>
324                                 <span class="saved"><?php esc_html_e('Saved.'); ?></span>
325                         </span>
326                         <div class="details">
327                                 <div class="filename"><strong><?php _e( 'File name:' ); ?></strong> {{ data.filename }}</div>
328                                 <div class="filename"><strong><?php _e( 'File type:' ); ?></strong> {{ data.mime }}</div>
329                                 <div class="uploaded"><strong><?php _e( 'Uploaded on:' ); ?></strong> {{ data.dateFormatted }}</div>
330
331                                 <div class="file-size"><strong><?php _e( 'File size:' ); ?></strong> {{ data.filesizeHumanReadable }}</div>
332                                 <# if ( 'image' === data.type && ! data.uploading ) { #>
333                                         <# if ( data.width && data.height ) { #>
334                                                 <div class="dimensions"><strong><?php _e( 'Dimensions:' ); ?></strong> {{ data.width }} &times; {{ data.height }}</div>
335                                         <# } #>
336                                 <# } #>
337
338                                 <# if ( data.fileLength ) { #>
339                                         <div class="file-length"><strong><?php _e( 'Length:' ); ?></strong> {{ data.fileLength }}</div>
340                                 <# } #>
341
342                                 <# if ( 'audio' === data.type && data.meta.bitrate ) { #>
343                                         <div class="bitrate">
344                                                 <strong><?php _e( 'Bitrate:' ); ?></strong> {{ Math.round( data.meta.bitrate / 1000 ) }}kb/s
345                                                 <# if ( data.meta.bitrate_mode ) { #>
346                                                 {{ ' ' + data.meta.bitrate_mode.toUpperCase() }}
347                                                 <# } #>
348                                         </div>
349                                 <# } #>
350
351                                 <div class="compat-meta">
352                                         <# if ( data.compat && data.compat.meta ) { #>
353                                                 {{{ data.compat.meta }}}
354                                         <# } #>
355                                 </div>
356                         </div>
357
358                         <div class="settings">
359                                 <label class="setting" data-setting="url">
360                                         <span class="name"><?php _e('URL'); ?></span>
361                                         <input type="text" value="{{ data.url }}" readonly />
362                                 </label>
363                                 <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
364                                 <label class="setting" data-setting="title">
365                                         <span class="name"><?php _e('Title'); ?></span>
366                                         <input type="text" value="{{ data.title }}" {{ maybeReadOnly }} />
367                                 </label>
368                                 <# if ( 'audio' === data.type ) { #>
369                                 <?php foreach ( array(
370                                         'artist' => __( 'Artist' ),
371                                         'album' => __( 'Album' ),
372                                 ) as $key => $label ) : ?>
373                                 <label class="setting" data-setting="<?php echo esc_attr( $key ) ?>">
374                                         <span class="name"><?php echo $label ?></span>
375                                         <input type="text" value="{{ data.<?php echo $key ?> || data.meta.<?php echo $key ?> || '' }}" />
376                                 </label>
377                                 <?php endforeach; ?>
378                                 <# } #>
379                                 <label class="setting" data-setting="caption">
380                                         <span class="name"><?php _e( 'Caption' ); ?></span>
381                                         <textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea>
382                                 </label>
383                                 <# if ( 'image' === data.type ) { #>
384                                         <label class="setting" data-setting="alt">
385                                                 <span class="name"><?php _e( 'Alt Text' ); ?></span>
386                                                 <input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} />
387                                         </label>
388                                 <# } #>
389                                 <label class="setting" data-setting="description">
390                                         <span class="name"><?php _e('Description'); ?></span>
391                                         <textarea {{ maybeReadOnly }}>{{ data.description }}</textarea>
392                                 </label>
393                                 <label class="setting">
394                                         <span class="name"><?php _e( 'Uploaded By' ); ?></span>
395                                         <span class="value">{{ data.authorName }}</span>
396                                 </label>
397                                 <# if ( data.uploadedTo ) { #>
398                                         <label class="setting">
399                                                 <span class="name"><?php _e( 'Uploaded To' ); ?></span>
400                                                 <# if ( data.uploadedToLink ) { #>
401                                                         <span class="value"><a href="{{ data.uploadedToLink }}">{{ data.uploadedToTitle }}</a></span>
402                                                 <# } else { #>
403                                                         <span class="value">{{ data.uploadedToTitle }}</span>
404                                                 <# } #>
405                                         </label>
406                                 <# } #>
407                                 <div class="attachment-compat"></div>
408                         </div>
409
410                         <div class="actions">
411                                 <a class="view-attachment" href="{{ data.link }}"><?php _e( 'View attachment page' ); ?></a> |
412                                 <a href="post.php?post={{ data.id }}&action=edit"><?php _e( 'Edit more details' ); ?></a>
413                                 <# if ( ! data.uploading && data.can.remove ) { #> |
414                                                 <?php if ( MEDIA_TRASH ): ?>
415                                                 <# if ( 'trash' === data.status ) { #>
416                                                         <a class="untrash-attachment" href="#"><?php _e( 'Untrash' ); ?></a>
417                                                 <# } else { #>
418                                                         <a class="trash-attachment" href="#"><?php _e( 'Trash' ); ?></a>
419                                                 <# } #>
420                                                 <?php else: ?>
421                                                         <a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ); ?></a>
422                                                 <?php endif; ?>
423                                         <# } #>
424                         </div>
425
426                 </div>
427         </script>
428
429         <script type="text/html" id="tmpl-attachment">
430                 <div class="attachment-preview js--select-attachment type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}">
431                         <div class="thumbnail">
432                                 <# if ( data.uploading ) { #>
433                                         <div class="media-progress-bar"><div style="width: {{ data.percent }}%"></div></div>
434                                 <# } else if ( 'image' === data.type && data.sizes ) { #>
435                                         <div class="centered">
436                                                 <img src="{{ data.size.url }}" draggable="false" alt="" />
437                                         </div>
438                                 <# } else { #>
439                                         <div class="centered">
440                                                 <# if ( data.image && data.image.src && data.image.src !== data.icon ) { #>
441                                                         <img src="{{ data.image.src }}" class="thumbnail" draggable="false" />
442                                                 <# } else { #>
443                                                         <img src="{{ data.icon }}" class="icon" draggable="false" />
444                                                 <# } #>
445                                         </div>
446                                         <div class="filename">
447                                                 <div>{{ data.filename }}</div>
448                                         </div>
449                                 <# } #>
450                         </div>
451                         <# if ( data.buttons.close ) { #>
452                                 <a class="close media-modal-icon" href="#" title="<?php esc_attr_e('Remove'); ?>"></a>
453                         <# } #>
454                 </div>
455                 <# if ( data.buttons.check ) { #>
456                         <a class="check" href="#" title="<?php esc_attr_e('Deselect'); ?>" tabindex="-1"><div class="media-modal-icon"></div></a>
457                 <# } #>
458                 <#
459                 var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly';
460                 if ( data.describe ) {
461                         if ( 'image' === data.type ) { #>
462                                 <input type="text" value="{{ data.caption }}" class="describe" data-setting="caption"
463                                         placeholder="<?php esc_attr_e('Caption this image&hellip;'); ?>" {{ maybeReadOnly }} />
464                         <# } else { #>
465                                 <input type="text" value="{{ data.title }}" class="describe" data-setting="title"
466                                         <# if ( 'video' === data.type ) { #>
467                                                 placeholder="<?php esc_attr_e('Describe this video&hellip;'); ?>"
468                                         <# } else if ( 'audio' === data.type ) { #>
469                                                 placeholder="<?php esc_attr_e('Describe this audio file&hellip;'); ?>"
470                                         <# } else { #>
471                                                 placeholder="<?php esc_attr_e('Describe this media file&hellip;'); ?>"
472                                         <# } #> {{ maybeReadOnly }} />
473                         <# }
474                 } #>
475         </script>
476
477         <script type="text/html" id="tmpl-attachment-details">
478                 <h3>
479                         <?php _e('Attachment Details'); ?>
480
481                         <span class="settings-save-status">
482                                 <span class="spinner"></span>
483                                 <span class="saved"><?php esc_html_e('Saved.'); ?></span>
484                         </span>
485                 </h3>
486                 <div class="attachment-info">
487                         <div class="thumbnail thumbnail-{{ data.type }}">
488                                 <# if ( data.uploading ) { #>
489                                         <div class="media-progress-bar"><div></div></div>
490                                 <# } else if ( 'image' === data.type && data.sizes ) { #>
491                                         <img src="{{ data.size.url }}" draggable="false" />
492                                 <# } else { #>
493                                         <img src="{{ data.icon }}" class="icon" draggable="false" />
494                                 <# } #>
495                         </div>
496                         <div class="details">
497                                 <div class="filename">{{ data.filename }}</div>
498                                 <div class="uploaded">{{ data.dateFormatted }}</div>
499
500                                 <div class="file-size">{{ data.filesizeHumanReadable }}</div>
501                                 <# if ( 'image' === data.type && ! data.uploading ) { #>
502                                         <# if ( data.width && data.height ) { #>
503                                                 <div class="dimensions">{{ data.width }} &times; {{ data.height }}</div>
504                                         <# } #>
505
506                                         <# if ( data.can.save && data.sizes ) { #>
507                                                 <a class="edit-attachment" href="{{ data.editLink }}&amp;image-editor" target="_blank"><?php _e( 'Edit Image' ); ?></a>
508                                                 <a class="refresh-attachment" href="#"><?php _e( 'Refresh' ); ?></a>
509                                         <# } #>
510                                 <# } #>
511
512                                 <# if ( data.fileLength ) { #>
513                                         <div class="file-length"><?php _e( 'Length:' ); ?> {{ data.fileLength }}</div>
514                                 <# } #>
515
516                                 <# if ( ! data.uploading && data.can.remove ) { #>
517                                         <?php if ( MEDIA_TRASH ): ?>
518                                         <# if ( 'trash' === data.status ) { #>
519                                                 <a class="untrash-attachment" href="#"><?php _e( 'Untrash' ); ?></a>
520                                         <# } else { #>
521                                                 <a class="trash-attachment" href="#"><?php _e( 'Trash' ); ?></a>
522                                         <# } #>
523                                         <?php else: ?>
524                                                 <a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ); ?></a>
525                                         <?php endif; ?>
526                                 <# } #>
527
528                                 <div class="compat-meta">
529                                         <# if ( data.compat && data.compat.meta ) { #>
530                                                 {{{ data.compat.meta }}}
531                                         <# } #>
532                                 </div>
533                         </div>
534                 </div>
535
536                 <label class="setting" data-setting="url">
537                         <span class="name"><?php _e('URL'); ?></span>
538                         <input type="text" value="{{ data.url }}" readonly />
539                 </label>
540                 <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
541                 <label class="setting" data-setting="title">
542                         <span class="name"><?php _e('Title'); ?></span>
543                         <input type="text" value="{{ data.title }}" {{ maybeReadOnly }} />
544                 </label>
545                 <# if ( 'audio' === data.type ) { #>
546                 <?php foreach ( array(
547                         'artist' => __( 'Artist' ),
548                         'album' => __( 'Album' ),
549                 ) as $key => $label ) : ?>
550                 <label class="setting" data-setting="<?php echo esc_attr( $key ) ?>">
551                         <span class="name"><?php echo $label ?></span>
552                         <input type="text" value="{{ data.<?php echo $key ?> || data.meta.<?php echo $key ?> || '' }}" />
553                 </label>
554                 <?php endforeach; ?>
555                 <# } #>
556                 <label class="setting" data-setting="caption">
557                         <span class="name"><?php _e('Caption'); ?></span>
558                         <textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea>
559                 </label>
560                 <# if ( 'image' === data.type ) { #>
561                         <label class="setting" data-setting="alt">
562                                 <span class="name"><?php _e('Alt Text'); ?></span>
563                                 <input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} />
564                         </label>
565                 <# } #>
566                 <label class="setting" data-setting="description">
567                         <span class="name"><?php _e('Description'); ?></span>
568                         <textarea {{ maybeReadOnly }}>{{ data.description }}</textarea>
569                 </label>
570         </script>
571
572         <script type="text/html" id="tmpl-media-selection">
573                 <div class="selection-info">
574                         <span class="count"></span>
575                         <# if ( data.editable ) { #>
576                                 <a class="edit-selection" href="#"><?php _e('Edit'); ?></a>
577                         <# } #>
578                         <# if ( data.clearable ) { #>
579                                 <a class="clear-selection" href="#"><?php _e('Clear'); ?></a>
580                         <# } #>
581                 </div>
582                 <div class="selection-view"></div>
583         </script>
584
585         <script type="text/html" id="tmpl-attachment-display-settings">
586                 <h3><?php _e('Attachment Display Settings'); ?></h3>
587
588                 <# if ( 'image' === data.type ) { #>
589                         <label class="setting">
590                                 <span><?php _e('Alignment'); ?></span>
591                                 <select class="alignment"
592                                         data-setting="align"
593                                         <# if ( data.userSettings ) { #>
594                                                 data-user-setting="align"
595                                         <# } #>>
596
597                                         <option value="left">
598                                                 <?php esc_attr_e('Left'); ?>
599                                         </option>
600                                         <option value="center">
601                                                 <?php esc_attr_e('Center'); ?>
602                                         </option>
603                                         <option value="right">
604                                                 <?php esc_attr_e('Right'); ?>
605                                         </option>
606                                         <option value="none" selected>
607                                                 <?php esc_attr_e('None'); ?>
608                                         </option>
609                                 </select>
610                         </label>
611                 <# } #>
612
613                 <div class="setting">
614                         <label>
615                                 <# if ( data.model.canEmbed ) { #>
616                                         <span><?php _e('Embed or Link'); ?></span>
617                                 <# } else { #>
618                                         <span><?php _e('Link To'); ?></span>
619                                 <# } #>
620
621                                 <select class="link-to"
622                                         data-setting="link"
623                                         <# if ( data.userSettings && ! data.model.canEmbed ) { #>
624                                                 data-user-setting="urlbutton"
625                                         <# } #>>
626
627                                 <# if ( data.model.canEmbed ) { #>
628                                         <option value="embed" selected>
629                                                 <?php esc_attr_e('Embed Media Player'); ?>
630                                         </option>
631                                         <option value="file">
632                                 <# } else { #>
633                                         <option value="file" selected>
634                                 <# } #>
635                                         <# if ( data.model.canEmbed ) { #>
636                                                 <?php esc_attr_e('Link to Media File'); ?>
637                                         <# } else { #>
638                                                 <?php esc_attr_e('Media File'); ?>
639                                         <# } #>
640                                         </option>
641                                         <option value="post">
642                                         <# if ( data.model.canEmbed ) { #>
643                                                 <?php esc_attr_e('Link to Attachment Page'); ?>
644                                         <# } else { #>
645                                                 <?php esc_attr_e('Attachment Page'); ?>
646                                         <# } #>
647                                         </option>
648                                 <# if ( 'image' === data.type ) { #>
649                                         <option value="custom">
650                                                 <?php esc_attr_e('Custom URL'); ?>
651                                         </option>
652                                         <option value="none">
653                                                 <?php esc_attr_e('None'); ?>
654                                         </option>
655                                 <# } #>
656                                 </select>
657                         </label>
658                         <input type="text" class="link-to-custom" data-setting="linkUrl" />
659                 </div>
660
661                 <# if ( 'undefined' !== typeof data.sizes ) { #>
662                         <label class="setting">
663                                 <span><?php _e('Size'); ?></span>
664                                 <select class="size" name="size"
665                                         data-setting="size"
666                                         <# if ( data.userSettings ) { #>
667                                                 data-user-setting="imgsize"
668                                         <# } #>>
669                                         <?php
670                                         /** This filter is documented in wp-admin/includes/media.php */
671                                         $sizes = apply_filters( 'image_size_names_choose', array(
672                                                 'thumbnail' => __('Thumbnail'),
673                                                 'medium'    => __('Medium'),
674                                                 'large'     => __('Large'),
675                                                 'full'      => __('Full Size'),
676                                         ) );
677
678                                         foreach ( $sizes as $value => $name ) : ?>
679                                                 <#
680                                                 var size = data.sizes['<?php echo esc_js( $value ); ?>'];
681                                                 if ( size ) { #>
682                                                         <option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, 'full' ); ?>>
683                                                                 <?php echo esc_html( $name ); ?> &ndash; {{ size.width }} &times; {{ size.height }}
684                                                         </option>
685                                                 <# } #>
686                                         <?php endforeach; ?>
687                                 </select>
688                         </label>
689                 <# } #>
690         </script>
691
692         <script type="text/html" id="tmpl-gallery-settings">
693                 <h3><?php _e('Gallery Settings'); ?></h3>
694
695                 <label class="setting">
696                         <span><?php _e('Link To'); ?></span>
697                         <select class="link-to"
698                                 data-setting="link"
699                                 <# if ( data.userSettings ) { #>
700                                         data-user-setting="urlbutton"
701                                 <# } #>>
702
703                                 <option value="post" <# if ( ! wp.media.galleryDefaults.link || 'post' == wp.media.galleryDefaults.link ) {
704                                         #>selected="selected"<# }
705                                 #>>
706                                         <?php esc_attr_e('Attachment Page'); ?>
707                                 </option>
708                                 <option value="file" <# if ( 'file' == wp.media.galleryDefaults.link ) { #>selected="selected"<# } #>>
709                                         <?php esc_attr_e('Media File'); ?>
710                                 </option>
711                                 <option value="none" <# if ( 'none' == wp.media.galleryDefaults.link ) { #>selected="selected"<# } #>>
712                                         <?php esc_attr_e('None'); ?>
713                                 </option>
714                         </select>
715                 </label>
716
717                 <label class="setting">
718                         <span><?php _e('Columns'); ?></span>
719                         <select class="columns" name="columns"
720                                 data-setting="columns">
721                                 <?php for ( $i = 1; $i <= 9; $i++ ) : ?>
722                                         <option value="<?php echo esc_attr( $i ); ?>" <#
723                                                 if ( <?php echo $i ?> == wp.media.galleryDefaults.columns ) { #>selected="selected"<# }
724                                         #>>
725                                                 <?php echo esc_html( $i ); ?>
726                                         </option>
727                                 <?php endfor; ?>
728                         </select>
729                 </label>
730
731                 <label class="setting">
732                         <span><?php _e( 'Random Order' ); ?></span>
733                         <input type="checkbox" data-setting="_orderbyRandom" />
734                 </label>
735         </script>
736
737         <script type="text/html" id="tmpl-playlist-settings">
738                 <h3><?php _e( 'Playlist Settings' ); ?></h3>
739
740                 <# var emptyModel = _.isEmpty( data.model ),
741                         isVideo = 'video' === data.controller.get('library').props.get('type'); #>
742
743                 <label class="setting">
744                         <input type="checkbox" data-setting="tracklist" <# if ( emptyModel ) { #>
745                                 checked="checked"
746                         <# } #> />
747                         <# if ( isVideo ) { #>
748                         <span><?php _e( 'Show Video List' ); ?></span>
749                         <# } else { #>
750                         <span><?php _e( 'Show Tracklist' ); ?></span>
751                         <# } #>
752                 </label>
753
754                 <# if ( ! isVideo ) { #>
755                 <label class="setting">
756                         <input type="checkbox" data-setting="artists" <# if ( emptyModel ) { #>
757                                 checked="checked"
758                         <# } #> />
759                         <span><?php _e( 'Show Artist Name in Tracklist' ); ?></span>
760                 </label>
761                 <# } #>
762
763                 <label class="setting">
764                         <input type="checkbox" data-setting="images" <# if ( emptyModel ) { #>
765                                 checked="checked"
766                         <# } #> />
767                         <span><?php _e( 'Show Images' ); ?></span>
768                 </label>
769         </script>
770
771         <script type="text/html" id="tmpl-embed-link-settings">
772                 <label class="setting title">
773                         <span><?php _e( 'Title' ); ?></span>
774                         <input type="text" class="alignment" data-setting="title" />
775                 </label>
776                 <div class="embed-container" style="display: none;">
777                         <div class="embed-preview"></div>
778                 </div>
779         </script>
780
781         <script type="text/html" id="tmpl-embed-image-settings">
782                 <div class="thumbnail">
783                         <img src="{{ data.model.url }}" draggable="false" />
784                 </div>
785
786                 <?php
787                 /** This filter is documented in wp-admin/includes/media.php */
788                 if ( ! apply_filters( 'disable_captions', '' ) ) : ?>
789                         <label class="setting caption">
790                                 <span><?php _e('Caption'); ?></span>
791                                 <textarea data-setting="caption" />
792                         </label>
793                 <?php endif; ?>
794
795                 <label class="setting alt-text">
796                         <span><?php _e('Alt Text'); ?></span>
797                         <input type="text" data-setting="alt" />
798                 </label>
799
800                 <div class="setting align">
801                         <span><?php _e('Align'); ?></span>
802                         <div class="button-group button-large" data-setting="align">
803                                 <button class="button" value="left">
804                                         <?php esc_attr_e('Left'); ?>
805                                 </button>
806                                 <button class="button" value="center">
807                                         <?php esc_attr_e('Center'); ?>
808                                 </button>
809                                 <button class="button" value="right">
810                                         <?php esc_attr_e('Right'); ?>
811                                 </button>
812                                 <button class="button active" value="none">
813                                         <?php esc_attr_e('None'); ?>
814                                 </button>
815                         </div>
816                 </div>
817
818                 <div class="setting link-to">
819                         <span><?php _e('Link To'); ?></span>
820                         <div class="button-group button-large" data-setting="link">
821                                 <button class="button" value="file">
822                                         <?php esc_attr_e('Image URL'); ?>
823                                 </button>
824                                 <button class="button" value="custom">
825                                         <?php esc_attr_e('Custom URL'); ?>
826                                 </button>
827                                 <button class="button active" value="none">
828                                         <?php esc_attr_e('None'); ?>
829                                 </button>
830                         </div>
831                         <input type="text" class="link-to-custom" data-setting="linkUrl" />
832                 </div>
833         </script>
834
835         <script type="text/html" id="tmpl-image-details">
836                 <div class="media-embed">
837                         <div class="embed-media-settings">
838                                 <div class="column-image">
839                                         <div class="image">
840                                                 <img src="{{ data.model.url }}" draggable="false" />
841
842                                                 <# if ( data.attachment && window.imageEdit ) { #>
843                                                         <div class="actions">
844                                                                 <input type="button" class="edit-attachment button" value="<?php esc_attr_e( 'Edit Original' ); ?>" />
845                                                                 <input type="button" class="replace-attachment button" value="<?php esc_attr_e( 'Replace' ); ?>" />
846                                                         </div>
847                                                 <# } #>
848                                         </div>
849                                 </div>
850                                 <div class="column-settings">
851                                         <?php
852                                         /** This filter is documented in wp-admin/includes/media.php */
853                                         if ( ! apply_filters( 'disable_captions', '' ) ) : ?>
854                                                 <label class="setting caption">
855                                                         <span><?php _e('Caption'); ?></span>
856                                                         <textarea data-setting="caption">{{ data.model.caption }}</textarea>
857                                                 </label>
858                                         <?php endif; ?>
859
860                                         <label class="setting alt-text">
861                                                 <span><?php _e('Alternative Text'); ?></span>
862                                                 <input type="text" data-setting="alt" value="{{ data.model.alt }}" />
863                                         </label>
864
865                                         <h3><?php _e( 'Display Settings' ); ?></h3>
866                                         <div class="setting align">
867                                                 <span><?php _e('Align'); ?></span>
868                                                 <div class="button-group button-large" data-setting="align">
869                                                         <button class="button" value="left">
870                                                                 <?php esc_attr_e('Left'); ?>
871                                                         </button>
872                                                         <button class="button" value="center">
873                                                                 <?php esc_attr_e('Center'); ?>
874                                                         </button>
875                                                         <button class="button" value="right">
876                                                                 <?php esc_attr_e('Right'); ?>
877                                                         </button>
878                                                         <button class="button active" value="none">
879                                                                 <?php esc_attr_e('None'); ?>
880                                                         </button>
881                                                 </div>
882                                         </div>
883
884                                         <# if ( data.attachment ) { #>
885                                                 <# if ( 'undefined' !== typeof data.attachment.sizes ) { #>
886                                                         <label class="setting size">
887                                                                 <span><?php _e('Size'); ?></span>
888                                                                 <select class="size" name="size"
889                                                                         data-setting="size"
890                                                                         <# if ( data.userSettings ) { #>
891                                                                                 data-user-setting="imgsize"
892                                                                         <# } #>>
893                                                                         <?php
894                                                                         /** This filter is documented in wp-admin/includes/media.php */
895                                                                         $sizes = apply_filters( 'image_size_names_choose', array(
896                                                                                 'thumbnail' => __('Thumbnail'),
897                                                                                 'medium'    => __('Medium'),
898                                                                                 'large'     => __('Large'),
899                                                                                 'full'      => __('Full Size'),
900                                                                         ) );
901
902                                                                         foreach ( $sizes as $value => $name ) : ?>
903                                                                                 <#
904                                                                                 var size = data.sizes['<?php echo esc_js( $value ); ?>'];
905                                                                                 if ( size ) { #>
906                                                                                         <option value="<?php echo esc_attr( $value ); ?>">
907                                                                                                 <?php echo esc_html( $name ); ?> &ndash; {{ size.width }} &times; {{ size.height }}
908                                                                                         </option>
909                                                                                 <# } #>
910                                                                         <?php endforeach; ?>
911                                                                         <option value="<?php echo esc_attr( 'custom' ); ?>">
912                                                                                 <?php _e( 'Custom Size' ); ?>
913                                                                         </option>
914                                                                 </select>
915                                                         </label>
916                                                 <# } #>
917                                                         <div class="custom-size<# if ( data.model.size !== 'custom' ) { #> hidden<# } #>">
918                                                                 <label><span><?php _e( 'Width' ); ?> <small>(px)</small></span> <input data-setting="customWidth" type="number" step="1" value="{{ data.model.customWidth }}" /></label><span class="sep">&times;</span><label><span><?php _e( 'Height' ); ?> <small>(px)</small></span><input data-setting="customHeight" type="number" step="1" value="{{ data.model.customHeight }}" /></label>
919                                                         </div>
920                                         <# } #>
921
922                                         <div class="setting link-to">
923                                                 <span><?php _e('Link To'); ?></span>
924                                                 <select data-setting="link">
925                                                 <# if ( data.attachment ) { #>
926                                                         <option value="file">
927                                                                 <?php esc_attr_e('Media File'); ?>
928                                                         </option>
929                                                         <option value="post">
930                                                                 <?php esc_attr_e('Attachment Page'); ?>
931                                                         </option>
932                                                 <# } else { #>
933                                                         <option value="file">
934                                                                 <?php esc_attr_e('Image URL'); ?>
935                                                         </option>
936                                                 <# } #>
937                                                         <option value="custom">
938                                                                 <?php esc_attr_e('Custom URL'); ?>
939                                                         </option>
940                                                         <option value="none">
941                                                                 <?php esc_attr_e('None'); ?>
942                                                         </option>
943                                                 </select>
944                                                 <input type="text" class="link-to-custom" data-setting="linkUrl" />
945                                         </div>
946                                         <div class="advanced-section">
947                                                 <h3><a class="advanced-toggle" href="#"><?php _e('Advanced Options'); ?></a></h3>
948                                                 <div class="advanced-settings hidden">
949                                                         <div class="advanced-image">
950                                                                 <label class="setting title-text">
951                                                                         <span><?php _e('Image Title Attribute'); ?></span>
952                                                                         <input type="text" data-setting="title" value="{{ data.model.title }}" />
953                                                                 </label>
954                                                                 <label class="setting extra-classes">
955                                                                         <span><?php _e('Image CSS Class'); ?></span>
956                                                                         <input type="text" data-setting="extraClasses" value="{{ data.model.extraClasses }}" />
957                                                                 </label>
958                                                         </div>
959                                                         <div class="advanced-link">
960                                                                 <div class="setting link-target">
961                                                                         <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>
962                                                                 </div>
963                                                                 <label class="setting link-rel">
964                                                                         <span><?php _e('Link Rel'); ?></span>
965                                                                         <input type="text" data-setting="linkRel" value="{{ data.model.linkClassName }}" />
966                                                                 </label>
967                                                                 <label class="setting link-class-name">
968                                                                         <span><?php _e('Link CSS Class'); ?></span>
969                                                                         <input type="text" data-setting="linkClassName" value="{{ data.model.linkClassName }}" />
970                                                                 </label>
971                                                         </div>
972                                                 </div>
973                                         </div>
974                                 </div>
975                         </div>
976                 </div>
977         </script>
978
979         <script type="text/html" id="tmpl-image-editor">
980                 <div id="media-head-{{ data.id }}"></div>
981                 <div id="image-editor-{{ data.id }}"></div>
982         </script>
983
984         <script type="text/html" id="tmpl-audio-details">
985                 <# var ext, html5types = {
986                         mp3: wp.media.view.settings.embedMimes.mp3,
987                         ogg: wp.media.view.settings.embedMimes.ogg
988                 }; #>
989
990                 <?php $audio_types = wp_get_audio_extensions(); ?>
991                 <div class="media-embed media-embed-details">
992                         <div class="embed-media-settings embed-audio-settings">
993                                 <?php wp_underscore_audio_template() ?>
994
995                                 <# if ( ! _.isEmpty( data.model.src ) ) {
996                                         ext = data.model.src.split('.').pop();
997                                         if ( html5types[ ext ] ) {
998                                                 delete html5types[ ext ];
999                                         }
1000                                 #>
1001                                 <label class="setting">
1002                                         <span>SRC</span>
1003                                         <input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" />
1004                                         <a class="remove-setting"><?php _e( 'Remove' ); ?></a>
1005                                 </label>
1006                                 <# } #>
1007                                 <?php
1008
1009                                 foreach ( $audio_types as $type ):
1010                                 ?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) {
1011                                         if ( ! _.isUndefined( html5types.<?php echo $type ?> ) ) {
1012                                                 delete html5types.<?php echo $type ?>;
1013                                         }
1014                                 #>
1015                                 <label class="setting">
1016                                         <span><?php echo strtoupper( $type ) ?></span>
1017                                         <input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" />
1018                                         <a class="remove-setting"><?php _e( 'Remove' ); ?></a>
1019                                 </label>
1020                                 <# } #>
1021                                 <?php endforeach ?>
1022
1023                                 <# if ( ! _.isEmpty( html5types ) ) { #>
1024                                 <div class="setting">
1025                                         <span><?php _e( 'Add alternate sources for maximum HTML5 playback:' ) ?></span>
1026                                         <div class="button-large">
1027                                         <# _.each( html5types, function (mime, type) { #>
1028                                         <button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button>
1029                                         <# } ) #>
1030                                         </div>
1031                                 </div>
1032                                 <# } #>
1033
1034                                 <div class="setting preload">
1035                                         <span><?php _e( 'Preload' ); ?></span>
1036                                         <div class="button-group button-large" data-setting="preload">
1037                                                 <button class="button" value="auto"><?php _ex( 'Auto', 'auto preload' ); ?></button>
1038                                                 <button class="button" value="metadata"><?php _e( 'Metadata' ); ?></button>
1039                                                 <button class="button active" value="none"><?php _e( 'None' ); ?></button>
1040                                         </div>
1041                                 </div>
1042
1043                                 <label class="setting checkbox-setting">
1044                                         <input type="checkbox" data-setting="autoplay" />
1045                                         <span><?php _e( 'Autoplay' ); ?></span>
1046                                 </label>
1047
1048                                 <label class="setting checkbox-setting">
1049                                         <input type="checkbox" data-setting="loop" />
1050                                         <span><?php _e( 'Loop' ); ?></span>
1051                                 </label>
1052                         </div>
1053                 </div>
1054         </script>
1055
1056         <script type="text/html" id="tmpl-video-details">
1057                 <# var ext, html5types = {
1058                         mp4: wp.media.view.settings.embedMimes.mp4,
1059                         ogv: wp.media.view.settings.embedMimes.ogv,
1060                         webm: wp.media.view.settings.embedMimes.webm
1061                 }; #>
1062
1063                 <?php $video_types = wp_get_video_extensions(); ?>
1064                 <div class="media-embed media-embed-details">
1065                         <div class="embed-media-settings embed-video-settings">
1066                                 <div class="wp-video-holder">
1067                                 <#
1068                                 var isYouTube = ! _.isEmpty( data.model.src ) && data.model.src.match(/youtube|youtu\.be/);
1069                                         w = ! data.model.width || data.model.width > 640 ? 640 : data.model.width,
1070                                         h = ! data.model.height ? 360 : data.model.height;
1071
1072                                 if ( data.model.width && w !== data.model.width ) {
1073                                         h = Math.ceil( ( h * w ) / data.model.width );
1074                                 }
1075                                 #>
1076
1077                                 <?php wp_underscore_video_template() ?>
1078
1079                                 <# if ( ! _.isEmpty( data.model.src ) ) {
1080                                         ext = data.model.src.split('.').pop();
1081                                         if ( html5types[ ext ] ) {
1082                                                 delete html5types[ ext ];
1083                                         }
1084                                 #>
1085                                 <label class="setting">
1086                                         <span>SRC</span>
1087                                         <input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" />
1088                                         <a class="remove-setting"><?php _e( 'Remove' ); ?></a>
1089                                 </label>
1090                                 <# } #>
1091                                 <?php foreach ( $video_types as $type ):
1092                                 ?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) {
1093                                         if ( ! _.isUndefined( html5types.<?php echo $type ?> ) ) {
1094                                                 delete html5types.<?php echo $type ?>;
1095                                         }
1096                                 #>
1097                                 <label class="setting">
1098                                         <span><?php echo strtoupper( $type ) ?></span>
1099                                         <input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" />
1100                                         <a class="remove-setting"><?php _e( 'Remove' ); ?></a>
1101                                 </label>
1102                                 <# } #>
1103                                 <?php endforeach ?>
1104                                 </div>
1105
1106                                 <# if ( ! _.isEmpty( html5types ) ) { #>
1107                                 <div class="setting">
1108                                         <span><?php _e( 'Add alternate sources for maximum HTML5 playback:' ); ?></span>
1109                                         <div class="button-large">
1110                                         <# _.each( html5types, function (mime, type) { #>
1111                                         <button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button>
1112                                         <# } ) #>
1113                                         </div>
1114                                 </div>
1115                                 <# } #>
1116
1117                                 <# if ( ! _.isEmpty( data.model.poster ) ) { #>
1118                                 <label class="setting">
1119                                         <span><?php _e( 'Poster Image' ); ?></span>
1120                                         <input type="text" disabled="disabled" data-setting="poster" value="{{ data.model.poster }}" />
1121                                         <a class="remove-setting"><?php _e( 'Remove' ); ?></a>
1122                                 </label>
1123                                 <# } #>
1124                                 <div class="setting preload">
1125                                         <span><?php _e( 'Preload' ); ?></span>
1126                                         <div class="button-group button-large" data-setting="preload">
1127                                                 <button class="button" value="auto"><?php _ex( 'Auto', 'auto preload' ); ?></button>
1128                                                 <button class="button" value="metadata"><?php _e( 'Metadata' ); ?></button>
1129                                                 <button class="button active" value="none"><?php _e( 'None' ); ?></button>
1130                                         </div>
1131                                 </div>
1132
1133                                 <label class="setting checkbox-setting">
1134                                         <input type="checkbox" data-setting="autoplay" />
1135                                         <span><?php _e( 'Autoplay' ); ?></span>
1136                                 </label>
1137
1138                                 <label class="setting checkbox-setting">
1139                                         <input type="checkbox" data-setting="loop" />
1140                                         <span><?php _e( 'Loop' ); ?></span>
1141                                 </label>
1142
1143                                 <label class="setting" data-setting="content">
1144                                         <span><?php _e( 'Tracks (subtitles, captions, descriptions, chapters, or metadata)' ); ?></span>
1145                                         <#
1146                                         var content = '';
1147                                         if ( ! _.isEmpty( data.model.content ) ) {
1148                                                 var tracks = jQuery( data.model.content ).filter( 'track' );
1149                                                 _.each( tracks.toArray(), function (track) {
1150                                                         content += track.outerHTML; #>
1151                                                 <p>
1152                                                         <input class="content-track" type="text" value="{{ track.outerHTML }}" />
1153                                                         <a class="remove-setting remove-track"><?php _e( 'Remove' ); ?></a>
1154                                                 </p>
1155                                                 <# } ); #>
1156                                         <# } else { #>
1157                                         <em><?php _e( 'There are no associated subtitles.' ); ?></em>
1158                                         <# } #>
1159                                         <textarea class="hidden content-setting">{{ content }}</textarea>
1160                                 </label>
1161                         </div>
1162                 </div>
1163         </script>
1164
1165         <script type="text/html" id="tmpl-editor-gallery">
1166                 <# if ( data.attachments ) { #>
1167                         <div class="gallery gallery-columns-{{ data.columns }}">
1168                                 <# _.each( data.attachments, function( attachment, index ) { #>
1169                                         <dl class="gallery-item">
1170                                                 <dt class="gallery-icon">
1171                                                         <# if ( attachment.thumbnail ) { #>
1172                                                                 <img src="{{ attachment.thumbnail.url }}" width="{{ attachment.thumbnail.width }}" height="{{ attachment.thumbnail.height }}" />
1173                                                         <# } else { #>
1174                                                                 <img src="{{ attachment.url }}" />
1175                                                         <# } #>
1176                                                 </dt>
1177                                                 <# if ( attachment.caption ) { #>
1178                                                         <dd class="wp-caption-text gallery-caption">
1179                                                                 {{ attachment.caption }}
1180                                                         </dd>
1181                                                 <# } #>
1182                                         </dl>
1183                                         <# if ( index % data.columns === data.columns - 1 ) { #>
1184                                                 <br style="clear: both;">
1185                                         <# } #>
1186                                 <# } ); #>
1187                         </div>
1188                 <# } else { #>
1189                         <div class="wpview-error">
1190                                 <div class="dashicons dashicons-format-gallery"></div><p><?php _e( 'No items found.' ); ?></p>
1191                         </div>
1192                 <# } #>
1193         </script>
1194
1195         <script type="text/html" id="tmpl-crop-content">
1196                 <img class="crop-image" src="{{ data.url }}">
1197                 <div class="upload-errors"></div>
1198         </script>
1199
1200         <?php
1201
1202         /**
1203          * Fires when the custom Backbone media templates are printed.
1204          *
1205          * @since 3.5.0
1206          */
1207         do_action( 'print_media_templates' );
1208 }