[ 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  if ( ! defined( 'ABSPATH' ) ) {
  10      die();
  11  }
  12  
  13  if ( ! class_exists( 'WP_Debug_Data' ) ) {
  14      require_once  ABSPATH . 'wp-admin/includes/class-wp-debug-data.php';
  15  }
  16  if ( ! class_exists( 'WP_Site_Health' ) ) {
  17      require_once  ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
  18  }
  19  
  20  $health_check_site_status = WP_Site_Health::get_instance();
  21  
  22  wp_admin_notice(
  23      __( 'The Site Health check requires JavaScript.' ),
  24      array(
  25          'type'               => 'error',
  26          'additional_classes' => array( 'hide-if-js' ),
  27      )
  28  );
  29  ?>
  30  
  31  <div class="health-check-body health-check-debug-tab hide-if-no-js">
  32      <?php
  33  
  34      WP_Debug_Data::check_for_updates();
  35  
  36      $info = WP_Debug_Data::debug_data();
  37  
  38      ?>
  39  
  40      <h2>
  41          <?php _e( 'Site Health Info' ); ?>
  42      </h2>
  43  
  44      <p>
  45          <?php
  46              /* translators: %s: URL to Site Health Status page. */
  47              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' ) ) );
  48          ?>
  49      </p>
  50      <p>
  51          <?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.' ); ?>
  52      </p>
  53  
  54      <div class="site-health-copy-buttons">
  55          <div class="copy-button-wrapper">
  56              <button type="button" class="button copy-button" data-clipboard-text="<?php echo esc_attr( WP_Debug_Data::format( $info, 'debug' ) ); ?>">
  57                  <?php _e( 'Copy site info to clipboard' ); ?>
  58              </button>
  59              <span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
  60          </div>
  61      </div>
  62  
  63      <div id="health-check-debug" class="health-check-accordion">
  64  
  65          <?php
  66  
  67          $sizes_fields = array( 'uploads_size', 'themes_size', 'plugins_size', 'wordpress_size', 'database_size', 'total_size' );
  68  
  69          foreach ( $info as $section => $details ) {
  70              if ( ! isset( $details['fields'] ) || empty( $details['fields'] ) ) {
  71                  continue;
  72              }
  73  
  74              ?>
  75              <h3 class="health-check-accordion-heading">
  76                  <button aria-expanded="false" class="health-check-accordion-trigger" aria-controls="health-check-accordion-block-<?php echo esc_attr( $section ); ?>" type="button">
  77                      <span class="title">
  78                          <?php echo esc_html( $details['label'] ); ?>
  79                          <?php
  80  
  81                          if ( isset( $details['show_count'] ) && $details['show_count'] ) {
  82                              printf(
  83                                  '(%s)',
  84                                  number_format_i18n( count( $details['fields'] ) )
  85                              );
  86                          }
  87  
  88                          ?>
  89                      </span>
  90                      <?php
  91  
  92                      if ( 'wp-paths-sizes' === $section ) {
  93                          ?>
  94                          <span class="health-check-wp-paths-sizes spinner"></span>
  95                          <?php
  96                      }
  97  
  98                      ?>
  99                      <span class="icon"></span>
 100                  </button>
 101              </h3>
 102  
 103              <div id="health-check-accordion-block-<?php echo esc_attr( $section ); ?>" class="health-check-accordion-panel" hidden="hidden">
 104                  <?php
 105  
 106                  if ( isset( $details['description'] ) && ! empty( $details['description'] ) ) {
 107                      printf( '<p>%s</p>', $details['description'] );
 108                  }
 109  
 110                  ?>
 111                  <table class="widefat striped health-check-table" role="presentation">
 112                      <tbody>
 113                      <?php
 114  
 115                      foreach ( $details['fields'] as $field_name => $field ) {
 116                          if ( is_array( $field['value'] ) ) {
 117                              $values = '<ul>';
 118  
 119                              foreach ( $field['value'] as $name => $value ) {
 120                                  $values .= sprintf( '<li>%s: %s</li>', esc_html( $name ), esc_html( $value ) );
 121                              }
 122  
 123                              $values .= '</ul>';
 124                          } else {
 125                              $values = esc_html( $field['value'] );
 126                          }
 127  
 128                          if ( in_array( $field_name, $sizes_fields, true ) ) {
 129                              printf( '<tr><td>%s</td><td class="%s">%s</td></tr>', esc_html( $field['label'] ), esc_attr( $field_name ), $values );
 130                          } else {
 131                              printf( '<tr><td>%s</td><td>%s</td></tr>', esc_html( $field['label'] ), $values );
 132                          }
 133                      }
 134  
 135                      ?>
 136                      </tbody>
 137                  </table>
 138              </div>
 139          <?php } ?>
 140      </div>
 141  </div>


Generated : Mon Mar 18 08:20:01 2024 Cross-referenced by PHPXref