Make WordPress Core

Changeset 39264


Ignore:
Timestamp:
11/16/2016 12:17:31 PM (9 years ago)
Author:
SergeyBiryukov
Message:

REST API: Uppercase 'ID' in endpoint descriptions and error messages for consistency with other strings.

See #38791.

Location:
trunk/src/wp-includes/rest-api/endpoints
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

    r39161 r39264  
    454454
    455455        $schema['properties']['post'] = array(
    456             'description'     => __( 'The id for the associated post of the resource.' ),
     456            'description'     => __( 'The ID for the associated post of the resource.' ),
    457457            'type'            => 'integer',
    458458            'context'         => array( 'view', 'edit' ),
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

    r39259 r39264  
    10221022                $prepared_comment['comment_author_url'] = $user->user_url;
    10231023            } else {
    1024                 return new WP_Error( 'rest_comment_author_invalid', __( 'Invalid comment author id.' ), array( 'status' => 400 ) );
     1024                return new WP_Error( 'rest_comment_author_invalid', __( 'Invalid comment author ID.' ), array( 'status' => 400 ) );
    10251025            }
    10261026        }
     
    11031103                ),
    11041104                'author'           => array(
    1105                     'description'  => __( 'The id of the user object, if author was a user.' ),
     1105                    'description'  => __( 'The ID of the user object, if author was a user.' ),
    11061106                    'type'         => 'integer',
    11071107                    'context'      => array( 'view', 'edit', 'embed' ),
     
    11881188                ),
    11891189                'parent'           => array(
    1190                     'description'  => __( 'The id for the parent of the object.' ),
     1190                    'description'  => __( 'The ID for the parent of the object.' ),
    11911191                    'type'         => 'integer',
    11921192                    'context'      => array( 'view', 'edit', 'embed' ),
     
    11941194                ),
    11951195                'post'             => array(
    1196                     'description'  => __( 'The id of the associated post object.' ),
     1196                    'description'  => __( 'The ID of the associated post object.' ),
    11971197                    'type'         => 'integer',
    11981198                    'context'      => array( 'view', 'edit' ),
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r39252 r39264  
    965965
    966966                if ( ! $user_obj ) {
    967                     return new WP_Error( 'rest_invalid_author', __( 'Invalid author id.' ), array( 'status' => 400 ) );
     967                    return new WP_Error( 'rest_invalid_author', __( 'Invalid author ID.' ), array( 'status' => 400 ) );
    968968                }
    969969            }
     
    996996
    997997            if ( empty( $parent ) ) {
    998                 return new WP_Error( 'rest_post_invalid_id', __( 'Invalid post parent id.' ), array( 'status' => 400 ) );
     998                return new WP_Error( 'rest_post_invalid_id', __( 'Invalid post parent ID.' ), array( 'status' => 400 ) );
    999999            }
    10001000
     
    10871087                return true;
    10881088            } else {
    1089                 return new WP_Error( 'rest_invalid_featured_media', __( 'Invalid featured media id.' ), array( 'status' => 400 ) );
     1089                return new WP_Error( 'rest_invalid_featured_media', __( 'Invalid featured media ID.' ), array( 'status' => 400 ) );
    10901090            }
    10911091        } else {
     
    17181718        if ( $post_type_obj->hierarchical ) {
    17191719            $schema['properties']['parent'] = array(
    1720                 'description' => __( 'The id for the parent of the object.' ),
     1720                'description' => __( 'The ID for the parent of the object.' ),
    17211721                'type'        => 'integer',
    17221722                'context'     => array( 'view', 'edit' ),
     
    18321832                case 'author':
    18331833                    $schema['properties']['author'] = array(
    1834                         'description' => __( 'The id for the author of the object.' ),
     1834                        'description' => __( 'The ID for the author of the object.' ),
    18351835                        'type'        => 'integer',
    18361836                        'context'     => array( 'view', 'edit', 'embed' ),
     
    18701870                case 'thumbnail':
    18711871                    $schema['properties']['featured_media'] = array(
    1872                         'description' => __( 'The id of the featured media for the object.' ),
     1872                        'description' => __( 'The ID of the featured media for the object.' ),
    18731873                        'type'        => 'integer',
    18741874                        'context'     => array( 'view', 'edit' ),
     
    20512051        if ( $post_type_obj->hierarchical || 'attachment' === $this->post_type ) {
    20522052            $params['parent'] = array(
    2053                 'description'       => __( 'Limit result set to those of particular parent ids.' ),
     2053                'description'       => __( 'Limit result set to those of particular parent IDs.' ),
    20542054                'type'              => 'array',
    20552055                'items'             => array(
     
    20592059            );
    20602060            $params['parent_exclude'] = array(
    2061                 'description'       => __( 'Limit result set to all items except those of a particular parent id.' ),
     2061                'description'       => __( 'Limit result set to all items except those of a particular parent ID.' ),
    20622062                'type'              => 'array',
    20632063                'items'             => array(
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php

    r39257 r39264  
    142142        $parent = get_post( $request['parent'] );
    143143        if ( ! $request['parent'] || ! $parent || $this->parent_post_type !== $parent->post_type ) {
    144             return new WP_Error( 'rest_post_invalid_parent', __( 'Invalid post parent id.' ), array( 'status' => 404 ) );
     144            return new WP_Error( 'rest_post_invalid_parent', __( 'Invalid post parent ID.' ), array( 'status' => 404 ) );
    145145        }
    146146
     
    180180        $parent = get_post( $request['parent'] );
    181181        if ( ! $request['parent'] || ! $parent || $this->parent_post_type !== $parent->post_type ) {
    182             return new WP_Error( 'rest_post_invalid_parent', __( 'Invalid post parent id.' ), array( 'status' => 404 ) );
     182            return new WP_Error( 'rest_post_invalid_parent', __( 'Invalid post parent ID.' ), array( 'status' => 404 ) );
    183183        }
    184184
    185185        $revision = get_post( $request['id'] );
    186186        if ( ! $revision || 'revision' !== $revision->post_type ) {
    187             return new WP_Error( 'rest_post_invalid_id', __( 'Invalid revision id.' ), array( 'status' => 404 ) );
     187            return new WP_Error( 'rest_post_invalid_id', __( 'Invalid revision ID.' ), array( 'status' => 404 ) );
    188188        }
    189189
     
    210210        $post = get_post( $request['id'] );
    211211        if ( ! $post ) {
    212             return new WP_Error( 'rest_post_invalid_id', __( 'Invalid revision id.' ), array( 'status' => 404 ) );
     212            return new WP_Error( 'rest_post_invalid_id', __( 'Invalid revision ID.' ), array( 'status' => 404 ) );
    213213        }
    214214        $post_type = get_post_type_object( 'revision' );
     
    400400            'properties' => array(
    401401                'author'          => array(
    402                     'description' => __( 'The id for the author of the object.' ),
     402                    'description' => __( 'The ID for the author of the object.' ),
    403403                    'type'        => 'integer',
    404404                    'context'     => array( 'view', 'edit', 'embed' ),
     
    439439                ),
    440440                'parent'          => array(
    441                     'description' => __( 'The id for the parent of the object.' ),
     441                    'description' => __( 'The ID for the parent of the object.' ),
    442442                    'type'        => 'integer',
    443443                    'context'     => array( 'view', 'edit', 'embed' ),
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php

    r39257 r39264  
    861861        if ( $taxonomy->hierarchical ) {
    862862            $schema['properties']['parent'] = array(
    863                 'description'  => __( 'The id for the parent of the resource.' ),
     863                'description'  => __( 'The ID for the parent of the resource.' ),
    864864                'type'         => 'integer',
    865865                'context'      => array( 'view', 'edit' ),
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

    r39257 r39264  
    313313
    314314        if ( empty( $id ) || empty( $user->ID ) ) {
    315             return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource id.' ), array( 'status' => 404 ) );
     315            return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource ID.' ), array( 'status' => 404 ) );
    316316        }
    317317
     
    343343
    344344        if ( empty( $id ) || empty( $user->ID ) ) {
    345             return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource id.' ), array( 'status' => 404 ) );
     345            return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource ID.' ), array( 'status' => 404 ) );
    346346        }
    347347
     
    540540
    541541        if ( ! $user ) {
    542             return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource id.' ), array( 'status' => 404 ) );
     542            return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource ID.' ), array( 'status' => 404 ) );
    543543        }
    544544
     
    683683
    684684        if ( ! $user ) {
    685             return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource id.' ), array( 'status' => 404 ) );
     685            return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource ID.' ), array( 'status' => 404 ) );
    686686        }
    687687
    688688        if ( ! empty( $reassign ) ) {
    689689            if ( $reassign === $id || ! get_userdata( $reassign ) ) {
    690                 return new WP_Error( 'rest_user_invalid_reassign', __( 'Invalid resource id for reassignment.' ), array( 'status' => 400 ) );
     690                return new WP_Error( 'rest_user_invalid_reassign', __( 'Invalid resource ID for reassignment.' ), array( 'status' => 400 ) );
    691691            }
    692692        }
Note: See TracChangeset for help on using the changeset viewer.