FeedWordPress - Version 2010.0602

Version Description

  • CATEGORY BOX INTERFACE ELEMENT FIXED FOR WP 3.0: Stylesheet changes between WordPress 2.9.x and the WordPress 3.0 RC caused the Categories box under Syndication --> Categories & Tags to malfunction. This has been fixed.

  • LINK CATEGORY SELECTION BOX IN SYNDICATION ==> FEEDS FIXED FOR WP 2.8 AND 2.9: A WP 3.0 compatibility change introduced in 2010.0531 inadvertently broke the Syndicated Link Category selector under Syndication --> Feeds & Updates in WP 2.8 and WP 2.9, causing the post categories to be displayed in the selector rather than the link categories. This should now be fixed so that the selector will work correctly under both the current versions of WordPress and the 3.0 RC.

  • MORE PERMISSIVE HANDLING OF FEEDS WITH BAD CONTENT-TYPE HEADERS: One of the small advantages that MagpieRSS had over SimplePie is that it was more tolerant about parsing well-formed feeds that the remote web server happened to deliver with weird or incorrect HTTP Content-type headers. In feeds affected by this problem, the new SimplePie parser would simply fail to find a feed, due to its being led astray by the contents of the Content-type header. This version includes an extension to SimplePie's content-type sniffer that offers more permissive handling of the HTTP headers.

  • MORE FULL-TEXT "EXCERPTS" NOW PROPERLY SHORTENED. Version 2010.0528 introduced code to control for cases in which elements intended for item summaries are (ill-advisedly) used to carry the full text of posts; past versions of FeedWordPress would simply include the full text of the post in the excerpt field, but newer versions now attempt to detect this condition when it arises and to head it off, by blanking out the excerpt field and filling it with an automatically generated short, plain text excerpt from the full content. This release broadens the test conditions that indicate when an excerpt field is treated as identical to the full text of the post, and should therefore improve the handling of some feeds (such as Google Reader feeds) where the full text of each post was still appearing in the excerpt field.

  • FILTERS: syndicated_item_published AND syndicated_item_updated FILTERS NOW ALLOW FILTER AUTHORS TO CHANGE POST TIMESTAMPS. You can now use the syndicated_item_published and syndicated_item_updated filter hooks to write filters or add-ons which directly change the post date and most-recently-updated timestamps on incoming syndicated posts. Props to niska for pointing out where the filters needed to be applied in order to change WordPress's internal timestamps for incoming posts.

Download this release

Release Info

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

Code changes from version 2010.0531 to 2010.0602

admin-ui.php CHANGED
@@ -123,57 +123,6 @@ class FeedWordPressAdminPage {
123
 
124
  function display_feed_select_dropdown() {
125
  $links = FeedWordPress::syndicated_links();
126
- if (fwp_test_wp_version(FWP_SCHEMA_27)) :
127
- ?>
128
- <style type="text/css">
129
- #post-search {
130
- float: right;
131
- margin:11px 12px 0;
132
- min-width: 130px;
133
- position:relative;
134
- }
135
- .fwpfs {
136
- color: #dddddd !important; background-color: #333 !important;
137
- background:#797979 url(<?php bloginfo('url') ?>/wp-admin/images/fav.png) repeat-x scroll left center;
138
- border-color:#777777 #777777 #666666 !important; -moz-border-radius-bottomleft:12px;
139
- -moz-border-radius-bottomright:12px;
140
- -moz-border-radius-topleft:12px;
141
- -moz-border-radius-topright:12px;
142
- border-style:solid;
143
- border-width:1px;
144
- line-height:15px;
145
- padding:3px 30px 4px 12px;
146
- }
147
- .fwpfs.slide-down {
148
- border-bottom-color: #626262;
149
- -moz-border-radius-bottomleft:0;
150
- -moz-border-radius-bottomright:0;
151
- -moz-border-radius-topleft:12px;
152
- -moz-border-radius-topright:12px;
153
- background-image:url(<?php bloginfo('url') ?>/wp-admin/images/fav-top.png);
154
- background-position:0 top;
155
- background-repeat:repeat-x;
156
- border-bottom-style:solid;
157
- border-bottom-width:1px;
158
- }
159
- </style>
160
-
161
- <script type="text/javascript">
162
- jQuery(document).ready(function($){
163
- $('.fwpfs').toggle(
164
- function(){$('.fwpfs').removeClass('slideUp').addClass('slideDown'); setTimeout(function(){if ( $('.fwpfs').hasClass('slideDown') ) { $('.fwpfs').addClass('slide-down'); }}, 10) },
165
- function(){$('.fwpfs').removeClass('slideDown').addClass('slideUp'); setTimeout(function(){if ( $('.fwpfs').hasClass('slideUp') ) { $('.fwpfs').removeClass('slide-down'); }}, 10) }
166
- );
167
- $('.fwpfs').bind(
168
- 'change',
169
- function () { this.form.submit(); }
170
- );
171
- $('#post-search .button').css( 'display', 'none' );
172
- });
173
- </script>
174
- <?php
175
- endif;
176
-
177
  ?>
178
  <p id="post-search">
179
  <select name="link_id" class="fwpfs" style="max-width: 20.0em;">
@@ -446,60 +395,66 @@ function fwp_tags_box ($tags, $object) {
446
  endif;
447
  }
448
 
449
- function fwp_category_box ($checked, $object, $tags = array()) {
450
  global $wp_db_version;
451
 
452
- if (fwp_test_wp_version(FWP_SCHEMA_25)) : // WordPress 2.5.x
 
 
 
 
 
 
 
 
 
453
  ?>
454
- <div id="category-adder" class="wp-hidden-children">
455
- <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
456
- <p id="category-add" class="wp-hidden-child">
457
- <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" />
458
- <?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
459
- <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" />
460
- <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
461
- <span id="category-ajax-response"></span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
462
  </p>
463
  </div>
464
 
465
- <ul id="category-tabs">
466
- <?php /* ui-tabs-selected in WP 2.7 CSS = tabs in WP 2.8 CSS. Thank you, o brilliant wordsmiths of the WordPress 2.8 stylesheet... */ ?>
467
- <li class="ui-tabs-selected tabs"><a href="#categories-all" tabindex="3"><?php _e( 'All posts' ); ?></a>
468
- <p style="font-size:smaller;font-style:bold;margin:0">Give <?php print $object; ?> these categories</p>
469
- </li>
470
- </ul>
471
-
472
- <?php /* ui-tabs-panel in WP 2.7 CSS = tabs-panel in WP 2.8 CSS. Thank you, o brilliant wordsmiths of the WordPress 2.8 stylesheet... */ ?>
473
- <div id="categories-all" class="ui-tabs-panel tabs-panel">
474
- <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
475
- <?php fwp_category_checklist(NULL, false, $checked) ?>
476
- </ul>
477
  </div>
478
  <?php
479
- elseif (fwp_test_wp_version(FWP_SCHEMA_20)) : // WordPress 2.x
480
- ?>
481
- <div id="moremeta" style="position: relative; right: auto">
482
- <div id="grabit" class="dbx-group">
483
- <fieldset id="categorydiv" class="dbx-box">
484
- <h3 class="dbx-handle"><?php _e('Categories') ?></h3>
485
- <div class="dbx-content">
486
- <p style="font-size:smaller;font-style:bold;margin:0">Place <?php print $object; ?> under...</p>
487
- <p id="jaxcat"></p>
488
- <div id="categorychecklist"><?php fwp_category_checklist(NULL, false, $checked); ?></div>
489
- </div>
490
- </fieldset>
491
- </div>
492
- </div>
493
- <?php
494
- else : // WordPress 1.5
495
- ?>
496
- <fieldset style="width: 60%;">
497
- <legend><?php _e('Categories') ?></legend>
498
- <p style="font-size:smaller;font-style:bold;margin:0">Place <?php print $object; ?> under...</p>
499
- <div style="height: 10em; overflow: scroll;"><?php fwp_category_checklist(NULL, false, $checked); ?></div>
500
- </fieldset>
501
- <?php
502
- endif;
503
  }
504
 
505
  function update_feeds_mention ($feed) {
123
 
124
  function display_feed_select_dropdown() {
125
  $links = FeedWordPress::syndicated_links();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  ?>
127
  <p id="post-search">
128
  <select name="link_id" class="fwpfs" style="max-width: 20.0em;">
395
  endif;
396
  }
397
 
398
+ function fwp_category_box ($checked, $object, $tags = array(), $prefix = '') {
399
  global $wp_db_version;
400
 
401
+ if (strlen($prefix) > 0) :
402
+ $idPrefix = $prefix.'-';
403
+ $idSuffix = "-".$prefix;
404
+ $namePrefix = $prefix . '_';
405
+ else :
406
+ $idPrefix = 'feedwordpress-';
407
+ $idSuffix = "-feedwordpress";
408
+ $namePrefix = 'feedwordpress_';
409
+ endif;
410
+
411
  ?>
412
+ <div id="<?php print $idPrefix; ?>taxonomy-category" class="feedwordpress-category-div">
413
+ <ul id="<?php print $idPrefix; ?>category-tabs" class="category-tabs">
414
+ <li class="ui-tabs-selected tabs"><a href="#<?php print $idPrefix; ?>categories-all" tabindex="3"><?php _e( 'All posts' ); ?></a>
415
+ <p style="font-size:smaller;font-style:bold;margin:0">Give <?php print $object; ?> these categories</p>
416
+ </li>
417
+ </ul>
418
+
419
+ <div id="<?php print $idPrefix; ?>categories-all" class="tabs-panel">
420
+ <ul id="<?php print $idPrefix; ?>categorychecklist" class="list:category categorychecklist form-no-clear">
421
+ <?php fwp_category_checklist(NULL, false, $checked, $prefix) ?>
422
+ </ul>
423
+ </div>
424
+
425
+ <div id="<?php print $idPrefix; ?>category-adder" class="category-adder wp-hidden-children">
426
+ <h4><a id="<?php print $idPrefix; ?>category-add-toggle" class="category-add-toggle" href="#<?php print $idPrefix; ?>category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
427
+ <p id="<?php print $idPrefix; ?>category-add" class="wp-hidden-child">
428
+ <?php
429
+ if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_30)) :
430
+ $newcat = 'newcategory'; // Well, thank God they added "egory" before WP 3.0 came out.
431
+ else :
432
+ $newcat = 'newcat';
433
+ endif;
434
+ ?>
435
+
436
+ <input type="text" name="<?php print $newcat; ?>" id="<?php print $idPrefix; ?>newcategory" class="newcategory form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" />
437
+ <label class="screen-reader-text" for="<?php print $idPrefix; ?>newcategory-parent"><?php _e('Parent Category:'); ?></label>
438
+ <?php wp_dropdown_categories( array(
439
+ 'hide_empty' => 0,
440
+ 'id' => $idPrefix.'newcategory-parent',
441
+ 'class' => 'newcategory-parent',
442
+ 'name' => $newcat.'_parent',
443
+ 'orderby' => 'name',
444
+ 'hierarchical' => 1,
445
+ 'show_option_none' => __('Parent category'),
446
+ 'tab_index' => 3,
447
+ ) ); ?>
448
+ <input type="button" id="<?php print $idPrefix; ?>category-add-sumbit" class="add:<?php print $idPrefix; ?>categorychecklist:category-add add-categorychecklist-category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" />
449
+ <?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 */ ?>
450
+ <input type="hidden" id="_ajax_nonce<?php print esc_html($idSuffix); ?>" name="_ajax_nonce" value="<?php print wp_create_nonce('add-category'); ?>" />
451
+ <input type="hidden" id="_ajax_nonce-add-category<?php print esc_html($idSuffix); ?>" name="_ajax_nonce-add-category" value="<?php print wp_create_nonce('add-category'); ?>" />
452
+ <span id="<?php print $idPrefix; ?>category-ajax-response" class="category-ajax-response"></span>
453
  </p>
454
  </div>
455
 
 
 
 
 
 
 
 
 
 
 
 
 
456
  </div>
457
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
458
  }
