b2evolution PHP Cross Reference Blogging Systems

Source: /skins/_rdf/comments.main.php - 116 lines - 4056 bytes - Text - Print

Description: This template generates an RSS 1.0 (RDF) feed for the requested blog's latest comments

   1  <?php
   2  /**
   3   * This template generates an RSS 1.0 (RDF) feed for the requested blog's latest comments
   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://web.resource.org/rss/1.0/}
   9   *
  10   * @package evoskins
  11   * @subpackage rdf
  12   *
  13   * @version $Id: comments.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  // What level of detail do we want?
  19  $feed_content = $Blog->get_setting('comment_feed_content');
  20  if( $feed_content == 'none' )
  21  {    // We don't want to provide this feed!
  22      // This will normaly have been detected earlier but just for security:
  23      debug_die( 'Feeds are disabled.');
  24  }
  25  
  26  if( !$Blog->get_setting( 'comments_latest' ) )
  27  { // The latest comments are disabled for current blog
  28      // Redirect to page with text/html mime type
  29      header_redirect( get_dispctrl_url( 'comments' ), 302 );
  30      // will have exited
  31  }
  32  
  33  $post_ID = NULL;
  34  if( isset($Item) )
  35  {    // Comments for a specific Item:
  36    $post_ID = $Item->ID;
  37  }
  38  
  39  $CommentList = new CommentList2( $Blog );
  40  
  41  // Filter list:
  42  $CommentList->set_filters( array(
  43          'types' => array( 'comment' ),
  44          'statuses' => array ( 'published' ),
  45          'post_ID' => $post_ID,
  46          'order' => 'DESC',
  47          'comments' => $Blog->get_setting('comments_per_feed'),
  48      ) );
  49  
  50  // Get ready for display (runs the query):
  51  $CommentList->display_init();
  52  
  53  headers_content_mightcache( 'application/xml' );        // In most situations, you do NOT want to cache dynamic content!
  54  
  55  echo '<?xml version="1.0" encoding="'.$io_charset.'"?'.'>';
  56  ?>
  57  <!-- generator="<?php echo $app_name; ?>/<?php echo $app_version ?>" -->
  58  <rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  59  <channel rdf:about="<?php $Blog->disp( 'url', 'xmlattr' ) ?>">
  60      <title><?php
  61          $Blog->disp( 'name', 'xml' );
  62          // ------------------------- TITLE FOR THE CURRENT REQUEST -------------------------
  63          request_title( array(
  64                  'title_before'=> ' - ',
  65                  'title_after' => '',
  66                  'title_none'  => '',
  67                  'glue'        => ' - ',
  68                  'title_single_disp' => true,
  69                  'format'      => 'xml',
  70              ) );
  71          // ------------------------------ END OF REQUEST TITLE -----------------------------
  72      ?></title>
  73      <link><?php $Blog->disp( 'lastcommentsurl', 'xml' ) ?></link>
  74      <description></description>
  75      <dc:language><?php $Blog->disp( 'locale', 'xml' ) ?></dc:language>
  76      <admin:generatorAgent rdf:resource="http://b2evolution.net/?v=<?php echo $app_version ?>"/>
  77      <sy:updatePeriod>hourly</sy:updatePeriod>
  78      <sy:updateFrequency>1</sy:updateFrequency>
  79      <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
  80      <items>
  81          <rdf:Seq>
  82          <?php while( $Comment = & $CommentList->get_next() )
  83          { // Loop through comments:
  84              ?>
  85              <rdf:li rdf:resource="<?php $Comment->permanent_url() ?>"/>
  86              <?php
  87          } ?>
  88          </rdf:Seq>
  89      </items>
  90  </channel>
  91  <?php
  92  $CommentList->restart();
  93  while( $Comment = & $CommentList->get_next() )
  94  { // Loop through comments:
  95      // Load comment's Item:
  96      $Comment->get_Item();
  97      ?>
  98  <item rdf:about="<?php $Comment->permanent_url() ?>">
  99      <title><?php echo format_to_output( T_('In response to:'), 'xml' ) ?> <?php $Comment->Item->title( array(
 100                  'format' => 'xml',
 101                  'link_type' => 'none',
 102              ) ); ?></title>
 103      <link><?php $Comment->permanent_url() ?></link>
 104      <dc:date><?php $Comment->date( 'isoZ', true ); ?></dc:date>
 105      <dc:creator><?php $Comment->author( '', '#', '', '#', 'xml' ) ?></dc:creator>
 106      <?php
 107      $content = $Comment->get_content();
 108      if( $feed_content == 'excerpt' )
 109      {
 110          $content = excerpt($content);
 111      }
 112      ?><description><?php echo format_to_output( make_rel_links_abs($content), 'entityencoded' ); ?></description>
 113      <content:encoded><![CDATA[<?php echo format_to_output( $content, 'htmlfeed' ); ?>]]></content:encoded>
 114  </item>
 115  <?php } // End of comment loop. ?>
 116  </rdf:RDF>

title

Description

title

Description

title

Description

title

title

Body