tab_activity.php
2 years ago
tab_captcha.php
2 years ago
tab_design.php
2 years ago
tab_firewall.php
2 years ago
tab_geoip.php
2 years ago
tab_login_form.php
2 years ago
tab_temp_access.php
2 years ago
tab_captcha.php
252 lines
| 1 | <?php |
| 2 | /** |
| 3 | * WP Captcha |
| 4 | * https://getwpcaptcha.com/ |
| 5 | * (c) WebFactory Ltd, 2022 - 2023, www.webfactoryltd.com |
| 6 | */ |
| 7 | |
| 8 | class WPCaptcha_Tab_Captcha extends WPCaptcha |
| 9 | { |
| 10 | static function display() |
| 11 | { |
| 12 | $tabs[] = array('id' => 'tab_captcha', 'class' => 'tab-content', 'label' => __('Captcha', 'advanced-google-recaptcha'), 'callback' => array(__CLASS__, 'tab_captcha')); |
| 13 | $tabs[] = array('id' => 'tab_captcha_location', 'class' => 'tab-content', 'label' => __('Where To Show', 'advanced-google-recaptcha'), 'callback' => array(__CLASS__, 'tab_captcha_location')); |
| 14 | |
| 15 | echo '<div id="tabs_log" class="ui-tabs wpcaptcha-tabs-2nd-level">'; |
| 16 | echo '<ul>'; |
| 17 | foreach ($tabs as $tab) { |
| 18 | echo '<li><a href="#' . esc_attr($tab['id']) . '">' . esc_html($tab['label']) . '</a></li>'; |
| 19 | } |
| 20 | echo '</ul>'; |
| 21 | |
| 22 | foreach ($tabs as $tab) { |
| 23 | if (is_callable($tab['callback'])) { |
| 24 | echo '<div style="display: none;" id="' . esc_attr($tab['id']) . '" class="' . esc_attr($tab['class']) . '">'; |
| 25 | call_user_func($tab['callback']); |
| 26 | echo '</div>'; |
| 27 | } |
| 28 | } // foreach |
| 29 | |
| 30 | echo '</div>'; // second level of tabs |
| 31 | } // display |
| 32 | |
| 33 | static function tab_captcha() |
| 34 | { |
| 35 | $options = WPCaptcha_Setup::get_options(); |
| 36 | |
| 37 | echo '<div class="tab-content">'; |
| 38 | |
| 39 | echo '<table class="form-table"><tbody>'; |
| 40 | |
| 41 | $captcha = array(); |
| 42 | $captcha[] = array('val' => 'disabled', 'label' => 'Disabled'); |
| 43 | $captcha[] = array('val' => 'builtin', 'label' => 'Built-in Math Captcha'); |
| 44 | $captcha[] = array('val' => 'icons', 'label' => 'Built-in Icon Captcha', 'class' => 'pro-option'); |
| 45 | $captcha[] = array('val' => 'recaptchav2', 'label' => 'Google reCAPTCHA v2'); |
| 46 | $captcha[] = array('val' => 'recaptchav3', 'label' => 'Google reCAPTCHA v3'); |
| 47 | $captcha[] = array('val' => 'hcaptcha', 'label' => 'hCaptcha', 'class' => 'pro-option'); |
| 48 | $captcha[] = array('val' => 'cloudflare', 'label' => 'Cloudflare Turnstile', 'class' => 'pro-option'); |
| 49 | |
| 50 | echo '<tr valign="top"> |
| 51 | <th scope="row"><label for="captcha">Captcha</label></th> |
| 52 | <td><select id="captcha" name="' . esc_attr(WPCAPTCHA_OPTIONS_KEY) . '[captcha]">'; |
| 53 | WPCaptcha_Utility::create_select_options($captcha, $options['captcha']); |
| 54 | echo '</select>'; |
| 55 | echo '<br /><span>Captcha or "are you human" verification ensures bots can\'t attack your login page and provides additional protection with minimal impact to users.</span>'; |
| 56 | echo '</td></tr>'; |
| 57 | |
| 58 | echo '<tr class="captcha_keys_wrapper" style="display:none;" valign="top"> |
| 59 | <th scope="row"><label for="captcha_site_key">Captcha Site Key</label></th> |
| 60 | <td><input type="text" class="regular-text" id="captcha_site_key" name="' . esc_attr(WPCAPTCHA_OPTIONS_KEY) . '[captcha_site_key]" value="' . esc_html($options['captcha_site_key']) . '" data-old="' . esc_html($options['captcha_site_key']) . '" />'; |
| 61 | echo '</td></tr>'; |
| 62 | |
| 63 | echo '<tr class="captcha_keys_wrapper" style="display:none;" valign="top"> |
| 64 | <th scope="row"><label for="captcha_secret_key">Captcha Secret Key</label></th> |
| 65 | <td><input type="text" class="regular-text" id="captcha_secret_key" name="' . esc_attr(WPCAPTCHA_OPTIONS_KEY) . '[captcha_secret_key]" value="' . esc_html($options['captcha_secret_key']) . '" data-old="' . esc_html($options['captcha_secret_key']) . '" />'; |
| 66 | echo '</td></tr>'; |
| 67 | |
| 68 | echo '<tr class="captcha_verify_wrapper" style="display:none;" valign="top"> |
| 69 | <th scope="row"></th> |
| 70 | <td><button id="verify-captcha" class="button button-primary button-large button-yellow">Verify Captcha <i class="wpcaptcha-icon wpcaptcha-make-group"></i></button>'; |
| 71 | echo '<input type="hidden" class="regular-text" id="captcha_verified" name="' . esc_attr(WPCAPTCHA_OPTIONS_KEY) . '[captcha_verified]" value="0" />'; |
| 72 | echo '<br /><span>Click the Verify Captcha button to verify that the captcha is valid and working otherwise captcha settings will not be saved</span>'; |
| 73 | echo '</td></tr>'; |
| 74 | |
| 75 | echo '<tr><td></td><td>'; |
| 76 | WPCaptcha_admin::footer_save_button(); |
| 77 | echo '</td></tr>'; |
| 78 | |
| 79 | echo '<tr><td colspan="2">'; |
| 80 | echo '<div class="captcha-box-wrapper ' . ($options['captcha'] == 'disabled'?'captcha-selected':'') . '" data-captcha="disabled">'; |
| 81 | echo '<img src="' . esc_url(WPCAPTCHA_PLUGIN_URL) . '/images/captcha_disabled.png" />'; |
| 82 | echo '<div class="captcha-box-desc">'; |
| 83 | echo '<h3>Captcha Disabled</h3>'; |
| 84 | echo '<ul>'; |
| 85 | echo '<li>No Additional Security</li>'; |
| 86 | echo '</ul>'; |
| 87 | echo '</div>'; |
| 88 | echo '</div>'; |
| 89 | |
| 90 | echo '<div class="captcha-box-wrapper ' . ($options['captcha'] == 'builtin'?'captcha-selected':'') . '" data-captcha="builtin">'; |
| 91 | echo '<img src="' . esc_url(WPCAPTCHA_PLUGIN_URL) . '/images/captcha_builtin.png" />'; |
| 92 | echo '<div class="captcha-box-desc">'; |
| 93 | echo '<h3>Built-in Math Captcha</h3>'; |
| 94 | echo '<ul>'; |
| 95 | echo '<li>Medium Security</li>'; |
| 96 | echo '<li>No API keys</li>'; |
| 97 | echo '<li>No 3rd party services</li>'; |
| 98 | echo '<li>GDPR Compatible</li>'; |
| 99 | echo '</ul>'; |
| 100 | echo '</div>'; |
| 101 | echo '</div>'; |
| 102 | |
| 103 | echo '<div class="captcha-box-wrapper ' . ($options['captcha'] == 'icons'?'captcha-selected':'') . '" data-captcha="icons">'; |
| 104 | echo '<a title="This feature is available in the PRO version. Click for details." href="#" data-feature="recaptchav2" class="open-upsell pro-label">PRO</a>'; |
| 105 | echo '<img src="' . esc_url(WPCAPTCHA_PLUGIN_URL) . '/images/captcha_icons.png" />'; |
| 106 | echo '<div class="captcha-box-desc">'; |
| 107 | echo '<h3>Built-in Icon Captcha</h3>'; |
| 108 | echo '<ul>'; |
| 109 | echo '<li>Medium Security</li>'; |
| 110 | echo '<li>No API keys</li>'; |
| 111 | echo '<li>No 3rd party services</li>'; |
| 112 | echo '<li>GDPR Compatible</li>'; |
| 113 | echo '</ul>'; |
| 114 | echo '</div>'; |
| 115 | echo '</div>'; |
| 116 | |
| 117 | echo '<div class="captcha-box-wrapper ' . ($options['captcha'] == 'recaptchav2'?'captcha-selected':'') . '" data-captcha="recaptchav2">'; |
| 118 | echo '<img src="' . esc_url(WPCAPTCHA_PLUGIN_URL) . '/images/captcha_recaptcha_v2.png" />'; |
| 119 | echo '<div class="captcha-box-desc">'; |
| 120 | echo '<h3>Google reCaptcha v2</h3>'; |
| 121 | echo '<ul>'; |
| 122 | echo '<li>High Security</li>'; |
| 123 | echo '<li>Requires <a href="https://www.google.com/recaptcha/about/" target="_blank">API Keys</a></li>'; |
| 124 | echo '<li>Powered by Google</li>'; |
| 125 | echo '<li>Not GDPR Compatible</li>'; |
| 126 | echo '</ul>'; |
| 127 | echo '</div>'; |
| 128 | echo '</div>'; |
| 129 | |
| 130 | echo '<div class="captcha-box-wrapper ' . ($options['captcha'] == 'recaptchav3'?'captcha-selected':'') . '" data-captcha="recaptchav3">'; |
| 131 | echo '<img src="' . esc_url(WPCAPTCHA_PLUGIN_URL) . '/images/captcha_recaptcha_v3.png" />'; |
| 132 | echo '<div class="captcha-box-desc">'; |
| 133 | echo '<h3>Google reCaptcha v3</h3>'; |
| 134 | echo '<ul>'; |
| 135 | echo '<li>High Security</li>'; |
| 136 | echo '<li>Requires <a href="https://www.google.com/recaptcha/about/" target="_blank">API Keys</a></li>'; |
| 137 | echo '<li>Powered by Google</li>'; |
| 138 | echo '<li>Not GDPR Compatible</li>'; |
| 139 | echo '</ul>'; |
| 140 | echo '</div>'; |
| 141 | echo '</div>'; |
| 142 | |
| 143 | echo '<div class="captcha-box-wrapper ' . ($options['captcha'] == 'hcaptcha'?'captcha-selected':'') . '" data-captcha="hcaptcha">'; |
| 144 | echo '<a title="This feature is available in the PRO version. Click for details." href="#" data-feature="recaptchav2" class="open-upsell pro-label">PRO</a>'; |
| 145 | echo '<img src="' . esc_url(WPCAPTCHA_PLUGIN_URL) . '/images/captcha_hcaptcha.png" />'; |
| 146 | echo '<div class="captcha-box-desc">'; |
| 147 | echo '<h3>hCaptcha</h3>'; |
| 148 | echo '<ul>'; |
| 149 | echo '<li>High Security</li>'; |
| 150 | echo '<li>Requires <a href="https://www.hcaptcha.com/signup-interstitial" target="_blank">API Keys</a></li>'; |
| 151 | echo '<li>GDPR Compatible</li>'; |
| 152 | echo '<li>Best Choice</li>'; |
| 153 | echo '</ul>'; |
| 154 | echo '</div>'; |
| 155 | echo '</div>'; |
| 156 | |
| 157 | echo '<div class="captcha-box-wrapper ' . ($options['captcha'] == 'cloudflare'?'captcha-selected':'') . '" data-captcha="cloudflare">'; |
| 158 | echo '<a title="This feature is available in the PRO version. Click for details." href="#" data-feature="recaptchav2" class="open-upsell pro-label">PRO</a>'; |
| 159 | echo '<img src="' . esc_url(WPCAPTCHA_PLUGIN_URL) . '/images/captcha_cloudflare.png" />'; |
| 160 | echo '<div class="captcha-box-desc">'; |
| 161 | echo '<h3>Cloudflare Turnstile</h3>'; |
| 162 | echo '<ul>'; |
| 163 | echo '<li>High Security</li>'; |
| 164 | echo '<li>Requires <a href="https://dash.cloudflare.com/sign-up?to=/:account/turnstile" target="_blank">API Keys</a></li>'; |
| 165 | echo '<li>Not explicitly GDPR Compatible</li>'; |
| 166 | echo '<li>Powered by Cloudflare</li>'; |
| 167 | echo '</ul>'; |
| 168 | echo '</div>'; |
| 169 | echo '</div>'; |
| 170 | |
| 171 | |
| 172 | echo '</td></tr>'; |
| 173 | |
| 174 | echo '</tbody></table>'; |
| 175 | |
| 176 | echo '</div>'; |
| 177 | } // tab_captcha |
| 178 | |
| 179 | static function tab_captcha_location() |
| 180 | { |
| 181 | $options = WPCaptcha_Setup::get_options(); |
| 182 | |
| 183 | echo '<div class="tab-content">'; |
| 184 | |
| 185 | echo '<table class="form-table"><tbody>'; |
| 186 | |
| 187 | echo '<tr valign="top"> |
| 188 | <th scope="row"><label for="captcha_show_login">Login Form</label></th> |
| 189 | <td>'; |
| 190 | WPCaptcha_Utility::create_toggle_switch('captcha_show_login', array('saved_value' => $options['captcha_show_login'], 'option_key' => esc_attr(WPCAPTCHA_OPTIONS_KEY) . '[captcha_show_login]')); |
| 191 | echo '<br /><span>Applies to default login, WooCommerce, and Easy Digital Downloads login pages</span>'; |
| 192 | echo '</td></tr>'; |
| 193 | |
| 194 | echo '<tr valign="top"> |
| 195 | <th scope="row"><label for="captcha_show_wp_registration">Registration Form</label></th> |
| 196 | <td>'; |
| 197 | WPCaptcha_Utility::create_toggle_switch('captcha_show_wp_registration', array('saved_value' => $options['captcha_show_wp_registration'], 'option_key' => esc_attr(WPCAPTCHA_OPTIONS_KEY) . '[captcha_show_wp_registration]')); |
| 198 | echo '<br /><span>Show captcha on WordPress user registration form</span>'; |
| 199 | echo '</td></tr>'; |
| 200 | |
| 201 | echo '<tr valign="top"> |
| 202 | <th scope="row"><label for="captcha_show_wp_lost_password">Lost Password Form</label></th> |
| 203 | <td>'; |
| 204 | WPCaptcha_Utility::create_toggle_switch('captcha_show_wp_lost_password', array('saved_value' => $options['captcha_show_wp_lost_password'], 'option_key' => esc_attr(WPCAPTCHA_OPTIONS_KEY) . '[captcha_show_wp_lost_password]')); |
| 205 | echo '<br /><span>Show captcha on WordPress lost password form</span>'; |
| 206 | echo '</td></tr>'; |
| 207 | |
| 208 | echo '<tr valign="top"> |
| 209 | <th scope="row"><label for="captcha_show_wp_comment">Comment Form</label></th> |
| 210 | <td>'; |
| 211 | WPCaptcha_Utility::create_toggle_switch('captcha_show_wp_comment', array('saved_value' => $options['captcha_show_wp_comment'], 'option_key' => esc_attr(WPCAPTCHA_OPTIONS_KEY) . '[captcha_show_wp_comment]')); |
| 212 | echo '<br /><span>Show captcha on WordPress comments form</span>'; |
| 213 | echo '</td></tr>'; |
| 214 | |
| 215 | echo '<tr valign="top"> |
| 216 | <th scope="row"><label for="captcha_show_woo_registration">WooCommerce Registration Form</label></th> |
| 217 | <td>'; |
| 218 | WPCaptcha_Utility::create_toggle_switch('captcha_show_woo_registration', array('saved_value' => $options['captcha_show_woo_registration'], 'option_key' => esc_attr(WPCAPTCHA_OPTIONS_KEY) . '[captcha_show_woo_registration]')); |
| 219 | echo '<br /><span>Show captcha on WooCommerce registration form</span>'; |
| 220 | echo '</td></tr>'; |
| 221 | |
| 222 | echo '<tr valign="top"> |
| 223 | <th scope="row"><label for="captcha_show_woo_checkout">WooCommerce Checkout Form</label></th> |
| 224 | <td>'; |
| 225 | WPCaptcha_Utility::create_toggle_switch('captcha_show_woo_checkout', array('saved_value' => $options['captcha_show_woo_checkout'], 'option_key' => esc_attr(WPCAPTCHA_OPTIONS_KEY) . '[captcha_show_woo_checkout]')); |
| 226 | echo '<br /><span>Show captcha on WooCommerce checkout form</span>'; |
| 227 | echo '</td></tr>'; |
| 228 | |
| 229 | echo '<tr valign="top"> |
| 230 | <th scope="row"><label for="captcha_show_edd_registration">Easy Digital Downloads Registration Form</label></th> |
| 231 | <td>'; |
| 232 | WPCaptcha_Utility::create_toggle_switch('captcha_show_edd_registration', array('saved_value' => $options['captcha_show_edd_registration'], 'option_key' => esc_attr(WPCAPTCHA_OPTIONS_KEY) . '[captcha_show_edd_registration]')); |
| 233 | echo '<br /><span>Show captcha on Easy Digital Downloads registration form</span>'; |
| 234 | echo '</td></tr>'; |
| 235 | |
| 236 | echo '<tr valign="top"> |
| 237 | <th scope="row"><label for="captcha_show_bp_registration">BuddyPress Registration Form</label></th> |
| 238 | <td>'; |
| 239 | WPCaptcha_Utility::create_toggle_switch('captcha_show_bp_registration', array('saved_value' => $options['captcha_show_bp_registration'], 'option_key' => esc_attr(WPCAPTCHA_OPTIONS_KEY) . '[captcha_show_bp_registration]')); |
| 240 | echo '<br /><span>Show captcha on BuddyPress registration form</span>'; |
| 241 | echo '</td></tr>'; |
| 242 | |
| 243 | echo '<tr><td></td><td>'; |
| 244 | WPCaptcha_admin::footer_save_button(); |
| 245 | echo '</td></tr>'; |
| 246 | |
| 247 | echo '</tbody></table>'; |
| 248 | |
| 249 | echo '</div>'; |
| 250 | } // tab_captcha_location |
| 251 | } // class WPCaptcha_Tab_Captcha |
| 252 |