Noptin_Ajax::save_options()
Saves settings
Source Source
File: includes/class-noptin-ajax.php
public function save_options() { if ( ! current_user_can( get_noptin_capability() ) ) { wp_die( -1, 403 ); } // Check nonce. check_ajax_referer( 'noptin_admin_nonce' ); /** * Runs before saving a settings */ do_action( 'noptin_before_save_options' ); // Prepare settings. $_settings = stripslashes_deep( $_POST['state'] ); unset( $_settings['noptin_admin_nonce'] ); unset( $_settings['saved'] ); unset( $_settings['error'] ); unset( $_settings['currentTab'] ); $settings = array(); foreach ( $_settings as $key => $val ) { if ( 'false' === $val ) { $val = false; } if ( 'true' === $val ) { $val = true; } $settings[ $key ] = $val; } /** * Sanitizes noptin settings. * * @param array $settings Noptin settings. */ $settings = apply_filters( 'noptin_sanitize_settings', $settings ); // Save them. update_noptin_options( $settings ); wp_send_json_success( 1 ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.8 | Introduced. |