PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 2.8.0
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v2.8.0
2.8.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 All 49 releases
← All changes | includes/abilities/settings/class-get-email-report-settings.php +24 -30 2.0.02.8.0 View file →
@@ -9,9 +9,8 @@
9 9
10 10 namespace ThinkRank\Abilities\Settings;
11 11
12 12 use ThinkRank\Abilities\Ability_Base;
13 -use ThinkRank\Core\Plan_Config;
14 13 use ThinkRank\SEO\Email_Report_Manager;
15 14
16 15 if ( ! defined( 'ABSPATH' ) ) {
17 16 exit; // Exit if accessed directly.
@@ -19,13 +18,12 @@
19 18
20 19 /**
21 20 * Retrieves ThinkRank Email Reporting settings.
22 21 *
23 - * Mirrors `GET /thinkrank/v1/email-report/config`: returns the per-site report
24 - * config (enable toggle, frequency, recipients, branding/content fields), the
25 - * plan capability map (which fields are editable on the current plan), the next
26 - * scheduled run, the available report sections, and the tokens usable in text
27 - * fields. Read-only.
22 + * Mirrors `GET /thinkrank/v1/email-report/config`: returns the resolved report
23 + * config (on/off, frequency, recipients, enabled sections, why the last
24 + * scheduled run sent nothing), the next scheduled run, the section catalog
25 + * and the readiness of the data sources. Read-only.
28 26 */
29 27 class Get_Email_Report_Settings extends Ability_Base {
30 28 /**
31 29 * Constructor.
@@ -32,9 +30,9 @@
32 30 */
33 31 public function __construct() {
34 32 $this->id = 'thinkrank/get-email-report-settings';
35 33 $this->label = __( 'Get ThinkRank Email Report Settings', 'thinkrank' );
36 - $this->description = __( 'Retrieve ThinkRank Email Reporting settings: enable toggle, frequency, recipients, branding/content fields, the plan capability map, the next scheduled send, the available report sections, and the tokens usable in text fields.', 'thinkrank' );
34 + $this->description = __( 'Retrieve ThinkRank Email Reporting settings: whether the scheduled SEO report is on, how often it is sent (days), who receives it, which sections it includes, the next scheduled send, the section catalog, and readiness — whether Google Search Console is connected (required; scheduled reports are paused and config.last_skip says why while it is not), and whether Google Analytics 4 and AI-assistant traffic data are available to add their sections. Use update-email-report-settings to switch it on or off, and send-email-report-test to send one now.', 'thinkrank' );
37 35 }
38 36
39 37 /**
40 38 * {@inheritDoc}
@@ -59,9 +57,9 @@
59 57 public function get_input_schema() {
60 58 return [
61 59 'type' => 'object',
62 60 'additionalProperties' => false,
63 - 'properties' => [],
61 + 'properties' => self::empty_properties(),
64 62 ];
65 63 }
66 64
67 65 /**
@@ -72,31 +70,32 @@
72 70 public function get_output_schema() {
73 71 return [
74 72 'type' => 'object',
75 73 'properties' => [
76 - 'config' => [
74 + 'config' => [
77 75 'type' => 'object',
78 - 'description' => __( 'The current per-site Email Reporting config.', 'thinkrank' ),
76 + 'description' => __( 'The resolved Email Reporting config: enabled, frequency_days, recipients, sections_enabled, the schedule timestamps, and last_skip ({reason, at} or null) — why the last scheduled run sent nothing: search_console_not_connected or no_data.', 'thinkrank' ),
79 77 'additionalProperties' => true,
80 78 ],
81 - 'capabilities' => [
82 - 'type' => 'object',
83 - 'description' => __( 'Which fields the current plan allows editing.', 'thinkrank' ),
84 - 'additionalProperties' => true,
79 + 'readiness' => [
80 + 'type' => 'object',
81 + 'description' => __( 'Data-source readiness: ready (bool — a report can be built), search_console (bool, required), analytics (bool — Google Analytics 4 connected, adds the site-traffic section), ai_traffic (bool — AI-assistant referrals recorded, adds that section), reason (string|null — search_console_not_connected when not ready).', 'thinkrank' ),
82 + 'properties' => [
83 + 'ready' => [ 'type' => 'boolean' ],
84 + 'search_console' => [ 'type' => 'boolean' ],
85 + 'analytics' => [ 'type' => 'boolean' ],
86 + 'ai_traffic' => [ 'type' => 'boolean' ],
87 + 'reason' => [ 'type' => [ 'string', 'null' ] ],
88 + ],
85 89 ],
86 - 'next_run' => [
90 + 'next_run' => [
87 91 'type' => [ 'string', 'null' ],
88 92 'description' => __( 'ISO-8601 timestamp of the next scheduled report, or null when disabled.', 'thinkrank' ),
89 93 ],
90 - 'sections' => [
94 + 'sections' => [
91 95 'type' => 'array',
92 96 'description' => __( 'The available report sections and their labels.', 'thinkrank' ),
93 97 ],
94 - 'tokens' => [
95 - 'type' => 'object',
96 - 'description' => __( 'Tokens usable in subject/intro/footer text.', 'thinkrank' ),
97 - 'additionalProperties' => true,
98 - ],
99 98 ],
100 99 ];
101 100 }
102 101
@@ -116,18 +115,13 @@
116 115 [ 'status' => 500 ]
117 116 );
118 117 }
119 118
120 - if ( ! function_exists( 'thinkrank_get_email_report_tokens' ) ) {
121 - require_once THINKRANK_PLUGIN_DIR . 'includes/config/email-report-settings-config.php';
122 - }
123 -
124 119 return [
125 - 'config' => $manager->config()->get(),
126 - 'capabilities' => Plan_Config::email_report(),
127 - 'next_run' => $manager->scheduler()->next_run_iso(),
128 - 'sections' => $manager->registry()->describe_for_ui(),
129 - 'tokens' => thinkrank_get_email_report_tokens(),
120 + 'config' => $manager->config()->get(),
121 + 'next_run' => $manager->scheduler()->next_run_iso(),
122 + 'sections' => $manager->registry()->describe_for_ui(),
123 + 'readiness' => $manager->data_provider()->readiness(),
130 124 ];
131 125 }
132 126
133 127 /**