is_email_address_unsafe()
is_email_address_unsafe( string $user_email ) 根据禁止域列表检查…
is_email_address_unsafe( string $user_email )
根据禁止域列表检查电子邮件地址。
Checks an email address against a list of banned domains.
目录锚点:#说明#参数#返回#源码
说明(Description)
此功能检查wp admin/network上的禁用电子邮件域列表/设置.php. 该检查仅在自我注册时运行;用户创建在wp admin/network/用户.php绕过这张支票。
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$user_email | (string) | 必需 | 用户注册时提供的电子邮件。 |
返回(Return)
(bool)当电子邮件地址被禁止时返回true。
源码(Source)
/** * 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. * * @since MU * * @param string $user_email The email provided by the user at registration. * @return bool Returns true when the email address is banned. */ 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( " ", $banned_names ); $is_email_address_unsafe = false; if ( $banned_names && is_array( $banned_names ) ) { $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 ( $dotted_domain === substr( $normalized_email, -strlen( $dotted_domain ) ) ) { $is_email_address_unsafe = true; break; } } } /** * Filter 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 ); }
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
MU (3.0.0) | wp-includes/ms-functions.php:397 | 1 function | 3 |
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
还没有任何评论,赶紧来占个楼吧!