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.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 19.0 All 129 releases
← All changes | src/integrations/admin/health-check-integration.php +9 -6 18.1 → trunk View file →
@@ -1,11 +1,11 @@
1 1 <?php
2 2
3 3 namespace Yoast\WP\SEO\Integrations\Admin;
4 4
5 +use Yoast\WP\SEO\Conditionals\Admin_Conditional;
5 6 use Yoast\WP\SEO\Integrations\Integration_Interface;
6 7 use Yoast\WP\SEO\Services\Health_Check\Health_Check;
7 -use Yoast\WP\SEO\Conditionals\Admin_Conditional;
8 8
9 9 /**
10 10 * Integrates health checks with WordPress' Site Health.
11 11 */
@@ -21,9 +21,8 @@
21 21 /**
22 22 * Uses the dependency injection container to obtain all available implementations of the Health_Check interface.
23 23 *
24 24 * @param Health_Check ...$health_checks The available health checks implementations.
25 - * @return void
26 25 */
27 26 public function __construct( Health_Check ...$health_checks ) {
28 27 $this->health_checks = $health_checks;
29 28 }
@@ -33,9 +32,9 @@
33 32 *
34 33 * @return void
35 34 */
36 35 public function register_hooks() {
37 - add_filter( 'site_status_tests', [ $this, 'add_health_checks' ] );
36 + \add_filter( 'site_status_tests', [ $this, 'add_health_checks' ] );
38 37 }
39 38
40 39 /**
41 40 * Returns the conditionals based on which this loadable should be active.
@@ -68,17 +67,17 @@
68 67 * @param mixed $tests Array to check.
69 68 * @return bool Returns true if the input array is a WordPress site status tests array.
70 69 */
71 70 private function is_valid_site_status_tests_array( $tests ) {
72 - if ( ! is_array( $tests ) ) {
71 + if ( ! \is_array( $tests ) ) {
73 72 return false;
74 73 }
75 74
76 - if ( ! array_key_exists( 'direct', $tests ) ) {
75 + if ( ! \array_key_exists( 'direct', $tests ) ) {
77 76 return false;
78 77 }
79 78
80 - if ( ! is_array( $tests['direct'] ) ) {
79 + if ( ! \is_array( $tests['direct'] ) ) {
81 80 return false;
82 81 }
83 82
84 83 return true;
@@ -91,8 +90,12 @@
91 90 * @return string[] Array containing WordPress site status tests with Yoast's health checks.
92 91 */
93 92 private function add_health_checks_to_site_status_tests( $tests ) {
94 93 foreach ( $this->health_checks as $health_check ) {
94 + if ( $health_check->is_excluded() ) {
95 + continue;
96 + }
97 +
95 98 $tests['direct'][ $health_check->get_test_identifier() ] = [
96 99 'test' => [ $health_check, 'run_and_get_result' ],
97 100 ];
98 101 }