Skip to content

Commit

Permalink
Improve site health status messages for clarity and consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
b1ink0 committed Dec 25, 2024
1 parent e1ec10c commit 48c83a5
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions plugins/optimization-detective/site-health/rest-api/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
*/
function od_optimization_detective_rest_api_test(): array {
$result = array(
'label' => __( 'Your site has functional Optimization Detective REST API endpoint', 'optimization-detective' ),
'label' => __( 'The REST API endpoint is functional.', 'optimization-detective' ),
'status' => 'good',
'badge' => array(
'label' => __( 'Optimization Detective', 'optimization-detective' ),
'color' => 'blue',
),
'description' => sprintf(
'<p>%s</p>',
__( 'Optimization Detective can send and store URL metrics via REST API endpoint', 'optimization-detective' )
__( 'Your site can send and receive URL metrics via the REST API endpoint.', 'optimization-detective' )
),
'actions' => '',
'test' => 'optimization_detective_rest_api',
Expand All @@ -44,10 +44,10 @@ function od_optimization_detective_rest_api_test(): array {

if ( is_wp_error( $response ) ) {
$result['status'] = 'recommended';
$result['label'] = __( 'Your site encountered error accessing Optimization Detective REST API endpoint', 'optimization-detective' );
$result['label'] = __( 'Error accessing the REST API endpoint', 'optimization-detective' );
$result['description'] = sprintf(
'<p>%s</p>',
esc_html__( 'The Optimization Detective endpoint could not be reached. This might mean the REST API is disabled or blocked.', 'optimization-detective' )
esc_html__( 'There was an issue reaching the REST API endpoint. This might be due to server settings or the REST API being disabled.', 'optimization-detective' )
);
$info = array(
'error_message' => $response->get_error_message(),
Expand All @@ -73,24 +73,24 @@ function od_optimization_detective_rest_api_test(): array {
$info['available'] = true;
} elseif ( 401 === $status_code ) {
$result['status'] = 'recommended';
$result['label'] = __( 'Your site encountered unauthorized error for Optimization Detective REST API endpoint', 'optimization-detective' );
$result['label'] = __( 'Authorization should not be required to access the REST API endpoint.', 'optimization-detective' );
$result['description'] = sprintf(
'<p>%s</p>',
esc_html__( 'The REST API endpoint requires authentication. Ensure proper credentials are provided.', 'optimization-detective' )
esc_html__( 'To collect URL metrics, the REST API endpoint should be accessible without requiring authorization.', 'optimization-detective' )
);
} elseif ( 403 === $status_code ) {
$result['status'] = 'recommended';
$result['label'] = __( 'Your site encountered forbidden error for Optimization Detective REST API endpoint', 'optimization-detective' );
$result['label'] = __( 'The REST API endpoint should not be forbidden.', 'optimization-detective' );
$result['description'] = sprintf(
'<p>%s</p>',
esc_html__( 'The REST API endpoint is blocked check server or security settings.', 'optimization-detective' )
esc_html__( 'The REST API endpoint is blocked. Please review your server or security settings.', 'optimization-detective' )
);
} else {
$result['status'] = 'recommended';
$result['label'] = __( 'Your site encountered error accessing Optimization Detective REST API endpoint', 'optimization-detective' );
$result['label'] = __( 'Error accessing the REST API endpoint', 'optimization-detective' );
$result['description'] = sprintf(
'<p>%s</p>',
esc_html__( 'The Optimization Detective endpoint could not be reached. This might mean the REST API is disabled or blocked.', 'optimization-detective' )
esc_html__( 'There was an issue reaching the REST API endpoint. This might be due to server settings or the REST API being disabled.', 'optimization-detective' )
);
}
$info['error_message'] = $result['label'];
Expand Down

0 comments on commit 48c83a5

Please sign in to comment.