verifier = $verifier; add_action( 'admin_menu', array( $this, 'menu' ) ); add_action( 'admin_init', array( $this, 'register' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) ); } public function menu() { add_options_page( __( '2IZI SmartCaptcha', '2izi-smartcaptcha' ), __( '2IZI SmartCaptcha', '2izi-smartcaptcha' ), 'manage_options', '2izi-smartcaptcha', array( $this, 'page' ) ); } public function register() { register_setting( 'izismfoy', 'izismfoy_options', array( $this, 'sanitize' ) ); } public function sanitize( $input ) { $old = get_option( 'izismfoy_options', array() ); $out = array(); $out['client_key'] = isset( $input['client_key'] ) ? sanitize_text_field( $input['client_key'] ) : ''; $new_server = isset( $input['server_key'] ) ? trim( (string) $input['server_key'] ) : ''; $out['server_key'] = '' !== $new_server ? sanitize_text_field( $new_server ) : ( isset( $old['server_key'] ) ? $old['server_key'] : '' ); $allowed_lang = array( '', 'ru', 'en', 'be', 'kk', 'tt', 'uk', 'uz', 'tr' ); $out['language'] = ( isset( $input['language'] ) && in_array( $input['language'], $allowed_lang, true ) ) ? $input['language'] : ''; foreach ( array( 'core_login','core_register','core_lostpassword','core_comments','woo_login','woo_register','woo_lostpassword','woo_checkout','woo_review','cf7','fail_closed' ) as $key ) { $out[ $key ] = empty( $input[ $key ] ) ? 0 : 1; } add_settings_error( 'izismfoy_messages', 'izismfoy_saved', __( 'Settings saved.', '2izi-smartcaptcha' ), 'updated' ); return $out; } public function assets( $hook ) { if ( 'settings_page_2izi-smartcaptcha' !== $hook ) { return; } wp_enqueue_style( 'izismfoy-admin', IZISMFOY_URL . 'assets/admin.css', array(), IZISMFOY_VERSION ); wp_enqueue_script( 'izismfoy-admin', IZISMFOY_URL . 'assets/admin.js', array(), IZISMFOY_VERSION, true ); $o = $this->verifier->get_options(); wp_localize_script( 'izismfoy-admin', 'izismfoyAdmin', array( 'configured' => $this->verifier->is_configured(), 'siteKey' => isset( $o['client_key'] ) ? $o['client_key'] : '', 'language' => IZISMFOY_Language::resolve( isset( $o['language'] ) ? $o['language'] : '' ), ) ); if ( $this->verifier->is_configured() ) { wp_enqueue_script( 'izismfoy-admin-yandex', 'https://smartcaptcha.cloud.yandex.ru/captcha.js?render=onload&onload=izismfoyAdminCaptchaOnload', array( 'izismfoy-admin' ), IZISMFOY_VERSION, true ); } } private function checkbox_row( $name, $label, $o, $desc = '' ) { ?>
' . esc_html( $title ) . ''; if ( $description ) { echo '' . esc_html( $description ) . '
'; } } public function page() { if ( ! current_user_can( 'manage_options' ) ) { return; } $o = $this->verifier->get_options(); ?>v
verifier->is_configured() ) : ?>Developed by 2IZI
2IZI develops secure web solutions, WordPress plugins and integrations.