- Timestamp:
- 11/23/2016 02:42:00 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
r39309 r39342 119 119 'type' => 'boolean', 120 120 'default' => false, 121 'description' => __( 'Required to be true, as resource doesnot support trashing.' ),121 'description' => __( 'Required to be true, as terms do not support trashing.' ), 122 122 ), 123 123 ), … … 322 322 323 323 if ( ! $term || $term->taxonomy !== $this->taxonomy ) { 324 return new WP_Error( 'rest_term_invalid', __( " Resourcedoesn't exist." ), array( 'status' => 404 ) );324 return new WP_Error( 'rest_term_invalid', __( "Term doesn't exist." ), array( 'status' => 404 ) ); 325 325 } 326 326 … … 351 351 $taxonomy_obj = get_taxonomy( $this->taxonomy ); 352 352 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() ) ); 354 354 } 355 355 … … 369 369 if ( isset( $request['parent'] ) ) { 370 370 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 ) ); 372 372 } 373 373 … … 375 375 376 376 if ( ! $parent ) { 377 return new WP_Error( 'rest_term_invalid', __( "Parent resourcedoesn't exist." ), array( 'status' => 400 ) );377 return new WP_Error( 'rest_term_invalid', __( "Parent term doesn't exist." ), array( 'status' => 400 ) ); 378 378 } 379 379 } … … 454 454 455 455 if ( ! $term ) { 456 return new WP_Error( 'rest_term_invalid', __( " Resourcedoesn't exist." ), array( 'status' => 404 ) );456 return new WP_Error( 'rest_term_invalid', __( "Term doesn't exist." ), array( 'status' => 404 ) ); 457 457 } 458 458 459 459 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() ) ); 461 461 } 462 462 … … 476 476 if ( isset( $request['parent'] ) ) { 477 477 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 ) ); 479 479 } 480 480 … … 482 482 483 483 if ( ! $parent ) { 484 return new WP_Error( 'rest_term_invalid', __( "Parent resourcedoesn't exist." ), array( 'status' => 400 ) );484 return new WP_Error( 'rest_term_invalid', __( "Parent term doesn't exist." ), array( 'status' => 400 ) ); 485 485 } 486 486 } … … 543 543 544 544 if ( ! $term ) { 545 return new WP_Error( 'rest_term_invalid', __( " Resourcedoesn't exist." ), array( 'status' => 404 ) );545 return new WP_Error( 'rest_term_invalid', __( "Term doesn't exist." ), array( 'status' => 404 ) ); 546 546 } 547 547 548 548 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() ) ); 550 550 } 551 551 … … 566 566 $force = isset( $request['force'] ) ? (bool) $request['force'] : false; 567 567 568 // We don't support trashing for t his resource type.568 // We don't support trashing for terms. 569 569 if ( ! $force ) { 570 570 return new WP_Error( 'rest_trash_not_supported', __( 'Terms do not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) ); … … 580 580 581 581 if ( ! $retval ) { 582 return new WP_Error( 'rest_cannot_delete', __( 'The resourcecannot be deleted.' ), array( 'status' => 500 ) );582 return new WP_Error( 'rest_cannot_delete', __( 'The term cannot be deleted.' ), array( 'status' => 500 ) ); 583 583 } 584 584 … … 807 807 'properties' => array( 808 808 'id' => array( 809 'description' => __( 'Unique identifier for the resource.' ),809 'description' => __( 'Unique identifier for the term.' ), 810 810 'type' => 'integer', 811 811 'context' => array( 'view', 'embed', 'edit' ), … … 813 813 ), 814 814 'count' => array( 815 'description' => __( 'Number of published posts for the resource.' ),815 'description' => __( 'Number of published posts for the term.' ), 816 816 'type' => 'integer', 817 817 'context' => array( 'view', 'edit' ), … … 819 819 ), 820 820 'description' => array( 821 'description' => __( 'HTML description of the resource.' ),821 'description' => __( 'HTML description of the term.' ), 822 822 'type' => 'string', 823 823 'context' => array( 'view', 'edit' ), 824 824 ), 825 825 'link' => array( 826 'description' => __( 'URL of the resource.' ),826 'description' => __( 'URL of the term.' ), 827 827 'type' => 'string', 828 828 'format' => 'uri', … … 831 831 ), 832 832 'name' => array( 833 'description' => __( 'HTML title for the resource.' ),833 'description' => __( 'HTML title for the term.' ), 834 834 'type' => 'string', 835 835 'context' => array( 'view', 'embed', 'edit' ), … … 840 840 ), 841 841 'slug' => array( 842 'description' => __( 'An alphanumeric identifier for the resourceunique to its type.' ),842 'description' => __( 'An alphanumeric identifier for the term unique to its type.' ), 843 843 'type' => 'string', 844 844 'context' => array( 'view', 'embed', 'edit' ), … … 848 848 ), 849 849 'taxonomy' => array( 850 'description' => __( 'Type attribution for the resource.' ),850 'description' => __( 'Type attribution for the term.' ), 851 851 'type' => 'string', 852 852 'enum' => array_keys( get_taxonomies() ), … … 861 861 if ( $taxonomy->hierarchical ) { 862 862 $schema['properties']['parent'] = array( 863 'description' => __( 'The ID for the parent of the resource.' ),863 'description' => __( 'The parent term ID.' ), 864 864 'type' => 'integer', 865 865 'context' => array( 'view', 'edit' ), … … 922 922 923 923 $query_params['orderby'] = array( 924 'description' => __( 'Sort collection by resourceattribute.' ),924 'description' => __( 'Sort collection by term attribute.' ), 925 925 'type' => 'string', 926 926 'default' => 'name', … … 937 937 938 938 $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.' ), 940 940 'type' => 'boolean', 941 941 'default' => false, … … 944 944 if ( $taxonomy->hierarchical ) { 945 945 $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.' ), 947 947 'type' => 'integer', 948 948 ); … … 950 950 951 951 $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.' ), 953 953 'type' => 'integer', 954 954 'default' => null, … … 956 956 957 957 $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.' ), 959 959 'type' => 'string', 960 960 );
Note: See TracChangeset
for help on using the changeset viewer.