Version Description
Release Date - 31 October 2019
- Prevented an attacker from being able to cause a user to unknowingly recheck their Pending comments for spam.
- Improved compatibility with Jetpack 7.7+.
- Updated the plugin activation page to use consistent language and markup.
- Redirecting users to the Akismet connnection/settings screen upon plugin activation, in an effort to make it easier for people to get setup.
Download this release
Release Info
Developer | cfinke |
Plugin | Akismet Anti-Spam |
Version | 4.1.3 |
Comparing to | |
See all releases |
Code changes from version 4.1.2 to 4.1.3
- _inc/akismet.css +38 -0
- _inc/akismet.js +55 -9
- akismet.php +2 -2
- class.akismet-admin.php +25 -2
- class.akismet.php +2 -0
- readme.txt +12 -4
- views/activate.php +8 -0
- views/connect-jp.php +72 -0
- views/enter.php +13 -0
- views/notice.php +7 -1
- views/predefined.php +11 -0
- views/setup.php +5 -0
- views/start.php +18 -89
- views/title.php +3 -0
_inc/akismet.css
CHANGED
@@ -546,6 +546,44 @@ table.comments td.comment p a:after {
|
|
546 |
margin-top: 1.5rem;
|
547 |
}
|
548 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
549 |
.akismet-button, .akismet-button:hover, .akismet-button:visited {
|
550 |
background: white;
|
551 |
border-color: #c8d7e1;
|
546 |
margin-top: 1.5rem;
|
547 |
}
|
548 |
|
549 |
+
.akismet-box-header {
|
550 |
+
max-width: 700px;
|
551 |
+
margin: 0 auto 40px auto;
|
552 |
+
line-height: 1.5;
|
553 |
+
}
|
554 |
+
|
555 |
+
.akismet-box-header h2 {
|
556 |
+
margin: 1.5rem 10% 0;
|
557 |
+
font-size: 1.375rem;
|
558 |
+
font-weight: 700;
|
559 |
+
color: #000;
|
560 |
+
}
|
561 |
+
|
562 |
+
.akismet-box .centered {
|
563 |
+
text-align: center;
|
564 |
+
}
|
565 |
+
|
566 |
+
.akismet-enter-api-key-box {
|
567 |
+
margin: 1.5rem 0;
|
568 |
+
}
|
569 |
+
|
570 |
+
.akismet-box .enter-api-key {
|
571 |
+
display: none;
|
572 |
+
margin-top: 1.5rem;
|
573 |
+
}
|
574 |
+
|
575 |
+
.akismet-box .akismet-toggles {
|
576 |
+
margin: 3rem 0;
|
577 |
+
}
|
578 |
+
|
579 |
+
.akismet-box .akismet-ak-connect, .akismet-box .toggle-jp-connect {
|
580 |
+
display: none;
|
581 |
+
}
|
582 |
+
|
583 |
+
.akismet-box .enter-api-key p {
|
584 |
+
padding: 0 1.5rem;
|
585 |
+
}
|
586 |
+
|
587 |
.akismet-button, .akismet-button:hover, .akismet-button:visited {
|
588 |
background: white;
|
589 |
border-color: #c8d7e1;
|
_inc/akismet.js
CHANGED
@@ -169,6 +169,8 @@ jQuery( function ( $ ) {
|
|
169 |
function akismet_check_for_spam(offset, limit) {
|
170 |
var check_for_spam_buttons = $( '.checkforspam' );
|
171 |
|
|
|
|
|
172 |
// We show the percentage complete down to one decimal point so even queues with 100k
|
173 |
// pending comments will show some progress pretty quickly.
|
174 |
var percentage_complete = Math.round( ( recheck_count / check_for_spam_buttons.data( 'pending-comment-count' ) ) * 1000 ) / 10;
|
@@ -181,9 +183,16 @@ jQuery( function ( $ ) {
|
|
181 |
{
|
182 |
'action': 'akismet_recheck_queue',
|
183 |
'offset': offset,
|
184 |
-
'limit': limit
|
|
|
185 |
},
|
186 |
function(result) {
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
recheck_count += result.counts.processed;
|
188 |
spam_count += result.counts.spam;
|
189 |
|
@@ -282,27 +291,64 @@ jQuery( function ( $ ) {
|
|
282 |
/**
|
283 |
* Sets the comment form privacy notice display to hide when one clicks Core's dismiss button on the related admin notice.
|
284 |
*/
|
285 |
-
$( '#akismet-privacy-notice-admin-notice' ).on( 'click', '.notice-dismiss', function(){
|
286 |
-
$.ajax({
|
287 |
-
|
288 |
-
});
|
289 |
});
|
290 |
|
291 |
-
$(
|
292 |
var form = $( this ).closest( 'form' );
|
293 |
|
294 |
form.data( 'initial-state', form.serialize() );
|
295 |
|
296 |
form.on( 'change keyup', function () {
|
297 |
var self = $( this );
|
298 |
-
var submit_button = self.find(
|
299 |
|
300 |
if ( self.serialize() != self.data( 'initial-state' ) ) {
|
301 |
-
submit_button.addClass(
|
302 |
}
|
303 |
else {
|
304 |
-
submit_button.removeClass(
|
305 |
}
|
306 |
} );
|
307 |
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
});
|
169 |
function akismet_check_for_spam(offset, limit) {
|
170 |
var check_for_spam_buttons = $( '.checkforspam' );
|
171 |
|
172 |
+
var nonce = check_for_spam_buttons.data( 'nonce' );
|
173 |
+
|
174 |
// We show the percentage complete down to one decimal point so even queues with 100k
|
175 |
// pending comments will show some progress pretty quickly.
|
176 |
var percentage_complete = Math.round( ( recheck_count / check_for_spam_buttons.data( 'pending-comment-count' ) ) * 1000 ) / 10;
|
183 |
{
|
184 |
'action': 'akismet_recheck_queue',
|
185 |
'offset': offset,
|
186 |
+
'limit': limit,
|
187 |
+
'nonce': nonce
|
188 |
},
|
189 |
function(result) {
|
190 |
+
if ( 'error' in result ) {
|
191 |
+
// An error is only returned in the case of a missing nonce, so we don't need the actual error message.
|
192 |
+
window.location.href = check_for_spam_buttons.data( 'failure-url' );
|
193 |
+
return;
|
194 |
+
}
|
195 |
+
|
196 |
recheck_count += result.counts.processed;
|
197 |
spam_count += result.counts.spam;
|
198 |
|
291 |
/**
|
292 |
* Sets the comment form privacy notice display to hide when one clicks Core's dismiss button on the related admin notice.
|
293 |
*/
|
294 |
+
$( '#akismet-privacy-notice-admin-notice' ).on( 'click', '.notice-dismiss', function () {
|
295 |
+
$.ajax( {
|
296 |
+
url: './options-general.php?page=akismet-key-config&akismet_comment_form_privacy_notice=hide',
|
297 |
+
} );
|
298 |
});
|
299 |
|
300 |
+
$( '.akismet-could-be-primary' ).each( function () {
|
301 |
var form = $( this ).closest( 'form' );
|
302 |
|
303 |
form.data( 'initial-state', form.serialize() );
|
304 |
|
305 |
form.on( 'change keyup', function () {
|
306 |
var self = $( this );
|
307 |
+
var submit_button = self.find( '.akismet-could-be-primary' );
|
308 |
|
309 |
if ( self.serialize() != self.data( 'initial-state' ) ) {
|
310 |
+
submit_button.addClass( 'akismet-is-primary' );
|
311 |
}
|
312 |
else {
|
313 |
+
submit_button.removeClass( 'akismet-is-primary' );
|
314 |
}
|
315 |
} );
|
316 |
} );
|
317 |
+
|
318 |
+
/**
|
319 |
+
* Shows the Enter API key form
|
320 |
+
*/
|
321 |
+
$( '.akismet-enter-api-key-box a' ).on( 'click', function ( e ) {
|
322 |
+
e.preventDefault();
|
323 |
+
|
324 |
+
var div = $( '.enter-api-key' );
|
325 |
+
div.show( 500 );
|
326 |
+
div.find( 'input[name=key]' ).focus();
|
327 |
+
|
328 |
+
$( this ).hide();
|
329 |
+
} );
|
330 |
+
|
331 |
+
/**
|
332 |
+
* Hides the Connect with Jetpack form | Shows the Activate Akismet Account form
|
333 |
+
*/
|
334 |
+
$( 'a.toggle-ak-connect' ).on( 'click', function ( e ) {
|
335 |
+
e.preventDefault();
|
336 |
+
|
337 |
+
$( '.akismet-ak-connect' ).slideToggle('slow');
|
338 |
+
$( 'a.toggle-ak-connect' ).hide();
|
339 |
+
$( '.akismet-jp-connect' ).hide();
|
340 |
+
$( 'a.toggle-jp-connect' ).show();
|
341 |
+
} );
|
342 |
+
|
343 |
+
/**
|
344 |
+
* Shows the Connect with Jetpack form | Hides the Activate Akismet Account form
|
345 |
+
*/
|
346 |
+
$( 'a.toggle-jp-connect' ).on( 'click', function ( e ) {
|
347 |
+
e.preventDefault();
|
348 |
+
|
349 |
+
$( '.akismet-jp-connect' ).slideToggle('slow');
|
350 |
+
$( 'a.toggle-jp-connect' ).hide();
|
351 |
+
$( '.akismet-ak-connect' ).hide();
|
352 |
+
$( 'a.toggle-ak-connect' ).show();
|
353 |
+
} );
|
354 |
});
|
akismet.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
Plugin Name: Akismet Anti-Spam
|
7 |
Plugin URI: https://akismet.com/
|
8 |
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.
|
9 |
-
Version: 4.1.
|
10 |
Author: Automattic
|
11 |
Author URI: https://automattic.com/wordpress-plugins/
|
12 |
License: GPLv2 or later
|
@@ -37,7 +37,7 @@ if ( !function_exists( 'add_action' ) ) {
|
|
37 |
exit;
|
38 |
}
|
39 |
|
40 |
-
define( 'AKISMET_VERSION', '4.1.
|
41 |
define( 'AKISMET__MINIMUM_WP_VERSION', '4.0' );
|
42 |
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
43 |
define( 'AKISMET_DELETE_LIMIT', 100000 );
|
6 |
Plugin Name: Akismet Anti-Spam
|
7 |
Plugin URI: https://akismet.com/
|
8 |
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.
|
9 |
+
Version: 4.1.3
|
10 |
Author: Automattic
|
11 |
Author URI: https://automattic.com/wordpress-plugins/
|
12 |
License: GPLv2 or later
|
37 |
exit;
|
38 |
}
|
39 |
|
40 |
+
define( 'AKISMET_VERSION', '4.1.3' );
|
41 |
define( 'AKISMET__MINIMUM_WP_VERSION', '4.0' );
|
42 |
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
43 |
define( 'AKISMET_DELETE_LIMIT', 100000 );
|
class.akismet-admin.php
CHANGED
@@ -80,6 +80,13 @@ class Akismet_Admin {
|
|
80 |
}
|
81 |
|
82 |
public static function admin_init() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
load_plugin_textdomain( 'akismet' );
|
84 |
add_meta_box( 'akismet-status', __('Comment History', 'akismet'), array( 'Akismet_Admin', 'comment_status_meta_box' ), 'comment', 'normal' );
|
85 |
|
@@ -396,8 +403,10 @@ class Akismet_Admin {
|
|
396 |
href="' . esc_url( $link ) . '"
|
397 |
data-active-label="' . esc_attr( __( 'Checking for Spam', 'akismet' ) ) . '"
|
398 |
data-progress-label-format="' . esc_attr( __( '(%1$s%)', 'akismet' ) ) . '"
|
399 |
-
data-success-url="' . esc_attr( remove_query_arg( 'akismet_recheck', add_query_arg( array( 'akismet_recheck_complete' => 1, 'recheck_count' => urlencode( '__recheck_count__' ), 'spam_count' => urlencode( '__spam_count__' ) ) ) ) ) . '"
|
|
|
400 |
data-pending-comment-count="' . esc_attr( $comments_count->moderated ) . '"
|
|
|
401 |
>';
|
402 |
echo '<span class="akismet-label">' . esc_html__('Check for Spam', 'akismet') . '</span>';
|
403 |
echo '<span class="checkforspam-progress"></span>';
|
@@ -414,6 +423,13 @@ class Akismet_Admin {
|
|
414 |
if ( ! ( isset( $_GET['recheckqueue'] ) || ( isset( $_REQUEST['action'] ) && 'akismet_recheck_queue' == $_REQUEST['action'] ) ) ) {
|
415 |
return;
|
416 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
|
418 |
$result_counts = self::recheck_queue_portion( empty( $_POST['offset'] ) ? 0 : $_POST['offset'], empty( $_POST['limit'] ) ? 100 : $_POST['limit'] );
|
419 |
|
@@ -1061,6 +1077,9 @@ class Akismet_Admin {
|
|
1061 |
|
1062 |
echo '<div class="notice notice-success"><p>' . esc_html( $message ) . '</p></div>';
|
1063 |
}
|
|
|
|
|
|
|
1064 |
|
1065 |
$akismet_comment_form_privacy_notice_option = get_option( 'akismet_comment_form_privacy_notice' );
|
1066 |
if ( ! in_array( $akismet_comment_form_privacy_notice_option, array( 'hide', 'display' ) ) ) {
|
@@ -1108,7 +1127,11 @@ class Akismet_Admin {
|
|
1108 |
if ( !class_exists('Jetpack') )
|
1109 |
return false;
|
1110 |
|
1111 |
-
|
|
|
|
|
|
|
|
|
1112 |
$xml = new Jetpack_IXR_ClientMulticall( array( 'user_id' => get_current_user_id() ) );
|
1113 |
|
1114 |
$xml->addCall( 'wpcom.getUserID' );
|
80 |
}
|
81 |
|
82 |
public static function admin_init() {
|
83 |
+
if ( get_option( 'Activated_Akismet' ) ) {
|
84 |
+
delete_option( 'Activated_Akismet' );
|
85 |
+
if ( ! headers_sent() ) {
|
86 |
+
wp_redirect( add_query_arg( array( 'page' => 'akismet-key-config', 'view' => 'start' ), class_exists( 'Jetpack' ) ? admin_url( 'admin.php' ) : admin_url( 'options-general.php' ) ) );
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
load_plugin_textdomain( 'akismet' );
|
91 |
add_meta_box( 'akismet-status', __('Comment History', 'akismet'), array( 'Akismet_Admin', 'comment_status_meta_box' ), 'comment', 'normal' );
|
92 |
|
403 |
href="' . esc_url( $link ) . '"
|
404 |
data-active-label="' . esc_attr( __( 'Checking for Spam', 'akismet' ) ) . '"
|
405 |
data-progress-label-format="' . esc_attr( __( '(%1$s%)', 'akismet' ) ) . '"
|
406 |
+
data-success-url="' . esc_attr( remove_query_arg( array( 'akismet_recheck', 'akismet_recheck_error' ), add_query_arg( array( 'akismet_recheck_complete' => 1, 'recheck_count' => urlencode( '__recheck_count__' ), 'spam_count' => urlencode( '__spam_count__' ) ) ) ) ) . '"
|
407 |
+
data-failure-url="' . esc_attr( remove_query_arg( array( 'akismet_recheck', 'akismet_recheck_complete' ), add_query_arg( array( 'akismet_recheck_error' => 1 ) ) ) ) . '"
|
408 |
data-pending-comment-count="' . esc_attr( $comments_count->moderated ) . '"
|
409 |
+
data-nonce="' . esc_attr( wp_create_nonce( 'akismet_check_for_spam' ) ) . '"
|
410 |
>';
|
411 |
echo '<span class="akismet-label">' . esc_html__('Check for Spam', 'akismet') . '</span>';
|
412 |
echo '<span class="checkforspam-progress"></span>';
|
423 |
if ( ! ( isset( $_GET['recheckqueue'] ) || ( isset( $_REQUEST['action'] ) && 'akismet_recheck_queue' == $_REQUEST['action'] ) ) ) {
|
424 |
return;
|
425 |
}
|
426 |
+
|
427 |
+
if ( ! wp_verify_nonce( $_POST['nonce'], 'akismet_check_for_spam' ) ) {
|
428 |
+
wp_send_json( array(
|
429 |
+
'error' => __( "You don't have permission to do that."),
|
430 |
+
));
|
431 |
+
return;
|
432 |
+
}
|
433 |
|
434 |
$result_counts = self::recheck_queue_portion( empty( $_POST['offset'] ) ? 0 : $_POST['offset'], empty( $_POST['limit'] ) ? 100 : $_POST['limit'] );
|
435 |
|
1077 |
|
1078 |
echo '<div class="notice notice-success"><p>' . esc_html( $message ) . '</p></div>';
|
1079 |
}
|
1080 |
+
else if ( isset( $_GET['akismet_recheck_error'] ) ) {
|
1081 |
+
echo '<div class="notice notice-error"><p>' . esc_html( __( 'Akismet could not recheck your comments for spam.', 'akismet' ) ) . '</p></div>';
|
1082 |
+
}
|
1083 |
|
1084 |
$akismet_comment_form_privacy_notice_option = get_option( 'akismet_comment_form_privacy_notice' );
|
1085 |
if ( ! in_array( $akismet_comment_form_privacy_notice_option, array( 'hide', 'display' ) ) ) {
|
1127 |
if ( !class_exists('Jetpack') )
|
1128 |
return false;
|
1129 |
|
1130 |
+
if ( defined( 'JETPACK__VERSION' ) && version_compare( JETPACK__VERSION, '7.7', '<' ) ) {
|
1131 |
+
// For version of Jetpack prior to 7.7.
|
1132 |
+
Jetpack::load_xml_rpc_client();
|
1133 |
+
}
|
1134 |
+
|
1135 |
$xml = new Jetpack_IXR_ClientMulticall( array( 'user_id' => get_current_user_id() ) );
|
1136 |
|
1137 |
$xml->addCall( 'wpcom.getUserID' );
|
class.akismet.php
CHANGED
@@ -1277,6 +1277,8 @@ p {
|
|
1277 |
$message = '<strong>'.sprintf(esc_html__( 'Akismet %s requires WordPress %s or higher.' , 'akismet'), AKISMET_VERSION, AKISMET__MINIMUM_WP_VERSION ).'</strong> '.sprintf(__('Please <a href="%1$s">upgrade WordPress</a> to a current version, or <a href="%2$s">downgrade to version 2.4 of the Akismet plugin</a>.', 'akismet'), 'https://codex.wordpress.org/Upgrading_WordPress', 'https://wordpress.org/extend/plugins/akismet/download/');
|
1278 |
|
1279 |
Akismet::bail_on_activation( $message );
|
|
|
|
|
1280 |
}
|
1281 |
}
|
1282 |
|
1277 |
$message = '<strong>'.sprintf(esc_html__( 'Akismet %s requires WordPress %s or higher.' , 'akismet'), AKISMET_VERSION, AKISMET__MINIMUM_WP_VERSION ).'</strong> '.sprintf(__('Please <a href="%1$s">upgrade WordPress</a> to a current version, or <a href="%2$s">downgrade to version 2.4 of the Akismet plugin</a>.', 'akismet'), 'https://codex.wordpress.org/Upgrading_WordPress', 'https://wordpress.org/extend/plugins/akismet/download/');
|
1278 |
|
1279 |
Akismet::bail_on_activation( $message );
|
1280 |
+
} else {
|
1281 |
+
add_option( 'Activated_Akismet', true );
|
1282 |
}
|
1283 |
}
|
1284 |
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs, procifer, stephdau
|
3 |
Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments
|
4 |
Requires at least: 4.0
|
5 |
-
Tested up to: 5.
|
6 |
-
Stable tag: 4.1.
|
7 |
License: GPLv2 or later
|
8 |
|
9 |
Akismet checks your comments and contact form submissions against our global database of spam to protect you and your site from malicious content.
|
@@ -20,16 +20,24 @@ Major features in Akismet include:
|
|
20 |
* Moderators can see the number of approved comments for each user.
|
21 |
* A discard feature that outright blocks the worst spam, saving you disk space and speeding up your site.
|
22 |
|
23 |
-
PS: You'll
|
24 |
|
25 |
== Installation ==
|
26 |
|
27 |
-
Upload the Akismet plugin to your blog,
|
28 |
|
29 |
1, 2, 3: You're done!
|
30 |
|
31 |
== Changelog ==
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
= 4.1.2 =
|
34 |
*Release Date - 14 May 2019*
|
35 |
|
2 |
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs, procifer, stephdau
|
3 |
Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments
|
4 |
Requires at least: 4.0
|
5 |
+
Tested up to: 5.3
|
6 |
+
Stable tag: 4.1.3
|
7 |
License: GPLv2 or later
|
8 |
|
9 |
Akismet checks your comments and contact form submissions against our global database of spam to protect you and your site from malicious content.
|
20 |
* Moderators can see the number of approved comments for each user.
|
21 |
* A discard feature that outright blocks the worst spam, saving you disk space and speeding up your site.
|
22 |
|
23 |
+
PS: You'll be prompted to get an Akismet.com API key to use it, once activated. Keys are free for personal blogs; paid subscriptions are available for businesses and commercial sites.
|
24 |
|
25 |
== Installation ==
|
26 |
|
27 |
+
Upload the Akismet plugin to your blog, activate it, and then enter your Akismet.com API key.
|
28 |
|
29 |
1, 2, 3: You're done!
|
30 |
|
31 |
== Changelog ==
|
32 |
|
33 |
+
= 4.1.3 =
|
34 |
+
*Release Date - 31 October 2019*
|
35 |
+
|
36 |
+
* Prevented an attacker from being able to cause a user to unknowingly recheck their Pending comments for spam.
|
37 |
+
* Improved compatibility with Jetpack 7.7+.
|
38 |
+
* Updated the plugin activation page to use consistent language and markup.
|
39 |
+
* Redirecting users to the Akismet connnection/settings screen upon plugin activation, in an effort to make it easier for people to get setup.
|
40 |
+
|
41 |
= 4.1.2 =
|
42 |
*Release Date - 14 May 2019*
|
43 |
|
views/activate.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="akismet-box">
|
2 |
+
<?php Akismet::view( 'title' ); ?>
|
3 |
+
<?php Akismet::view( 'setup' );?>
|
4 |
+
</div>
|
5 |
+
<br/>
|
6 |
+
<div class="akismet-box">
|
7 |
+
<?php Akismet::view( 'enter' );?>
|
8 |
+
</div>
|
views/connect-jp.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
//phpcs:disable VariableAnalysis
|
4 |
+
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
|
5 |
+
|
6 |
+
?>
|
7 |
+
<div class="akismet-box">
|
8 |
+
<?php Akismet::view( 'title' ); ?>
|
9 |
+
<div class="akismet-jp-connect">
|
10 |
+
<h3><?php esc_html_e( 'Connect with Jetpack', 'akismet' ); ?></h3><?php
|
11 |
+
if ( in_array( $akismet_user->status, array( 'no-sub', 'missing' ) ) ) {?>
|
12 |
+
<p><?php esc_html_e( 'Use your Jetpack connection to set up Akismet.', 'akismet' ); ?></p>
|
13 |
+
<form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank">
|
14 |
+
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
|
15 |
+
<input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
|
16 |
+
<input type="hidden" name="auto-connect" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
|
17 |
+
<input type="hidden" name="redirect" value="plugin-signup"/>
|
18 |
+
<input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
|
19 |
+
</form>
|
20 |
+
<?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
|
21 |
+
<p><?php
|
22 |
+
/* translators: %s is the WordPress.com username */
|
23 |
+
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>
|
24 |
+
<?php } elseif ( $akismet_user->status == 'cancelled' ) { ?>
|
25 |
+
<p><?php esc_html_e( 'Use your Jetpack connection to set up Akismet.', 'akismet' ); ?></p>
|
26 |
+
<form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank">
|
27 |
+
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
|
28 |
+
<input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
|
29 |
+
<input type="hidden" name="user_id" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
|
30 |
+
<input type="hidden" name="redirect" value="upgrade"/>
|
31 |
+
<input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
|
32 |
+
</form>
|
33 |
+
<?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
|
34 |
+
<p><?php
|
35 |
+
/* translators: %s is the WordPress.com email address */
|
36 |
+
echo esc_html( sprintf( __( 'Your subscription for %s is cancelled.' , 'akismet' ), $akismet_user->user_email ) ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p>
|
37 |
+
<?php } elseif ( $akismet_user->status == 'suspended' ) { ?>
|
38 |
+
<div class="akismet-right">
|
39 |
+
<p><a href="https://akismet.com/contact" class="akismet-button akismet-is-primary"><?php esc_html_e( 'Contact Akismet support' , 'akismet' ); ?></a></p>
|
40 |
+
</div>
|
41 |
+
<p>
|
42 |
+
<span class="akismet-alert-text"><?php
|
43 |
+
/* translators: %s is the WordPress.com email address */
|
44 |
+
echo esc_html( sprintf( __( 'Your subscription for %s is suspended.' , 'akismet' ), $akismet_user->user_email ) ); ?></span>
|
45 |
+
<?php esc_html_e( 'No worries! Get in touch and we’ll sort this out.', 'akismet' ); ?>
|
46 |
+
</p>
|
47 |
+
<?php } else { // ask do they want to use akismet account found using jetpack wpcom connection ?>
|
48 |
+
<p><?php esc_html_e( 'Use your Jetpack connection to set up Akismet.', 'akismet' ); ?></p>
|
49 |
+
<form name="akismet_use_wpcom_key" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-activate" class="akismet-right">
|
50 |
+
<input type="hidden" name="key" value="<?php echo esc_attr( $akismet_user->api_key );?>"/>
|
51 |
+
<input type="hidden" name="action" value="enter-key">
|
52 |
+
<?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
|
53 |
+
<input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
|
54 |
+
</form>
|
55 |
+
<?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
|
56 |
+
<p><?php
|
57 |
+
/* translators: %s is the WordPress.com username */
|
58 |
+
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>
|
59 |
+
<?php } ?>
|
60 |
+
</div>
|
61 |
+
<div class="akismet-ak-connect">
|
62 |
+
<?php Akismet::view( 'setup' );?>
|
63 |
+
</div>
|
64 |
+
<div class="centered akismet-toggles">
|
65 |
+
<a href="#" class="toggle-jp-connect"><?php esc_html_e( 'Connect with Jetpack' ); ?></a>
|
66 |
+
<a href="#" class="toggle-ak-connect"><?php esc_html_e( 'Set up a different account' ); ?></a>
|
67 |
+
</div>
|
68 |
+
</div>
|
69 |
+
<br/>
|
70 |
+
<div class="akismet-box">
|
71 |
+
<?php Akismet::view( 'enter' );?>
|
72 |
+
</div>
|
views/enter.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="akismet-enter-api-key-box centered">
|
2 |
+
<a href="#"><?php esc_html_e( 'Manually enter an API key' ); ?></a>
|
3 |
+
<div class="enter-api-key">
|
4 |
+
<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post">
|
5 |
+
<?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
|
6 |
+
<input type="hidden" name="action" value="enter-key">
|
7 |
+
<p style="width: 100%; display: flex; flex-wrap: nowrap; box-sizing: border-box;">
|
8 |
+
<input id="key" name="key" type="text" size="15" value="" placeholder="<?php esc_attr_e( 'Enter your API key' , 'akismet' ); ?>" class="regular-text code" style="flex-grow: 1; margin-right: 1rem;">
|
9 |
+
<input type="submit" name="submit" id="submit" class="akismet-button" value="<?php esc_attr_e( 'Connect with API key', 'akismet' );?>">
|
10 |
+
</p>
|
11 |
+
</form>
|
12 |
+
</div>
|
13 |
+
</div>
|
views/notice.php
CHANGED
@@ -1,3 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php if ( $type == 'plugin' ) :?>
|
2 |
<div class="updated" id="akismet_setup_prompt">
|
3 |
<form name="akismet_activate" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="POST">
|
@@ -138,4 +144,4 @@
|
|
138 |
<p><?php esc_html_e( 'To help your site with transparency under privacy laws like the GDPR, Akismet can display a notice to your users under your comment forms. This feature is disabled by default, however, you can turn it on below.', 'akismet' ); ?></p>
|
139 |
<p><?php printf( __(' Please <a href="%s">enable</a> or <a href="%s">disable</a> this feature. <a href="%s" id="akismet-privacy-notice-control-notice-info-link" target="_blank">More information</a>.', 'akismet' ), admin_url( apply_filters( 'akismet_comment_form_privacy_notice_url_display', 'options-general.php?page=akismet-key-config&akismet_comment_form_privacy_notice=display' ) ), admin_url( apply_filters( 'akismet_comment_form_privacy_notice_url_hide', 'options-general.php?page=akismet-key-config&akismet_comment_form_privacy_notice=hide' ) ), 'https://akismet.com/privacy/' ); ?></p>
|
140 |
</div>
|
141 |
-
<?php endif;?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
//phpcs:disable VariableAnalysis
|
4 |
+
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
|
5 |
+
|
6 |
+
?>
|
7 |
<?php if ( $type == 'plugin' ) :?>
|
8 |
<div class="updated" id="akismet_setup_prompt">
|
9 |
<form name="akismet_activate" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="POST">
|
144 |
<p><?php esc_html_e( 'To help your site with transparency under privacy laws like the GDPR, Akismet can display a notice to your users under your comment forms. This feature is disabled by default, however, you can turn it on below.', 'akismet' ); ?></p>
|
145 |
<p><?php printf( __(' Please <a href="%s">enable</a> or <a href="%s">disable</a> this feature. <a href="%s" id="akismet-privacy-notice-control-notice-info-link" target="_blank">More information</a>.', 'akismet' ), admin_url( apply_filters( 'akismet_comment_form_privacy_notice_url_display', 'options-general.php?page=akismet-key-config&akismet_comment_form_privacy_notice=display' ) ), admin_url( apply_filters( 'akismet_comment_form_privacy_notice_url_hide', 'options-general.php?page=akismet-key-config&akismet_comment_form_privacy_notice=hide' ) ), 'https://akismet.com/privacy/' ); ?></p>
|
146 |
</div>
|
147 |
+
<?php endif;?>
|
views/predefined.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="akismet-box">
|
2 |
+
<h2><?php esc_html_e( 'Manual Configuration', 'akismet' ); ?></h2>
|
3 |
+
<p>
|
4 |
+
<?php
|
5 |
+
|
6 |
+
/* translators: %s is the wp-config.php file */
|
7 |
+
echo sprintf( esc_html__( 'An Akismet API key has been defined in the %s file for this site.', 'akismet' ), '<code>wp-config.php</code>' );
|
8 |
+
|
9 |
+
?>
|
10 |
+
</p>
|
11 |
+
</div>
|
views/setup.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h3><?php esc_html_e( 'Set Up Akismet' , 'akismet' );?></h3>
|
2 |
+
<div class="akismet-right">
|
3 |
+
<?php Akismet::view( 'get', array( 'text' => __( 'Set up your Akismet account' , 'akismet' ), 'classes' => array( 'akismet-button', 'akismet-is-primary' ) ) ); ?>
|
4 |
+
</div>
|
5 |
+
<p><?php esc_html_e( 'Set up your Akismet account to enable spam filtering on this site.', 'akismet' ); ?></p>
|
views/start.php
CHANGED
@@ -1,3 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<div id="akismet-plugin-container">
|
2 |
<div class="akismet-masthead">
|
3 |
<div class="akismet-masthead__inside-container">
|
@@ -7,96 +13,19 @@
|
|
7 |
</div>
|
8 |
</div>
|
9 |
<div class="akismet-lower">
|
10 |
-
<?php Akismet_Admin::display_status()
|
11 |
-
|
12 |
-
<div class="akismet-box">
|
13 |
-
<h2><?php esc_html_e( 'Eliminate spam from your site', 'akismet' ); ?></h2>
|
14 |
-
<p><?php esc_html_e( 'Select one of the options below to get started.', 'akismet' ); ?></p>
|
15 |
-
</div>
|
16 |
<div class="akismet-boxes">
|
17 |
-
<?php
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
<input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
|
29 |
-
</form>
|
30 |
-
<?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
|
31 |
-
<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>
|
32 |
-
</div>
|
33 |
-
<?php } elseif ( $akismet_user->status == 'cancelled' ) { ?>
|
34 |
-
<div class="akismet-box">
|
35 |
-
<h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
|
36 |
-
<form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank">
|
37 |
-
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
|
38 |
-
<input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
|
39 |
-
<input type="hidden" name="user_id" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
|
40 |
-
<input type="hidden" name="redirect" value="upgrade"/>
|
41 |
-
<input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Reactivate Akismet' , 'akismet' ); ?>"/>
|
42 |
-
</form>
|
43 |
-
<p><?php echo esc_html( sprintf( __( 'Your subscription for %s is cancelled.' , 'akismet' ), $akismet_user->user_email ) ); ?></p>
|
44 |
-
</div>
|
45 |
-
<?php } elseif ( $akismet_user->status == 'suspended' ) { ?>
|
46 |
-
<div class="centered akismet-box">
|
47 |
-
<h3><?php esc_html_e( 'Connected via Jetpack' , 'akismet' ); ?></h3>
|
48 |
-
<p class="akismet-alert-text"><?php echo esc_html( sprintf( __( 'Your subscription for %s is suspended.' , 'akismet' ), $akismet_user->user_email ) ); ?></p>
|
49 |
-
<p><?php esc_html_e( 'No worries! Get in touch and we’ll sort this out.', 'akismet' ); ?></p>
|
50 |
-
<p><a href="https://akismet.com/contact" class="akismet-button akismet-is-primary"><?php esc_html_e( 'Contact Akismet support' , 'akismet' ); ?></a></p>
|
51 |
-
</div>
|
52 |
-
<?php } else { // ask do they want to use akismet account found using jetpack wpcom connection ?>
|
53 |
-
<div class="akismet-box">
|
54 |
-
<h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
|
55 |
-
<p><?php esc_html_e( 'Use your Jetpack connection to activate Akismet.', 'akismet' ); ?></p>
|
56 |
-
<form name="akismet_use_wpcom_key" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-activate" class="akismet-right">
|
57 |
-
<input type="hidden" name="key" value="<?php echo esc_attr( $akismet_user->api_key );?>"/>
|
58 |
-
<input type="hidden" name="action" value="enter-key">
|
59 |
-
<?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
|
60 |
-
<input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
|
61 |
-
</form>
|
62 |
-
<?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
|
63 |
-
<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>
|
64 |
-
</div>
|
65 |
-
<?php } ?>
|
66 |
-
<div class="akismet-box">
|
67 |
-
<h3><?php esc_html_e( 'Or sign up with a different email address', 'akismet' ); ?></h3>
|
68 |
-
<div class="akismet-right">
|
69 |
-
<?php Akismet::view( 'get', array( 'text' => __( 'Sign up with a different email address' , 'akismet' ), 'classes' => array( 'akismet-button' ) ) ); ?>
|
70 |
-
</div>
|
71 |
-
<p><?php esc_html_e( 'Choose this option to use Akismet independently of your Jetpack connection.', 'akismet' ); ?></p>
|
72 |
-
</div>
|
73 |
-
<?php } else { ?>
|
74 |
-
<div class="akismet-box">
|
75 |
-
<h3><?php esc_html_e( 'Activate Akismet' , 'akismet' );?></h3>
|
76 |
-
<div class="akismet-right">
|
77 |
-
<?php Akismet::view( 'get', array( 'text' => __( 'Get your API key' , 'akismet' ), 'classes' => array( 'akismet-button', 'akismet-is-primary' ) ) ); ?>
|
78 |
-
</div>
|
79 |
-
<p><?php esc_html_e( 'Log in or sign up now.', 'akismet' ); ?></p>
|
80 |
-
</div>
|
81 |
-
<?php } ?>
|
82 |
-
<div class="akismet-box">
|
83 |
-
<h3><?php esc_html_e( 'Or enter an API key', 'akismet' ); ?></h3>
|
84 |
-
<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>
|
85 |
-
<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post">
|
86 |
-
<?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
|
87 |
-
<input type="hidden" name="action" value="enter-key">
|
88 |
-
<p style="width: 100%; display: flex; flex-wrap: nowrap; box-sizing: border-box;">
|
89 |
-
<input id="key" name="key" type="text" size="15" value="" class="regular-text code" style="flex-grow: 1; margin-right: 1rem;">
|
90 |
-
<input type="submit" name="submit" id="submit" class="akismet-button" value="<?php esc_attr_e( 'Connect with API key', 'akismet' );?>">
|
91 |
-
</p>
|
92 |
-
</form>
|
93 |
-
</div>
|
94 |
-
<?php } else { ?>
|
95 |
-
<div class="akismet-box">
|
96 |
-
<h2><?php esc_html_e( 'Manual Configuration', 'akismet' ); ?></h2>
|
97 |
-
<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>
|
98 |
-
</div>
|
99 |
-
<?php } ?>
|
100 |
</div>
|
101 |
</div>
|
102 |
</div>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
//phpcs:disable VariableAnalysis
|
4 |
+
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
|
5 |
+
|
6 |
+
?>
|
7 |
<div id="akismet-plugin-container">
|
8 |
<div class="akismet-masthead">
|
9 |
<div class="akismet-masthead__inside-container">
|
13 |
</div>
|
14 |
</div>
|
15 |
<div class="akismet-lower">
|
16 |
+
<?php Akismet_Admin::display_status();?>
|
|
|
|
|
|
|
|
|
|
|
17 |
<div class="akismet-boxes">
|
18 |
+
<?php
|
19 |
+
|
20 |
+
if ( Akismet::predefined_api_key() ) {
|
21 |
+
Akismet::view( 'predefined' );
|
22 |
+
} elseif ( $akismet_user && in_array( $akismet_user->status, array( 'active', 'active-dunning', 'no-sub', 'missing', 'cancelled', 'suspended' ) ) ) {
|
23 |
+
Akismet::view( 'connect-jp', compact( 'akismet_user' ) );
|
24 |
+
} else {
|
25 |
+
Akismet::view( 'activate' );
|
26 |
+
}
|
27 |
+
|
28 |
+
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
</div>
|
30 |
</div>
|
31 |
</div>
|
views/title.php
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<div class="centered akismet-box-header">
|
2 |
+
<h2><?php esc_html_e( 'Eliminate spam from your site', 'akismet' ); ?></h2>
|
3 |
+
</div>
|