Ticket #4967: 4967.patch
File 4967.patch, 7.0 KB (added by , 15 years ago) |
---|
-
feed-rss.php
4 4 * 5 5 * @package WordPress 6 6 */ 7 8 header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); 9 $more = 1; 10 11 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> 12 <?php the_generator( 'comment' ); ?> 7 8 $obsolete_rss092=apply_filters("obsolete_rss092",true); 9 if($obsolete_rss092==true): 10 $feed_type="rss2"; 11 if(is_category()) { 12 $link=get_category_feed_link($wp_query->get_queried_object_id(),$feed_type,false); 13 } 14 elseif(is_tag()) { 15 $link=get_tag_feed_link($wp_query->get_queried_object_id(),$feed_type,false); 16 } 17 elseif(is_author()) { 18 $link=get_author_feed_link($wp_query->get_queried_object_id(),$feed_type,false); 19 } 20 elseif(is_search()) { 21 $link=get_search_feed_link($wp_query->get_queried_object_id(),$feed_type,false); 22 } 23 else { 24 $link=get_feed_link($feed_type); 25 } 26 wp_redirect($link,301); 27 else: 28 header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); 29 $more = 1; 30 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; the_generator( 'comment' ); ?> 13 31 <rss version="0.92"> 14 32 <channel> 15 33 <title><?php bloginfo_rss('name'); wp_title_rss(); ?></title> … … 34 52 <?php endwhile; ?> 35 53 </channel> 36 54 </rss> 55 <?php endif; ?> 56 No newline at end of file -
link-template.php
397 397 * @param string $feed Optional. Feed type. 398 398 * @return string 399 399 */ 400 function get_post_comments_feed_link($post_id = '', $feed = '' ) {400 function get_post_comments_feed_link($post_id = '', $feed = '', $escape = true) { 401 401 global $id; 402 402 403 403 if ( empty($post_id) ) … … 414 414 } else { 415 415 $type = get_post_field('post_type', $post_id); 416 416 if ( 'page' == $type ) 417 $url = trailingslashit(get_option('home')) . "?feed=$feed& amp;page_id=$post_id";417 $url = trailingslashit(get_option('home')) . "?feed=$feed&page_id=$post_id"; 418 418 else 419 $url = trailingslashit(get_option('home')) . "?feed=$feed& amp;p=$post_id";419 $url = trailingslashit(get_option('home')) . "?feed=$feed&p=$post_id"; 420 420 } 421 421 if($escape == true) { 422 $url = esc_url($url); 423 } 422 424 return apply_filters('post_comments_feed_link', $url); 423 425 } 424 426 … … 438 440 * @param string $feed Optional. Feed format. 439 441 * @return string Link to the comment feed for the current post. 440 442 */ 441 function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' 442 $url = get_post_comments_feed_link($post_id, $feed );443 function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '', $escape = true) { 444 $url = get_post_comments_feed_link($post_id, $feed, $escape); 443 445 if ( empty($link_text) ) 444 446 $link_text = __('Comments Feed'); 445 447 … … 460 462 * @param string $feed Optional. Feed type. 461 463 * @return string Link to the feed for the author specified by $author_id. 462 464 */ 463 function get_author_feed_link( $author_id, $feed = '' 465 function get_author_feed_link( $author_id, $feed = '', $escape = true) { 464 466 $author_id = (int) $author_id; 465 467 $permalink_structure = get_option('permalink_structure'); 466 468 … … 468 470 $feed = get_default_feed(); 469 471 470 472 if ( '' == $permalink_structure ) { 471 $link = trailingslashit(get_option('home')) . "?feed=$feed&a mp;author=" . $author_id;473 $link = trailingslashit(get_option('home')) . "?feed=$feed&author=" . $author_id; 472 474 } else { 473 475 $link = get_author_posts_url($author_id); 474 476 if ( $feed == get_default_feed() ) … … 478 480 479 481 $link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed'); 480 482 } 481 483 if($escape == true) { 484 $link = esc_url($link); 485 } 482 486 $link = apply_filters('author_feed_link', $link, $feed); 483 487 484 488 return $link; … … 498 502 * @param string $feed Optional. Feed type. 499 503 * @return string Link to the feed for the category specified by $cat_id. 500 504 */ 501 function get_category_feed_link($cat_id, $feed = '' ) {505 function get_category_feed_link($cat_id, $feed = '', $escape = true) { 502 506 $cat_id = (int) $cat_id; 503 507 504 508 $category = get_category($cat_id); … … 512 516 $permalink_structure = get_option('permalink_structure'); 513 517 514 518 if ( '' == $permalink_structure ) { 515 $link = trailingslashit(get_option('home')) . "?feed=$feed& amp;cat=" . $cat_id;519 $link = trailingslashit(get_option('home')) . "?feed=$feed&cat=" . $cat_id; 516 520 } else { 517 521 $link = get_category_link($cat_id); 518 522 if( $feed == get_default_feed() ) … … 522 526 523 527 $link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed'); 524 528 } 525 529 if($escape == true) { 530 $link = esc_url($link); 531 } 526 532 $link = apply_filters('category_feed_link', $link, $feed); 527 533 528 534 return $link; … … 537 543 * @param string $feed Optional. Feed type. 538 544 * @return string 539 545 */ 540 function get_tag_feed_link($tag_id, $feed = '' ) {546 function get_tag_feed_link($tag_id, $feed = '', $escape = true) { 541 547 $tag_id = (int) $tag_id; 542 548 543 549 $tag = get_tag($tag_id); … … 551 557 $feed = get_default_feed(); 552 558 553 559 if ( '' == $permalink_structure ) { 554 $link = trailingslashit(get_option('home')) . "?feed=$feed& amp;tag=" . $tag->slug;560 $link = trailingslashit(get_option('home')) . "?feed=$feed&tag=" . $tag->slug; 555 561 } else { 556 562 $link = get_tag_link($tag->term_id); 557 563 if ( $feed == get_default_feed() ) … … 560 566 $feed_link = "feed/$feed"; 561 567 $link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed'); 562 568 } 563 569 if($escape == true) { 570 $link = esc_url($link); 571 } 564 572 $link = apply_filters('tag_feed_link', $link, $feed); 565 573 566 574 return $link; … … 617 625 * @param string $feed Optional. Feed type. 618 626 * @return string 619 627 */ 620 function get_search_feed_link($search_query = '', $feed = '' ) {628 function get_search_feed_link($search_query = '', $feed = '', $escape = true) { 621 629 if ( empty($search_query) ) 622 630 $search = esc_attr(get_search_query()); 623 631 else … … 626 634 if ( empty($feed) ) 627 635 $feed = get_default_feed(); 628 636 629 $link = trailingslashit(get_option('home')) . "?s=$search&feed=$feed"; 630 637 $link = trailingslashit(get_option('home')) . "?s=$search&feed=$feed"; 638 if($escape == true) { 639 $link = esc_url($link); 640 } 631 641 $link = apply_filters('search_feed_link', $link); 632 642 633 643 return $link; … … 642 652 * @param string $feed Optional. Feed type. 643 653 * @return string 644 654 */ 645 function get_search_comments_feed_link($search_query = '', $feed = '' ) {655 function get_search_comments_feed_link($search_query = '', $feed = '', $escape = true) { 646 656 if ( empty($search_query) ) 647 657 $search = esc_attr(get_search_query()); 648 658 else … … 651 661 if ( empty($feed) ) 652 662 $feed = get_default_feed(); 653 663 654 $link = trailingslashit(get_option('home')) . "?s=$search&feed=comments-$feed"; 655 664 $link = trailingslashit(get_option('home')) . "?s=$search&feed=comments-$feed"; 665 if($escape == true) { 666 $link = esc_url($link); 667 } 656 668 $link = apply_filters('search_feed_link', $link); 657 669 658 670 return $link;