active-campaign-handler.php
3 years ago
base-handler.php
3 years ago
captcha-handler.php
3 years ago
get-response-handler.php
3 years ago
mailchimp-handler.php
3 years ago
options-handler.php
3 years ago
payments-gateways-handler.php
3 years ago
paypal-handler.php
3 years ago
tab-handler-manager.php
3 years ago
captcha-handler.php
42 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace Jet_Form_Builder\Admin\Tabs_Handlers; |
| 5 | |
| 6 | class Captcha_Handler extends Base_Handler { |
| 7 | |
| 8 | const OPTIONS = array( |
| 9 | 'secret' => '', |
| 10 | 'key' => '', |
| 11 | 'threshold' => 0.5, |
| 12 | ); |
| 13 | |
| 14 | public function slug() { |
| 15 | return 'captcha-tab'; |
| 16 | } |
| 17 | |
| 18 | public function on_get_request() { |
| 19 | // phpcs:disable WordPress.Security.NonceVerification.Missing |
| 20 | $secret = sanitize_text_field( wp_unslash( $_POST['secret'] ?? '' ) ); |
| 21 | $key = sanitize_text_field( wp_unslash( $_POST['key'] ?? '' ) ); |
| 22 | $threshold = filter_var( wp_unslash( $_POST['threshold'] ?? '' ), FILTER_VALIDATE_FLOAT ); |
| 23 | // phpcs:enable WordPress.Security.NonceVerification.Missing |
| 24 | |
| 25 | $threshold = false === $threshold ? self::OPTIONS['threshold'] : $threshold; |
| 26 | |
| 27 | $result = $this->update_options( |
| 28 | array( |
| 29 | 'secret' => $secret, |
| 30 | 'key' => $key, |
| 31 | 'threshold' => $threshold |
| 32 | ) |
| 33 | ); |
| 34 | |
| 35 | $this->send_response( $result ); |
| 36 | } |
| 37 | |
| 38 | public function on_load() { |
| 39 | return $this->get_options( self::OPTIONS ); |
| 40 | } |
| 41 | } |
| 42 |