PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.3.0
Defender Security – Malware Scanner, Login Security & Firewall v6.3.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
← All changes | src/controller/class-login-lockout.php +6 -5 5.4.0 → 6.3.0 View file →
@@ -11,8 +11,9 @@
11 11 use WP_Defender\Traits\IP;
12 12 use Calotes\Component\Request;
13 13 use Calotes\Component\Response;
14 14 use WP_Defender\Traits\Setting;
15 +use WP_Defender\Model\Lockout_Log;
15 16 use WP_Defender\Component\Blacklist_Lockout;
16 17 use WP_Defender\Component\Config\Config_Hub_Helper;
17 18 use WP_Defender\Model\Setting\Login_Lockout as Model_Login_Lockout;
18 19
@@ -69,9 +70,9 @@
69 70 * @defender_route
70 71 */
71 72 public function save_settings( Request $request ) {
72 73 $data = $request->get_data_by_model( $this->model );
73 - $old_enabled = (bool) $this->model->enabled;
74 + $old_enabled = $this->model->enabled;
74 75 $prev_data = $this->model->export();
75 76
76 77 $this->model->import( $data );
77 78 if ( $this->model->validate() ) {
@@ -117,9 +118,8 @@
117 118 public function enqueue_assets() {
118 119 if ( ! $this->is_page_active() ) {
119 120 return;
120 121 }
121 - wp_localize_script( 'def-iplockout', 'login_lockout', $this->data_frontend() );
122 122 }
123 123
124 124 /**
125 125 * Provides data for the frontend.
@@ -130,10 +130,11 @@
130 130 return array_merge(
131 131 array(
132 132 'model' => $this->model->export(),
133 133 'misc' => array(
134 - 'host' => defender_get_hostname(),
135 - 'module_name' => Model_Login_Lockout::get_module_name(),
134 + 'host' => defender_get_hostname(),
135 + 'module_name' => Model_Login_Lockout::get_module_name(),
136 + 'lockouts_24h' => (int) Lockout_Log::count( strtotime( '-24 hours' ), time(), Lockout_Log::AUTH_LOCK ),
136 137 ),
137 138 ),
138 139 $this->dump_routes_and_nonces()
139 140 );
@@ -190,9 +191,9 @@
190 191 *
191 192 * @param array $data Data to be imported into the model.
192 193 */
193 194 public function import_data( array $data ) {
194 - if ( ! empty( $data ) ) {
195 + if ( array() !== $data ) {
195 196 // Upgrade for old versions.
196 197 $data = $this->adapt_data( $data );
197 198 $model = $this->model;
198 199 $model->import( $data );