Skip to content

Commit 78e4597

Browse files
committed
Merge branch 'trunk' into stable
2 parents 5cb721e + 71d671f commit 78e4597

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+611
-446
lines changed

core/admin/class-admin.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function dashboard_widget() {
6767
<div style="background-color: #f6f7f7; padding: 25px; margin-bottom: 20px; border-left: 4px solid #72aee6;">
6868
<h3>
6969
<?php
70-
echo sprintf(
70+
printf(
7171
wp_kses(
7272
/* translators: %s: Zero Spam API link */
7373
__( '<strong>Super-charge WordPress Zero Spam with a <a href="%s" target="_blank" rel="noopener noreferrer">Zero Spam API License</a>.</strong>', 'zero-spam' ),
@@ -85,7 +85,7 @@ public function dashboard_widget() {
8585
?>
8686
</h3>
8787
<?php
88-
echo sprintf(
88+
printf(
8989
wp_kses(
9090
/* translators: %s: Zero Spam API link */
9191
__( '<p><strong>Enable enhanced protection</strong> and super-charge your site with the power of a global detection network that monitors traffic and usage in real-time to detect malicious activity.</p>', 'zero-spam' ),
@@ -133,7 +133,7 @@ public function admin_notices() {
133133
'content' => sprintf(
134134
wp_kses(
135135
/* translators: %1$s: Replaced with the Zero Spam settings page URL */
136-
__( 'Zero Spam Enhanced Protection is currenlty enabled, but <strong>missing a valid license key</strong>. <a href="%1$s">Add your license key</a> to enable enhanced site protection.', 'zero-spam' ),
136+
__( 'Zero Spam Enhanced Protection is currently enabled, but <strong>missing a valid license key</strong>. <a href="%1$s">Add your license key</a> to enable enhanced site protection.', 'zero-spam' ),
137137
array(
138138
'strong' => array(),
139139
'a' => array(

core/admin/class-dashboard.php

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ public function block_ip() {
8181
$record['start_block'] = sanitize_text_field( $_POST['blocked_start_date'] );
8282
$record['end_block'] = sanitize_text_field( $_POST['blocked_end_date'] );
8383

84-
8584
if ( ! empty( $record['user_ip'] ) && ! rest_is_ip_address( $record['user_ip'] ) ) {
8685
wp_redirect( $base_admin_link . '&subview=' . $subview . '&zerospam-type=error&zerospam-msg=Invalid IP address.' );
8786
exit;
@@ -107,7 +106,7 @@ public function block_ip() {
107106
$record['end_block'] = gmdate( 'Y-m-d G:i:s', strtotime( $record['end_block'] ) );
108107
}
109108

110-
if ( 'temporary' === $record['blocked_type'] && ! $record['end_block'] ) {
109+
if ( 'temporary' === $record['blocked_type'] && ! $record['end_block'] ) {
111110
wp_redirect( $base_admin_link . '&subview=' . $subview . '&zerospam-type=error&zerospam-msg=Missing block end date.' );
112111
exit;
113112
}
@@ -121,7 +120,7 @@ public function block_ip() {
121120
\ZeroSpam\Core\Utilities::refresh_htaccess();
122121

123122
wp_redirect( $base_admin_link . '&subview=' . $subview . '&zerospam-type=success&zerospam-msg=Record has been successfully added/updated.' );
124-
exit;
123+
exit;
125124
}
126125

127126
/**
@@ -158,25 +157,49 @@ public function dashboard_page() {
158157
<div class="zerospam-dashboard__col">
159158
<ul class="zerospam-dashboard__sections">
160159
<li>
161-
<a href="<?php echo esc_url( admin_url( "$base_admin_link&subview=reports" ) ); ?>" class="zerospam-dashboard__menu-link <?php if ( 'reports' === $subview ) : echo 'zerospam-dashboard__menu-link--active'; endif; ?>">
160+
<a href="<?php echo esc_url( admin_url( "$base_admin_link&subview=reports" ) ); ?>" class="zerospam-dashboard__menu-link
161+
<?php
162+
if ( 'reports' === $subview ) :
163+
echo 'zerospam-dashboard__menu-link--active';
164+
endif;
165+
?>
166+
">
162167
<img src="<?php echo plugin_dir_url( ZEROSPAM ); ?>assets/img/icon-reports.svg" class="zerospam-dashboard__menu-icon" />
163168
<?php esc_html_e( 'Dashboard', 'zero-spam' ); ?>
164169
</a>
165170
</li>
166171
<li>
167-
<a href="<?php echo esc_url( admin_url( "$base_admin_link&subview=log" ) ); ?>" class="zerospam-dashboard__menu-link <?php if ( 'log' === $subview ) : echo 'zerospam-dashboard__menu-link--active'; endif; ?>">
172+
<a href="<?php echo esc_url( admin_url( "$base_admin_link&subview=log" ) ); ?>" class="zerospam-dashboard__menu-link
173+
<?php
174+
if ( 'log' === $subview ) :
175+
echo 'zerospam-dashboard__menu-link--active';
176+
endif;
177+
?>
178+
">
168179
<img src="<?php echo plugin_dir_url( ZEROSPAM ); ?>assets/img/icon-log.svg" class="zerospam-dashboard__menu-icon" />
169180
<?php esc_html_e( 'Log', 'zero-spam' ); ?>
170181
</a>
171182
</li>
172183
<li>
173-
<a href="<?php echo esc_url( admin_url( "$base_admin_link&subview=blocked-ips" ) ); ?>" class="zerospam-dashboard__menu-link <?php if ( 'blocked-ips' === $subview ) : echo 'zerospam-dashboard__menu-link--active'; endif; ?>">
184+
<a href="<?php echo esc_url( admin_url( "$base_admin_link&subview=blocked-ips" ) ); ?>" class="zerospam-dashboard__menu-link
185+
<?php
186+
if ( 'blocked-ips' === $subview ) :
187+
echo 'zerospam-dashboard__menu-link--active';
188+
endif;
189+
?>
190+
">
174191
<img src="<?php echo plugin_dir_url( ZEROSPAM ); ?>assets/img/icon-blocked.svg" class="zerospam-dashboard__menu-icon" />
175192
<?php esc_html_e( 'Blocked IPs', 'zero-spam' ); ?>
176193
</a>
177194
</li>
178195
<li>
179-
<a href="<?php echo esc_url( admin_url( "$base_admin_link&subview=blocked-locations" ) ); ?>" class="zerospam-dashboard__menu-link <?php if ( 'blocked-locations' === $subview ) : echo 'zerospam-dashboard__menu-link--active'; endif; ?>">
196+
<a href="<?php echo esc_url( admin_url( "$base_admin_link&subview=blocked-locations" ) ); ?>" class="zerospam-dashboard__menu-link
197+
<?php
198+
if ( 'blocked-locations' === $subview ) :
199+
echo 'zerospam-dashboard__menu-link--active';
200+
endif;
201+
?>
202+
">
180203
<img src="<?php echo plugin_dir_url( ZEROSPAM ); ?>assets/img/icon-location.svg" class="zerospam-dashboard__menu-icon" />
181204
<?php esc_html_e( 'Blocked Locations', 'zero-spam' ); ?>
182205
</a>
@@ -189,7 +212,7 @@ public function dashboard_page() {
189212
</div>
190213
<div class="zerospam-dashboard__col">
191214
<?php if ( ! empty( $_REQUEST['zerospam-msg'] ) ) : ?>
192-
<div class="zerospam-block zerospam-block--notice zerospam-block--<?php echo ! empty( $_REQUEST['zerospam-type'] ) ? esc_attr( $_REQUEST['zerospam-type'] ) : 'default' ?>">
215+
<div class="zerospam-block zerospam-block--notice zerospam-block--<?php echo ! empty( $_REQUEST['zerospam-type'] ) ? esc_attr( $_REQUEST['zerospam-type'] ) : 'default'; ?>">
193216
<div class="zerospam-block__content">
194217
<?php echo sanitize_text_field( wp_unslash( $_REQUEST['zerospam-msg'] ) ); ?>
195218
</div>
@@ -303,13 +326,13 @@ public function dashboard_page() {
303326
case 'blocked-ips':
304327
$block_method = \ZeroSpam\Core\Settings::get_settings( 'block_method' );
305328
if ( ! empty( $block_method ) && 'php' !== $block_method ) :
306-
echo sprintf(
329+
printf(
307330
wp_kses(
308331
/* translators: %s: url */
309332
__( '<p>When using .htaccess &amp; due to <a href="%s" target="_blank" rel="noreferrer noopener">character limit restrictions</a>, <strong>no more than 170 blocked IP addresses recommended</strong>.</p>', 'zero-spam' ),
310333
array(
311334
'strong' => array(),
312-
'a' => array(
335+
'a' => array(
313336
'target' => array(),
314337
'href' => array(),
315338
'rel' => array(),
@@ -331,15 +354,15 @@ public function dashboard_page() {
331354
</form>
332355
<?php
333356
break;
334-
case 'blocked-locations':
335-
if (
336-
! \ZeroSpam\Core\Settings::get_settings( 'ipstack_api' ) &&
337-
! \ZeroSpam\Core\Settings::get_settings( 'ipinfo_access_token' )
338-
) :
339-
?>
357+
case 'blocked-locations':
358+
if (
359+
! \ZeroSpam\Core\Settings::get_settings( 'ipstack_api' ) &&
360+
! \ZeroSpam\Core\Settings::get_settings( 'ipinfo_access_token' )
361+
) :
362+
?>
340363
<div class="zerospam-block zerospam-block--error">
341364
<div class="zerospam-block__content">
342-
<?php _e( '<strong>Blocking locations is currently disabled.</strong> A valid ipstack API key or IPinfo access token is required.', 'zero-spam' ); ?>
365+
<?php _e( '<strong>Blocking locations is currently disabled.</strong> A valid ipstack API key or IPinfo access token is required.', 'zero-spam' ); ?>
343366
</div>
344367
</div>
345368
<?php endif; ?>
@@ -348,10 +371,10 @@ public function dashboard_page() {
348371
$table_data->prepare_items();
349372
?>
350373
<form class="zerospam-table-form" method="post">
351-
<?php wp_nonce_field( 'zerospam_nonce', 'zerospam_nonce' ); ?>
374+
<?php wp_nonce_field( 'zerospam_nonce', 'zerospam_nonce' ); ?>
352375
<input type="hidden" name="paged" value="1" />
353-
<?php $table_data->search_box( __( 'Search IPs', 'zero-spam' ), 'search-ip' ); ?>
354-
<?php $table_data->display(); ?>
376+
<?php $table_data->search_box( __( 'Search IPs', 'zero-spam' ), 'search-ip' ); ?>
377+
<?php $table_data->display(); ?>
355378
</form>
356379
<?php
357380
break;

0 commit comments

Comments
 (0)