PluginProbe
WPSSO Core – Complete Schema Markup and Meta Tags / 22.7.0
WPSSO Core – Complete Schema Markup and Meta Tags v22.7.0
22.7.0 22.6.1 22.6.0 22.5.3 22.5.2 22.5.1 22.4.0 22.3.0 22.2.1 22.2.0 22.1.3 22.1.2 22.1.1 22.1.0 22.0.0 21.13.3 21.13.2 trunk 21.13.1
wpsso / lib / options-filters.php

options-filters.php in WPSSO Core – Complete Schema Markup and Meta Tags 22.7.0, at lib/options-filters.php

664 lines 23.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * License: GPLv3
4 * License URI: https://www.gnu.org/licenses/gpl.txt
5 * Copyright 2012-2026 Jean-Sebastien Morisset (https://wpsso.com/)
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9
10 die( 'These aren\'t the droids you\'re looking for.' );
11 }
12
13 if ( ! defined( 'WPSSO_PLUGINDIR' ) ) {
14
15 die( 'Do. Or do not. There is no try.' );
16 }
17
18 if ( ! class_exists( 'WpssoOptionsFilters' ) ) {
19
20 /*
21 * Since WPSSO Core v9.0.0.
22 */
23 class WpssoOptionsFilters {
24
25 private $p; // Wpsso class object.
26
27 /*
28 * Instantiated by WpssoOptions->__construct().
29 */
30 public function __construct( &$plugin ) {
31
32 $this->p =& $plugin;
33
34 if ( $this->p->debug->enabled ) {
35
36 $this->p->debug->mark();
37 }
38
39 $this->p->util->add_plugin_filters( $this, array(
40 'option_type' => 4,
41 ), $prio = -1000 ); // Run first.
42 }
43
44 /*
45 * Return the sanitation type for a given option key.
46 */
47 public function filter_option_type( $type, $base_key, $network, $mod ) {
48
49 if ( ! empty( $type ) ) { // Return early if we already have a type.
50
51 return $type;
52
53 } elseif ( 0 === strpos( $base_key, 'plugin_' ) ) {
54
55 switch ( $base_key ) {
56
57 case ( 0 === strpos( $base_key, 'plugin_add_' ) ? true : false ):
58 case ( 0 === strpos( $base_key, 'plugin_filter_' ) ? true : false ):
59 case ( 0 === strpos( $base_key, 'plugin_import_' ) ? true : false ):
60
61 return 'checkbox';
62
63 case 'plugin_judgeme_shop_token': // Judge.me Shop Token.
64 case 'plugin_stamped_key_public': // Stamped.io API Key Public.
65
66 return 'api_key'; // Empty or alpha-numeric (upper or lower case), plus underscores and hypens.
67
68 case 'plugin_speakable_css_csv': // Speakable CSS Selectors.
69
70 return 'csv_blank';
71
72 case 'plugin_gravatar_size': // Gravatar Image Size.
73 case 'plugin_min_shorten': // Minimum URL Length to Shorten.
74 case 'plugin_ratings_reviews_num_max': // Maximum Number of Reviews.
75 case 'plugin_ratings_reviews_months_max': // Maximum Age of Reviews.
76 case 'plugin_upscale_pct_max': // Maximum Image Upscale Percent.
77
78 return 'pos_int'; // Integer options that must be 1 or more.
79
80 case 'plugin_stamped_store_hash': // Stamped.io Store Hash.
81
82 return 'blank_num'; // Empty string or numeric.
83
84 case 'plugin_title_part_site': // Title Tag Site Prefix / Suffix.
85 case 'plugin_title_part_tagline': // Title Tag Tagline Prefix / Suffix.
86 case 'plugin_img_alt_prefix': // Content Image Alt Prefix.
87 case 'plugin_p_cap_prefix': // WP Caption Text Prefix.
88 case 'plugin_bitly_access_token': // Bitly Access Token.
89 case 'plugin_bitly_domain': // Bitly Short Domain (Optional).
90 case 'plugin_bitly_group_name': // Bitly Group Name (Optional).
91 case 'plugin_dlmyapp_api_key':
92 case 'plugin_owly_api_key':
93 case 'plugin_judgeme_shop_domain': // Judge.me Shop Domain.
94 case 'plugin_shopperapproved_site_id': // Shopper Approved Site ID.
95 case 'plugin_shopperapproved_token': // Shopper Approved API Token.
96 case 'plugin_yourls_username':
97 case 'plugin_yourls_password':
98 case 'plugin_yourls_token':
99 case ( 0 === strpos( $base_key, 'plugin_cf_' ) ? true : false ): // Value is the name of a meta key.
100 case ( 0 === strpos( $base_key, 'plugin_attr_product_' ) ? true : false ): // Value is the name of a product attribute.
101
102 return 'one_line';
103
104 case 'plugin_comment_title': // Comment Title.
105 case 'plugin_comment_reply_title': // Reply Comment Title.
106 case 'plugin_comment_review_title': // Review Comment Title.
107 case 'plugin_product_var_title': // Product Variation Title.
108 case 'plugin_feed_title': // RSS Feed Title.
109 case 'plugin_404_page_title': // 404 Page Title.
110 case 'plugin_404_page_desc': // 404 Page Description.
111 case 'plugin_no_title_text': // No Title Text.
112 case 'plugin_no_desc_text': // No Description Text.
113 case 'plugin_shortener':
114
115 return 'not_blank';
116
117 case 'plugin_yourls_api_url':
118
119 return 'url';
120 }
121
122 } elseif ( 0 === strpos( $base_key, 'product_' ) ) {
123
124 switch ( $base_key ) {
125
126 case 'product_fluid_volume_value': // Product Fluid Volume.
127 case 'product_gtin14':
128 case 'product_gtin13':
129 case 'product_gtin12':
130 case 'product_gtin8':
131 case 'product_gtin':
132 case 'product_height_value': // Product Net Height.
133 case 'product_isbn': // Product ISBN.
134 case 'product_length_value': // Product Net Len. / Depth.
135 case 'product_min_advert_price': // Product Min Advert Price.
136 case 'product_price': // Product Price.
137 case 'product_shipping_height_value': // Product Shipping Height.
138 case 'product_shipping_length_value': // Product Shipping Length.
139 case 'product_shipping_weight_value': // Product Shipping Weight.
140 case 'product_shipping_width_value': // Product Shipping Width.
141 case 'product_weight_value': // Product Net Weight.
142 case 'product_width_value': // Product Net Width.
143
144 return 'blank_num';
145
146 case 'product_award': // Product Awards.
147 case 'product_brand':
148 case 'product_color':
149 case 'product_currency': // Product Price Currency.
150 case 'product_fluid_volume_units':
151 case 'product_height_units':
152 case 'product_length_units':
153 case 'product_material':
154 case 'product_mfr_part_no': // Product MPN.
155 case 'product_pattern':
156 case 'product_retailer_part_no': // Product SKU.
157 case 'product_shipping_height_units':
158 case 'product_shipping_length_units':
159 case 'product_shipping_weight_units':
160 case 'product_shipping_width_units':
161 case 'product_size':
162 case 'product_weight_units':
163 case 'product_width_units':
164
165 return 'one_line';
166
167 case 'product_adult_type':
168 case 'product_age_group':
169 case 'product_avail':
170 case 'product_category': // Product Google Category ID.
171 case 'product_condition': // Product Condition.
172 case 'product_energy_efficiency': // Product Energy Rating.
173 case 'product_energy_efficiency_min':
174 case 'product_energy_efficiency_max':
175 case 'product_mrp': // Product Return Policy.
176 case 'product_price_type':
177 case 'product_size_group':
178 case 'product_size_system':
179 case 'product_target_gender':
180
181 return 'not_blank';
182 }
183
184 /*
185 * Optimize and check for a schema option prefix first.
186 */
187 } elseif ( 0 === strpos( $base_key, 'schema_' ) ) {
188
189 switch ( $base_key ) {
190
191 case 'schema_book_pages': // Book Pages.
192 case 'schema_reading_mins': // Est. Reading Time.
193
194 if ( empty( $mod[ 'name' ] ) ) { // Must be an interger for plugin settings (ie. no module).
195
196 return 'integer';
197 }
198
199 return 'blank_int';
200
201 case 'schema_def_product_price_valid_days': // Default Product Prices Valid For.
202
203 return 'zero_pos_int'; // Integer options that must be 0 or more.
204
205 case 'schema_howto_step_section': // How-To Step or Section (0 or 1).
206 case 'schema_recipe_instruction_section': // Recipe Instruction or Section (0 or 1).
207
208 return 'integer';
209
210 case 'schema_book_audio_duration_days': // Audiobook Duration.
211 case 'schema_book_audio_duration_hours':
212 case 'schema_book_audio_duration_mins':
213 case 'schema_book_audio_duration_secs':
214 case 'schema_book_isbn': // Book ISBN.
215 case 'schema_event_offer_price':
216 case 'schema_howto_prep_days': // How-To Preparation Time.
217 case 'schema_howto_prep_hours':
218 case 'schema_howto_prep_mins':
219 case 'schema_howto_prep_secs':
220 case 'schema_howto_total_days': // How-To Total Time.
221 case 'schema_howto_total_hours':
222 case 'schema_howto_total_mins':
223 case 'schema_howto_total_secs':
224 case 'schema_job_salary': // Job Base Salary.
225 case 'schema_movie_duration_days': // Movie Runtime.
226 case 'schema_movie_duration_hours':
227 case 'schema_movie_duration_mins':
228 case 'schema_movie_duration_secs':
229 case 'schema_recipe_cook_days': // Recipe Cooking Time.
230 case 'schema_recipe_cook_hours':
231 case 'schema_recipe_cook_mins':
232 case 'schema_recipe_cook_secs':
233 case 'schema_recipe_nutri_cal':
234 case 'schema_recipe_nutri_prot':
235 case 'schema_recipe_nutri_fib':
236 case 'schema_recipe_nutri_carb':
237 case 'schema_recipe_nutri_sugar':
238 case 'schema_recipe_nutri_sod':
239 case 'schema_recipe_nutri_fat':
240 case 'schema_recipe_nutri_sat_fat':
241 case 'schema_recipe_nutri_unsat_fat':
242 case 'schema_recipe_nutri_chol':
243 case 'schema_recipe_prep_days': // Recipe Preparation Time.
244 case 'schema_recipe_prep_hours':
245 case 'schema_recipe_prep_mins':
246 case 'schema_recipe_prep_secs':
247 case 'schema_recipe_total_days': // Recipe Total Time.
248 case 'schema_recipe_total_hours':
249 case 'schema_recipe_total_mins':
250 case 'schema_recipe_total_secs':
251 case 'schema_review_item_cw_book_isbn': // Review: Subject Book ISBN.
252
253 return 'blank_num';
254
255 case 'schema_review_rating': // Review Rating.
256 case 'schema_review_rating_min': // Review Rating "from".
257 case 'schema_review_rating_max': // Review Rating "to".
258 case 'schema_def_review_rating_min': // Default Review Rating Min.
259 case 'schema_def_review_rating_max': // Default Review Rating Max.
260
261 return 'pos_fnum1';
262
263 case 'schema_img_id':
264
265 return 'img_id';
266
267 case 'schema_award': // Creative Work Awards.
268 case 'schema_title': // Schema Name.
269 case 'schema_title_alt': // Schema Alternate Name.
270 case 'schema_title_bc': // Schema Breadcrumb Name.
271 case 'schema_book_author_name': // Book Author Name.
272 case 'schema_book_edition': // Book Edition.
273 case 'schema_desc': // Schema Description.
274 case 'schema_headline': // Headline.
275 case 'schema_text': // Full Text.
276 case 'schema_copyright_year': // Copyright Year.
277 case 'schema_event_offer_name':
278 case 'schema_howto_step': // How-To Step Name.
279 case 'schema_howto_step_text': // How-To Step Description.
280 case 'schema_howto_supply': // How-To Supplies.
281 case 'schema_howto_tool': // How-To Tools.
282 case 'schema_howto_yield': // How-To Makes.
283 case 'schema_job_title': // Job Title.
284 case 'schema_job_currency': // Job Base Salary Currency.
285 case 'schema_movie_actor_person_name': // Movie Cast Names.
286 case 'schema_movie_director_person_name': // Movie Director Names.
287 case 'schema_recipe_cook_method':
288 case 'schema_recipe_course':
289 case 'schema_recipe_cuisine':
290 case 'schema_recipe_ingredient': // Recipe Ingredients.
291 case 'schema_recipe_instruction': // Recipe Instructions.
292 case 'schema_recipe_instruction_text': // Recipe Instruction Description.
293 case 'schema_recipe_nutri_serv':
294 case 'schema_recipe_yield': // Recipe Makes.
295 case 'schema_review_rating_alt_name':
296 case 'schema_review_claim_reviewed':
297 case 'schema_review_item_name': // Review: Subject Name.
298 case 'schema_review_item_desc': // Review: Subject Description.
299 case 'schema_review_item_cw_author_name': // Review: Subject Author Name.
300 case 'schema_review_item_cw_movie_actor_person_name': // Review: Subject Movie Cast Names.
301 case 'schema_review_item_cw_movie_director_person_name': // Review: Subject Movie Director Names.
302 case 'schema_review_item_software_app_cat': // Reviews: Software App Category.
303 case 'schema_review_item_software_app_os': // Reviews: Software App Operating System.
304 case 'schema_service_offer_catalog': // Offer Catalog Name.
305 case 'schema_service_offer_catalog_text': // Offer Catalog Description.
306 case 'schema_software_app_cat': // Application Category.
307 case 'schema_software_app_os': // Operating System.
308
309 return 'one_line';
310
311 case 'schema_howto_step_anchor_id': // How-To Step Anchor ID.
312 case 'schema_recipe_instruction_anchor_id': // Recipe Instruction Anchor ID.
313
314 return 'css_id';
315
316 case 'schema_keywords_csv': // Keywords.
317
318 return 'csv_blank';
319
320 case 'schema_book_author_type': // Book Author Type.
321 case 'schema_def_article_section': // Default Article Section.
322 case 'schema_def_book_format': // Default Book Format.
323 case 'schema_def_book_author_type': // Default Book Author Type.
324 case 'schema_def_event_attendance': // Default Event Attendance.
325 case 'schema_def_event_location_id': // Default Event Venue.
326 case 'schema_def_event_performer_org_id': // Default Event Performer Organization.
327 case 'schema_def_event_performer_person_id': // Default Event Performer Person.
328 case 'schema_def_event_organizer_org_id': // Default Event Organizer Organization.
329 case 'schema_def_event_organizer_person_id': // Default Event Organizer Person.
330 case 'schema_def_event_fund_org_id': // Default Event Funder Organization.
331 case 'schema_def_event_fund_person_id': // Default Event Funder Person.
332 case 'schema_def_family_friendly': // Default Family Friendly.
333 case 'schema_def_job_hiring_org_id': // Default Job Hiring Organization.
334 case 'schema_def_job_location_id': // Default Job Location.
335 case 'schema_def_job_location_type': // Default Job Location Type.
336 case 'schema_def_product_adult_type': // Default Product Adult Type.
337 case 'schema_def_product_age_group': // Default Product Age Group.
338 case 'schema_def_product_category': // Default Product Google Category.
339 case 'schema_def_product_condition': // Default Product Condition.
340 case 'schema_def_product_energy_efficiency_min':
341 case 'schema_def_product_energy_efficiency_max':
342 case 'schema_def_product_mrp': // Default Product Return Policy.
343 case 'schema_def_product_size_system': // Default Product Size System.
344 case 'schema_def_pub_org_id': // Default Publisher Organization.
345 case 'schema_def_pub_person_id': // Default Publisher Person.
346 case 'schema_def_prov_org_id': // Default Provider Organization.
347 case 'schema_def_prov_person_id': // Default Provider Person.
348 case 'schema_def_service_prov_org_id': // Default Service Provider Organization.
349 case 'schema_def_service_prov_person_id': // Default Service Provider Person.
350 case 'schema_def_fund_org_id': // Default Funder Organization.
351 case 'schema_def_fund_person_id': // Default Funder Person.
352 case 'schema_def_review_item_type': // Default Subject Schema Type.
353 case 'schema_article_section': // Article Section.
354 case 'schema_event_lang': // Event Language.
355 case 'schema_event_location_id': // Event Venue.
356 case 'schema_event_offer_currency':
357 case 'schema_event_offer_avail':
358 case 'schema_event_performer_org_id': // Event Performer Organization.
359 case 'schema_event_performer_person_id': // Event Performer Person.
360 case 'schema_event_organizer_org_id': // Event Organizer Organization.
361 case 'schema_event_organizer_person_id': // Event Organizer Person.
362 case 'schema_event_fund_org_id': // Event Funder Organization.
363 case 'schema_event_fund_person_id': // Event Funder Person.
364 case 'schema_event_attendance': // Event Attendance.
365 case 'schema_event_status': // Event Status.
366 case 'schema_family_friendly': // Family Friendly.
367 case 'schema_job_hiring_org_id': // Hiring Organization.
368 case 'schema_job_location_id': // Job Location.
369 case 'schema_job_location_type': // Job Location Type.
370 case 'schema_job_salary_currency': // Job Base Salary Currency.
371 case 'schema_job_salary_period': // Job Base Salary per Year, Month, Week, Hour.
372 case 'schema_lang': // Language.
373 case 'schema_movie_prodco_org_id': // Production Company.
374 case 'schema_pub_org_id': // Publisher Organization.
375 case 'schema_pub_person_id': // Publisher Person.
376 case 'schema_prov_org_id': // Provider Organization.
377 case 'schema_prov_person_id': // Provider Person.
378 case 'schema_fund_org_id': // Funder Organization.
379 case 'schema_fund_person_id': // Funder Person.
380 case 'schema_review_item_type': // Review: Subject Schema Type.
381 case 'schema_review_item_cw_author_type': // Review: Subject Author Type.
382 case 'schema_service_prov_org_id': // Service Provider Organization.
383 case 'schema_service_prov_person_id': // Service Provider Person.
384 case 'schema_type': // Schema Type.
385
386 return 'not_blank';
387
388 case 'schema_img_url':
389
390 return 'img_url';
391
392 case 'schema_addl_type_url': // Microdata Type URLs.
393 case 'schema_book_author_url': // Book Author URL.
394 case 'schema_ispartof_url': // Is Part of URLs.
395 case 'schema_license_url': // License URL.
396 case 'schema_event_online_url': // Event Online URL.
397 case 'schema_review_item_url': // Review: Subject Webpage URL.
398 case 'schema_review_item_sameas_url': // Review: Subject Same-As URL.
399 case 'schema_review_item_cw_author_url': // Review: Subject Author URL.
400 case 'schema_review_claim_first_url': // First Appearance URL.
401 case 'schema_review_item_software_app_dl_url': // Reviews: Software App Download URL.
402 case 'schema_sameas_url': // Same-As URLs.
403 case 'schema_service_offer_catalog_url': // Offer Catalog URL.
404 case 'schema_software_app_dl_url': // Download URL.
405
406 return 'url';
407 }
408 }
409
410 switch ( $base_key ) {
411
412 /*
413 * The "use" value should be 'default', 'empty', or 'force'.
414 */
415 case ( preg_match( '/:use$/', $base_key ) ? true : false ):
416
417 return 'not_blank';
418
419 /*
420 * Arrays.
421 */
422 case 'opt_versions':
423
424 return 'array';
425
426 /*
427 * Optimize and check for add meta tags options first.
428 */
429 case ( 0 === strpos( $base_key, 'add_link_' ) ? true : false ):
430 case ( 0 === strpos( $base_key, 'add_meta_' ) ? true : false ):
431
432 return 'checkbox';
433
434 /*
435 * X (Twitter) usernames (prepend with an @ character).
436 */
437 case 'tc_site':
438
439 return 'at_name';
440
441 /*
442 * Empty or alpha-numeric (upper or lower case), plus underscores.
443 */
444 case 'fb_app_id': // Facebook Application ID.
445 case 'fb_app_secret':
446 case 'fb_site_verify': // Facebook Domain Verification ID.
447 case 'g_site_verify': // Google Website Verification ID.
448 case 'pin_site_verify': // Pinterest Website Verification ID.
449 case ( preg_match( '/_api_key$/', $base_key ) ? true : false ):
450
451 return 'api_key';
452
453 /*
454 * Applies sanitize_title_with_dashes().
455 */
456 case ( preg_match( '/_utm_(medium|source|campaign|content|term)$/', $base_key ) ? true : false ):
457
458 return 'dashed';
459
460 /*
461 * Empty string, 'none', or color as #000000.
462 */
463 case ( false !== strpos( $base_key, '_color_' ) ? true : false ):
464
465 return 'color';
466
467 /*
468 * JS and CSS code (cannot be blank).
469 */
470 case ( false !== strpos( $base_key, '_js_' ) ? true : false ):
471 case ( false !== strpos( $base_key, '_css_' ) ? true : false ):
472 case ( preg_match( '/(_css|_js|_html)$/', $base_key ) ? true : false ):
473
474 return 'code';
475
476 /*
477 * Gravity View field IDs.
478 */
479 case 'gv_id_title': // Title Field ID.
480 case 'gv_id_desc': // Description Field ID.
481 case 'gv_id_img': // Post Image Field ID.
482
483 return 'blank_int';
484
485 /*
486 * Robots max values.
487 */
488 case 'robots_max_snippet': // Snippet Max. Length.
489 case 'robots_max_video_preview': // Video Max. Previews.
490
491 if ( empty( $mod[ 'name' ] ) ) { // Must be an interger for plugin settings (ie. no module).
492
493 return 'integer';
494 }
495
496 return 'blank_int'; // Allow blank (ie. default) for options.
497
498 /*
499 * Cast as integer (zero and -1 is ok).
500 */
501 case 'og_img_max': // Maximum Images.
502 case 'og_vid_max': // Maximum Videos to Include.
503 case 'og_desc_hashtags': // Description Hashtags.
504 case 'primary_term_id': // Primary Category.
505 case ( preg_match( '/_(cache_exp|caption_hashtags|filter_prio)$/', $base_key ) ? true : false ):
506 case ( preg_match( '/_(img|logo|banner)_url(:width|:height)$/', $base_key ) ? true : false ):
507
508 return 'integer';
509
510 /*
511 * Numeric options that must be zero or more.
512 */
513 case ( preg_match( '/_exp_secs$/', $base_key ) ? true : false ):
514
515 return 'zero_pos_int';
516
517 /*
518 * Numeric options that must be positive (1 or more).
519 */
520 case ( preg_match( '/_(len|warn)$/', $base_key ) ? true : false ):
521
522 return 'pos_int';
523
524 /*
525 * Empty string or an image ID.
526 */
527 case 'og_def_img_id':
528 case 'og_img_id':
529 case 'tc_lrg_img_id':
530 case 'tc_sum_img_id':
531
532 return 'img_id';
533
534 /*
535 * Empty string, or must include at least one HTML tag.
536 */
537 case 'og_vid_embed':
538
539 return 'html';
540
541 /*
542 * Texturized.
543 */
544 case 'og_title_sep':
545
546 return 'textured';
547
548 /*
549 * Text strings that can be blank (line breaks are removed).
550 */
551 case 'checksum': // Checksum of plugin versions.
552 case 'opt_checksum': // Checksum of option versions.
553 case 'site_name_alt':
554 case 'site_desc':
555 case 'seo_title': // SEO Title Tag.
556 case 'seo_desc': // SEO Meta Description.
557 case 'og_title':
558 case 'og_desc':
559 case 'tc_title': // X (Twitter) Card Title.
560 case 'tc_desc': // X (Twitter) Card Description.
561 case 'pin_desc':
562
563 return 'one_line';
564
565 /*
566 * Options that cannot be blank.
567 */
568 case 'site_org_place_id':
569 case 'site_org_schema_type':
570 case 'og_def_currency': // Default Currency.
571 case 'og_def_country': // Default Country.
572 case 'og_def_timezone': // Default Timezone.
573 case 'og_img_id_lib':
574 case 'robots_max_image_preview':
575 case ( false !== strpos( $base_key, '_crop_x' ) ? true : false ):
576 case ( false !== strpos( $base_key, '_crop_y' ) ? true : false ):
577 case ( false !== strpos( $base_key, '_type_for_' ) ? true : false ):
578 case ( preg_match( '/^(plugin|wp)_cm_[a-z]+_(name|label)$/', $base_key ) ? true : false ):
579
580 return 'not_blank';
581
582 /*
583 * Empty string or image URL.
584 */
585 case 'og_def_img_url':
586 case 'og_img_url':
587 case 'site_org_logo_url':
588 case 'site_org_banner_url':
589 case 'tc_lrg_img_url':
590 case 'tc_sum_img_url':
591
592 return 'img_url';
593
594 /*
595 * Empty string or a URL.
596 *
597 * Option key exceptions:
598 *
599 * 'add_meta_property_og:image:secure_url' = 0
600 * 'add_meta_property_og:video:secure_url' = 0
601 * 'plugin_cf_img_url' = '' // Image URL Custom Field.
602 * 'plugin_cf_vid_url' = '' // Video URL Custom Field.
603 */
604 case 'site_home_url':
605 case 'site_wp_url':
606 case 'canonical_url':
607 case 'redirect_url':
608 case 'fb_page_url':
609 case 'og_vid_url':
610 case 'pin_publisher_url':
611 case ( strpos( $base_key, '_url' ) && isset( $this->p->cf[ 'form' ][ 'social_accounts' ][ $base_key ] ) ? true : false ):
612
613 return 'url';
614
615 /*
616 * Empty or alpha-numeric uppercase (hyphens are allowed as well).
617 */
618 case ( preg_match( '/_tid$/', $base_key ) ? true : false ):
619
620 return 'auth_id';
621
622 /*
623 * Image width, subject to minimum value (typically, at least 200px).
624 */
625 case ( preg_match( '/_img_width$/', $base_key ) ? true : false ):
626
627 return 'img_width';
628
629 /*
630 * Image height, subject to minimum value (typically, at least 200px).
631 */
632 case ( preg_match( '/_img_height$/', $base_key ) ? true : false ):
633
634 return 'img_height';
635
636 /*
637 * Empty or 'none' string, or date as yyyy-mm-dd.
638 */
639 case ( preg_match( '/_date$/', $base_key ) ? true : false ):
640
641 return 'date';
642
643 /*
644 * Empty or 'none' string, or time as hh:mm or hh:mm:ss.
645 *
646 * Check last in case there are taxonomy option names like 'og_type_for_tax_product_delivery_time'.
647 */
648 case ( preg_match( '/_time$/', $base_key ) ? true : false ):
649
650 return 'time';
651
652 /*
653 * A regular expression.
654 */
655 case ( preg_match( '/_preg$/', $base_key ) ? true : false ):
656
657 return 'preg';
658 }
659
660 return $type;
661 }
662 }
663 }
664