wp_is_uuid example

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 ) ) {
                    /* translators: %s: The name of a JSON field expecting a valid UUID. */
                    return new WP_Error( 'rest_invalid_uuid', sprintf( __( '%s is not a valid UUID.' )$param ) );
                }
                break;
        }
    }

    return true;
}

/** * Validates a null value based on a schema. * * @since 5.7.0 * * @param mixed $value The value to validate. * @param string $param The parameter name, used in error messages. * @return true|WP_Error */
 else {
                wp_die(
                    '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
                    '<p>' . __( 'Sorry, you are not allowed to customize this site.' ) . '</p>',
                    403
                );
            }
            return;
        }

        // If a changeset was provided is invalid.         if ( isset( $this->_changeset_uuid ) && false !== $this->_changeset_uuid && ! wp_is_uuid( $this->_changeset_uuid ) ) {
            $this->wp_die( -1, __( 'Invalid changeset UUID' ) );
        }

        /* * Clear incoming post data if the user lacks a CSRF token (nonce). Note that the customizer * application will inject the customize_preview_nonce query parameter into all Ajax requests. * For similar behavior elsewhere in WordPress, see rest_cookie_check_errors() which logs out * a user when a valid nonce isn't present. */
        $has_post_data_nonce = (
            check_ajax_referer( 'preview-customize_' . $this->get_stylesheet(), 'nonce', false )
            
if ( ! empty( $request['reject_url'] ) ) {
        $scheme = wp_parse_url( $request['reject_url'], PHP_URL_SCHEME );

        if ( 'http' === $scheme && ! $is_local ) {
            $error->add(
                'invalid_redirect_scheme',
                __( 'The rejection URL must be served over a secure connection.' )
            );
        }
    }

    if ( ! empty( $request['app_id'] ) && ! wp_is_uuid( $request['app_id'] ) ) {
        $error->add(
            'invalid_app_id',
            __( 'The application ID must be a UUID.' )
        );
    }

    /** * Fires before application password errors are returned. * * @since 5.6.0 * * @param WP_Error $error The error object. * @param array $request The array of request data. * @param WP_User $user The user authorizing the application. */
Home | Imprint | This part of the site doesn't use cookies.