PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.6 28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 All 130 releases
← All changes | src/services/health-check/health-check.php +20 -14 18.3 → trunk View file →
@@ -9,9 +9,9 @@
9 9
10 10 /**
11 11 * The prefix to add to the test identifier. Used to differentiate between Yoast's health checks, and other health checks.
12 12 */
13 - const TEST_IDENTIFIER_PREFIX = 'yoast-';
13 + public const TEST_IDENTIFIER_PREFIX = 'yoast-';
14 14
15 15 /**
16 16 * The object that runs the actual health check.
17 17 *
@@ -34,25 +34,24 @@
34 34 *
35 35 * @return string The identifier that WordPress requires.
36 36 */
37 37 public function get_test_identifier() {
38 - $class_name_with_namespace = get_class( $this );
39 - $class_name_index = ( strrpos( $class_name_with_namespace, '\\' ) + 1 );
40 - $class_name = substr( $class_name_with_namespace, $class_name_index );
41 - $lowercase = strtolower( $class_name );
42 - $whitespace_as_dashes = str_replace( '_', '-', $lowercase );
43 - $with_prefix = self::TEST_IDENTIFIER_PREFIX . $whitespace_as_dashes;
38 + $full_class_name = static::class;
39 + $class_name_backslash_index = \strrpos( $full_class_name, '\\' );
40 +
41 + $class_name = $full_class_name;
42 + if ( $class_name_backslash_index ) {
43 + $class_name_index = ( $class_name_backslash_index + 1 );
44 + $class_name = \substr( $full_class_name, $class_name_index );
45 + }
46 +
47 + $lowercase = \strtolower( $class_name );
48 + $whitespace_as_dashes = \str_replace( '_', '-', $lowercase );
49 + $with_prefix = self::TEST_IDENTIFIER_PREFIX . $whitespace_as_dashes;
44 50 return $with_prefix;
45 51 }
46 52
47 53 /**
48 - * Returns the name of health check implementation that the user can see. WordPress needs this to manage the health check (https://developer.wordpress.org/reference/hooks/site_status_tests/).
49 - *
50 - * @return string A human-readable label for the health check.
51 - */
52 - abstract public function get_test_label();
53 -
54 - /**
55 54 * Runs the health check, and returns its result in the format that WordPress requires to show the results to the user (https://developer.wordpress.org/reference/hooks/site_status_test_result/).
56 55 *
57 56 * @return string[] The array containing a WordPress site status report.
58 57 */
@@ -66,5 +65,12 @@
66 65 *
67 66 * @return string[] The array containing a WordPress site status report.
68 67 */
69 68 abstract protected function get_result();
69 +
70 + /**
71 + * Returns whether the health check should be excluded from the results.
72 + *
73 + * @return bool Whether the check should be excluded.
74 + */
75 + abstract public function is_excluded();
70 76 }