Akismet Anti-Spam - Version 2.5.8

Version Description

  • Simplify the activation process for new users
  • Remove the reporter_ip parameter
  • Minor preventative security improvements
Download this release

Release Info

Developer eoigal
Plugin Icon 128x128 Akismet Anti-Spam
Version 2.5.8
Comparing to
See all releases

Code changes from version 2.5.7 to 2.5.8

Files changed (6) hide show
  1. .htaccess +5 -0
  2. admin.php +265 -187
  3. akismet.css +1 -12
  4. akismet.js +12 -0
  5. akismet.php +2 -2
  6. readme.txt +8 -3
.htaccess CHANGED
@@ -3,4 +3,9 @@ Deny from all
3
 
4
  <FilesMatch "^akismet\.(css|js)$">
5
  Allow from all
 
 
 
 
 
6
  </FilesMatch>
3
 
4
  <FilesMatch "^akismet\.(css|js)$">
5
  Allow from all
6
+ </FilesMatch>
7
+
8
+ #allow access to any image
9
+ <FilesMatch "^(.+)\.(png|gif)$">
10
+ Allow from all
11
  </FilesMatch>
admin.php CHANGED
@@ -10,9 +10,9 @@ function akismet_admin_init() {
10
  if ( !function_exists('is_multisite') && version_compare( $wp_version, '3.0', '<' ) ) {
11
 
12
  function akismet_version_warning() {
13
- echo "
14
- <div id='akismet-warning' class='updated fade'><p><strong>".sprintf(__('Akismet %s requires WordPress 3.0 or higher.'), AKISMET_VERSION) ."</strong> ".sprintf(__('Please <a href="%s">upgrade WordPress</a> to a current version, or <a href="%s">downgrade to version 2.4 of the Akismet plugin</a>.'), 'http://codex.wordpress.org/Upgrading_WordPress', 'http://wordpress.org/extend/plugins/akismet/download/'). "</p></div>
15
- ";
16
  }
17
  add_action('admin_notices', 'akismet_version_warning');
18
 
@@ -31,13 +31,14 @@ add_action( 'admin_enqueue_scripts', 'akismet_load_js_and_css' );
31
  function akismet_load_js_and_css() {
32
  global $hook_suffix;
33
 
34
- if (
35
- $hook_suffix == 'index.php' # dashboard
36
- || $hook_suffix == 'edit-comments.php'
37
- || $hook_suffix == 'comment.php'
38
- || $hook_suffix == 'post.php'
39
- || $hook_suffix == 'plugins_page_akismet-key-config'
40
- ) {
 
41
  wp_register_style( 'akismet.css', AKISMET_PLUGIN_URL . 'akismet.css', array(), '2.5.4.4' );
42
  wp_enqueue_style( 'akismet.css');
43
 
@@ -64,35 +65,51 @@ function akismet_plugin_action_links( $links, $file ) {
64
  add_filter( 'plugin_action_links', 'akismet_plugin_action_links', 10, 2 );
65
 
66
  function akismet_conf() {
67
- global $akismet_nonce, $wpcom_api_key;
 
 
 
 
 
 
 
 
68
 
69
- if ( isset($_POST['submit']) ) {
70
  if ( function_exists('current_user_can') && !current_user_can('manage_options') )
71
  die(__('Cheatin&#8217; uh?'));
 
 
72
 
73
  check_admin_referer( $akismet_nonce );
74
- $key = preg_replace( '/[^a-h0-9]/i', '', $_POST['key'] );
75
  $home_url = parse_url( get_bloginfo('url') );
76
-
77
- if ( empty($key) ) {
78
- $key_status = 'empty';
79
- $ms[] = 'new_key_empty';
80
- delete_option('wordpress_api_key');
81
- } elseif ( empty($home_url['host']) ) {
82
- $key_status = 'empty';
83
  $ms[] = 'bad_home_url';
84
- } else {
 
 
 
 
 
 
 
 
 
 
85
  $key_status = akismet_verify_key( $key );
86
- }
87
 
88
- if ( $key_status == 'valid' ) {
89
  update_option('wordpress_api_key', $key);
90
  $ms[] = 'new_key_valid';
91
- } else if ( $key_status == 'invalid' ) {
 
92
  $ms[] = 'new_key_invalid';
93
- } else if ( $key_status == 'failed' ) {
94
  $ms[] = 'new_key_failed';
95
- }
 
96
 
97
  if ( isset( $_POST['akismet_discard_month'] ) )
98
  update_option( 'akismet_discard_month', 'true' );
@@ -103,157 +120,197 @@ function akismet_conf() {
103
  update_option( 'akismet_show_user_comments_approved', 'true' );
104
  else
105
  update_option( 'akismet_show_user_comments_approved', 'false' );
 
 
 
106
 
107
- } elseif ( isset($_POST['check']) ) {
 
 
 
108
  akismet_get_server_connectivity(0);
109
  }
110
-
111
- if ( empty( $key_status) || $key_status != 'valid' ) {
112
- $key = get_option('wordpress_api_key');
113
- if ( empty( $key ) ) {
114
- if ( empty( $key_status ) || $key_status != 'failed' ) {
115
- if ( akismet_verify_key( '1234567890ab' ) == 'failed' )
116
- $ms[] = 'no_connection';
117
- else
118
- $ms[] = 'key_empty';
119
- }
120
- $key_status = 'empty';
121
- } else {
122
- $key_status = akismet_verify_key( $key );
 
 
 
123
  }
124
- if ( $key_status == 'valid' ) {
125
- $ms[] = 'key_valid';
126
- } else if ( $key_status == 'invalid' ) {
127
- $ms[] = 'key_invalid';
128
- } else if ( !empty($key) && $key_status == 'failed' ) {
129
- $ms[] = 'key_failed';
130
  }
131
  }
132
 
133
  $messages = array(
134
- 'new_key_empty' => array('color' => 'aa0', 'text' => __('Your key has been cleared.')),
135
- 'new_key_valid' => array('color' => '4AB915', 'text' => __('Your key has been verified. Happy blogging!')),
136
- 'new_key_invalid' => array('color' => '888', 'text' => __('The key you entered is invalid. Please double-check it.')),
137
- 'new_key_failed' => array('color' => '888', 'text' => __('The key you entered could not be verified because a connection to akismet.com could not be established. Please check your server configuration.')),
138
- 'no_connection' => array('color' => '888', 'text' => __('There was a problem connecting to the Akismet server. Please check your server configuration.')),
139
- 'key_empty' => array('color' => 'aa0', 'text' => sprintf(__('Please enter an API key. (<a href="%s" style="color:#fff">Get your key.</a>)'), 'http://akismet.com/get/?return=true')),
140
- 'key_valid' => array('color' => '4AB915', 'text' => __('This key is valid.')),
141
- 'key_invalid' => array('color' => '888', 'text' => __('This key is invalid.')),
142
- 'key_failed' => array('color' => 'aa0', 'text' => __('The key below was previously validated but a connection to akismet.com can not be established at this time. Please check your server configuration.')),
143
- 'bad_home_url' => array('color' => '888', 'text' => sprintf( __('Your WordPress home URL %s is invalid. Please fix the <a href="%s">home option</a>.'), esc_html( get_bloginfo('url') ), admin_url('options.php#home') ) ),
144
  );
145
  ?>
146
- <?php if ( !empty($_POST['submit'] ) ) : ?>
147
- <div id="message" class="updated fade"><p><strong><?php _e('Options saved.') ?></strong></p></div>
148
- <?php endif; ?>
149
  <div class="wrap">
150
- <h2><?php _e('Akismet Configuration'); ?></h2>
151
- <?php if (isset($_GET['message']) && $_GET['message'] == 'success') { ?>
152
- <div class="updated below-h2" id="message"><p><?php _e( '<strong>Sign up success!</strong> Please check your email for your Akismet API Key and enter it below.' ); ?></p></div>
153
- <?php } ?>
154
- <div class="narrow">
155
- <form action="" method="post" id="akismet-conf" style="margin: auto; width: 400px; ">
156
- <?php if ( !$wpcom_api_key ) { ?>
157
- <p><?php printf(__('For many people, <a href="%1$s">Akismet</a> will greatly reduce or even completely eliminate the comment and trackback spam you get on your site. If one does happen to get through, simply mark it as "spam" on the moderation screen and Akismet will learn from the mistakes. If you don\'t have an API key yet, you can get one at <a href="%2$s">Akismet.com</a>.'), 'http://akismet.com/?return=true', 'http://akismet.com/get/?return=true'); ?></p>
158
-
159
- <h3><label for="key"><?php _e('Akismet API Key'); ?></label></h3>
160
- <?php foreach ( $ms as $m ) : ?>
161
- <p style="padding: .5em; background-color: #<?php echo $messages[$m]['color']; ?>; color: #fff; font-weight: bold;"><?php echo $messages[$m]['text']; ?></p>
162
- <?php endforeach; ?>
163
- <p><input id="key" name="key" type="text" size="15" maxlength="12" value="<?php echo get_option('wordpress_api_key'); ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;" /> (<?php _e('<a href="http://akismet.com/get/?return=true">What is this?</a>'); ?>)</p>
164
- <?php if ( isset( $invalid_key) && $invalid_key ) { ?>
165
- <h3><?php _e('Why might my key be invalid?'); ?></h3>
166
- <p><?php _e('This can mean one of two things, either you copied the key wrong or that the plugin is unable to reach the Akismet servers, which is most often caused by an issue with your web host around firewalls or similar.'); ?></p>
167
- <?php } ?>
168
- <?php } ?>
169
- <?php akismet_nonce_field($akismet_nonce) ?>
170
- <p><label><input name="akismet_discard_month" id="akismet_discard_month" value="true" type="checkbox" <?php if ( get_option('akismet_discard_month') == 'true' ) echo ' checked="checked" '; ?> /> <?php _e('Auto-delete spam submitted on posts more than a month old.'); ?></label></p>
171
- <p><label><input name="akismet_show_user_comments_approved" id="akismet_show_user_comments_approved" value="true" type="checkbox" <?php if ( get_option('akismet_show_user_comments_approved') == 'true' ) echo ' checked="checked" '; ?> /> <?php _e('Show the number of comments you\'ve approved beside each comment author.'); ?></label></p>
172
- <p class="submit"><input type="submit" name="submit" value="<?php _e('Update options &raquo;'); ?>" /></p>
173
- </form>
174
-
175
- <form action="" method="post" id="akismet-connectivity" style="margin: auto; width: 400px; ">
176
-
177
- <h3><?php _e('Server Connectivity'); ?></h3>
178
- <?php
179
- if ( !function_exists('fsockopen') || !function_exists('gethostbynamel') ) {
180
- ?>
181
- <p style="padding: .5em; background-color: #888; color: #fff; font-weight:bold;"><?php _e('Network functions are disabled.'); ?></p>
182
- <p><?php echo sprintf( __('Your web host or server administrator has disabled PHP\'s <code>fsockopen</code> or <code>gethostbynamel</code> functions. <strong>Akismet cannot work correctly until this is fixed.</strong> Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet\'s system requirements</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
183
- <?php
184
- } else {
185
- $servers = akismet_get_server_connectivity();
186
- $fail_count = count($servers) - count( array_filter($servers) );
187
- if ( is_array($servers) && count($servers) > 0 ) {
188
- // some connections work, some fail
189
- if ( $fail_count > 0 && $fail_count < count($servers) ) { ?>
190
- <p style="padding: .5em; background-color: #aa0; color: #fff; font-weight:bold;"><?php _e('Unable to reach some Akismet servers.'); ?></p>
191
- <p><?php echo sprintf( __('A network problem or firewall is blocking some connections from your web server to Akismet.com. Akismet is working but this may cause problems during times of network congestion. Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
192
- <?php
193
- // all connections fail
194
- } elseif ( $fail_count > 0 ) { ?>
195
- <p style="padding: .5em; background-color: #888; color: #fff; font-weight:bold;"><?php _e('Unable to reach any Akismet servers.'); ?></p>
196
- <p><?php echo sprintf( __('A network problem or firewall is blocking all connections from your web server to Akismet.com. <strong>Akismet cannot work correctly until this is fixed.</strong> Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
197
- <?php
198
- // all connections work
199
- } else { ?>
200
- <p style="padding: .5em; background-color: #4AB915; color: #fff; font-weight:bold;"><?php _e('All Akismet servers are available.'); ?></p>
201
- <p><?php _e('Akismet is working correctly. All servers are accessible.'); ?></p>
202
- <?php
203
- }
204
- } else {
205
- ?>
206
- <p style="padding: .5em; background-color: #888; color: #fff; font-weight:bold;"><?php _e('Unable to find Akismet servers.'); ?></p>
207
- <p><?php echo sprintf( __('A DNS problem or firewall is preventing all access from your web server to Akismet.com. <strong>Akismet cannot work correctly until this is fixed.</strong> Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
208
- <?php
209
- }
210
- }
211
-
212
- if ( !empty($servers) ) {
213
- ?>
214
- <table style="width: 100%;">
215
- <thead><th><?php _e('Akismet server'); ?></th><th><?php _e('Network Status'); ?></th></thead>
216
- <tbody>
217
- <?php
218
- asort($servers);
219
- foreach ( $servers as $ip => $status ) {
220
- $color = ( $status ? '#4AB915' : '#888');
221
- ?>
222
- <tr>
223
- <td><?php echo htmlspecialchars($ip); ?></td>
224
- <td style="padding: 0 .5em; font-weight:bold; color: #fff; background-color: <?php echo $color; ?>"><?php echo ($status ? __('Accessible') : __('Re-trying') ); ?></td>
225
 
226
- <?php
227
- }
228
- }
229
- ?>
230
- </tbody>
231
- </table>
232
- <p><?php if ( get_option('akismet_connectivity_time') ) echo sprintf( __('Last checked %s ago.'), human_time_diff( get_option('akismet_connectivity_time') ) ); ?></p>
233
- <p class="submit"><input type="submit" name="check" value="<?php _e('Check network status &raquo;'); ?>" /></p>
234
- <p><?php printf( __('<a href="%s" target="_blank">Click here</a> to confirm that <a href="%s" target="_blank">Akismet.com is up</a>.'), 'http://status.automattic.com/9931/136079/Akismet-API', 'http://status.automattic.com/9931/136079/Akismet-API' ); ?></p>
235
- </form>
236
-
237
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  </div>
239
  <?php
240
  }
241
 
242
  function akismet_stats_display() {
243
- global $akismet_api_host, $akismet_api_port, $wpcom_api_key;
244
- $blog = urlencode( get_bloginfo('url') );
245
-
246
- $url = 'http://';
247
- if ( is_ssl() )
248
- $url = 'https://';
249
-
250
- $url .= 'akismet.com/web/1.0/user-stats.php';
251
- $url .= "?blog={$blog}&api_key=" . akismet_get_key();
252
- ?>
253
- <div class="wrap">
254
- <iframe src="<?php echo $url; ?>" width="100%" height="2500px" frameborder="0" id="akismet-stats-frame"></iframe>
255
- </div>
256
- <?php
257
  }
258
 
259
  function akismet_stats() {
@@ -288,9 +345,11 @@ function akismet_admin_warnings() {
288
  );
289
  ?>
290
  <div class='error'>
291
- <p><strong>Akismet Error Code: <?php echo $alert['code']; ?></strong></p>
292
  <p><?php esc_html_e( $alert['msg'] ); ?></p>
293
- <p>More information is available at <a href="https://akismet.com/errors/<?php echo $alert['code']; ?>">https://akismet.com/errors/<?php echo $alert['code']; ?></a></p>
 
 
294
  </div>
295
  <?php
296
  }
@@ -301,10 +360,33 @@ function akismet_admin_warnings() {
301
 
302
  if ( !get_option('wordpress_api_key') && !$wpcom_api_key && !isset($_POST['submit']) ) {
303
  function akismet_warning() {
304
- echo "
305
- <div id='akismet-warning' class='updated fade'><p><strong>".__('Akismet is almost ready.')."</strong> ".sprintf(__('You must <a href="%1$s">enter your Akismet API key</a> for it to work.'), "admin.php?page=akismet-key-config")."</p></div>
306
- ";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
307
  }
 
308
  add_action('admin_notices', 'akismet_warning');
309
  return;
310
  } elseif ( ( empty($_SERVER['SCRIPT_FILENAME']) || basename($_SERVER['SCRIPT_FILENAME']) == 'edit-comments.php' ) && wp_next_scheduled('akismet_schedule_cron_recheck') ) {
@@ -314,9 +396,9 @@ function akismet_admin_warnings() {
314
  $waiting = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->commentmeta WHERE meta_key = 'akismet_error'" );
315
  $next_check = wp_next_scheduled('akismet_schedule_cron_recheck');
316
  if ( $waiting > 0 && $next_check > time() )
317
- echo "
318
- <div id='akismet-warning' class='updated fade'><p><strong>".__('Akismet has detected a problem.')."</strong> ".sprintf(__('Some comments have not yet been checked for spam by Akismet. They have been temporarily held for moderation. Please check your <a href="%s">Akismet configuration</a> and contact your web host if problems persist.'), 'admin.php?page=akismet-key-config')."</p></div>
319
- ";
320
  }
321
  add_action('admin_notices', 'akismet_warning');
322
  return;
@@ -332,8 +414,8 @@ function akismet_comment_row_action( $a, $comment ) {
332
  return $a;
333
 
334
  $akismet_result = get_comment_meta( $comment->comment_ID, 'akismet_result', true );
335
- $akismet_error = get_comment_meta( $comment->comment_ID, 'akismet_error', true );
336
- $user_result = get_comment_meta( $comment->comment_ID, 'akismet_user_result', true);
337
  $comment_status = wp_get_comment_status( $comment->comment_ID );
338
  $desc = null;
339
  if ( $akismet_error ) {
@@ -369,7 +451,7 @@ function akismet_comment_row_action( $a, $comment ) {
369
  }
370
 
371
  if ( $desc )
372
- echo '<span class="akismet-status" commentid="'.$comment->comment_ID.'"><a href="comment.php?action=editcomment&amp;c='.$comment->comment_ID.'#akismet-status" title="' . esc_attr__( 'View comment history' ) . '">'.htmlspecialchars($desc).'</a></span>';
373
 
374
  if ( apply_filters( 'akismet_show_user_comments_approved', get_option('akismet_show_user_comments_approved') ) == 'true' ) {
375
  $comment_count = akismet_get_user_comments_approved( $comment->user_id, $comment->comment_author_email, $comment->comment_author, $comment->comment_author_url );
@@ -390,7 +472,7 @@ function akismet_comment_status_meta_box($comment) {
390
  foreach ( $history as $row ) {
391
  $time = date( 'D d M Y @ h:i:m a', $row['time'] ) . ' GMT';
392
  echo '<div style="margin-bottom: 13px;"><span style="color: #999;" alt="' . $time . '" title="' . $time . '">' . sprintf( __('%s ago'), human_time_diff( $row['time'] ) ) . '</span> - ';
393
- echo htmlspecialchars( $row['message'] ) . '</div>';
394
  }
395
 
396
  echo '</div>';
@@ -418,7 +500,7 @@ function akismet_comment_column_row( $column, $comment_id ) {
418
  echo '<dl class="akismet-history">';
419
  foreach ( $history as $row ) {
420
  echo '<dt>' . sprintf( __('%s ago'), human_time_diff( $row['time'] ) ) . '</dt>';
421
- echo '<dd>' . htmlspecialchars( $row['message'] ) . '</dd>';
422
  }
423
 
424
  echo '</dl>';
@@ -430,18 +512,16 @@ function akismet_comment_column_row( $column, $comment_id ) {
430
  // END FIXME
431
 
432
  // call out URLS in comments
433
- function akismet_text_add_link_callback( $m ) {
434
-
435
- // bare link?
436
- if ( $m[4] == $m[2] )
437
- return '<a '.$m[1].' href="'.$m[2].'" '.$m[3].' class="comment-link">'.$m[4].'</a>';
438
- else
439
- return '<span title="'.$m[2].'" class="comment-link"><a '.$m[1].' href="'.$m[2].'" '.$m[3].' class="comment-link">'.$m[4].'</a></span>';
440
  }
441
 
442
  function akismet_text_add_link_class( $comment_text ) {
443
-
444
- return preg_replace_callback( '#<a ([^>]*)href="([^"]+)"([^>]*)>(.*?)</a>#i', 'akismet_text_add_link_callback', $comment_text );
445
  }
446
 
447
  add_filter('comment_text', 'akismet_text_add_link_class');
@@ -516,7 +596,6 @@ function akismet_submit_nonspam_comment ( $comment_id ) {
516
  $comment->blog_lang = get_locale();
517
  $comment->blog_charset = get_option('blog_charset');
518
  $comment->permalink = get_permalink($comment->comment_post_ID);
519
- $comment->reporter_ip = $_SERVER['REMOTE_ADDR'];
520
  if ( is_object($current_user) ) {
521
  $comment->reporter = $current_user->user_login;
522
  }
@@ -568,7 +647,6 @@ function akismet_submit_spam_comment ( $comment_id ) {
568
  $comment->blog_lang = get_locale();
569
  $comment->blog_charset = get_option('blog_charset');
570
  $comment->permalink = get_permalink($comment->comment_post_ID);
571
- $comment->reporter_ip = $_SERVER['REMOTE_ADDR'];
572
  if ( is_object($current_user) ) {
573
  $comment->reporter = $current_user->user_login;
574
  }
@@ -822,12 +900,12 @@ function akismet_admin_menu() {
822
  }
823
  }
824
 
825
- function akismet_load_menu() {
826
  if ( class_exists( 'Jetpack' ) ) {
827
- add_submenu_page( 'jetpack', __( 'Akismet Configuration' ), __( 'Akismet Configuration' ), 'manage_options', 'akismet-key-config', 'akismet_conf' );
828
  add_submenu_page( 'jetpack', __( 'Akismet Stats' ), __( 'Akismet Stats' ), 'manage_options', 'akismet-stats-display', 'akismet_stats_display' );
829
  } else {
830
- add_submenu_page('plugins.php', __('Akismet Configuration'), __('Akismet Configuration'), 'manage_options', 'akismet-key-config', 'akismet_conf');
831
  add_submenu_page('index.php', __('Akismet Stats'), __('Akismet Stats'), 'manage_options', 'akismet-stats-display', 'akismet_stats_display');
832
  }
833
  }
10
  if ( !function_exists('is_multisite') && version_compare( $wp_version, '3.0', '<' ) ) {
11
 
12
  function akismet_version_warning() {
13
+ echo '
14
+ <div id="akismet-warning" class="updated fade"><p><strong>'.sprintf(__('Akismet %s requires WordPress 3.0 or higher.'), AKISMET_VERSION) .'</strong> '.sprintf(__('Please <a href="%s">upgrade WordPress</a> to a current version, or <a href="%s">downgrade to version 2.4 of the Akismet plugin</a>.'), 'http://codex.wordpress.org/Upgrading_WordPress', 'http://wordpress.org/extend/plugins/akismet/download/'). '</p></div>
15
+ ';
16
  }
17
  add_action('admin_notices', 'akismet_version_warning');
18
 
31
  function akismet_load_js_and_css() {
32
  global $hook_suffix;
33
 
34
+ if ( in_array( $hook_suffix, array(
35
+ 'index.php', # dashboard
36
+ 'edit-comments.php',
37
+ 'comment.php',
38
+ 'post.php',
39
+ 'plugins_page_akismet-key-config',
40
+ 'jetpack_page_akismet-key-config',
41
+ ) ) ) {
42
  wp_register_style( 'akismet.css', AKISMET_PLUGIN_URL . 'akismet.css', array(), '2.5.4.4' );
43
  wp_enqueue_style( 'akismet.css');
44
 
65
  add_filter( 'plugin_action_links', 'akismet_plugin_action_links', 10, 2 );
66
 
67
  function akismet_conf() {
68
+ global $akismet_nonce, $current_user;
69
+
70
+ $new_key_link = 'https://akismet.com/get/';
71
+ $api_key = akismet_get_key();
72
+ $show_key_form = $api_key;
73
+ $key_status = 'empty';
74
+ $saved_ok = false;
75
+
76
+ $ms = array();
77
 
78
+ if ( isset( $_POST['submit'] ) ) {
79
  if ( function_exists('current_user_can') && !current_user_can('manage_options') )
80
  die(__('Cheatin&#8217; uh?'));
81
+
82
+ $show_key_form = true;
83
 
84
  check_admin_referer( $akismet_nonce );
85
+ $key = preg_replace( '/[^a-h0-9]/i', '', $_POST['key'] );
86
  $home_url = parse_url( get_bloginfo('url') );
87
+
88
+ if ( empty( $home_url['host'] ) )
 
 
 
 
 
89
  $ms[] = 'bad_home_url';
90
+
91
+ if ( empty( $key ) ) {
92
+ if ( $api_key ) {
93
+ delete_option('wordpress_api_key');
94
+ $saved_ok = true;
95
+ $ms[] = 'new_key_empty';
96
+ }
97
+ else
98
+ $ms[] = 'key_empty';
99
+ }
100
+ else
101
  $key_status = akismet_verify_key( $key );
 
102
 
103
+ if ( $key != $api_key && $key_status == 'valid' ) {
104
  update_option('wordpress_api_key', $key);
105
  $ms[] = 'new_key_valid';
106
+ }
107
+ elseif ( $key_status == 'invalid' )
108
  $ms[] = 'new_key_invalid';
109
+ elseif ( $key_status == 'failed' )
110
  $ms[] = 'new_key_failed';
111
+
112
+ $api_key = $key_status == 'valid' ? $key : false;
113
 
114
  if ( isset( $_POST['akismet_discard_month'] ) )
115
  update_option( 'akismet_discard_month', 'true' );
120
  update_option( 'akismet_show_user_comments_approved', 'true' );
121
  else
122
  update_option( 'akismet_show_user_comments_approved', 'false' );
123
+
124
+ if ( empty( $ms ) )
125
+ $saved_ok = true;
126
 
127
+ }
128
+ elseif ( isset( $_POST['check'] ) ) {
129
+ $show_key_form = true;
130
+ check_admin_referer( $akismet_nonce );
131
  akismet_get_server_connectivity(0);
132
  }
133
+
134
+ if ( $show_key_form ) {
135
+ //check current key status
136
+ //only get this if showing the key form otherwise takes longer for page to load for new user
137
+ //no need to get it if we already know it and its valid
138
+ if ( in_array( $key_status, array( 'invalid', 'failed', 'empty' ) ) ) {
139
+ $key = get_option('wordpress_api_key');
140
+ if ( empty( $key ) ) {
141
+ //no key saved yet - maybe connection to Akismet down?
142
+ if ( in_array( $key_status, array( 'invalid', 'empty' ) ) ) {
143
+ if ( akismet_verify_key( '1234567890ab' ) == 'failed' )
144
+ $ms[] = 'no_connection';
145
+ }
146
+ }
147
+ else
148
+ $key_status = akismet_verify_key( $key );
149
  }
150
+
151
+ if ( !isset( $_POST['submit'] ) ) {
152
+ if ( $key_status == 'invalid' )
153
+ $ms[] = 'key_invalid';
154
+ elseif ( !empty( $key ) && $key_status == 'failed' )
155
+ $ms[] = 'key_failed';
156
  }
157
  }
158
 
159
  $messages = array(
160
+ 'new_key_empty' => array( 'class' => 'updated fade', 'text' => __('Your key has been cleared.' ) ),
161
+ 'new_key_valid' => array( 'class' => 'updated fade', 'text' => __('Your Akismet account has been successfully set up and activated. Happy blogging!' ) ),
162
+ 'new_key_invalid' => array( 'class' => 'error', 'text' => __('The key you entered is invalid. Please double-check it.' ) ),
163
+ 'new_key_failed' => array( 'class' => 'error', 'text' => __('The key you entered could not be verified because a connection to akismet.com could not be established. Please check your server configuration.' ) ),
164
+ 'no_connection' => array( 'class' => 'error', 'text' => __('There was a problem connecting to the Akismet server. Please check your server configuration.' ) ),
165
+ 'key_empty' => array( 'class' => 'updated fade', 'text' => __('Please enter an API key' ) ),
166
+ 'key_invalid' => array( 'class' => 'error', 'text' => __('This key is invalid.' ) ),
167
+ 'key_failed' => array( 'class' => 'error', 'text' => __('The key below was previously validated but a connection to akismet.com can not be established at this time. Please check your server configuration.' ) ),
168
+ 'bad_home_url' => array( 'class' => 'error', 'text' => sprintf( __('Your WordPress home URL %s is invalid. Please fix the <a href="%s">home option</a>.'), esc_html( get_bloginfo('url') ), admin_url('options.php#home') ) )
 
169
  );
170
  ?>
171
+
172
+
 
173
  <div class="wrap">
174
+ <?php if ( !$api_key ) : ?>
175
+ <h2 class="ak-header"><?php _e('Akismet'); ?></h2>
176
+ <?php else: ?>
177
+ <h2 class="ak-header"><?php printf( __( 'Akismet <a href="%s" class="add-new-h2">Stats</a>' ), esc_url( add_query_arg( array( 'page' => 'akismet-stats-display' ), class_exists( 'Jetpack' ) ? admin_url( 'admin.php' ) : admin_url( 'index.php' ) ) ) ); ?></h2>
178
+ <?php endif; ?>
179
+ <div class="no-key <?php echo $show_key_form ? 'hidden' : '';?>">
180
+ <p><?php _e('Akismet eliminates the comment and trackback spam you get on your site. To use Akismet you may need to sign up for an API key. Click the button below to get started.'); ?></p>
181
+ <form name="akismet_activate" action="https://akismet.com/get/" method="POST">
182
+ <input type="hidden" name="return" value="1"/>
183
+ <input type="hidden" name="jetpack" value="<?php echo (string) class_exists( 'Jetpack' );?>"/>
184
+ <input type="hidden" name="user" value="<?php echo esc_attr( $current_user->user_login );?>"/>
185
+ <input type="submit" class="button button-primary" value="<?php echo esc_attr( __('Create a new Akismet Key') ); ?>"/>
186
+ </form>
187
+ <br/>
188
+ <a href="#" class="switch-have-key"><?php _e('I already have a key'); ?></a>
189
+ </div>
190
+ <div class="have-key <?php echo $show_key_form ? '' : 'hidden';?>">
191
+ <?php if ( !empty($_POST['submit'] ) && $saved_ok ) : ?>
192
+ <div id="message" class="updated fade"><p><strong><?php _e('Settings saved.') ?></strong></p></div>
193
+ <?php endif; ?>
194
+ <?php if ( isset($_GET['message']) && $_GET['message'] == 'success' ) : ?>
195
+ <div id="message" class="updated fade"><p><?php _e('<strong>Sign up success!</strong> Please check your email for your Akismet API Key and enter it below.') ?></p></div>
196
+ <?php endif; ?>
197
+ <?php foreach( $ms as $m ) : ?>
198
+ <div class="<?php echo $messages[$m]['class']; ?>"><p><strong><?php echo $messages[$m]['text']; ?></strong></p></div>
199
+ <?php endforeach; ?>
200
+ <form action="" method="post" id="akismet-conf">
201
+ <table class="form-table">
202
+ <tbody>
203
+ <tr>
204
+ <th><label for="key"><?php _e('Akismet API Key');?></label></th>
205
+ <td>
206
+ <input id="key" name="key" type="text" size="15" maxlength="12" value="<?php echo esc_html( get_option('wordpress_api_key') ); ?>" class="regular-text code <?php echo $key_status;?>"><div class="under-input key-status <?php echo $key_status;?>"><?php echo ucfirst( $key_status );?></div>
207
+ <p class="need-key description"><?php printf( __('You must enter a valid Akismet API key here. If you need an API key, you can <a href="%s">create one here</a>'), '#' );?></p>
208
+ </td>
209
+ </tr>
210
+ <?php if ( $api_key ):?>
211
+ <tr valign="top">
212
+ <th scope="row"><?php _e('Settings');?></th>
213
+ <td>
214
+ <fieldset><legend class="screen-reader-text"><span><?php _e('Settings');?></span></legend>
215
+ <label for="akismet_discard_month" title="<?php echo esc_attr( __( 'Auto-detete old spam' ) ); ?>"><input name="akismet_discard_month" id="akismet_discard_month" value="true" type="checkbox" <?php echo get_option('akismet_discard_month') == 'true' ? 'checked="checked"':''; ?>> <span><?php _e('Auto-delete spam submitted on posts more than a month old.'); ?></span></label><br>
216
+ <label for="akismet_show_user_comments_approved" title="<?php echo esc_attr( __( 'Show approved comments' ) ); ?>"><input name="akismet_show_user_comments_approved" id="akismet_show_user_comments_approved" value="true" type="checkbox" <?php echo get_option('akismet_show_user_comments_approved') == 'true' ? 'checked="checked"':''; ?>> <span><?php _e('Show the number of comments you\'ve approved beside each comment author.'); ?></span></label>
217
+ </fieldset>
218
+ </td>
219
+ </tr>
220
+ <?php endif; ?>
221
+ </tbody>
222
+ </table>
223
+ <?php akismet_nonce_field($akismet_nonce) ?>
224
+ <p class="submit">
225
+ <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e('Save Changes');?>">
226
+ </p>
227
+ </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
 
229
+ <?php if ( $api_key ) : ?>
230
+ <h3><?php _e('Server Connectivity'); ?></h3>
231
+ <form action="" method="post" id="akismet-connectivity">
232
+ <table class="form-table">
233
+ <tbody>
234
+ <tr>
235
+ <th><label for="key"><?php _e('Server Status');?></label></th>
236
+ <td>
237
+ <?php if ( !function_exists('fsockopen') || !function_exists('gethostbynamel') ) : ?>
238
+ <p class="key-status failed"><?php _e('Network functions are disabled.'); ?></p>
239
+ <p class="description"><?php echo sprintf( __('Your web host or server administrator has disabled PHP\'s <code>fsockopen</code> or <code>gethostbynamel</code> functions. <strong>Akismet cannot work correctly until this is fixed.</strong> Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet\'s system requirements</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
240
+ <?php else :
241
+ $servers = akismet_get_server_connectivity();
242
+ $fail_count = count( $servers ) - count( array_filter( $servers ) );
243
+ if ( is_array( $servers ) && count( $servers ) > 0 ) {
244
+ if ( $fail_count > 0 && $fail_count < count( $servers ) ) { // some connections work, some fail ?>
245
+ <p class="key-status some"><?php _e('Unable to reach some Akismet servers.'); ?></p>
246
+ <p class="description"><?php echo sprintf( __('A network problem or firewall is blocking some connections from your web server to Akismet.com. Akismet is working but this may cause problems during times of network congestion. Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
247
+ <?php } elseif ( $fail_count > 0 ) { // all connections fail ?>
248
+ <p class="key-status failed"><?php _e('Unable to reach any Akismet servers.'); ?></p>
249
+ <p class="description"><?php echo sprintf( __('A network problem or firewall is blocking all connections from your web server to Akismet.com. <strong>Akismet cannot work correctly until this is fixed.</strong> Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
250
+ <?php } else { // all connections work ?>
251
+ <p class="key-status valid"><?php _e('All Akismet servers are available.'); ?></p>
252
+ <p class="description"><?php _e('Akismet is working correctly. All servers are accessible.'); ?></p>
253
+ <?php }
254
+ } else { //can't connect to any server ?>
255
+ <p class="key-status failed"><?php _e('Unable to find Akismet servers.'); ?></p>
256
+ <p class="description"><?php echo sprintf( __('A DNS problem or firewall is preventing all access from your web server to Akismet.com. <strong>Akismet cannot work correctly until this is fixed.</strong> Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
257
+ <?php }
258
+ endif; ?>
259
+ </td>
260
+ </tr>
261
+ <?php if ( !empty( $servers ) ) : ?>
262
+ <tr valign="top">
263
+ <th scope="row"><?php _e('Network Status');?></th>
264
+ <td>
265
+ <table class="network-status">
266
+ <thead>
267
+ <th><?php _e('Akismet server'); ?></th><th><?php _e('Network Status'); ?></th>
268
+ </thead>
269
+ <tbody>
270
+ <?php
271
+ asort($servers);
272
+ foreach ( $servers as $ip => $status ) : ?>
273
+ <tr>
274
+ <td align="center"><?php echo esc_html( $ip ); ?></td>
275
+ <td class="key-status <?php echo $status ? 'valid' : 'failed'; ?>"><?php echo $status ? __('Accessible') : __('Re-trying'); ?></td>
276
+ </tr>
277
+ <?php endforeach; ?>
278
+ </tbody>
279
+ </table>
280
+ <br/>
281
+ <input type="submit" name="check" id="submit" class="button" style="margin-left: 13.3em;" value="<?php _e('Check Network Status');?>">
282
+ </td>
283
+ </tr>
284
+ <?php endif; ?>
285
+ <tr valign="top">
286
+ <th scope="row"><?php _e('Last Checked');?></th>
287
+ <td>
288
+ <p><strong><?php echo get_option('akismet_connectivity_time') ? sprintf( __('%s Ago'), ucwords( human_time_diff( get_option('akismet_connectivity_time') ) ) ) : __( 'Not yet' ); ?></strong></p>
289
+ <p class="description"><?php printf( __('You can confirm that Akismet.com is up by <a href="%s" target="_blank">clicking here</a>.'), 'http://status.automattic.com/9931/136079/Akismet-API' ); ?></p>
290
+ </td>
291
+ </tbody>
292
+ </table>
293
+ <?php akismet_nonce_field($akismet_nonce) ?>
294
+ </form>
295
+ <?php endif;?>
296
+ </div>
297
  </div>
298
  <?php
299
  }
300
 
301
  function akismet_stats_display() {
302
+ global $akismet_api_host, $akismet_api_port;
303
+
304
+ $blog = urlencode( get_bloginfo('url') );
305
+ $api_key = akismet_get_key();?>
306
+
307
+ <div class="wrap"><?php
308
+ if ( !$api_key ) :?>
309
+ <div id="akismet-warning" class="updated fade"><p><strong><?php _e('Akismet is almost ready.');?></strong> <?php printf( __( 'You must <a href="%1$s">enter your Akismet API key</a> for it to work.' ), esc_url( add_query_arg( array( 'page' => 'akismet-key-config' ), admin_url( 'admin.php' ) ) ) );?></p></div><?php
310
+ else :?>
311
+ <iframe src="<?php echo esc_url( sprintf( '%s://akismet.com/web/1.0/user-stats.php?blog=%s&api_key=%s', is_ssl()?'https':'http', $blog, $api_key ) ); ?>" width="100%" height="2500px" frameborder="0" id="akismet-stats-frame"></iframe><?php
312
+ endif;?>
313
+ </div><?php
 
 
314
  }
315
 
316
  function akismet_stats() {
345
  );
346
  ?>
347
  <div class='error'>
348
+ <p><strong><?php _e( 'Akismet Error Code');?>: <?php echo $alert['code']; ?></strong></p>
349
  <p><?php esc_html_e( $alert['msg'] ); ?></p>
350
+ <p><?php //FIXME: need to revert this to using __() in next version
351
+ printf( translate( 'For more information:' ) . ' <a href="%s">%s</a>' , 'https://akismet.com/errors/'.$alert['code'], 'https://akismet.com/errors/'.$alert['code'] );?>
352
+ </p>
353
  </div>
354
  <?php
355
  }
360
 
361
  if ( !get_option('wordpress_api_key') && !$wpcom_api_key && !isset($_POST['submit']) ) {
362
  function akismet_warning() {
363
+ global $hook_suffix, $current_user;
364
+
365
+ if ( $hook_suffix == 'plugins.php' ) {
366
+ echo '
367
+ <div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
368
+ <style type="text/css">
369
+ .akismet_activate{min-width:825px;border:1px solid #4F800D;padding:5px;margin:15px 0;background:#83AF24;background-image:-webkit-gradient(linear,0% 0,80% 100%,from(#83AF24),to(#4F800D));background-image:-moz-linear-gradient(80% 100% 120deg,#4F800D,#83AF24);-moz-border-radius:3px;border-radius:3px;-webkit-border-radius:3px;position:relative;overflow:hidden}.akismet_activate .aa_a{position:absolute;top:-5px;right:10px;font-size:140px;color:#769F33;font-family:Georgia, "Times New Roman", Times, serif;z-index:1}.akismet_activate .aa_button{font-weight:bold;border:1px solid #029DD6;border-top:1px solid #06B9FD;font-size:15px;text-align:center;padding:9px 0 8px 0;color:#FFF;background:#029DD6;background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#029DD6),to(#0079B1));background-image:-moz-linear-gradient(0% 100% 90deg,#0079B1,#029DD6);-moz-border-radius:2px;border-radius:2px;-webkit-border-radius:2px}.akismet_activate .aa_button:hover{text-decoration:none !important;border:1px solid #029DD6;border-bottom:1px solid #00A8EF;font-size:15px;text-align:center;padding:9px 0 8px 0;color:#F0F8FB;background:#0079B1;background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#0079B1),to(#0092BF));background-image:-moz-linear-gradient(0% 100% 90deg,#0092BF,#0079B1);-moz-border-radius:2px;border-radius:2px;-webkit-border-radius:2px}.akismet_activate .aa_button_border{border:1px solid #006699;-moz-border-radius:2px;border-radius:2px;-webkit-border-radius:2px;background:#029DD6;background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#029DD6),to(#0079B1));background-image:-moz-linear-gradient(0% 100% 90deg,#0079B1,#029DD6)}.akismet_activate .aa_button_container{cursor:pointer;display:inline-block;background:#DEF1B8;padding:5px;-moz-border-radius:2px;border-radius:2px;-webkit-border-radius:2px;width:266px}.akismet_activate .aa_description{position:absolute;top:22px;left:285px;margin-left:25px;color:#E5F2B1;font-size:15px;z-index:1000}.akismet_activate .aa_description strong{color:#FFF;font-weight:normal}
370
+ </style>
371
+ <form name="akismet_activate" action="https://akismet.com/get/" method="POST">
372
+ <input type="hidden" name="return" value="1"/>
373
+ <input type="hidden" name="jetpack" value="'.(string) class_exists( 'Jetpack' ).'"/>
374
+ <input type="hidden" name="user" value="'.esc_attr( $current_user->user_login ).'"/>
375
+ <div class="akismet_activate">
376
+ <div class="aa_a">A</div>
377
+ <div class="aa_button_container" onclick="document.akismet_activate.submit();">
378
+ <div class="aa_button_border">
379
+ <div class="aa_button">Activate your Akismet account</div>
380
+ </div>
381
+ </div>
382
+ <div class="aa_description"><strong>Almost done</strong> - activate your account and say goodbye to comment spam.</div>
383
+ </div>
384
+ </form>
385
+ </div>
386
+ ';
387
+ }
388
  }
389
+
390
  add_action('admin_notices', 'akismet_warning');
391
  return;
392
  } elseif ( ( empty($_SERVER['SCRIPT_FILENAME']) || basename($_SERVER['SCRIPT_FILENAME']) == 'edit-comments.php' ) && wp_next_scheduled('akismet_schedule_cron_recheck') ) {
396
  $waiting = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->commentmeta WHERE meta_key = 'akismet_error'" );
397
  $next_check = wp_next_scheduled('akismet_schedule_cron_recheck');
398
  if ( $waiting > 0 && $next_check > time() )
399
+ echo '
400
+ <div id="akismet-warning" class="updated fade"><p><strong>'.__('Akismet has detected a problem.').'</strong> '.sprintf(__('Some comments have not yet been checked for spam by Akismet. They have been temporarily held for moderation. Please check your <a href="%s">Akismet configuration</a> and contact your web host if problems persist.'), 'admin.php?page=akismet-key-config').'</p></div>
401
+ ';
402
  }
403
  add_action('admin_notices', 'akismet_warning');
404
  return;
414
  return $a;
415
 
416
  $akismet_result = get_comment_meta( $comment->comment_ID, 'akismet_result', true );
417
+ $akismet_error = get_comment_meta( $comment->comment_ID, 'akismet_error', true );
418
+ $user_result = get_comment_meta( $comment->comment_ID, 'akismet_user_result', true);
419
  $comment_status = wp_get_comment_status( $comment->comment_ID );
420
  $desc = null;
421
  if ( $akismet_error ) {
451
  }
452
 
453
  if ( $desc )
454
+ echo '<span class="akismet-status" commentid="'.$comment->comment_ID.'"><a href="comment.php?action=editcomment&amp;c='.$comment->comment_ID.'#akismet-status" title="' . esc_attr__( 'View comment history' ) . '">'.esc_html( $desc ).'</a></span>';
455
 
456
  if ( apply_filters( 'akismet_show_user_comments_approved', get_option('akismet_show_user_comments_approved') ) == 'true' ) {
457
  $comment_count = akismet_get_user_comments_approved( $comment->user_id, $comment->comment_author_email, $comment->comment_author, $comment->comment_author_url );
472
  foreach ( $history as $row ) {
473
  $time = date( 'D d M Y @ h:i:m a', $row['time'] ) . ' GMT';
474
  echo '<div style="margin-bottom: 13px;"><span style="color: #999;" alt="' . $time . '" title="' . $time . '">' . sprintf( __('%s ago'), human_time_diff( $row['time'] ) ) . '</span> - ';
475
+ echo esc_html( $row['message'] ) . '</div>';
476
  }
477
 
478
  echo '</div>';
500
  echo '<dl class="akismet-history">';
501
  foreach ( $history as $row ) {
502
  echo '<dt>' . sprintf( __('%s ago'), human_time_diff( $row['time'] ) ) . '</dt>';
503
+ echo '<dd>' . esc_html( $row['message'] ) . '</dd>';
504
  }
505
 
506
  echo '</dl>';
512
  // END FIXME
513
 
514
  // call out URLS in comments
515
+ function akismet_text_add_link_callback( $m ) {
516
+ // bare link?
517
+ if ( $m[4] == $m[2] )
518
+ return '<a '.$m[1].' href="'.$m[2].'" '.$m[3].' class="comment-link">'.$m[4].'</a>';
519
+ else
520
+ return '<span title="'.$m[2].'" class="comment-link"><a '.$m[1].' href="'.$m[2].'" '.$m[3].' class="comment-link">'.$m[4].'</a></span>';
 
521
  }
522
 
523
  function akismet_text_add_link_class( $comment_text ) {
524
+ return preg_replace_callback( '#<a ([^>]*)href="([^"]+)"([^>]*)>(.*?)</a>#i', 'akismet_text_add_link_callback', $comment_text );
 
525
  }
526
 
527
  add_filter('comment_text', 'akismet_text_add_link_class');
596
  $comment->blog_lang = get_locale();
597
  $comment->blog_charset = get_option('blog_charset');
598
  $comment->permalink = get_permalink($comment->comment_post_ID);
 
599
  if ( is_object($current_user) ) {
600
  $comment->reporter = $current_user->user_login;
601
  }
647
  $comment->blog_lang = get_locale();
648
  $comment->blog_charset = get_option('blog_charset');
649
  $comment->permalink = get_permalink($comment->comment_post_ID);
 
650
  if ( is_object($current_user) ) {
651
  $comment->reporter = $current_user->user_login;
652
  }
900
  }
901
  }
902
 
903
+ function akismet_load_menu() {
904
  if ( class_exists( 'Jetpack' ) ) {
905
+ add_submenu_page( 'jetpack', __( 'Akismet' ), __( 'Akismet' ), 'manage_options', 'akismet-key-config', 'akismet_conf' );
906
  add_submenu_page( 'jetpack', __( 'Akismet Stats' ), __( 'Akismet Stats' ), 'manage_options', 'akismet-stats-display', 'akismet_stats_display' );
907
  } else {
908
+ add_submenu_page('plugins.php', __('Akismet'), __('Akismet'), 'manage_options', 'akismet-key-config', 'akismet_conf');
909
  add_submenu_page('index.php', __('Akismet Stats'), __('Akismet Stats'), 'manage_options', 'akismet-stats-display', 'akismet_stats_display');
910
  }
911
  }
akismet.css CHANGED
@@ -1,12 +1 @@
1
- #submitted-on { position: relative; }
2
- #the-comment-list .author .akismet-user-comment-count { display: inline; }
3
- #the-comment-list .author a span { text-decoration: none; color: #999; }
4
- #the-comment-list .remove_url { margin-left: 3px; color: #999; padding: 2px 3px 2px 0; }
5
- #the-comment-list .remove_url:hover { color: #A7301F; font-weight: bold; padding: 2px 2px 2px 0; }
6
- #dashboard_recent_comments .akismet-status { display: none; } /* never show the flagged by text on the dashboard */
7
- .akismet-status { float: right; }
8
- .akismet-status a { color: #AAA; font-style: italic; }
9
- span.comment-link a { text-decoration: underline; }
10
- span.comment-link:after { content: " " attr(title) " "; color: #aaa; text-decoration: none; }
11
- .mshot-arrow { width: 0; height: 0; border-top: 10px solid transparent; border-bottom: 10px solid transparent; border-right:10px solid #5C5C5C; position: absolute; left: -6px; top: 91px; }
12
- .mshot-container { background: #5C5C5C; position: absolute; top: -94px; padding: 7px; width: 450px; height: 338px; z-index: 20000; -moz-border-radius:6px; border-radius:6px; -webkit-border-radius:6px; }
1
+ #submitted-on{position:relative}#the-comment-list .author .akismet-user-comment-count{display:inline}#the-comment-list .author a span{text-decoration:none;color:#999}#the-comment-list .remove_url{margin-left:3px;color:#999;padding:2px 3px 2px 0}#the-comment-list .remove_url:hover{color:#A7301F;font-weight:bold;padding:2px 2px 2px 0}#dashboard_recent_comments .akismet-status{display:none}.akismet-status{float:right}.akismet-status a{color:#AAA;font-style:italic}span.comment-link a{text-decoration:underline}span.comment-link:after{content:" "attr(title) " ";color:#aaa;text-decoration:none}.mshot-arrow{width:0;height:0;border-top:10px solid transparent;border-bottom:10px solid transparent;border-right:10px solid #5C5C5C;position:absolute;left:-6px;top:91px}.mshot-container{background:#5C5C5C;position:absolute;top:-94px;padding:7px;width:450px;height:338px;z-index:20000;-moz-border-radius:6px;border-radius:6px;-webkit-border-radius:6px}h2.ak-header{padding-left:38px;background:url('img/logo.png') no-repeat 0 9px;margin-bottom:14px;line-height:32px}.key-status{padding:0.4em 1em;color:#fff;font-weight:bold;text-align:center;-webkit-border-radius:3px;border-radius:3px;border-width:1px;border-style:solid;max-width:23.3em}input#key{width:25.3em !important}input#key.valid{border-color:#4F800D}input#key.invalid,input#key.failed{border-color:#888}.key-status.under-input{margin-top:-5px;padding-bottom:0px}.key-status.invalid,.key-status.failed{background-color:#888}.key-status.valid{background-color:#4F800D}.key-status.some{background-color:#993300}.key-status.empty{display:none}table.network-status th,table.network-status td{padding:0.4em;margin:0;text-align:center}table.network-status{border-color:#dfdfdf;border-width:0 0 1px 1px;border-style:solid;border-spacing:0;width:25.6em}table.network-status th,table.network-status td{border-color:#dfdfdf;border-width:1px 1px 0 0;border-style:solid;margin:0;border-spacing:0}table.network-status td.key-status{border-radius:0px;-webkit-border-radius:0px}
 
 
 
 
 
 
 
 
 
 
 
akismet.js CHANGED
@@ -1,4 +1,16 @@
1
  jQuery(document).ready(function () {
 
 
 
 
 
 
 
 
 
 
 
 
2
  jQuery('.akismet-status').each(function () {
3
  var thisId = jQuery(this).attr('commentid');
4
  jQuery(this).prependTo('#comment-' + thisId + ' .column-comment div:first-child');
1
  jQuery(document).ready(function () {
2
+ jQuery( '.switch-have-key' ).click( function() {
3
+ var no_key = jQuery( this ).parents().find('div.no-key');
4
+ var have_key = jQuery( this ).parents().find('div.have-key');
5
+
6
+ no_key.addClass( 'hidden' );
7
+ have_key.removeClass( 'hidden' );
8
+
9
+ return false;
10
+ });
11
+ jQuery( 'p.need-key a' ).click( function(){
12
+ document.akismet_activate.submit();
13
+ });
14
  jQuery('.akismet-status').each(function () {
15
  var thisId = jQuery(this).attr('commentid');
16
  jQuery(this).prependTo('#comment-' + thisId + ' .column-comment div:first-child');
akismet.php CHANGED
@@ -6,7 +6,7 @@
6
  Plugin Name: Akismet
7
  Plugin URI: http://akismet.com/?return=true
8
  Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from comment and trackback spam</strong>. It keeps your site protected from spam even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="http://akismet.com/get/?return=true">Sign up for an Akismet API key</a>, and 3) Go to your Akismet configuration page, and save your API key.
9
- Version: 2.5.7
10
  Author: Automattic
11
  Author URI: http://automattic.com/wordpress-plugins/
12
  License: GPLv2 or later
@@ -34,7 +34,7 @@ if ( !function_exists( 'add_action' ) ) {
34
  exit;
35
  }
36
 
37
- define('AKISMET_VERSION', '2.5.7');
38
  define('AKISMET_PLUGIN_URL', plugin_dir_url( __FILE__ ));
39
 
40
  /** If you hardcode a WP.com API key here, all key config screens will be hidden */
6
  Plugin Name: Akismet
7
  Plugin URI: http://akismet.com/?return=true
8
  Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from comment and trackback spam</strong>. It keeps your site protected from spam even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="http://akismet.com/get/?return=true">Sign up for an Akismet API key</a>, and 3) Go to your Akismet configuration page, and save your API key.
9
+ Version: 2.5.8
10
  Author: Automattic
11
  Author URI: http://automattic.com/wordpress-plugins/
12
  License: GPLv2 or later
34
  exit;
35
  }
36
 
37
+ define('AKISMET_VERSION', '2.5.8');
38
  define('AKISMET_PLUGIN_URL', plugin_dir_url( __FILE__ ));
39
 
40
  /** If you hardcode a WP.com API key here, all key config screens will be hidden */
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Akismet ===
2
- Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, automattic
3
  Tags: akismet, comments, spam
4
  Requires at least: 3.0
5
- Tested up to: 3.5
6
- Stable tag: 2.5.7
7
  License: GPLv2 or later
8
 
9
  Akismet checks your comments against the Akismet web service to see if they look like spam or not.
@@ -31,6 +31,11 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co
31
 
32
  == Changelog ==
33
 
 
 
 
 
 
34
  = 2.5.7 =
35
  * FireFox Stats iframe preview bug
36
  * Fix mshots preview when using https
1
  === Akismet ===
2
+ Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, automattic
3
  Tags: akismet, comments, spam
4
  Requires at least: 3.0
5
+ Tested up to: 3.6
6
+ Stable tag: 2.5.8
7
  License: GPLv2 or later
8
 
9
  Akismet checks your comments against the Akismet web service to see if they look like spam or not.
31
 
32
  == Changelog ==
33
 
34
+ = 2.5.8 =
35
+ * Simplify the activation process for new users
36
+ * Remove the reporter_ip parameter
37
+ * Minor preventative security improvements
38
+
39
  = 2.5.7 =
40
  * FireFox Stats iframe preview bug
41
  * Fix mshots preview when using https