FeedWordPress - Version 2012.1218

Version Description

  • WORDPRESS VISUAL EDITOR FIXED. There was an unlisted change in the 2012.1212 release which had the effect of disabling the WordPress Visual Editor for all posts syndicated by FeedWordPress. Many users reported this as a bug. It was actually a deliberate decision -- a crappy way to try to deal with a crappy situation. (Many users had previously reported a "bug" in which all the paragraph or line breaks seemed to be stripped out of their syndicated posts; the issue turned out to be that the Visual Editor was stripping out <p> and <br/> tags on the assumption that the resulting post would be sent through standard WordPress formatting filters. But under default settings, posts syndicated by FWP deliberately bypass WordPress formatting filters.) In any case, this version adopts a more flexible compromise. If FeedWordPress is set up to bypass WordPress formatting filters (as it is by default), then the Visual Editor will be disabled for syndicated posts (since using it would produce incorrect results). If on the other hand FeedWordPress is set up to expose syndicated posts to WordPress formatting filters (as it usually is for those using the Visual Editor to manually edit posts), then the Visual Editor tab will be re-enabled for syndicated posts.

  • BUG FIX: PERMALINKS REWRITTEN FOR CUSTOM POST TYPES AS WELL AS NORMAL WORDPRESS POSTS. If you had WordPress set up to syndicate incoming posts to a custom post type (under Syndication > Posts & Links), and asked FeedWordPress to make "permalinks point to the original site", then previous versions of FeedWordPress would fail to do the rewriting -- permalinks would only be rewritten to point to the original source for normal WordPress posts, not for custom post types. In 2012.1218 this bug has been fixed: all post types will now have permalinks rewritten unless you request for permalinks to point to the local copy on your aggregator site.

  • BUG FIX: ELIMINATES "PHP Fatal error: Call to a member function setting() on a non-object...." Some changes to the in-memory caching of information about feed subscriptions could result in a fatal PHP error in cases where you have de-activated one of your subscriptions, but posts from that subscription were still in the archive. This would normally show up through half-completed feeds or half-completed pages that suddenly broke off in the middle, and displayed or logged an error message like: "PHP Fatal error: Call to a member function setting() on a non-object in {...}/wp-content/plugins/feedwordpress/feedwordpress.php on line 615". This bug has been eliminated, so affected feeds and pages should now render correctly, and the error message should no longer appear.

  • BUG FIX: CATEGORY BOXES IN SYNDICATION > CATEGORIES & TAGS. Some minor bugs in the appearance and animation of category checkboxes (for example, the checkbox used to select categories for syndicated posts on the Syndication > Categories & Tags settings page) have been fixed.

Download this release

Release Info

Developer radgeek
Plugin Icon wp plugin FeedWordPress
Version 2012.1218
Comparing to
See all releases

Code changes from version 2012.1212 to 2012.1218

admin-ui.php CHANGED
@@ -732,17 +732,10 @@ function fwp_option_box_opener ($legend, $id, $class = "stuffbox") {
732
  }
733
 
734
  function fwp_option_box_closer () {
735
- global $wp_db_version;
736
- if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) :
737
  ?>
738
  </div> <!-- class="inside" -->
739
  </div> <!-- class="stuffbox" -->
740
  <?php
741
- else :
742
- ?>
743
- </div> <!-- class="wrap" -->
744
- <?php
745
- endif;
746
  }
747
 
748
  function fwp_tags_box ($tags, $object, $params = array()) {
@@ -853,11 +846,6 @@ function fwp_category_box ($checked, $object, $tags = array(), $params = array()
853
  <?php
854
  $newcat = 'new'.$taxonomy;
855
 
856
- // Well, thank God they added "egory" before WP 3.0 came out.
857
- if ('newcategory'==$newcat
858
- and !FeedWordPressCompatibility::test_version(FWP_SCHEMA_30)) :
859
- $newcat = 'newcat';
860
- endif;
861
  ?>
862
  <label class="screen-reader-text" for="<?php print $idPrefix; ?>new<?php print $taxonomy; ?>"><?php _e('Add New Category'); ?></label>
863
  <input
@@ -880,7 +868,7 @@ function fwp_category_box ($checked, $object, $tags = array(), $params = array()
880
  'show_option_none' => __('Parent category'),
881
  'tab_index' => 3,
882
  ) ); ?>
883
- <input type="button" id="<?php print $idPrefix; ?><?php print $taxonomy; ?>-add-sumbit" class="add:<?php print $idPrefix; ?><?php print $taxonomy; ?>checklist:<?php print $taxonomy; ?>-add add-categorychecklist-category-add button category-add-submit" value="<?php _e( 'Add' ); ?>" tabindex="3" />
884
  <?php /* wp_nonce_field currently doesn't let us set an id different from name, but we need a non-unique name and a unique id */ ?>
885
  <input type="hidden" id="_ajax_nonce<?php print esc_html($idSuffix); ?>" name="_ajax_nonce" value="<?php print wp_create_nonce('add-'.$taxonomy); ?>" />
886
  <input type="hidden" id="_ajax_nonce-add-<?php print $taxonomy; ?><?php print esc_html($idSuffix); ?>" name="_ajax_nonce-add-<?php print $taxonomy; ?>" value="<?php print wp_create_nonce('add-'.$taxonomy); ?>" />
@@ -945,9 +933,6 @@ class FeedWordPressSettingsUI {
945
  global $fwp_path;
946
 
947
  wp_enqueue_script('post'); // for magic tag and category boxes
948
- if (!FeedWordPressCompatibility::test_version(FWP_SCHEMA_29)) : // < 2.9
949
- wp_enqueue_script('thickbox'); // for fold-up boxes
950
- endif;
951
  wp_enqueue_script('admin-forms'); // for checkbox selection
952
 
953
  wp_register_script('feedwordpress-elements', WP_PLUGIN_URL.'/'.$fwp_path.'/feedwordpress-elements.js');
732
  }
733
 
734
  function fwp_option_box_closer () {
 
 
735
  ?>
736
  </div> <!-- class="inside" -->
737
  </div> <!-- class="stuffbox" -->
738
  <?php
 
 
 
 
 
739
  }
740
 
741
  function fwp_tags_box ($tags, $object, $params = array()) {
846
  <?php
847
  $newcat = 'new'.$taxonomy;
848
 
 
 
 
 
 
849
  ?>
850
  <label class="screen-reader-text" for="<?php print $idPrefix; ?>new<?php print $taxonomy; ?>"><?php _e('Add New Category'); ?></label>
851
  <input
868
  'show_option_none' => __('Parent category'),
869
  'tab_index' => 3,
870
  ) ); ?>
