dispatch = NULL;
$this->filename = __FILE__;
} /* 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 (isset($_POST['link_ids']) and is_array($_POST['link_ids']) and ($_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__);
endif;
elseif (isset($_POST['update_uri'])) :
$targets = $_POST['update_uri'];
if (!is_array($targets)) :
$targets = array($targets);
endif;
$update_set = $targets;
endif;
endif;
return $update_set;
}
function display () {
global $wpdb;
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 => 'fwp_multidelete_page',
FWP_DELETE_CHECKED => 'fwp_multidelete_page',
'Unsubscribe' => 'fwp_multidelete_page',
FWP_RESUB_CHECKED => 'fwp_multiundelete_page',
);
if (isset($_REQUEST['action']) and isset($dispatcher[$_REQUEST['action']])) :
$method = $dispatcher[$_REQUEST['action']];
$cont = call_user_func($method);
endif;
if ($cont):
?>
sources('Y');
$potential_updates = (!$this->show_inactive() and (count($this->sources('Y')) > 0));
$this->open_sheet('Syndicated Sites');
?>
updates_requested()) > 0)) :
fwp_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;
fwp_add_meta_box(
/*id=*/ 'feedwordpress_feeds_box',
/*title=*/ __('Syndicated sources'),
/*callback=*/ 'fwp_syndication_manage_page_links_box',
/*page=*/ $this->meta_box_context(),
/*context =*/ $this->meta_box_context()
);
if (FeedWordPressCompatibility::test_version(0, FWP_SCHEMA_25)) :
fwp_add_meta_box(
/*id=*/ 'feedwordpress_add_feed_box',
/*title=*/ 'Add a new syndicated source',
/*callback=*/ 'fwp_syndication_manage_page_add_feed_box',
/*page=*/ $this->meta_box_context(),
/*context=*/ $this->meta_box_context()
);
endif;
do_action('feedwordpress_admin_page_syndication_meta_boxes', $this);
?>
meta_box_context(), $this->meta_box_context(), $this);
?>
close_sheet(/*dispatch=*/ NULL); ?>
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 .
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;
endif;
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;
}
function fwp_syndication_manage_page_add_feed_box ($object = NULL, $box = NULL) {
?>
bleg_thanks($subject, $box);
elseif ($bleg_box_ready) :
$object->bleg_box($object, $box);
endif;
?>
0)) :
?>
0):
foreach ($links as $link):
$trClass = array();
// Prep: Get last updated timestamp
$sLink = new SyndicatedLink($link->link_id);
if (!is_null($sLink->setting('update/last'))) :
$lastUpdated = fwp_time_elapsed($sLink->setting('update/last'));
else :
$lastUpdated = __('None yet');
endif;
// Prep: get last error timestamp, if any
if (is_null($sLink->setting('update/error'))) :
$errorsSince = '';
else :
$trClass[] = 'feed-error';
$theError = unserialize($sLink->setting('update/error'));
$errorsSince = ""
."
Returning errors since "
.fwp_time_elapsed($theError['since'])
."
"
."
Most recent ("
.fwp_time_elapsed($theError['ts'])
."):"
.implode("", $theError['object']->get_error_messages())
."
"
."
\n";
endif;
$nextUpdate = "Ready for next update ";
if (isset($sLink->settings['update/ttl']) and is_numeric($sLink->settings['update/ttl'])) :
if (isset($sLink->settings['update/timed']) and $sLink->settings['update/timed']=='automatically') :
$next = $sLink->settings['update/last'] + ((int) $sLink->settings['update/ttl'] * 60);
$nextUpdate .= fwp_time_elapsed($next);
if (FEEDWORDPRESS_DEBUG) : $nextUpdate .= " [".(($next-time())/60)." minutes]"; endif;
else :
$nextUpdate .= "every ".$sLink->settings['update/ttl']." minute".(($sLink->settings['update/ttl']!=1)?"s":"");
endif;
else:
$nextUpdate .= "as soon as possible";
endif;
$nextUpdate .= "
";
unset($sLink);
$alt_row = !$alt_row;
if ($alt_row) :
$trClass[] = 'alternate';
endif;
?>
0) ? ' class="'.implode(" ", $trClass).'"':''); ?>>
link_id}&page=${fwp_path}/";
$caption = (
(strlen($link->link_rss) > 0)
? __('Switch Feed')
: $caption=__('Find Feed')
);
?>
link_name); ?>
link_rss) > 0): ?>
link_rss, 32)); ?>
no feed assigned
There are no websites currently listed for syndication.
false));
$sources = $object->sources('*');
$visibility = $object->visibility_toggle();
$showInactive = $object->show_inactive();
$hrefPrefix = "admin.php?page=${fwp_path}/".basename(__FILE__);
?>
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);
?>
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).")
");
?>