foreach ($items as $item) { $priority = PMF_SITEMAP_GOOGLE_PRIORITY_DEFAULT; if ($visitsMax - $visitMin > 0) { $priority = sprintf('%.1f', PMF_SITEMAP_GOOGLE_PRIORITY_DEFAULT * (1 + ($item['visits'] - $visitMin) / ($visitsMax - $visitMin))); } // a. We use plain PMF urls w/o any SEO schema $link = str_replace($_SERVER['SCRIPT_NAME'], '/index.php', $item['url']); // b. We use SEO PMF urls if (PMF_SITEMAP_GOOGLE_USE_SEO) { if (isset($item['thema'])) { $oL = new PMF_Link($link); $oL->itemTitle = $item['thema']; $link = $oL->toString(); } } $sitemap .= buildSitemapNode(PMF_Link::getSystemUri('/sitemap.google.php') . $link, PMF_Date::createISO8601Date($item['date']), PMF_SITEMAP_GOOGLE_CHANGEFREQ_DAILY, $priority); } $sitemap .= '</urlset>'; $getgezip = PMF_Filter::filterInput(INPUT_GET, PMF_SITEMAP_GOOGLE_GET_GZIP, FILTER_VALIDATE_INT); if (!is_null($getgezip) && 1 == $getgezip) { if (function_exists('gzencode')) { $sitemapGz = gzencode($sitemap); header('Content-Type: application/x-gzip'); header('Content-Disposition: attachment; filename="' . PMF_SITEMAP_GOOGLE_FILENAME_GZ . '"'); header('Content-Length: ' . strlen($sitemapGz)); print $sitemapGz; } else { PMF_Helper_Http::getInstance()->printHTTPStatus404(); } } else { header('Content-Type: text/xml');
foreach ($items as $item) { $priority = PMF_SITEMAP_GOOGLE_PRIORITY_DEFAULT; if ($visitsMax - $visitMin > 0) { $priority = sprintf('%.1f', PMF_SITEMAP_GOOGLE_PRIORITY_DEFAULT * (1 + ($item['visits'] - $visitMin) / ($visitsMax - $visitMin))); } // a. We use plain PMF urls w/o any SEO schema $link = str_replace($_SERVER['SCRIPT_NAME'], '/index.php', $item['url']); // b. We use SEO PMF urls if (PMF_SITEMAP_GOOGLE_USE_SEO) { if (isset($item['thema'])) { $oL = new PMF_Link($link, $faqConfig); $oL->itemTitle = $item['thema']; $link = $oL->toString(); } } $sitemap .= buildSitemapNode($faqConfig->get('main.referenceURL') . $link, PMF_Date::createIsoDate($item['date'], DATE_W3C), PMF_SITEMAP_GOOGLE_CHANGEFREQ_DAILY, $priority); } $sitemap .= '</urlset>'; $response = new Response(); $getgezip = PMF_Filter::filterInput(INPUT_GET, PMF_SITEMAP_GOOGLE_GET_GZIP, FILTER_VALIDATE_INT); if (!is_null($getgezip) && 1 == $getgezip) { if (function_exists('gzencode')) { $sitemapGz = gzencode($sitemap); $response->headers->set('Content-Type', 'application/x-gzip'); $response->headers->set('Content-Disposition', 'attachment; filename="' . PMF_SITEMAP_GOOGLE_FILENAME_GZ . '"'); $response->headers->set('Content-Length', strlen($sitemapGz)); $response->setContent($sitemapGz); } else { $response->setStatusCode(404); } } else {