459
 
460
  function update_feeds_mention ($feed) {
categories-page.php CHANGED
@@ -109,7 +109,6 @@ function fwp_categories_page () {
109
  FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_categories_settings', /*capability=*/ 'manage_links');
110
 
111
  $link = FeedWordPressAdminPage::submitted_link();
112
- $link_id = $link->id;
113
 
114
  $catsPage = new FeedWordPressCategoriesPage($link);
115
 
@@ -169,6 +168,7 @@ function fwp_categories_page () {
169
  $catsPage->updated = true;
170
 
171
  // Reset, reload
 
172
  unset($link);
173
  $link = new SyndicatedLink($link_id);
174
  else :
109
  FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_categories_settings', /*capability=*/ 'manage_links');
110
 
111
  $link = FeedWordPressAdminPage::submitted_link();
 
112
 
113
  $catsPage = new FeedWordPressCategoriesPage($link);
114
 
168
  $catsPage->updated = true;
169
 
170
  // Reset, reload
171
+ $link_id = $link->id;
172
  unset($link);
173
  $link = new SyndicatedLink($link_id);
174
  else :
compatability.php CHANGED
@@ -237,9 +237,37 @@ if (!function_exists('add_post_meta')) {
237
  } /* add_post_meta() */
238
  } /* if */
239
 
240
- function fwp_category_checklist ($post_id = 0, $descendents_and_self = 0, $selected_cats = false) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  if (function_exists('wp_category_checklist')) :
242
- wp_category_checklist($post_id, $descendents_and_self, $selected_cats);
 
 
 
 
 
 
 
 
243
  else :
244
  // selected_cats is an array of integer cat_IDs / term_ids for
245
  // the categories that should be checked
237
  } /* add_post_meta() */
238
  } /* if */
239
 
240
+ if (!function_exists('disabled')) {
241
+ /**
242
+ * Outputs the html disabled attribute.
243
+ *
244
+ * Compares the first two arguments and if identical marks as disabled
245
+ *
246
+ * @since 3.0.0
247
+ *
248
+ * @param mixed $disabled One of the values to compare
249
+ * @param mixed $current (true) The other value to compare if not just true
250
+ * @param bool $echo Whether to echo or just return the string
251
+ * @return string html attribute or empty string
252
+ */
253
+ function disabled( $disabled, $current = true, $echo = true ) {
254
+ return __checked_selected_helper( $disabled, $current, $echo, 'disabled' );
255
+ }
256
+ } /* if */
257
+
258
+ require_once(dirname(__FILE__).'/feedwordpress-walker-category-checklist.class.php');
259
+
260
+ function fwp_category_checklist ($post_id = 0, $descendents_and_self = 0, $selected_cats = false, $prefix = '') {
261
  if (function_exists('wp_category_checklist')) :
262
+ $walker = new FeedWordPress_Walker_Category_Checklist;
263
+ $walker->set_prefix($prefix);
264
+ wp_category_checklist(
265
+ /*post_id=*/ $post_id,
266
+ /*descendents_and_self=*/ $descendents_and_self,
267
+ /*selected_cats=*/ $selected_cats,
268
+ /*popular_cats=*/ false,
269
+ /*walker=*/ $walker
270
+ );
271
  else :
272
  // selected_cats is an array of integer cat_IDs / term_ids for
273
  // the categories that should be checked
feeds-page.php CHANGED
@@ -342,10 +342,14 @@ contextual_appearance('time-limit', 'time-limit-box', null, 'yes');
342
  else :
343
  $cat_id = FeedWordPress::link_category_id();
344
 
345
- $results = get_categories(array(
346
- "taxonomy" => 'link_category',
347
- "hide_empty" => false,
348
- ));
 
 
 
 
349
 
350
  // Guarantee that the Contributors category will be in the drop-down chooser, even if it is empty.
351
  $found_link_category_id = false;
@@ -539,31 +543,6 @@ contextual_appearance('time-limit', 'time-limit-box', null, 'yes');
539
  $name = "Subscribe to <code>".esc_html(feedwordpress_display_url($lookup))."</code>";
540
  endif;
541
  ?>
542
- <style type="text/css">
543
- form.fieldset {
544
- clear: both;
545
- }
546
- .feed-sample {
547
- float: right;
548
- background-color: #D0D0D0;
549
- color: black;
550
- width: 45%;
551
- font-size: 70%;
552
- border-left: 1px dotted #A0A0A0;
553
- margin-left: 1.0em;
554
- }
555
- .feed-sample p, .feed-sample h3 {
556
- padding-left: 0.5em;
557
- padding-right: 0.5em;
558
- }
559
- .feed-sample .feed-problem {
560
- background-color: #ffd0d0;
561
- border-bottom: 1px dotted black;
562
- padding-bottom: 0.5em;
563
- margin-bottom: 0.5em;
564
- }
565
- </style>
566
-
567
  <div class="wrap">
568
  <h2>Feed Finder: <?php echo $name; ?></h2>
569
 
342
  else :
343
  $cat_id = FeedWordPress::link_category_id();
344
 
345
+ $params = array();
346
+ if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_USES_ARGS_TAXONOMY)) :
347
+ $params['taxonomy'] = 'link_category';
348
+ else :
349
+ $params['type'] = 'link';
350
+ endif;
351
+ $params['hide_empty'] = false;
352
+ $results = get_categories($params);
353
 
