PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 1.30.0
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v1.30.0
2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.1 2.1.0 2.0.2 2.0.1 2.0.0 1.32.0 1.31.0 1.30.0 1.29.0 1.28.0 1.27.0 1.26.0 1.25.0 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.10.0 All 48 releases
thinkrank / includes / abilities / settings / class-get-sitemap-settings.php

class-get-sitemap-settings.php in ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO 1.30.0, at includes/abilities/settings/class-get-sitemap-settings.php

106 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Get sitemap settings ability.
4 *
5 * @package ThinkRank\Abilities\Settings
6 */
7
8 declare(strict_types=1);
9
10 namespace ThinkRank\Abilities\Settings;
11
12 use ThinkRank\Abilities\Ability_Base;
13 use ThinkRank\SEO\Sitemap_Generator;
14
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit; // Exit if accessed directly.
17 }
18
19 /**
20 * Retrieves ThinkRank XML sitemap settings.
21 *
22 * Sitemap settings are stored via the Sitemap_Generator SEO manager and use
23 * per-type inclusion toggles plus exclusion lists.
24 */
25 class Get_Sitemap_Settings extends Ability_Base {
26 /**
27 * Constructor.
28 */
29 public function __construct() {
30 $this->id = 'thinkrank/get-sitemap-settings';
31 $this->label = __( 'Get ThinkRank Sitemap Settings', 'thinkrank' );
32 $this->description = __( 'Retrieve ThinkRank XML sitemap settings, which use per-type inclusion toggles plus exclusion lists.', 'thinkrank' );
33 }
34
35 /**
36 * {@inheritDoc}
37 *
38 * @return array<string, bool|float|string>
39 */
40 public function get_annotations() {
41 return [
42 'readonly' => true,
43 'destructive' => false,
44 'idempotent' => true,
45 'priority' => 1.0,
46 'openWorldHint' => false,
47 ];
48 }
49
50 /**
51 * {@inheritDoc}
52 *
53 * @return array<string, mixed>
54 */
55 public function get_input_schema() {
56 return [
57 'type' => 'object',
58 'additionalProperties' => false,
59 'properties' => [],
60 ];
61 }
62
63 /**
64 * {@inheritDoc}
65 *
66 * @return array<string, mixed>
67 */
68 public function get_output_schema() {
69 return [
70 'type' => 'object',
71 'properties' => [
72 'enabled' => [ 'type' => 'boolean' ],
73 'include_images' => [ 'type' => 'boolean' ],
74 'include_posts' => [ 'type' => 'boolean' ],
75 'include_pages' => [ 'type' => 'boolean' ],
76 'include_categories' => [ 'type' => 'boolean' ],
77 'include_tags' => [ 'type' => 'boolean' ],
78 'exclude_posts' => [ 'type' => 'string' ],
79 'exclude_terms' => [ 'type' => 'string' ],
80 ],
81 ];
82 }
83
84 /**
85 * Execute ability.
86 *
87 * @param array<string, mixed> $input Ability input payload.
88 * @return array<string, mixed>
89 */
90 public function execute( $input ) {
91 $gen = new Sitemap_Generator();
92 $s = $gen->get_settings( 'site', null );
93
94 return [
95 'enabled' => (bool) ( $s['enabled'] ?? true ),
96 'include_images' => (bool) ( $s['include_images'] ?? true ),
97 'include_posts' => (bool) ( $s['include_posts'] ?? true ),
98 'include_pages' => (bool) ( $s['include_pages'] ?? true ),
99 'include_categories' => (bool) ( $s['include_categories'] ?? true ),
100 'include_tags' => (bool) ( $s['include_tags'] ?? true ),
101 'exclude_posts' => (string) ( $s['exclude_posts'] ?? '' ),
102 'exclude_terms' => (string) ( $s['exclude_terms'] ?? '' ),
103 ];
104 }
105 }
106