Ticket #1526: wp-atom.patch
| File wp-atom.patch, 9.9 KB (added by , 20 years ago) |
|---|
-
trunk/wp-atom.php
diff -ru wp-svn/trunk/wp-atom.php wp-work/trunk/wp-atom.php
old new 1 1 <?php 2 // Atom 1.0 feed generator for WordPress 3 // Distributed under the terms of the GNU General Public License v2 2 4 3 if (empty($wp)) { 4 require_once('wp-config.php'); 5 wp('feed=atom'); 5 if (empty($feed)) { 6 $blog = 1; 7 $feed = 'atom'; 8 $doing_rss = 1; 9 require('wp-blog-header.php'); 6 10 } 7 11 8 12 header('Content-type: application/atom+xml; charset=' . get_settings('blog_charset'), true); 9 13 $more = 1; 10 11 14 ?> 12 <?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; ?> 13 <feed version="0.3" 14 xmlns="http://purl.org/atom/ns#" 15 xmlns:dc="http://purl.org/dc/elements/1.1/" 16 xml:lang="<?php echo get_option('rss_language'); ?>" 17 <?php do_action('atom_ns'); ?> 18 > 19 <title><?php bloginfo_rss('name') ?></title> 20 <link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" /> 21 <tagline><?php bloginfo_rss("description") ?></tagline> 22 <modified><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></modified> 23 <copyright>Copyright <?php echo mysql2date('Y', get_lastpostdate('blog'), 0); ?></copyright> 24 <generator url="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator> 15 <?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'."\n"; ?> 16 <feed xmlns="http://www.w3.org/2005/Atom" 17 xml:lang="<?php echo get_option('rss_language'); ?>" 18 <?php do_action('atom_ns'); ?>> 19 <title><?php bloginfo_rss('name'); ?></title> 20 <subtitle><?php bloginfo_rss('description'); ?></subtitle> 21 <id><?php bloginfo('url'); ?>/</id> 22 <link rel="self" type="application/atom+xml" href="<?php bloginfo('atom_url'); ?>"/> 23 <link rel="alternate" type="<?php bloginfo('html_type'); ?>" href="<?php bloginfo_rss('home'); ?>/"/> 24 <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></updated> 25 <rights>Copyright <?php echo mysql2date('Y', get_lastpostdate('blog'), 0); ?></rights> 26 <generator uri="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator> 25 27 <?php do_action('atom_head'); ?> 26 <?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?>28 <?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?> 27 29 <entry> 28 <author>29 <name><?php the_author() ?></name>30 <author> 31 <name><?php the_author(); ?></name> 30 32 </author> 31 <title type="text/html" mode="escaped"><![CDATA[<?php the_title_rss() ?>]]></title> 32 <link rel="alternate" type="text/html" href="<?php permalink_single_rss() ?>" /> 33 <id><?php the_guid(); ?></id> 34 <modified><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></modified> 35 <issued><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></issued> 36 <?php the_category_rss('rdf') ?> 37 <summary type="text/plain" mode="escaped"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary> 33 <title type="html"><![CDATA[ <?php the_title_rss(); ?> ]]></title> 34 <link rel="alternate" type="<?php bloginfo('html_type'); ?>" href="<?php permalink_single_rss(); ?>"/> 35 <id><?php permalink_single_rss(); ?></id> 36 <published><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></published> 37 <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z',$post->post_modified_gmt); ?></updated> 38 <?php 39 $categories_path = get_category_link(0); 40 $categories = get_the_category(); 41 foreach ($categories as $cat) { ?> 42 <category scheme="<?php echo $categories_path; ?>" 43 term="<?php $foo = "/" . str_replace('/','\/',$categories_path) . "/"; 44 echo preg_replace($foo,'',get_category_link($cat->cat_ID)); ?>" 45 label="<?php echo $cat->cat_name; ?>"/> 46 <?php } ?> 47 <summary type="html"> 48 <![CDATA[ <?php the_excerpt_rss(); ?> ]]> 49 </summary> 38 50 <?php if ( !get_settings('rss_use_excerpt') ) : ?> 39 <content type="<?php bloginfo('html_type'); ?>" mode="escaped" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content> 51 <content type="html"> 52 <![CDATA[ <?php the_content('', 0, '') ?> ]]> 53 </content> 54 <?php atom_enclosure(); ?> 55 <?php do_action('atom_entry'); ?> 40 56 <?php endif; ?> 41 <?php rss_enclosure(); ?>42 <?php do_action('atom_entry'); ?>43 57 </entry> 44 <?php $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?> 45 </feed> 58 <?php $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?> 59 </feed> 60 No newline at end of file -
trunk/wp-content/themes/classic/header.php
diff -ru wp-svn/trunk/wp-content/themes/classic/header.php wp-work/trunk/wp-content/themes/classic/header.php
old new 5 5 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> 6 6 7 7 <title><?php bloginfo('name'); ?><?php wp_title(); ?></title> 8 8 9 9 <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please --> 10 10 11 11 <style type="text/css" media="screen"> … … 14 14 15 15 <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" /> 16 16 <link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" /> 17 <link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />18 17 <link rel="alternate" type="application/atom+xml" title="Atom 1.0 feed" href="<?php bloginfo('atom_url'); ?>" /> 18 19 19 <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> 20 20 <?php wp_get_archives('type=monthly&format=link'); ?> 21 21 <?php //comments_popup_script(); // off by default ?> -
trunk/wp-content/themes/default/header.php
diff -ru wp-svn/trunk/wp-content/themes/default/header.php wp-work/trunk/wp-content/themes/default/header.php
old new 9 9 <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats --> 10 10 11 11 <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> 12 <link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" /> 12 13 <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" /> 13 14 <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> 14 15 … … 16 17 /* To accomodate differing install paths of WordPress, images are referred only here, 17 18 and not in the wp-layout.css file. If you prefer to use only CSS for colors and what 18 19 not, then go right ahead and delete the following lines, and the image files. */ 19 20 body { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgcolor.jpg"); } 20 21 body { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgcolor.jpg"); } 21 22 <?php /* Checks to see whether it needs a sidebar or not */ if ((! $withcomments) && (! is_single())) { ?> 22 23 #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg.jpg") repeat-y top; border: none; } 23 24 <?php } else { // No sidebar ?> 24 #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgwide.jpg") repeat-y top; border: none; } 25 #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgwide.jpg") repeat-y top; border: none; } 25 26 <?php } ?> 26 27 #header { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickheader.jpg") no-repeat bottom center; } 27 28 #footer { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickfooter.jpg") no-repeat bottom; border: none;} 28 29 29 30 /* Because the template is slightly different, size-wise, with images, this needs to be set here 30 31 If you don't want to use the template's images, you can also delete the following two lines. */ 31 32 32 33 #header { margin: 0 !important; margin: 0 0 0 1px; padding: 1px; height: 198px; width: 758px; } 33 #headerimg { margin: 7px 9px 0; height: 192px; width: 740px; } 34 #headerimg { margin: 7px 9px 0; height: 192px; width: 740px; } 34 35 35 36 /* To ease the insertion of a personal header image, I have done it in such a way, 36 37 that you simply drop in an image called 'personalheader.jpg' into your /images/ -
trunk/wp-includes/feed-functions.php
diff -ru wp-svn/trunk/wp-includes/feed-functions.php wp-work/trunk/wp-includes/feed-functions.php
old new 99 99 $link = get_author_link(0, $author_id, $author_nicename); 100 100 $link = $link . "feed/"; 101 101 } 102 102 103 103 $link = apply_filters('author_feed_link', $link); 104 104 105 105 if ($echo) echo $link; … … 142 142 143 143 $custom_fields = get_post_custom(); 144 144 if( is_array( $custom_fields ) ) { 145 while( list( $key, $val ) = each( $custom_fields ) ) { 145 while( list( $key, $val ) = each( $custom_fields ) ) { 146 146 if( $key == 'enclosure' ) { 147 147 if (is_array($val)) { 148 148 foreach($val as $enc) { … … 155 155 } 156 156 } 157 157 158 function atom_enclosure() { 159 global $id, $post; 160 if (!empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password)) return; 161 162 $custom_fields = get_post_custom(); 163 if( is_array( $custom_fields ) ) { 164 while( list( $key, $val ) = each( $custom_fields ) ) { 165 if( $key == 'enclosure' ) { 166 if (is_array($val)) { 167 foreach($val as $enc) { 168 $enclosure = split( "\n", $enc ); 169 print "<link rel=\"enclosure\" href=\"".trim( htmlspecialchars($enclosure[ 0 ]) )."\" length=\"".trim( $enclosure[ 1 ] )."\" type=\"".trim( $enclosure[ 2 ] )."\"/>\n"; 170 } 171 } 172 } 173 } 174 } 175 } 158 176 ?> 177 No newline at end of file