354
  // Guarantee that the Contributors category will be in the drop-down chooser, even if it is empty.
355
  $found_link_category_id = false;
543
  $name = "Subscribe to <code>".esc_html(feedwordpress_display_url($lookup))."</code>";
544
  endif;
545
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
546
  <div class="wrap">
547
  <h2>Feed Finder: <?php echo $name; ?></h2>
548
 
feedwordpress-content-type-sniffer.class.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class FeedWordPress_Content_Type_Sniffer extends SimplePie_Content_Type_Sniffer {
3
+ /**
4
+ * Get the Content-Type of the specified file
5
+ *
6
+ * @access public
7
+ * @return string Filtered content type
8
+ */
9
+ function get_type () {
10
+ $contentType = null;
11
+ $charset = null;
12
+ if (isset($this->file->headers['content-type'])) :
13
+ if (!is_array($this->file->headers['content-type'])) :
14
+ $this->file->headers['content-type'] = array($this->file->headers['content-type']);
15
+ endif;
16
+
17
+ foreach ($this->file->headers['content-type'] as $type) :
18
+ $parts = array_map('trim', split(";", $type, 2));
19
+ if (isset($parts[1])) :
20
+ $type = $parts[0];
21
+ $charset = $parts[1];
22
+ endif;
23
+
24
+ if (preg_match(
25
+ '!(application|text)/((atom|rss|rdf)\+)?xml!',
26
+ $type,
27
+ $ref
28
+ )) :
29
+ $contentType = $ref[0];
30
+ endif;
31
+ endforeach;
32
+
33
+ $outHeader = array();
34
+ if (!is_null($contentType)) :
35
+ $outHeader[] = $contentType;
36
+ else :
37
+ $outHeader[] = 'application/xml'; // Generic
38
+ endif;
39
+ if (!is_null($charset)) :
40
+ $outHeader[] = $charset;
41
+ endif;
42
+
43
+ $this->file->headers['content-type'] = implode("; ", $outHeader);
44
+ endif;
45
+ return parent::get_type();
46
+ } /* FeedWordPress_Content_Type_Sniffer::get_type() */
47
+ } /* class FeedWordPress_Content_Type_Sniffer */
48
+
feedwordpress-elements.css ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Category widget */
2
+ .feedwordpress-category-div .tabs-panel {
3
+ height: 200px;
4
+ overflow: auto;
5
+ border: 1px solid #DFDFDF;
6
+ margin-left: 126px;
7
+ }
8
+ .feedwordpress-category-div ul.category-tabs {
9
+ float: left;
10
+ margin: 0 -120px 0 5px;
11
+ padding: 0;
12
+ text-align: right;
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;
21
+ border-width: 1px 0 1px 1px;
22
+ margin-right: -1px;
23
+ padding: 8px;
24
+ background-color: #F1F1F1;
25
+ }
26
+
27
+ .feedwordpress-category-div ul.categorychecklist ul {
28
+ margin-left: 18px;
29
+ }
30
+ .feedwordpress-category-div ul.category-tabs a {
31
+ color: #333333;
32
+ font-weight: bold;
33
+ text-decoration: none;
34
+ }
35
+
36
+ /* Common settings page elements */
37
+ #post-search {
38
+ float: right;
39
+ margin:11px 12px 0;
40
+ min-width: 130px;
41
+ position:relative;
42
+ }
43
+ .fwpfs {
44
+ color: #dddddd !important; background-color: #333 !important;
45
+ background:#797979 url(<?php bloginfo('url') ?>/wp-admin/images/fav.png) repeat-x scroll left center;
46
+ border-color:#777777 #777777 #666666 !important; -moz-border-radius-bottomleft:12px;
47
+ -moz-border-radius-bottomright:12px;
48
+ -moz-border-radius-topleft:12px;
49
+ -moz-border-radius-topright:12px;
50
+ border-style:solid;
51
+ border-width:1px;
52
+ line-height:15px;
53
+ padding:3px 30px 4px 12px;
54
+ }
55
+ .fwpfs.slide-down {
56
+ border-bottom-color: #626262;
57
+ -moz-border-radius-bottomleft:0;
58
+ -moz-border-radius-bottomright:0;
59
+ -moz-border-radius-topleft:12px;
60
+ -moz-border-radius-topright:12px;
61
+ background-image:url(<?php bloginfo('url') ?>/wp-admin/images/fav-top.png);
62
+ background-position:0 top;
63
+ background-repeat:repeat-x;
64
+ border-bottom-style:solid;
65
+ border-bottom-width:1px;
66
+ }
67
+
68
+ /* Switchfeed interface elements */
69
+
70
+ form.fieldset {
71
+ clear: both;
72
+ }
73
+ .feed-sample {
74
+ float: right;
75
+ background-color: #D0D0D0;
76
+ color: black;
77
+ width: 45%;
78
+ font-size: 70%;
79
+ border-left: 1px dotted #A0A0A0;
80
+ margin-left: 1.0em;
81
+ padding: 3px;
82
+ max-height: 200px;
83
+ overflow: auto;
84
+ }
85
+ .feed-sample p, .feed-sample h3 {
86
+ padding-left: 0.5em;
87
+ padding-right: 0.5em;
88
+ }
89
+ .feed-sample .feed-problem {
90
+ background-color: #ffd0d0;
91
+ border-bottom: 1px dotted black;
92
+ padding-bottom: 0.5em;
93
+ margin-bottom: 0.5em;
94
+ }
95
+
feedwordpress-elements.js ADDED
@@ -0,0 +1,446 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($) {
2
+ var fs = {add:'ajaxAdd',del:'ajaxDel',dim:'ajaxDim',process:'process',recolor:'recolor'}, fwpList;
3
+
4
+ fwpList = {
5
+ settings: {
6
+ url: ajaxurl, type: 'POST',
7
+ response: 'ajax-response',
8
+
9
+ what: '',
10
+ alt: 'alternate', altOffset: 0,
11
+ addColor: null, delColor: null, dimAddColor: null, dimDelColor: null,
12
+
13
+ confirm: null,
14
+ addBefore: null, addAfter: null,
15
+ delBefore: null, delAfter: null,
16
+ dimBefore: null, dimAfter: null
17
+ },
18
+
19
+ nonce: function(e,s) {
20
+ var url = wpAjax.unserialize(e.attr('href'));
21
+ return s.nonce || url._ajax_nonce || $('#' + s.elementbox + ' input[name=_ajax_nonce]').val() || url._wpnonce || $('#' + s.element + ' input[name=_wpnonce]').val() || 0;
22
+ },
23
+
24
+ parseClass: function(e,t) {
25
+ var c = [], cl;
26
+ try {
27
+ cl = $(e).attr('class') || '';
28
+ cl = cl.match(new RegExp(t+':[\\S]+'));
29
+ if ( cl ) { c = cl[0].split(':'); }
30
+ } catch(r) {}
31
+ return c;
32
+ },
33
+
34
+ pre: function(e,s,a) {
35
+ var bg, r;
36
+ s = $.extend( {}, this.fwpList.settings, {
37
+ element: null,
38
+ nonce: 0,
39
+ target: e.get(0)
40
+ }, s || {} );
41
+ if ( $.isFunction( s.confirm ) ) {
42
+ if ( 'add' != a ) {
43
+ bg = $('#' + s.element).css('backgroundColor');
44
+ $('#' + s.element).css('backgroundColor', '#FF9966');
45
+ }
46
+ r = s.confirm.call(this,e,s,a,bg);
47
+ if ( 'add' != a ) { $('#' + s.element).css('backgroundColor', bg ); }
48
+ if ( !r ) { return false; }
49
+ }
50
+ return s;
51
+ },
52
+
53
+ ajaxAdd: function( e, s ) {
54
+ e = $(e);
55
+ s = s || {};
56
+ var list = this, cls = fwpList.parseClass(e,'add'), es, valid, formData;
57
+ s = fwpList.pre.call( list, e, s, 'add' );
58
+
59
+ s.element = cls[2] || e.attr( 'id' ) || s.element || null;
60
+ if ( cls[3] ) { s.addColor = '#' + cls[3]; }
61
+ else { s.addColor = s.addColor || '#FFFF33'; }
62
+
63
+ if ( !s ) { return false; }
64
+
65
+ if ( !e.is("[class^=add:" + list.id + ":]") ) { return !fwpList.add.call( list, e, s ); }
66
+
67
+ if ( !s.element ) { return true; }
68
+
69
+ s.action = 'add-' + s.what;
70
+
71
+ s.nonce = fwpList.nonce(e,s);
72
+
73
+ es = $('#' + s.elementbox + ' :input').not('[name=_ajax_nonce], [name=_wpnonce], [name=action]');
74
+ valid = wpAjax.validateForm( '#' + s.element );
75
+ if ( !valid ) { return false; }
76
+
77
+ s.data = $.param( $.extend( { _ajax_nonce: s.nonce, action: s.action }, wpAjax.unserialize( cls[4] || '' ) ) );
78
+ formData = $.isFunction(es.fieldSerialize) ? es.fieldSerialize() : es.serialize();
79
+ if ( formData ) { s.data += '&' + formData; }
80
+
81
+ if ( $.isFunction(s.addBefore) ) {
82
+ s = s.addBefore( s );
83
+ if ( !s ) { return true; }
84
+ }
85
+ if ( !s.data.match(/_ajax_nonce=[a-f0-9]+/) ) { return true; }
86
+
87
+ s.success = function(r) {
88
+ var res = wpAjax.parseAjaxResponse(r, s.response, s.element), o;
89
+ if ( !res || res.errors ) { return false; }
90
+
91
+ if ( true === res ) { return true; }
92
+
93
+ jQuery.each( res.responses, function() {
94
+ fwpList.add.call( list, this.data, $.extend( {}, s, { // this.firstChild.nodevalue
95
+ pos: this.position || 0,
96
+ id: this.id || 0,
97
+ oldId: this.oldId || null
98
+ } ) );
99
+ } );
100
+
101
+ if ( $.isFunction(s.addAfter) ) {
102
+ o = this.complete;
103
+ this.complete = function(x,st) {
104
+ var _s = $.extend( { xml: x, status: st, parsed: res }, s );
105
+ s.addAfter( r, _s );
106
+ if ( $.isFunction(o) ) { o(x,st); }
107
+ };
108
+ }
109
+ list.fwpList.recolor();
110
+ $(list).trigger( 'fwpListAddEnd', [ s, list.fwpList ] );
111
+ fwpList.clear.call(list,'#' + s.element);
112
+ };
113
+
114
+ $.ajax( s );
115
+ return false;
116
+ },
117
+
118
+ ajaxDel: function( e, s ) {
119
+ e = $(e); s = s || {};
120
+ var list = this, cls = fwpList.parseClass(e,'delete'), element;
121
+ s = fwpList.pre.call( list, e, s, 'delete' );
122
+
123
+ s.element = cls[2] || s.element || null;
124
+ if ( cls[3] ) { s.delColor = '#' + cls[3]; }
125
+ else { s.delColor = s.delColor || '#faa'; }
126
+
127
+ if ( !s || !s.element ) { return false; }
128
+
129
+ s.action = 'delete-' + s.what;
130
+
131
+ s.nonce = fwpList.nonce(e,s);
132
+
133
+ s.data = $.extend(
134
+ { action: s.action, id: s.element.split('-').pop(), _ajax_nonce: s.nonce },
135
+ wpAjax.unserialize( cls[4] || '' )
136
+ );
137
+
138
+ if ( $.isFunction(s.delBefore) ) {
139
+ s = s.delBefore( s, list );
140
+ if ( !s ) { return true; }
141
+ }
142
+ if ( !s.data._ajax_nonce ) { return true; }
143
+
144
+ element = $('#' + s.element);
145
+
146
+ if ( 'none' != s.delColor ) {
147
+ element.css( 'backgroundColor', s.delColor ).fadeOut( 350, function(){
148
+ list.fwpList.recolor();
149
+ $(list).trigger( 'fwpListDelEnd', [ s, list.fwpList ] );
150
+ });
151
+ } else {
152
+ list.fwpList.recolor();
153
+ $(list).trigger( 'fwpListDelEnd', [ s, list.fwpList ] );
154
+ }
155
+
156
+ s.success = function(r) {
157
+ var res = wpAjax.parseAjaxResponse(r, s.response, s.element), o;
158
+ if ( !res || res.errors ) {
159
+ element.stop().stop().css( 'backgroundColor', '#faa' ).show().queue( function() { list.fwpList.recolor(); $(this).dequeue(); } );
160
+ return false;
161
+ }
162
+ if ( $.isFunction(s.delAfter) ) {
163
+ o = this.complete;
164
+ this.complete = function(x,st) {
165
+ element.queue( function() {
166
+ var _s = $.extend( { xml: x, status: st, parsed: res }, s );
167
+ s.delAfter( r, _s );
168
+ if ( $.isFunction(o) ) { o(x,st); }
169
+ } ).dequeue();
170
+ };
171
+ }
172
+ };
173
+ $.ajax( s );
174
+ return false;
175
+ },
176
+
177
+ ajaxDim: function( e, s ) {
178
+ if ( $(e).parent().css('display') == 'none' ) // Prevent hidden links from being clicked by hotkeys
179
+ return false;
180
+ e = $(e); s = s || {};
181
+ var list = this, cls = fwpList.parseClass(e,'dim'), element, isClass, color, dimColor;
182
+ s = fwpList.pre.call( list, e, s, 'dim' );
183
+
184
+ s.element = cls[2] || s.element || null;
185
+ s.dimClass = cls[3] || s.dimClass || null;
186
+ if ( cls[4] ) { s.dimAddColor = '#' + cls[4]; }
187
+ else { s.dimAddColor = s.dimAddColor || '#FFFF33'; }
188
+ if ( cls[5] ) { s.dimDelColor = '#' + cls[5]; }
189
+ else { s.dimDelColor = s.dimDelColor || '#FF3333'; }
190
+
191
+ if ( !s || !s.element || !s.dimClass ) { return true; }
192
+
193
+ s.action = 'dim-' + s.what;
194
+
195
+ s.nonce = fwpList.nonce(e,s);
196
+
197
+ s.data = $.extend(
198
+ { action: s.action, id: s.element.split('-').pop(), dimClass: s.dimClass, _ajax_nonce : s.nonce },
199
+ wpAjax.unserialize( cls[6] || '' )
200
+ );
201
+
202
+ if ( $.isFunction(s.dimBefore) ) {
203
+ s = s.dimBefore( s );
204
+ if ( !s ) { return true; }
205
+ }
206
+
207
+ element = $('#' + s.element);
208
+ isClass = element.toggleClass(s.dimClass).is('.' + s.dimClass);
209
+ color = fwpList.getColor( element );
210
+ element.toggleClass( s.dimClass )
211
+ dimColor = isClass ? s.dimAddColor : s.dimDelColor;
212
+ if ( 'none' != dimColor ) {
213
+ element
214
+ .animate( { backgroundColor: dimColor }, 'fast' )
215
+ .queue( function() { element.toggleClass(s.dimClass); $(this).dequeue(); } )
216
+ .animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); $(list).trigger( 'fwpListDimEnd', [ s, list.fwpList ] ); } } );
217
+ } else {
218
+ $(list).trigger( 'fwpListDimEnd', [ s, list.fwpList ] );
219
+ }
220
+
221
+ if ( !s.data._ajax_nonce ) { return true; }
222
+
223
+ s.success = function(r) {
224
+ var res = wpAjax.parseAjaxResponse(r, s.response, s.element), o;
225
+ if ( !res || res.errors ) {
226
+ element.stop().stop().css( 'backgroundColor', '#FF3333' )[isClass?'removeClass':'addClass'](s.dimClass).show().queue( function() { list.fwpList.recolor(); $(this).dequeue(); } );
227
+ return false;
228
+ }
229
+ if ( $.isFunction(s.dimAfter) ) {
230
+ o = this.complete;
231
+ this.complete = function(x,st) {
232
+ element.queue( function() {
233
+ var _s = $.extend( { xml: x, status: st, parsed: res }, s );
234
+ s.dimAfter( r, _s );
235
+ if ( $.isFunction(o) ) { o(x,st); }
236
+ } ).dequeue();
237
+ };
238
+ }
239
+ };
240
+
241
+ $.ajax( s );
242
+ return false;
243
+ },
244
+
245
+ // From jquery.color.js: jQuery Color Animation by John Resig
246
+ getColor: function( el ) {
247
+ if ( el.constructor == Object )
248
+ el = el.get(0);
249
+ var elem = el, color, rgbaTrans = new RegExp( "rgba\\(\\s*0,\\s*0,\\s*0,\\s*0\\s*\\)", "i" );
250
+ do {
251
+ color = jQuery.curCSS(elem, 'backgroundColor');
252
+ if ( color != '' && color != 'transparent' && !color.match(rgbaTrans) || jQuery.nodeName(elem, "body") )
253
+ break;
254
+ } while ( elem = elem.parentNode );
255
+ return color || '#ffffff';
256
+ },
257
+
258
+ add: function( e, s ) {
259
+ e = $(e);
260
+
261
+ var list = $(this),
262
+ old = false,
263
+ _s = { pos: 0, id: 0, oldId: null },
264
+ ba, ref, color;
265
+
266
+ if ( 'string' == typeof s ) {
267
+ s = { what: s };
268
+ }
269
+
270
+ s = $.extend(_s, this.fwpList.settings, s);
271
+ if ( !e.size() || !s.what ) { return false; }
272
+ if ( s.oldId ) { old = $('#' + s.what + '-' + s.oldId); }
273
+ if ( s.id && ( s.id != s.oldId || !old || !old.size() ) ) { $('#' + s.what + '-' + s.id).remove(); }
274
+
275
+ if ( old && old.size() ) {
276
+ old.before(e);
277
+ old.remove();
278
+ } else if ( isNaN(s.pos) ) {
279
+ ba = 'after';
280
+ if ( '-' == s.pos.substr(0,1) ) {
281
+ s.pos = s.pos.substr(1);
282
+ ba = 'before';
283
+ }
284
+ ref = list.find( '#' + s.pos );
285
+ if ( 1 === ref.size() ) { ref[ba](e); }
286
+ else { list.append(e); }
287
+ } else if ( s.pos < 0 ) {
288
+ list.prepend(e);
289
+ } else {
290
+ list.append(e);
291
+ }
292
+
293
+ if ( s.alt ) {
294
+ if ( ( list.children(':visible').index( e[0] ) + s.altOffset ) % 2 ) { e.removeClass( s.alt ); }
295
+ else { e.addClass( s.alt ); }
296
+ }
297
+
298
+ if ( 'none' != s.addColor ) {
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
+ },
305
+
306
+ clear: function(e) {
307
+ var list = this, t, tag;
308
+ e = $(e);
309
+ if ( list.fwpList && e.parents( '#' + list.id ).size() ) { return; }
310
+ e.find(':input').each( function() {
311
+ if ( $(this).parents('.form-no-clear').size() )
312
+ return;
313
+ t = this.type.toLowerCase();
314
+ tag = this.tagName.toLowerCase();
315
+ if ( 'text' == t || 'password' == t || 'textarea' == tag ) { this.value = ''; }
316
+ else if ( 'checkbox' == t || 'radio' == t ) { this.checked = false; }
317
+ else if ( 'select' == tag ) { this.selectedIndex = null; }
318
+ });
319
+ },
320
+
321
+ process: function(el) {
322
+ var list = this;
323
+
324
+ $("[class^=add:" + list.id + ":]", el || null)
325
+ .filter('form').submit( function() { return list.fwpList.add(this); } ).end()
326
+ .not('form').click( function() { return list.fwpList.add(this); } );
327
+ $("[class^=delete:" + list.id + ":]", el || null).click( function() { return list.fwpList.del(this); } );
328
+ $("[class^=dim:" + list.id + ":]", el || null).click( function() { return list.fwpList.dim(this); } );
329
+ },
330
+
331
+ recolor: function() {
332
+ var list = this, items, eo;
333
+ if ( !list.fwpList.settings.alt ) { return; }
334
+ items = $('.list-item:visible', list);
335
+ if ( !items.size() ) { items = $(list).children(':visible'); }
336
+ eo = [':even',':odd'];
337
+ if ( list.fwpList.settings.altOffset % 2 ) { eo.reverse(); }
338
+ items.filter(eo[0]).addClass(list.fwpList.settings.alt).end().filter(eo[1]).removeClass(list.fwpList.settings.alt);
339
+ },
340
+
341
+ init: function() {
342
+ var lists = this;
343
+
344
+ lists.fwpList.process = function(a) {
345
+ lists.each( function() {
346
+ this.fwpList.process(a);
347
+ } );
348
+ };
349
+ lists.fwpList.recolor = function() {
350
+ lists.each( function() {
351
+ this.fwpList.recolor();
352
+ } );
353
+ };
354
+ }
355
+ };
356
+
357
+ $.fn.fwpList = function( settings ) {
358
+ this.each( function() {
359
+ var _this = this;
360
+ this.fwpList = { settings: $.extend( {}, fwpList.settings, { what: fwpList.parseClass(this,'list')[1] || '' }, settings ) };
361
+ $.each( fs, function(i,f) { _this.fwpList[i] = function( e, s ) { return fwpList[f].call( _this, e, s ); }; } );
362
+ } );
363
+ fwpList.init.call(this);
364
+ this.fwpList.process();
365
+ return this;
366
+ };
367
+
368
+ })(jQuery);
369
+
370
+ jQuery(document).ready( function($) {
371
+ // Category boxes
372
+ $('.feedwordpress-category-div').each( function () {
373
+ var this_id = $(this).attr('id');
374
+ var catAddBefore, catAddAfter;
375
+ var taxonomyParts, taxonomy, settingName;
376
+
377
+ taxonomyParts = this_id.split('-');
378
+ taxonomyParts.shift(); taxonomyParts.shift();
379
+ taxonomy = taxonomyParts.join('-');
380
+
381
+ settingName = taxonomy + '_tab';
382
+ if ( taxonomy == 'category' )
383
+ settingName = 'cats';
384
+
385
+ // No need to worry about tab stuff for our purposes
386
+
387
+ // Ajax Cat
388
+ var containerId = $(this).attr('id');
389
+ var checkboxId = $(this).find('.categorychecklist').attr('id');
390
+ var newCatId = $(this).find('.newcategory').attr('id');
391
+ var responseId = $(this).find('.'+taxonomy+'-ajax-response').attr('id');
392
+ var taxAdderId = $(this).find('.'+taxonomy+'-adder').attr('id');
393
+
394
+ $(this).find('.newcategory').one( 'focus', function () { $(this).val('').removeClass('form-input-tip'); } );
395
+ $(this).find('.add-categorychecklist-category-add').click( function() {
396
+ $(this).parent().children('.newcategory').focus();
397
+ } );
398
+
399
+ catAddBefore = function (s) {
400
+ if ( !$('#'+newCatId).val() )
401
+ return false;
402
+ s.data += '&' + $( ':checked', '#'+checkboxId ).serialize();
403
+ return s;
404
+ }
405
+ catAddAfter = function (r, s) {
406
+ // Clear out input box
407
+ $('.newcategory', '#'+this_id).val('');
408
+
409
+ // Clear out parent dropbox
410
+ var sup, drop = $('.newcategory-parent', '#'+this_id);
411
+
412
+ if ( 'undefined' != s.parsed.responses[0] && (sup = s.parsed.responses[0].supplemental.newcat_parent) ) {
413
+ drop.before(sup);
414
+ drop.remove();
415
+ }
416
+ };
417
+
418
+ $('#' + checkboxId).fwpList({
419
+ alt: '',
420
+ elementbox: taxAdderId,
421
+ response: responseId,
422
+ addBefore: catAddBefore,
423
+ addAfter: catAddAfter
424
+ });
425
+
426
+ $(this).find('.category-add-toggle').click( function () {
427
+ $('#' + taxAdderId).toggleClass('wp-hidden-children');
428
+ $('#' + newCatId).focus();
429
+ return false;
430
+ } ); /* $(this).find('.category-add-toggle').click() */
431
+
432
+ } ); /* $('.feedwordpress-category-div').each() */
433
+ } ); /* jQuery(document).ready() */
434
+
435
+ jQuery(document).ready(function($){
436
+ $('.fwpfs').toggle(
437
+ function(){$('.fwpfs').removeClass('slideUp').addClass('slideDown'); setTimeout(function(){if ( $('.fwpfs').hasClass('slideDown') ) { $('.fwpfs').addClass('slide-down'); }}, 10) },
438
+ function(){$('.fwpfs').removeClass('slideDown').addClass('slideUp'); setTimeout(function(){if ( $('.fwpfs').hasClass('slideUp') ) { $('.fwpfs').removeClass('slide-down'); }}, 10) }
439
+ );
440
+ $('.fwpfs').bind(
441
+ 'change',
442
+ function () { this.form.submit(); }
443
+ );
444
+ $('#post-search .button').css( 'display', 'none' );
445
+ });
446
+
feedwordpress-walker-category-checklist.class.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FeedWordPress_Walker_Category_Checklist
4
+ *
5
+ * @version 2010.0531
6
+ *
7
+ * This is the fucking stupidest thing ever.
8
+ */
9
+
10
+ require_once(ABSPATH.'/wp-admin/includes/template.php');
11
+ // Fucking fuck.
12
+
13
+ class FeedWordPress_Walker_Category_Checklist extends Walker_Category_Checklist {
14
+ var $prefix = '';
15
+ function set_prefix ($prefix) {
16
+ $this->prefix = $prefix;
17
+ }
18
+
19
+ function start_el (&$output, $category, $depth, $args) {
20
+ extract($args);
21
+ if ( empty($taxonomy) ) :
22
+ $taxonomy = 'category';
23
+ endif;
24
+
25
+ if ( $taxonomy == 'category' ) :
26
+ $name = 'post_category';
27
+ else :
28
+ $name = 'tax_input['.$taxonomy.']';
29
+ endif;
30
+
31
+ $unit = array();
32
+ if (strlen($this->prefix) > 0) :
33
+ $unit[] = $this->prefix;
34
+ endif;
35
+ $unit[] = $taxonomy;
36
+ $unit[] = $category->term_id;
37
+ $unitId = implode("-", $unit);
38
+
39
+ $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category category-checkbox"' : ' class="category-checkbox"';
40
+ $output .= "\n<li id='{$unitId}'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$unitId. '"' . checked( in_array( $category->term_id, $selected_cats ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
41
+ } /* FeedWordPress_Walker_Category_Checklist::start_el() */
42
+ } /* FeedWordPress_Walker_Category_Checklist */
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: 2010.0531
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 2010.0531
15
  */
