is_email_address_unsafe
函数
is_email_address_unsafe ( $user_email )
- 参数
-
-
(string)
$user_email
The email provided by the user at registration.- Required: 是
-
(string)
- 返回值
-
- (bool) True when the email address is banned, false otherwise.
- 定义位置
-
-
wp-includes/ms-functions.php
, line 384
-
wp-includes/ms-functions.php
- 引入
- –
- 弃用
- –
Checks an email address against a list of banned domains.
This function checks against the Banned Email Domains list
at wp-admin/network/settings.php. The check is only run on
self-registrations; user creation at wp-admin/network/users.php
bypasses this check.
function is_email_address_unsafe( $user_email ) { $banned_names = get_site_option( 'banned_email_domains' ); if ( $banned_names && ! is_array( $banned_names ) ) { $banned_names = explode( "n", $banned_names ); } $is_email_address_unsafe = false; if ( $banned_names && is_array( $banned_names ) && false !== strpos( $user_email, '@', 1 ) ) { $banned_names = array_map( 'strtolower', $banned_names ); $normalized_email = strtolower( $user_email ); list( $email_local_part, $email_domain ) = explode( '@', $normalized_email ); foreach ( $banned_names as $banned_domain ) { if ( ! $banned_domain ) { continue; } if ( $email_domain == $banned_domain ) { $is_email_address_unsafe = true; break; } $dotted_domain = ".$banned_domain"; if ( substr( $normalized_email, -strlen( $dotted_domain ) ) === $dotted_domain ) { $is_email_address_unsafe = true; break; } } } /** * Filters whether an email address is unsafe. * * @since 3.5.0 * * @param bool $is_email_address_unsafe Whether the email address is "unsafe". Default false. * @param string $user_email User email address. */ return apply_filters( 'is_email_address_unsafe', $is_email_address_unsafe, $user_email ); }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。