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


Generated : Sat Dec 21 08:20:01 2024 Cross-referenced by PHPXref