16
 
17
  # This uses code derived from:
@@ -33,7 +33,7 @@ License: GPL
33
 
34
  # -- Don't change these unless you know what you're doing...
35
 
36
- define ('FEEDWORDPRESS_VERSION', '2010.0531');
37
  define ('FEEDWORDPRESS_AUTHOR_CONTACT', 'http://radgeek.com/contact');
38
 
39
  // Defaults
@@ -58,6 +58,7 @@ define ('FEEDVALIDATOR_URI', 'http://feedvalidator.org/check.cgi');
58
  define ('FEEDWORDPRESS_FRESHNESS_INTERVAL', 10*60); // Every ten minutes
59
 
60
  define ('FWP_SCHEMA_HAS_USERMETA', 2966);
 
61
  define ('FWP_SCHEMA_20', 3308); // Database schema # for WP 2.0
62
  define ('FWP_SCHEMA_21', 4772); // Database schema # for WP 2.1
63
  define ('FWP_SCHEMA_23', 5495); // Database schema # for WP 2.3
@@ -66,6 +67,7 @@ define ('FWP_SCHEMA_26', 8201); // Database schema # for WP 2.6
66
  define ('FWP_SCHEMA_27', 9872); // Database schema # for WP 2.7
67
  define ('FWP_SCHEMA_28', 11548); // Database schema # for WP 2.8
