wpcf7_is_email_in_site_domain()CF7 1.0

Checks whether an email address belongs to the site domain.

Хуков нет.

Возвращает

null. Ничего.

Использование

wpcf7_is_email_in_site_domain( $email );
$email (обязательный)
-

Код wpcf7_is_email_in_site_domain() CF7 5.6.2

function wpcf7_is_email_in_site_domain( $email ) {
	if ( wpcf7_is_localhost() ) {
		return true;
	}

	$homes = array(
		home_url(),
		network_home_url(),
	);

	$homes = array_unique( $homes );

	foreach ( $homes as $home ) {
		$sitename = wp_parse_url( $home, PHP_URL_HOST );

		if ( WP_Http::is_ip_address( $sitename ) ) {
			return true;
		}

		if ( wpcf7_is_email_in_domain( $email, $sitename ) ) {
			return true;
		}
	}

	return false;
}