| @@ -10,15 +10,8 @@ | ||
| 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 | - /** | |
| 21 | 14 | * The base image helper. |
| 22 | 15 | * |
| 23 | 16 | * @var Base_Image_Helper |
| 24 | 17 | */ |
| @@ -28,42 +21,16 @@ | ||
| 28 | 21 | * Image_Helper constructor. |
| 29 | 22 | * |
| 30 | 23 | * @codeCoverageIgnore |
| 31 | 24 | * |
| 32 | - * @param Url_Helper $url The url helper. | |
| 25 | + * @param Url_Helper $url The url helper. Deprecated since 28.6 and no longer used. | |
| 33 | 26 | * @param Base_Image_Helper $image The image helper. |
| 34 | 27 | */ |
| 35 | - public function __construct( Url_Helper $url, Base_Image_Helper $image ) { | |
| 36 | - $this->url = $url; | |
| 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. | |
| 37 | 29 | $this->image = $image; |
| 38 | 30 | } |
| 39 | 31 | |
| 40 | 32 | /** |
| 41 | - * Determines whether the passed URL is considered valid. | |
| 42 | - * | |
| 43 | - * @param array $image The image array. | |
| 44 | - * | |
| 45 | - * @return bool Whether or not the URL is a valid image. | |
| 46 | - */ | |
| 47 | - public function is_image_url_valid( array $image ) { | |
| 48 | - if ( empty( $image['url'] ) || ! \is_string( $image['url'] ) ) { | |
| 49 | - return false; | |
| 50 | - } | |
| 51 | - | |
| 52 | - $image_extension = $this->url->get_extension_from_url( $image['url'] ); | |
| 53 | - $is_valid = $this->image->is_extension_valid( $image_extension ); | |
| 54 | - | |
| 55 | - /** | |
| 56 | - * Filter: 'wpseo_opengraph_is_valid_image_url' - Allows extra validation for an image url. | |
| 57 | - * | |
| 58 | - * @api bool - Current validation result. | |
| 59 | - * | |
| 60 | - * @param string $url The image url to validate. | |
| 61 | - */ | |
| 62 | - return (bool) \apply_filters( 'wpseo_opengraph_is_valid_image_url', $is_valid, $image['url'] ); | |
| 63 | - } | |
| 64 | - | |
| 65 | - /** | |
| 66 | 33 | * Retrieves the overridden image size value. |
| 67 | 34 | * |
| 68 | 35 | * @return string|null The image size when overriden by filter or null when not. |
| 69 | 36 | */ |
| @@ -79,9 +46,9 @@ | ||
| 79 | 46 | * Use the `wpseo_image_sizes` filter if you want to use our logic. That filter |
| 80 | 47 | * can be used to add an image size that needs to be taken into consideration |
| 81 | 48 | * within our own logic. |
| 82 | 49 | * |
| 83 | - * @api string|false $size Size string. | |
| 50 | + * @param string|false $size Size string. | |
| 84 | 51 | */ |
| 85 | 52 | return \apply_filters( 'wpseo_opengraph_image_size', null ); |
| 86 | 53 | } |
| 87 | 54 | |
| @@ -89,9 +56,9 @@ | ||
| 89 | 56 | * Retrieves the image data by a given attachment id. |
| 90 | 57 | * |
| 91 | 58 | * @param int $attachment_id The attachment id. |
| 92 | 59 | * |
| 93 | - * @return array|false The image data when found, `false` when not. | |
| 60 | + * @return array<string, string|int>|false The image data when found, `false` when not. | |
| 94 | 61 | */ |
| 95 | 62 | public function get_image_by_id( $attachment_id ) { |
| 96 | 63 | if ( ! $this->image->is_valid_attachment( $attachment_id ) ) { |
| 97 | 64 | return false; |