wpcf7_akismet_submitted_params

The Contact Form 7 wpcf7 akismet submitted params function.

Description

wpcf7_akismet_submitted_params(); 

Usage

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

Defined (1)

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

/modules/akismet.php  
  1. function wpcf7_akismet_submitted_params() { 
  2. $params = array( 
  3. 'author' => '',  
  4. 'author_email' => '',  
  5. 'author_url' => '',  
  6. 'content' => '' ); 
  7.  
  8. $has_akismet_option = false; 
  9.  
  10. foreach ( (array) $_POST as $key => $val ) { 
  11. if ( '_wpcf7' == substr( $key, 0, 6 ) || '_wpnonce' == $key ) { 
  12. continue; 
  13.  
  14. if ( is_array( $val ) ) { 
  15. $val = implode( ', ', wpcf7_array_flatten( $val ) ); 
  16.  
  17. $val = trim( $val ); 
  18.  
  19. if ( 0 == strlen( $val ) ) { 
  20. continue; 
  21.  
  22. if ( $tags = wpcf7_scan_form_tags( array( 'name' => $key ) ) ) { 
  23. $tag = $tags[0]; 
  24. $tag = new WPCF7_FormTag( $tag ); 
  25.  
  26. $akismet = $tag->get_option( 'akismet',  
  27. '(author|author_email|author_url)', true ); 
  28.  
  29. if ( $akismet ) { 
  30. $has_akismet_option = true; 
  31.  
  32. if ( 'author' == $akismet ) { 
  33. $params[$akismet] = trim( $params[$akismet] . ' ' . $val ); 
  34. } elseif ( '' == $params[$akismet] ) { 
  35. $params[$akismet] = $val; 
  36.  
  37. $params['content'] .= "\n\n" . $val; 
  38.  
  39. if ( ! $has_akismet_option ) { 
  40. return false; 
  41.  
  42. $params['content'] = trim( $params['content'] ); 
  43.  
  44. return $params;