| @@ -900,9 +900,12 @@ | ||
| 900 | 900 | |
| 901 | 901 | // Add image entries if provided |
| 902 | 902 | foreach ($images as $image) { |
| 903 | 903 | $xml .= " <image:image>\n"; |
| 904 | - $xml .= " <image:loc>" . esc_url(Url_Scheme::apply((string) $image['url'])) . "</image:loc>\n"; | |
| 904 | + // The sitemap protocol wants an escaped URL, and WordPress hands back | |
| 905 | + // attachment URLs with non-ASCII filenames unencoded (esc_url() does | |
| 906 | + // not encode them either), so write the percent-encoded form (#924). | |
| 907 | + $xml .= " <image:loc>" . esc_url(\ThinkRank\Core\Url_Validator::to_ascii(Url_Scheme::apply((string) $image['url']))) . "</image:loc>\n"; | |
| 905 | 908 | |
| 906 | 909 | if (!empty($image['title'])) { |
| 907 | 910 | $xml .= " <image:title>" . esc_html($image['title']) . "</image:title>\n"; |
| 908 | 911 | } |
| @@ -1350,9 +1353,9 @@ | ||
| 1350 | 1353 | if (preg_match('/src=["\']([^"\']+)["\']/', $img_tag, $src_match)) { |
| 1351 | 1354 | $image_url = $src_match[1]; |
| 1352 | 1355 | |
| 1353 | 1356 | // Skip if not a valid URL or external image |
| 1354 | - if (!filter_var($image_url, FILTER_VALIDATE_URL)) { | |
| 1357 | + if (!\ThinkRank\Core\Url_Validator::is_valid($image_url)) { | |
| 1355 | 1358 | continue; |
| 1356 | 1359 | } |
| 1357 | 1360 | |
| 1358 | 1361 | // Extract title and alt attributes |