diff --git a/src/js/_enqueues/admin/site-health.js b/src/js/_enqueues/admin/site-health.js
index 1a31be1b5e..54786dce6f 100644
|
a
|
b
|
|
| 8 | 8 | |
| 9 | 9 | jQuery( document ).ready( function( $ ) { |
| 10 | 10 | |
| | 11 | var __ = wp.i18n.__, |
| | 12 | _n = wp.i18n._n, |
| | 13 | sprintf = wp.i18n.sprintf; |
| | 14 | |
| 11 | 15 | var data; |
| 12 | 16 | |
| 13 | 17 | var clipboard = new ClipboardJS( '.site-health-copy-buttons .copy-button' ); |
| … |
… |
jQuery( document ).ready( function( $ ) { |
| 17 | 21 | var $wrapper = $( e.trigger ).closest( 'div' ); |
| 18 | 22 | $( '.success', $wrapper ).addClass( 'visible' ); |
| 19 | 23 | |
| 20 | | wp.a11y.speak( SiteHealth.string.site_info_copied ); |
| | 24 | wp.a11y.speak( __( 'Site information has been added to your clipboard.' ) ); |
| 21 | 25 | } ); |
| 22 | 26 | |
| 23 | 27 | // Accordion handling in various areas. |
| … |
… |
jQuery( document ).ready( function( $ ) { |
| 52 | 56 | function AppendIssue( issue ) { |
| 53 | 57 | var template = wp.template( 'health-check-issue' ), |
| 54 | 58 | issueWrapper = $( '#health-check-issues-' + issue.status ), |
| 55 | | issueCounter = $( '.issue-count', issueWrapper ); |
| | 59 | headline; |
| 56 | 60 | |
| 57 | 61 | SiteHealth.site_status.issues[ issue.status ]++; |
| 58 | 62 | |
| 59 | | issueCounter.text( SiteHealth.site_status.issues[ issue.status ] ); |
| | 63 | var count = SiteHealth.site_status.issues[ issue.status ]; |
| | 64 | |
| | 65 | if ( 'critical' === issue.status ) { |
| | 66 | headline = sprintf( _n( '%s Critical issue', '%s Critical issues', count ), '<span class="issue-count">' + count + '</span>' ); |
| | 67 | } else if ( 'recommended' === issue.status ) { |
| | 68 | headline = sprintf( _n( '%s Recommended improvement', '%s Recommended improvements', count ), '<span class="issue-count">' + count + '</span>' ); |
| | 69 | } else if ( 'good' === issue.status ) { |
| | 70 | headline = sprintf( _n( '%s Item with no issues detected', '%s Items with no issues detected', count ), '<span class="issue-count">' + count + '</span>' ); |
| | 71 | } |
| | 72 | |
| | 73 | if ( headline ) { |
| | 74 | $( '> h3', issueWrapper ).html( headline ); |
| | 75 | } |
| | 76 | |
| 60 | 77 | $( '.issues', '#health-check-issues-' + issue.status ).append( template( issue ) ); |
| 61 | 78 | } |
| 62 | 79 | |
| … |
… |
jQuery( document ).ready( function( $ ) { |
| 127 | 144 | } |
| 128 | 145 | ); |
| 129 | 146 | |
| 130 | | wp.a11y.speak( SiteHealth.string.site_health_complete_screen_reader.replace( '%s', val + '%' ) ); |
| | 147 | // translators: %s: The percentage score for the tests. |
| | 148 | var text = __( 'All site health tests have finished running. Your site scored %s, and the results are now available on the page.' ); |
| | 149 | wp.a11y.speak( sprintf( text, val + '%' ) ); |
| 131 | 150 | } |
| 132 | 151 | |
| 133 | 152 | /** |
diff --git a/src/wp-admin/includes/class-wp-site-health.php b/src/wp-admin/includes/class-wp-site-health.php
index 85420f4b8d..181d48a19f 100644
|
a
|
b
|
class WP_Site_Health { |
| 46 | 46 | |
| 47 | 47 | $health_check_js_variables = array( |
| 48 | 48 | 'screen' => $screen->id, |
| 49 | | 'string' => array( |
| 50 | | 'please_wait' => __( 'Please wait...' ), |
| 51 | | 'copied' => __( 'Copied' ), |
| 52 | | 'running_tests' => __( 'Currently being tested...' ), |
| 53 | | 'site_health_complete' => __( 'All site health tests have finished running.' ), |
| 54 | | 'site_info_show_copy' => __( 'Show options for copying this information' ), |
| 55 | | 'site_info_hide_copy' => __( 'Hide options for copying this information' ), |
| 56 | | // translators: %s: The percentage score for the tests. |
| 57 | | 'site_health_complete_screen_reader' => __( 'All site health tests have finished running. Your site scored %s, and the results are now available on the page.' ), |
| 58 | | 'site_info_copied' => __( 'Site information has been added to your clipboard.' ), |
| 59 | | ), |
| 60 | 49 | 'nonce' => array( |
| 61 | 50 | 'site_status' => wp_create_nonce( 'health-check-site-status' ), |
| 62 | 51 | 'site_status_result' => wp_create_nonce( 'health-check-site-status-result' ), |
diff --git a/src/wp-admin/site-health-info.php b/src/wp-admin/site-health-info.php
index 1ab31f64af..1d26329909 100644
|
a
|
b
|
require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
| 87 | 87 | <div class="site-health-copy-buttons"> |
| 88 | 88 | <div class="copy-button-wrapper"> |
| 89 | 89 | <button type="button" class="button button-primary copy-button" data-clipboard-text="<?php echo esc_attr( WP_Debug_Data::format( $info, 'text' ) ); ?>"><?php _e( 'Copy site info to clipboard' ); ?></button> |
| 90 | | <span class="success" aria-hidden="true">Copied!</span> |
| | 90 | <span class="success" aria-hidden="true"><?php _e( 'Copied!' ); ?></span> |
| 91 | 91 | </div> |
| 92 | 92 | <?php if ( $english_info ) : ?> |
| 93 | 93 | <div class="copy-button-wrapper"> |
| 94 | 94 | <button type="button" class="button copy-button" data-clipboard-text="<?php echo esc_attr( WP_Debug_Data::format( $english_info, 'text' ) ); ?>"><?php _e( 'Copy site info to clipboard (English)' ); ?></button> |
| 95 | | <span class="success" aria-hidden="true">Copied!</span> |
| | 95 | <span class="success" aria-hidden="true"><?php _e( 'Copied!' ) ?></span> |
| 96 | 96 | </div> |
| 97 | 97 | <?php endif; ?> |
| 98 | 98 | </div> |
diff --git a/src/wp-admin/site-health.php b/src/wp-admin/site-health.php
index cc4543e436..7941887ab1 100644
|
a
|
b
|
require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
| 91 | 91 | |
| 92 | 92 | <div class="site-health-issues-wrapper" id="health-check-issues-critical"> |
| 93 | 93 | <h3> |
| 94 | | <span class="issue-count">0</span> <?php _e( 'Critical issues' ); ?> |
| | 94 | <span class="issue-count">0</span> <?php echo _n( 'Critical issue', 'Critical issues', 0 ); ?> |
| 95 | 95 | </h3> |
| 96 | 96 | |
| 97 | 97 | <div id="health-check-site-status-critical" class="health-check-accordion issues"></div> |
| … |
… |
require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
| 99 | 99 | |
| 100 | 100 | <div class="site-health-issues-wrapper" id="health-check-issues-recommended"> |
| 101 | 101 | <h3> |
| 102 | | <span class="issue-count">0</span> <?php _e( 'Recommended improvements' ); ?> |
| | 102 | <span class="issue-count">0</span> <?php echo _n( 'Recommended improvement', 'Recommended improvements', 0 ); ?> |
| 103 | 103 | </h3> |
| 104 | 104 | |
| 105 | 105 | <div id="health-check-site-status-recommended" class="health-check-accordion issues"></div> |
diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
index 3a3f57eded..ada3af1064 100644
|
a
|
b
|
function wp_default_scripts( &$scripts ) { |
| 1690 | 1690 | ) |
| 1691 | 1691 | ); |
| 1692 | 1692 | |
| 1693 | | $scripts->add( 'site-health', "/wp-admin/js/site-health$suffix.js", array( 'clipboard', 'jquery', 'wp-util', 'wp-a11y' ), false, 1 ); |
| | 1693 | $scripts->add( 'site-health', "/wp-admin/js/site-health$suffix.js", array( 'clipboard', 'jquery', 'wp-util', 'wp-a11y', 'wp-i18n' ), false, 1 ); |
| 1694 | 1694 | |
| 1695 | 1695 | $scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y' ), false, 1 ); |
| 1696 | 1696 | did_action( 'init' ) && $scripts->localize( |