/** * Gets links to Zenpage news categories incl. pagination * * @return string */ function getSitemapZenpageNewsCategories() { global $_zp_zenpage, $sitemap_number; //TODO not splitted into several sitemaps yet if ($sitemap_number == 1) { $data = ''; $sitemap_locales = generateLanguageList(); $changefreq = getOption('sitemap_changefreq_newscats'); $newscats = $_zp_zenpage->getAllCategories(); if ($newscats) { $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 ($newscats as $newscat) { $catobj = new ZenpageCategory($newscat['titlelink']); if (!$catobj->isProtected()) { switch (SITEMAP_LOCALE_TYPE) { case 1: foreach ($sitemap_locales as $locale) { $url = seo_locale::localePath(true, $locale) . '/' . _CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/1'; $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\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(_CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/1', '?p=news&category=' . urlencode($catobj->getTitlelink()) . '&page=1', dynamic_locale::fullHostPath($locale)); $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>"); } break; default: $url = rewrite_path(_CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/1', '?p=news&category=' . urlencode($catobj->getTitlelink()) . '&page=1', FULLWEBPATH); $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>"); break; } // getting pages for the categories /* if(!empty($articlesperpage)) { $zenpage_articles_per_page = sanitize_numeric($articlesperpage); } else { $zenpage_articles_per_page = ZP_ARTICLES_PER_PAGE; } */ $zenpage_articles_per_page = ZP_ARTICLES_PER_PAGE; $articlecount = count($catobj->getArticles()); $catpages = ceil($articlecount / $zenpage_articles_per_page); if ($catpages > 1) { for ($x = 2; $x <= $catpages; $x++) { switch (SITEMAP_LOCALE_TYPE) { case 1: foreach ($sitemap_locales as $locale) { $url = seo_locale::localePath(true, $locale) . '/' . _CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/' . $x; $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\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(_CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/' . $x, '?p=news&category=' . urlencode($catobj->getTitlelink()) . '&page=' . $x, dynamic_locale::fullHostPath($locale)); $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>"); } break; default: $url = rewrite_path(_CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/' . $x, '?p=news&category=' . urlencode($catobj->getTitlelink()) . '&page=' . $x, FULLWEBPATH); $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\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; } }
/** * Gets links to Zenpage news categories incl. pagination * * @return string */ function getSitemapNewsCategories() { global $_zp_CMS, $sitemap_number; //TODO not splitted into several sitemaps yet if ($sitemap_number == 1) { $data = ''; $sitemap_locales = generateLanguageList(); $changefreq = getOption('sitemap_changefreq_newscats'); $newscats = $_zp_CMS->getAllCategories(); if ($newscats) { $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 ($newscats as $newscat) { $catobj = newCategory($newscat['titlelink']); if (!$catobj->isProtected()) { $base = $catobj->getLink(); switch (SITEMAP_LOCALE_TYPE) { case 1: foreach ($sitemap_locales as $locale) { $url = str_replace(WEBPATH, seo_locale::localePath(true, $locale), $base); $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\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 = dynamic_locale::fullHostPath($locale) . $base; $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>"); } break; default: $url = FULLHOSTPATH . $base; $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>"); break; } // getting pages for the categories $zenpage_articles_per_page = ZP_ARTICLES_PER_PAGE; $articlecount = count($catobj->getArticles()); $catpages = ceil($articlecount / $zenpage_articles_per_page); if ($catpages > 1) { for ($x = 2; $x <= $catpages; $x++) { $base = $catobj->getLink($x); switch (SITEMAP_LOCALE_TYPE) { case 1: foreach ($sitemap_locales as $locale) { $url = str_replace(WEBPATH, seo_locale::localePath(true, $locale), $base); $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\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 = dynamic_locale::fullHostPath($locale) . $base; $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>"); } break; default: $url = FULLHOSTPATH . $base; $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\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; } }