/** * 插件内容设置 * @param $name 对应标记参数 */ function sitemap_content($name) { if ($name == 'sitemap') { if (req()->is_post()) { sitemap_create(true); } include __DIR__ . "/page.php"; } return $name; }
if (array_key_exists('sitemap', $PAGES['article.php'])) { $ibid .= sitemaparticle($PAGES['article.php']['sitemap']); } if (array_key_exists('sitemap', $PAGES['forum.php'])) { $ibid .= sitemapforum($PAGES['forum.php']['sitemap']); } if (array_key_exists('sitemap', $PAGES['sections.php'])) { $ibid .= sitemaprub($PAGES['sections.php']['sitemap']); } if (array_key_exists('sitemap', $PAGES['download.php'])) { $ibid .= sitemapdown($PAGES['download.php']['sitemap']); } $ibid .= sitemapothers($PAGES); $ibid .= "</urlset>"; $file = fopen($filename, "w"); fwrite($file, $ibid); fclose($file); Ecr_Log("sitemap", "sitemap generated : " . date("H:i:s", time()), ""); } /* -----------------------------------------*/ // http://www.example.com/cache/sitemap.xml $filename = "cache/sitemap.xml"; // delais = 6 heures (21600 secondes) $refresh = 21600; if (file_exists($filename)) { if (time() - filemtime($filename) - $refresh > 0) { sitemap_create($PAGES, $filename); } } else { sitemap_create($PAGES, $filename); }