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

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