Make WordPress Core

Changeset 39342


Ignore:
Timestamp:
11/23/2016 02:42:00 AM (8 years ago)
Author:
joehoyle
Message:

REST API: Update “resource” strings to use the appropriate nouns.

Props ramiy.
Fixes #38811.

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

Legend:

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

    r39264 r39342  
    7777
    7878            if ( ! current_user_can( $post_parent_type->cap->edit_post, $request['post'] ) ) {
    79                 return new WP_Error( 'rest_cannot_edit', __( 'Sorry, you are not allowed to upload media to this resource.' ), array( 'status' => rest_authorization_required_code() ) );
     79                return new WP_Error( 'rest_cannot_edit', __( 'Sorry, you are not allowed to upload media to this post.' ), array( 'status' => rest_authorization_required_code() ) );
    8080            }
    8181        }
     
    379379
    380380        $schema['properties']['alt_text'] = array(
    381             'description'     => __( 'Alternative text to display when resource is not displayed.' ),
     381            'description'     => __( 'Alternative text to display when attachment is not displayed.' ),
    382382            'type'            => 'string',
    383383            'context'         => array( 'view', 'edit', 'embed' ),
     
    388388
    389389        $schema['properties']['caption'] = array(
    390             'description' => __( 'The caption for the resource.' ),
     390            'description' => __( 'The attachment caption.' ),
    391391            'type'        => 'object',
    392392            'context'     => array( 'view', 'edit', 'embed' ),
     
    396396            'properties'  => array(
    397397                'raw' => array(
    398                     'description' => __( 'Caption for the resource, as it exists in the database.' ),
     398                    'description' => __( 'Caption for the attachment, as it exists in the database.' ),
    399399                    'type'        => 'string',
    400400                    'context'     => array( 'edit' ),
    401401                ),
    402402                'rendered' => array(
    403                     'description' => __( 'HTML caption for the resource, transformed for display.' ),
     403                    'description' => __( 'HTML caption for the attachment, transformed for display.' ),
    404404                    'type'        => 'string',
    405405                    'context'     => array( 'view', 'edit', 'embed' ),
     
    410410
    411411        $schema['properties']['description'] = array(
    412             'description' => __( 'The description for the resource.' ),
     412            'description' => __( 'The attachment description.' ),
    413413            'type'        => 'object',
    414414            'context'     => array( 'view', 'edit' ),
     
    432432
    433433        $schema['properties']['media_type'] = array(
    434             'description'     => __( 'Type of resource.' ),
     434            'description'     => __( 'Attachment type.' ),
    435435            'type'            => 'string',
    436436            'enum'            => array( 'image', 'file' ),
     
    440440
    441441        $schema['properties']['mime_type'] = array(
    442             'description'     => __( 'MIME type of resource.' ),
     442            'description'     => __( 'The attachment MIME type.' ),
    443443            'type'            => 'string',
    444444            'context'         => array( 'view', 'edit', 'embed' ),
     
    447447
    448448        $schema['properties']['media_details'] = array(
    449             'description'     => __( 'Details about the resource file, specific to its type.' ),
     449            'description'     => __( 'Details about the media file, specific to its type.' ),
    450450            'type'            => 'object',
    451451            'context'         => array( 'view', 'edit', 'embed' ),
     
    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 attachment.' ),
    457457            'type'            => 'integer',
    458458            'context'         => array( 'view', 'edit' ),
     
    460460
    461461        $schema['properties']['source_url'] = array(
    462             'description'     => __( 'URL to the original resource file.' ),
     462            'description'     => __( 'URL to the original attachment file.' ),
    463463            'type'            => 'string',
    464464            'format'          => 'uri',
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

    r39337 r39342  
    12881288
    12891289        $query_params['after'] = array(
    1290             'description'       => __( 'Limit response to resources published after a given ISO8601 compliant date.' ),
     1290            'description'       => __( 'Limit response to comments published after a given ISO8601 compliant date.' ),
    12911291            'type'              => 'string',
    12921292            'format'            => 'date-time',
     
    13171317
    13181318        $query_params['before'] = array(
    1319             'description'       => __( 'Limit response to resources published before a given ISO8601 compliant date.' ),
     1319            'description'       => __( 'Limit response to comments published before a given ISO8601 compliant date.' ),
    13201320            'type'              => 'string',
    13211321            'format'            => 'date-time',
     
    13721372        $query_params['parent'] = array(
    13731373            'default'           => array(),
    1374             'description'       => __( 'Limit result set to resources of specific parent IDs.' ),
     1374            'description'       => __( 'Limit result set to comments of specific parent IDs.' ),
    13751375            'type'              => 'array',
    13761376            'items'             => array(
     
    13901390        $query_params['post']   = array(
    13911391            'default'           => array(),
    1392             'description'       => __( 'Limit result set to resources assigned to specific post IDs.' ),
     1392            'description'       => __( 'Limit result set to comments assigned to specific post IDs.' ),
    13931393            'type'              => 'array',
    13941394            'items'             => array(
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php

    r39313 r39342  
    126126
    127127        if ( empty( $status ) ) {
    128             return new WP_Error( 'rest_status_invalid', __( 'Invalid resource.' ), array( 'status' => 404 ) );
     128            return new WP_Error( 'rest_status_invalid', __( 'Invalid status.' ), array( 'status' => 404 ) );
    129129        }
    130130
     
    132132
    133133        if ( ! $check ) {
    134             return new WP_Error( 'rest_cannot_read_status', __( 'Cannot view resource.' ), array( 'status' => rest_authorization_required_code() ) );
     134            return new WP_Error( 'rest_cannot_read_status', __( 'Cannot view status.' ), array( 'status' => rest_authorization_required_code() ) );
    135135        }
    136136
     
    178178
    179179        if ( empty( $obj ) ) {
    180             return new WP_Error( 'rest_status_invalid', __( 'Invalid resource.' ), array( 'status' => 404 ) );
     180            return new WP_Error( 'rest_status_invalid', __( 'Invalid status.' ), array( 'status' => 404 ) );
    181181        }
    182182
     
    249249            'properties'           => array(
    250250                'name'             => array(
    251                     'description'  => __( 'The title for the resource.' ),
     251                    'description'  => __( 'The title for the status.' ),
    252252                    'type'         => 'string',
    253253                    'context'      => array( 'embed', 'view', 'edit' ),
     
    255255                ),
    256256                'private'          => array(
    257                     'description'  => __( 'Whether posts with this resource should be private.' ),
     257                    'description'  => __( 'Whether posts with this status should be private.' ),
    258258                    'type'         => 'boolean',
    259259                    'context'      => array( 'edit' ),
     
    261261                ),
    262262                'protected'        => array(
    263                     'description'  => __( 'Whether posts with this resource should be protected.' ),
     263                    'description'  => __( 'Whether posts with this status should be protected.' ),
    264264                    'type'         => 'boolean',
    265265                    'context'      => array( 'edit' ),
     
    267267                ),
    268268                'public'           => array(
    269                     'description'  => __( 'Whether posts of this resource should be shown in the front end of the site.' ),
     269                    'description'  => __( 'Whether posts of this status should be shown in the front end of the site.' ),
    270270                    'type'         => 'boolean',
    271271                    'context'      => array( 'view', 'edit' ),
     
    273273                ),
    274274                'queryable'        => array(
    275                     'description'  => __( 'Whether posts with this resource should be publicly-queryable.' ),
     275                    'description'  => __( 'Whether posts with this status should be publicly-queryable.' ),
    276276                    'type'         => 'boolean',
    277277                    'context'      => array( 'view', 'edit' ),
     
    285285                ),
    286286                'slug'             => array(
    287                     'description'  => __( 'An alphanumeric identifier for the resource.' ),
     287                    'description'  => __( 'An alphanumeric identifier for the status.' ),
    288288                    'type'         => 'string',
    289289                    'context'      => array( 'embed', 'view', 'edit' ),
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php

    r39313 r39342  
    120120
    121121        if ( empty( $obj ) ) {
    122             return new WP_Error( 'rest_type_invalid', __( 'Invalid resource.' ), array( 'status' => 404 ) );
     122            return new WP_Error( 'rest_type_invalid', __( 'Invalid post type.' ), array( 'status' => 404 ) );
    123123        }
    124124
    125125        if ( empty( $obj->show_in_rest ) ) {
    126             return new WP_Error( 'rest_cannot_read_type', __( 'Cannot view resource.' ), array( 'status' => rest_authorization_required_code() ) );
     126            return new WP_Error( 'rest_cannot_read_type', __( 'Cannot view post type.' ), array( 'status' => rest_authorization_required_code() ) );
    127127        }
    128128
     
    205205            'properties'           => array(
    206206                'capabilities'     => array(
    207                     'description'  => __( 'All capabilities used by the resource.' ),
     207                    'description'  => __( 'All capabilities used by the post type.' ),
    208208                    'type'         => 'object',
    209209                    'context'      => array( 'edit' ),
     
    211211                ),
    212212                'description'      => array(
    213                     'description'  => __( 'A human-readable description of the resource.' ),
     213                    'description'  => __( 'A human-readable description of the post type.' ),
    214214                    'type'         => 'string',
    215215                    'context'      => array( 'view', 'edit' ),
     
    217217                ),
    218218                'hierarchical'     => array(
    219                     'description'  => __( 'Whether or not the resource should have children.' ),
     219                    'description'  => __( 'Whether or not the post type should have children.' ),
    220220                    'type'         => 'boolean',
    221221                    'context'      => array( 'view', 'edit' ),
     
    223223                ),
    224224                'labels'           => array(
    225                     'description'  => __( 'Human-readable labels for the resource for various contexts.' ),
     225                    'description'  => __( 'Human-readable labels for the post type for various contexts.' ),
    226226                    'type'         => 'object',
    227227                    'context'      => array( 'edit' ),
     
    229229                ),
    230230                'name'             => array(
    231                     'description'  => __( 'The title for the resource.' ),
     231                    'description'  => __( 'The title for the post type.' ),
    232232                    'type'         => 'string',
    233233                    'context'      => array( 'view', 'edit', 'embed' ),
     
    235235                ),
    236236                'slug'             => array(
    237                     'description'  => __( 'An alphanumeric identifier for the resource.' ),
     237                    'description'  => __( 'An alphanumeric identifier for the post type.' ),
    238238                    'type'         => 'string',
    239239                    'context'      => array( 'view', 'edit', 'embed' ),
     
    241241                ),
    242242                'taxonomies'       => array(
    243                     'description'  => __( 'Taxonomies associated with resource.' ),
     243                    'description'  => __( 'Taxonomies associated with post type.' ),
    244244                    'type'         => 'array',
    245245                    'items'        => array(
     
    250250                ),
    251251                'rest_base'            => array(
    252                     'description'  => __( 'REST base route for the resource.' ),
     252                    'description'  => __( 'REST base route for the post type.' ),
    253253                    'type'         => 'string',
    254254                    'context'      => array( 'view', 'edit', 'embed' ),
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r39322 r39342  
    19641964
    19651965        $params['after'] = array(
    1966             'description'        => __( 'Limit response to resources published after a given ISO8601 compliant date.' ),
     1966            'description'        => __( 'Limit response to posts published after a given ISO8601 compliant date.' ),
    19671967            'type'               => 'string',
    19681968            'format'             => 'date-time',
     
    19891989
    19901990        $params['before'] = array(
    1991             'description'        => __( 'Limit response to resources published before a given ISO8601 compliant date.' ),
     1991            'description'        => __( 'Limit response to posts published before a given ISO8601 compliant date.' ),
    19921992            'type'               => 'string',
    19931993            'format'             => 'date-time',
     
    20142014        if ( 'page' === $this->post_type || post_type_supports( $this->post_type, 'page-attributes' ) ) {
    20152015            $params['menu_order'] = array(
    2016                 'description'        => __( 'Limit result set to resources with a specific menu_order value.' ),
     2016                'description'        => __( 'Limit result set to posts with a specific menu_order value.' ),
    20172017                'type'               => 'integer',
    20182018            );
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php

    r39264 r39342  
    1212 *
    1313 * @since 4.7.0
    14  *
     14 *0
    1515 * @see WP_REST_Controller
    1616 */
     
    9898                        'type'        => 'boolean',
    9999                        'default'     => false,
    100                         'description' => __( 'Required to be true, as resource does not support trashing.' ),
     100                        'description' => __( 'Required to be true, as revisions do not support trashing.' ),
    101101                    ),
    102102                ),
     
    228228        $force = isset( $request['force'] ) ? (bool) $request['force'] : false;
    229229
    230         // We don't support trashing for this resource type.
     230        // We don't support trashing for revisions.
    231231        if ( ! $force ) {
    232232            return new WP_Error( 'rest_trash_not_supported', __( 'Revisions do not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) );
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php

    r39313 r39342  
    161161        $tax_obj = get_taxonomy( $request['taxonomy'] );
    162162        if ( empty( $tax_obj ) ) {
    163             return new WP_Error( 'rest_taxonomy_invalid', __( 'Invalid resource.' ), array( 'status' => 404 ) );
     163            return new WP_Error( 'rest_taxonomy_invalid', __( 'Invalid taxonomy.' ), array( 'status' => 404 ) );
    164164        }
    165165        $data = $this->prepare_item_for_response( $tax_obj, $request );
     
    236236            'properties'           => array(
    237237                'capabilities'     => array(
    238                     'description'  => __( 'All capabilities used by the resource.' ),
     238                    'description'  => __( 'All capabilities used by the taxonomy.' ),
    239239                    'type'         => 'object',
    240240                    'context'      => array( 'edit' ),
     
    242242                ),
    243243                'description'      => array(
    244                     'description'  => __( 'A human-readable description of the resource.' ),
     244                    'description'  => __( 'A human-readable description of the taxonomy.' ),
    245245                    'type'         => 'string',
    246246                    'context'      => array( 'view', 'edit' ),
     
    248248                ),
    249249                'hierarchical'     => array(
    250                     'description'  => __( 'Whether or not the resource should have children.' ),
     250                    'description'  => __( 'Whether or not the taxonomy should have children.' ),
    251251                    'type'         => 'boolean',
    252252                    'context'      => array( 'view', 'edit' ),
     
    254254                ),
    255255                'labels'           => array(
    256                     'description'  => __( 'Human-readable labels for the resource for various contexts.' ),
     256                    'description'  => __( 'Human-readable labels for the taxonomy for various contexts.' ),
    257257                    'type'         => 'object',
    258258                    'context'      => array( 'edit' ),
     
    260260                ),
    261261                'name'             => array(
    262                     'description'  => __( 'The title for the resource.' ),
     262                    'description'  => __( 'The title for the taxonomy.' ),
    263263                    'type'         => 'string',
    264264                    'context'      => array( 'view', 'edit', 'embed' ),
     
    266266                ),
    267267                'slug'             => array(
    268                     'description'  => __( 'An alphanumeric identifier for the resource.' ),
     268                    'description'  => __( 'An alphanumeric identifier for the taxonomy.' ),
    269269                    'type'         => 'string',
    270270                    'context'      => array( 'view', 'edit', 'embed' ),
     
    278278                ),
    279279                'types'            => array(
    280                     'description'  => __( 'Types associated with resource.' ),
     280                    'description'  => __( 'Types associated with the taxonomy.' ),
    281281                    'type'         => 'array',
    282282                    'items'        => array(
     
    287287                ),
    288288                'rest_base'            => array(
    289                     'description'  => __( 'REST base route for the resource.' ),
     289                    'description'  => __( 'REST base route for the taxonomy.' ),
    290290                    'type'         => 'string',
    291291                    'context'      => array( 'view', 'edit', 'embed' ),
     
    309309        $new_params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
    310310        $new_params['type'] = array(
    311             'description'  => __( 'Limit results to resources associated with a specific post type.' ),
     311            'description'  => __( 'Limit results to taxonomies associated with a specific post type.' ),
    312312            'type'         => 'string',
    313313        );
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php

    r39309 r39342  
    119119                        'type'        => 'boolean',
    120120                        'default'     => false,
    121                         'description' => __( 'Required to be true, as resource does not support trashing.' ),
     121                        'description' => __( 'Required to be true, as terms do not support trashing.' ),
    122122                    ),
    123123                ),
     
    322322
    323323        if ( ! $term || $term->taxonomy !== $this->taxonomy ) {
    324             return new WP_Error( 'rest_term_invalid', __( "Resource doesn't exist." ), array( 'status' => 404 ) );
     324            return new WP_Error( 'rest_term_invalid', __( "Term doesn't exist." ), array( 'status' => 404 ) );
    325325        }
    326326
     
    351351        $taxonomy_obj = get_taxonomy( $this->taxonomy );
    352352        if ( ! current_user_can( $taxonomy_obj->cap->manage_terms ) ) {
    353             return new WP_Error( 'rest_cannot_create', __( 'Sorry, you are not allowed to create new resource.' ), array( 'status' => rest_authorization_required_code() ) );
     353            return new WP_Error( 'rest_cannot_create', __( 'Sorry, you are not allowed to create new terms.' ), array( 'status' => rest_authorization_required_code() ) );
    354354        }
    355355
     
    369369        if ( isset( $request['parent'] ) ) {
    370370            if ( ! is_taxonomy_hierarchical( $this->taxonomy ) ) {
    371                 return new WP_Error( 'rest_taxonomy_not_hierarchical', __( 'Can not set resource parent, taxonomy is not hierarchical.' ), array( 'status' => 400 ) );
     371                return new WP_Error( 'rest_taxonomy_not_hierarchical', __( 'Can not set parent term, taxonomy is not hierarchical.' ), array( 'status' => 400 ) );
    372372            }
    373373
     
    375375
    376376            if ( ! $parent ) {
    377                 return new WP_Error( 'rest_term_invalid', __( "Parent resource doesn't exist." ), array( 'status' => 400 ) );
     377                return new WP_Error( 'rest_term_invalid', __( "Parent term doesn't exist." ), array( 'status' => 400 ) );
    378378            }
    379379        }
     
    454454
    455455        if ( ! $term ) {
    456             return new WP_Error( 'rest_term_invalid', __( "Resource doesn't exist." ), array( 'status' => 404 ) );
     456            return new WP_Error( 'rest_term_invalid', __( "Term doesn't exist." ), array( 'status' => 404 ) );
    457457        }
    458458
    459459        if ( ! current_user_can( 'edit_term', $term->term_id ) ) {
    460             return new WP_Error( 'rest_cannot_update', __( 'Sorry, you are not allowed to update resource.' ), array( 'status' => rest_authorization_required_code() ) );
     460            return new WP_Error( 'rest_cannot_update', __( 'Sorry, you are not allowed to edit terms.' ), array( 'status' => rest_authorization_required_code() ) );
    461461        }
    462462
     
    476476        if ( isset( $request['parent'] ) ) {
    477477            if ( ! is_taxonomy_hierarchical( $this->taxonomy ) ) {
    478                 return new WP_Error( 'rest_taxonomy_not_hierarchical', __( 'Can not set resource parent, taxonomy is not hierarchical.' ), array( 'status' => 400 ) );
     478                return new WP_Error( 'rest_taxonomy_not_hierarchical', __( 'Can not set parent term, taxonomy is not hierarchical.' ), array( 'status' => 400 ) );
    479479            }
    480480
     
    482482
    483483            if ( ! $parent ) {
    484                 return new WP_Error( 'rest_term_invalid', __( "Parent resource doesn't exist." ), array( 'status' => 400 ) );
     484                return new WP_Error( 'rest_term_invalid', __( "Parent term doesn't exist." ), array( 'status' => 400 ) );
    485485            }
    486486        }
     
    543543
    544544        if ( ! $term ) {
    545             return new WP_Error( 'rest_term_invalid', __( "Resource doesn't exist." ), array( 'status' => 404 ) );
     545            return new WP_Error( 'rest_term_invalid', __( "Term doesn't exist." ), array( 'status' => 404 ) );
    546546        }
    547547
    548548        if ( ! current_user_can( 'delete_term', $term->term_id ) ) {
    549             return new WP_Error( 'rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.' ), array( 'status' => rest_authorization_required_code() ) );
     549            return new WP_Error( 'rest_cannot_delete', __( 'Sorry, you are not allowed to delete this term.' ), array( 'status' => rest_authorization_required_code() ) );
    550550        }
    551551
     
    566566        $force = isset( $request['force'] ) ? (bool) $request['force'] : false;
    567567
    568         // We don't support trashing for this resource type.
     568        // We don't support trashing for terms.
    569569        if ( ! $force ) {
    570570            return new WP_Error( 'rest_trash_not_supported', __( 'Terms do not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) );
     
    580580
    581581        if ( ! $retval ) {
    582             return new WP_Error( 'rest_cannot_delete', __( 'The resource cannot be deleted.' ), array( 'status' => 500 ) );
     582            return new WP_Error( 'rest_cannot_delete', __( 'The term cannot be deleted.' ), array( 'status' => 500 ) );
    583583        }
    584584
     
    807807            'properties' => array(
    808808                'id'          => array(
    809                     'description'  => __( 'Unique identifier for the resource.' ),
     809                    'description'  => __( 'Unique identifier for the term.' ),
    810810                    'type'         => 'integer',
    811811                    'context'      => array( 'view', 'embed', 'edit' ),
     
    813813                ),
    814814                'count'       => array(
    815                     'description'  => __( 'Number of published posts for the resource.' ),
     815                    'description'  => __( 'Number of published posts for the term.' ),
    816816                    'type'         => 'integer',
    817817                    'context'      => array( 'view', 'edit' ),
     
    819819                ),
    820820                'description' => array(
    821                     'description'  => __( 'HTML description of the resource.' ),
     821                    'description'  => __( 'HTML description of the term.' ),
    822822                    'type'         => 'string',
    823823                    'context'      => array( 'view', 'edit' ),
    824824                ),
    825825                'link'        => array(
    826                     'description'  => __( 'URL of the resource.' ),
     826                    'description'  => __( 'URL of the term.' ),
    827827                    'type'         => 'string',
    828828                    'format'       => 'uri',
     
    831831                ),
    832832                'name'        => array(
    833                     'description'  => __( 'HTML title for the resource.' ),
     833                    'description'  => __( 'HTML title for the term.' ),
    834834                    'type'         => 'string',
    835835                    'context'      => array( 'view', 'embed', 'edit' ),
     
    840840                ),
    841841                'slug'        => array(
    842                     'description'  => __( 'An alphanumeric identifier for the resource unique to its type.' ),
     842                    'description'  => __( 'An alphanumeric identifier for the term unique to its type.' ),
    843843                    'type'         => 'string',
    844844                    'context'      => array( 'view', 'embed', 'edit' ),
     
    848848                ),
    849849                'taxonomy'    => array(
    850                     'description'  => __( 'Type attribution for the resource.' ),
     850                    'description'  => __( 'Type attribution for the term.' ),
    851851                    'type'         => 'string',
    852852                    'enum'         => array_keys( get_taxonomies() ),
     
    861861        if ( $taxonomy->hierarchical ) {
    862862            $schema['properties']['parent'] = array(
    863                 'description'  => __( 'The ID for the parent of the resource.' ),
     863                'description'  => __( 'The parent term ID.' ),
    864864                'type'         => 'integer',
    865865                'context'      => array( 'view', 'edit' ),
     
    922922
    923923        $query_params['orderby'] = array(
    924             'description'       => __( 'Sort collection by resource attribute.' ),
     924            'description'       => __( 'Sort collection by term attribute.' ),
    925925            'type'              => 'string',
    926926            'default'           => 'name',
     
    937937
    938938        $query_params['hide_empty'] = array(
    939             'description'       => __( 'Whether to hide resources not assigned to any posts.' ),
     939            'description'       => __( 'Whether to hide terms not assigned to any posts.' ),
    940940            'type'              => 'boolean',
    941941            'default'           => false,
     
    944944        if ( $taxonomy->hierarchical ) {
    945945            $query_params['parent'] = array(
    946                 'description'       => __( 'Limit result set to resources assigned to a specific parent.' ),
     946                'description'       => __( 'Limit result set to terms assigned to a specific parent.' ),
    947947                'type'              => 'integer',
    948948            );
     
    950950
    951951        $query_params['post'] = array(
    952             'description'       => __( 'Limit result set to resources assigned to a specific post.' ),
     952            'description'       => __( 'Limit result set to terms assigned to a specific post.' ),
    953953            'type'              => 'integer',
    954954            'default'           => null,
     
    956956
    957957        $query_params['slug'] = array(
    958             'description'       => __( 'Limit result set to resources with a specific slug.' ),
     958            'description'       => __( 'Limit result set to terms with a specific slug.' ),
    959959            'type'              => 'string',
    960960        );
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

    r39313 r39342  
    8888                        'type'        => 'boolean',
    8989                        'default'     => false,
    90                         'description' => __( 'Required to be true, as resource does not support trashing.' ),
     90                        'description' => __( 'Required to be true, as users do not support trashing.' ),
    9191                    ),
    9292                    'reassign' => array(
     
    121121                        'type'        => 'boolean',
    122122                        'default'     => false,
    123                         'description' => __( 'Required to be true, as resource does not support trashing.' ),
     123                        'description' => __( 'Required to be true, as users do not support trashing.' ),
    124124                    ),
    125125                    'reassign' => array(
     
    145145        // Check if roles is specified in GET request and if user can list users.
    146146        if ( ! empty( $request['roles'] ) && ! current_user_can( 'list_users' ) ) {
    147             return new WP_Error( 'rest_user_cannot_view', __( 'Sorry, you are not allowed to filter by role.' ), array( 'status' => rest_authorization_required_code() ) );
     147            return new WP_Error( 'rest_user_cannot_view', __( 'Sorry, you are not allowed to filter users by role.' ), array( 'status' => rest_authorization_required_code() ) );
    148148        }
    149149
     
    153153
    154154        if ( in_array( $request['orderby'], array( 'email', 'registered_date' ), true ) && ! current_user_can( 'list_users' ) ) {
    155             return new WP_Error( 'rest_forbidden_orderby', __( 'Sorry, you are not allowed to order by this parameter.' ), array( 'status' => rest_authorization_required_code() ) );
     155            return new WP_Error( 'rest_forbidden_orderby', __( 'Sorry, you are not allowed to order users by this parameter.' ), array( 'status' => rest_authorization_required_code() ) );
    156156        }
    157157
     
    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 user 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 user ID.' ), array( 'status' => 404 ) );
    346346        }
    347347
     
    388388
    389389        if ( ! current_user_can( 'create_users' ) ) {
    390             return new WP_Error( 'rest_cannot_create_user', __( 'Sorry, you are not allowed to create new resource.' ), array( 'status' => rest_authorization_required_code() ) );
     390            return new WP_Error( 'rest_cannot_create_user', __( 'Sorry, you are not allowed to create new users.' ), array( 'status' => rest_authorization_required_code() ) );
    391391        }
    392392
     
    405405    public function create_item( $request ) {
    406406        if ( ! empty( $request['id'] ) ) {
    407             return new WP_Error( 'rest_user_exists', __( 'Cannot create existing resource.' ), array( 'status' => 400 ) );
     407            return new WP_Error( 'rest_user_exists', __( 'Cannot create existing user.' ), array( 'status' => 400 ) );
    408408        }
    409409
     
    441441
    442442            if ( ! $user_id ) {
    443                 return new WP_Error( 'rest_user_create', __( 'Error creating new resource.' ), array( 'status' => 500 ) );
     443                return new WP_Error( 'rest_user_create', __( 'Error creating new user.' ), array( 'status' => 500 ) );
    444444            }
    445445
     
    516516
    517517        if ( ! current_user_can( 'edit_user', $id ) ) {
    518             return new WP_Error( 'rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.' ), array( 'status' => rest_authorization_required_code() ) );
     518            return new WP_Error( 'rest_cannot_edit', __( 'Sorry, you are not allowed to edit this user.' ), array( 'status' => rest_authorization_required_code() ) );
    519519        }
    520520
    521521        if ( ! empty( $request['roles'] ) && ! current_user_can( 'edit_users' ) ) {
    522             return new WP_Error( 'rest_cannot_edit_roles', __( 'Sorry, you are not allowed to edit roles of this resource.' ), array( 'status' => rest_authorization_required_code() ) );
     522            return new WP_Error( 'rest_cannot_edit_roles', __( 'Sorry, you are not allowed to edit roles of this user.' ), array( 'status' => rest_authorization_required_code() ) );
    523523        }
    524524
     
    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 user ID.' ), array( 'status' => 404 ) );
    543543        }
    544544
     
    655655
    656656        if ( ! current_user_can( 'delete_user', $id ) ) {
    657             return new WP_Error( 'rest_user_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.' ), array( 'status' => rest_authorization_required_code() ) );
     657            return new WP_Error( 'rest_user_cannot_delete', __( 'Sorry, you are not allowed to delete this user.' ), array( 'status' => rest_authorization_required_code() ) );
    658658        }
    659659
     
    675675        $force    = isset( $request['force'] ) ? (bool) $request['force'] : false;
    676676
    677         // We don't support trashing for this type, error out.
     677        // We don't support trashing for users.
    678678        if ( ! $force ) {
    679679            return new WP_Error( 'rest_trash_not_supported', __( 'Users do not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) );
     
    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 user 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 user ID for reassignment.' ), array( 'status' => 400 ) );
    691691            }
    692692        }
     
    702702
    703703        if ( ! $result ) {
    704             return new WP_Error( 'rest_cannot_delete', __( 'The resource cannot be deleted.' ), array( 'status' => 500 ) );
     704            return new WP_Error( 'rest_cannot_delete', __( 'The user cannot be deleted.' ), array( 'status' => 500 ) );
    705705        }
    706706
     
    996996                && ! $potential_role->has_cap( 'edit_users' )
    997997            ) {
    998                 return new WP_Error( 'rest_user_invalid_role', __( 'Sorry, you are not allowed to give resource that role.' ), array( 'status' => rest_authorization_required_code() ) );
     998                return new WP_Error( 'rest_user_invalid_role', __( 'Sorry, you are not allowed to give users that role.' ), array( 'status' => rest_authorization_required_code() ) );
    999999            }
    10001000
     
    10061006
    10071007            if ( empty( $editable_roles[ $role ] ) ) {
    1008                 return new WP_Error( 'rest_user_invalid_role', __( 'Sorry, you are not allowed to give resource that role.' ), array( 'status' => 403 ) );
     1008                return new WP_Error( 'rest_user_invalid_role', __( 'Sorry, you are not allowed to give users that role.' ), array( 'status' => 403 ) );
    10091009            }
    10101010        }
     
    10831083            'properties' => array(
    10841084                'id'          => array(
    1085                     'description' => __( 'Unique identifier for the resource.' ),
     1085                    'description' => __( 'Unique identifier for the user.' ),
    10861086                    'type'        => 'integer',
    10871087                    'context'     => array( 'embed', 'view', 'edit' ),
     
    10891089                ),
    10901090                'username'    => array(
    1091                     'description' => __( 'Login name for the resource.' ),
     1091                    'description' => __( 'Login name for the user.' ),
    10921092                    'type'        => 'string',
    10931093                    'context'     => array( 'edit' ),
     
    10981098                ),
    10991099                'name'        => array(
    1100                     'description' => __( 'Display name for the resource.' ),
     1100                    'description' => __( 'Display name for the user.' ),
    11011101                    'type'        => 'string',
    11021102                    'context'     => array( 'embed', 'view', 'edit' ),
     
    11061106                ),
    11071107                'first_name'  => array(
    1108                     'description' => __( 'First name for the resource.' ),
     1108                    'description' => __( 'First name for the user.' ),
    11091109                    'type'        => 'string',
    11101110                    'context'     => array( 'edit' ),
     
    11141114                ),
    11151115                'last_name'   => array(
    1116                     'description' => __( 'Last name for the resource.' ),
     1116                    'description' => __( 'Last name for the user.' ),
    11171117                    'type'        => 'string',
    11181118                    'context'     => array( 'edit' ),
     
    11221122                ),
    11231123                'email'       => array(
    1124                     'description' => __( 'The email address for the resource.' ),
     1124                    'description' => __( 'The email address for the user.' ),
    11251125                    'type'        => 'string',
    11261126                    'format'      => 'email',
     
    11291129                ),
    11301130                'url'         => array(
    1131                     'description' => __( 'URL of the resource.' ),
     1131                    'description' => __( 'URL of the user.' ),
    11321132                    'type'        => 'string',
    11331133                    'format'      => 'uri',
     
    11351135                ),
    11361136                'description' => array(
    1137                     'description' => __( 'Description of the resource.' ),
     1137                    'description' => __( 'Description of the user.' ),
    11381138                    'type'        => 'string',
    11391139                    'context'     => array( 'embed', 'view', 'edit' ),
    11401140                ),
    11411141                'link'        => array(
    1142                     'description' => __( 'Author URL of the resource.' ),
     1142                    'description' => __( 'Author URL of the user.' ),
    11431143                    'type'        => 'string',
    11441144                    'format'      => 'uri',
     
    11471147                ),
    11481148                'locale'    => array(
    1149                     'description' => __( 'Locale for the resource.' ),
     1149                    'description' => __( 'Locale for the user.' ),
    11501150                    'type'        => 'string',
    11511151                    'enum'        => array_merge( array( '', 'en_US' ), get_available_languages() ),
     
    11531153                ),
    11541154                'nickname'    => array(
    1155                     'description' => __( 'The nickname for the resource.' ),
     1155                    'description' => __( 'The nickname for the user.' ),
    11561156                    'type'        => 'string',
    11571157                    'context'     => array( 'edit' ),
     
    11611161                ),
    11621162                'slug'        => array(
    1163                     'description' => __( 'An alphanumeric identifier for the resource.' ),
     1163                    'description' => __( 'An alphanumeric identifier for the user.' ),
    11641164                    'type'        => 'string',
    11651165                    'context'     => array( 'embed', 'view', 'edit' ),
     
    11691169                ),
    11701170                'registered_date' => array(
    1171                     'description' => __( 'Registration date for the resource.' ),
     1171                    'description' => __( 'Registration date for the user.' ),
    11721172                    'type'        => 'string',
    11731173                    'format'      => 'date-time',
     
    11761176                ),
    11771177                'roles'           => array(
    1178                     'description' => __( 'Roles assigned to the resource.' ),
     1178                    'description' => __( 'Roles assigned to the user.' ),
    11791179                    'type'        => 'array',
    11801180                    'items'       => array(
     
    11841184                ),
    11851185                'password'        => array(
    1186                     'description' => __( 'Password for the resource (never included).' ),
     1186                    'description' => __( 'Password for the user (never included).' ),
    11871187                    'type'        => 'string',
    11881188                    'context'     => array(), // Password is never displayed.
     
    11931193                ),
    11941194                'capabilities'    => array(
    1195                     'description' => __( 'All capabilities assigned to the resource.' ),
     1195                    'description' => __( 'All capabilities assigned to the user.' ),
    11961196                    'type'        => 'object',
    11971197                    'context'     => array( 'edit' ),
     
    11991199                ),
    12001200                'extra_capabilities' => array(
    1201                     'description' => __( 'Any extra capabilities assigned to the resource.' ),
     1201                    'description' => __( 'Any extra capabilities assigned to the user.' ),
    12021202                    'type'        => 'object',
    12031203                    'context'     => array( 'edit' ),
     
    12231223
    12241224            $schema['properties']['avatar_urls']  = array(
    1225                 'description' => __( 'Avatar URLs for the resource.' ),
     1225                'description' => __( 'Avatar URLs for the user.' ),
    12261226                'type'        => 'object',
    12271227                'context'     => array( 'embed', 'view', 'edit' ),
     
    12951295
    12961296        $query_params['slug']    = array(
    1297             'description'        => __( 'Limit result set to resources with a specific slug.' ),
     1297            'description'        => __( 'Limit result set to users with a specific slug.' ),
    12981298            'type'               => 'string',
    12991299        );
    13001300
    13011301        $query_params['roles']   = array(
    1302             'description'        => __( 'Limit result set to resources matching at least one specific role provided. Accepts csv list or single role.' ),
     1302            'description'        => __( 'Limit result set to users matching at least one specific role provided. Accepts csv list or single role.' ),
    13031303            'type'               => 'array',
    13041304            'items'              => array(
Note: See TracChangeset for help on using the changeset viewer.