FeedWordPress - Version 0.993

Version Description

Download this release

Release Info

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

Code changes from version 0.992 to 0.993

ChangeLog.text CHANGED
@@ -1,6 +1,37 @@
1
  FeedWordPress Change Log
2
  ========================
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  Changes from 0.991 to 0.992
5
  ---------------------------
6
  * AUTHOR RE-MAPPING: FeedWordPress now offers considerable control over
1
  FeedWordPress Change Log
2
  ========================
3
 
4
+ Changes from 0.992 to 0.993
5
+ ---------------------------
6
+
7
+ * WORDPRESS 2.5.1 COMPATIBILITY: FeedWordPress should now be compatible
8
+ with WordPress 2.5.1.
9
+
10
+ * WORDPRESS 2.5 INTERFACE IMPROVEMENTS: FeedWordPress's Dashboard
11
+ interface has undergone several cosmetic changes that should help it
12
+ integrate better with the WordPress Dashboard interface in WordPress
13
+ version 2.5.x.
14
+
15
+ * SYNDICATED POSTS CAN BE MARKED AS "PENDING REVIEW": WordPress 2.3 users
16
+ can now take advantage of WordPress's new "Pending Review" features for
17
+ incoming syndicated posts. Posts marked as "Pending Review" are not
18
+ published immediately, but are marked as ready to be reviewed by an
19
+ Administrator or Editor, who can then choose to publish the post or
20
+ hold it back. If you want to review syndicated posts from a particular
21
+ feed, or from all feeds, before they are posted, then use
22
+ Syndication --> Syndicated Sites --> Edit or Syndication --> Options to
23
+ change the settings for handling new posts.
24
+
25
+ * AWARE OF NEW URI FOR del.icio.us FEEDS: Previous releases of
26
+ FeedWordPress already automatically split del.icio.us tags up
27
+ appropriately appropriately when generating categories. (del.icio.us
28
+ feeds smoosh all the tags into a single `<dc:subject>` element,
29
+ separated by spaces; FeedWordPress un-smooshes them into multiple
30
+ categories by separating them at whitespace.) Unfortunately, del.icio.us
31
+ recently broke the existing behavior by changing host names for their
32
+ feeds from del.icio.us to feeds.delicious.com. Version 0.993 accounts
33
+ for the new host name and un-breaks the tag splitting.
34
+
35
  Changes from 0.991 to 0.992
36
  ---------------------------
37
  * AUTHOR RE-MAPPING: FeedWordPress now offers considerable control over
MagpieRSS-upgrade/rss.php CHANGED
@@ -1764,7 +1764,7 @@ function parse_w3cdtf ( $date_str ) {
1764
  $epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year);
1765
 
1766
  $offset = 0;
1767
- if ( $match[14] == 'Z' ) {
1768
  # zulu time, aka GMT
1769
  }
1770
  else {
1764
  $epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year);
1765
 
1766
  $offset = 0;
1767
+ if ( $match[15] == 'Z' ) {
1768
  # zulu time, aka GMT
1769
  }
