PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.6
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.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 19.0 All 129 releases
wordpress-seo / src / deprecated / frontend / schema / class-schema-image.php

class-schema-image.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.6, at src/deprecated/frontend/schema/class-schema-image.php

89 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPSEO plugin file.
4 *
5 * @package WPSEO\Frontend\Schema
6 */
7
8 /**
9 * Returns schema image data.
10 *
11 * @since 11.1
12 *
13 * @deprecated 14.0
14 *
15 * @property string $schema_id The `@id` to use for the returned image.
16 * @property array $data The ImageObject Schema array.
17 * @property int $attachment_id The ID of the attachment used to generate the object.
18 */
19 class WPSEO_Schema_Image {
20
21 /**
22 * Value to use as the image id.
23 *
24 * @var string
25 */
26 private $schema_id;
27
28 /**
29 * WPSEO_Schema_Image constructor.
30 *
31 * @codeCoverageIgnore
32 * @deprecated 14.0
33 *
34 * @param string $schema_id The string to use in an image's `@id`.
35 */
36 public function __construct( $schema_id ) {
37 _deprecated_function( __METHOD__, 'WPSEO 14.0', 'YoastSEO()->helpers->schema->image' );
38 $this->schema_id = $schema_id;
39 }
40
41 /**
42 * Find an image based on its URL and generate a Schema object for it.
43 *
44 * @codeCoverageIgnore
45 * @deprecated 14.0
46 *
47 * @param string $url The image URL to base our object on.
48 * @param string $caption An optional caption.
49 *
50 * @return array Schema ImageObject array.
51 */
52 public function generate_from_url( $url, $caption = '' ) {
53 _deprecated_function( __METHOD__, 'WPSEO 14.0', 'YoastSEO()->helpers->schema->image->generate_from_url' );
54 return YoastSEO()->helpers->schema->image->generate_from_url( $this->schema_id, $url, $caption );
55 }
56
57 /**
58 * Retrieve data about an image from the database and use it to generate a Schema object.
59 *
60 * @codeCoverageIgnore
61 * @deprecated 14.0
62 *
63 * @param int $attachment_id The attachment to retrieve data from.
64 * @param string $caption The caption string, if there is one.
65 *
66 * @return array Schema ImageObject array.
67 */
68 public function generate_from_attachment_id( $attachment_id, $caption = '' ) {
69 _deprecated_function( __METHOD__, 'WPSEO 14.0', 'YoastSEO()->helpers->schema->image->generate_from_attachment_id' );
70 return YoastSEO()->helpers->schema->image->generate_from_attachment_id( $this->schema_id, $attachment_id, $caption );
71 }
72
73 /**
74 * If we can't find $url in our database, we output a simple ImageObject.
75 *
76 * @codeCoverageIgnore
77 * @deprecated 14.0
78 *
79 * @param string $url The image URL.
80 * @param string $caption A caption, if set.
81 *
82 * @return array Schema ImageObject array.
83 */
84 public function simple_image_object( $url, $caption = '' ) {
85 _deprecated_function( __METHOD__, 'WPSEO 14.0', 'YoastSEO()->helpers->schema->image->simple_image_object' );
86 return YoastSEO()->helpers->schema->image->simple_image_object( $this->schema_id, $url, $caption );
87 }
88 }
89