PageRenderTime 51ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 1ms

/wp-includes/media-template.php

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