/** * Gets links to all Zenpage pages * * @return string */ function getSitemapZenpagePages() { global $_zp_zenpage, $sitemap_number; //not splitted into several sitemaps yet if ($sitemap_number == 1) { $data = ''; $limit = sitemap_getDBLimit(2); $sitemap_locales = generateLanguageList(); $changefreq = getOption('sitemap_changefreq_pages'); $pages = $_zp_zenpage->getPages(true); if ($pages) { $data .= sitemap_echonl('<?xml version="1.0" encoding="UTF-8"?>'); $data .= sitemap_echonl('<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'); foreach ($pages as $page) { $pageobj = new ZenpagePage($page['titlelink']); $date = substr($pageobj->getDatetime(), 0, 10); $lastchange = ''; if (!is_null($pageobj->getLastchange())) { $lastchange = substr($pageobj->getLastchange(), 0, 10); } if ($date > $lastchange && !empty($lastchangedate)) { $date = $lastchange; } if (!$pageobj->isProtected()) { switch (SITEMAP_LOCALE_TYPE) { case 1: foreach ($sitemap_locales as $locale) { $url = seo_locale::localePath(true, $locale) . '/' . _PAGES_ . '/' . urlencode($page['titlelink']); $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>"); } break; case 2: foreach ($sitemap_locales as $locale) { $url = rewrite_path(_PAGES_ . '/' . urlencode($page['titlelink']), '?p=pages&title=' . urlencode($page['titlelink']), dynamic_locale::fullHostPath($locale)); $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>"); } break; default: $url = rewrite_path(_PAGES_ . '/' . urlencode($page['titlelink']), '?p=pages&title=' . urlencode($page['titlelink']), FULLWEBPATH); $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>"); break; } } } $data .= sitemap_echonl('</urlset>'); // End off the <urlset> tag } return $data; } }