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