wp/wp-admin/site-health.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
     5  * @package WordPress
     5  * @package WordPress
     6  * @subpackage Administration
     6  * @subpackage Administration
     7  */
     7  */
     8 
     8 
     9 if ( isset( $_GET['tab'] ) && 'debug' === $_GET['tab'] ) {
     9 if ( isset( $_GET['tab'] ) && 'debug' === $_GET['tab'] ) {
    10 	require_once( dirname( __FILE__ ) . '/site-health-info.php' );
    10 	require_once __DIR__ . '/site-health-info.php';
    11 	return;
    11 	return;
    12 }
    12 }
    13 
    13 
    14 /** WordPress Administration Bootstrap */
    14 /** WordPress Administration Bootstrap */
    15 require_once( dirname( __FILE__ ) . '/admin.php' );
    15 require_once __DIR__ . '/admin.php';
    16 
    16 
    17 $title = __( 'Site Health Status' );
    17 $title = __( 'Site Health Status' );
    18 
    18 
    19 if ( ! current_user_can( 'view_site_health_checks' ) ) {
    19 if ( ! current_user_can( 'view_site_health_checks' ) ) {
    20 	wp_die( __( 'Sorry, you are not allowed to access site health information.' ), '', 403 );
    20 	wp_die( __( 'Sorry, you are not allowed to access site health information.' ), '', 403 );
    22 
    22 
    23 wp_enqueue_style( 'site-health' );
    23 wp_enqueue_style( 'site-health' );
    24 wp_enqueue_script( 'site-health' );
    24 wp_enqueue_script( 'site-health' );
    25 
    25 
    26 if ( ! class_exists( 'WP_Site_Health' ) ) {
    26 if ( ! class_exists( 'WP_Site_Health' ) ) {
    27 	require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
    27 	require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
    28 }
    28 }
    29 
    29 
    30 $health_check_site_status = new WP_Site_Health();
    30 $health_check_site_status = WP_Site_Health::get_instance();
    31 
    31 
    32 // Start by checking if this is a special request checking for the existence of certain filters.
    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();
    33 $health_check_site_status->check_wp_version_check_exists();
    34 
    34 
    35 require_once( ABSPATH . 'wp-admin/admin-header.php' );
    35 require_once ABSPATH . 'wp-admin/admin-header.php';
    36 ?>
    36 ?>
    37 <div class="health-check-header">
    37 <div class="health-check-header">
    38 	<div class="health-check-title-section">
    38 	<div class="health-check-title-section">
    39 		<h1>
    39 		<h1>
    40 			<?php _e( 'Site Health' ); ?>
    40 			<?php _e( 'Site Health' ); ?>
    41 		</h1>
    41 		</h1>
       
    42 	</div>
    42 
    43 
    43 		<div class="site-health-progress hide-if-no-js loading">
    44 	<div class="health-check-title-section site-health-progress-wrapper loading hide-if-no-js">
       
    45 		<div class="site-health-progress">
    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">
    46 			<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>
    47 				<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>
    48 				<circle id="bar" r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
    47 			</svg>
    49 			</svg>
    48 			<span class="screen-reader-text"><?php _e( 'Current health score:' ); ?></span>
    50 		</div>
    49 			<span class="site-health-progress-count"></span>
    51 		<div class="site-health-progress-label">
       
    52 			<?php _e( 'Results are still loading&hellip;' ); ?>
    50 		</div>
    53 		</div>
    51 	</div>
    54 	</div>
    52 
    55 
    53 	<nav class="health-check-tabs-wrapper hide-if-no-js" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>">
    56 	<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">
    57 		<a href="<?php echo esc_url( admin_url( 'site-health.php' ) ); ?>" class="health-check-tab active" aria-current="true">
    55 			<?php
    58 			<?php
    56 			/* translators: tab heading for Site Health Status page */
    59 			/* translators: Tab heading for Site Health Status page. */
    57 			_ex( 'Status', 'Site Health' );
    60 			_ex( 'Status', 'Site Health' );
    58 			?>
    61 			?>
    59 		</a>
    62 		</a>
    60 
    63 
    61 		<a href="<?php echo esc_url( admin_url( 'site-health.php?tab=debug' ) ); ?>" class="health-check-tab">
    64 		<a href="<?php echo esc_url( admin_url( 'site-health.php?tab=debug' ) ); ?>" class="health-check-tab">
    62 			<?php
    65 			<?php
    63 			/* translators: tab heading for Site Health Info page */
    66 			/* translators: Tab heading for Site Health Info page. */
    64 			_ex( 'Info', 'Site Health' );
    67 			_ex( 'Info', 'Site Health' );
    65 			?>
    68 			?>
    66 		</a>
    69 		</a>
    67 	</nav>
    70 	</nav>
    68 </div>
    71 </div>
    96 		<p><?php _e( 'The site health check shows critical information about your WordPress configuration and items that require your attention.' ); ?></p>
    99 		<p><?php _e( 'The site health check shows critical information about your WordPress configuration and items that require your attention.' ); ?></p>
    97 
   100 
    98 		<div class="site-health-issues-wrapper" id="health-check-issues-critical">
   101 		<div class="site-health-issues-wrapper" id="health-check-issues-critical">
    99 			<h3 class="site-health-issue-count-title">
   102 			<h3 class="site-health-issue-count-title">
   100 				<?php
   103 				<?php
   101 					/* translators: %s: number of critical issues found */
   104 					/* translators: %s: Number of critical issues found. */
   102 					printf( _n( '%s Critical issue', '%s Critical issues', 0 ), '<span class="issue-count">0</span>' );
   105 					printf( _n( '%s critical issue', '%s critical issues', 0 ), '<span class="issue-count">0</span>' );
   103 				?>
   106 				?>
   104 			</h3>
   107 			</h3>
   105 
   108 
   106 			<div id="health-check-site-status-critical" class="health-check-accordion issues"></div>
   109 			<div id="health-check-site-status-critical" class="health-check-accordion issues"></div>
   107 		</div>
   110 		</div>
   108 
   111 
   109 		<div class="site-health-issues-wrapper" id="health-check-issues-recommended">
   112 		<div class="site-health-issues-wrapper" id="health-check-issues-recommended">
   110 			<h3 class="site-health-issue-count-title">
   113 			<h3 class="site-health-issue-count-title">
   111 				<?php
   114 				<?php
   112 					/* translators: %s: number of recommended improvements */
   115 					/* translators: %s: Number of recommended improvements. */
   113 					printf( _n( '%s Recommended improvement', '%s Recommended improvements', 0 ), '<span class="issue-count">0</span>' );
   116 					printf( _n( '%s recommended improvement', '%s recommended improvements', 0 ), '<span class="issue-count">0</span>' );
   114 				?>
   117 				?>
   115 			</h3>
   118 			</h3>
   116 
   119 
   117 			<div id="health-check-site-status-recommended" class="health-check-accordion issues"></div>
   120 			<div id="health-check-site-status-recommended" class="health-check-accordion issues"></div>
   118 		</div>
   121 		</div>
   126 	</div>
   129 	</div>
   127 
   130 
   128 	<div class="site-health-issues-wrapper hidden" id="health-check-issues-good">
   131 	<div class="site-health-issues-wrapper hidden" id="health-check-issues-good">
   129 		<h3 class="site-health-issue-count-title">
   132 		<h3 class="site-health-issue-count-title">
   130 			<?php
   133 			<?php
   131 				/* translators: %s: number of items with no issues */
   134 				/* 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>' );
   135 				printf( _n( '%s item with no issues detected', '%s items with no issues detected', 0 ), '<span class="issue-count">0</span>' );
   133 			?>
   136 			?>
   134 		</h3>
   137 		</h3>
   135 
   138 
   136 		<div id="health-check-site-status-good" class="health-check-accordion issues"></div>
   139 		<div id="health-check-site-status-good" class="health-check-accordion issues"></div>
   137 	</div>
   140 	</div>
   145 			<span class="icon"></span>
   148 			<span class="icon"></span>
   146 		</button>
   149 		</button>
   147 	</h4>
   150 	</h4>
   148 	<div id="health-check-accordion-block-{{ data.test }}" class="health-check-accordion-panel" hidden="hidden">
   151 	<div id="health-check-accordion-block-{{ data.test }}" class="health-check-accordion-panel" hidden="hidden">
   149 		{{{ data.description }}}
   152 		{{{ data.description }}}
   150 		<div class="actions">
   153 		<# if ( data.actions ) { #>
   151 			<p class="button-container">{{{ data.actions }}}</p>
   154 			<div class="actions">
   152 		</div>
   155 				{{{ data.actions }}}
       
   156 			</div>
       
   157 		<# } #>
   153 	</div>
   158 	</div>
   154 </script>
   159 </script>
   155 
   160 
   156 <?php
   161 <?php
   157 include( ABSPATH . 'wp-admin/admin-footer.php' );
   162 require_once ABSPATH . 'wp-admin/admin-footer.php';