rebase on oct-10-2023
This commit is contained in:
@@ -41,44 +41,43 @@ function wpcf7_akismet( $spam, $submission ) {
|
||||
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';
|
||||
$comment = array(
|
||||
'comment_type' => 'contact-form',
|
||||
'comment_author' => $params['author'],
|
||||
'comment_author_email' => $params['author_email'],
|
||||
'comment_author_url' => $params['author_url'],
|
||||
'comment_content' => $params['content'],
|
||||
'blog' => home_url(),
|
||||
'blog_lang' => get_locale(),
|
||||
'blog_charset' => get_option( 'blog_charset' ),
|
||||
'user_ip' => $submission->get_meta( 'remote_ip' ),
|
||||
'user_agent' => $submission->get_meta( 'user_agent' ),
|
||||
'referrer' => isset( $_SERVER['HTTP_REFERER'] )
|
||||
? $_SERVER['HTTP_REFERER'] : '',
|
||||
);
|
||||
|
||||
$datetime = date_create_immutable(
|
||||
'@' . $submission->get_meta( 'timestamp' )
|
||||
);
|
||||
|
||||
if ( $datetime ) {
|
||||
$c['comment_date_gmt'] = $datetime->format( DATE_ATOM );
|
||||
$comment['comment_date_gmt'] = $datetime->format( DATE_ATOM );
|
||||
}
|
||||
|
||||
if ( $permalink = get_permalink() ) {
|
||||
$c['permalink'] = $permalink;
|
||||
$comment['permalink'] = $permalink;
|
||||
}
|
||||
|
||||
$ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' );
|
||||
$server_vars = array_diff_key(
|
||||
$_SERVER,
|
||||
array_flip( array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' ) )
|
||||
);
|
||||
|
||||
foreach ( $_SERVER as $key => $value ) {
|
||||
if ( ! in_array( $key, (array) $ignore ) ) {
|
||||
$c["$key"] = $value;
|
||||
}
|
||||
}
|
||||
$comment = array_merge( $comment, $server_vars );
|
||||
|
||||
$c = apply_filters( 'wpcf7_akismet_parameters', $c );
|
||||
$comment = apply_filters( 'wpcf7_akismet_parameters', $comment );
|
||||
|
||||
if ( wpcf7_akismet_comment_check( $c ) ) {
|
||||
if ( wpcf7_akismet_comment_check( $comment ) ) {
|
||||
$spam = true;
|
||||
|
||||
$submission->add_spam_log( array(
|
||||
|
||||
Reference in New Issue
Block a user