3 * WordPress media templates.
11 * Output the markup for a audio tag to be used in an Underscore template
12 * when data.model is passed.
16 function wp_underscore_audio_template() {
17 $audio_types = wp_get_audio_extensions();
20 class="wp-audio-shortcode"
21 width="{{ _.isUndefined( data.model.width ) ? 400 : data.model.width }}"
22 preload="{{ _.isUndefined( data.model.preload ) ? 'none' : data.model.preload }}"
24 <?php foreach ( array( 'autoplay', 'loop' ) as $attr ):
25 ?>if ( ! _.isUndefined( data.model.<?php echo $attr ?> ) && data.model.<?php echo $attr ?> ) {
26 #> <?php echo $attr ?><#
30 <# if ( ! _.isEmpty( data.model.src ) ) { #>
31 <source src="{{ data.model.src }}" type="{{ wp.media.view.settings.embedMimes[ data.model.src.split('.').pop() ] }}" />
34 <?php foreach ( $audio_types as $type ):
35 ?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) { #>
36 <source src="{{ data.model.<?php echo $type ?> }}" type="{{ wp.media.view.settings.embedMimes[ '<?php echo $type ?>' ] }}" />
44 * Output the markup for a video tag to be used in an Underscore template
45 * when data.model is passed.
49 function wp_underscore_video_template() {
50 $video_types = wp_get_video_extensions();
52 <# var w, h, settings = wp.media.view.settings,
53 isYouTube = ! _.isEmpty( data.model.src ) && data.model.src.match(/youtube|youtu\.be/);
55 if ( settings.contentWidth && data.model.width >= settings.contentWidth ) {
56 w = settings.contentWidth;
61 if ( w !== data.model.width ) {
62 h = Math.ceil( ( h * w ) / data.model.width );
64 h = data.model.height;
67 <div style="max-width: 100%; width: {{ w }}px">
69 class="wp-video-shortcode{{ isYouTube ? ' youtube-video' : '' }}"
73 $props = array( 'poster' => '', 'preload' => 'metadata' );
74 foreach ( $props as $key => $value ):
75 if ( empty( $value ) ) {
77 if ( ! _.isUndefined( data.model.<?php echo $key ?> ) && data.model.<?php echo $key ?> ) {
78 #> <?php echo $key ?>="{{ data.model.<?php echo $key ?> }}"<#
81 echo $key ?>="{{ _.isUndefined( data.model.<?php echo $key ?> ) ? '<?php echo $value ?>' : data.model.<?php echo $key ?> }}"<?php
85 <?php foreach ( array( 'autoplay', 'loop' ) as $attr ):
86 ?> if ( ! _.isUndefined( data.model.<?php echo $attr ?> ) && data.model.<?php echo $attr ?> ) {
87 #> <?php echo $attr ?><#
91 <# if ( ! _.isEmpty( data.model.src ) ) {
93 <source src="{{ data.model.src }}" type="video/youtube" />
95 <source src="{{ data.model.src }}" type="{{ settings.embedMimes[ data.model.src.split('.').pop() ] }}" />
99 <?php foreach ( $video_types as $type ):
100 ?><# if ( data.model.<?php echo $type ?> ) { #>
101 <source src="{{ data.model.<?php echo $type ?> }}" type="{{ settings.embedMimes[ '<?php echo $type ?>' ] }}" />
104 {{{ data.model.content }}}
111 * Prints the templates used in the media manager.
115 function wp_print_media_templates() {
117 $class = 'media-modal wp-core-ui';
118 if ( $is_IE && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false )
121 <script type="text/html" id="tmpl-media-frame">
122 <div class="media-frame-menu"></div>
123 <div class="media-frame-title"></div>
124 <div class="media-frame-router"></div>
125 <div class="media-frame-content"></div>
126 <div class="media-frame-toolbar"></div>
127 <div class="media-frame-uploader"></div>
130 <script type="text/html" id="tmpl-media-modal">
131 <div class="<?php echo $class; ?>">
132 <a class="media-modal-close" href="#" title="<?php esc_attr_e('Close'); ?>"><span class="media-modal-icon"></span></a>
133 <div class="media-modal-content"></div>
135 <div class="media-modal-backdrop"></div>
138 <script type="text/html" id="tmpl-uploader-window">
139 <div class="uploader-window-content">
140 <h3><?php _e( 'Drop files to upload' ); ?></h3>
144 <script type="text/html" id="tmpl-uploader-editor">
145 <div class="uploader-editor-content">
146 <div class="uploader-editor-title"><?php _e( 'Drop files to upload' ); ?></div>
150 <script type="text/html" id="tmpl-uploader-inline">
151 <# var messageClass = data.message ? 'has-upload-message' : 'no-upload-message'; #>
152 <div class="uploader-inline-content {{ messageClass }}">
153 <# if ( data.message ) { #>
154 <h3 class="upload-message">{{ data.message }}</h3>
156 <?php if ( ! _device_can_upload() ) : ?>
157 <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://wordpress.org/mobile/' ); ?></h3>
158 <?php elseif ( is_multisite() && ! is_upload_space_available() ) : ?>
159 <h3 class="upload-instructions"><?php _e( 'Upload Limit Exceeded' ); ?></h3>
161 /** This action is documented in wp-admin/includes/media.php */
162 do_action( 'upload_ui_over_quota' ); ?>
165 <div class="upload-ui">
166 <h3 class="upload-instructions drop-instructions"><?php _e( 'Drop files anywhere to upload' ); ?></h3>
167 <a href="#" class="browser button button-hero"><?php _e( 'Select Files' ); ?></a>
170 <div class="upload-inline-status"></div>
172 <div class="post-upload-ui">
174 /** This action is documented in wp-admin/includes/media.php */
175 do_action( 'pre-upload-ui' );
176 /** This action is documented in wp-admin/includes/media.php */
177 do_action( 'pre-plupload-upload-ui' );
179 if ( 10 === remove_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' ) ) {
180 /** This action is documented in wp-admin/includes/media.php */
181 do_action( 'post-plupload-upload-ui' );
182 add_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' );
184 /** This action is documented in wp-admin/includes/media.php */
185 do_action( 'post-plupload-upload-ui' );
188 $upload_size_unit = $max_upload_size = wp_max_upload_size();
189 $byte_sizes = array( 'KB', 'MB', 'GB' );
191 for ( $u = -1; $upload_size_unit > 1024 && $u < count( $byte_sizes ) - 1; $u++ ) {
192 $upload_size_unit /= 1024;
196 $upload_size_unit = 0;
199 $upload_size_unit = (int) $upload_size_unit;
204 <p class="max-upload-size"><?php
205 printf( __( 'Maximum upload file size: %d%s.' ), esc_html($upload_size_unit), esc_html($byte_sizes[$u]) );
208 <# if ( data.suggestedWidth && data.suggestedHeight ) { #>
209 <p class="suggested-dimensions">
210 <?php _e( 'Suggested image dimensions:' ); ?> {{data.suggestedWidth}} × {{data.suggestedHeight}}
215 /** This action is documented in wp-admin/includes/media.php */
216 do_action( 'post-upload-ui' ); ?>
222 <script type="text/html" id="tmpl-uploader-status">
223 <h3><?php _e( 'Uploading' ); ?></h3>
224 <a class="upload-dismiss-errors" href="#"><?php _e('Dismiss Errors'); ?></a>
226 <div class="media-progress-bar"><div></div></div>
227 <div class="upload-details">
228 <span class="upload-count">
229 <span class="upload-index"></span> / <span class="upload-total"></span>
231 <span class="upload-detail-separator">–</span>
232 <span class="upload-filename"></span>
234 <div class="upload-errors"></div>
237 <script type="text/html" id="tmpl-uploader-status-error">
238 <span class="upload-error-label"><?php _e('Error'); ?></span>
239 <span class="upload-error-filename">{{{ data.filename }}}</span>
240 <span class="upload-error-message">{{ data.message }}</span>
243 <script type="text/html" id="tmpl-attachment">
244 <div class="attachment-preview type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}">
245 <# if ( data.uploading ) { #>
246 <div class="media-progress-bar"><div></div></div>
247 <# } else if ( 'image' === data.type ) { #>
248 <div class="thumbnail">
249 <div class="centered">
250 <img src="{{ data.size.url }}" draggable="false" />
254 <img src="{{ data.icon }}" class="icon" draggable="false" />
255 <div class="filename">
256 <div>{{ data.filename }}</div>
260 <# if ( data.buttons.close ) { #>
261 <a class="close media-modal-icon" href="#" title="<?php esc_attr_e('Remove'); ?>"></a>
264 <# if ( data.buttons.check ) { #>
265 <a class="check" href="#" title="<?php esc_attr_e('Deselect'); ?>"><div class="media-modal-icon"></div></a>
269 var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly';
270 if ( data.describe ) { #>
271 <# if ( 'image' === data.type ) { #>
272 <input type="text" value="{{ data.caption }}" class="describe" data-setting="caption"
273 placeholder="<?php esc_attr_e('Caption this image…'); ?>" {{ maybeReadOnly }} />
275 <input type="text" value="{{ data.title }}" class="describe" data-setting="title"
276 <# if ( 'video' === data.type ) { #>
277 placeholder="<?php esc_attr_e('Describe this video…'); ?>"
278 <# } else if ( 'audio' === data.type ) { #>
279 placeholder="<?php esc_attr_e('Describe this audio file…'); ?>"
281 placeholder="<?php esc_attr_e('Describe this media file…'); ?>"
282 <# } #> {{ maybeReadOnly }} />
287 <script type="text/html" id="tmpl-attachment-details">
289 <?php _e('Attachment Details'); ?>
291 <span class="settings-save-status">
292 <span class="spinner"></span>
293 <span class="saved"><?php esc_html_e('Saved.'); ?></span>
296 <div class="attachment-info">
297 <div class="thumbnail">
298 <# if ( data.uploading ) { #>
299 <div class="media-progress-bar"><div></div></div>
300 <# } else if ( 'image' === data.type ) { #>
301 <img src="{{ data.size.url }}" draggable="false" />
303 <img src="{{ data.icon }}" class="icon" draggable="false" />
306 <div class="details">
307 <div class="filename">{{ data.filename }}</div>
308 <div class="uploaded">{{ data.dateFormatted }}</div>
310 <# if ( 'image' === data.type && ! data.uploading ) { #>
311 <# if ( data.width && data.height ) { #>
312 <div class="dimensions">{{ data.width }} × {{ data.height }}</div>
315 <# if ( data.can.save ) { #>
316 <a class="edit-attachment" href="{{ data.editLink }}&image-editor" target="_blank"><?php _e( 'Edit Image' ); ?></a>
317 <a class="refresh-attachment" href="#"><?php _e( 'Refresh' ); ?></a>
321 <# if ( data.fileLength ) { #>
322 <div class="file-length"><?php _e( 'Length:' ); ?> {{ data.fileLength }}</div>
325 <# if ( ! data.uploading && data.can.remove ) { #>
326 <?php if ( MEDIA_TRASH ): ?>
327 <a class="trash-attachment" href="#"><?php _e( 'Trash' ); ?></a>
329 <a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ); ?></a>
333 <div class="compat-meta">
334 <# if ( data.compat && data.compat.meta ) { #>
335 {{{ data.compat.meta }}}
341 <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
342 <label class="setting" data-setting="title">
343 <span><?php _e('Title'); ?></span>
344 <input type="text" value="{{ data.title }}" {{ maybeReadOnly }} />
346 <label class="setting" data-setting="caption">
347 <span><?php _e('Caption'); ?></span>
348 <textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea>
350 <# if ( 'image' === data.type ) { #>
351 <label class="setting" data-setting="alt">
352 <span><?php _e('Alt Text'); ?></span>
353 <input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} />
356 <label class="setting" data-setting="description">
357 <span><?php _e('Description'); ?></span>
358 <textarea {{ maybeReadOnly }}>{{ data.description }}</textarea>
362 <script type="text/html" id="tmpl-media-selection">
363 <div class="selection-info">
364 <span class="count"></span>
365 <# if ( data.editable ) { #>
366 <a class="edit-selection" href="#"><?php _e('Edit'); ?></a>
368 <# if ( data.clearable ) { #>
369 <a class="clear-selection" href="#"><?php _e('Clear'); ?></a>
372 <div class="selection-view"></div>
375 <script type="text/html" id="tmpl-attachment-display-settings">
376 <h3><?php _e('Attachment Display Settings'); ?></h3>
378 <# if ( 'image' === data.type ) { #>
379 <label class="setting">
380 <span><?php _e('Alignment'); ?></span>
381 <select class="alignment"
383 <# if ( data.userSettings ) { #>
384 data-user-setting="align"
387 <option value="left">
388 <?php esc_attr_e('Left'); ?>
390 <option value="center">
391 <?php esc_attr_e('Center'); ?>
393 <option value="right">
394 <?php esc_attr_e('Right'); ?>
396 <option value="none" selected>
397 <?php esc_attr_e('None'); ?>
403 <div class="setting">
405 <# if ( data.model.canEmbed ) { #>
406 <span><?php _e('Embed or Link'); ?></span>
408 <span><?php _e('Link To'); ?></span>
411 <select class="link-to"
413 <# if ( data.userSettings && ! data.model.canEmbed ) { #>
414 data-user-setting="urlbutton"
417 <# if ( data.model.canEmbed ) { #>
418 <option value="embed" selected>
419 <?php esc_attr_e('Embed Media Player'); ?>
421 <option value="file">
423 <option value="file" selected>
425 <# if ( data.model.canEmbed ) { #>
426 <?php esc_attr_e('Link to Media File'); ?>
428 <?php esc_attr_e('Media File'); ?>
431 <option value="post">
432 <# if ( data.model.canEmbed ) { #>
433 <?php esc_attr_e('Link to Attachment Page'); ?>
435 <?php esc_attr_e('Attachment Page'); ?>
438 <# if ( 'image' === data.type ) { #>
439 <option value="custom">
440 <?php esc_attr_e('Custom URL'); ?>
442 <option value="none">
443 <?php esc_attr_e('None'); ?>
448 <input type="text" class="link-to-custom" data-setting="linkUrl" />
451 <# if ( 'undefined' !== typeof data.sizes ) { #>
452 <label class="setting">
453 <span><?php _e('Size'); ?></span>
454 <select class="size" name="size"
456 <# if ( data.userSettings ) { #>
457 data-user-setting="imgsize"
460 /** This filter is documented in wp-admin/includes/media.php */
461 $sizes = apply_filters( 'image_size_names_choose', array(
462 'thumbnail' => __('Thumbnail'),
463 'medium' => __('Medium'),
464 'large' => __('Large'),
465 'full' => __('Full Size'),
468 foreach ( $sizes as $value => $name ) : ?>
470 var size = data.sizes['<?php echo esc_js( $value ); ?>'];
472 <option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, 'full' ); ?>>
473 <?php echo esc_html( $name ); ?> – {{ size.width }} × {{ size.height }}
482 <script type="text/html" id="tmpl-gallery-settings">
483 <h3><?php _e('Gallery Settings'); ?></h3>
485 <label class="setting">
486 <span><?php _e('Link To'); ?></span>
487 <select class="link-to"
489 <# if ( data.userSettings ) { #>
490 data-user-setting="urlbutton"
493 <option value="post" selected>
494 <?php esc_attr_e('Attachment Page'); ?>
496 <option value="file">
497 <?php esc_attr_e('Media File'); ?>
499 <option value="none">
500 <?php esc_attr_e('None'); ?>
505 <label class="setting">
506 <span><?php _e('Columns'); ?></span>
507 <select class="columns" name="columns"
508 data-setting="columns">
509 <?php for ( $i = 1; $i <= 9; $i++ ) : ?>
510 <option value="<?php echo esc_attr( $i ); ?>" <?php selected( $i, 3 ); ?>>
511 <?php echo esc_html( $i ); ?>
517 <label class="setting">
518 <span><?php _e( 'Random Order' ); ?></span>
519 <input type="checkbox" data-setting="_orderbyRandom" />
523 <script type="text/html" id="tmpl-playlist-settings">
524 <h3><?php _e( 'Playlist Settings' ); ?></h3>
526 <# var emptyModel = _.isEmpty( data.model ),
527 isVideo = 'video' === data.controller.get('library').props.get('type'); #>
529 <label class="setting">
530 <input type="checkbox" data-setting="tracklist" <# if ( emptyModel ) { #>
533 <# if ( isVideo ) { #>
534 <span><?php _e( 'Show Video List' ); ?></span>
536 <span><?php _e( 'Show Tracklist' ); ?></span>
540 <# if ( ! isVideo ) { #>
541 <label class="setting">
542 <input type="checkbox" data-setting="artists" <# if ( emptyModel ) { #>
545 <span><?php _e( 'Show Artist Name in Tracklist' ); ?></span>
549 <label class="setting">
550 <input type="checkbox" data-setting="images" <# if ( emptyModel ) { #>
553 <span><?php _e( 'Show Images' ); ?></span>
557 <script type="text/html" id="tmpl-embed-link-settings">
558 <label class="setting">
559 <span><?php _e('Title'); ?></span>
560 <input type="text" class="alignment" data-setting="title" />
564 <script type="text/html" id="tmpl-embed-image-settings">
565 <div class="thumbnail">
566 <img src="{{ data.model.url }}" draggable="false" />
570 /** This filter is documented in wp-admin/includes/media.php */
571 if ( ! apply_filters( 'disable_captions', '' ) ) : ?>
572 <label class="setting caption">
573 <span><?php _e('Caption'); ?></span>
574 <textarea data-setting="caption" />
578 <label class="setting alt-text">
579 <span><?php _e('Alt Text'); ?></span>
580 <input type="text" data-setting="alt" />
583 <div class="setting align">
584 <span><?php _e('Align'); ?></span>
585 <div class="button-group button-large" data-setting="align">
586 <button class="button" value="left">
587 <?php esc_attr_e('Left'); ?>
589 <button class="button" value="center">
590 <?php esc_attr_e('Center'); ?>
592 <button class="button" value="right">
593 <?php esc_attr_e('Right'); ?>
595 <button class="button active" value="none">
596 <?php esc_attr_e('None'); ?>
601 <div class="setting link-to">
602 <span><?php _e('Link To'); ?></span>
603 <div class="button-group button-large" data-setting="link">
604 <button class="button" value="file">
605 <?php esc_attr_e('Image URL'); ?>
607 <button class="button" value="custom">
608 <?php esc_attr_e('Custom URL'); ?>
610 <button class="button active" value="none">
611 <?php esc_attr_e('None'); ?>
614 <input type="text" class="link-to-custom" data-setting="linkUrl" />
618 <script type="text/html" id="tmpl-attachments-css">
619 <style type="text/css" id="{{ data.id }}-css">
621 padding: 0 {{ data.gutter }}px;
624 #{{ data.id }} .attachment {
625 margin: {{ data.gutter }}px;
626 width: {{ data.edge }}px;
629 #{{ data.id }} .attachment-preview,
630 #{{ data.id }} .attachment-preview .thumbnail {
631 width: {{ data.edge }}px;
632 height: {{ data.edge }}px;
635 #{{ data.id }} .portrait .thumbnail img {
636 max-width: {{ data.edge }}px;
640 #{{ data.id }} .landscape .thumbnail img {
642 max-height: {{ data.edge }}px;
647 <script type="text/html" id="tmpl-image-details">
648 <div class="media-embed">
649 <div class="embed-media-settings">
650 <div class="column-image">
652 <img src="{{ data.model.url }}" draggable="false" />
654 <# if ( data.attachment && window.imageEdit ) { #>
655 <div class="actions">
656 <input type="button" class="edit-attachment button" value="<?php esc_attr_e( 'Edit Original' ); ?>" />
657 <input type="button" class="replace-attachment button" value="<?php esc_attr_e( 'Replace' ); ?>" />
662 <div class="column-settings">
664 /** This filter is documented in wp-admin/includes/media.php */
665 if ( ! apply_filters( 'disable_captions', '' ) ) : ?>
666 <label class="setting caption">
667 <span><?php _e('Caption'); ?></span>
668 <textarea data-setting="caption">{{ data.model.caption }}</textarea>
672 <label class="setting alt-text">
673 <span><?php _e('Alternative Text'); ?></span>
674 <input type="text" data-setting="alt" value="{{ data.model.alt }}" />
677 <h3><?php _e( 'Display Settings' ); ?></h3>
678 <div class="setting align">
679 <span><?php _e('Align'); ?></span>
680 <div class="button-group button-large" data-setting="align">
681 <button class="button" value="left">
682 <?php esc_attr_e('Left'); ?>
684 <button class="button" value="center">
685 <?php esc_attr_e('Center'); ?>
687 <button class="button" value="right">
688 <?php esc_attr_e('Right'); ?>
690 <button class="button active" value="none">
691 <?php esc_attr_e('None'); ?>
696 <# if ( data.attachment ) { #>
697 <# if ( 'undefined' !== typeof data.attachment.sizes ) { #>
698 <label class="setting size">
699 <span><?php _e('Size'); ?></span>
700 <select class="size" name="size"
702 <# if ( data.userSettings ) { #>
703 data-user-setting="imgsize"
706 /** This filter is documented in wp-admin/includes/media.php */
707 $sizes = apply_filters( 'image_size_names_choose', array(
708 'thumbnail' => __('Thumbnail'),
709 'medium' => __('Medium'),
710 'large' => __('Large'),
711 'full' => __('Full Size'),
714 foreach ( $sizes as $value => $name ) : ?>
716 var size = data.sizes['<?php echo esc_js( $value ); ?>'];
718 <option value="<?php echo esc_attr( $value ); ?>">
719 <?php echo esc_html( $name ); ?> – {{ size.width }} × {{ size.height }}
723 <option value="<?php echo esc_attr( 'custom' ); ?>">
724 <?php _e( 'Custom Size' ); ?>
729 <div class="custom-size<# if ( data.model.size !== 'custom' ) { #> hidden<# } #>">
730 <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">×</span><label><span><?php _e( 'Height' ); ?> <small>(px)</small></span><input data-setting="customHeight" type="number" step="1" value="{{ data.model.customHeight }}" /></label>
734 <div class="setting link-to">
735 <span><?php _e('Link To'); ?></span>
736 <select data-setting="link">
737 <# if ( data.attachment ) { #>
738 <option value="file">
739 <?php esc_attr_e('Media File'); ?>
741 <option value="post">
742 <?php esc_attr_e('Attachment Page'); ?>
745 <option value="file">
746 <?php esc_attr_e('Image URL'); ?>
749 <option value="custom">
750 <?php esc_attr_e('Custom URL'); ?>
752 <option value="none">
753 <?php esc_attr_e('None'); ?>
756 <input type="text" class="link-to-custom" data-setting="linkUrl" />
758 <div class="advanced-section">
759 <h3><a class="advanced-toggle" href="#"><?php _e('Advanced Options'); ?></a></h3>
760 <div class="advanced-settings hidden">
761 <div class="advanced-image">
762 <label class="setting title-text">
763 <span><?php _e('Image Title Attribute'); ?></span>
764 <input type="text" data-setting="title" value="{{ data.model.title }}" />
766 <label class="setting extra-classes">
767 <span><?php _e('Image CSS Class'); ?></span>
768 <input type="text" data-setting="extraClasses" value="{{ data.model.extraClasses }}" />
771 <div class="advanced-link">
772 <div class="setting link-target">
773 <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>
775 <label class="setting link-rel">
776 <span><?php _e('Link Rel'); ?></span>
777 <input type="text" data-setting="linkRel" value="{{ data.model.linkClassName }}" />
779 <label class="setting link-class-name">
780 <span><?php _e('Link CSS Class'); ?></span>
781 <input type="text" data-setting="linkClassName" value="{{ data.model.linkClassName }}" />
791 <script type="text/html" id="tmpl-image-editor">
792 <div id="media-head-{{ data.id }}"></div>
793 <div id="image-editor-{{ data.id }}"></div>
796 <script type="text/html" id="tmpl-audio-details">
797 <# var ext, html5types = {
798 mp3: wp.media.view.settings.embedMimes.mp3,
799 ogg: wp.media.view.settings.embedMimes.ogg
802 <?php $audio_types = wp_get_audio_extensions(); ?>
803 <div class="media-embed media-embed-details">
804 <div class="embed-media-settings embed-audio-settings">
805 <?php wp_underscore_audio_template() ?>
807 <# if ( ! _.isEmpty( data.model.src ) ) {
808 ext = data.model.src.split('.').pop();
809 if ( html5types[ ext ] ) {
810 delete html5types[ ext ];
813 <label class="setting">
815 <input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" />
816 <a class="remove-setting"><?php _e( 'Remove' ); ?></a>
821 foreach ( $audio_types as $type ):
822 ?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) {
823 if ( ! _.isUndefined( html5types.<?php echo $type ?> ) ) {
824 delete html5types.<?php echo $type ?>;
827 <label class="setting">
828 <span><?php echo strtoupper( $type ) ?></span>
829 <input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" />
830 <a class="remove-setting"><?php _e( 'Remove' ); ?></a>
835 <# if ( ! _.isEmpty( html5types ) ) { #>
836 <div class="setting">
837 <span><?php _e( 'Add alternate sources for maximum HTML5 playback:' ) ?></span>
838 <div class="button-large">
839 <# _.each( html5types, function (mime, type) { #>
840 <button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button>
846 <div class="setting preload">
847 <span><?php _e( 'Preload' ); ?></span>
848 <div class="button-group button-large" data-setting="preload">
849 <button class="button" value="auto"><?php _ex( 'Auto', 'auto preload' ); ?></button>
850 <button class="button" value="metadata"><?php _e( 'Metadata' ); ?></button>
851 <button class="button active" value="none"><?php _e( 'None' ); ?></button>
855 <label class="setting checkbox-setting">
856 <span><?php _e( 'Autoplay' ); ?></span>
857 <input type="checkbox" data-setting="autoplay" />
860 <label class="setting checkbox-setting">
861 <span><?php _e( 'Loop' ); ?></span>
862 <input type="checkbox" data-setting="loop" />
864 <div class="clear"></div>
869 <script type="text/html" id="tmpl-video-details">
870 <# var ext, html5types = {
871 mp4: wp.media.view.settings.embedMimes.mp4,
872 ogv: wp.media.view.settings.embedMimes.ogv,
873 webm: wp.media.view.settings.embedMimes.webm
876 <?php $video_types = wp_get_video_extensions(); ?>
877 <div class="media-embed media-embed-details">
878 <div class="embed-media-settings embed-video-settings">
879 <div class="wp-video-holder">
881 var isYouTube = ! _.isEmpty( data.model.src ) && data.model.src.match(/youtube|youtu\.be/);
882 w = ! data.model.width || data.model.width > 640 ? 640 : data.model.width,
883 h = ! data.model.height ? 360 : data.model.height;
885 if ( data.model.width && w !== data.model.width ) {
886 h = Math.ceil( ( h * w ) / data.model.width );
890 <?php wp_underscore_video_template() ?>
892 <# if ( ! _.isEmpty( data.model.src ) ) {
893 ext = data.model.src.split('.').pop();
894 if ( html5types[ ext ] ) {
895 delete html5types[ ext ];
898 <label class="setting">
900 <input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" />
901 <a class="remove-setting"><?php _e( 'Remove' ); ?></a>
904 <?php foreach ( $video_types as $type ):
905 ?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) {
906 if ( ! _.isUndefined( html5types.<?php echo $type ?> ) ) {
907 delete html5types.<?php echo $type ?>;
910 <label class="setting">
911 <span><?php echo strtoupper( $type ) ?></span>
912 <input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" />
913 <a class="remove-setting"><?php _e( 'Remove' ); ?></a>
919 <# if ( ! _.isEmpty( html5types ) ) { #>
920 <div class="setting">
921 <span><?php _e( 'Add alternate sources for maximum HTML5 playback:' ); ?></span>
922 <div class="button-large">
923 <# _.each( html5types, function (mime, type) { #>
924 <button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button>
930 <# if ( ! _.isEmpty( data.model.poster ) ) { #>
931 <label class="setting">
932 <span><?php _e( 'Poster Image' ); ?></span>
933 <input type="text" disabled="disabled" data-setting="poster" value="{{ data.model.poster }}" />
934 <a class="remove-setting"><?php _e( 'Remove' ); ?></a>
937 <div class="setting preload">
938 <span><?php _e( 'Preload' ); ?></span>
939 <div class="button-group button-large" data-setting="preload">
940 <button class="button" value="auto"><?php _ex( 'Auto', 'auto preload' ); ?></button>
941 <button class="button" value="metadata"><?php _e( 'Metadata' ); ?></button>
942 <button class="button active" value="none"><?php _e( 'None' ); ?></button>
946 <label class="setting checkbox-setting">
947 <span><?php _e( 'Autoplay' ); ?></span>
948 <input type="checkbox" data-setting="autoplay" />
951 <label class="setting checkbox-setting">
952 <span><?php _e( 'Loop' ); ?></span>
953 <input type="checkbox" data-setting="loop" />
955 <div class="clear"></div>
957 <label class="setting" data-setting="content">
958 <span><?php _e( 'Tracks (subtitles, captions, descriptions, chapters, or metadata)' ); ?></span>
961 if ( ! _.isEmpty( data.model.content ) ) {
962 var tracks = jQuery( data.model.content ).filter( 'track' );
963 _.each( tracks.toArray(), function (track) {
964 content += track.outerHTML; #>
966 <input class="content-track" type="text" value="{{ track.outerHTML }}" />
967 <a class="remove-setting remove-track"><?php _e( 'Remove' ); ?></a>
971 <em><?php _e( 'There are no associated subtitles.' ); ?></em>
973 <textarea class="hidden content-setting">{{ content }}</textarea>
979 <script type="text/html" id="tmpl-editor-gallery">
980 <div class="toolbar">
981 <div class="dashicons dashicons-edit edit"></div><div class="dashicons dashicons-no-alt remove"></div>
983 <# if ( data.attachments ) { #>
984 <div class="gallery gallery-columns-{{ data.columns }}">
985 <# _.each( data.attachments, function( attachment, index ) { #>
986 <dl class="gallery-item">
987 <dt class="gallery-icon">
988 <# if ( attachment.thumbnail ) { #>
989 <img src="{{ attachment.thumbnail.url }}" width="{{ attachment.thumbnail.width }}" height="{{ attachment.thumbnail.height }}" />
991 <img src="{{ attachment.url }}" />
994 <dd class="wp-caption-text gallery-caption">
995 {{ attachment.caption }}
998 <# if ( index % data.columns === data.columns - 1 ) { #>
999 <br style="clear: both;">
1004 <div class="wpview-error">
1005 <div class="dashicons dashicons-format-gallery"></div><p><?php _e( 'No items found.' ); ?></p>
1010 <script type="text/html" id="tmpl-editor-audio">
1011 <div class="toolbar">
1012 <div class="dashicons dashicons-edit edit"></div>
1013 <div class="dashicons dashicons-no-alt remove"></div>
1015 <?php wp_underscore_audio_template() ?>
1016 <div class="wpview-overlay"></div>
1019 <script type="text/html" id="tmpl-editor-video">
1020 <div class="toolbar">
1021 <div class="dashicons dashicons-edit edit"></div>
1022 <div class="dashicons dashicons-no-alt remove"></div>
1024 <?php wp_underscore_video_template() ?>
1025 <div class="wpview-overlay"></div>
1028 <?php wp_underscore_playlist_templates() ?>
1030 <script type="text/html" id="tmpl-editor-playlist">
1031 <div class="toolbar">
1032 <div class="dashicons dashicons-edit edit"></div>
1033 <div class="dashicons dashicons-no-alt remove"></div>
1035 <# if ( data.tracks ) { #>
1036 <div class="wp-playlist wp-{{ data.type }}-playlist wp-playlist-{{ data.style }}">
1037 <# if ( 'audio' === data.type ){ #>
1038 <div class="wp-playlist-current-item"></div>
1040 <{{ data.type }} controls="controls" preload="none" <#
1041 if ( data.width ) { #> width="{{ data.width }}"<# }
1042 #><# if ( data.height ) { #> height="{{ data.height }}"<# } #>></{{ data.type }}>
1043 <div class="wp-playlist-next"></div>
1044 <div class="wp-playlist-prev"></div>
1046 <div class="wpview-overlay"></div>
1048 <div class="wpview-error">
1049 <div class="dashicons dashicons-video-alt3"></div><p><?php _e( 'No items found.' ); ?></p>
1054 <script type="text/html" id="tmpl-crop-content">
1055 <img class="crop-image" src="{{ data.url }}">
1056 <div class="upload-errors"></div>
1062 * Fires when the custom Backbone media templates are printed.
1066 do_action( 'print_media_templates' );