Jetpack_JSON_API_Sync_Object

The WordPress Core Jetpack JSON API Sync Object class.

Defined (1)

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

/json-endpoints/jetpack/class.jetpack-json-api-sync-endpoint.php  
  1. class Jetpack_JSON_API_Sync_Object extends Jetpack_JSON_API_Sync_Endpoint { 
  2. protected function result() { 
  3. $args = $this->query_args(); 
  4.  
  5. $module_name = $args['module_name']; 
  6.  
  7. require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-modules.php'; 
  8.  
  9. if ( ! $sync_module = Jetpack_Sync_Modules::get_module( $module_name ) ) { 
  10. return new WP_Error( 'invalid_module', 'You specified an invalid sync module' ); 
  11.  
  12. $object_type = $args['object_type']; 
  13. $object_ids = $args['object_ids']; 
  14.  
  15. require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-sender.php'; 
  16. $codec = Jetpack_Sync_Sender::get_instance()->get_codec(); 
  17.  
  18. Jetpack_Sync_Settings::set_is_syncing( true ); 
  19. $objects = $codec->encode( $sync_module->get_objects_by_id( $object_type, $object_ids ) ); 
  20. Jetpack_Sync_Settings::set_is_syncing( false ); 
  21.  
  22. return array( 
  23. 'objects' => $objects,  
  24. );