Changeset 47138 for trunk/src/wp-includes/rest-api/class-wp-rest-server.php
- Timestamp:
- 01/30/2020 08:20:30 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/class-wp-rest-server.php
r47122 r47138 78 78 */ 79 79 protected $route_options = array(); 80 81 /** 82 * Caches embedded requests. 83 * 84 * @since 5.4.0 85 * @var array 86 */ 87 protected $embed_cache = array(); 80 88 81 89 /** … … 463 471 464 472 if ( $embed ) { 473 $this->embed_cache = array(); 465 474 // Determine if this is a numeric array. 466 475 if ( wp_is_numeric_array( $data ) ) { … … 469 478 $data = $this->embed_links( $data ); 470 479 } 480 $this->embed_cache = array(); 471 481 } 472 482 … … 589 599 } 590 600 591 // Run through our internal routing and serve. 592 $request = WP_REST_Request::from_url( $item['href'] ); 593 if ( ! $request ) { 594 $embeds[] = array(); 595 continue; 596 } 597 598 // Embedded resources get passed context=embed. 599 if ( empty( $request['context'] ) ) { 600 $request['context'] = 'embed'; 601 } 602 603 $response = $this->dispatch( $request ); 604 605 /** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */ 606 $response = apply_filters( 'rest_post_dispatch', rest_ensure_response( $response ), $this, $request ); 607 608 $embeds[] = $this->response_to_data( $response, false ); 601 if ( ! array_key_exists( $item['href'], $this->embed_cache ) ) { 602 // Run through our internal routing and serve. 603 $request = WP_REST_Request::from_url( $item['href'] ); 604 if ( ! $request ) { 605 $embeds[] = array(); 606 continue; 607 } 608 609 // Embedded resources get passed context=embed. 610 if ( empty( $request['context'] ) ) { 611 $request['context'] = 'embed'; 612 } 613 614 $response = $this->dispatch( $request ); 615 616 /** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */ 617 $response = apply_filters( 'rest_post_dispatch', rest_ensure_response( $response ), $this, $request ); 618 619 $this->embed_cache[ $item['href'] ] = $this->response_to_data( $response, false ); 620 } 621 622 $embeds[] = $this->embed_cache[ $item['href'] ]; 609 623 } 610 624
Note: See TracChangeset
for help on using the changeset viewer.