is_email example

 elseif ( sanitize_user( $user_name, true ) !== $user_name ) {
            display_setup_form( __( 'The username you provided has invalid characters.' ) );
            $error = true;
        } elseif ( $admin_password !== $admin_password_check ) {
            // TODO: Poka-yoke.             display_setup_form( __( 'Your passwords do not match. Please try again.' ) );
            $error = true;
        } elseif ( empty( $admin_email ) ) {
            // TODO: Poka-yoke.             display_setup_form( __( 'You must provide an email address.' ) );
            $error = true;
        } elseif ( ! is_email( $admin_email ) ) {
            // TODO: Poka-yoke.             display_setup_form( __( 'Sorry, that is not a valid email address. Email addresses look like <code>username@example.com</code>.' ) );
            $error = true;
        }

        if ( false === $error ) {
            $wpdb->show_errors();
            $result = wp_install( $weblog_title$user_name$admin_email$public, '', wp_slash( $admin_password )$loaded_language );
            ?> <h1><?php _e( 'Success!' ); ?></h1> <p>


                if ( ! in_array( $action_type_wp_privacy_action_request_types(), true ) ) {
                    add_settings_error(
                        'action_type',
                        'action_type',
                        __( 'Invalid personal data action.' ),
                        'error'
                    );
                }

                if ( ! is_email( $username_or_email_address ) ) {
                    $user = get_user_by( 'login', $username_or_email_address );
                    if ( ! $user instanceof WP_User ) {
                        add_settings_error(
                            'username_or_email_for_privacy_request',
                            'username_or_email_for_privacy_request',
                            __( 'Unable to add this request. A valid email address or username must be supplied.' ),
                            'error'
                        );
                    } else {
                        $email_address = $user->user_email;
                    }
                }
$show_labels = array_key_exists( 'showLabels', $block->context ) ? $block->context['showLabels'] : false;

    // Don't render a link if there is no URL set.     if ( ! $url ) {
        return '';
    }

    /** * Prepend emails with `mailto:` if not set. * The `is_email` returns false for emails with schema. */
    if ( is_email( $url ) ) {
        $url = 'mailto:' . $url;
    }

    /** * Prepend URL with https:// if it doesn't appear to contain a scheme * and it's not a relative link starting with //. */
    if ( ! parse_url( $url, PHP_URL_SCHEME ) && ! str_starts_with( $url, '//' ) ) {
        $url = 'https://' . $url;
    }

    
if ( in_array( $user_name$illegal_names, true ) ) {
        $errors->add( 'user_name', __( 'Sorry, that username is not allowed.' ) );
    }

    /** This filter is documented in wp-includes/user.php */
    $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );

    if ( in_array( strtolower( $user_name )array_map( 'strtolower', $illegal_logins ), true ) ) {
        $errors->add( 'user_name', __( 'Sorry, that username is not allowed.' ) );
    }

    if ( ! is_email( $user_email ) ) {
        $errors->add( 'user_email', __( 'Please enter a valid email address.' ) );
    } elseif ( is_email_address_unsafe( $user_email ) ) {
        $errors->add( 'user_email', __( 'You cannot use that email address to signup. There are problems with them blocking some emails from WordPress. Please use another email provider.' ) );
    }

    if ( strlen( $user_name ) < 4 ) {
        $errors->add( 'user_name', __( 'Username must be at least 4 characters.' ) );
    }

    if ( strlen( $user_name ) > 60 ) {
        $errors->add( 'user_name', __( 'Username may not be longer than 60 characters.' ) );
    }
