[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-admin/ -> themes.php (source)

   1  <?php
   2  /**
   3   * Themes administration panel.
   4   *
   5   * @package WordPress
   6   * @subpackage Administration
   7   */
   8  
   9  /** WordPress Administration Bootstrap */
  10  require_once  __DIR__ . '/admin.php';
  11  
  12  if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) ) {
  13      wp_die(
  14          '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
  15          '<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>',
  16          403
  17      );
  18  }
  19  
  20  if ( current_user_can( 'switch_themes' ) && isset( $_GET['action'] ) ) {
  21      if ( 'activate' === $_GET['action'] ) {
  22          check_admin_referer( 'switch-theme_' . $_GET['stylesheet'] );
  23          $theme = wp_get_theme( $_GET['stylesheet'] );
  24  
  25          if ( ! $theme->exists() || ! $theme->is_allowed() ) {
  26              wp_die(
  27                  '<h1>' . __( 'Something went wrong.' ) . '</h1>' .
  28                  '<p>' . __( 'The requested theme does not exist.' ) . '</p>',
  29                  403
  30              );
  31          }
  32  
  33          switch_theme( $theme->get_stylesheet() );
  34          wp_redirect( admin_url( 'themes.php?activated=true' ) );
  35          exit;
  36      } elseif ( 'resume' === $_GET['action'] ) {
  37          check_admin_referer( 'resume-theme_' . $_GET['stylesheet'] );
  38          $theme = wp_get_theme( $_GET['stylesheet'] );
  39  
  40          if ( ! current_user_can( 'resume_theme', $_GET['stylesheet'] ) ) {
  41              wp_die(
  42                  '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
  43                  '<p>' . __( 'Sorry, you are not allowed to resume this theme.' ) . '</p>',
  44                  403
  45              );
  46          }
  47  
  48          $result = resume_theme( $theme->get_stylesheet(), self_admin_url( 'themes.php?error=resuming' ) );
  49  
  50          if ( is_wp_error( $result ) ) {
  51              wp_die( $result );
  52          }
  53  
  54          wp_redirect( admin_url( 'themes.php?resumed=true' ) );
  55          exit;
  56      } elseif ( 'delete' === $_GET['action'] ) {
  57          check_admin_referer( 'delete-theme_' . $_GET['stylesheet'] );
  58          $theme = wp_get_theme( $_GET['stylesheet'] );
  59  
  60          if ( ! current_user_can( 'delete_themes' ) ) {
  61              wp_die(
  62                  '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
  63                  '<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>',
  64                  403
  65              );
  66          }
  67  
  68          if ( ! $theme->exists() ) {
  69              wp_die(
  70                  '<h1>' . __( 'Something went wrong.' ) . '</h1>' .
  71                  '<p>' . __( 'The requested theme does not exist.' ) . '</p>',
  72                  403
  73              );
  74          }
  75  
  76          $active = wp_get_theme();
  77          if ( $active->get( 'Template' ) == $_GET['stylesheet'] ) {
  78              wp_redirect( admin_url( 'themes.php?delete-active-child=true' ) );
  79          } else {
  80              delete_theme( $_GET['stylesheet'] );
  81              wp_redirect( admin_url( 'themes.php?deleted=true' ) );
  82          }
  83          exit;
  84      } elseif ( 'enable-auto-update' === $_GET['action'] ) {
  85          if ( ! ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) ) {
  86              wp_die( __( 'Sorry, you are not allowed to enable themes automatic updates.' ) );
  87          }
  88  
  89          check_admin_referer( 'updates' );
  90  
  91          $all_items    = wp_get_themes();
  92          $auto_updates = (array) get_site_option( 'auto_update_themes', array() );
  93  
  94          $auto_updates[] = $_GET['stylesheet'];
  95          $auto_updates   = array_unique( $auto_updates );
  96          // Remove themes that have been deleted since the site option was last updated.
  97          $auto_updates = array_intersect( $auto_updates, array_keys( $all_items ) );
  98  
  99          update_site_option( 'auto_update_themes', $auto_updates );
 100  
 101          wp_redirect( admin_url( 'themes.php?enabled-auto-update=true' ) );
 102  
 103          exit;
 104      } elseif ( 'disable-auto-update' === $_GET['action'] ) {
 105          if ( ! ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) ) {
 106              wp_die( __( 'Sorry, you are not allowed to disable themes automatic updates.' ) );
 107          }
 108  
 109          check_admin_referer( 'updates' );
 110  
 111          $all_items    = wp_get_themes();
 112          $auto_updates = (array) get_site_option( 'auto_update_themes', array() );
 113  
 114          $auto_updates = array_diff( $auto_updates, array( $_GET['stylesheet'] ) );
 115          // Remove themes that have been deleted since the site option was last updated.
 116          $auto_updates = array_intersect( $auto_updates, array_keys( $all_items ) );
 117  
 118          update_site_option( 'auto_update_themes', $auto_updates );
 119  
 120          wp_redirect( admin_url( 'themes.php?disabled-auto-update=true' ) );
 121  
 122          exit;
 123      }
 124  }
 125  
 126  $title       = __( 'Manage Themes' );
 127  $parent_file = 'themes.php';
 128  
 129  // Help tab: Overview.
 130  if ( current_user_can( 'switch_themes' ) ) {
 131      $help_overview = '<p>' . __( 'This screen is used for managing your installed themes. Aside from the default theme(s) included with your WordPress installation, themes are designed and developed by third parties.' ) . '</p>' .
 132          '<p>' . __( 'From this screen you can:' ) . '</p>' .
 133          '<ul><li>' . __( 'Hover or tap to see Activate and Live Preview buttons' ) . '</li>' .
 134          '<li>' . __( 'Click on the theme to see the theme name, version, author, description, tags, and the Delete link' ) . '</li>' .
 135          '<li>' . __( 'Click Customize for the current theme or Live Preview for any other theme to see a live preview' ) . '</li></ul>' .
 136          '<p>' . __( 'The current theme is displayed highlighted as the first theme.' ) . '</p>' .
 137          '<p>' . __( 'The search for installed themes will search for terms in their name, description, author, or tag.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>';
 138  
 139      get_current_screen()->add_help_tab(
 140          array(
 141              'id'      => 'overview',
 142              'title'   => __( 'Overview' ),
 143              'content' => $help_overview,
 144          )
 145      );
 146  } // End if 'switch_themes'.
 147  
 148  // Help tab: Adding Themes.
 149  if ( current_user_can( 'install_themes' ) ) {
 150      if ( is_multisite() ) {
 151          $help_install = '<p>' . __( 'Installing themes on Multisite can only be done from the Network Admin section.' ) . '</p>';
 152      } else {
 153          $help_install = '<p>' . sprintf(
 154              /* translators: %s: https://wordpress.org/themes/ */
 155              __( 'If you would like to see more themes to choose from, click on the &#8220;Add New&#8221; button and you will be able to browse or search for additional themes from the <a href="%s">WordPress Theme Directory</a>. Themes in the WordPress Theme Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they&#8217;re free!' ),
 156              __( 'https://wordpress.org/themes/' )
 157          ) . '</p>';
 158      }
 159  
 160      get_current_screen()->add_help_tab(
 161          array(
 162              'id'      => 'adding-themes',
 163              'title'   => __( 'Adding Themes' ),
 164              'content' => $help_install,
 165          )
 166      );
 167  } // End if 'install_themes'.
 168  
 169  // Help tab: Previewing and Customizing.
 170  if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
 171      $help_customize =
 172          '<p>' . __( 'Tap or hover on any theme then click the Live Preview button to see a live preview of that theme and change theme options in a separate, full-screen view. You can also find a Live Preview button at the bottom of the theme details screen. Any installed theme can be previewed and customized in this way.' ) . '</p>' .
 173          '<p>' . __( 'The theme being previewed is fully interactive &mdash; navigate to different pages to see how the theme handles posts, archives, and other page templates. The settings may differ depending on what theme features the theme being previewed supports. To accept the new settings and activate the theme all in one step, click the Publish &amp; Activate button above the menu.' ) . '</p>' .
 174          '<p>' . __( 'When previewing on smaller monitors, you can use the collapse icon at the bottom of the left-hand pane. This will hide the pane, giving you more room to preview your site in the new theme. To bring the pane back, click on the collapse icon again.' ) . '</p>';
 175  
 176      get_current_screen()->add_help_tab(
 177          array(
 178              'id'      => 'customize-preview-themes',
 179              'title'   => __( 'Previewing and Customizing' ),
 180              'content' => $help_customize,
 181          )
 182      );
 183  } // End if 'edit_theme_options' && 'customize'.
 184  
 185  $help_sidebar_autoupdates = '';
 186  
 187  // Help tab: Auto-updates.
 188  if ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) {
 189      $help_tab_autoupdates =
 190          '<p>' . __( 'Auto-updates can be enabled or disabled for each individual theme. Themes with auto-updates enabled will display the estimated date of the next auto-update. Auto-updates depends on the WP-Cron task scheduling system.' ) . '</p>' .
 191          '<p>' . __( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '</p>';
 192  
 193      get_current_screen()->add_help_tab(
 194          array(
 195              'id'      => 'plugins-themes-auto-updates',
 196              'title'   => __( 'Auto-updates' ),
 197              'content' => $help_tab_autoupdates,
 198          )
 199      );
 200  
 201      $help_sidebar_autoupdates = '<p>' . __( '<a href="https://wordpress.org/support/article/plugins-themes-auto-updates/">Learn more: Auto-updates documentation</a>' ) . '</p>';
 202  } // End if 'update_themes' && 'wp_is_auto_update_enabled_for_type'.
 203  
 204  get_current_screen()->set_help_sidebar(
 205      '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
 206      '<p>' . __( '<a href="https://wordpress.org/support/article/using-themes/">Documentation on Using Themes</a>' ) . '</p>' .
 207      $help_sidebar_autoupdates .
 208      '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
 209  );
 210  
 211  if ( current_user_can( 'switch_themes' ) ) {
 212      $themes = wp_prepare_themes_for_js();
 213  } else {
 214      $themes = wp_prepare_themes_for_js( array( wp_get_theme() ) );
 215  }
 216  wp_reset_vars( array( 'theme', 'search' ) );
 217  
 218  wp_localize_script(
 219      'theme',
 220      '_wpThemeSettings',
 221      array(
 222          'themes'   => $themes,
 223          'settings' => array(
 224              'canInstall'    => ( ! is_multisite() && current_user_can( 'install_themes' ) ),
 225              'installURI'    => ( ! is_multisite() && current_user_can( 'install_themes' ) ) ? admin_url( 'theme-install.php' ) : null,
 226              'confirmDelete' => __( "Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete." ),
 227              'adminUrl'      => parse_url( admin_url(), PHP_URL_PATH ),
 228          ),
 229          'l10n'     => array(
 230              'addNew'            => __( 'Add New Theme' ),
 231              'search'            => __( 'Search Installed Themes' ),
 232              'searchPlaceholder' => __( 'Search installed themes...' ), // Placeholder (no ellipsis).
 233              /* translators: %d: Number of themes. */
 234              'themesFound'       => __( 'Number of Themes found: %d' ),
 235              'noThemesFound'     => __( 'No themes found. Try a different search.' ),
 236          ),
 237      )
 238  );
 239  
 240  add_thickbox();
 241  wp_enqueue_script( 'theme' );
 242  wp_enqueue_script( 'updates' );
 243  
 244  require_once  ABSPATH . 'wp-admin/admin-header.php';
 245  ?>
 246  
 247  <div class="wrap">
 248      <h1 class="wp-heading-inline"><?php esc_html_e( 'Themes' ); ?>
 249          <span class="title-count theme-count"><?php echo ! empty( $_GET['search'] ) ? __( '&hellip;' ) : count( $themes ); ?></span>
 250      </h1>
 251  
 252      <?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?>
 253          <a href="<?php echo admin_url( 'theme-install.php' ); ?>" class="hide-if-no-js page-title-action"><?php echo esc_html_x( 'Add New', 'theme' ); ?></a>
 254      <?php endif; ?>
 255  
 256      <form class="search-form"></form>
 257  
 258      <hr class="wp-header-end">
 259  <?php
 260  if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) {
 261      ?>
 262      <div id="message1" class="updated notice is-dismissible"><p><?php _e( 'The active theme is broken. Reverting to the default theme.' ); ?></p></div>
 263      <?php
 264  } elseif ( isset( $_GET['activated'] ) ) {
 265      if ( isset( $_GET['previewed'] ) ) {
 266          ?>
 267          <div id="message2" class="updated notice is-dismissible"><p><?php _e( 'Settings saved and theme activated.' ); ?> <a href="<?php echo home_url( '/' ); ?>"><?php _e( 'Visit site' ); ?></a></p></div>
 268          <?php
 269      } else {
 270          ?>
 271          <div id="message2" class="updated notice is-dismissible"><p><?php _e( 'New theme activated.' ); ?> <a href="<?php echo home_url( '/' ); ?>"><?php _e( 'Visit site' ); ?></a></p></div>
 272          <?php
 273      }
 274  } elseif ( isset( $_GET['deleted'] ) ) {
 275      ?>
 276      <div id="message3" class="updated notice is-dismissible"><p><?php _e( 'Theme deleted.' ); ?></p></div>
 277      <?php
 278  } elseif ( isset( $_GET['delete-active-child'] ) ) {
 279      ?>
 280      <div id="message4" class="error"><p><?php _e( 'You cannot delete a theme while it has an active child theme.' ); ?></p></div>
 281      <?php
 282  } elseif ( isset( $_GET['resumed'] ) ) {
 283      ?>
 284      <div id="message5" class="updated notice is-dismissible"><p><?php _e( 'Theme resumed.' ); ?></p></div>
 285      <?php
 286  } elseif ( isset( $_GET['error'] ) && 'resuming' === $_GET['error'] ) {
 287      ?>
 288      <div id="message6" class="error"><p><?php _e( 'Theme could not be resumed because it triggered a <strong>fatal error</strong>.' ); ?></p></div>
 289      <?php
 290  } elseif ( isset( $_GET['enabled-auto-update'] ) ) {
 291      ?>
 292      <div id="message7" class="updated notice is-dismissible"><p><?php _e( 'Theme will be auto-updated.' ); ?></p></div>
 293      <?php
 294  } elseif ( isset( $_GET['disabled-auto-update'] ) ) {
 295      ?>
 296      <div id="message8" class="updated notice is-dismissible"><p><?php _e( 'Theme will no longer be auto-updated.' ); ?></p></div>
 297      <?php
 298  }
 299  
 300  $ct = wp_get_theme();
 301  
 302  if ( $ct->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) {
 303      echo '<div class="error"><p>' . __( 'Error:' ) . ' ' . $ct->errors()->get_error_message() . '</p></div>';
 304  }
 305  
 306  /*
 307  // Certain error codes are less fatal than others. We can still display theme information in most cases.
 308  if ( ! $ct->errors() || ( 1 === count( $ct->errors()->get_error_codes() )
 309      && in_array( $ct->errors()->get_error_code(), array( 'theme_no_parent', 'theme_parent_invalid', 'theme_no_index' ) ) ) ) : ?>
 310  */
 311  
 312      // Pretend you didn't see this.
 313      $current_theme_actions = array();
 314  if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) {
 315      foreach ( (array) $submenu['themes.php'] as $item ) {
 316          $class = '';
 317          if ( 'themes.php' === $item[2] || 'theme-editor.php' === $item[2] || 0 === strpos( $item[2], 'customize.php' ) ) {
 318              continue;
 319          }
 320          // 0 = name, 1 = capability, 2 = file.
 321          if ( ( strcmp( $self, $item[2] ) == 0 && empty( $parent_file ) ) || ( $parent_file && ( $item[2] == $parent_file ) ) ) {
 322              $class = ' current';
 323          }
 324          if ( ! empty( $submenu[ $item[2] ] ) ) {
 325              $submenu[ $item[2] ] = array_values( $submenu[ $item[2] ] ); // Re-index.
 326              $menu_hook           = get_plugin_page_hook( $submenu[ $item[2] ][0][2], $item[2] );
 327              if ( file_exists( WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}" ) || ! empty( $menu_hook ) ) {
 328                  $current_theme_actions[] = "<a class='button$class' href='admin.php?page={$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
 329              } else {
 330                  $current_theme_actions[] = "<a class='button$class' href='{$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
 331              }
 332          } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) {
 333              $menu_file = $item[2];
 334  
 335              if ( current_user_can( 'customize' ) ) {
 336                  if ( 'custom-header' === $menu_file ) {
 337                      $current_theme_actions[] = "<a class='button hide-if-no-customize$class' href='customize.php?autofocus[control]=header_image'>{$item[0]}</a>";
 338                  } elseif ( 'custom-background' === $menu_file ) {
 339                      $current_theme_actions[] = "<a class='button hide-if-no-customize$class' href='customize.php?autofocus[control]=background_image'>{$item[0]}</a>";
 340                  }
 341              }
 342  
 343              $pos = strpos( $menu_file, '?' );
 344              if ( false !== $pos ) {
 345                  $menu_file = substr( $menu_file, 0, $pos );
 346              }
 347  
 348              if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) {
 349                  $current_theme_actions[] = "<a class='button$class' href='{$item[2]}'>{$item[0]}</a>";
 350              } else {
 351                  $current_theme_actions[] = "<a class='button$class' href='themes.php?page={$item[2]}'>{$item[0]}</a>";
 352              }
 353          }
 354      }
 355  }
 356  
 357  ?>
 358  
 359  <?php
 360  $class_name = 'theme-browser';
 361  if ( ! empty( $_GET['search'] ) ) {
 362      $class_name .= ' search-loading';
 363  }
 364  ?>
 365  <div class="<?php echo esc_attr( $class_name ); ?>">
 366      <div class="themes wp-clearfix">
 367  
 368  <?php
 369  /*
 370   * This PHP is synchronized with the tmpl-theme template below!
 371   */
 372  
 373  foreach ( $themes as $theme ) :
 374      $aria_action = esc_attr( $theme['id'] . '-action' );
 375      $aria_name   = esc_attr( $theme['id'] . '-name' );
 376  
 377      $active_class = '';
 378      if ( $theme['active'] ) {
 379          $active_class = ' active';
 380      }
 381      ?>
 382  <div class="theme<?php echo $active_class; ?>" tabindex="0" aria-describedby="<?php echo $aria_action . ' ' . $aria_name; ?>">
 383      <?php if ( ! empty( $theme['screenshot'][0] ) ) { ?>
 384          <div class="theme-screenshot">
 385              <img src="<?php echo $theme['screenshot'][0]; ?>" alt="" />
 386          </div>
 387      <?php } else { ?>
 388          <div class="theme-screenshot blank"></div>
 389      <?php } ?>
 390  
 391      <?php if ( $theme['hasUpdate'] ) : ?>
 392          <?php if ( $theme['updateResponse']['compatibleWP'] && $theme['updateResponse']['compatiblePHP'] ) : ?>
 393              <div class="update-message notice inline notice-warning notice-alt"><p>
 394                  <?php if ( $theme['hasPackage'] ) : ?>
 395                      <?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?>
 396                  <?php else : ?>
 397                      <?php _e( 'New version available.' ); ?>
 398                  <?php endif; ?>
 399              </p></div>
 400          <?php else : ?>
 401              <div class="update-message notice inline notice-error notice-alt"><p>
 402                  <?php
 403                  if ( ! $theme['updateResponse']['compatibleWP'] && ! $theme['updateResponse']['compatiblePHP'] ) {
 404                      printf(
 405                          /* translators: %s: Theme name. */
 406                          __( 'There is a new version of %s available, but it doesn&#8217;t work with your versions of WordPress and PHP.' ),
 407                          $theme['name']
 408                      );
 409                      if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
 410                          printf(
 411                              /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
 412                              ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
 413                              self_admin_url( 'update-core.php' ),
 414                              esc_url( wp_get_update_php_url() )
 415                          );
 416                          wp_update_php_annotation( '</p><p><em>', '</em>' );
 417                      } elseif ( current_user_can( 'update_core' ) ) {
 418                          printf(
 419                              /* translators: %s: URL to WordPress Updates screen. */
 420                              ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 421                              self_admin_url( 'update-core.php' )
 422                          );
 423                      } elseif ( current_user_can( 'update_php' ) ) {
 424                          printf(
 425                              /* translators: %s: URL to Update PHP page. */
 426                              ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 427                              esc_url( wp_get_update_php_url() )
 428                          );
 429                          wp_update_php_annotation( '</p><p><em>', '</em>' );
 430                      }
 431                  } elseif ( ! $theme['updateResponse']['compatibleWP'] ) {
 432                      printf(
 433                          /* translators: %s: Theme name. */
 434                          __( 'There is a new version of %s available, but it doesn&#8217;t work with your version of WordPress.' ),
 435                          $theme['name']
 436                      );
 437                      if ( current_user_can( 'update_core' ) ) {
 438                          printf(
 439                              /* translators: %s: URL to WordPress Updates screen. */
 440                              ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 441                              self_admin_url( 'update-core.php' )
 442                          );
 443                      }
 444                  } elseif ( ! $theme['updateResponse']['compatiblePHP'] ) {
 445                      printf(
 446                          /* translators: %s: Theme name. */
 447                          __( 'There is a new version of %s available, but it doesn&#8217;t work with your version of PHP.' ),
 448                          $theme['name']
 449                      );
 450                      if ( current_user_can( 'update_php' ) ) {
 451                          printf(
 452                              /* translators: %s: URL to Update PHP page. */
 453                              ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 454                              esc_url( wp_get_update_php_url() )
 455                          );
 456                          wp_update_php_annotation( '</p><p><em>', '</em>' );
 457                      }
 458                  }
 459                  ?>
 460              </p></div>
 461          <?php endif; ?>
 462      <?php endif; ?>
 463  
 464      <?php
 465      if ( ! $theme['compatibleWP'] || ! $theme['compatiblePHP'] ) {
 466          echo '<div class="notice inline notice-error notice-alt"><p>';
 467          if ( ! $theme['compatibleWP'] && ! $theme['compatiblePHP'] ) {
 468              _e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
 469              if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
 470                  printf(
 471                      /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
 472                      ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
 473                      self_admin_url( 'update-core.php' ),
 474                      esc_url( wp_get_update_php_url() )
 475                  );
 476                  wp_update_php_annotation( '</p><p><em>', '</em>' );
 477              } elseif ( current_user_can( 'update_core' ) ) {
 478                  printf(
 479                      /* translators: %s: URL to WordPress Updates screen. */
 480                      ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 481                      self_admin_url( 'update-core.php' )
 482                  );
 483              } elseif ( current_user_can( 'update_php' ) ) {
 484                  printf(
 485                      /* translators: %s: URL to Update PHP page. */
 486                      ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 487                      esc_url( wp_get_update_php_url() )
 488                  );
 489                  wp_update_php_annotation( '</p><p><em>', '</em>' );
 490              }
 491          } elseif ( ! $theme['compatibleWP'] ) {
 492              _e( 'This theme doesn&#8217;t work with your version of WordPress.' );
 493              if ( current_user_can( 'update_core' ) ) {
 494                  printf(
 495                      /* translators: %s: URL to WordPress Updates screen. */
 496                      ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 497                      self_admin_url( 'update-core.php' )
 498                  );
 499              }
 500          } elseif ( ! $theme['compatiblePHP'] ) {
 501              _e( 'This theme doesn&#8217;t work with your version of PHP.' );
 502              if ( current_user_can( 'update_php' ) ) {
 503                  printf(
 504                      /* translators: %s: URL to Update PHP page. */
 505                      ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 506                      esc_url( wp_get_update_php_url() )
 507                  );
 508                  wp_update_php_annotation( '</p><p><em>', '</em>' );
 509              }
 510          }
 511          echo '</p></div>';
 512      }
 513      ?>
 514  
 515      <span class="more-details" id="<?php echo $aria_action; ?>"><?php _e( 'Theme Details' ); ?></span>
 516      <div class="theme-author">
 517          <?php
 518          /* translators: %s: Theme author name. */
 519          printf( __( 'By %s' ), $theme['author'] );
 520          ?>
 521      </div>
 522  
 523      <div class="theme-id-container">
 524          <?php if ( $theme['active'] ) { ?>
 525              <h2 class="theme-name" id="<?php echo $aria_name; ?>">
 526                  <span><?php _ex( 'Active:', 'theme' ); ?></span> <?php echo $theme['name']; ?>
 527              </h2>
 528          <?php } else { ?>
 529              <h2 class="theme-name" id="<?php echo $aria_name; ?>"><?php echo $theme['name']; ?></h2>
 530          <?php } ?>
 531  
 532          <div class="theme-actions">
 533          <?php if ( $theme['active'] ) { ?>
 534              <?php if ( $theme['actions']['customize'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
 535                  <a class="button button-primary customize load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Customize' ); ?></a>
 536              <?php } ?>
 537          <?php } elseif ( $theme['compatibleWP'] && $theme['compatiblePHP'] ) { ?>
 538              <?php
 539              /* translators: %s: Theme name. */
 540              $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
 541              ?>
 542              <a class="button activate" href="<?php echo $theme['actions']['activate']; ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
 543              <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
 544                  <a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a>
 545              <?php } ?>
 546          <?php } else { ?>
 547              <?php
 548              /* translators: %s: Theme name. */
 549              $aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' );
 550              ?>
 551              <a class="button disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
 552              <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
 553                  <a class="button button-primary hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a>
 554              <?php } ?>
 555          <?php } ?>
 556  
 557          </div>
 558      </div>
 559  </div>
 560  <?php endforeach; ?>
 561      </div>
 562  </div>
 563  <div class="theme-overlay" tabindex="0" role="dialog" aria-label="<?php esc_attr_e( 'Theme Details' ); ?>"></div>
 564  
 565  <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
 566  
 567  <?php
 568  // List broken themes, if any.
 569  $broken_themes = wp_get_themes( array( 'errors' => true ) );
 570  if ( ! is_multisite() && $broken_themes ) {
 571      ?>
 572  
 573  <div class="broken-themes">
 574  <h3><?php _e( 'Broken Themes' ); ?></h3>
 575  <p><?php _e( 'The following themes are installed but incomplete.' ); ?></p>
 576  
 577      <?php
 578      $can_resume  = current_user_can( 'resume_themes' );
 579      $can_delete  = current_user_can( 'delete_themes' );
 580      $can_install = current_user_can( 'install_themes' );
 581      ?>
 582  <table>
 583      <tr>
 584          <th><?php _ex( 'Name', 'theme name' ); ?></th>
 585          <th><?php _e( 'Description' ); ?></th>
 586          <?php if ( $can_resume ) { ?>
 587              <td></td>
 588          <?php } ?>
 589          <?php if ( $can_delete ) { ?>
 590              <td></td>
 591          <?php } ?>
 592          <?php if ( $can_install ) { ?>
 593              <td></td>
 594          <?php } ?>
 595      </tr>
 596      <?php foreach ( $broken_themes as $broken_theme ) : ?>
 597          <tr>
 598              <td><?php echo $broken_theme->get( 'Name' ) ? $broken_theme->display( 'Name' ) : esc_html( $broken_theme->get_stylesheet() ); ?></td>
 599              <td><?php echo $broken_theme->errors()->get_error_message(); ?></td>
 600              <?php
 601              if ( $can_resume ) {
 602                  if ( 'theme_paused' === $broken_theme->errors()->get_error_code() ) {
 603                      $stylesheet = $broken_theme->get_stylesheet();
 604                      $resume_url = add_query_arg(
 605                          array(
 606                              'action'     => 'resume',
 607                              'stylesheet' => urlencode( $stylesheet ),
 608                          ),
 609                          admin_url( 'themes.php' )
 610                      );
 611                      $resume_url = wp_nonce_url( $resume_url, 'resume-theme_' . $stylesheet );
 612                      ?>
 613                      <td><a href="<?php echo esc_url( $resume_url ); ?>" class="button resume-theme"><?php _e( 'Resume' ); ?></a></td>
 614                      <?php
 615                  } else {
 616                      ?>
 617                      <td></td>
 618                      <?php
 619                  }
 620              }
 621  
 622              if ( $can_delete ) {
 623                  $stylesheet = $broken_theme->get_stylesheet();
 624                  $delete_url = add_query_arg(
 625                      array(
 626                          'action'     => 'delete',
 627                          'stylesheet' => urlencode( $stylesheet ),
 628                      ),
 629                      admin_url( 'themes.php' )
 630                  );
 631                  $delete_url = wp_nonce_url( $delete_url, 'delete-theme_' . $stylesheet );
 632                  ?>
 633                  <td><a href="<?php echo esc_url( $delete_url ); ?>" class="button delete-theme"><?php _e( 'Delete' ); ?></a></td>
 634                  <?php
 635              }
 636  
 637              if ( $can_install && 'theme_no_parent' === $broken_theme->errors()->get_error_code() ) {
 638                  $parent_theme_name = $broken_theme->get( 'Template' );
 639                  $parent_theme      = themes_api( 'theme_information', array( 'slug' => urlencode( $parent_theme_name ) ) );
 640  
 641                  if ( ! is_wp_error( $parent_theme ) ) {
 642                      $install_url = add_query_arg(
 643                          array(
 644                              'action' => 'install-theme',
 645                              'theme'  => urlencode( $parent_theme_name ),
 646                          ),
 647                          admin_url( 'update.php' )
 648                      );
 649                      $install_url = wp_nonce_url( $install_url, 'install-theme_' . $parent_theme_name );
 650                      ?>
 651                      <td><a href="<?php echo esc_url( $install_url ); ?>" class="button install-theme"><?php _e( 'Install Parent Theme' ); ?></a></td>
 652                      <?php
 653                  }
 654              }
 655              ?>
 656          </tr>
 657      <?php endforeach; ?>
 658  </table>
 659  </div>
 660  
 661      <?php
 662  }
 663  ?>
 664  </div><!-- .wrap -->
 665  
 666  <?php
 667  
 668  /**
 669   * Returns the JavaScript template used to display the auto-update setting for a theme.
 670   *
 671   * @since 5.5.0
 672   *
 673   * @return string The template for displaying the auto-update setting link.
 674   */
 675  function wp_theme_auto_update_setting_template() {
 676      $template = '
 677          <div class="theme-autoupdate">
 678              <# if ( data.autoupdate.supported ) { #>
 679                  <# if ( data.autoupdate.forced === false ) { #>
 680                      ' . __( 'Auto-updates disabled' ) . '
 681                  <# } else if ( data.autoupdate.forced ) { #>
 682                      ' . __( 'Auto-updates enabled' ) . '
 683                  <# } else if ( data.autoupdate.enabled ) { #>
 684                      <button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="disable">
 685                          <span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Disable auto-updates' ) . '</span>
 686                      </button>
 687                  <# } else { #>
 688                      <button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="enable">
 689                          <span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Enable auto-updates' ) . '</span>
 690                      </button>
 691                  <# } #>
 692              <# } #>
 693              <# if ( data.hasUpdate ) { #>
 694                  <# if ( data.autoupdate.supported && data.autoupdate.enabled ) { #>
 695                      <span class="auto-update-time">
 696                  <# } else { #>
 697                      <span class="auto-update-time hidden">
 698                  <# } #>
 699                  <br />' . wp_get_auto_update_message() . '</span>
 700              <# } #>
 701              <div class="notice notice-error notice-alt inline hidden"><p></p></div>
 702          </div>
 703      ';
 704  
 705      /**
 706       * Filters the JavaScript template used to display the auto-update setting for a theme (in the overlay).
 707       *
 708       * See {@see wp_prepare_themes_for_js()} for the properties of the `data` object.
 709       *
 710       * @since 5.5.0
 711       *
 712       * @param string $template The template for displaying the auto-update setting link.
 713       */
 714      return apply_filters( 'theme_auto_update_setting_template', $template );
 715  }
 716  
 717  /*
 718   * The tmpl-theme template is synchronized with PHP above!
 719   */
 720  ?>
 721  <script id="tmpl-theme" type="text/template">
 722      <# if ( data.screenshot[0] ) { #>
 723          <div class="theme-screenshot">
 724              <img src="{{ data.screenshot[0] }}" alt="" />
 725          </div>
 726      <# } else { #>
 727          <div class="theme-screenshot blank"></div>
 728      <# } #>
 729  
 730      <# if ( data.hasUpdate ) { #>
 731          <# if ( data.updateResponse.compatibleWP && data.updateResponse.compatiblePHP ) { #>
 732              <div class="update-message notice inline notice-warning notice-alt"><p>
 733                  <# if ( data.hasPackage ) { #>
 734                      <?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?>
 735                  <# } else { #>
 736                      <?php _e( 'New version available.' ); ?>
 737                  <# } #>
 738              </p></div>
 739          <# } else { #>
 740              <div class="update-message notice inline notice-error notice-alt"><p>
 741                  <# if ( ! data.updateResponse.compatibleWP && ! data.updateResponse.compatiblePHP ) { #>
 742                      <?php
 743                      printf(
 744                          /* translators: %s: Theme name. */
 745                          __( 'There is a new version of %s available, but it doesn&#8217;t work with your versions of WordPress and PHP.' ),
 746                          '{{{ data.name }}}'
 747                      );
 748                      if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
 749                          printf(
 750                              /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
 751                              ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
 752                              self_admin_url( 'update-core.php' ),
 753                              esc_url( wp_get_update_php_url() )
 754                          );
 755                          wp_update_php_annotation( '</p><p><em>', '</em>' );
 756                      } elseif ( current_user_can( 'update_core' ) ) {
 757                          printf(
 758                              /* translators: %s: URL to WordPress Updates screen. */
 759                              ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 760                              self_admin_url( 'update-core.php' )
 761                          );
 762                      } elseif ( current_user_can( 'update_php' ) ) {
 763                          printf(
 764                              /* translators: %s: URL to Update PHP page. */
 765                              ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 766                              esc_url( wp_get_update_php_url() )
 767                          );
 768                          wp_update_php_annotation( '</p><p><em>', '</em>' );
 769                      }
 770                      ?>
 771                  <# } else if ( ! data.updateResponse.compatibleWP ) { #>
 772                      <?php
 773                      printf(
 774                          /* translators: %s: Theme name. */
 775                          __( 'There is a new version of %s available, but it doesn&#8217;t work with your version of WordPress.' ),
 776                          '{{{ data.name }}}'
 777                      );
 778                      if ( current_user_can( 'update_core' ) ) {
 779                          printf(
 780                              /* translators: %s: URL to WordPress Updates screen. */
 781                              ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 782                              self_admin_url( 'update-core.php' )
 783                          );
 784                      }
 785                      ?>
 786                  <# } else if ( ! data.updateResponse.compatiblePHP ) { #>
 787                      <?php
 788                      printf(
 789                          /* translators: %s: Theme name. */
 790                          __( 'There is a new version of %s available, but it doesn&#8217;t work with your version of PHP.' ),
 791                          '{{{ data.name }}}'
 792                      );
 793                      if ( current_user_can( 'update_php' ) ) {
 794                          printf(
 795                              /* translators: %s: URL to Update PHP page. */
 796                              ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 797                              esc_url( wp_get_update_php_url() )
 798                          );
 799                          wp_update_php_annotation( '</p><p><em>', '</em>' );
 800                      }
 801                      ?>
 802                  <# } #>
 803              </p></div>
 804          <# } #>
 805      <# } #>
 806  
 807      <# if ( ! data.compatibleWP || ! data.compatiblePHP ) { #>
 808          <div class="notice notice-error notice-alt"><p>
 809              <# if ( ! data.compatibleWP && ! data.compatiblePHP ) { #>
 810                  <?php
 811                  _e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
 812                  if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
 813                      printf(
 814                          /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
 815                          ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
 816                          self_admin_url( 'update-core.php' ),
 817                          esc_url( wp_get_update_php_url() )
 818                      );
 819                      wp_update_php_annotation( '</p><p><em>', '</em>' );
 820                  } elseif ( current_user_can( 'update_core' ) ) {
 821                      printf(
 822                          /* translators: %s: URL to WordPress Updates screen. */
 823                          ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 824                          self_admin_url( 'update-core.php' )
 825                      );
 826                  } elseif ( current_user_can( 'update_php' ) ) {
 827                      printf(
 828                          /* translators: %s: URL to Update PHP page. */
 829                          ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 830                          esc_url( wp_get_update_php_url() )
 831                      );
 832                      wp_update_php_annotation( '</p><p><em>', '</em>' );
 833                  }
 834                  ?>
 835              <# } else if ( ! data.compatibleWP ) { #>
 836                  <?php
 837                  _e( 'This theme doesn&#8217;t work with your version of WordPress.' );
 838                  if ( current_user_can( 'update_core' ) ) {
 839                      printf(
 840                          /* translators: %s: URL to WordPress Updates screen. */
 841                          ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 842                          self_admin_url( 'update-core.php' )
 843                      );
 844                  }
 845                  ?>
 846              <# } else if ( ! data.compatiblePHP ) { #>
 847                  <?php
 848                  _e( 'This theme doesn&#8217;t work with your version of PHP.' );
 849                  if ( current_user_can( 'update_php' ) ) {
 850                      printf(
 851                          /* translators: %s: URL to Update PHP page. */
 852                          ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 853                          esc_url( wp_get_update_php_url() )
 854                      );
 855                      wp_update_php_annotation( '</p><p><em>', '</em>' );
 856                  }
 857                  ?>
 858              <# } #>
 859          </p></div>
 860      <# } #>
 861  
 862      <span class="more-details" id="{{ data.id }}-action"><?php _e( 'Theme Details' ); ?></span>
 863      <div class="theme-author">
 864          <?php
 865          /* translators: %s: Theme author name. */
 866          printf( __( 'By %s' ), '{{{ data.author }}}' );
 867          ?>
 868      </div>
 869  
 870      <div class="theme-id-container">
 871          <# if ( data.active ) { #>
 872              <h2 class="theme-name" id="{{ data.id }}-name">
 873                  <span><?php _ex( 'Active:', 'theme' ); ?></span> {{{ data.name }}}
 874              </h2>
 875          <# } else { #>
 876              <h2 class="theme-name" id="{{ data.id }}-name">{{{ data.name }}}</h2>
 877          <# } #>
 878  
 879          <div class="theme-actions">
 880              <# if ( data.active ) { #>
 881                  <# if ( data.actions.customize ) { #>
 882                      <a class="button button-primary customize load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Customize' ); ?></a>
 883                  <# } #>
 884              <# } else { #>
 885                  <# if ( data.compatibleWP && data.compatiblePHP ) { #>
 886                      <?php
 887                      /* translators: %s: Theme name. */
 888                      $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
 889                      ?>
 890                      <a class="button activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a>
 891                      <a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a>
 892                  <# } else { #>
 893                      <?php
 894                      /* translators: %s: Theme name. */
 895                      $aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' );
 896                      ?>
 897                      <a class="button disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
 898                      <a class="button button-primary hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a>
 899                  <# } #>
 900              <# } #>
 901          </div>
 902      </div>
 903  </script>
 904  
 905  <script id="tmpl-theme-single" type="text/template">
 906      <div class="theme-backdrop"></div>
 907      <div class="theme-wrap wp-clearfix" role="document">
 908          <div class="theme-header">
 909              <button class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show previous theme' ); ?></span></button>
 910              <button class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show next theme' ); ?></span></button>
 911              <button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close details dialog' ); ?></span></button>
 912          </div>
 913          <div class="theme-about wp-clearfix">
 914              <div class="theme-screenshots">
 915              <# if ( data.screenshot[0] ) { #>
 916                  <div class="screenshot"><img src="{{ data.screenshot[0] }}" alt="" /></div>
 917              <# } else { #>
 918                  <div class="screenshot blank"></div>
 919              <# } #>
 920              </div>
 921  
 922              <div class="theme-info">
 923                  <# if ( data.active ) { #>
 924                      <span class="current-label"><?php _e( 'Current Theme' ); ?></span>
 925                  <# } #>
 926                  <h2 class="theme-name">{{{ data.name }}}<span class="theme-version">
 927                      <?php
 928                      /* translators: %s: Theme version. */
 929                      printf( __( 'Version: %s' ), '{{ data.version }}' );
 930                      ?>
 931                  </span></h2>
 932                  <p class="theme-author">
 933                      <?php
 934                      /* translators: %s: Theme author link. */
 935                      printf( __( 'By %s' ), '{{{ data.authorAndUri }}}' );
 936                      ?>
 937                  </p>
 938  
 939                  <# if ( ! data.compatibleWP || ! data.compatiblePHP ) { #>
 940                      <div class="notice notice-error notice-alt notice-large"><p>
 941                          <# if ( ! data.compatibleWP && ! data.compatiblePHP ) { #>
 942                              <?php
 943                              _e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
 944                              if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
 945                                  printf(
 946                                      /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
 947                                      ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
 948                                      self_admin_url( 'update-core.php' ),
 949                                      esc_url( wp_get_update_php_url() )
 950                                  );
 951                                  wp_update_php_annotation( '</p><p><em>', '</em>' );
 952                              } elseif ( current_user_can( 'update_core' ) ) {
 953                                  printf(
 954                                      /* translators: %s: URL to WordPress Updates screen. */
 955                                      ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 956                                      self_admin_url( 'update-core.php' )
 957                                  );
 958                              } elseif ( current_user_can( 'update_php' ) ) {
 959                                  printf(
 960                                      /* translators: %s: URL to Update PHP page. */
 961                                      ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 962                                      esc_url( wp_get_update_php_url() )
 963                                  );
 964                                  wp_update_php_annotation( '</p><p><em>', '</em>' );
 965                              }
 966                              ?>
 967                          <# } else if ( ! data.compatibleWP ) { #>
 968                              <?php
 969                              _e( 'This theme doesn&#8217;t work with your version of WordPress.' );
 970                              if ( current_user_can( 'update_core' ) ) {
 971                                  printf(
 972                                      /* translators: %s: URL to WordPress Updates screen. */
 973                                      ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 974                                      self_admin_url( 'update-core.php' )
 975                                  );
 976                              }
 977                              ?>
 978                          <# } else if ( ! data.compatiblePHP ) { #>
 979                              <?php
 980                              _e( 'This theme doesn&#8217;t work with your version of PHP.' );
 981                              if ( current_user_can( 'update_php' ) ) {
 982                                  printf(
 983                                      /* translators: %s: URL to Update PHP page. */
 984                                      ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 985                                      esc_url( wp_get_update_php_url() )
 986                                  );
 987                                  wp_update_php_annotation( '</p><p><em>', '</em>' );
 988                              }
 989                              ?>
 990                          <# } #>
 991                      </p></div>
 992                  <# } #>
 993  
 994                  <# if ( data.hasUpdate ) { #>
 995                      <# if ( data.updateResponse.compatibleWP && data.updateResponse.compatiblePHP ) { #>
 996                          <div class="notice notice-warning notice-alt notice-large">
 997                              <h3 class="notice-title"><?php _e( 'Update Available' ); ?></h3>
 998                              {{{ data.update }}}
 999                          </div>
