summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2017-09-01 20:12:26 -0400
committerAnthony G. Basile <blueness@gentoo.org>2017-09-01 20:12:26 -0400
commit05952b31eb58ff8cd2da3923cc86d78aca6aec06 (patch)
treebfc92e447ff9a2fa18cf4695f23e9883e18f1cb6 /plugins/akismet
parentUpdate mantra 2.6.1.1 (diff)
downloadblogs-gentoo-05952b31eb58ff8cd2da3923cc86d78aca6aec06.tar.gz
blogs-gentoo-05952b31eb58ff8cd2da3923cc86d78aca6aec06.tar.bz2
blogs-gentoo-05952b31eb58ff8cd2da3923cc86d78aca6aec06.zip
Update akismet 3.3.4
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'plugins/akismet')
-rw-r--r--plugins/akismet/_inc/akismet.js54
-rw-r--r--plugins/akismet/akismet.php4
-rw-r--r--plugins/akismet/class.akismet-admin.php40
-rw-r--r--plugins/akismet/class.akismet-widget.php2
-rw-r--r--plugins/akismet/class.akismet.php28
-rw-r--r--plugins/akismet/readme.txt20
-rw-r--r--plugins/akismet/views/config.php110
-rw-r--r--plugins/akismet/views/notice.php4
-rw-r--r--plugins/akismet/views/start.php147
9 files changed, 249 insertions, 160 deletions
diff --git a/plugins/akismet/_inc/akismet.js b/plugins/akismet/_inc/akismet.js
index b7ff7194..c1ddc8b0 100644
--- a/plugins/akismet/_inc/akismet.js
+++ b/plugins/akismet/_inc/akismet.js
@@ -3,6 +3,8 @@ jQuery( function ( $ ) {
var mshotSecondTryTimer = null
var mshotThirdTryTimer = null
+ var mshotEnabledLinkSelector = 'a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type, td.comment p a';
+
$('.akismet-status').each(function () {
var thisId = $(this).attr('commentid');
$(this).prependTo('#comment-' + thisId + ' .column-comment');
@@ -82,7 +84,7 @@ jQuery( function ( $ ) {
});
// Show a preview image of the hovered URL. Applies to author URLs and URLs inside the comments.
- $( '#the-comment-list' ).on( 'mouseover', 'a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type, td.comment p a', function () {
+ $( '#the-comment-list' ).on( 'mouseover', mshotEnabledLinkSelector, function () {
clearTimeout( mshotRemovalTimer );
if ( $( '.akismet-mshot' ).length > 0 ) {
@@ -99,9 +101,9 @@ jQuery( function ( $ ) {
clearTimeout( mshotSecondTryTimer );
clearTimeout( mshotThirdTryTimer );
- var thisHref = encodeURIComponent( $( this ).attr( 'href' ) );
+ var thisHref = $( this ).attr( 'href' );
- 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>' );
+ 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>' );
mShot.data( 'link', this );
var offset = $( this ).offset();
@@ -111,12 +113,15 @@ jQuery( function ( $ ) {
top: offset.top + ( $( this ).height() / 2 ) - 101 // 101 = top offset of the arrow plus the top border thickness
} );
+ // These retries appear to be superfluous if .mshot-image has already loaded, but it's because mShots
+ // can return a "Generating thumbnail..." image if it doesn't have a thumbnail ready, so we need
+ // to retry to see if we can get the newly generated thumbnail.
mshotSecondTryTimer = setTimeout( function () {
- mShot.find( '.mshot-image' ).attr( 'src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=2' );
+ mShot.find( '.mshot-image' ).attr( 'src', akismet_mshot_url( thisHref, 2 ) );
}, 6000 );
mshotThirdTryTimer = setTimeout( function () {
- mShot.find( '.mshot-image' ).attr( 'src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=3' );
+ mShot.find( '.mshot-image' ).attr( 'src', akismet_mshot_url( thisHref, 3 ) );
}, 12000 );
$( 'body' ).append( mShot );
@@ -127,6 +132,18 @@ jQuery( function ( $ ) {
$( '.akismet-mshot' ).remove();
}, 200 );
+ } ).on( 'mouseover', 'tr', function () {
+ // When the mouse hovers over a comment row, begin preloading mshots for any links in the comment or the comment author.
+ var linksToPreloadMshotsFor = $( this ).find( mshotEnabledLinkSelector );
+
+ linksToPreloadMshotsFor.each( function () {
+ // Don't attempt to preload an mshot for a single link twice. Browser caching should cover this, but in case of
+ // race conditions, save a flag locally when we've begun trying to preload one.
+ if ( ! $( this ).data( 'akismet-mshot-preloaded' ) ) {
+ akismet_preload_mshot( $( this ).attr( 'href' ) );
+ $( this ).data( 'akismet-mshot-preloaded', true );
+ }
+ } );
} );
$('.checkforspam:not(.button-disabled)').click( function(e) {
@@ -223,4 +240,31 @@ jQuery( function ( $ ) {
}
});
}
+
+ /**
+ * Generate an mShot URL if given a link URL.
+ *
+ * @param string linkUrl
+ * @param int retry If retrying a request, the number of the retry.
+ * @return string The mShot URL;
+ */
+ function akismet_mshot_url( linkUrl, retry ) {
+ var mshotUrl = '//s0.wordpress.com/mshots/v1/' + encodeURIComponent( linkUrl ) + '?w=900';
+
+ if ( retry ) {
+ mshotUrl += '&r=' + encodeURIComponent( retry );
+ }
+
+ return mshotUrl;
+ }
+
+ /**
+ * Begin loading an mShot preview of a link.
+ *
+ * @param string linkUrl
+ */
+ function akismet_preload_mshot( linkUrl ) {
+ var img = new Image();
+ img.src = akismet_mshot_url( linkUrl );
+ }
}); \ No newline at end of file
diff --git a/plugins/akismet/akismet.php b/plugins/akismet/akismet.php
index ca21d8b7..9894295b 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: 3.3.2
+Version: 3.3.4
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', '3.3.2' );
+define( 'AKISMET_VERSION', '3.3.4' );
define( 'AKISMET__MINIMUM_WP_VERSION', '3.7' );
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 fe29233d..aed5e3d5 100644
--- a/plugins/akismet/class.akismet-admin.php
+++ b/plugins/akismet/class.akismet-admin.php
@@ -208,7 +208,7 @@ class Akismet_Admin {
'content' =>
'<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' .
'<p>' . esc_html__( 'Akismet filters out spam, so you can focus on more important things.' , 'akismet') . '</p>' .
- '<p>' . esc_html__( 'On this page, you are able to enter/remove an API key, view account information and view spam stats.' , 'akismet') . '</p>',
+ '<p>' . esc_html__( 'On this page, you are able to update your Akismet settings and view spam stats.' , 'akismet') . '</p>',
)
);
@@ -218,22 +218,24 @@ class Akismet_Admin {
'title' => __( 'Settings' , 'akismet'),
'content' =>
'<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' .
- '<p><strong>' . esc_html__( 'API Key' , 'akismet') . '</strong> - ' . esc_html__( 'Enter/remove an API key.' , 'akismet') . '</p>' .
+ ( Akismet::predefined_api_key() ? '' : '<p><strong>' . esc_html__( 'API Key' , 'akismet') . '</strong> - ' . esc_html__( 'Enter/remove an API key.' , 'akismet') . '</p>' ) .
'<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>' .
'<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>',
)
);
- $current_screen->add_help_tab(
- array(
- 'id' => 'account',
- 'title' => __( 'Account' , 'akismet'),
- 'content' =>
- '<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' .
- '<p><strong>' . esc_html__( 'Subscription Type' , 'akismet') . '</strong> - ' . esc_html__( 'The Akismet subscription plan' , 'akismet') . '</p>' .
- '<p><strong>' . esc_html__( 'Status' , 'akismet') . '</strong> - ' . esc_html__( 'The subscription status - active, cancelled or suspended' , 'akismet') . '</p>',
- )
- );
+ if ( ! Akismet::predefined_api_key() ) {
+ $current_screen->add_help_tab(
+ array(
+ 'id' => 'account',
+ 'title' => __( 'Account' , 'akismet'),
+ 'content' =>
+ '<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' .
+ '<p><strong>' . esc_html__( 'Subscription Type' , 'akismet') . '</strong> - ' . esc_html__( 'The Akismet subscription plan' , 'akismet') . '</p>' .
+ '<p><strong>' . esc_html__( 'Status' , 'akismet') . '</strong> - ' . esc_html__( 'The subscription status - active, cancelled or suspended' , 'akismet') . '</p>',
+ )
+ );
+ }
}
}
@@ -255,10 +257,11 @@ 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 ( defined( 'WPCOM_API_KEY' ) )
+
+ if ( Akismet::predefined_api_key() ) {
return false; //shouldn't have option to save key if already defined
-
+ }
+
$new_key = preg_replace( '/[^a-f0-9]/i', '', $_POST['key'] );
$old_key = Akismet::get_api_key();
@@ -907,6 +910,11 @@ class Akismet_Admin {
if ( get_option( 'akismet_strictness' ) === false ) {
add_option( 'akismet_strictness', ( get_option( 'akismet_discard_month' ) === 'false' ? '0' : '1' ) );
}
+
+ // Sync the local "Total spam blocked" count with the authoritative count from the server.
+ if ( isset( $stat_totals['all'], $stat_totals['all']->spam ) ) {
+ update_option( 'akismet_spam_count', $stat_totals['all']->spam );
+ }
$notices = array();
@@ -1011,7 +1019,7 @@ class Akismet_Admin {
public static function display_status() {
if ( ! self::get_server_connectivity() ) {
- Akismet::view( 'notice', compact( 'servers-be-down' ) );
+ Akismet::view( 'notice', array( 'type' => 'servers-be-down' ) );
}
else if ( ! empty( self::$notices ) ) {
foreach ( self::$notices as $index => $type ) {
diff --git a/plugins/akismet/class.akismet-widget.php b/plugins/akismet/class.akismet-widget.php
index 474f7592..55b0f35c 100644
--- a/plugins/akismet/class.akismet-widget.php
+++ b/plugins/akismet/class.akismet-widget.php
@@ -62,7 +62,7 @@ class Akismet_Widget extends WP_Widget {
}
function form( $instance ) {
- if ( $instance ) {
+ if ( $instance && isset( $instance['title'] ) ) {
$title = $instance['title'];
}
else {
diff --git a/plugins/akismet/class.akismet.php b/plugins/akismet/class.akismet.php
index 95099136..f4172e03 100644
--- a/plugins/akismet/class.akismet.php
+++ b/plugins/akismet/class.akismet.php
@@ -914,6 +914,15 @@ class Akismet {
return $approved;
}
+ if ( 'trash' === $approved ) {
+ // If the last comment we checked has had its approval set to 'trash',
+ // then it failed the comment blacklist check. Let that blacklist override
+ // the spam check, since users have the (valid) expectation that when
+ // they fill out their blacklists, comments that match it will always
+ // end up in the trash.
+ return $approved;
+ }
+
// bump the counter here instead of when the filter is added to reduce the possibility of overcounting
if ( $incr = apply_filters('akismet_spam_count_incr', 1) )
update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr );
@@ -1091,17 +1100,10 @@ class Akismet {
}
public static function load_form_js() {
- // WP < 3.3 can't enqueue a script this late in the game and still have it appear in the footer.
- // Once we drop support for everything pre-3.3, this can change back to a single enqueue call.
wp_register_script( 'akismet-form', plugin_dir_url( __FILE__ ) . '_inc/form.js', array(), AKISMET_VERSION, true );
- add_action( 'wp_footer', array( 'Akismet', 'print_form_js' ) );
- add_action( 'admin_footer', array( 'Akismet', 'print_form_js' ) );
+ wp_enqueue_script( 'akismet-form' );
}
- public static function print_form_js() {
- wp_print_scripts( 'akismet-form' );
- }
-
public static function inject_ak_js( $fields ) {
echo '<p style="display: none;">';
echo '<input type="hidden" id="ak_js" name="ak_js" value="' . mt_rand( 0, 250 ) . '"/>';
@@ -1205,7 +1207,7 @@ p {
* @param mixed $akismet_debug The data to log.
*/
public static function log( $akismet_debug ) {
- if ( apply_filters( 'akismet_debug_log', defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) ) {
+ if ( apply_filters( 'akismet_debug_log', defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG && defined( 'AKISMET_DEBUG' ) && AKISMET_DEBUG ) ) {
error_log( print_r( compact( 'akismet_debug' ), true ) );
}
}
@@ -1292,4 +1294,12 @@ p {
return $meta_value;
}
+
+ public static function predefined_api_key() {
+ if ( defined( 'WPCOM_API_KEY' ) ) {
+ return true;
+ }
+
+ return apply_filters( 'akismet_predefined_api_key', false );
+ }
}
diff --git a/plugins/akismet/readme.txt b/plugins/akismet/readme.txt
index dc087934..d56cc7a7 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
Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments
Requires at least: 3.7
-Tested up to: 4.7.4
-Stable tag: 3.3.2
+Tested up to: 4.8.1
+Stable tag: 3.3.4
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,22 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co
== Changelog ==
+= 3.3.4 =
+
+* Disabled Akismet's debug log output by default unless AKISMET_DEBUG is defined.
+* URL previews now begin preloading when the mouse moves near them in the comments section of wp-admin.
+* 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.
+* Fixed a bug that was preventing an error from being shown when a site can't reach Akismet's servers.
+
+= 3.3.3 =
+*Release Date - 13 July 2017*
+
+* Reduced amount of bandwidth used by the URL Preview feature.
+* Improved the admin UI when the API key is manually pre-defined for the site.
+* Removed a workaround for WordPress installations older than 3.3 that will improve Akismet's compatibility with other plugins.
+* The number of spam blocked that is displayed on the WordPress dashboard will now be more accurate and updated more frequently.
+* Fixed a bug in the Akismet widget that could cause PHP warnings.
+
= 3.3.2 =
*Release Date - 10 May 2017*
diff --git a/plugins/akismet/views/config.php b/plugins/akismet/views/config.php
index f7b232ed..c12914a0 100644
--- a/plugins/akismet/views/config.php
+++ b/plugins/akismet/views/config.php
@@ -65,7 +65,7 @@
<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="POST">
<table cellspacing="0" class="akismet-settings">
<tbody>
- <?php if ( !defined( 'WPCOM_API_KEY' ) ):?>
+ <?php if ( ! Akismet::predefined_api_key() ) { ?>
<tr>
<th class="akismet-api-key" width="10%" align="left" scope="row"><?php esc_html_e('API Key', 'akismet');?></th>
<td width="5%"/>
@@ -73,7 +73,7 @@
<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>
</td>
</tr>
- <?php endif; ?>
+ <?php } ?>
<?php if ( isset( $_GET['ssl_status'] ) ) { ?>
<tr>
<th align="left" scope="row"><?php esc_html_e( 'SSL Status', 'akismet' ); ?></th>
@@ -157,11 +157,11 @@
</tbody>
</table>
<div class="akismet-card-actions">
- <?php if ( !defined( 'WPCOM_API_KEY' ) ):?>
+ <?php if ( ! Akismet::predefined_api_key() ) { ?>
<div id="delete-action">
<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>
</div>
- <?php endif; ?>
+ <?php } ?>
<?php wp_nonce_field(Akismet_Admin::NONCE) ?>
<div id="publishing-action">
<input type="hidden" name="action" value="enter-key">
@@ -172,61 +172,63 @@
</form>
</div>
</div>
-
- <div class="akismet-card">
- <div class="akismet-section-header">
- <div class="akismet-section-header__label">
- <span><?php esc_html_e( 'Account' , 'akismet'); ?></span>
+
+ <?php if ( ! Akismet::predefined_api_key() ) { ?>
+ <div class="akismet-card">
+ <div class="akismet-section-header">
+ <div class="akismet-section-header__label">
+ <span><?php esc_html_e( 'Account' , 'akismet'); ?></span>
+ </div>
</div>
- </div>
- <div class="inside">
- <table cellspacing="0" border="0" class="akismet-settings">
- <tbody>
- <tr>
- <th scope="row" align="left"><?php esc_html_e( 'Subscription Type' , 'akismet');?></th>
- <td width="5%"/>
- <td align="left">
- <p><?php echo esc_html( $akismet_user->account_name ); ?></p>
- </td>
- </tr>
- <tr>
- <th scope="row" align="left"><?php esc_html_e( 'Status' , 'akismet');?></th>
- <td width="5%"/>
- <td align="left">
- <p><?php
- if ( 'cancelled' == $akismet_user->status ) :
- esc_html_e( 'Cancelled', 'akismet' );
- elseif ( 'suspended' == $akismet_user->status ) :
- esc_html_e( 'Suspended', 'akismet' );
- elseif ( 'missing' == $akismet_user->status ) :
- esc_html_e( 'Missing', 'akismet' );
- elseif ( 'no-sub' == $akismet_user->status ) :
- esc_html_e( 'No Subscription Found', 'akismet' );
- else :
- esc_html_e( 'Active', 'akismet' );
- endif; ?></p>
- </td>
- </tr>
- <?php if ( $akismet_user->next_billing_date ) : ?>
- <tr>
- <th scope="row" align="left"><?php esc_html_e( 'Next Billing Date' , 'akismet');?></th>
- <td width="5%"/>
- <td align="left">
- <p><?php echo date( 'F j, Y', $akismet_user->next_billing_date ); ?></p>
- </td>
- </tr>
- <?php endif; ?>
- </tbody>
- </table>
- <div class="akismet-card-actions">
- <div id="publishing-action">
- <?php Akismet::view( 'get', array( 'text' => ( $akismet_user->account_type == 'free-api-key' && $akismet_user->status == 'active' ? __( 'Upgrade' , 'akismet') : __( 'Change' , 'akismet') ), 'redirect' => 'upgrade' ) ); ?>
+ <div class="inside">
+ <table cellspacing="0" border="0" class="akismet-settings">
+ <tbody>
+ <tr>
+ <th scope="row" align="left"><?php esc_html_e( 'Subscription Type' , 'akismet');?></th>
+ <td width="5%"/>
+ <td align="left">
+ <p><?php echo esc_html( $akismet_user->account_name ); ?></p>
+ </td>
+ </tr>
+ <tr>
+ <th scope="row" align="left"><?php esc_html_e( 'Status' , 'akismet');?></th>
+ <td width="5%"/>
+ <td align="left">
+ <p><?php
+ if ( 'cancelled' == $akismet_user->status ) :
+ esc_html_e( 'Cancelled', 'akismet' );
+ elseif ( 'suspended' == $akismet_user->status ) :
+ esc_html_e( 'Suspended', 'akismet' );
+ elseif ( 'missing' == $akismet_user->status ) :
+ esc_html_e( 'Missing', 'akismet' );
+ elseif ( 'no-sub' == $akismet_user->status ) :
+ esc_html_e( 'No Subscription Found', 'akismet' );
+ else :
+ esc_html_e( 'Active', 'akismet' );
+ endif; ?></p>
+ </td>
+ </tr>
+ <?php if ( $akismet_user->next_billing_date ) : ?>
+ <tr>
+ <th scope="row" align="left"><?php esc_html_e( 'Next Billing Date' , 'akismet');?></th>
+ <td width="5%"/>
+ <td align="left">
+ <p><?php echo date( 'F j, Y', $akismet_user->next_billing_date ); ?></p>
+ </td>
+ </tr>
+ <?php endif; ?>
+ </tbody>
+ </table>
+ <div class="akismet-card-actions">
+ <div id="publishing-action">
+ <?php Akismet::view( 'get', array( 'text' => ( $akismet_user->account_type == 'free-api-key' && $akismet_user->status == 'active' ? __( 'Upgrade' , 'akismet') : __( 'Change' , 'akismet') ), 'redirect' => 'upgrade' ) ); ?>
+ </div>
+ <div class="clear"></div>
</div>
- <div class="clear"></div>
</div>
</div>
- </div>
+ <?php } ?>
<?php endif;?>
</div>
</div> \ No newline at end of file
diff --git a/plugins/akismet/views/notice.php b/plugins/akismet/views/notice.php
index e82f1685..3b6236da 100644
--- a/plugins/akismet/views/notice.php
+++ b/plugins/akismet/views/notice.php
@@ -46,8 +46,8 @@
</div>
<?php elseif ( $type == 'servers-be-down' ) :?>
<div class="akismet-alert akismet-critical">
- <h3 class="akismet-key-status failed"><?php esc_html_e("Akismet can&#8217;t connect to your site.", 'akismet'); ?></h3>
- <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>
+ <h3 class="akismet-key-status failed"><?php esc_html_e("Your site can&#8217;t connect to the Akismet servers.", 'akismet'); ?></h3>
+ <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>
</div>
<?php elseif ( $type == 'active-dunning' ) :?>
<div class="akismet-alert akismet-critical">
diff --git a/plugins/akismet/views/start.php b/plugins/akismet/views/start.php
index d17b53dc..0ec35fdb 100644
--- a/plugins/akismet/views/start.php
+++ b/plugins/akismet/views/start.php
@@ -8,86 +8,95 @@
</div>
<div class="akismet-lower">
<?php Akismet_Admin::display_status(); ?>
+
<div class="akismet-box">
<h2><?php esc_html_e( 'Eliminate spam from your site', 'akismet' ); ?></h2>
<p><?php esc_html_e( 'Select one of the options below to get started.', 'akismet' ); ?></p>
</div>
<div class="akismet-boxes">
- <?php if ( $akismet_user && in_array( $akismet_user->status, array( 'active', 'active-dunning', 'no-sub', 'missing', 'cancelled', 'suspended' ) ) ) { ?>
- <?php if ( in_array( $akismet_user->status, array( 'no-sub', 'missing' ) ) ) { ?>
+ <?php if ( ! Akismet::predefined_api_key() ) { ?>
+ <?php if ( $akismet_user && in_array( $akismet_user->status, array( 'active', 'active-dunning', 'no-sub', 'missing', 'cancelled', 'suspended' ) ) ) { ?>
+ <?php if ( in_array( $akismet_user->status, array( 'no-sub', 'missing' ) ) ) { ?>
+ <div class="akismet-box">
+ <h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
+ <p><?php esc_html_e( 'Use your Jetpack connection to activate Akismet.', 'akismet' ); ?></p>
+ <form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank">
+ <input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
+ <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
+ <input type="hidden" name="auto-connect" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
+ <input type="hidden" name="redirect" value="plugin-signup"/>
+ <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
+ </form>
+ <?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
+ <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>
+ </div>
+ <?php } elseif ( $akismet_user->status == 'cancelled' ) { ?>
+ <div class="akismet-box">
+ <h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
+ <form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank">
+ <input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
+ <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
+ <input type="hidden" name="user_id" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
+ <input type="hidden" name="redirect" value="upgrade"/>
+ <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Reactivate Akismet' , 'akismet' ); ?>"/>
+ </form>
+ <p><?php echo esc_html( sprintf( __( 'Your subscription for %s is cancelled.' , 'akismet' ), $akismet_user->user_email ) ); ?></p>
+ </div>
+ <?php } elseif ( $akismet_user->status == 'suspended' ) { ?>
+ <div class="centered akismet-box">
+ <h3><?php esc_html_e( 'Connected via Jetpack' , 'akismet' ); ?></h3>
+ <p class="akismet-alert-text"><?php echo esc_html( sprintf( __( 'Your subscription for %s is suspended.' , 'akismet' ), $akismet_user->user_email ) ); ?></p>
+ <p><?php esc_html_e( 'No worries! Get in touch and we&#8217;ll sort this out.', 'akismet' ); ?></p>
+ <p><a href="https://akismet.com/contact" class="akismet-button akismet-is-primary"><?php esc_html_e( 'Contact Akismet support' , 'akismet' ); ?></a></p>
+ </div>
+ <?php } else { // ask do they want to use akismet account found using jetpack wpcom connection ?>
+ <div class="akismet-box">
+ <h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
+ <p><?php esc_html_e( 'Use your Jetpack connection to activate Akismet.', 'akismet' ); ?></p>
+ <form name="akismet_use_wpcom_key" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-activate" class="akismet-right">
+ <input type="hidden" name="key" value="<?php echo esc_attr( $akismet_user->api_key );?>"/>
+ <input type="hidden" name="action" value="enter-key">
+ <?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
+ <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
+ </form>
+ <?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
+ <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>
+ </div>
+ <?php } ?>
+ <div class="akismet-box">
+ <h3><?php esc_html_e( 'Or sign up with a different email address', 'akismet' ); ?></h3>
+ <div class="akismet-right">
+ <?php Akismet::view( 'get', array( 'text' => __( 'Sign up with a different email address' , 'akismet' ), 'classes' => array( 'akismet-button' ) ) ); ?>
+ </div>
+ <p><?php esc_html_e( 'Choose this option to use Akismet independently of your Jetpack connection.', 'akismet' ); ?></p>
+ </div>
+ <?php } else { ?>
+ <div class="akismet-box">
+ <h3><?php esc_html_e( 'Activate Akismet' , 'akismet' );?></h3>
+ <div class="akismet-right">
+ <?php Akismet::view( 'get', array( 'text' => __( 'Get your API key' , 'akismet' ), 'classes' => array( 'akismet-button', 'akismet-is-primary' ) ) ); ?>
+ </div>
+ <p><?php esc_html_e( 'Log in or sign up now.', 'akismet' ); ?></p>
+ </div>
+ <?php } ?>
<div class="akismet-box">
- <h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
- <p><?php esc_html_e( 'Use your Jetpack connection to activate Akismet.', 'akismet' ); ?></p>
- <form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank">
- <input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
- <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
- <input type="hidden" name="auto-connect" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
- <input type="hidden" name="redirect" value="plugin-signup"/>
- <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
- </form>
- <?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
- <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>
- </div>
- <?php } elseif ( $akismet_user->status == 'cancelled' ) { ?>
- <div class="akismet-box">
- <h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
- <form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank">
- <input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
- <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
- <input type="hidden" name="user_id" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
- <input type="hidden" name="redirect" value="upgrade"/>
- <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Reactivate Akismet' , 'akismet' ); ?>"/>
+ <h3><?php esc_html_e( 'Or enter an API key', 'akismet' ); ?></h3>
+ <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>
+ <form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post">
+ <?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
+ <input type="hidden" name="action" value="enter-key">
+ <p style="width: 100%; display: flex; flex-wrap: nowrap; box-sizing: border-box;">
+ <input id="key" name="key" type="text" size="15" value="" class="regular-text code" style="flex-grow: 1; margin-right: 1rem;">
+ <input type="submit" name="submit" id="submit" class="akismet-button" value="<?php esc_attr_e( 'Connect with API key', 'akismet' );?>">
+ </p>
</form>
- <p><?php echo esc_html( sprintf( __( 'Your subscription for %s is cancelled.' , 'akismet' ), $akismet_user->user_email ) ); ?></p>
- </div>
- <?php } elseif ( $akismet_user->status == 'suspended' ) { ?>
- <div class="centered akismet-box">
- <h3><?php esc_html_e( 'Connected via Jetpack' , 'akismet' ); ?></h3>
- <p class="akismet-alert-text"><?php echo esc_html( sprintf( __( 'Your subscription for %s is suspended.' , 'akismet' ), $akismet_user->user_email ) ); ?></p>
- <p><?php esc_html_e( 'No worries! Get in touch and we&#8217;ll sort this out.', 'akismet' ); ?></p>
- <p><a href="https://akismet.com/contact" class="akismet-button akismet-is-primary"><?php esc_html_e( 'Contact Akismet support' , 'akismet' ); ?></a></p>
</div>
- <?php } else { // ask do they want to use akismet account found using jetpack wpcom connection ?>
+ <?php } else { ?>
<div class="akismet-box">
- <h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
- <p><?php esc_html_e( 'Use your Jetpack connection to activate Akismet.', 'akismet' ); ?></p>
- <form name="akismet_use_wpcom_key" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-activate" class="akismet-right">
- <input type="hidden" name="key" value="<?php echo esc_attr( $akismet_user->api_key );?>"/>
- <input type="hidden" name="action" value="enter-key">
- <?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
- <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
- </form>
- <?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
- <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>
+ <h2><?php esc_html_e( 'Manual Configuration', 'akismet' ); ?></h2>
+ <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>
</div>
<?php } ?>
- <div class="akismet-box">
- <h3><?php esc_html_e( 'Or sign up with a different email address', 'akismet' ); ?></h3>
- <div class="akismet-right">
- <?php Akismet::view( 'get', array( 'text' => __( 'Sign up with a different email address' , 'akismet' ), 'classes' => array( 'akismet-button' ) ) ); ?>
- </div>
- <p><?php esc_html_e( 'Choose this option to use Akismet independently of your Jetpack connection.', 'akismet' ); ?></p>
- </div>
- <?php } else { ?>
- <div class="akismet-box">
- <h3><?php esc_html_e( 'Activate Akismet' , 'akismet' );?></h3>
- <div class="akismet-right">
- <?php Akismet::view( 'get', array( 'text' => __( 'Get your API key' , 'akismet' ), 'classes' => array( 'akismet-button', 'akismet-is-primary' ) ) ); ?>
- </div>
- <p><?php esc_html_e( 'Log in or sign up now.', 'akismet' ); ?></p>
- </div>
- <?php } ?>
- <div class="akismet-box">
- <h3><?php esc_html_e( 'Or enter an API key', 'akismet' ); ?></h3>
- <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>
- <form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post">
- <?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
- <input type="hidden" name="action" value="enter-key">
- <p style="width: 100%; display: flex; flex-wrap: nowrap; box-sizing: border-box;">
- <input id="key" name="key" type="text" size="15" value="" class="regular-text code" style="flex-grow: 1; margin-right: 1rem;">
- <input type="submit" name="submit" id="submit" class="akismet-button" value="<?php esc_attr_e( 'Connect with API key', 'akismet' );?>">
- </p>
- </form>
</div>
</div>
</div> \ No newline at end of file