Changeset 2341330
- Timestamp:
- 07/16/2020 03:12:35 AM (6 years ago)
- Location:
- vaptcha/trunk
- Files:
-
- 3 edited
-
VaptchaPlugin.php (modified) (6 diffs)
-
options.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vaptcha/trunk/VaptchaPlugin.php
r2336552 r2341330 40 40 $color = get_option('vaptcha_options')['bg_color']; 41 41 $style = get_option('vaptcha_options')['button_style']; 42 $https = get_option('vaptcha_options')['https'];43 $type = get_option('vaptcha_options')['type'];44 42 $height = $height ? $height : '36px'; 45 43 $options = json_encode(Array( 46 44 "vid" => $vid, 47 "type" => $type,45 'type' => 'click', 48 46 "lang" => $lang, 49 47 "style" => $style, 50 "https" => $https,48 "https" => true, 51 49 "color" => $color, 52 50 "offline_server" => site_url() . '/wp-json/vaptcha/offline', … … 185 183 $validated['vaptcha_register'] = ($input['vaptcha_register'] == "1" ? "1" : "0"); 186 184 $validated['vaptcha_login'] = ($input['vaptcha_login'] == "1" ? "1" : "0"); 187 $validated['vaptcha_lang'] = ($input['vaptcha_lang'] == "zh-CN" ? "zh-CN" : "en");185 $validated['vaptcha_lang'] = sanitize_text_field($input['vaptcha_lang']); 188 186 $validated['bg_color'] = sanitize_text_field($input['bg_color']); 189 187 $validated['vaptcha_width'] = sanitize_text_field($input['vaptcha_width']); 190 188 $validated['vaptcha_height'] = sanitize_text_field($input['vaptcha_height']); 191 $validated['https'] = ($input['vaptcha_ai'] == "true" ? "true" : "false");192 189 $validated['button_style'] = ($input['button_style'] == "light" ? "light" : "dark"); 193 $validated['type'] = in_array($input['type'], array('popup', 'embed')) ? $input['type'] : 'float';194 195 190 return $validated; 196 191 } … … 213 208 'vaptcha_register' => '1', 214 209 'vaptcha_login' => '1', 215 'vaptcha_lang' => ' en',210 'vaptcha_lang' => 'auto', 216 211 'bg_color' => '#57ABFF', 217 212 'vaptcha_width' => '', 218 213 'vaptcha_height' => '', 219 'https' => 'false',214 'https' => true, 220 215 'button_style' => 'dark', 221 'type' => ' float',216 'type' => 'click', 222 217 "offline_server" => site_url() . '/wp-json/vaptcha/offline', 223 218 // 'mode' => 'offline', … … 264 259 } 265 260 return $data; 261 } 262 263 function back_end_styles() { 264 // load styles 265 wp_register_style( 'vaptcha-setting-style', plugin_dir_url( __FILE__ ) . '/css/back-end-styles.css', false, '1.0' ); 266 wp_enqueue_style( 'vaptcha-setting-style' ); 267 266 268 } 267 269 … … 273 275 add_action('admin_init', array($this, 'vaptcha_settings_init')); 274 276 add_action('admin_menu', array($this, 'vaptcha_options_page')); 277 // load styles 278 add_action( 'admin_enqueue_scripts', array( $this, 'back_end_styles' ) ); 275 279 add_action('woocommerce_login_form', array($this, 'captcha_in_woocommerce')); 276 280 add_action('woocommerce_register_form', array($this, 'captcha_in_woocommerce')); … … 293 297 add_filter('registration_errors', array($this, 'captcha_validate_register'),100,1); 294 298 295 // add_filter('woocommerce_process_login_errors', array($this, 'captcha_validate_woocommerce'),100,1);296 299 add_filter('woocommerce_process_registration_errors', array($this, 'captcha_validate_woocommerce'),100,1); 297 // add_filter('lostpassword_post', array($this, 'captcha_validate_woocommerce'),100,1);298 300 } 299 301 -
vaptcha/trunk/options.php
r2306831 r2341330 3 3 exit('No direct script access allowed'); 4 4 } 5 5 6 function vaptcha_options_page_html() 6 7 { … … 9 10 return; 10 11 } 11 $options = get_option("vaptcha_options");12 12 ?> 13 <!-- Create a header in the default WordPress 'wrap' container --> 14 <div class='wrap vaptcha-wrap'> 15 16 <h2><?php _e('VAPTCHA智能人机验证', 'vaptcha') ?></h2> 17 <p class="vaptcha-about-text"><?php _e( 'VAPTCHA手势验证码是基于人工智能和大数据的次世代人机验证解决方案,安全强度极高,是目前唯一未被自动化程序破解的验证码。', 'vaptcha' ); ?> 18 <p class="vaptcha-about-text"><?php _e( '快速接入,完全免费,请放心使用。', 'vaptcha' ); ?> 19 <div class='vaptcha-badge'></div> 20 <?php 21 $options = get_option("vaptcha_options"); 22 ?> 13 23 <form name="form" action="options.php" method="post"> 14 <?php 15 settings_fields('vaptcha_options_group'); 16 ?> 17 <h2 class="title"><?php echo __('VAPTCHA 设置', 'vaptcha') ?></h2> 18 <table class="form-table"> 19 <tbody><tr> 20 <th><label for="vid">vid</label></th> 21 <td> <input name="vaptcha_options[vaptcha_vid]" type="text" value="<?php echo $options['vaptcha_vid'] ?>" class="regular-text code"></td> 22 <td> <?php _e('请登录官网(www.vaptcha.com)免费获取VID及KEY', 'vaptcha') ?> </td> 23 </tr> 24 <tr> 25 <th><label for="key">key</label></th> 26 <td> <input name="vaptcha_options[vaptcha_key]" type="text" value="<?php echo $options['vaptcha_key'] ?>" class="regular-text code"></td> 27 </tr> 28 <tr> 29 <th scope="row"><label for="type"><?php _e('显示类型', 'vaptcha') ?></label></th> 30 <td> 31 <select name="vaptcha_options[type]" id="type"> 32 <option <?php if ($options['type'] == 'flaot'){ ?> selected="selected" <?php }?> value="float"><?php _e('浮动式', 'vaptcha') ?></option> 33 <option <?php if ($options['type'] == 'popup'){ ?> selected="selected" <?php }?> value="popup"><?php _e('弹出式', 'vaptcha') ?></option> 34 <option <?php if ($options['type'] == 'embed'){ ?> selected="selected" <?php }?> value="embed"><?php _e('嵌入式', 'vaptcha') ?></option> 35 </select> 36 </td> 37 </tr> 38 <tr> 39 <th scope="row"><label for="button_style"><?php _e('按钮风格', 'vaptcha') ?></label></th> 40 <td> 41 <select name="vaptcha_options[button_style]" id="button_style"> 42 <option <?php if ($options['button_style'] == 'dark'){ ?> selected="selected" <?php }?> value="dark"><?php _e('深色', 'vaptcha') ?></option> 43 <option <?php if ($options['button_style'] == 'light'){ ?> selected="selected" <?php }?> value="light"><?php _e('浅色', 'vaptcha') ?></option> 44 </select> 45 </td> 46 </tr> 47 <tr> 48 <th><label for="tag_base"><?php _e('按钮颜色', 'vaptcha') ?></label></th> 49 <td> <input name="vaptcha_options[bg_color]" type="text" value="<?php echo $options['bg_color'] ?>" class="regular-text code"></td> 50 <td> <?php _e('', 'vaptcha') ?> </td> 51 </th> 52 </tr> 53 <tr> 54 <th><label for="tag_base"><?php _e('按钮高度', 'vaptcha') ?></label></th> 55 <td> <input name="vaptcha_options[vaptcha_height]" type="text" value="<?php echo $options['vaptcha_height'] ?>" class="regular-text code"></td> 56 <td> <?php _e('不得低于36px', 'vaptcha') ?> </td> 57 </th> 58 </tr> 59 <tr> 60 <th><label for="tag_base"><?php _e('按钮宽度', 'vaptcha') ?></label></th> 61 <td> <input name="vaptcha_options[vaptcha_width]" type="text" value="<?php echo $options['vaptcha_width'] ?>" class="regular-text code"></td> 62 <td> <?php _e('不得低于200px', 'vaptcha') ?> </td> 63 </th> 64 </tr> 65 <!-- <tr> 66 <th><label for="tag_base"><?php _e('智能检测', 'vaptcha') ?></label></th> 67 <td> 68 <label for="ai_open"><?php echo __('开启', 'vaptcha') ?></label> 69 <input name="vaptcha_options[vaptcha_ai]" id="ai_open" type="radio" value="true" <?php if ($options['vaptcha_ai'] == 'true') { ?> checked <?php } ?> class="regular-text code"> 70 <label for="ai_close"><?php echo __('关闭', 'vaptcha') ?></label> 71 <input name="vaptcha_options[vaptcha_ai]" id="ai_close" type="radio" value="false" <?php if ($options['vaptcha_ai'] == 'false') { ?> checked <?php } ?> class="regular-text code"> 72 </td> 73 <td> <?php _e('如果开启,高风险操作或者客户端在验证时需要进行手势验证,无风险客户端则可以一键通过验证,大幅提升用户体验', 'vaptcha') ?> </td> 74 </tr> --> 75 <tr> 76 <th><label for="tag_base"><?php _e('HTTPS', 'vaptcha') ?></label></th> 77 <td> 78 <label for="https_open"><?php echo __('开启', 'vaptcha') ?></label> 79 <input name="vaptcha_options[https]" id="ai_open" type="radio" value="true" <?php if ($options['https'] == 'true') { ?> checked <?php } ?> class="regular-text code"> 80 <label for="https_close"><?php echo __('关闭', 'vaptcha') ?></label> 81 <input name="vaptcha_options[https]" id="ai_close" type="radio" value="false" <?php if ($options['https'] == 'false') { ?> checked <?php } ?> class="regular-text code"> 82 </td> 83 <td> <?php _e('如果开启,高风险操作或者客户端在验证时需要进行手势验证,无风险客户端则可以一键通过验证,大幅提升用户体验', 'vaptcha') ?> </td> 84 </tr> 85 <tr> 86 <th><b style="font-size: 16px;"><?php _e('设置启用模块', 'vaptcha') ?></b></th> 87 </tr> 88 <tr> 89 <th><label for="tag_base"><?php _e('评论', 'vaptcha') ?></label></th> 90 <td> 91 <label for="comment_open"><?php echo __('开启', 'vaptcha') ?></label> 92 <input name="vaptcha_options[vaptcha_comment]" id="comment_open" type="radio" value="1" <?php if ($options['vaptcha_comment'] == '1') { ?> checked <?php } ?> class="regular-text code"> 93 <label for="comment_close"><?php echo __('关闭', 'vaptcha') ?></label> 94 <input name="vaptcha_options[vaptcha_comment]" id="comment_close" type="radio" value="0" <?php if ($options['vaptcha_comment'] == '0') { ?> checked <?php } ?> class="regular-text code"> 95 </td> 96 </tr> 97 <tr> 98 <th><label for="tag_base"><?php _e('注册', 'vaptcha') ?></label></th> 99 <td> 100 <label for="register_open"><?php echo __('开启', 'vaptcha') ?></label> 101 <input name="vaptcha_options[vaptcha_register]" id="register_open" type="radio" value="1" <?php if ($options['vaptcha_register'] == '1') { ?> checked <?php } ?> class="regular-text code"> 102 <label for="register_close"><?php echo __('关闭', 'vaptcha') ?></label> 103 <input name="vaptcha_options[vaptcha_register]" id="register_close" type="radio" value="0" <?php if ($options['vaptcha_register'] == '0') { ?> checked <?php } ?> class="regular-text code"> 104 </td> 105 </tr> 106 <tr> 107 <th><label for="tag_base"><?php _e('登录', 'vaptcha') ?></label></th> 108 <td> 109 <label for="login_open"><?php echo __('开启', 'vaptcha') ?></label> 110 <input name="vaptcha_options[vaptcha_login]" id="login_open" type="radio" value="1" <?php if ($options['vaptcha_login'] == '1') { ?> checked <?php } ?> class="regular-text code"> 111 <label for="login_close"><?php echo __('关闭', 'vaptcha') ?></label> 112 <input name="vaptcha_options[vaptcha_login]" id="login_close" type="radio" value="0" <?php if ($options['vaptcha_login'] == '0') { ?> checked <?php } ?> class="regular-text code"> 113 </td> 114 </tr> 115 <tr> 116 <th><b style="font-size: 16px;"><?php _e('语言选择', 'vaptcha') ?></b></th> 117 </tr> 118 <tr> 119 <th> 120 <label for="lang_zh">中文</label> 121 <input name="vaptcha_options[vaptcha_lang]" id="lang_zh" type="radio" value="zh-CN" <?php if ($options['vaptcha_lang'] == 'zh-CN') { ?> checked <?php } ?> class="regular-text code"> 122 <label for="lang_en">English</label> 123 <input name="vaptcha_options[vaptcha_lang]" id="lang_en" type="radio" value="en" <?php if ($options['vaptcha_lang'] == 'en') { ?> checked <?php } ?> class="regular-text code"> 124 </th> 125 </tr> 126 </tbody></table> 24 <?php 25 settings_fields('vaptcha_options_group'); 26 if ( empty( $options['vaptcha_vid'] ) || empty( $options['vaptcha_key'] ) ) { ?> 27 <p class="get-vaptcha-key"><?php echo __( '请登录VAPTCHA官网免费获取VID及Key,填写保存后即可生效。官网地址:: ', 'uncr_translate' ) . '<a href="https://www.vaptcha.com" target="_blank" title="vaptcha">' . __( 'https://www.vaptcha.com', 'uncr_translate' ) . '</a>'; ?></p> 28 <?php } ?> 29 <table class="form-table"> 30 <tbody> 31 <tr> 32 <th class="form-title"><?php _e( '人机验证设置', 'vaptcha' ); ?></th> 33 <td> 34 <?php _e( '(登录VAPTCHA - 创建验证单元 - 免费获取)', 'vaptcha' ); ?> 35 </td> 36 </tr> 37 <tr> 38 <th><label for="public_key_text">VID</label></th> 39 <td> 40 <fieldset> 41 <input placeholder="" type="text" id="public_key_text" name="vaptcha_options[vaptcha_vid]" value="<?php echo $options['vaptcha_vid'] ?>"> 42 </fieldset> 43 </td> 44 </tr> 45 <tr> 46 <th><label for="public_key_text">KEY</label></th> 47 <td> 48 <fieldset> 49 <input placeholder="" type="text" id="public_key_text" name="vaptcha_options[vaptcha_key]" value="<?php echo $options['vaptcha_key'] ?>"> 50 </fieldset> 51 </td> 52 </tr> 53 <tr> 54 <th scope="row"><label for="button_style"><?php _e('按钮风格', 'vaptcha') ?></label></th> 55 <td> 56 <fieldset class="vaptcha-radio-field-wrapper"> 57 <input id="invisible" type="radio" <?php if( 'dark' == $options['button_style'] ) echo 'checked="checked"'; ?> name="vaptcha_options[button_style]" value="dark"> 58 <label for="invisible"><?php _e('深色', 'vaptcha') ?></label> 59 <input id="normal" type="radio" <?php if( 'light' == $options['button_style'] ) echo 'checked="checked"'; ?> name="vaptcha_options[button_style]" value="light"> 60 <label for="normal"><?php _e('浅色', 'vaptcha') ?></label> 61 </fieldset> 62 </td> 63 </tr> 64 <tr> 65 <th><label for="public_key_text"><?php _e('按钮颜色', 'vaptcha') ?></label></th> 66 <td> 67 <fieldset> 68 <input type="text" id="public_key_text" name="vaptcha_options[bg_color]" value="<?php echo $options['bg_color'] ?>"> 69 </fieldset> 70 </td> 71 </tr> 72 <tr> 73 <th><label for="public_key_text"><?php _e('按钮高度(PX)', 'vaptcha') ?></label></th> 74 <td> 75 <fieldset> 76 <input type="text" id="public_key_text" name="vaptcha_options[vaptcha_height]" value="<?php echo $options['vaptcha_height'] ?>"> 77 </fieldset> 78 </td> 79 <td> <?php _e('不得低于36px', 'vaptcha') ?> </td> 80 </tr> 81 <tr> 82 <th><label for="public_key_text"><?php _e('按钮宽度(PX)', 'vaptcha') ?></label></th> 83 <td> 84 <fieldset> 85 <input type="text" id="public_key_text" name="vaptcha_options[vaptcha_width]" value="<?php echo $options['vaptcha_width'] ?>"> 86 </fieldset> 87 </td> 88 <td> <?php _e('不得低于200px', 'vaptcha') ?> </td> 89 </tr> 90 <tr> 91 <th class="form-title"><b style="font-size: 16px;"><?php _e('其他设置', 'vaptcha') ?></b></th> 92 </tr> 93 <tr> 94 <th><label for="public_key_text"><?php _e('启用模块', 'vaptcha') ?></label></th> 95 <td> 96 <fieldset> 97 <div class="vaptcha-checkbox-wrapper"> 98 <input id="vaptcha_login_form" type="checkbox" name="vaptcha_options[vaptcha_login]" value="1" 99 <?php if( 1 == $options['vaptcha_login'] ) echo 'checked="checked"'; ?>> 100 <label for="vaptcha_login_form"><?php _e('登录', 'vaptcha') ?></label> 101 </div> 102 <div class="vaptcha-checkbox-wrapper"> 103 <input id="register_open" type="checkbox" name="vaptcha_options[vaptcha_register]" value="1" 104 <?php checked( $options['vaptcha_register'], 1); ?>> 105 <label for="register_open"><?php _e('注册', 'vaptcha') ?></label> 106 </div> 107 <div class="vaptcha-checkbox-wrapper"> 108 <input id="comment_open" type="checkbox" name="vaptcha_options[vaptcha_comment]" value="1" 109 <?php if( 1 == $options['vaptcha_comment'] ) echo 'checked="checked"'; ?>> 110 <label for="comment_open"><?php _e('评论', 'vaptcha') ?></label> 111 </div> 112 </fieldset> 113 </td> 114 </tr> 115 <tr> 116 <th><label for="public_key_text"><?php _e('语言设定', 'vaptcha') ?></label></th> 117 <td> 118 <fieldset> 119 <select name="vaptcha_options[vaptcha_lang]"> 120 <option value="auto" <?php selected( $options['vaptcha_lang'], 'auto' ); ?>>Auto Detect</option> 121 <option value="en" <?php selected( $options['vaptcha_lang'], 'en' ); ?>>English</option> 122 <option value="zh-CN" <?php selected( $options['vaptcha_lang'], 'zh-CN' ); ?>>中文简体</option> 123 <option value="zh-TW" <?php selected( $options['vaptcha_lang'], 'zh-TW' ); ?>>中文繁體</option> 124 <option value="jp" <?php selected( $options['vaptcha_lang'], 'jp' ); ?>>にほんご</option> 125 </select> 126 </fieldset> 127 </td> 128 </tr> 129 </tbody> 130 </table> 131 <p class="deadline"></p> 127 132 <?php submit_button(__('保存设置', 'vaptcha')); ?> 128 </form> 133 </form> 134 </div> 129 135 <?php 130 136 } -
vaptcha/trunk/readme.txt
r2340726 r2341330 1 1 === VAPTCHA智能人机验证 === 2 <div style="font-size: 16px">3 2 Contributors: vaptcha 4 3 Donate link: https://www.vaptcha.com … … 90 89 91 90 * Update VAPTCHA v3.0 92 </div>
Note: See TracChangeset
for help on using the changeset viewer.