[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

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


Generated: Thu Oct 17 08:20:02 2019 Cross-referenced by PHPXref 0.7