get_actor_object()->get_id(), $activity, ); } /** * Send "Ignore" response. * * @param string $actor The actors ActivityPub ID which sends the response. * @param array $activity_object The Activity object that gets ignored. * @param string $to The target actor. */ public static function send_ignore_response( $actor, $activity_object, $to = null ) { if ( ! $to && array_key_exists( 'actor', $activity_object ) ) { $to = object_to_uri( $activity_object['actor'] ); } if ( ! $to ) { return; } // Only send minimal data. $activity_object = array_intersect_key( $activity_object, array_flip( array( 'id', 'type', 'actor', 'object', ) ) ); $to = Actors::get_by_resource( $to ); $actor = Actors::get_by_resource( $actor ); // Get inbox. $inbox = $to->get_shared_inbox(); // Send "Ignore" activity. $activity = new Activity(); $activity->set_type( 'Ignore' ); $activity->set_object( $activity_object ); $activity->set_actor( $actor->get_id() ); $activity->set_to( $to ); $activity->set_id( $actor->get_id() . '#ignore-' . \preg_replace( '~^https?://~', '', $activity_object['id'] ) ); $activity = $activity->to_json(); Http::post( $inbox, $activity, $actor->get__id() ); } }