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/class.akismet-admin.php
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/class.akismet-admin.php')
-rw-r--r--plugins/akismet/class.akismet-admin.php40
1 files changed, 24 insertions, 16 deletions
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 ) {