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/component/class-table-lockout.php +54 -11 5.3.1 → 6.3.0 View file →
@@ -20,9 +20,9 @@
20 20 use Formats;
21 21
22 22 public const STATUS_BAN = 'ban', STATUS_NOT_BAN = 'not_ban', STATUS_ALLOWLIST = 'allowlist';
23 23 public const SORT_DESC = 'latest', SORT_ASC = 'oldest', SORT_BY_IP = 'ip', SORT_BY_UA = 'user_agent';
24 - public const LIMIT_20 = '20', LIMIT_50 = '50', LIMIT_100 = '100', LIMIT_ALL = '-1';
24 + public const LIMIT_10 = '10', LIMIT_20 = '20', LIMIT_50 = '50', LIMIT_100 = '100', LIMIT_ALL = '-1';
25 25
26 26 /**
27 27 * Retrieves the status text for a given IP address.
28 28 *
@@ -59,17 +59,26 @@
59 59 * @return array
60 60 */
61 61 private function get_types(): array {
62 62 return array(
63 - 'all' => esc_html__( 'All', 'defender-security' ),
64 - Lockout_Log::AUTH_FAIL => esc_html__( 'Failed login attempts', 'defender-security' ),
65 - Lockout_Log::AUTH_LOCK => esc_html__( 'Login lockout', 'defender-security' ),
66 - Lockout_Log::ERROR_404 => esc_html__( '404 error', 'defender-security' ),
67 - Lockout_Log::LOCKOUT_404 => esc_html__( '404 lockout', 'defender-security' ),
68 - Lockout_Log::LOCKOUT_UA => esc_html__( 'User Agent Lockout', 'defender-security' ),
69 - // New IP Lockout type since 5.3.0.
70 - Lockout_Log::LOCKOUT_IP_CUSTOM => esc_html__( 'Custom IP Lockout', 'defender-security' ),
71 - Lockout_Log::IP_UNLOCK => esc_html__( 'IP Unlock', 'defender-security' ),
63 + 'all' => esc_html__( 'Any', 'defender-security' ),
64 + Lockout_Log::AUTH_FAIL => esc_html__( 'Failed login attempts', 'defender-security' ),
65 + Lockout_Log::AUTH_LOCK => esc_html__( 'Login lockout', 'defender-security' ),
66 + Lockout_Log::ERROR_404 => esc_html__( '404 error', 'defender-security' ),
67 + Lockout_Log::LOCKOUT_404 => esc_html__( '404 lockout', 'defender-security' ),
68 + Lockout_Log::LOCKOUT_UA => esc_html__( 'User Agent Lockout', 'defender-security' ),
69 + Lockout_Log::LOCKOUT_MALICIOUS_BOT => esc_html__( 'Malicious Bot Lockout', 'defender-security' ),
70 + Lockout_Log::LOCKOUT_FAKE_BOT => esc_html__( 'Fake Bot Lockout', 'defender-security' ),
71 + // New types since 5.3.0.
72 + Lockout_Log::LOCKOUT_IP_CUSTOM => esc_html__( 'Custom IP Lockout', 'defender-security' ),
73 + Lockout_Log::IP_UNLOCK => esc_html__( 'IP Unlock', 'defender-security' ),
74 + // New types since 5.7.0.
75 + Lockout_Log::ERROR_404_XSS => esc_html__( 'XSS attempt', 'defender-security' ),
76 + Lockout_Log::LOCKOUT_404_XSS => esc_html__( 'XSS lockout', 'defender-security' ),
77 + Lockout_Log::ERROR_404_NON_EXISTENT_THEME => esc_html__( 'Attempt to access non-installed theme', 'defender-security' ),
78 + Lockout_Log::LOCKOUT_404_NON_EXISTENT_THEME => esc_html__( 'Non-installed theme lockout', 'defender-security' ),
79 + Lockout_Log::ERROR_404_NON_EXISTENT_PLUGIN => esc_html__( 'Attempt to access non-installed plugin', 'defender-security' ),
80 + Lockout_Log::LOCKOUT_404_NON_EXISTENT_PLUGIN => esc_html__( 'Non-installed plugin lockout', 'defender-security' ),
72 81 );
73 82 }
74 83
75 84 /**
@@ -78,9 +87,9 @@
78 87 * @return array
79 88 */
80 89 private function ban_status(): array {
81 90 return array(
82 - 'all' => esc_html__( 'All', 'defender-security' ),
91 + 'all' => esc_html__( 'Any', 'defender-security' ),
83 92 self::STATUS_NOT_BAN => esc_html__( 'Not Banned', 'defender-security' ),
84 93 self::STATUS_BAN => esc_html__( 'Banned', 'defender-security' ),
85 94 self::STATUS_ALLOWLIST => esc_html__( 'Allowlisted', 'defender-security' ),
86 95 );
@@ -119,8 +128,9 @@
119 128 * @return array An associative array of pagination limits.
120 129 */
121 130 private function limit_per_page(): array {
122 131 return array(
132 + self::LIMIT_10 => '10',
123 133 self::LIMIT_20 => '20',
124 134 self::LIMIT_50 => '50',
125 135 self::LIMIT_100 => '100',
126 136 self::LIMIT_ALL => esc_html__( 'All', 'defender-security' ),
@@ -138,6 +148,39 @@
138 148 'ban_status' => $this->ban_status(),
139 149 'sort_values' => $this->sort_values(),
140 150 'limit_logs' => $this->limit_per_page(),
141 151 );
152 + }
153 +
154 + /**
155 + * Resolves sorting parameters based on the provided sort key.
156 + *
157 + * @param string $sort The sort key.
158 + *
159 + * @return array An associative array containing 'order' and 'order_by' keys.
160 + */
161 + public function resolve_sort( string $sort ): array {
162 + switch ( $sort ) {
163 + case self::SORT_BY_IP:
164 + return array(
165 + 'order' => 'desc',
166 + 'order_by' => 'ip',
167 + );
168 + case self::SORT_ASC:
169 + return array(
170 + 'order' => 'asc',
171 + 'order_by' => 'id',
172 + );
173 + case self::SORT_BY_UA:
174 + return array(
175 + 'order' => 'asc',
176 + 'order_by' => 'user_agent',
177 + );
178 + case self::SORT_DESC:
179 + default:
180 + return array(
181 + 'order' => 'desc',
182 + 'order_by' => 'id',
183 + );
184 + }
142 185 }
143 186 }