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

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

61 lines 1.6 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 class Indexable_Date_Archive_Builder {
15
16 /**
17 * The options helper.
18 *
19 * @var Options_Helper
20 */
21 private $options;
22
23 /**
24 * The latest version of the Indexable_Date_Archive_Builder.
25 *
26 * @var int
27 */
28 protected $version;
29
30 /**
31 * Indexable_Date_Archive_Builder constructor.
32 *
33 * @param Options_Helper $options The options helper.
34 * @param Indexable_Builder_Versions $versions The latest version for all indexable builders.
35 */
36 public function __construct( Options_Helper $options, Indexable_Builder_Versions $versions ) {
37 $this->options = $options;
38 $this->version = $versions->get_latest_version_for_type( 'date-archive' );
39 }
40
41 /**
42 * Formats the data.
43 *
44 * @param Indexable $indexable The indexable to format.
45 *
46 * @return Indexable The extended indexable.
47 */
48 public function build( $indexable ) {
49 $indexable->object_type = 'date-archive';
50 $indexable->title = $this->options->get( 'title-archive-wpseo' );
51 $indexable->description = $this->options->get( 'metadesc-archive-wpseo' );
52 $indexable->is_robots_noindex = $this->options->get( 'noindex-archive-wpseo' );
53 $indexable->is_public = ( (int) $indexable->is_robots_noindex !== 1 );
54 $indexable->blog_id = \get_current_blog_id();
55 $indexable->permalink = null;
56 $indexable->version = $this->version;
57
58 return $indexable;
59 }
60 }
61