Make WordPress Core


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

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

Props ramiy.
Fixes #38811.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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                );
Note: See TracChangeset for help on using the changeset viewer.