PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.1.8
JetFormBuilder — Dynamic Blocks Form Builder v3.1.8
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 / security / module.php
jetformbuilder / modules / security Last commit date
csrf 2 years ago exceptions 2 years ago honeypot 2 years ago wp-nonce 2 years ago module.php 2 years ago
module.php
81 lines
1 <?php
2
3
4 namespace JFB_Modules\Security;
5
6 use JFB_Modules\Logger;
7 use JFB_Components\Module\Base_Module_After_Install_It;
8 use JFB_Components\Module\Base_Module_Dir_It;
9 use JFB_Components\Module\Base_Module_Dir_Trait;
10 use JFB_Components\Module\Base_Module_Handle_It;
11 use JFB_Components\Module\Base_Module_Handle_Trait;
12 use JFB_Components\Module\Base_Module_It;
13 use JFB_Components\Module\Base_Module_Url_It;
14 use JFB_Components\Module\Base_Module_Url_Trait;
15 use JFB_Modules\Security\Exceptions\Spam_Exception;
16 use JFB_Modules\Security\Csrf;
17 use JFB_Modules\Security\Honeypot;
18 use JFB_Modules\Security\Wp_Nonce;
19
20 // If this file is called directly, abort.
21 if ( ! defined( 'WPINC' ) ) {
22 die;
23 }
24
25 class Module implements
26 Base_Module_It,
27 Base_Module_Url_It,
28 Base_Module_Dir_It,
29 Base_Module_After_Install_It,
30 Base_Module_Handle_It {
31
32 use Base_Module_Handle_Trait;
33 use Base_Module_Url_Trait;
34 use Base_Module_Dir_Trait;
35
36 private $spam_statuses = array();
37
38 public function rep_item_id() {
39 return 'security';
40 }
41
42 public function on_install() {
43 $this->spam_statuses = apply_filters(
44 'jet-form-builder/security/spam-statuses',
45 array()
46 );
47
48 jet_form_builder()->get_modules()->install( new Csrf\Module() );
49 jet_form_builder()->get_modules()->install( new Honeypot\Module() );
50 jet_form_builder()->get_modules()->install( new Wp_Nonce\Module() );
51 }
52
53 public function on_uninstall() {
54 $this->spam_statuses = array();
55
56 jet_form_builder()->get_modules()->uninstall( new Csrf\Module() );
57 jet_form_builder()->get_modules()->uninstall( new Honeypot\Module() );
58 jet_form_builder()->get_modules()->uninstall( new Wp_Nonce\Module() );
59 }
60
61 public function condition(): bool {
62 return true;
63 }
64
65 public function init_hooks() {
66 }
67
68 public function remove_hooks() {
69 }
70
71 public function has_spam(): bool {
72 $status = jet_fb_handler()->response_args['status'] ?? '';
73
74 return (
75 in_array( $status, $this->spam_statuses, true ) ||
76 Logger\Module::instance()->has_log( Spam_Exception::class )
77 );
78 }
79
80 }
81