[ 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          <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" aria-current="page">
 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                      <# if ( data.originalImageURL && data.originalImageName ) { #>
 430                          <?php _e( 'Original image:' ); ?>
 431                          <a href="{{ data.originalImageURL }}">{{data.originalImageName}}</a>
 432                      <# } #>
 433                  <# } #>
 434  
 435                  <# if ( data.fileLength && data.fileLengthHumanReadable ) { #>
 436                      <div class="file-length"><strong><?php _e( 'Length:' ); ?></strong>
 437                          <span aria-hidden="true">{{ data.fileLength }}</span>
 438                          <span class="screen-reader-text">{{ data.fileLengthHumanReadable }}</span>
 439                      </div>
 440                  <# } #>
 441  
 442                  <# if ( 'audio' === data.type && data.meta.bitrate ) { #>
 443                      <div class="bitrate">
 444                          <strong><?php _e( 'Bitrate:' ); ?></strong> {{ Math.round( data.meta.bitrate / 1000 ) }}kb/s
 445                          <# if ( data.meta.bitrate_mode ) { #>
 446                          {{ ' ' + data.meta.bitrate_mode.toUpperCase() }}
 447                          <# } #>
 448                      </div>
 449                  <# } #>
 450  
 451                  <div class="compat-meta">
 452                      <# if ( data.compat && data.compat.meta ) { #>
 453                          {{{ data.compat.meta }}}
 454                      <# } #>
 455                  </div>
 456              </div>
 457  
 458              <div class="settings">
 459                  <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
 460                  <# if ( 'image' === data.type ) { #>
 461                      <span class="setting has-description" data-setting="alt">
 462                          <label for="attachment-details-two-column-alt-text" class="name"><?php _e( 'Alternative Text' ); ?></label>
 463                          <input type="text" id="attachment-details-two-column-alt-text" value="{{ data.alt }}" aria-describedby="alt-text-description" {{ maybeReadOnly }} />
 464                      </span>
 465                      <p class="description" id="alt-text-description"><?php echo $alt_text_description; ?></p>
 466                  <# } #>
 467                  <?php if ( post_type_supports( 'attachment', 'title' ) ) : ?>
 468                  <span class="setting" data-setting="title">
 469                      <label for="attachment-details-two-column-title" class="name"><?php _e( 'Title' ); ?></label>
 470                      <input type="text" id="attachment-details-two-column-title" value="{{ data.title }}" {{ maybeReadOnly }} />
 471                  </span>
 472                  <?php endif; ?>
 473                  <# if ( 'audio' === data.type ) { #>
 474                  <?php
 475                  foreach ( array(
 476                      'artist' => __( 'Artist' ),
 477                      'album'  => __( 'Album' ),
 478                  ) as $key => $label ) :
 479                      ?>
 480                  <span class="setting" data-setting="<?php echo esc_attr( $key ); ?>">
 481                      <label for="attachment-details-two-column-<?php echo esc_attr( $key ); ?>" class="name"><?php echo $label; ?></label>
 482                      <input type="text" id="attachment-details-two-column-<?php echo esc_attr( $key ); ?>" value="{{ data.<?php echo $key; ?> || data.meta.<?php echo $key; ?> || '' }}" />
 483                  </span>
 484                  <?php endforeach; ?>
 485                  <# } #>
 486                  <span class="setting" data-setting="caption">
 487                      <label for="attachment-details-two-column-caption" class="name"><?php _e( 'Caption' ); ?></label>
 488                      <textarea id="attachment-details-two-column-caption" {{ maybeReadOnly }}>{{ data.caption }}</textarea>
 489                  </span>
 490                  <span class="setting" data-setting="description">
 491                      <label for="attachment-details-two-column-description" class="name"><?php _e( 'Description' ); ?></label>
 492                      <textarea id="attachment-details-two-column-description" {{ maybeReadOnly }}>{{ data.description }}</textarea>
 493                  </span>
 494                  <span class="setting">
 495                      <span class="name"><?php _e( 'Uploaded By' ); ?></span>
 496                      <span class="value">{{ data.authorName }}</span>
 497                  </span>
 498                  <# if ( data.uploadedToTitle ) { #>
 499                      <span class="setting">
 500                          <span class="name"><?php _e( 'Uploaded To' ); ?></span>
 501                          <# if ( data.uploadedToLink ) { #>
 502                              <span class="value"><a href="{{ data.uploadedToLink }}">{{ data.uploadedToTitle }}</a></span>
 503                          <# } else { #>
 504                              <span class="value">{{ data.uploadedToTitle }}</span>
 505                          <# } #>
 506                      </span>
 507                  <# } #>
 508                  <span class="setting" data-setting="url">
 509                      <label for="attachment-details-two-column-copy-link" class="name"><?php _e( 'Copy Link' ); ?></label>
 510                      <input type="text" id="attachment-details-two-column-copy-link" value="{{ data.url }}" readonly />
 511                  </span>
 512                  <div class="attachment-compat"></div>
 513              </div>
 514  
 515              <div class="actions">
 516                  <a class="view-attachment" href="{{ data.link }}"><?php _e( 'View attachment page' ); ?></a>
 517                  <# if ( data.can.save ) { #> |
 518                      <a href="{{ data.editLink }}"><?php _e( 'Edit more details' ); ?></a>
 519                  <# } #>
 520                  <# if ( ! data.uploading && data.can.remove ) { #> |
 521                      <?php if ( MEDIA_TRASH ) : ?>
 522                          <# if ( 'trash' === data.status ) { #>
 523                              <button type="button" class="button-link untrash-attachment"><?php _e( 'Restore from Trash' ); ?></button>
 524                          <# } else { #>
 525                              <button type="button" class="button-link trash-attachment"><?php _e( 'Move to Trash' ); ?></button>
 526                          <# } #>
 527                      <?php else : ?>
 528                          <button type="button" class="button-link delete-attachment"><?php _e( 'Delete Permanently' ); ?></button>
 529                      <?php endif; ?>
 530                  <# } #>
 531              </div>
 532          </div>
 533      </script>
 534  
 535      <?php // Template for the Attachment "thumbnails" in the Media Grid. ?>
 536      <script type="text/html" id="tmpl-attachment">
 537          <div class="attachment-preview js--select-attachment type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}">
 538              <div class="thumbnail">
 539                  <# if ( data.uploading ) { #>
 540                      <div class="media-progress-bar"><div style="width: {{ data.percent }}%"></div></div>
 541                  <# } else if ( 'image' === data.type && data.sizes ) { #>
 542                      <div class="centered">
 543                          <img src="{{ data.size.url }}" draggable="false" alt="" />
 544                      </div>
 545                  <# } else { #>
 546                      <div class="centered">
 547                          <# if ( data.image && data.image.src && data.image.src !== data.icon ) { #>
 548                              <img src="{{ data.image.src }}" class="thumbnail" draggable="false" alt="" />
 549                          <# } else if ( data.sizes && data.sizes.medium ) { #>
 550                              <img src="{{ data.sizes.medium.url }}" class="thumbnail" draggable="false" alt="" />
 551                          <# } else { #>
 552                              <img src="{{ data.icon }}" class="icon" draggable="false" alt="" />
 553                          <# } #>
 554                      </div>
 555                      <div class="filename">
 556                          <div>{{ data.filename }}</div>
 557                      </div>
 558                  <# } #>
 559              </div>
 560              <# if ( data.buttons.close ) { #>
 561                  <button type="button" class="button-link attachment-close media-modal-icon"><span class="screen-reader-text"><?php _e( 'Remove' ); ?></span></button>
 562              <# } #>
 563          </div>
 564          <# if ( data.buttons.check ) { #>
 565              <button type="button" class="check" tabindex="-1"><span class="media-modal-icon"></span><span class="screen-reader-text"><?php _e( 'Deselect' ); ?></span></button>
 566          <# } #>
 567          <#
 568          var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly';
 569          if ( data.describe ) {
 570              if ( 'image' === data.type ) { #>
 571                  <input type="text" value="{{ data.caption }}" class="describe" data-setting="caption"
 572                      aria-label="<?php esc_attr_e( 'Caption' ); ?>"
 573                      placeholder="<?php esc_attr_e( 'Caption&hellip;' ); ?>" {{ maybeReadOnly }} />
 574              <# } else { #>
 575                  <input type="text" value="{{ data.title }}" class="describe" data-setting="title"
 576                      <# if ( 'video' === data.type ) { #>
 577                          aria-label="<?php esc_attr_e( 'Video title' ); ?>"
 578                          placeholder="<?php esc_attr_e( 'Video title&hellip;' ); ?>"
 579                      <# } else if ( 'audio' === data.type ) { #>
 580                          aria-label="<?php esc_attr_e( 'Audio title' ); ?>"
 581                          placeholder="<?php esc_attr_e( 'Audio title&hellip;' ); ?>"
 582                      <# } else { #>
 583                          aria-label="<?php esc_attr_e( 'Media title' ); ?>"
 584                          placeholder="<?php esc_attr_e( 'Media title&hellip;' ); ?>"
 585                      <# } #> {{ maybeReadOnly }} />
 586              <# }
 587          } #>
 588      </script>
 589  
 590      <?php // Template for the Attachment details, used for example in the sidebar. ?>
 591      <script type="text/html" id="tmpl-attachment-details">
 592          <h2>
 593              <?php _e( 'Attachment Details' ); ?>
 594              <span class="settings-save-status" role="status">
 595                  <span class="spinner"></span>
 596                  <span class="saved"><?php esc_html_e( 'Saved.' ); ?></span>
 597              </span>
 598          </h2>
 599          <div class="attachment-info">
 600              <div class="thumbnail thumbnail-{{ data.type }}">
 601                  <# if ( data.uploading ) { #>
 602                      <div class="media-progress-bar"><div></div></div>
 603                  <# } else if ( 'image' === data.type && data.sizes ) { #>
 604                      <img src="{{ data.size.url }}" draggable="false" alt="" />
 605                  <# } else { #>
 606                      <img src="{{ data.icon }}" class="icon" draggable="false" alt="" />
 607                  <# } #>
 608              </div>
 609              <div class="details">
 610                  <div class="filename">{{ data.filename }}</div>
 611                  <div class="uploaded">{{ data.dateFormatted }}</div>
 612  
 613                  <div class="file-size">{{ data.filesizeHumanReadable }}</div>
 614                  <# if ( 'image' === data.type && ! data.uploading ) { #>
 615                      <# if ( data.width && data.height ) { #>
 616                          <div class="dimensions">
 617                              <?php
 618                              /* translators: 1: A number of pixels wide, 2: A number of pixels tall. */
 619                              printf( __( '%1$s by %2$s pixels' ), '{{ data.width }}', '{{ data.height }}' );
 620                              ?>
 621                          </div>
 622                      <# } #>
 623  
 624                      <# if ( data.originalImageURL && data.originalImageName ) { #>
 625                          <?php _e( 'Original image:' ); ?>
 626                          <a href="{{ data.originalImageURL }}">{{data.originalImageName}}</a>
 627                      <# } #>
 628  
 629                      <# if ( data.can.save && data.sizes ) { #>
 630                          <a class="edit-attachment" href="{{ data.editLink }}&amp;image-editor" target="_blank"><?php _e( 'Edit Image' ); ?></a>
 631                      <# } #>
 632                  <# } #>
 633  
 634                  <# if ( data.fileLength && data.fileLengthHumanReadable ) { #>
 635                      <div class="file-length"><?php _e( 'Length:' ); ?>
 636                          <span aria-hidden="true">{{ data.fileLength }}</span>
 637                          <span class="screen-reader-text">{{ data.fileLengthHumanReadable }}</span>
 638                      </div>
 639                  <# } #>
 640  
 641                  <# if ( ! data.uploading && data.can.remove ) { #>
 642                      <?php if ( MEDIA_TRASH ) : ?>
 643                      <# if ( 'trash' === data.status ) { #>
 644                          <button type="button" class="button-link untrash-attachment"><?php _e( 'Restore from Trash' ); ?></button>
 645                      <# } else { #>
 646                          <button type="button" class="button-link trash-attachment"><?php _e( 'Move to Trash' ); ?></button>
 647                      <# } #>
 648                      <?php else : ?>
 649                          <button type="button" class="button-link delete-attachment"><?php _e( 'Delete Permanently' ); ?></button>
 650                      <?php endif; ?>
 651                  <# } #>
 652  
 653                  <div class="compat-meta">
 654                      <# if ( data.compat && data.compat.meta ) { #>
 655                          {{{ data.compat.meta }}}
 656                      <# } #>
 657                  </div>
 658              </div>
 659          </div>
 660          <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
 661          <# if ( 'image' === data.type ) { #>
 662              <span class="setting has-description" data-setting="alt">
 663                  <label for="attachment-details-alt-text" class="name"><?php _e( 'Alt Text' ); ?></label>
 664                  <input type="text" id="attachment-details-alt-text" value="{{ data.alt }}" aria-describedby="alt-text-description" {{ maybeReadOnly }} />
 665              </span>
 666              <p class="description" id="alt-text-description"><?php echo $alt_text_description; ?></p>
 667          <# } #>
 668          <?php if ( post_type_supports( 'attachment', 'title' ) ) : ?>
 669          <span class="setting" data-setting="title">
 670              <label for="attachment-details-title" class="name"><?php _e( 'Title' ); ?></label>
 671              <input type="text" id="attachment-details-title" value="{{ data.title }}" {{ maybeReadOnly }} />
 672          </span>
 673          <?php endif; ?>
 674          <# if ( 'audio' === data.type ) { #>
 675          <?php
 676          foreach ( array(
 677              'artist' => __( 'Artist' ),
 678              'album'  => __( 'Album' ),
 679          ) as $key => $label ) :
 680              ?>
 681          <span class="setting" data-setting="<?php echo esc_attr( $key ); ?>">
 682              <label for="attachment-details-<?php echo esc_attr( $key ); ?>" class="name"><?php echo $label; ?></label>
 683              <input type="text" id="attachment-details-<?php echo esc_attr( $key ); ?>" value="{{ data.<?php echo $key; ?> || data.meta.<?php echo $key; ?> || '' }}" />
 684          </span>
 685          <?php endforeach; ?>
 686          <# } #>
 687          <span class="setting" data-setting="caption">
 688              <label for="attachment-details-caption" class="name"><?php _e( 'Caption' ); ?></label>
 689              <textarea id="attachment-details-caption" {{ maybeReadOnly }}>{{ data.caption }}</textarea>
 690          </span>
 691          <span class="setting" data-setting="description">
 692              <label for="attachment-details-description" class="name"><?php _e( 'Description' ); ?></label>
 693              <textarea id="attachment-details-description" {{ maybeReadOnly }}>{{ data.description }}</textarea>
 694          </span>
 695          <span class="setting" data-setting="url">
 696              <label for="attachment-details-copy-link" class="name"><?php _e( 'Copy Link' ); ?></label>
 697              <input type="text" id="attachment-details-copy-link" value="{{ data.url }}" readonly />
 698          </span>
 699      </script>
 700  
 701      <?php // Template for the Selection status bar. ?>
 702      <script type="text/html" id="tmpl-media-selection">
 703          <div class="selection-info">
 704              <span class="count"></span>
 705              <# if ( data.editable ) { #>
 706                  <button type="button" class="button-link edit-selection"><?php _e( 'Edit Selection' ); ?></button>
 707              <# } #>
 708              <# if ( data.clearable ) { #>
 709                  <button type="button" class="button-link clear-selection"><?php _e( 'Clear' ); ?></button>
 710              <# } #>
 711          </div>
 712          <div class="selection-view"></div>
 713      </script>
 714  
 715      <?php // Template for the Attachment display settings, used for example in the sidebar. ?>
 716      <script type="text/html" id="tmpl-attachment-display-settings">
 717          <h2><?php _e( 'Attachment Display Settings' ); ?></h2>
 718  
 719          <# if ( 'image' === data.type ) { #>
 720              <span class="setting align">
 721                  <label for="attachment-display-settings-alignment" class="name"><?php _e( 'Alignment' ); ?></label>
 722                  <select id="attachment-display-settings-alignment" class="alignment"
 723                      data-setting="align"
 724                      <# if ( data.userSettings ) { #>
 725                          data-user-setting="align"
 726                      <# } #>>
 727  
 728                      <option value="left">
 729                          <?php esc_html_e( 'Left' ); ?>
 730                      </option>
 731                      <option value="center">
 732                          <?php esc_html_e( 'Center' ); ?>
 733                      </option>
 734                      <option value="right">
 735                          <?php esc_html_e( 'Right' ); ?>
 736                      </option>
 737                      <option value="none" selected>
 738                          <?php esc_html_e( 'None' ); ?>
 739                      </option>
 740                  </select>
 741              </span>
 742          <# } #>
 743  
 744          <span class="setting">
 745              <label for="attachment-display-settings-link-to" class="name">
 746                  <# if ( data.model.canEmbed ) { #>
 747                      <?php _e( 'Embed or Link' ); ?>
 748                  <# } else { #>
 749                      <?php _e( 'Link To' ); ?>
 750                  <# } #>
 751              </label>
 752              <select id="attachment-display-settings-link-to" class="link-to"
 753                  data-setting="link"
 754                  <# if ( data.userSettings && ! data.model.canEmbed ) { #>
 755                      data-user-setting="urlbutton"
 756                  <# } #>>
 757  
 758              <# if ( data.model.canEmbed ) { #>
 759                  <option value="embed" selected>
 760                      <?php esc_html_e( 'Embed Media Player' ); ?>
 761                  </option>
 762                  <option value="file">
 763              <# } else { #>
 764                  <option value="none" selected>
 765                      <?php esc_html_e( 'None' ); ?>
 766                  </option>
 767                  <option value="file">
 768              <# } #>
 769                  <# if ( data.model.canEmbed ) { #>
 770                      <?php esc_html_e( 'Link to Media File' ); ?>
 771                  <# } else { #>
 772                      <?php esc_html_e( 'Media File' ); ?>
 773                  <# } #>
 774                  </option>
 775                  <option value="post">
 776                  <# if ( data.model.canEmbed ) { #>
 777                      <?php esc_html_e( 'Link to Attachment Page' ); ?>
 778                  <# } else { #>
 779                      <?php esc_html_e( 'Attachment Page' ); ?>
 780                  <# } #>
 781                  </option>
 782              <# if ( 'image' === data.type ) { #>
 783                  <option value="custom">
 784                      <?php esc_html_e( 'Custom URL' ); ?>
 785                  </option>
 786              <# } #>
 787              </select>
 788          </span>
 789          <span class="setting">
 790              <label for="attachment-display-settings-link-to-custom" class="name"><?php _e( 'URL' ); ?></label>
 791              <input type="text" id="attachment-display-settings-link-to-custom" class="link-to-custom" data-setting="linkUrl" />
 792          </span>
 793  
 794          <# if ( 'undefined' !== typeof data.sizes ) { #>
 795              <span class="setting">
 796                  <label for="attachment-display-settings-size" class="name"><?php _e( 'Size' ); ?></label>
 797                  <select id="attachment-display-settings-size" class="size" name="size"
 798                      data-setting="size"
 799                      <# if ( data.userSettings ) { #>
 800                          data-user-setting="imgsize"
 801                      <# } #>>
 802                      <?php
 803                      /** This filter is documented in wp-admin/includes/media.php */
 804                      $sizes = apply_filters(
 805                          'image_size_names_choose',
 806                          array(
 807                              'thumbnail' => __( 'Thumbnail' ),
 808                              'medium'    => __( 'Medium' ),
 809                              'large'     => __( 'Large' ),
 810                              'full'      => __( 'Full Size' ),
 811                          )
 812                      );
 813  
 814                      foreach ( $sizes as $value => $name ) :
 815                          ?>
 816                          <#
 817                          var size = data.sizes['<?php echo esc_js( $value ); ?>'];
 818                          if ( size ) { #>
 819                              <option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, 'full' ); ?>>
 820                                  <?php echo esc_html( $name ); ?> &ndash; {{ size.width }} &times; {{ size.height }}
 821                              </option>
 822                          <# } #>
 823                      <?php endforeach; ?>
 824                  </select>
 825              </span>
 826          <# } #>
 827      </script>
 828  
 829      <?php // Template for the Gallery settings, used for example in the sidebar. ?>
 830      <script type="text/html" id="tmpl-gallery-settings">
 831          <h2><?php _e( 'Gallery Settings' ); ?></h2>
 832  
 833          <span class="setting">
 834              <label for="gallery-settings-link-to" class="name"><?php _e( 'Link To' ); ?></label>
 835              <select id="gallery-settings-link-to" class="link-to"
 836                  data-setting="link"
 837                  <# if ( data.userSettings ) { #>
 838                      data-user-setting="urlbutton"
 839                  <# } #>>
 840  
 841                  <option value="post" <# if ( ! wp.media.galleryDefaults.link || 'post' == wp.media.galleryDefaults.link ) {
 842                      #>selected="selected"<# }
 843                  #>>
 844                      <?php esc_html_e( 'Attachment Page' ); ?>
 845                  </option>
 846                  <option value="file" <# if ( 'file' == wp.media.galleryDefaults.link ) { #>selected="selected"<# } #>>
 847                      <?php esc_html_e( 'Media File' ); ?>
 848                  </option>
 849                  <option value="none" <# if ( 'none' == wp.media.galleryDefaults.link ) { #>selected="selected"<# } #>>
 850                      <?php esc_html_e( 'None' ); ?>
 851                  </option>
 852              </select>
 853          </span>
 854  
 855          <span class="setting">
 856              <label for="gallery-settings-columns" class="name select-label-inline"><?php _e( 'Columns' ); ?></label>
 857              <select id="gallery-settings-columns" class="columns" name="columns"
 858                  data-setting="columns">
 859                  <?php for ( $i = 1; $i <= 9; $i++ ) : ?>
 860                      <option value="<?php echo esc_attr( $i ); ?>" <#
 861                          if ( <?php echo $i; ?> == wp.media.galleryDefaults.columns ) { #>selected="selected"<# }
 862                      #>>
 863                          <?php echo esc_html( $i ); ?>
 864                      </option>
 865                  <?php endfor; ?>
 866              </select>
 867          </span>
 868  
 869          <span class="setting">
 870              <input type="checkbox" id="gallery-settings-random-order" data-setting="_orderbyRandom" />
 871              <label for="gallery-settings-random-order" class="checkbox-label-inline"><?php _e( 'Random Order' ); ?></label>
 872          </span>
 873  
 874          <span class="setting size">
 875              <label for="gallery-settings-size" class="name"><?php _e( 'Size' ); ?></label>
 876              <select id="gallery-settings-size" class="size" name="size"
 877                  data-setting="size"
 878                  <# if ( data.userSettings ) { #>
 879                      data-user-setting="imgsize"
 880                  <# } #>
 881                  >
 882                  <?php
 883                  /** This filter is documented in wp-admin/includes/media.php */
 884                  $size_names = apply_filters(
 885                      'image_size_names_choose',
 886                      array(
 887                          'thumbnail' => __( 'Thumbnail' ),
 888                          'medium'    => __( 'Medium' ),
 889                          'large'     => __( 'Large' ),
 890                          'full'      => __( 'Full Size' ),
 891                      )
 892                  );
 893  
 894                  foreach ( $size_names as $size => $label ) :
 895                      ?>
 896                      <option value="<?php echo esc_attr( $size ); ?>">
 897                          <?php echo esc_html( $label ); ?>
 898                      </option>
 899                  <?php endforeach; ?>
 900              </select>
 901          </span>
 902      </script>
 903  
 904      <?php // Template for the Playlists settings, used for example in the sidebar. ?>
 905      <script type="text/html" id="tmpl-playlist-settings">
 906          <h2><?php _e( 'Playlist Settings' ); ?></h2>
 907  
 908          <# var emptyModel = _.isEmpty( data.model ),
 909              isVideo = 'video' === data.controller.get('library').props.get('type'); #>
 910  
 911          <span class="setting">
 912              <input type="checkbox" id="playlist-settings-show-list" data-setting="tracklist" <# if ( emptyModel ) { #>
 913                  checked="checked"
 914              <# } #> />
 915              <label for="playlist-settings-show-list" class="checkbox-label-inline">
 916                  <# if ( isVideo ) { #>
 917                  <?php _e( 'Show Video List' ); ?>
 918                  <# } else { #>
 919                  <?php _e( 'Show Tracklist' ); ?>
 920                  <# } #>
 921              </label>
 922          </span>
 923  
 924          <# if ( ! isVideo ) { #>
 925          <span class="setting">
 926              <input type="checkbox" id="playlist-settings-show-artist" data-setting="artists" <# if ( emptyModel ) { #>
 927                  checked="checked"
 928              <# } #> />
 929              <label for="playlist-settings-show-artist" class="checkbox-label-inline">
 930                  <?php _e( 'Show Artist Name in Tracklist' ); ?>
 931              </label>
 932          </span>
 933          <# } #>
 934  
 935          <span class="setting">
 936              <input type="checkbox" id="playlist-settings-show-images" data-setting="images" <# if ( emptyModel ) { #>
 937                  checked="checked"
 938              <# } #> />
 939              <label for="playlist-settings-show-images" class="checkbox-label-inline">
 940                  <?php _e( 'Show Images' ); ?>
 941              </label>
 942          </span>
 943      </script>
 944  
 945      <?php // Template for the "Insert from URL" layout. ?>
 946      <script type="text/html" id="tmpl-embed-link-settings">
 947          <span class="setting link-text">
 948              <label for="embed-link-settings-link-text" class="name"><?php _e( 'Link Text' ); ?></label>
 949              <input type="text" id="embed-link-settings-link-text" class="alignment" data-setting="linkText" />
 950          </span>
 951          <div class="embed-container" style="display: none;">
 952              <div class="embed-preview"></div>
 953          </div>
 954      </script>
 955  
 956      <?php // Template for the "Insert from URL" image preview and details. ?>
 957      <script type="text/html" id="tmpl-embed-image-settings">
 958          <div class="wp-clearfix">
 959              <div class="thumbnail">
 960                  <img src="{{ data.model.url }}" draggable="false" alt="" />
 961              </div>
 962          </div>
 963  
 964          <span class="setting alt-text has-description">
 965              <label for="embed-image-settings-alt-text" class="name"><?php _e( 'Alternative Text' ); ?></label>
 966              <input type="text" id="embed-image-settings-alt-text" data-setting="alt" aria-describedby="alt-text-description" />
 967          </span>
 968          <p class="description" id="alt-text-description"><?php echo $alt_text_description; ?></p>
 969  
 970          <?php
 971          /** This filter is documented in wp-admin/includes/media.php */
 972          if ( ! apply_filters( 'disable_captions', '' ) ) :
 973              ?>
 974              <span class="setting caption">
 975                  <label for="embed-image-settings-caption" class="name"><?php _e( 'Caption' ); ?></label>
 976                  <textarea id="embed-image-settings-caption" data-setting="caption" />
 977              </span>
 978          <?php endif; ?>
 979  
 980          <fieldset class="setting-group">
 981              <legend class="name"><?php _e( 'Align' ); ?></legend>
 982              <span class="setting align">
 983                  <span class="button-group button-large" data-setting="align">
 984                      <button class="button" value="left">
 985                          <?php esc_html_e( 'Left' ); ?>
 986                      </button>
 987                      <button class="button" value="center">
 988                          <?php esc_html_e( 'Center' ); ?>
 989                      </button>
 990                      <button class="button" value="right">
 991                          <?php esc_html_e( 'Right' ); ?>
 992                      </button>
 993                      <button class="button active" value="none">
 994                          <?php esc_html_e( 'None' ); ?>
 995                      </button>
 996                  </span>
 997              </span>
 998          </fieldset>
 999  
1000          <fieldset class="setting-group">
1001              <legend class="name"><?php _e( 'Link To' ); ?></legend>
1002              <span class="setting link-to">
1003                  <span class="button-group button-large" data-setting="link">
1004                      <button class="button" value="file">
1005                          <?php esc_html_e( 'Image URL' ); ?>
1006                      </button>
1007                      <button class="button" value="custom">
1008                          <?php esc_html_e( 'Custom URL' ); ?>
1009                      </button>
1010                      <button class="button active" value="none">
1011                          <?php esc_html_e( 'None' ); ?>
1012                      </button>
1013                  </span>
1014              </span>
1015              <span class="setting">
1016                  <label for="embed-image-settings-link-to-custom" class="name"><?php _e( 'URL' ); ?></label>
1017                  <input type="text" id="embed-image-settings-link-to-custom" class="link-to-custom" data-setting="linkUrl" />
1018              </span>
1019          </fieldset>
1020      </script>
1021  
1022      <?php // Template for the Image details, used for example in the editor. ?>
1023      <script type="text/html" id="tmpl-image-details">
1024          <div class="media-embed">
1025              <div class="embed-media-settings">
1026                  <div class="column-settings">
1027                      <span class="setting alt-text has-description">
1028                          <label for="image-details-alt-text" class="name"><?php _e( 'Alternative Text' ); ?></label>
1029                          <input type="text" id="image-details-alt-text" data-setting="alt" value="{{ data.model.alt }}" aria-describedby="alt-text-description" />
1030                      </span>
1031                      <p class="description" id="alt-text-description"><?php echo $alt_text_description; ?></p>
1032  
1033                      <?php
1034                      /** This filter is documented in wp-admin/includes/media.php */
1035                      if ( ! apply_filters( 'disable_captions', '' ) ) :
1036                          ?>
1037                          <span class="setting caption">
1038                              <label for="image-details-caption" class="name"><?php _e( 'Caption' ); ?></label>
1039                              <textarea id="image-details-caption" data-setting="caption">{{ data.model.caption }}</textarea>
1040                          </span>
1041                      <?php endif; ?>
1042  
1043                      <h2><?php _e( 'Display Settings' ); ?></h2>
1044                      <fieldset class="setting-group">
1045                          <legend class="legend-inline"><?php _e( 'Align' ); ?></legend>
1046                          <span class="setting align">
1047                              <span class="button-group button-large" data-setting="align">
1048                                  <button class="button" value="left">
1049                                      <?php esc_html_e( 'Left' ); ?>
1050                                  </button>
1051                                  <button class="button" value="center">
1052                                      <?php esc_html_e( 'Center' ); ?>
1053                                  </button>
1054                                  <button class="button" value="right">
1055                                      <?php esc_html_e( 'Right' ); ?>
1056                                  </button>
1057                                  <button class="button active" value="none">
1058                                      <?php esc_html_e( 'None' ); ?>
1059                                  </button>
1060                              </span>
1061                          </span>
1062                      </fieldset>
1063  
1064                      <# if ( data.attachment ) { #>
1065                          <# if ( 'undefined' !== typeof data.attachment.sizes ) { #>
1066                              <span class="setting size">
1067                                  <label for="image-details-size" class="name"><?php _e( 'Size' ); ?></label>
1068                                  <select id="image-details-size" class="size" name="size"
1069                                      data-setting="size"
1070                                      <# if ( data.userSettings ) { #>
1071                                          data-user-setting="imgsize"
1072                                      <# } #>>
1073                                      <?php
1074                                      /** This filter is documented in wp-admin/includes/media.php */
1075                                      $sizes = apply_filters(
1076                                          'image_size_names_choose',
1077                                          array(
1078                                              'thumbnail' => __( 'Thumbnail' ),
1079                                              'medium'    => __( 'Medium' ),
1080                                              'large'     => __( 'Large' ),
1081                                              'full'      => __( 'Full Size' ),
1082                                          )
1083                                      );
1084  
1085                                      foreach ( $sizes as $value => $name ) :
1086                                          ?>
1087                                          <#
1088                                          var size = data.sizes['<?php echo esc_js( $value ); ?>'];
1089                                          if ( size ) { #>
1090                                              <option value="<?php echo esc_attr( $value ); ?>">
1091                                                  <?php echo esc_html( $name ); ?> &ndash; {{ size.width }} &times; {{ size.height }}
1092                                              </option>
1093                                          <# } #>
1094                                      <?php endforeach; ?>
1095                                      <option value="<?php echo esc_attr( 'custom' ); ?>">
1096                                          <?php _e( 'Custom Size' ); ?>
1097                                      </option>
1098                                  </select>
1099                              </span>
1100                          <# } #>
1101                              <div class="custom-size wp-clearfix<# if ( data.model.size !== 'custom' ) { #> hidden<# } #>">
1102                                  <span class="custom-size-setting">
1103                                      <label for="image-details-size-width"><?php _e( 'Width' ); ?></label>
1104                                      <input type="number" id="image-details-size-width" aria-describedby="image-size-desc" data-setting="customWidth" step="1" value="{{ data.model.customWidth }}" />
1105                                  </span>
1106                                  <span class="sep" aria-hidden="true">&times;</span>
1107                                  <span class="custom-size-setting">
1108                                      <label for="image-details-size-height"><?php _e( 'Height' ); ?></label>
1109                                      <input type="number" id="image-details-size-height" aria-describedby="image-size-desc" data-setting="customHeight" step="1" value="{{ data.model.customHeight }}" />
1110                                  </span>
1111                                  <p id="image-size-desc" class="description"><?php _e( 'Image size in pixels' ); ?></p>
1112                              </div>
1113                      <# } #>
1114  
1115                      <span class="setting link-to">
1116                          <label for="image-details-link-to" class="name"><?php _e( 'Link To' ); ?></label>
1117                          <select id="image-details-link-to" data-setting="link">
1118                          <# if ( data.attachment ) { #>
1119                              <option value="file">
1120                                  <?php esc_html_e( 'Media File' ); ?>
1121                              </option>
1122                              <option value="post">
1123                                  <?php esc_html_e( 'Attachment Page' ); ?>
1124                              </option>
1125                          <# } else { #>
1126                              <option value="file">
1127                                  <?php esc_html_e( 'Image URL' ); ?>
1128                              </option>
1129                          <# } #>
1130                              <option value="custom">
1131                                  <?php esc_html_e( 'Custom URL' ); ?>
1132                              </option>
1133                              <option value="none">
1134                                  <?php esc_html_e( 'None' ); ?>
1135                              </option>
1136                          </select>
1137                      </span>
1138                      <span class="setting">
1139                          <label for="image-details-link-to-custom" class="name"><?php _e( 'URL' ); ?></label>
1140                          <input type="text" id="image-details-link-to-custom" class="link-to-custom" data-setting="linkUrl" />
1141                      </span>
1142  
1143                      <div class="advanced-section">
1144                          <h2><button type="button" class="button-link advanced-toggle"><?php _e( 'Advanced Options' ); ?></button></h2>
1145                          <div class="advanced-settings hidden">
1146                              <div class="advanced-image">
1147                                  <span class="setting title-text">
1148                                      <label for="image-details-title-attribute" class="name"><?php _e( 'Image Title Attribute' ); ?></label>
1149                                      <input type="text" id="image-details-title-attribute" data-setting="title" value="{{ data.model.title }}" />
1150                                  </span>
1151                                  <span class="setting extra-classes">
1152                                      <label for="image-details-css-class" class="name"><?php _e( 'Image CSS Class' ); ?></label>
1153                                      <input type="text" id="image-details-css-class" data-setting="extraClasses" value="{{ data.model.extraClasses }}" />
1154                                  </span>
1155                              </div>
1156                              <div class="advanced-link">
1157                                  <span class="setting link-target">
1158                                      <input type="checkbox" id="image-details-link-target" data-setting="linkTargetBlank" value="_blank" <# if ( data.model.linkTargetBlank ) { #>checked="checked"<# } #>>
1159                                      <label for="image-details-link-target" class="checkbox-label"><?php _e( 'Open link in a new tab' ); ?></label>
1160                                  </span>
1161                                  <span class="setting link-rel">
1162                                      <label for="image-details-link-rel" class="name"><?php _e( 'Link Rel' ); ?></label>
1163                                      <input type="text" id="image-details-link-rel" data-setting="linkRel" value="{{ data.model.linkRel }}" />
1164                                  </span>
1165                                  <span class="setting link-class-name">
1166                                      <label for="image-details-link-css-class" class="name"><?php _e( 'Link CSS Class' ); ?></label>
1167                                      <input type="text" id="image-details-link-css-class" data-setting="linkClassName" value="{{ data.model.linkClassName }}" />
1168                                  </span>
1169                              </div>
1170                          </div>
1171                      </div>
1172                  </div>
1173                  <div class="column-image">
1174                      <div class="image">
1175                          <img src="{{ data.model.url }}" draggable="false" alt="" />
1176                          <# if ( data.attachment && window.imageEdit ) { #>
1177                              <div class="actions">
1178                                  <input type="button" class="edit-attachment button" value="<?php esc_attr_e( 'Edit Original' ); ?>" />
1179                                  <input type="button" class="replace-attachment button" value="<?php esc_attr_e( 'Replace' ); ?>" />
1180                              </div>
1181                          <# } #>
1182                      </div>
1183                  </div>
1184              </div>
1185          </div>
1186      </script>
1187  
1188      <?php // Template for the Image Editor layout. ?>
1189      <script type="text/html" id="tmpl-image-editor">
1190          <div id="media-head-{{ data.id }}"></div>
1191          <div id="image-editor-{{ data.id }}"></div>
1192      </script>
1193  
1194      <?php // Template for an embedded Audio details. ?>
1195      <script type="text/html" id="tmpl-audio-details">
1196          <# var ext, html5types = {
1197              mp3: wp.media.view.settings.embedMimes.mp3,
1198              ogg: wp.media.view.settings.embedMimes.ogg
1199          }; #>
1200  
1201          <?php $audio_types = wp_get_audio_extensions(); ?>
1202          <div class="media-embed media-embed-details">
1203              <div class="embed-media-settings embed-audio-settings">
1204                  <?php wp_underscore_audio_template(); ?>
1205  
1206                  <# if ( ! _.isEmpty( data.model.src ) ) {
1207                      ext = data.model.src.split('.').pop();
1208                      if ( html5types[ ext ] ) {
1209                          delete html5types[ ext ];
1210                      }
1211                  #>
1212                  <span class="setting">
1213                      <label for="audio-details-source" class="name"><?php _e( 'URL' ); ?></label>
1214                      <input type="text" id="audio-details-source" readonly data-setting="src" value="{{ data.model.src }}" />
1215                      <button type="button" class="button-link remove-setting"><?php _e( 'Remove audio source' ); ?></button>
1216                  </span>
1217                  <# } #>
1218                  <?php
1219  
1220                  foreach ( $audio_types as $type ) :
1221                      ?>
1222                  <# if ( ! _.isEmpty( data.model.<?php echo $type; ?> ) ) {
1223                      if ( ! _.isUndefined( html5types.<?php echo $type; ?> ) ) {
1224                          delete html5types.<?php echo $type; ?>;
1225                      }
1226                  #>
1227                  <span class="setting">
1228                      <label for="audio-details-<?php echo $type . '-source'; ?>" class="name"><?php echo strtoupper( $type ); ?></label>
1229                      <input type="text" id="audio-details-<?php echo $type . '-source'; ?>" readonly data-setting="<?php echo $type; ?>" value="{{ data.model.<?php echo $type; ?> }}" />
1230                      <button type="button" class="button-link remove-setting"><?php _e( 'Remove audio source' ); ?></button>
1231                  </span>
1232                  <# } #>
1233                  <?php endforeach ?>
1234  
1235                  <# if ( ! _.isEmpty( html5types ) ) { #>
1236                  <fieldset class="setting-group">
1237                      <legend class="name"><?php _e( 'Add alternate sources for maximum HTML5 playback' ); ?></legend>
1238                      <span class="setting">
1239                          <span class="button-large">
1240                          <# _.each( html5types, function (mime, type) { #>
1241                              <button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button>
1242                          <# } ) #>
1243                          </span>
1244                      </span>
1245                  </fieldset>
1246                  <# } #>
1247  
1248                  <fieldset class="setting-group">
1249                      <legend class="name"><?php _e( 'Preload' ); ?></legend>
1250                      <span class="setting preload">
1251                          <span class="button-group button-large" data-setting="preload">
1252                              <button class="button" value="auto"><?php _ex( 'Auto', 'auto preload' ); ?></button>
1253                              <button class="button" value="metadata"><?php _e( 'Metadata' ); ?></button>
1254                              <button class="button active" value="none"><?php _e( 'None' ); ?></button>
1255                          </span>
1256                      </span>
1257                  </fieldset>
1258  
1259                  <span class="setting-group">
1260                      <span class="setting checkbox-setting autoplay">
1261                          <input type="checkbox" id="audio-details-autoplay" data-setting="autoplay" />
1262                          <label for="audio-details-autoplay" class="checkbox-label"><?php _e( 'Autoplay' ); ?></label>
1263                      </span>
1264  
1265                      <span class="setting checkbox-setting">
1266                          <input type="checkbox" id="audio-details-loop" data-setting="loop" />
1267                          <label for="audio-details-loop" class="checkbox-label"><?php _e( 'Loop' ); ?></label>
1268                      </span>
1269                  </span>
1270              </div>
1271          </div>
1272      </script>
1273  
1274      <?php // Template for an embedded Video details. ?>
1275      <script type="text/html" id="tmpl-video-details">
1276          <# var ext, html5types = {
1277              mp4: wp.media.view.settings.embedMimes.mp4,
1278              ogv: wp.media.view.settings.embedMimes.ogv,
1279              webm: wp.media.view.settings.embedMimes.webm
1280          }; #>
1281  
1282          <?php $video_types = wp_get_video_extensions(); ?>
1283          <div class="media-embed media-embed-details">
1284              <div class="embed-media-settings embed-video-settings">
1285                  <div class="wp-video-holder">
1286                  <#
1287                  var w = ! data.model.width || data.model.width > 640 ? 640 : data.model.width,
1288                      h = ! data.model.height ? 360 : data.model.height;
1289  
1290                  if ( data.model.width && w !== data.model.width ) {
1291                      h = Math.ceil( ( h * w ) / data.model.width );
1292                  }
1293                  #>
1294  
1295                  <?php wp_underscore_video_template(); ?>
1296  
1297                  <# if ( ! _.isEmpty( data.model.src ) ) {
1298                      ext = data.model.src.split('.').pop();
1299                      if ( html5types[ ext ] ) {
1300                          delete html5types[ ext ];
1301                      }
1302                  #>
1303                  <span class="setting">
1304                      <label for="video-details-source" class="name"><?php _e( 'URL' ); ?></label>
1305                      <input type="text" id="video-details-source" readonly data-setting="src" value="{{ data.model.src }}" />
1306                      <button type="button" class="button-link remove-setting"><?php _e( 'Remove video source' ); ?></button>
1307                  </span>
1308                  <# } #>
1309                  <?php
1310                  foreach ( $video_types as $type ) :
1311                      ?>
1312                  <# if ( ! _.isEmpty( data.model.<?php echo $type; ?> ) ) {
1313                      if ( ! _.isUndefined( html5types.<?php echo $type; ?> ) ) {
1314                          delete html5types.<?php echo $type; ?>;
1315                      }
1316                  #>
1317                  <span class="setting">
1318                      <label for="video-details-<?php echo $type . '-source'; ?>" class="name"><?php echo strtoupper( $type ); ?></label>
1319                      <input type="text" id="video-details-<?php echo $type . '-source'; ?>" readonly data-setting="<?php echo $type; ?>" value="{{ data.model.<?php echo $type; ?> }}" />
1320                      <button type="button" class="button-link remove-setting"><?php _e( 'Remove video source' ); ?></button>
1321                  </span>
1322                  <# } #>
1323                  <?php endforeach ?>
1324                  </div>
1325  
1326                  <# if ( ! _.isEmpty( html5types ) ) { #>
1327                  <fieldset class="setting-group">
1328                      <legend class="name"><?php _e( 'Add alternate sources for maximum HTML5 playback' ); ?></legend>
1329                      <span class="setting">
1330                          <span class="button-large">
1331                          <# _.each( html5types, function (mime, type) { #>
1332                              <button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button>
1333                          <# } ) #>
1334                          </span>
1335                      </span>
1336                  </fieldset>
1337                  <# } #>
1338  
1339                  <# if ( ! _.isEmpty( data.model.poster ) ) { #>
1340                  <span class="setting">
1341                      <label for="video-details-poster-image" class="name"><?php _e( 'Poster Image' ); ?></label>
1342                      <input type="text" id="video-details-poster-image" readonly data-setting="poster" value="{{ data.model.poster }}" />
1343                      <button type="button" class="button-link remove-setting"><?php _e( 'Remove poster image' ); ?></button>
1344                  </span>
1345                  <# } #>
1346  
1347                  <fieldset class="setting-group">
1348                      <legend class="name"><?php _e( 'Preload' ); ?></legend>
1349                      <span class="setting preload">
1350                          <span class="button-group button-large" data-setting="preload">
1351                              <button class="button" value="auto"><?php _ex( 'Auto', 'auto preload' ); ?></button>
1352                              <button class="button" value="metadata"><?php _e( 'Metadata' ); ?></button>
1353                              <button class="button active" value="none"><?php _e( 'None' ); ?></button>
1354                          </span>
1355                      </span>
1356                  </fieldset>
1357  
1358                  <span class="setting-group">
1359                      <span class="setting checkbox-setting autoplay">
1360                          <input type="checkbox" id="video-details-autoplay" data-setting="autoplay" />
1361                          <label for="video-details-autoplay" class="checkbox-label"><?php _e( 'Autoplay' ); ?></label>
1362                      </span>
1363  
1364                      <span class="setting checkbox-setting">
1365                          <input type="checkbox" id="video-details-loop" data-setting="loop" />
1366                          <label for="video-details-loop" class="checkbox-label"><?php _e( 'Loop' ); ?></label>
1367                      </span>
1368                  </span>
1369  
1370                  <span class="setting" data-setting="content">
1371                      <#
1372                      var content = '';
1373                      if ( ! _.isEmpty( data.model.content ) ) {
1374                          var tracks = jQuery( data.model.content ).filter( 'track' );
1375                          _.each( tracks.toArray(), function( track, index ) {
1376                              content += track.outerHTML; #>
1377                          <label for="video-details-track-{{ index }}" class="name"><?php _e( 'Tracks (subtitles, captions, descriptions, chapters, or metadata)' ); ?></label>
1378                          <input class="content-track" type="text" id="video-details-track-{{ index }}" aria-describedby="video-details-track-desc-{{ index }}" value="{{ track.outerHTML }}" />
1379                          <span class="description" id="video-details-track-desc-{{ index }}">
1380                          <?php
1381                              printf(
1382                                  /* translators: 1: "srclang" HTML attribute, 2: "label" HTML attribute, 3: "kind" HTML attribute. */
1383                                  __( 'The %1$s, %2$s, and %3$s values can be edited to set the video track language and kind.' ),
1384                                  'srclang',
1385                                  'label',
1386                                  'kind'
1387                              );
1388                          ?>
1389                          </span>
1390                          <button type="button" class="button-link remove-setting remove-track"><?php _ex( 'Remove video track', 'media' ); ?></button><br/>
1391                          <# } ); #>
1392                      <# } else { #>
1393                      <span class="name"><?php _e( 'Tracks (subtitles, captions, descriptions, chapters, or metadata)' ); ?></span><br />
1394                      <em><?php _e( 'There are no associated subtitles.' ); ?></em>
1395                      <# } #>
1396                      <textarea class="hidden content-setting">{{ content }}</textarea>
1397                  </span>
1398              </div>
1399          </div>
1400      </script>
1401  
1402      <?php // Template for a Gallery within the editor. ?>
1403      <script type="text/html" id="tmpl-editor-gallery">
1404          <# if ( data.attachments.length ) { #>
1405              <div class="gallery gallery-columns-{{ data.columns }}">
1406                  <# _.each( data.attachments, function( attachment, index ) { #>
1407                      <dl class="gallery-item">
1408                          <dt class="gallery-icon">
1409                              <# if ( attachment.thumbnail ) { #>
1410                                  <img src="{{ attachment.thumbnail.url }}" width="{{ attachment.thumbnail.width }}" height="{{ attachment.thumbnail.height }}" alt="{{ attachment.alt }}" />
1411                              <# } else { #>
1412                                  <img src="{{ attachment.url }}" alt="{{ attachment.alt }}" />
1413                              <# } #>
1414                          </dt>
1415                          <# if ( attachment.caption ) { #>
1416                              <dd class="wp-caption-text gallery-caption">
1417                                  {{{ data.verifyHTML( attachment.caption ) }}}
1418                              </dd>
1419                          <# } #>
1420                      </dl>
1421                      <# if ( index % data.columns === data.columns - 1 ) { #>
1422                          <br style="clear: both;">
1423                      <# } #>
1424                  <# } ); #>
1425              </div>
1426          <# } else { #>
1427              <div class="wpview-error">
1428                  <div class="dashicons dashicons-format-gallery"></div><p><?php _e( 'No items found.' ); ?></p>
1429              </div>
1430          <# } #>
1431      </script>
1432  
1433      <?php // Template for the Crop area layout, used for example in the Customizer. ?>
1434      <script type="text/html" id="tmpl-crop-content">
1435          <img class="crop-image" src="{{ data.url }}" alt="<?php esc_attr_e( 'Image crop area preview. Requires mouse interaction.' ); ?>">
1436          <div class="upload-errors"></div>
1437      </script>
1438  
1439      <?php // Template for the Site Icon preview, used for example in the Customizer. ?>
1440      <script type="text/html" id="tmpl-site-icon-preview">
1441          <h2><?php _e( 'Preview' ); ?></h2>
1442          <strong aria-hidden="true"><?php _e( 'As a browser icon' ); ?></strong>
1443          <div class="favicon-preview">
1444              <img src="<?php echo esc_url( admin_url( 'images/' . ( is_rtl() ? 'browser-rtl.png' : 'browser.png' ) ) ); ?>" class="browser-preview" width="182" height="" alt="" />
1445  
1446              <div class="favicon">
1447                  <img id="preview-favicon" src="{{ data.url }}" alt="<?php esc_attr_e( 'Preview as a browser icon' ); ?>"/>
1448              </div>
1449              <span class="browser-title" aria-hidden="true"><# print( '<?php bloginfo( 'name' ); ?>' ) #></span>
1450          </div>
1451  
1452          <strong aria-hidden="true"><?php _e( 'As an app icon' ); ?></strong>
1453          <div class="app-icon-preview">
1454              <img id="preview-app-icon" src="{{ data.url }}" alt="<?php esc_attr_e( 'Preview as an app icon' ); ?>"/>
1455          </div>
1456      </script>
1457  
1458      <?php
1459  
1460      /**
1461       * Fires when the custom Backbone media templates are printed.
1462       *
1463       * @since 3.5.0
1464       */
1465      do_action( 'print_media_templates' );
1466  }


Generated: Mon Apr 6 01:00:03 2020 Cross-referenced by PHPXref 0.7.1