Skip to content

Commit e7dde2c

Browse files
committed
updates
1 parent 1be3684 commit e7dde2c

File tree

5 files changed

+153
-119
lines changed

5 files changed

+153
-119
lines changed

core/admin/class-dashboard.php

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ public function dashboard_page() {
183183
</li>
184184
</ul>
185185

186-
<iframe src="https://www.facebook.com/plugins/page.php?href=https%3A%2F%2Fwww.facebook.com%2Fzerospamorg&tabs=timeline&width=300&height=500&small_header=false&adapt_container_width=true&hide_cover=false&show_facepile=true&appId=2704301689814493" width="300" height="500" style="border:none;overflow:hidden;margin-bottom:40px;" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"></iframe>
186+
<iframe src="https://www.facebook.com/plugins/page.php?href=https%3A%2F%2Fwww.facebook.com%2Fzerospamorg&tabs=timeline&width=300&height=635&small_header=false&adapt_container_width=true&hide_cover=false&show_facepile=true&appId=2704301689814493" width="300" height="635" style="border:none;overflow:hidden;margin-bottom:40px;" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"></iframe>
187187

188-
<a class="twitter-timeline" data-height="350" href="https://twitter.com/ZeroSpamOrg?ref_src=twsrc%5Etfw">Tweets by ZeroSpamOrg</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
188+
<a class="twitter-timeline" data-height="604" href="https://twitter.com/ZeroSpamOrg?ref_src=twsrc%5Etfw">Tweets by ZeroSpamOrg</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
189189
</div>
190190
<div class="zerospam-dashboard__col">
191191
<?php if ( ! empty( $_REQUEST['zerospam-msg'] ) ) : ?>
@@ -203,18 +203,19 @@ public function dashboard_page() {
203203
?>
204204
<div class="zerospam-blocks">
205205
<div class="zerospam-block zerospam-block--review">
206-
<h3 class="zerospam-block__headline"><?php esc_html_e( 'Detections the Last 24 Hours', 'zero-spam' ); ?></h3>
206+
<h3 class="zerospam-block__headline"><?php esc_html_e( 'Detections by the Hour', 'zero-spam' ); ?></h3>
207207
<div class="zerospam-block__content">
208208
<div class="zerospam-block__content-col">
209209
<?php require ZEROSPAM_PATH . 'includes/templates/admin-bar-chart.php'; ?>
210210
</div>
211211
<div class="zerospam-block__content-col">
212-
<h3>
212+
<?php require ZEROSPAM_PATH . 'includes/templates/admin-hours-list.php'; ?>
213+
<p style="margin-top: 20px">
213214
<?php
214215
printf(
215216
wp_kses(
216217
/* translators: %s: Replaced with the Zero Spam URL */
217-
__( 'We need you... <a href="%1$s" target="_blank" rel="noreferrer noopener">and your review!</a>', 'zero-spam' ),
218+
__( '<strong>We need you!</strong> Help support development and new features by reviewing us on WordPress.org &mdash; once reviewed, contact us to get a <strong>10&#37; off coupon</strong> on any <a href="%1$s" target="_blank" rel="noreferrer noopener">Zero Spam license</a>.', 'zero-spam' ),
218219
array(
219220
'strong' => array(),
220221
'a' => array(
@@ -226,30 +227,11 @@ public function dashboard_page() {
226227
'br' => array(),
227228
)
228229
),
229-
'https://wordpress.org/support/plugin/zero-spam/reviews/?filter=5',
230+
'https://www.zerospam.org/subscribe/'
230231
);
231232
?>
232-
</h3>
233-
<?php
234-
printf(
235-
wp_kses(
236-
/* translators: %s: Replaced with the Zero Spam URL */
237-
__( 'Help support continued development, improvements and new feature releases by submitting a review on WordPress.org. Users who submit a review can contact us for a 10&#37; off coupon on any <a href="%1$s" target="_blank" rel="noreferrer noopener">Zero Spam enhanced protection license</a>.', 'zero-spam' ),
238-
array(
239-
'strong' => array(),
240-
'a' => array(
241-
'target' => array(),
242-
'href' => array(),
243-
'rel' => array(),
244-
),
245-
'em' => array(),
246-
'br' => array(),
247-
)
248-
),
249-
'https://www.zerospam.org/subscribe/'
250-
);
251-
?>
252-
<p><a href="https://wordpress.org/support/plugin/zero-spam/reviews/?filter=5" target="_blank" rel="noreferrer noopener" class="button"><?php _e( 'Submit Review', 'zero-spam' ); ?> &#8594;</a></p>
233+
</p>
234+
<p><a href="https://wordpress.org/support/plugin/zero-spam/reviews/?filter=5" target="_blank" rel="noreferrer noopener" class="button button-primary"><?php _e( 'Submit Review', 'zero-spam' ); ?> &#8594;</a></p>
253235
</div>
254236
</div>
255237
</div>
@@ -271,7 +253,7 @@ public function dashboard_page() {
271253
printf(
272254
wp_kses(
273255
/* translators: %s: Replaced with the Zero Spam URL */
274-
__( 'We use the latest techniques available, but <em>nothing is 100&#37;</em>.<br /><a href="%1$s" target="_blank" rel="noreferrer noopener">Contact us</a> if seeing a large amount a malicious activity for help.', 'zero-spam' ),
256+
__( 'We use the latest techniques available, but <em>nothing is 100&#37;</em>. <a href="%1$s" target="_blank" rel="noreferrer noopener">Contact us</a> if seeing a large amount a malicious activity for help.', 'zero-spam' ),
275257
array(
276258
'strong' => array(),
277259
'a' => array(

includes/templates/admin-header.php

Lines changed: 89 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -4,97 +4,96 @@
44
*
55
* @package ZeroSpam
66
*/
7-
87
?>
98

109
<header class="zerospam-header">
11-
<img src="<?php echo plugin_dir_url( ZEROSPAM ) . 'assets/img/text-zero-spam.svg' ?>" width="250" />
12-
<div class="zerospam-header__status">
13-
<?php
14-
$status = \ZeroSpam\Core\Settings::get_settings( 'zerospam' );
15-
if ( 'enabled' !== $status ) :
16-
echo '<img src="' . plugin_dir_url( ZEROSPAM ) . 'assets/img/icon-error.svg" class="zerospam-small-icon" />';
17-
echo sprintf(
18-
wp_kses(
19-
/* translators: %1s: Replaced with the Zero Spam URL */
20-
__( '<strong>Enhanced Protection is <a href="%1$s">DISABLED</a>.</strong>', 'zero-spam' ),
21-
array(
22-
'h3' => array(),
23-
'p' => array(),
24-
'a' => array(
25-
'href' => array(),
26-
'class' => array(),
27-
'rel' => array(),
28-
),
29-
'strong' => array(),
30-
)
31-
),
32-
admin_url( "options-general.php?page=wordpress-zero-spam-settings&subview=zerospam" )
33-
);
34-
else :
35-
$license_key = \ZeroSpam\Core\Settings::get_settings( 'zerospam_license' );
36-
if ( $license_key ) :
37-
$license = \ZeroSpam\Modules\Zero_Spam::get_license( $license_key );
38-
if ( empty( $license['license_key'] ) ) :
39-
echo '<img src="' . plugin_dir_url( ZEROSPAM ) . 'assets/img/icon-error.svg" class="zerospam-small-icon" />';
40-
echo sprintf(
41-
wp_kses(
42-
/* translators: %1s: Replaced with the Zero Spam URL */
43-
__( '<strong>Enhanced Protection is <a href="%1$s">DISABLED</a> (invalid license).</strong>', 'zero-spam' ),
44-
array(
45-
'h3' => array(),
46-
'p' => array(),
47-
'a' => array(
48-
'href' => array(),
49-
'class' => array(),
50-
'rel' => array(),
51-
),
52-
'strong' => array(),
53-
)
54-
),
55-
admin_url( "options-general.php?page=wordpress-zero-spam-settings&subview=zerospam" )
56-
);
57-
else :
58-
echo '<img src="' . plugin_dir_url( ZEROSPAM ) . 'assets/img/icon-success.svg" class="zerospam-small-icon" />';
59-
echo sprintf(
60-
wp_kses(
61-
/* translators: %1s: Replaced with the Zero Spam URL */
62-
__( '<strong>Protected &mdash; %1s queries available</strong>', 'zero-spam' ),
63-
array(
64-
'h3' => array(),
65-
'p' => array(),
66-
'a' => array(
67-
'href' => array(),
68-
'class' => array(),
69-
'rel' => array(),
70-
),
71-
'strong' => array(),
72-
)
73-
),
74-
number_format( $license['queries_remaining'], 0 )
75-
);
76-
endif;
77-
else:
78-
echo '<img src="' . plugin_dir_url( ZEROSPAM ) . 'assets/img/icon-error.svg" class="zerospam-small-icon" />';
79-
echo sprintf(
80-
wp_kses(
81-
/* translators: %1s: Replaced with the Zero Spam URL, %2$s: Replaced with the DDoD attack wiki URL */
82-
__( '<strong>Enhanced Protection is <a href="%1$s">DISABLED</a>.</strong>', 'zero-spam' ),
83-
array(
84-
'h3' => array(),
85-
'p' => array(),
86-
'a' => array(
87-
'href' => array(),
88-
'class' => array(),
89-
'rel' => array(),
90-
),
91-
'strong' => array(),
92-
)
93-
),
94-
admin_url( "options-general.php?page=wordpress-zero-spam-settings&subview=zerospam" )
95-
);
96-
endif;
97-
endif;
98-
?>
99-
</div>
10+
<img src="<?php echo plugin_dir_url( ZEROSPAM ) . 'assets/img/text-zero-spam.svg' ?>" width="250" />
11+
<div class="zerospam-header__status">
12+
<?php
13+
$status = \ZeroSpam\Core\Settings::get_settings( 'zerospam' );
14+
if ( 'enabled' !== $status ) :
15+
echo '<img src="' . plugin_dir_url( ZEROSPAM ) . 'assets/img/icon-error.svg" class="zerospam-small-icon" />';
16+
echo sprintf(
17+
wp_kses(
18+
/* translators: %1s: Replaced with the Zero Spam URL */
19+
__( '<strong>Enhanced Protection is <a href="%1$s">DISABLED</a>.</strong>', 'zero-spam' ),
20+
array(
21+
'h3' => array(),
22+
'p' => array(),
23+
'a' => array(
24+
'href' => array(),
25+
'class' => array(),
26+
'rel' => array(),
27+
),
28+
'strong' => array(),
29+
)
30+
),
31+
admin_url( "options-general.php?page=wordpress-zero-spam-settings&subview=zerospam" )
32+
);
33+
else :
34+
$license_key = \ZeroSpam\Core\Settings::get_settings( 'zerospam_license' );
35+
if ( $license_key ) :
36+
$license = \ZeroSpam\Modules\Zero_Spam::get_license( $license_key );
37+
if ( empty( $license['license_key'] ) ) :
38+
echo '<img src="' . plugin_dir_url( ZEROSPAM ) . 'assets/img/icon-error.svg" class="zerospam-small-icon" />';
39+
echo sprintf(
40+
wp_kses(
41+
/* translators: %1s: Replaced with the Zero Spam URL */
42+
__( '<strong>Enhanced Protection is <a href="%1$s">DISABLED</a> (invalid license).</strong>', 'zero-spam' ),
43+
array(
44+
'h3' => array(),
45+
'p' => array(),
46+
'a' => array(
47+
'href' => array(),
48+
'class' => array(),
49+
'rel' => array(),
50+
),
51+
'strong' => array(),
52+
)
53+
),
54+
admin_url( "options-general.php?page=wordpress-zero-spam-settings&subview=zerospam" )
55+
);
56+
else :
57+
echo '<img src="' . plugin_dir_url( ZEROSPAM ) . 'assets/img/icon-success.svg" class="zerospam-small-icon" />';
58+
echo sprintf(
59+
wp_kses(
60+
/* translators: %1s: Replaced with the Zero Spam URL */
61+
__( '<strong>%1s queries available</strong>', 'zero-spam' ),
62+
array(
63+
'h3' => array(),
64+
'p' => array(),
65+
'a' => array(
66+
'href' => array(),
67+
'class' => array(),
68+
'rel' => array(),
69+
),
70+
'strong' => array(),
71+
)
72+
),
73+
number_format( $license['queries_remaining'], 0 )
74+
);
75+
endif;
76+
else:
77+
echo '<img src="' . plugin_dir_url( ZEROSPAM ) . 'assets/img/icon-error.svg" class="zerospam-small-icon" />';
78+
echo sprintf(
79+
wp_kses(
80+
/* translators: %1s: Replaced with the Zero Spam URL, %2$s: Replaced with the DDoD attack wiki URL */
81+
__( '<strong>Enhanced Protection is <a href="%1$s">DISABLED</a>.</strong>', 'zero-spam' ),
82+
array(
83+
'h3' => array(),
84+
'p' => array(),
85+
'a' => array(
86+
'href' => array(),
87+
'class' => array(),
88+
'rel' => array(),
89+
),
90+
'strong' => array(),
91+
)
92+
),
93+
admin_url( "options-general.php?page=wordpress-zero-spam-settings&subview=zerospam" )
94+
);
95+
endif;
96+
endif;
97+
?>
98+
</div>
10099
</header>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* Admin hours list
4+
*
5+
* @package ZeroSpam
6+
*/
7+
8+
$data = array(
9+
'12am' => 0,
10+
'1am' => 0,
11+
'2am' => 0,
12+
'3am' => 0,
13+
'4am' => 0,
14+
'5am' => 0,
15+
'6am' => 0,
16+
'7am' => 0,
17+
'8am' => 0,
18+
'9am' => 0,
19+
'10am' => 0,
20+
'11am' => 0,
21+
'12pm' => 0,
22+
'1pm' => 0,
23+
'2pm' => 0,
24+
'3pm' => 0,
25+
'4pm' => 0,
26+
'5pm' => 0,
27+
'6pm' => 0,
28+
'7pm' => 0,
29+
'8pm' => 0,
30+
'9pm' => 0,
31+
'10pm' => 0,
32+
'11pm' => 0,
33+
);
34+
foreach ( $entries as $key => $entry ) {
35+
$entry_date_key = gmdate( 'ga', strtotime( $entry['date_recorded'] ) );
36+
$data[ $entry_date_key ]++;
37+
}
38+
39+
arsort( $data );
40+
array_splice( $data, 5 );
41+
?>
42+
<h3><?php _e( 'All-time Detections by Hour', 'zero-spam' ); ?></h3>
43+
<ul class="zerospam-list zerospam-list--top">
44+
<?php foreach ( $data as $time => $count ) : ?>
45+
<li class="zerospam-list__item">
46+
<span class="zerospam-list__value zerospam-list__value--label">
47+
<?php echo $time; ?>
48+
</span>
49+
<span class="zerospam-list__value zerospam-list__value--count"><?php echo number_format( $count, 0 ); ?></span>
50+
</li>
51+
<?php endforeach; ?>
52+
</ul>

modules/class-zerospam.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ public static function query( $params ) {
440440
if ( gmdate( 'Y-m-d', strtotime( $first_query_date ) ) !== gmdate( 'Y-m-d' ) ) {
441441
// New day.
442442
update_site_option( 'zero_spam_last_api_query', current_time( 'mysql' ) . '*1' );
443-
} elseif ( $num_queries > 100 ) {
443+
} elseif ( $num_queries > 200 ) {
444444
return false;
445445
} else {
446446
update_site_option( 'zero_spam_last_api_query', $first_query_date . '*' . ( $num_queries+1 ) );

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ If hosting with Pantheon, see their [known issues page](https://pantheon.io/docs
107107

108108
= v5.4.1 =
109109

110+
* feat(dashboard): dashboard ui enhancements
110111
* perf(sharing): performance improvements when sharing data
111112
* fix(memberpress): removed memberpress support, they made fundamental changes to their plugin that's ganna require a rework
112113
* chore(charts): updated chart.js tp 3.9.1

0 commit comments

Comments
 (0)