REST API: Call `WP_REST_Server::get_compact_response_links()` and `::get_raw_data()` static methods the right way.

Props andizer, TimothyBlynJacobs.
Fixes #47578.
Built from https://develop.svn.wordpress.org/trunk@45566


git-svn-id: http://core.svn.wordpress.org/trunk@45377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-06-26 18:07:54 +00:00
parent bab5ed2df5
commit e23ce44744
4 changed files with 5 additions and 5 deletions

View File

@ -1395,7 +1395,7 @@ function rest_preload_api_request( $memo, $path ) {
if ( 200 === $response->status ) {
$server = rest_get_server();
$data = (array) $response->get_data();
$links = $server->get_compact_response_links( $response );
$links = $server::get_compact_response_links( $response );
if ( ! empty( $links ) ) {
$data['_links'] = $links;
}

View File

@ -310,7 +310,7 @@ class WP_REST_Server {
$request->set_body_params( wp_unslash( $_POST ) );
$request->set_file_params( $_FILES );
$request->set_headers( $this->get_headers( wp_unslash( $_SERVER ) ) );
$request->set_body( $this->get_raw_data() );
$request->set_body( self::get_raw_data() );
/*
* HTTP method override for clients that can't use PUT/PATCH/DELETE. First, we check
@ -437,7 +437,7 @@ class WP_REST_Server {
*/
public function response_to_data( $response, $embed ) {
$data = $response->get_data();
$links = $this->get_compact_response_links( $response );
$links = self::get_compact_response_links( $response );
if ( ! empty( $links ) ) {
// Convert links to part of the data.

View File

@ -212,7 +212,7 @@ abstract class WP_REST_Controller {
$data = (array) $response->get_data();
$server = rest_get_server();
$links = $server->get_compact_response_links( $response );
$links = $server::get_compact_response_links( $response );
if ( ! empty( $links ) ) {
$data['_links'] = $links;

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-alpha-45565';
$wp_version = '5.3-alpha-45566';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.