X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/177fd6fefd2e3d5a0ea6591c71d660cabdb3c1a4..refs/tags/wordpress-2.6.2:/wp-content/plugins/akismet/akismet.php diff --git a/wp-content/plugins/akismet/akismet.php b/wp-content/plugins/akismet/akismet.php index e774fdae..21933883 100644 --- a/wp-content/plugins/akismet/akismet.php +++ b/wp-content/plugins/akismet/akismet.php @@ -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 WordPress.com API key to use it. You can review the spam it catches under "Comments." To show off your Akismet stats just put <?php akismet_counter(); ?> in your template. See also: WP Stats plugin. -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 "" . __('Check for Spam') . ""; + if ( function_exists('plugins_url') ) + $link = 'admin.php?action=akismet_recheck_queue'; + else + $link = 'edit-comments.php?page=akismet-admin&recheckqueue=true&noheader=true'; + echo "
" . __('Check for Spam') . ""; } 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;