PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.2
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.2
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 / page-comments-reports.php

page-comments-reports.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.2, at src/services/health-check/page-comments-reports.php

64 lines 2.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 * Presents a set of different messages for the Page_Comments health check.
7 */
8 class Page_Comments_Reports {
9
10 use Reports_Trait;
11
12 /**
13 * Constructor.
14 *
15 * @param Report_Builder_Factory $report_builder_factory The factory for result builder objects.
16 * This class uses the report builder to generate WordPress-friendly
17 * health check results.
18 */
19 public function __construct( Report_Builder_Factory $report_builder_factory ) {
20 $this->report_builder_factory = $report_builder_factory;
21 }
22
23 /**
24 * Returns the report for when comments are set to be all on one page.
25 *
26 * @return string[] The message as a WordPress site status report.
27 */
28 public function get_success_result() {
29 return $this->get_report_builder()
30 ->set_label( \esc_html__( 'Comments are displayed on a single page', 'wordpress-seo' ) )
31 ->set_status_good()
32 ->set_description( \__( 'Comments on your posts are displayed on a single page. This is just like we\'d suggest it. You\'re doing well!', 'wordpress-seo' ) )
33 ->build();
34 }
35
36 /**
37 * Returns the report for when comments are set to be broken up across multiple pages.
38 *
39 * @return string[] The message as a WordPress site status report.
40 */
41 public function get_has_comments_on_multiple_pages_result() {
42 return $this->get_report_builder()
43 ->set_label( \__( 'Comments break into multiple pages', 'wordpress-seo' ) )
44 ->set_status_recommended()
45 ->set_description( \__( 'Comments on your posts break into multiple pages. As this is not needed in 999 out of 1000 cases, we recommend you disable it. To fix this, uncheck "Break comments into pages..." on the Discussion Settings page.', 'wordpress-seo' ) )
46 ->set_actions( $this->get_has_comments_on_multiple_pages_actions() )
47 ->build();
48 }
49
50 /**
51 * Returns the actions for when the comments are set to be broken up across multiple pages.
52 *
53 * @return string The actions as a string.
54 */
55 private function get_has_comments_on_multiple_pages_actions() {
56 return \sprintf(
57 /* translators: 1: Opening tag of the link to the discussion settings page, 2: Link closing tag. */
58 \esc_html__( '%1$sGo to the Discussion Settings page%2$s', 'wordpress-seo' ),
59 '<a href="' . \esc_url( \admin_url( 'options-discussion.php' ) ) . '">',
60 '</a>',
61 );
62 }
63 }
64