array( 'label' => __( 'Settings', 'google-captcha' ) ), 'misc' => array( 'label' => __( 'Misc', 'google-captcha' ) ), 'custom_code' => array( 'label' => __( 'Custom Code', 'google-captcha' ) ), 'license' => array( 'label' => __( 'License Key', 'google-captcha' ) ) ); parent::__construct( array( 'plugin_basename' => $plugin_basename, 'plugins_info' => $gglcptch_plugin_info, 'prefix' => 'gglcptch', 'default_options' => gglcptch_get_default_options(), 'options' => $gglcptch_options, 'is_network_options' => is_network_admin(), 'tabs' => $tabs, 'wp_slug' => 'google-captcha', 'pro_page' => 'admin.php?page=google-captcha-pro.php', 'bws_license_plugin' => 'google-captcha-pro/google-captcha-pro.php', 'link_key' => 'b850d949ccc1239cab0da315c3c822ab', 'link_pn' => '109' ) ); $this->all_plugins = get_plugins(); /* Private and public keys */ $this->keys = array( 'public' => array( 'display_name' => __( 'Site Key', 'google-captcha' ), 'form_name' => 'gglcptch_public_key', 'error_msg' => '', ), 'private' => array( 'display_name' => __( 'Secret Key', 'google-captcha' ), 'form_name' => 'gglcptch_private_key', 'error_msg' => '', ), ); $this->versions = array( 'v1' => sprintf( '%s 1', __( 'Version', 'google-captcha' ) ), 'v2' => sprintf( '%s 2', __( 'Version', 'google-captcha' ) ), 'invisible' => __( 'Invisible', 'google-captcha' ) ); /* Supported forms */ $this->forms = gglcptch_get_forms(); $this->sections = gglcptch_get_sections(); /* Google captcha themes */ $this->themes = array( array( 'red', 'Red' ), array( 'white', 'White' ), array( 'blackglass', 'Blackglass' ), array( 'clean', 'Clean' ), ); add_action( get_parent_class( $this ) . '_display_custom_messages', array( $this, 'display_custom_messages' ) ); add_action( get_parent_class( $this ) . '_display_metabox', array( $this, 'display_metabox' ) ); } /** * Save plugin options to the database * @access public * @param void * @return array The action results */ public function save_options() { /* Save data for settings page */ if ( empty( $_POST['gglcptch_public_key'] ) ) { $this->keys['public']['error_msg'] = __( 'Enter site key', 'google-captcha' ); $error = __( "WARNING: The captcha will not be displayed until you fill key fields.", 'google-captcha' ); } else { $this->keys['public']['error_msg'] = ''; } if ( empty( $_POST['gglcptch_private_key'] ) ) { $this->keys['private']['error_msg'] = __( 'Enter secret key', 'google-captcha' ); $error = __( "WARNING: The captcha will not be displayed until you fill key fields.", 'google-captcha' ); } else { $this->keys['private']['error_msg'] = ''; } if ( $_POST['gglcptch_public_key'] != $this->options['public_key'] || $_POST['gglcptch_private_key'] != $this->options['private_key'] ) { $this->options['keys_verified'] = false; } if ( $_POST['gglcptch_recaptcha_version'] != $this->options['recaptcha_version'] ) { $this->options['keys_verified'] = false; $this->options['need_keys_verified_check'] = true; } $this->options['whitelist_message'] = stripslashes( esc_html( $_POST['gglcptch_whitelist_message'] ) ); $this->options['public_key'] = trim( stripslashes( esc_html( $_POST['gglcptch_public_key'] ) ) ); $this->options['private_key'] = trim( stripslashes( esc_html( $_POST['gglcptch_private_key'] ) ) ); $this->options['recaptcha_version'] = in_array( $_POST['gglcptch_recaptcha_version'], array( 'v1', 'v2', 'invisible' ) ) ? $_POST['gglcptch_recaptcha_version']: 'v2'; $this->options['theme'] = stripslashes( esc_html( $_POST['gglcptch_theme'] ) ); $this->options['theme_v2'] = stripslashes( esc_html( $_POST['gglcptch_theme_v2'] ) ); $this->options['disable_submit'] = isset( $_POST['gglcptch_disable_submit'] ) ? 1 : 0; foreach ( $this->forms as $form_slug => $form_data ) { $this->options[ $form_slug ] = isset( $_POST["gglcptch_{$form_slug}"] ) ? 1 : 0; } if ( function_exists( 'get_editable_roles' ) ) { foreach ( get_editable_roles() as $role => $fields ) { $this->options[ $role ] = isset( $_POST[ 'gglcptch_' . $role ] ) ? 1 : 0; } } update_option( 'gglcptch_options', $this->options ); $message = __( "Settings saved.", 'google-captcha' ); return compact( 'message', 'notice', 'error' ); } /** * Displays 'settings' menu-tab * @access public * @param void * @return void */ public function tab_settings() { global $wp_version; $is_main_site = is_main_site( get_current_blog_id() ); ?>

help_phrase(); ?>
keys as $key => $fields ) { ?> options['public_key'] ) && ! empty( $this->options['private_key'] ) ) { ?>
sections as $section_slug => $section ) { if ( empty( $section['name'] ) || empty( $section['forms'] ) || ! is_array( $section['forms'] ) ) { continue; } $section_notice = ! empty( $section['section_notice'] ) ? $section['section_notice'] : ''; ?>

 

forms[ $form_slug ]['form_notice']; $form_atts = ''; if ( '' != $form_notice || '' != $section_notice ) { $form_atts .= disabled( 1, 1, false ); } $form_atts .= checked( ! empty( $this->options[ $form_slug ] ), true, false ); ?>  

hide_pro_tabs ) { ?>
bws_pro_block_links(); ?>
$fields ) { printf( '
', 'gglcptch_' . $role, $role, checked( ! empty( $this->options[ $role ] ), true, false ), translate_user_role( $fields['name'] ) ); } } ?>
versions as $version => $version_name ) { ?>
hide_pro_tabs ) { ?>
bws_pro_block_links(); ?>
change_permission_attr; ?> id="gglcptch_disable_submit" type="checkbox" options["disable_submit"] ) ); ?> name="gglcptch_disable_submit" value="1" /> 
options['recaptcha_version'] == 'v1' ) { ?>

options['need_keys_verified_check'] ) ) { ?>