WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #1526


Ignore:
Timestamp:
07/21/2005 05:42:23 AM (16 years ago)
Author:
markjaquith
Comment:

wp-atom.php.2.diff is a diff against current 1.6 SVN code. I have tried this out and it validates as Atom 1.0

Atom 0.3 is depreciated, so this should definitely be in the WP 1.6 release

Many thanks to comatoast for the patch

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1526

    • Property Status changed from new to assigned
    • Property Priority changed from normal to high
    • Property Keywords bg|has-patch bg|dev-feedback added
    • Property Version changed from 1.5.1.2 to 1.6
    • Property Milestone changed from to 1.6
    • Property Owner changed from anonymous to markjaquith
  • Ticket #1526 – Description

    initial v1  
    22
    33The old version of this file (as of 1.5.1.3) generates invalid Atom, so I figured that this would be an improvement.
    4 
    5 {{{
    6 <?php
    7 
    8 if (empty($feed)) {
    9     $blog = 1;
    10         $feed = 'atom';
    11     $doing_rss = 1;
    12     require('wp-blog-header.php');
    13 }
    14 
    15 header('Content-type: application/atom+xml; charset=' . get_settings('blog_charset'), true);
    16 $more = 1;
    17 
    18 ?>
    19 <?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; ?>
    20 <feed
    21   xmlns="http://www.w3.org/2005/Atom"
    22   xmlns:dc="http://purl.org/dc/elements/1.1/"
    23   xml:lang="<?php echo get_option('rss_language'); ?>"
    24   >
    25     <title><?php bloginfo_rss('name') ?></title>
    26     <link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
    27     <link rel="self"      type="application/atom+xml" href="<?php bloginfo('atom_url') ?>" />
    28     <subtitle><?php bloginfo_rss("description") ?></subtitle>
    29     <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></updated>
    30     <rights>Copyright <?php echo mysql2date('Y', get_lastpostdate('blog'), 0); ?></rights>
    31     <id><?php bloginfo('url') ?></id>
    32     <generator uri="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator>
    33 
    34     <?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?>
    35     <entry>
    36         <author>
    37             <name><?php the_author() ?></name>
    38         </author>
    39         <title type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><![CDATA[<?php the_title_rss() ?>]]></div></title>
    40         <link rel="alternate" type="text/html" href="<?php permalink_single_rss() ?>" />
    41         <id><?php the_guid(); ?></id>
    42         <updated><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></updated>
    43         <?php the_category_rss('rdf') ?>
    44         <summary type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><![CDATA[<?php the_excerpt_rss(); ?>]]></div></summary>
    45 <?php if ( !get_settings('rss_use_excerpt') ) : ?>
    46         <content type="xhtml" xml:base="<?php permalink_single_rss() ?>"><div xmlns="http://www.w3.org/1999/xhtml"><![CDATA[<?php the_content('', 0, '') ?>]]></div></content>
    47 <?php endif; ?>
    48 <?php rss_enclosure(); ?>
    49     </entry>
    50     <?php $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?>
    51 </feed>
    52 }}}