Jetpack_JSON_API_Get_Post_Backup_Endpoint

The WordPress Core Jetpack JSON API Get Post Backup Endpoint class.

Defined (1)

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

/json-endpoints/jetpack/class.jetpack-json-api-get-post-backup-endpoint.php  
  1. class Jetpack_JSON_API_Get_Post_Backup_Endpoint extends Jetpack_JSON_API_Endpoint { 
  2. // /sites/%s/posts/%d/backup -> $blog_id, $post_id 
  3.  
  4. protected $needed_capabilities = array(); 
  5. protected $post_id; 
  6.  
  7. function validate_input( $post_id ) { 
  8. if ( empty( $post_id ) || ! is_numeric( $post_id ) ) { 
  9. return new WP_Error( 'post_id_not_specified', __( 'You must specify a Post ID', 'jetpack' ) ); 
  10.  
  11. $this->post_id = intval( $post_id ); 
  12.  
  13. return true; 
  14.  
  15. protected function result() { 
  16. $post = get_post( $this->post_id ); 
  17. if ( empty( $post ) ) { 
  18. return new WP_Error( 'post_not_found', __( 'Post not found', 'jetpack' ) ); 
  19.  
  20. return array( 
  21. 'post' => (array)$post,  
  22. 'meta' => get_post_meta( $post->ID ),  
  23. ); 
  24.