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


Generated : Tue Apr 23 08:20:01 2024 Cross-referenced by PHPXref