--- a/wp/wp-includes/rest-api/class-wp-rest-request.php Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-includes/rest-api/class-wp-rest-request.php Mon Oct 14 18:28:13 2019 +0200
@@ -111,13 +111,13 @@
*/
public function __construct( $method = '', $route = '', $attributes = array() ) {
$this->params = array(
- 'URL' => array(),
- 'GET' => array(),
- 'POST' => array(),
- 'FILES' => array(),
+ 'URL' => array(),
+ 'GET' => array(),
+ 'POST' => array(),
+ 'FILES' => array(),
// See parse_json_params.
- 'JSON' => null,
+ 'JSON' => null,
'defaults' => array(),
);
@@ -174,7 +174,6 @@
* @link https://nginx.org/en/docs/http/ngx_http_core_module.html#underscores_in_headers
*
* @since 4.4.0
- * @static
*
* @param string $key Header name.
* @return string Canonicalized name.
@@ -235,7 +234,7 @@
* @param string $value Header value, or list of values.
*/
public function set_header( $key, $value ) {
- $key = $this->canonicalize_header_name( $key );
+ $key = $this->canonicalize_header_name( $key );
$value = (array) $value;
$this->headers[ $key ] = $value;
@@ -250,7 +249,7 @@
* @param string $value Header value, or list of values.
*/
public function add_header( $key, $value ) {
- $key = $this->canonicalize_header_name( $key );
+ $key = $this->canonicalize_header_name( $key );
$value = (array) $value;
if ( ! isset( $this->headers[ $key ] ) ) {
@@ -368,7 +367,7 @@
* @param array $order {
* An array of types to check, in order of priority.
*
- * @param string $type The type to check.
+ * @param string $type The type to check.
* }
* @param WP_REST_Request $this The request object.
*/
@@ -405,7 +404,7 @@
* @param mixed $value Parameter value.
*/
public function set_param( $key, $value ) {
- $order = $this->get_parameter_order();
+ $order = $this->get_parameter_order();
$this->params[ $order[0] ][ $key ] = $value;
}
@@ -587,8 +586,8 @@
$this->body = $data;
// Enable lazy parsing.
- $this->parsed_json = false;
- $this->parsed_body = false;
+ $this->parsed_json = false;
+ $this->parsed_body = false;
$this->params['JSON'] = null;
}
@@ -650,7 +649,7 @@
'status' => WP_Http::BAD_REQUEST,
);
if ( function_exists( 'json_last_error' ) ) {
- $error_data['json_error_code'] = json_last_error();
+ $error_data['json_error_code'] = json_last_error();
$error_data['json_error_message'] = json_last_error_msg();
}
@@ -802,7 +801,14 @@
}
if ( $invalid_params ) {
- return new WP_Error( 'rest_invalid_param', sprintf( __( 'Invalid parameter(s): %s' ), implode( ', ', array_keys( $invalid_params ) ) ), array( 'status' => 400, 'params' => $invalid_params ) );
+ return new WP_Error(
+ 'rest_invalid_param',
+ sprintf( __( 'Invalid parameter(s): %s' ), implode( ', ', array_keys( $invalid_params ) ) ),
+ array(
+ 'status' => 400,
+ 'params' => $invalid_params,
+ )
+ );
}
return true;
@@ -824,7 +830,7 @@
}
$attributes = $this->get_attributes();
- $required = array();
+ $required = array();
// No arguments set, skip validation.
if ( empty( $attributes['args'] ) ) {
@@ -840,7 +846,14 @@
}
if ( ! empty( $required ) ) {
- return new WP_Error( 'rest_missing_callback_param', sprintf( __( 'Missing parameter(s): %s' ), implode( ', ', $required ) ), array( 'status' => 400, 'params' => $required ) );
+ return new WP_Error(
+ 'rest_missing_callback_param',
+ sprintf( __( 'Missing parameter(s): %s' ), implode( ', ', $required ) ),
+ array(
+ 'status' => 400,
+ 'params' => $required,
+ )
+ );
}
/*
@@ -868,7 +881,14 @@
}
if ( $invalid_params ) {
- return new WP_Error( 'rest_invalid_param', sprintf( __( 'Invalid parameter(s): %s' ), implode( ', ', array_keys( $invalid_params ) ) ), array( 'status' => 400, 'params' => $invalid_params ) );
+ return new WP_Error(
+ 'rest_invalid_param',
+ sprintf( __( 'Invalid parameter(s): %s' ), implode( ', ', array_keys( $invalid_params ) ) ),
+ array(
+ 'status' => 400,
+ 'params' => $invalid_params,
+ )
+ );
}
return true;
@@ -938,14 +958,13 @@
/**
* Retrieves a WP_REST_Request object from a full URL.
*
- * @static
* @since 4.5.0
*
* @param string $url URL with protocol, domain, path and query args.
* @return WP_REST_Request|false WP_REST_Request object on success, false on failure.
*/
public static function from_url( $url ) {
- $bits = parse_url( $url );
+ $bits = parse_url( $url );
$query_params = array();
if ( ! empty( $bits['query'] ) ) {
@@ -956,7 +975,7 @@
if ( get_option( 'permalink_structure' ) && 0 === strpos( $url, $api_root ) ) {
// Pretty permalinks on, and URL is under the API root.
$api_url_part = substr( $url, strlen( untrailingslashit( $api_root ) ) );
- $route = parse_url( $api_url_part, PHP_URL_PATH );
+ $route = parse_url( $api_url_part, PHP_URL_PATH );
} elseif ( ! empty( $query_params['rest_route'] ) ) {
// ?rest_route=... set directly
$route = $query_params['rest_route'];