PluginProbe
Loginizer / 2.0.6
Loginizer v2.0.6
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
← All changes | main/settings/recaptcha.php +72 -15 2.0.12.0.6 View file →
@@ -17,9 +17,9 @@
17 17 wp_die('Sorry, but you do not have permissions to change settings.');
18 18 }
19 19
20 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');
21 + $lz_error['not_in_free'] = __('This feature is not available in the Free version.', 'loginizer').' <a href="'.LOGINIZER_PRICING_URL.'" target="_blank" style="text-decoration:none; color:green;"><b>'.esc_html__('Upgrade to Pro', 'loginizer').'</b></a>';
22 22 return loginizer_page_recaptcha_T();
23 23 }
24 24
25 25 /* Make sure post was from this page */
@@ -82,8 +82,13 @@
82 82
83 83 // Sizes
84 84 $lz_env['size']['normal'] = 'Normal';
85 85 $lz_env['size']['compact'] = 'Compact';
86 +
87 + // Size cloudflare (turnstile)
88 + $lz_env['turnstile_size']['normal'] = 'Normal';
89 + $lz_env['turnstile_size']['compact'] = 'Compact';
90 + $lz_env['turnstile_size']['flexible'] = 'Flexible';
86 91
87 92 // reCAPTCHA Domains
88 93 $lz_env['captcha_domains']['www.google.com'] = 'google.com';
89 94 $lz_env['captcha_domains']['www.recaptcha.net'] = 'recaptcha.net';
@@ -117,8 +122,13 @@
117 122 $option['captcha_theme'] = lz_optpost('captcha_theme');
118 123 $option['captcha_size'] = lz_optpost('captcha_size');
119 124 $option['captcha_lang'] = lz_optpost('captcha_lang');
120 125 $option['captcha_domain'] = lz_optpost('captcha_domain');
126 + $option['captcha_score_threshold'] = lz_optpost('captcha_score_threshold');
127 + if(!is_numeric($option['captcha_score_threshold']) || $option['captcha_score_threshold'] > '1.0' || $option['captcha_score_threshold'] < '0.0'){
128 + $option['captcha_score_threshold'] = '0.5';
129 + }
130 +
121 131 $option['captcha_disable_btn'] = lz_optpost('captcha_disable_btn'); // Only for v2 reCaptcha Checkbox
122 132
123 133 // Cloudflare Turnstil Captcha
124 134 $option['turn_captcha_key'] = lz_optpost('turn_captcha_key');
@@ -143,8 +153,12 @@
143 153 $option['captcha_resetpass'] = (int) lz_optpost('captcha_resetpass');
144 154 $option['captcha_register'] = (int) lz_optpost('captcha_register');
145 155 $option['captcha_comment'] = (int) lz_optpost('captcha_comment');
146 156 $option['captcha_wc_checkout'] = (int) lz_optpost('captcha_wc_checkout');
157 + $option['captcha_wc_block_checkout'] = isset($_POST['captcha_wc_block_checkout']);
158 + $option['captcha_wc_checkout_pos'] = lz_optpost('captcha_wc_checkout_pos');
159 + $option['captcha_wpforms'] = (int) lz_optpost('captcha_wpforms');
160 + $option['captcha_contactform7'] = (int) lz_optpost('captcha_contactform7');
147 161
148 162 // Are we to use Math Captcha ?
149 163 if(!empty($_POST['captcha_status']) && $_POST['captcha_status'] == 2){
150 164
@@ -197,9 +211,9 @@
197 211 $lz_error['turn_captcha_theme'] = __('The Turnstile theme is invalid', 'loginizer');
198 212 }
199 213
200 214 // Is size valid ?
201 - if(empty($lz_env['size'][$option['turn_captcha_size']])){
215 + if(empty($lz_env['turnstile_size'][$option['turn_captcha_size']])){
202 216 $lz_error['turn_captcha_size'] = __('The Turnstile size is invalid', 'loginizer');
203 217 }
204 218
205 219 // Is lang valid ?
@@ -377,9 +391,9 @@
377 391
378 392 <tr class="lz_google_cap">
379 393 <td scope="row" valign="top"><label><b><?php echo __('reCAPTCHA type', 'loginizer'); ?></b></label><br>
380 394 <?php echo __('Choose the type of reCAPTCHA', 'loginizer'); ?><br />
381 - <?php echo __('<a href="https://g.co/recaptcha/sitetypes/" target="_blank">See Site Types for more details</a>', 'loginizer'); ?>
395 + <?php echo '<a href="https://developers.google.com/recaptcha/docs/versions" target="_blank">'.__('See Site Types for more details', 'loginizer').'</a>'; ?>
382 396 </td>
383 397 <td>
384 398 <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 />
385 399 <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,9 +405,9 @@
391 405 <?php echo __('Make sure you enter the correct keys as per the reCAPTCHA type selected above', 'loginizer'); ?>
392 406 </td>
393 407 <td>
394 408 <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 />
395 - <?php echo __('Get the Site Key and Secret Key from <a href="https://www.google.com/recaptcha/admin/" target="_blank">Google</a>', 'loginizer'); ?>
409 + <?php echo __('Get the Site Key and Secret Key from', 'loginizer'). ' <a href="https://www.google.com/recaptcha/admin/" target="_blank">Google</a>'; ?>
396 410 </td>
397 411 </tr>
398 412 <tr class="lz_google_cap">
399 413 <td scope="row" valign="top"><label for="captcha_secret"><b><?php echo __('Secret Key', 'loginizer'); ?></b></label></td>
@@ -406,9 +420,9 @@
406 420 <td>
407 421 <select name="captcha_theme" id="captcha_theme">
408 422 <?php
409 423 foreach($lz_env['theme'] as $k => $v){
410 - echo '<option '.lz_POSTselect('captcha_theme', $k, ((!empty($loginizer['captcha_theme']) && $loginizer['captcha_theme'] == $k) ? true : false)).' value="'.esc_attr($k).'">'.esc_html($v).'</value>';
424 + 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>';
411 425 }
412 426 ?>
413 427 </select>
414 428 </td>
@@ -418,9 +432,9 @@
418 432 <td>
419 433 <select name="captcha_lang" id="captcha_lang">
420 434 <?php
421 435 foreach($lz_env['lang'] as $k => $v){
422 - echo '<option '.lz_POSTselect('captcha_lang', $k, ((!empty($loginizer['captcha_lang']) && $loginizer['captcha_lang'] == $k) ? true : false)).' value="'.esc_attr($k).'">'.esc_html($v).'</value>';
436 + 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>';
423 437 }
424 438 ?>
425 439 </select>
426 440 </td>
@@ -430,9 +444,9 @@
430 444 <td>
431 445 <select name="captcha_size" id="captcha_size">
432 446 <?php
433 447 foreach($lz_env['size'] as $k => $v){
434 - echo '<option '.lz_POSTselect('captcha_size', $k, ((!empty($loginizer['captcha_size']) && $loginizer['captcha_size'] == $k) ? true : false)).' value="'.esc_attr($k).'">'.esc_html($v).'</value>';
448 + 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>';
435 449 }
436 450 ?>
437 451 </select>
438 452 </td>
@@ -445,9 +459,9 @@
445 459 <td>
446 460 <select name="captcha_domain" id="captcha_domain">
447 461 <?php
448 462 foreach($lz_env['captcha_domains'] as $k => $v){
449 - 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') : '').'</value>';
463 + 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>';
450 464 }
451 465 ?>
452 466 </select>
453 467 </td>
@@ -452,14 +466,25 @@
452 466 </select>
453 467 </td>
454 468 </tr>
455 469
470 + <tr class="lz_google_cap lz_google_cap_v3">
471 + <td scope="row" valign="top">
472 + <label for="captcha_domain"><b><?php echo __('reCaptcha threshold', 'loginizer'); ?></b></label><br>
473 + <?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'); ?>
474 + </td>
475 + <td>
476 + <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'); ?>">
477 + </select>
478 + </td>
479 + </tr>
480 +
456 481 <tr class="lz_turnstile_cap">
457 482 <td scope="row" valign="top"><label for="turn_captcha_key"><b><?php echo __('Site Key', 'loginizer'); ?></b></label><br>
458 483 </td>
459 484 <td>
460 485 <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 />
461 - <?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'); ?>
486 + <?php echo __('Get the Site Key and Secret Key from', 'loginizer').' <a href="https://dash.cloudflare.com/sign-up?to=/:account/turnstile" target="_blank">Cloudflare Turnstile</a>'; ?>
462 487 </td>
463 488 </tr>
464 489 <tr class="lz_turnstile_cap">
465 490 <td scope="row" valign="top"><label for="turn_captcha_secret"><b><?php echo __('Secret Key', 'loginizer'); ?></b></label></td>
@@ -472,9 +497,9 @@
472 497 <td>
473 498 <select name="turn_captcha_theme" id="turn_captcha_theme">
474 499 <?php
475 500 foreach($lz_env['theme'] as $k => $v){
476 - 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).'</value>';
501 + 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>';
477 502 }
478 503 ?>
479 504 </select>
480 505 </td>
@@ -485,21 +510,21 @@
485 510 <td>
486 511 <select name="turn_captcha_lang" id="turn_captcha_lang">
487 512 <?php
488 513 foreach($lz_env['lang'] as $k => $v){
489 - echo '<option '.lz_POSTselect('turn_captcha_lang', $k, ((!empty($loginizer['turn_captcha_lang']) && $loginizer['turn_captcha_lang'] == $k) ? true : false)).' value="'.$k.'">'.$v.'</value>';
514 + echo '<option '.lz_POSTselect('turn_captcha_lang', $k, ((!empty($loginizer['turn_captcha_lang']) && $loginizer['turn_captcha_lang'] == $k) ? true : false)).' value="'.$k.'">'.$v.'</option>';
490 515 }
491 516 ?>
492 517 </select>
493 518 </td>
494 519 </tr>
495 - <tr class="lz_turnstile_cap lz_google_cap_size">
520 + <tr class="lz_turnstile_cap">
496 521 <td scope="row" valign="top"><label for="turn_captcha_size"><b><?php echo __('Size', 'loginizer'); ?></b></label></td>
497 522 <td>
498 523 <select name="turn_captcha_size" id="turn_captcha_size">
499 524 <?php
500 - foreach($lz_env['size'] as $k => $v){
501 - echo '<option '.lz_POSTselect('turn_captcha_size', $k, ((!empty($loginizer['turn_captcha_size']) && $loginizer['turn_captcha_size'] == $k) ? true : false)).' value="'.$k.'">'.$v.'</value>';
525 + foreach($lz_env['turnstile_size'] as $k => $v){
526 + echo '<option '.lz_POSTselect('turn_captcha_size', $k, ((!empty($loginizer['turn_captcha_size']) && $loginizer['turn_captcha_size'] == $k) ? true : false)).' value="'.$k.'">'.$v.'</option>';
502 527 }
503 528 ?>
504 529 </select>
505 530 </td>
@@ -590,10 +615,34 @@
590 615
591 616 echo '<tr>
592 617 <td><label for="captcha_wc_checkout">'.__('WooCommerce Checkout', 'loginizer').'</label></td>
593 618 <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>
619 + </tr>
620 + <tr>
621 + <td><label for="captcha_wc_block_checkout">'.__('WooCommerce Block based Checkout', 'loginizer').'</label></td>
622 + <td><input type="checkbox" value="1" name="captcha_wc_block_checkout" id="captcha_wc_block_checkout" '.lz_POSTchecked('captcha_wc_block_checkout', (!empty($loginizer['captcha_wc_block_checkout']))).' /></td>
623 + </tr>
624 +
625 + <tr>
626 + <td><label for="captcha_wc_checkout_pos">'.__('WooCommerce Checkout Position', 'loginizer').'</label></td>
627 + <td>
628 + <select value="'.lz_optpost('captcha_wc_checkout_pos').'" name="captcha_wc_checkout_pos" id="captcha_wc_checkout_pos" />
629 + <option value="" '.(isset($loginizer['captcha_wc_checkout_pos']) ? selected($loginizer['captcha_wc_checkout_pos'], '', false) : '').'>'.__('Before Payment', 'loginizer').'</option>
630 + <option value="before_submit" '.(isset($loginizer['captcha_wc_checkout_pos']) ? selected($loginizer['captcha_wc_checkout_pos'], 'before_submit', false) : '').'>'.__('Before Order Button', 'loginizer').'</option>
631 + </select>
632 + </td>
633 + </tr>
634 + <tr>
635 + <td><label for="captcha_wpforms">'.__('WPForms', 'loginizer').'</label></td>
636 + <td><input type="checkbox" value="1" name="captcha_wpforms" id="captcha_wpforms" '.lz_POSTchecked('captcha_wpforms', (empty($loginizer['captcha_wpforms']) ? false : true)).' /></td>
637 + </tr>
638 + <tr>
639 + <td><label for="captcha_contactform7">'.__('ContactForm7', 'loginizer').'</label></td>
640 + <td><input type="checkbox" value="1" name="captcha_contactform7" id="captcha_contactform7" '.lz_POSTchecked('captcha_contactform7', (empty($loginizer['captcha_contactform7']) ? false : true)).' /></td>
641 + </tr>
642 + <tr>
643 + <td>'.__('To use the Loginizer reCAPTCHA on Contact Form 7 please enable the above checkbox add the shortcode: [loginizer_pro_recaptcha]', 'loginizer').'</td>
594 644 </tr>';
595 -
596 645 }
597 646
598 647 ?>
599 648 </table>
@@ -666,11 +715,19 @@
666 715
667 716 var cur_captcha_type = jQuery("input:radio[name='captcha_type']:checked").val();
668 717
669 718 if(cur_captcha_type == 'v3' || cur_captcha_type == 'v2_invisible'){
719 + if(cur_captcha_type == 'v3'){
720 + jQuery(".lz_google_cap_v3").show();
721 + } else {
722 + jQuery(".lz_google_cap_v3").hide();
723 + }
724 +
670 725 jQuery(".lz_google_cap_size").hide();
671 726 }else{
672 727 jQuery(".lz_google_cap_size").show();
728 + jQuery(".lz_google_cap_v3").hide();
729 +
673 730 }
674 731
675 732 }
676 733