wpcf7_akismet() CF7 1.0
Хуков нет.
Возвращает
Null. Ничего.
Использование
wpcf7_akismet( $spam, $submission );
Код wpcf7_akismet() wpcf7 akismet CF7 5.3.2
function wpcf7_akismet( $spam, $submission ) {
if ( $spam ) {
return $spam;
}
if ( ! wpcf7_akismet_is_available() ) {
return false;
}
if ( ! $params = wpcf7_akismet_submitted_params() ) {
return false;
}
$c = array();
$c['comment_author'] = $params['author'];
$c['comment_author_email'] = $params['author_email'];
$c['comment_author_url'] = $params['author_url'];
$c['comment_content'] = $params['content'];
$c['blog'] = get_option( 'home' );
$c['blog_lang'] = get_locale();
$c['blog_charset'] = get_option( 'blog_charset' );
$c['user_ip'] = $_SERVER['REMOTE_ADDR'];
$c['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
$c['referrer'] = $_SERVER['HTTP_REFERER'];
$c['comment_type'] = 'contact-form';
$datetime = date_create_immutable(
'@' . $submission->get_meta( 'timestamp' )
);
if ( $datetime ) {
$c['comment_date_gmt'] = $datetime->format( DATE_ATOM );
}
if ( $permalink = get_permalink() ) {
$c['permalink'] = $permalink;
}
$ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' );
foreach ( $_SERVER as $key => $value ) {
if ( ! in_array( $key, (array) $ignore ) ) {
$c["$key"] = $value;
}
}
if ( wpcf7_akismet_comment_check( $c ) ) {
$spam = true;
$submission->add_spam_log( array(
'agent' => 'akismet',
'reason' => __( "Akismet returns a spam response.", 'contact-form-7' ),
) );
} else {
$spam = false;
}
return $spam;
}