Ticket #9510: php.files.to.patch
| File php.files.to.patch, 6.7 KB (added by simek, 4 years ago) |
|---|
-
feed-atom.php
5 5 * @package WordPress 6 6 */ 7 7 8 function echo_feed_subtitle() { 9 $feed_subtitle=get_bloginfo_rss("description"); 10 if(!empty($feed_subtitle)) { 11 echo '<subtitle type="text">'.$feed_subtitle.'</subtitle>'."\n"; 12 } 13 } 14 function get_query_id() { 15 global $wp_query; 16 return $wp_query->get_queried_object_id(); 17 } 18 function echo_atom_feed_links($selfLink,$alternateLink,$repliesLink) { 19 echo '<link rel="self" type="application/atom+xml" href="'.$selfLink.'" />'."\n".'<link rel="alternate" type="text/html" href="'.$alternateLink.'" />'."\n".'<link rel="replies" type="application/atom+xml" href="'.$repliesLink.'" />'."\n"; 20 } 21 8 22 header('Content-Type: ' . feed_content_type('atom') . '; charset=' . get_option('blog_charset'), true); 9 23 $more = 1; 24 $feed_type="atom"; 10 25 11 26 ?> 12 27 <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> … … 17 32 xml:base="<?php bloginfo_rss('home') ?>/wp-atom.php" 18 33 <?php do_action('atom_ns'); ?> 19 34 > 35 <id><?php bloginfo('atom_url'); ?></id> 20 36 <title type="text"><?php bloginfo_rss('name'); wp_title_rss(); ?></title> 21 <subtitle type="text"><?php bloginfo_rss("description") ?></subtitle> 22 23 <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></updated> 37 <?php 38 if(is_category()) { 39 $cat_id=get_query_id(); 40 echo_atom_feed_links(get_category_feed_link($cat_id),get_category_link($cat_id),get_category_comments_feed_link($cat_id,$feed_type)); 41 } 42 elseif(is_tag()) { 43 $tag_id=get_query_id(); 44 echo_atom_feed_links(get_tag_feed_link($tag_id),get_tag_link($tag_id),get_tag_comments_feed_link($tag_id,$feed_type)); 45 } 46 elseif(is_author()) { 47 $author_id=get_query_id(); 48 echo_atom_feed_links(get_author_feed_link($author_id),get_author_posts_url($author_id),get_author_comments_feed_link($author_id,$feed_type)); 49 } 50 elseif(is_date()) { 51 /* To be done */ 52 } 53 elseif(is_search()) { 54 $search_query=get_search_query(); 55 echo_atom_feed_links(get_search_feed_link($search_query,$feed_type),get_search_link($search_query),get_search_comments_feed_link($search_query,$feed_type)); 56 } 57 else { 58 echo_feed_subtitle(); 59 echo_atom_feed_links(get_bloginfo('atom_url'),get_bloginfo_rss('url').'/',get_bloginfo_rss('comments_atom_url')); 60 }?> 24 61 <?php the_generator( 'atom' ); ?> 25 26 <link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />27 <id><?php bloginfo('atom_url'); ?></id>28 <link rel="self" type="application/atom+xml" href="<?php self_link(); ?>" />29 30 62 <?php do_action('atom_head'); ?> 63 <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></updated> 31 64 <?php while (have_posts()) : the_post(); ?> 32 65 <entry> 33 66 <author> … … 41 74 <id><?php the_guid(); ?></id> 42 75 <updated><?php echo get_post_modified_time('Y-m-d\TH:i:s\Z', true); ?></updated> 43 76 <published><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></published> 44 <?php the_category_rss( 'atom') ?>77 <?php the_category_rss($feed_type) ?> 45 78 <summary type="<?php html_type_rss(); ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary> 46 79 <?php if ( !get_option('rss_use_excerpt') ) : ?> 47 80 <content type="<?php html_type_rss(); ?>" xml:base="<?php the_permalink_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content> … … 49 82 <?php atom_enclosure(); ?> 50 83 <?php do_action('atom_entry'); ?> 51 84 <link rel="replies" type="text/html" href="<?php the_permalink_rss() ?>#comments" thr:count="<?php echo get_comments_number()?>"/> 52 <link rel="replies" type="application/atom+xml" href="<?php echo get_post_comments_feed_link(0, 'atom') ?>" thr:count="<?php echo get_comments_number()?>"/>85 <link rel="replies" type="application/atom+xml" href="<?php echo get_post_comments_feed_link(0,$feed_type) ?>" thr:count="<?php echo get_comments_number()?>"/> 53 86 <thr:total><?php echo get_comments_number()?></thr:total> 54 87 </entry> 55 88 <?php endwhile ; ?> -
link-template.php
5 5 * @package WordPress 6 6 * @subpackage Template 7 7 */ 8 9 function get_category_comments_feed_link($cat_id, $feed = '') { 10 $cat_id = (int) $cat_id; 8 11 12 $category = get_category($cat_id); 13 14 if ( empty($category) || is_wp_error($category) ) 15 return false; 16 17 if ( empty($feed) ) 18 $feed = get_default_feed(); 19 20 $permalink_structure = get_option('permalink_structure'); 21 22 if ( '' == $permalink_structure ) { 23 $link = get_option('home') . "?feed=comments-$feed&cat=" . $cat_id; 24 } else { 25 $link = get_category_link($cat_id); 26 if( $feed == get_default_feed() ) 27 $feed_link = 'comments/feed'; 28 else 29 $feed_link = "comments/feed/$feed"; 30 31 $link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed'); 32 } 33 34 $link = apply_filters('category_comments_feed_link', $link, $feed); 35 36 return $link; 37 } 38 function get_tag_comments_feed_link($tag_id, $feed = '') { 39 $tag_id = (int) $tag_id; 40 41 $tag = get_tag($tag_id); 42 43 if ( empty($tag) || is_wp_error($tag) ) 44 return false; 45 46 $permalink_structure = get_option('permalink_structure'); 47 48 if ( empty($feed) ) 49 $feed = get_default_feed(); 50 51 if ( '' == $permalink_structure ) { 52 $link = get_option('home') . "?feed=comments-$feed&tag=" . $tag->slug; 53 } else { 54 $link = get_tag_link($tag->term_id); 55 if ( $feed == get_default_feed() ) 56 $feed_link = 'comments/feed'; 57 else 58 $feed_link = "comments/feed/$feed"; 59 $link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed'); 60 } 61 62 $link = apply_filters('tag_comments_feed_link', $link, $feed); 63 64 return $link; 65 } 66 function get_author_comments_feed_link( $author_id, $feed = '' ) { 67 $author_id = (int) $author_id; 68 $permalink_structure = get_option('permalink_structure'); 69 70 if ( empty($feed) ) 71 $feed = get_default_feed(); 72 73 if ( '' == $permalink_structure ) { 74 $link = get_option('home') . "?feed=comments-$feed&author=" . $author_id; 75 } else { 76 $link = get_author_posts_url($author_id); 77 if ( $feed == get_default_feed() ) 78 $feed_link = 'comments/feed'; 79 else 80 $feed_link = "comments/feed/$feed"; 81 82 $link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed'); 83 } 84 85 $link = apply_filters('author_comments_feed_link', $link, $feed); 86 87 return $link; 88 } 89 function get_search_link($search_query) { 90 if (empty($search_query)) { 91 $search=attribute_escape(get_search_query()); 92 } 93 else { 94 $search=attribute_escape(stripslashes($search_query)); 95 } 96 $link=get_option('home')."?s=$search"; 97 $link=apply_filters('search_link',$link); 98 return $link; 99 } 100 9 101 /** 10 102 * Display the permalink for the current post. 11 103 *
