FeedWordPress - Version 2013.0503

Version Description

Download this release

Release Info

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

Code changes from version 2012.1218 to 2013.0503

admin-ui.php CHANGED
@@ -163,12 +163,12 @@ class FeedWordPressAdminPage {
163
  );
164
  foreach ($submit_buttons as $field) :
165
  if (isset($fwp_post[$field])) :
166
- $link_id = $_REQUEST['save_link_id'];
167
  endif;
168
  endforeach;
169
 
170
  if (is_null($link_id) and isset($_REQUEST['link_id'])) :
171
- $link_id = $_REQUEST['link_id'];
172
  endif;
173
 
174
  return $link_id;
@@ -187,7 +187,7 @@ class FeedWordPressAdminPage {
187
  function stamp_link_id ($field = null) {
188
  if (is_null($field)) : $field = 'save_link_id'; endif;
189
  ?>
190
- <input type="hidden" name="<?php print esc_html($field); ?>" value="<?php print ($this->for_feed_settings() ? $this->link->id : '*'); ?>" />
191
  <?php
192
  } /* FeedWordPressAdminPage::stamp_link_id () */
193
 
163
  );
164
  foreach ($submit_buttons as $field) :
165
  if (isset($fwp_post[$field])) :
166
+ $link_id = MyPHP::request('save_link_id');
167
  endif;
168
  endforeach;
169
 
170
  if (is_null($link_id) and isset($_REQUEST['link_id'])) :
171
+ $link_id = MyPHP::request('link_id');
172
  endif;
173
 
174
  return $link_id;
187
  function stamp_link_id ($field = null) {
188
  if (is_null($field)) : $field = 'save_link_id'; endif;
189
  ?>
190
+ <input type="hidden" name="<?php print esc_attr($field); ?>" value="<?php print ($this->for_feed_settings() ? $this->link->id : '*'); ?>" />
191
  <?php
192
  } /* FeedWordPressAdminPage::stamp_link_id () */
193
 
