PluginProbe
Loginizer / 2.0.2
Loginizer v2.0.2
2.1.0 2.0.9 2.0.8 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 trunk 1.0 1.0.1 1.0.2 1.1.0 1.1.1 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 All 74 releases
loginizer / main / settings / recaptcha.php

recaptcha.php in Loginizer 2.0.2, at main/settings/recaptcha.php

710 lines 31.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if(!defined('ABSPATH')){
4 die('Hacking Attempt!');
5 }
6
7 //---------------------
8 // Admin Menu Pro Pages
9 //---------------------
10
11 // Loginizer - reCaptcha Page
12 function loginizer_page_recaptcha(){
13
14 global $loginizer, $lz_error, $lz_env;
15
16 if(!current_user_can('manage_options')){
17 wp_die('Sorry, but you do not have permissions to change settings.');
18 }
19
20 if(!loginizer_is_premium() && count($_POST) > 0){
21 $lz_error['not_in_free'] = __('This feature is not available in the Free version. <a href="'.LOGINIZER_PRICING_URL.'" target="_blank" style="text-decoration:none; color:green;"><b>Upgrade to Pro</b></a>', 'loginizer');
22 return loginizer_page_recaptcha_T();
23 }
24
25 /* Make sure post was from this page */
26 if(count($_POST) > 0){
27 check_admin_referer('loginizer-options');
28 }
29
30 // Themes
31 $lz_env['theme']['light'] = 'Light';
32 $lz_env['theme']['dark'] = 'Dark';
33
34 // Langs
35 $lz_env['lang'][''] = 'Auto Detect';
36 $lz_env['lang']['ar'] = 'Arabic';
37 $lz_env['lang']['bg'] = 'Bulgarian';
38 $lz_env['lang']['ca'] = 'Catalan';
39 $lz_env['lang']['zh-CN'] = 'Chinese (Simplified)';
40 $lz_env['lang']['zh-TW'] = 'Chinese (Traditional)';
41 $lz_env['lang']['hr'] = 'Croatian';
42 $lz_env['lang']['cs'] = 'Czech';
43 $lz_env['lang']['da'] = 'Danish';
44 $lz_env['lang']['nl'] = 'Dutch';
45 $lz_env['lang']['en-GB'] = 'English (UK)';
46 $lz_env['lang']['en'] = 'English (US)';
47 $lz_env['lang']['fil'] = 'Filipino';
48 $lz_env['lang']['fi'] = 'Finnish';
49 $lz_env['lang']['fr'] = 'French';
50 $lz_env['lang']['fr-CA'] = 'French (Canadian)';
51 $lz_env['lang']['de'] = 'German';
52 $lz_env['lang']['de-AT'] = 'German (Austria)';
53 $lz_env['lang']['de-CH'] = 'German (Switzerland)';
54 $lz_env['lang']['el'] = 'Greek';
55 $lz_env['lang']['iw'] = 'Hebrew';
56 $lz_env['lang']['hi'] = 'Hindi';
57 $lz_env['lang']['hu'] = 'Hungarain';
58 $lz_env['lang']['id'] = 'Indonesian';
59 $lz_env['lang']['it'] = 'Italian';
60 $lz_env['lang']['ja'] = 'Japanese';
61 $lz_env['lang']['ko'] = 'Korean';
62 $lz_env['lang']['lv'] = 'Latvian';
63 $lz_env['lang']['lt'] = 'Lithuanian';
64 $lz_env['lang']['no'] = 'Norwegian';
65 $lz_env['lang']['fa'] = 'Persian';
66 $lz_env['lang']['pl'] = 'Polish';
67 $lz_env['lang']['pt'] = 'Portuguese';
68 $lz_env['lang']['pt-BR'] = 'Portuguese (Brazil)';
69 $lz_env['lang']['pt-PT'] = 'Portuguese (Portugal)';
70 $lz_env['lang']['ro'] = 'Romanian';
71 $lz_env['lang']['ru'] = 'Russian';
72 $lz_env['lang']['sr'] = 'Serbian';
73 $lz_env['lang']['sk'] = 'Slovak';
74 $lz_env['lang']['sl'] = 'Slovenian';
75 $lz_env['lang']['es'] = 'Spanish';
76 $lz_env['lang']['es-419'] = 'Spanish (Latin America)';
77 $lz_env['lang']['sv'] = 'Swedish';
78 $lz_env['lang']['th'] = 'Thai';
79 $lz_env['lang']['tr'] = 'Turkish';
80 $lz_env['lang']['uk'] = 'Ukrainian';
81 $lz_env['lang']['vi'] = 'Vietnamese';
82
83 // Sizes
84 $lz_env['size']['normal'] = 'Normal';
85 $lz_env['size']['compact'] = 'Compact';
86
87 // reCAPTCHA Domains
88 $lz_env['captcha_domains']['www.google.com'] = 'google.com';
89 $lz_env['captcha_domains']['www.recaptcha.net'] = 'recaptcha.net';
90
91 if(isset($_POST['save_lz'])){
92
93 // Clear captcha
94 if(empty($_POST['captcha_status'])){
95
96 // Save the options
97 update_option('loginizer_captcha', '');
98
99 // Mark as saved
100 $GLOBALS['lz_cleared'] = true;
101
102 }else{
103
104 $option['captcha_status'] = (int) lz_optpost('captcha_status');
105
106 //hcaptcha
107 $option['hcaptcha_secretkey'] = lz_optpost('hcaptcha_secretkey');
108 $option['hcaptcha_sitekey'] = lz_optpost('hcaptcha_sitekey');
109 $option['hcaptcha_lang'] = lz_optpost('hcaptcha_lang');
110 $option['hcaptcha_theme'] = lz_optpost('hcaptcha_theme');
111 $option['hcaptcha_size'] = lz_optpost('hcaptcha_size');
112
113 // Google Captcha
114 $option['captcha_type'] = lz_optpost('captcha_type');
115 $option['captcha_key'] = lz_optpost('captcha_key');
116 $option['captcha_secret'] = lz_optpost('captcha_secret');
117 $option['captcha_theme'] = lz_optpost('captcha_theme');
118 $option['captcha_size'] = lz_optpost('captcha_size');
119 $option['captcha_lang'] = lz_optpost('captcha_lang');
120 $option['captcha_domain'] = lz_optpost('captcha_domain');
121 $option['captcha_score_threshold'] = lz_optpost('captcha_score_threshold');
122 if(!is_numeric($option['captcha_score_threshold']) || $option['captcha_score_threshold'] > '1.0' || $option['captcha_score_threshold'] < '0.0'){
123 $option['captcha_score_threshold'] = '0.5';
124 }
125
126 $option['captcha_disable_btn'] = lz_optpost('captcha_disable_btn'); // Only for v2 reCaptcha Checkbox
127
128 // Cloudflare Turnstil Captcha
129 $option['turn_captcha_key'] = lz_optpost('turn_captcha_key');
130 $option['turn_captcha_secret'] = lz_optpost('turn_captcha_secret');
131 $option['turn_captcha_theme'] = lz_optpost('turn_captcha_theme');
132 $option['turn_captcha_size'] = lz_optpost('turn_captcha_size');
133 $option['turn_captcha_lang'] = lz_optpost('turn_captcha_lang');
134
135 // Math Captcha
136 $option['captcha_text'] = lz_optpost('captcha_text');
137 $option['captcha_time'] = (int) lz_optpost('captcha_time');
138 $option['captcha_words'] = (int) lz_optpost('captcha_words');
139 $option['captcha_add'] = (int) lz_optpost('captcha_add');
140 $option['captcha_subtract'] = (int) lz_optpost('captcha_subtract');
141 $option['captcha_multiply'] = (int) lz_optpost('captcha_multiply');
142 $option['captcha_divide'] = (int) lz_optpost('captcha_divide');
143
144 // Checkboxes
145 $option['captcha_user_hide'] = (int) lz_optpost('captcha_user_hide');
146 $option['captcha_login'] = (int) lz_optpost('captcha_login');
147 $option['captcha_lostpass'] = (int) lz_optpost('captcha_lostpass');
148 $option['captcha_resetpass'] = (int) lz_optpost('captcha_resetpass');
149 $option['captcha_register'] = (int) lz_optpost('captcha_register');
150 $option['captcha_comment'] = (int) lz_optpost('captcha_comment');
151 $option['captcha_wc_checkout'] = (int) lz_optpost('captcha_wc_checkout');
152
153 // Are we to use Math Captcha ?
154 if(!empty($_POST['captcha_status']) && $_POST['captcha_status'] == 2){
155
156 $option['captcha_no_google'] = 1;
157
158 // Make the checks
159 if(strlen($option['captcha_text']) < 1){
160 $lz_error['captcha_text'] = __('The Captcha key was not submitted', 'loginizer');
161 }
162
163 }else if(!empty($_POST['captcha_status']) && $_POST['captcha_status'] == 3){
164
165 if(strlen($option['hcaptcha_sitekey']) < 32 || strlen($option['hcaptcha_sitekey']) > 50){
166 $lz_error['hcaptcha_sitekey'] = __('The hCAPTCHA key is invalid', 'loginizer');
167 }
168
169 // Is secret valid ?
170 if(strlen($option['hcaptcha_secretkey']) < 32 || strlen($option['hcaptcha_secretkey']) > 50){
171 $lz_error['hcaptcha_secretkey'] = __('The hCAPTCHA secret is invalid', 'loginizer');
172 }
173
174 // Is theme valid ?
175 if(empty($lz_env['theme'][$option['hcaptcha_theme']])){
176 $lz_error['hcaptcha_theme'] = __('The hCaptcha theme is invalid', 'loginizer');
177 }
178
179 // Is size valid ?
180 if(empty($lz_env['size'][$option['hcaptcha_size']])){
181 $lz_error['hcaptcha_size'] = __('The Turnstile size is invalid', 'loginizer');
182 }
183
184 // Is lang valid ?
185 if(empty($lz_env['lang'][$option['turn_captcha_lang']])){
186 $lz_error['turn_captcha_lang'] = __('The Turnstile language is invalid', 'loginizer');
187 }
188
189 }else if(!empty($_POST['captcha_status']) && $_POST['captcha_status'] == 4){
190
191 if(strlen($option['turn_captcha_key']) < 24 || strlen($option['turn_captcha_key']) > 50){
192 $lz_error['turn_captcha_key'] = __('The Turnstile Site key is invalid', 'loginizer');
193 }
194
195 // Is secret valid ?
196 if(strlen($option['turn_captcha_secret']) < 32 || strlen($option['turn_captcha_secret']) > 50){
197 $lz_error['turn_captcha_secret'] = __('The Turnstile secret key is invalid', 'loginizer');
198 }
199
200 // Is theme valid ?
201 if(empty($lz_env['theme'][$option['turn_captcha_theme']])){
202 $lz_error['turn_captcha_theme'] = __('The Turnstile theme is invalid', 'loginizer');
203 }
204
205 // Is size valid ?
206 if(empty($lz_env['size'][$option['turn_captcha_size']])){
207 $lz_error['turn_captcha_size'] = __('The Turnstile size is invalid', 'loginizer');
208 }
209
210 // Is lang valid ?
211 if(empty($lz_env['lang'][$option['turn_captcha_lang']])){
212 $lz_error['turn_captcha_lang'] = __('The Turnstile language is invalid', 'loginizer');
213 }
214
215 }else{
216
217 // Make the checks
218 if(strlen($option['captcha_key']) < 32 || strlen($option['captcha_key']) > 50){
219 $lz_error['captcha_key'] = __('The reCAPTCHA key is invalid', 'loginizer');
220 }
221
222 // Is secret valid ?
223 if(strlen($option['captcha_secret']) < 32 || strlen($option['captcha_secret']) > 50){
224 $lz_error['captcha_secret'] = __('The reCAPTCHA secret is invalid', 'loginizer');
225 }
226
227 // Is theme valid ?
228 if(empty($lz_env['theme'][$option['captcha_theme']])){
229 $lz_error['captcha_theme'] = __('The reCAPTCHA theme is invalid', 'loginizer');
230 }
231
232 // Is size valid ?
233 if(empty($lz_env['size'][$option['captcha_size']])){
234 $lz_error['captcha_size'] = __('The reCAPTCHA size is invalid', 'loginizer');
235 }
236
237 // Is lang valid ?
238 if(empty($lz_env['lang'][$option['captcha_lang']])){
239 $lz_error['captcha_lang'] = __('The reCAPTCHA language is invalid', 'loginizer');
240 }
241
242 if(empty($lz_env['captcha_domains'][$option['captcha_domain']])){
243 $lz_error['captcha_domain'] = __('The reCAPTCHA domain is invalid', 'loginizer');
244 }
245
246 }
247
248 // Is there an error ?
249 if(!empty($lz_error)){
250 return loginizer_page_recaptcha_T();
251 }
252
253 // Save the options
254 update_option('loginizer_captcha', $option);
255
256 // Mark as saved
257 $GLOBALS['lz_saved'] = true;
258 }
259
260 }
261
262 // Call the theme
263 loginizer_page_recaptcha_T();
264
265 }
266
267 // Loginizer - reCaptcha Page Theme
268 function loginizer_page_recaptcha_T(){
269
270 global $loginizer, $lz_error, $lz_env;
271
272 // Universal header
273 loginizer_page_header('reCAPTCHA Settings');
274
275 loginizer_feature_available('reCAPTCHA');
276
277 // Saved ?
278 if(!empty($GLOBALS['lz_saved'])){
279 echo '<div id="message" class="updated"><p>'. __('The settings were saved successfully', 'loginizer'). '</p></div><br />';
280 }
281
282 // Cleared ?
283 if(!empty($GLOBALS['lz_cleared'])){
284 echo '<div id="message" class="updated"><p>'. __('reCAPTCHA has been disabled !', 'loginizer'). '</p></div><br />';
285 }
286
287 // Any errors ?
288 if(!empty($lz_error)){
289 lz_report_error($lz_error);echo '<br />';
290 }
291
292 ?>
293
294 <style>
295 input[type="text"], textarea, select {
296 width: 70%;
297 }
298 </style>
299
300 <div id="" class="postbox">
301
302 <div class="postbox-header">
303 <h2 class="hndle ui-sortable-handle">
304 <span><?php echo __('reCAPTCHA Settings', 'loginizer'); ?></span>
305 </h2>
306 </div>
307
308 <div class="inside">
309
310 <form action="" method="post" enctype="multipart/form-data" loginizer-premium-only="1">
311 <?php wp_nonce_field('loginizer-options'); ?>
312 <table class="form-table">
313 <tr>
314 <td scope="row" valign="top" style="width:400px !important;"><label for="captcha_status"><b><?php echo __('Captcha Status', 'loginizer'); ?></b></label></td>
315 <td>
316 <select name="captcha_status" id="captcha_status" onchange="lz_captcha_status();">
317 <?php
318 echo '<option '.lz_POSTselect('captcha_status', 0, (empty($loginizer['captcha_key']) && empty($loginizer['captcha_no_google']) && empty($loginizer['captcha_status']) ? true : false)).' value="0">'.__('Disabled', 'loginizer').'</option>
319 <option '.lz_POSTselect('captcha_status', 1, (!empty($loginizer['captcha_key']) ? true : false)).' value="1">'.__('Google reCAPTCHA', 'loginizer').'</option>
320 <option '.lz_POSTselect('captcha_status', 2, (!empty($loginizer['captcha_no_google']) ? true : false)).' value="2">'.__('Math Captcha', 'loginizer').'</option>
321 <option '.lz_POSTselect('captcha_status', 3, ((!empty($loginizer['captcha_status']) && $loginizer['captcha_status'] == 3) ? true : false)).' value="3">'.__('hCAPTCHA', 'loginizer').'</option>
322 <option '.lz_POSTselect('captcha_status', 4, ((!empty($loginizer['captcha_status']) && $loginizer['captcha_status'] == 4) ? true : false)).' value="4">'.__('Cloudflare Turnstile', 'loginizer').'</option>';
323 ?>
324 </select>
325 </td>
326 </tr>
327
328 <tr class="hcaptcha">
329 <td scope="row" valign="top"><label for="hcaptcha_sitekey"><b><?php echo __('Site Key', 'loginizer'); ?></b></label><br>
330 <?php echo __('Make sure you enter the correct keys as per the reCAPTCHA type selected above', 'loginizer'); ?>
331 </td>
332 <td>
333 <input type="text" size="50" value="<?php echo lz_optpost('hcaptcha_sitekey', (!empty($loginizer['hcaptcha_sitekey']) ? $loginizer['hcaptcha_sitekey'] : '')); ?>" name="hcaptcha_sitekey" id="hcaptcha_sitekey" /><br />
334 <?php echo __('Get the Site Key and Secret Key from <a href="https://www.hcaptcha.com/" target="_blank">hcaptcha</a>', 'loginizer'); ?>
335 </td>
336 </tr>
337
338 <tr class="hcaptcha">
339 <td scope="row" valign="top"><label for="hcaptcha_secretkey"><b><?php echo __('Secret Key', 'loginizer'); ?></b></label></td>
340 <td>
341 <input type="text" size="50" value="<?php echo lz_optpost('hcaptcha_secretkey', (!empty($loginizer['hcaptcha_secretkey']) ? $loginizer['hcaptcha_secretkey'] : '')); ?>" name="hcaptcha_secretkey" id="hcaptcha_secretkey" />
342 </td>
343 </tr>
344 <tr class="hcaptcha">
345 <td scope="row" valign="top"><label for="hcaptcha_theme"><b><?php echo __('Theme', 'loginizer'); ?></b></label></td>
346 <td>
347 <select name="hcaptcha_theme" id="hcaptcha_theme">
348 <?php
349 foreach($lz_env['theme'] as $k => $v){
350 echo '<option '.lz_POSTselect('hcaptcha_theme', $k, ((!empty($loginizer['hcaptcha_theme']) && $loginizer['hcaptcha_theme'] == $k) ? true : false)).' value="'.esc_attr($k).'">'.esc_html($v).'</value>';
351 }
352 ?>
353 </select>
354 </td>
355 </tr>
356 <tr class="hcaptcha">
357 <td scope="row" valign="top"><label for="hcaptcha_lang"><b><?php echo __('Language', 'loginizer'); ?></b></label></td>
358 <td>
359 <select name="hcaptcha_lang" id="hcaptcha_lang">
360 <?php
361 foreach($lz_env['lang'] as $k => $v){
362 echo '<option '.lz_POSTselect('hcaptcha_lang', $k, ((!empty($loginizer['hcaptcha_lang']) && $loginizer['hcaptcha_lang'] == $k) ? true : false)).' value="'.esc_attr($k).'">'.esc_attr($v).'</value>';
363 }
364 ?>
365 </select>
366 </td>
367 </tr>
368
369 <tr class="hcaptcha">
370 <td scope="row" valign="top"><label for="hcaptcha_size"><b><?php echo __('Size', 'loginizer'); ?></b></label></td>
371 <td>
372 <select name="hcaptcha_size" id="hcaptcha_size">
373 <?php
374 foreach($lz_env['size'] as $k => $v){
375 echo '<option '.lz_POSTselect('hcaptcha_size', $k, ((!empty($loginizer['hcaptcha_size']) && $loginizer['hcaptcha_size'] == $k) ? true : false)).' value="'.esc_attr($k).'">'.esc_html($v).'</value>';
376 }
377 ?>
378 </select>
379 </td>
380 </tr>
381
382
383 <tr class="lz_google_cap">
384 <td scope="row" valign="top"><label><b><?php echo __('reCAPTCHA type', 'loginizer'); ?></b></label><br>
385 <?php echo __('Choose the type of reCAPTCHA', 'loginizer'); ?><br />
386 <?php echo __('<a href="https://g.co/recaptcha/sitetypes/" target="_blank">See Site Types for more details</a>', 'loginizer'); ?>
387 </td>
388 <td>
389 <input type="radio" value="v3" onchange="google_recaptcha_type()" <?php echo lz_POSTradio('captcha_type', 'v3', (!empty($loginizer['captcha_type']) ? $loginizer['captcha_type'] : '')); ?> name="captcha_type" id="captcha_type_v3" /> <label for="captcha_type_v3"><?php echo __('reCAPTCHA v3', 'loginizer'); ?></label><br /><br />
390 <input type="radio" value="" onchange="google_recaptcha_type()" <?php echo lz_POSTradio('captcha_type', '', (!empty($loginizer['captcha_type']) ? $loginizer['captcha_type'] : '')); ?> name="captcha_type" id="captcha_type_v2" /> <label for="captcha_type_v2"><?php echo __('reCAPTCHA v2 - Checkbox', 'loginizer'); ?></label><br /><br />
391 <input type="radio" value="v2_invisible" onchange="google_recaptcha_type()" <?php echo lz_POSTradio('captcha_type', 'v2_invisible', (!empty($loginizer['captcha_type']) ? $loginizer['captcha_type'] : '')); ?> name="captcha_type" id="captcha_type_v2_invisible" /> <label for="captcha_type_v2_invisible"><?php echo __('reCAPTCHA v2 - Invisible', 'loginizer'); ?></label><br />
392 </td>
393 </tr>
394 <tr class="lz_google_cap">
395 <td scope="row" valign="top"><label for="captcha_key"><b><?php echo __('Site Key', 'loginizer'); ?></b></label><br>
396 <?php echo __('Make sure you enter the correct keys as per the reCAPTCHA type selected above', 'loginizer'); ?>
397 </td>
398 <td>
399 <input type="text" size="50" value="<?php echo lz_optpost('captcha_key', (!empty($loginizer['captcha_key']) ? $loginizer['captcha_key'] : '')); ?>" name="captcha_key" id="captcha_key" /><br />
400 <?php echo __('Get the Site Key and Secret Key from <a href="https://www.google.com/recaptcha/admin/" target="_blank">Google</a>', 'loginizer'); ?>
401 </td>
402 </tr>
403 <tr class="lz_google_cap">
404 <td scope="row" valign="top"><label for="captcha_secret"><b><?php echo __('Secret Key', 'loginizer'); ?></b></label></td>
405 <td>
406 <input type="text" size="50" value="<?php echo lz_optpost('captcha_secret', (!empty($loginizer['captcha_secret']) ? $loginizer['captcha_secret'] : '')); ?>" name="captcha_secret" id="captcha_secret" />
407 </td>
408 </tr>
409 <tr class="lz_google_cap">
410 <td scope="row" valign="top"><label for="captcha_theme"><b><?php echo __('Theme', 'loginizer'); ?></b></label></td>
411 <td>
412 <select name="captcha_theme" id="captcha_theme">
413 <?php
414 foreach($lz_env['theme'] as $k => $v){
415 echo '<option '.lz_POSTselect('captcha_theme', $k, ((!empty($loginizer['captcha_theme']) && $loginizer['captcha_theme'] == $k) ? true : false)).' value="'.esc_attr($k).'">'.esc_html($v).'</option>';
416 }
417 ?>
418 </select>
419 </td>
420 </tr>
421 <tr class="lz_google_cap">
422 <td scope="row" valign="top"><label for="captcha_lang"><b><?php echo __('Language', 'loginizer'); ?></b></label></td>
423 <td>
424 <select name="captcha_lang" id="captcha_lang">
425 <?php
426 foreach($lz_env['lang'] as $k => $v){
427 echo '<option '.lz_POSTselect('captcha_lang', $k, ((!empty($loginizer['captcha_lang']) && $loginizer['captcha_lang'] == $k) ? true : false)).' value="'.esc_attr($k).'">'.esc_html($v).'</option>';
428 }
429 ?>
430 </select>
431 </td>
432 </tr>
433 <tr class="lz_google_cap lz_google_cap_size">
434 <td scope="row" valign="top"><label for="captcha_size"><b><?php echo __('Size', 'loginizer'); ?></b></label></td>
435 <td>
436 <select name="captcha_size" id="captcha_size">
437 <?php
438 foreach($lz_env['size'] as $k => $v){
439 echo '<option '.lz_POSTselect('captcha_size', $k, ((!empty($loginizer['captcha_size']) && $loginizer['captcha_size'] == $k) ? true : false)).' value="'.esc_attr($k).'">'.esc_html($v).'</option>';
440 }
441 ?>
442 </select>
443 </td>
444 </tr>
445 <tr class="lz_google_cap">
446 <td scope="row" valign="top">
447 <label for="captcha_domain"><b><?php echo __('reCAPTCHA Domain', 'loginizer'); ?></b></label><br>
448 <?php echo __('If Google is not accessible or blocked in your country select other one', 'loginizer'); ?>
449 </td>
450 <td>
451 <select name="captcha_domain" id="captcha_domain">
452 <?php
453 foreach($lz_env['captcha_domains'] as $k => $v){
454 echo '<option '.lz_POSTselect('captcha_domain', $k, ((!empty($loginizer['captcha_domain']) && $loginizer['captcha_domain'] == $k) ? true : false)).' value="'.$k.'">'.$v.($k == 'www.google.com' ? ' '.__('(Default)', 'loginizer') : '').'</option>';
455 }
456 ?>
457 </select>
458 </td>
459 </tr>
460
461 <tr class="lz_google_cap lz_google_cap_v3">
462 <td scope="row" valign="top">
463 <label for="captcha_domain"><b><?php echo __('reCaptcha threshold', 'loginizer'); ?></b></label><br>
464 <?php echo __('Google returns a score between 0.0 and 1.0 — with 0.0 meaning it\'s likely a bot and 1.0 meaning it\'s likely a human. The default threshold is 0.5, but you can change it based on your needs.', 'loginizer'); ?>
465 </td>
466 <td>
467 <input type="number" max="1.0" min="0.0" step="0.1" name="captcha_score_threshold" id="captcha_score_threshold" value="<?php echo (!empty($loginizer['captcha_score_threshold']) ? esc_attr($loginizer['captcha_score_threshold']) : '0.5'); ?>">
468 </select>
469 </td>
470 </tr>
471
472 <tr class="lz_turnstile_cap">
473 <td scope="row" valign="top"><label for="turn_captcha_key"><b><?php echo __('Site Key', 'loginizer'); ?></b></label><br>
474 </td>
475 <td>
476 <input type="text" size="50" value="<?php echo lz_optpost('turn_captcha_key', (!empty($loginizer['turn_captcha_key']) ? $loginizer['turn_captcha_key'] : '')); ?>" name="turn_captcha_key" id="turn_captcha_key" /><br />
477 <?php echo __('Get the Site Key and Secret Key from <a href="https://dash.cloudflare.com/sign-up?to=/:account/turnstile" target="_blank">Cloudflare Turnstile</a>', 'loginizer'); ?>
478 </td>
479 </tr>
480 <tr class="lz_turnstile_cap">
481 <td scope="row" valign="top"><label for="turn_captcha_secret"><b><?php echo __('Secret Key', 'loginizer'); ?></b></label></td>
482 <td>
483 <input type="password" size="50" value="<?php echo lz_optpost('turn_captcha_secret', (!empty($loginizer['turn_captcha_secret']) ? $loginizer['turn_captcha_secret'] : '')); ?>" name="turn_captcha_secret" id="turn_captcha_secret" />
484 </td>
485 </tr>
486 <tr class="lz_turnstile_cap">
487 <td scope="row" valign="top"><label for="turn_captcha_theme"><b><?php echo __('Theme', 'loginizer'); ?></b></label></td>
488 <td>
489 <select name="turn_captcha_theme" id="turn_captcha_theme">
490 <?php
491 foreach($lz_env['theme'] as $k => $v){
492 echo '<option '.lz_POSTselect('turn_captcha_theme', $k, ((!empty($loginizer['turn_captcha_theme']) && $loginizer['turn_captcha_theme'] == $k) ? true : false)).' value="'.esc_attr($k).'">'.esc_html($v).'</option>';
493 }
494 ?>
495 </select>
496 </td>
497 </tr>
498
499 <tr class="lz_turnstile_cap">
500 <td scope="row" valign="top"><label for="turn_captcha_lang"><b><?php echo __('Language', 'loginizer'); ?></b></label></td>
501 <td>
502 <select name="turn_captcha_lang" id="turn_captcha_lang">
503 <?php
504 foreach($lz_env['lang'] as $k => $v){
505 echo '<option '.lz_POSTselect('turn_captcha_lang', $k, ((!empty($loginizer['turn_captcha_lang']) && $loginizer['turn_captcha_lang'] == $k) ? true : false)).' value="'.$k.'">'.$v.'</option>';
506 }
507 ?>
508 </select>
509 </td>
510 </tr>
511 <tr class="lz_turnstile_cap lz_google_cap_size">
512 <td scope="row" valign="top"><label for="turn_captcha_size"><b><?php echo __('Size', 'loginizer'); ?></b></label></td>
513 <td>
514 <select name="turn_captcha_size" id="turn_captcha_size">
515 <?php
516 foreach($lz_env['size'] as $k => $v){
517 echo '<option '.lz_POSTselect('turn_captcha_size', $k, ((!empty($loginizer['turn_captcha_size']) && $loginizer['turn_captcha_size'] == $k) ? true : false)).' value="'.$k.'">'.$v.'</option>';
518 }
519 ?>
520 </select>
521 </td>
522 </tr>
523
524 <tr class="lz_math_cap">
525 <td scope="row" valign="top">
526 <label for="captcha_text"><b><?php echo __('Captcha Text', 'loginizer'); ?></b></label><br>
527 <?php echo __('The text to be shown for the Captcha Field', 'loginizer'); ?>
528 </td>
529 <td>
530 <input type="text" size="30" value="<?php echo lz_optpost('captcha_text', (!empty($loginizer['captcha_text']) ? $loginizer['captcha_text'] : '')); ?>" name="captcha_text" id="captcha_text" />
531 </td>
532 </tr>
533 <tr class="lz_math_cap">
534 <td scope="row" valign="top">
535 <label for="captcha_time"><b><?php echo __('Captcha Time', 'loginizer'); ?></b></label><br>
536 <?php echo __('Enter the number of seconds, a user has to enter captcha value.', 'loginizer'); ?>
537 </td>
538 <td>
539 <input type="text" size="30" value="<?php echo lz_optpost('captcha_time', (!empty($loginizer['captcha_time']) ? $loginizer['captcha_time'] : '')); ?>" name="captcha_time" id="captcha_time" />
540 </td>
541 </tr>
542 <tr class="lz_math_cap">
543 <td scope="row" valign="top">
544 <label for="captcha_words"><b><?php echo __('Display Captcha in Words', 'loginizer'); ?></b></label><br>
545 <?php echo __('If selected the Captcha will be displayed in words rather than numbers', 'loginizer'); ?>
546 </td>
547 <td>
548 <input type="checkbox" value="1" name="captcha_words" id="captcha_words" <?php echo lz_POSTchecked('captcha_words', (empty($loginizer['captcha_words']) ? false : true));?> />
549 </td>
550 </tr>
551 <tr class="lz_math_cap">
552 <td scope="row" valign="top" style="vertical-align: top !important;">
553 <label><b><?php echo __('Mathematical operations', 'loginizer'); ?></b></label><br>
554 <?php echo __('The Mathematical operations to use for Captcha', 'loginizer'); ?>
555 </td>
556 <td valign="top">
557 <table class="wp-list-table fixed users" cellpadding="8" cellspacing="1">
558 <?php echo '
559 <tr>
560 <td><label for="captcha_add">'.__('Addition (+)', 'loginizer').'</label></td>
561 <td><input type="checkbox" value="1" name="captcha_add" id="captcha_add" '.lz_POSTchecked('captcha_add', (empty($loginizer['captcha_add']) ? false : true)).' /></td>
562 </tr>
563 <tr>
564 <td><label for="captcha_subtract">'.__('Subtraction (-)', 'loginizer').'</label></td>
565 <td><input type="checkbox" value="1" name="captcha_subtract" id="captcha_subtract" '.lz_POSTchecked('captcha_subtract', (empty($loginizer['captcha_subtract']) ? false : true)).' /></td>
566 </tr>
567 <tr>
568 <td><label for="captcha_multiply">'.__('Multiplication (x)', 'loginizer').'</label></td>
569 <td><input type="checkbox" value="1" name="captcha_multiply" id="captcha_multiply" '.lz_POSTchecked('captcha_multiply', (empty($loginizer['captcha_multiply']) ? false : true)).' /></td>
570 </tr>
571 <tr>
572 <td><label for="captcha_divide">'.__('Division (÷)', 'loginizer').'</label></td>
573 <td><input type="checkbox" value="1" name="captcha_divide" id="captcha_divide" '.lz_POSTchecked('captcha_divide', (empty($loginizer['captcha_divide']) ? false : true)).' /></td>
574 </tr>';
575 ?>
576 </table>
577 </td>
578 </tr>
579 <tr class="lz_cap">
580 <td scope="row" valign="top"><label><b><?php echo __('Show Captcha On', 'loginizer'); ?></b></label></td>
581 <td valign="top">
582 <table class="wp-list-table fixed users" cellpadding="8" cellspacing="1">
583 <?php echo '
584 <tr>
585 <td><label for="captcha_login">'.__('Login Form', 'loginizer').'</label></td>
586 <td><input type="checkbox" value="1" name="captcha_login" id="captcha_login" '.lz_POSTchecked('captcha_login', (empty($loginizer['captcha_login']) ? false : true)).' /></td>
587 </tr>
588 <tr>
589 <td><label for="captcha_lostpass">'.__('Lost Password Form', 'loginizer').'</label></td>
590 <td><input type="checkbox" value="1" name="captcha_lostpass" id="captcha_lostpass" '.lz_POSTchecked('captcha_lostpass', (empty($loginizer['captcha_lostpass']) ? false : true)).' /></td>
591 </tr>
592 <tr>
593 <td><label for="captcha_resetpass">'.__('Reset Password Form', 'loginizer').'</label></td>
594 <td><input type="checkbox" value="1" name="captcha_resetpass" id="captcha_resetpass" '.lz_POSTchecked('captcha_resetpass', (empty($loginizer['captcha_resetpass']) ? false : true)).' /></td>
595 </tr>
596 <tr>
597 <td><label for="captcha_register">'.__('Registration Form', 'loginizer').'</label></td>
598 <td><input type="checkbox" value="1" name="captcha_register" id="captcha_register" '.lz_POSTchecked('captcha_register', (empty($loginizer['captcha_register']) ? false : true)).' /></td>
599 </tr>
600 <tr>
601 <td><label for="captcha_comment">'.__('Comment Form', 'loginizer').'</label></td>
602 <td><input type="checkbox" value="1" name="captcha_comment" id="captcha_comment" '.lz_POSTchecked('captcha_comment', (empty($loginizer['captcha_comment']) ? false : true)).' /></td>
603 </tr>';
604
605 if(!defined('SITEPAD')){
606
607 echo '<tr>
608 <td><label for="captcha_wc_checkout">'.__('WooCommerce Checkout', 'loginizer').'</label></td>
609 <td><input type="checkbox" value="1" name="captcha_wc_checkout" id="captcha_wc_checkout" '.lz_POSTchecked('captcha_wc_checkout', (empty($loginizer['captcha_wc_checkout']) ? false : true)).' /></td>
610 </tr>';
611
612 }
613
614 ?>
615 </table>
616 </td>
617 </tr>
618 <tr class="lz_google_cap lz_google_cap_size">
619 <td scope="row" valign="top"><label for="captcha_disable_btn"><b><?php echo __('Disable Login Button', 'loginizer'); ?></b></label></td>
620 <td>
621 <input type="checkbox" value="1" name="captcha_disable_btn" id="captcha_disable_btn" <?php echo lz_POSTchecked('captcha_disable_btn', (empty($loginizer['captcha_disable_btn']) ? false : true)); ?> />
622 </td>
623 </tr>
624 <tr class="lz_cap">
625 <td scope="row" valign="top"><label for="captcha_user_hide"><b><?php echo __('Hide CAPTCHA for logged in Users', 'loginizer'); ?></b></label></td>
626 <td>
627 <input type="checkbox" value="1" name="captcha_user_hide" id="captcha_user_hide" <?php echo lz_POSTchecked('captcha_user_hide', (empty($loginizer['captcha_user_hide']) ? false : true)); ?> />
628 </td>
629 </tr>
630 </table><br />
631 <center><input name="save_lz" class="button button-primary action" value="<?php echo __('Save Settings','loginizer'); ?>" type="submit" /></center>
632 </form>
633
634 </div>
635 </div>
636 <br />
637
638 <script type="text/javascript">
639
640 function lz_captcha_status(){
641
642 var cur_captcha_status = jQuery("#captcha_status option:selected").val();
643
644 if(cur_captcha_status == 1){
645 jQuery(".lz_google_cap").show();
646 jQuery(".lz_math_cap").hide();
647 jQuery('.lz_turnstile_cap').hide();
648 jQuery(".lz_cap").show();
649 google_recaptcha_type();
650 jQuery(".hcaptcha").hide();
651
652 }else if(cur_captcha_status == 2){
653 jQuery(".lz_google_cap").hide();
654 jQuery(".lz_math_cap").show();
655 jQuery('.lz_turnstile_cap').hide();
656 jQuery(".lz_cap").show();
657 jQuery(".hcaptcha").hide();
658
659 }else if(cur_captcha_status == 3){
660 jQuery(".hcaptcha").show();
661 jQuery(".lz_math_cap").hide();
662 jQuery('.lz_turnstile_cap').hide();
663 jQuery(".lz_cap").show();
664 jQuery(".lz_google_cap").hide();
665 }else if(cur_captcha_status == 4){
666 jQuery(".hcaptcha").hide();
667 jQuery(".lz_math_cap").hide();
668 jQuery('.lz_turnstile_cap').show();
669 jQuery(".lz_cap").show();
670 jQuery(".lz_google_cap").hide();
671 }else{
672 jQuery(".hcaptcha").hide();
673 jQuery(".lz_google_cap").hide();
674 jQuery(".lz_math_cap").hide();
675 jQuery('.lz_turnstile_cap').hide();
676 jQuery(".lz_cap").hide();
677 }
678
679 }
680
681 function google_recaptcha_type(){
682
683 var cur_captcha_type = jQuery("input:radio[name='captcha_type']:checked").val();
684
685 if(cur_captcha_type == 'v3' || cur_captcha_type == 'v2_invisible'){
686 if(cur_captcha_type == 'v3'){
687 jQuery(".lz_google_cap_v3").show();
688 } else {
689 jQuery(".lz_google_cap_v3").hide();
690 }
691
692 jQuery(".lz_google_cap_size").hide();
693 }else{
694 jQuery(".lz_google_cap_size").show();
695 jQuery(".lz_google_cap_v3").hide();
696
697 }
698
699 }
700
701 jQuery(document).ready(function(){
702 lz_captcha_status();
703 });
704
705 </script>
706
707 <?php
708 loginizer_page_footer();
709
710 }