]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-content/plugins/akismet/akismet.php
Wordpress 2.6.2
[autoinstalls/wordpress.git] / wp-content / plugins / akismet / akismet.php
index e774fdae0bb25d143fc240c8e134ece58fb5430e..21933883c678c827a9b0994709849997600f93f4 100644 (file)
@@ -3,9 +3,9 @@
 Plugin Name: Akismet
 Plugin URI: http://akismet.com/
 Description: Akismet checks your comments against the Akismet web service to see if they look like spam or not. You need a <a href="http://wordpress.com/api-keys/">WordPress.com API key</a> to use it. You can review the spam it catches under "Comments." To show off your Akismet stats just put <code>&lt;?php akismet_counter(); ?></code> in your template. See also: <a href="http://wordpress.org/extend/plugins/stats/">WP Stats plugin</a>.
-Version: 2.1.4
+Version: 2.1.8
 Author: Matt Mullenweg
-Author URI: http://photomatt.net/
+Author URI: http://ma.tt/
 */
 
 // If you hardcode a WP.com API key here, all key config screens will be hidden
@@ -327,7 +327,12 @@ function akismet_spam_totals() {
 }
 
 function akismet_manage_page() {
-       global $wpdb, $submenu;
+       global $wpdb, $submenu, $wp_db_version;
+
+       // WP 2.7 has its own spam management page
+       if ( 8645 <= $wp_db_version )
+               return;
+
        $count = sprintf(__('Akismet Spam (%s)'), akismet_spam_count());
        if ( isset( $submenu['edit-comments.php'] ) )
                add_submenu_page('edit-comments.php', __('Akismet Spam'), $count, 'moderate_comments', 'akismet-admin', 'akismet_caught' );
@@ -337,6 +342,7 @@ function akismet_manage_page() {
 
 function akismet_caught() {
        global $wpdb, $comment, $akismet_caught, $akismet_nonce;
+
        akismet_recheck_queue();
        if (isset($_POST['submit']) && 'recover' == $_POST['action'] && ! empty($_POST['not_spam'])) {
                check_admin_referer( $akismet_nonce );
@@ -480,7 +486,7 @@ if ( isset( $_POST['s'] ) ) {
        if ( isset( $_GET['ctype'] ) )
                $current_type = preg_replace( '|[^a-z]|', '', $_GET['ctype'] );
 
-       $comments = akismet_spam_comments( $current_type );
+       $comments = akismet_spam_comments( $current_type, $page );
        $total = akismet_spam_count( $current_type );
        $totals = akismet_spam_totals();
 ?>
@@ -706,22 +712,24 @@ if ( 'moderation.php' == $pagenow ) {
 
 // For WP >= 2.5
 function akismet_check_for_spam_button($comment_status) {
-       if ( 'moderated' != $comment_status )
+       if ( 'approved' == $comment_status )
                return;
-       $count = wp_count_comments();
-       if ( !empty($count->moderated ) )
-               echo "<a href='edit-comments.php?page=akismet-admin&amp;recheckqueue=true&amp;noheader=true'>" . __('Check for Spam') . "</a>";
+       if ( function_exists('plugins_url') )
+               $link = 'admin.php?action=akismet_recheck_queue';
+       else
+               $link = 'edit-comments.php?page=akismet-admin&amp;recheckqueue=true&amp;noheader=true';
+       echo "</div><div class='alignleft'><a class='button-secondary checkforspam' href='$link'>" . __('Check for Spam') . "</a>";
 }
 add_action('manage_comments_nav', 'akismet_check_for_spam_button');
 
 function akismet_recheck_queue() {
        global $wpdb, $akismet_api_host, $akismet_api_port;
 
-       if ( !isset( $_GET['recheckqueue'] ) )
+       if ( ! ( isset( $_GET['recheckqueue'] ) || ( isset( $_REQUEST['action'] ) && 'akismet_recheck_queue' == $_REQUEST['action'] ) ) )
                return;
 
        $moderation = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = '0'", ARRAY_A );
-       foreach ( $moderation as $c ) {
+       foreach ( (array) $moderation as $c ) {
                $c['user_ip']    = $c['comment_author_IP'];
                $c['user_agent'] = $c['comment_agent'];
                $c['referrer']   = '';
@@ -741,6 +749,8 @@ function akismet_recheck_queue() {
        exit;
 }
 
+add_action('admin_action_akismet_recheck_queue', 'akismet_recheck_queue');
+
 function akismet_check_db_comment( $id ) {
        global $wpdb, $akismet_api_host, $akismet_api_port;