PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.9
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.9
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
wordpress-seo / src / services / health-check / postname-permalink-check.php

postname-permalink-check.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.9, at src/services/health-check/postname-permalink-check.php

64 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yoast\WP\SEO\Services\Health_Check;
4
5 /**
6 * Paasses when permalinks are set to contain the post name.
7 */
8 class Postname_Permalink_Check extends Health_Check {
9
10 /**
11 * Runs the health check.
12 *
13 * @var Postname_Permalink_Runner
14 */
15 private $runner;
16
17 /**
18 * Generates WordPress-friendly health check results.
19 *
20 * @var Postname_Permalink_Reports
21 */
22 private $reports;
23
24 /**
25 * Constructor.
26 *
27 * @param Postname_Permalink_Runner $runner The object that implements the actual health check.
28 * @param Postname_Permalink_Reports $reports The object that generates WordPress-friendly results.
29 * @return void
30 */
31 public function __construct(
32 Postname_Permalink_Runner $runner,
33 Postname_Permalink_Reports $reports
34 ) {
35 $this->runner = $runner;
36 $this->reports = $reports;
37 $this->reports->set_test_identifier( $this->get_test_identifier() );
38
39 $this->set_runner( $this->runner );
40 }
41
42 /**
43 * Returns a human-readable label for this health check.
44 *
45 * @return string The human-readable label.
46 */
47 public function get_test_label() {
48 return __( 'Postname permalink', 'wordpress-seo' );
49 }
50
51 /**
52 * Returns the WordPress-friendly health check result.
53 *
54 * @return string[] The WordPress-friendly health check result.
55 */
56 protected function get_result() {
57 if ( $this->runner->is_successful() ) {
58 return $this->reports->get_success_result();
59 }
60
61 return $this->reports->get_has_no_postname_in_permalink_result();
62 }
63 }
64