wpcf7_akismet_comment_check()CF7 1.0

Sends data to Akismet.

Хуки из функции

Возвращает

true|false. True if Akismet called it spam, or false otherwise.

Использование

wpcf7_akismet_comment_check( $comment );
$comment(массив) (обязательный)
Submission and environment data.

Код wpcf7_akismet_comment_check() CF7 5.9.3

function wpcf7_akismet_comment_check( $comment ) {
	$spam = false;
	$query_string = wpcf7_build_query( $comment );

	if ( is_callable( array( 'Akismet', 'http_post' ) ) ) {
		$response = Akismet::http_post( $query_string, 'comment-check' );
	} else {
		return $spam;
	}

	if ( 'true' == $response[1] ) {
		$spam = true;
	}

	if ( $submission = WPCF7_Submission::get_instance() ) {
		$submission->push( 'akismet', array(
			'comment' => $comment,
			'spam' => $spam,
		) );
	}

	return apply_filters( 'wpcf7_akismet_comment_check', $spam, $comment );
}