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 |
|---|---|
| 3478 | * 'email_no_at', 'local_invalid_chars', 'domain_period_sequence', 'domain_period_limits', |
| 3479 | * 'domain_no_periods', 'sub_hyphen_limits', 'sub_invalid_chars', or no specific context. |
| 3480 | * |
| 3481 | * @since 2.8.0 |
| 3482 | * |
| 3483 | * @param string|false $is_email The email address if successfully passed the is_email() checks, false otherwise. |
| 3484 | * @param string $email The email address being checked. |
| 3485 | * @param string $context Context under which the email was tested. |
| 3486 | */ |
| 3487 | return apply_filters( 'is_email', false, $email, 'email_too_short' ); |
| 3488 | } |
| 3489 | |
| 3490 | // Test for an @ character after the first position. |
| 3491 | if ( strpos( $email, '@', 1 ) === false ) { |
| 3492 | /** This filter is documented in wp-includes/formatting.php */ |
| 3493 | return apply_filters( 'is_email', false, $email, 'email_no_at' ); |
| 3494 | } |
| 3495 | |
| 3496 | // Split out the local and domain parts. |
| 3497 | list( $local, $domain ) = explode( '@', $email, 2 ); |
| 3498 | |
| 3499 | // LOCAL PART |
| 3500 | // Test for invalid characters. |
| 3501 | if ( ! preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) { |
| 3502 | /** This filter is documented in wp-includes/formatting.php */ |
| 3503 | return apply_filters( 'is_email', false, $email, 'local_invalid_chars' ); |
| 3504 | } |
| 3505 | |
| 3506 | // DOMAIN PART |
| 3507 | // Test for sequences of periods. |
| 3508 | if ( preg_match( '/\.{2,}/', $domain ) ) { |
| 3509 | /** This filter is documented in wp-includes/formatting.php */ |
| 3510 | return apply_filters( 'is_email', false, $email, 'domain_period_sequence' ); |
| 3511 | } |
| 3512 | |
| 3513 | // Test for leading and trailing periods and whitespace. |
| 3514 | if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain ) { |
| 3515 | /** This filter is documented in wp-includes/formatting.php */ |
| 3516 | return apply_filters( 'is_email', false, $email, 'domain_period_limits' ); |
| 3517 | } |
| 3518 | |
| 3519 | // Split the domain into subs. |
| 3520 | $subs = explode( '.', $domain ); |
| 3521 | |
| 3522 | // Assume the domain will have at least two subs. |
| 3523 | if ( 2 > count( $subs ) ) { |
| 3524 | /** This filter is documented in wp-includes/formatting.php */ |
| 3525 | return apply_filters( 'is_email', false, $email, 'domain_no_periods' ); |
| 3526 | } |
| 3527 | |
| 3528 | // Loop through each sub. |
| 3529 | foreach ( $subs as $sub ) { |
| 3530 | // Test for leading and trailing hyphens and whitespace. |
| 3531 | if ( trim( $sub, " \t\n\r\0\x0B-" ) !== $sub ) { |
| 3532 | /** This filter is documented in wp-includes/formatting.php */ |
| 3533 | return apply_filters( 'is_email', false, $email, 'sub_hyphen_limits' ); |
| 3534 | } |
| 3535 | |
| 3536 | // Test for invalid characters. |
| 3537 | if ( ! preg_match( '/^[a-z0-9-]+$/i', $sub ) ) { |
| 3538 | /** This filter is documented in wp-includes/formatting.php */ |
| 3539 | return apply_filters( 'is_email', false, $email, 'sub_invalid_chars' ); |
| 3540 | } |
| 3541 | } |
| 3542 | |
| 3543 | // Congratulations, your email made it! |
| 3544 | /** This filter is documented in wp-includes/formatting.php */ |
| 3545 | return apply_filters( 'is_email', $email, $email, null ); |
| 3546 | } |
| 3547 | |
| 3548 | /** |
| 3549 | * Converts to ASCII from email subjects. |
| 3550 | * |
| 3551 | * @since 1.2.0 |
| 3552 | * |
| 3553 | * @param string $string Subject line. |
| 3554 | * @return string Converted string to ASCII. |