| @@ -1,50 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | require_once(dirname(__FILE__) . '/admin-ui.php'); |
| 3 | -require_once(dirname(__FILE__) . '/magpiemocklink.class.php'); | |
| 4 | -require_once(dirname(__FILE__) . '/feedfinder.class.php'); | |
| 5 | 3 | |
| 6 | -$FeedWordPressHTTPStatusMessages = array ( | |
| 7 | - 200 => 'OK. FeedWordPress had no problems retrieving the content at this URL but the content does not seem to be a feed, and does not seem to include links to any feeds.', | |
| 8 | - 201 => 'Created', | |
| 9 | - 202 => 'Accepted', | |
| 10 | - 203 => 'Non-Authoritative information', | |
| 11 | - 204 => 'No Content', | |
| 12 | - 205 => 'Reset Content', | |
| 13 | - 206 => 'Partial Content', | |
| 14 | - 300 => 'Multiple Choices', | |
| 15 | - 301 => 'Moved Permanently', | |
| 16 | - 302 => 'Found', | |
| 17 | - 303 => 'See Other', | |
| 18 | - 304 => 'Not Modified', | |
| 19 | - 305 => 'Use Proxy', | |
| 20 | - 307 => 'Temporary Redirect', | |
| 21 | - 400 => 'Bad Request', | |
| 22 | - 401 => 'Unauthorized. This URL probably needs a username and password for you to access it.', | |
| 23 | - 402 => 'Payment Required', | |
| 24 | - 403 => 'Forbidden. The URL is not made available for the machine that FeedWordPress is running on.', | |
| 25 | - 404 => 'Not Found. There is nothing at this URL. Have you checked the address for typos?', | |
| 26 | - 405 => 'Method Not Allowed', | |
| 27 | - 406 => 'Not Acceptable', | |
| 28 | - 407 => 'Proxy Authentication Required', | |
| 29 | - 408 => 'Request Timeout', | |
| 30 | - 409 => 'Conflict', | |
| 31 | - 410 => 'Gone. This URL is no longer available on this server and no forwarding address is known.', | |
| 32 | - 411 => 'Length Required', | |
| 33 | - 412 => 'Precondition Failed', | |
| 34 | - 413 => 'Request Entity Too Large', | |
| 35 | - 414 => 'Request URI Too Long', | |
| 36 | - 415 => 'Unsupported Media Type', | |
| 37 | - 416 => 'Requested Range Not Satisfiable', | |
| 38 | - 417 => 'Expectation Failed', | |
| 39 | - 500 => 'Internal Server Error. Something unexpected went wrong with the configuration of the server that hosts this URL. You might try again later to see if this issue has been resolved.', | |
| 40 | - 501 => 'Not Implemented', | |
| 41 | - 502 => 'Bad Gateway', | |
| 42 | - 503 => 'Service Unavailable. The server is currently unable to handle the request due to a temporary overloading or maintenance of the server that hosts this URL. This is probably a temporary condition and you should try again later to see if the issue has been resolved.', | |
| 43 | - 504 => 'Gateway Timeout', | |
| 44 | - 505 => 'HTTP Version Not Supported', | |
| 45 | -); | |
| 46 | - | |
| 47 | 4 | ################################################################################ |
| 48 | 5 | ## ADMIN MENU ADD-ONS: implement Dashboard management pages #################### |
| 49 | 6 | ################################################################################ |
| 50 | 7 | |
| @@ -50,32 +7,201 @@ | ||
| 50 | 7 | |
| 51 | 8 | if (fwp_test_wp_version(0, FWP_SCHEMA_25)) : |
| 52 | 9 | define('FWP_UPDATE_CHECKED', 'Update Checked Links'); |
| 53 | 10 | define('FWP_UNSUB_CHECKED', 'Unsubscribe from Checked Links'); |
| 54 | - define('FWP_SYNDICATE_NEW', 'Syndicate »'); | |
| 11 | + define('FWP_SYNDICATE_NEW', 'Syndicate ...'); | |
| 55 | 12 | else : |
| 56 | 13 | define('FWP_UPDATE_CHECKED', 'Update Checked'); |
| 57 | 14 | define('FWP_UNSUB_CHECKED', 'Unsubscribe'); |
| 58 | - define('FWP_SYNDICATE_NEW', 'Syndicate »'); | |
| 15 | + define('FWP_SYNDICATE_NEW', 'Syndicate ...'); | |
| 59 | 16 | endif; |
| 60 | 17 | |
| 61 | -function feedwordpress_syndication_toggles () { | |
| 62 | -?> | |
| 63 | - <script type="text/javascript"> | |
| 64 | - jQuery(document).ready( function($) { | |
| 65 | - // In case someone got here first. | |
| 66 | - $('.postbox h3, .postbox .handlediv').unbind('click'); | |
| 67 | - $('.postbox h3 a').unbind('click'); | |
| 68 | - $('.hide-postbox-tog').unbind('click'); | |
| 69 | - $('.columns-prefs input[type="radio"]').unbind('click'); | |
| 70 | - $('.meta-box-sortables').sortable('destroy'); | |
| 71 | - | |
| 72 | - postboxes.add_postbox_toggles('feedwordpresssyndication'); | |
| 73 | - } ); | |
| 74 | - </script> | |
| 75 | -<?php | |
| 76 | -} | |
| 18 | +class FeedWordPressSyndicationPage extends FeedWordPressAdminPage { | |
| 19 | + function FeedWordPressSyndicationPage () { | |
| 20 | + FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpresssyndication', /*link=*/ NULL); | |
| 77 | 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">—<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__); ?>&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 | + | |
| 78 | 204 | function fwp_dashboard_update_if_requested () { |
| 79 | 205 | global $wpdb; |
| 80 | 206 | |
| 81 | 207 | if (isset($_POST['update']) or isset($_POST['action']) or isset($_POST['update_uri'])) : |
| @@ -102,9 +228,9 @@ | ||
| 102 | 228 | endif; |
| 103 | 229 | |
| 104 | 230 | shuffle($update_set); // randomize order for load balancing purposes... |
| 105 | 231 | if ($fwp_update_invoke != 'get' and count($update_set) > 0) : // Only do things with side-effects for HTTP POST or command line |
| 106 | - $feedwordpress =& new FeedWordPress; | |
| 232 | + $feedwordpress = new FeedWordPress; | |
| 107 | 233 | add_action('feedwordpress_check_feed', 'update_feeds_mention'); |
| 108 | 234 | add_action('feedwordpress_check_feed_complete', 'update_feeds_finish', 10, 3); |
| 109 | 235 | |
| 110 | 236 | $crash_dt = (int) get_option('feedwordpress_update_time_limit'); |
| @@ -149,153 +275,80 @@ | ||
| 149 | 275 | echo "<p>Update complete.".implode(' and', $mesg)."</p>"; |
| 150 | 276 | echo "\n"; flush(); |
| 151 | 277 | endif; |
| 152 | 278 | echo "</div> <!-- class=\"updated\" -->\n"; |
| 153 | - elseif (fwp_test_wp_version(FWP_SCHEMA_25)) : | |
| 154 | -?> | |
| 155 | - <p class="youare">Check currently scheduled feeds for new and updated posts.</p> | |
| 156 | -<?php | |
| 157 | 279 | endif; |
| 158 | 280 | } |
| 159 | 281 | |
| 160 | -function fwp_syndication_manage_page () { | |
| 161 | - global $wpdb; | |
| 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 | +} | |
| 162 | 295 | |
| 163 | - if (FeedWordPress::needs_upgrade()) : | |
| 164 | - fwp_upgrade_page(); | |
| 165 | - return; | |
| 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'; | |
| 166 | 306 | endif; |
| 167 | 307 | |
| 168 | -?> | |
| 169 | -<?php $cont = true; | |
| 170 | -if (isset($_REQUEST['action'])): | |
| 171 | - if ($_REQUEST['action'] == 'feedfinder' or $_REQUEST['action'] == FWP_SYNDICATE_NEW) : $cont = fwp_feedfinder_page(); | |
| 172 | - elseif ($_REQUEST['action'] == 'switchfeed') : $cont = fwp_switchfeed_page(); | |
| 173 | - elseif ($_REQUEST['action'] == 'linkedit') : $cont = fwp_linkedit_page(); | |
| 174 | - elseif ($_REQUEST['action'] == FWP_UNSUB_CHECKED or $_REQUEST['action'] == 'Unsubscribe') : $cont = fwp_multidelete_page(); | |
| 308 | + if (!is_null($bleg_box_hidden)) : | |
| 309 | + update_option('feedwordpress_bleg_box_hidden', $bleg_box_hidden); | |
| 310 | + else : | |
| 311 | + $bleg_box_hidden = get_option('feedwordpress_bleg_box_hidden'); | |
| 175 | 312 | endif; |
| 176 | -endif; | |
| 177 | - | |
| 178 | -if ($cont): | |
| 179 | 313 | ?> |
| 180 | -<?php | |
| 181 | - $links = FeedWordPress::syndicated_links(); | |
| 182 | -?> | |
| 183 | - <div class="wrap"> | |
| 184 | -<?php if (fwp_test_wp_version(FWP_SCHEMA_27)) : ?> | |
| 185 | - <div class="icon32"><img src="<?php print htmlspecialchars(WP_PLUGIN_URL.'/'.$GLOBALS['fwp_path'].'/feedwordpress.png'); ?>" alt="" /></div> | |
| 186 | - <h2>Syndicated Sites</h2> | |
| 187 | -<?php endif; | |
| 188 | - if (fwp_test_wp_version(0, FWP_SCHEMA_25)) : | |
| 189 | - fwp_dashboard_update_if_requested(); | |
| 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); | |
| 190 | 320 | endif; |
| 321 | + ?> | |
| 191 | 322 | |
| 192 | - if (fwp_test_wp_version(FWP_SCHEMA_27)) : | |
| 193 | - if (fwp_test_wp_version(FWP_SCHEMA_27, FWP_SCHEMA_28)) : | |
| 194 | - $hook_it = 'admin_footer'; | |
| 195 | - else : // WordPress 2.8+ | |
| 196 | - $hook_it = 'admin_footer-feedwordpress/syndication.php'; | |
| 197 | - endif; | |
| 198 | - add_action($hook_it, 'feedwordpress_syndication_toggles', /*priority=*/ 10000); | |
| 199 | - echo "<form style='display: none' method='get' action=''>\n<p>\n"; | |
| 200 | - wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); | |
| 201 | - wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); | |
| 202 | - echo "</p>\n</form>\n"; | |
| 203 | - | |
| 204 | - if ($links) : | |
| 205 | - add_meta_box( | |
| 206 | - /*id=*/ 'feedwordpress_update_box', | |
| 207 | - /*title=*/ __('Update feeds now'), | |
| 208 | - /*callback=*/ 'fwp_syndication_manage_page_update_box', | |
| 209 | - /*page=*/ 'feedwordpresssyndication', | |
| 210 | - /*context =*/ 'feedwordpresssyndication' | |
| 211 | - ); | |
| 212 | - endif; | |
| 213 | - add_meta_box( | |
| 214 | - /*id=*/ 'feedwordpress_feeds_box', | |
| 215 | - /*title=*/ __('Syndicated sources'), | |
| 216 | - /*callback=*/ 'fwp_syndication_manage_page_links_box', | |
| 217 | - /*page=*/ 'feedwordpresssyndication', | |
| 218 | - /*context =*/ 'feedwordpresssyndication' | |
| 219 | - ); | |
| 220 | -?> | |
| 221 | - <div class="metabox-holder"> | |
| 222 | - <div id="feedwordpresssyndication-sortables" class="meta-box-sortables ui-sortable"> | |
| 223 | -<?php | |
| 224 | - do_meta_boxes('feedwordpresssyndication', 'feedwordpresssyndication', NULL); | |
| 225 | - else : | |
| 226 | - if ($links): // only display Update panel if there are some links to update.... | |
| 227 | - fwp_syndication_manage_page_update_box(); | |
| 228 | - endif; | |
| 229 | - fwp_syndication_manage_page_links_box(); | |
| 230 | -?> | |
| 231 | - </div> <!-- class="wrap" --> | |
| 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 | + > | |
| 328 | + <div><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?></div> | |
| 329 | + <p>Check currently scheduled feeds for new and updated posts.</p> | |
| 232 | 330 | |
| 233 | - <?php if (fwp_test_wp_version(0, FWP_SCHEMA_25)) : ?> | |
| 234 | - <div class="wrap"> | |
| 235 | - <form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post"> | |
| 236 | - <div><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?></div> | |
| 237 | - <h2>Add a new syndicated site:</h2> | |
| 238 | - <div> | |
| 239 | - <label for="add-uri">Website or feed:</label> | |
| 240 | - <input type="text" name="lookup" id="add-uri" value="URI" size="64" /> | |
| 241 | - <input type="hidden" name="action" value="feedfinder" /> | |
| 242 | - </div> | |
| 243 | - <div class="submit"><input type="submit" value="Syndicate »" /></div> | |
| 244 | - </form> | |
| 245 | - </div> <!-- class="wrap" --> | |
| 246 | - <?php endif; ?> | |
| 331 | + <?php | |
| 332 | + fwp_dashboard_update_if_requested(); | |
| 247 | 333 | |
| 248 | - <div style="display: none"> | |
| 249 | - <div id="tags-input"></div> <!-- avoid JS error from WP 2.5 bug --> | |
| 250 | - </div> | |
| 251 | -<?php | |
| 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 & Update Settings<a></a>.</p> | |
| 340 | + <?php | |
| 252 | 341 | endif; |
| 253 | -endif; | |
| 254 | -} /* function fwp_syndication_manage_page () */ | |
| 342 | + ?> | |
| 255 | 343 | |
| 256 | -function fwp_syndication_manage_page_update_box ($object = NULL, $box = NULL) { | |
| 257 | - $updateFeedsNow = __('Update feeds now'); | |
| 258 | -?> | |
| 259 | - <form action="" method="POST"> | |
| 260 | - <div><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?></div> | |
| 261 | - <?php if (fwp_test_wp_version(FWP_SCHEMA_25, FWP_SCHEMA_27)) : ?> | |
| 262 | - <div id="rightnow"> | |
| 263 | - <h3 class="reallynow"><span><?php print $updateFeedsNow; ?></span> | |
| 264 | - <input type="hidden" name="update_uri" value="*" /><input style="float: right; border: none;" class="rbutton" type="submit" name="update" value="Update" /> | |
| 265 | - <br class="clear"/></h3> | |
| 266 | - <?php elseif (fwp_test_wp_version(0, FWP_SCHEMA_25)) : ?> | |
| 267 | - <h2><?php print $updateFeedsNow; ?></h2> | |
| 268 | - <?php endif; ?> | |
| 269 | - | |
| 270 | -<?php | |
| 271 | - if (fwp_test_wp_version(FWP_SCHEMA_25)) : | |
| 272 | - fwp_dashboard_update_if_requested(); | |
| 273 | - else : | |
| 274 | -?> | |
| 275 | -<p>Check currently scheduled feeds for new and updated posts.</p> | |
| 276 | -<?php endif; ?> | |
| 277 | - | |
| 278 | -<?php if (!get_option('feedwordpress_automatic_updates')) : ?> | |
| 279 | - <p class="youhave"><strong>Note:</strong> Automatic updates are currently turned | |
| 280 | - <strong>off</strong>. New posts from your feeds will not be syndicated | |
| 281 | - until you manually check for them here. You can turn on automatic | |
| 282 | - updates under <a href="admin.php?page=<?php print $GLOBALS['fwp_path']; ?>/syndication-options.php">Syndication | |
| 283 | - Options</a>.</p> | |
| 284 | -<?php endif; ?> | |
| 285 | - | |
| 286 | - <?php if (!fwp_test_wp_version(FWP_SCHEMA_25, FWP_SCHEMA_27)) : ?> | |
| 287 | 344 | <div class="submit"><input type="hidden" name="update_uri" value="*" /><input class="button-primary" type="submit" name="update" value="Update" /></div> |
| 288 | - <?php endif; ?> | |
| 289 | 345 | |
| 290 | 346 | <?php if (fwp_test_wp_version(FWP_SCHEMA_27)) : ?> |
| 291 | 347 | <br style="clear: both" /> |
| 292 | - <?php elseif (fwp_test_wp_version(FWP_SCHEMA_25, FWP_SCHEMA_27)) : ?> | |
| 348 | + <?php /* elseif (fwp_test_wp_version(FWP_SCHEMA_25, FWP_SCHEMA_27)) : | |
| 293 | 349 | </div> <!-- id="rightnow" --> |
| 294 | - </div> <!-- class="wrap" --> | |
| 295 | - <?php elseif (fwp_test_wp_version(0, FWP_SCHEMA_25)) : ?> | |
| 296 | - </div> <!-- class="wrap" --> | |
| 297 | - <?php endif; ?> | |
| 350 | + <?php */ endif; ?> | |
| 298 | 351 | </form> |
| 299 | 352 | <?php |
| 300 | 353 | } /* function fwp_syndication_manage_page_update_box () */ |
| 301 | 354 | |
| @@ -301,13 +354,8 @@ | ||
| 301 | 354 | |
| 302 | 355 | function fwp_syndication_manage_page_links_box ($object = NULL, $box = NULL) { |
| 303 | 356 | $links = FeedWordPress::syndicated_links(); |
| 304 | 357 | ?> |
| 305 | - <?php if (!fwp_test_wp_version(FWP_SCHEMA_27)) : ?> | |
| 306 | - <div class="wrap"> | |
| 307 | - <h2>Syndicated Sites</h2> | |
| 308 | - <?php endif; ?> | |
| 309 | - | |
| 310 | 358 | <form id="syndicated-links" action="admin.php?page=<?php print $GLOBALS['fwp_path']; ?>/<?php echo basename(__FILE__); ?>" method="post"> |
| 311 | 359 | <div><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?></div> |
| 312 | 360 | |
| 313 | 361 | <?php $alt_row = true; ?> |
| @@ -316,25 +364,10 @@ | ||
| 316 | 364 | <div class="tablenav"> |
| 317 | 365 | <div class="alignright"> |
| 318 | 366 | <label for="add-uri">Add new source:</label> |
| 319 | 367 | <input type="text" name="lookup" id="add-uri" value="Website or feed URI" /> |
| 320 | -<script type="text/javascript"> | |
| 321 | -jQuery(document).ready( function () { | |
| 322 | - var addUri = jQuery("#add-uri"); | |
| 323 | - var box = addUri.get(0); | |
| 324 | - if (box.value==box.defaultValue) { addUri.addClass('form-input-tip'); } | |
| 325 | - addUri.focus(function() { | |
| 326 | - if ( this.value == this.defaultValue ) | |
| 327 | - jQuery(this).val( '' ).removeClass( 'form-input-tip' ); | |
| 328 | - }); | |
| 329 | - addUri.blur(function() { | |
| 330 | - if ( this.value == '' ) | |
| 331 | - jQuery(this).val( this.defaultValue ).addClass( 'form-input-tip' ); | |
| 332 | - }); | |
| 368 | + <?php FeedWordPressSettingsUI::magic_input_tip_js('add-uri'); ?> | |
| 333 | 369 | |
| 334 | -} ); | |
| 335 | -</script> | |
| 336 | - | |
| 337 | 370 | <input type="hidden" name="action" value="feedfinder" /> |
| 338 | 371 | <input type="submit" class="button-secondary" name="action" value="<?php print FWP_SYNDICATE_NEW; ?>" /></div> |
| 339 | 372 | |
| 340 | 373 | <?php if (count($links) > 0) : ?> |
| @@ -375,33 +408,22 @@ | ||
| 375 | 408 | $caption=__('Find Feed'); |
| 376 | 409 | endif; |
| 377 | 410 | ?> |
| 378 | 411 | <td> |
| 379 | -<strong><a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>&link_id=<?php echo $link->link_id; ?>&action=linkedit"><?php echo wp_specialchars($link->link_name, 'both'); ?></a></strong> | |
| 412 | +<strong><a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/feeds-page.php&link_id=<?php echo $link->link_id; ?>"><?php echo esc_html($link->link_name); ?></a></strong> | |
| 380 | 413 | <div class="row-actions"><div><strong>Settings ></strong> |
| 381 | -<a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>&link_id=<?php echo $link->link_id; ?>&action=linkedit"><?php _e('Feed'); ?></a> | |
| 414 | +<a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/feeds-page.php&link_id=<?php echo $link->link_id; ?>"><?php _e('Feed'); ?></a> | |
| 382 | 415 | | <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/posts-page.php&link_id=<?php echo $link->link_id; ?>"><?php _e('Posts'); ?></a> |
| 383 | 416 | | <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/authors-page.php&link_id=<?php echo $link->link_id; ?>"><?php _e('Authors'); ?></a> |
| 384 | -| <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/categories-page.php&link_id=<?php echo $link->link_id; ?>"><?php _e('Categories & Tags'); ?></a></div> | |
| 417 | +| <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/categories-page.php&link_id=<?php echo $link->link_id; ?>"><?php print htmlspecialchars(__('Categories'.FEEDWORDPRESS_AND_TAGS)); ?></a></div> | |
| 385 | 418 | <div><strong>Actions ></strong> |
| 386 | 419 | <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>&link_id=<?php echo $link->link_id; ?>&action=feedfinder"><?php echo $caption; ?></a> |
| 387 | 420 | | <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>&link_id=<?php echo $link->link_id; ?>&action=Unsubscribe"><?php _e('Unsubscribe'); ?></a> |
| 388 | -| <a href="<?php echo wp_specialchars($link->link_url, 'both'); ?>"><?php _e('View')?></a></div> | |
| 421 | +| <a href="<?php echo esc_html($link->link_url); ?>"><?php _e('View')?></a></div> | |
| 389 | 422 | </div> |
| 390 | 423 | </td> |
| 391 | -<?php | |
| 392 | - if (strlen($link->link_rss) > 0): | |
| 393 | - $uri_bits = parse_url($link->link_rss); | |
| 394 | - $uri_bits['host'] = preg_replace('/^www\./i', '', $uri_bits['host']); | |
| 395 | - $display_uri = | |
| 396 | - (isset($uri_bits['user'])?$uri_bits['user'].'@':'') | |
| 397 | - .(isset($uri_bits['host'])?$uri_bits['host']:'') | |
| 398 | - .(isset($uri_bits['port'])?':'.$uri_bits['port']:'') | |
| 399 | - .(isset($uri_bits['path'])?$uri_bits['path']:'') | |
| 400 | - .(isset($uri_bits['query'])?'?'.$uri_bits['query']:''); | |
| 401 | - if (strlen($display_uri) > 32) : $display_uri = substr($display_uri, 0, 32).'…'; endif; | |
| 402 | -?> | |
| 403 | - <td><a href="<?php echo wp_specialchars($link->link_rss, 'both'); ?>"><?php echo wp_specialchars($display_uri, 'both'); ?></a></td> | |
| 424 | + <?php if (strlen($link->link_rss) > 0): ?> | |
| 425 | + <td><a href="<?php echo esc_html($link->link_rss); ?>"><?php echo esc_html(feedwordpress_display_url($link->link_rss, 32)); ?></a></td> | |
| 404 | 426 | <?php else: ?> |
| 405 | 427 | <td style="background-color:#FFFFD0"><p><strong>no |
| 406 | 428 | feed assigned</strong></p></td> |
| 407 | 429 | <?php endif; ?> |
| @@ -406,9 +428,9 @@ | ||
| 406 | 428 | feed assigned</strong></p></td> |
| 407 | 429 | <?php endif; ?> |
| 408 | 430 | |
| 409 | 431 | <td><?php |
| 410 | - $sLink =& new SyndicatedLink($link->link_id); | |
| 432 | + $sLink = new SyndicatedLink($link->link_id); | |
| 411 | 433 | if (isset($sLink->settings['update/last'])) : |
| 412 | 434 | print fwp_time_elapsed($sLink->settings['update/last']); |
| 413 | 435 | else : |
| 414 | 436 | _e('None yet'); |
| @@ -418,8 +440,9 @@ | ||
| 418 | 440 | if (isset($sLink->settings['update/ttl']) and is_numeric($sLink->settings['update/ttl'])) : |
| 419 | 441 | if (isset($sLink->settings['update/timed']) and $sLink->settings['update/timed']=='automatically') : |
| 420 | 442 | $next = $sLink->settings['update/last'] + ((int) $sLink->settings['update/ttl'] * 60); |
| 421 | 443 | print fwp_time_elapsed($next); |
| 444 | + if (FEEDWORDPRESS_DEBUG) : print " [".(($next-time())/60)." minutes]"; endif; | |
| 422 | 445 | else : |
| 423 | 446 | echo "every ".$sLink->settings['update/ttl']." minute".(($sLink->settings['update/ttl']!=1)?"s":""); |
| 424 | 447 | endif; |
| 425 | 448 | else: |
| @@ -424,8 +447,9 @@ | ||
| 424 | 447 | endif; |
| 425 | 448 | else: |
| 426 | 449 | echo "as soon as possible"; |
| 427 | 450 | endif; |
| 451 | + unset($sLink); | |
| 428 | 452 | print "</div>"; |
| 429 | 453 | ?> |
| 430 | 454 | </td> |
| 431 | 455 | </tr> |
| @@ -450,484 +474,64 @@ | ||
| 450 | 474 | <?php |
| 451 | 475 | } /* function fwp_syndication_manage_page_links_box() */ |
| 452 | 476 | |
| 453 | 477 | function fwp_feedfinder_page () { |
| 454 | - global $wpdb; | |
| 455 | - global $FeedWordPressHTTPStatusMessages; | |
| 478 | + global $post_source; | |
| 479 | + | |
| 480 | + $post_source = 'feedwordpress_feeds'; | |
| 481 | + | |
| 482 | + // With action=feedfinder, this goes directly to the feedfinder page | |
| 483 | + include_once(dirname(__FILE__) . '/feeds-page.php'); | |
| 484 | + return false; | |
| 485 | +} /* function fwp_feedfinder_page () */ | |
| 456 | 486 | |
| 457 | - $lookup = (isset($_REQUEST['lookup'])?$_REQUEST['lookup']:NULL); | |
| 458 | - | |
| 459 | - if (isset($_REQUEST['link_id']) and ($_REQUEST['link_id']!=0)): | |
| 460 | - $link_id = $_REQUEST['link_id']; | |
| 461 | - if (!is_numeric($link_id)) : FeedWordPress::critical_bug('fwp_feedfinder_page::link_id', $link_id, __LINE__); endif; | |
| 462 | - | |
| 463 | - $link = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id='".$wpdb->escape($link_id)."'"); | |
| 464 | - if (is_object($link)): | |
| 465 | - if (is_null($lookup)) $lookup = $link->link_url; | |
| 466 | - $name = wp_specialchars($link->link_name, 'both'); | |
| 467 | - else: | |
| 468 | - die (__("Cheatin' uh ?")); | |
| 469 | - endif; | |
| 470 | - else: | |
| 471 | - $name = "<code>".htmlspecialchars($lookup)."</code>"; | |
| 472 | - $link_id = 0; | |
| 473 | - endif; | |
| 474 | -?> | |
| 475 | - <div class="wrap"> | |
| 476 | - <h2>Feed Finder: <?php echo $name; ?></h2> | |
| 477 | -<?php | |
| 478 | - $f =& new FeedFinder($lookup); | |
| 479 | - $feeds = $f->find(); | |
| 480 | - if (count($feeds) > 0): | |
| 481 | - foreach ($feeds as $key => $f): | |
| 482 | - $rss = fetch_rss($f); | |
| 483 | - if ($rss): | |
| 484 | - $feed_title = isset($rss->channel['title'])?$rss->channel['title']:$rss->channel['link']; | |
| 485 | - $feed_link = isset($rss->channel['link'])?$rss->channel['link']:''; | |
| 486 | - else : | |
| 487 | - // Give us some sucky defaults | |
| 488 | - $uri_bits = parse_url($lookup); | |
| 489 | - $uri_bits['host'] = preg_replace('/^www\./i', '', $uri_bits['host']); | |
| 490 | - $display_uri = | |
| 491 | - (isset($uri_bits['user'])?$uri_bits['user'].'@':'') | |
| 492 | - .(isset($uri_bits['host'])?$uri_bits['host']:'') | |
| 493 | - .(isset($uri_bits['port'])?':'.$uri_bits['port']:'') | |
| 494 | - .(isset($uri_bits['path'])?$uri_bits['path']:'') | |
| 495 | - .(isset($uri_bits['query'])?'?'.$uri_bits['query']:''); | |
| 496 | - if (strlen($display_uri) > 32) : $display_uri = substr($display_uri, 0, 32).'…'; endif; | |
| 497 | - | |
| 498 | - $feed_title = $display_uri; | |
| 499 | - $feed_link = $lookup; | |
| 500 | - endif; | |
| 501 | -?> | |
| 502 | - <form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post"> | |
| 503 | - <div><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_switchfeed'); ?></div> | |
| 504 | - <fieldset style="clear: both"> | |
| 505 | - <legend><?php echo $rss->feed_type; ?> <?php echo $rss->feed_version; ?> feed</legend> | |
| 506 | - | |
| 507 | - <?php if ($link_id===0): ?> | |
| 508 | - <input type="hidden" name="feed_title" value="<?php echo wp_specialchars($feed_title, 'both'); ?>" /> | |
| 509 | - <input type="hidden" name="feed_link" value="<?php echo wp_specialchars($feed_link, 'both'); ?>" /> | |
| 510 | - <?php endif; ?> | |
| 511 | - | |
| 512 | - <input type="hidden" name="link_id" value="<?php echo $link_id; ?>" /> | |
| 513 | - <input type="hidden" name="feed" value="<?php echo wp_specialchars($f, 'both'); ?>" /> | |
| 514 | - <input type="hidden" name="action" value="switchfeed" /> | |
| 515 | - | |
| 516 | - <div> | |
| 517 | - <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"> | |
| 518 | -<?php if (count($rss->items) > 0): ?> | |
| 519 | - <?php | |
| 520 | - // Prepare to display Sample Item | |
| 521 | - $link =& new MagpieMockLink($rss, $f); | |
| 522 | - $post =& new SyndicatedPost($rss->items[0], $link); | |
| 523 | - ?> | |
| 524 | - <h3>Sample Item</h3> | |
| 525 | - <ul> | |
| 526 | - <li><strong>Title:</strong> <a href="<?php echo $post->post['meta']['syndication_permalink']; ?>"><?php echo $post->post['post_title']; ?></a></li> | |
| 527 | - <li><strong>Date:</strong> <?php print date('d-M-y g:i:s a', $post->published()); ?></li> | |
| 528 | - </ul> | |
| 529 | - <div class="entry"> | |
| 530 | - <?php print $post->post['post_content']; ?> | |
| 531 | - </div> | |
| 532 | -<?php else: ?> | |
| 533 | - <h3>No Items</h3> | |
| 534 | - <p>FeedWordPress found no posts on this feed.</p> | |
| 535 | -<?php endif; ?> | |
| 536 | - </div> | |
| 537 | - | |
| 538 | - <div> | |
| 539 | - <h3>Feed Information</h3> | |
| 540 | - <ul> | |
| 541 | - <li><strong>Website:</strong> <a href="<?php echo $feed_link; ?>"><?php echo is_null($feed_title)?'<em>Unknown</em>':$feed_title; ?></a></li> | |
| 542 | - <li><strong>Feed URI:</strong> <a href="<?php echo wp_specialchars($f, 'both'); ?>"><?php echo wp_specialchars($f, 'both'); ?></a> (<a title="Check feed <<?php echo wp_specialchars($f, 'both'); ?>> for validity" href="http://feedvalidator.org/check.cgi?url=<?php echo urlencode($f); ?>">validate</a>)</li> | |
| 543 | - <li><strong>Encoding:</strong> <?php echo isset($rss->encoding)?wp_specialchars($rss->encoding, 'both'):"<em>Unknown</em>"; ?></li> | |
| 544 | - <li><strong>Description:</strong> <?php echo isset($rss->channel['description'])?wp_specialchars($rss->channel['description'], 'both'):"<em>Unknown</em>"; ?></li> | |
| 545 | - </ul> | |
| 546 | - <div class="submit"><input type="submit" name="Use" value="« Use this feed" /></div> | |
| 547 | - <div class="submit"><input type="submit" name="Cancel" value="« Cancel" /></div> | |
| 548 | - </div> | |
| 549 | - </div> | |
| 550 | - </fieldset> | |
| 551 | - </form> | |
| 552 | -<?php | |
| 553 | - endforeach; | |
| 554 | - else: | |
| 555 | - print "<p><strong>".__('Error').":</strong> ".__("FeedWordPress couldn't find any feeds at").' <code><a href="'.htmlspecialchars($lookup).'">'.htmlspecialchars($lookup).'</a></code>'; | |
| 556 | - print ". ".__('Try another URL').".</p>"; | |
| 557 | - | |
| 558 | - // Diagnostics | |
| 559 | - $httpObject = _wp_http_get_object(); | |
| 560 | - $transports = $httpObject->_getTransport(); | |
| 561 | - print "<div class=\"updated\" style=\"margin-left: 3.0em; margin-right: 3.0em;\">\n"; | |
| 562 | - print "<h3>".__('Diagnostic information')."</h3>\n"; | |
| 563 | - if (!is_null($f->error())) : | |
| 564 | - print "<h4>".__('HTTP request failure')."</h4>\n"; | |
| 565 | - print "<p>".$f->error()."</p>\n"; | |
| 566 | - else : | |
| 567 | - print "<h4>".__('HTTP request completed')."</h4>\n"; | |
| 568 | - print "<p><strong>Status ".$f->status().":</strong> ".$FeedWordPressHTTPStatusMessages[$f->status()]."</p>\n"; | |
| 569 | - endif; | |
| 570 | - print "<h4>".__('HTTP Transports available').":</h4>\n"; | |
| 571 | - print "<ol>\n"; | |
| 572 | - print "<li>".implode("</li>\n<li>", array_map('get_class', $transports))."</li>\n"; | |
| 573 | - print "</ol>\n"; | |
| 574 | - print "</div>\n"; | |
| 575 | - endif; | |
| 576 | -?> | |
| 577 | - </div> | |
| 578 | - | |
| 579 | - <form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post"> | |
| 580 | - <div><?php | |
| 581 | - FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); | |
| 582 | - ?></div> | |
| 583 | - <div class="wrap"> | |
| 584 | - <h2>Use another feed</h2> | |
| 585 | - <div><label>Feed:</label> | |
| 586 | - <input type="text" name="lookup" value="URI" /> | |
| 587 | - <input type="hidden" name="link_id" value="<?php echo $link_id; ?>" /> | |
| 588 | - <input type="hidden" name="action" value="feedfinder" /></div> | |
| 589 | - <div class="submit"><input type="submit" value="Use this feed »" /></div> | |
| 590 | - </div> | |
| 591 | - </form> | |
| 592 | -<?php | |
| 593 | - return false; // Don't continue | |
| 594 | -} | |
| 595 | - | |
| 596 | 487 | function fwp_switchfeed_page () { |
| 597 | 488 | global $wpdb, $wp_db_version; |
| 489 | + global $fwp_post; | |
| 598 | 490 | |
| 599 | 491 | // If this is a POST, validate source and user credentials |
| 600 | 492 | FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_switchfeed', /*capability=*/ 'manage_links'); |
| 601 | 493 | |
| 602 | - if (!isset($_REQUEST['Cancel'])): | |
| 603 | - if (isset($_POST['link_id']) and ($_POST['link_id']==0)): | |
| 604 | - $link_id = FeedWordPress::syndicate_link($_REQUEST['feed_title'], $_REQUEST['feed_link'], $_REQUEST['feed']); | |
| 605 | - if ($link_id): ?> | |
| 606 | -<div class="updated"><p><a href="<?php echo stripslashes($_REQUEST['feed_link']); ?>"><?php echo wp_specialchars(stripslashes($_REQUEST['feed_title']), 'both'); ?></a> | |
| 607 | -has been added as a contributing site, using the feed at <<a href="<?php echo stripslashes($_REQUEST['feed']); ?>"><?php echo wp_specialchars(stripslashes($_REQUEST['feed']), 'both'); ?></a>>. | |
| 608 | -| <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>&link_id=<?php echo $link_id; ?>&action=linkedit">Configure settings</a>.</div> | |
| 494 | + $changed = false; | |
| 495 | + if (!isset($fwp_post['Cancel'])): | |
| 496 | + if (isset($fwp_post['save_link_id']) and ($fwp_post['save_link_id']=='*')) : | |
| 497 | + $changed = true; | |
| 498 | + $link_id = FeedWordPress::syndicate_link($fwp_post['feed_title'], $fwp_post['feed_link'], $fwp_post['feed']); | |
| 499 | + if ($link_id): | |
| 500 | + $existingLink = new SyndicatedLink($link_id); | |
| 501 | + ?> | |
| 502 | +<div class="updated"><p><a href="<?php print $fwp_post['feed_link']; ?>"><?php print esc_html($fwp_post['feed_title']); ?></a> | |
| 503 | +has been added as a contributing site, using the feed at | |
| 504 | +<<a href="<?php print $fwp_post['feed']; ?>"><?php print esc_html($fwp_post['feed']); ?></a>>. | |
| 505 | +| <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/feeds-page.php&link_id=<?php print $link_id; ?>">Configure settings</a>.</p></div> | |
| 609 | 506 | <?php else: ?> |
| 610 | -<div class="updated"><p>There was a problem adding the feed. [SQL: <?php echo wp_specialchars(mysql_error(), 'both'); ?>]</p></div> | |
| 507 | +<div class="updated"><p>There was a problem adding the feed. [SQL: <?php echo esc_html(mysql_error()); ?>]</p></div> | |
| 611 | 508 | <?php endif; |
| 612 | - elseif (isset($_POST['link_id'])): | |
| 613 | - // Update link_rss | |
| 614 | - $result = $wpdb->query(" | |
| 615 | - UPDATE $wpdb->links | |
| 616 | - SET | |
| 617 | - link_rss = '".$wpdb->escape($_REQUEST['feed'])."' | |
| 618 | - WHERE link_id = '".$wpdb->escape($_REQUEST['link_id'])."' | |
| 619 | - "); | |
| 620 | - | |
| 621 | - if ($result): | |
| 622 | - $result = $wpdb->get_row(" | |
| 623 | - SELECT link_name, link_url FROM $wpdb->links | |
| 624 | - WHERE link_id = '".$wpdb->escape($_REQUEST['link_id'])."' | |
| 625 | - "); | |
| 626 | - ?> | |
| 627 | -<div class="updated"><p>Feed for <a href="<?php echo $result->link_url; ?>"><?php echo wp_specialchars($result->link_name, 'both'); ?></a> | |
| 628 | -updated to <<a href="<?php echo $_REQUEST['feed']; ?>"><?php echo wp_specialchars($_REQUEST['feed'], 'both'); ?></a>>.</p></div> | |
| 629 | - <?php else: ?> | |
| 630 | -<div class="updated"><p>Nothing was changed.</p></div> | |
| 631 | - <?php endif; | |
| 632 | - endif; | |
| 633 | - endif; | |
| 634 | - return true; // Continue | |
| 635 | -} | |
| 509 | + elseif (isset($fwp_post['save_link_id'])): | |
| 510 | + $existingLink = new SyndicatedLink($fwp_post['save_link_id']); | |
| 511 | + $changed = $existingLink->set_uri($fwp_post['feed']); | |
| 636 | 512 | |
| 637 | -function fwp_linkedit_page () { | |
| 638 | - global $wpdb, $wp_db_version; | |
| 639 | - | |
| 640 | - // If this is a POST, validate source and user credentials | |
| 641 | - FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_linkedit', /*capability=*/ 'manage_links'); | |
| 642 | - | |
| 643 | - $special_settings = array ( /* Regular expression syntax is OK here */ | |
| 644 | - 'cats', | |
| 645 | - 'cat_split', | |
| 646 | - 'hardcode name', | |
| 647 | - 'hardcode url', | |
| 648 | - 'hardcode description', | |
| 649 | - 'hardcode categories', /* Deprecated */ | |
| 650 | - 'post status', | |
| 651 | - 'comment status', | |
| 652 | - 'ping status', | |
| 653 | - 'unfamiliar author', | |
| 654 | - 'unfamliar categories', /* Deprecated */ | |
| 655 | - 'unfamiliar category', | |
| 656 | - 'map authors', | |
| 657 | - 'tags', | |
| 658 | - 'update/.*', | |
| 659 | - 'feed/.*', | |
| 660 | - 'link/.*', | |
| 661 | - ); | |
| 662 | - | |
| 663 | - if (isset($_REQUEST['feedfinder'])) : | |
| 664 | - return fwp_feedfinder_page(); // re-route to Feed Finder page | |
| 665 | - else : | |
| 666 | - $link_id = (int) $_REQUEST['link_id']; | |
| 667 | - $link =& new SyndicatedLink($link_id); | |
| 668 | - | |
| 669 | - if ($link->found()) : | |
| 670 | - if (isset($GLOBALS['fwp_post']['save'])) : | |
| 671 | - $alter = array (); | |
| 672 | - | |
| 673 | - // custom feed settings first | |
| 674 | - foreach ($GLOBALS['fwp_post']['notes'] as $mn) : | |
| 675 | - $mn['key0'] = trim($mn['key0']); | |
| 676 | - $mn['key1'] = trim($mn['key1']); | |
| 677 | - if (preg_match("\007^((" | |
| 678 | - .implode(')|(',$special_settings) | |
| 679 | - ."))$\007i", | |
| 680 | - $mn['key1'])) : | |
| 681 | - $mn['key1'] = 'user/'.$mn['key1']; | |
| 682 | - endif; | |
| 683 | - | |
| 684 | - if (strlen($mn['key0']) > 0) : | |
| 685 | - unset($link->settings[$mn['key0']]); // out with the old | |
| 686 | - endif; | |
| 687 | - | |
| 688 | - if (($mn['action']=='update') and (strlen($mn['key1']) > 0)) : | |
| 689 | - $link->settings[$mn['key1']] = $mn['value']; // in with the new | |
| 690 | - endif; | |
| 691 | - endforeach; | |
| 692 | - | |
| 693 | - // now stuff through the web form | |
| 694 | - // hardcoded feed info | |
| 695 | - if (isset($GLOBALS['fwp_post']['hardcode_name'])) : | |
| 696 | - $link->settings['hardcode name'] = $GLOBALS['fwp_post']['hardcode_name']; | |
| 697 | - if (FeedWordPress::affirmative($link->settings, 'hardcode name')) : | |
| 698 | - $alter[] = "link_name = '".$wpdb->escape($GLOBALS['fwp_post']['name'])."'"; | |
| 699 | - endif; | |
| 700 | - endif; | |
| 701 | - if (isset($GLOBALS['fwp_post']['hardcode_description'])) : | |
| 702 | - $link->settings['hardcode description'] = $GLOBALS['fwp_post']['hardcode_description']; | |
| 703 | - if (FeedWordPress::affirmative($link->settings, 'hardcode description')) : | |
| 704 | - $alter[] = "link_description = '".$wpdb->escape($GLOBALS['fwp_post']['description'])."'"; | |
| 705 | - endif; | |
| 706 | - endif; | |
| 707 | - if (isset($GLOBALS['fwp_post']['hardcode_url'])) : | |
| 708 | - $link->settings['hardcode url'] = $GLOBALS['fwp_post']['hardcode_url']; | |
| 709 | - if (FeedWordPress::affirmative($link->settings, 'hardcode url')) : | |
| 710 | - $alter[] = "link_url = '".$wpdb->escape($GLOBALS['fwp_post']['linkurl'])."'"; | |
| 711 | - endif; | |
| 712 | - endif; | |
| 713 | - | |
| 714 | - // Update scheduling | |
| 715 | - if (isset($GLOBALS['fwp_post']['update_schedule'])) : | |
| 716 | - $link->settings['update/hold'] = $GLOBALS['fwp_post']['update_schedule']; | |
| 717 | - endif; | |
| 718 | - | |
| 719 | - $alter[] = "link_notes = '".$wpdb->escape($link->settings_to_notes())."'"; | |
| 720 | - | |
| 721 | - $alter_set = implode(", ", $alter); | |
| 722 | - | |
| 723 | - // issue update query | |
| 724 | - $result = $wpdb->query(" | |
| 725 | - UPDATE $wpdb->links | |
| 726 | - SET $alter_set | |
| 727 | - WHERE link_id='$link_id' | |
| 728 | - "); | |
| 729 | - $updated_link = true; | |
| 730 | - | |
| 731 | - // reload link information from DB | |
| 732 | - if (function_exists('clean_bookmark_cache')) : | |
| 733 | - clean_bookmark_cache($link_id); | |
| 734 | - endif; | |
| 735 | - $link =& new SyndicatedLink($link_id); | |
| 736 | - else : | |
| 737 | - $updated_link = false; | |
| 513 | + if ($changed): | |
| 514 | + $home = $existingLink->homepage(/*from feed=*/ false); | |
| 515 | + $name = $existingLink->name(/*from feed=*/ false); | |
| 516 | + ?> | |
| 517 | +<div class="updated"><p>Feed for <a href="<?php echo esc_html($home); ?>"><?php echo esc_html($name); ?></a> | |
| 518 | +updated to <<a href="<?php echo esc_html($fwp_post['feed']); ?>"><?php echo esc_html($fwp_post['feed']); ?></a>>.</p></div> | |
| 519 | + <?php | |
| 738 | 520 | endif; |
| 739 | - | |
| 740 | - $db_link = $link->link; | |
| 741 | - $link_url = wp_specialchars($db_link->link_url, 1); | |
| 742 | - $link_name = wp_specialchars($db_link->link_name, 1); | |
| 743 | - $link_description = wp_specialchars($db_link->link_description, 'both'); | |
| 744 | - $link_rss_uri = wp_specialchars($db_link->link_rss, 'both'); | |
| 745 | - else : | |
| 746 | - die( __('Link not found.') ); | |
| 747 | 521 | endif; |
| 522 | + endif; | |
| 748 | 523 | |
| 749 | - ?> | |
| 750 | -<script type="text/javascript"> | |
| 751 | - function flip_hardcode (item) { | |
| 752 | - ed=document.getElementById('basics-'+item+'-edit'); | |
| 753 | - view=document.getElementById('basics-'+item+'-view'); | |
| 754 | - | |
| 755 | - o = document.getElementById('basics-hardcode-'+item); | |
| 756 | - if (o.value=='yes') { ed.style.display='inline'; view.style.display='none'; } | |
| 757 | - else { ed.style.display='none'; view.style.display='inline'; } | |
| 758 | - } | |
| 759 | -</script> | |
| 760 | - | |
| 761 | -<?php if ($updated_link) : ?> | |
| 762 | -<div class="updated"><p>Syndicated feed settings updated.</p></div> | |
| 763 | -<?php endif; ?> | |
| 764 | - | |
| 765 | -<form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post"> | |
| 766 | -<div class="wrap"> | |
| 767 | -<?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_linkedit'); ?> | |
| 768 | -<input type="hidden" name="link_id" value="<?php echo $link_id; ?>" /> | |
| 769 | -<input type="hidden" name="action" value="linkedit" /> | |
| 770 | -<input type="hidden" name="save" value="link" /> | |
| 771 | - | |
| 772 | -<?php if (fwp_test_wp_version(FWP_SCHEMA_27)) : ?> | |
| 773 | - <div class="icon32"><img src="<?php print htmlspecialchars(WP_PLUGIN_URL.'/'.$GLOBALS['fwp_path'].'/feedwordpress.png'); ?>" alt="" /></div> | |
| 774 | -<?php endif; ?> | |
| 775 | - | |
| 776 | -<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> | |
| 777 | - | |
| 778 | -<div id="poststuff"> | |
| 779 | -<?php fwp_linkedit_single_submit($status); ?> | |
| 780 | - | |
| 781 | -<div id="post-body"> | |
| 782 | -<?php fwp_option_box_opener('Feed Information', 'feedinformationdiv'); ?> | |
| 783 | - <table class="editform" width="100%" cellspacing="2" cellpadding="5"> | |
| 784 | - <tr> | |
| 785 | - <th scope="row" width="20%"><?php _e('Feed URI:') ?></th> | |
| 786 | - <td width="60%"><a href="<?php echo wp_specialchars($link_rss_uri, 'both'); ?>"><?php echo $link_rss_uri; ?></a> | |
| 787 | - (<a href="<?php echo FEEDVALIDATOR_URI; ?>?url=<?php echo urlencode($link_rss_uri); ?>" | |
| 788 | - title="Check feed <<?php echo wp_specialchars($link_rss_uri, 'both'); ?>> for validity">validate</a>) | |
| 789 | - </td> | |
| 790 | - <td width="20%"><input type="submit" name="feedfinder" value="switch →" style="font-size:smaller" /></td> | |
| 791 | - </tr> | |
| 792 | - <tr> | |
| 793 | - <th scope="row" width="20%"><?php _e('Link Name:') ?></th> | |
| 794 | - <td width="60%"><input type="text" id="basics-name-edit" name="name" | |
| 795 | - value="<?php echo $link_name; ?>" style="width: 95%" /> | |
| 796 | - <span id="basics-name-view"><strong><?php echo $link_name; ?></strong></span> | |
| 797 | - </td> | |
| 798 | - <td> | |
| 799 | - <select id="basics-hardcode-name" onchange="flip_hardcode('name')" name="hardcode_name"> | |
| 800 | - <option value="no" <?php echo $link->hardcode('name')?'':'selected="selected"'; ?>>update automatically</option> | |
| 801 | - <option value="yes" <?php echo $link->hardcode('name')?'selected="selected"':''; ?>>edit manually</option> | |
| 802 | - </select> | |
| 803 | - </td> | |
| 804 | - </tr> | |
| 805 | - <tr> | |
| 806 | - <th scope="row" width="20%"><?php _e('Short description:') ?></th> | |
| 807 | - <td width="60%"> | |
| 808 | - <input id="basics-description-edit" type="text" name="description" value="<?php echo $link_description; ?>" style="width: 95%" /> | |
| 809 | - <span id="basics-description-view"><strong><?php echo $link_description; ?></strong></span> | |
| 810 | - </td> | |
| 811 | - <td> | |
| 812 | - <select id="basics-hardcode-description" onchange="flip_hardcode('description')" | |
| 813 | - name="hardcode_description"> | |
| 814 | - <option value="no" <?php echo $link->hardcode('description')?'':'selected="selected"'; ?>>update automatically</option> | |
| 815 | - <option value="yes" <?php echo $link->hardcode('description')?'selected="selected"':''; ?>>edit manually</option> | |
| 816 | - </select></td> | |
| 817 | - </tr> | |
| 818 | - <tr> | |
| 819 | - <th width="20%" scope="row"><?php _e('Homepage:') ?></th> | |
| 820 | - <td width="60%"> | |
| 821 | - <input id="basics-url-edit" type="text" name="linkurl" value="<?php echo $link_url; ?>" style="width: 95%;" /> | |
| 822 | - <a id="basics-url-view" href="<?php echo $link_url; ?>"><?php echo $link_url; ?></a></td> | |
| 823 | - <td> | |
| 824 | - <select id="basics-hardcode-url" onchange="flip_hardcode('url')" name="hardcode_url"> | |
| 825 | - <option value="no"<?php echo $link->hardcode('url')?'':' selected="selected"'; ?>>update automatically</option> | |
| 826 | - <option value="yes"<?php echo $link->hardcode('url')?' selected="selected"':''; ?>>edit manually</option> | |
| 827 | - </select></td></tr> | |
| 524 | + if (isset($existingLink)) : | |
| 525 | + do_action('feedwordpress_admin_switchfeed', $fwp_post['feed'], $existingLink); | |
| 526 | + endif; | |
| 828 | 527 | |
| 829 | - <tr> | |
| 830 | - <th width="20%"><?php _e('Last update') ?>:</th> | |
| 831 | - <td colspan="2"><?php | |
| 832 | - if (isset($link->settings['update/last'])) : | |
| 833 | - echo fwp_time_elapsed($link->settings['update/last'])." "; | |
| 834 | - else : | |
| 835 | - echo " none yet"; | |
| 836 | - endif; | |
| 837 | - ?></td></tr> | |
| 838 | - <tr><th width="20%">Next update:</th> | |
| 839 | - <td colspan="2"><?php | |
| 840 | - $holdem = (isset($link->settings['update/hold']) ? $link->settings['update/hold'] : 'scheduled'); | |
| 841 | - ?> | |
| 842 | - <select name="update_schedule"> | |
| 843 | - <option value="scheduled"<?php echo ($holdem=='scheduled')?' selected="selected"':''; ?>>update on schedule <?php | |
| 844 | - echo " ("; | |
| 845 | - if (isset($link->settings['update/ttl']) and is_numeric($link->settings['update/ttl'])) : | |
| 846 | - if (isset($link->settings['update/timed']) and $link->settings['update/timed']=='automatically') : | |
| 847 | - echo 'next: '; | |
| 848 | - $next = $link->settings['update/last'] + ((int) $link->settings['update/ttl'] * 60); | |
| 849 | - if (strftime('%x', time()) != strftime('%x', $next)) : | |
| 850 | - echo strftime('%x', $next)." "; | |
| 851 | - endif; | |
| 852 | - echo strftime('%X', $link->settings['update/last']+((int) $link->settings['update/ttl']*60)); | |
| 853 | - else : | |
| 854 | - echo "every ".$link->settings['update/ttl']." minute".(($link->settings['update/ttl']!=1)?"s":""); | |
| 855 | - endif; | |
| 856 | - else: | |
| 857 | - echo "next scheduled update"; | |
| 858 | - endif; | |
| 859 | - echo ")"; | |
| 860 | - ?></option> | |
| 861 | - <option value="next"<?php echo ($holdem=='next')?' selected="selected"':''; ?>>update ASAP</option> | |
| 862 | - <option value="ping"<?php echo ($holdem=='ping')?' selected="selected"':''; ?>>update only when pinged</option> | |
| 863 | - </select></tr> | |
| 864 | - </table> | |
| 865 | -<?php fwp_option_box_closer(); ?> | |
| 866 | - | |
| 867 | -<script type="text/javascript"> | |
| 868 | -flip_hardcode('name'); | |
| 869 | -flip_hardcode('description'); | |
| 870 | -flip_hardcode('url'); | |
| 871 | -</script> | |
| 872 | - | |
| 873 | -<?php fwp_linkedit_periodic_submit(); ?> | |
| 874 | - | |
| 875 | -<?php | |
| 876 | - FeedWordPressSettingsUI::instead_of_posts_box($link_id); | |
| 877 | - FeedWordPressSettingsUI::instead_of_authors_box($link_id); | |
| 878 | - FeedWordPressSettingsUI::instead_of_categories_box($link_id); | |
| 879 | - | |
| 880 | - fwp_option_box_opener('Custom Feed Settings (for use in templates)', 'postcustom', 'postbox'); | |
| 881 | -?> | |
| 882 | -<p class="setting-description">These custom settings are special fields for the <strong>feed</strong> you are | |
| 883 | -syndicating, to be retrieved in templates using the <code>get_feed_meta()</code> function. They do not create | |
| 884 | -custom fields on syndicated <strong>posts</strong>. If you want to create custom fields that are applied to each | |
| 885 | -individual post from this feed, set up the settings in <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/posts-page.php&link_id=<?php print $link_id; ?>">Syndicated Posts</a>.</p> | |
| 886 | - | |
| 887 | -<div id="postcustomstuff"> | |
| 888 | -<table id="meta-list" cellpadding="3"> | |
| 889 | - <tr> | |
| 890 | - <th>Key</th> | |
| 891 | - <th>Value</th> | |
| 892 | - <th>Action</th> | |
| 893 | - </tr> | |
| 894 | - | |
| 895 | -<?php | |
| 896 | - $i = 0; | |
| 897 | - foreach ($link->settings as $key => $value) : | |
| 898 | - if (!preg_match("\007^((".implode(')|(', $special_settings)."))$\007i", $key)) : | |
| 899 | -?> | |
| 900 | - <tr style="vertical-align:top"> | |
| 901 | - <th width="30%" scope="row"><input type="hidden" name="notes[<?php echo $i; ?>][key0]" value="<?php echo wp_specialchars($key, 'both'); ?>" /> | |
| 902 | - <input id="notes-<?php echo $i; ?>-key" name="notes[<?php echo $i; ?>][key1]" value="<?php echo wp_specialchars($key, 'both'); ?>" /></th> | |
| 903 | - <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> | |
| 904 | - <td width="10%"><select name="notes[<?php echo $i; ?>][action]"> | |
| 905 | - <option value="update">save changes</option> | |
| 906 | - <option value="delete">delete this setting</option> | |
| 907 | - </select></td> | |
| 908 | - </tr> | |
| 909 | -<?php | |
| 910 | - $i++; | |
| 911 | - endif; | |
| 912 | - endforeach; | |
| 913 | -?> | |
| 914 | - <tr> | |
| 915 | - <th scope="row"><input type="text" size="10" name="notes[<?php echo $i; ?>][key1]" value="" /></th> | |
| 916 | - <td><textarea name="notes[<?php echo $i; ?>][value]" rows="2" cols="40"></textarea></td> | |
| 917 | - <td><em>add new setting...</em><input type="hidden" name="notes[<?php echo $i; ?>][action]" value="update" /></td> | |
| 918 | - </tr> | |
| 919 | -</table> | |
| 920 | -<?php fwp_option_box_closer(); ?> | |
| 921 | - | |
| 922 | -<?php fwp_linkedit_periodic_submit(); ?> | |
| 923 | -<?php fwp_linkedit_single_submit_closer(); ?> | |
| 924 | -</div> <!-- id="post-body" --> | |
| 925 | -</div> <!-- id="poststuff" --> | |
| 926 | -</div> | |
| 927 | - <?php | |
| 528 | + if (!$changed) : | |
| 529 | + ?> | |
| 530 | +<div class="updated"><p>Nothing was changed.</p></div> | |
| 531 | + <?php | |
| 928 | 532 | endif; |
| 929 | - return false; // Don't continue | |
| 533 | + return true; // Continue | |
| 930 | 534 | } |
| 931 | 535 | |
| 932 | 536 | function fwp_multidelete_page () { |
| 933 | 537 | global $wpdb; |
| @@ -938,9 +542,15 @@ | ||
| 938 | 542 | $link_ids = (isset($_REQUEST['link_ids']) ? $_REQUEST['link_ids'] : array()); |
| 939 | 543 | if (isset($_REQUEST['link_id'])) : array_push($link_ids, $_REQUEST['link_id']); endif; |
| 940 | 544 | |
| 941 | 545 | if (isset($GLOBALS['fwp_post']['confirm']) and $GLOBALS['fwp_post']['confirm']=='Delete'): |
| 942 | - foreach ($GLOBALS['fwp_post']['link_action'] as $link_id => $what) : | |
| 546 | + if (isset($GLOBALS['fwp_post']['link_action']) and is_array($GLOBALS['fwp_post']['link_action'])) : | |
| 547 | + $actions = $GLOBALS['fwp_post']['link_action']; | |
| 548 | + else : | |
| 549 | + $actions = array(); | |
| 550 | + endif; | |
| 551 | + | |
| 552 | + foreach ($actions as $link_id => $what) : | |
| 943 | 553 | $do_it[$what][] = $link_id; |
| 944 | 554 | endforeach; |
| 945 | 555 | |
| 946 | 556 | $alter = array(); |
| @@ -1026,12 +636,12 @@ | ||
| 1026 | 636 | <input type="hidden" name="confirm" value="Delete" /> |
| 1027 | 637 | |
| 1028 | 638 | <h2>Unsubscribe from Syndicated Links:</h2> |
| 1029 | 639 | <?php foreach ($targets as $link) : |
| 1030 | - $link_url = wp_specialchars($link->link_url, 1); | |
| 1031 | - $link_name = wp_specialchars($link->link_name, 1); | |
| 1032 | - $link_description = wp_specialchars($link->link_description, 'both'); | |
| 1033 | - $link_rss = wp_specialchars($link->link_rss, 'both'); | |
| 640 | + $link_url = esc_html($link->link_url); | |
| 641 | + $link_name = esc_html($link->link_name); | |
| 642 | + $link_description = esc_html($link->link_description); | |
| 643 | + $link_rss = esc_html($link->link_rss); | |
| 1034 | 644 | ?> |
| 1035 | 645 | <fieldset> |
| 1036 | 646 | <legend><?php echo $link_name; ?></legend> |
| 1037 | 647 | <table class="editform" width="100%" cellspacing="2" cellpadding="5"> |
| @@ -1075,6 +685,7 @@ | ||
| 1075 | 685 | return false; // Don't continue on to Syndicated Sites listing |
| 1076 | 686 | endif; |
| 1077 | 687 | } |
| 1078 | 688 | |
| 1079 | - fwp_syndication_manage_page(); | |
| 689 | + $syndicationPage = new FeedWordPressSyndicationPage; | |
| 690 | + $syndicationPage->display(); | |
| 1080 | 691 | |