get_sections() as $section_id => $section ) { add_settings_section( $section_id, $section['section_title'], ! empty( $section['section_callback'] ) ? $section['section_callback'] : null, 'anr_admin_options' ); } foreach ( $this->get_fields() as $field_id => $field ) { $args = wp_parse_args( $field, array( 'id' => $field_id, 'label' => '', 'cb_label' => '', 'type' => 'text', 'class' => 'regular-text', 'section_id' => '', 'desc' => '', 'std' => '', ) ); add_settings_field( $args['id'], $args['label'], ! empty( $args['callback'] ) ? $args['callback'] : array( $this, 'callback' ), 'anr_admin_options', $args['section_id'], $args ); } } function get_sections() { $sections = array( 'google_keys' => array( 'section_title' => __( 'Google Keys', 'advanced-nocaptcha-recaptcha' ), 'section_callback' => function() { printf( __( 'Get reCaptcha keys from Google. Make sure to get keys for your selected captcha version.', 'advanced-nocaptcha-recaptcha' ), 'https://www.google.com/recaptcha/admin' ); }, ), 'forms' => array( 'section_title' => __( 'Forms', 'advanced-nocaptcha-recaptcha' ), ), 'other' => array( 'section_title' => __( 'Other Settings', 'advanced-nocaptcha-recaptcha' ), ), ); return apply_filters( 'anr_settings_sections', $sections ); } function get_fields() { $score_values = []; for ( $i = 0.0; $i <= 1; $i += 0.1 ) { $score_values[ "$i" ] = number_format_i18n( $i, 1 ); } $fields = array( 'captcha_version' => array( 'label' => __( 'Version', 'advanced-nocaptcha-recaptcha' ), 'section_id' => 'google_keys', 'type' => 'select', 'class' => 'regular', 'std' => 'v2_checkbox', 'options' => array( 'v2_checkbox' => __( 'V2 "I\'m not a robot"', 'advanced-nocaptcha-recaptcha' ), 'v2_invisible' => __( 'V2 Invisible', 'advanced-nocaptcha-recaptcha' ), 'v3' => __( 'V3', 'advanced-nocaptcha-recaptcha' ), ), 'desc' => __( 'Select your reCaptcha version. Make sure to use site key and secret key for your selected version.', 'advanced-nocaptcha-recaptcha' ), ), 'site_key' => array( 'label' => __( 'Site Key', 'advanced-nocaptcha-recaptcha' ), 'section_id' => 'google_keys', ), 'secret_key' => array( 'label' => __( 'Secret Key', 'advanced-nocaptcha-recaptcha' ), 'section_id' => 'google_keys', ), 'enabled_forms' => array( 'label' => __( 'Enabled Forms', 'advanced-nocaptcha-recaptcha' ), 'section_id' => 'forms', 'type' => 'multicheck', 'class' => 'checkbox', 'options' => array( 'login' => __( 'Login Form', 'advanced-nocaptcha-recaptcha' ), 'registration' => __( 'Registration Form', 'advanced-nocaptcha-recaptcha' ), 'ms_user_signup' => __( 'Multisite User Signup Form', 'advanced-nocaptcha-recaptcha' ), 'lost_password' => __( 'Lost Password Form', 'advanced-nocaptcha-recaptcha' ), 'reset_password' => __( 'Reset Password Form', 'advanced-nocaptcha-recaptcha' ), 'comment' => __( 'Comment Form', 'advanced-nocaptcha-recaptcha' ), 'bbp_new' => __( 'bbPress New topic', 'advanced-nocaptcha-recaptcha' ), 'bbp_reply' => __( 'bbPress reply to topic', 'advanced-nocaptcha-recaptcha' ), 'bp_register' => __( 'BuddyPress register', 'advanced-nocaptcha-recaptcha' ), 'wc_checkout' => __( 'WooCommerce Checkout', 'advanced-nocaptcha-recaptcha' ), ), 'desc' => sprintf( __( 'For other forms see Instruction', 'advanced-nocaptcha-recaptcha' ), esc_url( admin_url( 'admin.php?page=anr-instruction' ) ) ), ), 'error_message' => array( 'label' => __( 'Error Message', 'advanced-nocaptcha-recaptcha' ), 'section_id' => 'other', 'std' => __( 'Please solve Captcha correctly', 'advanced-nocaptcha-recaptcha' ), ), 'language' => array( 'label' => __( 'Captcha Language', 'advanced-nocaptcha-recaptcha' ), 'section_id' => 'other', 'type' => 'select', 'class' => 'regular', 'options' => array( '' => __( 'Auto Detect', 'advanced-nocaptcha-recaptcha' ), 'ar' => __( 'Arabic', 'advanced-nocaptcha-recaptcha' ), 'bg' => __( 'Bulgarian', 'advanced-nocaptcha-recaptcha' ), 'ca' => __( 'Catalan', 'advanced-nocaptcha-recaptcha' ), 'zh-CN' => __( 'Chinese (Simplified)', 'advanced-nocaptcha-recaptcha' ), 'zh-CN' => __( 'Chinese (Traditional)', 'advanced-nocaptcha-recaptcha' ), 'hr' => __( 'Croatian', 'advanced-nocaptcha-recaptcha' ), 'cs' => __( 'Czech', 'advanced-nocaptcha-recaptcha' ), 'da' => __( 'Danish', 'advanced-nocaptcha-recaptcha' ), 'nl' => __( 'Dutch', 'advanced-nocaptcha-recaptcha' ), 'en-GB' => __( 'English (UK)', 'advanced-nocaptcha-recaptcha' ), 'en' => __( 'English (US)', 'advanced-nocaptcha-recaptcha' ), 'fil' => __( 'Filipino', 'advanced-nocaptcha-recaptcha' ), 'fi' => __( 'Finnish', 'advanced-nocaptcha-recaptcha' ), 'fr' => __( 'French', 'advanced-nocaptcha-recaptcha' ), 'fr-CA' => __( 'French (Canadian)', 'advanced-nocaptcha-recaptcha' ), 'de' => __( 'German', 'advanced-nocaptcha-recaptcha' ), 'de-AT' => __( 'German (Austria)', 'advanced-nocaptcha-recaptcha' ), 'de-CH' => __( 'German (Switzerland)', 'advanced-nocaptcha-recaptcha' ), 'el' => __( 'Greek', 'advanced-nocaptcha-recaptcha' ), 'iw' => __( 'Hebrew', 'advanced-nocaptcha-recaptcha' ), 'hi' => __( 'Hindi', 'advanced-nocaptcha-recaptcha' ), 'hu' => __( 'Hungarain', 'advanced-nocaptcha-recaptcha' ), 'id' => __( 'Indonesian', 'advanced-nocaptcha-recaptcha' ), 'it' => __( 'Italian', 'advanced-nocaptcha-recaptcha' ), 'ja' => __( 'Japanese', 'advanced-nocaptcha-recaptcha' ), 'ko' => __( 'Korean', 'advanced-nocaptcha-recaptcha' ), 'lv' => __( 'Latvian', 'advanced-nocaptcha-recaptcha' ), 'lt' => __( 'Lithuanian', 'advanced-nocaptcha-recaptcha' ), 'no' => __( 'Norwegian', 'advanced-nocaptcha-recaptcha' ), 'fa' => __( 'Persian', 'advanced-nocaptcha-recaptcha' ), 'pl' => __( 'Polish', 'advanced-nocaptcha-recaptcha' ), 'pt' => __( 'Portuguese', 'advanced-nocaptcha-recaptcha' ), 'pt-BR' => __( 'Portuguese (Brazil)', 'advanced-nocaptcha-recaptcha' ), 'pt-PT' => __( 'Portuguese (Portugal)', 'advanced-nocaptcha-recaptcha' ), 'ro' => __( 'Romanian', 'advanced-nocaptcha-recaptcha' ), 'ru' => __( 'Russian', 'advanced-nocaptcha-recaptcha' ), 'sr' => __( 'Serbian', 'advanced-nocaptcha-recaptcha' ), 'sk' => __( 'Slovak', 'advanced-nocaptcha-recaptcha' ), 'sl' => __( 'Slovenian', 'advanced-nocaptcha-recaptcha' ), 'es' => __( 'Spanish', 'advanced-nocaptcha-recaptcha' ), 'es-419' => __( 'Spanish (Latin America)', 'advanced-nocaptcha-recaptcha' ), 'sv' => __( 'Swedish', 'advanced-nocaptcha-recaptcha' ), 'th' => __( 'Thai', 'advanced-nocaptcha-recaptcha' ), 'tr' => __( 'Turkish', 'advanced-nocaptcha-recaptcha' ), 'uk' => __( 'Ukrainian', 'advanced-nocaptcha-recaptcha' ), 'vi' => __( 'Vietnamese', 'advanced-nocaptcha-recaptcha' ), ), ), 'theme' => array( 'label' => __( 'Theme', 'advanced-nocaptcha-recaptcha' ), 'section_id' => 'other', 'type' => 'select', 'class' => 'regular hidden anr-show-field-for-v2_checkbox anr-show-field-for-v2_invisible', 'std' => 'light', 'options' => array( 'light' => __( 'Light', 'advanced-nocaptcha-recaptcha' ), 'dark' => __( 'Dark', 'advanced-nocaptcha-recaptcha' ), ), ), 'size' => array( 'label' => __( 'Size', 'advanced-nocaptcha-recaptcha' ), 'section_id' => 'other', 'type' => 'select', 'class' => 'regular hidden anr-show-field-for-v2_checkbox', 'std' => 'normal', 'options' => array( 'normal' => __( 'Normal', 'advanced-nocaptcha-recaptcha' ), 'compact' => __( 'Compact', 'advanced-nocaptcha-recaptcha' ), ), ), 'badge' => array( 'label' => __( 'Badge', 'advanced-nocaptcha-recaptcha' ), 'section_id' => 'other', 'type' => 'select', 'class' => 'regular hidden anr-show-field-for-v2_invisible', 'std' => 'bottomright', 'options' => array( 'bottomright' => __( 'Bottom Right', 'advanced-nocaptcha-recaptcha' ), 'bottomleft' => __( 'Bottom Left', 'advanced-nocaptcha-recaptcha' ), 'inline' => __( 'Inline', 'advanced-nocaptcha-recaptcha' ), ), 'desc' => __( 'Badge shows for invisible captcha', 'advanced-nocaptcha-recaptcha' ), ), 'failed_login_allow' => array( 'label' => __( 'Failed login Captcha', 'advanced-nocaptcha-recaptcha' ), 'section_id' => 'other', 'std' => 0, 'type' => 'number', 'class' => 'regular-number', 'sanitize_callback' => 'absint', 'desc' => __( 'Show login Captcha after how many failed attempts? 0 = show always', 'advanced-nocaptcha-recaptcha' ), ), 'v3_script_load' => array( 'label' => __( 'v3 Script Load', 'advanced-nocaptcha-recaptcha' ), 'section_id' => 'other', 'type' => 'select', 'class' => 'regular hidden anr-show-field-for-v3', 'std' => 'all_pages', 'options' => array( 'all_pages' => __( 'All Pages', 'advanced-nocaptcha-recaptcha' ), 'form_pages' => __( 'Form Pages', 'advanced-nocaptcha-recaptcha' ), ), 'desc' => __( 'Loading in All Pages help google for analytics', 'advanced-nocaptcha-recaptcha' ), ), 'score' => array( 'label' => __( 'Captcha Score', 'advanced-nocaptcha-recaptcha' ), 'section_id' => 'other', 'type' => 'select', 'class' => 'regular hidden anr-show-field-for-v3', 'std' => '0.5', 'options' => $score_values, 'desc' => __( 'Higher means more sensitive', 'advanced-nocaptcha-recaptcha' ), ), 'loggedin_hide' => array( 'label' => __( 'Logged in Hide', 'advanced-nocaptcha-recaptcha' ), 'section_id' => 'other', 'type' => 'checkbox', 'class' => 'checkbox', 'cb_label' => __( 'Hide Captcha for logged in users?', 'advanced-nocaptcha-recaptcha' ), ), 'remove_css' => array( 'label' => __( 'Remove CSS', 'advanced-nocaptcha-recaptcha' ), 'section_id' => 'other', 'type' => 'checkbox', 'class' => 'checkbox hidden anr-show-field-for-v2_checkbox', 'cb_label' => __( "Remove this plugin's css from login page?", 'advanced-nocaptcha-recaptcha' ), 'desc' => __( 'This css increase login page width to adjust with Captcha width.', 'advanced-nocaptcha-recaptcha' ), ), 'no_js' => array( 'label' => __( 'No JS Captcha', 'advanced-nocaptcha-recaptcha' ), 'section_id' => 'other', 'type' => 'checkbox', 'class' => 'checkbox hidden anr-show-field-for-v2_checkbox', 'cb_label' => __( 'Show captcha if javascript disabled?', 'advanced-nocaptcha-recaptcha' ), 'desc' => __( 'If JavaScript is a requirement for your site, we advise that you do NOT check this.', 'advanced-nocaptcha-recaptcha' ), ), ); if ( ! class_exists( 'ANR_Pro' ) ) : $fields['pro_notice'] = array( 'section_id' => 'forms', 'type' => 'html', 'std' => '

To support development of "Advanced noCaptcha & invisible Captcha" plugin please purchase PRO version. View Details

', ); endif; return apply_filters( 'anr_settings_fields', $fields ); } function callback( $field ) { $attrib = ''; if ( ! empty( $field['required'] ) ) { $attrib .= ' required = "required"'; } if ( ! empty( $field['readonly'] ) ) { $attrib .= ' readonly = "readonly"'; } if ( ! empty( $field['disabled'] ) ) { $attrib .= ' disabled = "disabled"'; } if ( ! empty( $field['minlength'] ) ) { $attrib .= ' minlength = "' . absint( $field['minlength'] ) . '"'; } if ( ! empty( $field['maxlength'] ) ) { $attrib .= ' maxlength = "' . absint( $field['maxlength'] ) . '"'; } $value = anr_get_option( $field['id'], $field['std'] ); switch ( $field['type'] ) { case 'text': case 'email': case 'url': case 'number': case 'hidden': case 'submit': printf( '', esc_attr( $field['type'] ), esc_attr( $field['id'] ), esc_attr( $field['class'] ), esc_attr( $field['id'] ), isset( $field['placeholder'] ) ? esc_attr( $field['placeholder'] ) : '', esc_attr( $value ), $attrib ); break; case 'textarea': printf( '', esc_attr( $field['id'] ), esc_attr( $field['class'] ), esc_attr( $field['id'] ), isset( $field['placeholder'] ) ? esc_attr( $field['placeholder'] ) : '', $attrib, esc_textarea( $value ) ); break; case 'checkbox': printf( '', esc_attr( $field['id'] ) ); printf( '', 'checkbox', esc_attr( $field['id'] ), esc_attr( $field['class'] ), esc_attr( $field['id'] ), '1', checked( $value, '1', false ), esc_attr( $field['cb_label'] ) ); break; case 'multicheck': printf( '', esc_attr( $field['id'] ) ); foreach ( $field['options'] as $key => $label ) { printf( '
', 'checkbox', esc_attr( $field['id'] ), esc_attr( $field['class'] ), esc_attr( $field['id'] ), esc_attr( $key ), checked( in_array( $key, (array) $value ), true, false ), esc_attr( $label ) ); } break; case 'select': printf( '' ); break; case 'html': echo $field['std']; break; default: printf( __( 'No hook defined for %s', 'advanced-nocaptcha-recaptcha' ), esc_html( $field['type'] ) ); break; } if ( ! empty( $field['desc'] ) ) { printf( '

%s

', $field['desc'] ); } } function options_sanitize( $value ) { if ( ! $value || ! is_array( $value ) ) { return $value; } $fields = $this->get_fields(); foreach ( $value as $option_slug => $option_value ) { if ( isset( $fields[ $option_slug ] ) && ! empty( $fields[ $option_slug ]['sanitize_callback'] ) ) { $value[ $option_slug ] = call_user_func( $fields[ $option_slug ]['sanitize_callback'], $option_value ); } } return $value; } function menu_page() { add_options_page( __( 'Advanced noCaptcha & invisible captcha Settings', 'advanced-nocaptcha-recaptcha' ), __( 'Advanced noCaptcha & invisible captcha', 'advanced-nocaptcha-recaptcha' ), 'manage_options', 'anr-admin-settings', array( $this, 'admin_settings' ) ); add_submenu_page( 'anr-non-exist-menu', 'Advanced noCaptcha reCaptcha - ' . __( 'Instruction', 'advanced-nocaptcha-recaptcha' ), __( 'Instruction', 'advanced-nocaptcha-recaptcha' ), 'manage_options', 'anr-instruction', array( $this, 'instruction_page' ) ); } function settings_save() { if ( current_user_can( 'manage_options' ) && isset( $_POST['anr_admin_options'] ) && isset( $_POST['action'] ) && 'update' === $_POST['action'] && isset( $_GET['page'] ) && 'anr-admin-settings' === $_GET['page'] ) { check_admin_referer( 'anr_admin_options-options' ); $value = wp_unslash( $_POST['anr_admin_options'] ); if ( ! is_array( $value ) ) { $value = []; } anr_update_option( $value ); wp_safe_redirect( admin_url( 'options-general.php?page=anr-admin-settings&updated=true' ) ); exit; } } function admin_settings() { wp_enqueue_script( 'anr-admin' ); ?>

anr_admin_sidebar(); ?>

' . __( 'Plugin Author', 'advanced-nocaptcha-recaptcha' ) . '

Shamim Hasan
Know php, MySql, css, javascript, html. Expert in WordPress.

You can hire for plugin customization, build custom plugin or any kind of WordPress job via
Contact Form
'; if ( ! class_exists( 'ANR_Pro' ) ) : $return .= '

' . __( 'Support Development', 'advanced-nocaptcha-recaptcha' ) . '

To support development of "Advanced noCaptcha & invisible Captcha" plugin please purchase
PRO
version only for USD 10

View Details

'; endif; return $return; } function instruction_page() { ?>

GOOGLE if you do not have already.', 'advanced-nocaptcha-recaptcha' ), esc_url( 'https://www.google.com/recaptcha/admin' ) ); ?>
' . esc_html__( 'Settings', 'advanced-nocaptcha-recaptcha' ) . '' ); ?>

[anr_nocaptcha g-recaptcha-response]' ); ?>

do_action( 'anr_captcha_form_field' )", '[anr-captcha]' ); ?>
anr_verify_captcha()' ); ?>
Advanced noCaptcha reCaptcha', 'advanced-nocaptcha-recaptcha' ), esc_url( 'https://www.shamimsplugins.com/contact-us/' ) ); ?>
anr_admin_sidebar(); ?>

' . __( 'Settings', 'advanced-nocaptcha-recaptcha' ) . ''; array_unshift( $links, $settings_link ); return $links; } } //END CLASS add_action( 'wp_loaded', array( ANR_Settings::init(), 'actions_filters' ) );