(int) ( ! empty( $_POST['ab_flag_spam'] ) ), 'email_notify' => (int) ( ! empty( $_POST['ab_email_notify'] ) ), 'cronjob_enable' => (int) ( ! empty( $_POST['ab_cronjob_enable'] ) ), 'cronjob_interval' => (int) self::get_key( $_POST, 'ab_cronjob_interval' ), 'no_notice' => (int) ( ! empty( $_POST['ab_no_notice'] ) ), 'dashboard_count' => (int) ( ! empty( $_POST['ab_dashboard_count'] ) ), 'dashboard_chart' => (int) ( ! empty( $_POST['ab_dashboard_chart'] ) ), 'regexp_check' => (int) ( ! empty( $_POST['ab_regexp_check'] ) ), 'spam_ip' => (int) ( ! empty( $_POST['ab_spam_ip'] ) ), 'already_commented' => (int) ( ! empty( $_POST['ab_already_commented'] ) ), 'time_check' => (int) ( ! empty( $_POST['ab_time_check'] ) ), 'ignore_pings' => (int) ( ! empty( $_POST['ab_ignore_pings'] ) ), 'ignore_filter' => (int) ( ! empty( $_POST['ab_ignore_filter'] ) ), 'ignore_type' => (int) self::get_key( $_POST, 'ab_ignore_type' ), 'reasons_enable' => (int) ( ! empty( $_POST['ab_reasons_enable'] ) ), 'ignore_reasons' => (array) self::get_key( $_POST, 'ab_ignore_reasons' ), 'bbcode_check' => (int) ( ! empty( $_POST['ab_bbcode_check'] ) ), 'gravatar_check' => (int) ( ! empty( $_POST['ab_gravatar_check'] ) ), 'country_code' => (int) ( ! empty( $_POST['ab_country_code'] ) ), 'country_denied' => sanitize_text_field( wp_unslash( self::get_key( $_POST, 'ab_country_denied' ) ) ), 'country_allowed' => sanitize_text_field( wp_unslash( self::get_key( $_POST, 'ab_country_allowed' ) ) ), 'translate_api' => (int) ( ! empty( $_POST['ab_translate_api'] ) ), 'translate_lang' => $selected_languages, 'delete_data_on_uninstall' => (int) ( ! empty( $_POST['delete_data_on_uninstall'] ) ), 'use_output_buffer' => (int) ( ! empty( $_POST['ab_use_output_buffer'] ) ), ); foreach ( $options['ignore_reasons'] as $key => $val ) { if ( ! isset( self::$defaults['reasons'][ $val ] ) ) { unset( $options['ignore_reasons'][ $key ] ); } } if ( empty( $options['cronjob_interval'] ) ) { $options['cronjob_enable'] = 0; } if ( empty( $options['translate_lang'] ) ) { $options['translate_api'] = 0; } if ( empty( $options['reasons_enable'] ) ) { $options['ignore_reasons'] = array(); } if ( ! empty( $options['country_denied'] ) ) { $options['country_denied'] = preg_replace( '/[^A-Z ,;]/', '', strtoupper( $options['country_denied'] ) ); } if ( ! empty( $options['country_allowed'] ) ) { $options['country_allowed'] = preg_replace( '/[^A-Z ,;]/', '', strtoupper( $options['country_allowed'] ) ); } if ( empty( $options['country_denied'] ) && empty( $options['country_allowed'] ) ) { $options['country_code'] = 0; } if ( $options['cronjob_enable'] && ! self::get_option( 'cronjob_enable' ) ) { self::init_scheduled_hook(); } elseif ( ! $options['cronjob_enable'] && self::get_option( 'cronjob_enable' ) ) { self::clear_scheduled_hook(); } self::update_options( $options ); wp_safe_redirect( add_query_arg( array( 'updated' => 'true', ), wp_get_referer() ) ); die(); } /** * Generation of a selectbox * * @since 2.4.5 * * @param string $name Name of the Selectbox. * @param array $data Array with values. * @param string $selected Selected value. * @return string $html Generated HTML. */ private static function _build_select( $name, $data, $selected ) { $html = ''; return $html; } /** * Display the GUI * * @since 0.1 * @since 2.7.0 * @since 2.10.0 Change documentation links, change country option name, and add option to parse complete markup for comment forms */ public static function options_page() { ?>