get_status_header_desc example


    public function to_array() {
        return array(
            'headers'  => $this->get_headers(),
            'body'     => $this->get_data(),
            'response' => array(
                'code'    => $this->get_status(),
                'message' => get_status_header_desc( $this->get_status() ),
            ),
            'cookies'  => $this->get_cookies(),
            'filename' => $this->filename,
        );
    }
}

        $post_id = apply_filters( 'oembed_request_post_id', $post_id$request['url'] );

        $data = get_oembed_response_data( $post_id$request['maxwidth'] );

        if ( ! $data ) {
            return new WP_Error( 'oembed_invalid_url', get_status_header_desc( 404 ), array( 'status' => 404 ) );
        }

        return $data;
    }

    /** * Checks if current user can make a proxy oEmbed request. * * @since 4.8.0 * * @return true|WP_Error True if the request has read access, WP_Error object otherwise. */


    if ( ! isset( $params['format'] ) || 'xml' !== $params['format'] ) {
        return $served;
    }

    // Embed links inside the request.     $data = $server->response_to_data( $result, false );

    if ( ! class_exists( 'SimpleXMLElement' ) ) {
        status_header( 501 );
        die( get_status_header_desc( 501 ) );
    }

    $result = _oembed_create_xml( $data );

    // Bail if there's no XML.     if ( ! $result ) {
        status_header( 501 );
        return get_status_header_desc( 501 );
    }

    if ( ! headers_sent() ) {
        

function status_header( $code$description = '' ) {
    if ( ! $description ) {
        $description = get_status_header_desc( $code );
    }

    if ( empty( $description ) ) {
        return;
    }

    $protocol      = wp_get_server_protocol();
    $status_header = "$protocol $code $description";
    if ( function_exists( 'apply_filters' ) ) {

        /** * Filters an HTTP status header. * * @since 2.2.0 * * @param string $status_header HTTP status header. * @param int $code HTTP status code. * @param string $description Description for the status code. * @param string $protocol Server protocol. */
Home | Imprint | This part of the site doesn't use cookies.