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() ) : ?>

section_heading( __( 'Connection', '2izi-smartcaptcha' ), __( 'Create SmartCaptcha in Yandex Cloud, then copy its Client key and Server key here.', '2izi-smartcaptcha' ) ); ?> verifier->is_configured() ) : ?> section_heading( __( 'WordPress protection', '2izi-smartcaptcha' ), __( 'Choose which standard WordPress forms require CAPTCHA verification.', '2izi-smartcaptcha' ) ); ?> section_heading( __( 'WooCommerce protection', '2izi-smartcaptcha' ), __( 'These options are used only when WooCommerce is active.', '2izi-smartcaptcha' ) ); ?> section_heading( __( 'Integrations', '2izi-smartcaptcha' ) ); ?> section_heading( __( 'Security', '2izi-smartcaptcha' ) ); ?>
'https://2izi.ru/projects/smartcaptcha', 'en' => 'https://2izi.ru/en/projects/smartcaptcha', 'ja' => 'https://2izi.ru/ja/projects/smartcaptcha', 'zh' => 'https://2izi.ru/cn/projects/smartcaptcha', 'it' => 'https://2izi.ru/it/projects/smartcaptcha', ); $current_locale = function_exists( 'determine_locale' ) ? determine_locale() : get_locale(); $locale_prefix = strtolower( substr( (string) $current_locale, 0, 2 ) ); $project_url = isset( $project_urls[ $locale_prefix ] ) ? $project_urls[ $locale_prefix ] : $project_urls['en']; ?>

Developed by 2IZI

2IZI develops secure web solutions, WordPress plugins and integrations.

2IZI SmartCaptcha project · 2izi.ru