function update_feed() { global $feedwordpress; add_action('feedwordpress_check_feed', 'update_feeds_mention'); add_action('feedwordpress_check_feed_complete', 'update_feeds_finish', 10, 3); $link = $this->link; print '<div class="updated">'; print "<ul>"; $uri = $this->link->uri(); $displayUrl = $uri; // check for effects of an effective-url filter $effectiveUrl = $link->uri(array('fetch' => true)); if ($uri != $effectiveUrl) { $displayUrl .= ' | ' . $effectiveUrl; } $delta = $feedwordpress->update($uri); print "</ul>"; if (!is_null($delta)) { echo "<p><strong>Update complete.</strong>" . fwp_update_set_results_message($delta) . "</p>"; echo "\n"; flush(); } else { $effectiveUrl = esc_html($effectiveUrl); echo "<p><strong>Error:</strong> There was a problem updating <a href=\"{$effectiveUrl}\">{$displayUrl}</a></p>\n"; } print "</div>\n"; remove_action('feedwordpress_check_feed', 'update_feeds_mention'); remove_action('feedwordpress_check_feed_complete', 'update_feeds_finish', 10, 3); }
function ping($args) { global $feedwordpress; $delta = @$feedwordpress->update($args[1]); if (is_null($delta)) { return array('flerror' => true, 'message' => "Sorry. I don't syndicate <{$args['1']}>."); } else { $mesg = array(); return array('flerror' => false, 'message' => "Thanks for the ping." . fwp_update_set_results_message($delta)); } }
function fwp_dashboard_update_if_requested($object) { global $wpdb; $update_set = $object->updates_requested(); if (count($update_set) > 0) { shuffle($update_set); // randomize order for load balancing purposes... $feedwordpress = new FeedWordPress(); add_action('feedwordpress_check_feed', 'update_feeds_mention'); add_action('feedwordpress_check_feed_complete', 'update_feeds_finish', 10, 3); $crash_ts = $feedwordpress->crash_ts(); echo "<div class=\"update-results\">\n"; echo "<ul>\n"; $tdelta = NULL; foreach ($update_set as $uri) { if (!is_null($crash_ts) and time() > $crash_ts) { echo "<li><p><strong>Further updates postponed:</strong> update time limit of " . $crash_dt . " second" . ($crash_dt == 1 ? "" : "s") . " exceeded.</p></li>"; break; } if ($uri == '*') { $uri = NULL; } $delta = $feedwordpress->update($uri, $crash_ts); if (!is_null($delta)) { if (is_null($tdelta)) { $tdelta = $delta; } else { $tdelta['new'] += $delta['new']; $tdelta['updated'] += $delta['updated']; } } else { $display_uri = esc_html(feedwordpress_display_url($uri)); $uri = esc_html($uri); echo "<li><p><strong>Error:</strong> There was a problem updating <code><a href=\"{$uri}\">{$display_uri}</a></code></p></li>\n"; } } echo "</ul>\n"; if (!is_null($tdelta)) { echo "<p><strong>Update complete.</strong>" . fwp_update_set_results_message($delta) . "</p>"; echo "\n"; flush(); } echo "</div> <!-- class=\"updated\" -->\n"; } }