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