- Timestamp:
- 05/02/2018 01:24:30 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php
r42343 r43087 341 341 setup_postdata( $post ); 342 342 343 $schema = $this->get_item_schema(); 344 345 $data = array(); 346 347 if ( ! empty( $schema['properties']['author'] ) ) { 343 $fields = $this->get_fields_for_response( $request ); 344 $data = array(); 345 346 if ( in_array( 'author', $fields, true ) ) { 348 347 $data['author'] = (int) $post->post_author; 349 348 } 350 349 351 if ( ! empty( $schema['properties']['date']) ) {350 if ( in_array( 'date', $fields, true ) ) { 352 351 $data['date'] = $this->prepare_date_response( $post->post_date_gmt, $post->post_date ); 353 352 } 354 353 355 if ( ! empty( $schema['properties']['date_gmt']) ) {354 if ( in_array( 'date_gmt', $fields, true ) ) { 356 355 $data['date_gmt'] = $this->prepare_date_response( $post->post_date_gmt ); 357 356 } 358 357 359 if ( ! empty( $schema['properties']['id']) ) {358 if ( in_array( 'id', $fields, true ) ) { 360 359 $data['id'] = $post->ID; 361 360 } 362 361 363 if ( ! empty( $schema['properties']['modified']) ) {362 if ( in_array( 'modified', $fields, true ) ) { 364 363 $data['modified'] = $this->prepare_date_response( $post->post_modified_gmt, $post->post_modified ); 365 364 } 366 365 367 if ( ! empty( $schema['properties']['modified_gmt']) ) {366 if ( in_array( 'modified_gmt', $fields, true ) ) { 368 367 $data['modified_gmt'] = $this->prepare_date_response( $post->post_modified_gmt ); 369 368 } 370 369 371 if ( ! empty( $schema['properties']['parent']) ) {370 if ( in_array( 'parent', $fields, true ) ) { 372 371 $data['parent'] = (int) $post->post_parent; 373 372 } 374 373 375 if ( ! empty( $schema['properties']['slug']) ) {374 if ( in_array( 'slug', $fields, true ) ) { 376 375 $data['slug'] = $post->post_name; 377 376 } 378 377 379 if ( ! empty( $schema['properties']['guid']) ) {378 if ( in_array( 'guid', $fields, true ) ) { 380 379 $data['guid'] = array( 381 380 /** This filter is documented in wp-includes/post-template.php */ … … 385 384 } 386 385 387 if ( ! empty( $schema['properties']['title']) ) {386 if ( in_array( 'title', $fields, true ) ) { 388 387 $data['title'] = array( 389 388 'raw' => $post->post_title, … … 392 391 } 393 392 394 if ( ! empty( $schema['properties']['content']) ) {393 if ( in_array( 'content', $fields, true ) ) { 395 394 396 395 $data['content'] = array( … … 401 400 } 402 401 403 if ( ! empty( $schema['properties']['excerpt']) ) {402 if ( in_array( 'excerpt', $fields, true ) ) { 404 403 $data['excerpt'] = array( 405 404 'raw' => $post->post_excerpt,
Note: See TracChangeset
for help on using the changeset viewer.