wpcf7_is_email_in_site_domain

The Contact Form 7 wpcf7 is email in site domain function.

Description

wpcf7_is_email_in_site_domain( $email ); 

Parameters (1)

0. $email
The email.

Usage

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

Defined (1)

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

/includes/formatting.php  
  1. function wpcf7_is_email_in_site_domain( $email ) { 
  2. if ( wpcf7_is_localhost() ) { 
  3. return true; 
  4.  
  5. $site_domain = strtolower( $_SERVER['SERVER_NAME'] ); 
  6.  
  7. if ( preg_match( '/^[0-9.]+$/', $site_domain ) ) { // 123.456.789.012 
  8. return true; 
  9.  
  10. if ( wpcf7_is_email_in_domain( $email, $site_domain ) ) { 
  11. return true; 
  12.  
  13. $home_url = home_url(); 
  14.  
  15. // for interoperability with WordPress MU Domain Mapping plugin 
  16. if ( is_multisite() && function_exists( 'domain_mapping_siteurl' ) ) { 
  17. $domain_mapping_siteurl = domain_mapping_siteurl( false ); 
  18.  
  19. if ( $domain_mapping_siteurl ) { 
  20. $home_url = $domain_mapping_siteurl; 
  21.  
  22. if ( preg_match( '%^https?://([^/]+)%', $home_url, $matches ) ) { 
  23. $site_domain = strtolower( $matches[1] ); 
  24.  
  25. if ( $site_domain != strtolower( $_SERVER['SERVER_NAME'] ) 
  26. && wpcf7_is_email_in_domain( $email, $site_domain ) ) { 
  27. return true; 
  28.  
  29. return false;