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