68
  define ('FWP_SCHEMA_29', 12329); // Database schema # for WP 2.9
 
69
 
70
  if (FEEDWORDPRESS_DEBUG) :
71
  // Help us to pick out errors, if any.
@@ -107,8 +109,10 @@ if (isset($wp_db_version)) :
107
  endif;
108
  endif;
109
 
 
110
  require_once(dirname(__FILE__) . '/compatability.php'); // LEGACY API: Replicate or mock up functions for legacy support purposes
111
  require_once(dirname(__FILE__) . '/feedwordpresshtml.class.php');
 
112
 
113
  // Magic quotes are just about the stupidest thing ever.
114
  if (is_array($_POST)) :
@@ -129,29 +133,28 @@ else : // Something went wrong. Let's just guess.
129
  endif;
130
 
131
  function feedwordpress_admin_scripts () {
 
 
132
  wp_enqueue_script('post'); // for magic tag and category boxes
 
 
 
133
  wp_enqueue_script('admin-forms'); // for checkbox selection
 
 
 
134
  }
135
 
136
  // If this is a FeedWordPress admin page, queue up scripts for AJAX functions that FWP uses
137
  // If it is a display page or a non-FeedWordPress admin page, don't.
138
  if (is_admin() and isset($_REQUEST['page']) and preg_match("|^{$fwp_path}/|", $_REQUEST['page'])) :
