function accept_multiadd()
{
global $fwp_post;
if (isset($fwp_post['cancel']) and $fwp_post['cancel'] == __(FWP_CANCEL_BUTTON)) {
return true;
// Continue ....
}
// If this is a POST, validate source and user credentials
FeedWordPressCompatibility::validate_http_request('feedwordpress_feeds', 'manage_links');
$in = (isset($fwp_post['multilookup']) ? $fwp_post['multilookup'] : '') . (isset($fwp_post['opml_lookup']) ? $fwp_post['opml_lookup'] : '');
if (isset($fwp_post['confirm']) and $fwp_post['confirm'] == 'multiadd') {
$chex = $fwp_post['multilookup'];
$added = array();
$errors = array();
foreach ($chex as $feed) {
if (isset($feed['add']) and $feed['add'] == 'yes') {
// Then, add in the URL.
$link_id = FeedWordPress::syndicate_link($feed['title'], $feed['link'], $feed['url']);
if ($link_id and !is_wp_error($link_id)) {
$added[] = $link_id;
} else {
$errors[] = array($feed['url'], $link_id);
}
}
}
print "<div class='updated'>\n";
print "<p>Added " . count($added) . " new syndicated sources.</p>";
if (count($errors) > 0) {
print "<p>FeedWordPress encountered errors trying to add the following sources:</p>\n\t\t\t\t<ul>\n";
foreach ($errors as $err) {
$url = $err[0];
$short = esc_html(feedwordpress_display_url($url));
$url = esc_html($url);
$wp = $err[1];
if (is_wp_error($err[1])) {
$error = $err[1];
$mesg = " (<code>" . $error->get_error_messages() . "</code>)";
} else {
$mesg = '';
}
print "<li><a href='{$url}'>{$short}</a>{$mesg}</li>\n";
}
print "</ul>\n";
}
print "</div>\n";
} elseif (is_array($in) or strlen($in) > 0) {
add_meta_box('feedwordpress_multiadd_box', __('Add Feeds'), array($this, 'multiadd_box'), $this->meta_box_context(), $this->meta_box_context());
}
return true;
// Continue...
}