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
This commit is contained in:
Sergey Biryukov 2016-11-16 12:18:33 +00:00
parent 2f4988c898
commit ce74afdae2
7 changed files with 26 additions and 26 deletions

View File

@ -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' ),
);

View File

@ -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,

View File

@ -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',

View File

@ -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' ),
),

View File

@ -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' ),
);

View File

@ -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 ) );
}
}

View File

@ -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.