Exemple #1
0
    // the preamble
    $text = '<?xml version="1.0" encoding="' . $context['charset'] . '"?>' . "\n" . '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">' . "\n";
    // the front page
    $text .= '	<url>' . "\n" . '		<loc>' . $context['url_to_home'] . $context['url_to_root'] . '</loc>' . "\n" . '		<changefreq>weekly</changefreq>' . "\n" . '		<priority>1.0</priority>' . "\n" . '	</url>' . "\n\n";
    // the site map
    $text .= '	<url>' . "\n" . '		<loc>' . $context['url_to_home'] . $context['url_to_root'] . 'sections/</loc>' . "\n" . '		<changefreq>weekly</changefreq>' . "\n" . '		<priority>1.0</priority>' . "\n" . '	</url>' . "\n\n";
    // main sections
    if ($items = Sections::list_by_title_for_anchor(NULL, 0, 25, 'raw')) {
        foreach ($items as $id => $item) {
            $text .= '	<url>' . "\n" . '		<loc>' . encode_link(Sections::get_permalink($item)) . '</loc>' . "\n" . '		<changefreq>weekly</changefreq>' . "\n" . '	</url>' . "\n\n";
        }
    }
    // the categories tree
    $text .= '	<url>' . "\n" . '		<loc>' . $context['url_to_home'] . $context['url_to_root'] . 'categories/</loc>' . "\n" . '		<changefreq>weekly</changefreq>' . "\n" . '		<priority>0.7</priority>' . "\n" . '	</url>' . "\n\n";
    // main categories
    if ($items = Categories::list_by_date(0, 25, 'raw')) {
        foreach ($items as $id => $item) {
            $text .= '	<url>' . "\n" . '		<loc>' . encode_link(Categories::get_permalink($item)) . '</loc>' . "\n" . '		<changefreq>weekly</changefreq>' . "\n" . '	</url>' . "\n\n";
        }
    }
    // members
    $text .= '	<url>' . "\n" . '		<loc>' . $context['url_to_home'] . $context['url_to_root'] . 'users/</loc>' . "\n" . '		<changefreq>weekly</changefreq>' . "\n" . '		<priority>0.7</priority>' . "\n" . '	</url>' . "\n\n";
    // the OPML feed
    $text .= '	<url>' . "\n" . '		<loc>' . $context['url_to_home'] . $context['url_to_root'] . 'feeds/describe.php</loc>' . "\n" . '		<changefreq>weekly</changefreq>' . "\n" . '	</url>' . "\n\n";
    // the postamble
    $text .= '</urlset>' . "\n";
    // put in cache
    Safe::file_put_contents($cache_id, $text);
}
//
// transfer to the user agent
Exemple #2
0
    // the main rss feed of this site
    $text .= '	<outline type="rss" text="' . encode_field($context['channel_title']) . '" xmlUrl="' . $context['url_to_home'] . $context['url_to_root'] . Feeds::get_url('rss') . '"' . " />\n";
    // full articles
    $text .= '	<outline type="rss" text="' . encode_field(i18n::c('Pages with full content') . $suffix) . '" xmlUrl="' . $context['url_to_home'] . $context['url_to_root'] . Feeds::get_url('articles') . '"' . " />\n";
    // newest comments
    $text .= '	<outline type="rss" text="' . encode_field(i18n::c('Comments') . $suffix) . '" xmlUrl="' . $context['url_to_home'] . $context['url_to_root'] . Feeds::get_url('comments') . '"' . " />\n";
    // the file rss feed for podcasting, etc.
    $text .= '	<outline type="rss" text="' . encode_field(i18n::c('Files and podcasts') . $suffix) . '" xmlUrl="' . $context['url_to_home'] . $context['url_to_root'] . Feeds::get_url('files') . '"' . " />\n";
    // one feed per section
    if ($items = Sections::list_by_title_for_anchor(NULL, 0, COMPACT_LIST_SIZE, 'raw')) {
        foreach ($items as $id => $attributes) {
            $text .= '	<outline type="rss" text="' . encode_field(strip_tags($attributes['title']) . $suffix) . '" xmlUrl="' . $context['url_to_home'] . $context['url_to_root'] . Sections::get_url($id, 'feed') . '"' . " />\n";
        }
    }
    // one feed per category
    if ($items = Categories::list_by_date(0, COMPACT_LIST_SIZE, 'raw')) {
        foreach ($items as $id => $attributes) {
            $text .= '	<outline type="rss" text="' . encode_field(strip_tags($attributes['title']) . $suffix) . '" xmlUrl="' . $context['url_to_home'] . $context['url_to_root'] . Categories::get_url($id, 'feed') . '"' . " />\n";
        }
    }
    // one feed per user
    if ($items = Users::list_by_posts(0, COMPACT_LIST_SIZE, 'raw')) {
        foreach ($items as $id => $attributes) {
            $text .= '	<outline type="rss" text="' . encode_field(strip_tags($attributes['nick_name']) . $suffix) . '" xmlUrl="' . $context['url_to_home'] . $context['url_to_root'] . Users::get_url($id, 'feed') . '"' . " />\n";
        }
    }
    // the postamble
    $text .= '</body>' . "\n" . '</opml>' . "\n";
    // put in cache
    Safe::file_put_contents($cache_id, $text);
}