[ Index ]

PHP Cross Reference of WordPress

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 Activate &amp; Publish 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  $current_theme = wp_get_theme();
 301  
 302  if ( $current_theme->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) {
 303      echo '<div class="error"><p>' . __( 'Error:' ) . ' ' . $current_theme->errors()->get_error_message() . '</p></div>';
 304  }
 305  
 306  $current_theme_actions = array();
 307  
 308  if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) {
 309      foreach ( (array) $submenu['themes.php'] as $item ) {
 310          $class = '';
 311          if ( 'themes.php' === $item[2] || 'theme-editor.php' === $item[2] || 0 === strpos( $item[2], 'customize.php' ) ) {
 312              continue;
 313          }
 314          // 0 = name, 1 = capability, 2 = file.
 315          if ( ( strcmp( $self, $item[2] ) == 0 && empty( $parent_file ) ) || ( $parent_file && ( $item[2] == $parent_file ) ) ) {
 316              $class = ' current';
 317          }
 318          if ( ! empty( $submenu[ $item[2] ] ) ) {
 319              $submenu[ $item[2] ] = array_values( $submenu[ $item[2] ] ); // Re-index.
 320              $menu_hook           = get_plugin_page_hook( $submenu[ $item[2] ][0][2], $item[2] );
 321              if ( file_exists( WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}" ) || ! empty( $menu_hook ) ) {
 322                  $current_theme_actions[] = "<a class='button$class' href='admin.php?page={$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
 323              } else {
 324                  $current_theme_actions[] = "<a class='button$class' href='{$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
 325              }
 326          } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) {
 327              $menu_file = $item[2];
 328  
 329              if ( current_user_can( 'customize' ) ) {
 330                  if ( 'custom-header' === $menu_file ) {
 331                      $current_theme_actions[] = "<a class='button hide-if-no-customize$class' href='customize.php?autofocus[control]=header_image'>{$item[0]}</a>";
 332                  } elseif ( 'custom-background' === $menu_file ) {
 333                      $current_theme_actions[] = "<a class='button hide-if-no-customize$class' href='customize.php?autofocus[control]=background_image'>{$item[0]}</a>";
 334                  }
 335              }
 336  
 337              $pos = strpos( $menu_file, '?' );
 338              if ( false !== $pos ) {
 339                  $menu_file = substr( $menu_file, 0, $pos );
 340              }
 341  
 342              if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) {
 343                  $current_theme_actions[] = "<a class='button$class' href='{$item[2]}'>{$item[0]}</a>";
 344              } else {
 345                  $current_theme_actions[] = "<a class='button$class' href='themes.php?page={$item[2]}'>{$item[0]}</a>";
 346              }
 347          }
 348      }
 349  }
 350  
 351  $class_name = 'theme-browser';
 352  if ( ! empty( $_GET['search'] ) ) {
 353      $class_name .= ' search-loading';
 354  }
 355  ?>
 356  <div class="<?php echo esc_attr( $class_name ); ?>">
 357      <div class="themes wp-clearfix">
 358  
 359  <?php
 360  /*
 361   * This PHP is synchronized with the tmpl-theme template below!
 362   */
 363  
 364  foreach ( $themes as $theme ) :
 365      $aria_action = esc_attr( $theme['id'] . '-action' );
 366      $aria_name   = esc_attr( $theme['id'] . '-name' );
 367  
 368      $active_class = '';
 369      if ( $theme['active'] ) {
 370          $active_class = ' active';
 371      }
 372      ?>
 373  <div class="theme<?php echo $active_class; ?>" tabindex="0" aria-describedby="<?php echo $aria_action . ' ' . $aria_name; ?>">
 374      <?php if ( ! empty( $theme['screenshot'][0] ) ) { ?>
 375          <div class="theme-screenshot">
 376              <img src="<?php echo $theme['screenshot'][0]; ?>" alt="" />
 377          </div>
 378      <?php } else { ?>
 379          <div class="theme-screenshot blank"></div>
 380      <?php } ?>
 381  
 382      <?php if ( $theme['hasUpdate'] ) : ?>
 383          <?php if ( $theme['updateResponse']['compatibleWP'] && $theme['updateResponse']['compatiblePHP'] ) : ?>
 384              <div class="update-message notice inline notice-warning notice-alt"><p>
 385                  <?php if ( $theme['hasPackage'] ) : ?>
 386                      <?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?>
 387                  <?php else : ?>
 388                      <?php _e( 'New version available.' ); ?>
 389                  <?php endif; ?>
 390              </p></div>
 391          <?php else : ?>
 392              <div class="update-message notice inline notice-error notice-alt"><p>
 393                  <?php
 394                  if ( ! $theme['updateResponse']['compatibleWP'] && ! $theme['updateResponse']['compatiblePHP'] ) {
 395                      printf(
 396                          /* translators: %s: Theme name. */
 397                          __( 'There is a new version of %s available, but it doesn&#8217;t work with your versions of WordPress and PHP.' ),
 398                          $theme['name']
 399                      );
 400                      if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
 401                          printf(
 402                              /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
 403                              ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
 404                              self_admin_url( 'update-core.php' ),
 405                              esc_url( wp_get_update_php_url() )
 406                          );
 407                          wp_update_php_annotation( '</p><p><em>', '</em>' );
 408                      } elseif ( current_user_can( 'update_core' ) ) {
 409                          printf(
 410                              /* translators: %s: URL to WordPress Updates screen. */
 411                              ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 412                              self_admin_url( 'update-core.php' )
 413                          );
 414                      } elseif ( current_user_can( 'update_php' ) ) {
 415                          printf(
 416                              /* translators: %s: URL to Update PHP page. */
 417                              ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 418                              esc_url( wp_get_update_php_url() )
 419                          );
 420                          wp_update_php_annotation( '</p><p><em>', '</em>' );
 421                      }
 422                  } elseif ( ! $theme['updateResponse']['compatibleWP'] ) {
 423                      printf(
 424                          /* translators: %s: Theme name. */
 425                          __( 'There is a new version of %s available, but it doesn&#8217;t work with your version of WordPress.' ),
 426                          $theme['name']
 427                      );
 428                      if ( current_user_can( 'update_core' ) ) {
 429                          printf(
 430                              /* translators: %s: URL to WordPress Updates screen. */
 431                              ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 432                              self_admin_url( 'update-core.php' )
 433                          );
 434                      }
 435                  } elseif ( ! $theme['updateResponse']['compatiblePHP'] ) {
 436                      printf(
 437                          /* translators: %s: Theme name. */
 438                          __( 'There is a new version of %s available, but it doesn&#8217;t work with your version of PHP.' ),
 439                          $theme['name']
 440                      );
 441                      if ( current_user_can( 'update_php' ) ) {
 442                          printf(
 443                              /* translators: %s: URL to Update PHP page. */
 444                              ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 445                              esc_url( wp_get_update_php_url() )
 446                          );
 447                          wp_update_php_annotation( '</p><p><em>', '</em>' );
 448                      }
 449                  }
 450                  ?>
 451              </p></div>
 452          <?php endif; ?>
 453      <?php endif; ?>
 454  
 455      <?php
 456      if ( ! $theme['compatibleWP'] || ! $theme['compatiblePHP'] ) {
 457          echo '<div class="notice inline notice-error notice-alt"><p>';
 458          if ( ! $theme['compatibleWP'] && ! $theme['compatiblePHP'] ) {
 459              _e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
 460              if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
 461                  printf(
 462                      /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
 463                      ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
 464                      self_admin_url( 'update-core.php' ),
 465                      esc_url( wp_get_update_php_url() )
 466                  );
 467                  wp_update_php_annotation( '</p><p><em>', '</em>' );
 468              } elseif ( current_user_can( 'update_core' ) ) {
 469                  printf(
 470                      /* translators: %s: URL to WordPress Updates screen. */
 471                      ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 472                      self_admin_url( 'update-core.php' )
 473                  );
 474              } elseif ( current_user_can( 'update_php' ) ) {
 475                  printf(
 476                      /* translators: %s: URL to Update PHP page. */
 477                      ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 478                      esc_url( wp_get_update_php_url() )
 479                  );
 480                  wp_update_php_annotation( '</p><p><em>', '</em>' );
 481              }
 482          } elseif ( ! $theme['compatibleWP'] ) {
 483              _e( 'This theme doesn&#8217;t work with your version of WordPress.' );
 484              if ( current_user_can( 'update_core' ) ) {
 485                  printf(
 486                      /* translators: %s: URL to WordPress Updates screen. */
 487                      ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 488                      self_admin_url( 'update-core.php' )
 489                  );
 490              }
 491          } elseif ( ! $theme['compatiblePHP'] ) {
 492              _e( 'This theme doesn&#8217;t work with your version of PHP.' );
 493              if ( current_user_can( 'update_php' ) ) {
 494                  printf(
 495                      /* translators: %s: URL to Update PHP page. */
 496                      ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 497                      esc_url( wp_get_update_php_url() )
 498                  );
 499                  wp_update_php_annotation( '</p><p><em>', '</em>' );
 500              }
 501          }
 502          echo '</p></div>';
 503      }
 504      ?>
 505  
 506      <span class="more-details" id="<?php echo $aria_action; ?>"><?php _e( 'Theme Details' ); ?></span>
 507      <div class="theme-author">
 508          <?php
 509          /* translators: %s: Theme author name. */
 510          printf( __( 'By %s' ), $theme['author'] );
 511          ?>
 512      </div>
 513  
 514      <div class="theme-id-container">
 515          <?php if ( $theme['active'] ) { ?>
 516              <h2 class="theme-name" id="<?php echo $aria_name; ?>">
 517                  <span><?php _ex( 'Active:', 'theme' ); ?></span> <?php echo $theme['name']; ?>
 518              </h2>
 519          <?php } else { ?>
 520              <h2 class="theme-name" id="<?php echo $aria_name; ?>"><?php echo $theme['name']; ?></h2>
 521          <?php } ?>
 522  
 523          <div class="theme-actions">
 524          <?php if ( $theme['active'] ) { ?>
 525              <?php if ( $theme['actions']['customize'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
 526                  <a class="button button-primary customize load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Customize' ); ?></a>
 527              <?php } ?>
 528          <?php } elseif ( $theme['compatibleWP'] && $theme['compatiblePHP'] ) { ?>
 529              <?php
 530              /* translators: %s: Theme name. */
 531              $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
 532              ?>
 533              <a class="button activate" href="<?php echo $theme['actions']['activate']; ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
 534              <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
 535                  <a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a>
 536              <?php } ?>
 537          <?php } else { ?>
 538              <?php
 539              /* translators: %s: Theme name. */
 540              $aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' );
 541              ?>
 542              <a class="button disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
 543              <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
 544                  <a class="button button-primary hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a>
 545              <?php } ?>
 546          <?php } ?>
 547  
 548          </div>
 549      </div>
 550  </div>
 551  <?php endforeach; ?>
 552      </div>
 553  </div>
 554  <div class="theme-overlay" tabindex="0" role="dialog" aria-label="<?php esc_attr_e( 'Theme Details' ); ?>"></div>
 555  
 556  <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
 557  
 558  <?php
 559  // List broken themes, if any.
 560  $broken_themes = wp_get_themes( array( 'errors' => true ) );
 561  if ( ! is_multisite() && $broken_themes ) {
 562      ?>
 563  
 564  <div class="broken-themes">
 565  <h3><?php _e( 'Broken Themes' ); ?></h3>
 566  <p><?php _e( 'The following themes are installed but incomplete.' ); ?></p>
 567  
 568      <?php
 569      $can_resume  = current_user_can( 'resume_themes' );
 570      $can_delete  = current_user_can( 'delete_themes' );
 571      $can_install = current_user_can( 'install_themes' );
 572      ?>
 573  <table>
 574      <tr>
 575          <th><?php _ex( 'Name', 'theme name' ); ?></th>
 576          <th><?php _e( 'Description' ); ?></th>
 577          <?php if ( $can_resume ) { ?>
 578              <td></td>
 579          <?php } ?>
 580          <?php if ( $can_delete ) { ?>
 581              <td></td>
 582          <?php } ?>
 583          <?php if ( $can_install ) { ?>
 584              <td></td>
 585          <?php } ?>
 586      </tr>
 587      <?php foreach ( $broken_themes as $broken_theme ) : ?>
 588          <tr>
 589              <td><?php echo $broken_theme->get( 'Name' ) ? $broken_theme->display( 'Name' ) : esc_html( $broken_theme->get_stylesheet() ); ?></td>
 590              <td><?php echo $broken_theme->errors()->get_error_message(); ?></td>
 591              <?php
 592              if ( $can_resume ) {
 593                  if ( 'theme_paused' === $broken_theme->errors()->get_error_code() ) {
 594                      $stylesheet = $broken_theme->get_stylesheet();
 595                      $resume_url = add_query_arg(
 596                          array(
 597                              'action'     => 'resume',
 598                              'stylesheet' => urlencode( $stylesheet ),
 599                          ),
 600                          admin_url( 'themes.php' )
 601                      );
 602                      $resume_url = wp_nonce_url( $resume_url, 'resume-theme_' . $stylesheet );
 603                      ?>
 604                      <td><a href="<?php echo esc_url( $resume_url ); ?>" class="button resume-theme"><?php _e( 'Resume' ); ?></a></td>
 605                      <?php
 606                  } else {
 607                      ?>
 608                      <td></td>
 609                      <?php
 610                  }
 611              }
 612  
 613              if ( $can_delete ) {
 614                  $stylesheet = $broken_theme->get_stylesheet();
 615                  $delete_url = add_query_arg(
 616                      array(
 617                          'action'     => 'delete',
 618                          'stylesheet' => urlencode( $stylesheet ),
 619                      ),
 620                      admin_url( 'themes.php' )
 621                  );
 622                  $delete_url = wp_nonce_url( $delete_url, 'delete-theme_' . $stylesheet );
 623                  ?>
 624                  <td><a href="<?php echo esc_url( $delete_url ); ?>" class="button delete-theme"><?php _e( 'Delete' ); ?></a></td>
 625                  <?php
 626              }
 627  
 628              if ( $can_install && 'theme_no_parent' === $broken_theme->errors()->get_error_code() ) {
 629                  $parent_theme_name = $broken_theme->get( 'Template' );
 630                  $parent_theme      = themes_api( 'theme_information', array( 'slug' => urlencode( $parent_theme_name ) ) );
 631  
 632                  if ( ! is_wp_error( $parent_theme ) ) {
 633                      $install_url = add_query_arg(
 634                          array(
 635                              'action' => 'install-theme',
 636                              'theme'  => urlencode( $parent_theme_name ),
 637                          ),
 638                          admin_url( 'update.php' )
 639                      );
 640                      $install_url = wp_nonce_url( $install_url, 'install-theme_' . $parent_theme_name );
 641                      ?>
 642                      <td><a href="<?php echo esc_url( $install_url ); ?>" class="button install-theme"><?php _e( 'Install Parent Theme' ); ?></a></td>
 643                      <?php
 644                  }
 645              }
 646              ?>
 647          </tr>
 648      <?php endforeach; ?>
 649  </table>
 650  </div>
 651  
 652      <?php
 653  }
 654  ?>
 655  </div><!-- .wrap -->
 656  
 657  <?php
 658  
 659  /**
 660   * Returns the JavaScript template used to display the auto-update setting for a theme.
 661   *
 662   * @since 5.5.0
 663   *
 664   * @return string The template for displaying the auto-update setting link.
 665   */
 666  function wp_theme_auto_update_setting_template() {
 667      $template = '
 668          <div class="theme-autoupdate">
 669              <# if ( data.autoupdate.supported ) { #>
 670                  <# if ( data.autoupdate.forced === false ) { #>
 671                      ' . __( 'Auto-updates disabled' ) . '
 672                  <# } else if ( data.autoupdate.forced ) { #>
 673                      ' . __( 'Auto-updates enabled' ) . '
 674                  <# } else if ( data.autoupdate.enabled ) { #>
 675                      <button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="disable">
 676                          <span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Disable auto-updates' ) . '</span>
 677                      </button>
 678                  <# } else { #>
 679                      <button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="enable">
 680                          <span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Enable auto-updates' ) . '</span>
 681                      </button>
 682                  <# } #>
 683              <# } #>
 684              <# if ( data.hasUpdate ) { #>
 685                  <# if ( data.autoupdate.supported && data.autoupdate.enabled ) { #>
 686                      <span class="auto-update-time">
 687                  <# } else { #>
 688                      <span class="auto-update-time hidden">
 689                  <# } #>
 690                  <br />' . wp_get_auto_update_message() . '</span>
 691              <# } #>
 692              <div class="notice notice-error notice-alt inline hidden"><p></p></div>
 693          </div>
 694      ';
 695  
 696      /**
 697       * Filters the JavaScript template used to display the auto-update setting for a theme (in the overlay).
 698       *
 699       * See {@see wp_prepare_themes_for_js()} for the properties of the `data` object.
 700       *
 701       * @since 5.5.0
 702       *
 703       * @param string $template The template for displaying the auto-update setting link.
 704       */
 705      return apply_filters( 'theme_auto_update_setting_template', $template );
 706  }
 707  
 708  /*
 709   * The tmpl-theme template is synchronized with PHP above!
 710   */
 711  ?>
 712  <script id="tmpl-theme" type="text/template">
 713      <# if ( data.screenshot[0] ) { #>
 714          <div class="theme-screenshot">
 715              <img src="{{ data.screenshot[0] }}" alt="" />
 716          </div>
 717      <# } else { #>
 718          <div class="theme-screenshot blank"></div>
 719      <# } #>
 720  
 721      <# if ( data.hasUpdate ) { #>
 722          <# if ( data.updateResponse.compatibleWP && data.updateResponse.compatiblePHP ) { #>
 723              <div class="update-message notice inline notice-warning notice-alt"><p>
 724                  <# if ( data.hasPackage ) { #>
 725                      <?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?>
 726                  <# } else { #>
 727                      <?php _e( 'New version available.' ); ?>
 728                  <# } #>
 729              </p></div>
 730          <# } else { #>
 731              <div class="update-message notice inline notice-error notice-alt"><p>
 732                  <# if ( ! data.updateResponse.compatibleWP && ! data.updateResponse.compatiblePHP ) { #>
 733                      <?php
 734                      printf(
 735                          /* translators: %s: Theme name. */
 736                          __( 'There is a new version of %s available, but it doesn&#8217;t work with your versions of WordPress and PHP.' ),
 737                          '{{{ data.name }}}'
 738                      );
 739                      if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
 740                          printf(
 741                              /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
 742                              ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
 743                              self_admin_url( 'update-core.php' ),
 744                              esc_url( wp_get_update_php_url() )
 745                          );
 746                          wp_update_php_annotation( '</p><p><em>', '</em>' );
 747                      } elseif ( current_user_can( 'update_core' ) ) {
 748                          printf(
 749                              /* translators: %s: URL to WordPress Updates screen. */
 750                              ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 751                              self_admin_url( 'update-core.php' )
 752                          );
 753                      } elseif ( current_user_can( 'update_php' ) ) {
 754                          printf(
 755                              /* translators: %s: URL to Update PHP page. */
 756                              ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 757                              esc_url( wp_get_update_php_url() )
 758                          );
 759                          wp_update_php_annotation( '</p><p><em>', '</em>' );
 760                      }
 761                      ?>
 762                  <# } else if ( ! data.updateResponse.compatibleWP ) { #>
 763                      <?php
 764                      printf(
 765                          /* translators: %s: Theme name. */
 766                          __( 'There is a new version of %s available, but it doesn&#8217;t work with your version of WordPress.' ),
 767                          '{{{ data.name }}}'
 768                      );
 769                      if ( current_user_can( 'update_core' ) ) {
 770                          printf(
 771                              /* translators: %s: URL to WordPress Updates screen. */
 772                              ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 773                              self_admin_url( 'update-core.php' )
 774                          );
 775                      }
 776                      ?>
 777                  <# } else if ( ! data.updateResponse.compatiblePHP ) { #>
 778                      <?php
 779                      printf(
 780                          /* translators: %s: Theme name. */
 781                          __( 'There is a new version of %s available, but it doesn&#8217;t work with your version of PHP.' ),
 782                          '{{{ data.name }}}'
 783                      );
 784                      if ( current_user_can( 'update_php' ) ) {
 785                          printf(
 786                              /* translators: %s: URL to Update PHP page. */
 787                              ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 788                              esc_url( wp_get_update_php_url() )
 789                          );
 790                          wp_update_php_annotation( '</p><p><em>', '</em>' );
 791                      }
 792                      ?>
 793                  <# } #>
 794              </p></div>
 795          <# } #>
 796      <# } #>
 797  
 798      <# if ( ! data.compatibleWP || ! data.compatiblePHP ) { #>
 799          <div class="notice notice-error notice-alt"><p>
 800              <# if ( ! data.compatibleWP && ! data.compatiblePHP ) { #>
 801                  <?php
 802                  _e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
 803                  if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
 804                      printf(
 805                          /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
 806                          ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
 807                          self_admin_url( 'update-core.php' ),
 808                          esc_url( wp_get_update_php_url() )
 809                      );
 810                      wp_update_php_annotation( '</p><p><em>', '</em>' );
 811                  } elseif ( current_user_can( 'update_core' ) ) {
 812                      printf(
 813                          /* translators: %s: URL to WordPress Updates screen. */
 814                          ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 815                          self_admin_url( 'update-core.php' )
 816                      );
 817                  } elseif ( current_user_can( 'update_php' ) ) {
 818                      printf(
 819                          /* translators: %s: URL to Update PHP page. */
 820                          ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 821                          esc_url( wp_get_update_php_url() )
 822                      );
 823                      wp_update_php_annotation( '</p><p><em>', '</em>' );
 824                  }
 825                  ?>
 826              <# } else if ( ! data.compatibleWP ) { #>
 827                  <?php
 828                  _e( 'This theme doesn&#8217;t work with your version of WordPress.' );
 829                  if ( current_user_can( 'update_core' ) ) {
 830                      printf(
 831                          /* translators: %s: URL to WordPress Updates screen. */
 832                          ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 833                          self_admin_url( 'update-core.php' )
 834                      );
 835                  }
 836                  ?>
 837              <# } else if ( ! data.compatiblePHP ) { #>
 838                  <?php
 839                  _e( 'This theme doesn&#8217;t work with your version of PHP.' );
 840                  if ( current_user_can( 'update_php' ) ) {
 841                      printf(
 842                          /* translators: %s: URL to Update PHP page. */
 843                          ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 844                          esc_url( wp_get_update_php_url() )
 845                      );
 846                      wp_update_php_annotation( '</p><p><em>', '</em>' );
 847                  }
 848                  ?>
 849              <# } #>
 850          </p></div>
 851      <# } #>
 852  
 853      <span class="more-details" id="{{ data.id }}-action"><?php _e( 'Theme Details' ); ?></span>
 854      <div class="theme-author">
 855          <?php
 856          /* translators: %s: Theme author name. */
 857          printf( __( 'By %s' ), '{{{ data.author }}}' );
 858          ?>
 859      </div>
 860  
 861      <div class="theme-id-container">
 862          <# if ( data.active ) { #>
 863              <h2 class="theme-name" id="{{ data.id }}-name">
 864                  <span><?php _ex( 'Active:', 'theme' ); ?></span> {{{ data.name }}}
 865              </h2>
 866          <# } else { #>
 867              <h2 class="theme-name" id="{{ data.id }}-name">{{{ data.name }}}</h2>
 868          <# } #>
 869  
 870          <div class="theme-actions">
 871              <# if ( data.active ) { #>
 872                  <# if ( data.actions.customize ) { #>
 873                      <a class="button button-primary customize load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Customize' ); ?></a>
 874                  <# } #>
 875              <# } else { #>
 876                  <# if ( data.compatibleWP && data.compatiblePHP ) { #>
 877                      <?php
 878                      /* translators: %s: Theme name. */
 879                      $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
 880                      ?>
 881                      <a class="button activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a>
 882                      <a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a>
 883                  <# } else { #>
 884                      <?php
 885                      /* translators: %s: Theme name. */
 886                      $aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' );
 887                      ?>
 888                      <a class="button disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
 889                      <a class="button button-primary hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a>
 890                  <# } #>
 891              <# } #>
 892          </div>
 893      </div>
 894  </script>
 895  
 896  <script id="tmpl-theme-single" type="text/template">
 897      <div class="theme-backdrop"></div>
 898      <div class="theme-wrap wp-clearfix" role="document">
 899          <div class="theme-header">
 900              <button class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show previous theme' ); ?></span></button>
 901              <button class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show next theme' ); ?></span></button>
 902              <button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close details dialog' ); ?></span></button>
 903          </div>
 904          <div class="theme-about wp-clearfix">
 905              <div class="theme-screenshots">
 906              <# if ( data.screenshot[0] ) { #>
 907                  <div class="screenshot"><img src="{{ data.screenshot[0] }}" alt="" /></div>
 908              <# } else { #>
 909                  <div class="screenshot blank"></div>
 910              <# } #>
 911              </div>
 912  
 913              <div class="theme-info">
 914                  <# if ( data.active ) { #>
 915                      <span class="current-label"><?php _e( 'Current Theme' ); ?></span>
 916                  <# } #>
 917                  <h2 class="theme-name">{{{ data.name }}}<span class="theme-version">
 918                      <?php
 919                      /* translators: %s: Theme version. */
 920                      printf( __( 'Version: %s' ), '{{ data.version }}' );
 921                      ?>
 922                  </span></h2>
 923                  <p class="theme-author">
 924                      <?php
 925                      /* translators: %s: Theme author link. */
 926                      printf( __( 'By %s' ), '{{{ data.authorAndUri }}}' );
 927                      ?>
 928                  </p>
 929  
 930                  <# if ( ! data.compatibleWP || ! data.compatiblePHP ) { #>
 931                      <div class="notice notice-error notice-alt notice-large"><p>
 932                          <# if ( ! data.compatibleWP && ! data.compatiblePHP ) { #>
 933                              <?php
 934                              _e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
 935                              if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
 936                                  printf(
 937                                      /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
 938                                      ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
 939                                      self_admin_url( 'update-core.php' ),
 940                                      esc_url( wp_get_update_php_url() )
 941                                  );
 942                                  wp_update_php_annotation( '</p><p><em>', '</em>' );
 943                              } elseif ( current_user_can( 'update_core' ) ) {
 944                                  printf(
 945                                      /* translators: %s: URL to WordPress Updates screen. */
 946                                      ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 947                                      self_admin_url( 'update-core.php' )
 948                                  );
 949                              } elseif ( current_user_can( 'update_php' ) ) {
 950                                  printf(
 951                                      /* translators: %s: URL to Update PHP page. */
 952                                      ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 953                                      esc_url( wp_get_update_php_url() )
 954                                  );
 955                                  wp_update_php_annotation( '</p><p><em>', '</em>' );
 956                              }
 957                              ?>
 958                          <# } else if ( ! data.compatibleWP ) { #>
 959                              <?php
 960                              _e( 'This theme doesn&#8217;t work with your version of WordPress.' );
 961                              if ( current_user_can( 'update_core' ) ) {
 962                                  printf(
 963                                      /* translators: %s: URL to WordPress Updates screen. */
 964                                      ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 965                                      self_admin_url( 'update-core.php' )
 966                                  );
 967                              }
 968                              ?>
 969                          <# } else if ( ! data.compatiblePHP ) { #>
 970                              <?php
 971                              _e( 'This theme doesn&#8217;t work with your version of PHP.' );
 972                              if ( current_user_can( 'update_php' ) ) {
 973                                  printf(
 974                                      /* translators: %s: URL to Update PHP page. */
 975                                      ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 976                                      esc_url( wp_get_update_php_url() )
 977                                  );
 978                                  wp_update_php_annotation( '</p><p><em>', '</em>' );
 979                              }
 980                              ?>
 981                          <# } #>
 982                      </p></div>
 983                  <# } #>
 984  
 985                  <# if ( data.hasUpdate ) { #>
 986                      <# if ( data.updateResponse.compatibleWP && data.updateResponse.compatiblePHP ) { #>
 987                          <div class="notice notice-warning notice-alt notice-large">
 988                              <h3 class="notice-title"><?php _e( 'Update Available' ); ?></h3>
 989                              {{{ data.update }}}
 990                          </div>
 991                      <# } else { #>
 992                          <div class="notice notice-error notice-alt notice-large">
 993                              <h3 class="notice-title"><?php _e( 'Update Incompatible' ); ?></h3>
 994                              <p>
 995                                  <# if ( ! data.updateResponse.compatibleWP && ! data.updateResponse.compatiblePHP ) { #>
 996                                      <?php
 997                                      printf(
 998                                          /* translators: %s: Theme name. */
 999                                          __( 'There is a new version of %s available, but it doesn&#8217;t work with your versions of WordPress and PHP.' ),
1000                                          '{{{ data.name }}}'
1001                                      );
1002                                      if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
1003                                          printf(
1004                                              /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
1005                                              ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
1006                                              self_admin_url( 'update-core.php' ),
1007                                              esc_url( wp_get_update_php_url() )
1008                                          );
1009                                          wp_update_php_annotation( '</p><p><em>', '</em>' );
1010                                      } elseif ( current_user_can( 'update_core' ) ) {
1011                                          printf(
1012                                              /* translators: %s: URL to WordPress Updates screen. */
1013                                              ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
1014                                              self_admin_url( 'update-core.php' )
1015                                          );
1016                                      } elseif ( current_user_can( 'update_php' ) ) {
1017                                          printf(
1018                                              /* translators: %s: URL to Update PHP page. */
1019                                              ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
1020                                              esc_url( wp_get_update_php_url() )
1021                                          );
1022                                          wp_update_php_annotation( '</p><p><em>', '</em>' );
1023                                      }
1024                                      ?>
1025                                  <# } else if ( ! data.updateResponse.compatibleWP ) { #>
1026                                      <?php
1027                                      printf(
1028                                          /* translators: %s: Theme name. */
1029                                          __( 'There is a new version of %s available, but it doesn&#8217;t work with your version of WordPress.' ),
1030                                          '{{{ data.name }}}'
1031                                      );
1032                                      if ( current_user_can( 'update_core' ) ) {
1033                                          printf(
1034                                              /* translators: %s: URL to WordPress Updates screen. */
1035                                              ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
1036                                              self_admin_url( 'update-core.php' )
1037                                          );
1038                                      }
1039                                      ?>
1040                                  <# } else if ( ! data.updateResponse.compatiblePHP ) { #>
1041                                      <?php
1042                                      printf(
1043                                          /* translators: %s: Theme name. */
1044                                          __( 'There is a new version of %s available, but it doesn&#8217;t work with your version of PHP.' ),
1045                                          '{{{ data.name }}}'
1046                                      );
1047                                      if ( current_user_can( 'update_php' ) ) {
1048                                          printf(
1049                                              /* translators: %s: URL to Update PHP page. */
1050                                              ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
1051                                              esc_url( wp_get_update_php_url() )
1052                                          );
1053                                          wp_update_php_annotation( '</p><p><em>', '</em>' );
1054                                      }
1055                                      ?>
1056                                  <# } #>
1057                              </p>
1058                          </div>
1059                      <# } #>
1060                  <# } #>
1061  
1062                  <# if ( data.actions.autoupdate ) { #>
1063                      <?php echo wp_theme_auto_update_setting_template(); ?>
1064                  <# } #>
1065  
1066                  <p class="theme-description">{{{ data.description }}}</p>
1067  
1068                  <# if ( data.parent ) { #>
1069                      <p class="parent-theme">
1070                          <?php
1071                          /* translators: %s: Theme name. */
1072                          printf( __( 'This is a child theme of %s.' ), '<strong>{{{ data.parent }}}</strong>' );
1073                          ?>
1074                      </p>
1075                  <# } #>
1076  
1077                  <# if ( data.tags ) { #>
1078                      <p class="theme-tags"><span><?php _e( 'Tags:' ); ?></span> {{{ data.tags }}}</p>
1079                  <# } #>
1080              </div>
1081          </div>
1082  
1083          <div class="theme-actions">
1084              <div class="active-theme">
1085                  <a href="{{{ data.actions.customize }}}" class="button button-primary customize load-customize hide-if-no-customize"><?php _e( 'Customize' ); ?></a>
1086                  <?php echo implode( ' ', $current_theme_actions ); ?>
1087              </div>
1088              <div class="inactive-theme">
1089                  <# if ( data.compatibleWP && data.compatiblePHP ) { #>
1090                      <?php
1091                      /* translators: %s: Theme name. */
1092                      $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
1093                      ?>
1094                      <# if ( data.actions.activate ) { #>
1095                          <a href="{{{ data.actions.activate }}}" class="button activate" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a>
1096                      <# } #>
1097                      <a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a>
1098                  <# } else { #>
1099                      <?php
1100                      /* translators: %s: Theme name. */
1101                      $aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' );
1102                      ?>
1103                      <# if ( data.actions.activate ) { #>
1104                          <a class="button disabled" aria-label="<?php echo $aria_label; ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
1105                      <# } #>
1106                      <a class="button button-primary hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a>
1107                  <# } #>
1108              </div>
1109  
1110              <# if ( ! data.active && data.actions['delete'] ) { #>
1111                  <a href="{{{ data.actions['delete'] }}}" class="button delete-theme"><?php _e( 'Delete' ); ?></a>
1112              <# } #>
1113          </div>
1114      </div>
1115  </script>
1116  
1117  <?php
1118  wp_print_request_filesystem_credentials_modal();
1119  wp_print_admin_notice_templates();
1120  wp_print_update_row_templates();
1121  
1122  wp_localize_script(
1123      'updates',
1124      '_wpUpdatesItemCounts',
1125      array(
1126          'totals' => wp_get_update_data(),
1127      )
1128  );
1129  
1130  require_once ABSPATH . 'wp-admin/admin-footer.php';


Generated: Mon Apr 19 01:00:04 2021 Cross-referenced by PHPXref 0.7.1