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