options = get_option( 'applicationinsights_options' );
?>
options = get_site_option( 'applicationinsights_options' );
?>
',
isset( $this->options['instrumentation_key'] ) ? esc_attr( $this->options['instrumentation_key'] ) : ''
);
}
/**
* This function here is hooked up to a special action and necessary to process
* the saving of the options. This is the big difference with a normal options
* page.
*/
function applicationinsights_options()
{
// Make sure we are posting from our options page. There's a little surprise
// here, on the options page we used the 'applicationinsights_option_group'
// slug when calling 'settings_fields' but we must add the '-options' postfix
// when we check the referer.
check_admin_referer('applicationinsights_option_group-options');
// This is the list of registered options.
global $new_whitelist_options;
// pick option group
$options = $new_whitelist_options['applicationinsights_option_group'];
// Go through the posted data and save only our options. This is a generic
// way to do this, but you may want to address the saving of each option
// individually.
foreach ($options as $option) {
if (isset($_POST[$option])) {
// If we registered a callback function to sanitizes the option's
// value it is where we call it (see register_setting).
$option_value = apply_filters('sanitize_option_' . 'applicationinsights_option_group', $_POST[$option]);
// And finally we save our option with the site's options.
update_site_option($option, $option_value);
} else {
// If the option is not here then delete it. It depends on how you
// want to manage your defaults however.
delete_site_option($option);
}
}
// At last we redirect back to our options page.
wp_redirect(add_query_arg(array('page' => 'applicationinsights-setting-admin',
'updated' => 'true'), network_admin_url('settings.php')));
exit;
}
}