PluginProbe
FeedWordPress / 2009.0612
FeedWordPress v2009.0612
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 +593 -289 2009.11112009.0612 View file →
@@ -1,6 +1,7 @@
1 1 <?php
2 2 require_once(dirname(__FILE__) . '/admin-ui.php');
3 +require_once(dirname(__FILE__) . '/magpiemocklink.class.php');
3 4
4 5 ################################################################################
5 6 ## ADMIN MENU ADD-ONS: implement Dashboard management pages ####################
6 7 ################################################################################
@@ -7,201 +8,15 @@
7 8
8 9 if (fwp_test_wp_version(0, FWP_SCHEMA_25)) :
9 10 define('FWP_UPDATE_CHECKED', 'Update Checked Links');
10 11 define('FWP_UNSUB_CHECKED', 'Unsubscribe from Checked Links');
11 - define('FWP_SYNDICATE_NEW', 'Syndicate ...');
12 + define('FWP_SYNDICATE_NEW', 'Syndicate »');
12 13 else :
13 14 define('FWP_UPDATE_CHECKED', 'Update Checked');
14 15 define('FWP_UNSUB_CHECKED', 'Unsubscribe');
15 - define('FWP_SYNDICATE_NEW', 'Syndicate ...');
16 + define('FWP_SYNDICATE_NEW', 'Syndicate »');
16 17 endif;
17 18
18 -class FeedWordPressSyndicationPage extends FeedWordPressAdminPage {
19 - function FeedWordPressSyndicationPage () {
20 - FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpresssyndication', /*link=*/ NULL);
21 -
22 - // No over-arching form element
23 - $this->dispatch = NULL;
24 - $this->filename = __FILE__;
25 - } /* FeedWordPressSyndicationPage constructor */
26 -
27 - function has_link () { return false; }
28 -
29 - function display () {
30 - global $wpdb;
31 -
32 - if (FeedWordPress::needs_upgrade()) :
33 - fwp_upgrade_page();
34 - return;
35 - endif;
36 -
37 - ?>
38 - <?php $cont = true;
39 - if (isset($_REQUEST['action'])):
40 - if ($_REQUEST['action'] == 'feedfinder' or $_REQUEST['action']==FWP_SYNDICATE_NEW) : $cont = fwp_feedfinder_page();
41 - elseif ($_REQUEST['action'] == 'switchfeed') : $cont = fwp_switchfeed_page();
42 - elseif ($_REQUEST['action'] == FWP_UNSUB_CHECKED or $_REQUEST['action'] == 'Unsubscribe') : $cont = fwp_multidelete_page();
43 - endif;
44 - endif;
45 -
46 - if ($cont):
47 - ?>
48 - <style type="text/css">
49 - .heads-up {
50 - background-color: #d0d0d0;
51 - color: black;
52 - padding: 1.0em;
53 - margin: 0.5em 4.0em !important;
54 - }
55 - .update-form.with-donation {
56 - margin-right: 50%;
57 - min-height: 255px;
58 - }
59 - .donation-form, .donation-thanks {
60 - background-color: #ffffcc;
61 - text-align: left;
62 - padding: 0.5em 0.5em;
63 - border-left: thin dashed #777777;
64 - font-size: 70%;
65 - position: absolute;
66 - top: 0; bottom: 0; right: 0; left: auto;
67 - width: 50%;
68 - }
69 - .donation-thanks {
70 - background-color: #ccffcc;
71 - }
72 - .donation-thanks .signature {
73 - text-align: right;
74 - font-style: italic;
75 - }
76 - .donation-form h4, .donation-thanks h4 {
77 - font-size: 10px;
78 - text-align: center;
79 - border-bottom: 1px solid #777777;
80 - margin: 0px;
81 - }
82 - .donation-form .donate {
83 - text-align: center;
84 - }
85 - .donation-form .sod-off {
86 - padding-top: 0.5em;
87 - margin-top: 0.5em;
88 - border-top: thin solid #777777;
89 - }
90 - </style>
91 - <?php
92 - $links = FeedWordPress::syndicated_links();
93 - $this->open_sheet('Syndicated Sites');
94 - ?>
95 - <div id="post-body">
96 - <?php
97 - if ($links) :
98 - fwp_add_meta_box(
99 - /*id=*/ 'feedwordpress_update_box',
100 - /*title=*/ __('Update feeds now'),
101 - /*callback=*/ 'fwp_syndication_manage_page_update_box',
102 - /*page=*/ $this->meta_box_context(),
103 - /*context =*/ $this->meta_box_context()
104 - );
105 - endif;
106 - fwp_add_meta_box(
107 - /*id=*/ 'feedwordpress_feeds_box',
108 - /*title=*/ __('Syndicated sources'),
109 - /*callback=*/ 'fwp_syndication_manage_page_links_box',
110 - /*page=*/ $this->meta_box_context(),
111 - /*context =*/ $this->meta_box_context()
112 - );
113 - if (FeedWordPressCompatibility::test_version(0, FWP_SCHEMA_25)) :
114 - fwp_add_meta_box(
115 - /*id=*/ 'feedwordpress_add_feed_box',
116 - /*title=*/ 'Add a new syndicated source',
117 - /*callback=*/ 'fwp_syndication_manage_page_add_feed_box',
118 - /*page=*/ $this->meta_box_context(),
119 - /*context=*/ $this->meta_box_context()
120 - );
121 - endif;
122 -
123 - do_action('feedwordpress_admin_page_syndication_meta_boxes', $this);
124 - ?>
125 - <div class="metabox-holder">
126 - <?php
127 - fwp_do_meta_boxes($this->meta_box_context(), $this->meta_box_context(), $this);
128 - ?>
129 - </div> <!-- class="metabox-holder" -->
130 - </div> <!-- id="post-body" -->
131 -
132 - <?php $this->close_sheet(/*dispatch=*/ NULL); ?>
133 -
134 - <div style="display: none">
135 - <div id="tags-input"></div> <!-- avoid JS error from WP 2.5 bug -->
136 - </div>
137 - <?php
138 - endif;
139 - } /* FeedWordPressSyndicationPage::display () */
140 -
141 - function bleg_thanks ($page, $box = NULL) {
142 - ?>
143 - <div class="donation-thanks">
144 - <h4>Thank you!</h4>
145 - <p><strong>Thank you</strong> for your contribution to <a href="http://feedwordpress.radgeek.com/">FeedWordPress</a> development.
146 - Your generous gifts make ongoing support and development for
147 - FeedWordPress possible.</p>
148 - <p>If you have any questions about FeedWordPress, or if there
149 - is anything I can do to help make FeedWordPress more useful for
150 - you, please <a href="http://feedwordpress.radgeek.com/contact">contact me</a>
151 - and let me know what you're thinking about.</p>
152 - <p class="signature">&#8212;<a href="http://radgeek.com/">Charles Johnson</a>, Developer, <a href="http://feedwordpress.radgeek.com/">FeedWordPress</a>.</p>
153 - </div>
154 - <?php
155 - } /* FeedWordPressSyndicationPage::bleg_thanks () */
156 -
157 - function bleg_box ($page, $box = NULL) {
158 - ?>
159 -<div class="donation-form">
160 -<h4>Keep FeedWordPress improving</h4>
161 -<form action="https://www.paypal.com/cgi-bin/webscr" accept-charset="UTF-8" method="post"><div>
162 -<p><a href="http://feedwordpress.radgeek.com/">FeedWordPress</a> makes syndication
163 -simple and empowers you to stream content from all over the web into your
164 -WordPress hub. That's got to be worth a few lattes. If you're finding FWP useful,
165 -<a href="http://feedwordpress.radgeek.com/donation/">a modest gift</a>
166 -is the best way to support steady progress on development, enhancements,
167 -support, and documentation.</p>
168 -<div class="donate">
169 -<input type="hidden" name="business" value="commerce@radgeek.com" />
170 -<input type="hidden" name="cmd" value="_xclick" />
171 -<input type="hidden" name="item_name" value="FeedWordPress donation" />
172 -<input type="hidden" name="no_shipping" value="1" />
173 -<input type="hidden" name="return" value="<?php bloginfo('url'); ?>/wp-admin/admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php print basename(__FILE__); ?>&amp;paid=yes" />
174 -<input type="hidden" name="currency_code" value="USD" />
175 -<input type="hidden" name="notify_url" value="http://feedwordpress.radgeek.com/ipn/donation" />
176 -<input type="hidden" name="custom" value="1" />
177 -<input type="image" name="submit" src="https://www.paypal.com/en_GB/i/btn/btn_donate_SM.gif" alt="Donate through PayPal" />
178 -</div>
179 -</div></form>
180 -
181 -<p>You can make a gift online (or
182 -<a href="http://feedwordpress.radgeek.com/donation">set up an automatic
183 -regular donation</a>) using an existing PayPal account or any major credit card.</p>
184 -
185 -<div class="sod-off">
186 -<form style="text-align: center" action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php print basename(__FILE__); ?>" method="POST"><div>
187 -<input class="button-primary" type="submit" name="maybe_later" value="Maybe Later" />
188 -<input class="button-secondary" type="submit" name="go_away" value="Dismiss" />
189 -</div></form>
190 -</div>
191 -</div> <!-- class="donation-form" -->
192 - <?php
193 - } /* FeedWordPressSyndicationPage::bleg_box () */
194 -
195 - /**
196 - * Override the default display of a save-settings button and replace
197 - * it with nothing.
198 - */
199 - function interstitial () {
200 - /* NOOP */
201 - } /* FeedWordPressSyndicationPage::interstitial() */
202 -} /* class FeedWordPressSyndicationPage */
203 -
204 19 function fwp_dashboard_update_if_requested () {
205 20 global $wpdb;
206 21
207 22 if (isset($_POST['update']) or isset($_POST['action']) or isset($_POST['update_uri'])) :
@@ -275,80 +90,147 @@
275 90 echo "<p>Update complete.".implode(' and', $mesg)."</p>";
276 91 echo "\n"; flush();
277 92 endif;
278 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
279 98 endif;
280 99 }
281 100
282 -function fwp_syndication_manage_page_add_feed_box ($object = NULL, $box = NULL) {
283 - ?>
284 - <form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php print basename(__FILE__); ?>" method="post">
285 - <div>
286 - <?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?>
287 - <label for="add-uri">Website or feed:</label>
288 - <input type="text" name="lookup" id="add-uri" value="URI" size="64" />
289 - <input type="hidden" name="action" value="feedfinder" />
290 - </div>
291 - <div class="submit"><input type="submit" value="<?php print FWP_SYNDICATE_NEW; ?>" /></div>
292 - </form>
293 - <?php
294 -}
101 +function fwp_syndication_manage_page () {
102 + global $wpdb;
295 103
296 -define('FEEDWORDPRESS_BLEG_MAYBE_LATER_OFFSET', (60 /*sec/min*/ * 60 /*min/hour*/ * 24 /*hour/day*/ * 31 /*days*/));
297 -define('FEEDWORDPRESS_BLEG_ALREADY_PAID_OFFSET', (60 /*sec/min*/ * 60 /*min/hour*/ * 24 /*hour/day*/ * 183 /*days*/));
298 -function fwp_syndication_manage_page_update_box ($object = NULL, $box = NULL) {
299 - $bleg_box_hidden = null;
300 - if (isset($_POST['maybe_later'])) :
301 - $bleg_box_hidden = time() + FEEDWORDPRESS_BLEG_MAYBE_LATER_OFFSET;
302 - elseif (isset($_REQUEST['paid']) and $_REQUEST['paid']) :
303 - $bleg_box_hidden = time() + FEEDWORDPRESS_BLEG_ALREADY_PAID_OFFSET;
304 - elseif (isset($_POST['go_away'])) :
305 - $bleg_box_hidden = 'permanent';
104 + if (FeedWordPress::needs_upgrade()) :
105 + fwp_upgrade_page();
106 + return;
306 107 endif;
307 108
308 - if (!is_null($bleg_box_hidden)) :
309 - update_option('feedwordpress_bleg_box_hidden', $bleg_box_hidden);
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);
310 160 else :
311 - $bleg_box_hidden = get_option('feedwordpress_bleg_box_hidden');
312 - endif;
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();
313 165 ?>
314 - <?php
315 - $bleg_box_ready = (!$bleg_box_hidden or (is_numeric($bleg_box_hidden) and $bleg_box_hidden < time()));
316 - if (isset($_REQUEST['paid']) and $_REQUEST['paid']) :
317 - $object->bleg_thanks($subject, $box);
318 - elseif ($bleg_box_ready) :
319 - $object->bleg_box($object, $box);
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
320 187 endif;
321 - ?>
188 +endif;
189 +} /* function fwp_syndication_manage_page () */
322 190
323 - <form
324 - action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php print basename(__FILE__); ?>"
325 - method="POST"
326 - class="update-form<?php if ($bleg_box_ready) : ?> with-donation<?php endif; ?>"
327 - >
191 +function fwp_syndication_manage_page_update_box ($object = NULL, $box = NULL) {
192 + $updateFeedsNow = __('Update feeds now');
193 +?>
194 + <form action="" method="POST">
328 195 <div><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?></div>
329 - <p>Check currently scheduled feeds for new and updated posts.</p>
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; ?>
330 204
331 - <?php
332 - fwp_dashboard_update_if_requested();
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; ?>
333 212
334 - if (!get_option('feedwordpress_automatic_updates')) :
335 - ?>
336 - <p class="heads-up"><strong>Note:</strong> Automatic updates are currently turned
337 - <strong>off</strong>. New posts from your feeds will not be syndicated
338 - until you manually check for them here. You can turn on automatic
339 - updates under <a href="admin.php?page=<?php print $GLOBALS['fwp_path']; ?>/feeds-page.php">Feed &amp; Update Settings<a></a>.</p>
340 - <?php
341 - endif;
342 - ?>
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; ?>
343 220
221 + <?php if (!fwp_test_wp_version(FWP_SCHEMA_25, FWP_SCHEMA_27)) : ?>
344 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; ?>
345 224
346 225 <?php if (fwp_test_wp_version(FWP_SCHEMA_27)) : ?>
347 226 <br style="clear: both" />
348 - <?php /* elseif (fwp_test_wp_version(FWP_SCHEMA_25, FWP_SCHEMA_27)) :
227 + <?php elseif (fwp_test_wp_version(FWP_SCHEMA_25, FWP_SCHEMA_27)) : ?>
349 228 </div> <!-- id="rightnow" -->
350 - <?php */ endif; ?>
229 + </div> <!-- class="wrap" -->
230 + <?php elseif (fwp_test_wp_version(0, FWP_SCHEMA_25)) : ?>
231 + </div> <!-- class="wrap" -->
232 + <?php endif; ?>
351 233 </form>
352 234 <?php
353 235 } /* function fwp_syndication_manage_page_update_box () */
354 236
@@ -354,8 +236,13 @@
354 236
355 237 function fwp_syndication_manage_page_links_box ($object = NULL, $box = NULL) {
356 238 $links = FeedWordPress::syndicated_links();
357 239 ?>
240 + <?php if (!fwp_test_wp_version(FWP_SCHEMA_27)) : ?>
241 + <div class="wrap">
242 + <h2>Syndicated Sites</h2>
243 + <?php endif; ?>
244 +
358 245 <form id="syndicated-links" action="admin.php?page=<?php print $GLOBALS['fwp_path']; ?>/<?php echo basename(__FILE__); ?>" method="post">
359 246 <div><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?></div>
360 247
361 248 <?php $alt_row = true; ?>
@@ -364,10 +251,25 @@
364 251 <div class="tablenav">
365 252 <div class="alignright">
366 253 <label for="add-uri">Add new source:</label>
367 254 <input type="text" name="lookup" id="add-uri" value="Website or feed URI" />
368 - <?php FeedWordPressSettingsUI::magic_input_tip_js('add-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 + });
369 268
269 +} );
270 +</script>
271 +
370 272 <input type="hidden" name="action" value="feedfinder" />
371 273 <input type="submit" class="button-secondary" name="action" value="<?php print FWP_SYNDICATE_NEW; ?>" /></div>
372 274
373 275 <?php if (count($links) > 0) : ?>
@@ -408,14 +310,14 @@
408 310 $caption=__('Find Feed');
409 311 endif;
410 312 ?>
411 313 <td>
412 -<strong><a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/feeds-page.php&amp;link_id=<?php echo $link->link_id; ?>"><?php echo wp_specialchars($link->link_name, 'both'); ?></a></strong>
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>
413 315 <div class="row-actions"><div><strong>Settings &gt;</strong>
414 -<a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/feeds-page.php&amp;link_id=<?php echo $link->link_id; ?>"><?php _e('Feed'); ?></a>
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>
415 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>
416 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>
417 -| <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/categories-page.php&amp;link_id=<?php echo $link->link_id; ?>"><?php print htmlspecialchars(__('Categories'.FEEDWORDPRESS_AND_TAGS)); ?></a></div>
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>
418 320 <div><strong>Actions &gt;</strong>
419 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>
420 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>
421 323 | <a href="<?php echo wp_specialchars($link->link_url, 'both'); ?>"><?php _e('View')?></a></div>
@@ -451,9 +353,8 @@
451 353 if (isset($sLink->settings['update/ttl']) and is_numeric($sLink->settings['update/ttl'])) :
452 354 if (isset($sLink->settings['update/timed']) and $sLink->settings['update/timed']=='automatically') :
453 355 $next = $sLink->settings['update/last'] + ((int) $sLink->settings['update/ttl'] * 60);
454 356 print fwp_time_elapsed($next);
455 - if (FEEDWORDPRESS_DEBUG) : print " [".(($next-time())/60)." minutes]"; endif;
456 357 else :
457 358 echo "every ".$sLink->settings['update/ttl']." minute".(($sLink->settings['update/ttl']!=1)?"s":"");
458 359 endif;
459 360 else:
@@ -484,58 +385,468 @@
484 385 <?php
485 386 } /* function fwp_syndication_manage_page_links_box() */
486 387
487 388 function fwp_feedfinder_page () {
488 - global $post_source;
489 -
490 - $post_source = 'feedwordpress_feeds';
491 -
492 - // With action=feedfinder, this goes directly to the feedfinder page
493 - include_once(dirname(__FILE__) . '/feeds-page.php');
494 - return false;
495 -} /* function fwp_feedfinder_page () */
389 + global $wpdb;
496 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 +
497 515 function fwp_switchfeed_page () {
498 516 global $wpdb, $wp_db_version;
499 - global $fwp_post;
500 517
501 518 // If this is a POST, validate source and user credentials
502 519 FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_switchfeed', /*capability=*/ 'manage_links');
503 520
504 - $changed = false;
505 - if (!isset($fwp_post['Cancel'])):
506 - if (isset($fwp_post['save_link_id']) and ($fwp_post['save_link_id']=='*')) :
507 - $changed = true;
508 - $link_id = FeedWordPress::syndicate_link($fwp_post['feed_title'], $fwp_post['feed_link'], $fwp_post['feed']);
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']);
509 524 if ($link_id): ?>
510 -<div class="updated"><p><a href="<?php print $fwp_post['feed_link']; ?>"><?php print wp_specialchars($fwp_post['feed_title'], 'both'); ?></a>
511 -has been added as a contributing site, using the feed at
512 -&lt;<a href="<?php print $fwp_post['feed']; ?>"><?php print wp_specialchars($fwp_post['feed'], 'both'); ?></a>&gt;.
513 -| <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/feeds-page.php&amp;link_id=<?php print $link_id; ?>">Configure settings</a>.</p></div>
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>
514 528 <?php else: ?>
515 529 <div class="updated"><p>There was a problem adding the feed. [SQL: <?php echo wp_specialchars(mysql_error(), 'both'); ?>]</p></div>
516 530 <?php endif;
517 - elseif (isset($fwp_post['save_link_id'])):
518 - $existingLink = new SyndicatedLink($fwp_post['save_link_id']);
519 - $changed = $existingLink->set_uri($fwp_post['feed']);
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 +}
520 555
521 - if ($changed):
522 - $home = $existingLink->homepage(/*from feed=*/ false);
523 - $name = $existingLink->name(/*from feed=*/ false);
524 - ?>
525 -<div class="updated"><p>Feed for <a href="<?php echo wp_specialchars($home, 'both'); ?>"><?php echo wp_specialchars($name, 'both'); ?></a>
526 -updated to &lt;<a href="<?php echo wp_specialchars($fwp_post['feed'], 'both'); ?>"><?php echo wp_specialchars($fwp_post['feed'], 'both'); ?></a>&gt;.</p></div>
527 - <?php
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;
528 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.') );
529 666 endif;
530 - endif;
531 667
532 - if (!$changed) :
533 - ?>
534 -<div class="updated"><p>Nothing was changed.</p></div>
535 - <?php
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
536 847 endif;
537 - return true; // Continue
848 + return false; // Don't continue
538 849 }
539 850
540 851 function fwp_multidelete_page () {
541 852 global $wpdb;
@@ -546,15 +857,9 @@
546 857 $link_ids = (isset($_REQUEST['link_ids']) ? $_REQUEST['link_ids'] : array());
547 858 if (isset($_REQUEST['link_id'])) : array_push($link_ids, $_REQUEST['link_id']); endif;
548 859
549 860 if (isset($GLOBALS['fwp_post']['confirm']) and $GLOBALS['fwp_post']['confirm']=='Delete'):
550 - if (isset($GLOBALS['fwp_post']['link_action']) and is_array($GLOBALS['fwp_post']['link_action'])) :
551 - $actions = $GLOBALS['fwp_post']['link_action'];
552 - else :
553 - $actions = array();
554 - endif;
555 -
556 - foreach ($actions as $link_id => $what) :
861 + foreach ($GLOBALS['fwp_post']['link_action'] as $link_id => $what) :
557 862 $do_it[$what][] = $link_id;
558 863 endforeach;
559 864
560 865 $alter = array();
@@ -689,7 +994,6 @@
689 994 return false; // Don't continue on to Syndicated Sites listing
690 995 endif;
691 996 }
692 997
693 - $syndicationPage = new FeedWordPressSyndicationPage;
694 - $syndicationPage->display();
998 + fwp_syndication_manage_page();
695 999