PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.6
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.6
28.6 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 All 130 releases
← All changes | src/helpers/open-graph/image-helper.php +39 -2 trunk → 28.6 View file →
@@ -10,8 +10,15 @@
10 10 */
11 11 class Image_Helper {
12 12
13 13 /**
14 + * The URL helper.
15 + *
16 + * @var Url_Helper
17 + */
18 + private $url;
19 +
20 + /**
14 21 * The base image helper.
15 22 *
16 23 * @var Base_Image_Helper
17 24 */
@@ -21,13 +28,43 @@
21 28 * Image_Helper constructor.
22 29 *
23 30 * @codeCoverageIgnore
24 31 *
25 - * @param Url_Helper $url The url helper. Deprecated since 28.6 and no longer used.
32 + * @param Url_Helper $url The url helper.
26 33 * @param Base_Image_Helper $image The image helper.
27 34 */
28 - public function __construct( Url_Helper $url, Base_Image_Helper $image ) { // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found, VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- $url is deprecated, kept for BC reasons.
35 + public function __construct( Url_Helper $url, Base_Image_Helper $image ) {
36 + $this->url = $url;
29 37 $this->image = $image;
38 + }
39 +
40 + /**
41 + * Determines whether the passed URL is considered valid.
42 + *
43 + * @deprecated 22.4
44 + * @codeCoverageIgnore
45 + *
46 + * @param array<array<string, string|int>> $image The image array.
47 + *
48 + * @return bool Whether or not the URL is a valid image.
49 + */
50 + public function is_image_url_valid( array $image ) {
51 + \_deprecated_function( __METHOD__, 'Yoast SEO 22.4' );
52 +
53 + if ( empty( $image['url'] ) || ! \is_string( $image['url'] ) ) {
54 + return false;
55 + }
56 +
57 + $image_extension = $this->url->get_extension_from_url( $image['url'] );
58 + $is_valid = $this->image->is_extension_valid( $image_extension );
59 +
60 + /**
61 + * Filter: 'wpseo_opengraph_is_valid_image_url' - Allows extra validation for an image url.
62 + *
63 + * @param bool $is_valid Current validation result.
64 + * @param string $url The image url to validate.
65 + */
66 + return (bool) \apply_filters( 'wpseo_opengraph_is_valid_image_url', $is_valid, $image['url'] );
30 67 }
31 68
32 69 /**
33 70 * Retrieves the overridden image size value.