summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/json-endpoints/class.wpcom-json-api-get-media-v1-2-endpoint.php')
-rw-r--r--plugins/jetpack/json-endpoints/class.wpcom-json-api-get-media-v1-2-endpoint.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/jetpack/json-endpoints/class.wpcom-json-api-get-media-v1-2-endpoint.php b/plugins/jetpack/json-endpoints/class.wpcom-json-api-get-media-v1-2-endpoint.php
new file mode 100644
index 00000000..e8219cf3
--- /dev/null
+++ b/plugins/jetpack/json-endpoints/class.wpcom-json-api-get-media-v1-2-endpoint.php
@@ -0,0 +1,23 @@
+<?php
+require_once( JETPACK__PLUGIN_DIR . 'sal/class.json-api-date.php' );
+
+class WPCOM_JSON_API_Get_Media_v1_2_Endpoint extends WPCOM_JSON_API_Get_Media_v1_1_Endpoint {
+ function callback( $path = '', $blog_id = 0, $media_id = 0 ) {
+ $response = parent::callback( $path, $blog_id, $media_id );
+
+ if ( is_wp_error( $response ) ) {
+ return $response;
+ }
+
+ $media_item = get_post( $media_id );
+ $response->modified = WPCOM_JSON_API_Date::format_date( $media_item->post_modified_gmt, $media_item->post_modified );
+
+ // expose `revision_history` object
+ $response->revision_history = (object) array(
+ 'items' => (array) Jetpack_Media::get_revision_history( $media_id ),
+ 'original' => (object) Jetpack_Media::get_original_media( $media_id )
+ );
+
+ return $response;
+ }
+}