b2evolution PHP Cross Reference Blogging Systems

Source: /skins/_rss/index.main.php - 147 lines - 4749 bytes - Text - Print

Description: This template generates an RSS 0.92 feed for the requested blog's latest posts

   1  <?php
   2  /**
   3   * This template generates an RSS 0.92 feed for the requested blog's latest posts
   4   *
   5   * For a quick explanation of b2evo 2.0 skins, please start here:
   6   * {@link http://b2evolution.net/man/skin-structure}
   7   *
   8   * See {@link http://backend.userland.com/rss092}
   9   *
  10   * @package evoskins
  11   * @subpackage rss
  12   *
  13   * @version $Id: index.main.php 3157 2013-03-06 04:34:44Z fplanque $
  14   */
  15  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  16  
  17  
  18  // Note: even if we request the same post as $Item earlier, the following will do more restrictions (dates, etc.)
  19  // Init the MainList object:
  20  init_MainList( $Blog->get_setting('posts_per_feed') );
  21  
  22  // What level of detail do we want?
  23  $feed_content = $Blog->get_setting('feed_content');
  24  if( $feed_content == 'none' )
  25  {    // We don't want to provide this feed!
  26      // This will normaly have been detected earlier but just for security:
  27      debug_die( 'Feeds are disabled.');
  28  }
  29  
  30  $image_size = $Blog->get_setting( 'image_size' );
  31  
  32  headers_content_mightcache( 'application/xml' );        // In most situations, you do NOT want to cache dynamic content!
  33  
  34  echo '<?xml version="1.0" encoding="'.$io_charset.'"?'.'>';
  35  
  36  ?>
  37  <!-- generator="<?php echo $app_name; ?>/<?php echo $app_version ?>" -->
  38  <rss version="0.92">
  39      <channel>
  40          <title><?php
  41              $Blog->disp( 'name', 'xml' );
  42              // ------------------------- TITLE FOR THE CURRENT REQUEST -------------------------
  43              request_title( array(
  44                      'title_before'=> ' - ',
  45                      'title_after' => '',
  46                      'title_none'  => '',
  47                      'glue'        => ' - ',
  48                      'title_single_disp' => true,
  49                      'format'      => 'xml',
  50                  ) );
  51              // ------------------------------ END OF REQUEST TITLE -----------------------------
  52          ?></title>
  53          <link><?php $Blog->disp( 'url', 'xml' ) ?></link>
  54          <description><?php $Blog->disp( 'shortdesc' ,'xml' ) ?></description>
  55          <language><?php $Blog->disp( 'locale', 'xml' ) ?></language>
  56          <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  57          <?php
  58          while( $Item = & mainlist_get_item() )
  59          {    // For each blog post, do everything below up to the closing curly brace "}"
  60          ?>
  61          <item>
  62              <title><?php $Item->title( array(
  63                  'format' => 'xml',
  64                  'link_type' => 'none',
  65              ) ); ?></title>
  66              <?php
  67                  if( $feed_content == 'excerpt' )
  68                  {    // EXCERPTS ---------------------------------------------------------------------
  69                      ?>
  70              <description><?php
  71                  $content = $Item->get_excerpt();
  72  
  73                  // Get content as "htmlbody", otherwise make_rel_links_abs() can't catch <a> and <img> tags
  74                  // TODO: clean solution : work in format_to_output!
  75                  echo format_to_output( make_rel_links_abs($content), 'entityencoded' );
  76  
  77                  // Display Item footer text (text can be edited in Blog Settings):
  78                  $Item->footer( array(
  79                          'mode'        => 'xml',
  80                          'block_start' => '<div class="item_footer">',
  81                          'block_end'   => '</div>',
  82                          'format'      => 'entityencoded',
  83                      ) );
  84              ?></description>
  85                      <?php
  86                  }
  87                  elseif( $feed_content == 'normal'
  88                              || $feed_content == 'full' )
  89                  {    // POST CONTENTS -----------------------------------------------------------------
  90                      ?>
  91              <description><?php
  92                  // URL link, if the post has one:
  93                  $Item->url_link( array(
  94                          'before'        => '<p>',
  95                          'after'         => '</p>',
  96                          'format'        => 'entityencoded',
  97                          'podcast'       => false,
  98                      ) );
  99  
 100                  // Display images that are linked to this post:
 101                  $content = $Item->get_images( array(
 102                          'before' =>              '<div>',
 103                          'before_image' =>        '<div>',
 104                          'before_image_legend' => '<div><i>',
 105                          'after_image_legend' =>  '</i></div>',
 106                          'after_image' =>         '</div>',
 107                          'after' =>               '</div>',
 108                          'image_size' =>          $image_size,
 109                      ), 'htmlbody' );
 110  
 111                  $content .= $Item->get_content_teaser( 1, false );
 112  
 113                  if( $feed_content == 'normal' )
 114                  {    // Teasers only
 115                      $content .= $Item->get_more_link( array(
 116                              'before'    => '',
 117                              'after'     => '',
 118                              'disppage'  => 1,
 119                          ) );
 120                  }
 121                  else
 122                  {    // Full contents
 123                      $content .= $Item->get_content_extension( 1, true );
 124                  }
 125  
 126                  // Get content as "htmlbody", otherwise make_rel_links_abs() can't catch <a> and <img> tags
 127                  // TODO: clean solution : work in format_to_output!
 128                  echo format_to_output( make_rel_links_abs($content), 'entityencoded' );
 129  
 130                  // Display Item footer text (text can be edited in Blog Settings):
 131                  $Item->footer( array(
 132                          'mode'        => 'xml',
 133                          'block_start' => '<div class="item_footer">',
 134                          'block_end'   => '</div>',
 135                          'format'      => 'entityencoded',
 136                      ) );
 137              ?></description>
 138              <link><?php $Item->permanent_url( 'single' ) ?></link>
 139                      <?php
 140                  }
 141              ?>
 142          </item>
 143          <?php
 144          }
 145          ?>
 146      </channel>
 147  </rss>

title

Description

title

Description

title

Description

title

title

Body