wpcf7_blacklist_check

The Contact Form 7 wpcf7 blacklist check function.

Description

wpcf7_blacklist_check( $target ); 

Parameters (1)

0. $target
The target.

Usage

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

Defined (1)

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

/includes/functions.php  
  1. function wpcf7_blacklist_check( $target ) { 
  2. $mod_keys = trim( get_option( 'blacklist_keys' ) ); 
  3.  
  4. if ( empty( $mod_keys ) ) { 
  5. return false; 
  6.  
  7. $words = explode( "\n", $mod_keys ); 
  8.  
  9. foreach ( (array) $words as $word ) { 
  10. $word = trim( $word ); 
  11.  
  12. if ( empty( $word ) || 256 < strlen( $word ) ) { 
  13. continue; 
  14.  
  15. $pattern = sprintf( '#%s#i', preg_quote( $word, '#' ) ); 
  16.  
  17. if ( preg_match( $pattern, $target ) ) { 
  18. return true; 
  19.  
  20. return false;