PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.5.4
JetFormBuilder — Dynamic Blocks Form Builder v3.5.4
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / modules / captcha / friendly-captcha / verify-token-action.php
jetformbuilder / modules / captcha / friendly-captcha Last commit date
friendly-captcha.php 1 year ago verify-token-action.php 1 year ago
verify-token-action.php
76 lines
1 <?php
2
3
4 namespace JFB_Modules\Captcha\Friendly_Captcha;
5
6 use Jet_Form_Builder\Exceptions\Gateway_Exception;
7 use JFB_Modules\Gateways\Actions_Abstract\Action_Application_Raw_Body_It;
8 use JFB_Modules\Gateways\Base_Gateway_Action;
9
10 class Verify_Token_Action extends Base_Gateway_Action implements
11 Action_Application_Raw_Body_It {
12
13 private $secret;
14 private $solution;
15 private $site_key;
16
17 public function action_endpoint() {
18 return 'siteverify';
19 }
20
21 public function base_url(): string {
22 return 'https://api.friendlycaptcha.com/api/v1/';
23 }
24
25 public function send_request() {
26 $response = parent::send_request();
27
28 if ( ! empty( $response['success'] ) ) {
29 return $response;
30 }
31
32 // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
33 throw new Gateway_Exception( Module::SPAM_EXCEPTION, $response, $this->get_request_args() );
34 }
35
36 /**
37 * @throws Gateway_Exception
38 */
39 public function before_make_request() {
40 if ( $this->solution && $this->secret && $this->site_key ) {
41 return;
42 }
43
44 // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
45 throw new Gateway_Exception( Module::SPAM_EXCEPTION, 'Empty solution. Spammer detected' );
46 }
47
48 public function set_secret( string $secret ): Verify_Token_Action {
49 $this->secret = $secret;
50
51 return $this;
52 }
53
54 public function set_solution( string $solution ): Verify_Token_Action {
55 $this->solution = $solution;
56
57 return $this;
58 }
59
60 public function set_site_key( string $key ): Verify_Token_Action {
61 $this->site_key = $key;
62
63 return $this;
64 }
65
66
67 public function action_body() {
68 return array(
69 'secret' => $this->secret,
70 'solution' => $this->solution,
71 'sitekey' => $this->site_key,
72 );
73 }
74
75 }
76