diagnostics-page.php CHANGED
@@ -119,6 +119,7 @@ class FeedWordPressDiagnosticsPage extends FeedWordPressAdminPage {
119
 
120
  function info_box ($page, $box = NULL) {
121
  global $feedwordpress;
 
122
  $link_category_id = FeedWordPress::link_category_id();
123
  ?>
124
  <table class="edit-form narrow">
@@ -133,6 +134,20 @@ class FeedWordPressDiagnosticsPage extends FeedWordPressAdminPage {
133
  <td>You are using FeedWordPress version <strong><?php print FEEDWORDPRESS_VERSION; ?></strong>.</td>
134
  </tr>
135
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  <tr>
137
  <th scope="row">Link Category:</th>
138
  <td><?php if (!is_wp_error($link_category_id)) :
119
 
120
  function info_box ($page, $box = NULL) {
121
  global $feedwordpress;
122
+ global $wp_version;
123
  $link_category_id = FeedWordPress::link_category_id();
124
  ?>
125
  <table class="edit-form narrow">
134
  <td>You are using FeedWordPress version <strong><?php print FEEDWORDPRESS_VERSION; ?></strong>.</td>
135
  </tr>
136
 
137
+ <tr>
138
+ <th scope="row">Hosting Environment:</th>
139
+ <td><ul style="margin-top: 0; padding-top: 0;">
140
+ <li><em>WordPress:</em> version <?php print $wp_version; ?></li>
141
+ <?php if (function_exists('phpversion')) : ?>
142
+ <li><em>PHP:</em> version <?php print phpversion(); ?></li>
143
+ <?php endif; ?>
144
+ <?php if (function_exists('apache_get_version')) : ?>
145
+ <li><sem>Web Server:</em> <?php print apache_get_version(); ?></li>
146
+ <?php endif; ?>
147
+ </ul>
148
+ </td>
149
+ </tr>
150
+
151
  <tr>
152
  <th scope="row">Link Category:</th>
153
  <td><?php if (!is_wp_error($link_category_id)) :
feeds-page.php CHANGED
@@ -775,9 +775,9 @@ class FeedWordPressFeedsPage extends FeedWordPressAdminPage {
775
 
776
  $lookup = (isset($_REQUEST['lookup']) ? $_REQUEST['lookup'] : NULL);
777
 
778
- $auth = FeedWordPress::param('link_rss_auth_method');
779
- $username = FeedWordPress::param('link_rss_username');
780
- $password = FeedWordPress::param('link_rss_password');
781
  $credentials = array(
782
  "authentication" => $auth,
783
  "username" => $username,
775
 
776
  $lookup = (isset($_REQUEST['lookup']) ? $_REQUEST['lookup'] : NULL);
777
 
778
+ $auth = MyPHP::request('link_rss_auth_method');
779
+ $username = MyPHP::request('link_rss_username');
780
+ $password = MyPHP::request('link_rss_password');
781
  $credentials = array(
782
  "authentication" => $auth,
783
  "username" => $username,
feedwordpress-elements.css CHANGED
@@ -429,3 +429,43 @@ table.twofer td.secondary { padding-left: 10px; width: 30%; }
429
 
430
  #feedwordpress-admin-feeds #link-rss-params td { width: auto !important; }
431
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
429
 
430
  #feedwordpress-admin-feeds #link-rss-params td { width: auto !important; }
431
 
432
+ /* Feed Contents picker & XPath test results widgets */
433
+
434
+ .fwp-xpath-test-results {
435
+ position: absolute;
436
+ top: auto; left: auto;
437
+ z-index: 9999999;
438
+ overflow: auto;
439
+ max-height: 100px; max-width: 400px;
440
+ background-color: #ccffcc;
441
+ padding: 10px;
442
+ }
443
+ .fwp-xpath-test-results-close {
444
+ position: absolute;
445
+ top: 10px; right: 10px;
446
+
447
+ }
448
+ .fwp-xpath-test-setting {
449
+ font-size: smaller;
450
+ }
451
+
452
+ .fwp-feed-contents-picker h4, .fwp-xpath-test-results h4 {
453
+ margin-top: 0;
454
+ margin-bottom: 5px;
455
+ border-bottom: 1px dotted black;
456
+ }
457
+ .fwp-feed-contents-picker-close {
458
+ position: absolute;
459
+ top: 10px; right: 10px;
460
+ }
461
+ .fwp-feed-contents-picker, .fwp-feeds-picker {
462
+ position: absolute;
463
+ top: auto; left: auto;
464
+ z-index: 9999999;
465
+ overflow: auto;
466
+ max-height: 100px; max-width: 400px;
467
+ background-color: #ccffcc;
468
+ padding: 10px;
469
+ }
470
+
471
+
feedwordpress-elements.js CHANGED
@@ -486,7 +486,252 @@ jQuery(document).ready( function($) {
486
  } ); /* $('.feedwordpress-category-div').each() */
487
  } ); /* jQuery(document).ready() */
488
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
489
  jQuery(document).ready(function($){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
490
  if ( $('.jaxtag').length ) {
491
  tagBox.init();
492
  }
486
  } ); /* $('.feedwordpress-category-div').each() */
487
  } ); /* jQuery(document).ready() */
488
 
489
+
490
+ function fwp_feedspiper () {
491
+ var data = {
492
+ action: 'fwp_feeds'
493
+ };
494
+
495
+ return jQuery.ajax({
496
+ type: "POST",
497
+ url: ajaxurl,
498
+ data: data
499
+ });
500
+ }
501
+
502
+ function fwp_feedcontentspiper (feed_id, callbackOK, callbackFail) {
503
+ var data = {
504
+ action: 'fwp_feedcontents',
505
+ feed_id: feed_id
506
+ };
507
+
508
+ jQuery.ajax({
509
+ type: "POST",
510
+ url: ajaxurl,
511
+ data: data
512
+ })
513
+ .done(function (response) { callbackOK(response); })
514
+ .fail(function (response) { callbackFail(response); });
515
+ }
516
+
517
+ function fwp_feedcontentspicker (feed_id, destination, pickCallback, closeCallback) {
518
+ var picker_id = 'fwp-feed-contents-picker-' + feed_id;
519
+
520
+ jQuery('<div class="fwp-feed-contents-picker" style="display: none;" id="'+picker_id+'"><p>Loading...</p></div>').insertAfter(destination);
521
+ jQuery('#'+picker_id).show(500);
522
+
523
+ fwp_feedcontentspiper(feed_id, function (response) {
524
+ var ul = '<h4>Using post...</h4><ul>';
525
+ for (var i=0; i < response.length; i++) {
526
+ ul += '<li><a class="fwp-feed-contents-picker-pick-'+feed_id+'" href="'
527
+ +response[i].guid
528
+ +'">' + response[i].post_title + '</a></li>';
529
+ }
530
+ ul += '</ul>';
531
+ ul += '<a class="fwp-feed-contents-picker-close" href="#" id="fwp-feed-contents-picker-' + feed_id + '-close">x</a>';
532
+
533
+ jQuery('#fwp-feed-contents-picker-' + feed_id).html(ul);
534
+
535
+ // Set up event handlers.
536
+ jQuery('#fwp-feed-contents-picker-' + feed_id + '-close').click(function (e) {
537
+ jQuery('#fwp-feed-contents-picker-' + feed_id).hide(500, function () { jQuery('#fwp-feed-contents-picker-' + feed_id).remove(); });
538
+ if (typeof(closeCallback)=='function') {
539
+ closeCallback(feed_id);
540
+ }
541
+ e.preventDefault();
542
+ return false;
543
+ });
544
+ jQuery('.fwp-feed-contents-picker-pick-' + feed_id).click(function (e) {
545
+ jQuery('#fwp-feed-contents-picker-' + feed_id).hide(500, function () { jQuery('#fwp-feed-contents-picker-' + feed_id).remove(); });
546
+ if (typeof(pickCallback)=='function') {
547
+ pickCallback(feed_id, jQuery(this).attr('href'));
548
+ }
549
+ e.preventDefault();
550
+ return false;
551
+ });
552
+ },
553
+ function (response) {
554
+ jQuery('#' + picker_id).addClass('error').html('There was a problem getting a listing of the feed. Sorry!').delay(5000).hide(500, function () { jQuery(this).remove(); });
555
+ });
556
+ }
557
+
558
+ function fwp_feedspicker (destination, pickCallback, closeCallback) {
559
+ var dabber = jQuery(destination).attr('id');
560
+ var picker_id = 'fwp-feeds-picker-' + dabber;
561
+
562
+ jQuery('<div class="fwp-feeds-picker" style="display: none;" id="'+picker_id+'"><p>Loading...</p></div>').insertAfter(destination);
563
+ jQuery('#'+picker_id).show(500);
564
+
565
+ fwp_feedspiper()
566
+ .done(function (response) {
567
+ var ul = '<h4>Using subscription...</h4><ul>';
568
+ for (var i=0; i < response.length; i++) {
569
+ ul += '<li><a class="fwp-feeds-picker-pick-'+dabber+'" href="#feed-'
570
+ +response[i].id
571
+ +'">' + response[i].name + '</a></li>';
572
+ }
573
+ ul += '</ul>';
574
+ ul += '<a class="fwp-feeds-picker-close" href="#" id="fwp-feeds-picker-' + dabber + '-close">x</a>';
575
+
576
+ jQuery('#fwp-feeds-picker-' + dabber).html(ul);;
577
+
578
+ // Set up event handlers.
579
+ jQuery('#fwp-feeds-picker-' + dabber + '-close').click(function (e) {
580
+ jQuery('#fwp-feeds-picker-' + dabber).hide(500, function () { jQuery('#fwp-feeds-picker-' + dabber).remove(); });
581
+ if (typeof(closeCallback)=='function') {
582
+ closeCallback(destination);
583
+ }
584
+ e.preventDefault();
585
+ return false;
586
+ });
587
+ jQuery('.fwp-feeds-picker-pick-' + dabber).click(function (e) {
588
+ jQuery('#fwp-feeds-picker-' + dabber).hide(500, function () {
589
+ jQuery('#fwp-feeds-picker-' + dabber).remove();
590
+ });
591
+
592
+ var feed_id = jQuery(this).attr('href').replace(/^#feed-/, '');
593
+
594
+ if (typeof(pickCallback)=='function') {
595
+ pickCallback(feed_id, jQuery(this));
596
+ }
597
+ e.preventDefault();
598
+ return false;
599
+ });
600
+ })
601
+ .fail(function (response) {
602
+ jQuery('#' + picker_id).addClass('error').html('There was a problem getting a listing of your subscriptions. Sorry!').delay(5000).hide(500, function () { jQuery(this).remove(); });
603
+ });
604
+ }
605
+
606
+ function fwp_xpathtest_ajax (expression, feed_id, post_id) {
607
+ var data = {
608
+ action: 'fwp_xpathtest',
609
+ xpath: expression,
610
+ feed_id: feed_id,
611
+ post_id: post_id
612
+ };
613
+
614
+ return jQuery.ajax({
615
+ type: "GET",
616
+ url: ajaxurl,
617
+ data: data
618
+ });
619
+ }
620
+
621
+ function fwp_xpathtest_fail (response, result_id, destination) {
622
+ jQuery('<div class="fwp-xpath-test-results error" style="display: none;" id="'+result_id+'">There was a problem communicating with the server.<p>result = <code>'+response+'</code></p></div>').insertAfter(destination);
623
+ jQuery('#'+result_id).show(500).delay(3000).hide(500, function () { jQuery(this).remove(); });
624
+ }
625
+
626
+ function fwp_xpathtest_ok (response, result_id, destination) {
627
+ var dabber = jQuery(destination).attr('id');
628
+ var resultsHtml = '<ul>';
629
+
630
+ if (response.results instanceof Array) {
631
+ for (var i = 0; i < response.results.length; i++) {
632
+ resultsHtml += '<li>result['+i.toString()+'] = <code>'+response.results[i]+'</code></li>';
633
+ }
634
+ } else {
635
+ resultsHtml += '<li>result = <code>' + response.results + '</code></li>';
636
+ } /* if */
637
+ resultsHtml += '</ul>';
638
+
639
+ jQuery('<div class="fwp-xpath-test-results" style="display: none;" id="'+result_id+'"><h4>'+response.expression+'</h4>'+resultsHtml+'</code> <a class="fwp-xpath-test-results-close">x</a></div>').insertAfter(destination);
640
+
641
+ var link_id = 'fwp-xpath-test-results-post-'+dabber;
642
+ if (jQuery('#'+link_id).length > 0) {
643
+ jQuery('#'+link_id).attr('href', response.guid).html(response.post_title);
644
+ } else {
645
+ jQuery('<div id="contain-'+link_id+'" class="fwp-xpath-test-results-post fwp-xpath-test-setting">Using post: <a id="'+link_id+'" href="'+response.guid+'"> '+response.post_title+'</a> (<a href="#" class="fwp-xpath-test-results-post-change">reset</a>)</div>').insertAfter('#'+result_id);
646
+ } /* if */
647
+
648
+ jQuery('#'+result_id).find('.fwp-xpath-test-results-close').click(function (e) {
649
+ e.preventDefault();
650
+
651
+ jQuery('#'+result_id).hide(500, function () { jQuery(this).remove(); });
652
+ return false;
653
+ });
654
+ jQuery('#contain-'+link_id).find('.fwp-xpath-test-results-post-change').click(function (e) {
655
+ e.preventDefault();
656
+ jQuery('#contain-'+link_id).remove();
657
+
658
+ return false;
659
+ });
660
+ jQuery('#'+result_id).show(500);
661
+ }
662
+
663
+ function fwp_xpathtest (expression, destination, feed_id) {
664
+ var dabber = jQuery(destination).attr('id');
665
+ var result_id = 'fwp-xpath-test-results-'+dabber;
666
+ var preset_post_id = 'fwp-xpath-test-results-post-'+dabber;
667
+ var post_id = jQuery('#'+preset_post_id).attr('href');
668
+
669
+ // Clear out any previous results.
670
+ jQuery('#'+result_id).remove();
671
+
672
+ if (jQuery('#xpath-test-feed-id-'+dabber).length > 0) {
673
+ feed_id = jQuery('#xpath-test-feed-id-'+dabber).val();
674
+ }
675
+
676
+ if ('*' == feed_id) {
677
+
678
+ fwp_feedspicker(destination, function (feed_id, a) {
679
+ var href = a.attr('href');
680
+ var text = a.text();
681
+
682
+ jQuery('<div class="fwp-xpath-test-feed-id fwp-xpath-test-setting" id="contain-xpath-test-feed-id-'+dabber+'">Using sub: <a href="'+href+'">'+text+'</a><input type="hidden" id="xpath-test-feed-id-'+dabber+'" name="xpath_test_feed_id" value="'+feed_id+'" /> (<a href="#" class="fwp-xpath-test-feed-id-change">reset</a>)</div>').insertAfter(destination);
683
+
684
+ jQuery('#contain-xpath-test-feed-id-'+dabber).find('.fwp-xpath-test-feed-id-change').click(function (e) {
685
+ e.preventDefault();
686
+
687
+ // If there is a post set, we need to reset that
688
+ console.log(('#contain-fwp-xpath-test-results-post-'+dabber), jQuery('#contain-fwp-xpath-test-results-post-'+dabber));
689
+ jQuery('#contain-fwp-xpath-test-results-post-'+dabber).remove();
690
+
691
+ // Show yourself out.
692
+ jQuery('#contain-xpath-test-feed-id-'+dabber).remove();
693
+ return false;
694
+ });
695
+
696
+ // Now recursively call the function in order to force
697
+ // a post-picker.
698
+ fwp_xpathtest(expression, destination, feed_id);
699
+ });
700
+ }
701
+
702
+ // Check for a pre-selected post GUID.
703
+ else if (post_id) {
704
+ fwp_xpathtest_ajax(expression, feed_id, post_id)
705
+ .done( function (response) { fwp_xpathtest_ok(response, result_id, destination); } )
706
+ .fail( function (response) { fwp_xpathtest_fail(response, result_id, destination); } );
707
+ }
708
+ else {
709
+ // Pop up the feed content picker
710
+ fwp_feedcontentspicker(feed_id, destination, function (feed_id, post_id) {
711
+ fwp_xpathtest_ajax(expression, feed_id, post_id)
712
+ .done( function (response) { fwp_xpathtest_ok(response, result_id, destination); } )
713
+ .fail( function (response) { fwp_xpathtest_fail(response, result_id, destination); } );
714
+ });
715
+ }
716
+
717
+ }
718
+
719
  jQuery(document).ready(function($){
720
+ if ( $('.xpath-test').length ) {
721
+ $('.xpath-test').click ( function (e) {
722
+ e.preventDefault();
723
+
724
+ // Pull the local expression from the text box
725
+ var expr = jQuery(this).closest('tr').find('textarea').val();
726
+
727
+ // Check to see if we are on a Feed settings page or
728
+ // on the global settings page;
729
+ var feed_id = jQuery('input[name="save_link_id"]').val();
730
+
731
+ fwp_xpathtest(expr, jQuery(this), feed_id);
732
+ return false;
733
+ });
734
+ }
735
  if ( $('.jaxtag').length ) {
736
  tagBox.init();
737
  }
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.1218
7
  Author: Charles Johnson
8
  Author URI: http://radgeek.com/
9
  License: GPL
@@ -11,30 +11,28 @@ 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.
23
  #
24
- # INSTALLATION: see readme.txt or <http://projects.radgeek.com/install>
25
  #
26
  # USAGE: once FeedWordPress is installed, you manage just about everything from
27
- # the WordPress Dashboard, under the Syndication menu. To ensure that fresh
28
- # content is added as it becomes available, you can convince your contributors
29
- # to put your XML-RPC URI (if WordPress is installed at
30
- # <http://www.zyx.com/blog>, XML-RPC requests should be sent to
31
- # <http://www.zyx.com/blog/xmlrpc.php>), or update manually under the
32
- # Syndication menu, or set up automatic updates under Syndication --> Settings,
33
- # or use a cron job.
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')) :
@@ -104,6 +102,7 @@ if (!function_exists('wp_insert_user')) :
104
  endif;
105
 
106
  $dir = dirname(__FILE__);
 
107
  require_once("${dir}/admin-ui.php");
108
  require_once("${dir}/feedwordpresssyndicationpage.class.php");
109
  require_once("${dir}/compatability.php"); // Legacy API
@@ -224,6 +223,7 @@ if (!FeedWordPress::needs_upgrade()) : // only work if the conditions are safe!
224
  add_filter('syndicated_item_content', array('SyndicatedPost', 'resolve_relative_uris'), 0, 2);
225
  add_filter('syndicated_item_content', array('SyndicatedPost', 'sanitize_content'), 0, 2);
226
 
 
227
  else :
228
  # Hook in the menus, which will just point to the upgrade interface
229
  add_action('admin_menu', 'fwp_add_pages');
@@ -653,6 +653,8 @@ function syndication_comments_feed_link ($link) {
653
  ################################################################################
654
 
655
  function fwp_add_pages () {
 
 
656
  $menu_cap = FeedWordPress::menu_cap();
657
  $settings_cap = FeedWordPress::menu_cap(/*sub=*/ true);
658
  $syndicationMenu = FeedWordPress::path('syndication.php');
@@ -706,6 +708,9 @@ function fwp_add_pages () {
706
  $syndicationMenu, 'FeedWordPress Diagnostics', 'Diagnostics',
707
  $settings_cap, FeedWordPress::path('diagnostics-page.php')
708
  );
 
 
 
709
  } /* function fwp_add_pages () */
710
 
711
  function fwp_check_debug () {
@@ -946,7 +951,7 @@ class FeedWordPress {
946
  endif;
947
 
948
  return $sub;
949
- } /* FeedWordPress::subscriptions () */
950
 
951
  # function update (): polls for updates on one or more Contributor feeds
952
  #
@@ -1207,6 +1212,29 @@ class FeedWordPress {
1207
  endif;
1208
  } /* FeedWordPress::admin_init() */
1209
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1210
  function init () {
1211
  global $fwp_path;
1212
 
@@ -1245,10 +1273,118 @@ class FeedWordPress {
1245
  /*priority=*/ -100
1246
  );
1247
 
 
 
 
 
1248
  $this->clear_cache_magic_url();
1249
  $this->update_magic_url();
1250
  } /* FeedWordPress::init() */
1251
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1252
  function redirect_retired () {
1253
  global $wp_query;
1254
  if (is_singular()) :
@@ -1267,6 +1403,34 @@ class FeedWordPress {
1267
  endif;
1268
  }
1269
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1270
  function dashboard_setup () {
1271
  $see_it = FeedWordPress::menu_cap();
1272
 
@@ -1385,10 +1549,7 @@ class FeedWordPress {
1385
  } /* FeedWordPress::clear_cache_magic_url() */
1386
 
1387
  function clear_cache_requested () {
1388
- return (
1389
- isset($_GET['clear_cache'])
1390
- and $_GET['clear_cache']
1391
- );
1392
  } /* FeedWordPress::clear_cache_requested() */
1393
 
1394
  function update_requested () {
@@ -2077,21 +2238,13 @@ EOMAIL;
2077
  return $path;
2078
  }
2079
 
 
 
2080
  function param ($key, $type = 'REQUEST', $default = NULL) {
2081
- $where = '_'.strtoupper($type);
2082
- $ret = $default;
2083
- if (isset($GLOBALS[$where]) and is_array($GLOBALS[$where])) :
2084
- if (isset($GLOBALS[$where][$key])) :
2085
- $ret = $GLOBALS[$where][$key];
2086
- if (get_magic_quotes_gpc()) :
2087
- $ret = stripslashes_deep($ret);
2088
- endif;
2089
- endif;
2090
- endif;
2091
- return $ret;
2092
  }
2093
  function post ($key, $default = NULL) {
2094
- return FeedWordPress::param($key, 'POST');
2095
  }
2096
  } // class FeedWordPress
2097
 
3
  Plugin Name: FeedWordPress
4
  Plugin URI: http://feedwordpress.radgeek.com/
5
  Description: simple and flexible Atom/RSS syndication for WordPress
6
+ Version: 2013.0502
7
  Author: Charles Johnson
8
  Author URI: http://radgeek.com/
9
  License: GPL
11
 
12
  /**
13
  * @package FeedWordPress
14
+ * @version 2013.0502
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.
20
+ # - MagpieRSS feed parser by Kellan Elliot-McCrea <kellan@protest.net>
21
  # - Ultra-Liberal Feed Finder by Mark Pilgrim <mark@diveintomark.org>
22
  # - WordPress Blog Tool and Publishing Platform <http://wordpress.org/>
23
  # according to the terms of the GNU General Public License.
24
  #
25
+ # INSTALLATION: see readme.txt or <http://feedwordpress.radgeek.com/install>
26
  #
27
  # USAGE: once FeedWordPress is installed, you manage just about everything from
28
+ # the WordPress Dashboard, under the Syndication menu. To keep fresh content
29
+ # coming in as it becomes available, you'll have to either check for updates
30
+ # manually, or set up one of the automatically-scheduled update methods. See
31
+ # <http://feedwordpress.radgeek.com/wiki/quick-start/> for some details.
 
 
 
32
 
33
  # -- Don't change these unless you know what you're doing...
34
 
35
+ define ('FEEDWORDPRESS_VERSION', '2013.0502');
36
  define ('FEEDWORDPRESS_AUTHOR_CONTACT', 'http://radgeek.com/contact');
37
 
38
  if (!defined('FEEDWORDPRESS_BLEG')) :
102
  endif;
103
 
104
  $dir = dirname(__FILE__);
105
+ require_once("${dir}/externals/myphp/myphp.class.php");
106
  require_once("${dir}/admin-ui.php");
107
  require_once("${dir}/feedwordpresssyndicationpage.class.php");
108
  require_once("${dir}/compatability.php"); // Legacy API
223
  add_filter('syndicated_item_content', array('SyndicatedPost', 'resolve_relative_uris'), 0, 2);
224
  add_filter('syndicated_item_content', array('SyndicatedPost', 'sanitize_content'), 0, 2);
225
 
226
+ add_action('plugins_loaded', array('FeedWordPress', 'admin_api'));
227
  else :
228
  # Hook in the menus, which will just point to the upgrade interface
229
  add_action('admin_menu', 'fwp_add_pages');
653
  ################################################################################
654
 
655
  function fwp_add_pages () {
656
+ global $feedwordpress;
657
+
658
  $menu_cap = FeedWordPress::menu_cap();
659
  $settings_cap = FeedWordPress::menu_cap(/*sub=*/ true);
660
  $syndicationMenu = FeedWordPress::path('syndication.php');
708
  $syndicationMenu, 'FeedWordPress Diagnostics', 'Diagnostics',
709
  $settings_cap, FeedWordPress::path('diagnostics-page.php')
710
  );
711
+
712
+ add_filter('page_row_actions', array($feedwordpress, 'row_actions'), 10, 2);
713
+ add_filter('post_row_actions', array($feedwordpress, 'row_actions'), 10, 2);
714
  } /* function fwp_add_pages () */
715
 
716
  function fwp_check_debug () {
951
  endif;
952
 
953
  return $sub;
954
+ } /* FeedWordPress::subscription () */
955
 
956
  # function update (): polls for updates on one or more Contributor feeds
957
  #
1212
  endif;
1213
  } /* FeedWordPress::admin_init() */
1214
 
1215
+ function admin_api () {
1216
+ // This sucks, but WordPress doesn't give us any other way to
1217
+ // easily invoke a permanent-delete from a plugged in post
1218
+ // actions link. So we create a magic parameter, and when this
1219
+ // magic parameter is activated, the WordPress trashcan is
1220
+ // temporarily de-activated.
1221
+
1222
+ if (MyPHP::request('fwp_post_delete')=='nuke') :
1223
+ // Get post ID #
1224
+ $post_id = MyPHP::request('post');
1225
+ if (!$post_id) :
1226
+ $post_id = MyPHP::request('post_ID');
1227
+ endif;
1228
+
1229
+ // Make sure we've got the right nonce and all that.
1230
+ check_admin_referer('delete-post_' . $post_id);
1231
+
1232
+ // If so, disable the trashcan.
1233
+ define('EMPTY_TRASH_DAYS', 0);
1234
+ endif;
1235
+
1236
+ }
1237
+
1238
  function init () {
1239
  global $fwp_path;
1240
 
1273
  /*priority=*/ -100
1274
  );
1275
 
1276
+ add_action('wp_ajax_fwp_feeds', array($this, 'fwp_feeds'));
1277
+ add_action('wp_ajax_fwp_feedcontents', array($this, 'fwp_feedcontents'));
1278
+ add_action('wp_ajax_fwp_xpathtest', array($this, 'fwp_xpathtest'));
1279
+
1280
  $this->clear_cache_magic_url();
1281
  $this->update_magic_url();
1282
  } /* FeedWordPress::init() */
1283
 
1284
+ function fwp_feeds () {
1285
+ $feeds = array();
1286
+ $feed_ids = $this->feeds;
1287
+
1288
+ foreach ($feed_ids as $id) :
1289
+ $sub = $this->subscription($id);
1290
+ $feeds[] = array(
1291
+ "id" => $id,
1292
+ "url" => $sub->uri(),
1293
+ "name" => $sub->name(/*fromFeed=*/ false),
1294
+ );
1295
+ endforeach;
1296
+
1297
+ header("Content-Type: application/json");
1298
+ echo json_encode($feeds);
1299
+ exit;
1300
+ }
1301
+
1302
+ function fwp_feedcontents () {
1303
+ $feed_id = MyPHP::request('feed_id');
1304
+
1305
+ // Let's load up some data from the feed . . .
1306
+ $feed = $this->subscription($feed_id);
1307
+ $posts = $feed->live_posts();
1308
+
1309
+ if (is_wp_error($posts)) :
1310
+ header("HTTP/1.1 502 Bad Gateway");
1311
+ $result = $posts;
1312
+ else :
1313
+ $result = array();
1314
+
1315
+ foreach ($posts as $post) :
1316
+ $p = new SyndicatedPost($post, $feed);
1317
+
1318
+ $result[] = array(
1319
+ "post_title" => $p->entry->get_title(),
1320
+ "post_link" => $p->permalink(),
1321
+ "guid" => $p->guid(),
1322
+ "post_date" => $p->published(),
1323
+ );
1324
+ endforeach;
1325
+ endif;
1326
+
1327
+ header("Content-Type: application/json");
1328
+
1329
+ echo json_encode($result);
1330
+
1331
+ // This is an AJAX request, so close it out thus.
1332
+ die;
1333
+ } /* FeedWordPress::fwp_feedcontents () */
1334
+
1335
+ function fwp_xpathtest () {
1336
+ $xpath = MyPHP::request('xpath');
1337
+ $feed_id = MyPHP::request('feed_id');
1338
+ $post_id = MyPHP::request('post_id');
1339
+
1340
+ $expr = new FeedWordPressParsedPostMeta($xpath);
1341
+
1342
+ // Let's load up some data from the feed . . .
1343
+ $feed = $this->subscription($feed_id);
1344
+ $posts = $feed->live_posts();
1345
+
1346
+ if (!is_wp_error($posts)) :
1347
+ if (strlen($post_id) == 0) :
1348
+ $post = $posts[0];
1349
+ else :
1350
+ $post = null;
1351
+
1352
+ foreach ($posts as $p) :
1353
+ if ($p->get_id() == $post_id) :
1354
+ $post = $p;
1355
+ endif;
1356
+ endforeach;
1357
+ endif;
1358
+
1359
+ $post = new SyndicatedPost($post, $feed);
1360
+ $meta = $expr->do_substitutions($post);
1361
+
1362
+ $result = array(
1363
+ "post_title" => $post->entry->get_title(),
1364
+ "post_link" => $post->permalink(),
1365
+ "guid" => $post->guid(),
1366
+ "expression" => $xpath,
1367
+ "results" => $meta
1368
+ );
1369
+ else :
1370
+ $result = array(
1371
+ "expression" => $xpath,
1372
+ "feed_id" => $feed_id,
1373
+ "post_id" => $post_id,
1374
+ "results" => $posts
1375
+ );
1376
+
1377
+ header("HTTP/1.1 503 Bad Gateway");
1378
+ endif;
1379
+
1380
+ header("Content-Type: application/json");
1381
+
1382
+ echo json_encode($result);
1383
+
1384
+ // This is an AJAX request, so close it out thus.
1385
+ die;
1386
+ } /* FeedWordPress::fwp_xpathtest () */
1387
+
1388
  function redirect_retired () {
1389
  global $wp_query;
1390
  if (is_singular()) :
1403
  endif;
1404
  }
1405
 
1406
+ function row_actions ($actions, $post) {
1407
+ if (is_syndicated($post->ID)) :
1408
+ $link = get_delete_post_link($post->ID, '', true);
1409
+ $link = MyPHP::url($link, array("fwp_post_delete" => "nuke"));
1410
+
1411
+ $caption = 'Erase the record of this post (will be re-syndicated if it still appears on the feed).';
1412
+ $linktext = 'Erase/Resyndicate';
1413
+
1414
+ $keys = array_keys($actions);
1415
+ $links = array();
1416
+ foreach ($keys as $key) :
1417
+ $links[$key] = $actions[$key];
1418
+
1419
+ if ('trash'==$key) :
1420
+ $links[$key] = "<a class='submitdelete' title='" . esc_attr( __( 'Move this item to the Trash (will NOT be re-syndicated)' ) ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash/Don&#8217;t Resyndicate' ) . "</a>";
1421
+
1422
+ // Placeholder.
1423
+ $links['delete'] = '';
1424
+ endif;
1425
+ endforeach;
1426
+
1427
+ $links['delete'] = '<a class="submitdelete" title="'.esc_attr(__($caption)).'" href="' . $link . '">' . __($linktext) . '</a>';
1428
+
1429
+ $actions = $links;
1430
+ endif;
1431
+ return $actions;
1432
+ }
1433
+
1434
  function dashboard_setup () {
1435
  $see_it = FeedWordPress::menu_cap();
1436
 
1549
  } /* FeedWordPress::clear_cache_magic_url() */
1550
 
1551
  function clear_cache_requested () {
1552
+ return MyPHP::request('clear_cache');
 
 
 
1553
  } /* FeedWordPress::clear_cache_requested() */
1554
 
1555
  function update_requested () {
2238
  return $path;
2239
  }
2240
 
2241
+ // These are superceded by MyPHP::param/post/get/request, but kept
2242
+ // here for backward compatibility.
2243
  function param ($key, $type = 'REQUEST', $default = NULL) {
2244
+ return MyPHP::param($key, $default, $type);
 
 
 
 
 
 
 
 
 
 
2245
  }
2246
  function post ($key, $default = NULL) {
2247
+ return MyPHP::post($key, $default);
2248
  }
2249
  } // class FeedWordPress
2250
 
feedwordpress_file.class.php CHANGED
@@ -26,7 +26,7 @@ class FeedWordPress_File extends WP_SimplePie_File {
26
  global $wpdb;
27
  global $fwp_credentials;
28
 
29
- if ( preg_match('/^http(s)?:\/\//i', $url) ) {
30
  $args = array( 'timeout' => $this->timeout, 'redirection' => $this->redirects);
31
 
32
  if ( !empty($this->headers) )
@@ -81,13 +81,16 @@ class FeedWordPress_File extends WP_SimplePie_File {
81
  $source->update_setting('link/http status', $this->status_code);
82
  $source->save_settings(/*reload=*/ true);
83
  endif;
84
-
85
- } else {
86
- if ( ! $this->body = file_get_contents($url) ) {
87
- $this->error = 'file_get_contents could not read the file';
88
- $this->success = false;
89
- }
90
- }
 
 
 
91
 
92
  // SimplePie makes a strongly typed check against integers with
93
  // this, but WordPress puts a string in. Which causes caching
26
  global $wpdb;
27
  global $fwp_credentials;
28
 
29
+ if ( preg_match('/^http(s)?:\/\//i', $url) ) :
30
  $args = array( 'timeout' => $this->timeout, 'redirection' => $this->redirects);
31
 
32
  if ( !empty($this->headers) )
81
  $source->update_setting('link/http status', $this->status_code);
82
  $source->save_settings(/*reload=*/ true);
83
  endif;
84
+
85
+ // Do not allow schemes other than http(s)? for the time being.
86
+ // They are unlikely to be used; and unrestricted use of schemes
87
+ // allows for user to use an unrestricted file:/// scheme, which
88
+ // may result in exploits by WordPress users against the web
89
+ // hosting environment.
90
+ else :
91
+ $this->error = 'FeedWordPress only allows http or https URLs';
92
+ $this->success = false;
93
+ endif;
94
 
95
  // SimplePie makes a strongly typed check against integers with
96
  // this, but WordPress puts a string in. Which causes caching
feedwordpresssyndicationpage.class.php CHANGED
@@ -82,8 +82,8 @@ class FeedWordPressSyndicationPage extends FeedWordPressAdminPage {
82
 
83
  $update_set = array();
84
  if ($fwp_update_invoke != 'get') :
85
- if (is_array(FeedWordPress::post('link_ids'))
86
- and (FeedWordPress::post('action')==FWP_UPDATE_CHECKED)) :
87
  $targets = $wpdb->get_results("
88
  SELECT * FROM $wpdb->links
89
  WHERE link_id IN (".implode(",",$_POST['link_ids']).")
@@ -95,8 +95,8 @@ class FeedWordPressSyndicationPage extends FeedWordPressAdminPage {
95
  else : // This should never happen
96
  FeedWordPress::critical_bug('fwp_syndication_manage_page::targets', $targets, __LINE__, __FILE__);
97
  endif;
98
- elseif (!is_null(FeedWordPress::post('update_uri'))) :
99
- $targets = FeedWordPress::post('update_uri');
100
  if (!is_array($targets)) :
101
  $targets = array($targets);
102
  endif;
@@ -351,7 +351,7 @@ class FeedWordPressSyndicationPage extends FeedWordPressAdminPage {
351
  FWP_RESUB_CHECKED => 'multiundelete_page',
352
  );
353
 
354
- $act = FeedWordPress::param('action');
355
  if (isset($dispatcher[$act])) :
356
  $method = $dispatcher[$act];
357
  if (method_exists($this, $method)) :
@@ -1141,14 +1141,14 @@ updated to &lt;<a href="<?php echo esc_html($fwp_post['feed']); ?>"><?php echo e
1141
  endif;
1142
 
1143
  if (isset($existingLink)) :
1144
- $auth = FeedWordPress::post('link_rss_auth_method');
1145
  if (!is_null($auth) and (strlen($auth) > 0) and ($auth != '-')) :
1146
  $existingLink->update_setting('http auth method', $auth);
1147
  $existingLink->update_setting('http username',
1148
- FeedWordPress::post('link_rss_username')
1149
  );
1150
  $existingLink->update_setting('http password',
1151
- FeedWordPress::post('link_rss_password')
1152
  );
1153
  else :
1154
  $existingLink->update_setting('http auth method', NULL);
82
 
83
  $update_set = array();
84
  if ($fwp_update_invoke != 'get') :
85
+ if (is_array(MyPHP::post('link_ids'))
86
+ and (MyPHP::post('action')==FWP_UPDATE_CHECKED)) :
87
  $targets = $wpdb->get_results("
88
  SELECT * FROM $wpdb->links
89
  WHERE link_id IN (".implode(",",$_POST['link_ids']).")
95
  else : // This should never happen
96
  FeedWordPress::critical_bug('fwp_syndication_manage_page::targets', $targets, __LINE__, __FILE__);
97
  endif;
98
+ elseif (!is_null(MyPHP::post('update_uri'))) :
99
+ $targets = MyPHP::post('update_uri');
100
  if (!is_array($targets)) :
101
  $targets = array($targets);
102
  endif;
351
  FWP_RESUB_CHECKED => 'multiundelete_page',
352
  );
353
 
354
+ $act = MyPHP::request('action');
355
  if (isset($dispatcher[$act])) :
356
  $method = $dispatcher[$act];
357
  if (method_exists($this, $method)) :
1141
  endif;
1142
 
1143
  if (isset($existingLink)) :
1144
+ $auth = MyPHP::post('link_rss_auth_method');
1145
  if (!is_null($auth) and (strlen($auth) > 0) and ($auth != '-')) :
1146
  $existingLink->update_setting('http auth method', $auth);
1147
  $existingLink->update_setting('http username',
1148
+ MyPHP::post('link_rss_username')
1149
  );
1150
  $existingLink->update_setting('http password',
1151
+ MyPHP::post('link_rss_password')
1152
  );
1153
  else :
1154
  $existingLink->update_setting('http auth method', NULL);
posts-page.php CHANGED
@@ -418,12 +418,16 @@ class FeedWordPressPostsPage extends FeedWordPressAdminPage {
418
 
419
  <?php
420
  $i = 0;
421
- foreach ($custom_settings as $key => $value) :
 
 
 
422
  ?>
423
  <tr style="vertical-align:top">
424
  <th width="30%" scope="row"><input type="hidden" name="notes[<?php echo $i; ?>][key0]" value="<?php echo esc_html($key); ?>" />
425
  <input id="notes-<?php echo $i; ?>-key" name="notes[<?php echo $i; ?>][key1]" value="<?php echo esc_html($key); ?>" /></th>
426
- <td width="60%"><textarea rows="2" cols="40" id="notes-<?php echo $i; ?>-value" name="notes[<?php echo $i; ?>][value]"><?php echo esc_html($value); ?></textarea></td>
 
427
  <td width="10%"><select name="notes[<?php echo $i; ?>][action]">
428
  <option value="update">save changes</option>
429
  <option value="delete">delete this setting</option>
@@ -437,7 +441,7 @@ class FeedWordPressPostsPage extends FeedWordPressAdminPage {
437
 
438
  <tr style="vertical-align: top">
439
  <th scope="row"><input type="text" size="10" name="notes[<?php echo $i; ?>][key1]" value="" /></th>
440
- <td><textarea name="notes[<?php echo $i; ?>][value]" rows="2" cols="40"></textarea>
441
  <p>Enter a text value, or a path to a data element from the syndicated item.<br/>
442
  For data elements, you can use an XPath-like syntax wrapped in <code>$( ... )</code>.<br/>
443
  <code>hello</code> = the text value <code><span style="background-color: #30FFA0;">hello</span></code><br/>
418
 
419
  <?php
420
  $i = 0;
421
+ $testerButton = '<br/><button id="xpath-test-%d"'
422
+ .'class="xpath-test"'
423
+ .'>test expression</button>';
424
+ foreach ($custom_settings as $key => $value) :
425
  ?>
426
  <tr style="vertical-align:top">
427
  <th width="30%" scope="row"><input type="hidden" name="notes[<?php echo $i; ?>][key0]" value="<?php echo esc_html($key); ?>" />
428
  <input id="notes-<?php echo $i; ?>-key" name="notes[<?php echo $i; ?>][key1]" value="<?php echo esc_html($key); ?>" /></th>
429
+ <td width="60%"><textarea rows="2" cols="40" id="notes-<?php echo $i; ?>-value" name="notes[<?php echo $i; ?>][value]"><?php echo esc_html($value); ?></textarea>
430
+ <?php print sprintf($testerButton, $i); ?></td>
431
  <td width="10%"><select name="notes[<?php echo $i; ?>][action]">
432
  <option value="update">save changes</option>
433
  <option value="delete">delete this setting</option>
441
 
442
  <tr style="vertical-align: top">
443
  <th scope="row"><input type="text" size="10" name="notes[<?php echo $i; ?>][key1]" value="" /></th>
444
+ <td><textarea name="notes[<?php echo $i; ?>][value]" rows="2" cols="40"></textarea><?php print sprintf($testerButton, $i); ?>
445
  <p>Enter a text value, or a path to a data element from the syndicated item.<br/>
446
  For data elements, you can use an XPath-like syntax wrapped in <code>$( ... )</code>.<br/>
447
  <code>hello</code> = the text value <code><span style="background-color: #30FFA0;">hello</span></code><br/>
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Charles Johnson
3
  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.1218
8
 
9
  FeedWordPress syndicates content from feeds you choose into your WordPress weblog.
10
 
@@ -94,6 +94,23 @@ outs, see the documentation at the [FeedWordPress project homepage][].
94
 
95
  == Changelog ==
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  = 2012.1218 =
98
 
99
  * WORDPRESS VISUAL EDITOR FIXED. There was an unlisted change in the
3
  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.1
7
+ Stable tag: 2013.0503
8
 
9
  FeedWordPress syndicates content from feeds you choose into your WordPress weblog.
10
 
94
 
95
  == Changelog ==
96
 
97
+ = 2012.0503 =
98
+
99
+ * BUGFIX: Works properly again with WordPress installations that use a
100
+ MySQL table name prefix other than the default `wp_` prefix.
101
+
102
+ * BUGFIX: Includes a couple of significant PHP 5.4 compatibility fixes.
103
+ Now that PHP 5.4 is more widely deployed, Diagnostics will now also
104
+ show PHP version and some other potentially useful troubleshooting
105
+ information.
106
+
107
+ * ADMIN UI: Better indicates your options when deleting a syndicated post
108
+ so as to let you know whether it will be Trashed (and thus not
109
+ resyndicated) or Erased (and thus potentially resyndicated)
110
+
111
+ * ADMIN UI: Adds an AJAXy Test Expression button to allow live testing of
112
+ sample results from expressions in Custom Post Settings.
113
+
114
  = 2012.1218 =
115
 
116
  * WORDPRESS VISUAL EDITOR FIXED. There was an unlisted change in the
syndicatedlink.class.php CHANGED
@@ -92,12 +92,7 @@ class SyndicatedLink {
92
  return $stale;
93
  } /* SyndicatedLink::stale () */
94
 
95
- function poll ($crash_ts = NULL) {
96
- global $wpdb;
97
-
98
- $url = $this->uri(array('add_params' => true));
99
- FeedWordPress::diagnostic('updated_feeds', 'Polling feed ['.$url.']');
100
-
101
  $timeout = $this->setting('fetch timeout', 'feedwordpress_fetch_timeout', FEEDWORDPRESS_FETCH_TIMEOUT_DEFAULT);
102
 
103
  $this->simplepie = apply_filters(
@@ -112,6 +107,31 @@ class SyndicatedLink {
112
  else :
113
  $this->magpie = new MagpieFromSimplePie($this->simplepie, NULL);
114
  endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
 
116
  $new_count = NULL;
117
 
@@ -230,11 +250,7 @@ class SyndicatedLink {
230
  # -- Add new posts from feed and update any updated posts
231
  $crashed = false;
232
 
233
- $posts = apply_filters(
234
- 'syndicated_feed_items',
235
- $this->simplepie->get_items(),
236
- $this
237
- );
238
 
239
  $this->magpie->originals = $posts;
240
 
92
  return $stale;
93
  } /* SyndicatedLink::stale () */
94
 
95
+ function fetch () {
 
 
 
 
 
96
  $timeout = $this->setting('fetch timeout', 'feedwordpress_fetch_timeout', FEEDWORDPRESS_FETCH_TIMEOUT_DEFAULT);
97
 
98
  $this->simplepie = apply_filters(
107
  else :
108
  $this->magpie = new MagpieFromSimplePie($this->simplepie, NULL);
109
  endif;
110
+ }
111
+ function live_posts () {
112
+ if (!is_object($this->simplepie)) :
113
+ $this->fetch();
114
+ endif;
115
+
116
+ if (is_object($this->simplepie) and method_exists($this->simplepie, 'get_items')) :
117
+ $ret = apply_filters(
118
+ 'syndicated_feed_items',
119
+ $this->simplepie->get_items(),
120
+ $this
121
+ );
122
+ else :
123
+ $ret = $this->simplepie;
124
+ endif;
125
+ return $ret;
126
+ }
127
+
128
+ function poll ($crash_ts = NULL) {
129
+ global $wpdb;
130
+
131
+ $url = $this->uri(array('add_params' => true));
132
+ FeedWordPress::diagnostic('updated_feeds', 'Polling feed ['.$url.']');
133
+
134
+ $this->fetch();
135
 
136
  $new_count = NULL;
137
 
250
  # -- Add new posts from feed and update any updated posts
251
  $crashed = false;
252
 
253
+ $posts = $this->live_posts();
 
 
 
 
254
 
255
  $this->magpie->originals = $posts;
256
 
syndicationdataqueries.class.php CHANGED
@@ -94,7 +94,7 @@ class SyndicationDataQueries {
94
  // checks -- for reasons of both performance and correctness. Pitch:
95
  $search .= " -- '";
96
  elseif ($query->get('fields')=='_synfrom') :
97
- $search .= " AND ({$wpdb->postmeta}.meta_key = '".$query->get('meta_key')."' AND wp_postmeta.meta_value = '".$query->get('meta_value')."') -- '";
98
  endif;
99
  return $search;
100
  } /* SyndicationDataQueries::posts_search () */
94
  // checks -- for reasons of both performance and correctness. Pitch:
95
  $search .= " -- '";
96
  elseif ($query->get('fields')=='_synfrom') :
97
+ $search .= " AND ({$wpdb->postmeta}.meta_key = '".$query->get('meta_key')."' AND {$wpdb->postmeta}.meta_value = '".$query->get('meta_value')."') -- '";
98
  endif;
99
  return $search;
100
  } /* SyndicationDataQueries::posts_search () */