[ 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/_rdf/ -> index.main.php (source)

   1  <?php
   2  /**

   3   * This template generates an RSS 1.0 (RDF) 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://web.resource.org/rss/1.0/}

   9   *

  10   * @package evoskins

  11   * @subpackage rdf

  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  <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/">
  38  <channel rdf:about="<?php $Blog->disp( 'url', 'xmlattr' ) ?>">
  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      <dc:language><?php $Blog->disp( 'locale', 'xml' ) ?></dc:language>
  55      <admin:generatorAgent rdf:resource="http://b2evolution.net/?v=<?php echo $app_version ?>"/>
  56      <sy:updatePeriod>hourly</sy:updatePeriod>
  57      <sy:updateFrequency>1</sy:updateFrequency>
  58      <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
  59      <items>
  60          <rdf:Seq>
  61          <?php
  62          while( $Item = & mainlist_get_item() )
  63          {    // For each blog post, do everything below up to the closing curly brace "}"
  64              ?>
  65              <rdf:li rdf:resource="<?php $Item->permanent_url( 'single' ) ?>"/>
  66          <?php } ?>
  67          </rdf:Seq>
  68      </items>
  69  </channel>
  70  <?php
  71  $MainList->restart();
  72  while( $Item = & mainlist_get_item() )
  73  {    // For each blog post, do everything below up to the closing curly brace "}"
  74      // Load Item's creator User:

  75      $Item->get_creator_User();
  76      ?>
  77  
  78  <item rdf:about="<?php $Item->permanent_url( 'single' ) ?>">
  79      <title><?php $Item->title( array(
  80                  'format' => 'xml',
  81                  'link_type' => 'none',
  82              ) ); ?></title>
  83      <link><?php $Item->permanent_url( 'single' ) ?></link>
  84      <?php
  85          $Item->issue_date( array(
  86                  'before'      => '<dc:date>',
  87                  'after'       => '</dc:date>',
  88                  'date_format' => 'isoZ',
  89                 'use_GMT'     => true,
  90              ) );
  91      ?>
  92      <dc:creator><?php $Item->creator_User->preferred_name( 'xml' ) ?></dc:creator>
  93      <dc:subject><?php $Item->main_category( 'xml' ) ?></dc:subject>
  94      <?php
  95          if( $feed_content == 'excerpt' )
  96          {
  97              ?>
  98      <description><?php
  99          $content = $Item->get_excerpt( 'entityencoded' );
 100  
 101          // fp> this is another one of these "oooooh it's just a tiny little change"

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 177          echo make_rel_links_abs( $content );
 178      ?>]]></content:encoded>
 179              <?php
 180          }
 181      ?>
 182  </item>
 183  <?php
 184  }
 185  ?>
 186  </rdf:RDF>
 187  <?php
 188      $Hit->log(); // log the hit on this page

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

 191      exit();
 192  ?>


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