akismet_comment_row_action

Definition:
function akismet_comment_row_action( $a, $comment ) {}

Parameters

  • $a
  • $comment

Defined filters

  • akismet_show_user_comments_approved
    apply_filters( 'akismet_show_user_comments_approved', get_option('akismet_show_user_comments_approved')

Source code

function akismet_comment_row_action( $a, $comment ) {



	// failsafe for old WP versions

	if ( !function_exists('add_comment_meta') )

		return $a;



	$akismet_result = get_comment_meta( $comment->comment_ID, 'akismet_result', true );

	$user_result = get_comment_meta( $comment->comment_ID, 'akismet_user_result', true);

	$comment_status = wp_get_comment_status( $comment->comment_ID );

	$desc = null;

	if ( !$user_result || $user_result == $akismet_result ) {

		// Show the original Akismet result if the user hasn't overridden it, or if their decision was the same

		if ( $akismet_result == 'true' && $comment_status != 'spam' && $comment_status != 'trash' )

			$desc = __( 'Flagged as spam by Akismet' );

		elseif ( $akismet_result == 'false' && $comment_status == 'spam' )

			$desc = __( 'Cleared by Akismet' );

	} else {

		$who = get_comment_meta( $comment->comment_ID, 'akismet_user', true );

		if ( $user_result == 'true' )

			$desc = sprintf( __('Flagged as spam by %s'), $who );

		else

			$desc = sprintf( __('Un-spammed by %s'), $who );

	}



	// add a History item to the hover links, just after Edit

	if ( $akismet_result ) {

		$b = array();

		foreach ( $a as $k => $item ) {

			$b[ $k ] = $item;

			if ( $k == 'edit' )

				$b['history'] = '<a href="comment.php?action=editcomment&amp;c='.$comment->comment_ID.'#akismet-status" title="'. esc_attr__( 'View comment history' ) . '"> '. __('History') . '</a>';

		}

		

		$a = $b;

	}

		

	if ( $desc )

		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>';

		

	if ( apply_filters( 'akismet_show_user_comments_approved', get_option('akismet_show_user_comments_approved') ) == 'true' ) {

		$comment_count = akismet_get_user_comments_approved( $comment->user_id, $comment->comment_author_email, $comment->comment_author, $comment->comment_author_url );

		$comment_count = intval( $comment_count );

		echo '<span class="akismet-user-comment-count" commentid="'.$comment->comment_ID.'" style="display:none;"><br><span class="akismet-user-comment-counts">'.sprintf( _n( '%s approved', '%s approved', $comment_count ), number_format_i18n( $comment_count ) ) . '</span></span>';

	}

	

	return $a;

}

433

akismet_comment_column_row

Definition:
function akismet_comment_column_row( $column, $comment_id ) {}

Parameters

  • $column
  • $comment_id

Source code

function akismet_comment_column_row( $column, $comment_id ) {

	if ( $column != 'akismet' )

		return;

		

	$history = akismet_get_comment_history( $comment_id );

	

	if ( $history ) {

		echo '<dl class="akismet-history">';

		foreach ( $history as $row ) {

			echo '<dt>' . sprintf( __('%s ago'), human_time_diff( $row['time'] ) ) . '</dt>';

			echo '<dd>' . htmlspecialchars( $row['message'] ) . '</dd>';

		}

		

		echo '</dl>';

	}

}

431

akismet_comments_columns

Definition:
function akismet_comments_columns( $columns ) {}

Parameters

  • $columns

Source code

function akismet_comments_columns( $columns ) {

	$columns[ 'akismet' ] = __( 'Akismet' );

	return $columns;

}

429

akismet_check_server_connectivity

Definition:
function akismet_check_server_connectivity() {}

Source code

function akismet_check_server_connectivity() {

	global $akismet_api_host, $akismet_api_port, $wpcom_api_key;

	

	$test_host = 'rest.akismet.com';

	

	// Some web hosts may disable one or both functions

	if ( !function_exists('fsockopen') || !function_exists('gethostbynamel') )

		return array();

	

	$ips = gethostbynamel($test_host);

	if ( !$ips || !is_array($ips) || !count($ips) )

		return array();

		

	$servers = array();

	foreach ( $ips as $ip ) {

		$response = akismet_verify_key( akismet_get_key(), $ip );

		// even if the key is invalid, at least we know we have connectivity

		if ( $response == 'valid' || $response == 'invalid' )

			$servers[$ip] = true;

		else

			$servers[$ip] = false;

	}



	return $servers;

}

427

akismet_check_for_spam_button

Definition:
function akismet_check_for_spam_button($comment_status) {}

Parameters

  • $comment_status

Source code

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';

	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>";

}

423