1770
  else {
feedwordpress.php CHANGED
@@ -3,11 +3,11 @@
3
  Plugin Name: FeedWordPress
4
  Plugin URI: http://projects.radgeek.com/feedwordpress
5
  Description: simple and flexible Atom/RSS syndication for WordPress
6
- Version: 0.992
7
  Author: Charles Johnson
8
  Author URI: http://radgeek.com/
9
  License: GPL
10
- Last modified: 2008-01-04 18:03 PDT
11
  */
12
 
13
  # This uses code derived from:
@@ -27,7 +27,7 @@ Last modified: 2008-01-04 18:03 PDT
27
 
28
  # -- Don't change these unless you know what you're doing...
29
 
30
- define ('FEEDWORDPRESS_VERSION', '0.992');
31
  define ('FEEDWORDPRESS_AUTHOR_CONTACT', 'http://radgeek.com/contact');
32
  define ('DEFAULT_SYNDICATION_CATEGORY', 'Contributors');
33
 
@@ -43,6 +43,7 @@ define ('FEEDWORDPRESS_FRESHNESS_INTERVAL', 10*60); // Every ten minutes
43
  define ('FWP_SCHEMA_20', 3308); // Database schema # for WP 2.0
44
  define ('FWP_SCHEMA_21', 4772); // Database schema # for WP 2.1
45
  define ('FWP_SCHEMA_23', 5495); // Database schema # for WP 2.3
 
46
 
47
  if (FEEDWORDPRESS_DEBUG) :
48
  // Help us to pick out errors, if any.
@@ -83,7 +84,12 @@ if (isset($wp_db_version)) :
83
  endif;
84
 
85
  if (function_exists('wp_enqueue_script')) :
86
- wp_enqueue_script( 'ajaxcat' ); // Provides the handy-dandy new category text box
 
 
 
 
 
87
  endif;
88
 
89
  // Magic quotes are just about the stupidest thing ever.
@@ -91,6 +97,18 @@ if (is_array($_POST)) :
91
  $fwp_post = stripslashes_deep($_POST);
92
  endif;
93
 
 
 
 
 
 
 
 
 
 
 
 
 
94
 
95
  if (!FeedWordPress::needs_upgrade()) : // only work if the conditions are safe!
96
 
@@ -148,6 +166,10 @@ if (!FeedWordPress::needs_upgrade()) : // only work if the conditions are safe!
148
 
149
  # Cron-less auto-update. Hooray!
150
  add_action('init', 'feedwordpress_auto_update');
 
 
 
 
151
  else :
152
  # Hook in the menus, which will just point to the upgrade interface
153
  add_action('admin_menu', 'fwp_add_pages');
@@ -263,6 +285,24 @@ if (!function_exists('wp_insert_user')) {
263
  return $id;
264
  }
265
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
  ################################################################################
267
  ## TEMPLATE API: functions to make your templates syndication-aware ############
268
  ################################################################################
@@ -399,6 +439,7 @@ like me you may want to back up your database before you proceed.</p>
399
 
400
  function fwp_add_pages () {
401
  global $legacy_capability_hack;
 
402
 
403
  if ($legacy_capability_hack) :
404
  // old & busted: numeric user levels
@@ -411,18 +452,129 @@ function fwp_add_pages () {
411
  endif;
412
 
413
  //add_submenu_page('plugins.php', 'Akismet Configuration', 'Akismet Configuration', 'manage_options', 'syndication-manage-page', 'fwp_syndication_manage_page');
414
- add_menu_page('Syndicated Sites', 'Syndication', $manage_links, 'feedwordpress/'.basename(__FILE__), 'fwp_syndication_manage_page');
415
- add_submenu_page('feedwordpress/'.basename(__FILE__), 'Syndication Options', 'Options', $manage_options, 'feedwordpress/syndication-options.php');
416
- add_options_page('Syndication Options', 'Syndication', $manage_options, 'feedwordpress/syndication-options.php');
417
  } // function fwp_add_pages () */
418
 
419
- function fwp_category_box ($checked, $object) {
420
  global $wp_db_version;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
421
 
422
- if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_20) : // WordPress 2.x
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
423
  ?>
424
- <div id="poststuff">
425
-
426
  <div id="moremeta">
427
  <div id="grabit" class="dbx-group">
428
  <fieldset id="categorydiv" class="dbx-box">
@@ -430,18 +582,17 @@ function fwp_category_box ($checked, $object) {
430
  <div class="dbx-content">
431
  <p style="font-size:smaller;font-style:bold;margin:0">Place <?php print $object; ?> under...</p>
432
  <p id="jaxcat"></p>
433
- <ul id="categorychecklist"><?php write_nested_categories($checked); ?></ul></div>
434
  </fieldset>
435
  </div>
436
  </div>
437
- </div>
438
  <?php
439
  else : // WordPress 1.5
440
  ?>
441
  <fieldset id="categorydiv" style="width: 20%; margin-right: 2em">
442
  <legend><?php _e('Categories') ?></legend>
443
  <p style="font-size:smaller;font-style:bold;margin:0">Place <?php print $object; ?> under...</p>
444
- <div style="height: 20em"><?php write_nested_categories($checked); ?></div>
445
  </fieldset>
446
  <?php
447
  endif;
@@ -542,7 +693,7 @@ if ($cont):
542
  <p><strong>Note:</strong> Automatic updates are currently turned
543
  <strong>off</strong>. New posts from your feeds will not be syndicated
544
  until you manually check for them here. You can turn on automatic
545
- updates under <a href="admin.php?page=feedwordpress/syndication-options.php">Syndication
546
  Options</a>.</p>
547
  <?php endif; ?>
548
 
@@ -551,7 +702,7 @@ if ($cont):
551
  </form>
552
  </div> <!-- class="wrap" -->
553
 
554
- <form action="admin.php?page=feedwordpress/<?php echo basename(__FILE__); ?>" method="post">
555
  <div class="wrap">
556
  <h2>Syndicated Sites</h2>
557
  <?php $alt_row = true;
@@ -592,9 +743,9 @@ if ($cont):
592
  <?php
593
  endif;
594
  ?>
595
- <td><a href="admin.php?page=feedwordpress/<?php echo basename(__FILE__); ?>&amp;link_id=<?php echo $link->link_id; ?>&amp;action=linkedit" class="edit"><?php _e('Edit')?></a></td>
596
- <td><a href="admin.php?page=feedwordpress/<?php echo basename(__FILE__); ?>&amp;link_id=<?php echo $link->link_id; ?>&amp;action=feedfinder" class="edit"><?php echo $caption; ?></a></td>
597
- <td><a href="admin.php?page=feedwordpress/<?php echo basename(__FILE__); ?>&amp;link_id=<?php echo $link->link_id; ?>&amp;action=Unsubscribe" class="delete"><?php _e('Unsubscribe'); ?></a></td>
598
  <td><input type="checkbox" name="link_ids[]" value="<?php echo $link->link_id; ?>" /></td>
599
  <?php
600
  echo "\n\t</tr>";
@@ -614,7 +765,7 @@ if ($cont):
614
  </form>
615
 
616
  <div class="wrap">
617
- <form action="admin.php?page=feedwordpress/<?php echo basename(__FILE__); ?>" method="post">
618
  <h2>Add a new syndicated site:</h2>
619
  <div>
620
  <label for="add-uri">Website or newsfeed:</label>
@@ -661,7 +812,7 @@ function fwp_feedfinder_page () {
661
  $feed_title = isset($rss->channel['title'])?$rss->channel['title']:$rss->channel['link'];
662
  $feed_link = isset($rss->channel['link'])?$rss->channel['link']:'';
663
  ?>
664
- <form action="admin.php?page=feedwordpress/<?php echo basename(__FILE__); ?>" method="post">
665
  <fieldset style="clear: both">
666
  <legend><?php echo $rss->feed_type; ?> <?php echo $rss->feed_version; ?> feed</legend>
667
 
@@ -714,7 +865,7 @@ function fwp_feedfinder_page () {
714
  ?>
715
  </div>
716
 
717
- <form action="admin.php?page=feedwordpress/<?php echo basename(__FILE__); ?>" method="post">
718
  <div class="wrap">
719
  <h2>Use another feed</h2>
720
  <div><label>Feed:</label>
@@ -769,7 +920,7 @@ updated to &lt;<a href="<?php echo $_REQUEST['feed']; ?>"><?php echo wp_specialc
769
  }
770
 
771
  function fwp_linkedit_page () {
772
- global $wpdb;
773
 
774
  check_admin_referer(); // Make sure we arrived here from the Dashboard
775
 
@@ -784,8 +935,10 @@ function fwp_linkedit_page () {
784
  'comment status',
785
  'ping status',
786
  'unfamiliar author',
787
- 'unfamliar categories',
 
788
  'map authors',
 
789
  'update/.*',
790
  'feed/.*',
791
  'link/.*',
@@ -864,6 +1017,14 @@ function fwp_linkedit_page () {
864
  unset($meta['cats']);
865
  endif;
866
 
 
 
 
 
 
 
 
 
867
  // Post status, comment status, ping status
868
  foreach (array('post', 'comment', 'ping') as $what) :
869
  $sfield = "feed_{$what}_status";
@@ -994,6 +1155,9 @@ function fwp_linkedit_page () {
994
  if (is_array($meta['cats'])) :
995
  $meta['cats'] = implode(FEEDWORDPRESS_CAT_SEPARATOR, $meta['cats']);
996
  endif;
 
 
 
997
 
998
  // Collapse the author mapping rule structure back into a flat string
999
  if (isset($meta['map authors'])) :
@@ -1041,6 +1205,10 @@ function fwp_linkedit_page () {
1041
  $ping_status_global = get_option('feedwordpress_syndicated_ping_status');
1042
 
1043
  $status['post'] = array('publish' => '', 'private' => '', 'draft' => '', 'site-default' => '');
 
 
 
 
1044
  $status['comment'] = array('open' => '', 'closed' => '', 'site-default' => '');
1045
  $status['ping'] = array('open' => '', 'closed' => '', 'site-default' => '');
1046
 
@@ -1065,26 +1233,11 @@ function fwp_linkedit_page () {
1065
  $unfamiliar[$what][$key] = ' checked="checked"';
1066
  endforeach;
1067
 
1068
- $dogs = get_nested_categories(-1, 0);
1069
- if (is_array($meta['cats'])) :
1070
- $cats = array_map('strtolower',
1071
- array_map('trim',
1072
- $meta['cats']
1073
- ));
1074
- else:
1075
- $cats = array();
1076
  endif;
1077
-
1078
- foreach ($dogs as $tag => $dog) :
1079
- $found_by_name = in_array(strtolower(trim($dog['cat_name'])), $cats);
1080
-
1081
- if (isset($dog['cat_ID'])) : $dog['cat_id'] = $dog['cat_ID']; endif;
1082
- $found_by_id = in_array('{#'.trim($dog['cat_id']).'}', $cats);
1083
 
1084
- if ($found_by_name or $found_by_id) :
1085
- $dogs[$tag]['checked'] = true;
1086
- endif;
1087
- endforeach;
1088
  else :
1089
  die( __('Link not found.') );
1090
  endif;
@@ -1122,97 +1275,101 @@ function fwp_linkedit_page () {
1122
  <div class="updated"><p>Syndicated feed settings updated.</p></div>
1123
  <?php endif; ?>
1124
 
1125
- <form action="admin.php?page=feedwordpress/<?php echo basename(__FILE__); ?>" method="post">
1126
  <div class="wrap">
1127
  <input type="hidden" name="link_id" value="<?php echo $link_id; ?>" />
1128
  <input type="hidden" name="action" value="linkedit" />
1129
  <input type="hidden" name="save" value="link" />
1130
 
1131
  <h2>Edit a syndicated feed:</h2>
1132
- <fieldset class="options"><legend>Basics</legend>
1133
- <table class="editform" width="100%" cellspacing="2" cellpadding="5">
1134
- <tr>
1135
- <th scope="row" width="20%"><?php _e('Feed URI:') ?></th>
1136
- <td width="60%"><a href="<?php echo wp_specialchars($link_rss_uri, 'both'); ?>"><?php echo $link_rss_uri; ?></a>
1137
- (<a href="<?php echo FEEDVALIDATOR_URI; ?>?url=<?php echo urlencode($link_rss_uri); ?>"
1138
- title="Check feed &lt;<?php echo wp_specialchars($link_rss_uri, 'both'); ?>&gt; for validity">validate</a>)
1139
- </td>
1140
- <td width="20%"><input type="submit" name="feedfinder" value="switch &rarr;" style="font-size:smaller" /></td>
1141
- </tr>
1142
- <tr>
1143
- <th scope="row" width="20%"><?php _e('Link Name:') ?></th>
1144
- <td width="60%"><input type="text" id="basics-name-edit" name="name"
1145
- value="<?php echo $link_name; ?>" style="width: 95%" />
1146
- <span id="basics-name-view"><strong><?php echo $link_name; ?></strong></span>
1147
- </td>
1148
- <td>
1149
- <select id="basics-hardcode-name" onchange="flip_hardcode('name')" name="hardcode_name">
1150
- <option value="no" <?php echo $link->hardcode('name')?'':'selected="selected"'; ?>>update automatically</option>
1151
- <option value="yes" <?php echo $link->hardcode('name')?'selected="selected"':''; ?>>edit manually</option>
1152
- </select>
1153
- </td>
1154
- </tr>
1155
- <tr>
1156
- <th scope="row" width="20%"><?php _e('Short description:') ?></th>
1157
- <td width="60%">
1158
- <input id="basics-description-edit" type="text" name="description" value="<?php echo $link_description; ?>" style="width: 95%" />
1159
- <span id="basics-description-view"><strong><?php echo $link_description; ?></strong></span>
1160
- </td>
1161
- <td>
1162
- <select id="basics-hardcode-description" onchange="flip_hardcode('description')"
1163
- name="hardcode_description">
1164
- <option value="no" <?php echo $link->hardcode('description')?'':'selected="selected"'; ?>>update automatically</option>
1165
- <option value="yes" <?php echo $link->hardcode('description')?'selected="selected"':''; ?>>edit manually</option>
1166
- </select></td>
1167
- </tr>
1168
- <tr>
1169
- <th width="20%" scope="row"><?php _e('Homepage:') ?></th>
1170
- <td width="60%">
1171
- <input id="basics-url-edit" type="text" name="linkurl" value="<?php echo $link_url; ?>" style="width: 95%;" />
1172
- <a id="basics-url-view" href="<?php echo $link_url; ?>"><?php echo $link_url; ?></a></td>
1173
- <td>
1174
- <select id="basics-hardcode-url" onchange="flip_hardcode('url')" name="hardcode_url">
1175
- <option value="no"<?php echo $link->hardcode('url')?'':' selected="selected"'; ?>>update automatically</option>
1176
- <option value="yes"<?php echo $link->hardcode('url')?' selected="selected"':''; ?>>edit manually</option>
1177
- </select></td></tr>
1178
 
1179
- <tr>
1180
- <th width="20%"><?php _e('Last update') ?>:</th>
1181
- <td colspan="2"><?php
1182
- if (isset($meta['update/last'])) :
1183
- echo strftime('%x %X', $meta['update/last'])." ";
1184
- else :
1185
- echo " none yet";
1186
- endif;
1187
- ?></td></tr>
1188
- <tr><th width="20%">Next update:</th>
1189
- <td colspan="2"><?php
1190
- $holdem = (isset($meta['update/hold']) ? $meta['update/hold'] : 'scheduled');
1191
- ?>
1192
- <select name="update_schedule">
1193
- <option value="scheduled"<?php echo ($holdem=='scheduled')?' selected="selected"':''; ?>>update on schedule <?php
1194
- echo " (";
1195
- if (isset($meta['update/ttl']) and is_numeric($meta['update/ttl'])) :
1196
- if (isset($meta['update/timed']) and $meta['update/timed']=='automatically') :
1197
- echo 'next: ';
1198
- $next = $meta['update/last'] + ((int) $meta['update/ttl'] * 60);
1199
- if (strftime('%x', time()) != strftime('%x', $next)) :
1200
- echo strftime('%x', $next)." ";
1201
- endif;
1202
- echo strftime('%X', $meta['update/last']+((int) $meta['update/ttl']*60));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1203
  else :
1204
- echo "every ".$meta['update/ttl']." minute".(($meta['update/ttl']!=1)?"s":"");
1205
  endif;
1206
- else:
1207
- echo "next scheduled update";
1208
- endif;
1209
- echo ")";
1210
- ?></option>
1211
- <option value="next"<?php echo ($holdem=='next')?' selected="selected"':''; ?>>update ASAP</option>
1212
- <option value="ping"<?php echo ($holdem=='ping')?' selected="selected"':''; ?>>update only when pinged</option>
1213
- </select></tr>
1214
- </table>
1215
- </fieldset>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1216
 
1217
  <script type="text/javascript">
1218
  flip_hardcode('name');
@@ -1220,65 +1377,97 @@ flip_hardcode('description');
1220
  flip_hardcode('url');
1221
  </script>
1222
 
1223
- <p class="submit">
1224
- <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
1225
- </p>
1226
-
1227
- <fieldset class="options">
1228
- <legend>Syndicated Posts</legend>
1229
-
1230
- <?php fwp_category_box($dogs, 'all syndicated posts from this feed'); ?>
1231
 
 
 
 
 
1232
  <table class="editform" width="75%" cellspacing="2" cellpadding="5">
1233
  <tr><th width="27%" scope="row" style="vertical-align:top">Publication:</th>
1234
  <td width="73%" style="vertical-align:top"><ul style="margin:0; list-style:none">
1235
  <li><label><input type="radio" name="feed_post_status" value="site-default"
1236
- <?php echo $status['post']['site-default']; ?> /> Use site-wide setting from <a href="admin.php?page=feedwordpress/syndication-options.php">Syndication Options</a>
1237
  (currently: <strong><?php echo ($post_status_global ? $post_status_global : 'publish'); ?></strong>)</label></li>
1238
  <li><label><input type="radio" name="feed_post_status" value="publish"
1239
  <?php echo $status['post']['publish']; ?> /> Publish posts from this feed immediately</label></li>
1240
- <li><label><input type="radio" name="feed_post_status" value="private"
1241
- <?php echo $status['post']['private']; ?> /> Hold posts from this feed as private posts</label></li>
 
 
 
 
1242
  <li><label><input type="radio" name="feed_post_status" value="draft"
1243
- <?php echo $status['post']['draft']; ?> /> Hold posts from this feed as drafts</label></li>
 
 
1244
  </ul></td>
1245
  </tr>
 
 
 
 
 
1246
 
1247
- <tr><th width="27%" scope="row" style="vertical-align:top">Comments:</th>
1248
- <td width="73%"><ul style="margin:0; list-style:none">
1249
- <li><label><input type="radio" name="feed_comment_status" value="site-default"
1250
- <?php echo $status['comment']['site-default']; ?> /> Use site-wide setting from <a href="admin.php?page=feedwordpress/syndication-options.php">Syndication Options</a>
1251
- (currently: <strong><?php echo ($comment_status_global ? $comment_status_global : 'closed'); ?>)</strong></label></li>
1252
- <li><label><input type="radio" name="feed_comment_status" value="open"
1253
- <?php echo $status['comment']['open']; ?> /> Allow comments on syndicated posts from this feed</label></li>
1254
- <li><label><input type="radio" name="feed_comment_status" value="closed"
1255
- <?php echo $status['comment']['closed']; ?> /> Don't allow comments on syndicated posts from this feed</label></li>
 
 
 
1256
  </ul></td>
1257
  </tr>
1258
 
1259
- <tr><th width="27%" scope="row" style="vertical-align:top">Trackback and Pingback:</th>
1260
- <td width="73%"><ul style="margin:0; list-style:none">
1261
- <li><label><input type="radio" name="feed_ping_status" value="site-default"
1262
- <?php echo $status['ping']['site-default']; ?> /> Use site-wide setting from <a href="admin.php?page=feedwordpress/syndication-options.php">Syndication Options</a>
1263
- (currently: <strong><?php echo ($ping_status_global ? $ping_status_global : 'closed'); ?>)</strong></label></li>
1264
- <li><label><input type="radio" name="feed_ping_status" value="open"
1265
- <?php echo $status['ping']['open']; ?> /> Accept pings on syndicated posts from this feed</label></li>
1266
- <li><label><input type="radio" name="feed_ping_status" value="closed"
1267
- <?php echo $status['ping']['closed']; ?> /> Don't accept pings on syndicated posts from this feed</label></li>
1268
- </ul></td>
1269
  </tr>
1270
  </table>
1271
- </fieldset>
1272
-
1273
- <p class="submit">
1274
- <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
1275
- </p>
 
 
 
1276
 
1277
- <fieldset class="options">
1278
- <legend>Syndicated Authors</legend>
1279
  <?php $authorlist = fwp_author_list(); ?>
1280
-
1281
  <table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1282
  <tr><th colspan="3" style="text-align: left; padding-top: 1.0em; border-bottom: 1px dotted black;">For posts by specific authors. Blank out a name to delete the rule.</th></tr>
1283
 
1284
  <?php if (isset($meta['map authors'])) : $i=0; foreach ($meta['map authors'] as $author_rules) : foreach ($author_rules as $author_name => $author_action) : $i++; ?>
@@ -1313,28 +1502,8 @@ flip_hardcode('url');
1313
  <td><div id="add-author-rule-newuser">named <input type="text" name="add_author_rule_newuser" value="" /></div></td>
1314
  </tr>
1315
 
1316
- <tr><th colspan="3" style="text-align: left; padding-top: 1.0em; border-bottom: 1px dotted black;">For posts by authors that haven't been syndicated before:</th></tr>
1317
- <tr>
1318
- <th style="text-align: left">Posts by new authors</th>
1319
- <td>
1320
- <select id="unfamiliar-author" name="unfamiliar_author" onchange="flip_newuser('unfamiliar-author');">
1321
- <option value="site-default"<?php if (!isset($meta['unfamiliar author'])) : ?>selected="selected"<?php endif; ?>>are handled using site-wide settings</option>
1322
- <option value="create"<?php if ('create'==$meta['unfamiliar author']) : ?>selected="selected"<?php endif; ?>>create a new author account</option>
1323
- <?php foreach ($authorlist as $author_id => $author_name) : ?>
1324
- <option value="<?php echo $author_id; ?>"<?php if ($author_id==$meta['unfamiliar author']) : ?>selected="selected"<?php endif; ?>>are assigned to <?php echo $author_name; ?></option>
1325
- <?php endforeach; ?>
1326
- <option value="newuser">will be assigned to a new user...</option>
1327
- <option value="filter"<?php if ('filter'==$meta['unfamiliar author']) : ?>selected="selected"<?php endif; ?>>get filtered out</option>
1328
- </select>
1329
- </td>
1330
- <td>
1331
- <div id="unfamiliar-author-default">Site-wide settings can be set in <a href="admin.php?page=feedwordpress/syndication-options.php">Syndication Options</a></div>
1332
- <div id="unfamiliar-author-newuser">named <input type="text" name="unfamiliar_author_newuser" value="" /></div>
1333
- </td>
1334
- </tr>
1335
-
1336
  </table>
1337
- </fieldset>
1338
 
1339
  <script>
1340
  flip_newuser('unfamiliar-author');
@@ -1344,45 +1513,38 @@ flip_hardcode('url');
1344
  flip_newuser('add-author-rule');
1345
  </script>
1346
 
1347
- <p class="submit">
1348
- <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
1349
- </p>
1350
-
1351
- <fieldset>
1352
- <legend>Advanced Feed Options</legend>
1353
- <table class="editform" width="100%" cellspacing="2" cellpadding="5">
 
 
 
 
 
 
 
 
1354
 
1355
- <tr>
1356
- <th width="20%" scope="row" style="vertical-align:top">Unfamiliar categories:</th>
1357
- <td width="80%"><ul style="margin: 0; list-style:none">
1358
- <li><label><input type="radio" name="unfamiliar_category" value="site-default"<?php echo $unfamiliar['category']['site-default']; ?> /> use site-wide setting from <a href="admin.php?page=feedwordpress/syndication-options.php">Syndication Options</a>
1359
- (currently <strong><?php echo FeedWordPress::on_unfamiliar('category'); ?></strong>)</label></li>
1360
- <li><label><input type="radio" name="unfamiliar_category" value="create"<?php echo $unfamiliar['category']['create']; ?> /> create any categories the post is in</label></li>
1361
- <li><label><input type="radio" name="unfamiliar_category" value="default"<?php echo $unfamiliar['category']['default']; ?> /> don't create new categories</label></li>
1362
- <li><label><input type="radio" name="unfamiliar_category" value="filter"<?php echo $unfamiliar['category']['filter']; ?> /> don't create new categories and don't syndicate posts unless they match at least one familiar category</label></li>
1363
- </ul></td>
1364
- </tr>
1365
 
1366
- <tr>
1367
- <th width="20%" scope="row" style="vertical-align:top">Multiple categories:</th>
1368
- <td width="80%">
1369
- <input type="text" size="20" id="cat_split" name="cat_split" value="<?php if (isset($meta['cat_split'])) : echo htmlspecialchars($meta['cat_split']); endif; ?>" /><br/>
1370
- Enter a <a href="http://us.php.net/manual/en/reference.pcre.pattern.syntax.php">Perl-compatible regular expression</a> here if the feed provides multiple
1371
- categories in a single category element. The regular expression should match
1372
- the characters used to separate one category from the next. If the feed uses
1373
- spaces (like <a href="http://del.icio.us/">del.icio.us</a>), use the pattern "\s".
1374
- If the feed does not provide multiple categories in a single element, leave this
1375
- blank.</td>
1376
- </tr>
1377
  </table>
1378
- </fieldset>
 
1379
 
1380
- <p class="submit">
1381
- <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
1382
- </p>
1383
-
1384
- <fieldset id="postcustom">
1385
- <legend>Custom Settings (for use in templates)</legend>
1386
  <div id="postcustomstuff">
1387
  <table id="meta-list" cellpadding="3">
1388
  <tr>
@@ -1416,12 +1578,11 @@ blank.</td>
1416
  <td><em>add new setting...</em><input type="hidden" name="notes[<?php echo $i; ?>][action]" value="update" /></td>
1417
  </tr>
1418
  </table>
1419
- </fieldset>
1420
-
1421
- <p class="submit">
1422
- <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
1423
- </p>
1424
 
 
 
 
1425
  </div>
1426
  <?php
1427
  endif;
@@ -1532,7 +1693,7 @@ function fwp_multidelete_page () {
1532
  WHERE link_id IN (".implode(",",$link_ids).")
1533
  ");
1534
  ?>
1535
- <form action="admin.php?page=feedwordpress/<?php echo basename(__FILE__); ?>" method="post">
1536
  <div class="wrap">
1537
  <input type="hidden" name="action" value="Unsubscribe" />
1538
  <input type="hidden" name="confirm" value="Delete" />
@@ -2069,11 +2230,6 @@ class SyndicatedPost {
2069
  var $_freshness = null;
2070
  var $_wp_id = null;
2071
 
2072
- var $strip_attrs = array (
2073
- array('[a-z]+', 'style'),
2074
- array('[a-z]+', 'target'),
2075
- );
2076
-
2077
  function SyndicatedPost ($item, $link) {
2078
  global $wpdb;
2079
 
@@ -2106,12 +2262,12 @@ class SyndicatedPost {
2106
  # of insertion, not here, to avoid double-escaping and
2107
  # to avoid screwing with syndicated_post filters
2108
 
2109
- $this->post['post_title'] = $this->item['title'];
2110
 
2111
- // This just gives usan alphanumeric representation of
2112
  // the author. We will look up (or create) the numeric
2113
  // ID for the author in SyndicatedPost::add()
2114
- $this->post['named']['author'] = $this->author();
2115
 
2116
  # Identify content and sanitize it.
2117
  # ---------------------------------
@@ -2124,22 +2280,7 @@ class SyndicatedPost {
2124
  else:
2125
  $content = $this->item['description'];
2126
  endif;
2127
-
2128
- # FeedWordPress used to resolve URIs relative to the
2129
- # feed URI. It now relies on the xml:base support
2130
- # baked in to the MagpieRSS upgrade. So all we do here
2131
- # now is to sanitize problematic attributes.
2132
- #
2133
- # This kind of sucks. I intend to replace it with
2134
- # lib_filter sometime soon.
2135
- foreach ($this->strip_attrs as $pair):
2136
- list($tag,$attr) = $pair;
2137
- $content = preg_replace (
2138
- ":(<$tag [^>]*)($attr=(\"[^\">]*\"|[^>\\s]+))([^>]*>):i",
2139
- "\\1\\4",
2140
- $content
2141
- );
2142
- endforeach;
2143
 
2144
  # Identify and sanitize excerpt
2145
  $excerpt = NULL;
@@ -2151,9 +2292,8 @@ class SyndicatedPost {
2151
  $excerpt = substr($excerpt,0,252).'...';
2152
  endif;
2153
  endif;
 
2154
 
2155
- $this->post['post_content'] = $content;
2156
-
2157
  if (!is_null($excerpt)):
2158
  $this->post['post_excerpt'] = $excerpt;
2159
  endif;
@@ -2163,9 +2303,9 @@ class SyndicatedPost {
2163
  $this->post['post_name'] = sanitize_title($this->post['post_title']);
2164
  endif;
2165
 
2166
- $this->post['epoch']['issued'] = $this->published();
2167
- $this->post['epoch']['created'] = $this->created();
2168
- $this->post['epoch']['modified'] = $this->updated();
2169
 
2170
  // Dealing with timestamps in WordPress is so fucking fucked.
2171
  $offset = (int) get_option('gmt_offset') * 60 * 60;
@@ -2180,33 +2320,33 @@ class SyndicatedPost {
2180
  $this->post['ping_status'] = $this->link->syndicated_status('ping', 'closed');
2181
 
2182
  // Unique ID (hopefully a unique tag: URI); failing that, the permalink
2183
- $this->post['guid'] = $this->guid();
2184
 
2185
  // RSS 2.0 / Atom 1.0 enclosure support
2186
  if ( isset($this->item['enclosure#']) ) :
2187
  for ($i = 1; $i <= $this->item['enclosure#']; $i++) :
2188
  $eid = (($i > 1) ? "#{$id}" : "");
2189
  $this->post['meta']['enclosure'][] =
2190
- $this->item["enclosure{$eid}@url"]."\n".
2191
- $this->item["enclosure{$eid}@length"]."\n".
2192
- $this->item["enclosure{$eid}@type"];
2193
  endfor;
2194
  endif;
2195
 
2196
  // In case you want to point back to the blog this was syndicated from
2197
  if (isset($this->feed->channel['title'])) :
2198
- $this->post['meta']['syndication_source'] = $this->feed->channel['title'];
2199
  endif;
2200
  if (isset($this->feed->channel['link'])) :
2201
- $this->post['meta']['syndication_source_uri'] = $this->feed->channel['link'];
2202
  endif;
2203
 
2204
  // Store information on human-readable and machine-readable comment URIs
2205
  if (isset($this->item['comments'])) :
2206
- $this->post['meta']['rss:comments'] = $this->item['comments'];
2207
  endif;
2208
  if (isset($this->item['wfw']['commentrss'])) :
2209
- $this->post['meta']['wfw:commentRSS'] = $this->item['wfw']['commentrss'];
2210
  endif;
2211
 
2212
  // Store information to identify the feed that this came from
@@ -2214,11 +2354,11 @@ class SyndicatedPost {
2214
  $this->post['meta']['syndication_feed_id'] = $this->feedmeta['link/id'];
2215
 
2216
  // In case you want to know the external permalink...
2217
- $this->post['meta']['syndication_permalink'] = $this->item['link'];
2218
 
2219
  // Feed-by-feed options for author and category creation
2220
  $this->post['named']['unfamiliar']['author'] = $this->feedmeta['unfamiliar author'];
2221
- $this->post['named']['unfamiliar']['category'] = $this->feedmeta['unfamiliar categories'];
2222
 
2223
  // Categories: start with default categories, if any
2224
  $fc = get_option("feedwordpress_syndication_cats");
@@ -2247,6 +2387,19 @@ class SyndicatedPost {
2247
  endif;
2248
  endfor;
2249
  endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
2250
  endif;
2251
  } // SyndicatedPost::SyndicatedPost()
2252
 
@@ -2378,13 +2531,22 @@ class SyndicatedPost {
2378
  endif;
2379
  endforeach;
2380
 
 
 
 
 
 
 
 
 
 
2381
  if ($this->use_api('wp_insert_post')) :
2382
  $dbpost['post_pingback'] = false; // Tell WP 2.1 and 2.2 not to process for pingbacks
2383
  $this->_wp_id = wp_insert_post($dbpost);
2384
 
2385
  // This should never happen.
2386
  if (!is_numeric($this->_wp_id) or ($this->_wp_id == 0)) :
2387
- FeedWordPress::critical_bug('SyndicatedPost (_wp_id problem)', $this, __LINE__);
2388
  endif;
2389
 
2390
  // Unfortunately, as of WordPress 2.3, wp_insert_post()
@@ -2780,11 +2942,16 @@ class SyndicatedPost {
2780
 
2781
  function use_api ($tag) {
2782
  global $wp_db_version;
2783
- if ('wp_insert_post'==$tag) :
 
2784
  // Before 2.2, wp_insert_post does too much of the wrong stuff to use it
2785
  // In 1.5 it was such a resource hog it would make PHP segfault on big updates
2786
  $ret = (isset($wp_db_version) and $wp_db_version > FWP_SCHEMA_21);
2787
- endif;
 
 
 
 
2788
  return $ret;
2789
  } // function SyndicatedPost::use_api ()
2790
 
@@ -2943,6 +3110,29 @@ class SyndicatedPost {
2943
 
2944
  return $author;
2945
  } // SyndicatedPost::author()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2946
  } // class SyndicatedPost
2947
 
2948
  # class SyndicatedLink: represents a syndication feed stored within the
@@ -3022,22 +3212,33 @@ class SyndicatedLink {
3022
  $this->settings['link/name'] = $this->link->link_name;
3023
  $this->settings['link/id'] = $this->link->link_id;
3024
 
3025
- // `hardcode categories` is deprecated in favor of `unfamiliar categories`
 
 
 
 
 
 
3026
  if (
3027
  FeedWordPress::affirmative($this->settings, 'hardcode categories')
3028
- and !isset($this->settings['unfamiliar categories'])
3029
  ) :
3030
- $this->settings['unfamiliar categories'] = 'default';
3031
  endif;
3032
-
3033
  // Set this up automagically for del.icio.us
3034
- if (!isset($this->settings['cat_split']) and false !== strpos($this->link->link_rss, 'del.icio.us')) :
 
 
3035
  $this->settings['cat_split'] = '\s'; // Whitespace separates multiple tags in del.icio.us RSS feeds
3036
  endif;
3037
 
3038
  if (isset($this->settings['cats'])):
3039
  $this->settings['cats'] = preg_split(FEEDWORDPRESS_CAT_SEPARATOR_PATTERN, $this->settings['cats']);
3040
  endif;
 
 
 
3041
 
3042
  if (isset($this->settings['map authors'])) :
3043
  $author_rules = explode("\n\n", $this->settings['map authors']);
@@ -3131,6 +3332,9 @@ class SyndicatedLink {
3131
  if (is_array($to_notes['cats'])) :
3132
  $to_notes['cats'] = implode(FEEDWORDPRESS_CAT_SEPARATOR, $to_notes['cats']);
3133
  endif;
 
 
 
3134
 
3135
  if (isset($to_notes['map authors'])) :
3136
  $ma = array();
@@ -3145,6 +3349,7 @@ class SyndicatedLink {
3145
  unset($to_notes['link/id']); unset($to_notes['link/uri']);
3146
  unset($to_notes['link/name']);
3147
  unset($to_notes['hardcode categories']); // Deprecated
 
3148
 
3149
  $notes = '';
3150
  foreach ($to_notes as $key => $value) :
@@ -3178,6 +3383,9 @@ class SyndicatedLink {
3178
  if (is_array($to_notes['cats'])) :
3179
  $to_notes['cats'] = implode(FEEDWORDPRESS_CAT_SEPARATOR, $to_notes['cats']);
3180
  endif;
 
 
 
3181
 
3182
  if (isset($to_notes['map authors'])) :
3183
  $ma = array();
@@ -3192,6 +3400,7 @@ class SyndicatedLink {
3192
  unset($to_notes['link/id']); unset($to_notes['link/uri']);
3193
  unset($to_notes['link/name']);
3194
  unset($to_notes['hardcode categories']); // Deprecated
 
3195
 
3196
  $notes = '';
3197
  foreach ($to_notes as $key => $value) :
3
  Plugin Name: FeedWordPress
4
  Plugin URI: http://projects.radgeek.com/feedwordpress
5
  Description: simple and flexible Atom/RSS syndication for WordPress
6
+ Version: 0.993
7
  Author: Charles Johnson
8
  Author URI: http://radgeek.com/
9
  License: GPL
10
+ Last modified: 2008-05-08 4:48 PM PDT
11
  */
12
 
13
  # This uses code derived from:
27
 
28
  # -- Don't change these unless you know what you're doing...
29
 
30
+ define ('FEEDWORDPRESS_VERSION', '0.993');
31
  define ('FEEDWORDPRESS_AUTHOR_CONTACT', 'http://radgeek.com/contact');
32
  define ('DEFAULT_SYNDICATION_CATEGORY', 'Contributors');
33
 
43
  define ('FWP_SCHEMA_20', 3308); // Database schema # for WP 2.0
44
  define ('FWP_SCHEMA_21', 4772); // Database schema # for WP 2.1
45
  define ('FWP_SCHEMA_23', 5495); // Database schema # for WP 2.3
46
+ define ('FWP_SCHEMA_25', 7558); // Database schema # for WP 2.5
47
 
48
  if (FEEDWORDPRESS_DEBUG) :
49
  // Help us to pick out errors, if any.
84
  endif;
85
 
86
  if (function_exists('wp_enqueue_script')) :
87
+ if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) :
88
+ wp_enqueue_script('post');
89
+ wp_enqueue_script('thickbox');
90
+ else :
91
+ wp_enqueue_script( 'ajaxcat' ); // Provides the handy-dandy new category text box
92
+ endif;
93
  endif;
94
 
95
  // Magic quotes are just about the stupidest thing ever.
97
  $fwp_post = stripslashes_deep($_POST);
98
  endif;
99
 
100
+ // Get the path relative to the plugins directory in which FWP is stored
101
+ preg_match (
102
+ '|/wp-content/plugins/(.+)$|',
103
+ dirname(__FILE__),
104
+ $ref
105
+ );
106
+
107
+ if (isset($ref[1])) :
108
+ $fwp_path = $ref[1];
109
+ else : // Something went wrong. Let's just guess.
110
+ $fwp_path = 'feedwordpress';
111
+ endif;
112
 
113
  if (!FeedWordPress::needs_upgrade()) : // only work if the conditions are safe!
114
 
166
 
167
  # Cron-less auto-update. Hooray!
168
  add_action('init', 'feedwordpress_auto_update');
169
+
170
+ # Default sanitizers
171
+ add_filter('syndicated_item_content', array('SyndicatedPost', 'sanitize_content'), 0, 2);
172
+
173
  else :
174
  # Hook in the menus, which will just point to the upgrade interface
175
  add_action('admin_menu', 'fwp_add_pages');
285
  return $id;
286
  }
287
  }
288
+
289
+ function fwp_category_checklist ($post_id = 0, $descendents_and_self = 0, $selected_cats = false) {
290
+ if (function_exists('wp_category_checklist')) :
291
+ wp_category_checklist($post_id, $descendents_and_self, $selected_cats);
292
+ else :
293
+ global $checked_categories;
294
+
295
+ // selected_cats is an array of integer cat_IDs / term_ids for
296
+ // the categories that should be checked
297
+ $cats = array();
298
+ if ($post_id) : $cats = wp_get_post_categories($post_id);
299
+ else : $cats = $selected_cats;
300
+ endif;
301
+
302
+ $checked_categories = $cats;
303
+ dropdown_categories();
304
+ endif;
305
+ }
306
  ################################################################################
307
  ## TEMPLATE API: functions to make your templates syndication-aware ############
308
  ################################################################################
439
 
440
  function fwp_add_pages () {
441
  global $legacy_capability_hack;
442
+ global $fwp_path;
443
 
444
  if ($legacy_capability_hack) :
445
  // old & busted: numeric user levels
452
  endif;
453
 
454
  //add_submenu_page('plugins.php', 'Akismet Configuration', 'Akismet Configuration', 'manage_options', 'syndication-manage-page', 'fwp_syndication_manage_page');
455
+ add_menu_page('Syndicated Sites', 'Syndication', $manage_links, $fwp_path.'/'.basename(__FILE__), 'fwp_syndication_manage_page');
456
+ add_submenu_page($fwp_path.'/'.basename(__FILE__), 'Syndication Options', 'Options', $manage_options, $fwp_path.'/syndication-options.php');
457
+ add_options_page('Syndication Options', 'Syndication', $manage_options, $fwp_path.'/syndication-options.php');
458
  } // function fwp_add_pages () */
459
 
460
+ function fwp_linkedit_single_submit ($status = NULL) {
461
  global $wp_db_version;
462
+ if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) :
463
+ ?>
464
+ <div class="submitbox" id="submitlink">
465
+ <div id="previewview"></div>
466
+ <div class="inside">
467
+ <?php if (!is_null($status)) : ?>
468
+ <p><strong>Publication</strong></p>
469
+ <p>When a new post is syndicated from this feed...</p>
470
+ <select name="feed_post_status">
471
+ <option value="site-default" <?php echo $status['post']['site-default']; ?>> Use
472
+ Syndication Options setting</option>
473
+ <option value="publish" <?php echo $status['post']['publish']; ?>>Publish it immediately</option>
474
+
475
+ <?php if (SyndicatedPost::use_api('post_status_pending')) : ?>
476
+ <option value="pending" <?php echo $status['post']['pending']; ?>>Hold it Pending Review</option>
477
+ <?php endif; ?>
478
+
479
+ <option value="draft" <?php echo $status['post']['draft']; ?>>Save it as a draft</option>
480
+ <option value="private" <?php echo $status['post']['private']; ?>>Keep it private</option>
481
+ </select>
482
+ <?php endif; ?>
483
+ </div>
484
 
485
+ <p class="submit">
486
+ <input type="submit" name="submit" value="<?php _e('Save') ?>" />
487
+ </p>
488
+ </div>
489
+ <?php
490
+ endif;
491
+ }
492
+
493
+ function fwp_linkedit_periodic_submit ($caption = NULL) {
494
+ global $wp_db_version;
495
+ if (!(isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25)) :
496
+ if (is_null($caption)) : $caption = __('Save Changes &raquo;'); endif;
497
+ ?>
498
+ <p class="submit">
499
+ <input type="submit" name="submit" value="<?php print $caption; ?>" />
500
+ </p>
501
+ <?php
502
+ endif;
503
+ }
504
+
505
+ function fwp_option_box_opener ($legend, $id, $class = "stuffbox") {
506
+ global $wp_db_version;
507
+ if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) :
508
+ ?>
509
+ <div id="<?php print $id; ?>" class="<?php print $class; ?>">
510
+ <h3><?php print htmlspecialchars($legend); ?></h3>
511
+ <div class="inside">
512
+ <?php
513
+ else :
514
+ ?>
515
+ <fieldset class="options"><legend><?php print htmlspecialchars($legend); ?></legend>
516
+ <?php
517
+ endif;
518
+ }
519
+
520
+ function fwp_option_box_closer () {
521
+ global $wp_db_version;
522
+ if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) :
523
+ ?>
524
+ </div> <!-- class="inside" -->
525
+ </div> <!-- class="stuffbox" -->
526
+ <?php
527
+ else :
528
+ ?>
529
+ </fieldset>
530
+ <?php
531
+ endif;
532
+ }
533
+
534
+ function fwp_tags_box ($tags) {
535
+ if (!is_array($tags)) : $tags = array(); endif;
536
+ ?>
537
+ <div id="tagsdiv" class="postbox">
538
+ <h3><?php _e('Tags') ?></h3>
539
+ <p style="font-size:smaller;font-style:bold;margin:0">Place <?php print $object; ?> under...</p>
540
+ <div class="inside">
541
+ <p id="jaxtag"><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo implode(",", $tags); ?>" /></p>
542
+ <div id="tagchecklist"></div>
543
+ </div>
544
+ </div>
545
+ <?php
546
+ }
547
+
548
+ function fwp_category_box ($checked, $object, $tags = array()) {
549
+ global $wp_db_version;
550
+
551
+ if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) : // WordPress 2.5.x
552
+ ?>
553
+ <div id="category-adder" class="wp-hidden-children">
554
+ <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
555
+ <p id="category-add" class="wp-hidden-child">
556
+ <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" />
557
+ <?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
558
+ <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" />
559
+ <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
560
+ <span id="category-ajax-response"></span>
561
+ </p>
562
+ </div>
563
+
564
+ <ul id="category-tabs">
565
+ <li class="ui-tabs-selected"><a href="#categories-all" tabindex="3"><?php _e( 'All posts' ); ?></a>
566
+ <p style="font-size:smaller;font-style:bold;margin:0">Give <?php print $object; ?> these categories</p>
567
+ </li>
568
+ </ul>
569
+
570
+ <div id="categories-all" class="ui-tabs-panel">
571
+ <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
572
+ <?php fwp_category_checklist(NULL, false, $checked) ?>
573
+ </ul>
574
+ </div>
575
+ <?php
576
+ elseif (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_20) : // WordPress 2.x
577
  ?>
 
 
578
  <div id="moremeta">
579
  <div id="grabit" class="dbx-group">
580
  <fieldset id="categorydiv" class="dbx-box">
582
  <div class="dbx-content">
583
  <p style="font-size:smaller;font-style:bold;margin:0">Place <?php print $object; ?> under...</p>
584
  <p id="jaxcat"></p>
585
+ <ul id="categorychecklist"><?php fwp_category_checklist(NULL, false, $checked); ?></ul></div>
586
  </fieldset>
587
  </div>
588
  </div>
 
589
  <?php
590
  else : // WordPress 1.5
591
  ?>
592
  <fieldset id="categorydiv" style="width: 20%; margin-right: 2em">
593
  <legend><?php _e('Categories') ?></legend>
594
  <p style="font-size:smaller;font-style:bold;margin:0">Place <?php print $object; ?> under...</p>
595
+ <div style="height: 20em"><?php fwp_category_checklist(NULL, false, $checked); ?></div>
596
  </fieldset>
597
  <?php
598
  endif;
693
  <p><strong>Note:</strong> Automatic updates are currently turned
694
  <strong>off</strong>. New posts from your feeds will not be syndicated
695
  until you manually check for them here. You can turn on automatic
696
+ updates under <a href="admin.php?page=<?php print $GLOBALS['fwp_path']; ?>/syndication-options.php">Syndication
697
  Options</a>.</p>
698
  <?php endif; ?>
699
 
702
  </form>
703
  </div> <!-- class="wrap" -->
704
 
705
+ <form action="admin.php?page=<?php print $GLOBALS['fwp_path']; ?>/<?php echo basename(__FILE__); ?>" method="post">
706
  <div class="wrap">
707
  <h2>Syndicated Sites</h2>
708
  <?php $alt_row = true;
743
  <?php
744
  endif;
745
  ?>
746
+ <td><a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>&amp;link_id=<?php echo $link->link_id; ?>&amp;action=linkedit" class="edit"><?php _e('Edit')?></a></td>
747
+ <td><a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>&amp;link_id=<?php echo $link->link_id; ?>&amp;action=feedfinder" class="edit"><?php echo $caption; ?></a></td>
748
+ <td><a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>&amp;link_id=<?php echo $link->link_id; ?>&amp;action=Unsubscribe" class="delete"><?php _e('Unsubscribe'); ?></a></td>
749
  <td><input type="checkbox" name="link_ids[]" value="<?php echo $link->link_id; ?>" /></td>
750
  <?php
751
  echo "\n\t</tr>";
765
  </form>
766
 
767
  <div class="wrap">
768
+ <form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post">
769
  <h2>Add a new syndicated site:</h2>
770
  <div>
771
  <label for="add-uri">Website or newsfeed:</label>
812
  $feed_title = isset($rss->channel['title'])?$rss->channel['title']:$rss->channel['link'];
813
  $feed_link = isset($rss->channel['link'])?$rss->channel['link']:'';
814
  ?>
815
+ <form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post">
816
  <fieldset style="clear: both">
817
  <legend><?php echo $rss->feed_type; ?> <?php echo $rss->feed_version; ?> feed</legend>
818
 
865
  ?>
866
  </div>
867
 
868
+ <form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post">
869
  <div class="wrap">
870
  <h2>Use another feed</h2>
871
  <div><label>Feed:</label>
920
  }
921
 
922
  function fwp_linkedit_page () {
923
+ global $wpdb, $wp_db_version;
924
 
925
  check_admin_referer(); // Make sure we arrived here from the Dashboard
926
 
935
  'comment status',
936
  'ping status',
937
  'unfamiliar author',
938
+ 'unfamliar categories', /* Deprecated */
939
+ 'unfamiliar category',
940
  'map authors',
941
+ 'tags',
942
  'update/.*',
943
  'feed/.*',
944
  'link/.*',
1017
  unset($meta['cats']);
1018
  endif;
1019
 
1020
+ // Tags
1021
+ if (isset($GLOBALS['fwp_post']['tags_input'])) :
1022
+ $meta['tags'] = array();
1023
+ foreach (explode(',', $GLOBALS['fwp_post']['tags_input']) as $tag) :
1024
+ $meta['tags'][] = trim($tag);
1025
+ endforeach;
1026
+ endif;
1027
+
1028
  // Post status, comment status, ping status
1029
  foreach (array('post', 'comment', 'ping') as $what) :
1030
  $sfield = "feed_{$what}_status";
1155
  if (is_array($meta['cats'])) :
1156
  $meta['cats'] = implode(FEEDWORDPRESS_CAT_SEPARATOR, $meta['cats']);
1157
  endif;
1158
+ if (is_array($meta['tags'])) :
1159
+ $meta['tags'] = implode(FEEDWORDPRESS_CAT_SEPARATOR, $meta['tags']);
1160
+ endif;
1161
 
1162
  // Collapse the author mapping rule structure back into a flat string
1163
  if (isset($meta['map authors'])) :
1205
  $ping_status_global = get_option('feedwordpress_syndicated_ping_status');
1206
 
1207
  $status['post'] = array('publish' => '', 'private' => '', 'draft' => '', 'site-default' => '');
1208
+ if (SyndicatedPost::use_api('post_status_pending')) :
1209
+ $status['post']['pending'] = '';
1210
+ endif;
1211
+
1212
  $status['comment'] = array('open' => '', 'closed' => '', 'site-default' => '');
1213
  $status['ping'] = array('open' => '', 'closed' => '', 'site-default' => '');
1214
 
1233
  $unfamiliar[$what][$key] = ' checked="checked"';
1234
  endforeach;
1235
 
1236
+ if (is_array($meta['cats'])) : $cats = $meta['cats'];
1237
+ else : $cats = array();
 
 
 
 
 
 
1238
  endif;
 
 
 
 
 
 
1239
 
1240
+ $dogs = SyndicatedPost::category_ids($cats, /*unfamiliar=*/ NULL);
 
 
 
1241
  else :
1242
  die( __('Link not found.') );
1243
  endif;
1275
  <div class="updated"><p>Syndicated feed settings updated.</p></div>
1276
  <?php endif; ?>
1277
 
1278
+ <form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post">
1279
  <div class="wrap">
1280
  <input type="hidden" name="link_id" value="<?php echo $link_id; ?>" />
1281
  <input type="hidden" name="action" value="linkedit" />
1282
  <input type="hidden" name="save" value="link" />
1283
 
1284
  <h2>Edit a syndicated feed:</h2>
1285
+ <div id="poststuff">
1286
+ <?php fwp_linkedit_single_submit($status); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1287
 
1288
+ <div id="post-body">
1289
+ <?php fwp_option_box_opener('Feed Information', 'feedinformationdiv'); ?>
1290
+ <table class="editform" width="100%" cellspacing="2" cellpadding="5">
1291
+ <tr>
1292
+ <th scope="row" width="20%"><?php _e('Feed URI:') ?></th>
1293
+ <td width="60%"><a href="<?php echo wp_specialchars($link_rss_uri, 'both'); ?>"><?php echo $link_rss_uri; ?></a>
1294
+ (<a href="<?php echo FEEDVALIDATOR_URI; ?>?url=<?php echo urlencode($link_rss_uri); ?>"
1295
+ title="Check feed &lt;<?php echo wp_specialchars($link_rss_uri, 'both'); ?>&gt; for validity">validate</a>)
1296
+ </td>
1297
+ <td width="20%"><input type="submit" name="feedfinder" value="switch &rarr;" style="font-size:smaller" /></td>
1298
+ </tr>
1299
+ <tr>
1300
+ <th scope="row" width="20%"><?php _e('Link Name:') ?></th>
1301
+ <td width="60%"><input type="text" id="basics-name-edit" name="name"
1302
+ value="<?php echo $link_name; ?>" style="width: 95%" />
1303
+ <span id="basics-name-view"><strong><?php echo $link_name; ?></strong></span>
1304
+ </td>
1305
+ <td>
1306
+ <select id="basics-hardcode-name" onchange="flip_hardcode('name')" name="hardcode_name">
1307
+ <option value="no" <?php echo $link->hardcode('name')?'':'selected="selected"'; ?>>update automatically</option>
1308
+ <option value="yes" <?php echo $link->hardcode('name')?'selected="selected"':''; ?>>edit manually</option>
1309
+ </select>
1310
+ </td>
1311
+ </tr>
1312
+ <tr>
1313
+ <th scope="row" width="20%"><?php _e('Short description:') ?></th>
1314
+ <td width="60%">
1315
+ <input id="basics-description-edit" type="text" name="description" value="<?php echo $link_description; ?>" style="width: 95%" />
1316
+ <span id="basics-description-view"><strong><?php echo $link_description; ?></strong></span>
1317
+ </td>
1318
+ <td>
1319
+ <select id="basics-hardcode-description" onchange="flip_hardcode('description')"
1320
+ name="hardcode_description">
1321
+ <option value="no" <?php echo $link->hardcode('description')?'':'selected="selected"'; ?>>update automatically</option>
1322
+ <option value="yes" <?php echo $link->hardcode('description')?'selected="selected"':''; ?>>edit manually</option>
1323
+ </select></td>
1324
+ </tr>
1325
+ <tr>
1326
+ <th width="20%" scope="row"><?php _e('Homepage:') ?></th>
1327
+ <td width="60%">
1328
+ <input id="basics-url-edit" type="text" name="linkurl" value="<?php echo $link_url; ?>" style="width: 95%;" />
1329
+ <a id="basics-url-view" href="<?php echo $link_url; ?>"><?php echo $link_url; ?></a></td>
1330
+ <td>
1331
+ <select id="basics-hardcode-url" onchange="flip_hardcode('url')" name="hardcode_url">
1332
+ <option value="no"<?php echo $link->hardcode('url')?'':' selected="selected"'; ?>>update automatically</option>
1333
+ <option value="yes"<?php echo $link->hardcode('url')?' selected="selected"':''; ?>>edit manually</option>
1334
+ </select></td></tr>
1335
+
1336
+ <tr>
1337
+ <th width="20%"><?php _e('Last update') ?>:</th>
1338
+ <td colspan="2"><?php
1339
+ if (isset($meta['update/last'])) :
1340
+ echo strftime('%x %X', $meta['update/last'])." ";
1341
  else :
1342
+ echo " none yet";
1343
  endif;
1344
+ ?></td></tr>
1345
+ <tr><th width="20%">Next update:</th>
1346
+ <td colspan="2"><?php
1347
+ $holdem = (isset($meta['update/hold']) ? $meta['update/hold'] : 'scheduled');
1348
+ ?>
1349
+ <select name="update_schedule">
1350
+ <option value="scheduled"<?php echo ($holdem=='scheduled')?' selected="selected"':''; ?>>update on schedule <?php
1351
+ echo " (";
1352
+ if (isset($meta['update/ttl']) and is_numeric($meta['update/ttl'])) :
1353
+ if (isset($meta['update/timed']) and $meta['update/timed']=='automatically') :
1354
+ echo 'next: ';
1355
+ $next = $meta['update/last'] + ((int) $meta['update/ttl'] * 60);
1356
+ if (strftime('%x', time()) != strftime('%x', $next)) :
1357
+ echo strftime('%x', $next)." ";
1358
+ endif;
1359
+ echo strftime('%X', $meta['update/last']+((int) $meta['update/ttl']*60));
1360
+ else :
1361
+ echo "every ".$meta['update/ttl']." minute".(($meta['update/ttl']!=1)?"s":"");
1362
+ endif;
1363
+ else:
1364
+ echo "next scheduled update";
1365
+ endif;
1366
+ echo ")";
1367
+ ?></option>
1368
+ <option value="next"<?php echo ($holdem=='next')?' selected="selected"':''; ?>>update ASAP</option>
1369
+ <option value="ping"<?php echo ($holdem=='ping')?' selected="selected"':''; ?>>update only when pinged</option>
1370
+ </select></tr>
1371
+ </table>
1372
+ <?php fwp_option_box_closer(); ?>
1373
 
1374
  <script type="text/javascript">
1375
  flip_hardcode('name');
1377
  flip_hardcode('url');
1378
  </script>
1379
 
1380
+ <?php fwp_linkedit_periodic_submit(); ?>
 
 
 
 
 
 
 
1381
 
1382
+ <?php
1383
+ if (!(isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25)) :
1384
+ fwp_option_box_opener('Syndicated Posts', 'syndicatedpostsdiv', 'postbox');
1385
+ ?>
1386
  <table class="editform" width="75%" cellspacing="2" cellpadding="5">
1387
  <tr><th width="27%" scope="row" style="vertical-align:top">Publication:</th>
1388
  <td width="73%" style="vertical-align:top"><ul style="margin:0; list-style:none">
1389
  <li><label><input type="radio" name="feed_post_status" value="site-default"
1390
+ <?php echo $status['post']['site-default']; ?> /> Use site-wide setting from <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/syndication-options.php">Syndication Options</a>
1391
  (currently: <strong><?php echo ($post_status_global ? $post_status_global : 'publish'); ?></strong>)</label></li>
1392
  <li><label><input type="radio" name="feed_post_status" value="publish"
1393
  <?php echo $status['post']['publish']; ?> /> Publish posts from this feed immediately</label></li>
1394
+
1395
+ <?php if (SyndicatedPost::use_api('post_status_pending')) : ?>
1396
+ <li><label><input type="radio" name="feed_post_status" value="pending"
1397
+ <?php echo $status['post']['pending']; ?>/> Hold posts from this feed for review; mark as Pending</label></li>
1398
+ <?php endif; ?>
1399
+
1400
  <li><label><input type="radio" name="feed_post_status" value="draft"
1401
+ <?php echo $status['post']['draft']; ?> /> Save posts from this feed as drafts</label></li>
1402
+ <li><label><input type="radio" name="feed_post_status" value="private"
1403
+ <?php echo $status['post']['private']; ?> /> Save posts from this feed as private posts</label></li>
1404
  </ul></td>
1405
  </tr>
1406
+ </table>
1407
+ <?php
1408
+ fwp_option_box_closer();
1409
+ fwp_linkedit_periodic_submit();
1410
+ endif;
1411
 
1412
+ fwp_option_box_opener(__('Categories'), 'categorydiv', 'postbox');
1413
+ fwp_category_box($dogs, 'all syndicated posts from this feed');
1414
+ ?>
1415
+ <table>
1416
+ <tr>
1417
+ <th width="20%" scope="row" style="vertical-align:top">Unfamiliar categories:</th>
1418
+ <td width="80%"><ul style="margin: 0; list-style:none">
1419
+ <li><label><input type="radio" name="unfamiliar_category" value="site-default"<?php echo $unfamiliar['category']['site-default']; ?> /> use site-wide setting from <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/syndication-options.php">Syndication Options</a>
1420
+ (currently <strong><?php echo FeedWordPress::on_unfamiliar('category'); ?></strong>)</label></li>
1421
+ <li><label><input type="radio" name="unfamiliar_category" value="create"<?php echo $unfamiliar['category']['create']; ?> /> create any categories the post is in</label></li>
1422
+ <li><label><input type="radio" name="unfamiliar_category" value="default"<?php echo $unfamiliar['category']['default']; ?> /> don't create new categories</label></li>
1423
+ <li><label><input type="radio" name="unfamiliar_category" value="filter"<?php echo $unfamiliar['category']['filter']; ?> /> don't create new categories and don't syndicate posts unless they match at least one familiar category</label></li>
1424
  </ul></td>
1425
  </tr>
1426
 
1427
+ <tr>
1428
+ <th width="20%" scope="row" style="vertical-align:top">Multiple categories:</th>
1429
+ <td width="80%">
1430
+ <input type="text" size="20" id="cat_split" name="cat_split" value="<?php if (isset($meta['cat_split'])) : echo htmlspecialchars($meta['cat_split']); endif; ?>" /><br/>
1431
+ Enter a <a href="http://us.php.net/manual/en/reference.pcre.pattern.syntax.php">Perl-compatible regular expression</a> here if the feed provides multiple
1432
+ categories in a single category element. The regular expression should match
1433
+ the characters used to separate one category from the next. If the feed uses
1434
+ spaces (like <a href="http://del.icio.us/">del.icio.us</a>), use the pattern "\s".
1435
+ If the feed does not provide multiple categories in a single element, leave this
1436
+ blank.</td>
1437
  </tr>
1438
  </table>
1439
+ <?php
1440
+ fwp_option_box_closer();
1441
+ fwp_linkedit_periodic_submit();
1442
+
1443
+ if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) :
1444
+ fwp_tags_box($meta['tags']);
1445
+ fwp_linkedit_periodic_submit();
1446
+ endif; ?>
1447
 
1448
+ <?php fwp_option_box_opener('Syndicated Authors', 'authordiv', 'postbox'); ?>
 
1449
  <?php $authorlist = fwp_author_list(); ?>
 
1450
  <table>
1451
+ <tr><th colspan="3" style="text-align: left; padding-top: 1.0em; border-bottom: 1px dotted black;">For posts by authors that haven't been syndicated before:</th></tr>
1452
+ <tr>
1453
+ <th style="text-align: left">Posts by new authors</th>
1454
+ <td>
1455
+ <select id="unfamiliar-author" name="unfamiliar_author" onchange="flip_newuser('unfamiliar-author');">
1456
+ <option value="site-default"<?php if (!isset($meta['unfamiliar author'])) : ?>selected="selected"<?php endif; ?>>are handled using site-wide settings</option>
1457
+ <option value="create"<?php if ('create'==$meta['unfamiliar author']) : ?>selected="selected"<?php endif; ?>>create a new author account</option>
1458
+ <?php foreach ($authorlist as $author_id => $author_name) : ?>
1459
+ <option value="<?php echo $author_id; ?>"<?php if ($author_id==$meta['unfamiliar author']) : ?>selected="selected"<?php endif; ?>>are assigned to <?php echo $author_name; ?></option>
1460
+ <?php endforeach; ?>
1461
+ <option value="newuser">will be assigned to a new user...</option>
1462
+ <option value="filter"<?php if ('filter'==$meta['unfamiliar author']) : ?>selected="selected"<?php endif; ?>>get filtered out</option>
1463
+ </select>
1464
+ </td>
1465
+ <td>
1466
+ <div id="unfamiliar-author-default">Site-wide settings can be set in <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/syndication-options.php">Syndication Options</a></div>
1467
+ <div id="unfamiliar-author-newuser">named <input type="text" name="unfamiliar_author_newuser" value="" /></div>
1468
+ </td>
1469
+ </tr>
1470
+
1471
  <tr><th colspan="3" style="text-align: left; padding-top: 1.0em; border-bottom: 1px dotted black;">For posts by specific authors. Blank out a name to delete the rule.</th></tr>
1472
 
1473
  <?php if (isset($meta['map authors'])) : $i=0; foreach ($meta['map authors'] as $author_rules) : foreach ($author_rules as $author_name => $author_action) : $i++; ?>
1502
  <td><div id="add-author-rule-newuser">named <input type="text" name="add_author_rule_newuser" value="" /></div></td>
1503
  </tr>
1504
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1505
  </table>
1506
+ <?php fwp_option_box_closer(); ?>
1507
 
1508
  <script>
1509
  flip_newuser('unfamiliar-author');
1513
  flip_newuser('add-author-rule');
1514
  </script>
1515
 
1516
+ <?php
1517
+ fwp_linkedit_periodic_submit();
1518
+ fwp_option_box_opener('Comments & Pings', 'commentstatusdiv', 'postbox');
1519
+ ?>
1520
+ <table class="editform" width="75%" cellspacing="2" cellpadding="5">
1521
+ <tr><th width="27%" scope="row" style="vertical-align:top"><?php print __('Comments'); ?>:</th>
1522
+ <td width="73%"><ul style="margin:0; list-style:none">
1523
+ <li><label><input type="radio" name="feed_comment_status" value="site-default"
1524
+ <?php echo $status['comment']['site-default']; ?> /> Use site-wide setting from <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/syndication-options.php">Syndication Options</a>
1525
+ (currently: <strong><?php echo ($comment_status_global ? $comment_status_global : 'closed'); ?>)</strong></label></li>
1526
+ <li><label><input type="radio" name="feed_comment_status" value="open"
1527
+ <?php echo $status['comment']['open']; ?> /> Allow comments on syndicated posts from this feed</label></li>
1528
+ <li><label><input type="radio" name="feed_comment_status" value="closed"
1529
+ <?php echo $status['comment']['closed']; ?> /> Don't allow comments on syndicated posts from this feed</label></li>
1530
+ </ul></td></tr>
1531
 
1532
+ <tr><th width="27%" scope="row" style="vertical-align:top"><?php print __('Pings'); ?>:</th>
1533
+ <td width="73%"><ul style="margin:0; list-style:none">
1534
+ <li><label><input type="radio" name="feed_ping_status" value="site-default"
1535
+ <?php echo $status['ping']['site-default']; ?> /> Use site-wide setting from <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/syndication-options.php">Syndication Options</a>
1536
+ (currently: <strong><?php echo ($ping_status_global ? $ping_status_global : 'closed'); ?>)</strong></label></li>
1537
+ <li><label><input type="radio" name="feed_ping_status" value="open"
1538
+ <?php echo $status['ping']['open']; ?> /> Accept pings on syndicated posts from this feed</label></li>
1539
+ <li><label><input type="radio" name="feed_ping_status" value="closed"
1540
+ <?php echo $status['ping']['closed']; ?> /> Don't accept pings on syndicated posts from this feed</label></li>
1541
+ </ul></td></tr>
1542
 
 
 
 
 
 
 
 
 
 
 
 
1543
  </table>
1544
+ <?php fwp_option_box_closer(); ?>
1545
+ <?php fwp_linkedit_periodic_submit(); ?>
1546
 
1547
+ <?php fwp_option_box_opener('Custom Settings (for use in templates)', 'postcustom', 'postbox'); ?>
 
 
 
 
 
1548
  <div id="postcustomstuff">
1549
  <table id="meta-list" cellpadding="3">
1550
  <tr>
1578
  <td><em>add new setting...</em><input type="hidden" name="notes[<?php echo $i; ?>][action]" value="update" /></td>
1579
  </tr>
1580
  </table>
1581
+ <?php fwp_option_box_closer(); ?>
 
 
 
 
1582
 
1583
+ <?php fwp_linkedit_periodic_submit(); ?>
1584
+ </div> <!-- id="post-body" -->
1585
+ </div> <!-- id="poststuff" -->
1586
  </div>
1587
  <?php
1588
  endif;
1693
  WHERE link_id IN (".implode(",",$link_ids).")
1694
  ");
1695
  ?>
1696
+ <form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post">
1697
  <div class="wrap">
1698
  <input type="hidden" name="action" value="Unsubscribe" />
1699
  <input type="hidden" name="confirm" value="Delete" />
2230
  var $_freshness = null;
2231
  var $_wp_id = null;
2232
 
 
 
 
 
 
2233
  function SyndicatedPost ($item, $link) {
2234
  global $wpdb;
2235
 
2262
  # of insertion, not here, to avoid double-escaping and
2263
  # to avoid screwing with syndicated_post filters
2264
 
2265
+ $this->post['post_title'] = apply_filters('syndicated_item_title', $this->item['title'], $this);
2266
 
2267
+ // This just gives us an alphanumeric representation of
2268
  // the author. We will look up (or create) the numeric
2269
  // ID for the author in SyndicatedPost::add()
2270
+ $this->post['named']['author'] = apply_filters('syndicated_item_author', $this->author(), $this);
2271
 
2272
  # Identify content and sanitize it.
2273
  # ---------------------------------
2280
  else:
2281
  $content = $this->item['description'];
2282
  endif;
2283
+ $this->post['post_content'] = apply_filters('syndicated_item_content', $content, $this);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2284
 
2285
  # Identify and sanitize excerpt
2286
  $excerpt = NULL;
2292
  $excerpt = substr($excerpt,0,252).'...';
2293
  endif;
2294
  endif;
2295
+ $excerpt = apply_filters('syndicated_item_excerpt', $excerpt, $this);
2296
 
 
 
2297
  if (!is_null($excerpt)):
2298
  $this->post['post_excerpt'] = $excerpt;
2299
  endif;
2303
  $this->post['post_name'] = sanitize_title($this->post['post_title']);
2304
  endif;
2305
 
2306
+ $this->post['epoch']['issued'] = apply_filters('syndicated_item_published', $this->published(), $this);
2307
+ $this->post['epoch']['created'] = apply_filters('syndicated_item_created', $this->created(), $this);
2308
+ $this->post['epoch']['modified'] = apply_filters('syndicated_item_updated', $this->updated(), $this);
2309
 
2310
  // Dealing with timestamps in WordPress is so fucking fucked.
2311
  $offset = (int) get_option('gmt_offset') * 60 * 60;
2320
  $this->post['ping_status'] = $this->link->syndicated_status('ping', 'closed');
2321
 
2322
  // Unique ID (hopefully a unique tag: URI); failing that, the permalink
2323
+ $this->post['guid'] = apply_filters('syndicated_item_guid', $this->guid(), $this);
2324
 
2325
  // RSS 2.0 / Atom 1.0 enclosure support
2326
  if ( isset($this->item['enclosure#']) ) :
2327
  for ($i = 1; $i <= $this->item['enclosure#']; $i++) :
2328
  $eid = (($i > 1) ? "#{$id}" : "");
2329
  $this->post['meta']['enclosure'][] =
2330
+ apply_filters('syndicated_item_enclosure_url', $this->item["enclosure{$eid}@url"], $this)."\n".
2331
+ apply_filters('syndicated_item_enclosure_length', $this->item["enclosure{$eid}@length"], $this)."\n".
2332
+ apply_filters('syndicated_item_enclosure_type', $this->item["enclosure{$eid}@type"], $this);
2333
  endfor;
2334
  endif;
2335
 
2336
  // In case you want to point back to the blog this was syndicated from
2337
  if (isset($this->feed->channel['title'])) :
2338
+ $this->post['meta']['syndication_source'] = apply_filters('syndicated_item_source_title', $this->feed->channel['title'], $this);
2339
  endif;
2340
  if (isset($this->feed->channel['link'])) :
2341
+ $this->post['meta']['syndication_source_uri'] = apply_filters('syndicated_item_source_link', $this->feed->channel['link'], $this);
2342
  endif;
2343
 
2344
  // Store information on human-readable and machine-readable comment URIs
2345
  if (isset($this->item['comments'])) :
2346
+ $this->post['meta']['rss:comments'] = apply_filters('syndicated_item_comments', $this->item['comments']);
2347
  endif;
2348
  if (isset($this->item['wfw']['commentrss'])) :
2349
+ $this->post['meta']['wfw:commentRSS'] = apply_filters('syndicated_item_commentrss', $this->item['wfw']['commentrss']);
2350
  endif;
2351
 
2352
  // Store information to identify the feed that this came from
2354
  $this->post['meta']['syndication_feed_id'] = $this->feedmeta['link/id'];
2355
 
2356
  // In case you want to know the external permalink...
2357
+ $this->post['meta']['syndication_permalink'] = apply_filters('syndicated_item_link', $this->item['link']);
2358
 
2359
  // Feed-by-feed options for author and category creation
2360
  $this->post['named']['unfamiliar']['author'] = $this->feedmeta['unfamiliar author'];
2361
+ $this->post['named']['unfamiliar']['category'] = $this->feedmeta['unfamiliar category'];
2362
 
2363
  // Categories: start with default categories, if any
2364
  $fc = get_option("feedwordpress_syndication_cats");
2387
  endif;
2388
  endfor;
2389
  endif;
2390
+ $this->post['named']['category'] = apply_filters('syndicated_item_categories', $this->post['named']['category'], $this);
2391
+
2392
+ // Tags: start with default tags, if any
2393
+ $ft = get_option("feedwordpress_syndication_tags");
2394
+ if ($ft) :
2395
+ $this->post['tags_input'] = explode('FEEDWORDPRESS_CAT_SEPARATOR', $ft);
2396
+ else :
2397
+ $this->post['tags_input'] = array();
2398
+ endif;
2399
+
2400
+ if (is_array($this->feedmeta['tags'])) :
2401
+ $this->post['tags_input'] = array_merge($this->post['tags_input'], $this->feedmeta['tags']);
2402
+ endif;
2403
  endif;
2404
  } // SyndicatedPost::SyndicatedPost()
2405
 
2531
  endif;
2532
  endforeach;
2533
 
2534
+ if (strlen($dbpost['post_title'].$dbpost['post_content'].$dbpost['post_excerpt']) == 0) :
2535
+ // FIXME: Option for filtering out empty posts
2536
+ endif;
2537
+ if (strlen($dbpost['post_title'])==0) :
2538
+ $dbpost['post_title'] = $this->post['meta']['syndication_source']
2539
+ .' '.gmdate('Y-m-d H:i:s', $this->published() + $offset);
2540
+ // FIXME: Option for what to fill a blank title with...
2541
+ endif;
2542
+
2543
  if ($this->use_api('wp_insert_post')) :
2544
  $dbpost['post_pingback'] = false; // Tell WP 2.1 and 2.2 not to process for pingbacks
2545
  $this->_wp_id = wp_insert_post($dbpost);
2546
 
2547
  // This should never happen.
2548
  if (!is_numeric($this->_wp_id) or ($this->_wp_id == 0)) :
2549
+ FeedWordPress::critical_bug('SyndicatedPost (_wp_id problem)', array($dbpost, $this), __LINE__);
2550
  endif;
2551
 
2552
  // Unfortunately, as of WordPress 2.3, wp_insert_post()
2942
 
2943
  function use_api ($tag) {
2944
  global $wp_db_version;
2945
+ switch ($tag) :
2946
+ case 'wp_insert_post':
2947
  // Before 2.2, wp_insert_post does too much of the wrong stuff to use it
2948
  // In 1.5 it was such a resource hog it would make PHP segfault on big updates
2949
  $ret = (isset($wp_db_version) and $wp_db_version > FWP_SCHEMA_21);
2950
+ break;
2951
+ case 'post_status_pending':
2952
+ $ret = (isset($wp_db_version) and $wp_db_version > FWP_SCHEMA_23);
2953
+ break;
2954
+ endswitch;
2955
  return $ret;
2956
  } // function SyndicatedPost::use_api ()
2957
 
3110
 
3111
  return $author;
3112
  } // SyndicatedPost::author()
3113
+
3114
+ var $strip_attrs = array (
3115
+ array('[a-z]+', 'style'),
3116
+ array('[a-z]+', 'target'),
3117
+ );
3118
+ function sanitize_content ($content, $obj) {
3119
+ # FeedWordPress used to resolve URIs relative to the
3120
+ # feed URI. It now relies on the xml:base support
3121
+ # baked in to the MagpieRSS upgrade. So all we do here
3122
+ # now is to sanitize problematic attributes.
3123
+ #
3124
+ # This kind of sucks. I intend to replace it with
3125
+ # lib_filter sometime soon.
3126
+ foreach ($obj->strip_attrs as $pair):
3127
+ list($tag,$attr) = $pair;
3128
+ $content = preg_replace (
3129
+ ":(<$tag [^>]*)($attr=(\"[^\">]*\"|[^>\\s]+))([^>]*>):i",
3130
+ "\\1\\4",
3131
+ $content
3132
+ );
3133
+ endforeach;
3134
+ return $content;
3135
+ }
3136
  } // class SyndicatedPost
3137
 
3138
  # class SyndicatedLink: represents a syndication feed stored within the
3212
  $this->settings['link/name'] = $this->link->link_name;
3213
  $this->settings['link/id'] = $this->link->link_id;
3214
 
3215
+ // `hardcode categories` and `unfamiliar categories` are deprecated in favor of `unfamiliar category`
3216
+ if (
3217
+ isset($this->settings['unfamiliar categories'])
3218
+ and !isset($this->settings['unfamiliar category'])
3219
+ ) :
3220
+ $this->settings['unfamiliar category'] = $this->settings['unfamiliar categories'];
3221
+ endif;
3222
  if (
3223
  FeedWordPress::affirmative($this->settings, 'hardcode categories')
3224
+ and !isset($this->settings['unfamiliar category'])
3225
  ) :
3226
+ $this->settings['unfamiliar category'] = 'default';
3227
  endif;
3228
+
3229
  // Set this up automagically for del.icio.us
3230
+ $bits = parse_url($this->link->link_rss);
3231
+ $tagspacers = array('del.icio.us', 'feeds.delicious.com');
3232
+ if (!isset($this->settings['cat_split']) and in_array($bits['host'], $tagspacers)) :
3233
  $this->settings['cat_split'] = '\s'; // Whitespace separates multiple tags in del.icio.us RSS feeds
3234
  endif;
3235
 
3236
  if (isset($this->settings['cats'])):
3237
  $this->settings['cats'] = preg_split(FEEDWORDPRESS_CAT_SEPARATOR_PATTERN, $this->settings['cats']);
3238
  endif;
3239
+ if (isset($this->settings['tags'])):
3240
+ $this->settings['tags'] = preg_split(FEEDWORDPRESS_CAT_SEPARATOR_PATTERN, $this->settings['tags']);
3241
+ endif;
3242
 
3243
  if (isset($this->settings['map authors'])) :
3244
  $author_rules = explode("\n\n", $this->settings['map authors']);
3332
  if (is_array($to_notes['cats'])) :
3333
  $to_notes['cats'] = implode(FEEDWORDPRESS_CAT_SEPARATOR, $to_notes['cats']);
3334
  endif;
3335
+ if (is_array($to_notes['tags'])) :
3336
+ $to_notes['tags'] = implode(FEEDWORDPRESS_CAT_SEPARATOR, $to_notes['tags']);
3337
+ endif;
3338
 
3339
  if (isset($to_notes['map authors'])) :
3340
  $ma = array();
3349
  unset($to_notes['link/id']); unset($to_notes['link/uri']);
3350
  unset($to_notes['link/name']);
3351
  unset($to_notes['hardcode categories']); // Deprecated
3352
+ unset($to_notes['unfamiliar categories']); // Deprecated
3353
 
3354
  $notes = '';
3355
  foreach ($to_notes as $key => $value) :
3383
  if (is_array($to_notes['cats'])) :
3384
  $to_notes['cats'] = implode(FEEDWORDPRESS_CAT_SEPARATOR, $to_notes['cats']);
3385
  endif;
3386
+ if (is_array($to_notes['tags'])) :
3387
+ $to_notes['tags'] = implode(FEEDWORDPRESS_CAT_SEPARATOR, $to_notes['tags']);
3388
+ endif;
3389
 
3390
  if (isset($to_notes['map authors'])) :
3391
  $ma = array();
3400
  unset($to_notes['link/id']); unset($to_notes['link/uri']);
3401
  unset($to_notes['link/name']);
3402
  unset($to_notes['hardcode categories']); // Deprecated
3403
+ unset($to_notes['unfamiliar categories']); // Deprecated
3404
 
3405
  $notes = '';
3406
  foreach ($to_notes as $key => $value) :
readme.txt CHANGED
@@ -3,10 +3,10 @@ Contributors: Charles Johnson
3
  Donate link: http://projects.radgeek.com/feedwordpress/
4
  Tags: syndication, aggregation, feed, atom, rss
5
  Requires at least: 1.5
6
- Tested up to: 2.3.1
7
- Stable tag: 0.992
8
 
9
- FeedWordPress is an Atom/RSS aggregator for WordPress. When activated, it syndicates content from feeds you choose into your WordPress weblog.
10
 
11
  == Description ==
12
 
@@ -23,13 +23,14 @@ to use at [Feminist Blogs](http://feministblogs.org/).
23
 
24
  FeedWordPress is designed with flexibility, ease of use, and ease of
25
  configuration in mind. You'll need a working installation of WordPress or
26
- WordPress MU (versions [2.3][], [2.2][], [2.1][], [2.0][] or [1.5][]), and also
27
- FTP or SFTP access to your web host. The ability to create cron jobs on your web
28
- host is helpful but not absolutely necessary. You *don't* need to tweak any
29
- plain-text configuration files and you *don't* need shell access to your web
30
  host to make it work. (Although, I should point out, web hosts that *don't*
31
  offer shell access are *bad web hosts*.)
32
 
 
33
  [2.3]: http://codex.wordpress.org/Version_2.3
34
  [2.2]: http://codex.wordpress.org/Version_2.2
35
  [2.1]: http://codex.wordpress.org/Version_2.1
@@ -38,7 +39,7 @@ offer shell access are *bad web hosts*.)
38
 
39
  == Installation ==
40
 
41
- To use version 0.992 of FeedWordPress, you will need:
42
 
43
  * an installed and configured copy of WordPress version 2.3.x, 2.2.x,
44
  2.1.x, 2.0.x, or 1.5.x. (FeedWordPress will also work with the
@@ -78,7 +79,7 @@ To use version 0.992 of FeedWordPress, you will need:
78
 
79
  = Upgrades =
80
 
81
- To *upgrade* an existing installation of FeedWordPress to version 0.992:
82
 
83
  1. Download the FeedWordPress archive in zip or gzipped tar format and
84
  extract the files on your computer.
3
  Donate link: http://projects.radgeek.com/feedwordpress/
4
  Tags: syndication, aggregation, feed, atom, rss
5
  Requires at least: 1.5
6
+ Tested up to: 2.5.1
7
+ Stable tag: 0.993
8
 
9
+ FeedWordPress syndicates content from feeds you choose into your WordPress weblog.
10
 
11
  == Description ==
12
 
23
 
24
  FeedWordPress is designed with flexibility, ease of use, and ease of
25
  configuration in mind. You'll need a working installation of WordPress or
26
+ WordPress MU (versions [2.5][], [2.3][], [2.2][], [2.1][], [2.0][] or [1.5][]),
27
+ and also FTP or SFTP access to your web host. The ability to create cron jobs on
28
+ your web host is helpful but not absolutely necessary. You *don't* need to tweak
29
+ any plain-text configuration files and you *don't* need shell access to your web
30
  host to make it work. (Although, I should point out, web hosts that *don't*
31
  offer shell access are *bad web hosts*.)
32
 
33
+ [2.5]: http://codex.wordpress.org/Version_2.5
34
  [2.3]: http://codex.wordpress.org/Version_2.3
35
  [2.2]: http://codex.wordpress.org/Version_2.2
36
  [2.1]: http://codex.wordpress.org/Version_2.1
39
 
40
  == Installation ==
41
 
42
+ To use version 0.993 of FeedWordPress, you will need:
43
 
44
  * an installed and configured copy of WordPress version 2.3.x, 2.2.x,
45
  2.1.x, 2.0.x, or 1.5.x. (FeedWordPress will also work with the
79
 
80
  = Upgrades =
81
 
82
+ To *upgrade* an existing installation of FeedWordPress to version 0.993:
83
 
84
  1. Download the FeedWordPress archive in zip or gzipped tar format and
85
  extract the files on your computer.
syndication-options.php CHANGED
@@ -7,8 +7,7 @@ function fwp_syndication_options_page () {
7
  return;
8
  endif;
9
 
10
- $caption = 'Save Changes';
11
- if (isset($_POST['action']) and $_POST['action']==$caption):
12
  check_admin_referer();
13
 
14
  if (!current_user_can('manage_options')):
@@ -60,11 +59,24 @@ function fwp_syndication_options_page () {
60
  endif;
61
 
62
  if (!empty($cats)) :
63
- update_option('feedwordpress_syndication_cats', implode("\n", $cats));
64
  else :
65
  delete_option('feedwordpress_syndication_cats');
66
  endif;
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  if (isset($_REQUEST['comment_status']) and ($_REQUEST['comment_status'] == 'open')) :
69
  update_option('feedwordpress_syndicated_comment_status', 'open');
70
  else :
@@ -147,23 +159,14 @@ function fwp_syndication_options_page () {
147
  $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
148
  endif;
149
 
150
- $cats = get_option('feedwordpress_syndication_cats');
151
- $dogs = get_nested_categories(-1, 0);
152
- $cats = array_map('strtolower',
153
- array_map('trim',
154
- preg_split(FEEDWORDPRESS_CAT_SEPARATOR_PATTERN, $cats)
155
- ));
156
-
157
- foreach ($dogs as $tag => $dog) :
158
- $found_by_name = in_array(strtolower(trim($dog['cat_name'])), $cats);
159
- if (isset($dog['cat_ID'])) : $dog['cat_id'] = $dog['cat_ID']; endif;
160
- $found_by_id = in_array('{#'.trim($dog['cat_id']).'}', $cats);
161
-
162
- if ($found_by_name or $found_by_id) :
163
- $dogs[$tag]['checked'] = true;
164
- endif;
165
- endforeach;
166
 
 
 
 
167
  ?>
168
  <script type="text/javascript">
169
  function flip_newuser (item) {
@@ -184,9 +187,11 @@ function fwp_syndication_options_page () {
184
 
185
  <div class="wrap">
186
  <h2>Syndication Options</h2>
 
187
  <form action="" method="post">
188
- <fieldset class="options">
189
- <legend>Syndicated Feeds</legend>
 
190
  <table class="editform" width="100%" cellspacing="2" cellpadding="5">
191
  <tr>
192
  <th width="33%" scope="row">Syndicated Link category:</th>
@@ -224,57 +229,76 @@ function fwp_syndication_options_page () {
224
  <li><input type="checkbox" name="hardcode_url" value="no"<?php echo (($hardcode_url=='yes')?'':' checked="checked"');?>/> Update the contributor homepage when the feed link changes</li>
225
  </ul></td></tr>
226
  </table>
227
- <div class="submit"><input type="submit" name="action" value="<?php echo $caption; ?>" /></div>
228
- </fieldset>
229
-
230
- <fieldset class="options">
231
- <legend>Syndicated Posts</legend>
232
-
233
- <?php fwp_category_box($dogs, '<em>all syndicated posts</em>'); ?>
234
 
 
 
 
235
  <table class="editform" width="75%" cellspacing="2" cellpadding="5">
236
  <tr style="vertical-align: top"><th width="44%" scope="row">Publication:</th>
237
  <td width="56%"><ul style="margin: 0; padding: 0; list-style:none">
238
  <li><label><input type="radio" name="post_status" value="publish"<?php echo (!$post_status or $post_status=='publish')?' checked="checked"':''; ?> /> Publish syndicated posts immediately</label></li>
239
- <li><label><input type="radio" name="post_status" value="draft"<?php echo ($post_status=='draft')?' checked="checked"':''; ?> /> Hold syndicated posts as drafts</label></li>
240
- <li><label><input type="radio" name="post_status" value="private"<?php echo ($post_status=='private')?' checked="checked"':''; ?> /> Hold syndicated posts as private posts</label></li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  </ul></td></tr>
 
 
 
 
 
 
 
 
 
242
 
243
- <tr style="vertical-align: top"><th width="44%" scope="row">Comments:</th>
 
 
 
244
  <td width="56%"><ul style="margin: 0; padding: 0; list-style:none">
245
  <li><label><input type="radio" name="comment_status" value="open"<?php echo ($comment_status=='open')?' checked="checked"':''; ?> /> Allow comments on syndicated posts</label></li>
246
  <li><label><input type="radio" name="comment_status" value="closed"<?php echo ($comment_status!='open')?' checked="checked"':''; ?> /> Don't allow comments on syndicated posts</label></li>
247
  </ul></td></tr>
248
 
249
- <tr style="vertical-align: top"><th width="44%" scope="row">Trackback and Pingback:</th>
250
  <td width="56%"><ul style="margin:0; padding: 0; list-style:none">
251
  <li><label><input type="radio" name="ping_status" value="open"<?php echo ($ping_status=='open')?' checked="checked"':''; ?> /> Accept pings on syndicated posts</label></li>
252
  <li><label><input type="radio" name="ping_status" value="closed"<?php echo ($ping_status!='open')?' checked="checked"':''; ?> /> Don't accept pings on syndicated posts</label></li>
253
  </ul></td></tr>
254
-
255
- <tr style="vertical-align: top"><th width="44%" scope="row" style="vertical-align:top">Unfamiliar categories:</th>
256
- <td width="56%"><ul style="margin: 0; padding:0; list-style:none">
257
- <li><label><input type="radio" name="unfamiliar_category" value="create"<?php echo $unfamiliar_category['create']; ?>/> create any categories the post is in</label></li>
258
- <li><label><input type="radio" name="unfamiliar_category" value="default"<?php echo $unfamiliar_category['default']; ?>/> don't create new categories</li>
259
- <li><label><input type="radio" name="unfamiliar_category" value="filter"<?php echo $unfamiliar_category['filter']; ?>/> don't create new categories and don't syndicate posts unless they match at least one familiar category</label></li>
260
- </ul></td></tr>
261
-
262
- <tr style="vertical-align: top"><th width="44%" scope="row">Permalinks point to:</th>
263
- <td width="56%"><select name="munge_permalink" size="1">
264
- <option value="yes"<?php echo ($munge_permalink=='yes')?' selected="selected"':''; ?>>original website</option>
265
- <option value="no"<?php echo ($munge_permalink=='no')?' selected="selected"':''; ?>>this website</option>
266
- </select></td></tr>
267
  </table>
268
- <div class="submit"><input type="submit" name="action" value="<?php echo $caption; ?>" /></div>
269
- </fieldset>
270
-
271
- <fieldset class="options">
272
- <legend>Syndicated Authors</legend>
273
  <?php
 
 
 
 
 
274
  $unfamiliar_author = FeedWordPress::on_unfamiliar('author');
275
  $authorlist = fwp_author_list();
276
  ?>
277
-
278
  <table>
279
  <tr><th colspan="3" style="text-align: left; padding-top: 1.0em; border-bottom: 1px dotted black;">For posts by authors that haven't been syndicated before:</th></tr>
280
  <tr>
@@ -299,12 +323,12 @@ function fwp_syndication_options_page () {
299
  <script>
300
  flip_newuser('unfamiliar-author');
301
  </script>
302
-
303
- <div class="submit"><input type="submit" name="action" value="<?php echo $caption; ?>" /></div>
304
- </fieldset>
305
-
306
- <fieldset class="options">
307
- <legend>Back-end Options</legend>
308
  <table class="editform" width="100%" cellspacing="2" cellpadding="5">
309
  <th width="33%" scope="row">Write update notices to PHP logs:</th>
310
  <td width="67%"><select name="update_logging" size="1">
@@ -313,10 +337,14 @@ function fwp_syndication_options_page () {
313
  </select></td>
314
  </tr>
315
  </table>
316
- <div class="submit"><input type="submit" name="action" value="<?php echo $caption; ?>" /></div>
317
- </fieldset>
 
 
 
318
  </form>
319
  </div>
 
320
  <?php
321
  }
322
 
7
  return;
8
  endif;
9
 
10
+ if (isset($_POST['submit'])) :
 
11
  check_admin_referer();
12
 
13
  if (!current_user_can('manage_options')):
59
  endif;
60
 
61
  if (!empty($cats)) :
62
+ update_option('feedwordpress_syndication_cats', implode(FEEDWORDPRESS_CAT_SEPARATOR, $cats));
63
  else :
64
  delete_option('feedwordpress_syndication_cats');
65
  endif;
66
 
67
+ // Tags
68
+ if (isset($_REQUEST['tags_input'])) :
69
+ $tags = explode(",", $_REQUEST['tags_input']);
70
+ else :
71
+ $tags = array();
72
+ endif;
73
+
74
+ if (!empty($tags)) :
75
+ update_option('feedwordpress_syndication_tags', implode(FEEDWORDPRESS_CAT_SEPARATOR, $tags));
76
+ else :
77
+ delete_option('feedwordpress_syndication_tags');
78
+ endif;
79
+
80
  if (isset($_REQUEST['comment_status']) and ($_REQUEST['comment_status'] == 'open')) :
81
  update_option('feedwordpress_syndicated_comment_status', 'open');
82
  else :
159
  $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
160
  endif;
161
 
162
+ $cats = array_map('trim',
163
+ preg_split(FEEDWORDPRESS_CAT_SEPARATOR_PATTERN, get_option('feedwordpress_syndication_cats'))
164
+ );
165
+ $dogs = SyndicatedPost::category_ids($cats, /*unfamiliar=*/ NULL);
 
 
 
 
 
 
 
 
 
 
 
 
166
 
167
+ $tags = array_map('trim',
168
+ preg_split(FEEDWORDPRESS_CAT_SEPARATOR_PATTERN, get_option('feedwordpress_syndication_tags'))
169
+ );
170
  ?>
171
  <script type="text/javascript">
172
  function flip_newuser (item) {
187
 
188
  <div class="wrap">
189
  <h2>Syndication Options</h2>
190
+ <div id="poststuff">
191
  <form action="" method="post">
192
+ <?php fwp_linkedit_single_submit(); ?>
193
+ <div id="post-body">
194
+ <?php fwp_option_box_opener('Syndicated Feeds', 'syndicatedfeedsdiv'); ?>
195
  <table class="editform" width="100%" cellspacing="2" cellpadding="5">
196
  <tr>
197
  <th width="33%" scope="row">Syndicated Link category:</th>
229
  <li><input type="checkbox" name="hardcode_url" value="no"<?php echo (($hardcode_url=='yes')?'':' checked="checked"');?>/> Update the contributor homepage when the feed link changes</li>
230
  </ul></td></tr>
231
  </table>
232
+ <?php fwp_linkedit_periodic_submit(); ?>
233
+ <?php fwp_option_box_closer(); ?>
 
 
 
 
 
234
 
235
+ <?php
236
+ fwp_option_box_opener(__('Syndicated Posts'), 'syndicatedpostsdiv');
237
+ ?>
238
  <table class="editform" width="75%" cellspacing="2" cellpadding="5">
239
  <tr style="vertical-align: top"><th width="44%" scope="row">Publication:</th>
240
  <td width="56%"><ul style="margin: 0; padding: 0; list-style:none">
241
  <li><label><input type="radio" name="post_status" value="publish"<?php echo (!$post_status or $post_status=='publish')?' checked="checked"':''; ?> /> Publish syndicated posts immediately</label></li>
242
+ <?php if (SyndicatedPost::use_api('post_status_pending')) : ?>
243
+ <li><label><input type="radio" name="post_status" value="pending"<?php echo ($post_status=='pending')?' checked="checked"':''; ?> /> Hold syndicated posts for review; mark as Pending</label></li>
244
+ <?php endif; ?>
245
+ <li><label><input type="radio" name="post_status" value="draft"<?php echo ($post_status=='draft')?' checked="checked"':''; ?> /> Save syndicated posts as drafts</label></li>
246
+ <li><label><input type="radio" name="post_status" value="private"<?php echo ($post_status=='private')?' checked="checked"':''; ?> /> Save syndicated posts as private posts</label></li>
247
+ </ul></td></tr>
248
+ <tr style="vertical-align: top"><th width="44%" scope="row">Permalinks point to:</th>
249
+ <td width="56%"><select name="munge_permalink" size="1">
250
+ <option value="yes"<?php echo ($munge_permalink=='yes')?' selected="selected"':''; ?>>original website</option>
251
+ <option value="no"<?php echo ($munge_permalink=='no')?' selected="selected"':''; ?>>this website</option>
252
+ </select></td></tr>
253
+ </table>
254
+ <?php
255
+ fwp_option_box_closer();
256
+ fwp_linkedit_periodic_submit();
257
+
258
+ fwp_option_box_opener(__('Categories for syndicated posts'), 'categorydiv', 'postbox');
259
+ fwp_category_box($dogs, '<em>all syndicated posts</em>');
260
+ ?>
261
+ <table class="editform" width="75%" cellspacing="2" cellpadding="5">
262
+ <tr style="vertical-align: top"><th width="27%" scope="row" style="vertical-align:top">Unfamiliar categories:</th>
263
+ <td><ul style="margin: 0; padding:0; list-style:none">
264
+ <li><label><input type="radio" name="unfamiliar_category" value="create"<?php echo $unfamiliar_category['create']; ?>/> create any categories the post is in</label></li>
265
+ <li><label><input type="radio" name="unfamiliar_category" value="default"<?php echo $unfamiliar_category['default']; ?>/> don't create new categories</li>
266
+ <li><label><input type="radio" name="unfamiliar_category" value="filter"<?php echo $unfamiliar_category['filter']; ?>/> don't create new categories and don't syndicate posts unless they match at least one familiar category</label></li>
267
  </ul></td></tr>
268
+ </table>
269
+ <?php
270
+ fwp_option_box_closer();
271
+ fwp_linkedit_periodic_submit();
272
+
273
+ if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) :
274
+ fwp_tags_box($tags);
275
+ fwp_linkedit_periodic_submit();
276
+ endif;
277
 
278
+ fwp_option_box_opener(__('Comments & Pings'), 'commentstatus', 'postbox');
279
+ ?>
280
+ <table class="editform" width="75%" cellspacing="2" cellpadding="5">
281
+ <tr style="vertical-align: top"><th width="44%" scope="row"><?php print __('Comments') ?>:</th>
282
  <td width="56%"><ul style="margin: 0; padding: 0; list-style:none">
283
  <li><label><input type="radio" name="comment_status" value="open"<?php echo ($comment_status=='open')?' checked="checked"':''; ?> /> Allow comments on syndicated posts</label></li>
284
  <li><label><input type="radio" name="comment_status" value="closed"<?php echo ($comment_status!='open')?' checked="checked"':''; ?> /> Don't allow comments on syndicated posts</label></li>
285
  </ul></td></tr>
286
 
287
+ <tr style="vertical-align: top"><th width="44%" scope="row"><?php print __('Pings') ?>:</th>
288
  <td width="56%"><ul style="margin:0; padding: 0; list-style:none">
289
  <li><label><input type="radio" name="ping_status" value="open"<?php echo ($ping_status=='open')?' checked="checked"':''; ?> /> Accept pings on syndicated posts</label></li>
290
  <li><label><input type="radio" name="ping_status" value="closed"<?php echo ($ping_status!='open')?' checked="checked"':''; ?> /> Don't accept pings on syndicated posts</label></li>
291
  </ul></td></tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  </table>
 
 
 
 
 
293
  <?php
294
+ fwp_option_box_closer();
295
+ fwp_linkedit_periodic_submit();
296
+
297
+ fwp_option_box_opener('Syndicated Authors', 'authordiv', 'postbox');
298
+
299
  $unfamiliar_author = FeedWordPress::on_unfamiliar('author');
300
  $authorlist = fwp_author_list();
301
  ?>
 
302
  <table>
303
  <tr><th colspan="3" style="text-align: left; padding-top: 1.0em; border-bottom: 1px dotted black;">For posts by authors that haven't been syndicated before:</th></tr>
304
  <tr>
323
  <script>
324
  flip_newuser('unfamiliar-author');
325
  </script>
326
+ <?php
327
+ fwp_option_box_closer();
328
+ fwp_linkedit_periodic_submit();
329
+
330
+ fwp_option_box_opener('Back End', 'backenddiv', 'postbox');
331
+ ?>
332
  <table class="editform" width="100%" cellspacing="2" cellpadding="5">
333
  <th width="33%" scope="row">Write update notices to PHP logs:</th>
334
  <td width="67%"><select name="update_logging" size="1">
337
  </select></td>
338
  </tr>
339
  </table>
340
+ <?php
341
+ fwp_option_box_closer();
342
+ fwp_linkedit_periodic_submit();
343
+ ?>
344
+ </div>
345
  </form>
346
  </div>
347
+ </div>
348
  <?php
349
  }
350