'plugins_page_akismet-key-config',
'jetpack_page_akismet-key-config',
) ) ) {
- wp_register_style( 'akismet.css', AKISMET_PLUGIN_URL . 'akismet.css', array(), '2.5.9' );
+ wp_register_style( 'akismet.css', AKISMET_PLUGIN_URL . 'akismet.css', array(), AKISMET_VERSION );
wp_enqueue_style( 'akismet.css');
- wp_register_script( 'akismet.js', AKISMET_PLUGIN_URL . 'akismet.js', array('jquery'), '2.5.9' );
+ wp_register_script( 'akismet.js', AKISMET_PLUGIN_URL . 'akismet.js', array('jquery'), AKISMET_VERSION );
wp_enqueue_script( 'akismet.js' );
wp_localize_script( 'akismet.js', 'WPAkismet', array(
- 'comment_author_url_nonce' => wp_create_nonce( 'comment_author_url_nonce' )
+ 'comment_author_url_nonce' => wp_create_nonce( 'comment_author_url_nonce' ),
+ 'strings' => array(
+ 'Remove this URL' => __( 'Remove this URL' ),
+ 'Removing...' => __( 'Removing...' ),
+ 'URL removed' => __( 'URL removed' ),
+ '(undo)' => __( '(undo)' ),
+ 'Re-adding...' => __( 'Re-adding...' ),
+ )
) );
}
}
$path = plugin_basename(__FILE__);
echo '<h3>' . _x( 'Spam', 'comments' ) . '</h3>';
global $submenu;
- if ( isset( $submenu['edit-comments.php'] ) )
- $link = 'edit-comments.php';
- else
- $link = 'edit.php';
- echo '<p>'.sprintf( _n( '<a href="%1$s">Akismet</a> has protected your site from <a href="%2$s">%3$s spam comments</a>.', '<a href="%1$s">Akismet</a> has protected your site from <a href="%2$s">%3$s spam comments</a>.', $count ), 'http://akismet.com/?return=true', clean_url("$link?page=akismet-admin"), number_format_i18n($count) ).'</p>';
+ echo '<p>'.sprintf( _n( '<a href="%1$s">Akismet</a> has protected your site from <a href="%2$s">%3$s spam comments</a>.', '<a href="%1$s">Akismet</a> has protected your site from <a href="%2$s">%3$s spam comments</a>.', $count ), 'http://akismet.com/?return=true', esc_url( add_query_arg( array( 'page' => 'akismet-admin' ), admin_url( isset( $submenu['edit-comments.php'] ) ? 'edit-comments.php' : 'edit.php' ) ) ), number_format_i18n($count) ).'</p>';
}
add_action('activity_box_end', 'akismet_stats');
global $submenu, $wp_db_version;
if ( 8645 < $wp_db_version ) // 2.7
- $link = 'edit-comments.php?comment_status=spam';
+ $link = add_query_arg( array( 'comment_status' => 'spam' ), admin_url( 'edit-comments.php' ) );
elseif ( isset( $submenu['edit-comments.php'] ) )
- $link = 'edit-comments.php?page=akismet-admin';
+ $link = add_query_arg( array( 'page' => 'akismet-admin' ), admin_url( 'edit-comments.php' ) );
else
- $link = 'edit.php?page=akismet-admin';
+ $link = add_query_arg( array( 'page' => 'akismet-admin' ), admin_url( 'edit.php' ) );
if ( $count = get_option('akismet_spam_count') ) {
$intro = sprintf( _n(
// For WP >= 2.5
-function akismet_check_for_spam_button($comment_status) {
+function akismet_check_for_spam_button( $comment_status ) {
if ( 'approved' == $comment_status )
return;
+
if ( function_exists('plugins_url') )
- $link = 'admin.php?action=akismet_recheck_queue';
+ $link = add_query_arg( array( 'action' => 'akismet_recheck_queue' ), admin_url( 'admin.php' ) );
else
- $link = 'edit-comments.php?page=akismet-admin&recheckqueue=true&noheader=true';
- echo "</div><div class='alignleft'><a class='button-secondary checkforspam' href='$link'>" . __('Check for Spam') . "</a>";
+ $link = add_query_arg( array( 'page' => 'akismet-admin', 'recheckqueue' => 'true', 'noheader' => 'true' ), admin_url( 'edit-comments.php' ) );
+
+ echo '</div><div class="alignleft"><a class="button-secondary checkforspam" href="' . $link . '">' . esc_html__('Check for Spam') . '</a>';
+ echo '<img src="' . esc_url( admin_url( 'images/wpspin_light.gif' ) ) . '" class="checkforspam-spinner" />';
}
add_action('manage_comments_nav', 'akismet_check_for_spam_button');
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 );
+
+ $paginate = '';
+ if ( isset( $_POST['limit'] ) && isset( $_POST['offset'] ) ) {
+ $paginate = $wpdb->prepare( " LIMIT %d OFFSET %d", array( $_POST['limit'], $_POST['offset'] ) );
+ }
+ $moderation = $wpdb->get_results( "SELECT * FROM {$wpdb->comments} WHERE comment_approved = '0'{$paginate}", ARRAY_A );
foreach ( (array) $moderation as $c ) {
$c['user_ip'] = $c['comment_author_IP'];
$c['user_agent'] = $c['comment_agent'];
$c['blog'] = get_bloginfo('url');
$c['blog_lang'] = get_locale();
$c['blog_charset'] = get_option('blog_charset');
- $c['permalink'] = get_permalink($c['comment_post_ID']);
+ $c['permalink'] = get_permalink($c['comment_post_ID']);
$c['user_role'] = '';
if ( isset( $c['user_ID'] ) )
delete_comment_meta( $c['comment_ID'], 'akismet_rechecking' );
}
- $redirect_to = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : admin_url( 'edit-comments.php' );
- wp_safe_redirect( $redirect_to );
- exit;
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
+ wp_send_json( array(
+ 'processed' => count((array) $moderation),
+ ));
+ }
+ else {
+ $redirect_to = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : admin_url( 'edit-comments.php' );
+ wp_safe_redirect( $redirect_to );
+ exit;
+ }
}
add_action('admin_action_akismet_recheck_queue', 'akismet_recheck_queue');
+add_action('wp_ajax_akismet_recheck_queue', 'akismet_recheck_queue');
// Adds an 'x' link next to author URLs, clicking will remove the author URL and show an undo link
function akismet_remove_comment_author_url() {