link = $link; // Set meta-box context name $this->context = $page; if ($this->for_feed_settings()) : $this->context .= 'forfeed'; endif; } /* FeedWordPressAdminPage constructor */ function pageslug () { $slug = preg_replace('/FeedWordPress(.*)Page/', '$1', get_class($this)); return strtolower($slug); } function pagename ($context = NULL) { if (is_null($context)) : $context = 'default'; endif; if (isset($this->pagenames[$context])) : $name = $this->pagenames[$context]; elseif (isset($tis->pagenames['default'])) : $name = $this->pagenames['default']; else : $name = $this->pageslug(); endif; return __($name); } /* FeedWordPressAdminPage::pagename () */ function accept_POST ($post) { if ($this->for_feed_settings() and $this->update_requested_in($post)) : $this->update_feed(); elseif ($this->save_requested_in($post)) : // User mashed Save Changes $this->save_settings($post); endif; do_action($this->dispatch.'_post', &$post, &$this); } function update_feed () { global $feedwordpress; add_action('feedwordpress_check_feed', 'update_feeds_mention'); add_action('feedwordpress_check_feed_complete', 'update_feeds_finish', 10, 3); print '
'; print ""; if (!is_null($delta)) : $mesg = array(); if (isset($delta['new'])) : $mesg[] = ' '.$delta['new'].' new posts were syndicated'; endif; if (isset($delta['updated'])) : $mesg[] = ' '.$delta['updated'].' existing posts were updated'; endif; echo "

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

"; echo "\n"; flush(); else : $uri = esc_html($uri); echo "

Error: There was a problem updating $uri

