[ Index ] |
|
Code source de WordPress 2.1.2 |
1 <?php 2 3 if (empty($wp)) { 4 require_once('wp-config.php'); 5 wp('feed=rss2&withcomments=1'); 6 } 7 8 header('Content-type: text/xml;charset=' . get_option('blog_charset'), true); 9 10 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; 11 ?> 12 <!-- generator="wordpress/<?php echo $wp_version ?>" --> 13 <rss version="2.0" 14 xmlns:content="http://purl.org/rss/1.0/modules/content/"> 15 <channel> 16 <?php 17 $i = 0; 18 if (have_posts()) : 19 while (have_posts()) : the_post(); 20 if ($i < 1) { 21 $i++; 22 ?> 23 <title><?php if (is_single() || is_page() ) { printf(__('Comments on: %s'), get_the_title_rss()); } else { printf(__('Comments for %s'), get_bloginfo_rss("name")); } ?></title> 24 <link><?php (is_single()) ? permalink_single_rss() : bloginfo_rss("url") ?></link> 25 <description><?php bloginfo_rss("description") ?></description> 26 <pubDate><?php echo gmdate('r'); ?></pubDate> 27 <generator>http://wordpress.org/?v=<?php echo $wp_version ?></generator> 28 29 <?php 30 if (is_single() || is_page()) { 31 $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email, 32 comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, 33 $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments 34 LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '" . get_the_ID() . "' 35 AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status = 'publish' 36 AND post_date_gmt < '" . gmdate("Y-m-d H:i:59") . "' 37 ORDER BY comment_date_gmt ASC" ); 38 } else { // if no post id passed in, we'll just ue the last 10 comments. 39 $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email, 40 comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, 41 $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments 42 LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status = 'publish' 43 AND $wpdb->comments.comment_approved = '1' AND post_date_gmt < '" . gmdate("Y-m-d H:i:s") . "' 44 ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss') ); 45 } 46 // this line is WordPress' motor, do not delete it. 47 if ($comments) { 48 foreach ($comments as $comment) { 49 $GLOBALS['comment'] =& $comment; 50 // Some plugins may need to know the metadata 51 // associated with this comment's post: 52 get_post_custom($comment->comment_post_ID); 53 ?> 54 <item> 55 <title><?php if ( ! (is_single() || is_page()) ) { 56 $title = get_the_title($comment->comment_post_ID); 57 $title = apply_filters('the_title', $title); 58 $title = apply_filters('the_title_rss', $title); 59 printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss()); 60 } else { 61 printf(__('By: %s'), get_comment_author_rss()); 62 } ?></title> 63 <link><?php comment_link() ?></link> 64 <author><?php echo get_comment_author_rss() ?></author> 65 <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate> 66 <guid><?php comment_link() ?></guid> 67 <?php 68 if (!empty($comment->post_password) && $_COOKIE['wp-postpass'] != $comment->post_password) { 69 ?> 70 <description><?php _e('Protected Comments: Please enter your password to view comments.'); ?></description> 71 <content:encoded><![CDATA[<?php echo get_the_password_form() ?>]]></content:encoded> 72 <?php 73 } else { 74 ?> 75 <description><?php comment_text_rss() ?></description> 76 <content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded> 77 <?php 78 } // close check for password 79 do_action('commentrss2_item', $comment->comment_ID, $comment->comment_post_ID); 80 ?> 81 </item> 82 <?php 83 } 84 } 85 } 86 endwhile; endif; 87 ?> 88 </channel> 89 </rss>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 30 19:41:27 2007 | par Balluche grâce à PHPXref 0.7 |