PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.2
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.2
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 / builders / indexable-date-archive-builder.php

indexable-date-archive-builder.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.2, at src/builders/indexable-date-archive-builder.php

66 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yoast\WP\SEO\Builders;
4
5 use Yoast\WP\SEO\Helpers\Options_Helper;
6 use Yoast\WP\SEO\Models\Indexable;
7 use Yoast\WP\SEO\Values\Indexables\Indexable_Builder_Versions;
8
9 /**
10 * Date Archive Builder for the indexables.
11 *
12 * Formats the date archive meta to indexable format.
13 *
14 * @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded
15 */
16 class Indexable_Date_Archive_Builder {
17
18 /**
19 * The options helper.
20 *
21 * @var Options_Helper
22 */
23 private $options;
24
25 /**
26 * The latest version of the Indexable_Date_Archive_Builder.
27 *
28 * @var int
29 */
30 protected $version;
31
32 /**
33 * Indexable_Date_Archive_Builder constructor.
34 *
35 * @param Options_Helper $options The options helper.
36 * @param Indexable_Builder_Versions $versions The latest version for all indexable builders.
37 */
38 public function __construct(
39 Options_Helper $options,
40 Indexable_Builder_Versions $versions
41 ) {
42 $this->options = $options;
43 $this->version = $versions->get_latest_version_for_type( 'date-archive' );
44 }
45
46 /**
47 * Formats the data.
48 *
49 * @param Indexable $indexable The indexable to format.
50 *
51 * @return Indexable The extended indexable.
52 */
53 public function build( $indexable ) {
54 $indexable->object_type = 'date-archive';
55 $indexable->title = $this->options->get( 'title-archive-wpseo' );
56 $indexable->description = $this->options->get( 'metadesc-archive-wpseo' );
57 $indexable->is_robots_noindex = $this->options->get( 'noindex-archive-wpseo' );
58 $indexable->is_public = ( (int) $indexable->is_robots_noindex !== 1 );
59 $indexable->blog_id = \get_current_blog_id();
60 $indexable->permalink = null;
61 $indexable->version = $this->version;
62
63 return $indexable;
64 }
65 }
66