WPCOM_JSON_API_Get_Media_v1_2_Endpoint

The WordPress Core WPCOM JSON API Get Media v1 2 Endpoint class.

Defined (1)

The class is defined in the following location(s).

/json-endpoints/class.wpcom-json-api-get-media-v1-2-endpoint.php  
  1. class WPCOM_JSON_API_Get_Media_v1_2_Endpoint extends WPCOM_JSON_API_Get_Media_v1_1_Endpoint { 
  2. function callback( $path = '', $blog_id = 0, $media_id = 0 ) { 
  3. $response = parent::callback( $path, $blog_id, $media_id ); 
  4.  
  5. if ( is_wp_error( $response ) ) { 
  6. return $response; 
  7.  
  8. $media_item = get_post( $media_id ); 
  9. $response->modified = WPCOM_JSON_API_Date::format_date( $media_item->post_modified_gmt, $media_item->post_modified ); 
  10.  
  11. // expose `revision_history` object 
  12. $response->revision_history = (object) array( 
  13. 'items' => (array) Jetpack_Media::get_revision_history( $media_id ),  
  14. 'original' => (object) Jetpack_Media::get_original_media( $media_id ) 
  15. ); 
  16.  
  17. return $response;