2
0
mirror of https://github.com/boostorg/website.git synced 2026-01-26 07:02:23 +00:00
Files
website/sitemap.xml.php
Daniel James 8fda3a3ce4 Merge versioned library info from beta.
Needed because polygon will have different information in 1.54 to older
releases.


[SVN r84383]
2013-05-20 08:21:27 +00:00

58 lines
1.6 KiB
PHP

<?php
header('Content-Type: application/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>', "\n";
define('USE_SERIALIZED_INFO', true);
require_once(dirname(__FILE__) . '/common/code/boost.php');
require_once(dirname(__FILE__) . '/common/code/boost_libraries.php');
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<?php
// Returns true if the library is part of the current release of boost.
function current_version_filter($lib) {
return BoostVersion::current()->compare($lib['boost-version']) >= 0 &&
(!isset($lib['boost-min-version']) ||
BoostVersion::current()->compare($lib['boost-min-version']) >= 0) &&
(!isset($lib['boost-max-version']) ||
BoostVersion::current()->compare($lib['boost-max-version']) <= 0);
}
function xmlentities($text) {
return str_replace(
array('&', '<', '>', '"', "'"),
array('&amp;', '&lt;', '&gt;', '&quot;', '&apos;'),
$text);
}
function echo_sitemap_url($loc, $priority, $freq) {
$loc_xml = xmlentities("http://$_SERVER[HTTP_HOST]/$loc");
echo <<<EOL
<url>
<loc>$loc_xml</loc>
<priority>$priority</priority>
<changefreq>$freq</changefreq>
</url>
EOL;
}
// Library list
echo_sitemap_url("doc/libs/", '1.0', 'daily');
// Library 'home pages'
$libs = USE_SERIALIZED_INFO ?
unserialize(file_get_contents(dirname(__FILE__) . '/generated/libraries.txt')) :
new boost_libraries(dirname(__FILE__) . '/doc/libraries.xml');
foreach ($libs->get(null, 'current_version_filter') as $lib) {
echo_sitemap_url("doc/libs/release/$lib[documentation]", '1.0', 'daily');
}
?>
</urlset>