function _xmlsitemap_format in XML sitemap 5
Process an array of links.
Parameters
$entries: An array of links to process:
Return value
A string of formatted links
Related topics
1 call to _xmlsitemap_format()
- _xmlsitemap_output_chunk in ./
xmlsitemap.module - Generate a chunk of the site map.
File
- ./
xmlsitemap.module, line 558 - Creates a site map compatible with the sitemaps.org schema.
Code
function _xmlsitemap_format($entries) {
$links = array();
foreach ($entries as $entry) {
if (isset($entry['#loc'])) {
$link = ' <url>' . "\n";
$link .= ' <loc>' . check_url($entry['#loc']) . '</loc>' . "\n";
if (isset($entry['#lastmod'])) {
$link .= ' <lastmod>' . gmdate('Y-m-d\\TH:i:s+00:00', $entry['#lastmod']) . '</lastmod>' . "\n";
}
if (isset($entry['#changefreq'])) {
$link .= ' <changefreq>' . _xmlsitemap_frequency($entry['#changefreq']) . '</changefreq>' . "\n";
}
if (isset($entry['#priority']) && $entry['#priority'] <= 1 && $entry['#priority'] >= 0) {
$link .= ' <priority>' . number_format($entry['#priority'], 1) . '</priority>' . "\n";
}
$link .= ' </url>';
$links[] = $link;
}
}
return $links;
}