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