public static function handle_save_on_network()
{
if (!Falcon::is_network_mode()) {
return;
}
if (empty($_POST) || empty($_REQUEST['action']) || $_REQUEST['action'] !== 'update') {
return;
}
$option_page = 'bbsub_options';
$capability = apply_filters("option_page_capability_{$option_page}", 'manage_network_options');
if (!current_user_can($capability)) {
wp_die(__('Cheatin’ uh?'), 403);
}
check_admin_referer($option_page . '-options');
$whitelist_options = apply_filters('whitelist_options', array());
if (!isset($whitelist_options[$option_page])) {
wp_die(__('<strong>ERROR</strong>: options page not found.'));
}
$options = $whitelist_options[$option_page];
foreach ($options as $option) {
if ($unregistered) {
_deprecated_argument('options.php', '2.7', sprintf(__('The <code>%1$s</code> setting is unregistered. Unregistered settings are deprecated. See http://codex.wordpress.org/Settings_API'), $option, $option_page));
}
$option = trim($option);
$value = null;
if (isset($_POST[$option])) {
$value = $_POST[$option];
if (!is_array($value)) {
$value = trim($value);
}
$value = wp_unslash($value);
}
update_site_option($option, $value);
}
/**
* Handle settings errors and return to options page
*/
// If no settings errors were registered add a general 'updated' message.
if (!count(get_settings_errors())) {
add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated');
}
set_transient('settings_errors', get_settings_errors(), 30);
/**
* Redirect back to the settings page that was submitted
*/
$goback = add_query_arg('settings-updated', 'true', wp_get_referer());
wp_redirect($goback);
exit;
}