PluginProbe
FeedWordPress / 2025.1211
FeedWordPress v2025.1211
trunk 0.8 0.9 0.91 0.95 0.96 0.97 0.98 0.981 0.99 0.991 0.992 0.993 2008.1030 2008.1101 2008.1105 2008.1214 2009.0612 2009.0613 2009.0618 2009.0707 2009.1111 2009.1112 2010.0127 2010.0528 All 65 releases
← All changes | syndication.php +3 -997 2009.06122025.1211 View file →
@@ -1,999 +1,5 @@
1 1 <?php
2 -require_once(dirname(__FILE__) . '/admin-ui.php');
3 -require_once(dirname(__FILE__) . '/magpiemocklink.class.php');
2 + require_once dirname(__FILE__) . '/feedwordpresssyndicationpage.class.php';
4 3
5 -################################################################################
6 -## ADMIN MENU ADD-ONS: implement Dashboard management pages ####################
7 -################################################################################
8 -
9 -if (fwp_test_wp_version(0, FWP_SCHEMA_25)) :
10 - define('FWP_UPDATE_CHECKED', 'Update Checked Links');
11 - define('FWP_UNSUB_CHECKED', 'Unsubscribe from Checked Links');
12 - define('FWP_SYNDICATE_NEW', 'Syndicate »');
13 -else :
14 - define('FWP_UPDATE_CHECKED', 'Update Checked');
15 - define('FWP_UNSUB_CHECKED', 'Unsubscribe');
16 - define('FWP_SYNDICATE_NEW', 'Syndicate »');
17 -endif;
18 -
19 -function fwp_dashboard_update_if_requested () {
20 - global $wpdb;
21 -
22 - if (isset($_POST['update']) or isset($_POST['action']) or isset($_POST['update_uri'])) :
23 - $fwp_update_invoke = 'post';
24 - else :
25 - $fwp_update_invoke = 'get';
26 - endif;
27 -
28 - $update_set = array();
29 - if (isset($_POST['link_ids']) and is_array($_POST['link_ids']) and ($_POST['action']==FWP_UPDATE_CHECKED)) :
30 - $targets = $wpdb->get_results("
31 - SELECT * FROM $wpdb->links
32 - WHERE link_id IN (".implode(",",$_POST['link_ids']).")
33 - ");
34 - if (is_array($targets)) :
35 - foreach ($targets as $target) :
36 - $update_set[] = $target->link_rss;
37 - endforeach;
38 - else : // This should never happen
39 - FeedWordPress::critical_bug('fwp_syndication_manage_page::targets', $targets, __LINE__);
40 - endif;
41 - elseif (isset($_POST['update_uri'])) :
42 - $update_set[] = $_POST['update_uri'];
43 - endif;
44 -
45 - shuffle($update_set); // randomize order for load balancing purposes...
46 - if ($fwp_update_invoke != 'get' and count($update_set) > 0) : // Only do things with side-effects for HTTP POST or command line
47 - $feedwordpress =& new FeedWordPress;
48 - add_action('feedwordpress_check_feed', 'update_feeds_mention');
49 - add_action('feedwordpress_check_feed_complete', 'update_feeds_finish', 10, 3);
50 -
51 - $crash_dt = (int) get_option('feedwordpress_update_time_limit');
52 - if ($crash_dt > 0) :
53 - $crash_ts = time() + $crash_dt;
54 - else :
55 - $crash_ts = NULL;
56 - endif;
57 -
58 - if (fwp_test_wp_version(FWP_SCHEMA_25)) :
59 - echo "<div class=\"youare\">\n";
60 - else :
61 - echo "<div class=\"updated\">\n";
62 - endif;
63 - echo "<ul>\n";
64 - $tdelta = NULL;
65 - foreach ($update_set as $uri) :
66 - if (!is_null($crash_ts) and (time() > $crash_ts)) :
67 - echo "<li><p><strong>Further updates postponed:</strong> update time limit of ".$crash_dt." second".(($crash_dt==1)?"":"s")." exceeded.</p></li>";
68 - break;
69 - endif;
70 -
71 - if ($uri == '*') : $uri = NULL; endif;
72 - $delta = $feedwordpress->update($uri, $crash_ts);
73 - if (!is_null($delta)) :
74 - if (is_null($tdelta)) :
75 - $tdelta = $delta;
76 - else :
77 - $tdelta['new'] += $delta['new'];
78 - $tdelta['updated'] += $delta['updated'];
79 - endif;
80 - else :
81 - echo "<li><p><strong>Error:</strong> There was a problem updating <a href=\"$uri\">$uri</a></p></li>\n";
82 - endif;
83 - endforeach;
84 - echo "</ul>\n";
85 -
86 - if (!is_null($tdelta)) :
87 - $mesg = array();
88 - if (isset($delta['new'])) : $mesg[] = ' '.$tdelta['new'].' new posts were syndicated'; endif;
89 - if (isset($delta['updated'])) : $mesg[] = ' '.$tdelta['updated'].' existing posts were updated'; endif;
90 - echo "<p>Update complete.".implode(' and', $mesg)."</p>";
91 - echo "\n"; flush();
92 - endif;
93 - echo "</div> <!-- class=\"updated\" -->\n";
94 - elseif (fwp_test_wp_version(FWP_SCHEMA_25)) :
95 -?>
96 - <p class="youare">Check currently scheduled feeds for new and updated posts.</p>
97 -<?php
98 - endif;
99 -}
100 -
101 -function fwp_syndication_manage_page () {
102 - global $wpdb;
103 -
104 - if (FeedWordPress::needs_upgrade()) :
105 - fwp_upgrade_page();
106 - return;
107 - endif;
108 -
109 -?>
110 -<?php $cont = true;
111 -if (isset($_REQUEST['action'])):
112 - if ($_REQUEST['action'] == 'feedfinder' or $_REQUEST['action'] == FWP_SYNDICATE_NEW) : $cont = fwp_feedfinder_page();
113 - elseif ($_REQUEST['action'] == 'switchfeed') : $cont = fwp_switchfeed_page();
114 - elseif ($_REQUEST['action'] == 'linkedit') : $cont = fwp_linkedit_page();
115 - elseif ($_REQUEST['action'] == FWP_UNSUB_CHECKED or $_REQUEST['action'] == 'Unsubscribe') : $cont = fwp_multidelete_page();
116 - endif;
117 -endif;
118 -
119 -if ($cont):
120 -?>
121 -<?php
122 - $links = FeedWordPress::syndicated_links();
123 -?>
124 - <div class="wrap">
125 -<?php if (fwp_test_wp_version(FWP_SCHEMA_27)) : ?>
126 - <div class="icon32"><img src="<?php print htmlspecialchars(WP_PLUGIN_URL.'/'.$GLOBALS['fwp_path'].'/feedwordpress.png'); ?>" alt="" /></div>
127 - <h2>Syndicated Sites</h2>
128 -<?php endif;
129 - if (fwp_test_wp_version(0, FWP_SCHEMA_25)) :
130 - fwp_dashboard_update_if_requested();
131 - endif;
132 -
133 - if (fwp_test_wp_version(FWP_SCHEMA_27)) :
134 -?>
135 - <script type="text/javascript">
136 - jQuery(document).ready( function($) {
137 - // In case someone got here first.
138 - $('.postbox h3, .postbox .handlediv').unbind('click');
139 - $('.hide-postbox-tog').unbind('click');
140 - $('.meta-box-sortables').sortable('destroy');
141 -
142 - postboxes.add_postbox_toggles('feedwordpress_syndication');
143 - } );
144 - </script>
145 -<?php
146 - echo "<form style='display: none' method='get' action=''>\n<p>\n";
147 - wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
148 - wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
149 - echo "</p>\n</form>\n";
150 -
151 - if ($links) :
152 - add_meta_box('feedwordpress_update_box', __('Update feeds now'), 'fwp_syndication_manage_page_update_box', /*page=*/ 'feedwordpress_syndication', /*context =*/ 'normal');
153 - endif;
154 - add_meta_box('feedwordpress_feeds_box', __('Syndicated sources'), 'fwp_syndication_manage_page_links_box', /*page=*/ 'feedwordpress_syndication', /*context =*/ 'normal');
155 -?>
156 - <div class="metabox-holder">
157 - <div id="feedwordpress-sortables" class="meta-box-sortables ui-sortable">
158 -<?php
159 - do_meta_boxes('feedwordpress_syndication', 'normal', NULL);
160 - else :
161 - if ($links): // only display Update panel if there are some links to update....
162 - fwp_syndication_manage_page_update_box();
163 - endif;
164 - fwp_syndication_manage_page_links_box();
165 -?>
166 - </div> <!-- class="wrap" -->
167 -
168 - <?php if (fwp_test_wp_version(0, FWP_SCHEMA_25)) : ?>
169 - <div class="wrap">
170 - <form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post">
171 - <div><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?></div>
172 - <h2>Add a new syndicated site:</h2>
173 - <div>
174 - <label for="add-uri">Website or feed:</label>
175 - <input type="text" name="lookup" id="add-uri" value="URI" size="64" />
176 - <input type="hidden" name="action" value="feedfinder" />
177 - </div>
178 - <div class="submit"><input type="submit" value="Syndicate &raquo;" /></div>
179 - </form>
180 - </div> <!-- class="wrap" -->
181 - <?php endif; ?>
182 -
183 - <div style="display: none">
184 - <div id="tags-input"></div> <!-- avoid JS error from WP 2.5 bug -->
185 - </div>
186 -<?php
187 - endif;
188 -endif;
189 -} /* function fwp_syndication_manage_page () */
190 -
191 -function fwp_syndication_manage_page_update_box ($object = NULL, $box = NULL) {
192 - $updateFeedsNow = __('Update feeds now');
193 -?>
194 - <form action="" method="POST">
195 - <div><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?></div>
196 - <?php if (fwp_test_wp_version(FWP_SCHEMA_25, FWP_SCHEMA_27)) : ?>
197 - <div id="rightnow">
198 - <h3 class="reallynow"><span><?php print $updateFeedsNow; ?></span>
199 - <input type="hidden" name="update_uri" value="*" /><input style="float: right; border: none;" class="rbutton" type="submit" name="update" value="Update" />
200 - <br class="clear"/></h3>
201 - <?php elseif (fwp_test_wp_version(0, FWP_SCHEMA_25)) : ?>
202 - <h2><?php print $updateFeedsNow; ?></h2>
203 - <?php endif; ?>
204 -
205 -<?php
206 - if (fwp_test_wp_version(FWP_SCHEMA_25)) :
207 - fwp_dashboard_update_if_requested();
208 - else :
209 -?>
210 -<p>Check currently scheduled feeds for new and updated posts.</p>
211 -<?php endif; ?>
212 -
213 -<?php if (!get_option('feedwordpress_automatic_updates')) : ?>
214 - <p class="youhave"><strong>Note:</strong> Automatic updates are currently turned
215 - <strong>off</strong>. New posts from your feeds will not be syndicated
216 - until you manually check for them here. You can turn on automatic
217 - updates under <a href="admin.php?page=<?php print $GLOBALS['fwp_path']; ?>/syndication-options.php">Syndication
218 - Options</a>.</p>
219 -<?php endif; ?>
220 -
221 - <?php if (!fwp_test_wp_version(FWP_SCHEMA_25, FWP_SCHEMA_27)) : ?>
222 - <div class="submit"><input type="hidden" name="update_uri" value="*" /><input class="button-primary" type="submit" name="update" value="Update" /></div>
223 - <?php endif; ?>
224 -
225 - <?php if (fwp_test_wp_version(FWP_SCHEMA_27)) : ?>
226 - <br style="clear: both" />
227 - <?php elseif (fwp_test_wp_version(FWP_SCHEMA_25, FWP_SCHEMA_27)) : ?>
228 - </div> <!-- id="rightnow" -->
229 - </div> <!-- class="wrap" -->
230 - <?php elseif (fwp_test_wp_version(0, FWP_SCHEMA_25)) : ?>
231 - </div> <!-- class="wrap" -->
232 - <?php endif; ?>
233 - </form>
234 -<?php
235 -} /* function fwp_syndication_manage_page_update_box () */
236 -
237 -function fwp_syndication_manage_page_links_box ($object = NULL, $box = NULL) {
238 - $links = FeedWordPress::syndicated_links();
239 -?>
240 - <?php if (!fwp_test_wp_version(FWP_SCHEMA_27)) : ?>
241 - <div class="wrap">
242 - <h2>Syndicated Sites</h2>
243 - <?php endif; ?>
244 -
245 - <form id="syndicated-links" action="admin.php?page=<?php print $GLOBALS['fwp_path']; ?>/<?php echo basename(__FILE__); ?>" method="post">
246 - <div><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?></div>
247 -
248 -<?php $alt_row = true; ?>
249 -
250 - <?php if (fwp_test_wp_version(FWP_SCHEMA_25)) : ?>
251 - <div class="tablenav">
252 - <div class="alignright">
253 - <label for="add-uri">Add new source:</label>
254 - <input type="text" name="lookup" id="add-uri" value="Website or feed URI" />
255 -<script type="text/javascript">
256 -jQuery(document).ready( function () {
257 - var addUri = jQuery("#add-uri");
258 - var box = addUri.get(0);
259 - if (box.value==box.defaultValue) { addUri.addClass('form-input-tip'); }
260 - addUri.focus(function() {
261 - if ( this.value == this.defaultValue )
262 - jQuery(this).val( '' ).removeClass( 'form-input-tip' );
263 - });
264 - addUri.blur(function() {
265 - if ( this.value == '' )
266 - jQuery(this).val( this.defaultValue ).addClass( 'form-input-tip' );
267 - });
268 -
269 -} );
270 -</script>
271 -
272 - <input type="hidden" name="action" value="feedfinder" />
273 - <input type="submit" class="button-secondary" name="action" value="<?php print FWP_SYNDICATE_NEW; ?>" /></div>
274 -
275 -<?php if (count($links) > 0) : ?>
276 - <div class="alignleft">
277 - <input class="button-secondary" type="submit" name="action" value="<?php print FWP_UPDATE_CHECKED; ?>" />
278 - <input class="button-secondary delete" type="submit" class="delete" name="action" value="<?php print FWP_UNSUB_CHECKED; ?>" />
279 - </div>
280 -<?php endif; ?>
281 -
282 - <br class="clear" />
283 - </div>
284 - <br class="clear" />
285 -
286 - <table class="widefat">
287 - <?php else : ?>
288 - <table width="100%" cellpadding="3" cellspacing="3">
289 - <?php endif; ?>
290 -<thead>
291 -<tr>
292 -<th class="check-column" scope="col"><?php if (fwp_test_wp_version(FWP_SCHEMA_25)) : ?>
293 -<input type="checkbox" <?php if (fwp_test_wp_version(FWP_SCHEMA_25, FWP_SCHEMA_26)) : ?>onclick="checkAll(document.getElementById('syndicated-links'));"<?php endif; ?> />
294 -<?php endif; ?></th>
295 -<th scope="col"><?php _e('Name'); ?></th>
296 -<th scope="col"><?php _e('Feed'); ?></th>
297 -<th scope="col"><?php _e('Updated'); ?></th>
298 -</tr>
299 -</thead>
300 -
301 -<tbody>
302 -<?php if (count($links) > 0): foreach ($links as $link):
303 - $alt_row = !$alt_row; ?>
304 -<tr<?php echo ($alt_row?' class="alternate"':''); ?>>
305 -<th class="check-column" scope="row"><input type="checkbox" name="link_ids[]" value="<?php echo $link->link_id; ?>" /></th>
306 -<?php
307 - if (strlen($link->link_rss) > 0):
308 - $caption=__('Switch Feed');
309 - else :
310 - $caption=__('Find Feed');
311 - endif;
312 -?>
313 -<td>
314 -<strong><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"><?php echo wp_specialchars($link->link_name, 'both'); ?></a></strong>
315 -<div class="row-actions"><div><strong>Settings &gt;</strong>
316 -<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"><?php _e('Feed'); ?></a>
317 -| <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/posts-page.php&amp;link_id=<?php echo $link->link_id; ?>"><?php _e('Posts'); ?></a>
318 -| <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/authors-page.php&amp;link_id=<?php echo $link->link_id; ?>"><?php _e('Authors'); ?></a>
319 -| <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/categories-page.php&amp;link_id=<?php echo $link->link_id; ?>"><?php _e('Categories &amp; Tags'); ?></a></div>
320 -<div><strong>Actions &gt;</strong>
321 -<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"><?php echo $caption; ?></a>
322 -| <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"><?php _e('Unsubscribe'); ?></a>
323 -| <a href="<?php echo wp_specialchars($link->link_url, 'both'); ?>"><?php _e('View')?></a></div>
324 -</div>
325 -</td>
326 -<?php
327 - if (strlen($link->link_rss) > 0):
328 - $uri_bits = parse_url($link->link_rss);
329 - $uri_bits['host'] = preg_replace('/^www\./i', '', $uri_bits['host']);
330 - $display_uri =
331 - (isset($uri_bits['user'])?$uri_bits['user'].'@':'')
332 - .(isset($uri_bits['host'])?$uri_bits['host']:'')
333 - .(isset($uri_bits['port'])?':'.$uri_bits['port']:'')
334 - .(isset($uri_bits['path'])?$uri_bits['path']:'')
335 - .(isset($uri_bits['query'])?'?'.$uri_bits['query']:'');
336 - if (strlen($display_uri) > 32) : $display_uri = substr($display_uri, 0, 32).'&#8230;'; endif;
337 -?>
338 - <td><a href="<?php echo wp_specialchars($link->link_rss, 'both'); ?>"><?php echo wp_specialchars($display_uri, 'both'); ?></a></td>
339 - <?php else: ?>
340 - <td style="background-color:#FFFFD0"><p><strong>no
341 - feed assigned</strong></p></td>
342 - <?php endif; ?>
343 -
344 - <td><?php
345 - $sLink =& new SyndicatedLink($link->link_id);
346 - if (isset($sLink->settings['update/last'])) :
347 - print fwp_time_elapsed($sLink->settings['update/last']);
348 - else :
349 - _e('None yet');
350 - endif;
351 -
352 - print "<div style='font-style:italic;size:0.9em'>Ready for next update ";
353 - if (isset($sLink->settings['update/ttl']) and is_numeric($sLink->settings['update/ttl'])) :
354 - if (isset($sLink->settings['update/timed']) and $sLink->settings['update/timed']=='automatically') :
355 - $next = $sLink->settings['update/last'] + ((int) $sLink->settings['update/ttl'] * 60);
356 - print fwp_time_elapsed($next);
357 - else :
358 - echo "every ".$sLink->settings['update/ttl']." minute".(($sLink->settings['update/ttl']!=1)?"s":"");
359 - endif;
360 - else:
361 - echo "as soon as possible";
362 - endif;
363 - print "</div>";
364 -?>
365 - </td>
366 - </tr>
367 -<?php
368 - endforeach;
369 - else :
370 -?>
371 -<tr><td colspan="<?php print $span+2; ?>"><p>There are no websites currently listed for syndication.</p></td></tr>
372 -<?php
373 - endif;
374 -?>
375 -</tbody>
376 -</table>
377 -
378 -<?php if (count($links) > 0 and fwp_test_wp_version(0, FWP_SCHEMA_25)) : ?>
379 -<br/><hr/>
380 -<div class="submit"><input type="submit" class="delete" name="action" value="<?php print FWP_UNSUB_CHECKED; ?>" />
381 -<input type="submit" name="action" value="<?php print FWP_UPDATE_CHECKED; ?>" /></div>
382 -<?php endif; ?>
383 -
384 - </form>
385 -<?php
386 -} /* function fwp_syndication_manage_page_links_box() */
387 -
388 -function fwp_feedfinder_page () {
389 - global $wpdb;
390 -
391 - $lookup = (isset($_REQUEST['lookup'])?$_REQUEST['lookup']:NULL);
392 -
393 - if (isset($_REQUEST['link_id']) and ($_REQUEST['link_id']!=0)):
394 - $link_id = $_REQUEST['link_id'];
395 - if (!is_numeric($link_id)) : FeedWordPress::critical_bug('fwp_feedfinder_page::link_id', $link_id, __LINE__); endif;
396 -
397 - $link = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id='".$wpdb->escape($link_id)."'");
398 - if (is_object($link)):
399 - if (is_null($lookup)) $lookup = $link->link_url;
400 - $name = wp_specialchars($link->link_name, 'both');
401 - else:
402 - die (__("Cheatin' uh ?"));
403 - endif;
404 - else:
405 - $name = "<code>".htmlspecialchars($lookup)."</code>";
406 - $link_id = 0;
407 - endif;
408 -?>
409 - <div class="wrap">
410 - <h2>Feed Finder: <?php echo $name; ?></h2>
411 -<?php
412 - $f =& new FeedFinder($lookup);
413 - $feeds = $f->find();
414 - if (count($feeds) > 0):
415 - foreach ($feeds as $key => $f):
416 - $rss = fetch_rss($f);
417 - if ($rss):
418 - $feed_title = isset($rss->channel['title'])?$rss->channel['title']:$rss->channel['link'];
419 - $feed_link = isset($rss->channel['link'])?$rss->channel['link']:'';
420 - else :
421 - // Give us some sucky defaults
422 - $uri_bits = parse_url($lookup);
423 - $uri_bits['host'] = preg_replace('/^www\./i', '', $uri_bits['host']);
424 - $display_uri =
425 - (isset($uri_bits['user'])?$uri_bits['user'].'@':'')
426 - .(isset($uri_bits['host'])?$uri_bits['host']:'')
427 - .(isset($uri_bits['port'])?':'.$uri_bits['port']:'')
428 - .(isset($uri_bits['path'])?$uri_bits['path']:'')
429 - .(isset($uri_bits['query'])?'?'.$uri_bits['query']:'');
430 - if (strlen($display_uri) > 32) : $display_uri = substr($display_uri, 0, 32).'&#8230;'; endif;
431 -
432 - $feed_title = $display_uri;
433 - $feed_link = $lookup;
434 - endif;
435 -?>
436 - <form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post">
437 - <div><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_switchfeed'); ?></div>
438 - <fieldset style="clear: both">
439 - <legend><?php echo $rss->feed_type; ?> <?php echo $rss->feed_version; ?> feed</legend>
440 -
441 - <?php if ($link_id===0): ?>
442 - <input type="hidden" name="feed_title" value="<?php echo wp_specialchars($feed_title, 'both'); ?>" />
443 - <input type="hidden" name="feed_link" value="<?php echo wp_specialchars($feed_link, 'both'); ?>" />
444 - <?php endif; ?>
445 -
446 - <input type="hidden" name="link_id" value="<?php echo $link_id; ?>" />
447 - <input type="hidden" name="feed" value="<?php echo wp_specialchars($f, 'both'); ?>" />
448 - <input type="hidden" name="action" value="switchfeed" />
449 -
450 - <div>
451 - <div style="float:right; background-color:#D0D0D0; color: black; width:45%; font-size:70%; border-left: 1px dotted #A0A0A0; padding-left: 0.5em; margin-left: 1.0em">
452 -<?php if (count($rss->items) > 0): ?>
453 - <?php
454 - // Prepare to display Sample Item
455 - $link =& new MagpieMockLink($rss, $f);
456 - $post =& new SyndicatedPost($rss->items[0], $link);
457 - ?>
458 - <h3>Sample Item</h3>
459 - <ul>
460 - <li><strong>Title:</strong> <a href="<?php echo $post->post['meta']['syndication_permalink']; ?>"><?php echo $post->post['post_title']; ?></a></li>
461 - <li><strong>Date:</strong> <?php print date('d-M-y g:i:s a', $post->published()); ?></li>
462 - </ul>
463 - <div class="entry">
464 - <?php print $post->post['post_content']; ?>
465 - </div>
466 -<?php else: ?>
467 - <h3>No Items</h3>
468 - <p>FeedWordPress found no posts on this feed.</p>
469 -<?php endif; ?>
470 - </div>
471 -
472 - <div>
473 - <h3>Feed Information</h3>
474 - <ul>
475 - <li><strong>Website:</strong> <a href="<?php echo $feed_link; ?>"><?php echo is_null($feed_title)?'<em>Unknown</em>':$feed_title; ?></a></li>
476 - <li><strong>Feed URI:</strong> <a href="<?php echo wp_specialchars($f, 'both'); ?>"><?php echo wp_specialchars($f, 'both'); ?></a> (<a title="Check feed &lt;<?php echo wp_specialchars($f, 'both'); ?>&gt; for validity" href="http://feedvalidator.org/check.cgi?url=<?php echo urlencode($f); ?>">validate</a>)</li>
477 - <li><strong>Encoding:</strong> <?php echo isset($rss->encoding)?wp_specialchars($rss->encoding, 'both'):"<em>Unknown</em>"; ?></li>
478 - <li><strong>Description:</strong> <?php echo isset($rss->channel['description'])?wp_specialchars($rss->channel['description'], 'both'):"<em>Unknown</em>"; ?></li>
479 - </ul>
480 - <div class="submit"><input type="submit" name="Use" value="&laquo; Use this feed" /></div>
481 - <div class="submit"><input type="submit" name="Cancel" value="&laquo; Cancel" /></div>
482 - </div>
483 - </div>
484 - </fieldset>
485 - </form>
486 -<?php
487 - endforeach;
488 - else:
489 - print "<p><strong>".__('Error').":</strong> ".__("I couldn't find any feeds at").' <code><a href="'.htmlspecialchars($lookup).'">'.htmlspecialchars($lookup).'</a></code>';
490 - if (!is_null($f->error())) :
491 - print " [".__('HTTP request error').": ".htmlspecialchars(trim($f->error()))."]";
492 - endif;
493 - print ". ".__('Try another URL')."</p>";
494 - endif;
495 -?>
496 - </div>
497 -
498 - <form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post">
499 - <div><?php
500 - FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds');
501 - ?></div>
502 - <div class="wrap">
503 - <h2>Use another feed</h2>
504 - <div><label>Feed:</label>
505 - <input type="text" name="lookup" value="URI" />
506 - <input type="hidden" name="link_id" value="<?php echo $link_id; ?>" />
507 - <input type="hidden" name="action" value="feedfinder" /></div>
508 - <div class="submit"><input type="submit" value="Use this feed &raquo;" /></div>
509 - </div>
510 - </form>
511 -<?php
512 - return false; // Don't continue
513 -}
514 -
515 -function fwp_switchfeed_page () {
516 - global $wpdb, $wp_db_version;
517 -
518 - // If this is a POST, validate source and user credentials
519 - FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_switchfeed', /*capability=*/ 'manage_links');
520 -
521 - if (!isset($_REQUEST['Cancel'])):
522 - if (isset($_POST['link_id']) and ($_POST['link_id']==0)):
523 - $link_id = FeedWordPress::syndicate_link($_REQUEST['feed_title'], $_REQUEST['feed_link'], $_REQUEST['feed']);
524 - if ($link_id): ?>
525 -<div class="updated"><p><a href="<?php echo stripslashes($_REQUEST['feed_link']); ?>"><?php echo wp_specialchars(stripslashes($_REQUEST['feed_title']), 'both'); ?></a>
526 -has been added as a contributing site, using the feed at &lt;<a href="<?php echo stripslashes($_REQUEST['feed']); ?>"><?php echo wp_specialchars(stripslashes($_REQUEST['feed']), 'both'); ?></a>&gt;.
527 -| <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>&amp;link_id=<?php echo $link_id; ?>&amp;action=linkedit">Configure settings</a>.</div>
528 -<?php else: ?>
529 -<div class="updated"><p>There was a problem adding the feed. [SQL: <?php echo wp_specialchars(mysql_error(), 'both'); ?>]</p></div>
530 -<?php endif;
531 - elseif (isset($_POST['link_id'])):
532 - // Update link_rss
533 - $result = $wpdb->query("
534 - UPDATE $wpdb->links
535 - SET
536 - link_rss = '".$wpdb->escape($_REQUEST['feed'])."'
537 - WHERE link_id = '".$wpdb->escape($_REQUEST['link_id'])."'
538 - ");
539 -
540 - if ($result):
541 - $result = $wpdb->get_row("
542 - SELECT link_name, link_url FROM $wpdb->links
543 - WHERE link_id = '".$wpdb->escape($_REQUEST['link_id'])."'
544 - ");
545 - ?>
546 -<div class="updated"><p>Feed for <a href="<?php echo $result->link_url; ?>"><?php echo wp_specialchars($result->link_name, 'both'); ?></a>
547 -updated to &lt;<a href="<?php echo $_REQUEST['feed']; ?>"><?php echo wp_specialchars($_REQUEST['feed'], 'both'); ?></a>&gt;.</p></div>
548 - <?php else: ?>
549 -<div class="updated"><p>Nothing was changed.</p></div>
550 - <?php endif;
551 - endif;
552 - endif;
553 - return true; // Continue
554 -}
555 -
556 -function fwp_linkedit_page () {
557 - global $wpdb, $wp_db_version;
558 -
559 - // If this is a POST, validate source and user credentials
560 - FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_linkedit', /*capability=*/ 'manage_links');
561 -
562 - $special_settings = array ( /* Regular expression syntax is OK here */
563 - 'cats',
564 - 'cat_split',
565 - 'hardcode name',
566 - 'hardcode url',
567 - 'hardcode description',
568 - 'hardcode categories', /* Deprecated */
569 - 'post status',
570 - 'comment status',
571 - 'ping status',
572 - 'unfamiliar author',
573 - 'unfamliar categories', /* Deprecated */
574 - 'unfamiliar category',
575 - 'map authors',
576 - 'tags',
577 - 'update/.*',
578 - 'feed/.*',
579 - 'link/.*',
580 - );
581 -
582 - if (isset($_REQUEST['feedfinder'])) :
583 - return fwp_feedfinder_page(); // re-route to Feed Finder page
584 - else :
585 - $link_id = (int) $_REQUEST['link_id'];
586 - $link =& new SyndicatedLink($link_id);
587 -
588 - if ($link->found()) :
589 - if (isset($GLOBALS['fwp_post']['save'])) :
590 - $alter = array ();
591 -
592 - // custom feed settings first
593 - foreach ($GLOBALS['fwp_post']['notes'] as $mn) :
594 - $mn['key0'] = trim($mn['key0']);
595 - $mn['key1'] = trim($mn['key1']);
596 - if (preg_match("\007^(("
597 - .implode(')|(',$special_settings)
598 - ."))$\007i",
599 - $mn['key1'])) :
600 - $mn['key1'] = 'user/'.$mn['key1'];
601 - endif;
602 -
603 - if (strlen($mn['key0']) > 0) :
604 - unset($link->settings[$mn['key0']]); // out with the old
605 - endif;
606 -
607 - if (($mn['action']=='update') and (strlen($mn['key1']) > 0)) :
608 - $link->settings[$mn['key1']] = $mn['value']; // in with the new
609 - endif;
610 - endforeach;
611 -
612 - // now stuff through the web form
613 - // hardcoded feed info
614 - if (isset($GLOBALS['fwp_post']['hardcode_name'])) :
615 - $link->settings['hardcode name'] = $GLOBALS['fwp_post']['hardcode_name'];
616 - if (FeedWordPress::affirmative($link->settings, 'hardcode name')) :
617 - $alter[] = "link_name = '".$wpdb->escape($GLOBALS['fwp_post']['name'])."'";
618 - endif;
619 - endif;
620 - if (isset($GLOBALS['fwp_post']['hardcode_description'])) :
621 - $link->settings['hardcode description'] = $GLOBALS['fwp_post']['hardcode_description'];
622 - if (FeedWordPress::affirmative($link->settings, 'hardcode description')) :
623 - $alter[] = "link_description = '".$wpdb->escape($GLOBALS['fwp_post']['description'])."'";
624 - endif;
625 - endif;
626 - if (isset($GLOBALS['fwp_post']['hardcode_url'])) :
627 - $link->settings['hardcode url'] = $GLOBALS['fwp_post']['hardcode_url'];
628 - if (FeedWordPress::affirmative($link->settings, 'hardcode url')) :
629 - $alter[] = "link_url = '".$wpdb->escape($GLOBALS['fwp_post']['linkurl'])."'";
630 - endif;
631 - endif;
632 -
633 - // Update scheduling
634 - if (isset($GLOBALS['fwp_post']['update_schedule'])) :
635 - $link->settings['update/hold'] = $GLOBALS['fwp_post']['update_schedule'];
636 - endif;
637 -
638 - $alter[] = "link_notes = '".$wpdb->escape($link->settings_to_notes())."'";
639 -
640 - $alter_set = implode(", ", $alter);
641 -
642 - // issue update query
643 - $result = $wpdb->query("
644 - UPDATE $wpdb->links
645 - SET $alter_set
646 - WHERE link_id='$link_id'
647 - ");
648 - $updated_link = true;
649 -
650 - // reload link information from DB
651 - if (function_exists('clean_bookmark_cache')) :
652 - clean_bookmark_cache($link_id);
653 - endif;
654 - $link =& new SyndicatedLink($link_id);
655 - else :
656 - $updated_link = false;
657 - endif;
658 -
659 - $db_link = $link->link;
660 - $link_url = wp_specialchars($db_link->link_url, 1);
661 - $link_name = wp_specialchars($db_link->link_name, 1);
662 - $link_description = wp_specialchars($db_link->link_description, 'both');
663 - $link_rss_uri = wp_specialchars($db_link->link_rss, 'both');
664 - else :
665 - die( __('Link not found.') );
666 - endif;
667 -
668 - ?>
669 -<script type="text/javascript">
670 - function flip_hardcode (item) {
671 - ed=document.getElementById('basics-'+item+'-edit');
672 - view=document.getElementById('basics-'+item+'-view');
673 -
674 - o = document.getElementById('basics-hardcode-'+item);
675 - if (o.value=='yes') { ed.style.display='inline'; view.style.display='none'; }
676 - else { ed.style.display='none'; view.style.display='inline'; }
677 - }
678 -</script>
679 -
680 -<?php if ($updated_link) : ?>
681 -<div class="updated"><p>Syndicated feed settings updated.</p></div>
682 -<?php endif; ?>
683 -
684 -<form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post">
685 -<div class="wrap">
686 -<?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_linkedit'); ?>
687 -<input type="hidden" name="link_id" value="<?php echo $link_id; ?>" />
688 -<input type="hidden" name="action" value="linkedit" />
689 -<input type="hidden" name="save" value="link" />
690 -
691 -<?php if (fwp_test_wp_version(FWP_SCHEMA_27)) : ?>
692 - <div class="icon32"><img src="<?php print htmlspecialchars(WP_PLUGIN_URL.'/'.$GLOBALS['fwp_path'].'/feedwordpress.png'); ?>" alt="" /></div>
693 -<?php endif; ?>
694 -
695 -<h2><?php _e('Feed settings'); ?><?php if (!is_null($link) and $link->found()) : ?>: <?php echo wp_specialchars($link->link->link_name, 1); ?><?php endif; ?></h2>
696 -
697 -<div id="poststuff">
698 -<?php fwp_linkedit_single_submit($status); ?>
699 -
700 -<div id="post-body">
701 -<?php fwp_option_box_opener('Feed Information', 'feedinformationdiv'); ?>
702 - <table class="editform" width="100%" cellspacing="2" cellpadding="5">
703 - <tr>
704 - <th scope="row" width="20%"><?php _e('Feed URI:') ?></th>
705 - <td width="60%"><a href="<?php echo wp_specialchars($link_rss_uri, 'both'); ?>"><?php echo $link_rss_uri; ?></a>
706 - (<a href="<?php echo FEEDVALIDATOR_URI; ?>?url=<?php echo urlencode($link_rss_uri); ?>"
707 - title="Check feed &lt;<?php echo wp_specialchars($link_rss_uri, 'both'); ?>&gt; for validity">validate</a>)
708 - </td>
709 - <td width="20%"><input type="submit" name="feedfinder" value="switch &rarr;" style="font-size:smaller" /></td>
710 - </tr>
711 - <tr>
712 - <th scope="row" width="20%"><?php _e('Link Name:') ?></th>
713 - <td width="60%"><input type="text" id="basics-name-edit" name="name"
714 - value="<?php echo $link_name; ?>" style="width: 95%" />
715 - <span id="basics-name-view"><strong><?php echo $link_name; ?></strong></span>
716 - </td>
717 - <td>
718 - <select id="basics-hardcode-name" onchange="flip_hardcode('name')" name="hardcode_name">
719 - <option value="no" <?php echo $link->hardcode('name')?'':'selected="selected"'; ?>>update automatically</option>
720 - <option value="yes" <?php echo $link->hardcode('name')?'selected="selected"':''; ?>>edit manually</option>
721 - </select>
722 - </td>
723 - </tr>
724 - <tr>
725 - <th scope="row" width="20%"><?php _e('Short description:') ?></th>
726 - <td width="60%">
727 - <input id="basics-description-edit" type="text" name="description" value="<?php echo $link_description; ?>" style="width: 95%" />
728 - <span id="basics-description-view"><strong><?php echo $link_description; ?></strong></span>
729 - </td>
730 - <td>
731 - <select id="basics-hardcode-description" onchange="flip_hardcode('description')"
732 - name="hardcode_description">
733 - <option value="no" <?php echo $link->hardcode('description')?'':'selected="selected"'; ?>>update automatically</option>
734 - <option value="yes" <?php echo $link->hardcode('description')?'selected="selected"':''; ?>>edit manually</option>
735 - </select></td>
736 - </tr>
737 - <tr>
738 - <th width="20%" scope="row"><?php _e('Homepage:') ?></th>
739 - <td width="60%">
740 - <input id="basics-url-edit" type="text" name="linkurl" value="<?php echo $link_url; ?>" style="width: 95%;" />
741 - <a id="basics-url-view" href="<?php echo $link_url; ?>"><?php echo $link_url; ?></a></td>
742 - <td>
743 - <select id="basics-hardcode-url" onchange="flip_hardcode('url')" name="hardcode_url">
744 - <option value="no"<?php echo $link->hardcode('url')?'':' selected="selected"'; ?>>update automatically</option>
745 - <option value="yes"<?php echo $link->hardcode('url')?' selected="selected"':''; ?>>edit manually</option>
746 - </select></td></tr>
747 -
748 - <tr>
749 - <th width="20%"><?php _e('Last update') ?>:</th>
750 - <td colspan="2"><?php
751 - if (isset($link->settings['update/last'])) :
752 - echo fwp_time_elapsed($link->settings['update/last'])." ";
753 - else :
754 - echo " none yet";
755 - endif;
756 - ?></td></tr>
757 - <tr><th width="20%">Next update:</th>
758 - <td colspan="2"><?php
759 - $holdem = (isset($link->settings['update/hold']) ? $link->settings['update/hold'] : 'scheduled');
760 - ?>
761 - <select name="update_schedule">
762 - <option value="scheduled"<?php echo ($holdem=='scheduled')?' selected="selected"':''; ?>>update on schedule <?php
763 - echo " (";
764 - if (isset($link->settings['update/ttl']) and is_numeric($link->settings['update/ttl'])) :
765 - if (isset($link->settings['update/timed']) and $link->settings['update/timed']=='automatically') :
766 - echo 'next: ';
767 - $next = $link->settings['update/last'] + ((int) $link->settings['update/ttl'] * 60);
768 - if (strftime('%x', time()) != strftime('%x', $next)) :
769 - echo strftime('%x', $next)." ";
770 - endif;
771 - echo strftime('%X', $link->settings['update/last']+((int) $link->settings['update/ttl']*60));
772 - else :
773 - echo "every ".$link->settings['update/ttl']." minute".(($link->settings['update/ttl']!=1)?"s":"");
774 - endif;
775 - else:
776 - echo "next scheduled update";
777 - endif;
778 - echo ")";
779 - ?></option>
780 - <option value="next"<?php echo ($holdem=='next')?' selected="selected"':''; ?>>update ASAP</option>
781 - <option value="ping"<?php echo ($holdem=='ping')?' selected="selected"':''; ?>>update only when pinged</option>
782 - </select></tr>
783 - </table>
784 -<?php fwp_option_box_closer(); ?>
785 -
786 -<script type="text/javascript">
787 -flip_hardcode('name');
788 -flip_hardcode('description');
789 -flip_hardcode('url');
790 -</script>
791 -
792 -<?php fwp_linkedit_periodic_submit(); ?>
793 -
794 -<?php
795 - FeedWordPressSettingsUI::instead_of_posts_box($link_id);
796 - FeedWordPressSettingsUI::instead_of_authors_box($link_id);
797 - FeedWordPressSettingsUI::instead_of_categories_box($link_id);
798 -
799 - fwp_option_box_opener('Custom Feed Settings (for use in templates)', 'postcustom', 'postbox');
800 -?>
801 -<p class="setting-description">These custom settings are special fields for the <strong>feed</strong> you are
802 -syndicating, to be retrieved in templates using the <code>get_feed_meta()</code> function. They do not create
803 -custom fields on syndicated <strong>posts</strong>. If you want to create custom fields that are applied to each
804 -individual post from this feed, set up the settings in <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/posts-page.php&amp;link_id=<?php print $link_id; ?>">Syndicated Posts</a>.</p>
805 -
806 -<div id="postcustomstuff">
807 -<table id="meta-list" cellpadding="3">
808 - <tr>
809 - <th>Key</th>
810 - <th>Value</th>
811 - <th>Action</th>
812 - </tr>
813 -
814 -<?php
815 - $i = 0;
816 - foreach ($link->settings as $key => $value) :
817 - if (!preg_match("\007^((".implode(')|(', $special_settings)."))$\007i", $key)) :
818 -?>
819 - <tr style="vertical-align:top">
820 - <th width="30%" scope="row"><input type="hidden" name="notes[<?php echo $i; ?>][key0]" value="<?php echo wp_specialchars($key, 'both'); ?>" />
821 - <input id="notes-<?php echo $i; ?>-key" name="notes[<?php echo $i; ?>][key1]" value="<?php echo wp_specialchars($key, 'both'); ?>" /></th>
822 - <td width="60%"><textarea rows="2" cols="40" id="notes-<?php echo $i; ?>-value" name="notes[<?php echo $i; ?>][value]"><?php echo wp_specialchars($value, 'both'); ?></textarea></td>
823 - <td width="10%"><select name="notes[<?php echo $i; ?>][action]">
824 - <option value="update">save changes</option>
825 - <option value="delete">delete this setting</option>
826 - </select></td>
827 - </tr>
828 -<?php
829 - $i++;
830 - endif;
831 - endforeach;
832 -?>
833 - <tr>
834 - <th scope="row"><input type="text" size="10" name="notes[<?php echo $i; ?>][key1]" value="" /></th>
835 - <td><textarea name="notes[<?php echo $i; ?>][value]" rows="2" cols="40"></textarea></td>
836 - <td><em>add new setting...</em><input type="hidden" name="notes[<?php echo $i; ?>][action]" value="update" /></td>
837 - </tr>
838 -</table>
839 -<?php fwp_option_box_closer(); ?>
840 -
841 -<?php fwp_linkedit_periodic_submit(); ?>
842 -<?php fwp_linkedit_single_submit_closer(); ?>
843 -</div> <!-- id="post-body" -->
844 -</div> <!-- id="poststuff" -->
845 -</div>
846 - <?php
847 - endif;
848 - return false; // Don't continue
849 -}
850 -
851 -function fwp_multidelete_page () {
852 - global $wpdb;
853 -
854 - // If this is a POST, validate source and user credentials
855 - FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_feeds', /*capability=*/ 'manage_links');
856 -
857 - $link_ids = (isset($_REQUEST['link_ids']) ? $_REQUEST['link_ids'] : array());
858 - if (isset($_REQUEST['link_id'])) : array_push($link_ids, $_REQUEST['link_id']); endif;
859 -
860 - if (isset($GLOBALS['fwp_post']['confirm']) and $GLOBALS['fwp_post']['confirm']=='Delete'):
861 - foreach ($GLOBALS['fwp_post']['link_action'] as $link_id => $what) :
862 - $do_it[$what][] = $link_id;
863 - endforeach;
864 -
865 - $alter = array();
866 - if (count($do_it['hide']) > 0) :
867 - $hidem = "(".implode(', ', $do_it['hide']).")";
868 - $alter[] = "
869 - UPDATE $wpdb->links
870 - SET link_visible = 'N'
871 - WHERE link_id IN {$hidem}
872 - ";
873 - endif;
874 -
875 - if (count($do_it['nuke']) > 0) :
876 - $nukem = "(".implode(', ', $do_it['nuke']).")";
877 -
878 - // Make a list of the items syndicated from this feed...
879 - $post_ids = $wpdb->get_col("
880 - SELECT post_id FROM $wpdb->postmeta
881 - WHERE meta_key = 'syndication_feed_id'
882 - AND meta_value IN {$nukem}
883 - ");
884 -
885 - // ... and kill them all
886 - if (count($post_ids) > 0) :
887 - foreach ($post_ids as $post_id) :
888 - wp_delete_post($post_id);
889 - endforeach;
890 - endif;
891 -
892 - $alter[] = "
893 - DELETE FROM $wpdb->links
894 - WHERE link_id IN {$nukem}
895 - ";
896 - endif;
897 -
898 - if (count($do_it['delete']) > 0) :
899 - $deletem = "(".implode(', ', $do_it['delete']).")";
900 -
901 - // Make the items syndicated from this feed appear to be locally-authored
902 - $alter[] = "
903 - DELETE FROM $wpdb->postmeta
904 - WHERE meta_key = 'syndication_feed_id'
905 - AND meta_value IN {$deletem}
906 - ";
907 -
908 - // ... and delete the links themselves.
909 - $alter[] = "
910 - DELETE FROM $wpdb->links
911 - WHERE link_id IN {$deletem}
912 - ";
913 - endif;
914 -
915 - $errs = array(); $success = array ();
916 - foreach ($alter as $sql) :
917 - $result = $wpdb->query($sql);
918 - if (!$result):
919 - $errs[] = mysql_error();
920 - endif;
921 - endforeach;
922 -
923 - if (count($alter) > 0) :
924 - echo "<div class=\"updated\">\n";
925 - if (count($errs) > 0) :
926 - echo "There were some problems processing your ";
927 - echo "unsubscribe request. [SQL: ".implode('; ', $errs)."]";
928 - else :
929 - echo "Your unsubscribe request(s) have been processed.";
930 - endif;
931 - echo "</div>\n";
932 - endif;
933 -
934 - return true; // Continue on to Syndicated Sites listing
935 - else :
936 - $targets = $wpdb->get_results("
937 - SELECT * FROM $wpdb->links
938 - WHERE link_id IN (".implode(",",$link_ids).")
939 - ");
940 -?>
941 -<form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post">
942 -<div class="wrap">
943 -<?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?>
944 -<input type="hidden" name="action" value="Unsubscribe" />
945 -<input type="hidden" name="confirm" value="Delete" />
946 -
947 -<h2>Unsubscribe from Syndicated Links:</h2>
948 -<?php foreach ($targets as $link) :
949 - $link_url = wp_specialchars($link->link_url, 1);
950 - $link_name = wp_specialchars($link->link_name, 1);
951 - $link_description = wp_specialchars($link->link_description, 'both');
952 - $link_rss = wp_specialchars($link->link_rss, 'both');
953 -?>
954 -<fieldset>
955 -<legend><?php echo $link_name; ?></legend>
956 -<table class="editform" width="100%" cellspacing="2" cellpadding="5">
957 -<tr><th scope="row" width="20%"><?php _e('Feed URI:') ?></th>
958 -<td width="80%"><a href="<?php echo $link_rss; ?>"><?php echo $link_rss; ?></a></td></tr>
959 -<tr><th scope="row" width="20%"><?php _e('Short description:') ?></th>
960 -<td width="80%"><?php echo $link_description; ?></span></td></tr>
961 -<tr><th width="20%" scope="row"><?php _e('Homepage:') ?></th>
962 -<td width="80%"><a href="<?php echo $link_url; ?>"><?php echo $link_url; ?></a></td></tr>
963 -<tr style="vertical-align:top"><th width="20%" scope="row">Subscription <?php _e('Options') ?>:</th>
964 -<td width="80%"><ul style="margin:0; padding: 0; list-style: none">
965 -<li><input type="radio" id="hide-<?php echo $link->link_id; ?>"
966 -name="link_action[<?php echo $link->link_id; ?>]" value="hide" />
967 -<label for="hide-<?php echo $link->link_id; ?>">Turn off the subscription for this
968 -syndicated link<br/><span style="font-size:smaller">(Keep the feed information
969 -and all the posts from this feed in the database, but don't syndicate any
970 -new posts from the feed.)</span></label></li>
971 -<li><input type="radio" id="nuke-<?php echo $link->link_id; ?>"
972 -name="link_action[<?php echo $link->link_id; ?>]" value="nuke" />
973 -<label for="nuke-<?php echo $link->link_id; ?>">Delete this syndicated link and all the
974 -posts that were syndicated from it</label></li>
975 -<li><input type="radio" id="delete-<?php echo $link->link_id; ?>"
976 -name="link_action[<?php echo $link->link_id; ?>]" value="delete" />
977 -<label for="delete-<?php echo $link->link_id; ?>">Delete this syndicated link, but
978 -<em>keep</em> posts that were syndicated from it (as if they were authored
979 -locally).</label></li>
980 -<li><input type="radio" id="nothing-<?php echo $link->link_id; ?>"
981 -name="link_action[<?php echo $link->link_id; ?>]" value="nothing" />
982 -<label for="nothing-<?php echo $link->link_id; ?>">Keep this feed as it is. I changed
983 -my mind.</label></li>
984 -</ul>
985 -</table>
986 -</fieldset>
987 -<?php endforeach; ?>
988 -
989 -<div class="submit">
990 -<input class="delete" type="submit" name="submit" value="<?php _e('Unsubscribe from selected feeds &raquo;') ?>" />
991 -</div>
992 -</div>
993 -<?php
994 - return false; // Don't continue on to Syndicated Sites listing
995 - endif;
996 -}
997 -
998 - fwp_syndication_manage_page();
999 -
4 + $syndicationPage = new FeedWordPressSyndicationPage( __FILE__ );
5 + $syndicationPage->display();