871
+ <input type="button" id="<?php print $idPrefix; ?><?php print $taxonomy; ?>-add-sumbit" class="add:<?php print $idPrefix; ?><?php print $taxonomy; ?>checklist:<?php print $idPrefix.$taxonomy; ?>-add add-categorychecklist-category-add button category-add-submit" value="<?php _e( 'Add' ); ?>" tabindex="3" />
872
  <?php /* wp_nonce_field currently doesn't let us set an id different from name, but we need a non-unique name and a unique id */ ?>
873
  <input type="hidden" id="_ajax_nonce<?php print esc_html($idSuffix); ?>" name="_ajax_nonce" value="<?php print wp_create_nonce('add-'.$taxonomy); ?>" />
874
  <input type="hidden" id="_ajax_nonce-add-<?php print $taxonomy; ?><?php print esc_html($idSuffix); ?>" name="_ajax_nonce-add-<?php print $taxonomy; ?>" value="<?php print wp_create_nonce('add-'.$taxonomy); ?>" />
933
  global $fwp_path;
934
 
935
  wp_enqueue_script('post'); // for magic tag and category boxes
 
 
 
936
  wp_enqueue_script('admin-forms'); // for checkbox selection
937
 
938
  wp_register_script('feedwordpress-elements', WP_PLUGIN_URL.'/'.$fwp_path.'/feedwordpress-elements.js');
feedwordpress-elements.css CHANGED
@@ -13,8 +13,7 @@
13
  width: 120px;
14
  }
15
  .feedwordpress-category-div ul.category-tabs li.tabs {
16
- -moz-border-radius: 3px 0 0 3px;
17
- -webkit-border-radius: 3px 0 0 3px;
18
  border-radius: 3px 0 0 3px;
19
  border-color: #DFDFDF;
20
  border-style: solid none solid solid;
13
  width: 120px;
14
  }
15
  .feedwordpress-category-div ul.category-tabs li.tabs {
16
+ display: block;
 
17
  border-radius: 3px 0 0 3px;
18
  border-color: #DFDFDF;
19
  border-style: solid none solid solid;
feedwordpress-elements.js CHANGED
@@ -249,7 +249,7 @@ fwpList = {
249
  el = el.get(0);
250
  var elem = el, color, rgbaTrans = new RegExp( "rgba\\(\\s*0,\\s*0,\\s*0,\\s*0\\s*\\)", "i" );
251
  do {
252
- color = jQuery.curCSS(elem, 'backgroundColor');
253
  if ( color != '' && color != 'transparent' && !color.match(rgbaTrans) || jQuery.nodeName(elem, "body") )
254
  break;
255
  } while ( elem = elem.parentNode );
@@ -299,7 +299,6 @@ fwpList = {
299
  color = fwpList.getColor( e );
300
  e.css( 'backgroundColor', s.addColor ).animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); } } );
301
  }
302
-
303
  list.each( function() { this.fwpList.process( e ); } );
304
  return e;
305
  },
@@ -394,14 +393,6 @@ function feedAuthenticationMethod (params) {
394
  var elMethod = elTable.find('.link-rss-auth-method');
395
  var elLink = elDiv.find('.link-rss-userpass-use');
396
 
397
- console.log('--- ---');
398
- console.log(s.node);
399
- console.log(elDiv);
400
- console.log(elTable);
401
- console.log(elMethod);
402
- console.log(elLink);
403
- console.log(elMethod.val());
404
-
405
  // Set.
406
  if (s.value != null) {
407
  elMethod.val(s.value);
249
  el = el.get(0);
250
  var elem = el, color, rgbaTrans = new RegExp( "rgba\\(\\s*0,\\s*0,\\s*0,\\s*0\\s*\\)", "i" );
251
  do {
252
+ color = jQuery(elem).css('backgroundColor');
253
  if ( color != '' && color != 'transparent' && !color.match(rgbaTrans) || jQuery.nodeName(elem, "body") )
254
  break;
255
  } while ( elem = elem.parentNode );
299
  color = fwpList.getColor( e );
300
  e.css( 'backgroundColor', s.addColor ).animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); } } );
301
  }
 
302
  list.each( function() { this.fwpList.process( e ); } );
303
  return e;
304
  },
393
  var elMethod = elTable.find('.link-rss-auth-method');
394
  var elLink = elDiv.find('.link-rss-userpass-use');
395
 
 
 
 
 
 
 
 
 
396
  // Set.
