[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/skins/_rss2/ -> index.main.php (source)

   1  <?php
   2  /**

   3   * This template generates an RSS 2.0 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://manual.b2evolution.net/Skins_2.0}

   7   *

   8   * See {@link http://backend.userland.com/rss092}

   9   *

  10   * @package evoskins

  11   * @subpackage rss

  12   *

  13   * @version $Id: index.main.php,v 1.6 2007/11/04 01:10:57 fplanque Exp $

  14   */
  15  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  16  
  17  // Note: even if we request the same post as $Item earlier, the following will do more restrictions (dates, etc.)

  18  // Init the MainList object:

  19  init_MainList( $Blog->get_setting('posts_per_feed') );
  20  
  21  // What level of detail do we want?

  22  $feed_content = $Blog->get_setting('feed_content');
  23  if( $feed_content == 'none' )
  24  {    // We don't want to provide this feed!
  25      global $skins_path;
  26      require $skins_path.'_404_not_found.main.php';
  27      exit();
  28  }
  29  
  30  
  31  skin_content_header( 'application/xml' );    // Sets charset!

  32  
  33  echo '<?xml version="1.0" encoding="'.$io_charset.'"?'.'>';
  34  
  35  ?>
  36  <!-- generator="<?php echo $app_name ?>/<?php echo $app_version ?>" -->
  37  <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  38      <channel>
  39          <title><?php
  40              $Blog->disp( 'name', 'xml' );
  41              // ------------------------- TITLE FOR THE CURRENT REQUEST -------------------------

  42              request_title( array(
  43                      'title_before'=> ' - ',
  44                      'title_after' => '',
  45                      'title_none'  => '',
  46                      'glue'        => ' - ',
  47                      'title_single_disp' => true,
  48                      'format'      => 'xml',
  49                  ) );
  50              // ------------------------------ END OF REQUEST TITLE -----------------------------

  51          ?></title>
  52          <link><?php $Blog->disp( 'url', 'xml' ) ?></link>
  53          <description><?php $Blog->disp( 'shortdesc', 'xml' ) ?></description>
  54          <language><?php $Blog->disp( 'locale', 'xml' ) ?></language>
  55          <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  56          <admin:generatorAgent rdf:resource="http://b2evolution.net/?v=<?php echo $app_version ?>"/>
  57          <ttl>60</ttl>
  58          <?php
  59          while( $Item = & mainlist_get_item() )
  60          {    // For each blog post, do everything below up to the closing curly brace "}"
  61              ?>
  62          <item>
  63              <title><?php $Item->title( array(
  64                  'format' => 'xml',
  65                  'link_type' => 'none',
  66              ) ); ?></title>
  67              <link><?php $Item->permanent_url( 'single' ) ?></link>
  68              <?php
  69                  $Item->issue_date( array(
  70                          'before'      => '<pubDate>',
  71                          'after'       => '</pubDate>',
  72                          'date_format' => 'r',
  73                         'use_GMT'     => true,
  74                      ) );
  75              ?>
  76              <dc:creator><?php $Item->get_creator_User(); $Item->creator_User->preferred_name('xml') ?></dc:creator>
  77              <?php
  78                  $Item->categories( array(
  79                      'before'          => '',
  80                      'after'           => '',
  81                      'include_main'    => true,
  82                      'include_other'   => true,
  83                      'include_external'=> true,
  84                      'before_main'     => '<category domain="main">',
  85                      'after_main'      => '</category>',
  86                      'before_other'    => '<category domain="alt">',
  87                      'after_other'     => '</category>',
  88                      'before_external' => '<category domain="external">',
  89                      'after_external'  => '</category>',
  90                      'link_categories' => false,
  91                      'separator'       => "\n",
  92                      'format'          => 'htmlbody', // TODO: "xml" eats away the tags!!
  93                  ) );
  94              ?>
  95              <guid isPermaLink="false"><?php $Item->ID() ?>@<?php echo $baseurl ?></guid>
  96              <?php
  97                  if( $feed_content == 'excerpt' )
  98                  {
  99                      ?>
 100              <description><?php
 101                  $content = $Item->get_excerpt( 'entityencoded' );
 102  
 103                  // fp> this is another one of these "oooooh it's just a tiny little change"

 104                  // and "we only need to make the links absolute in RSS"

 105                  // and then you get half baked code! The URL LINK stays RELATIVE!! :((

 106                  // TODO: clean solution : work in format_to_output!

 107                  echo make_rel_links_abs( $content );
 108              ?></description>
 109              <content:encoded><![CDATA[<?php
 110                  // Display images that are linked to this post:

 111                  $content = $Item->get_excerpt( 'htmlbody' );
 112  
 113                  // fp> this is another one of these "oooooh it's just a tiny little change"

 114                  // and "we only need to make the links absolute in RSS"

 115                  // and then you get half baked code! The URL LINK stays RELATIVE!! :((

 116                  // TODO: clean solution : work in format_to_output! --- we probably need 'htmlfeed' as 'htmlbody+absolute'

 117                  echo make_rel_links_abs( $content );
 118              ?>]]></content:encoded>
 119                      <?php
 120                  }
 121                  elseif( $feed_content == 'normal' )
 122                  {
 123                      ?>
 124              <description><?php
 125                // fp> TODO: make a clear decision on wether or not $before &nd $after get formatted to output or not.

 126                $Item->url_link( '&lt;p&gt;', '&lt;/p&gt;', '%s', array(), 'entityencoded' );
 127  
 128                  // Display images that are linked to this post:

 129                  $content = $Item->get_images( array(
 130                          'before' =>              '<div>',
 131                          'before_image' =>        '<div>',
 132                          'before_image_legend' => '<div><i>',
 133                          'after_image_legend' =>  '</i></div>',
 134                          'after_image' =>         '</div>',
 135                          'after' =>               '</div>',
 136                          'image_size' =>          'fit-320x320'
 137                      ), 'entityencoded' );
 138  
 139                  $content .= $Item->get_content_teaser( 1, false, 'entityencoded' );
 140  
 141                  $content .= $Item->get_more_link( array(
 142                          'before'    => '',
 143                          'after'     => '',
 144                          'disppage'  => 1,
 145                          'format'    => 'entityencoded',
 146                      ) );
 147  
 148                  // fp> this is another one of these "oooooh it's just a tiny little change"

 149                  // and "we only need to make the links absolute in RSS"

 150                  // and then you get half baked code! The URL LINK stays RELATIVE!! :((

 151                  // TODO: clean solution : work in format_to_output!

 152                  echo make_rel_links_abs( $content );
 153              ?></description>
 154              <content:encoded><![CDATA[<?php
 155                  $Item->url_link( '<p>', '</p>' );
 156  
 157                  // Display images that are linked to this post:

 158                  $content = $Item->get_images( array(
 159                          'before' =>              '<div>',
 160                          'before_image' =>        '<div>',
 161                          'before_image_legend' => '<div><i>',
 162                          'after_image_legend' =>  '</i></div>',
 163                          'after_image' =>         '</div>',
 164                          'after' =>               '</div>',
 165                          'image_size' =>          'fit-320x320'
 166                      ), 'htmlbody' );
 167  
 168                  $content .= $Item->get_content_teaser( 1, false );
 169  
 170                  $content .= $Item->get_more_link( array(
 171                          'before'    => '',
 172                          'after'     => '',
 173                          'disppage'  => 1,
 174                      ) );
 175  
 176                  // fp> this is another one of these "oooooh it's just a tiny little change"

 177                  // and "we only need to make the links absolute in RSS"

 178                  // and then you get half baked code! The URL LINK stays RELATIVE!! :((

 179                  // TODO: clean solution : work in format_to_output! --- we probably need 'htmlfeed' as 'htmlbody+absolute'

 180                  echo make_rel_links_abs( $content );
 181              ?>]]></content:encoded>
 182                      <?php
 183                  }
 184              ?>
 185              <comments><?php echo $Item->get_single_url( 'auto' ); ?>#comments</comments>
 186          </item>
 187          <?php
 188          }
 189          ?>
 190      </channel>
 191  </rss>
 192  <?php
 193      $Hit->log(); // log the hit on this page

 194  
 195      // This is a self contained XML document, make sure there is no additional output:

 196      exit();
 197  ?>


Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics