1 |
commit: 05952b31eb58ff8cd2da3923cc86d78aca6aec06 |
2 |
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Sep 2 00:12:26 2017 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Sep 2 00:12:26 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/blogs-gentoo.git/commit/?id=05952b31 |
7 |
|
8 |
Update akismet 3.3.4 |
9 |
|
10 |
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org> |
11 |
|
12 |
plugins/akismet/_inc/akismet.js | 54 ++++++++++-- |
13 |
plugins/akismet/akismet.php | 4 +- |
14 |
plugins/akismet/class.akismet-admin.php | 40 +++++---- |
15 |
plugins/akismet/class.akismet-widget.php | 2 +- |
16 |
plugins/akismet/class.akismet.php | 28 ++++-- |
17 |
plugins/akismet/readme.txt | 20 ++++- |
18 |
plugins/akismet/views/config.php | 110 +++++++++++------------ |
19 |
plugins/akismet/views/notice.php | 4 +- |
20 |
plugins/akismet/views/start.php | 147 ++++++++++++++++--------------- |
21 |
9 files changed, 249 insertions(+), 160 deletions(-) |
22 |
|
23 |
diff --git a/plugins/akismet/_inc/akismet.js b/plugins/akismet/_inc/akismet.js |
24 |
index b7ff719..c1ddc8b 100644 |
25 |
--- a/plugins/akismet/_inc/akismet.js |
26 |
+++ b/plugins/akismet/_inc/akismet.js |
27 |
@@ -3,6 +3,8 @@ jQuery( function ( $ ) { |
28 |
var mshotSecondTryTimer = null |
29 |
var mshotThirdTryTimer = null |
30 |
|
31 |
+ var mshotEnabledLinkSelector = 'a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type, td.comment p a'; |
32 |
+ |
33 |
$('.akismet-status').each(function () { |
34 |
var thisId = $(this).attr('commentid'); |
35 |
$(this).prependTo('#comment-' + thisId + ' .column-comment'); |
36 |
@@ -82,7 +84,7 @@ jQuery( function ( $ ) { |
37 |
}); |
38 |
|
39 |
// Show a preview image of the hovered URL. Applies to author URLs and URLs inside the comments. |
40 |
- $( '#the-comment-list' ).on( 'mouseover', 'a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type, td.comment p a', function () { |
41 |
+ $( '#the-comment-list' ).on( 'mouseover', mshotEnabledLinkSelector, function () { |
42 |
clearTimeout( mshotRemovalTimer ); |
43 |
|
44 |
if ( $( '.akismet-mshot' ).length > 0 ) { |
45 |
@@ -99,9 +101,9 @@ jQuery( function ( $ ) { |
46 |
clearTimeout( mshotSecondTryTimer ); |
47 |
clearTimeout( mshotThirdTryTimer ); |
48 |
|
49 |
- var thisHref = encodeURIComponent( $( this ).attr( 'href' ) ); |
50 |
+ var thisHref = $( this ).attr( 'href' ); |
51 |
|
52 |
- var mShot = $( '<div class="akismet-mshot mshot-container"><div class="mshot-arrow"></div><img src="//s0.wordpress.com/mshots/v1/' + thisHref + '?w=450" width="450" height="338" class="mshot-image" /></div>' ); |
53 |
+ var mShot = $( '<div class="akismet-mshot mshot-container"><div class="mshot-arrow"></div><img src="' + akismet_mshot_url( thisHref ) + '" width="450" height="338" class="mshot-image" /></div>' ); |
54 |
mShot.data( 'link', this ); |
55 |
|
56 |
var offset = $( this ).offset(); |
57 |
@@ -111,12 +113,15 @@ jQuery( function ( $ ) { |
58 |
top: offset.top + ( $( this ).height() / 2 ) - 101 // 101 = top offset of the arrow plus the top border thickness |
59 |
} ); |
60 |
|
61 |
+ // These retries appear to be superfluous if .mshot-image has already loaded, but it's because mShots |
62 |
+ // can return a "Generating thumbnail..." image if it doesn't have a thumbnail ready, so we need |
63 |
+ // to retry to see if we can get the newly generated thumbnail. |
64 |
mshotSecondTryTimer = setTimeout( function () { |
65 |
- mShot.find( '.mshot-image' ).attr( 'src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=2' ); |
66 |
+ mShot.find( '.mshot-image' ).attr( 'src', akismet_mshot_url( thisHref, 2 ) ); |
67 |
}, 6000 ); |
68 |
|
69 |
mshotThirdTryTimer = setTimeout( function () { |
70 |
- mShot.find( '.mshot-image' ).attr( 'src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=3' ); |
71 |
+ mShot.find( '.mshot-image' ).attr( 'src', akismet_mshot_url( thisHref, 3 ) ); |
72 |
}, 12000 ); |
73 |
|
74 |
$( 'body' ).append( mShot ); |
75 |
@@ -127,6 +132,18 @@ jQuery( function ( $ ) { |
76 |
|
77 |
$( '.akismet-mshot' ).remove(); |
78 |
}, 200 ); |
79 |
+ } ).on( 'mouseover', 'tr', function () { |
80 |
+ // When the mouse hovers over a comment row, begin preloading mshots for any links in the comment or the comment author. |
81 |
+ var linksToPreloadMshotsFor = $( this ).find( mshotEnabledLinkSelector ); |
82 |
+ |
83 |
+ linksToPreloadMshotsFor.each( function () { |
84 |
+ // Don't attempt to preload an mshot for a single link twice. Browser caching should cover this, but in case of |
85 |
+ // race conditions, save a flag locally when we've begun trying to preload one. |
86 |
+ if ( ! $( this ).data( 'akismet-mshot-preloaded' ) ) { |
87 |
+ akismet_preload_mshot( $( this ).attr( 'href' ) ); |
88 |
+ $( this ).data( 'akismet-mshot-preloaded', true ); |
89 |
+ } |
90 |
+ } ); |
91 |
} ); |
92 |
|
93 |
$('.checkforspam:not(.button-disabled)').click( function(e) { |
94 |
@@ -223,4 +240,31 @@ jQuery( function ( $ ) { |
95 |
} |
96 |
}); |
97 |
} |
98 |
+ |
99 |
+ /** |
100 |
+ * Generate an mShot URL if given a link URL. |
101 |
+ * |
102 |
+ * @param string linkUrl |
103 |
+ * @param int retry If retrying a request, the number of the retry. |
104 |
+ * @return string The mShot URL; |
105 |
+ */ |
106 |
+ function akismet_mshot_url( linkUrl, retry ) { |
107 |
+ var mshotUrl = '//s0.wordpress.com/mshots/v1/' + encodeURIComponent( linkUrl ) + '?w=900'; |
108 |
+ |
109 |
+ if ( retry ) { |
110 |
+ mshotUrl += '&r=' + encodeURIComponent( retry ); |
111 |
+ } |
112 |
+ |
113 |
+ return mshotUrl; |
114 |
+ } |
115 |
+ |
116 |
+ /** |
117 |
+ * Begin loading an mShot preview of a link. |
118 |
+ * |
119 |
+ * @param string linkUrl |
120 |
+ */ |
121 |
+ function akismet_preload_mshot( linkUrl ) { |
122 |
+ var img = new Image(); |
123 |
+ img.src = akismet_mshot_url( linkUrl ); |
124 |
+ } |
125 |
}); |
126 |
\ No newline at end of file |
127 |
|
128 |
diff --git a/plugins/akismet/akismet.php b/plugins/akismet/akismet.php |
129 |
index ca21d8b..9894295 100644 |
130 |
--- a/plugins/akismet/akismet.php |
131 |
+++ b/plugins/akismet/akismet.php |
132 |
@@ -6,7 +6,7 @@ |
133 |
Plugin Name: Akismet Anti-Spam |
134 |
Plugin URI: https://akismet.com/ |
135 |
Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. It keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key. |
136 |
-Version: 3.3.2 |
137 |
+Version: 3.3.4 |
138 |
Author: Automattic |
139 |
Author URI: https://automattic.com/wordpress-plugins/ |
140 |
License: GPLv2 or later |
141 |
@@ -37,7 +37,7 @@ if ( !function_exists( 'add_action' ) ) { |
142 |
exit; |
143 |
} |
144 |
|
145 |
-define( 'AKISMET_VERSION', '3.3.2' ); |
146 |
+define( 'AKISMET_VERSION', '3.3.4' ); |
147 |
define( 'AKISMET__MINIMUM_WP_VERSION', '3.7' ); |
148 |
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
149 |
define( 'AKISMET_DELETE_LIMIT', 100000 ); |
150 |
|
151 |
diff --git a/plugins/akismet/class.akismet-admin.php b/plugins/akismet/class.akismet-admin.php |
152 |
index fe29233..aed5e3d 100644 |
153 |
--- a/plugins/akismet/class.akismet-admin.php |
154 |
+++ b/plugins/akismet/class.akismet-admin.php |
155 |
@@ -208,7 +208,7 @@ class Akismet_Admin { |
156 |
'content' => |
157 |
'<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' . |
158 |
'<p>' . esc_html__( 'Akismet filters out spam, so you can focus on more important things.' , 'akismet') . '</p>' . |
159 |
- '<p>' . esc_html__( 'On this page, you are able to enter/remove an API key, view account information and view spam stats.' , 'akismet') . '</p>', |
160 |
+ '<p>' . esc_html__( 'On this page, you are able to update your Akismet settings and view spam stats.' , 'akismet') . '</p>', |
161 |
) |
162 |
); |
163 |
|
164 |
@@ -218,22 +218,24 @@ class Akismet_Admin { |
165 |
'title' => __( 'Settings' , 'akismet'), |
166 |
'content' => |
167 |
'<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' . |
168 |
- '<p><strong>' . esc_html__( 'API Key' , 'akismet') . '</strong> - ' . esc_html__( 'Enter/remove an API key.' , 'akismet') . '</p>' . |
169 |
+ ( Akismet::predefined_api_key() ? '' : '<p><strong>' . esc_html__( 'API Key' , 'akismet') . '</strong> - ' . esc_html__( 'Enter/remove an API key.' , 'akismet') . '</p>' ) . |
170 |
'<p><strong>' . esc_html__( 'Comments' , 'akismet') . '</strong> - ' . esc_html__( 'Show the number of approved comments beside each comment author in the comments list page.' , 'akismet') . '</p>' . |
171 |
'<p><strong>' . esc_html__( 'Strictness' , 'akismet') . '</strong> - ' . esc_html__( 'Choose to either discard the worst spam automatically or to always put all spam in spam folder.' , 'akismet') . '</p>', |
172 |
) |
173 |
); |
174 |
|
175 |
- $current_screen->add_help_tab( |
176 |
- array( |
177 |
- 'id' => 'account', |
178 |
- 'title' => __( 'Account' , 'akismet'), |
179 |
- 'content' => |
180 |
- '<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' . |
181 |
- '<p><strong>' . esc_html__( 'Subscription Type' , 'akismet') . '</strong> - ' . esc_html__( 'The Akismet subscription plan' , 'akismet') . '</p>' . |
182 |
- '<p><strong>' . esc_html__( 'Status' , 'akismet') . '</strong> - ' . esc_html__( 'The subscription status - active, cancelled or suspended' , 'akismet') . '</p>', |
183 |
- ) |
184 |
- ); |
185 |
+ if ( ! Akismet::predefined_api_key() ) { |
186 |
+ $current_screen->add_help_tab( |
187 |
+ array( |
188 |
+ 'id' => 'account', |
189 |
+ 'title' => __( 'Account' , 'akismet'), |
190 |
+ 'content' => |
191 |
+ '<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' . |
192 |
+ '<p><strong>' . esc_html__( 'Subscription Type' , 'akismet') . '</strong> - ' . esc_html__( 'The Akismet subscription plan' , 'akismet') . '</p>' . |
193 |
+ '<p><strong>' . esc_html__( 'Status' , 'akismet') . '</strong> - ' . esc_html__( 'The subscription status - active, cancelled or suspended' , 'akismet') . '</p>', |
194 |
+ ) |
195 |
+ ); |
196 |
+ } |
197 |
} |
198 |
} |
199 |
|
200 |
@@ -255,10 +257,11 @@ class Akismet_Admin { |
201 |
foreach( array( 'akismet_strictness', 'akismet_show_user_comments_approved' ) as $option ) { |
202 |
update_option( $option, isset( $_POST[$option] ) && (int) $_POST[$option] == 1 ? '1' : '0' ); |
203 |
} |
204 |
- |
205 |
- if ( defined( 'WPCOM_API_KEY' ) ) |
206 |
+ |
207 |
+ if ( Akismet::predefined_api_key() ) { |
208 |
return false; //shouldn't have option to save key if already defined |
209 |
- |
210 |
+ } |
211 |
+ |
212 |
$new_key = preg_replace( '/[^a-f0-9]/i', '', $_POST['key'] ); |
213 |
$old_key = Akismet::get_api_key(); |
214 |
|
215 |
@@ -907,6 +910,11 @@ class Akismet_Admin { |
216 |
if ( get_option( 'akismet_strictness' ) === false ) { |
217 |
add_option( 'akismet_strictness', ( get_option( 'akismet_discard_month' ) === 'false' ? '0' : '1' ) ); |
218 |
} |
219 |
+ |
220 |
+ // Sync the local "Total spam blocked" count with the authoritative count from the server. |
221 |
+ if ( isset( $stat_totals['all'], $stat_totals['all']->spam ) ) { |
222 |
+ update_option( 'akismet_spam_count', $stat_totals['all']->spam ); |
223 |
+ } |
224 |
|
225 |
$notices = array(); |
226 |
|
227 |
@@ -1011,7 +1019,7 @@ class Akismet_Admin { |
228 |
|
229 |
public static function display_status() { |
230 |
if ( ! self::get_server_connectivity() ) { |
231 |
- Akismet::view( 'notice', compact( 'servers-be-down' ) ); |
232 |
+ Akismet::view( 'notice', array( 'type' => 'servers-be-down' ) ); |
233 |
} |
234 |
else if ( ! empty( self::$notices ) ) { |
235 |
foreach ( self::$notices as $index => $type ) { |
236 |
|
237 |
diff --git a/plugins/akismet/class.akismet-widget.php b/plugins/akismet/class.akismet-widget.php |
238 |
index 474f759..55b0f35 100644 |
239 |
--- a/plugins/akismet/class.akismet-widget.php |
240 |
+++ b/plugins/akismet/class.akismet-widget.php |
241 |
@@ -62,7 +62,7 @@ class Akismet_Widget extends WP_Widget { |
242 |
} |
243 |
|
244 |
function form( $instance ) { |
245 |
- if ( $instance ) { |
246 |
+ if ( $instance && isset( $instance['title'] ) ) { |
247 |
$title = $instance['title']; |
248 |
} |
249 |
else { |
250 |
|
251 |
diff --git a/plugins/akismet/class.akismet.php b/plugins/akismet/class.akismet.php |
252 |
index 9509913..f4172e0 100644 |
253 |
--- a/plugins/akismet/class.akismet.php |
254 |
+++ b/plugins/akismet/class.akismet.php |
255 |
@@ -914,6 +914,15 @@ class Akismet { |
256 |
return $approved; |
257 |
} |
258 |
|
259 |
+ if ( 'trash' === $approved ) { |
260 |
+ // If the last comment we checked has had its approval set to 'trash', |
261 |
+ // then it failed the comment blacklist check. Let that blacklist override |
262 |
+ // the spam check, since users have the (valid) expectation that when |
263 |
+ // they fill out their blacklists, comments that match it will always |
264 |
+ // end up in the trash. |
265 |
+ return $approved; |
266 |
+ } |
267 |
+ |
268 |
// bump the counter here instead of when the filter is added to reduce the possibility of overcounting |
269 |
if ( $incr = apply_filters('akismet_spam_count_incr', 1) ) |
270 |
update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr ); |
271 |
@@ -1091,17 +1100,10 @@ class Akismet { |
272 |
} |
273 |
|
274 |
public static function load_form_js() { |
275 |
- // WP < 3.3 can't enqueue a script this late in the game and still have it appear in the footer. |
276 |
- // Once we drop support for everything pre-3.3, this can change back to a single enqueue call. |
277 |
wp_register_script( 'akismet-form', plugin_dir_url( __FILE__ ) . '_inc/form.js', array(), AKISMET_VERSION, true ); |
278 |
- add_action( 'wp_footer', array( 'Akismet', 'print_form_js' ) ); |
279 |
- add_action( 'admin_footer', array( 'Akismet', 'print_form_js' ) ); |
280 |
+ wp_enqueue_script( 'akismet-form' ); |
281 |
} |
282 |
|
283 |
- public static function print_form_js() { |
284 |
- wp_print_scripts( 'akismet-form' ); |
285 |
- } |
286 |
- |
287 |
public static function inject_ak_js( $fields ) { |
288 |
echo '<p style="display: none;">'; |
289 |
echo '<input type="hidden" id="ak_js" name="ak_js" value="' . mt_rand( 0, 250 ) . '"/>'; |
290 |
@@ -1205,7 +1207,7 @@ p { |
291 |
* @param mixed $akismet_debug The data to log. |
292 |
*/ |
293 |
public static function log( $akismet_debug ) { |
294 |
- if ( apply_filters( 'akismet_debug_log', defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) ) { |
295 |
+ if ( apply_filters( 'akismet_debug_log', defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG && defined( 'AKISMET_DEBUG' ) && AKISMET_DEBUG ) ) { |
296 |
error_log( print_r( compact( 'akismet_debug' ), true ) ); |
297 |
} |
298 |
} |
299 |
@@ -1292,4 +1294,12 @@ p { |
300 |
|
301 |
return $meta_value; |
302 |
} |
303 |
+ |
304 |
+ public static function predefined_api_key() { |
305 |
+ if ( defined( 'WPCOM_API_KEY' ) ) { |
306 |
+ return true; |
307 |
+ } |
308 |
+ |
309 |
+ return apply_filters( 'akismet_predefined_api_key', false ); |
310 |
+ } |
311 |
} |
312 |
|
313 |
diff --git a/plugins/akismet/readme.txt b/plugins/akismet/readme.txt |
314 |
index dc08793..d56cc7a 100644 |
315 |
--- a/plugins/akismet/readme.txt |
316 |
+++ b/plugins/akismet/readme.txt |
317 |
@@ -2,8 +2,8 @@ |
318 |
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs |
319 |
Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments |
320 |
Requires at least: 3.7 |
321 |
-Tested up to: 4.7.4 |
322 |
-Stable tag: 3.3.2 |
323 |
+Tested up to: 4.8.1 |
324 |
+Stable tag: 3.3.4 |
325 |
License: GPLv2 or later |
326 |
|
327 |
Akismet checks your comments and contact form submissions against our global database of spam to protect you and your site from malicious content. |
328 |
@@ -30,6 +30,22 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co |
329 |
|
330 |
== Changelog == |
331 |
|
332 |
+= 3.3.4 = |
333 |
+ |
334 |
+* Disabled Akismet's debug log output by default unless AKISMET_DEBUG is defined. |
335 |
+* URL previews now begin preloading when the mouse moves near them in the comments section of wp-admin. |
336 |
+* When a comment is caught by the Comment Blacklist, Akismet will always allow it to stay in the trash even if it is spam as well. |
337 |
+* Fixed a bug that was preventing an error from being shown when a site can't reach Akismet's servers. |
338 |
+ |
339 |
+= 3.3.3 = |
340 |
+*Release Date - 13 July 2017* |
341 |
+ |
342 |
+* Reduced amount of bandwidth used by the URL Preview feature. |
343 |
+* Improved the admin UI when the API key is manually pre-defined for the site. |
344 |
+* Removed a workaround for WordPress installations older than 3.3 that will improve Akismet's compatibility with other plugins. |
345 |
+* The number of spam blocked that is displayed on the WordPress dashboard will now be more accurate and updated more frequently. |
346 |
+* Fixed a bug in the Akismet widget that could cause PHP warnings. |
347 |
+ |
348 |
= 3.3.2 = |
349 |
*Release Date - 10 May 2017* |
350 |
|
351 |
|
352 |
diff --git a/plugins/akismet/views/config.php b/plugins/akismet/views/config.php |
353 |
index f7b232e..c12914a 100644 |
354 |
--- a/plugins/akismet/views/config.php |
355 |
+++ b/plugins/akismet/views/config.php |
356 |
@@ -65,7 +65,7 @@ |
357 |
<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="POST"> |
358 |
<table cellspacing="0" class="akismet-settings"> |
359 |
<tbody> |
360 |
- <?php if ( !defined( 'WPCOM_API_KEY' ) ):?> |
361 |
+ <?php if ( ! Akismet::predefined_api_key() ) { ?> |
362 |
<tr> |
363 |
<th class="akismet-api-key" width="10%" align="left" scope="row"><?php esc_html_e('API Key', 'akismet');?></th> |
364 |
<td width="5%"/> |
365 |
@@ -73,7 +73,7 @@ |
366 |
<span class="api-key"><input id="key" name="key" type="text" size="15" value="<?php echo esc_attr( get_option('wordpress_api_key') ); ?>" class="<?php echo esc_attr( 'regular-text code ' . $akismet_user->status ); ?>"></span> |
367 |
</td> |
368 |
</tr> |
369 |
- <?php endif; ?> |
370 |
+ <?php } ?> |
371 |
<?php if ( isset( $_GET['ssl_status'] ) ) { ?> |
372 |
<tr> |
373 |
<th align="left" scope="row"><?php esc_html_e( 'SSL Status', 'akismet' ); ?></th> |
374 |
@@ -157,11 +157,11 @@ |
375 |
</tbody> |
376 |
</table> |
377 |
<div class="akismet-card-actions"> |
378 |
- <?php if ( !defined( 'WPCOM_API_KEY' ) ):?> |
379 |
+ <?php if ( ! Akismet::predefined_api_key() ) { ?> |
380 |
<div id="delete-action"> |
381 |
<a class="submitdelete deletion" href="<?php echo esc_url( Akismet_Admin::get_page_url( 'delete_key' ) ); ?>"><?php esc_html_e('Disconnect this account', 'akismet'); ?></a> |
382 |
</div> |
383 |
- <?php endif; ?> |
384 |
+ <?php } ?> |
385 |
<?php wp_nonce_field(Akismet_Admin::NONCE) ?> |
386 |
<div id="publishing-action"> |
387 |
<input type="hidden" name="action" value="enter-key"> |
388 |
@@ -172,61 +172,63 @@ |
389 |
</form> |
390 |
</div> |
391 |
</div> |
392 |
- |
393 |
- <div class="akismet-card"> |
394 |
- <div class="akismet-section-header"> |
395 |
- <div class="akismet-section-header__label"> |
396 |
- <span><?php esc_html_e( 'Account' , 'akismet'); ?></span> |
397 |
+ |
398 |
+ <?php if ( ! Akismet::predefined_api_key() ) { ?> |
399 |
+ <div class="akismet-card"> |
400 |
+ <div class="akismet-section-header"> |
401 |
+ <div class="akismet-section-header__label"> |
402 |
+ <span><?php esc_html_e( 'Account' , 'akismet'); ?></span> |
403 |
+ </div> |
404 |
</div> |
405 |
- </div> |
406 |
|
407 |
- <div class="inside"> |
408 |
- <table cellspacing="0" border="0" class="akismet-settings"> |
409 |
- <tbody> |
410 |
- <tr> |
411 |
- <th scope="row" align="left"><?php esc_html_e( 'Subscription Type' , 'akismet');?></th> |
412 |
- <td width="5%"/> |
413 |
- <td align="left"> |
414 |
- <p><?php echo esc_html( $akismet_user->account_name ); ?></p> |
415 |
- </td> |
416 |
- </tr> |
417 |
- <tr> |
418 |
- <th scope="row" align="left"><?php esc_html_e( 'Status' , 'akismet');?></th> |
419 |
- <td width="5%"/> |
420 |
- <td align="left"> |
421 |
- <p><?php |
422 |
- if ( 'cancelled' == $akismet_user->status ) : |
423 |
- esc_html_e( 'Cancelled', 'akismet' ); |
424 |
- elseif ( 'suspended' == $akismet_user->status ) : |
425 |
- esc_html_e( 'Suspended', 'akismet' ); |
426 |
- elseif ( 'missing' == $akismet_user->status ) : |
427 |
- esc_html_e( 'Missing', 'akismet' ); |
428 |
- elseif ( 'no-sub' == $akismet_user->status ) : |
429 |
- esc_html_e( 'No Subscription Found', 'akismet' ); |
430 |
- else : |
431 |
- esc_html_e( 'Active', 'akismet' ); |
432 |
- endif; ?></p> |
433 |
- </td> |
434 |
- </tr> |
435 |
- <?php if ( $akismet_user->next_billing_date ) : ?> |
436 |
- <tr> |
437 |
- <th scope="row" align="left"><?php esc_html_e( 'Next Billing Date' , 'akismet');?></th> |
438 |
- <td width="5%"/> |
439 |
- <td align="left"> |
440 |
- <p><?php echo date( 'F j, Y', $akismet_user->next_billing_date ); ?></p> |
441 |
- </td> |
442 |
- </tr> |
443 |
- <?php endif; ?> |
444 |
- </tbody> |
445 |
- </table> |
446 |
- <div class="akismet-card-actions"> |
447 |
- <div id="publishing-action"> |
448 |
- <?php Akismet::view( 'get', array( 'text' => ( $akismet_user->account_type == 'free-api-key' && $akismet_user->status == 'active' ? __( 'Upgrade' , 'akismet') : __( 'Change' , 'akismet') ), 'redirect' => 'upgrade' ) ); ?> |
449 |
+ <div class="inside"> |
450 |
+ <table cellspacing="0" border="0" class="akismet-settings"> |
451 |
+ <tbody> |
452 |
+ <tr> |
453 |
+ <th scope="row" align="left"><?php esc_html_e( 'Subscription Type' , 'akismet');?></th> |
454 |
+ <td width="5%"/> |
455 |
+ <td align="left"> |
456 |
+ <p><?php echo esc_html( $akismet_user->account_name ); ?></p> |
457 |
+ </td> |
458 |
+ </tr> |
459 |
+ <tr> |
460 |
+ <th scope="row" align="left"><?php esc_html_e( 'Status' , 'akismet');?></th> |
461 |
+ <td width="5%"/> |
462 |
+ <td align="left"> |
463 |
+ <p><?php |
464 |
+ if ( 'cancelled' == $akismet_user->status ) : |
465 |
+ esc_html_e( 'Cancelled', 'akismet' ); |
466 |
+ elseif ( 'suspended' == $akismet_user->status ) : |
467 |
+ esc_html_e( 'Suspended', 'akismet' ); |
468 |
+ elseif ( 'missing' == $akismet_user->status ) : |
469 |
+ esc_html_e( 'Missing', 'akismet' ); |
470 |
+ elseif ( 'no-sub' == $akismet_user->status ) : |
471 |
+ esc_html_e( 'No Subscription Found', 'akismet' ); |
472 |
+ else : |
473 |
+ esc_html_e( 'Active', 'akismet' ); |
474 |
+ endif; ?></p> |
475 |
+ </td> |
476 |
+ </tr> |
477 |
+ <?php if ( $akismet_user->next_billing_date ) : ?> |
478 |
+ <tr> |
479 |
+ <th scope="row" align="left"><?php esc_html_e( 'Next Billing Date' , 'akismet');?></th> |
480 |
+ <td width="5%"/> |
481 |
+ <td align="left"> |
482 |
+ <p><?php echo date( 'F j, Y', $akismet_user->next_billing_date ); ?></p> |
483 |
+ </td> |
484 |
+ </tr> |
485 |
+ <?php endif; ?> |
486 |
+ </tbody> |
487 |
+ </table> |
488 |
+ <div class="akismet-card-actions"> |
489 |
+ <div id="publishing-action"> |
490 |
+ <?php Akismet::view( 'get', array( 'text' => ( $akismet_user->account_type == 'free-api-key' && $akismet_user->status == 'active' ? __( 'Upgrade' , 'akismet') : __( 'Change' , 'akismet') ), 'redirect' => 'upgrade' ) ); ?> |
491 |
+ </div> |
492 |
+ <div class="clear"></div> |
493 |
</div> |
494 |
- <div class="clear"></div> |
495 |
</div> |
496 |
</div> |
497 |
- </div> |
498 |
+ <?php } ?> |
499 |
<?php endif;?> |
500 |
</div> |
501 |
</div> |
502 |
\ No newline at end of file |
503 |
|
504 |
diff --git a/plugins/akismet/views/notice.php b/plugins/akismet/views/notice.php |
505 |
index e82f168..3b6236d 100644 |
506 |
--- a/plugins/akismet/views/notice.php |
507 |
+++ b/plugins/akismet/views/notice.php |
508 |
@@ -46,8 +46,8 @@ |
509 |
</div> |
510 |
<?php elseif ( $type == 'servers-be-down' ) :?> |
511 |
<div class="akismet-alert akismet-critical"> |
512 |
- <h3 class="akismet-key-status failed"><?php esc_html_e("Akismet can’t connect to your site.", 'akismet'); ?></h3> |
513 |
- <p class="akismet-description"><?php printf( __('Your firewall may be blocking Akismet. Please contact your host and refer to <a href="%s" target="_blank">our guide about firewalls</a>.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p> |
514 |
+ <h3 class="akismet-key-status failed"><?php esc_html_e("Your site can’t connect to the Akismet servers.", 'akismet'); ?></h3> |
515 |
+ <p class="akismet-description"><?php printf( __('Your firewall may be blocking Akismet from connecting to its API. Please contact your host and refer to <a href="%s" target="_blank">our guide about firewalls</a>.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p> |
516 |
</div> |
517 |
<?php elseif ( $type == 'active-dunning' ) :?> |
518 |
<div class="akismet-alert akismet-critical"> |
519 |
|
520 |
diff --git a/plugins/akismet/views/start.php b/plugins/akismet/views/start.php |
521 |
index d17b53d..0ec35fd 100644 |
522 |
--- a/plugins/akismet/views/start.php |
523 |
+++ b/plugins/akismet/views/start.php |
524 |
@@ -8,86 +8,95 @@ |
525 |
</div> |
526 |
<div class="akismet-lower"> |
527 |
<?php Akismet_Admin::display_status(); ?> |
528 |
+ |
529 |
<div class="akismet-box"> |
530 |
<h2><?php esc_html_e( 'Eliminate spam from your site', 'akismet' ); ?></h2> |
531 |
<p><?php esc_html_e( 'Select one of the options below to get started.', 'akismet' ); ?></p> |
532 |
</div> |
533 |
<div class="akismet-boxes"> |
534 |
- <?php if ( $akismet_user && in_array( $akismet_user->status, array( 'active', 'active-dunning', 'no-sub', 'missing', 'cancelled', 'suspended' ) ) ) { ?> |
535 |
- <?php if ( in_array( $akismet_user->status, array( 'no-sub', 'missing' ) ) ) { ?> |
536 |
+ <?php if ( ! Akismet::predefined_api_key() ) { ?> |
537 |
+ <?php if ( $akismet_user && in_array( $akismet_user->status, array( 'active', 'active-dunning', 'no-sub', 'missing', 'cancelled', 'suspended' ) ) ) { ?> |
538 |
+ <?php if ( in_array( $akismet_user->status, array( 'no-sub', 'missing' ) ) ) { ?> |
539 |
+ <div class="akismet-box"> |
540 |
+ <h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3> |
541 |
+ <p><?php esc_html_e( 'Use your Jetpack connection to activate Akismet.', 'akismet' ); ?></p> |
542 |
+ <form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank"> |
543 |
+ <input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/> |
544 |
+ <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/> |
545 |
+ <input type="hidden" name="auto-connect" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/> |
546 |
+ <input type="hidden" name="redirect" value="plugin-signup"/> |
547 |
+ <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/> |
548 |
+ </form> |
549 |
+ <?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?> |
550 |
+ <p><?php echo sprintf( esc_html( __( 'You are connected as %s.', 'akismet' ) ), '<b>' . esc_html( $akismet_user->user_login ) . '</b>' ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p> |
551 |
+ </div> |
552 |
+ <?php } elseif ( $akismet_user->status == 'cancelled' ) { ?> |
553 |
+ <div class="akismet-box"> |
554 |
+ <h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3> |
555 |
+ <form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank"> |
556 |
+ <input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/> |
557 |
+ <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/> |
558 |
+ <input type="hidden" name="user_id" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/> |
559 |
+ <input type="hidden" name="redirect" value="upgrade"/> |
560 |
+ <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Reactivate Akismet' , 'akismet' ); ?>"/> |
561 |
+ </form> |
562 |
+ <p><?php echo esc_html( sprintf( __( 'Your subscription for %s is cancelled.' , 'akismet' ), $akismet_user->user_email ) ); ?></p> |
563 |
+ </div> |
564 |
+ <?php } elseif ( $akismet_user->status == 'suspended' ) { ?> |
565 |
+ <div class="centered akismet-box"> |
566 |
+ <h3><?php esc_html_e( 'Connected via Jetpack' , 'akismet' ); ?></h3> |
567 |
+ <p class="akismet-alert-text"><?php echo esc_html( sprintf( __( 'Your subscription for %s is suspended.' , 'akismet' ), $akismet_user->user_email ) ); ?></p> |
568 |
+ <p><?php esc_html_e( 'No worries! Get in touch and we’ll sort this out.', 'akismet' ); ?></p> |
569 |
+ <p><a href="https://akismet.com/contact" class="akismet-button akismet-is-primary"><?php esc_html_e( 'Contact Akismet support' , 'akismet' ); ?></a></p> |
570 |
+ </div> |
571 |
+ <?php } else { // ask do they want to use akismet account found using jetpack wpcom connection ?> |
572 |
+ <div class="akismet-box"> |
573 |
+ <h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3> |
574 |
+ <p><?php esc_html_e( 'Use your Jetpack connection to activate Akismet.', 'akismet' ); ?></p> |
575 |
+ <form name="akismet_use_wpcom_key" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-activate" class="akismet-right"> |
576 |
+ <input type="hidden" name="key" value="<?php echo esc_attr( $akismet_user->api_key );?>"/> |
577 |
+ <input type="hidden" name="action" value="enter-key"> |
578 |
+ <?php wp_nonce_field( Akismet_Admin::NONCE ) ?> |
579 |
+ <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/> |
580 |
+ </form> |
581 |
+ <?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?> |
582 |
+ <p><?php echo sprintf( esc_html( __( 'You are connected as %s.', 'akismet' ) ), '<b>' . esc_html( $akismet_user->user_login ) . '</b>' ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p> |
583 |
+ </div> |
584 |
+ <?php } ?> |
585 |
+ <div class="akismet-box"> |
586 |
+ <h3><?php esc_html_e( 'Or sign up with a different email address', 'akismet' ); ?></h3> |
587 |
+ <div class="akismet-right"> |
588 |
+ <?php Akismet::view( 'get', array( 'text' => __( 'Sign up with a different email address' , 'akismet' ), 'classes' => array( 'akismet-button' ) ) ); ?> |
589 |
+ </div> |
590 |
+ <p><?php esc_html_e( 'Choose this option to use Akismet independently of your Jetpack connection.', 'akismet' ); ?></p> |
591 |
+ </div> |
592 |
+ <?php } else { ?> |
593 |
+ <div class="akismet-box"> |
594 |
+ <h3><?php esc_html_e( 'Activate Akismet' , 'akismet' );?></h3> |
595 |
+ <div class="akismet-right"> |
596 |
+ <?php Akismet::view( 'get', array( 'text' => __( 'Get your API key' , 'akismet' ), 'classes' => array( 'akismet-button', 'akismet-is-primary' ) ) ); ?> |
597 |
+ </div> |
598 |
+ <p><?php esc_html_e( 'Log in or sign up now.', 'akismet' ); ?></p> |
599 |
+ </div> |
600 |
+ <?php } ?> |
601 |
<div class="akismet-box"> |
602 |
- <h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3> |
603 |
- <p><?php esc_html_e( 'Use your Jetpack connection to activate Akismet.', 'akismet' ); ?></p> |
604 |
- <form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank"> |
605 |
- <input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/> |
606 |
- <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/> |
607 |
- <input type="hidden" name="auto-connect" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/> |
608 |
- <input type="hidden" name="redirect" value="plugin-signup"/> |
609 |
- <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/> |
610 |
- </form> |
611 |
- <?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?> |
612 |
- <p><?php echo sprintf( esc_html( __( 'You are connected as %s.', 'akismet' ) ), '<b>' . esc_html( $akismet_user->user_login ) . '</b>' ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p> |
613 |
- </div> |
614 |
- <?php } elseif ( $akismet_user->status == 'cancelled' ) { ?> |
615 |
- <div class="akismet-box"> |
616 |
- <h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3> |
617 |
- <form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank"> |
618 |
- <input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/> |
619 |
- <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/> |
620 |
- <input type="hidden" name="user_id" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/> |
621 |
- <input type="hidden" name="redirect" value="upgrade"/> |
622 |
- <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Reactivate Akismet' , 'akismet' ); ?>"/> |
623 |
+ <h3><?php esc_html_e( 'Or enter an API key', 'akismet' ); ?></h3> |
624 |
+ <p><?php esc_html_e( 'Already have your key? Enter it here.', 'akismet' ); ?> <a href="https://docs.akismet.com/getting-started/api-key/" target="_blank"><?php esc_html_e( '(What is an API key?)', 'akismet' ); ?></a></p> |
625 |
+ <form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post"> |
626 |
+ <?php wp_nonce_field( Akismet_Admin::NONCE ) ?> |
627 |
+ <input type="hidden" name="action" value="enter-key"> |
628 |
+ <p style="width: 100%; display: flex; flex-wrap: nowrap; box-sizing: border-box;"> |
629 |
+ <input id="key" name="key" type="text" size="15" value="" class="regular-text code" style="flex-grow: 1; margin-right: 1rem;"> |
630 |
+ <input type="submit" name="submit" id="submit" class="akismet-button" value="<?php esc_attr_e( 'Connect with API key', 'akismet' );?>"> |
631 |
+ </p> |
632 |
</form> |
633 |
- <p><?php echo esc_html( sprintf( __( 'Your subscription for %s is cancelled.' , 'akismet' ), $akismet_user->user_email ) ); ?></p> |
634 |
- </div> |
635 |
- <?php } elseif ( $akismet_user->status == 'suspended' ) { ?> |
636 |
- <div class="centered akismet-box"> |
637 |
- <h3><?php esc_html_e( 'Connected via Jetpack' , 'akismet' ); ?></h3> |
638 |
- <p class="akismet-alert-text"><?php echo esc_html( sprintf( __( 'Your subscription for %s is suspended.' , 'akismet' ), $akismet_user->user_email ) ); ?></p> |
639 |
- <p><?php esc_html_e( 'No worries! Get in touch and we’ll sort this out.', 'akismet' ); ?></p> |
640 |
- <p><a href="https://akismet.com/contact" class="akismet-button akismet-is-primary"><?php esc_html_e( 'Contact Akismet support' , 'akismet' ); ?></a></p> |
641 |
</div> |
642 |
- <?php } else { // ask do they want to use akismet account found using jetpack wpcom connection ?> |
643 |
+ <?php } else { ?> |
644 |
<div class="akismet-box"> |
645 |
- <h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3> |
646 |
- <p><?php esc_html_e( 'Use your Jetpack connection to activate Akismet.', 'akismet' ); ?></p> |
647 |
- <form name="akismet_use_wpcom_key" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-activate" class="akismet-right"> |
648 |
- <input type="hidden" name="key" value="<?php echo esc_attr( $akismet_user->api_key );?>"/> |
649 |
- <input type="hidden" name="action" value="enter-key"> |
650 |
- <?php wp_nonce_field( Akismet_Admin::NONCE ) ?> |
651 |
- <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/> |
652 |
- </form> |
653 |
- <?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?> |
654 |
- <p><?php echo sprintf( esc_html( __( 'You are connected as %s.', 'akismet' ) ), '<b>' . esc_html( $akismet_user->user_login ) . '</b>' ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p> |
655 |
+ <h2><?php esc_html_e( 'Manual Configuration', 'akismet' ); ?></h2> |
656 |
+ <p><?php echo sprintf( esc_html__( 'An Akismet API key has been defined in the %s file for this site.', 'akismet' ), '<code>wp-config.php</code>' ); ?></p> |
657 |
</div> |
658 |
<?php } ?> |
659 |
- <div class="akismet-box"> |
660 |
- <h3><?php esc_html_e( 'Or sign up with a different email address', 'akismet' ); ?></h3> |
661 |
- <div class="akismet-right"> |
662 |
- <?php Akismet::view( 'get', array( 'text' => __( 'Sign up with a different email address' , 'akismet' ), 'classes' => array( 'akismet-button' ) ) ); ?> |
663 |
- </div> |
664 |
- <p><?php esc_html_e( 'Choose this option to use Akismet independently of your Jetpack connection.', 'akismet' ); ?></p> |
665 |
- </div> |
666 |
- <?php } else { ?> |
667 |
- <div class="akismet-box"> |
668 |
- <h3><?php esc_html_e( 'Activate Akismet' , 'akismet' );?></h3> |
669 |
- <div class="akismet-right"> |
670 |
- <?php Akismet::view( 'get', array( 'text' => __( 'Get your API key' , 'akismet' ), 'classes' => array( 'akismet-button', 'akismet-is-primary' ) ) ); ?> |
671 |
- </div> |
672 |
- <p><?php esc_html_e( 'Log in or sign up now.', 'akismet' ); ?></p> |
673 |
- </div> |
674 |
- <?php } ?> |
675 |
- <div class="akismet-box"> |
676 |
- <h3><?php esc_html_e( 'Or enter an API key', 'akismet' ); ?></h3> |
677 |
- <p><?php esc_html_e( 'Already have your key? Enter it here.', 'akismet' ); ?> <a href="https://docs.akismet.com/getting-started/api-key/" target="_blank"><?php esc_html_e( '(What is an API key?)', 'akismet' ); ?></a></p> |
678 |
- <form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post"> |
679 |
- <?php wp_nonce_field( Akismet_Admin::NONCE ) ?> |
680 |
- <input type="hidden" name="action" value="enter-key"> |
681 |
- <p style="width: 100%; display: flex; flex-wrap: nowrap; box-sizing: border-box;"> |
682 |
- <input id="key" name="key" type="text" size="15" value="" class="regular-text code" style="flex-grow: 1; margin-right: 1rem;"> |
683 |
- <input type="submit" name="submit" id="submit" class="akismet-button" value="<?php esc_attr_e( 'Connect with API key', 'akismet' );?>"> |
684 |
- </p> |
685 |
- </form> |
686 |
</div> |
687 |
</div> |
688 |
</div> |
689 |
\ No newline at end of file |