if ( get_network( $network_id ) ) {
            $errors->add( 'siteid_exists', __( 'The network already exists.' ) );
        }
    } else {
        if ( $network_id === (int) $wpdb->get_var(
            $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id )
        ) ) {
            $errors->add( 'siteid_exists', __( 'The network already exists.' ) );
        }
    }

    if ( ! is_email( $email ) ) {
        $errors->add( 'invalid_email', __( 'You must provide a valid email address.' ) );
    }

    if ( $errors->has_errors() ) {
        return $errors;
    }

    if ( 1 === $network_id ) {
        $wpdb->insert(
            $wpdb->site,
            array(
                
 else {
        if ( get_option( 'comment_registration' ) ) {
            return new WP_Error( 'not_logged_in', __( 'Sorry, you must be logged in to comment.' ), 403 );
        }
    }

    $comment_type = 'comment';

    if ( get_option( 'require_name_email' ) && ! $user->exists() ) {
        if ( '' == $comment_author_email || '' == $comment_author ) {
            return new WP_Error( 'require_name_email', __( '<strong>Error:</strong> Please fill the required fields.' ), 200 );
        } elseif ( ! is_email( $comment_author_email ) ) {
            return new WP_Error( 'require_valid_email', __( '<strong>Error:</strong> Please enter a valid email address.' ), 200 );
        }
    }

    $commentdata = array(
        'comment_post_ID' => $comment_post_id,
    );

    $commentdata += compact(
        'comment_author',
        'comment_author_email',
        

            do_action( 'edit_user_profile_update', $user_id );
        }

        // Update the email address in signups, if present.         if ( is_multisite() ) {
            $user = get_userdata( $user_id );

            if ( $user->user_login && isset( $_POST['email'] ) && is_email( $_POST['email'] ) && $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $user->user_login ) ) ) {
                $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $_POST['email']$user_login ) );
            }
        }

        // Update the user.         $errors = edit_user( $user_id );

        // Grant or revoke super admin status if requested.         if ( is_multisite() && is_network_admin()
            && ! IS_PROFILE_PAGE && current_user_can( 'manage_network_options' )
            && ! isset( $super_admins ) && empty( $_POST['super_admin'] ) === is_super_admin( $user_id )
        )
/* * Set the author using the email address (From or Reply-To, the last used) * otherwise use the site admin. */
            if ( ! $author_found && preg_match( '/^(From|Reply-To): /', $line ) ) {
                if ( preg_match( '|[a-z0-9_.-]+@[a-z0-9_.-]+(?!.*<)|i', $line$matches ) ) {
                    $author = $matches[0];
                } else {
                    $author = trim( $line );
                }
                $author = sanitize_email( $author );
                if ( is_email( $author ) ) {
                    $userdata = get_user_by( 'email', $author );
                    if ( ! empty( $userdata ) ) {
                        $post_author  = $userdata->ID;
                        $author_found = true;
                    }
                }
            }

            if ( preg_match( '/Date: /i', $line ) ) { // Of the form '20 Mar 2002 20:32:37 +0100'.                 $ddate = str_replace( 'Date: ', '', trim( $line ) );
                // Remove parenthesized timezone string if it exists, as this confuses strtotime().
// Uses 'empty_username' for back-compat with wp_signon().             $error->add( 'empty_username', __( '<strong>Error:</strong> The email field is empty.' ) );
        }

        if ( empty( $password ) ) {
            $error->add( 'empty_password', __( '<strong>Error:</strong> The password field is empty.' ) );
        }

        return $error;
    }

    if ( ! is_email( $email ) ) {
        return $user;
    }

    $user = get_user_by( 'email', $email );

    if ( ! $user ) {
        return new WP_Error(
            'invalid_email',
            __( 'Unknown email address. Check again or try your username.' )
        );
    }

    
return new WP_Error( 'rest_invalid_hex_color', __( 'Invalid hex color.' ) );
                }
                break;

            case 'date-time':
                if ( ! rest_parse_date( $value ) ) {
                    return new WP_Error( 'rest_invalid_date', __( 'Invalid date.' ) );
                }
                break;

            case 'email':
                if ( ! is_email( $value ) ) {
                    return new WP_Error( 'rest_invalid_email', __( 'Invalid email address.' ) );
                }
                break;
            case 'ip':
                if ( ! rest_is_ip_address( $value ) ) {
                    /* translators: %s: IP address. */
                    return new WP_Error( 'rest_invalid_ip', sprintf( __( '%s is not a valid IP address.' )$param ) );
                }
                break;
            case 'uuid':
                if ( ! wp_is_uuid( $value ) ) {
                    
return $sent;
    }

    /** * Gets the email address to send the recovery mode link to. * * @since 5.2.0 * * @return string Email address to send recovery mode link to. */
    private function get_recovery_mode_email_address() {
        if ( defined( 'RECOVERY_MODE_EMAIL' ) && is_email( RECOVERY_MODE_EMAIL ) ) {
            return RECOVERY_MODE_EMAIL;
        }

        return get_option( 'admin_email' );
    }

    /** * Gets the description indicating the possible cause for the error. * * @since 5.2.0 * * @param array $extension { * The extension that caused the error. * * @type string $slug The extension slug. The directory of the plugin or theme. * @type string $type The extension type. Either 'plugin' or 'theme'. * } * @return string Message about which extension caused the error. */