\n"; endif; print "
\n"; remove_action('feedwordpress_check_feed', 'update_feeds_mention'); remove_action('feedwordpress_check_feed_complete', 'update_feeds_finish', 10, 3); } function save_settings ($post) { do_action($this->dispatch.'_save', &$post, &$this); if ($this->for_feed_settings()) : // Save settings $this->link->save_settings(/*reload=*/ true); $this->updated = true; // Reset, reload $link_id = $this->link->id; unset($this->link); $this->link = new SyndicatedLink($link_id); else : $this->updated = true; endif; } /* FeedWordPressAdminPage::save_settings () */ function for_feed_settings () { return (is_object($this->link) and method_exists($this->link, 'found') and $this->link->found()); } function for_default_settings () { return !$this->for_feed_settings(); } function setting ($names, $fallback_value = NULL, $params = array()) { if (!is_array($params)) : $params = array('default' => $params); endif; $params = shortcode_atts(array( 'default' => 'default', 'fallback' => true, ), $params); if (is_string($names)) : $feed_name = $names; $global_name = 'feedwordpress_'.preg_replace('![\s/]+!', '_', $names); else : $feed_name = $names['feed']; $global_name = 'feedwordpress_'.$names['global']; endif; if ($this->for_feed_settings()) : // Check feed-specific setting first; fall back to global if (!$params['fallback']) : $global_name = NULL; endif; $ret = $this->link->setting($feed_name, $global_name, $fallback_value, $params['default']); else : // Check global setting $ret = get_option($global_name, $fallback_value); endif; return $ret; } function update_setting ($names, $value, $default = 'default') { if (is_string($names)) : $feed_name = $names; $global_name = 'feedwordpress_'.preg_replace('![\s/]+!', '_', $names); else : $feed_name = $names['feed']; $global_name = 'feedwordpress_'.$names['global']; endif; if ($this->for_feed_settings()) : // Update feed-specific setting $this->link->update_setting($feed_name, $value, $default); else : // Update global setting update_option($global_name, $value); endif; } /* FeedWordPressAdminPage::update_setting () */ function save_requested_in ($post) { return (isset($post['save']) or isset($post['submit'])); } function update_requested_in ($post) { return (isset($post['update']) and (strlen($post['update']) > 0)); } /*static*/ function submitted_link_id () { global $fwp_post; // Presume global unless we get a specific link ID $link_id = NULL; $submit_buttons = array( 'save', 'submit', 'fix_mismatch', 'feedfinder', ); foreach ($submit_buttons as $field) : if (isset($fwp_post[$field])) : $link_id = $_REQUEST['save_link_id']; endif; endforeach; if (is_null($link_id) and isset($_REQUEST['link_id'])) : $link_id = $_REQUEST['link_id']; endif; return $link_id; } /* FeedWordPressAdminPage::submitted_link_id() */ /*static*/ function submitted_link () { $link_id = FeedWordPressAdminPage::submitted_link_id(); if (is_numeric($link_id) and $link_id) : $link = new SyndicatedLink($link_id); else : $link = NULL; endif; return $link; } /* FeedWordPressAdminPage::submitted_link () */ function stamp_link_id ($field = null) { if (is_null($field)) : $field = 'save_link_id'; endif; ?> for_feed_settings()) : $phrase = __('posts from this feed'); else : $phrase = __('syndicated posts'); endif; return $phrase; } /* FeedWordPressAdminPage::these_posts_phrase() */ /** * Provides a uniquely identifying name for the interface context for * use with add_meta_box() and do_meta_boxes(), * * @return string the context name * * @see add_meta_box() * @see do_meta_boxes() */ function meta_box_context () { return $this->context; } /* FeedWordPressAdminPage::meta_box_context () */ /** * Outputs JavaScript to fix AJAX toggles settings. * * @uses FeedWordPressAdminPage::meta_box_context() */ function fix_toggles () { FeedWordPressSettingsUI::fix_toggles_js($this->meta_box_context()); } /* FeedWordPressAdminPage::fix_toggles() */ function ajax_interface_js () { ?> function contextual_appearance (item, appear, disappear, value, visibleStyle, checkbox) { if (typeof(visibleStyle)=='undefined') visibleStyle = 'block'; var rollup=document.getElementById(item); if (rollup) { if ((checkbox && rollup.checked) || (!checkbox && value==rollup.value)) { jQuery('#'+disappear).hide(); jQuery('#'+appear).show(600); } else { jQuery('#'+appear).hide(); jQuery('#'+disappear).show(600); } } } '', 'between' => ' | ', 'after' => '', 'long' => false, 'subscription' => $this->link, )); $sub = $params['subscription']; $links = array( "Feed" => array('page' => 'feeds-page.php', 'long' => 'Feeds & Updates'), "Posts" => array('page' => 'posts-page.php', 'long' => 'Posts & Links'), "Authors" => array('page' => 'authors-page.php', 'long' => 'Authors'), 'Categories' => array('page' => 'categories-page.php', 'long' => 'Categories'.FEEDWORDPRESS_AND_TAGS), ); $hrefPrefix = 'admin.php?'; $link_id = NULL; if (is_object($sub)) : if (method_exists($sub, 'found')) : if ($sub->found()) : $link_id = $sub->link->link_id; endif; else : $link_id = $sub->link_id; endif; endif; if (!is_null($link_id)) : $urlParam = "link_id={$link_id}"; $hrefPrefix .= $urlParam."&"; $urlSuffix = "&".$urlParam; else : $urlParam = ''; endif; $hrefPrefix .= "page=${fwp_path}/"; print $params['before']; $first = true; foreach ($links as $label => $link) : if (!$first) : print $params['between']; endif; if (isset($link['url'])) : $url = $link['url'].$urlSuffix; else : $url = $hrefPrefix.$link['page']; endif; $url = esc_html($url); if ($link['page']==basename($this->filename)) : print ""; else : print ""; endif; if ($params['long']) : print esc_html(__($link['long'])); else : print esc_html(__($label)); endif; if ($link['page']==basename($this->filename)) : print ""; else : print ""; endif; $first = false; endforeach; print $params['after']; } /* FeedWordPressAdminPage::display_feed_settings_page_links */ function display_feed_select_dropdown() { $links = FeedWordPress::syndicated_links(); ?>

for_feed_settings()) : ?>: link->name(/*from feed=*/ false)); ?>

mesg = $mesg; endif; if ($this->updated) : if ($this->updated === true) : $this->mesg = $pagename . ' settings updated.'; else : $this->mesg = $this->updated; endif; endif; if (!is_null($this->mesg)) : ?>

mesg); ?>

for_feed_settings()) : ?>

These settings only affect posts syndicated from link->link->link_name); ?>.

These settings affect posts syndicated from any feed unless they are overridden by settings for that specific feed.

