summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/akismet/class.akismet-admin.php')
-rw-r--r--plugins/akismet/class.akismet-admin.php24
1 files changed, 19 insertions, 5 deletions
diff --git a/plugins/akismet/class.akismet-admin.php b/plugins/akismet/class.akismet-admin.php
index bc00260f..926b3c7a 100644
--- a/plugins/akismet/class.akismet-admin.php
+++ b/plugins/akismet/class.akismet-admin.php
@@ -92,10 +92,10 @@ class Akismet_Admin {
public static function load_menu() {
if ( class_exists( 'Jetpack' ) ) {
- $hook = add_submenu_page( 'jetpack', __( 'Akismet' , 'akismet'), __( 'Akismet' , 'akismet'), 'manage_options', 'akismet-key-config', array( 'Akismet_Admin', 'display_page' ) );
+ $hook = add_submenu_page( 'jetpack', __( 'Akismet Anti-Spam' , 'akismet'), __( 'Akismet Anti-Spam' , 'akismet'), 'manage_options', 'akismet-key-config', array( 'Akismet_Admin', 'display_page' ) );
}
else {
- $hook = add_options_page( __('Akismet', 'akismet'), __('Akismet', 'akismet'), 'manage_options', 'akismet-key-config', array( 'Akismet_Admin', 'display_page' ) );
+ $hook = add_options_page( __('Akismet Anti-Spam', 'akismet'), __('Akismet Anti-Spam', 'akismet'), 'manage_options', 'akismet-key-config', array( 'Akismet_Admin', 'display_page' ) );
}
if ( $hook ) {
@@ -1061,8 +1061,22 @@ class Akismet_Admin {
if ( !$xml->isError() ) {
$responses = $xml->getResponse();
if ( count( $responses ) > 1 ) {
- $api_key = array_shift( $responses[0] );
- $user_id = (int) array_shift( $responses[1] );
+ // Due to a quirk in how Jetpack does multi-calls, the response order
+ // can't be trusted to match the call order. It's a good thing our
+ // return values can be mostly differentiated from each other.
+ $first_response_value = array_shift( $responses[0] );
+ $second_response_value = array_shift( $responses[1] );
+
+ // If WPCOM ever reaches 100 billion users, this will fail. :-)
+ if ( preg_match( '/^[a-f0-9]{12}$/i', $first_response_value ) ) {
+ $api_key = $first_response_value;
+ $user_id = (int) $second_response_value;
+ }
+ else {
+ $api_key = $second_response_value;
+ $user_id = (int) $first_response_value;
+ }
+
return compact( 'api_key', 'user_id' );
}
}
@@ -1100,4 +1114,4 @@ class Akismet_Admin {
return $all_plugins;
}
-} \ No newline at end of file
+}