Changeset 43445 for branches/4.9/src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php
- Timestamp:
- 07/13/2018 06:50:51 AM (7 years ago)
- Location:
- branches/4.9
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
-
branches/4.9/src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php
r41731 r43445 332 332 setup_postdata( $post ); 333 333 334 $schema = $this->get_item_schema(); 335 336 $data = array(); 337 338 if ( ! empty( $schema['properties']['author'] ) ) { 334 $fields = $this->get_fields_for_response( $request ); 335 $data = array(); 336 337 if ( in_array( 'author', $fields, true ) ) { 339 338 $data['author'] = (int) $post->post_author; 340 339 } 341 340 342 if ( ! empty( $schema['properties']['date']) ) {341 if ( in_array( 'date', $fields, true ) ) { 343 342 $data['date'] = $this->prepare_date_response( $post->post_date_gmt, $post->post_date ); 344 343 } 345 344 346 if ( ! empty( $schema['properties']['date_gmt']) ) {345 if ( in_array( 'date_gmt', $fields, true ) ) { 347 346 $data['date_gmt'] = $this->prepare_date_response( $post->post_date_gmt ); 348 347 } 349 348 350 if ( ! empty( $schema['properties']['id']) ) {349 if ( in_array( 'id', $fields, true ) ) { 351 350 $data['id'] = $post->ID; 352 351 } 353 352 354 if ( ! empty( $schema['properties']['modified']) ) {353 if ( in_array( 'modified', $fields, true ) ) { 355 354 $data['modified'] = $this->prepare_date_response( $post->post_modified_gmt, $post->post_modified ); 356 355 } 357 356 358 if ( ! empty( $schema['properties']['modified_gmt']) ) {357 if ( in_array( 'modified_gmt', $fields, true ) ) { 359 358 $data['modified_gmt'] = $this->prepare_date_response( $post->post_modified_gmt ); 360 359 } 361 360 362 if ( ! empty( $schema['properties']['parent']) ) {361 if ( in_array( 'parent', $fields, true ) ) { 363 362 $data['parent'] = (int) $post->post_parent; 364 363 } 365 364 366 if ( ! empty( $schema['properties']['slug']) ) {365 if ( in_array( 'slug', $fields, true ) ) { 367 366 $data['slug'] = $post->post_name; 368 367 } 369 368 370 if ( ! empty( $schema['properties']['guid']) ) {369 if ( in_array( 'guid', $fields, true ) ) { 371 370 $data['guid'] = array( 372 371 /** This filter is documented in wp-includes/post-template.php */ … … 376 375 } 377 376 378 if ( ! empty( $schema['properties']['title']) ) {377 if ( in_array( 'title', $fields, true ) ) { 379 378 $data['title'] = array( 380 379 'raw' => $post->post_title, … … 383 382 } 384 383 385 if ( ! empty( $schema['properties']['content']) ) {384 if ( in_array( 'content', $fields, true ) ) { 386 385 387 386 $data['content'] = array( … … 392 391 } 393 392 394 if ( ! empty( $schema['properties']['excerpt']) ) {393 if ( in_array( 'excerpt', $fields, true ) ) { 395 394 $data['excerpt'] = array( 396 395 'raw' => $post->post_excerpt,
Note: See TracChangeset
for help on using the changeset viewer.