PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.5.2
JetFormBuilder — Dynamic Blocks Form Builder v3.6.5.2
3.6.5.2 3.6.5.1 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 / security / module.php
jetformbuilder / modules / security Last commit date
csrf 1 month ago exceptions 2 years ago honeypot 1 month ago wp-nonce 2 months ago module.php 4 days ago restricted-preset-notice.php 4 days ago
module.php
105 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 /**
39 * @var Restricted_Preset_Notice
40 */
41 private $restricted_preset_notice;
42
43 public function rep_item_id() {
44 return 'security';
45 }
46
47 public function on_install() {
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 $this->spam_statuses = apply_filters(
53 'jet-form-builder/security/spam-statuses',
54 array()
55 );
56 }
57
58 public function on_uninstall() {
59 jet_form_builder()->get_modules()->uninstall( new Csrf\Module() );
60 jet_form_builder()->get_modules()->uninstall( new Honeypot\Module() );
61 jet_form_builder()->get_modules()->uninstall( new Wp_Nonce\Module() );
62
63 $this->spam_statuses = array();
64 }
65
66 public function condition(): bool {
67 return true;
68 }
69
70 public function init_hooks() {
71 $this->restricted_preset_notice = new Restricted_Preset_Notice();
72 $this->restricted_preset_notice->init_hooks();
73 }
74
75 public function remove_hooks() {
76 if ( $this->restricted_preset_notice ) {
77 $this->restricted_preset_notice->remove_hooks();
78 }
79 }
80
81 public function has_spam(): bool {
82 $status = jet_fb_handler()->response_args['status'] ?? '';
83
84 return (
85 in_array( $status, $this->spam_statuses, true ) ||
86 Logger\Module::instance()->has_log( Spam_Exception::class )
87 );
88 }
89
90 public static function get_hasher(): \PasswordHash {
91 global $wp_hasher;
92
93 if ( ! empty( $wp_hasher ) ) {
94 return $wp_hasher;
95 }
96
97 require_once ABSPATH . WPINC . '/class-phpass.php';
98 // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
99 $wp_hasher = new \PasswordHash( 8, true );
100
101 return $wp_hasher;
102 }
103
104 }
105