Changeset 39342
- Timestamp:
- 11/23/2016 02:42:00 AM (8 years ago)
- 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 77 77 78 78 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() ) ); 80 80 } 81 81 } … … 379 379 380 380 $schema['properties']['alt_text'] = array( 381 'description' => __( 'Alternative text to display when resourceis not displayed.' ),381 'description' => __( 'Alternative text to display when attachment is not displayed.' ), 382 382 'type' => 'string', 383 383 'context' => array( 'view', 'edit', 'embed' ), … … 388 388 389 389 $schema['properties']['caption'] = array( 390 'description' => __( 'The caption for the resource.' ),390 'description' => __( 'The attachment caption.' ), 391 391 'type' => 'object', 392 392 'context' => array( 'view', 'edit', 'embed' ), … … 396 396 'properties' => array( 397 397 '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.' ), 399 399 'type' => 'string', 400 400 'context' => array( 'edit' ), 401 401 ), 402 402 'rendered' => array( 403 'description' => __( 'HTML caption for the resource, transformed for display.' ),403 'description' => __( 'HTML caption for the attachment, transformed for display.' ), 404 404 'type' => 'string', 405 405 'context' => array( 'view', 'edit', 'embed' ), … … 410 410 411 411 $schema['properties']['description'] = array( 412 'description' => __( 'The description for the resource.' ),412 'description' => __( 'The attachment description.' ), 413 413 'type' => 'object', 414 414 'context' => array( 'view', 'edit' ), … … 432 432 433 433 $schema['properties']['media_type'] = array( 434 'description' => __( ' Type of resource.' ),434 'description' => __( 'Attachment type.' ), 435 435 'type' => 'string', 436 436 'enum' => array( 'image', 'file' ), … … 440 440 441 441 $schema['properties']['mime_type'] = array( 442 'description' => __( ' MIME type of resource.' ),442 'description' => __( 'The attachment MIME type.' ), 443 443 'type' => 'string', 444 444 'context' => array( 'view', 'edit', 'embed' ), … … 447 447 448 448 $schema['properties']['media_details'] = array( 449 'description' => __( 'Details about the resourcefile, specific to its type.' ),449 'description' => __( 'Details about the media file, specific to its type.' ), 450 450 'type' => 'object', 451 451 'context' => array( 'view', 'edit', 'embed' ), … … 454 454 455 455 $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.' ), 457 457 'type' => 'integer', 458 458 'context' => array( 'view', 'edit' ), … … 460 460 461 461 $schema['properties']['source_url'] = array( 462 'description' => __( 'URL to the original resourcefile.' ),462 'description' => __( 'URL to the original attachment file.' ), 463 463 'type' => 'string', 464 464 'format' => 'uri', -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
r39337 r39342 1288 1288 1289 1289 $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.' ), 1291 1291 'type' => 'string', 1292 1292 'format' => 'date-time', … … 1317 1317 1318 1318 $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.' ), 1320 1320 'type' => 'string', 1321 1321 'format' => 'date-time', … … 1372 1372 $query_params['parent'] = array( 1373 1373 'default' => array(), 1374 'description' => __( 'Limit result set to resources of specific parent IDs.' ),1374 'description' => __( 'Limit result set to comments of specific parent IDs.' ), 1375 1375 'type' => 'array', 1376 1376 'items' => array( … … 1390 1390 $query_params['post'] = array( 1391 1391 '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.' ), 1393 1393 'type' => 'array', 1394 1394 'items' => array( -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php
r39313 r39342 126 126 127 127 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 ) ); 129 129 } 130 130 … … 132 132 133 133 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() ) ); 135 135 } 136 136 … … 178 178 179 179 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 ) ); 181 181 } 182 182 … … 249 249 'properties' => array( 250 250 'name' => array( 251 'description' => __( 'The title for the resource.' ),251 'description' => __( 'The title for the status.' ), 252 252 'type' => 'string', 253 253 'context' => array( 'embed', 'view', 'edit' ), … … 255 255 ), 256 256 'private' => array( 257 'description' => __( 'Whether posts with this resourceshould be private.' ),257 'description' => __( 'Whether posts with this status should be private.' ), 258 258 'type' => 'boolean', 259 259 'context' => array( 'edit' ), … … 261 261 ), 262 262 'protected' => array( 263 'description' => __( 'Whether posts with this resourceshould be protected.' ),263 'description' => __( 'Whether posts with this status should be protected.' ), 264 264 'type' => 'boolean', 265 265 'context' => array( 'edit' ), … … 267 267 ), 268 268 'public' => array( 269 'description' => __( 'Whether posts of this resourceshould 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.' ), 270 270 'type' => 'boolean', 271 271 'context' => array( 'view', 'edit' ), … … 273 273 ), 274 274 'queryable' => array( 275 'description' => __( 'Whether posts with this resourceshould be publicly-queryable.' ),275 'description' => __( 'Whether posts with this status should be publicly-queryable.' ), 276 276 'type' => 'boolean', 277 277 'context' => array( 'view', 'edit' ), … … 285 285 ), 286 286 'slug' => array( 287 'description' => __( 'An alphanumeric identifier for the resource.' ),287 'description' => __( 'An alphanumeric identifier for the status.' ), 288 288 'type' => 'string', 289 289 'context' => array( 'embed', 'view', 'edit' ), -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php
r39313 r39342 120 120 121 121 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 ) ); 123 123 } 124 124 125 125 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() ) ); 127 127 } 128 128 … … 205 205 'properties' => array( 206 206 'capabilities' => array( 207 'description' => __( 'All capabilities used by the resource.' ),207 'description' => __( 'All capabilities used by the post type.' ), 208 208 'type' => 'object', 209 209 'context' => array( 'edit' ), … … 211 211 ), 212 212 'description' => array( 213 'description' => __( 'A human-readable description of the resource.' ),213 'description' => __( 'A human-readable description of the post type.' ), 214 214 'type' => 'string', 215 215 'context' => array( 'view', 'edit' ), … … 217 217 ), 218 218 'hierarchical' => array( 219 'description' => __( 'Whether or not the resource should have children.' ),219 'description' => __( 'Whether or not the post type should have children.' ), 220 220 'type' => 'boolean', 221 221 'context' => array( 'view', 'edit' ), … … 223 223 ), 224 224 '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.' ), 226 226 'type' => 'object', 227 227 'context' => array( 'edit' ), … … 229 229 ), 230 230 'name' => array( 231 'description' => __( 'The title for the resource.' ),231 'description' => __( 'The title for the post type.' ), 232 232 'type' => 'string', 233 233 'context' => array( 'view', 'edit', 'embed' ), … … 235 235 ), 236 236 'slug' => array( 237 'description' => __( 'An alphanumeric identifier for the resource.' ),237 'description' => __( 'An alphanumeric identifier for the post type.' ), 238 238 'type' => 'string', 239 239 'context' => array( 'view', 'edit', 'embed' ), … … 241 241 ), 242 242 'taxonomies' => array( 243 'description' => __( 'Taxonomies associated with resource.' ),243 'description' => __( 'Taxonomies associated with post type.' ), 244 244 'type' => 'array', 245 245 'items' => array( … … 250 250 ), 251 251 'rest_base' => array( 252 'description' => __( 'REST base route for the resource.' ),252 'description' => __( 'REST base route for the post type.' ), 253 253 'type' => 'string', 254 254 'context' => array( 'view', 'edit', 'embed' ), -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
r39322 r39342 1964 1964 1965 1965 $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.' ), 1967 1967 'type' => 'string', 1968 1968 'format' => 'date-time', … … 1989 1989 1990 1990 $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.' ), 1992 1992 'type' => 'string', 1993 1993 'format' => 'date-time', … … 2014 2014 if ( 'page' === $this->post_type || post_type_supports( $this->post_type, 'page-attributes' ) ) { 2015 2015 $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.' ), 2017 2017 'type' => 'integer', 2018 2018 ); -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php
r39264 r39342 12 12 * 13 13 * @since 4.7.0 14 * 14 *0 15 15 * @see WP_REST_Controller 16 16 */ … … 98 98 'type' => 'boolean', 99 99 'default' => false, 100 'description' => __( 'Required to be true, as re source doesnot support trashing.' ),100 'description' => __( 'Required to be true, as revisions do not support trashing.' ), 101 101 ), 102 102 ), … … 228 228 $force = isset( $request['force'] ) ? (bool) $request['force'] : false; 229 229 230 // We don't support trashing for this resource type.230 // We don't support trashing for revisions. 231 231 if ( ! $force ) { 232 232 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 161 161 $tax_obj = get_taxonomy( $request['taxonomy'] ); 162 162 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 ) ); 164 164 } 165 165 $data = $this->prepare_item_for_response( $tax_obj, $request ); … … 236 236 'properties' => array( 237 237 'capabilities' => array( 238 'description' => __( 'All capabilities used by the resource.' ),238 'description' => __( 'All capabilities used by the taxonomy.' ), 239 239 'type' => 'object', 240 240 'context' => array( 'edit' ), … … 242 242 ), 243 243 'description' => array( 244 'description' => __( 'A human-readable description of the resource.' ),244 'description' => __( 'A human-readable description of the taxonomy.' ), 245 245 'type' => 'string', 246 246 'context' => array( 'view', 'edit' ), … … 248 248 ), 249 249 'hierarchical' => array( 250 'description' => __( 'Whether or not the resourceshould have children.' ),250 'description' => __( 'Whether or not the taxonomy should have children.' ), 251 251 'type' => 'boolean', 252 252 'context' => array( 'view', 'edit' ), … … 254 254 ), 255 255 'labels' => array( 256 'description' => __( 'Human-readable labels for the resourcefor various contexts.' ),256 'description' => __( 'Human-readable labels for the taxonomy for various contexts.' ), 257 257 'type' => 'object', 258 258 'context' => array( 'edit' ), … … 260 260 ), 261 261 'name' => array( 262 'description' => __( 'The title for the resource.' ),262 'description' => __( 'The title for the taxonomy.' ), 263 263 'type' => 'string', 264 264 'context' => array( 'view', 'edit', 'embed' ), … … 266 266 ), 267 267 'slug' => array( 268 'description' => __( 'An alphanumeric identifier for the resource.' ),268 'description' => __( 'An alphanumeric identifier for the taxonomy.' ), 269 269 'type' => 'string', 270 270 'context' => array( 'view', 'edit', 'embed' ), … … 278 278 ), 279 279 'types' => array( 280 'description' => __( 'Types associated with resource.' ),280 'description' => __( 'Types associated with the taxonomy.' ), 281 281 'type' => 'array', 282 282 'items' => array( … … 287 287 ), 288 288 'rest_base' => array( 289 'description' => __( 'REST base route for the resource.' ),289 'description' => __( 'REST base route for the taxonomy.' ), 290 290 'type' => 'string', 291 291 'context' => array( 'view', 'edit', 'embed' ), … … 309 309 $new_params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); 310 310 $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.' ), 312 312 'type' => 'string', 313 313 ); -
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 ); -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
r39313 r39342 88 88 'type' => 'boolean', 89 89 'default' => false, 90 'description' => __( 'Required to be true, as resource doesnot support trashing.' ),90 'description' => __( 'Required to be true, as users do not support trashing.' ), 91 91 ), 92 92 'reassign' => array( … … 121 121 'type' => 'boolean', 122 122 'default' => false, 123 'description' => __( 'Required to be true, as resource doesnot support trashing.' ),123 'description' => __( 'Required to be true, as users do not support trashing.' ), 124 124 ), 125 125 'reassign' => array( … … 145 145 // Check if roles is specified in GET request and if user can list users. 146 146 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() ) ); 148 148 } 149 149 … … 153 153 154 154 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() ) ); 156 156 } 157 157 … … 313 313 314 314 if ( empty( $id ) || empty( $user->ID ) ) { 315 return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resourceID.' ), array( 'status' => 404 ) );315 return new WP_Error( 'rest_user_invalid_id', __( 'Invalid user ID.' ), array( 'status' => 404 ) ); 316 316 } 317 317 … … 343 343 344 344 if ( empty( $id ) || empty( $user->ID ) ) { 345 return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resourceID.' ), array( 'status' => 404 ) );345 return new WP_Error( 'rest_user_invalid_id', __( 'Invalid user ID.' ), array( 'status' => 404 ) ); 346 346 } 347 347 … … 388 388 389 389 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() ) ); 391 391 } 392 392 … … 405 405 public function create_item( $request ) { 406 406 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 ) ); 408 408 } 409 409 … … 441 441 442 442 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 ) ); 444 444 } 445 445 … … 516 516 517 517 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() ) ); 519 519 } 520 520 521 521 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() ) ); 523 523 } 524 524 … … 540 540 541 541 if ( ! $user ) { 542 return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resourceID.' ), array( 'status' => 404 ) );542 return new WP_Error( 'rest_user_invalid_id', __( 'Invalid user ID.' ), array( 'status' => 404 ) ); 543 543 } 544 544 … … 655 655 656 656 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() ) ); 658 658 } 659 659 … … 675 675 $force = isset( $request['force'] ) ? (bool) $request['force'] : false; 676 676 677 // We don't support trashing for this type, error out.677 // We don't support trashing for users. 678 678 if ( ! $force ) { 679 679 return new WP_Error( 'rest_trash_not_supported', __( 'Users do not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) ); … … 683 683 684 684 if ( ! $user ) { 685 return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resourceID.' ), array( 'status' => 404 ) );685 return new WP_Error( 'rest_user_invalid_id', __( 'Invalid user ID.' ), array( 'status' => 404 ) ); 686 686 } 687 687 688 688 if ( ! empty( $reassign ) ) { 689 689 if ( $reassign === $id || ! get_userdata( $reassign ) ) { 690 return new WP_Error( 'rest_user_invalid_reassign', __( 'Invalid resourceID for reassignment.' ), array( 'status' => 400 ) );690 return new WP_Error( 'rest_user_invalid_reassign', __( 'Invalid user ID for reassignment.' ), array( 'status' => 400 ) ); 691 691 } 692 692 } … … 702 702 703 703 if ( ! $result ) { 704 return new WP_Error( 'rest_cannot_delete', __( 'The resourcecannot be deleted.' ), array( 'status' => 500 ) );704 return new WP_Error( 'rest_cannot_delete', __( 'The user cannot be deleted.' ), array( 'status' => 500 ) ); 705 705 } 706 706 … … 996 996 && ! $potential_role->has_cap( 'edit_users' ) 997 997 ) { 998 return new WP_Error( 'rest_user_invalid_role', __( 'Sorry, you are not allowed to give resourcethat 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() ) ); 999 999 } 1000 1000 … … 1006 1006 1007 1007 if ( empty( $editable_roles[ $role ] ) ) { 1008 return new WP_Error( 'rest_user_invalid_role', __( 'Sorry, you are not allowed to give resourcethat 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 ) ); 1009 1009 } 1010 1010 } … … 1083 1083 'properties' => array( 1084 1084 'id' => array( 1085 'description' => __( 'Unique identifier for the resource.' ),1085 'description' => __( 'Unique identifier for the user.' ), 1086 1086 'type' => 'integer', 1087 1087 'context' => array( 'embed', 'view', 'edit' ), … … 1089 1089 ), 1090 1090 'username' => array( 1091 'description' => __( 'Login name for the resource.' ),1091 'description' => __( 'Login name for the user.' ), 1092 1092 'type' => 'string', 1093 1093 'context' => array( 'edit' ), … … 1098 1098 ), 1099 1099 'name' => array( 1100 'description' => __( 'Display name for the resource.' ),1100 'description' => __( 'Display name for the user.' ), 1101 1101 'type' => 'string', 1102 1102 'context' => array( 'embed', 'view', 'edit' ), … … 1106 1106 ), 1107 1107 'first_name' => array( 1108 'description' => __( 'First name for the resource.' ),1108 'description' => __( 'First name for the user.' ), 1109 1109 'type' => 'string', 1110 1110 'context' => array( 'edit' ), … … 1114 1114 ), 1115 1115 'last_name' => array( 1116 'description' => __( 'Last name for the resource.' ),1116 'description' => __( 'Last name for the user.' ), 1117 1117 'type' => 'string', 1118 1118 'context' => array( 'edit' ), … … 1122 1122 ), 1123 1123 'email' => array( 1124 'description' => __( 'The email address for the resource.' ),1124 'description' => __( 'The email address for the user.' ), 1125 1125 'type' => 'string', 1126 1126 'format' => 'email', … … 1129 1129 ), 1130 1130 'url' => array( 1131 'description' => __( 'URL of the resource.' ),1131 'description' => __( 'URL of the user.' ), 1132 1132 'type' => 'string', 1133 1133 'format' => 'uri', … … 1135 1135 ), 1136 1136 'description' => array( 1137 'description' => __( 'Description of the resource.' ),1137 'description' => __( 'Description of the user.' ), 1138 1138 'type' => 'string', 1139 1139 'context' => array( 'embed', 'view', 'edit' ), 1140 1140 ), 1141 1141 'link' => array( 1142 'description' => __( 'Author URL of the resource.' ),1142 'description' => __( 'Author URL of the user.' ), 1143 1143 'type' => 'string', 1144 1144 'format' => 'uri', … … 1147 1147 ), 1148 1148 'locale' => array( 1149 'description' => __( 'Locale for the resource.' ),1149 'description' => __( 'Locale for the user.' ), 1150 1150 'type' => 'string', 1151 1151 'enum' => array_merge( array( '', 'en_US' ), get_available_languages() ), … … 1153 1153 ), 1154 1154 'nickname' => array( 1155 'description' => __( 'The nickname for the resource.' ),1155 'description' => __( 'The nickname for the user.' ), 1156 1156 'type' => 'string', 1157 1157 'context' => array( 'edit' ), … … 1161 1161 ), 1162 1162 'slug' => array( 1163 'description' => __( 'An alphanumeric identifier for the resource.' ),1163 'description' => __( 'An alphanumeric identifier for the user.' ), 1164 1164 'type' => 'string', 1165 1165 'context' => array( 'embed', 'view', 'edit' ), … … 1169 1169 ), 1170 1170 'registered_date' => array( 1171 'description' => __( 'Registration date for the resource.' ),1171 'description' => __( 'Registration date for the user.' ), 1172 1172 'type' => 'string', 1173 1173 'format' => 'date-time', … … 1176 1176 ), 1177 1177 'roles' => array( 1178 'description' => __( 'Roles assigned to the resource.' ),1178 'description' => __( 'Roles assigned to the user.' ), 1179 1179 'type' => 'array', 1180 1180 'items' => array( … … 1184 1184 ), 1185 1185 'password' => array( 1186 'description' => __( 'Password for the resource(never included).' ),1186 'description' => __( 'Password for the user (never included).' ), 1187 1187 'type' => 'string', 1188 1188 'context' => array(), // Password is never displayed. … … 1193 1193 ), 1194 1194 'capabilities' => array( 1195 'description' => __( 'All capabilities assigned to the resource.' ),1195 'description' => __( 'All capabilities assigned to the user.' ), 1196 1196 'type' => 'object', 1197 1197 'context' => array( 'edit' ), … … 1199 1199 ), 1200 1200 'extra_capabilities' => array( 1201 'description' => __( 'Any extra capabilities assigned to the resource.' ),1201 'description' => __( 'Any extra capabilities assigned to the user.' ), 1202 1202 'type' => 'object', 1203 1203 'context' => array( 'edit' ), … … 1223 1223 1224 1224 $schema['properties']['avatar_urls'] = array( 1225 'description' => __( 'Avatar URLs for the resource.' ),1225 'description' => __( 'Avatar URLs for the user.' ), 1226 1226 'type' => 'object', 1227 1227 'context' => array( 'embed', 'view', 'edit' ), … … 1295 1295 1296 1296 $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.' ), 1298 1298 'type' => 'string', 1299 1299 ); 1300 1300 1301 1301 $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.' ), 1303 1303 'type' => 'array', 1304 1304 'items' => array(
Note: See TracChangeset
for help on using the changeset viewer.