[ Index ] |
|
Code source de b2evolution 2.1.0-beta |
1 <?php 2 /** 3 * This template generates an Atom 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://atompub.org/2005/07/11/draft-ietf-atompub-format-10.html} 9 * 10 * @package evoskins 11 * @subpackage atom 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 if( $debug) 31 { 32 skin_content_header( 'application/xml' ); // Sets charset! 33 } 34 else 35 { 36 skin_content_header( 'application/atom+xml' ); // Sets charset! 37 } 38 39 echo '<?xml version="1.0" encoding="'.$io_charset.'"?'.'>'; 40 ?> 41 <feed xml:lang="<?php $Blog->disp( 'locale', 'xml' ) ?>" xmlns="http://www.w3.org/2005/Atom"> 42 <title><?php 43 $Blog->disp( 'name', 'xml' ); 44 // ------------------------- TITLE FOR THE CURRENT REQUEST ------------------------- 45 request_title( array( 46 'title_before'=> ' - ', 47 'title_after' => '', 48 'title_none' => '', 49 'glue' => ' - ', 50 'title_single_disp' => true, 51 'format' => 'xml', 52 ) ); 53 // ------------------------------ END OF REQUEST TITLE ----------------------------- 54 ?></title> 55 <link rel="alternate" type="text/html" href="<?php $Blog->disp( 'url', 'xml' ) ?>" /> 56 <link rel="self" type="application/atom+xml" href="<?php $Blog->disp( 'atom_url', 'xmlattr' ) ?>" /> 57 <id><?php $Blog->disp( 'atom_url', 'xmlattr' ); /* TODO: may need a regenerate_url() */ ?></id> 58 <subtitle><?php $Blog->disp( 'shortdesc', 'xml' ) ?></subtitle> 59 <generator uri="http://b2evolution.net/" version="<?php echo $app_version ?>"><?php echo $app_name ?></generator> 60 <updated><?php echo gmdate('Y-m-d\TH:i:s\Z'); ?></updated> 61 <?php 62 while( $Item = & mainlist_get_item() ) 63 { // For each blog post, do everything below up to the closing curly brace "}" 64 // Load Item's creator User: 65 $Item->get_creator_User(); 66 ?> 67 68 <entry> 69 <title type="text"><?php $Item->title( array( 70 'format' => 'xml', 71 'link_type' => 'none', 72 ) ); ?></title> 73 <link rel="alternate" type="text/html" href="<?php $Item->permanent_url( 'single' ) ?>" /> 74 <author> 75 <name><?php $Item->creator_User->preferred_name( 'xml' ) ?></name> 76 <?php $Item->creator_User->url( '<uri>', "</uri>\n", 'xml' ) ?> 77 </author> 78 <id><?php $Item->permanent_url( 'single' ) ?></id> 79 <?php 80 $Item->issue_date( array( 81 'before' => '<published>', 82 'after' => '</published>', 83 'date_format' => 'isoZ', 84 'use_GMT' => true, 85 ) ); 86 ?> 87 <updated><?php $Item->mod_date( 'isoZ', true ) ?></updated> 88 <?php 89 if( $feed_content == 'excerpt' ) 90 { 91 ?> 92 <content type="html"><![CDATA[<?php 93 $content = $Item->get_excerpt( 'entityencoded' ); 94 95 // fp> this is another one of these "oooooh it's just a tiny little change" 96 // and "we only need to make the links absolute in RSS" 97 // and then you get half baked code! The URL LINK stays RELATIVE!! :(( 98 // TODO: clean solution : work in format_to_output! 99 echo make_rel_links_abs( $content ); 100 ?>]]></content> 101 <?php 102 } 103 elseif( $feed_content == 'normal' ) 104 { 105 ?> 106 <content type="html"><![CDATA[<?php 107 $Item->url_link( '<p>', '</p>' ); 108 109 // Display images that are linked to this post: 110 $content = $Item->get_images( array( 111 'before' => '<div>', 112 'before_image' => '<div>', 113 'before_image_legend' => '<div><i>', 114 'after_image_legend' => '</i></div>', 115 'after_image' => '</div>', 116 'after' => '</div>', 117 'image_size' => 'fit-320x320' 118 ), 'htmlbody' ); 119 120 $content .= $Item->get_content_teaser( 1, false ); 121 122 $content .= $Item->get_more_link( array( 123 'before' => '', 124 'after' => '', 125 'disppage' => 1, 126 ) ); 127 128 // fp> this is another one of these "oooooh it's just a tiny little change" 129 // and "we only need to make the links absolute in RSS" 130 // and then you get half baked code! The URL LINK stays RELATIVE!! :(( 131 // TODO: clean solution : work in format_to_output! --- we probably need 'htmlfeed' as 'htmlbody+absolute' 132 echo make_rel_links_abs( $content ); 133 ?>]]></content> 134 <?php 135 } 136 ?> 137 </entry> 138 139 <?php 140 } 141 ?> 142 </feed> 143 <?php 144 $Hit->log(); // log the hit on this page 145 146 // This is a self contained XML document, make sure there is no additional output: 147 exit(); 148 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 23:58:50 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |