400 ) ); } forward_activity( $activity ); switch ( $activity['type'] ) { case 'Create': $activity = \create\handle_inbox( $actor_slug, $activity ); break; case 'Update': $activity = \update\handle_inbox( $actor_slug, $activity ); break; case 'Delete': $activity = \delete\handle_inbox( $actor_slug, $activity ); break; case 'Follow': break; case 'Accept': break; case 'Reject': break; case 'Add': break; case 'Remove': break; case 'Announce': break; case 'Undo': break; } if ( is_wp_error( $activity ) ) { return $activity; } return persist_activity( $actor_slug, $activity ); } function forward_activity( $activity ) { // TODO } function persist_activity( $actory_slug, $activity ) { global $wpdb; $activity = \activities\persist_activity( $activity ); if ( is_wp_error( $activity ) ) { return $activity; } $activity_id = $wpdb->insert_id; $actor_id = \actors\get_actor_id( $actor_slug ); $wpdb->insert( 'pterotype_inbox', array( 'actor_id' => $actor_id, 'activity_id' => $activity_id, ) ); $response = new \WP_Rest_Response(); return $response; } ?>