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"; } }
function fwp_dashboard_update_if_requested($object) { $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_dt = (int) get_option('feedwordpress_update_time_limit'); if ($crash_dt > 0) { $crash_ts = time() + $crash_dt; } else { $crash_ts = NULL; } 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 { echo "<li><p><strong>Error:</strong> There was a problem updating <a href=\"{$uri}\">{$uri}</a></p></li>\n"; } } echo "</ul>\n"; if (!is_null($tdelta)) { $mesg = array(); if (isset($delta['new'])) { $mesg[] = ' ' . $tdelta['new'] . ' new posts were syndicated'; } if (isset($delta['updated'])) { $mesg[] = ' ' . $tdelta['updated'] . ' existing posts were updated'; } echo "<p>Update complete." . implode(' and', $mesg) . "</p>"; echo "\n"; flush(); } echo "</div> <!-- class=\"updated\" -->\n"; } }
function feedwordpress_pong($args) { $feedwordpress = new 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(); if (isset($delta['new'])) { $mesg[] = ' ' . $delta['new'] . ' new posts were syndicated'; } if (isset($delta['updated'])) { $mesg[] = ' ' . $delta['updated'] . ' existing posts were updated'; } return array('flerror' => false, 'message' => "Thanks for the ping." . implode(' and', $mesg)); } }
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; endif; if ($uri == '*') : $uri = NULL; endif; $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']; endif; 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"; endif; endforeach; echo "</ul>\n"; if (!is_null($tdelta)) : $mesg = array(); if (isset($delta['new'])) : $mesg[] = ' '.$tdelta['new'].' new posts were syndicated'; endif; if (isset($delta['updated'])) : $mesg[] = ' '.$tdelta['updated'].' existing posts were updated'; endif; echo "<p>Update complete.".implode(' and', $mesg)."</p>"; echo "\n"; flush(); endif; echo "</div> <!-- class=\"updated\" -->\n"; endif; }