PageRenderTime 96ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-includes/media-template.php

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