summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/akismet/_inc/akismet.css6
-rw-r--r--plugins/akismet/_inc/akismet.js11
-rw-r--r--plugins/akismet/akismet.php4
-rw-r--r--plugins/akismet/class.akismet-admin.php54
-rw-r--r--plugins/akismet/class.akismet.php35
-rw-r--r--plugins/akismet/readme.txt29
-rw-r--r--plugins/akismet/views/config.php13
-rw-r--r--plugins/akismet/views/notice.php10
8 files changed, 151 insertions, 11 deletions
diff --git a/plugins/akismet/_inc/akismet.css b/plugins/akismet/_inc/akismet.css
index 85f3c5ec..bf40fb14 100644
--- a/plugins/akismet/_inc/akismet.css
+++ b/plugins/akismet/_inc/akismet.css
@@ -417,6 +417,10 @@ table.comments td.comment p a:after {
padding: 1.5rem;
}
+.akismet-lower .notice {
+ margin-bottom: 2rem;
+}
+
.akismet-card {
margin-top: 1rem;
margin-bottom: 0;
@@ -583,4 +587,4 @@ table.comments td.comment p a:after {
.akismet-section-header__actions {
line-height: 1.75rem;
-} \ No newline at end of file
+}
diff --git a/plugins/akismet/_inc/akismet.js b/plugins/akismet/_inc/akismet.js
index cac4d57f..b5df186f 100644
--- a/plugins/akismet/_inc/akismet.js
+++ b/plugins/akismet/_inc/akismet.js
@@ -273,4 +273,13 @@ jQuery( function ( $ ) {
var img = new Image();
img.src = akismet_mshot_url( linkUrl );
}
-}); \ No newline at end of file
+
+ /**
+ * Sets the comment form privacy notice display to hide when one clicks Core's dismiss button on the related admin notice.
+ */
+ $( '#akismet-privacy-notice-admin-notice' ).on( 'click', '.notice-dismiss', function(){
+ $.ajax({
+ url: './options-general.php?page=akismet-key-config&akismet_comment_form_privacy_notice=hide',
+ });
+ });
+});
diff --git a/plugins/akismet/akismet.php b/plugins/akismet/akismet.php
index a8ea4a15..e16f8888 100644
--- a/plugins/akismet/akismet.php
+++ b/plugins/akismet/akismet.php
@@ -6,7 +6,7 @@
Plugin Name: Akismet Anti-Spam
Plugin URI: https://akismet.com/
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.
-Version: 4.0.3
+Version: 4.0.7
Author: Automattic
Author URI: https://automattic.com/wordpress-plugins/
License: GPLv2 or later
@@ -37,7 +37,7 @@ if ( !function_exists( 'add_action' ) ) {
exit;
}
-define( 'AKISMET_VERSION', '4.0.3' );
+define( 'AKISMET_VERSION', '4.0.7' );
define( 'AKISMET__MINIMUM_WP_VERSION', '4.0' );
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'AKISMET_DELETE_LIMIT', 100000 );
diff --git a/plugins/akismet/class.akismet-admin.php b/plugins/akismet/class.akismet-admin.php
index 42e884f9..1e806173 100644
--- a/plugins/akismet/class.akismet-admin.php
+++ b/plugins/akismet/class.akismet-admin.php
@@ -32,6 +32,10 @@ class Akismet_Admin {
if ( isset( $_POST['action'] ) && $_POST['action'] == 'enter-key' ) {
self::enter_api_key();
}
+
+ if ( ! empty( $_GET['akismet_comment_form_privacy_notice'] ) && empty( $_GET['settings-updated']) ) {
+ self::set_form_privacy_notice_option( $_GET['akismet_comment_form_privacy_notice'] );
+ }
}
public static function init_hooks() {
@@ -65,11 +69,23 @@ class Akismet_Admin {
add_filter( 'wxr_export_skip_commentmeta', array( 'Akismet_Admin', 'exclude_commentmeta_from_export' ), 10, 3 );
add_filter( 'all_plugins', array( 'Akismet_Admin', 'modify_plugin_description' ) );
+
+ if ( class_exists( 'Jetpack' ) ) {
+ add_filter( 'akismet_comment_form_privacy_notice_url_display', array( 'Akismet_Admin', 'jetpack_comment_form_privacy_notice_url' ) );
+ add_filter( 'akismet_comment_form_privacy_notice_url_hide', array( 'Akismet_Admin', 'jetpack_comment_form_privacy_notice_url' ) );
+ }
}
public static function admin_init() {
load_plugin_textdomain( 'akismet' );
add_meta_box( 'akismet-status', __('Comment History', 'akismet'), array( 'Akismet_Admin', 'comment_status_meta_box' ), 'comment', 'normal' );
+
+ if ( function_exists( 'wp_add_privacy_policy_content' ) ) {
+ wp_add_privacy_policy_content(
+ __( 'Akismet', 'akismet' ),
+ __( 'We collect information about visitors who comment on Sites that use our Akismet anti-spam service. The information we collect depends on how the User sets up Akismet for the Site, but typically includes the commenter\'s IP address, user agent, referrer, and Site URL (along with other information directly provided by the commenter such as their name, username, email address, and the comment itself).', 'akismet' )
+ );
+ }
}
public static function admin_menu() {
@@ -260,7 +276,13 @@ class Akismet_Admin {
foreach( array( 'akismet_strictness', 'akismet_show_user_comments_approved' ) as $option ) {
update_option( $option, isset( $_POST[$option] ) && (int) $_POST[$option] == 1 ? '1' : '0' );
}
-
+
+ if ( ! empty( $_POST['akismet_comment_form_privacy_notice'] ) ) {
+ self::set_form_privacy_notice_option( $_POST['akismet_comment_form_privacy_notice'] );
+ } else {
+ self::set_form_privacy_notice_option( 'hide' );
+ }
+
if ( Akismet::predefined_api_key() ) {
return false; //shouldn't have option to save key if already defined
}
@@ -825,6 +847,14 @@ class Akismet_Admin {
) );
}
+ public static function display_privacy_notice_control_warning() {
+ if ( !current_user_can( 'manage_options' ) )
+ return;
+ Akismet::view( 'notice', array(
+ 'type' => 'privacy',
+ ) );
+ }
+
public static function display_spam_check_warning() {
Akismet::fix_scheduled_recheck();
@@ -958,6 +988,10 @@ class Akismet_Admin {
$notices[] = array( 'type' => $akismet_user->status );
}
+ if ( false === get_option( 'akismet_comment_form_privacy_notice' ) ) {
+ $notices[] = array( 'type' => 'privacy' );
+ }
+
/*
// To see all variants when testing.
$notices[] = array( 'type' => 'active-notice', 'time_saved' => 'Cleaning up spam takes time. Akismet has saved you 1 minute!' );
@@ -1024,6 +1058,14 @@ class Akismet_Admin {
echo '<div class="notice notice-success"><p>' . esc_html( $message ) . '</p></div>';
}
+
+ $akismet_comment_form_privacy_notice_option = get_option( 'akismet_comment_form_privacy_notice' );
+ if ( ! in_array( $akismet_comment_form_privacy_notice_option, array( 'hide', 'display' ) ) ) {
+ $api_key = Akismet::get_api_key();
+ if ( ! empty( $api_key ) ) {
+ self::display_privacy_notice_control_warning();
+ }
+ }
}
public static function display_status() {
@@ -1128,4 +1170,14 @@ class Akismet_Admin {
return $all_plugins;
}
+
+ private static function set_form_privacy_notice_option( $state ) {
+ if ( in_array( $state, array( 'display', 'hide' ) ) ) {
+ update_option( 'akismet_comment_form_privacy_notice', $state );
+ }
+ }
+
+ public static function jetpack_comment_form_privacy_notice_url( $url ) {
+ return str_replace( 'options-general.php', 'admin.php', $url );
+ }
}
diff --git a/plugins/akismet/class.akismet.php b/plugins/akismet/class.akismet.php
index 0ed53fce..146c13c5 100644
--- a/plugins/akismet/class.akismet.php
+++ b/plugins/akismet/class.akismet.php
@@ -51,6 +51,9 @@ class Akismet {
// Jetpack compatibility
add_filter( 'jetpack_options_whitelist', array( 'Akismet', 'add_to_jetpack_options_whitelist' ) );
add_action( 'update_option_wordpress_api_key', array( 'Akismet', 'updated_option' ), 10, 2 );
+ add_action( 'add_option_wordpress_api_key', array( 'Akismet', 'added_option' ), 10, 2 );
+
+ add_action( 'comment_form_after', array( 'Akismet', 'display_comment_form_privacy_notice' ) );
}
public static function get_api_key() {
@@ -110,6 +113,18 @@ class Akismet {
}
}
+ /**
+ * Treat the creation of an API key the same as updating the API key to a new value.
+ *
+ * @param mixed $option_name Will always be "wordpress_api_key", until something else hooks in here.
+ * @param mixed $value The option value.
+ */
+ public static function added_option( $option_name, $value ) {
+ if ( 'wordpress_api_key' === $option_name ) {
+ return self::updated_option( '', $value );
+ }
+ }
+
public static function rest_auto_check_comment( $commentdata ) {
self::$is_rest_api_call = true;
@@ -1187,7 +1202,7 @@ class Akismet {
<!doctype html>
<html>
<head>
-<meta charset="<?php bloginfo( 'charset' ); ?>">
+<meta charset="<?php bloginfo( 'charset' ); ?>" />
<style>
* {
text-align: center;
@@ -1200,6 +1215,7 @@ p {
font-size: 18px;
}
</style>
+</head>
<body>
<p><?php echo esc_html( $message ); ?></p>
</body>
@@ -1388,4 +1404,21 @@ p {
return apply_filters( 'akismet_predefined_api_key', false );
}
+
+ /**
+ * Controls the display of a privacy related notice underneath the comment form using the `akismet_comment_form_privacy_notice` option and filter respectively.
+ * Default is top not display the notice, leaving the choice to site admins, or integrators.
+ */
+ public static function display_comment_form_privacy_notice() {
+ if ( 'display' !== apply_filters( 'akismet_comment_form_privacy_notice', get_option( 'akismet_comment_form_privacy_notice', 'hide' ) ) ) {
+ return;
+ }
+ echo apply_filters(
+ 'akismet_comment_form_privacy_notice_markup',
+ '<p class="akismet_comment_form_privacy_notice">' . sprintf(
+ __( 'This site uses Akismet to reduce spam. <a href="%s" target="_blank">Learn how your comment data is processed</a>.', 'akismet' ),
+ 'https://akismet.com/privacy/'
+ ) . '</p>'
+ );
+ }
}
diff --git a/plugins/akismet/readme.txt b/plugins/akismet/readme.txt
index c892430d..f6d67c1c 100644
--- a/plugins/akismet/readme.txt
+++ b/plugins/akismet/readme.txt
@@ -2,8 +2,8 @@
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs, procifer, stephdau
Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments
Requires at least: 4.0
-Tested up to: 4.9.1
-Stable tag: 4.0.3
+Tested up to: 4.9.6
+Stable tag: 4.0.7
License: GPLv2 or later
Akismet checks your comments and contact form submissions against our global database of spam to protect you and your site from malicious content.
@@ -30,6 +30,31 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co
== Changelog ==
+= 4.0.7 =
+*Release Date - 28 May 2018*
+
+* Based on user feedback, the link on "Learn how your comment data is processed." in the optional privacy notice now has a `target` of `_blank` and opens in a new tab/window.
+* Updated the in-admin privacy notice to use the term "comment" instead of "contact" in "Akismet can display a notice to your users under your comment forms."
+* Only show in-admin privacy notice if Akismet has an API Key configured
+
+= 4.0.6 =
+*Release Date - 26 May 2018*
+
+* Moved away from using `empty( get_option() )` to instantiating a variable to be compatible with older versions of PHP (5.3, 5.4, etc).
+
+= 4.0.5 =
+*Release Date - 26 May 2018*
+
+* Corrected version number after tagging. Sorry...
+
+= 4.0.4 =
+*Release Date - 26 May 2018*
+
+* Added a hook to provide Akismet-specific privacy information for a site's privacy policy.
+* Added tools to control the display of a privacy related notice under comment forms.
+* Fixed HTML in activation failure message to close META and HEAD tag properly.
+* Fixed a bug that would sometimes prevent Akismet from being correctly auto-configured.
+
= 4.0.3 =
*Release Date - 19 February 2018*
diff --git a/plugins/akismet/views/config.php b/plugins/akismet/views/config.php
index 59dd18c5..53d9fa86 100644
--- a/plugins/akismet/views/config.php
+++ b/plugins/akismet/views/config.php
@@ -151,6 +151,17 @@
?>
</td>
</tr>
+ <tr>
+ <th class="comment-form-privacy-notice" align="left" scope="row"><?php esc_html_e('Privacy', 'akismet'); ?></th>
+ <td></td>
+ <td align="left">
+ <fieldset><legend class="screen-reader-text"><span><?php esc_html_e('Akismet privacy notice', 'akismet'); ?></span></legend>
+ <p><label for="akismet_comment_form_privacy_notice_display"><input type="radio" name="akismet_comment_form_privacy_notice" id="akismet_comment_form_privacy_notice_display" value="display" <?php checked('display', get_option('akismet_comment_form_privacy_notice')); ?> /> <?php esc_html_e('Display a privacy notice under your comment forms.', 'akismet'); ?></label></p>
+ <p><label for="akismet_comment_form_privacy_notice_hide"><input type="radio" name="akismet_comment_form_privacy_notice" id="akismet_comment_form_privacy_notice_hide" value="hide" <?php echo in_array( get_option('akismet_comment_form_privacy_notice'), array('display', 'hide') ) ? checked('hide', get_option('akismet_comment_form_privacy_notice'), false) : 'checked="checked"'; ?> /> <?php esc_html_e('Do not display privacy notice.', 'akismet'); ?></label></p>
+ </fieldset>
+ <span class="akismet-note"><?php esc_html_e( 'To help your site be compliant with GDPR and other laws requiring notification of tracking, Akismet can display a notice to your users on your contact form. This feature is disabled by default, however, if you or your audience is located in Europe, you need to turn it on.', 'akismet' );?></span>
+ </td>
+ </tr>
</tbody>
</table>
<div class="akismet-card-actions">
@@ -228,4 +239,4 @@
<?php } ?>
<?php endif;?>
</div>
-</div> \ No newline at end of file
+</div>
diff --git a/plugins/akismet/views/notice.php b/plugins/akismet/views/notice.php
index 4f65b840..9f482b25 100644
--- a/plugins/akismet/views/notice.php
+++ b/plugins/akismet/views/notice.php
@@ -15,7 +15,7 @@
<?php elseif ( $type == 'spam-check' ) :?>
<div class="notice notice-warning">
<p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' );?></strong></p>
- <p><?php printf( __( 'Some comments have not yet been checked for spam by Akismet. They have been temporarily held for moderation and will automatically be rechecked later.', 'akismet' ) ); ?></p>
+ <p><?php esc_html_e( 'Some comments have not yet been checked for spam by Akismet. They have been temporarily held for moderation and will automatically be rechecked later.', 'akismet' ); ?></p>
<?php if ( $link_text ) { ?>
<p><?php echo $link_text; ?></p>
<?php } ?>
@@ -132,4 +132,10 @@
</p>
<?php endif; ?>
</div>
-<?php endif;?> \ No newline at end of file
+<?php elseif ( $type == 'privacy' ) :?>
+<div class="notice notice-warning is-dismissible" id="akismet-privacy-notice-admin-notice">
+ <p><strong><?php esc_html_e( 'Akismet & Privacy.', 'akismet' );?></strong></p>
+ <p><?php esc_html_e( 'To help your site be compliant with GDPR and other laws requiring notification of tracking, Akismet can display a notice to your users under your comment forms. This feature is disabled by default, however, if you or your audience is located in Europe, you need to turn it on.', 'akismet' ); ?></p>
+ <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>
+</div>
+<?php endif;?>