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