PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 2.10.0
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v2.10.0
2.10.0 2.9.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 All 51 releases
← All changes | includes/core/class-plan-config.php +165 -124 1.25.0 → 2.10.0 View file →
@@ -8,11 +8,10 @@
8 8 * reads from here. No feature code should check `defined('THINKRANK_PRO_VERSION')`
9 9 * or `apply_filters('thinkrank_is_pro_active', ...)` directly — call these methods
10 10 * instead so a single override flips behavior everywhere.
11 11 *
12 - * The Pro plugin attaches by filtering `thinkrank_email_report_capabilities`
13 - * (or the analogous filter for other features). It never needs to fork or
14 - * monkey-patch this file.
12 + * The Pro plugin attaches by filtering each feature's capability map. It never
13 + * needs to fork or monkey-patch this file.
15 14 *
16 15 * @package ThinkRank\Core
17 16 * @since 1.9.0
18 17 */
@@ -28,10 +27,10 @@
28 27 /**
29 28 * Plan_Config — capability registry for free/pro feature gating.
30 29 *
31 30 * Usage:
32 - * if (Plan_Config::can('custom_subject', 'email_report')) { ... }
33 - * $caps = Plan_Config::email_report();
31 + * if (Plan_Config::can('usage_policy', 'llms_txt')) { ... }
32 + * $caps = Plan_Config::llms_txt();
34 33 *
35 34 * @since 1.9.0
36 35 */
37 36 final class Plan_Config {
@@ -50,185 +49,227 @@
50 49 );
51 50 }
52 51
53 52 /**
54 - * Capability map for the Email Reporting feature.
53 + * Capability map for the llms.txt feature.
55 54 *
56 - * Returns a flat array of capability_key => bool|int|array describing
57 - * what the current plan can do. The Pro plugin filters this to enable
58 - * its capabilities.
55 + * Generating and editing llms.txt is FREE and stays free. What Pro adds is
56 + * the usage policy: the `Training:` / `Summarization:` / `Embedding:` /
57 + * `Require-Attribution:` directives that state what agents may do with the
58 + * content, rather than describing the content itself (#160 in Pro).
59 59 *
60 - * Schema (keep in sync with src/admin/config/email-report-plan.js):
61 - * - allowed_frequencies int[] Days between sends user may pick.
62 - * - max_recipients int Max addresses on the recipients field.
63 - * - recipients_locked_to string|null 'admin_email' = pre-filled & read-only.
64 - * - custom_subject bool May edit subject template.
65 - * - custom_logo bool May upload a header logo.
66 - * - logo_link bool May set a click-through URL on the logo.
67 - * - header_background bool May set a custom header background CSS.
68 - * - link_to_full_report bool May toggle the dashboard CTA at the foot.
69 - * - intro_text bool May set a custom intro paragraph.
70 - * - sections_configurable bool May enable/disable individual sections.
71 - * - footer_text bool May set a custom footer paragraph.
72 - * - additional_css bool May inject additional CSS into the email.
73 - * - ai_highlights bool May render the AI Highlights section.
60 + * Schema:
61 + * usage_policy bool May publish usage-policy directives in llms.txt.
62 + * full_document bool May publish llms-full.txt, the full-content
63 + * companion document (thinkrank-pro#171).
64 + *
65 + * @since 2.5.0
66 + *
67 + * @return array Capability map.
74 68 */
75 - public static function email_report(): array {
69 + public static function llms_txt(): array {
76 70 $defaults = [
77 - 'allowed_frequencies' => [30],
78 - 'max_recipients' => 1,
79 - 'recipients_locked_to' => 'admin_email',
80 - 'custom_subject' => false,
81 - 'custom_logo' => false,
82 - 'logo_link' => false,
83 - 'header_background' => false,
84 - 'link_to_full_report' => false,
85 - 'intro_text' => false,
86 - 'sections_configurable' => false,
87 - 'footer_text' => false,
88 - 'additional_css' => false,
89 - 'ai_highlights' => false,
71 + 'usage_policy' => false,
72 + 'full_document' => false,
90 73 ];
91 74
92 - if (self::is_pro()) {
93 - $defaults = array_merge($defaults, [
94 - 'allowed_frequencies' => [7, 15, 30],
95 - 'max_recipients' => 50,
96 - 'recipients_locked_to' => null,
97 - 'custom_subject' => true,
98 - 'custom_logo' => true,
99 - 'logo_link' => true,
100 - 'header_background' => true,
101 - 'link_to_full_report' => true,
102 - 'intro_text' => true,
103 - 'sections_configurable' => true,
104 - 'footer_text' => true,
105 - 'additional_css' => true,
106 - // ai_highlights stays false by default — it's a separate sub-feature
107 - // the Pro plugin opts in to once the AI summary integration ships.
108 - ]);
109 - }
110 -
111 75 /**
112 - * Filter the Email Reporting capability map.
76 + * Filter the llms.txt capability map.
113 77 *
114 - * The Pro plugin uses this filter (and only this filter) to enable
115 - * pro capabilities. Returning a partial array is fine; missing keys
116 - * fall back to the values above.
78 + * ThinkRank Pro sets `usage_policy` to true; nothing in the free
79 + * plugin ever does, so the directives simply never render without it.
117 80 *
118 - * @since 1.9.0
81 + * @since 2.5.0
119 82 *
120 83 * @param array $defaults Capability map (see schema above).
121 84 */
122 - $caps = apply_filters('thinkrank_email_report_capabilities', $defaults);
85 + $caps = apply_filters('thinkrank_llms_txt_capabilities', $defaults);
123 86
124 - // Defensive merge: never let a filter drop required keys.
125 87 return array_merge($defaults, is_array($caps) ? $caps : []);
126 88 }
127 89
128 90 /**
129 - * Capability map for the Focus Keywords feature.
91 + * Capability map for the Site SEO Analyzer.
130 92 *
131 - * Free allows up to 5 focus keywords; ThinkRank Pro lifts the cap. The 6th
132 - * and subsequent keywords are stored but only become usable (analyzed,
133 - * output, editable) once Pro raises the limit.
93 + * Running the audit and seeing the score is FREE and stays free. What Pro
94 + * adds is memory: dated snapshots of each run, a score trend, and a
95 + * side-by-side comparison of two runs (#161 in Pro). Free keeps exactly
96 + * what it has today — the most recent run, cached for an hour.
134 97 *
135 - * Localized to the metabox as `thinkrankMetabox.focusKeywords`.
136 98 * Schema:
137 - * - max_keywords int Usable focus keywords. 0 = unlimited (Pro).
99 + * history bool May persist and read audit snapshots.
100 + * history_runs int Snapshots retained per site (0 = unlimited).
138 101 *
139 - * @since 2.0.0
102 + * @since 2.5.0
140 103 *
141 104 * @return array Capability map.
142 105 */
143 - public static function focus_keywords(): array {
144 - // Free default. ThinkRank Pro lifts the cap by filtering the map below
145 - // (Pro owns its own limit rather than the free plugin hard-coding it).
106 + public static function seo_analyzer(): array {
146 107 $defaults = [
147 - 'max_keywords' => 5,
108 + 'history' => false,
109 + 'history_runs' => 0,
148 110 ];
149 111
150 112 /**
151 - * Filter the Focus Keywords capability map.
113 + * Filter the SEO Analyzer capability map.
152 114 *
153 - * The Pro plugin uses this filter to lift the free cap — set
154 - * `max_keywords` to 0 for unlimited, or a finite number.
115 + * ThinkRank Pro sets `history` to true and declares how many runs it
116 + * retains. Nothing in the free plugin ever does, so no snapshot is
117 + * ever written without Pro.
155 118 *
156 - * @since 2.0.0
119 + * @since 2.5.0
157 120 *
158 121 * @param array $defaults Capability map (see schema above).
159 122 */
160 - $caps = apply_filters('thinkrank_focus_keywords_capabilities', $defaults);
123 + $caps = apply_filters('thinkrank_seo_analyzer_capabilities', $defaults);
161 124
162 125 return array_merge($defaults, is_array($caps) ? $caps : []);
163 126 }
164 127
165 128 /**
166 - * Check a single capability for a given feature.
129 + * Capability map for Focus Pages.
167 130 *
168 - * Currently only the `email_report` feature is registered. Adding more
169 - * features means adding a switch case here that delegates to its own
170 - * capability builder method.
131 + * Focus Pages is Pro: it is bulk (many pages in one run), historical, and
132 + * depends on Pro-only rank data (thinkrank-pro#164). Free has no entry
133 + * point in v1 — the per-post SEO score panel already answers the single-page
134 + * on-page question.
171 135 *
172 - * @param string $capability Capability key (e.g. 'custom_subject').
173 - * @param string $feature Feature scope (default 'email_report').
136 + * Schema:
137 + * enabled bool May curate and diagnose focus pages.
138 + * max_pages int Pages that may be curated (0 = none).
139 + *
140 + * @since 2.5.0
141 + *
142 + * @return array Capability map.
174 143 */
175 - public static function can(string $capability, string $feature = 'email_report'): bool {
176 - $caps = self::capabilities_for($feature);
177 - return ! empty($caps[$capability]);
144 + public static function focus_pages(): array {
145 + $defaults = [
146 + 'enabled' => false,
147 + 'max_pages' => 0,
148 + ];
149 +
150 + /**
151 + * Filter the Focus Pages capability map.
152 + *
153 + * ThinkRank Pro enables the feature and declares its own page cap,
154 + * which bounds the external API cost of a refresh.
155 + *
156 + * @since 2.5.0
157 + *
158 + * @param array $defaults Capability map (see schema above).
159 + */
160 + $caps = apply_filters('thinkrank_focus_pages_capabilities', $defaults);
161 +
162 + return array_merge($defaults, is_array($caps) ? $caps : []);
178 163 }
179 164
180 165 /**
181 - * Get the full capability map for a feature.
166 + * Capability map for sitewide duplicate snippet detection.
182 167 *
183 - * @param string $feature Feature scope.
184 - * @return array
168 + * The check itself is Free: finding out that two of your pages carry one
169 + * title is a read, it runs when the user asks for it, and it is exactly the
170 + * kind of thing that should work on a first install (#564). What Pro adds
171 + * is the unattended half — a recheck that runs on a schedule and tells you
172 + * when a new duplicate appears, rather than when you next open the screen.
173 + *
174 + * Nothing in the free plugin schedules anything, so `scheduled` only ever
175 + * reports what Pro has arranged; the report reads it to say whether it is
176 + * being watched or only answered on demand.
177 + *
178 + * Schema:
179 + * scheduled bool Duplicates are rechecked without the user asking.
180 + *
181 + * @since 2.10.0
182 + *
183 + * @return array Capability map.
185 184 */
186 - public static function capabilities_for(string $feature): array {
187 - switch ($feature) {
188 - case 'email_report':
189 - return self::email_report();
190 - default:
191 - return [];
192 - }
185 + public static function duplicate_snippets(): array {
186 + $defaults = [
187 + 'scheduled' => false,
188 + ];
189 +
190 + /**
191 + * Filter the duplicate snippets capability map.
192 + *
193 + * @since 2.10.0
194 + *
195 + * @param array $defaults Capability map (see schema above).
196 + */
197 + $caps = apply_filters('thinkrank_duplicate_snippets_capabilities', $defaults);
198 +
199 + return array_merge($defaults, is_array($caps) ? $caps : []);
193 200 }
194 201
195 202 /**
196 - * Clamp a frequency value to one the current plan allows.
203 + * Capability map for the thin content report.
197 204 *
198 - * Free plans always end up at 30. Pro plans accept 7, 15, or 30.
199 - * Anything else falls back to the highest allowed value (most permissive
200 - * default that still respects the cap).
205 + * Finding out which of your pages are thin is a read, it runs when the user
206 + * asks for it, and it is exactly what should work on a first install, so
207 + * the report is Free (#565). What Pro adds is the unattended half: an alert
208 + * when content that was fine becomes thin, or when something thin is
209 + * published, which is the decay framing Content Refresh Radar already uses.
201 210 *
202 - * @param int $requested Requested frequency in days.
203 - * @return int Clamped frequency.
211 + * Nothing in the free plugin schedules anything, so `scheduled_alerts` only
212 + * ever reports what Pro has arranged; the report reads it to say whether it
213 + * is being watched or only answered on demand.
214 + *
215 + * Schema:
216 + * scheduled_alerts bool Newly-thin content is reported without being asked.
217 + *
218 + * @since 2.10.0
219 + *
220 + * @return array Capability map.
204 221 */
205 - public static function clamp_email_report_frequency(int $requested): int {
206 - $allowed = self::email_report()['allowed_frequencies'];
207 - if (in_array($requested, $allowed, true)) {
208 - return $requested;
209 - }
210 - return (int) max($allowed);
222 + public static function thin_content(): array {
223 + $defaults = [
224 + 'scheduled_alerts' => false,
225 + ];
226 +
227 + /**
228 + * Filter the thin content capability map.
229 + *
230 + * @since 2.10.0
231 + *
232 + * @param array $defaults Capability map (see schema above).
233 + */
234 + $caps = apply_filters('thinkrank_thin_content_capabilities', $defaults);
235 +
236 + return array_merge($defaults, is_array($caps) ? $caps : []);
211 237 }
212 238
213 239 /**
214 - * Truncate a list of recipients to the plan-allowed maximum.
240 + * Check a single capability for a given feature.
215 241 *
216 - * Used at save and at render time. The save-time call gives the user
217 - * feedback; the render-time call is a defense in depth so a downgrade
218 - * never accidentally fans a report out to a list the user no longer
219 - * has the plan for.
242 + * Adding a feature means adding a switch case to capabilities_for() that
243 + * delegates to its own capability builder method.
220 244 *
221 - * @param string[] $recipients Recipient email addresses.
222 - * @return string[] Truncated, de-duplicated recipients.
245 + * @param string $capability Capability key (e.g. 'usage_policy').
246 + * @param string $feature Feature scope (e.g. 'llms_txt').
223 247 */
224 - public static function clamp_email_report_recipients(array $recipients): array {
225 - $caps = self::email_report();
226 - $unique = array_values(array_unique(array_filter(array_map('trim', $recipients))));
248 + public static function can(string $capability, string $feature): bool {
249 + $caps = self::capabilities_for($feature);
250 + return ! empty($caps[$capability]);
251 + }
227 252
228 - if ('admin_email' === $caps['recipients_locked_to']) {
229 - return [(string) get_option('admin_email')];
253 + /**
254 + * Get the full capability map for a feature.
255 + *
256 + * @param string $feature Feature scope.
257 + * @return array
258 + */
259 + public static function capabilities_for(string $feature): array {
260 + switch ($feature) {
261 + case 'llms_txt':
262 + return self::llms_txt();
263 + case 'seo_analyzer':
264 + return self::seo_analyzer();
265 + case 'focus_pages':
266 + return self::focus_pages();
267 + case 'duplicate_snippets':
268 + return self::duplicate_snippets();
269 + case 'thin_content':
270 + return self::thin_content();
271 + default:
272 + return [];
230 273 }
231 -
232 - return array_slice($unique, 0, (int) $caps['max_recipients']);
233 274 }
234 275 }