Пример #1
0
function sitemap_update()
{
    require_once EMLOG_ROOT . '/content/plugins/sitemap/class.sitemap.php';
    extract(sitemap_config());
    $sitemap = new sitemap($sitemap_name);
    return $sitemap->build();
}
Пример #2
0
function callback_init()
{
    require_once EMLOG_ROOT . '/content/plugins/sitemap/class.sitemap.php';
    require_once EMLOG_ROOT . '/content/plugins/sitemap/sitemap.php';
    extract(sitemap_config());
    $sitemap = new sitemap($sitemap_name);
    $sitemap->build();
}
Пример #3
0
 function __construct()
 {
     extract(sitemap_config());
     $this->db = Database::getInstance();
     $this->path = EMLOG_ROOT . '/' . $sitemap_name;
     $this->changefreq = $sitemap_changefreq;
     $this->priority = $sitemap_priority;
     $this->comment_time = $sitemap_comment_time;
 }
Пример #4
0
function plugin_setting()
{
    extract(sitemap_config());
    if (!isset($_POST['update'])) {
        $changefreq2 = isset($_POST['sitemap_changefreq']) ? $_POST['sitemap_changefreq'] : array();
        $priority2 = isset($_POST['sitemap_priority']) ? $_POST['sitemap_priority'] : array();
        $sitemap_name2 = isset($_POST['sitemap_name']) ? strval($_POST['sitemap_name']) : '';
        foreach ($changefreq2 as $key => $value) {
            if (!in_array($value, array('always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never'))) {
                $sitemap_changefreq[$key] = 'daily';
            } else {
                $sitemap_changefreq[$key] = $value;
            }
        }
        foreach ($priority2 as $key => $value) {
            if (floatval($value) > 1.0 || floatval($value) <= 0) {
                $sitemap_priority[$key] = '0.8';
            } else {
                $sitemap_priority[$key] = $value;
            }
        }
        if ($sitemap_name2 != '' && $sitemap_name != $sitemap_name2) {
            if (!@rename(EMLOG_ROOT . '/' . $sitemap_name, EMLOG_ROOT . '/' . $sitemap_name2)) {
                emMsg("重命名文件{$sitemap_name}失败,请设置根目录下{$sitemap_name}权限为777(LINUX)/everyone可写(windows)", './plugin.php?plugin=sitemap');
            }
            $sitemap_name = $sitemap_name2;
        }
        $sitemap_show_footer = isset($_POST['sitemap_show_footer']) ? addslashes($_POST['sitemap_show_footer']) : 0;
        $sitemap_comment_time = isset($_POST['sitemap_comment_time']) ? addslashes($_POST['sitemap_comment_time']) : 0;
        if (!@file_put_contents(EMLOG_ROOT . '/content/plugins/sitemap/config', serialize(compact('sitemap_name', 'sitemap_changefreq', 'sitemap_priority', 'sitemap_show_footer', 'sitemap_comment_time')))) {
            emMsg("更新配置失败,请设置文件content/plugins/sitemap/config权限为777(LINUX)/everyone可写(windows)", './plugin.php?plugin=sitemap');
        }
    }
    if (!sitemap_update()) {
        emMsg("更新sitemap失败,请设置根目录下{$sitemap_name}权限为777(LINUX)/everyone可写(windows)", './plugin.php?plugin=sitemap');
    }
    return true;
}