PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 2.7.0
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v2.7.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 / links / class-get-external-links-settings.php

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

90 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Get external link settings ability.
4 *
5 * @package ThinkRank\Abilities\Links
6 */
7
8 declare(strict_types=1);
9
10 namespace ThinkRank\Abilities\Links;
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit; // Exit if accessed directly.
14 }
15
16 /**
17 * Reads the site-wide outbound-link handling settings.
18 *
19 * Mirrors `GET /thinkrank/v1/external-links/settings`. The rewrite happens at
20 * render time and never touches stored post content, so both switches are
21 * reversible — worth knowing before changing them. Read-only.
22 */
23 class Get_External_Links_Settings extends External_Links_Ability_Base {
24
25 /**
26 * Constructor.
27 */
28 public function __construct() {
29 $this->id = 'thinkrank/get-external-links-settings';
30 $this->label = __( 'Get ThinkRank External Link Settings', 'thinkrank' );
31 $this->description = __( 'Read the site-wide outbound-link settings: whether external links get rel="nofollow", whether they open in a new tab, and the list of hosts excluded from both. The rewrite is applied while the page renders and never modifies stored post content. Use update-external-links-settings to change them.', 'thinkrank' );
32 }
33
34 /**
35 * {@inheritDoc}
36 *
37 * @return array<string, bool|float|string>
38 */
39 public function get_annotations() {
40 return [
41 'readonly' => true,
42 'destructive' => false,
43 'idempotent' => true,
44 'priority' => 1.0,
45 'openWorldHint' => false,
46 ];
47 }
48
49 /**
50 * {@inheritDoc}
51 *
52 * @return array<string, mixed>
53 */
54 public function get_input_schema() {
55 return [
56 'type' => 'object',
57 'additionalProperties' => false,
58 'properties' => self::empty_properties(),
59 ];
60 }
61
62 /**
63 * {@inheritDoc}
64 *
65 * @return array<string, mixed>
66 */
67 public function get_output_schema() {
68 return [
69 'type' => 'object',
70 'properties' => $this->settings_properties(),
71 ];
72 }
73
74 /**
75 * Execute ability.
76 *
77 * @param array<string, mixed> $input Ability input payload.
78 * @return array<string, mixed>
79 */
80 public function execute( $input ) {
81 $settings = $this->stored();
82
83 return [
84 'nofollow_external' => (bool) ( $settings['nofollow_external'] ?? false ),
85 'open_external_in_new_tab' => (bool) ( $settings['open_external_in_new_tab'] ?? false ),
86 'external_link_exceptions' => $settings['external_link_exceptions'],
87 ];
88 }
89 }
90