WordPress.org

Make WordPress Core

Ticket #3065: patch.txt

File patch.txt, 1.5 KB (added by murky, 9 years ago)

This is my first ever wordpress core patch submission! It aims to fix a problem I had with ampersands when syndicating feeds.

Line 
1Index: wp-includes/feed.php
2===================================================================
3--- wp-includes/feed.php        (revision 4111)
4+++ wp-includes/feed.php        (working copy)
5@@ -59,7 +59,11 @@
6 }
7 
8 function permalink_single_rss($file = '') {
9-    echo get_permalink();
10+    /* This update cleans up permalinks, necessary for a syndicated feed */
11+    $url = get_permalink();
12+    $url = str_replace("&", "&", $url);
13+    $url = str_replace("&", "&", $url);
14+    echo $url;
15 }
16 
17 function comment_link() {
18@@ -92,6 +96,9 @@
19        else
20                $url = get_settings('home') . "/$commentsrssfilename?feed=rss2&p=$id";
21 
22+      /* This update cleans up permalinks, necessary for a syndicated feed */
23+      $url = str_replace("&", "&", $url);
24+      $url = str_replace("&", "&", $url);
25        return apply_filters('post_comments_feed_link', $url);
26 }
27 
28Index: wp-includes/comment-template.php
29===================================================================
30--- wp-includes/comment-template.php    (revision 4111)
31+++ wp-includes/comment-template.php    (working copy)
32@@ -142,7 +142,11 @@
33 }
34 
35 function comments_link( $file = '', $echo = true ) {
36-    echo get_comments_link();
37+      /* Cleans things up when a syndicated feed doesn't do ampersands properly */
38+      $url = get_comments_link();
39+      $url = str_replace("&", "&", $url);
40+      $url = str_replace("&", "&", $url);
41+      echo $url;
42 }
43 
44 function get_comments_number( $post_id = 0 ) {