wpcf7_akismet

The Contact Form 7 wpcf7 akismet function.

Description

wpcf7_akismet( $spam ); 

Parameters (1)

0. $spam
The spam.

Usage

  1. if ( !function_exists( 'wpcf7_akismet' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/modules/akismet.php'; 
  3.  
  4. // The spam. 
  5. $spam = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpcf7_akismet($spam); 
  9.  

Defined (1)

The function is defined in the following location(s).

/modules/akismet.php  
  1. function wpcf7_akismet( $spam ) { 
  2. if ( $spam ) { 
  3. return $spam; 
  4.  
  5. return false; 
  6.  
  7. if ( ! $params = wpcf7_akismet_submitted_params() ) { 
  8. return false; 
  9.  
  10. $c = array(); 
  11.  
  12. $c['comment_author'] = $params['author']; 
  13. $c['comment_author_email'] = $params['author_email']; 
  14. $c['comment_author_url'] = $params['author_url']; 
  15. $c['comment_content'] = $params['content']; 
  16.  
  17. $c['blog'] = get_option( 'home' ); 
  18. $c['blog_lang'] = get_locale(); 
  19. $c['blog_charset'] = get_option( 'blog_charset' ); 
  20. $c['user_ip'] = $_SERVER['REMOTE_ADDR']; 
  21. $c['user_agent'] = $_SERVER['HTTP_USER_AGENT']; 
  22. $c['referrer'] = $_SERVER['HTTP_REFERER']; 
  23.  
  24. // http://blog.akismet.com/2012/06/19/pro-tip-tell-us-your-comment_type/ 
  25. $c['comment_type'] = 'contact-form'; 
  26.  
  27. if ( $permalink = get_permalink() ) { 
  28. $c['permalink'] = $permalink; 
  29.  
  30. $ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' ); 
  31.  
  32. foreach ( $_SERVER as $key => $value ) { 
  33. if ( ! in_array( $key, (array) $ignore ) ) 
  34. $c["$key"] = $value; 
  35.