PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.4.2
JetFormBuilder — Dynamic Blocks Form Builder v3.6.4.2
3.6.5 3.6.4.2 3.6.4.1 3.6.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 2 months ago verify-token-action.php 2 months ago
verify-token-action.php
77 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\Captcha\Module;
8 use JFB_Modules\Gateways\Actions_Abstract\Action_Application_Raw_Body_It;
9 use JFB_Modules\Gateways\Base_Gateway_Action;
10
11 class Verify_Token_Action extends Base_Gateway_Action implements
12 Action_Application_Raw_Body_It {
13
14 private $secret;
15 private $solution;
16 private $site_key;
17
18 public function action_endpoint() {
19 return 'siteverify';
20 }
21
22 public function base_url(): string {
23 return 'https://api.friendlycaptcha.com/api/v1/';
24 }
25
26 public function send_request() {
27 $response = parent::send_request();
28
29 if ( ! empty( $response['success'] ) ) {
30 return $response;
31 }
32
33 // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
34 throw new Gateway_Exception( Module::SPAM_EXCEPTION, $response, $this->get_request_args() );
35 }
36
37 /**
38 * @throws Gateway_Exception
39 */
40 public function before_make_request() {
41 if ( $this->solution && $this->secret && $this->site_key ) {
42 return;
43 }
44
45 // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
46 throw new Gateway_Exception( Module::SPAM_EXCEPTION, 'Empty solution. Spammer detected' );
47 }
48
49 public function set_secret( string $secret ): Verify_Token_Action {
50 $this->secret = $secret;
51
52 return $this;
53 }
54
55 public function set_solution( string $solution ): Verify_Token_Action {
56 $this->solution = $solution;
57
58 return $this;
59 }
60
61 public function set_site_key( string $key ): Verify_Token_Action {
62 $this->site_key = $key;
63
64 return $this;
65 }
66
67
68 public function action_body() {
69 return array(
70 'secret' => $this->secret,
71 'solution' => $this->solution,
72 'sitekey' => $this->site_key,
73 );
74 }
75
76 }
77