| 1 |
<?php |
| 2 |
/** |
| 3 |
* WPSEO plugin file. |
| 4 |
* |
| 5 |
* @package WPSEO\Frontend\Schema |
| 6 |
*/ |
| 7 |
|
| 8 |
use Yoast\WP\SEO\Generators\Schema\Main_Image; |
| 9 |
|
| 10 |
/** |
| 11 |
* Returns ImageObject schema data. |
| 12 |
* |
| 13 |
* @since 11.5 |
| 14 |
* @deprecated 14.0 |
| 15 |
* @codeCoverageIgnore |
| 16 |
*/ |
| 17 |
class WPSEO_Schema_MainImage extends WPSEO_Deprecated_Graph_Piece { |
| 18 |
|
| 19 |
/** |
| 20 |
* WPSEO_Schema_WebPage constructor. |
| 21 |
* |
| 22 |
* @deprecated 14.0 |
| 23 |
* @codeCoverageIgnore |
| 24 |
* |
| 25 |
* @param null $context The context. No longer used but present for BC. |
| 26 |
*/ |
| 27 |
public function __construct( $context = null ) { |
| 28 |
parent::__construct( Main_Image::class ); |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
* Gets the post's first usable content image. Null if none is available. |
| 33 |
* |
| 34 |
* @deprecated 14.0 |
| 35 |
* @codeCoverageIgnore |
| 36 |
* |
| 37 |
* @param int $post_id The post id. |
| 38 |
* |
| 39 |
* @return string|null The image URL or null if there is no image. |
| 40 |
*/ |
| 41 |
protected function get_first_usable_content_image_for_post( $post_id ) { |
| 42 |
_deprecated_function( __METHOD__, 'WPSEO 14.0' ); |
| 43 |
|
| 44 |
return WPSEO_Image_Utils::get_first_usable_content_image_for_post( $post_id ); |
| 45 |
} |
| 46 |
|
| 47 |
/** |
| 48 |
* Generates image schema from the attachment id. |
| 49 |
* |
| 50 |
* @deprecated 14.0 |
| 51 |
* @codeCoverageIgnore |
| 52 |
* |
| 53 |
* @param string $image_id The image schema id. |
| 54 |
* |
| 55 |
* @return array Schema ImageObject array. |
| 56 |
*/ |
| 57 |
protected function generate_image_schema_from_attachment_id( $image_id ) { |
| 58 |
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'YoastSEO()->helpers->schema->image->generate_from_attachment_id' ); |
| 59 |
|
| 60 |
return $this->helpers->schema->image->generate_from_attachment_id( $image_id, get_post_thumbnail_id() ); |
| 61 |
} |
| 62 |
|
| 63 |
/** |
| 64 |
* Generates image schema from the url. |
| 65 |
* |
| 66 |
* @deprecated 14.0 |
| 67 |
* @codeCoverageIgnore |
| 68 |
* |
| 69 |
* @param string $image_id The image schema id. |
| 70 |
* @param string $image_url The image URL. |
| 71 |
* |
| 72 |
* @return array Schema ImageObject array. |
| 73 |
*/ |
| 74 |
protected function generate_image_schema_from_url( $image_id, $image_url ) { |
| 75 |
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'YoastSEO()->helpers->schema->image->generate_from_url' ); |
| 76 |
|
| 77 |
return $this->helpers->schema->image->generate_from_url( $image_id, $image_url ); |
| 78 |
} |
| 79 |
} |
| 80 |
|