WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 9 times in this file.
| Line | Code |
|---|---|
| 3498 | * 'email_no_at', 'local_invalid_chars', 'domain_period_sequence', 'domain_period_limits', |
| 3499 | * 'domain_no_periods', 'sub_hyphen_limits', 'sub_invalid_chars', or no specific context. |
| 3500 | * |
| 3501 | * @since 2.8.0 |
| 3502 | * |
| 3503 | * @param string|false $is_email The email address if successfully passed the is_email() checks, false otherwise. |
| 3504 | * @param string $email The email address being checked. |
| 3505 | * @param string $context Context under which the email was tested. |
| 3506 | */ |
| 3507 | return apply_filters( 'is_email', false, $email, 'email_too_short' ); |
| 3508 | } |
| 3509 | |
| 3510 | // Test for an @ character after the first position. |
| 3511 | if ( strpos( $email, '@', 1 ) === false ) { |
| 3512 | /** This filter is documented in wp-includes/formatting.php */ |
| 3513 | return apply_filters( 'is_email', false, $email, 'email_no_at' ); |
| 3514 | } |
| 3515 | |
| 3516 | // Split out the local and domain parts. |
| 3517 | list( $local, $domain ) = explode( '@', $email, 2 ); |
| 3518 | |
| 3519 | // LOCAL PART |
| 3520 | // Test for invalid characters. |
| 3521 | if ( ! preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) { |
| 3522 | /** This filter is documented in wp-includes/formatting.php */ |
| 3523 | return apply_filters( 'is_email', false, $email, 'local_invalid_chars' ); |
| 3524 | } |
| 3525 | |
| 3526 | // DOMAIN PART |
| 3527 | // Test for sequences of periods. |
| 3528 | if ( preg_match( '/\.{2,}/', $domain ) ) { |
| 3529 | /** This filter is documented in wp-includes/formatting.php */ |
| 3530 | return apply_filters( 'is_email', false, $email, 'domain_period_sequence' ); |
| 3531 | } |
| 3532 | |
| 3533 | // Test for leading and trailing periods and whitespace. |
| 3534 | if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain ) { |
| 3535 | /** This filter is documented in wp-includes/formatting.php */ |
| 3536 | return apply_filters( 'is_email', false, $email, 'domain_period_limits' ); |
| 3537 | } |
| 3538 | |
| 3539 | // Split the domain into subs. |
| 3540 | $subs = explode( '.', $domain ); |
| 3541 | |
| 3542 | // Assume the domain will have at least two subs. |
| 3543 | if ( 2 > count( $subs ) ) { |
| 3544 | /** This filter is documented in wp-includes/formatting.php */ |
| 3545 | return apply_filters( 'is_email', false, $email, 'domain_no_periods' ); |
| 3546 | } |
| 3547 | |
| 3548 | // Loop through each sub. |
| 3549 | foreach ( $subs as $sub ) { |
| 3550 | // Test for leading and trailing hyphens and whitespace. |
| 3551 | if ( trim( $sub, " \t\n\r\0\x0B-" ) !== $sub ) { |
| 3552 | /** This filter is documented in wp-includes/formatting.php */ |
| 3553 | return apply_filters( 'is_email', false, $email, 'sub_hyphen_limits' ); |
| 3554 | } |
| 3555 | |
| 3556 | // Test for invalid characters. |
| 3557 | if ( ! preg_match( '/^[a-z0-9-]+$/i', $sub ) ) { |
| 3558 | /** This filter is documented in wp-includes/formatting.php */ |
| 3559 | return apply_filters( 'is_email', false, $email, 'sub_invalid_chars' ); |
| 3560 | } |
| 3561 | } |
| 3562 | |
| 3563 | // Congratulations, your email made it! |
| 3564 | /** This filter is documented in wp-includes/formatting.php */ |
| 3565 | return apply_filters( 'is_email', $email, $email, null ); |
| 3566 | } |
| 3567 | |
| 3568 | /** |
| 3569 | * Converts to ASCII from email subjects. |
| 3570 | * |
| 3571 | * @since 1.2.0 |
| 3572 | * |
| 3573 | * @param string $subject Subject line. |
| 3574 | * @return string Converted string to ASCII. |