139
- if (function_exists('wp_enqueue_script')) :
140
- if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_29)) :
141
- add_action('admin_print_scripts', 'feedwordpress_admin_scripts');
142
- elseif (FeedWordPressCompatibility::test_version(FWP_SCHEMA_25)) :
143
- wp_enqueue_script('post'); // for magic tag and category boxes
144
- wp_enqueue_script('thickbox'); // for fold-up boxes
145
- wp_enqueue_script('admin-forms'); // for checkbox selection
146
- else :
147
- wp_enqueue_script( 'ajaxcat' ); // Provides the handy-dandy new category text box
148
- endif;
149
- endif;
150
- if (function_exists('wp_enqueue_style')) :
151
- if (fwp_test_wp_version(FWP_SCHEMA_25)) :
152
- wp_enqueue_style('dashboard');
153
- endif;
154
- endif;
155
  if (function_exists('wp_admin_css')) :
156
  if (fwp_test_wp_version(FWP_SCHEMA_25)) :
157
  wp_admin_css('css/dashboard');
@@ -1377,11 +1380,11 @@ class FeedWordPress {
1377
  }
1378
 
1379
  /*static*/ function fetch ($url) {
1380
- require_once (ABSPATH . WPINC . '/class-feed.php');
1381
  $feed = new SimplePie();
1382
  $feed->set_feed_url($url);
1383
  $feed->set_cache_class('WP_Feed_Cache');
1384
  $feed->set_file_class('WP_SimplePie_File');
 
1385
  $feed->set_cache_duration(FeedWordPress::cache_duration());
1386
  $feed->init();
1387
  $feed->handle_content_type();
3
  Plugin Name: FeedWordPress
4
  Plugin URI: http://feedwordpress.radgeek.com/
5
  Description: simple and flexible Atom/RSS syndication for WordPress
6
+ Version: 2010.0602
7
  Author: Charles Johnson
8
  Author URI: http://radgeek.com/
9
  License: GPL
11
 
12
  /**
13
  * @package FeedWordPress
14
+ * @version 2010.0602
15
  */
16
 
17
  # This uses code derived from:
33
 
34
  # -- Don't change these unless you know what you're doing...
35
 
36
+ define ('FEEDWORDPRESS_VERSION', '2010.0602');
37
  define ('FEEDWORDPRESS_AUTHOR_CONTACT', 'http://radgeek.com/contact');
38
 
39
  // Defaults
58
  define ('FEEDWORDPRESS_FRESHNESS_INTERVAL', 10*60); // Every ten minutes
59
 
60
  define ('FWP_SCHEMA_HAS_USERMETA', 2966);
61
+ define ('FWP_SCHEMA_USES_ARGS_TAXONOMY', 12694); // Revision # for using $args['taxonomy'] to get link categories
62
  define ('FWP_SCHEMA_20', 3308); // Database schema # for WP 2.0
63
  define ('FWP_SCHEMA_21', 4772); // Database schema # for WP 2.1
64
  define ('FWP_SCHEMA_23', 5495); // Database schema # for WP 2.3
67
  define ('FWP_SCHEMA_27', 9872); // Database schema # for WP 2.7
68
  define ('FWP_SCHEMA_28', 11548); // Database schema # for WP 2.8
69
  define ('FWP_SCHEMA_29', 12329); // Database schema # for WP 2.9
70
+ define ('FWP_SCHEMA_30', 12694); // Database schema # for WP 3.0
71
 
72
  if (FEEDWORDPRESS_DEBUG) :
73
  // Help us to pick out errors, if any.
109
  endif;
110
  endif;
111
 
112
+ require_once (ABSPATH . WPINC . '/class-feed.php');
113
  require_once(dirname(__FILE__) . '/compatability.php'); // LEGACY API: Replicate or mock up functions for legacy support purposes
114
  require_once(dirname(__FILE__) . '/feedwordpresshtml.class.php');
115
+ require_once(dirname(__FILE__) . '/feedwordpress-content-type-sniffer.class.php');
116
 
117
  // Magic quotes are just about the stupidest thing ever.
118
  if (is_array($_POST)) :
133
  endif;
134
 
135
  function feedwordpress_admin_scripts () {
136
+ global $fwp_path;
137
+
138
  wp_enqueue_script('post'); // for magic tag and category boxes
139
+ if (!FeedWordPressCompatibility::test_version(FWP_SCHEMA_29)) : // < 2.9
140
+ wp_enqueue_script('thickbox'); // for fold-up boxes
141
+ endif;
142
  wp_enqueue_script('admin-forms'); // for checkbox selection
143
+
144
+ wp_register_script('feedwordpress-elements', WP_PLUGIN_URL.'/'.$fwp_path.'/feedwordpress-elements.js');
145
+ wp_enqueue_script('feedwordpress-elements');
146
  }
147
 
148
  // If this is a FeedWordPress admin page, queue up scripts for AJAX functions that FWP uses
149
  // If it is a display page or a non-FeedWordPress admin page, don't.
150
  if (is_admin() and isset($_REQUEST['page']) and preg_match("|^{$fwp_path}/|", $_REQUEST['page'])) :
151
+ add_action('admin_print_scripts', 'feedwordpress_admin_scripts');
152
+
153
+ wp_register_style('feedwordpress-elements', WP_PLUGIN_URL.'/'.$fwp_path.'/feedwordpress-elements.css');
154
+
155
+ wp_enqueue_style('dashboard');
156
+ wp_enqueue_style('feedwordpress-elements');
157
+
 
 
 
 
 
 
 
 
 
158
  if (function_exists('wp_admin_css')) :
159
  if (fwp_test_wp_version(FWP_SCHEMA_25)) :
160
  wp_admin_css('css/dashboard');
1380
  }
