$value ) { if ( ! in_array( $key, (array) $ignore ) ) { $c["$key"] = $value; } } return wpcf7_akismet_comment_check( $c ); } function wpcf7_akismet_is_available() { if ( is_callable( array( 'Akismet', 'get_api_key' ) ) ) { return (bool) Akismet::get_api_key(); } return false; } function wpcf7_akismet_submitted_params() { $params = array( 'author' => '', 'author_email' => '', 'author_url' => '', 'content' => '', ); $has_akismet_option = false; foreach ( (array) $_POST as $key => $val ) { if ( '_wpcf7' == substr( $key, 0, 6 ) || '_wpnonce' == $key ) { continue; } if ( is_array( $val ) ) { $val = implode( ', ', wpcf7_array_flatten( $val ) ); } $val = trim( $val ); if ( 0 == strlen( $val ) ) { continue; } if ( $tags = wpcf7_scan_form_tags( array( 'name' => $key ) ) ) { $tag = $tags[0]; $akismet = $tag->get_option( 'akismet', '(author|author_email|author_url)', true ); if ( $akismet ) { $has_akismet_option = true; if ( 'author' == $akismet ) { $params[$akismet] = trim( $params[$akismet] . ' ' . $val ); continue; } elseif ( '' == $params[$akismet] ) { $params[$akismet] = $val; continue; } } } $params['content'] .= "\n\n" . $val; } if ( ! $has_akismet_option ) { return false; } $params['content'] = trim( $params['content'] ); return $params; } 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->akismet = array( 'comment' => $comment, 'spam' => $spam ); } return apply_filters( 'wpcf7_akismet_comment_check', $spam, $comment ); }