PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.5
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.5
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 | admin/class-yoast-columns.php +19 -10 18.228.5 View file →
@@ -11,8 +11,10 @@
11 11 class WPSEO_Yoast_Columns implements WPSEO_WordPress_Integration {
12 12
13 13 /**
14 14 * Registers all hooks to WordPress.
15 + *
16 + * @return void
15 17 */
16 18 public function register_hooks() {
17 19 add_action( 'load-edit.php', [ $this, 'add_help_tab' ] );
18 20 }
@@ -18,8 +20,10 @@
18 20 }
19 21
20 22 /**
21 23 * Adds the help tab to the help center for current screen.
24 + *
25 + * @return void
22 26 */
23 27 public function add_help_tab() {
24 28 $link_columns_present = $this->display_links();
25 29 $meta_columns_present = $this->display_meta_columns();
@@ -29,9 +33,9 @@
29 33
30 34 $help_tab_content = sprintf(
31 35 /* translators: %1$s: Yoast SEO */
32 36 __( '%1$s adds several columns to this page.', 'wordpress-seo' ),
33 - 'Yoast SEO'
37 + 'Yoast SEO',
34 38 );
35 39
36 40 if ( $meta_columns_present ) {
37 41 $help_tab_content .= ' ' . sprintf(
@@ -37,9 +41,9 @@
37 41 $help_tab_content .= ' ' . sprintf(
38 42 /* translators: %1$s: Link to article about content analysis, %2$s: Anchor closing */
39 43 __( 'We\'ve written an article about %1$show to use the SEO score and Readability score%2$s.', 'wordpress-seo' ),
40 44 '<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/16p' ) . '">',
41 - '</a>'
45 + '</a>',
42 46 );
43 47 }
44 48
45 49 if ( $link_columns_present ) {
@@ -48,9 +52,9 @@
48 52 __( 'The links columns show the number of articles on this site linking %3$sto%4$s this article and the number of URLs linked %3$sfrom%4$s this article. Learn more about %1$show to use these features to improve your internal linking%2$s, which greatly enhances your SEO.', 'wordpress-seo' ),
49 53 '<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/16p' ) . '">',
50 54 '</a>',
51 55 '<em>',
52 - '</em>'
56 + '</em>',
53 57 );
54 58 }
55 59
56 60 $screen = get_current_screen();
@@ -60,9 +64,9 @@
60 64 'title' => sprintf( __( '%s Columns', 'wordpress-seo' ), 'Yoast' ),
61 65 'id' => 'yst-columns',
62 66 'content' => '<p>' . $help_tab_content . '</p>',
63 67 'priority' => 15,
64 - ]
68 + ],
65 69 );
66 70 }
67 71
68 72 /**
@@ -70,19 +74,24 @@
70 74 *
71 75 * @return string The current post type.
72 76 */
73 77 private function get_current_post_type() {
74 - return filter_input( INPUT_GET, 'post_type' );
78 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
79 + if ( isset( $_GET['post_type'] ) && is_string( $_GET['post_type'] ) ) {
80 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
81 + return sanitize_text_field( wp_unslash( $_GET['post_type'] ) );
82 + }
83 + return '';
75 84 }
76 85
77 86 /**
78 - * Whether or not we are showing link columns on this overview page.
87 + * Whether we are showing link columns on this overview page.
79 88 * This depends on the post being accessible or not.
80 89 *
81 - * @return bool Whether or not the linking columns are shown
90 + * @return bool Whether the linking columns are shown
82 91 */
83 92 private function display_links() {
84 - $current_post_type = sanitize_text_field( $this->get_current_post_type() );
93 + $current_post_type = $this->get_current_post_type();
85 94
86 95 if ( empty( $current_post_type ) ) {
87 96 return false;
88 97 }
@@ -93,12 +102,12 @@
93 102 /**
94 103 * Wraps the WPSEO_Metabox check to determine whether the metabox should be displayed either by
95 104 * choice of the admin or because the post type is not a public post type.
96 105 *
97 - * @return bool Whether or not the meta box (and associated columns etc) should be hidden.
106 + * @return bool Whether the meta box (and associated columns etc) should be hidden.
98 107 */
99 108 private function display_meta_columns() {
100 - $current_post_type = sanitize_text_field( $this->get_current_post_type() );
109 + $current_post_type = $this->get_current_post_type();
101 110
102 111 if ( empty( $current_post_type ) ) {
103 112 return false;
104 113 }