1381
 
1382
  /*static*/ function fetch ($url) {
 
1383
  $feed = new SimplePie();
1384
  $feed->set_feed_url($url);
1385
  $feed->set_cache_class('WP_Feed_Cache');
1386
  $feed->set_file_class('WP_SimplePie_File');
1387
+ $feed->set_content_type_sniffer_class('FeedWordPress_Content_Type_Sniffer');
1388
  $feed->set_cache_duration(FeedWordPress::cache_duration());
1389
  $feed->init();
1390
  $feed->handle_content_type();
magpiefromsimplepie.class.php CHANGED
@@ -50,6 +50,8 @@ class MagpieFromSimplePie {
50
  'http://www.itunes.com/dtds/podcast-1.0.dtd' => 'itunes',
51
  'http://a9.com/-/spec/opensearchrss/1.0/' => 'openSearch',
52
  'http://purl.org/rss/1.0/modules/slash/' => 'slash',
 
 
53
  );
54
 
55
  /**
50
  'http://www.itunes.com/dtds/podcast-1.0.dtd' => 'itunes',
51
  'http://a9.com/-/spec/opensearchrss/1.0/' => 'openSearch',
52
  'http://purl.org/rss/1.0/modules/slash/' => 'slash',
53
+ 'http://www.google.com/schemas/reader/atom/' => 'gr',
54
+ 'urn:atom-extension:indexing' => 'indexing',
55
  );
56
 
57
  /**
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://feedwordpress.radgeek.com/
4
  Tags: syndication, aggregation, feed, atom, rss
5
  Requires at least: 2.8
6
  Tested up to: 3.0
7
- Stable tag: 2010.0531
8
 
9
  FeedWordPress syndicates content from feeds you choose into your WordPress weblog.
10
 
@@ -93,6 +93,52 @@ outs, see the documentation at the [FeedWordPress project homepage][].
93
 
94
  == Changelog ==
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  = 2010.0531 =
97
 
98
  * PERMALINK / CUSTOM FIELDS PROBLEM RESOLVED: An issue in 2010.0528 caused
4
  Tags: syndication, aggregation, feed, atom, rss
5
  Requires at least: 2.8
6
  Tested up to: 3.0
7
+ Stable tag: 2010.0602
8
 
9
  FeedWordPress syndicates content from feeds you choose into your WordPress weblog.
10
 
93
 
94
  == Changelog ==
95
 
96
+ = 2010.0602 =
97
+
98
+ * CATEGORY BOX INTERFACE ELEMENT FIXED FOR WP 3.0: Stylesheet changes
99
+ between WordPress 2.9.x and the WordPress 3.0 RC caused the Categories
100
+ box under **Syndication --> Categories & Tags** to malfunction. This
101
+ has been fixed.
102
+
103
+ * LINK CATEGORY SELECTION BOX IN SYNDICATION ==> FEEDS FIXED FOR WP 2.8
104
+ AND 2.9: A WP 3.0 compatibility change introduced in 2010.0531
105
+ inadvertently broke the Syndicated Link Category selector under
106
+ Syndication --> Feeds & Updates in WP 2.8 and WP 2.9, causing the post
107
+ categories to be displayed in the selector rather than the link
108
+ categories. This should now be fixed so that the selector will work
109
+ correctly under both the current versions of WordPress and the 3.0 RC.
110
+
111
+ * MORE PERMISSIVE HANDLING OF FEEDS WITH BAD CONTENT-TYPE HEADERS: One of
112
+ the small advantages that MagpieRSS had over SimplePie is that it was
113
+ more tolerant about parsing well-formed feeds that the remote web server
114
+ happened to deliver with weird or incorrect HTTP Content-type headers.
115
+ In feeds affected by this problem, the new SimplePie parser would simply
116
+ fail to find a feed, due to its being led astray by the contents of the
117
+ Content-type header. This version includes an extension to SimplePie's
118
+ content-type sniffer that offers more permissive handling of the HTTP
119
+ headers.
120
+
121
+ * MORE FULL-TEXT "EXCERPTS" NOW PROPERLY SHORTENED. Version 2010.0528
122
+ introduced code to control for cases in which elements intended for
123
+ item summaries are (ill-advisedly) used to carry the full text of posts;
124
+ past versions of FeedWordPress would simply include the full text of the
125
+ post in the excerpt field, but newer versions now attempt to detect
126
+ this condition when it arises and to head it off, by blanking out the
127
+ excerpt field and filling it with an automatically generated short,
128
+ plain text excerpt from the full content. This release broadens the
129
+ test conditions that indicate when an excerpt field is treated as
130
+ identical to the full text of the post, and should therefore improve
131
+ the handling of some feeds (such as Google Reader feeds) where the full
132
+ text of each post was still appearing in the excerpt field.
133
+
134
+ * FILTERS: `syndicated_item_published` AND `syndicated_item_updated`
135
+ FILTERS NOW ALLOW FILTER AUTHORS TO CHANGE POST TIMESTAMPS. You can now
136
+ use the `syndicated_item_published` and `syndicated_item_updated` filter
137
+ hooks to write filters or add-ons which directly change the post date
138
+ and most-recently-updated timestamps on incoming syndicated posts. Props
139
+ to niska for pointing out where the filters needed to be applied in
140
+ order to change WordPress's internal timestamps for incoming posts.
141
+
142
  = 2010.0531 =
143
 
144
  * PERMALINK / CUSTOM FIELDS PROBLEM RESOLVED: An issue in 2010.0528 caused
syndicatedpost.class.php CHANGED
@@ -121,7 +121,7 @@ class SyndicatedPost {
121
  );
122
 
123
  $excerpt = apply_filters('syndicated_item_excerpt', $this->excerpt(), $this);
124
- if (!is_null($excerpt)):
125
  $this->post['post_excerpt'] = $excerpt;
126
  endif;
127
 
@@ -131,10 +131,10 @@ class SyndicatedPost {
131
 
132
  // Dealing with timestamps in WordPress is so fucking fucked.
133
  $offset = (int) get_option('gmt_offset') * 60 * 60;
134
- $this->post['post_date'] = gmdate('Y-m-d H:i:s', $this->published(/*fallback=*/ true, /*default=*/ -1) + $offset);
135
- $this->post['post_modified'] = gmdate('Y-m-d H:i:s', $this->updated(/*fallback=*/ true, /*default=*/ -1) + $offset);
136
- $this->post['post_date_gmt'] = gmdate('Y-m-d H:i:s', $this->published(/*fallback=*/ true, /*default=*/ -1));
137
- $this->post['post_modified_gmt'] = gmdate('Y-m-d H:i:s', $this->updated(/*fallback=*/ true, /*default=*/ -1));
138
 
