dispatch = 'feedwordpress_diagnostics';
$this->filename = __FILE__;
}
function has_link () { return false; }
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');
?>
__('Diagnostics'),
'updates_box' => __('Updates'),
);
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);
?>
meta_box_context(), $this->meta_box_context(), $this);
?>
close_sheet();
} /* FeedWordPressDiagnosticsPage::display () */
function accept_POST ($post) {
if (isset($post['submit'])
or isset($post['save'])) :
update_option('feedwordpress_debug', $post['feedwordpress_debug']);
if (!isset($post['diagnostics_output'])
or !is_array($post['diagnostics_output'])) :
$post['diagnostics_output'] = array();
endif;
update_option('feedwordpress_diagnostics_output', $post['diagnostics_output']);
if (!isset($post['diagnostics_show'])
or !is_array($post['diagnostics_show'])) :
$post['diagnostics_show'] = array();
endif;
update_option('feedwordpress_diagnostics_show', $post['diagnostics_show']);
if ($post['diagnostics_show']
and in_array('updated_feeds:errors:persistent', $post['diagnostics_show'])) :
update_option('feedwordpress_diagnostics_persistent_errors_hours', (int) $post['diagnostics_persistent_error_hours']);
else :
delete_option('feedwordpress_diagnostics_persistent_errors_hours');
endif;
if (in_array('email', $post['diagnostics_output'])) :
$ded = $post['diagnostics_email_destination'];
if ('mailto'==$ded) :
$ded .= ':'.$post['diagnostics_email_destination_address'];
endif;
update_option('feedwordpress_diagnostics_email_destination', $ded);
else :
delete_option('feedwordpress_diagnostics_email_destination');
endif;
$this->updated = true; // Default update message
endif;
} /* FeedWordPressDiagnosticsPage::accept_POST () */
/*static*/ function diagnostics_box ($page, $box = NULL) {
$settings = array();
$settings['debug'] = (get_option('feedwordpress_debug')=='yes');
$diagnostics_output = get_option('feedwordpress_diagnostics_output', array());
$users = fwp_author_list();
$ded = get_option('feedwordpress_diagnostics_email_destination', 'admins');
if (preg_match('/^mailto:(.*)$/', $ded, $ref)) :
$ded_addy = $ref[1];
else :
$ded_addy = NULL;
endif;
// Hey ho, let's go...
?>