filename); endif; return "admin.php?page=${fwp_path}/".$filename; } /* FeedWordPressAdminPage::form_action () */ function update_message () { return $this->mesg; } function display () { if (FeedWordPress::needs_upgrade()) : fwp_upgrade_page(); return; endif; FeedWordPressCompatibility::validate_http_request(/*action=*/ $this->dispatch, /*capability=*/ 'manage_links'); //////////////////////////////////////////////// // Process POST request, if any //////////////// //////////////////////////////////////////////// if (strtoupper($_SERVER['REQUEST_METHOD'])=='POST') : $this->accept_POST($GLOBALS['fwp_post']); else : $this->updated = false; endif; //////////////////////////////////////////////// // Prepare settings page /////////////////////// //////////////////////////////////////////////// $this->display_update_notice_if_updated( $this->pagename('settings-update'), $this->update_message() ); $this->open_sheet($this->pagename('open-sheet')); ?>
boxes_by_methods as $method => $row) : if (is_array($row)) : $id = $row['id']; $title = $row['title']; else : $id = 'feedwordpress_'.$method; $title = $row; endif; add_meta_box( /*id=*/ $id, /*title=*/ $title, /*callback=*/ array(&$this, $method), /*page=*/ $this->meta_box_context(), /*context=*/ $this->meta_box_context() ); endforeach; do_action($this->dispatch.'_meta_boxes', $this); ?>
meta_box_context(), $this->meta_box_context(), $this); ?>
close_sheet(); ?> filename), /*callback=*/ array($this, 'fix_toggles'), /*priority=*/ 10000 ); FeedWordPressSettingsUI::ajax_nonce_fields(); ?>
display_sheet_header($header); endif; if (!is_null($this->dispatch)) : ?>
dispatch); $this->stamp_link_id(); ?>
has_link()) : $this->display_settings_scope_message(); endif; ?>
dispatch)) : ?>
save_button(); ?>
has_link()) : $this->display_feed_select_dropdown(); endif; ?>
dispatch)) : $this->save_button(); print "
\n"; endif; ?>
filename); endif; if (isset($params['site-wide-url'])) : $href = $params['site-wide-url']; else : $href = "admin.php?page=${fwp_path}/${filename}"; endif; if (isset($params['setting-default'])) : $settingDefault = $params['setting-default']; else : $settingDefault = NULL; endif; if (isset($params['global-setting-default'])) : $globalSettingDefault = $params['global-setting-default']; else : $globalSettingDefault = $settingDefault; endif; $globalSetting = get_option('feedwordpress_'.$globalName, $globalSettingDefault); if ($this->for_feed_settings()) : $setting = $this->link->setting($localName, NULL, $settingDefault); else : $setting = $globalSetting; endif; if (isset($params['offer-site-wide'])) : $offerSiteWide = $params['offer-site-wide']; else : $offerSiteWide = $this->for_feed_settings(); endif; // This allows us to provide an alternative set of human-readable // labels for each potential value. For use in Currently: line. if (isset($params['labels'])) : $labels = $params['labels']; elseif (is_callable($options)) : $labels = NULL; else : $labels = $options; endif; if (isset($params['input-name'])) : $inputName = $params['input-name']; else : $inputName = $globalName; endif; if (isset($params['default-input-id'])) : $defaultInputId = $params['default-input-id']; else : $defaultInputId = NULL; endif; if (isset($params['default-input-id-no'])) : $defaultInputIdNo = $params['default-input-id-no']; elseif (!is_null($defaultInputId)) : $defaultInputIdNo = $defaultInputId.'-no'; else : $defaultInputIdNo = NULL; endif; // This allows us to either include the site-default setting as // one of the options within the radio box, or else as a simple // yes/no toggle that controls whether or not to check another // set of inputs. if (isset($params['default-input-name'])) : $defaultInputName = $params['default-input-name']; else : $defaultInputName = $inputName; endif; if ($defaultInputName != $inputName) : $defaultInputValue = 'yes'; else : $defaultInputValue = ( isset($params['default-input-value']) ? $params['default-input-value'] : 'site-default' ); endif; $settingDefaulted = (is_null($setting) or ($settingDefault === $setting)); if (!is_callable($options)) : $checked = array(); if ($settingDefaulted) : $checked[$defaultInputValue] = ' checked="checked"'; endif; foreach ($options as $value => $label) : if ($setting == $value) : $checked[$value] = ' checked="checked"'; else : $checked[$value] = ''; endif; endforeach; endif; $defaulted = array(); if ($defaultInputName != $inputName) : $defaulted['yes'] = ($settingDefaulted ? ' checked="checked"' : ''); $defaulted['no'] = ($settingDefaulted ? '' : ' checked="checked"'); else : $defaulted['yes'] = (isset($checked[$defaultInputValue]) ? $checked[$defaultInputValue] : ''); endif; if (isset($params['defaulted'])) : $defaulted['yes'] = ($params['defaulted'] ? ' checked="checked"' : ''); $defaulted['no'] = ($params['defaulted'] ? '' : ' checked="checked"'); endif; if ($offerSiteWide) : ?>
  • Currently: (change)
    • $label) : ?>
    and
      we opened above ?>

