media-template.php 59 KB

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