[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-admin/ -> theme-install.php (source)

   1  <?php
   2  /**
   3   * Install theme administration panel.
   4   *
   5   * @package WordPress
   6   * @subpackage Administration
   7   */
   8  
   9  /** WordPress Administration Bootstrap */
  10  require_once  __DIR__ . '/admin.php';
  11  require  ABSPATH . 'wp-admin/includes/theme-install.php';
  12  
  13  $tab = ! empty( $_REQUEST['tab'] ) ? sanitize_text_field( $_REQUEST['tab'] ) : '';
  14  
  15  if ( ! current_user_can( 'install_themes' ) ) {
  16      wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
  17  }
  18  
  19  if ( is_multisite() && ! is_network_admin() ) {
  20      wp_redirect( network_admin_url( 'theme-install.php' ) );
  21      exit;
  22  }
  23  
  24  // Used in the HTML title tag.
  25  $title       = __( 'Add Themes' );
  26  $parent_file = 'themes.php';
  27  
  28  if ( ! is_network_admin() ) {
  29      $submenu_file = 'theme-install.php';
  30  }
  31  
  32  $installed_themes = search_theme_directories();
  33  
  34  if ( false === $installed_themes ) {
  35      $installed_themes = array();
  36  }
  37  
  38  foreach ( $installed_themes as $theme_slug => $theme_data ) {
  39      // Ignore child themes.
  40      if ( str_contains( $theme_slug, '/' ) ) {
  41          unset( $installed_themes[ $theme_slug ] );
  42      }
  43  }
  44  
  45  wp_localize_script(
  46      'theme',
  47      '_wpThemeSettings',
  48      array(
  49          'themes'          => false,
  50          'settings'        => array(
  51              'isInstall'  => true,
  52              'canInstall' => current_user_can( 'install_themes' ),
  53              'installURI' => current_user_can( 'install_themes' ) ? self_admin_url( 'theme-install.php' ) : null,
  54              'adminUrl'   => parse_url( self_admin_url(), PHP_URL_PATH ),
  55          ),
  56          'l10n'            => array(
  57              'addNew'              => __( 'Add Theme' ),
  58              'search'              => __( 'Search Themes' ),
  59              'upload'              => __( 'Upload Theme' ),
  60              'back'                => __( 'Back' ),
  61              'error'               => sprintf(
  62                  /* translators: %s: Support forums URL. */
  63                  __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
  64                  __( 'https://wordpress.org/support/forums/' )
  65              ),
  66              'tryAgain'            => __( 'Try Again' ),
  67              /* translators: %d: Number of themes. */
  68              'themesFound'         => __( 'Number of Themes found: %d' ),
  69              'noThemesFound'       => __( 'No themes found. Try a different search.' ),
  70              /* translators: %s: Theme name. */
  71              'themeViewed'         => __( 'Theme details: %s' ),
  72              'collapseSidebar'     => __( 'Collapse Sidebar' ),
  73              'expandSidebar'       => __( 'Expand Sidebar' ),
  74              /* translators: Hidden accessibility text. */
  75              'selectFeatureFilter' => __( 'Select one or more Theme features to filter by' ),
  76          ),
  77          'installedThemes' => array_keys( $installed_themes ),
  78          'activeTheme'     => get_stylesheet(),
  79      )
  80  );
  81  
  82  wp_enqueue_script( 'theme' );
  83  wp_enqueue_script( 'updates' );
  84  
  85  if ( $tab ) {
  86      /**
  87       * Fires before each of the tabs are rendered on the Install Themes page.
  88       *
  89       * The dynamic portion of the hook name, `$tab`, refers to the current
  90       * theme installation tab.
  91       *
  92       * Possible hook names include:
  93       *
  94       *  - `install_themes_pre_block-themes`
  95       *  - `install_themes_pre_dashboard`
  96       *  - `install_themes_pre_featured`
  97       *  - `install_themes_pre_new`
  98       *  - `install_themes_pre_search`
  99       *  - `install_themes_pre_updated`
 100       *  - `install_themes_pre_upload`
 101       *
 102       * @since 2.8.0
 103       * @since 6.1.0 Added the `install_themes_pre_block-themes` hook name.
 104       */
 105      do_action( "install_themes_pre_{$tab}" );
 106  }
 107  
 108  $help_overview =
 109      '<p>' . sprintf(
 110          /* translators: %s: Theme Directory URL. */
 111          __( 'You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s">WordPress Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.' ),
 112          __( 'https://wordpress.org/themes/' )
 113      ) . '</p>' .
 114      '<p>' . __( 'You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>' .
 115      '<p>' . __( 'Alternately, you can browse the themes that are Popular or Latest. When you find a theme you like, you can preview it or install it.' ) . '</p>' .
 116      '<p>' . sprintf(
 117          /* translators: %s: /wp-content/themes */
 118          __( 'You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme&#8217;s folder via FTP into your %s directory.' ),
 119          '<code>/wp-content/themes</code>'
 120      ) . '</p>';
 121  
 122  get_current_screen()->add_help_tab(
 123      array(
 124          'id'      => 'overview',
 125          'title'   => __( 'Overview' ),
 126          'content' => $help_overview,
 127      )
 128  );
 129  
 130  $help_installing =
 131      '<p>' . __( 'Once you have generated a list of themes, you can preview and install any of them. Click on the thumbnail of the theme you are interested in previewing. It will open up in a full-screen Preview page to give you a better idea of how that theme will look.' ) . '</p>' .
 132      '<p>' . __( 'To install the theme so you can preview it with your site&#8217;s content and customize its theme options, click the "Install" button at the top of the left-hand pane. The theme files will be downloaded to your website automatically. When this is complete, the theme is now available for activation, which you can do by clicking the "Activate" link, or by navigating to your Manage Themes screen and clicking the "Live Preview" link under any installed theme&#8217;s thumbnail image.' ) . '</p>';
 133  
 134  get_current_screen()->add_help_tab(
 135      array(
 136          'id'      => 'installing',
 137          'title'   => __( 'Previewing and Installing' ),
 138          'content' => $help_installing,
 139      )
 140  );
 141  
 142  // Help tab: Block themes.
 143  $help_block_themes =
 144      '<p>' . __( 'A block theme is a theme that uses blocks for all parts of a site including navigation menus, header, content, and site footer. These themes are built for the features that allow you to edit and customize all parts of your site.' ) . '</p>' .
 145      '<p>' . __( 'With a block theme, you can place and edit blocks without affecting your content by customizing or creating new templates.' ) . '</p>';
 146  
 147  get_current_screen()->add_help_tab(
 148      array(
 149          'id'      => 'block_themes',
 150          'title'   => __( 'Block themes' ),
 151          'content' => $help_block_themes,
 152      )
 153  );
 154  
 155  get_current_screen()->set_help_sidebar(
 156      '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
 157      '<p>' . __( '<a href="https://wordpress.org/documentation/article/appearance-themes-screen/#install-themes">Documentation on Adding New Themes</a>' ) . '</p>' .
 158      '<p>' . __( '<a href="https://wordpress.org/documentation/article/block-themes/">Documentation on Block Themes</a>' ) . '</p>' .
 159      '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
 160  );
 161  
 162  require_once  ABSPATH . 'wp-admin/admin-header.php';
 163  
 164  ?>
 165  <div class="wrap">
 166      <h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1>
 167  
 168      <?php
 169  
 170      /**
 171       * Filters the tabs shown on the Add Themes screen.
 172       *
 173       * This filter is for backward compatibility only, for the suppression of the upload tab.
 174       *
 175       * @since 2.8.0
 176       *
 177       * @param string[] $tabs Associative array of the tabs shown on the Add Themes screen. Default is 'upload'.
 178       */
 179      $tabs = apply_filters( 'install_themes_tabs', array( 'upload' => __( 'Upload Theme' ) ) );
 180      if ( ! empty( $tabs['upload'] ) && current_user_can( 'upload_themes' ) ) {
 181          echo ' <button type="button" class="upload-view-toggle page-title-action hide-if-no-js" aria-expanded="false">' . __( 'Upload Theme' ) . '</button>';
 182      }
 183      ?>
 184  
 185      <hr class="wp-header-end">
 186  
 187      <?php
 188      wp_admin_notice(
 189          __( 'The Theme Installer screen requires JavaScript.' ),
 190          array(
 191              'additional_classes' => array( 'error', 'hide-if-js' ),
 192          )
 193      );
 194      ?>
 195  
 196      <div class="upload-theme">
 197      <?php install_themes_upload(); ?>
 198      </div>
 199  
 200      <h2 class="screen-reader-text hide-if-no-js">
 201          <?php
 202          /* translators: Hidden accessibility text. */
 203          _e( 'Filter themes list' );
 204          ?>
 205      </h2>
 206  
 207      <div class="wp-filter hide-if-no-js">
 208          <div class="filter-count">
 209              <span class="count theme-count"></span>
 210          </div>
 211  
 212          <ul class="filter-links">
 213              <li><a href="#" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></a></li>
 214              <li><a href="#" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></a></li>
 215              <li><a href="#" data-sort="block-themes"><?php _ex( 'Block Themes', 'themes' ); ?></a></li>
 216              <li><a href="#" data-sort="favorites"><?php _ex( 'Favorites', 'themes' ); ?></a></li>
 217          </ul>
 218  
 219          <button type="button" class="button drawer-toggle" aria-expanded="false"><?php _e( 'Feature Filter' ); ?></button>
 220  
 221          <form class="search-form"><p class="search-box"></p></form>
 222  
 223          <div class="favorites-form">
 224              <?php
 225              $action = 'save_wporg_username_' . get_current_user_id();
 226              if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), $action ) ) {
 227                  $user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
 228                  update_user_meta( get_current_user_id(), 'wporg_favorites', $user );
 229              } else {
 230                  $user = get_user_option( 'wporg_favorites' );
 231              }
 232              ?>
 233              <p class="install-help"><?php _e( 'If you have marked themes as favorites on WordPress.org, you can browse them here.' ); ?></p>
 234  
 235              <p class="favorites-username">
 236                  <label for="wporg-username-input"><?php _e( 'Your WordPress.org username:' ); ?></label>
 237                  <input type="hidden" id="wporg-username-nonce" name="_wpnonce" value="<?php echo esc_attr( wp_create_nonce( $action ) ); ?>" />
 238                  <input type="search" id="wporg-username-input" value="<?php echo esc_attr( $user ); ?>" />
 239                  <input type="button" class="button favorites-form-submit" value="<?php esc_attr_e( 'Get Favorites' ); ?>" />
 240              </p>
 241          </div>
 242  
 243          <div class="filter-drawer">
 244              <div class="buttons">
 245                  <button type="button" class="apply-filters button"><?php _e( 'Apply Filters' ); ?><span></span></button>
 246                  <button type="button" class="clear-filters button" aria-label="<?php esc_attr_e( 'Clear current filters' ); ?>"><?php _e( 'Clear' ); ?></button>
 247              </div>
 248          <?php
 249          // Use the core list, rather than the .org API, due to inconsistencies
 250          // and to ensure tags are translated.
 251          $feature_list = get_theme_feature_list( false );
 252  
 253          foreach ( $feature_list as $feature_group => $features ) {
 254              echo '<fieldset class="filter-group">';
 255              echo '<legend>' . esc_html( $feature_group ) . '</legend>';
 256              echo '<div class="filter-group-feature">';
 257              foreach ( $features as $feature => $feature_name ) {
 258                  $feature = esc_attr( $feature );
 259                  echo '<input type="checkbox" id="filter-id-' . $feature . '" value="' . $feature . '" /> ';
 260                  echo '<label for="filter-id-' . $feature . '">' . esc_html( $feature_name ) . '</label>';
 261              }
 262              echo '</div>';
 263              echo '</fieldset>';
 264          }
 265          ?>
 266              <div class="buttons">
 267                  <button type="button" class="apply-filters button"><?php _e( 'Apply Filters' ); ?><span></span></button>
 268                  <button type="button" class="clear-filters button" aria-label="<?php esc_attr_e( 'Clear current filters' ); ?>"><?php _e( 'Clear' ); ?></button>
 269              </div>
 270              <div class="filtered-by">
 271                  <span><?php _e( 'Filtering by:' ); ?></span>
 272                  <div class="tags"></div>
 273                  <button type="button" class="button-link edit-filters"><?php _e( 'Edit Filters' ); ?></button>
 274              </div>
 275          </div>
 276      </div>
 277      <h2 class="screen-reader-text hide-if-no-js">
 278          <?php
 279          /* translators: Hidden accessibility text. */
 280          _e( 'Themes list' );
 281          ?>
 282      </h2>
 283      <div class="theme-browser content-filterable"></div>
 284      <div class="theme-install-overlay wp-full-overlay expanded" tabindex="0" role="dialog" aria-label="<?php esc_attr_e( 'Browse Themes' ); ?>"></div>
 285  
 286      <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
 287      <span class="spinner"></span>
 288  
 289  <?php
 290  if ( $tab ) {
 291      /**
 292       * Fires at the top of each of the tabs on the Install Themes page.
 293       *
 294       * The dynamic portion of the hook name, `$tab`, refers to the current
 295       * theme installation tab.
 296       *
 297       * Possible hook names include:
 298       *
 299       *  - `install_themes_block-themes`
 300       *  - `install_themes_dashboard`
 301       *  - `install_themes_featured`
 302       *  - `install_themes_new`
 303       *  - `install_themes_search`
 304       *  - `install_themes_updated`
 305       *  - `install_themes_upload`
 306       *
 307       * @since 2.8.0
 308       * @since 6.1.0 Added the `install_themes_block-themes` hook name.
 309       *
 310       * @param int $paged Number of the current page of results being viewed.
 311       */
 312      do_action( "install_themes_{$tab}", $paged );
 313  }
 314  ?>
 315  </div>
 316  
 317  <script id="tmpl-theme" type="text/template">
 318      <# if ( data.screenshot_url ) { #>
 319          <div class="theme-screenshot">
 320              <img src="{{ data.screenshot_url }}?ver={{ data.version }}" alt="" />
 321          </div>
 322      <# } else { #>
 323          <div class="theme-screenshot blank"></div>
 324      <# } #>
 325  
 326      <# if ( data.installed ) { #>
 327          <?php
 328          wp_admin_notice(
 329              _x( 'Installed', 'theme' ),
 330              array(
 331                  'type'               => 'success',
 332                  'additional_classes' => array( 'notice-alt' ),
 333              )
 334          );
 335          ?>
 336      <# } #>
 337  
 338      <# if ( ! data.compatible_wp || ! data.compatible_php ) { #>
 339          <div class="notice notice-error notice-alt"><p>
 340              <# if ( ! data.compatible_wp && ! data.compatible_php ) { #>
 341                  <?php
 342                  _e( 'This theme does not work with your versions of WordPress and PHP.' );
 343                  if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
 344                      printf(
 345                          /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
 346                          ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
 347                          self_admin_url( 'update-core.php' ),
 348                          esc_url( wp_get_update_php_url() )
 349                      );
 350                      wp_update_php_annotation( '</p><p><em>', '</em>' );
 351                  } elseif ( current_user_can( 'update_core' ) ) {
 352                      printf(
 353                          /* translators: %s: URL to WordPress Updates screen. */
 354                          ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 355                          self_admin_url( 'update-core.php' )
 356                      );
 357                  } elseif ( current_user_can( 'update_php' ) ) {
 358                      printf(
 359                          /* translators: %s: URL to Update PHP page. */
 360                          ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 361                          esc_url( wp_get_update_php_url() )
 362                      );
 363                      wp_update_php_annotation( '</p><p><em>', '</em>' );
 364                  }
 365                  ?>
 366              <# } else if ( ! data.compatible_wp ) { #>
 367                  <?php
 368                  _e( 'This theme does not work with your version of WordPress.' );
 369                  if ( current_user_can( 'update_core' ) ) {
 370                      printf(
 371                          /* translators: %s: URL to WordPress Updates screen. */
 372                          ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 373                          self_admin_url( 'update-core.php' )
 374                      );
 375                  }
 376                  ?>
 377              <# } else if ( ! data.compatible_php ) { #>
 378                  <?php
 379                  _e( 'This theme does not work with your version of PHP.' );
 380                  if ( current_user_can( 'update_php' ) ) {
 381                      printf(
 382                          /* translators: %s: URL to Update PHP page. */
 383                          ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 384                          esc_url( wp_get_update_php_url() )
 385                      );
 386                      wp_update_php_annotation( '</p><p><em>', '</em>' );
 387                  }
 388                  ?>
 389              <# } #>
 390          </p></div>
 391      <# } #>
 392  
 393      <# if ( data.compatible_wp && data.compatible_php ) { #>
 394      <button type="button" class="more-details"><?php _ex( 'Details &amp; Preview', 'theme' ); ?></button>
 395      <# } else { #>
 396      <span class="more-details"><?php _ex( 'Details &amp; Preview', 'theme' ); ?></span>
 397      <# } #>
 398      <div class="theme-author">
 399          <?php
 400          /* translators: %s: Theme author name. */
 401          printf( __( 'By %s' ), '{{ data.author }}' );
 402          ?>
 403      </div>
 404  
 405      <div class="theme-id-container">
 406          <h3 class="theme-name">{{ data.name }}</h3>
 407  
 408          <div class="theme-actions">
 409              <# if ( data.installed ) { #>
 410                  <# if ( data.compatible_wp && data.compatible_php ) { #>
 411                      <?php
 412                      /* translators: %s: Theme name. */
 413                      $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
 414                      ?>
 415                      <# if ( data.activate_url ) { #>
 416                          <# if ( ! data.active ) { #>
 417                              <a class="button button-primary button-compact activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
 418                          <# } else { #>
 419                              <button type="button" class="button button-primary button-compact disabled" aria-disabled="true"><?php _ex( 'Activated', 'theme' ); ?></button>
 420                          <# } #>
 421                      <# } #>
 422                      <# if ( data.customize_url ) { #>
 423                          <# if ( ! data.active ) { #>
 424                              <# if ( ! data.block_theme ) { #>
 425                                  <a class="button button-compact load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a>
 426                              <# } #>
 427                          <# } else { #>
 428                              <a class="button button-compact load-customize" href="{{ data.customize_url }}"><?php _e( 'Customize' ); ?></a>
 429                          <# } #>
 430                      <# } else { #>
 431                          <button class="button button-compact preview install-theme-preview"><?php echo esc_html_x( 'Preview', 'verb' ); ?></button>
 432                      <# } #>
 433                  <# } else { #>
 434                      <?php
 435                      /* translators: %s: Theme name. */
 436                      $aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' );
 437                      ?>
 438                      <# if ( data.activate_url ) { #>
 439                          <button type="button" class="button button-primary button-compact disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>" aria-disabled="true"><?php _ex( 'Cannot Activate', 'theme' ); ?></button>
 440                      <# } #>
 441                      <# if ( data.customize_url ) { #>
 442                          <button type="button" class="button button-compact disabled" aria-disabled="true"><?php _e( 'Live Preview' ); ?></button>
 443                      <# } else { #>
 444                          <button type="button" class="button button-compact disabled" aria-disabled="true"><?php echo esc_html_x( 'Preview', 'verb' ); ?></button>
 445                      <# } #>
 446                  <# } #>
 447              <# } else { #>
 448                  <# if ( data.compatible_wp && data.compatible_php ) { #>
 449                      <?php
 450                      /* translators: %s: Theme name. */
 451                      $aria_label = sprintf( _x( 'Install %s', 'theme' ), '{{ data.name }}' );
 452                      ?>
 453                      <a class="button button-primary button-compact theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}" href="{{ data.install_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Install' ); ?></a>
 454                      <button class="button button-compact preview install-theme-preview"><?php echo esc_html_x( 'Preview', 'verb' ); ?></button>
 455                  <# } else { #>
 456                      <?php
 457                      /* translators: %s: Theme name. */
 458                      $aria_label = sprintf( _x( 'Cannot Install %s', 'theme' ), '{{ data.name }}' );
 459                      ?>
 460                      <button type="button" class="button button-primary button-compact disabled" data-name="{{ data.name }}" aria-label="<?php echo esc_attr( $aria_label ); ?>" aria-disabled="true"><?php _ex( 'Cannot Install', 'theme' ); ?></button>
 461                      <button type="button" class="button button-compact disabled" aria-disabled="true"><?php echo esc_html_x( 'Preview', 'verb' ); ?></button>
 462                  <# } #>
 463              <# } #>
 464          </div>
 465      </div>
 466  </script>
 467  
 468  <script id="tmpl-theme-preview" type="text/template">
 469      <div class="wp-full-overlay-sidebar">
 470          <div class="wp-full-overlay-header">
 471              <button class="close-full-overlay"><span class="screen-reader-text">
 472                  <?php
 473                  /* translators: Hidden accessibility text. */
 474                  _e( 'Close' );
 475                  ?>
 476              </span></button>
 477              <button class="previous-theme"><span class="screen-reader-text">
 478                  <?php
 479                  /* translators: Hidden accessibility text. */
 480                  _ex( 'Previous', 'theme' );
 481                  ?>
 482              </span></button>
 483              <button class="next-theme"><span class="screen-reader-text">
 484                  <?php
 485                  /* translators: Hidden accessibility text. */
 486                  _ex( 'Next', 'theme' );
 487                  ?>
 488              </span></button>
 489              <# if ( data.installed ) { #>
 490                  <# if ( data.compatible_wp && data.compatible_php ) { #>
 491                      <?php
 492                      /* translators: %s: Theme name. */
 493                      $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
 494                      ?>
 495                      <# if ( ! data.active ) { #>
 496                          <a class="button button-primary activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
 497                      <# } else { #>
 498                          <button type="button" class="button button-primary disabled" aria-disabled="true"><?php _ex( 'Activated', 'theme' ); ?></button>
 499                      <# } #>
 500                  <# } else { #>
 501                      <button type="button" class="button button-primary disabled" aria-disabled="true"><?php _ex( 'Cannot Activate', 'theme' ); ?></button>
 502                  <# } #>
 503              <# } else { #>
 504                  <# if ( data.compatible_wp && data.compatible_php ) { #>
 505                      <a href="{{ data.install_url }}" class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></a>
 506                  <# } else { #>
 507                      <button type="button" class="button button-primary disabled" aria-disabled="true"><?php _ex( 'Cannot Install', 'theme' ); ?></button>
 508                  <# } #>
 509              <# } #>
 510          </div>
 511          <div class="wp-full-overlay-sidebar-content">
 512              <div class="install-theme-info">
 513                  <h3 class="theme-name">{{ data.name }}</h3>
 514                      <span class="theme-by">
 515                          <?php
 516                          /* translators: %s: Theme author name. */
 517                          printf( __( 'By %s' ), '{{ data.author }}' );
 518                          ?>
 519                      </span>
 520  
 521                      <div class="theme-screenshot">
 522                          <img class="theme-screenshot" src="{{ data.screenshot_url }}?ver={{ data.version }}" alt="" />
 523                      </div>
 524  
 525                      <div class="theme-details">
 526                          <# if ( data.rating ) { #>
 527                              <div class="theme-rating">
 528                                  {{{ data.stars }}}
 529                                  <a class="num-ratings" href="{{ data.reviews_url }}">
 530                                      <?php
 531                                      /* translators: %s: Number of ratings. */
 532                                      printf( __( '(%s ratings)' ), '{{ data.num_ratings }}' );
 533                                      ?>
 534                                  </a>
 535                              </div>
 536                          <# } else { #>
 537                              <span class="no-rating"><?php _e( 'This theme has not been rated yet.' ); ?></span>
 538                          <# } #>
 539  
 540                          <div class="theme-version">
 541                              <?php
 542                              /* translators: %s: Theme version. */
 543                              printf( __( 'Version: %s' ), '{{ data.version }}' );
 544                              ?>
 545                          </div>
 546  
 547                          <# if ( ! data.compatible_wp || ! data.compatible_php ) { #>
 548                              <div class="notice notice-error notice-alt notice-large"><p>
 549                                  <# if ( ! data.compatible_wp && ! data.compatible_php ) { #>
 550                                      <?php
 551                                      _e( 'This theme does not work with your versions of WordPress and PHP.' );
 552                                      if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
 553                                          printf(
 554                                              /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
 555                                              ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
 556                                              self_admin_url( 'update-core.php' ),
 557                                              esc_url( wp_get_update_php_url() )
 558                                          );
 559                                          wp_update_php_annotation( '</p><p><em>', '</em>' );
 560                                      } elseif ( current_user_can( 'update_core' ) ) {
 561                                          printf(
 562                                              /* translators: %s: URL to WordPress Updates screen. */
 563                                              ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 564                                              self_admin_url( 'update-core.php' )
 565                                          );
 566                                      } elseif ( current_user_can( 'update_php' ) ) {
 567                                          printf(
 568                                              /* translators: %s: URL to Update PHP page. */
 569                                              ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 570                                              esc_url( wp_get_update_php_url() )
 571                                          );
 572                                          wp_update_php_annotation( '</p><p><em>', '</em>' );
 573                                      }
 574                                      ?>
 575                                  <# } else if ( ! data.compatible_wp ) { #>
 576                                      <?php
 577                                      _e( 'This theme does not work with your version of WordPress.' );
 578                                      if ( current_user_can( 'update_core' ) ) {
 579                                          printf(
 580                                              /* translators: %s: URL to WordPress Updates screen. */
 581                                              ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 582                                              self_admin_url( 'update-core.php' )
 583                                          );
 584                                      }
 585                                      ?>
 586                                  <# } else if ( ! data.compatible_php ) { #>
 587                                      <?php
 588                                      _e( 'This theme does not work with your version of PHP.' );
 589                                      if ( current_user_can( 'update_php' ) ) {
 590                                          printf(
 591                                              /* translators: %s: URL to Update PHP page. */
 592                                              ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 593                                              esc_url( wp_get_update_php_url() )
 594                                          );
 595                                          wp_update_php_annotation( '</p><p><em>', '</em>' );
 596                                      }
 597                                      ?>
 598                                  <# } #>
 599                              </p></div>
 600                          <# } #>
 601  
 602                          <div class="theme-description">{{{ data.description }}}</div>
 603                      </div>
 604                  </div>
 605              </div>
 606              <div class="wp-full-overlay-footer">
 607                  <button type="button" class="collapse-sidebar button" aria-expanded="true" aria-label="<?php esc_attr_e( 'Collapse Sidebar' ); ?>">
 608                      <span class="collapse-sidebar-arrow" aria-hidden="true"></span>
 609                      <span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span>
 610                  </button>
 611              </div>
 612          </div>
 613          <div class="wp-full-overlay-main">
 614          <iframe src="{{ data.preview_url }}" title="<?php echo esc_attr_x( 'Preview', 'noun' ); ?>"></iframe>
 615      </div>
 616  </script>
 617  
 618  <?php
 619  wp_print_request_filesystem_credentials_modal();
 620  wp_print_admin_notice_templates();
 621  
 622  require_once  ABSPATH . 'wp-admin/admin-footer.php';


Generated : Tue Oct 20 08:20:34 2026 Cross-referenced by PHPXref