Version Description
WP 3.1.3 COMPAT / BUGFIX: WHITESPACE IN GUIDS NO LONGER PRODUCES DUPLICATE POSTS. The work-around for handling filtered URIs in guid elements has now been extended to handle URIs that were filtered because of leading or trailing whitespace, in addition to URIs that were filtered because of unapproved schemes.
WP 3.1.3 COMPAT / BUGFIX: RELATIVE URLS IN GUIDS NO LONGER PRODUCE DUPLICATE POSTS. The work-around for handling filtered URIs in guid elements has now been extended to handle URIs that were altered without being filtered out entirely (most commonly because a scheme was added to a relative URL).
BUGFIX: UPDATES TO POST NO LONGER CAUSE DUPLICATE DRAFT VERSION TO APPEAR. Under certain conditions in 2011.0531, an update to an existing post would not be properly applied to the post itself, but rather would appear as a duplicate post with Draft status. This bug has been eliminated, and updates will now be properly inserted as revisions to the existing post.
Release Info
Developer | radgeek |
Plugin | FeedWordPress |
Version | 2011.0602 |
Comparing to | |
See all releases |
Code changes from version 2011.0531 to 2011.0602
- feedwordpress.php +3 -3
- readme.txt +28 -9
- syndicatedpost.class.php +13 -8
- syndicationdataqueries.class.php +12 -0
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: FeedWordPress
|
4 |
Plugin URI: http://feedwordpress.radgeek.com/
|
5 |
Description: simple and flexible Atom/RSS syndication for WordPress
|
6 |
-
Version: 2011.
|
7 |
Author: Charles Johnson
|
8 |
Author URI: http://radgeek.com/
|
9 |
License: GPL
|
@@ -11,7 +11,7 @@ License: GPL
|
|
11 |
|
12 |
/**
|
13 |
* @package FeedWordPress
|
14 |
-
* @version 2011.
|
15 |
*/
|
16 |
|
17 |
# This uses code derived from:
|
@@ -34,7 +34,7 @@ License: GPL
|
|
34 |
|
35 |
# -- Don't change these unless you know what you're doing...
|
36 |
|
37 |
-
define ('FEEDWORDPRESS_VERSION', '2011.
|
38 |
define ('FEEDWORDPRESS_AUTHOR_CONTACT', 'http://radgeek.com/contact');
|
39 |
|
40 |
if (!defined('FEEDWORDPRESS_BLEG')) :
|
3 |
Plugin Name: FeedWordPress
|
4 |
Plugin URI: http://feedwordpress.radgeek.com/
|
5 |
Description: simple and flexible Atom/RSS syndication for WordPress
|
6 |
+
Version: 2011.0602
|
7 |
Author: Charles Johnson
|
8 |
Author URI: http://radgeek.com/
|
9 |
License: GPL
|
11 |
|
12 |
/**
|
13 |
* @package FeedWordPress
|
14 |
+
* @version 2011.0602
|
15 |
*/
|
16 |
|
17 |
# This uses code derived from:
|
34 |
|
35 |
# -- Don't change these unless you know what you're doing...
|
36 |
|
37 |
+
define ('FEEDWORDPRESS_VERSION', '2011.0602');
|
38 |
define ('FEEDWORDPRESS_AUTHOR_CONTACT', 'http://radgeek.com/contact');
|
39 |
|
40 |
if (!defined('FEEDWORDPRESS_BLEG')) :
|
@@ -4,7 +4,7 @@ Donate link: http://feedwordpress.radgeek.com/
|
|
4 |
Tags: syndication, aggregation, feed, atom, rss
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.1.3
|
7 |
-
Stable tag: 2011.
|
8 |
|
9 |
FeedWordPress syndicates content from feeds you choose into your WordPress weblog.
|
10 |
|
@@ -93,16 +93,35 @@ outs, see the documentation at the [FeedWordPress project homepage][].
|
|
93 |
|
94 |
== Changelog ==
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
= 2011.0531 =
|
97 |
|
98 |
-
*
|
99 |
-
changes in the way that WordPress handles post guids in the
|
100 |
-
release (3.1.3), many users experienced problems with many
|
101 |
-
appearing in rapid succession. (Specifically, this would
|
102 |
-
posts using tag: URL guids -- such as all the posts
|
103 |
-
feeds or feeds from other Google services.) This
|
104 |
-
FeedWordPress eliminates the issue by working
|
105 |
-
on tag: URLs.
|
106 |
|
107 |
* NEW AND IMPROVED DIAGNOSTICS: Syndication --> Diagnostics now contains some
|
108 |
new diagnostics settings useful for debugging problems with duplicate posts
|
4 |
Tags: syndication, aggregation, feed, atom, rss
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.1.3
|
7 |
+
Stable tag: 2011.0602
|
8 |
|
9 |
FeedWordPress syndicates content from feeds you choose into your WordPress weblog.
|
10 |
|
93 |
|
94 |
== Changelog ==
|
95 |
|
96 |
+
= 2011.0602 =
|
97 |
+
|
98 |
+
* WP 3.1.3 COMPAT / BUGFIX: WHITESPACE IN GUIDS NO LONGER PRODUCES DUPLICATE
|
99 |
+
POSTS. The work-around for handling filtered URIs in guid elements has now
|
100 |
+
been extended to handle URIs that were filtered because of leading or
|
101 |
+
trailing whitespace, in addition to URIs that were filtered because of
|
102 |
+
unapproved schemes.
|
103 |
+
|
104 |
+
* WP 3.1.3 COMPAT / BUGFIX: RELATIVE URLS IN GUIDS NO LONGER PRODUCE DUPLICATE
|
105 |
+
POSTS. The work-around for handling filtered URIs in guid elements has now
|
106 |
+
been extended to handle URIs that were altered without being filtered out
|
107 |
+
entirely (most commonly because a scheme was added to a relative URL).
|
108 |
+
|
109 |
+
* BUGFIX: UPDATES TO POST NO LONGER CAUSE DUPLICATE DRAFT VERSION TO APPEAR.
|
110 |
+
Under certain conditions in 2011.0531, an update to an existing post would
|
111 |
+
not be properly applied to the post itself, but rather would appear as a
|
112 |
+
duplicate post with Draft status. This bug has been eliminated, and updates
|
113 |
+
will now be properly inserted as revisions to the existing post.
|
114 |
+
|
115 |
= 2011.0531 =
|
116 |
|
117 |
+
* WORDPRESS 3.1.3 COMPATIBILITY: DUPLICATE POSTS ISSUE FIXED. Due to
|
118 |
+
internal changes in the way that WordPress handles post guids in the
|
119 |
+
most recent release (3.1.3), many users experienced problems with many
|
120 |
+
duplicate posts appearing in rapid succession. (Specifically, this would
|
121 |
+
happen with any posts using tag: URL guids -- such as all the posts
|
122 |
+
coming from Blogger feeds or feeds from other Google services.) This
|
123 |
+
compatibility release of FeedWordPress eliminates the issue by working
|
124 |
+
around the new restrictions on tag: URLs.
|
125 |
|
126 |
* NEW AND IMPROVED DIAGNOSTICS: Syndication --> Diagnostics now contains some
|
127 |
new diagnostics settings useful for debugging problems with duplicate posts
|
@@ -10,7 +10,7 @@ require_once(dirname(__FILE__).'/feedtime.class.php');
|
|
10 |
* different feed formats, which may be useful to FeedWordPress users
|
11 |
* who make use of feed data in PHP add-ons and filters.
|
12 |
*
|
13 |
-
* @version
|
14 |
*/
|
15 |
class SyndicatedPost {
|
16 |
var $item = null; // MagpieRSS representation
|
@@ -765,6 +765,9 @@ class SyndicatedPost {
|
|
765 |
$this->_hashes[$id] = get_post_custom_values(
|
766 |
'syndication_item_hash', $id
|
767 |
);
|
|
|
|
|
|
|
768 |
endif;
|
769 |
return $this->_hashes[$id];
|
770 |
}
|
@@ -778,12 +781,14 @@ class SyndicatedPost {
|
|
778 |
}
|
779 |
|
780 |
/*static*/ function normalize_guid ($guid) {
|
|
|
781 |
if (preg_match('/^[0-9a-z]{32}$/i', $guid)) : // MD5
|
782 |
-
$guid = SyndicatedPost::
|
783 |
-
elseif (strlen(esc_url($guid)) == 0) :
|
784 |
$guid = SyndicatedPost::normalize_guid_prefix().md5($guid);
|
785 |
endif;
|
786 |
-
|
|
|
787 |
return $guid;
|
788 |
} /* SyndicatedPost::normalize_guid() */
|
789 |
|
@@ -1290,7 +1295,7 @@ class SyndicatedPost {
|
|
1290 |
if ($updated) :
|
1291 |
FeedWordPress::diagnostic('feed_items:freshness', 'Item ['.$this->guid().'] "'.$this->entry->get_title().'" is an update of an existing post.');
|
1292 |
$this->_freshness = 1; // Updated content
|
1293 |
-
$this->_wp_id = $old_post->
|
1294 |
|
1295 |
// We want this to keep a running list of all the
|
1296 |
// processed update hashes.
|
@@ -1298,11 +1303,10 @@ class SyndicatedPost {
|
|
1298 |
$this->stored_hashes(),
|
1299 |
array($this->update_hash())
|
1300 |
);
|
1301 |
-
|
1302 |
else :
|
1303 |
FeedWordPress::diagnostic('feed_items:freshness', 'Item ['.$this->guid().'] "'.$this->entry->get_title().'" is a duplicate of an existing post.');
|
1304 |
$this->_freshness = 0; // Same old, same old
|
1305 |
-
$this->_wp_id = $old_post->
|
1306 |
endif;
|
1307 |
endif;
|
1308 |
endif;
|
@@ -1504,7 +1508,7 @@ class SyndicatedPost {
|
|
1504 |
|
1505 |
foreach ($doNotMunge as $field) :
|
1506 |
$dbpost[$field] = get_post_field($field, $this->wp_id());
|
1507 |
-
endforeach;
|
1508 |
endif;
|
1509 |
|
1510 |
// WP3's wp_insert_post scans current_user_can() for the
|
@@ -1529,6 +1533,7 @@ class SyndicatedPost {
|
|
1529 |
$this->post['ID'] = $this->wp_id();
|
1530 |
$dbpost['ID'] = $this->post['ID'];
|
1531 |
endif;
|
|
|
1532 |
$this->_wp_id = wp_insert_post($dbpost, /*return wp_error=*/ true);
|
1533 |
|
1534 |
remove_action(
|
10 |
* different feed formats, which may be useful to FeedWordPress users
|
11 |
* who make use of feed data in PHP add-ons and filters.
|
12 |
*
|
13 |
+
* @version 2011.0601
|
14 |
*/
|
15 |
class SyndicatedPost {
|
16 |
var $item = null; // MagpieRSS representation
|
765 |
$this->_hashes[$id] = get_post_custom_values(
|
766 |
'syndication_item_hash', $id
|
767 |
);
|
768 |
+
if (is_null($this->_hashes[$id])) :
|
769 |
+
$this->_hashes[$id] = array();
|
770 |
+
endif;
|
771 |
endif;
|
772 |
return $this->_hashes[$id];
|
773 |
}
|
781 |
}
|
782 |
|
783 |
/*static*/ function normalize_guid ($guid) {
|
784 |
+
$guid = trim($guid);
|
785 |
if (preg_match('/^[0-9a-z]{32}$/i', $guid)) : // MD5
|
786 |
+
$guid = SyndicatedPost::normalize_guid_prefix().strtolower($guid);
|
787 |
+
elseif ((strlen(esc_url($guid)) == 0) or (esc_url($guid) != $guid)) :
|
788 |
$guid = SyndicatedPost::normalize_guid_prefix().md5($guid);
|
789 |
endif;
|
790 |
+
$guid = trim($guid);
|
791 |
+
|
792 |
return $guid;
|
793 |
} /* SyndicatedPost::normalize_guid() */
|
794 |
|
1295 |
if ($updated) :
|
1296 |
FeedWordPress::diagnostic('feed_items:freshness', 'Item ['.$this->guid().'] "'.$this->entry->get_title().'" is an update of an existing post.');
|
1297 |
$this->_freshness = 1; // Updated content
|
1298 |
+
$this->_wp_id = $old_post->ID;
|
1299 |
|
1300 |
// We want this to keep a running list of all the
|
1301 |
// processed update hashes.
|
1303 |
$this->stored_hashes(),
|
1304 |
array($this->update_hash())
|
1305 |
);
|
|
|
1306 |
else :
|
1307 |
FeedWordPress::diagnostic('feed_items:freshness', 'Item ['.$this->guid().'] "'.$this->entry->get_title().'" is a duplicate of an existing post.');
|
1308 |
$this->_freshness = 0; // Same old, same old
|
1309 |
+
$this->_wp_id = $old_post->ID;
|
1310 |
endif;
|
1311 |
endif;
|
1312 |
endif;
|
1508 |
|
1509 |
foreach ($doNotMunge as $field) :
|
1510 |
$dbpost[$field] = get_post_field($field, $this->wp_id());
|
1511 |
+
endforeach;
|
1512 |
endif;
|
1513 |
|
1514 |
// WP3's wp_insert_post scans current_user_can() for the
|
1533 |
$this->post['ID'] = $this->wp_id();
|
1534 |
$dbpost['ID'] = $this->post['ID'];
|
1535 |
endif;
|
1536 |
+
|
1537 |
$this->_wp_id = wp_insert_post($dbpost, /*return wp_error=*/ true);
|
1538 |
|
1539 |
remove_action(
|
@@ -2,6 +2,7 @@
|
|
2 |
class SyndicationDataQueries {
|
3 |
function SyndicationDataQueries () {
|
4 |
add_action('init', array(&$this, 'init'));
|
|
|
5 |
add_filter('posts_search', array(&$this, 'posts_search'), 10, 2);
|
6 |
add_filter('posts_fields', array(&$this, 'posts_fields'), 10, 2);
|
7 |
add_filter('posts_request', array(&$this, 'posts_request'), 10, 2);
|
@@ -12,6 +13,17 @@ class SyndicationDataQueries {
|
|
12 |
$wp->add_query_var('guid');
|
13 |
}
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
function posts_request ($sql, &$query) {
|
16 |
if ($query->get('fields') == '_synfresh') :
|
17 |
FeedWordPress::diagnostic('feed_items:freshness:sql', "SQL: ".$sql);
|
2 |
class SyndicationDataQueries {
|
3 |
function SyndicationDataQueries () {
|
4 |
add_action('init', array(&$this, 'init'));
|
5 |
+
add_filter('pre_get_posts', array(&$this, 'pre_get_posts'), 10, 1);
|
6 |
add_filter('posts_search', array(&$this, 'posts_search'), 10, 2);
|
7 |
add_filter('posts_fields', array(&$this, 'posts_fields'), 10, 2);
|
8 |
add_filter('posts_request', array(&$this, 'posts_request'), 10, 2);
|
13 |
$wp->add_query_var('guid');
|
14 |
}
|
15 |
|
16 |
+
function pre_get_posts (&$q) {
|
17 |
+
if ($q->get('guid')) :
|
18 |
+
$q->query_vars['post_type'] = get_post_types();
|
19 |
+
$q->query_vars['post_status'] = implode(",", get_post_stati());
|
20 |
+
endif;
|
21 |
+
|
22 |
+
if ($q->get('fields') == '_synfresh') :
|
23 |
+
$q->query_vars['cache_results'] = false; // Not suitable for caching.
|
24 |
+
endif;
|
25 |
+
}
|
26 |
+
|
27 |
function posts_request ($sql, &$query) {
|
28 |
if ($query->get('fields') == '_synfresh') :
|
29 |
FeedWordPress::diagnostic('feed_items:freshness:sql', "SQL: ".$sql);
|