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 |
---|---|
3272 | * 'email_no_at', 'local_invalid_chars', 'domain_period_sequence', 'domain_period_limits', |
3273 | * 'domain_no_periods', 'sub_hyphen_limits', 'sub_invalid_chars', or no specific context. |
3274 | * |
3275 | * @since 2.8.0 |
3276 | * |
3277 | * @param bool $is_email Whether the email address has passed the is_email() checks. Default false. |
3278 | * @param string $email The email address being checked. |
3279 | * @param string $context Context under which the email was tested. |
3280 | */ |
3281 | return apply_filters( 'is_email', false, $email, 'email_too_short' ); |
3282 | } |
3283 |
|
3284 | // Test for an @ character after the first position |
3285 | if ( strpos( $email, '@', 1 ) === false ) { |
3286 | /** This filter is documented in wp-includes/formatting.php */ |
3287 | return apply_filters( 'is_email', false, $email, 'email_no_at' ); |
3288 | } |
3289 |
|
3290 | // Split out the local and domain parts |
3291 | list( $local, $domain ) = explode( '@', $email, 2 ); |
3292 |
|
3293 | // LOCAL PART |
3294 | // Test for invalid characters |
3295 | if ( ! preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) { |
3296 | /** This filter is documented in wp-includes/formatting.php */ |
3297 | return apply_filters( 'is_email', false, $email, 'local_invalid_chars' ); |
3298 | } |
3299 |
|
3300 | // DOMAIN PART |
3301 | // Test for sequences of periods |
3302 | if ( preg_match( '/\.{2,}/', $domain ) ) { |
3303 | /** This filter is documented in wp-includes/formatting.php */ |
3304 | return apply_filters( 'is_email', false, $email, 'domain_period_sequence' ); |
3305 | } |
3306 |
|
3307 | // Test for leading and trailing periods and whitespace |
3308 | if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain ) { |
3309 | /** This filter is documented in wp-includes/formatting.php */ |
3310 | return apply_filters( 'is_email', false, $email, 'domain_period_limits' ); |
3311 | } |
3312 |
|
3313 | // Split the domain into subs |
3314 | $subs = explode( '.', $domain ); |
3315 |
|
3316 | // Assume the domain will have at least two subs |
3317 | if ( 2 > count( $subs ) ) { |
3318 | /** This filter is documented in wp-includes/formatting.php */ |
3319 | return apply_filters( 'is_email', false, $email, 'domain_no_periods' ); |
3320 | } |
3321 |
|
3322 | // Loop through each sub |
3323 | foreach ( $subs as $sub ) { |
3324 | // Test for leading and trailing hyphens and whitespace |
3325 | if ( trim( $sub, " \t\n\r\0\x0B-" ) !== $sub ) { |
3326 | /** This filter is documented in wp-includes/formatting.php */ |
3327 | return apply_filters( 'is_email', false, $email, 'sub_hyphen_limits' ); |
3328 | } |
3329 |
|
3330 | // Test for invalid characters |
3331 | if ( ! preg_match( '/^[a-z0-9-]+$/i', $sub ) ) { |
3332 | /** This filter is documented in wp-includes/formatting.php */ |
3333 | return apply_filters( 'is_email', false, $email, 'sub_invalid_chars' ); |
3334 | } |
3335 | } |
3336 |
|
3337 | // Congratulations your email made it! |
3338 | /** This filter is documented in wp-includes/formatting.php */ |
3339 | return apply_filters( 'is_email', $email, $email, null ); |
3340 | } |
3341 |
|
3342 | /** |
3343 | * Convert to ASCII from email subjects. |
3344 | * |
3345 | * @since 1.2.0 |
3346 | * |
3347 | * @param string $string Subject line |
3348 | * @return string Converted string to ASCII |