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 |
---|---|
3415 | * 'email_no_at', 'local_invalid_chars', 'domain_period_sequence', 'domain_period_limits', |
3416 | * 'domain_no_periods', 'sub_hyphen_limits', 'sub_invalid_chars', or no specific context. |
3417 | * |
3418 | * @since 2.8.0 |
3419 | * |
3420 | * @param string|false $is_email The email address if successfully passed the is_email() checks, false otherwise. |
3421 | * @param string $email The email address being checked. |
3422 | * @param string $context Context under which the email was tested. |
3423 | */ |
3424 | return apply_filters( 'is_email', false, $email, 'email_too_short' ); |
3425 | } |
3426 |
|
3427 | // Test for an @ character after the first position. |
3428 | if ( strpos( $email, '@', 1 ) === false ) { |
3429 | /** This filter is documented in wp-includes/formatting.php */ |
3430 | return apply_filters( 'is_email', false, $email, 'email_no_at' ); |
3431 | } |
3432 |
|
3433 | // Split out the local and domain parts. |
3434 | list( $local, $domain ) = explode( '@', $email, 2 ); |
3435 |
|
3436 | // LOCAL PART |
3437 | // Test for invalid characters. |
3438 | if ( ! preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) { |
3439 | /** This filter is documented in wp-includes/formatting.php */ |
3440 | return apply_filters( 'is_email', false, $email, 'local_invalid_chars' ); |
3441 | } |
3442 |
|
3443 | // DOMAIN PART |
3444 | // Test for sequences of periods. |
3445 | if ( preg_match( '/\.{2,}/', $domain ) ) { |
3446 | /** This filter is documented in wp-includes/formatting.php */ |
3447 | return apply_filters( 'is_email', false, $email, 'domain_period_sequence' ); |
3448 | } |
3449 |
|
3450 | // Test for leading and trailing periods and whitespace. |
3451 | if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain ) { |
3452 | /** This filter is documented in wp-includes/formatting.php */ |
3453 | return apply_filters( 'is_email', false, $email, 'domain_period_limits' ); |
3454 | } |
3455 |
|
3456 | // Split the domain into subs. |
3457 | $subs = explode( '.', $domain ); |
3458 |
|
3459 | // Assume the domain will have at least two subs. |
3460 | if ( 2 > count( $subs ) ) { |
3461 | /** This filter is documented in wp-includes/formatting.php */ |
3462 | return apply_filters( 'is_email', false, $email, 'domain_no_periods' ); |
3463 | } |
3464 |
|
3465 | // Loop through each sub. |
3466 | foreach ( $subs as $sub ) { |
3467 | // Test for leading and trailing hyphens and whitespace. |
3468 | if ( trim( $sub, " \t\n\r\0\x0B-" ) !== $sub ) { |
3469 | /** This filter is documented in wp-includes/formatting.php */ |
3470 | return apply_filters( 'is_email', false, $email, 'sub_hyphen_limits' ); |
3471 | } |
3472 |
|
3473 | // Test for invalid characters. |
3474 | if ( ! preg_match( '/^[a-z0-9-]+$/i', $sub ) ) { |
3475 | /** This filter is documented in wp-includes/formatting.php */ |
3476 | return apply_filters( 'is_email', false, $email, 'sub_invalid_chars' ); |
3477 | } |
3478 | } |
3479 |
|
3480 | // Congratulations, your email made it! |
3481 | /** This filter is documented in wp-includes/formatting.php */ |
3482 | return apply_filters( 'is_email', $email, $email, null ); |
3483 | } |
3484 |
|
3485 | /** |
3486 | * Convert to ASCII from email subjects. |
3487 | * |
3488 | * @since 1.2.0 |
3489 | * |
3490 | * @param string $string Subject line |
3491 | * @return string Converted string to ASCII |