verify-token-action.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace JFB_Modules\Captcha\Hcaptcha; |
| 5 | |
| 6 | use Jet_Form_Builder\Exceptions\Gateway_Exception; |
| 7 | use JFB_Modules\Captcha\Re_Captcha_V3\Verify_Token_Action as BaseVerify; |
| 8 | |
| 9 | class Verify_Token_Action extends BaseVerify { |
| 10 | |
| 11 | public function base_url(): string { |
| 12 | return 'https://hcaptcha.com/'; |
| 13 | } |
| 14 | |
| 15 | public function send_request() { |
| 16 | $this->request(); |
| 17 | $this->response_body_as_array(); |
| 18 | |
| 19 | $response = $this->get_response_body(); |
| 20 | |
| 21 | if ( ! empty( $response['success'] ) ) { |
| 22 | return $response; |
| 23 | } |
| 24 | |
| 25 | // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped |
| 26 | throw new Gateway_Exception( Module::SPAM_EXCEPTION ); |
| 27 | } |
| 28 | |
| 29 | } |
| 30 |