PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 2.1.1
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v2.1.1
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-site-identity-settings.php

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

103 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 * Get site identity 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\Site_Identity_Manager;
14
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit; // Exit if accessed directly.
17 }
18
19 /**
20 * Retrieves ThinkRank site identity settings.
21 *
22 * Covers title templates, site name/description, breadcrumb configuration, and
23 * brand imagery. The robots.txt keys managed by this manager are intentionally
24 * excluded here; use the dedicated robots.txt ability for those.
25 */
26 class Get_Site_Identity_Settings extends Ability_Base {
27 /**
28 * Constructor.
29 */
30 public function __construct() {
31 $this->id = 'thinkrank/get-site-identity-settings';
32 $this->label = __( 'Get ThinkRank Site Identity Settings', 'thinkrank' );
33 $this->description = __( 'Retrieve ThinkRank site identity settings: the homepage/category/tag/author/search/archive title templates, site name and description, breadcrumb configuration, brand imagery, homepage hero, and the business details behind LocalBusiness schema. Robots.txt contents and schema toggles have their own abilities. Use update-site-identity-settings to change them.', 'thinkrank' );
34 }
35
36 /**
37 * {@inheritDoc}
38 *
39 * @return array<string, bool|float|string>
40 */
41 public function get_annotations() {
42 return [
43 'readonly' => true,
44 'destructive' => false,
45 'idempotent' => true,
46 'priority' => 1.0,
47 'openWorldHint' => false,
48 ];
49 }
50
51 /**
52 * Build the JSON schema properties for site identity settings.
53 *
54 * @return array<string, mixed>
55 */
56 private static function schema_properties() {
57 return Settings_Key_Map::site_identity();
58 }
59
60 /**
61 * {@inheritDoc}
62 *
63 * @return array<string, mixed>
64 */
65 public function get_input_schema() {
66 return [
67 'type' => 'object',
68 'additionalProperties' => false,
69 'properties' => self::empty_properties(),
70 ];
71 }
72
73 /**
74 * {@inheritDoc}
75 *
76 * @return array<string, mixed>
77 */
78 public function get_output_schema() {
79 return [
80 'type' => 'object',
81 'properties' => [
82 'settings' => [
83 'type' => 'object',
84 'properties' => self::schema_properties(),
85 ],
86 ],
87 ];
88 }
89
90 /**
91 * Execute ability.
92 *
93 * @param array<string, mixed> $input Ability input payload.
94 * @return array<string, mixed>
95 */
96 public function execute( $input ) {
97 $mgr = new Site_Identity_Manager();
98 $s = $mgr->get_settings( 'site', null );
99
100 return [ 'settings' => Settings_Key_Map::read( Settings_Key_Map::site_identity(), $s ) ];
101 }
102 }
103