1000                      <# } else { #>
1001                          <div class="notice notice-error notice-alt notice-large">
1002                              <h3 class="notice-title"><?php _e( 'Update Incompatible' ); ?></h3>
1003                              <p>
1004                                  <# if ( ! data.updateResponse.compatibleWP && ! data.updateResponse.compatiblePHP ) { #>
1005                                      <?php
1006                                      printf(
1007                                          /* translators: %s: Theme name. */
1008                                          __( 'There is a new version of %s available, but it doesn&#8217;t work with your versions of WordPress and PHP.' ),
1009                                          '{{{ data.name }}}'
1010                                      );
1011                                      if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
1012                                          printf(
1013                                              /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
1014                                              ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
1015                                              self_admin_url( 'update-core.php' ),
1016                                              esc_url( wp_get_update_php_url() )
1017                                          );
1018                                          wp_update_php_annotation( '</p><p><em>', '</em>' );
1019                                      } elseif ( current_user_can( 'update_core' ) ) {
1020                                          printf(
1021                                              /* translators: %s: URL to WordPress Updates screen. */
1022                                              ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
1023                                              self_admin_url( 'update-core.php' )
1024                                          );
1025                                      } elseif ( current_user_can( 'update_php' ) ) {
1026                                          printf(
1027                                              /* translators: %s: URL to Update PHP page. */
1028                                              ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
1029                                              esc_url( wp_get_update_php_url() )
1030                                          );
1031                                          wp_update_php_annotation( '</p><p><em>', '</em>' );
1032                                      }
1033                                      ?>
1034                                  <# } else if ( ! data.updateResponse.compatibleWP ) { #>
1035                                      <?php
1036                                      printf(
1037                                          /* translators: %s: Theme name. */
1038                                          __( 'There is a new version of %s available, but it doesn&#8217;t work with your version of WordPress.' ),
1039                                          '{{{ data.name }}}'
1040                                      );
1041                                      if ( current_user_can( 'update_core' ) ) {
1042                                          printf(
1043                                              /* translators: %s: URL to WordPress Updates screen. */
1044                                              ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
1045                                              self_admin_url( 'update-core.php' )
1046                                          );
1047                                      }
1048                                      ?>
1049                                  <# } else if ( ! data.updateResponse.compatiblePHP ) { #>
1050                                      <?php
1051                                      printf(
1052                                          /* translators: %s: Theme name. */
1053                                          __( 'There is a new version of %s available, but it doesn&#8217;t work with your version of PHP.' ),
1054                                          '{{{ data.name }}}'
1055                                      );
1056                                      if ( current_user_can( 'update_php' ) ) {
1057                                          printf(
1058                                              /* translators: %s: URL to Update PHP page. */
1059                                              ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
1060                                              esc_url( wp_get_update_php_url() )
1061                                          );
1062                                          wp_update_php_annotation( '</p><p><em>', '</em>' );
1063                                      }
1064                                      ?>
1065                                  <# } #>
1066                              </p>
1067                          </div>
1068                      <# } #>
1069                  <# } #>
1070  
1071                  <# if ( data.actions.autoupdate ) { #>
1072                      <?php echo wp_theme_auto_update_setting_template(); ?>
1073                  <# } #>
1074  
1075                  <p class="theme-description">{{{ data.description }}}</p>
1076  
1077                  <# if ( data.parent ) { #>
1078                      <p class="parent-theme">
1079                          <?php
1080                          /* translators: %s: Theme name. */
1081                          printf( __( 'This is a child theme of %s.' ), '<strong>{{{ data.parent }}}</strong>' );
1082                          ?>
1083                      </p>
1084                  <# } #>
1085  
1086                  <# if ( data.tags ) { #>
1087                      <p class="theme-tags"><span><?php _e( 'Tags:' ); ?></span> {{{ data.tags }}}</p>
1088                  <# } #>
1089              </div>
1090          </div>
1091  
1092          <div class="theme-actions">
1093              <div class="active-theme">
1094                  <a href="{{{ data.actions.customize }}}" class="button button-primary customize load-customize hide-if-no-customize"><?php _e( 'Customize' ); ?></a>
1095                  <?php echo implode( ' ', $current_theme_actions ); ?>
1096              </div>
1097              <div class="inactive-theme">
1098                  <# if ( data.compatibleWP && data.compatiblePHP ) { #>
1099                      <?php
1100                      /* translators: %s: Theme name. */
1101                      $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
1102                      ?>
1103                      <# if ( data.actions.activate ) { #>
1104                          <a href="{{{ data.actions.activate }}}" class="button activate" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a>
1105                      <# } #>
1106                      <a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a>
1107                  <# } else { #>
1108                      <?php
1109                      /* translators: %s: Theme name. */
1110                      $aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' );
1111                      ?>
1112                      <# if ( data.actions.activate ) { #>
1113                          <a class="button disabled" aria-label="<?php echo $aria_label; ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
1114                      <# } #>
1115                      <a class="button button-primary hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a>
1116                  <# } #>
1117              </div>
1118  
1119              <# if ( ! data.active && data.actions['delete'] ) { #>
1120                  <a href="{{{ data.actions['delete'] }}}" class="button delete-theme"><?php _e( 'Delete' ); ?></a>
1121              <# } #>
1122          </div>
1123      </div>
1124  </script>
1125  
1126  <?php
1127  wp_print_request_filesystem_credentials_modal();
1128  wp_print_admin_notice_templates();
1129  wp_print_update_row_templates();
1130  
1131  wp_localize_script(
1132      'updates',
1133      '_wpUpdatesItemCounts',
1134      array(
1135          'totals' => wp_get_update_data(),
1136      )
1137  );
1138  
1139  require_once  ABSPATH . 'wp-admin/admin-footer.php';


Generated : Thu Oct 22 08:20:02 2020 Cross-referenced by PHPXref