function display() { global $fwp_post; global $post_source; $this->boxes_by_methods = array('feed_information_box' => __('Feed Information'), 'global_feeds_box' => __('Update Scheduling'), 'updated_posts_box' => __('Updated Posts'), 'custom_settings_box' => __('Custom Feed Settings (for use in templates)'), 'fetch_settings_box' => __('Settings for Fetching Feeds (Advanced)')); if ($this->for_default_settings()) { unset($this->boxes_by_methods['custom_settings_box']); } // Allow overriding of normal source for FeedFinder, which may // be called from multiple points. if (isset($post_source) and !is_null($post_source)) { $source = $post_source; } else { $source = $this->dispatch; } if (isset($_REQUEST['feedfinder']) or isset($_REQUEST['action']) and $_REQUEST['action'] == 'feedfinder' or isset($_REQUEST['action']) and $_REQUEST['action'] == FWP_SYNDICATE_NEW) { // If this is a POST, validate source and user credentials FeedWordPressCompatibility::validate_http_request($source, 'manage_links'); return $this->display_feedfinder(); // re-route to Feed Finder page } parent::display(); return false; // Don't continue }
function display () { global $wpdb, $wp_db_version, $fwp_path; global $fwp_post; if (FeedWordPress::needs_upgrade()) : fwp_upgrade_page(); return; endif; // If this is a POST, validate source and user credentials FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_diagnostics', /*capability=*/ 'manage_options'); if (strtoupper($_SERVER['REQUEST_METHOD'])=='POST') : $this->accept_POST($fwp_post); do_action('feedwordpress_admin_page_diagnostics_save', $GLOBALS['fwp_post'], $this); endif; //////////////////////////////////////////////// // Prepare settings page /////////////////////// //////////////////////////////////////////////// $this->display_update_notice_if_updated('Diagnostics'); $this->open_sheet('FeedWordPress Diagnostics'); ?> <div id="post-body"> <?php $boxes_by_methods = array( 'info_box' => __('Diagnostic Information'), 'diagnostics_box' => __('Display Diagnostics'), 'updates_box' => __('Updates'), 'tests_box' => __('Diagnostic Tests'), ); foreach ($boxes_by_methods as $method => $title) : add_meta_box( /*id=*/ 'feedwordpress_'.$method, /*title=*/ $title, /*callback=*/ array('FeedWordPressDiagnosticsPage', $method), /*page=*/ $this->meta_box_context(), /*context=*/ $this->meta_box_context() ); endforeach; do_action('feedwordpress_admin_page_diagnostics_meta_boxes', $this); ?> <div class="metabox-holder"> <?php fwp_do_meta_boxes($this->meta_box_context(), $this->meta_box_context(), $this); ?> </div> <!-- class="metabox-holder" --> </div> <!-- id="post-body" --> <?php $this->close_sheet(); } /* FeedWordPressDiagnosticsPage::display () */
function display() { global $wpdb, $wp_db_version, $fwp_path; global $fwp_post; if (FeedWordPress::needs_upgrade()) { fwp_upgrade_page(); return; } // If this is a POST, validate source and user credentials FeedWordPressCompatibility::validate_http_request('feedwordpress_performance', 'manage_options'); if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') { $this->accept_POST($fwp_post); do_action('feedwordpress_admin_page_performance_save', $fwp_post, $this); } //////////////////////////////////////////////// // Prepare settings page /////////////////////// //////////////////////////////////////////////// $this->display_update_notice_if_updated('Performance'); $this->open_sheet('FeedWordPress Performance'); ?> <div id="post-body"> <?php $boxes_by_methods = array('performance_box' => __('Performance')); foreach ($boxes_by_methods as $method => $title) { add_meta_box('feedwordpress_' . $method, $title, array('FeedWordPressPerformancePage', $method), $this->meta_box_context(), $this->meta_box_context()); } do_action('feedwordpress_admin_page_performance_meta_boxes', $this); ?> <div class="metabox-holder"> <?php fwp_do_meta_boxes($this->meta_box_context(), $this->meta_box_context(), $this); ?> </div> <!-- class="metabox-holder" --> </div> <!-- id="post-body" --> <?php $this->close_sheet(); }
function multiundelete_page() { global $wpdb; // If this is a POST, validate source and user credentials FeedWordPressCompatibility::validate_http_request('feedwordpress_feeds', 'manage_links'); // Get single link ID or multiple link IDs from REQUEST parameters // if available. Sanitize values for MySQL. $link_list = $this->requested_link_ids_sql(); if (MyPHP::post('confirm') == 'Undelete') { if (is_array(MyPHP::post('link_action'))) { $actions = MyPHP::post('link_action'); } else { $actions = array(); } $do_it = array('unhide' => array()); foreach ($actions as $link_id => $what) { $do_it[$what][] = $link_id; } $alter = array(); if (count($do_it['unhide']) > 0) { $unhiddem = "(" . implode(', ', $do_it['unhide']) . ")"; $alter[] = "\n\t\t\t\tUPDATE {$wpdb->links}\n\t\t\t\tSET link_visible = 'Y'\n\t\t\t\tWHERE link_id IN {$unhiddem}\n\t\t\t\t"; } $errs = array(); $success = array(); foreach ($alter as $sql) { $result = $wpdb->query($sql); if (!$result) { $errs[] = mysql_error(); } } if (count($alter) > 0) { echo "<div class=\"updated\">\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."; } echo "</div>\n"; } return true; // Continue on to Syndicated Sites listing } else { // $link_list has previously been sanitized for html by self::requested_link_ids_sql $targets = $wpdb->get_results("\n\t\t\t\tSELECT * FROM {$wpdb->links}\n\t\t\t\tWHERE link_id IN {$link_list}\n\t\t\t\t"); ?> <form action="<?php print $this->form_action(); ?> " method="post"> <div class="wrap"> <?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?> <input type="hidden" name="action" value="<?php print FWP_RESUB_CHECKED; ?> " /> <input type="hidden" name="confirm" value="Undelete" /> <h2>Re-subscribe to Syndicated Links:</h2> <?php foreach ($targets as $link) { $subscribed = 'Y' == strtoupper($link->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) { ?> <fieldset> <legend><?php echo $link_name; ?> </legend> <table class="editform" width="100%" cellspacing="2" cellpadding="5"> <tr><th scope="row" width="20%"><?php _e('Feed URI:'); ?> </th> <td width="80%"><a href="<?php echo $link_rss; ?> "><?php echo $link_rss; ?> </a></td></tr> <tr><th scope="row" width="20%"><?php _e('Short description:'); ?> </th> <td width="80%"><?php echo $link_description; ?> </span></td></tr> <tr><th width="20%" scope="row"><?php _e('Homepage:'); ?> </th> <td width="80%"><a href="<?php echo $link_url; ?> "><?php echo $link_url; ?> </a></td></tr> <tr style="vertical-align:top"><th width="20%" scope="row">Subscription <?php _e('Options'); ?> :</th> <td width="80%"><ul style="margin:0; padding: 0; list-style: none"> <li><input type="radio" id="unhide-<?php echo $link->link_id; ?> " name="link_action[<?php echo $link->link_id; ?> ]" value="unhide" checked="checked" /> <label for="unhide-<?php echo $link->link_id; ?> ">Turn back on the subscription for this syndication source.</label></li> <li><input type="radio" id="nothing-<?php echo $link->link_id; ?> " name="link_action[<?php echo $link->link_id; ?> ]" value="nothing" /> <label for="nothing-<?php echo $link->link_id; ?> ">Leave this feed as it is. I changed my mind.</label></li> </ul> </table> </fieldset> <?php } } ?> <div class="submit"> <input class="button-primary delete" type="submit" name="submit" value="<?php _e('Re-subscribe to selected feeds »'); ?> " /> </div> </div> <?php return false; // Don't continue on to Syndicated Sites listing } }
function display() { global $fwp_post; if (FeedWordPress::needs_upgrade()) { fwp_upgrade_page(); return; } FeedWordPressCompatibility::validate_http_request($this->dispatch, 'manage_links'); //////////////////////////////////////////////// // Process POST request, if any //////////////// //////////////////////////////////////////////// if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') { $this->accept_POST($fwp_post); } else { $this->updated = false; } //////////////////////////////////////////////// // Prepare settings page /////////////////////// //////////////////////////////////////////////// $this->display_update_notice_if_updated($this->pagename('settings-update'), $this->update_message()); $this->open_sheet($this->pagename('open-sheet')); ?> <div id="post-body"> <?php foreach ($this->boxes_by_methods as $method => $row) { if (is_array($row)) { $id = $row['id']; $title = $row['title']; } else { $id = 'feedwordpress_' . $method; $title = $row; } add_meta_box($id, $title, array($this, $method), $this->meta_box_context(), $this->meta_box_context()); } do_action($this->dispatch . '_meta_boxes', $this); ?> <div class="metabox-holder"> <?php fwp_do_meta_boxes($this->meta_box_context(), $this->meta_box_context(), $this); ?> </div> <!-- class="metabox-holder" --> </div> <!-- id="post-body" --> <?php $this->close_sheet(); ?> <?php }
function fwp_posts_page() { global $wp_db_version; global $fwp_post; if (FeedWordPress::needs_upgrade()) { fwp_upgrade_page(); return; } // If this is a POST, validate source and user credentials FeedWordPressCompatibility::validate_http_request('feedwordpress_posts_settings', 'manage_links'); $link = FeedWordPressAdminPage::submitted_link(); $postsPage = new FeedWordPressPostsPage($link); $mesg = null; //////////////////////////////////////////////// // Process POST request, if any //////////////// //////////////////////////////////////////////// if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') { $postsPage->accept_POST($fwp_post); do_action('feedwordpress_admin_page_posts_save', $fwp_post, $postsPage); } $postsPage->ajax_interface_js(); if ($postsPage->updated) { ?> <div class="updated"><p>Syndicated posts settings updated.</p></div> <?php } elseif (!is_null($mesg)) { ?> <div class="updated"><p><?php print esc_html($mesg); ?> </p></div> <?php } ?> <?php $links = FeedWordPress::syndicated_links(); $postsPage->open_sheet('Syndicated Posts & Links'); ?> <style type="text/css"> table.edit-form th, table.form-table th { width: 27%; vertical-align: top; } table.edit-form td, table.form-table td { width: 73%; vertical-align: top; } ul.options { margin: 0; padding: 0; list-style: none; } </style> <div id="post-body"> <?php $boxes_by_methods = array('publication_box' => __('Syndicated Posts'), 'links_box' => __('Links'), 'formatting_box' => __('Formatting'), 'comments_and_pings_box' => __('Comments & Pings'), 'custom_post_settings_box' => __('Custom Post Settings (to apply to each syndicated post)')); foreach ($boxes_by_methods as $method => $title) { fwp_add_meta_box('feedwordpress_' . $method, $title, array('FeedWordPressPostsPage', $method), $postsPage->meta_box_context(), $postsPage->meta_box_context()); } do_action('feedwordpress_admin_page_posts_meta_boxes', $postsPage); ?> <div class="metabox-holder"> <?php fwp_do_meta_boxes($postsPage->meta_box_context(), $postsPage->meta_box_context(), $postsPage); ?> </div> <!-- class="metabox-holder" --> </div> <!-- id="post-body" --> <?php $postsPage->close_sheet(); }
function display() { global $fwp_post; global $post_source; if (FeedWordPress::needs_upgrade()) { fwp_upgrade_page(); return; } // Allow overriding of normal source for FeedFinder, which may // be called from multiple points. if (isset($post_source) and !is_null($post_source)) { $source = $post_source; } else { $source = get_class($this); } // If this is a POST, validate source and user credentials FeedWordPressCompatibility::validate_http_request($source, 'manage_links'); if (isset($_REQUEST['feedfinder']) or isset($_REQUEST['action']) and $_REQUEST['action'] == 'feedfinder' or isset($_REQUEST['action']) and $_REQUEST['action'] == FWP_SYNDICATE_NEW) { return $this->display_feedfinder(); // re-route to Feed Finder page } else { if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') { $this->accept_POST($fwp_post); do_action('feedwordpress_admin_page_feeds_save', $GLOBALS['fwp_post'], $this); } //////////////////////////////////////////////// // Prepare settings page /////////////////////// //////////////////////////////////////////////// $this->ajax_interface_js(); $this->display_update_notice_if_updated('Syndicated feed'); $this->open_sheet('Feed and Update'); ?> <div id="post-body"> <?php //////////////////////////////////////////////// // Display settings boxes ////////////////////// //////////////////////////////////////////////// $boxes_by_methods = array('feed_information_box' => __('Feed Information'), 'global_feeds_box' => __('Update Scheduling'), 'updated_posts_box' => __('Updated Posts'), 'posts_box' => __('Syndicated Posts, Links, Comments & Pings'), 'authors_box' => __('Syndicated Authors'), 'categories_box' => __('Categories' . FEEDWORDPRESS_AND_TAGS), 'custom_settings_box' => __('Custom Feed Settings (for use in templates)')); if ($this->for_default_settings()) { unset($boxes_by_methods['custom_settings_box']); } foreach ($boxes_by_methods as $method => $row) { if (is_array($row)) { $id = $row['id']; $title = $row['title']; } else { $id = 'feedwordpress_' . $method; $title = $row; } fwp_add_meta_box($id, $title, array(get_class($this), $method), $this->meta_box_context(), $this->meta_box_context()); } do_action('feedwordpress_admin_page_feeds_meta_boxes', $this); ?> <div class="metabox-holder"> <?php fwp_do_meta_boxes($this->meta_box_context(), $this->meta_box_context(), $this); ?> </div> <!-- class="metabox-holder" --> </div> <!-- id="post-body" --> <?php $this->close_sheet(); ?> <script type="text/javascript"> var els = ['name', 'description', 'url']; for (var i = 0; i < els.length; i++) { contextual_appearance( /*item=*/ 'basics-hardcode-'+els[i], /*appear=*/ 'basics-'+els[i]+'-view', /*disappear=*/ 'basics-'+els[i]+'-edit', /*value=*/ 'no', /*visibleStyle=*/ 'block', /*checkbox=*/ true ); } /* for */ </script> <?php } return false; // Don't continue }
function fwp_authors_page() { global $wp_db_version; if (FeedWordPress::needs_upgrade()) { fwp_upgrade_page(); return; } FeedWordPressCompatibility::validate_http_request('feedwordpress_author_settings', 'manage_links'); $link = FeedWordPressAdminPage::submitted_link(); $authorsPage = new FeedWordPressAuthorsPage($link); $mesg = null; if (isset($GLOBALS['fwp_post']['fix_mismatch'])) { $fix_mismatch_to_id = $GLOBALS['fwp_post']['fix_mismatch_to']; $fix_mismatch_from_id = (int) $GLOBALS['fwp_post']['fix_mismatch_from']; if (is_numeric($fix_mismatch_from_id)) { // Make a list of all the items by this author syndicated from this feed... $args = array('posts_per_page' => -1, 'meta_key' => 'syndication_feed_id', 'meta_value' => $link->id, 'post_author' => $fix_mismatch_from_id); $query = new WP_Query($args); $mesg = ''; $post_ids = array(); if ($query->have_posts()) { while ($query->have_posts()) { global $post; $query->the_post(); if (is_numeric($fix_mismatch_to_id)) { $post->post_author = $fix_mismatch_to_id; $new_post = (array) $post; wp_insert_post($new_post); $mesg_action = 'Re-assigned'; $post_ids[] = get_the_ID(); } else { if ($fix_mismatch_to_id == 'filter') { wp_delete_post($post->ID); $mesg_action = 'Re-assigned'; $post_ids[] = get_the_ID(); } } } $mesg = $mesg_action . ' ' . count($post_ids) . ' post' . (count($post_ids) == 1 ? '' : 's') . '.'; } else { $mesg = "Couldn't find any posts that matched your criteria."; } } $updated_link = false; } elseif (isset($GLOBALS['fwp_post']['save'])) { if (is_object($link) and $link->found()) { $alter = array(); // Unfamiliar author rule if (isset($GLOBALS['fwp_post']["unfamiliar_author"])) { if ('site-default' == $GLOBALS['fwp_post']["unfamiliar_author"]) { unset($link->settings["unfamiliar author"]); } else { $link->settings["unfamiliar author"] = $GLOBALS['fwp_post']["unfamiliar_author"]; } } // Handle author mapping rules if (isset($GLOBALS['fwp_post']['author_rules_name']) and isset($GLOBALS['fwp_post']['author_rules_action'])) { unset($link->settings['map authors']); foreach ($GLOBALS['fwp_post']['author_rules_name'] as $key => $name) { // Normalize for case and whitespace $name = strtolower(trim($name)); $author_action = strtolower(trim($GLOBALS['fwp_post']['author_rules_action'][$key])); if (strlen($name) > 0) { $link->settings['map authors']['name'][$name] = $author_action; } } } if (isset($GLOBALS['fwp_post']['add_author_rule_name']) and isset($GLOBALS['fwp_post']['add_author_rule_action'])) { $name = strtolower(trim($GLOBALS['fwp_post']['add_author_rule_name'])); $author_action = strtolower(trim($GLOBALS['fwp_post']['add_author_rule_action'])); if (strlen($name) > 0) { $link->settings['map authors']['name'][$name] = $author_action; } } // Save settings $link->save_settings(true); $updated_link = true; // Reset, reload $link_id = $link->id; unset($link); $link = new SyndicatedLink($link_id); } else { update_option('feedwordpress_unfamiliar_author', $GLOBALS['fwp_post']['unfamiliar_author']); if (isset($GLOBALS['fwp_post']['match_author_by_email']) and $GLOBALS['fwp_post']['match_author_by_email'] == 'yes') { update_option('feedwordpress_do_not_match_author_by_email', 'no'); } else { update_option('feedwordpress_do_not_match_author_by_email', 'yes'); } if (isset($GLOBALS['fwp_post']['null_emails'])) { update_option('feedwordpress_null_email_set', $GLOBALS['fwp_post']['null_emails']); } $updated_link = true; } do_action('feedwordpress_admin_page_authors_save', $GLOBALS['fwp_post'], $authorsPage); $authorsPage->refresh_author_list(); } else { $updated_link = false; } //////////////////////////////////////////////// // Prepare settings page /////////////////////// //////////////////////////////////////////////// if ($updated_link) { ?> <div class="updated"><p>Syndicated author settings updated.</p></div> <?php } elseif (!is_null($mesg)) { ?> <div class="updated"><p><?php print esc_html($mesg); ?> </p></div> <?php } if (function_exists('add_meta_box')) { add_action(FeedWordPressCompatibility::bottom_script_hook(__FILE__), array($authorsPage, 'fix_toggles'), 10000); FeedWordPressSettingsUI::ajax_nonce_fields(); } $authorsPage->open_sheet('Syndicated Author'); ?> <div id="post-body"> <?php //////////////////////////////////////////////// // Display settings boxes ////////////////////// //////////////////////////////////////////////// $boxes_by_methods = array('syndicated_authors_box' => __('Syndicated Authors'), 'fix_authors_box' => __('Reassign Authors')); if ($authorsPage->for_default_settings()) { unset($boxes_by_methods['fix_authors_box']); } foreach ($boxes_by_methods as $method => $row) { if (is_array($row)) { $id = $row['id']; $title = $row['title']; } else { $id = 'feedwordpress_' . $method; $title = $row; } fwp_add_meta_box($id, $title, array('FeedWordPressAuthorsPage', $method), $authorsPage->meta_box_context(), $authorsPage->meta_box_context()); } do_action('feedwordpress_admin_page_authors_meta_boxes', $authorsPage); ?> <div class="metabox-holder"> <?php fwp_do_meta_boxes($authorsPage->meta_box_context(), $authorsPage->meta_box_context(), $authorsPage); ?> </div> <!-- class="metabox-holder" --> </div> <!-- id="post-body" --> <?php $authorsPage->close_sheet(); ?> <script type="text/javascript"> <?php if (!is_object($link) or !$link->found()) { ?> contextual_appearance('match-author-by-email', 'unless-null-email', null, 'yes', 'block', /*checkbox=*/ true); <?php } ?> </script> <?php }
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')); ?> <div id="post-body"> <?php foreach ($this->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); ?> <div class="metabox-holder"> <?php fwp_do_meta_boxes($this->meta_box_context(), $this->meta_box_context(), $this); ?> </div> <!-- class="metabox-holder" --> </div> <!-- id="post-body" --> <?php $this->close_sheet(); ?> <?php }
function fwp_multidelete_page() { // If this is a POST, validate source and user credentials FeedWordPressCompatibility::validate_http_request('feedwordpress_feeds', 'manage_links'); $link_ids = isset($_REQUEST['link_ids']) ? $_REQUEST['link_ids'] : array(); if (isset($_REQUEST['link_id'])) { array_push($link_ids, $_REQUEST['link_id']); } if (isset($GLOBALS['fwp_post']['confirm']) and $GLOBALS['fwp_post']['confirm'] == 'Delete') { if (isset($GLOBALS['fwp_post']['link_action']) and is_array($GLOBALS['fwp_post']['link_action'])) { $actions = $GLOBALS['fwp_post']['link_action']; } else { $actions = array(); } $do_it = array('hide' => array(), 'nuke' => array(), 'delete' => array()); foreach ($actions as $link_id => $what) { $do_it[$what][] = $link_id; } $alter = $errs = array(); if (count($do_it['hide']) > 0) { $links = get_bookmarks(array('include' => implode(',', $do_it['hide']))); if (is_array($links) && !empty($links)) { foreach ($links as $link) { $link->link_visible = 'N'; $alter[] = 'hiding link: ' . $link->link_id; wp_update_link((array) $link); } } } if (count($do_it['nuke']) > 0) { foreach ($do_it['nuke'] as $nuke_id) { // Make a list of the items syndicated from this feed... $args = array('posts_per_page' => -1, 'numberposts' => 0, 'meta_key' => 'syndication_feed_id', 'meta_value' => $nuke_id); $posts = get_posts($args); // ... and kill them all if (is_array($posts) && !empty($posts)) { foreach ($posts as $p) { $alter[] = 'deleting post: ' . $p->ID; wp_delete_post($p->ID, true); } } // Then delete the link wp_delete_link($nuke_id); } } if (count($do_it['delete']) > 0) { $deletem = "(" . implode(', ', $do_it['delete']) . ")"; foreach ($do_it['delete'] as $del_id) { // Make a list of the items syndicated from this feed... $args = array('posts_per_page' => -1, 'numberposts' => 0, 'meta_key' => 'syndication_feed_id', 'meta_value' => $del_id); $posts = get_posts($args); // Make the items syndicated from this feed appear to be locally-authored if (is_array($posts) && !empty($posts)) { foreach ($posts as $p) { $alter[] = 'deleting postmeta for post: ' . $p->ID; if (!delete_post_meta($p->ID, 'syndication_feed_id')) { $errs[] = 'Could not delete meta for post: ' . $p->ID; } } } // Then delete the link wp_delete_link($del_id); } } if (count($alter) > 0) { echo "<div class=\"updated\">\n"; if (count($errs) > 0) { echo "There were some problems processing your "; echo "unsubscribe request. [Errors: " . implode('; ', $errs) . "]"; } else { echo "Your unsubscribe request(s) have been processed."; } echo "</div>\n"; } return true; // Continue on to Syndicated Sites listing } else { if (count($link_ids) > 0) { $targets = get_bookmarks(array('include' => implode(',', $link_ids), 'hide_invisible' => 0)); } else { $targets = array(); } ?> <form action="admin.php?page=<?php echo FWP_SYNDICATION_PAGE_SLUG; ?> " method="post"> <div class="wrap"> <?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?> <input type="hidden" name="action" value="Unsubscribe" /> <input type="hidden" name="confirm" value="Delete" /> <h2>Unsubscribe from Syndicated Links:</h2> <?php foreach ($targets as $link) { $subscribed = 'Y' == strtoupper($link->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); ?> <fieldset> <legend><?php echo $link_name; ?> </legend> <table class="editform" width="100%" cellspacing="2" cellpadding="5"> <tr><th scope="row" width="20%"><?php _e('Feed URI:'); ?> </th> <td width="80%"><a href="<?php echo $link_rss; ?> "><?php echo $link_rss; ?> </a></td></tr> <tr><th scope="row" width="20%"><?php _e('Short description:'); ?> </th> <td width="80%"><?php echo $link_description; ?> </span></td></tr> <tr><th width="20%" scope="row"><?php _e('Homepage:'); ?> </th> <td width="80%"><a href="<?php echo $link_url; ?> "><?php echo $link_url; ?> </a></td></tr> <tr style="vertical-align:top"><th width="20%" scope="row">Subscription <?php _e('Options'); ?> :</th> <td width="80%"><ul style="margin:0; padding: 0; list-style: none"> <?php if ($subscribed) { ?> <li><input type="radio" id="hide-<?php echo $link->link_id; ?> " name="link_action[<?php echo $link->link_id; ?> ]" value="hide" checked="checked" /> <label for="hide-<?php echo $link->link_id; ?> ">Turn off the subscription for this syndicated link<br/><span style="font-size:smaller">(Keep the feed information and all the posts from this feed in the database, but don't syndicate any new posts from the feed.)</span></label></li> <?php } ?> <li><input type="radio" id="nuke-<?php echo $link->link_id; ?> "<?php if (!$subscribed) { ?> checked="checked"<?php } ?> name="link_action[<?php echo $link->link_id; ?> ]" value="nuke" /> <label for="nuke-<?php echo $link->link_id; ?> ">Delete this syndicated link and all the posts that were syndicated from it</label></li> <li><input type="radio" id="delete-<?php echo $link->link_id; ?> " name="link_action[<?php echo $link->link_id; ?> ]" value="delete" /> <label for="delete-<?php echo $link->link_id; ?> ">Delete this syndicated link, but <em>keep</em> posts that were syndicated from it (as if they were authored locally).</label></li> <li><input type="radio" id="nothing-<?php echo $link->link_id; ?> " name="link_action[<?php echo $link->link_id; ?> ]" value="nothing" /> <label for="nothing-<?php echo $link->link_id; ?> ">Keep this feed as it is. I changed my mind.</label></li> </ul> </table> </fieldset> <?php } ?> <div class="submit"> <input class="delete" type="submit" name="submit" value="<?php _e('Unsubscribe from selected feeds »'); ?> " /> </div> </div> <?php return false; // Don't continue on to Syndicated Sites listing } }
function multiundelete_page () { global $wpdb; // If this is a POST, validate source and user credentials FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_feeds', /*capability=*/ 'manage_links'); $link_ids = (isset($_REQUEST['link_ids']) ? $_REQUEST['link_ids'] : array()); if (isset($_REQUEST['link_id'])) : array_push($link_ids, $_REQUEST['link_id']); endif; if (isset($GLOBALS['fwp_post']['confirm']) and $GLOBALS['fwp_post']['confirm']=='Undelete'): if (isset($GLOBALS['fwp_post']['link_action']) and is_array($GLOBALS['fwp_post']['link_action'])) : $actions = $GLOBALS['fwp_post']['link_action']; else : $actions = array(); endif; $do_it = array( 'unhide' => 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 "<div class=\"updated\">\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 "</div>\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).") "); ?> <form action="<?php print $this->form_action(); ?>" method="post"> <div class="wrap"> <?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?> <input type="hidden" name="action" value="<?php print FWP_RESUB_CHECKED; ?>" /> <input type="hidden" name="confirm" value="Undelete" /> <h2>Re-subscribe to Syndicated Links:</h2> <?php foreach ($targets as $link) : $subscribed = ('Y' == strtoupper($link->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) : ?> <fieldset> <legend><?php echo $link_name; ?></legend> <table class="editform" width="100%" cellspacing="2" cellpadding="5"> <tr><th scope="row" width="20%"><?php _e('Feed URI:') ?></th> <td width="80%"><a href="<?php echo $link_rss; ?>"><?php echo $link_rss; ?></a></td></tr> <tr><th scope="row" width="20%"><?php _e('Short description:') ?></th> <td width="80%"><?php echo $link_description; ?></span></td></tr> <tr><th width="20%" scope="row"><?php _e('Homepage:') ?></th> <td width="80%"><a href="<?php echo $link_url; ?>"><?php echo $link_url; ?></a></td></tr> <tr style="vertical-align:top"><th width="20%" scope="row">Subscription <?php _e('Options') ?>:</th> <td width="80%"><ul style="margin:0; padding: 0; list-style: none"> <li><input type="radio" id="unhide-<?php echo $link->link_id; ?>" name="link_action[<?php echo $link->link_id; ?>]" value="unhide" checked="checked" /> <label for="unhide-<?php echo $link->link_id; ?>">Turn back on the subscription for this syndication source.</label></li> <li><input type="radio" id="nothing-<?php echo $link->link_id; ?>" name="link_action[<?php echo $link->link_id; ?>]" value="nothing" /> <label for="nothing-<?php echo $link->link_id; ?>">Leave this feed as it is. I changed my mind.</label></li> </ul> </table> </fieldset> <?php endif; endforeach; ?> <div class="submit"> <input class="button-primary delete" type="submit" name="submit" value="<?php _e('Re-subscribe to selected feeds »') ?>" /> </div> </div> <?php return false; // Don't continue on to Syndicated Sites listing endif; } /* FeedWordPressSyndicationPage::multiundelete_page() */
function fwp_categories_page() { global $wp_db_version; if (FeedWordPress::needs_upgrade()) { fwp_upgrade_page(); return; } FeedWordPressCompatibility::validate_http_request('feedwordpress_categories_settings', 'manage_links'); $link = FeedWordPressAdminPage::submitted_link(); $catsPage = new FeedWordPressCategoriesPage($link); $mesg = null; //////////////////////////////////////////////// // Process POST request, if any ///////////////// //////////////////////////////////////////////// if (isset($GLOBALS['fwp_post']['save']) or isset($GLOBALS['fwp_post']['submit'])) { $saveCats = array(); if (isset($GLOBALS['fwp_post']['post_category'])) { foreach ($GLOBALS['fwp_post']['post_category'] as $cat_id) { $saveCats[] = '{#' . $cat_id . '}'; } } // Different variable names to cope with different WordPress AJAX UIs $syndicatedTags = array(); if (isset($GLOBALS['fwp_post']['tax_input']['post_tag'])) { $syndicatedTags = explode(",", $GLOBALS['fwp_post']['tax_input']['post_tag']); } elseif (isset($GLOBALS['fwp_post']['tags_input'])) { $syndicatedTags = explode(",", $GLOBALS['fwp_post']['tags_input']); } $syndicatedTags = array_map('trim', $syndicatedTags); if (is_object($link) and $link->found()) { $alter = array(); // Categories if (!empty($saveCats)) { $link->settings['cats'] = $saveCats; } else { unset($link->settings['cats']); } // Tags $link->settings['tags'] = $syndicatedTags; // Unfamiliar categories if (isset($GLOBALS['fwp_post']["unfamiliar_category"])) { if ('site-default' == $GLOBALS['fwp_post']["unfamiliar_category"]) { unset($link->settings["unfamiliar category"]); } else { $link->settings["unfamiliar category"] = $GLOBALS['fwp_post']["unfamiliar_category"]; } } // Category spitting regex if (isset($GLOBALS['fwp_post']['cat_split'])) { if (strlen(trim($GLOBALS['fwp_post']['cat_split'])) > 0) { $link->settings['cat_split'] = trim($GLOBALS['fwp_post']['cat_split']); } else { unset($link->settings['cat_split']); } } // Save settings $link->save_settings(true); $catsPage->updated = true; // Reset, reload $link_id = $link->id; unset($link); $link = new SyndicatedLink($link_id); } else { // Categories if (!empty($saveCats)) { update_option('feedwordpress_syndication_cats', implode(FEEDWORDPRESS_CAT_SEPARATOR, $saveCats)); } else { delete_option('feedwordpress_syndication_cats'); } // Tags if (!empty($syndicatedTags)) { update_option('feedwordpress_syndication_tags', implode(FEEDWORDPRESS_CAT_SEPARATOR, $syndicatedTags)); } else { delete_option('feedwordpress_syndication_tags'); } update_option('feedwordpress_unfamiliar_category', $_REQUEST['unfamiliar_category']); $catsPage->updated = true; } do_action('feedwordpress_admin_page_categories_save', $GLOBALS['fwp_post'], $catsPage); } else { $catsPage->updated = false; } //////////////////////////////////////////////// // Prepare settings page /////////////////////// //////////////////////////////////////////////// $catsPage->display_update_notice_if_updated('Syndicated categories' . FEEDWORDPRESS_AND_TAGS, $mesg); $catsPage->open_sheet('Categories' . FEEDWORDPRESS_AND_TAGS); ?> <style type="text/css"> table.edit-form th { width: 27%; vertical-align: top; } table.edit-form td { width: 73%; vertical-align: top; } table.edit-form td ul.options { margin: 0; padding: 0; list-style: none; } </style> <div id="post-body"> <?php //////////////////////////////////////////////// // Display settings boxes ////////////////////// //////////////////////////////////////////////// $boxes_by_methods = array('feed_categories_box' => __('Feed Categories' . FEEDWORDPRESS_AND_TAGS), 'categories_box' => array('title' => __('Categories'), 'id' => 'categorydiv'), 'tags_box' => __('Tags')); if (!FeedWordPressCompatibility::post_tags()) { unset($boxes_by_methods['tags_box']); } foreach ($boxes_by_methods as $method => $row) { if (is_array($row)) { $id = $row['id']; $title = $row['title']; } else { $id = 'feedwordpress_' . $method; $title = $row; } fwp_add_meta_box($id, $title, array('FeedWordPressCategoriesPage', $method), $catsPage->meta_box_context(), $catsPage->meta_box_context()); } do_action('feedwordpress_admin_page_categories_meta_boxes', $catsPage); ?> <div class="metabox-holder"> <?php fwp_do_meta_boxes($catsPage->meta_box_context(), $catsPage->meta_box_context(), $catsPage); ?> </div> <!-- class="metabox-holder" --> </div> <!-- id="post-body" --> <?php $catsPage->close_sheet(); }