site-health.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <?php
  2. /**
  3. * Tools Administration Screen.
  4. *
  5. * @package WordPress
  6. * @subpackage Administration
  7. */
  8. if ( isset( $_GET['tab'] ) && 'debug' === $_GET['tab'] ) {
  9. require_once( dirname( __FILE__ ) . '/site-health-info.php' );
  10. return;
  11. }
  12. /** WordPress Administration Bootstrap */
  13. require_once( dirname( __FILE__ ) . '/admin.php' );
  14. $title = __( 'Site Health Status' );
  15. if ( ! current_user_can( 'view_site_health_checks' ) ) {
  16. wp_die( __( 'Sorry, you are not allowed to access site health information.' ), '', 403 );
  17. }
  18. wp_enqueue_style( 'site-health' );
  19. wp_enqueue_script( 'site-health' );
  20. if ( ! class_exists( 'WP_Site_Health' ) ) {
  21. require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
  22. }
  23. $health_check_site_status = new WP_Site_Health();
  24. // Start by checking if this is a special request checking for the existence of certain filters.
  25. $health_check_site_status->check_wp_version_check_exists();
  26. require_once( ABSPATH . 'wp-admin/admin-header.php' );
  27. ?>
  28. <div class="health-check-header">
  29. <div class="health-check-title-section">
  30. <h1>
  31. <?php _e( 'Site Health' ); ?>
  32. </h1>
  33. </div>
  34. <div class="health-check-title-section site-health-progress-wrapper loading hide-if-no-js">
  35. <div class="site-health-progress">
  36. <svg role="img" aria-hidden="true" focusable="false" width="100%" height="100%" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg">
  37. <circle r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
  38. <circle id="bar" r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
  39. </svg>
  40. </div>
  41. <div class="site-health-progress-label">
  42. <?php _e( 'Results are still loading&hellip;' ); ?>
  43. </div>
  44. </div>
  45. <nav class="health-check-tabs-wrapper hide-if-no-js" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>">
  46. <a href="<?php echo esc_url( admin_url( 'site-health.php' ) ); ?>" class="health-check-tab active" aria-current="true">
  47. <?php
  48. /* translators: Tab heading for Site Health Status page. */
  49. _ex( 'Status', 'Site Health' );
  50. ?>
  51. </a>
  52. <a href="<?php echo esc_url( admin_url( 'site-health.php?tab=debug' ) ); ?>" class="health-check-tab">
  53. <?php
  54. /* translators: Tab heading for Site Health Info page. */
  55. _ex( 'Info', 'Site Health' );
  56. ?>
  57. </a>
  58. </nav>
  59. </div>
  60. <hr class="wp-header-end">
  61. <div class="notice notice-error hide-if-js">
  62. <p><?php _e( 'The Site Health check requires JavaScript.' ); ?></p>
  63. </div>
  64. <div class="health-check-body hide-if-no-js">
  65. <div class="site-status-all-clear hide">
  66. <p class="icon">
  67. <span class="dashicons dashicons-yes"></span>
  68. </p>
  69. <p class="encouragement">
  70. <?php _e( 'Great job!' ); ?>
  71. </p>
  72. <p>
  73. <?php _e( 'Everything is running smoothly here.' ); ?>
  74. </p>
  75. </div>
  76. <div class="site-status-has-issues">
  77. <h2>
  78. <?php _e( 'Site Health Status' ); ?>
  79. </h2>
  80. <p><?php _e( 'The site health check shows critical information about your WordPress configuration and items that require your attention.' ); ?></p>
  81. <div class="site-health-issues-wrapper" id="health-check-issues-critical">
  82. <h3 class="site-health-issue-count-title">
  83. <?php
  84. /* translators: %s: Number of critical issues found. */
  85. printf( _n( '%s critical issue', '%s critical issues', 0 ), '<span class="issue-count">0</span>' );
  86. ?>
  87. </h3>
  88. <div id="health-check-site-status-critical" class="health-check-accordion issues"></div>
  89. </div>
  90. <div class="site-health-issues-wrapper" id="health-check-issues-recommended">
  91. <h3 class="site-health-issue-count-title">
  92. <?php
  93. /* translators: %s: Number of recommended improvements. */
  94. printf( _n( '%s recommended improvement', '%s recommended improvements', 0 ), '<span class="issue-count">0</span>' );
  95. ?>
  96. </h3>
  97. <div id="health-check-site-status-recommended" class="health-check-accordion issues"></div>
  98. </div>
  99. </div>
  100. <div class="site-health-view-more">
  101. <button type="button" class="button site-health-view-passed" aria-expanded="false" aria-controls="health-check-issues-good">
  102. <?php _e( 'Passed tests' ); ?>
  103. <span class="icon"></span>
  104. </button>
  105. </div>
  106. <div class="site-health-issues-wrapper hidden" id="health-check-issues-good">
  107. <h3 class="site-health-issue-count-title">
  108. <?php
  109. /* translators: %s: Number of items with no issues. */
  110. printf( _n( '%s item with no issues detected', '%s items with no issues detected', 0 ), '<span class="issue-count">0</span>' );
  111. ?>
  112. </h3>
  113. <div id="health-check-site-status-good" class="health-check-accordion issues"></div>
  114. </div>
  115. </div>
  116. <script id="tmpl-health-check-issue" type="text/template">
  117. <h4 class="health-check-accordion-heading">
  118. <button aria-expanded="false" class="health-check-accordion-trigger" aria-controls="health-check-accordion-block-{{ data.test }}" type="button">
  119. <span class="title">{{ data.label }}</span>
  120. <span class="badge {{ data.badge.color }}">{{ data.badge.label }}</span>
  121. <span class="icon"></span>
  122. </button>
  123. </h4>
  124. <div id="health-check-accordion-block-{{ data.test }}" class="health-check-accordion-panel" hidden="hidden">
  125. {{{ data.description }}}
  126. <div class="actions">
  127. <p class="button-container">{{{ data.actions }}}</p>
  128. </div>
  129. </div>
  130. </script>
  131. <?php
  132. include( ABSPATH . 'wp-admin/admin-footer.php' );