akismet_cron_recheck

Definition:
function akismet_cron_recheck() {}

Source code

function akismet_cron_recheck() {

	global $wpdb;



	delete_option('akismet_available_servers');



	$comment_errors = $wpdb->get_col( "

		SELECT comment_id

		FROM {$wpdb->prefix}commentmeta

9017

akismet_counter

Definition:
function akismet_counter() {}

Source code

function akismet_counter() {

	$plugin_dir = '/wp-content/plugins';

	if ( defined( 'PLUGINDIR' ) )

		$plugin_dir = '/' . PLUGINDIR;



?>

<style type="text/css">

#akismetwrap #aka,#aka:link,#aka:hover,#aka:visited,#aka:active{color:#fff;text-decoration:none}

#aka:hover{border:none;text-decoration:none}

#aka:hover #akismet1{display:none}

#aka:hover #akismet2,#akismet1{display:block}

#akismet2{display:none;padding-top:2px}

#akismeta{font-size:16px;font-weight:bold;line-height:18px;text-decoration:none}

#akismetcount{display:block;font:15px Verdana,Arial,Sans-Serif;font-weight:bold;text-decoration:none}

#akismetwrap #akismetstats{background:url(<?php echo get_option('siteurl'), $plugin_dir; ?>/akismet/akismet.gif) no-repeat top left;border:none;color:#fff;font:11px 'Trebuchet MS','Myriad Pro',sans-serif;height:40px;line-height:100%;overflow:hidden;padding:8px 0 0;text-align:center;width:120px}

</style>

<?php

$count = get_option('akismet_spam_count');

printf( _n( '<div id="akismetwrap"><div id="akismetstats"><a id="aka" href="http://akismet.com" title=""><div id="akismet1"><span id="akismetcount">%1$s</span> <span id="akismetsc">spam comment</span></div> <div id="akismet2"><span id="akismetbb">blocked by</span><br /><span id="akismeta">Akismet</span></div></a></div></div>', '<div id="akismetwrap"><div id="akismetstats"><a id="aka" href="http://akismet.com" title=""><div id="akismet1"><span id="akismetcount">%1$s</span> <span id="akismetsc">spam comments</span></div> <div id="akismet2"><span id="akismetbb">blocked by</span><br /><span id="akismeta">Akismet</span></div></a></div></div>', $count ), number_format_i18n( $count ) );

}

9015

akismet_cmp_time

Definition:
function akismet_cmp_time( $a, $b ) {}

Parameters

  • $a
  • $b

Source code

function akismet_cmp_time( $a, $b ) {

	return $a['time'] > $b['time'] ? -1 : 1;

}

9007

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;

}

9005

akismet_auto_check_update_meta

Definition:
function akismet_auto_check_update_meta( $id, $comment ) {}

Parameters

  • $id
  • $comment

Source code

function akismet_auto_check_update_meta( $id, $comment ) {

	global $akismet_last_comment;



	// failsafe for old WP versions

	if ( !function_exists('add_comment_meta') )

		return false;



	// wp_insert_comment() might be called in other contexts, so make sure this is the same comment

	// as was checked by akismet_auto_check_comment

	if ( is_object($comment) && !empty($akismet_last_comment) && is_array($akismet_last_comment) ) {

		if ( intval($akismet_last_comment['comment_post_ID']) == intval($comment->comment_post_ID)

			&& $akismet_last_comment['comment_author'] == $comment->comment_author

			&& $akismet_last_comment['comment_author_email'] == $comment->comment_author_email ) {

				// normal result: true or false

				if ( $akismet_last_comment['akismet_result'] == 'true' ) {

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

					akismet_update_comment_history( $comment->comment_ID, __('Akismet caught this comment as spam'), 'check-spam' );

					if ( $comment->comment_approved != 'spam' )

						akismet_update_comment_history( $comment->comment_ID, sprintf( __('Comment status was changed to %s'), $comment->comment_approved), 'status-changed'.$comment->comment_approved );

				} elseif ( $akismet_last_comment['akismet_result'] == 'false' ) {

					update_comment_meta( $comment->comment_ID, 'akismet_result', 'false' );

					akismet_update_comment_history( $comment->comment_ID, __('Akismet cleared this comment'), 'check-ham' );

					if ( $comment->comment_approved == 'spam' ) {

						if ( wp_blacklist_check($comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent) )

							akismet_update_comment_history( $comment->comment_ID, __('Comment was caught by wp_blacklist_check'), 'wp-blacklisted' );

						else

							akismet_update_comment_history( $comment->comment_ID, sprintf( __('Comment status was changed to %s'), $comment->comment_approved), 'status-changed-'.$comment->comment_approved );

					}

				// abnormal result: error

				} else {

					update_comment_meta( $comment->comment_ID, 'akismet_error', time() );

					akismet_update_comment_history( $comment->comment_ID, sprintf( __('Akismet was unable to check this comment (response: %s), will automatically retry again later.'), $akismet_last_comment['akismet_result']), 'check-error' );

				}

				

				// record the complete original data as submitted for checking

				if ( isset($akismet_last_comment['comment_as_submitted']) )

					update_comment_meta( $comment->comment_ID, 'akismet_as_submitted', $akismet_last_comment['comment_as_submitted'] );

		}

	}

}

9000