From dbedd143e436fcec99ce7a10fac2637e97caafda Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 23 Feb 2007 02:50:05 +0000 Subject: [PATCH] Relocate feed templates to wp-includes. fixes #3846 git-svn-id: http://svn.automattic.com/wordpress/trunk@4927 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-atom.php | 45 +--------------- wp-commentsrss2.php | 83 +----------------------------- wp-includes/feed-atom.php | 45 ++++++++++++++++ wp-includes/feed-rdf.php | 51 ++++++++++++++++++ wp-includes/feed-rss.php | 31 +++++++++++ wp-includes/feed-rss2-comments.php | 83 ++++++++++++++++++++++++++++++ wp-includes/feed-rss2.php | 50 ++++++++++++++++++ wp-includes/functions.php | 10 ++-- wp-rdf.php | 51 +----------------- wp-rss.php | 31 +---------- wp-rss2.php | 50 +----------------- 11 files changed, 275 insertions(+), 255 deletions(-) create mode 100644 wp-includes/feed-atom.php create mode 100644 wp-includes/feed-rdf.php create mode 100644 wp-includes/feed-rss.php create mode 100644 wp-includes/feed-rss2-comments.php create mode 100644 wp-includes/feed-rss2.php diff --git a/wp-atom.php b/wp-atom.php index 11db36506e..60f2155414 100644 --- a/wp-atom.php +++ b/wp-atom.php @@ -5,47 +5,6 @@ if (empty($wp)) { wp('feed=atom'); } -header('Content-type: application/atom+xml; charset=' . get_option('blog_charset'), true); -$more = 1; +require (ABSPATH . WPINC . '/feed-atom.php'); -?> -'; ?> - - > - <?php bloginfo_rss('name') ?> - - - - WordPress - - - - - - - - - - - - - <![CDATA[<?php the_title_rss() ?>]]> - - - - - - ]]> - - ]]> - - - - - - +?> \ No newline at end of file diff --git a/wp-commentsrss2.php b/wp-commentsrss2.php index 92858b6a99..531f6268be 100644 --- a/wp-commentsrss2.php +++ b/wp-commentsrss2.php @@ -5,85 +5,6 @@ if (empty($wp)) { wp('feed=rss2&withcomments=1'); } -header('Content-type: text/xml;charset=' . get_option('blog_charset'), true); +require (ABSPATH . WPINC . '/feed-rss2-comments.php'); -echo ''; -?> - - - - - <?php if (is_single() || is_page() ) { printf(__('Comments on: %s'), get_the_title_rss()); } else { printf(__('Comments for %s'), get_bloginfo_rss("name")); } ?> - - - - http://wordpress.org/?v= - -get_results("SELECT comment_ID, comment_author, comment_author_email, - comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, - $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments - LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '" . get_the_ID() . "' - AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status = 'publish' - AND post_date_gmt < '" . gmdate("Y-m-d H:i:59") . "' - ORDER BY comment_date_gmt ASC" ); - } else { // if no post id passed in, we'll just ue the last 10 comments. - $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email, - comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, - $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments - LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status = 'publish' - AND $wpdb->comments.comment_approved = '1' AND post_date_gmt < '" . gmdate("Y-m-d H:i:s") . "' - ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss') ); - } - // this line is WordPress' motor, do not delete it. - if ($comments) { - foreach ($comments as $comment) { - $GLOBALS['comment'] =& $comment; - // Some plugins may need to know the metadata - // associated with this comment's post: - get_post_custom($comment->comment_post_ID); -?> - - <?php if ( ! (is_single() || is_page()) ) { - $title = get_the_title($comment->comment_post_ID); - $title = apply_filters('the_title', $title); - $title = apply_filters('the_title_rss', $title); - printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss()); - } else { - printf(__('By: %s'), get_comment_author_rss()); - } ?> - - - - - post_password) && $_COOKIE['wp-postpass'] != $comment->post_password) { - ?> - - ]]> - - - ]]> - comment_ID, $comment->comment_post_ID); - ?> - - - - +?> \ No newline at end of file diff --git a/wp-includes/feed-atom.php b/wp-includes/feed-atom.php new file mode 100644 index 0000000000..17fce725d1 --- /dev/null +++ b/wp-includes/feed-atom.php @@ -0,0 +1,45 @@ + +'; ?> + + > + <?php bloginfo_rss('name') ?> + + + + WordPress + + + + + + + + + + + + + <![CDATA[<?php the_title_rss() ?>]]> + + + + + + ]]> + + ]]> + + + + + + diff --git a/wp-includes/feed-rdf.php b/wp-includes/feed-rdf.php new file mode 100644 index 0000000000..80b1d6d0b5 --- /dev/null +++ b/wp-includes/feed-rdf.php @@ -0,0 +1,51 @@ + +'; ?> + + +> +"> + <?php bloginfo_rss('name') ?> + + + + + hourly + 1 + 2000-01-01T12:00+00:00 + + + + + + + + + + + + <?php the_title_rss() ?> + + post_date_gmt, false); ?> + + + + + + + ]]> + + + + + diff --git a/wp-includes/feed-rss.php b/wp-includes/feed-rss.php new file mode 100644 index 0000000000..97e06105c6 --- /dev/null +++ b/wp-includes/feed-rss.php @@ -0,0 +1,31 @@ + +'; ?> + + + + <?php bloginfo_rss('name') ?> + + + + http://backend.userland.com/rss092 + + + + + + <?php the_title_rss() ?> + + ]]> + + + + + + + + + diff --git a/wp-includes/feed-rss2-comments.php b/wp-includes/feed-rss2-comments.php new file mode 100644 index 0000000000..4e49898492 --- /dev/null +++ b/wp-includes/feed-rss2-comments.php @@ -0,0 +1,83 @@ +'; +?> + + + + + <?php if (is_single() || is_page() ) { printf(__('Comments on: %s'), get_the_title_rss()); } else { printf(__('Comments for %s'), get_bloginfo_rss("name")); } ?> + + + + http://wordpress.org/?v= + +get_results("SELECT comment_ID, comment_author, comment_author_email, + comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, + $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments + LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '" . get_the_ID() . "' + AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status = 'publish' + AND post_date_gmt < '" . gmdate("Y-m-d H:i:59") . "' + ORDER BY comment_date_gmt ASC" ); + } else { // if no post id passed in, we'll just ue the last 10 comments. + $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email, + comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, + $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments + LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status = 'publish' + AND $wpdb->comments.comment_approved = '1' AND post_date_gmt < '" . gmdate("Y-m-d H:i:s") . "' + ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss') ); + } + // this line is WordPress' motor, do not delete it. + if ($comments) { + foreach ($comments as $comment) { + $GLOBALS['comment'] =& $comment; + // Some plugins may need to know the metadata + // associated with this comment's post: + get_post_custom($comment->comment_post_ID); +?> + + <?php if ( ! (is_single() || is_page()) ) { + $title = get_the_title($comment->comment_post_ID); + $title = apply_filters('the_title', $title); + $title = apply_filters('the_title_rss', $title); + printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss()); + } else { + printf(__('By: %s'), get_comment_author_rss()); + } ?> + + + + + post_password) && $_COOKIE['wp-postpass'] != $comment->post_password) { + ?> + + ]]> + + + ]]> + comment_ID, $comment->comment_post_ID); + ?> + + + + diff --git a/wp-includes/feed-rss2.php b/wp-includes/feed-rss2.php new file mode 100644 index 0000000000..03711df845 --- /dev/null +++ b/wp-includes/feed-rss2.php @@ -0,0 +1,50 @@ + +'; ?> + + + +> + + + <?php bloginfo_rss('name'); ?> + + + + http://wordpress.org/?v= + + + + + <?php the_title_rss() ?> + + + + + + + + + ]]> + + ]]> + post_content ) > 0 ) : ?> + ]]> + + ]]> + + + + + + + + + diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 644e45e1fe..7ee2c48e5f 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -958,23 +958,23 @@ function do_feed() { } function do_feed_rdf() { - load_template(ABSPATH . 'wp-rdf.php'); + load_template(ABSPATH . WPINC . '/feed-rdf.php'); } function do_feed_rss() { - load_template(ABSPATH . 'wp-rss.php'); + load_template(ABSPATH . WPINC . '/feed-rss.php'); } function do_feed_rss2($for_comments) { if ( $for_comments ) { - load_template(ABSPATH . 'wp-commentsrss2.php'); + load_template(ABSPATH . WPINC . '/feed-rss2-comments.php'); } else { - load_template(ABSPATH . 'wp-rss2.php'); + load_template(ABSPATH . WPINC . '/feed-rss2.php'); } } function do_feed_atom() { - load_template(ABSPATH . 'wp-atom.php'); + load_template(ABSPATH . WPINC . '/feed-atom.php'); } function do_robots() { diff --git a/wp-rdf.php b/wp-rdf.php index f64709e725..293032b442 100644 --- a/wp-rdf.php +++ b/wp-rdf.php @@ -5,53 +5,6 @@ if (empty($wp)) { wp('feed=rdf'); } -header('Content-type: application/rdf+xml; charset=' . get_option('blog_charset'), true); -$more = 1; +require (ABSPATH . WPINC . '/feed-rdf.php'); -?> -'; ?> - - -> -"> - <?php bloginfo_rss('name') ?> - - - - - hourly - 1 - 2000-01-01T12:00+00:00 - - - - - - - - - - - - <?php the_title_rss() ?> - - post_date_gmt, false); ?> - - - - - - - ]]> - - - - - +?> \ No newline at end of file diff --git a/wp-rss.php b/wp-rss.php index c10b065f0e..9df542773f 100644 --- a/wp-rss.php +++ b/wp-rss.php @@ -5,33 +5,6 @@ if (empty($wp)) { wp('feed=rss'); } -header('Content-type: text/xml; charset=' . get_option('blog_charset'), true); -$more = 1; +require (ABSPATH . WPINC . '/feed-rss.php'); -?> -'; ?> - - - - <?php bloginfo_rss('name') ?> - - - - http://backend.userland.com/rss092 - - - - - - <?php the_title_rss() ?> - - ]]> - - - - - - - - - +?> \ No newline at end of file diff --git a/wp-rss2.php b/wp-rss2.php index 4addfc4bc6..6467ab8e93 100644 --- a/wp-rss2.php +++ b/wp-rss2.php @@ -5,52 +5,6 @@ if (empty($wp)) { wp('feed=rss2'); } -header('Content-type: text/xml; charset=' . get_option('blog_charset'), true); -$more = 1; +require (ABSPATH . WPINC . '/feed-rss2.php'); -?> -'; ?> - - - -> - - - <?php bloginfo_rss('name'); ?> - - - - http://wordpress.org/?v= - - - - - <?php the_title_rss() ?> - - - - - - - - - ]]> - - ]]> - post_content ) > 0 ) : ?> - ]]> - - ]]> - - - - - - - - - +?> \ No newline at end of file