| @@ -80,10 +80,19 @@ | ||
| 80 | 80 | return $validation; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | $schema_type = $schema['@type']; |
| 84 | - $spec = $this->schema_factory->get_schema_specification($schema_type); | |
| 85 | 84 | |
| 85 | + // A LocalBusiness node carries the subtype the site chose ("Dentist"), | |
| 86 | + // and none of the ~150 subtypes has a spec of its own. They all share | |
| 87 | + // LocalBusiness's requirements, so validate against that rather than | |
| 88 | + // reporting the site's own business type as unsupported. | |
| 89 | + if (\ThinkRank\Config\Local_Business_Types_Config::is_local_business($schema_type)) { | |
| 90 | + $schema_type = 'LocalBusiness'; | |
| 91 | + } | |
| 92 | + | |
| 93 | + $spec =$this->schema_factory->get_schema_specification($schema_type); | |
| 94 | + | |
| 86 | 95 | if (empty($spec)) { |
| 87 | 96 | $validation['errors'][] = "Unsupported schema type: {$schema_type}"; |
| 88 | 97 | $validation['valid'] = false; |
| 89 | 98 | return $validation; |
| @@ -309,9 +318,9 @@ | ||
| 309 | 318 | |
| 310 | 319 | // Check for social media profiles - properly validate array |
| 311 | 320 | if (!isset($schema['sameAs']) || empty($schema['sameAs']) || |
| 312 | 321 | (is_array($schema['sameAs']) && count(array_filter($schema['sameAs'], function($url) { |
| 313 | - return !empty($url) && filter_var($url, FILTER_VALIDATE_URL); | |
| 322 | + return !empty($url) && \ThinkRank\Core\Url_Validator::is_valid($url); | |
| 314 | 323 | })) === 0)) { |
| 315 | 324 | $validation['suggestions'][] = 'Social media profiles (sameAs) are recommended for organization schema - add Facebook, Twitter, LinkedIn, Instagram, or YouTube URLs.'; |
| 316 | 325 | } |
| 317 | 326 | |
| @@ -347,9 +356,9 @@ | ||
| 347 | 356 | |
| 348 | 357 | // Check for social media profiles - properly validate array |
| 349 | 358 | if (!isset($schema['sameAs']) || empty($schema['sameAs']) || |
| 350 | 359 | (is_array($schema['sameAs']) && count(array_filter($schema['sameAs'], function($url) { |
| 351 | - return !empty($url) && filter_var($url, FILTER_VALIDATE_URL); | |
| 360 | + return !empty($url) && \ThinkRank\Core\Url_Validator::is_valid($url); | |
| 352 | 361 | })) === 0)) { |
| 353 | 362 | $validation['suggestions'][] = 'Social media profiles (sameAs) are recommended for local business schema.'; |
| 354 | 363 | } |
| 355 | 364 | |
| @@ -371,9 +380,9 @@ | ||
| 371 | 380 | if (isset($schema['logo']) && !empty($schema['logo']) && |
| 372 | 381 | (is_string($schema['logo']) || (is_array($schema['logo']) && !empty($schema['logo']['url'])))) { |
| 373 | 382 | $has_logo = true; |
| 374 | 383 | } elseif (isset($schema['publisher']['logo']) && !empty($schema['publisher']['logo']) && |
| 375 | - (is_string($schema['publisher']['logo']) || (is_array($schema['publisher']['logo']) && !empty($schema['publisher']['logo']['url'])))) { | |
| 384 | + (is_string($schema['publisher']['logo']) || (is_array($schema['publisher']['logo']) && !empty($schema['publisher']['logo']['url'])))) { | |
| 376 | 385 | $has_logo = true; |
| 377 | 386 | } |
| 378 | 387 | |
| 379 | 388 | if (!$has_logo) { |