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 +37 -3 5.7.2 → 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,9 +59,9 @@
59 59 * @return array
60 60 */
61 61 private function get_types(): array {
62 62 return array(
63 - 'all' => esc_html__( 'All', 'defender-security' ),
63 + 'all' => esc_html__( 'Any', 'defender-security' ),
64 64 Lockout_Log::AUTH_FAIL => esc_html__( 'Failed login attempts', 'defender-security' ),
65 65 Lockout_Log::AUTH_LOCK => esc_html__( 'Login lockout', 'defender-security' ),
66 66 Lockout_Log::ERROR_404 => esc_html__( '404 error', 'defender-security' ),
67 67 Lockout_Log::LOCKOUT_404 => esc_html__( '404 lockout', 'defender-security' ),
@@ -87,9 +87,9 @@
87 87 * @return array
88 88 */
89 89 private function ban_status(): array {
90 90 return array(
91 - 'all' => esc_html__( 'All', 'defender-security' ),
91 + 'all' => esc_html__( 'Any', 'defender-security' ),
92 92 self::STATUS_NOT_BAN => esc_html__( 'Not Banned', 'defender-security' ),
93 93 self::STATUS_BAN => esc_html__( 'Banned', 'defender-security' ),
94 94 self::STATUS_ALLOWLIST => esc_html__( 'Allowlisted', 'defender-security' ),
95 95 );
@@ -128,8 +128,9 @@
128 128 * @return array An associative array of pagination limits.
129 129 */
130 130 private function limit_per_page(): array {
131 131 return array(
132 + self::LIMIT_10 => '10',
132 133 self::LIMIT_20 => '20',
133 134 self::LIMIT_50 => '50',
134 135 self::LIMIT_100 => '100',
135 136 self::LIMIT_ALL => esc_html__( 'All', 'defender-security' ),
@@ -147,6 +148,39 @@
147 148 'ban_status' => $this->ban_status(),
148 149 'sort_values' => $this->sort_values(),
149 150 'limit_logs' => $this->limit_per_page(),
150 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 + }
151 185 }
152 186 }