139
  // Use feed-level preferences or the global default.
140
  $this->post['post_status'] = $this->link->syndicated_status('post', 'publish');
@@ -497,7 +497,12 @@ class SyndicatedPost {
497
  # If that's what happened, we don't want the full
498
  # content for the excerpt.
499
  $content = $this->content();
500
- if ( is_null($excerpt) or $excerpt == $content ) :
 
 
 
 
 
501
  # If content is available, generate an excerpt.
502
  if ( strlen(trim($content)) > 0 ) :
503
  $excerpt = strip_tags($content);
@@ -689,7 +694,7 @@ class SyndicatedPost {
689
  $author['uri'] = $this->item['author_url'];
690
  elseif (isset($this->feed->channel['author_url'])) :
691
  $author['uri'] = $this->item['author_url'];
692
- else:
693
  $author['uri'] = $this->feed->channel['link'];
694
  endif;
695
 
@@ -1555,7 +1560,11 @@ class SyndicatedPost {
1555
  // more than one user account with an empty e-mail address, so we
1556
  // need *something* here. Ugh.
1557
  if (strlen($email) == 0 or FeedWordPress::is_null_email($email)) :
1558
- $url = parse_url($this->feed->channel['link']);
 
 
 
 
1559
  $email = $nice_author.'@'.$url['host'];
1560
  endif;
1561
 
121
  );
122
 
123
  $excerpt = apply_filters('syndicated_item_excerpt', $this->excerpt(), $this);
124
+ if (!empty($excerpt)):
125
  $this->post['post_excerpt'] = $excerpt;
126
  endif;
127
 
131
 
132
  // Dealing with timestamps in WordPress is so fucking fucked.
133
  $offset = (int) get_option('gmt_offset') * 60 * 60;
134
+ $this->post['post_date'] = gmdate('Y-m-d H:i:s', apply_filters('syndicated_item_published', $this->published(/*fallback=*/ true, /*default=*/ -1), $this) + $offset);
135
+ $this->post['post_modified'] = gmdate('Y-m-d H:i:s', apply_filters('syndicated_item_updated', $this->updated(/*fallback=*/ true, /*default=*/ -1), $this) + $offset);
136
+ $this->post['post_date_gmt'] = gmdate('Y-m-d H:i:s', apply_filters('syndicated_item_published', $this->published(/*fallback=*/ true, /*default=*/ -1), $this));
137
+ $this->post['post_modified_gmt'] = gmdate('Y-m-d H:i:s', apply_filters('syndicated_item_updated', $this->updated(/*fallback=*/ true, /*default=*/ -1), $this));
138
 
139
  // Use feed-level preferences or the global default.
140
  $this->post['post_status'] = $this->link->syndicated_status('post', 'publish');
497
  # If that's what happened, we don't want the full
498
  # content for the excerpt.
499
  $content = $this->content();
500
+
501
+ // Ignore whitespace, case, and tag cruft.
502
+ $theExcerpt = preg_replace('/\s+/', '', strtolower(strip_tags($excerpt)));
503
+ $theContent = preg_replace('/\s+/', '', strtolower(strip_Tags($content)));
504
+
505
+ if ( empty($excerpt) or $theExcerpt == $theContent ) :
506
  # If content is available, generate an excerpt.
507
  if ( strlen(trim($content)) > 0 ) :
508
  $excerpt = strip_tags($content);
694
  $author['uri'] = $this->item['author_url'];
695
  elseif (isset($this->feed->channel['author_url'])) :
696
  $author['uri'] = $this->item['author_url'];
697
+ elseif (isset($this->feed->channel['link'])) :
698
  $author['uri'] = $this->feed->channel['link'];
699
  endif;
700
 
1560
  // more than one user account with an empty e-mail address, so we
1561
  // need *something* here. Ugh.
1562
  if (strlen($email) == 0 or FeedWordPress::is_null_email($email)) :
1563
+ $hostUrl = $this->link->homepage();
1564
+ if (is_null($hostUrl) or (strlen($hostUrl) < 0)) :
1565
+ $hostUrl = $this->link->uri();
1566
+ endif;
1567
+ $url = parse_url($hostUrl);
1568
  $email = $nice_author.'@'.$url['host'];
1569
  endif;
1570
 
syndication.php CHANGED
@@ -5,15 +5,9 @@ require_once(dirname(__FILE__) . '/admin-ui.php');
5
  ## ADMIN MENU ADD-ONS: implement Dashboard management pages ####################
6
  ################################################################################
7
 
8
- if (fwp_test_wp_version(0, FWP_SCHEMA_25)) :
9
- define('FWP_UPDATE_CHECKED', 'Update Checked Links');
10
- define('FWP_UNSUB_CHECKED', 'Unsubscribe from Checked Links');
11
- define('FWP_SYNDICATE_NEW', 'Syndicate ...');
12
- else :
13
- define('FWP_UPDATE_CHECKED', 'Update Checked');
14
- define('FWP_UNSUB_CHECKED', 'Unsubscribe');
15
- define('FWP_SYNDICATE_NEW', 'Syndicate ...');
16
- endif;
17
 
18
  class FeedWordPressSyndicationPage extends FeedWordPressAdminPage {
19
  function FeedWordPressSyndicationPage () {
@@ -343,11 +337,7 @@ function fwp_syndication_manage_page_update_box ($object = NULL, $box = NULL) {
343
 
344
  <div class="submit"><input type="hidden" name="update_uri" value="*" /><input class="button-primary" type="submit" name="update" value="Update" /></div>
345
 
346
- <?php if (fwp_test_wp_version(FWP_SCHEMA_27)) : ?>
347
- <br style="clear: both" />
348
- <?php /* elseif (fwp_test_wp_version(FWP_SCHEMA_25, FWP_SCHEMA_27)) :
349
- </div> <!-- id="rightnow" -->
350
- <?php */ endif; ?>
351
  </form>
352
  <?php
353
  } /* function fwp_syndication_manage_page_update_box () */
5
  ## ADMIN MENU ADD-ONS: implement Dashboard management pages ####################
6
  ################################################################################
7
 
8
+ define('FWP_UPDATE_CHECKED', 'Update Checked');
9
+ define('FWP_UNSUB_CHECKED', 'Unsubscribe');
10
+ define('FWP_SYNDICATE_NEW', 'Syndicate ...');
 
 
 
 
 
 
11
 
12
  class FeedWordPressSyndicationPage extends FeedWordPressAdminPage {
13
  function FeedWordPressSyndicationPage () {
337
 
338
  <div class="submit"><input type="hidden" name="update_uri" value="*" /><input class="button-primary" type="submit" name="update" value="Update" /></div>
339
 
340
+ <br style="clear: both" />
 
 
 
 
341
  </form>
342
  <?php
343
  } /* function fwp_syndication_manage_page_update_box () */