| @@ -730,8 +730,27 @@ | ||
| 730 | 730 | return $optimization; |
| 731 | 731 | } |
| 732 | 732 | |
| 733 | 733 | /** |
| 734 | + * Deployed types an authoritative deploy takes off the page. | |
| 735 | + * | |
| 736 | + * Everything deployed that the payload left out, except the types the | |
| 737 | + * caller sent but could not deploy: those failed validation, they were not | |
| 738 | + * removed by the user, so their live copy stays. Retiring them took the | |
| 739 | + * site's Organization down behind a success toast (#949). | |
| 740 | + * | |
| 741 | + * @since 2.14.1 | |
| 742 | + * | |
| 743 | + * @param string[] $deployed Types deployed for the context now. | |
| 744 | + * @param string[] $payload Types in this deploy. | |
| 745 | + * @param string[] $retain_types Types sent but skipped by validation. | |
| 746 | + * @return string[] Types to retire. | |
| 747 | + */ | |
| 748 | + public static function types_to_retire(array $deployed, array $payload, array $retain_types = []): array { | |
| 749 | + return array_values(array_diff($deployed, $payload, $retain_types)); | |
| 750 | + } | |
| 751 | + | |
| 752 | + /** | |
| 734 | 753 | * Deploy schema markup with automated implementation |
| 735 | 754 | * |
| 736 | 755 | * @since 1.0.0 |
| 737 | 756 | * |
| @@ -765,11 +784,12 @@ | ||
| 765 | 784 | if (!empty($options['authoritative'])) { |
| 766 | 785 | $deployment['retired_schemas'] = $this->retire_schema_types( |
| 767 | 786 | $context_type, |
| 768 | 787 | $context_id, |
| 769 | - array_diff( | |
| 788 | + self::types_to_retire( | |
| 770 | 789 | array_keys($this->get_deployed_schemas($context_type, $context_id)), |
| 771 | - array_keys($schema_data) | |
| 790 | + array_keys($schema_data), | |
| 791 | + (array) ($options['retain_types'] ?? []) | |
| 772 | 792 | ) |
| 773 | 793 | ); |
| 774 | 794 | } |
| 775 | 795 | |
| @@ -2224,15 +2244,10 @@ | ||
| 2224 | 2244 | if (!is_string($url) || '' === trim($url)) { |
| 2225 | 2245 | return false; |
| 2226 | 2246 | } |
| 2227 | 2247 | |
| 2228 | - if (!filter_var($url, FILTER_VALIDATE_URL)) { | |
| 2229 | - return false; | |
| 2230 | - } | |
| 2231 | - | |
| 2232 | - $scheme = wp_parse_url($url, PHP_URL_SCHEME); | |
| 2233 | - | |
| 2234 | - return in_array(strtolower((string) $scheme), ['http', 'https'], true); | |
| 2248 | + // IRI-aware: a non-ASCII path or IDN host is a real URL (#924). | |
| 2249 | + return \ThinkRank\Core\Url_Validator::is_http_url($url); | |
| 2235 | 2250 | } |
| 2236 | 2251 | |
| 2237 | 2252 | /** |
| 2238 | 2253 | * Drop values that are not URLs from URL-typed properties. |