Skip to content

Commit 4d09ee9

Browse files
committed
Fix < loc > URLs generation for URLs with '&'
see osclass/plugin-sitemap_generator#2 To Convert special characters, especially the **&** found in OSClass search URLs, to HTML entities taken from https://github.com/pawelantczak/php-sitemap-generator/blob/master/SitemapGenerator.php#L190 an excellent sitemap generator
1 parent 63e73a3 commit 4d09ee9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function sitemap_add_url($url = '', $date = '', $freq = 'daily') {
7575

7676
$filename = osc_base_path() . 'sitemap.xml';
7777
$xml = ' <url>' . PHP_EOL;
78-
$xml .= ' <loc>' . htmlentities($url, ENT_QUOTES, "UTF-8") . '</loc>' . PHP_EOL;
78+
$xml .= ' <loc>' . htmlspecialchars($url, ENT_QUOTES, "UTF-8") . '</loc>' . PHP_EOL;
7979
$xml .= ' <lastmod>' . $date . '</lastmod>' . PHP_EOL;
8080
$xml .= ' <changefreq>' . $freq . '</changefreq>' . PHP_EOL;
8181
$xml .= ' </url>' . PHP_EOL;

0 commit comments

Comments
 (0)