= FWP_SCHEMA_25) : ?>
Tag $object as...

"; if (isset($params['textarea_name'])) : $textAreaName = $params['textarea_name']; else : $textAreaName = "tax_input[$tax_name]"; endif; print $desc; $helps = __('Separate tags with commas.'); $box['title'] = __('Tags'); ?>

0) : $idPrefix = $prefix.'-'; $idSuffix = "-".$prefix; $namePrefix = $prefix . '_'; else : $idPrefix = 'feedwordpress-'; $idSuffix = "-feedwordpress"; $namePrefix = 'feedwordpress_'; endif; ?>

$taxonomy, 'hide_empty' => 0, 'id' => $idPrefix.'new'.$taxonomy.'-parent', 'class' => 'new'.$taxonomy.'-parent', 'name' => $newcat.'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3, ) ); ?>

Updating ".$feed['link/name']." from <".$feed['link/uri']."> ..."; flush(); } function update_feeds_finish ($feed, $added, $dt) { if (is_wp_error($added)) : $mesgs = $added->get_error_messages(); foreach ($mesgs as $mesg) : echo "
Feed error: $mesg"; endforeach; echo "\n"; else : echo " completed in $dt second".(($dt==1)?'':'s')."\n"; endif; flush(); } function fwp_author_list () { global $wpdb; $ret = array(); $users = get_users_of_blog(); if (is_array($users)) : foreach ($users as $user) : $id = (int) $user->ID; $ret[$id] = $user->display_name; if (strlen(trim($ret[$id])) == 0) : $ret[$id] = $user->user_login; endif; endforeach; endif; return $ret; } class FeedWordPressSettingsUI { function is_admin () { global $fwp_path; $admin_page = false; // Innocent until proven guilty if (isset($_REQUEST['page'])) : $admin_page = ( is_admin() and preg_match("|^{$fwp_path}/|", $_REQUEST['page']) ); endif; return $admin_page; } function admin_scripts () { global $fwp_path; wp_enqueue_script('post'); // for magic tag and category boxes if (!FeedWordPressCompatibility::test_version(FWP_SCHEMA_29)) : // < 2.9 wp_enqueue_script('thickbox'); // for fold-up boxes endif; wp_enqueue_script('admin-forms'); // for checkbox selection wp_register_script('feedwordpress-elements', WP_PLUGIN_URL.'/'.$fwp_path.'/feedwordpress-elements.js'); wp_enqueue_script('feedwordpress-elements'); } function admin_styles () { ?> \n

\n"; wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); echo "

\n\n"; endif; } /* FeedWordPressSettingsUI::ajax_nonce_fields () */ /*static*/ function fix_toggles_js ($context) { ?> 0) : $userdata = array(); $userdata['ID'] = NULL; $userdata['user_login'] = apply_filters('pre_user_login', sanitize_user($newuser_name)); $userdata['user_nicename'] = apply_filters('pre_user_nicename', sanitize_title($newuser_name)); $userdata['display_name'] = $newuser_name; $userdata['user_pass'] = substr(md5(uniqid(microtime())), 0, 6); // just something random to lock it up $blahUrl = get_bloginfo('url'); $url = parse_url($blahUrl); $userdata['user_email'] = substr(md5(uniqid(microtime())), 0, 6).'@'.$url['host']; $newuser_id = wp_insert_user($userdata); $ret = $newuser_id; // Either a numeric ID or a WP_Error object else : // TODO: Add some error reporting endif; return $ret; } /* fwp_insert_new_user () */ /** * fwp_add_meta_box * * This function is no longer necessary, since no versions of WordPress that FWP * still supports lack add_meta_box(). But I've left it in place for the time * being for add-on modules that may have used it in setting up their UI. */ function fwp_add_meta_box ($id, $title, $callback, $page, $context = 'advanced', $priority = 'default', $callback_args = null) { return add_meta_box($id, $title, $callback, $page, $context, $priority, $callback_args); } /* function fwp_add_meta_box () */ function fwp_do_meta_boxes($page, $context, $object) { $ret = do_meta_boxes($page, $context, $object); // Avoid JavaScript error from WordPress 2.5 bug ?>
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_rss) > 0): ?>
link_name); ?>
display_feed_settings_page_links(array( 'before' => '
Settings > ', 'after' => '
', 'subscription' => $link, )); endif; ?>
Actions > | |
link_rss, 32)); ?>

no feed assigned

There are no websites currently listed for syndication.