wpcf7_akismet
The Contact Form 7 wpcf7 akismet function.
Description
wpcf7_akismet( $spam );
Parameters (1)
- 0. $spam
- The spam.
Usage
if ( !function_exists( 'wpcf7_akismet' ) ) { require_once ABSPATH . PLUGINDIR . 'contact-form-7/modules/akismet.php'; } // The spam. $spam = null; // NOTICE! Understand what this does before running. $result = wpcf7_akismet($spam);
Defined (1)
The function is defined in the following location(s).
- /modules/akismet.php
- function wpcf7_akismet( $spam ) {
- 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'];
- // http://blog.akismet.com/2012/06/19/pro-tip-tell-us-your-comment_type/
- $c['comment_type'] = 'contact-form';
- 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;
- }
- return wpcf7_akismet_comment_check( $c );
- }