[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/ -> media-template.php (source)

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


Generated: Sun Jul 5 01:00:04 2020 Cross-referenced by PHPXref 0.7.1