Skip to content

Commit

Permalink
Fix < loc > URLs generation for URLs with '&'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
emanwebdev committed Mar 21, 2014
1 parent 63e73a3 commit 4d09ee9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function sitemap_add_url($url = '', $date = '', $freq = 'daily') {

$filename = osc_base_path() . 'sitemap.xml';
$xml = ' <url>' . PHP_EOL;
$xml .= ' <loc>' . htmlentities($url, ENT_QUOTES, "UTF-8") . '</loc>' . PHP_EOL;
$xml .= ' <loc>' . htmlspecialchars($url, ENT_QUOTES, "UTF-8") . '</loc>' . PHP_EOL;
$xml .= ' <lastmod>' . $date . '</lastmod>' . PHP_EOL;
$xml .= ' <changefreq>' . $freq . '</changefreq>' . PHP_EOL;
$xml .= ' </url>' . PHP_EOL;
Expand Down

0 comments on commit 4d09ee9

Please sign in to comment.