[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-admin/ -> site-health-info.php (source)

   1  <?php
   2  /**
   3   * Tools Administration Screen.
   4   *
   5   * @package WordPress
   6   * @subpackage Administration
   7   */
   8  
   9  // Don't load directly.
  10  if ( ! defined( 'ABSPATH' ) ) {
  11      exit;
  12  }
  13  
  14  if ( ! class_exists( 'WP_Debug_Data' ) ) {
  15      require_once  ABSPATH . 'wp-admin/includes/class-wp-debug-data.php';
  16  }
  17  if ( ! class_exists( 'WP_Site_Health' ) ) {
  18      require_once  ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
  19  }
  20  
  21  $health_check_site_status = WP_Site_Health::get_instance();
  22  
  23  wp_admin_notice(
  24      __( 'The Site Health check requires JavaScript.' ),
  25      array(
  26          'type'               => 'error',
  27          'additional_classes' => array( 'hide-if-js' ),
  28      )
  29  );
  30  ?>
  31  
  32  <div class="health-check-body health-check-debug-tab hide-if-no-js">
  33      <?php
  34  
  35      WP_Debug_Data::check_for_updates();
  36  
  37      $info = WP_Debug_Data::debug_data();
  38  
  39      ?>
  40  
  41      <h2>
  42          <?php _e( 'Site Health Info' ); ?>
  43      </h2>
  44  
  45      <p>
  46          <?php
  47              /* translators: %s: URL to Site Health Status page. */
  48              printf( __( 'This page can show you every detail about the configuration of your WordPress website. For any improvements that could be made, see the <a href="%s">Site Health Status</a> page.' ), esc_url( admin_url( 'site-health.php' ) ) );
  49          ?>
  50      </p>
  51      <p>
  52          <?php _e( 'If you want to export a handy list of all the information on this page, you can use the button below to copy it to the clipboard. You can then paste it in a text file and save it to your device, or paste it in an email exchange with a support engineer or theme/plugin developer for example.' ); ?>
  53      </p>
  54  
  55      <div class="site-health-copy-buttons">
  56          <div class="copy-button-wrapper">
  57              <button type="button" class="button copy-button" data-clipboard-text="<?php echo esc_attr( WP_Debug_Data::format( $info, 'debug' ) ); ?>">
  58                  <?php _e( 'Copy site info to clipboard' ); ?>
  59              </button>
  60              <span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
  61          </div>
  62      </div>
  63  
  64      <div id="health-check-debug" class="health-check-accordion">
  65  
  66          <?php
  67  
  68          $sizes_fields = array( 'uploads_size', 'themes_size', 'plugins_size', 'fonts_size', 'wordpress_size', 'database_size', 'total_size' );
  69  
  70          foreach ( $info as $section => $details ) {
  71              if ( ! isset( $details['fields'] ) || empty( $details['fields'] ) ) {
  72                  continue;
  73              }
  74  
  75              ?>
  76              <h3 class="health-check-accordion-heading">
  77                  <button id="health-check-section-<?php echo esc_attr( $section ); ?>" aria-expanded="false" class="health-check-accordion-trigger" aria-controls="health-check-accordion-block-<?php echo esc_attr( $section ); ?>" type="button">
  78                      <span class="title">
  79                          <?php echo esc_html( $details['label'] ); ?>
  80                          <?php
  81  
  82                          if ( isset( $details['show_count'] ) && $details['show_count'] ) {
  83                              printf(
  84                                  '(%s)',
  85                                  number_format_i18n( count( $details['fields'] ) )
  86                              );
  87                          }
  88  
  89                          ?>
  90                      </span>
  91                      <?php
  92  
  93                      if ( 'wp-paths-sizes' === $section ) {
  94                          ?>
  95                          <span class="health-check-wp-paths-sizes spinner"></span>
  96                          <?php
  97                      }
  98  
  99                      ?>
 100                      <span class="icon"></span>
 101                  </button>
 102              </h3>
 103  
 104              <div id="health-check-accordion-block-<?php echo esc_attr( $section ); ?>" class="health-check-accordion-panel" hidden="hidden">
 105                  <?php
 106  
 107                  if ( isset( $details['description'] ) && ! empty( $details['description'] ) ) {
 108                      printf( '<p>%s</p>', $details['description'] );
 109                  }
 110  
 111                  ?>
 112                  <table class="widefat striped health-check-table">
 113                      <tbody>
 114                      <?php
 115  
 116                      foreach ( $details['fields'] as $field_name => $field ) {
 117                          if ( is_array( $field['value'] ) ) {
 118                              $values = '<ul>';
 119  
 120                              foreach ( $field['value'] as $name => $value ) {
 121                                  $values .= sprintf( '<li>%s: %s</li>', esc_html( $name ), esc_html( $value ) );
 122                              }
 123  
 124                              $values .= '</ul>';
 125                          } else {
 126                              $values = esc_html( $field['value'] );
 127                          }
 128  
 129                          if ( in_array( $field_name, $sizes_fields, true ) ) {
 130                              printf( '<tr><th scope="row">%s</th><td class="%s">%s</td></tr>', esc_html( $field['label'] ), esc_attr( $field_name ), $values );
 131                          } else {
 132                              printf( '<tr><th scope="row">%s</th><td>%s</td></tr>', esc_html( $field['label'] ), $values );
 133                          }
 134                      }
 135  
 136                      ?>
 137                      </tbody>
 138                  </table>
 139              </div>
 140          <?php } ?>
 141      </div>
 142  </div>


Generated : Fri Jul 10 08:20:14 2026 Cross-referenced by PHPXref