From ce74afdae26940bac5e074053df32181dff9aa52 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 16 Nov 2016 12:18:33 +0000 Subject: [PATCH] REST API: Uppercase 'ID' in endpoint descriptions and error messages for consistency with other strings. See #38791. Built from https://develop.svn.wordpress.org/trunk@39264 git-svn-id: http://core.svn.wordpress.org/trunk@39204 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../class-wp-rest-attachments-controller.php | 2 +- .../class-wp-rest-comments-controller.php | 8 ++++---- .../endpoints/class-wp-rest-posts-controller.php | 16 ++++++++-------- .../class-wp-rest-revisions-controller.php | 12 ++++++------ .../endpoints/class-wp-rest-terms-controller.php | 2 +- .../endpoints/class-wp-rest-users-controller.php | 10 +++++----- wp-includes/version.php | 2 +- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php index 3044031f58..ea89a94585 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php @@ -453,7 +453,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { ); $schema['properties']['post'] = array( - 'description' => __( 'The id for the associated post of the resource.' ), + 'description' => __( 'The ID for the associated post of the resource.' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ); diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php index 8f4da17e23..e9a86419f6 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php @@ -1021,7 +1021,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller { $prepared_comment['comment_author_email'] = $user->user_email; $prepared_comment['comment_author_url'] = $user->user_url; } else { - return new WP_Error( 'rest_comment_author_invalid', __( 'Invalid comment author id.' ), array( 'status' => 400 ) ); + return new WP_Error( 'rest_comment_author_invalid', __( 'Invalid comment author ID.' ), array( 'status' => 400 ) ); } } @@ -1102,7 +1102,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller { 'readonly' => true, ), 'author' => array( - 'description' => __( 'The id of the user object, if author was a user.' ), + 'description' => __( 'The ID of the user object, if author was a user.' ), 'type' => 'integer', 'context' => array( 'view', 'edit', 'embed' ), ), @@ -1187,13 +1187,13 @@ class WP_REST_Comments_Controller extends WP_REST_Controller { 'readonly' => true, ), 'parent' => array( - 'description' => __( 'The id for the parent of the object.' ), + 'description' => __( 'The ID for the parent of the object.' ), 'type' => 'integer', 'context' => array( 'view', 'edit', 'embed' ), 'default' => 0, ), 'post' => array( - 'description' => __( 'The id of the associated post object.' ), + 'description' => __( 'The ID of the associated post object.' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'default' => 0, diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php index 183c1b03f9..0edb92bbfc 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php @@ -964,7 +964,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { $user_obj = get_userdata( $post_author ); if ( ! $user_obj ) { - return new WP_Error( 'rest_invalid_author', __( 'Invalid author id.' ), array( 'status' => 400 ) ); + return new WP_Error( 'rest_invalid_author', __( 'Invalid author ID.' ), array( 'status' => 400 ) ); } } @@ -995,7 +995,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { $parent = get_post( (int) $request['parent'] ); if ( empty( $parent ) ) { - return new WP_Error( 'rest_post_invalid_id', __( 'Invalid post parent id.' ), array( 'status' => 400 ) ); + return new WP_Error( 'rest_post_invalid_id', __( 'Invalid post parent ID.' ), array( 'status' => 400 ) ); } $prepared_post->post_parent = (int) $parent->ID; @@ -1086,7 +1086,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { if ( $result ) { return true; } else { - return new WP_Error( 'rest_invalid_featured_media', __( 'Invalid featured media id.' ), array( 'status' => 400 ) ); + return new WP_Error( 'rest_invalid_featured_media', __( 'Invalid featured media ID.' ), array( 'status' => 400 ) ); } } else { return delete_post_thumbnail( $post_id ); @@ -1717,7 +1717,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { if ( $post_type_obj->hierarchical ) { $schema['properties']['parent'] = array( - 'description' => __( 'The id for the parent of the object.' ), + 'description' => __( 'The ID for the parent of the object.' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ); @@ -1831,7 +1831,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { case 'author': $schema['properties']['author'] = array( - 'description' => __( 'The id for the author of the object.' ), + 'description' => __( 'The ID for the author of the object.' ), 'type' => 'integer', 'context' => array( 'view', 'edit', 'embed' ), ); @@ -1869,7 +1869,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { case 'thumbnail': $schema['properties']['featured_media'] = array( - 'description' => __( 'The id of the featured media for the object.' ), + 'description' => __( 'The ID of the featured media for the object.' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ); @@ -2050,7 +2050,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { if ( $post_type_obj->hierarchical || 'attachment' === $this->post_type ) { $params['parent'] = array( - 'description' => __( 'Limit result set to those of particular parent ids.' ), + 'description' => __( 'Limit result set to those of particular parent IDs.' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -2058,7 +2058,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { 'default' => array(), ); $params['parent_exclude'] = array( - 'description' => __( 'Limit result set to all items except those of a particular parent id.' ), + 'description' => __( 'Limit result set to all items except those of a particular parent ID.' ), 'type' => 'array', 'items' => array( 'type' => 'integer', diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php index 3e551eefb8..907ba054b1 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php @@ -141,7 +141,7 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller { public function get_items( $request ) { $parent = get_post( $request['parent'] ); if ( ! $request['parent'] || ! $parent || $this->parent_post_type !== $parent->post_type ) { - return new WP_Error( 'rest_post_invalid_parent', __( 'Invalid post parent id.' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_post_invalid_parent', __( 'Invalid post parent ID.' ), array( 'status' => 404 ) ); } $revisions = wp_get_post_revisions( $request['parent'] ); @@ -179,12 +179,12 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller { public function get_item( $request ) { $parent = get_post( $request['parent'] ); if ( ! $request['parent'] || ! $parent || $this->parent_post_type !== $parent->post_type ) { - return new WP_Error( 'rest_post_invalid_parent', __( 'Invalid post parent id.' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_post_invalid_parent', __( 'Invalid post parent ID.' ), array( 'status' => 404 ) ); } $revision = get_post( $request['id'] ); if ( ! $revision || 'revision' !== $revision->post_type ) { - return new WP_Error( 'rest_post_invalid_id', __( 'Invalid revision id.' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_post_invalid_id', __( 'Invalid revision ID.' ), array( 'status' => 404 ) ); } $response = $this->prepare_item_for_response( $revision, $request ); @@ -209,7 +209,7 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller { $post = get_post( $request['id'] ); if ( ! $post ) { - return new WP_Error( 'rest_post_invalid_id', __( 'Invalid revision id.' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_post_invalid_id', __( 'Invalid revision ID.' ), array( 'status' => 404 ) ); } $post_type = get_post_type_object( 'revision' ); return current_user_can( $post_type->cap->delete_post, $post->ID ); @@ -399,7 +399,7 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller { // Base properties for every Revision. 'properties' => array( 'author' => array( - 'description' => __( 'The id for the author of the object.' ), + 'description' => __( 'The ID for the author of the object.' ), 'type' => 'integer', 'context' => array( 'view', 'edit', 'embed' ), ), @@ -438,7 +438,7 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller { 'context' => array( 'view', 'edit' ), ), 'parent' => array( - 'description' => __( 'The id for the parent of the object.' ), + 'description' => __( 'The ID for the parent of the object.' ), 'type' => 'integer', 'context' => array( 'view', 'edit', 'embed' ), ), diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php index 65334d356c..46eac98ba6 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php @@ -860,7 +860,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { if ( $taxonomy->hierarchical ) { $schema['properties']['parent'] = array( - 'description' => __( 'The id for the parent of the resource.' ), + 'description' => __( 'The ID for the parent of the resource.' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ); diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php index a0589fa3c8..5024b0937b 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php @@ -312,7 +312,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { $types = get_post_types( array( 'show_in_rest' => true ), 'names' ); if ( empty( $id ) || empty( $user->ID ) ) { - return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource id.' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource ID.' ), array( 'status' => 404 ) ); } if ( get_current_user_id() === $id ) { @@ -342,7 +342,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { $user = get_userdata( $id ); if ( empty( $id ) || empty( $user->ID ) ) { - return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource id.' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource ID.' ), array( 'status' => 404 ) ); } $user = $this->prepare_item_for_response( $user, $request ); @@ -539,7 +539,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { $user = get_userdata( $id ); if ( ! $user ) { - return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource id.' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource ID.' ), array( 'status' => 404 ) ); } if ( email_exists( $request['email'] ) && $request['email'] !== $user->user_email ) { @@ -682,12 +682,12 @@ class WP_REST_Users_Controller extends WP_REST_Controller { $user = get_userdata( $id ); if ( ! $user ) { - return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource id.' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource ID.' ), array( 'status' => 404 ) ); } if ( ! empty( $reassign ) ) { if ( $reassign === $id || ! get_userdata( $reassign ) ) { - return new WP_Error( 'rest_user_invalid_reassign', __( 'Invalid resource id for reassignment.' ), array( 'status' => 400 ) ); + return new WP_Error( 'rest_user_invalid_reassign', __( 'Invalid resource ID for reassignment.' ), array( 'status' => 400 ) ); } } diff --git a/wp-includes/version.php b/wp-includes/version.php index d12d9bad22..aed54840c6 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-beta4-39263'; +$wp_version = '4.7-beta4-39264'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.