<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
echo context::global_filter($core->blog->settings->lang, 0, 0, 0, 0, 0, 'BlogLanguage');
?>
" lang="<?php 
echo context::global_filter($core->blog->settings->lang, 0, 0, 0, 0, 0, 'BlogLanguage');
?>
">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta name="MSSmartTagsPreventParsing" content="TRUE" />
  <meta name="ROBOTS" content="<?php 
echo context::robotsPolicy($core->blog->settings->robots_policy, '');
?>
" />
  
  <title><?php 
echo context::global_filter($core->blog->name, 1, 0, 0, 0, 0, 'BlogName');
if (!context::PaginationStart()) {
    ?>
 - <?php 
    echo __('page');
    ?>
 <?php 
    echo context::global_filter(context::PaginationPosition(0), 0, 0, 0, 0, 0, 'PaginationCurrent');
}
?>
</title>
  <meta name="description" lang="<?php 
echo context::global_filter($core->blog->settings->lang, 0, 0, 0, 0, 0, 'BlogLanguage');
Example #2
0
 public static function feed($args)
 {
     $type = null;
     $comments = false;
     $cat_url = false;
     $post_id = null;
     $params = array();
     $subtitle = '';
     $mime = 'application/xml';
     $_ctx =& $GLOBALS['_ctx'];
     $core =& $GLOBALS['core'];
     if (preg_match('!^([a-z]{2}(-[a-z]{2})?)/(.*)$!', $args, $m)) {
         $params['lang'] = $m[1];
         $args = $m[3];
         $_ctx->langs = $core->blog->getLangs($params);
         if ($_ctx->langs->isEmpty()) {
             # The specified language does not exist.
             self::p404();
             return;
         } else {
             $_ctx->cur_lang = $m[1];
         }
     }
     if (preg_match('#^rss2/xslt$#', $args, $m)) {
         # RSS XSLT stylesheet
         self::serveDocument('rss2.xsl', 'text/xml');
         return;
     } elseif (preg_match('#^(atom|rss2)/comments/([0-9]+)$#', $args, $m)) {
         # Post comments feed
         $type = $m[1];
         $comments = true;
         $post_id = (int) $m[2];
     } elseif (preg_match('#^(?:category/(.+)/)?(atom|rss2)(/comments)?$#', $args, $m)) {
         # All posts or comments feed
         $type = $m[2];
         $comments = !empty($m[3]);
         if (!empty($m[1])) {
             $cat_url = $m[1];
         }
     } else {
         # The specified Feed URL is malformed.
         self::p404();
         return;
     }
     if ($cat_url) {
         $params['cat_url'] = $cat_url;
         $params['post_type'] = 'post';
         $_ctx->categories = $core->blog->getCategories($params);
         if ($_ctx->categories->isEmpty()) {
             # The specified category does no exist.
             self::p404();
             return;
         }
         $subtitle = ' - ' . $_ctx->categories->cat_title;
     } elseif ($post_id) {
         $params['post_id'] = $post_id;
         $params['post_type'] = '';
         $_ctx->posts = $core->blog->getPosts($params);
         if ($_ctx->posts->isEmpty()) {
             # The specified post does not exist.
             self::p404();
             return;
         }
         $subtitle = ' - ' . $_ctx->posts->post_title;
     }
     $tpl = $type;
     if ($comments) {
         $tpl .= '-comments';
         $_ctx->nb_comment_per_page = $core->blog->settings->nb_comment_per_feed;
     } else {
         $_ctx->nb_entry_per_page = $core->blog->settings->nb_post_per_feed;
         $_ctx->short_feed_items = $core->blog->settings->short_feed_items;
     }
     $tpl .= '.xml';
     if ($type == 'atom') {
         $mime = 'application/atom+xml';
     }
     $_ctx->feed_subtitle = $subtitle;
     header('X-Robots-Tag: ' . context::robotsPolicy($core->blog->settings->robots_policy, ''));
     self::serveDocument($tpl, $mime);
     if (!$comments && !$cat_url) {
         $core->blog->publishScheduledEntries();
     }
 }