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


Generated: Sun Sep 15 01:00:03 2019 Cross-referenced by PHPXref 0.7.1