dispatch = NULL; if (is_null($filename)) : $this->filename = __FILE__; else : $this->filename = $filename; endif; } /* FeedWordPressSyndicationPage constructor */ function has_link () { return false; } var $_sources = NULL; function sources ($visibility = 'Y') { if (is_null($this->_sources)) : $links = FeedWordPress::syndicated_links(array("hide_invisible" => false)); $this->_sources = array("Y" => array(), "N" => array()); foreach ($links as $link) : $this->_sources[$link->link_visible][] = $link; endforeach; endif; $ret = ( array_key_exists($visibility, $this->_sources) ? $this->_sources[$visibility] : $this->_sources ); return $ret; } /* FeedWordPressSyndicationPage::sources() */ function visibility_toggle () { $sources = $this->sources('*'); $defaultVisibility = 'Y'; if ((count($this->sources('N')) > 0) and (count($this->sources('Y'))==0)) : $defaultVisibility = 'N'; endif; $visibility = ( isset($_REQUEST['visibility']) ? $_REQUEST['visibility'] : $defaultVisibility ); return $visibility; } /* FeedWordPressSyndicationPage::visibility_toggle() */ function show_inactive () { return ($this->visibility_toggle() == 'N'); } function updates_requested () { global $wpdb; if (isset($_POST['update']) or isset($_POST['action']) or isset($_POST['update_uri'])) : // Only do things with side-effects for HTTP POST or command line $fwp_update_invoke = 'post'; else : $fwp_update_invoke = 'get'; endif; $update_set = array(); if ($fwp_update_invoke != 'get') : if (is_array(FeedWordPress::post('link_ids')) and (FeedWordPress::post('action')==FWP_UPDATE_CHECKED)) : $targets = $wpdb->get_results(" SELECT * FROM $wpdb->links WHERE link_id IN (".implode(",",$_POST['link_ids']).") "); if (is_array($targets)) : foreach ($targets as $target) : $update_set[] = $target->link_rss; endforeach; else : // This should never happen FeedWordPress::critical_bug('fwp_syndication_manage_page::targets', $targets, __LINE__, __FILE__); endif; elseif (!is_null(FeedWordPress::post('update_uri'))) : $targets = FeedWordPress::post('update_uri'); if (!is_array($targets)) : $targets = array($targets); endif; $first = each($targets); if (!is_numeric($first['key'])) : // URLs in keys $targets = array_keys($targets); endif; $update_set = $targets; endif; endif; return $update_set; } function accept_multiadd () { global $fwp_post; if (isset($fwp_post['cancel']) and $fwp_post['cancel']==__(FWP_CANCEL_BUTTON)) : return true; // Continue .... endif; // If this is a POST, validate source and user credentials FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_feeds', /*capability=*/ '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); endif; endif; endforeach; print "
\n"; print "

Added ".count($added)." new syndicated sources.

"; if (count($errors) > 0) : print "

FeedWordPress encountered errors trying to add the following sources:

\n"; endif; print "
\n"; elseif (is_array($in) or strlen($in) > 0) : add_meta_box( /*id=*/ 'feedwordpress_multiadd_box', /*title=*/ __('Add Feeds'), /*callback=*/ array($this, 'multiadd_box'), /*page=*/ $this->meta_box_context(), /*context =*/ $this->meta_box_context() ); endif; return true; // Continue... } function display_multiadd_line ($line) { $short_feed = esc_html(feedwordpress_display_url($line['feed'])); $feed = esc_html($line['feed']); $link = esc_html($line['link']); $title = esc_html($line['title']); $checked = $line['checked']; $i = esc_html($line['i']); print "
  • · $short_feed"; if (isset($line['extra'])) : print " · ".esc_html($line['extra']); endif; print "
  • \n"; flush(); } function multiadd_box ($page, $box = NULL) { global $fwp_post; $localData = NULL; if (isset($_FILES['opml_upload']['name']) and (strlen($_FILES['opml_upload']['name']) > 0)) : $in = 'tag:localhost'; $localData = file_get_contents($_FILES['opml_upload']['tmp_name']); $merge_all = true; elseif (isset($fwp_post['multilookup'])) : $in = $fwp_post['multilookup']; $merge_all = false; elseif (isset($fwp_post['opml_lookup'])) : $in = $fwp_post['opml_lookup']; $merge_all = true; else : $in = ''; $merge_all = false; endif; if (strlen($in) > 0) : $lines = preg_split( "/\s+/", $in, /*no limit soldier*/ -1, PREG_SPLIT_NO_EMPTY ); $i = 0; ?>

    Looking up feed information...

    \n"; flush(); foreach ($lines as $line) : $url = trim($line); if (strlen($url) > 0) : // First, use FeedFinder to check the URL. if (is_null($localData)) : $finder = new FeedFinder($url, /*verify=*/ false, /*fallbacks=*/ 1); else : $finder = new FeedFinder('tag:localhost', /*verify=*/ false, /*fallbacks=*/ 1); $finder->upload_data($localData); endif; $feeds = array_values( array_unique( $finder->find() ) ); $found = false; if (count($feeds) > 0) : foreach ($feeds as $feed) : $pie = FeedWordPress::fetch($feed); if (!is_wp_error($pie)) : $found = true; $short_feed = esc_html(feedwordpress_display_url($feed)); $feed = esc_html($feed); $title = esc_html($pie->get_title()); $checked = ' checked="checked"'; $link = esc_html($pie->get_link()); $this->display_multiadd_line(array( 'feed' => $feed, 'title' => $pie->get_title(), 'link' => $pie->get_link(), 'checked' => ' checked="checked"', 'i' => $i, )); $i++; // Increment field counter if (!$merge_all) : // Break out after first find break; endif; endif; endforeach; endif; if (!$found) : $this->display_multiadd_line(array( 'feed' => $url, 'title' => feedwordpress_display_url($url), 'extra' => " [FeedWordPress couldn't detect any feeds for this URL.]", 'link' => NULL, 'checked' => '', 'i' => $i, )); $i++; // Increment field counter endif; endif; endforeach; print "\n"; ?>
    _sources = NULL; // Force reload of sources list return true; // Continue } function display () { global $wpdb; global $fwp_post; if (FeedWordPress::needs_upgrade()) : fwp_upgrade_page(); return; endif; ?> 'fwp_feedfinder_page', FWP_SYNDICATE_NEW => 'fwp_feedfinder_page', "switchfeed" => 'fwp_switchfeed_page', FWP_UNSUB_CHECKED => 'multidelete_page', FWP_DELETE_CHECKED => 'multidelete_page', 'Unsubscribe' => 'multidelete_page', FWP_RESUB_CHECKED => 'multiundelete_page', ); if (isset($_REQUEST['action']) and isset($dispatcher[$_REQUEST['action']])) : $method = $dispatcher[$_REQUEST['action']]; if (method_exists($this, $method)) : $cont = $this->{$method}(); else : $cont = call_user_func($method); endif; elseif (isset($fwp_post['multiadd']) and $fwp_post['multiadd']==FWP_SYNDICATE_NEW) : $cont = $this->accept_multiadd($fwp_post); endif; if ($cont): $links = $this->sources('Y'); $potential_updates = (!$this->show_inactive() and (count($this->sources('Y')) > 0)); $this->open_sheet('Syndicated Sites'); ?>
    updates_requested()) > 0)) : add_meta_box( /*id=*/ 'feedwordpress_update_box', /*title=*/ __('Update feeds now'), /*callback=*/ 'fwp_syndication_manage_page_update_box', /*page=*/ $this->meta_box_context(), /*context =*/ $this->meta_box_context() ); endif; add_meta_box( /*id=*/ 'feedwordpress_feeds_box', /*title=*/ __('Syndicated sources'), /*callback=*/ array(&$this, 'syndicated_sources_box'), /*page=*/ $this->meta_box_context(), /*context =*/ $this->meta_box_context() ); do_action('feedwordpress_admin_page_syndication_meta_boxes', $this); ?>
    meta_box_context(), $this->meta_box_context(), $this); ?>
    close_sheet(/*dispatch=*/ NULL); ?>
    false)); $sources = $this->sources('*'); $visibility = 'Y'; $hrefPrefix = $this->form_action(); $activeHref = $hrefPrefix.'&visibility=Y'; $inactiveHref = $hrefPrefix.'&visibility=N'; $lastUpdate = get_option('feedwordpress_last_update_all', NULL); $automatic_updates = get_option('feedwordpress_automatic_updates', NULL); if ('init'==$automatic_updates) : $update_setting = 'automatically before page loads'; elseif ('shutdown'==$automatic_updates) : $update_setting = 'automatically after page loads'; else : $update_setting = 'using a cron job or manual check-ins'; endif; // Hey ho, let's go... ?>

    Managed by FeedWordPress .

    If you find this tool useful for your daily work, you can contribute to ongoing support and development with a modest donation.


    Updates

    Subscriptions

    Active
    Inactive
    0) : ?>

    false)); $sources = $this->sources('*'); $visibility = $this->visibility_toggle(); $showInactive = $this->show_inactive(); $hrefPrefix = $this->form_action(); ?>

    Add Multiple Sources

    Enter one feed or website URL per line. If a URL links to a website which provides multiple feeds, FeedWordPress will use the first one listed.

    Import source list

    You can import a list of sources in OPML format, either by providing a URL for the OPML document, or by uploading a copy from your computer.

    0) : fwp_syndication_manage_page_links_subsubsub($sources, $showInactive); endif; ?>

    Thank you!

    Thank you for your contribution to FeedWordPress development. Your generous gifts make ongoing support and development for FeedWordPress possible.

    If you have any questions about FeedWordPress, or if there is anything I can do to help make FeedWordPress more useful for you, please contact me and let me know what you're thinking about.

    Charles Johnson, Developer, FeedWordPress.

    Keep FeedWordPress improving

    FeedWordPress makes syndication simple and empowers you to stream content from all over the web into your WordPress hub. That's got to be worth a few lattes. If you're finding FWP useful, a modest gift is the best way to support steady progress on development, enhancements, support, and documentation.

    You can make a gift online (or set up an automatic regular donation) using an existing PayPal account or any major credit card.

    array(), 'nuke' => array(), 'delete' => array(), ); foreach ($actions as $link_id => $what) : $do_it[$what][] = $link_id; endforeach; $alter = array(); if (count($do_it['hide']) > 0) : $hidem = "(".implode(', ', $do_it['hide']).")"; $alter[] = " UPDATE $wpdb->links SET link_visible = 'N' WHERE link_id IN {$hidem} "; endif; if (count($do_it['nuke']) > 0) : $nukem = "(".implode(', ', $do_it['nuke']).")"; // Make a list of the items syndicated from this feed... $post_ids = $wpdb->get_col(" SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'syndication_feed_id' AND meta_value IN {$nukem} "); // ... and kill them all if (count($post_ids) > 0) : foreach ($post_ids as $post_id) : if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_29)) : // Force scrubbing of deleted post // rather than sending to Trashcan wp_delete_post( /*postid=*/ $post_id, /*force_delete=*/ true ); else : wp_delete_post($post_id); endif; endforeach; endif; $alter[] = " DELETE FROM $wpdb->links WHERE link_id IN {$nukem} "; endif; if (count($do_it['delete']) > 0) : $deletem = "(".implode(', ', $do_it['delete']).")"; // Make the items syndicated from this feed appear to be locally-authored $alter[] = " DELETE FROM $wpdb->postmeta WHERE meta_key = 'syndication_feed_id' AND meta_value IN {$deletem} "; // ... and delete the links themselves. $alter[] = " DELETE FROM $wpdb->links WHERE link_id IN {$deletem} "; endif; $errs = array(); $success = array (); foreach ($alter as $sql) : $result = $wpdb->query($sql); if (!$result): $errs[] = mysql_error(); endif; endforeach; if (count($alter) > 0) : echo "
    \n"; if (count($errs) > 0) : echo "There were some problems processing your "; echo "unsubscribe request. [SQL: ".implode('; ', $errs)."]"; else : echo "Your unsubscribe request(s) have been processed."; endif; echo "
    \n"; endif; return true; // Continue on to Syndicated Sites listing else : $targets = $wpdb->get_results(" SELECT * FROM $wpdb->links WHERE link_id IN (".implode(",",$link_ids).") "); ?>

    Unsubscribe from Syndicated Links:

    link_visible)); $link_url = esc_html($link->link_url); $link_name = esc_html($link->link_name); $link_description = esc_html($link->link_description); $link_rss = esc_html($link->link_rss); ?>
    Subscription :
    • checked="checked" name="link_action[link_id; ?>]" value="nuke" />
    array(), ); foreach ($actions as $link_id => $what) : $do_it[$what][] = $link_id; endforeach; $alter = array(); if (count($do_it['unhide']) > 0) : $unhiddem = "(".implode(', ', $do_it['unhide']).")"; $alter[] = " UPDATE $wpdb->links SET link_visible = 'Y' WHERE link_id IN {$unhiddem} "; endif; $errs = array(); $success = array (); foreach ($alter as $sql) : $result = $wpdb->query($sql); if (!$result): $errs[] = mysql_error(); endif; endforeach; if (count($alter) > 0) : echo "
    \n"; if (count($errs) > 0) : echo "There were some problems processing your "; echo "re-subscribe request. [SQL: ".implode('; ', $errs)."]"; else : echo "Your re-subscribe request(s) have been processed."; endif; echo "
    \n"; endif; return true; // Continue on to Syndicated Sites listing else : $targets = $wpdb->get_results(" SELECT * FROM $wpdb->links WHERE link_id IN (".implode(",",$link_ids).") "); ?>

    Re-subscribe to Syndicated Links:

    link_visible)); $link_url = esc_html($link->link_url); $link_name = esc_html($link->link_name); $link_description = esc_html($link->link_description); $link_rss = esc_html($link->link_rss); if (!$subscribed) : ?>
    Subscription :
    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 "
    \n"; echo "\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 "

    Update complete.".implode(' and', $mesg)."

    "; echo "\n"; flush(); endif; echo "
    \n"; endif; } define('FEEDWORDPRESS_BLEG_MAYBE_LATER_OFFSET', (60 /*sec/min*/ * 60 /*min/hour*/ * 24 /*hour/day*/ * 31 /*days*/)); define('FEEDWORDPRESS_BLEG_ALREADY_PAID_OFFSET', (60 /*sec/min*/ * 60 /*min/hour*/ * 24 /*hour/day*/ * 183 /*days*/)); function fwp_syndication_manage_page_update_box ($object = NULL, $box = NULL) { $bleg_box_hidden = null; if (isset($_POST['maybe_later'])) : $bleg_box_hidden = time() + FEEDWORDPRESS_BLEG_MAYBE_LATER_OFFSET; elseif (isset($_REQUEST['paid']) and $_REQUEST['paid']) : $bleg_box_hidden = time() + FEEDWORDPRESS_BLEG_ALREADY_PAID_OFFSET; elseif (isset($_POST['go_away'])) : $bleg_box_hidden = 'permanent'; endif; if (!is_null($bleg_box_hidden)) : update_option('feedwordpress_bleg_box_hidden', $bleg_box_hidden); else : $bleg_box_hidden = get_option('feedwordpress_bleg_box_hidden'); endif; ?> bleg_thanks($subject, $box); elseif ($bleg_box_ready) : $object->bleg_box($object, $box); endif; ?>

    Check currently scheduled feeds for new and updated posts.

    Note: Automatic updates are currently turned off. New posts from your feeds will not be syndicated until you manually check for them here. You can turn on automatic updates under Feed & Update Settings.

    show_inactive()) : ?> updates_requested() as $req) : ?>

    accept_multiadd(); return true; else : $post_source = 'feedwordpress_feeds'; // With action=feedfinder, this goes directly to the feedfinder page include_once(dirname(__FILE__) . '/feeds-page.php'); return false; endif; } /* function fwp_feedfinder_page () */ function fwp_switchfeed_page () { global $wpdb, $wp_db_version; global $fwp_post; // If this is a POST, validate source and user credentials FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_switchfeed', /*capability=*/ 'manage_links'); $changed = false; if (!isset($fwp_post['Cancel'])): if (isset($fwp_post['save_link_id']) and ($fwp_post['save_link_id']=='*')) : $changed = true; $link_id = FeedWordPress::syndicate_link($fwp_post['feed_title'], $fwp_post['feed_link'], $fwp_post['feed']); if ($link_id): $existingLink = new SyndicatedLink($link_id); ?>

    has been added as a contributing site, using the feed at <>. | Configure settings.

    There was a problem adding the feed. [SQL: ]

    set_uri($fwp_post['feed']); if ($changed): $home = $existingLink->homepage(/*from feed=*/ false); $name = $existingLink->name(/*from feed=*/ false); ?>

    Feed for updated to <>.

    Nothing was changed.