397
  if (s.value != null) {
398
  elMethod.val(s.value);
feedwordpress.php CHANGED
@@ -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: 2012.1212
7
  Author: Charles Johnson
8
  Author URI: http://radgeek.com/
9
  License: GPL
@@ -11,12 +11,12 @@ License: GPL
11
 
12
  /**
13
  * @package FeedWordPress
14
- * @version 2012.1212
15
  */
16
 
17
  # This uses code derived from:
18
  # - wp-rss-aggregate.php by Kellan Elliot-McCrea <kellan@protest.net>
19
- # - MagpieRSS by Kellan Elliot-McCrea <kellan@protest.net>
20
  # - Ultra-Liberal Feed Finder by Mark Pilgrim <mark@diveintomark.org>
21
  # - WordPress Blog Tool and Publishing Platform <http://wordpress.org/>
22
  # according to the terms of the GNU General Public License.
@@ -34,7 +34,7 @@ License: GPL
34
 
35
  # -- Don't change these unless you know what you're doing...
36
 
37
- define ('FEEDWORDPRESS_VERSION', '2012.1212');
38
  define ('FEEDWORDPRESS_AUTHOR_CONTACT', 'http://radgeek.com/contact');
39
 
40
  if (!defined('FEEDWORDPRESS_BLEG')) :
@@ -66,14 +66,6 @@ define ('FEEDWORDPRESS_FRESHNESS_INTERVAL', 10*60); // Every ten minutes
66
 
67
  define ('FWP_SCHEMA_HAS_USERMETA', 2966);
68
  define ('FWP_SCHEMA_USES_ARGS_TAXONOMY', 12694); // Revision # for using $args['taxonomy'] to get link categories
69
- define ('FWP_SCHEMA_20', 3308); // Database schema # for WP 2.0
70
- define ('FWP_SCHEMA_21', 4772); // Database schema # for WP 2.1
71
- define ('FWP_SCHEMA_23', 5495); // Database schema # for WP 2.3
72
- define ('FWP_SCHEMA_25', 7558); // Database schema # for WP 2.5
73
- define ('FWP_SCHEMA_26', 8201); // Database schema # for WP 2.6
74
- define ('FWP_SCHEMA_27', 9872); // Database schema # for WP 2.7
75
- define ('FWP_SCHEMA_28', 11548); // Database schema # for WP 2.8
76
- define ('FWP_SCHEMA_29', 12329); // Database schema # for WP 2.9
77
  define ('FWP_SCHEMA_30', 12694); // Database schema # for WP 3.0
78
 
79
  if (FEEDWORDPRESS_DEBUG) :
@@ -127,6 +119,7 @@ require_once("${dir}/feedwordpress_file.class.php");
127
  require_once("${dir}/feedwordpress_parser.class.php");
128
  require_once("${dir}/feedwordpressrpc.class.php");
129
  require_once("${dir}/feedwordpresshttpauthenticator.class.php");
 
130
 
131
  // Magic quotes are just about the stupidest thing ever.
132
  if (is_array($_POST)) :
@@ -171,7 +164,8 @@ if (!FeedWordPress::needs_upgrade()) : // only work if the conditions are safe!
171
 
172
  # Filter in original permalinks if the user wants that
173
  add_filter('post_link', 'syndication_permalink', /*priority=*/ 1, /*arguments=*/ 3);
174
-
 
175
  # When foreign URLs are used for permalinks in feeds or display
176
  # contexts, they need to be escaped properly.
177
  add_filter('the_permalink', 'syndication_permalink_escaped');
@@ -320,7 +314,8 @@ function debug_out_feedwordpress_footer () {
320
  * @return bool TRUE if the post's meta-data indicates it was syndicated; FALSE otherwise
321
  */
322
  function is_syndicated ($id = NULL) {
323
- return (strlen(get_syndication_feed_id($id)) > 0);
 
324
  } /* function is_syndicated() */
325
 
326
  function feedwordpress_display_url ($url, $before = 60, $after = 0) {
@@ -346,62 +341,58 @@ function feedwordpress_display_url ($url, $before = 60, $after = 0) {
346
  } /* feedwordpress_display_url () */
347
 
348
  function get_syndication_source_property ($original, $id, $local, $remote = NULL) {
349
- $ret = NULL;
350
- if (is_null($original)) :
351
- $original = FeedWordPress::use_aggregator_source_data();
352
- endif;
353
-
354
- if (is_null($remote)) :
355
- $remote = $local . '_original';
356
- endif;
357
-
358
- $vals = ($original ? get_post_custom_values($remote, $id) : array());
359
- if (count($vals) < 1) :
360
- $vals = get_post_custom_values($local, $id);
361
- endif;
362
-
363
- if (count($vals) > 0) :
364
- $ret = $vals[0];
365
- endif;
366
- return $ret;
367
  } /* function get_syndication_source_property () */
368
 
369
- function the_syndication_source_link ($original = NULL, $id = NULL) { echo get_syndication_source_link($original, $id); }
370
  function get_syndication_source_link ($original = NULL, $id = NULL) {
371
- return get_syndication_source_property($original, $id, 'syndication_source_uri');
 
372
  } /* function get_syndication_source_link() */
373
 
374
- function the_syndication_source ($original = NULL, $id = NULL) { echo get_syndication_source($original, $id); }
 
 
 
375
  function get_syndication_source ($original = NULL, $id = NULL) {
376
- $ret = get_syndication_source_property($original, $id, 'syndication_source');
377
- if (is_null($ret) or strlen(trim($ret)) == 0) : // Fall back to URL of blog
378
- $ret = feedwordpress_display_url(get_syndication_source_link());
379
- endif;
380
- return $ret;
381
  } /* function get_syndication_source() */
382
 
383
- function the_syndication_feed ($original = NULL, $id = NULL) { echo get_syndication_feed($original, $id); }
 
 
 
384
  function get_syndication_feed ($original = NULL, $id = NULL) {
385
- return get_syndication_source_property($original, $id, 'syndication_feed');
 
386
  } /* function get_syndication_feed() */
387
 
388
- function the_syndication_feed_guid ($original = NULL, $id = NULL) { echo get_syndication_feed_guid($original, $id); }
 
 
 
389
  function get_syndication_feed_guid ($original = NULL, $id = NULL) {
390
- $ret = get_syndication_source_property($original, $id, 'syndication_source_id');
391
- if (is_null($ret) or strlen(trim($ret))==0) : // Fall back to URL of feed
392
- $ret = get_syndication_feed();
393
- endif;
394
- return $ret;
395
  } /* function get_syndication_feed_guid () */
396
 
397
- function get_syndication_feed_id ($id = NULL) { list($u) = get_post_custom_values('syndication_feed_id', $id); return $u; }
398
- function the_syndication_feed_id ($id = NULL) { echo get_syndication_feed_id($id); }
 
 
 
 
 
 
 
 
 
 
399
 
400
  function get_syndication_feed_object ($id = NULL) {
401
- global $feedwordpress;
402
-
403
- $feed_id = get_syndication_feed_id($id);
404
- return $feedwordpress->subscription($feed_id);
405
  } /* function get_syndication_feed_object() */
406
 
407
  function get_feed_meta ($key, $id = NULL) {
@@ -415,11 +406,13 @@ function get_feed_meta ($key, $id = NULL) {
415
  } /* function get_feed_meta() */
416
 
417
  function get_syndication_permalink ($id = NULL) {
418
- list($u) = get_post_custom_values('syndication_permalink', $id); return $u;
419
- }
 
 
420
  function the_syndication_permalink ($id = NULL) {
421
  echo get_syndication_permalink($id);
422
- }
423
 
424
  /**
425
  * get_local_permalink: returns a string containing the internal permalink
@@ -472,11 +465,8 @@ $feedwordpress_the_original_permalink = NULL;
472
  function feedwordpress_preserve_syndicated_content ($text) {
473
  global $feedwordpress_the_syndicated_content;
474
 
475
- $globalExpose = (get_option('feedwordpress_formatting_filters') == 'yes');
476
- $localExpose = get_post_custom_values('_feedwordpress_formatting_filters');
477
- $expose = ($globalExpose or ((count($localExpose) > 0) and $localExpose[0]));
478
-
479
- if ( is_syndicated() and !$expose ) :
480
  $feedwordpress_the_syndicated_content = $text;
481
  else :
482
  $feedwordpress_the_syndicated_content = NULL;
@@ -538,7 +528,7 @@ function feedwordpress_item_feed_data () {
538
  * @global $id
539
  * @global $feedwordpress_the_original_permalink
540
  */
541
- function syndication_permalink ($permalink = '', $post = null, $leavename = false) {
542
  global $id;
543
  global $feedwordpress_the_original_permalink;
544
 
@@ -612,6 +602,7 @@ function syndication_comments_feed_link ($link) {
612
  // that value here.
613
  $source = get_syndication_feed_object();
614
  $replacement = NULL;
 
615
  if ($source->setting('munge comments feed links', 'munge_comments_feed_links', 'yes') != 'no') :
616
  $commentFeeds = get_post_custom_values('wfw:commentRSS');
617
  if (
@@ -939,7 +930,14 @@ class FeedWordPress {
939
  if (isset($this->feeds[$which])) :
940
  $sub = $this->feeds[$which];
941
  endif;
942
-
 
 
 
 
 
 
 
943
  // Load 'er up if you haven't already.
944
  if (!is_null($sub) and !($sub InstanceOf SyndicatedLink)) :
945
  $link = new SyndicatedLink($sub);
@@ -1332,11 +1330,11 @@ class FeedWordPress {
1332
 
1333
  function user_can_richedit ($rich_edit) {
1334
 
1335
- global $post;
1336
 
1337
- if (is_syndicated($post->ID)) :
1338
  // Disable visual editor and only allow operations
1339
- // directly on HTML if post is syndicated.
1340
  $rich_edit = false;
1341
  endif;
1342
 
@@ -1516,6 +1514,7 @@ class FeedWordPress {
1516
  else :
1517
  $links = array();
1518
  endif;
 
1519
  return $links;
1520
  } // function FeedWordPress::syndicated_links()
1521
 
3
  Plugin Name: FeedWordPress
4
  Plugin URI: http://feedwordpress.radgeek.com/
5
  Description: simple and flexible Atom/RSS syndication for WordPress
6
+ Version: 2012.1218
7
  Author: Charles Johnson
8
  Author URI: http://radgeek.com/
9
  License: GPL
11
 
12
  /**
13
  * @package FeedWordPress
14
+ * @version 2012.1218
15
  */
16
 
17
  # This uses code derived from:
18
  # - wp-rss-aggregate.php by Kellan Elliot-McCrea <kellan@protest.net>
19
+ # - SimplePie feed parser by Ryan Parman, Geoffrey Sneddon, Ryan McCue, et al. # - MagpieRSS feed parser by Kellan Elliot-McCrea <kellan@protest.net>
20
  # - Ultra-Liberal Feed Finder by Mark Pilgrim <mark@diveintomark.org>
21
  # - WordPress Blog Tool and Publishing Platform <http://wordpress.org/>
22
  # according to the terms of the GNU General Public License.
34
 
35
  # -- Don't change these unless you know what you're doing...
36
 
37
+ define ('FEEDWORDPRESS_VERSION', '2012.1218');
38
  define ('FEEDWORDPRESS_AUTHOR_CONTACT', 'http://radgeek.com/contact');
39
 
40
  if (!defined('FEEDWORDPRESS_BLEG')) :
66
 
67
  define ('FWP_SCHEMA_HAS_USERMETA', 2966);
68
  define ('FWP_SCHEMA_USES_ARGS_TAXONOMY', 12694); // Revision # for using $args['taxonomy'] to get link categories
 
 
 
 
 
 
 
 
69
  define ('FWP_SCHEMA_30', 12694); // Database schema # for WP 3.0
70
 
71
  if (FEEDWORDPRESS_DEBUG) :
119
  require_once("${dir}/feedwordpress_parser.class.php");
120
  require_once("${dir}/feedwordpressrpc.class.php");
121
  require_once("${dir}/feedwordpresshttpauthenticator.class.php");
122
+ require_once("${dir}/feedwordpresslocalpost.class.php");
123
 
124
  // Magic quotes are just about the stupidest thing ever.
125
  if (is_array($_POST)) :
164
 
165
  # Filter in original permalinks if the user wants that
166
  add_filter('post_link', 'syndication_permalink', /*priority=*/ 1, /*arguments=*/ 3);
167
+ add_filter('post_type_link', 'syndication_permalink', /*priority=*/ 1, /*arguments=*/ 4);
168
+
169
  # When foreign URLs are used for permalinks in feeds or display
170
  # contexts, they need to be escaped properly.
171
  add_filter('the_permalink', 'syndication_permalink_escaped');
314
  * @return bool TRUE if the post's meta-data indicates it was syndicated; FALSE otherwise
315
  */
316
  function is_syndicated ($id = NULL) {
317
+ $p = new FeedWordPressLocalPost($id);
318
+ return $p->is_syndicated();
319
  } /* function is_syndicated() */
320
 
321
  function feedwordpress_display_url ($url, $before = 60, $after = 0) {
341
  } /* feedwordpress_display_url () */
342
 
343
  function get_syndication_source_property ($original, $id, $local, $remote = NULL) {
344
+ $p = new FeedWordPressLocalPost($id);
345
+ return $p->meta($local, array("unproxy" => $original, "unproxied setting" => $remote));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
346
  } /* function get_syndication_source_property () */
347
 
 
348
  function get_syndication_source_link ($original = NULL, $id = NULL) {
349
+ $p = new FeedWordPressLocalPost($id);
350
+ return $p->syndication_source_link($original);
351
  } /* function get_syndication_source_link() */
352
 
353
+ function the_syndication_source_link ($original = NULL, $id = NULL) {
354
+ echo get_syndication_source_link($original, $id);
355
+ } /* function the_syndication_source_link() */
356
+
357
  function get_syndication_source ($original = NULL, $id = NULL) {
358
+ $p = new FeedWordPressLocalPost($id);
359
+ return $p->syndication_source($original);
 
 
 
360
  } /* function get_syndication_source() */
361
 
362
+ function the_syndication_source ($original = NULL, $id = NULL) {
363
+ echo get_syndication_source($original, $id);
364
+ } /* function the_syndication_source () */
365
+
366
  function get_syndication_feed ($original = NULL, $id = NULL) {
367
+ $p = new FeedWordPressLocalPost($id);
368
+ return $p->syndication_feed($original);
369
  } /* function get_syndication_feed() */
370
 
371
+ function the_syndication_feed ($original = NULL, $id = NULL) {
372
+ echo get_syndication_feed($original, $id);
373
+ } /* function the_syndication_feed() */
374
+
375
  function get_syndication_feed_guid ($original = NULL, $id = NULL) {
376
+ $p = new FeedWordPressLocalPost($id);
377
+ return $p->syndication_feed_guid($original);
 
 
 
378
  } /* function get_syndication_feed_guid () */
379
 
380
+ function the_syndication_feed_guid ($original = NULL, $id = NULL) {
381
+ echo get_syndication_feed_guid($original, $id);
382
+ } /* function the_syndication_feed_guid () */
383
+
384
+ function get_syndication_feed_id ($id = NULL) {
385
+ $p = new FeedWordPressLocalPost($id);
386
+ return $p->feed_id();
387
+ } /* function get_syndication_feed_id () */
388
+
389
+ function the_syndication_feed_id ($id = NULL) {
390
+ echo get_syndication_feed_id($id);
391
+ } /* function the_syndication_feed_id () */
392
 
393
  function get_syndication_feed_object ($id = NULL) {
394
+ $p = new FeedWordPressLocalPost($id);
395
+ return $p->feed();
 
 
396
  } /* function get_syndication_feed_object() */
397
 
398
  function get_feed_meta ($key, $id = NULL) {
406
  } /* function get_feed_meta() */
407
 
408
  function get_syndication_permalink ($id = NULL) {
409
+ $p = new FeedWordPressLocalPost($id);
410
+ return $p->syndication_permalink();
411
+ } /* function get_syndication_permalink () */
412
+
413
  function the_syndication_permalink ($id = NULL) {
414
  echo get_syndication_permalink($id);
415
+ } /* function the_syndication_permalink () */
416
 
417
  /**
418
  * get_local_permalink: returns a string containing the internal permalink
465
  function feedwordpress_preserve_syndicated_content ($text) {
466
  global $feedwordpress_the_syndicated_content;
467
 
468
+ $p = new FeedWordPressLocalPost;
469
+ if (!$p->is_exposed_to_formatting_filters()) :
 
 
 
470
  $feedwordpress_the_syndicated_content = $text;
471
  else :
472
  $feedwordpress_the_syndicated_content = NULL;
528
  * @global $id
529
  * @global $feedwordpress_the_original_permalink
530
  */
531
+ function syndication_permalink ($permalink = '', $post = null, $leavename = false, $sample = false) {
532
  global $id;
533
  global $feedwordpress_the_original_permalink;
534
 
602
  // that value here.
603
  $source = get_syndication_feed_object();
604
  $replacement = NULL;
605
+
606
  if ($source->setting('munge comments feed links', 'munge_comments_feed_links', 'yes') != 'no') :
607
  $commentFeeds = get_post_custom_values('wfw:commentRSS');
608
  if (
930
  if (isset($this->feeds[$which])) :
931
  $sub = $this->feeds[$which];
932
  endif;
933
+
934
+ // If it's not in the in-memory cache already, try to load it from DB.
935
+ // This is necessary to fill requests for subscriptions that we don't
936
+ // cache in memory, e.g. for deactivated feeds.
937
+ if (is_null($sub)) :
938
+ $sub = get_bookmark($which);
939
+ endif;
940
+
941
  // Load 'er up if you haven't already.
942
  if (!is_null($sub) and !($sub InstanceOf SyndicatedLink)) :
943
  $link = new SyndicatedLink($sub);
1330
 
1331
  function user_can_richedit ($rich_edit) {
1332
 
1333
+ $post = new FeedWordPressLocalPost;
1334
 
1335
+ if (!$post->is_exposed_to_formatting_filters()) :
1336
  // Disable visual editor and only allow operations
1337
+ // directly on HTML if post is bypassing fmt filters
1338
  $rich_edit = false;
1339
  endif;
1340
 
1514
  else :
1515
  $links = array();
1516
  endif;
1517
+
1518
  return $links;
1519
  } // function FeedWordPress::syndicated_links()
1520
 
feedwordpress_parser.class.php CHANGED
@@ -1,5 +1,17 @@
1
  <?php
2
  class FeedWordPress_Parser extends SimplePie_Parser {
 
 
 
 
 
 
 
 
 
 
 
 
3
  function parse (&$data, $encoding) {
4
  $data = apply_filters('feedwordpress_parser_parse', $data, $encoding, $this);
5
 
@@ -78,7 +90,19 @@ class FeedWordPress_Parser extends SimplePie_Parser {
78
  xml_set_start_namespace_decl_handler($xml, 'start_xmlns');
79
 
80
  // Parse!
81
- if (!xml_parse($xml, $data, true))
 
 
 
 
 
 
 
 
 
 
 
 
82
  {
83
  if (class_exists('DOMDocument')) :
84
  libxml_use_internal_errors(true);
1
  <?php
2
  class FeedWordPress_Parser extends SimplePie_Parser {
3
+ function reset_parser (&$xml) {
4
+ xml_parser_free($xml);
5
+
6
+ $xml = xml_parser_create_ns($this->encoding, $this->separator);
7
+ xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE, 1);
8
+ xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, 0);
9
+ xml_set_object($xml, $this);
10
+ xml_set_character_data_handler($xml, 'cdata');
11
+ xml_set_element_handler($xml, 'tag_open', 'tag_close');
12
+ xml_set_start_namespace_decl_handler($xml, 'start_xmlns');
13
+ }
14
+
15
  function parse (&$data, $encoding) {
16
  $data = apply_filters('feedwordpress_parser_parse', $data, $encoding, $this);
17
 
90
  xml_set_start_namespace_decl_handler($xml, 'start_xmlns');
91
 
92
  // Parse!
93
+ $parseResults = xml_parse($xml, $data, true);
94
+
95
+ $endOfJunk = strpos($data, '<?xml');
96
+ if (!$parseResults and $endOfJunk > 0) :
97
+ // There is some junk before the feed prolog. Try to get rid of it.
98
+ $newData = substr($data, $endOfJunk);
99
+ $newData = trim($newData);
100
+ $this->reset_parser($xml);
101
+
102
+ $parseResults = xml_parse($xml, $newData, true);
103
+ endif;
104
+
105
+ if (!$parseResults)
106
  {
107
  if (class_exists('DOMDocument')) :
108
  libxml_use_internal_errors(true);
feedwordpresslocalpost.class.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FeedWordPressLocalPost {
4
+ private $post;
5
+
6
+ public function __construct ($p = NULL) {
7
+ global $post;
8
+
9
+ if (is_null($p)) :
10
+ $this->post = $post; // current post in loop
11
+ elseif (is_object($p)) :
12
+ $this->post = $p;
13
+ else :
14
+ $this->post = get_post($p);
15
+ endif;
16
+ }
17
+
18
+ public function id () {
19
+ return $this->post->ID;
20
+ }
21
+
22
+ public function meta ($what, $params = array()) {
23
+
24
+ // -=-=-= 1. INITIAL SETUP. =-=-=-
25
+ $params = wp_parse_args($params, array(
26
+ "single" => true,
27
+ "default" => NULL,
28
+ "global" => NULL,
29
+ "unproxied setting" => NULL,
30
+ "unproxy" => false,
31
+ ));
32
+
33
+ // This is a little weird, just bear with me here.
34
+ $results = array();
35
+
36
+ // Has this been left up to the admin setting?
37
+ if (is_null($params['unproxy'])) :
38
+ $params['unproxy'] = FeedWordPress::use_aggregator_source_data();
39
+ endif;
40
+
41
+ // -=-=-= 2. GET DATA FROM THE PROXIMATE OR THE ULTIMATE SOURCE. =-=-=-
42
+
43
+ // Now if we are supposed to look for ultimate source data (e.g. from
44
+ // <atom:source> ... </atom:source> elements), do so here.
45
+ if ($params['unproxy']) :
46
+ if (!is_string($params['unproxied setting'])) :
47
+ // Default pattern for unproxied settings: {$name}_original
48
+ $params['unproxied setting'] = $what . '_original';
49
+ endif;
50
+
51
+ // Now see if there's anything in postmeta from our ultimate source.
52
+ // If so, then we can cut out the middle man here.
53
+ $results = get_post_meta($this->post->ID, /*key=*/ $params['unproxied setting'], /*single=*/ false);
54
+ endif;
55
+
56
+ // If we weren't looking for ultimate source data, or if there wasn't
57
+ // any recorded, then grab this from the data for the proximate source.
58
+ if (empty($results)) :
59
+ $results = get_post_meta($this->post->ID, /*key=*/ $what, /*single=*/ false);
60
+ endif;
61
+
62
+ // -=-=-= 3. DEAL WITH THE RESULTS, IF ANY, OR FALLBACK VALUES. =-=-=-
63
+
64
+ // If we have results now, cool. Just pass them back.
65
+ if (!empty($results)) :
66
+ $ret = ($params['single'] ? $results[0] : $results);
67
+
68
+ // If we got no results but we have a fallback global setting, cool. Use
69
+ // that. Jam it into a singleton array for queries expecting an array of
70
+ // results instead of a scalar result.
71
+ elseif (is_string($params['global']) and strlen($params['global']) > 0) :
72
+ $opt = get_option($params['global'], $params['default']);
73
+ $ret = ($params['single'] ? $opt : array($opt));
74
+
75
+ // If we got no results and we have no fallback global setting, pass
76
+ // back a default value for single-result queries, or an empty array for
77
+ // multiple-result queries.
78
+ else :
79
+ $ret = ($params['single'] ? $params['default'] : array());
80
+ endif;
81
+
82
+ return $ret;
83
+ }
84
+
85
+ public function is_syndicated () {
86
+ return (!is_null($this->feed_id(/*single=*/ false)));
87
+ }
88
+
89
+ public function syndication_permalink () {
90
+ return $this->meta('syndication_permalink');
91
+ }
92
+
93
+ public function feed () {
94
+ return $GLOBALS['feedwordpress']->subscription($this->feed_id());
95
+ }
96
+
97
+ public function feed_id () {
98
+ return $this->meta('syndication_feed_id');
99
+ }
100
+
101
+ public function syndication_feed ($original = NULL) {
102
+ return $this->meta('syndication_feed', array("unproxy" => $original));
103
+ }
104
+
105
+ public function syndication_feed_guid ($original = NULL) {
106
+ $ret = $this->meta('syndication_source_id', array("unproxy" => $original));
107
+
108
+ // If this is blank, fall back to the full URL of the feed
109
+ if (is_null($ret) or strlen(trim($ret))==0) :
110
+ $ret = get_syndication_feed();
111
+ endif;
112
+
113
+ return $ret;
114
+ }
115
+
116
+ public function syndication_source ($original = NULL) {
117
+ $ret = $this->meta('syndication_source', array("unproxy" => $original));
118
+
119
+ // If this is blank, fall back to a prettified URL for the blog.
120
+ if (is_null($ret) or strlen(trim($ret)) == 0) :
121
+ $ret = feedwordpress_display_url($this->syndication_source_link());
122
+ endif;
123
+
124
+ return $ret;
125
+ }
126
+
127
+ public function syndication_source_link ($original = NULL) {
128
+ return $this->meta('syndication_source_uri', array("unproxy" => $original));
129
+ }
130
+
131
+ public function is_exposed_to_formatting_filters () {
132
+
133
+ return (
134
+ !$this->is_syndicated()
135
+ or (
136
+ 'yes' == $this->meta(
137
+ '_feedwordpress_formatting_filters',
138
+ array(
139
+ 'global' => 'feedwordpress_formatting_filters',
140
+ 'default' => 'no',
141
+ )
142
+ )
143
+ )
144
+ );
145
+
146
+ } /* FeedWordPressLocalPost::is_exposed_to_formatting_filters () */
147
+
148
+ } /* class FeedWordPressLocalPost */
149
+
feedwordpresssyndicationpage.class.php CHANGED
@@ -734,16 +734,12 @@ regular donation</a>) using an existing PayPal account or any major credit card.
734
  // ... and kill them all
735
  if (count($post_ids) > 0) :
736
  foreach ($post_ids as $post_id) :
737
- if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_29)) :
738
- // Force scrubbing of deleted post
739
- // rather than sending to Trashcan
740
- wp_delete_post(
741
- /*postid=*/ $post_id,
742
- /*force_delete=*/ true
743
- );
744
- else :
745
- wp_delete_post($post_id);
746
- endif;
747
  endforeach;
748
  endif;
749
 
734
  // ... and kill them all
735
  if (count($post_ids) > 0) :
736
  foreach ($post_ids as $post_id) :
737
+ // Force scrubbing of deleted post
738
+ // rather than sending to Trashcan
739
+ wp_delete_post(
740
+ /*postid=*/ $post_id,
741
+ /*force_delete=*/ true
742
+ );
 
 
 
 
743
  endforeach;
744
  endif;
745
 
posts-page.php CHANGED
@@ -133,7 +133,6 @@ class FeedWordPressPostsPage extends FeedWordPressAdminPage {
133
  * @uses FeedWordPressPostsPage::these_posts_phrase()
134
  * @uses FeedWordPress::syndicated_status()
135
  * @uses SyndicatedLink::syndicated_status()
136
- * @uses SyndicatedPost::use_api()
137
  */
138
  /*static*/ function publication_box ($page, $box = NULL) {
139
  $thesePosts = $page->these_posts_phrase();
133
  * @uses FeedWordPressPostsPage::these_posts_phrase()
134
  * @uses FeedWordPress::syndicated_status()
135
  * @uses SyndicatedLink::syndicated_status()
 
136
  */
137
  /*static*/ function publication_box ($page, $box = NULL) {
138
  $thesePosts = $page->these_posts_phrase();
readme.txt CHANGED
@@ -4,14 +4,14 @@ Donate link: http://feedwordpress.radgeek.com/
4
  Tags: syndication, aggregation, feed, atom, rss
5
  Requires at least: 3.0
6
  Tested up to: 3.5
7
- Stable tag: 2012.1212
8
 
9
  FeedWordPress syndicates content from feeds you choose into your WordPress weblog.
10
 
11
  == Description ==
12
 
13
  * Author: [Charles Johnson](http://radgeek.com/contact)
14
- * Project URI: <http://projects.radgeek.com/feedwordpress>
15
  * License: GPL 2. See License below for copyright jots and tittles.
16
 
17
  FeedWordPress is an Atom/RSS aggregator for WordPress. It syndicates content
@@ -94,6 +94,56 @@ outs, see the documentation at the [FeedWordPress project homepage][].
94
 
95
  == Changelog ==
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  = 2012.1212 =
98
 
99
  * WORDPRESS 3.5 COMPATIBILITY: This release has been tested for compatibility
@@ -1889,7 +1939,8 @@ The FeedWordPress plugin is copyright © 2005-2010 by Charles Johnson. It uses
1889
  code derived or translated from:
1890
 
1891
  - [wp-rss-aggregate.php][] by [Kellan Elliot-McCrea](kellan@protest.net)
1892
- - [MagpieRSS][] by [Kellan Elliot-McCrea](kellan@protest.net)
 
1893
  - [Ultra-Liberal Feed Finder][] by [Mark Pilgrim](mark@diveintomark.org)
1894
  - [WordPress Blog Tool and Publishing Platform](http://wordpress.org/)
1895
 
@@ -1905,8 +1956,8 @@ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1905
  PARTICULAR PURPOSE. See the GNU General Public License for more details.
1906
 
1907
  [wp-rss-aggregate.php]: http://laughingmeme.org/archives/002203.html
 
1908
  [MagpieRSS]: http://magpierss.sourceforge.net/
1909
- [HTTP Navigator 2]: http://www.keyvan.net/2004/11/16/http-navigator/
1910
  [Ultra-Liberal Feed Finder]: http://diveintomark.org/projects/feed_finder/
1911
  [GNU General Public License]: http://www.gnu.org/copyleft/gpl.html
1912
 
4
  Tags: syndication, aggregation, feed, atom, rss
5
  Requires at least: 3.0
6
  Tested up to: 3.5
7
+ Stable tag: 2012.1218
8
 
9
  FeedWordPress syndicates content from feeds you choose into your WordPress weblog.
10
 
11
  == Description ==
12
 
13
  * Author: [Charles Johnson](http://radgeek.com/contact)
14
+ * Project URI: <http://feedwordpress.radgeek.com/>
15
  * License: GPL 2. See License below for copyright jots and tittles.
16
 
17
  FeedWordPress is an Atom/RSS aggregator for WordPress. It syndicates content
94
 
95
  == Changelog ==
96
 
97
+ = 2012.1218 =
98
+
99
+ * WORDPRESS VISUAL EDITOR FIXED. There was an unlisted change in the
100
+ 2012.1212 release which had the effect of disabling the WordPress Visual
101
+ Editor for all posts syndicated by FeedWordPress. Many users reported
102
+ this as a bug. It was actually a deliberate decision -- a crappy way to
103
+ try to deal with a crappy situation. (Many users had previously reported
104
+ a "bug" in which all the paragraph or line breaks seemed to be stripped
105
+ out of their syndicated posts; the issue turned out to be that the
106
+ Visual Editor was stripping out `<p>` and `<br/>` tags on the assumption
107
+ that the resulting post would be sent through standard WordPress
108
+ formatting filters. But under default settings, posts syndicated by FWP
109
+ deliberately bypass WordPress formatting filters.) In any case, this
110
+ version adopts a more flexible compromise. *If* FeedWordPress is set up
111
+ to bypass WordPress formatting filters (as it is by default), *then*
112
+ the Visual Editor will be disabled for syndicated posts (since using it
113
+ would produce incorrect results). If on the other hand FeedWordPress is
114
+ set up to expose syndicated posts to WordPress formatting filters (as it
115
+ usually is for those using the Visual Editor to manually edit posts),
116
+ then the Visual Editor tab will be re-enabled for syndicated posts.
117
+
118
+ * BUG FIX: PERMALINKS REWRITTEN FOR CUSTOM POST TYPES AS WELL AS NORMAL
119
+ WORDPRESS POSTS. If you had WordPress set up to syndicate incoming posts
120
+ to a custom post type (under Syndication > Posts & Links), and asked
121
+ FeedWordPress to make "permalinks point to the original site", then
122
+ previous versions of FeedWordPress would fail to do the rewriting --
123
+ permalinks would only be rewritten to point to the original source for
124
+ normal WordPress posts, not for custom post types. In 2012.1218 this bug
125
+ has been fixed: all post types will now have permalinks rewritten unless
126
+ you request for permalinks to point to the local copy on your aggregator
127
+ site.
128
+
129
+ * BUG FIX: ELIMINATES "PHP Fatal error: Call to a member function
130
+ setting() on a non-object...." Some changes to the in-memory caching of
131
+ information about feed subscriptions could result in a fatal PHP error
132
+ in cases where you have de-activated one of your subscriptions, but
133
+ posts from that subscription were still in the archive. This would
134
+ normally show up through half-completed feeds or half-completed pages
135
+ that suddenly broke off in the middle, and displayed or logged an error
136
+ message like: "PHP Fatal error: Call to a member function setting() on a
137
+ non-object in {...}/wp-content/plugins/feedwordpress/feedwordpress.php
138
+ on line 615". This bug has been eliminated, so affected feeds and pages
139
+ should now render correctly, and the error message should no longer
140
+ appear.
141
+
142
+ * BUG FIX: CATEGORY BOXES IN SYNDICATION > CATEGORIES & TAGS. Some minor
143
+ bugs in the appearance and animation of category checkboxes (for
144
+ example, the checkbox used to select categories for syndicated posts on
145
+ the Syndication > Categories & Tags settings page) have been fixed.
146
+
147
  = 2012.1212 =
148
 
149
  * WORDPRESS 3.5 COMPATIBILITY: This release has been tested for compatibility
1939
  code derived or translated from:
1940
 
1941
  - [wp-rss-aggregate.php][] by [Kellan Elliot-McCrea](kellan@protest.net)
1942
+ - [SimplePie][] feed parser by Ryan Parman, Geoffrey Sneddon, Ryan McCue, et al.
1943
+ - [MagpieRSS][] feed parser by [Kellan Elliot-McCrea](kellan@protest.net)
1944
  - [Ultra-Liberal Feed Finder][] by [Mark Pilgrim](mark@diveintomark.org)
1945
  - [WordPress Blog Tool and Publishing Platform](http://wordpress.org/)
1946
 
1956
  PARTICULAR PURPOSE. See the GNU General Public License for more details.
1957
 
1958
  [wp-rss-aggregate.php]: http://laughingmeme.org/archives/002203.html
1959
+ [SimplePie]: http://www.simplepie.org/
1960
  [MagpieRSS]: http://magpierss.sourceforge.net/
 
1961
  [Ultra-Liberal Feed Finder]: http://diveintomark.org/projects/feed_finder/
1962
  [GNU General Public License]: http://www.gnu.org/copyleft/gpl.html
1963
 
syndicatedpost.class.php CHANGED
@@ -2198,20 +2198,5 @@ EOM;
2198
  return $terms;
2199
  } // function SyndicatedPost::category_ids ()
2200
 
2201
- function use_api ($tag) {
2202
- global $wp_db_version;
2203
- switch ($tag) :
2204
- case 'wp_insert_post':
2205
- // Before 2.2, wp_insert_post does too much of the wrong stuff to use it
2206
- // In 1.5 it was such a resource hog it would make PHP segfault on big updates
2207
- $ret = (isset($wp_db_version) and $wp_db_version > FWP_SCHEMA_21);
2208
- break;
2209
- case 'post_status_pending':
2210
- $ret = (isset($wp_db_version) and $wp_db_version > FWP_SCHEMA_23);
2211
- break;
2212
- endswitch;
2213
- return $ret;
2214
- } // function SyndicatedPost::use_api ()
2215
-
2216
  } /* class SyndicatedPost */
2217
 
2198
  return $terms;
2199
  } // function SyndicatedPost::category_ids ()
2200
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2201
  } /* class SyndicatedPost */
2202