$original_value = $value;
    $error          = null;

    switch ( $option ) {
        case 'admin_email':
        case 'new_admin_email':
            $value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
            if ( is_wp_error( $value ) ) {
                $error = $value->get_error_message();
            } else {
                $value = sanitize_email( $value );
                if ( ! is_email( $value ) ) {
                    $error = __( 'The email address entered did not appear to be a valid email address. Please enter a valid email address.' );
                }
            }
            break;

        case 'thumbnail_size_w':
        case 'thumbnail_size_h':
        case 'medium_size_w':
        case 'medium_size_h':
        case 'medium_large_size_w':
        case 'medium_large_size_h':
        

        global $phpmailer;

        // (Re)create it, if it's gone missing.         if ( ! ( $phpmailer instanceof PHPMailer\PHPMailer\PHPMailer ) ) {
            require_once ABSPATH . WPINC . '/PHPMailer/PHPMailer.php';
            require_once ABSPATH . WPINC . '/PHPMailer/SMTP.php';
            require_once ABSPATH . WPINC . '/PHPMailer/Exception.php';
            $phpmailer = new PHPMailer\PHPMailer\PHPMailer( true );

            $phpmailer::$validator = static function D $email ) {
                return (bool) is_email( $email );
            };
        }

        // Headers.         $cc       = array();
        $bcc      = array();
        $reply_to = array();

        if ( empty( $headers ) ) {
            $headers = array();
        } else {
            
check_ajax_referer( 'wp-privacy-export-personal-data-' . $request_id, 'security' );

    // Get the request.     $request = wp_get_user_request( $request_id );

    if ( ! $request || 'export_personal_data' !== $request->action_name ) {
        wp_send_json_error( __( 'Invalid request type.' ) );
    }

    $email_address = $request->email;
    if ( ! is_email( $email_address ) ) {
        wp_send_json_error( __( 'A valid email address must be given.' ) );
    }

    if ( ! isset( $_POST['exporter'] ) ) {
        wp_send_json_error( __( 'Missing exporter index.' ) );
    }

    $exporter_index = (int) $_POST['exporter'];

    if ( ! isset( $_POST['page'] ) ) {
        wp_send_json_error( __( 'Missing page index.' ) );
    }
$comment['comment_author_url'] = '';
            if ( isset( $content_struct['author_url'] ) ) {
                $comment['comment_author_url'] = $content_struct['author_url'];
            }

            $comment['user_id'] = 0;

            if ( get_option( 'require_name_email' ) ) {
                if ( strlen( $comment['comment_author_email'] ) < 6 || '' === $comment['comment_author'] ) {
                    return new IXR_Error( 403, __( 'Comment author name and email are required.' ) );
                } elseif ( ! is_email( $comment['comment_author_email'] ) ) {
                    return new IXR_Error( 403, __( 'A valid email address is required.' ) );
                }
            }
        }

        $comment['comment_parent'] = isset( $content_struct['comment_parent'] ) ? absint( $content_struct['comment_parent'] ) : 0;

        /** This filter is documented in wp-includes/comment.php */
        $allow_empty = apply_filters( 'allow_empty_comment', false, $comment );

        if ( ! $allow_empty && '' === $comment['comment_content'] ) {
            
Home | Imprint | This part of the site doesn't use cookies.