[ Index ]

PHP Cross Reference of WordPress

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


Generated: Tue Apr 23 01:00:02 2024 Cross-referenced by PHPXref 0.7.1