PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 1.28.0
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v1.28.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 / config / schema-settings-config.php

schema-settings-config.php in ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO 1.28.0, at includes/config/schema-settings-config.php

306 lines 9.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Schema Settings Configuration
4 *
5 * Shared configuration for schema settings between frontend and backend.
6 * This eliminates duplication and ensures consistency across the application.
7 *
8 * @package ThinkRank
9 * @subpackage Config
10 * @since 1.0.0
11 */
12
13 declare(strict_types=1);
14
15 namespace ThinkRank\Config;
16
17 // Prevent direct access
18 if (!defined('ABSPATH')) {
19 exit;
20 }
21
22 /**
23 * Schema Settings Configuration Class
24 *
25 * Provides centralized schema settings configuration for both frontend and backend.
26 * Eliminates duplication between SchemaTab.js and Schema_Management_System.
27 *
28 * @since 1.0.0
29 */
30 class Schema_Settings_Config {
31
32 /**
33 * Get default schema settings
34 *
35 * @since 1.0.0
36 *
37 * @param string $context_type Context type ('site', 'post', 'page', 'product')
38 * @return array Default settings array
39 */
40 public static function get_default_settings(string $context_type = 'site'): array {
41 $defaults = [
42 // Core settings
43 'enabled' => true,
44 'auto_generate_schema' => true,
45 'enabled_schema_types' => [],
46 'validation_level' => 'moderate',
47 'rich_snippets_optimization' => true,
48 'cache_duration' => 3600, // 1 hour
49 'auto_deploy' => true,
50
51 // Basic schema settings (moved from Site Identity)
52 'organization_schema' => true,
53 'knowledge_graph' => true,
54
55 // Organization schema settings
56 'organization_name' => '',
57 'organization_type' => 'Organization',
58 'organization_logo' => '',
59 'organization_url' => '',
60 'organization_description' => '',
61 'organization_social_facebook' => '',
62 'organization_social_twitter' => '',
63 'organization_social_linkedin' => '',
64 'organization_social_instagram' => '',
65 'organization_social_youtube' => '',
66 'organization_social_pinterest' => '',
67 'organization_social_whatsapp' => '',
68 'organization_social_telegram' => '',
69 'organization_contact_type' => 'customer service',
70 'organization_contact_phone' => '',
71 'organization_contact_email' => '',
72 'organization_contact_hours' => '',
73
74 // Website schema settings
75 'website_name' => '',
76 'website_url' => '',
77 'website_description' => '',
78 'website_author' => '',
79 'website_enable_search' => true,
80 'website_search_url' => '',
81
82 // LocalBusiness schema settings
83 'business_price_range' => '',
84 'business_geo_latitude' => '',
85 'business_geo_longitude' => '',
86 'business_opening_hours' => [],
87
88 // Content schema settings (site-wide only)
89 'enable_breadcrumbs_schema' => true,
90 'enable_local_business' => false,
91
92 // Removed post/page-specific schema settings (Product, Event, Article, Software Application, HowTo, FAQ)
93 // These are now handled only at the post/page level via metabox
94
95 // Person schema settings (site-wide)
96 'person_name' => '',
97 'person_job_title' => '',
98 'person_description' => '',
99 'person_image' => '',
100 'person_url' => '',
101 'person_email' => '',
102 'person_telephone' => '',
103 'person_address' => '',
104 'person_birth_date' => '',
105 'person_nationality' => '',
106 'person_works_for' => '',
107 'person_same_as' => array(),
108
109 // Removed FAQPage schema settings (now handled at post/page level)
110 ];
111
112 // Context-specific defaults
113 switch ($context_type) {
114 case 'site':
115 $defaults['enabled_schema_types'] = ['Organization', 'LocalBusiness'];
116 $defaults['auto_deploy'] = true;
117 break;
118 case 'post':
119 $defaults['enabled_schema_types'] = ['Article', 'Person'];
120 $defaults['validation_level'] = 'strict';
121 break;
122 case 'page':
123 $defaults['enabled_schema_types'] = ['Article', 'FAQPage'];
124 $defaults['rich_snippets_optimization'] = true;
125 break;
126 case 'product':
127 $defaults['enabled_schema_types'] = ['Product'];
128 $defaults['validation_level'] = 'strict';
129 $defaults['rich_snippets_optimization'] = true;
130 break;
131 }
132
133 return $defaults;
134 }
135
136 /**
137 * Get settings schema definition
138 *
139 * @since 1.0.0
140 *
141 * @param string $context_type Context type
142 * @return array Settings schema definition
143 */
144 public static function get_settings_schema(string $context_type = 'site'): array {
145 return [
146 'enabled' => [
147 'type' => 'boolean',
148 'title' => 'Enable Schema Management',
149 'description' => 'Enable automated schema markup generation and management',
150 'default' => true
151 ],
152 'auto_generate_schema' => [
153 'type' => 'boolean',
154 'title' => 'Auto-Generate Schema',
155 'description' => 'Automatically generate schema markup based on content',
156 'default' => true
157 ],
158 'enabled_schema_types' => [
159 'type' => 'array',
160 'title' => 'Enabled Schema Types',
161 'description' => 'Select which schema types to generate',
162 'items' => [
163 'type' => 'string',
164 'enum' => self::get_supported_schema_types($context_type)
165 ],
166 'default' => []
167 ],
168 'deployment_method' => [
169 'type' => 'string',
170 'title' => 'Deployment Method',
171 'description' => 'Schema markup output format (JSON-LD)',
172 'enum' => ['json_ld'],
173 'default' => 'json_ld'
174 ],
175 'validation_level' => [
176 'type' => 'string',
177 'title' => 'Validation Level',
178 'description' => 'Schema validation strictness level',
179 'enum' => ['strict', 'moderate', 'lenient'],
180 'default' => 'moderate'
181 ],
182 'rich_snippets_optimization' => [
183 'type' => 'boolean',
184 'title' => 'Rich Snippets Optimization',
185 'description' => 'Optimize schema for rich snippets in search results',
186 'default' => true
187 ],
188 'cache_duration' => [
189 'type' => 'integer',
190 'title' => 'Cache Duration',
191 'description' => 'Schema cache duration in seconds',
192 'minimum' => 300,
193 'maximum' => 86400,
194 'default' => 3600
195 ],
196 'auto_deploy' => [
197 'type' => 'boolean',
198 'title' => 'Auto Deploy',
199 'description' => 'Automatically deploy generated schema markup',
200 'default' => true
201 ]
202 ];
203 }
204
205 /**
206 * Get supported schema types for context
207 *
208 * @since 1.0.0
209 *
210 * @param string $context_type Context type
211 * @return array Supported schema types
212 */
213 public static function get_supported_schema_types(string $context_type = 'site'): array {
214 $all_types = [
215 'Article', 'Product', 'Organization', 'LocalBusiness',
216 'Person', 'WebSite', 'FAQPage', 'SoftwareApplication',
217 'Event', 'HowTo', 'Review', 'VideoObject'
218 ];
219
220 // Context-specific filtering can be added here if needed
221 return $all_types;
222 }
223
224 /**
225 * Get validation level options
226 *
227 * @since 1.0.0
228 *
229 * @return array Validation level options
230 */
231 public static function get_validation_level_options(): array {
232 return [
233 ['value' => 'strict', 'label' => 'Strict'],
234 ['value' => 'moderate', 'label' => 'Moderate'],
235 ['value' => 'lenient', 'label' => 'Lenient']
236 ];
237 }
238
239 /**
240 * Get deployment method options
241 *
242 * @since 1.0.0
243 *
244 * @return array Deployment method options
245 */
246 public static function get_deployment_method_options(): array {
247 return [
248 ['value' => 'json_ld', 'label' => 'JSON-LD']
249 ];
250 }
251
252 /**
253 * Get boolean settings list
254 *
255 * @since 1.0.0
256 *
257 * @return array List of boolean setting keys
258 */
259 public static function get_boolean_settings(): array {
260 return [
261 'enabled',
262 'auto_generate_schema',
263 'rich_snippets_optimization',
264 'auto_deploy',
265 'organization_schema',
266 'knowledge_graph',
267 'enable_breadcrumbs_schema',
268 'enable_article_schema',
269 'enable_product_schema',
270 'enable_local_business',
271 'enable_faq_schema',
272 'enable_howto_schema'
273 ];
274 }
275
276 /**
277 * Get array settings list
278 *
279 * @since 1.0.0
280 *
281 * @return array List of array setting keys
282 */
283 public static function get_array_settings(): array {
284 return [
285 'enabled_schema_types',
286 'business_opening_hours',
287 'software_operating_systems',
288 'software_features',
289 'howto_supply'
290 ];
291 }
292
293 /**
294 * Get integer settings list
295 *
296 * @since 1.0.0
297 *
298 * @return array List of integer setting keys
299 */
300 public static function get_integer_settings(): array {
301 return [
302 'cache_duration'
303 ];
304 }
305 }
306