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 | inc/class-wpseo-content-images.php +9 -10 18.7 → trunk View file →
@@ -12,10 +12,10 @@
12 12
13 13 /**
14 14 * Retrieves images from the post content.
15 15 *
16 - * @param int $post_id The post ID.
17 - * @param \WP_Post|null $post The post object.
16 + * @param int $post_id The post ID.
17 + * @param WP_Post|null $post The post object.
18 18 *
19 19 * @return array An array of images found in this post.
20 20 */
21 21 public function get_images( $post_id, $post = null ) {
@@ -34,13 +34,13 @@
34 34 return [];
35 35 }
36 36
37 37 $content_images = $this->get_img_tags_from_content( $content );
38 - $images = array_map( [ $this, 'get_img_tag_source' ], $content_images );
39 - $images = array_filter( $images );
40 - $images = array_unique( $images );
41 - $images = array_values( $images ); // Reset the array keys.
42 38
39 + $images = array_map( [ $this, 'get_img_tag_source' ], $content_images );
40 + $images = array_filter( $images );
41 + $images = array_unique( $images );
42 + $images = array_values( $images ); // Reset the array keys.
43 43 return $images;
44 44 }
45 45
46 46 /**
@@ -86,11 +86,9 @@
86 86 *
87 87 * @return string The content of the supplied post.
88 88 */
89 89 private function get_post_content( $post_id, $post ) {
90 - if ( $post === null ) {
91 - $post = get_post( $post_id );
92 - }
90 + $post ??= get_post( $post_id );
93 91
94 92 if ( $post === null ) {
95 93 return '';
96 94 }
@@ -97,9 +95,10 @@
97 95
98 96 /**
99 97 * Filter: 'wpseo_pre_analysis_post_content' - Allow filtering the content before analysis.
100 98 *
101 - * @api string $post_content The Post content string.
99 + * @param string $post_content The Post content string.
100 + * @param WP_Post $post The current post.
102 101 */
103 102 $content = apply_filters( 'wpseo_pre_analysis_post_content', $post->post_content, $post );
104 103
105 104 if ( ! is_string( $content ) ) {