diff --git a/includes/activity/class-event.php b/includes/activity/class-event.php index f80f6d2..658f3a6 100644 --- a/includes/activity/class-event.php +++ b/includes/activity/class-event.php @@ -93,6 +93,12 @@ class Event extends Base_Object { */ protected $status; + /** + * TODO this seems to not be a default property of an Object but needed by mobilizon TODO: + */ + protected $actor; + + /** * @context https://joinmobilizon.org/ns#externalParticipationUrl * @var string diff --git a/includes/transformer/class-factory.php b/includes/transformer/class-factory.php index 727e239..beee0b0 100644 --- a/includes/transformer/class-factory.php +++ b/includes/transformer/class-factory.php @@ -10,9 +10,12 @@ use Activitypub\Transformer\Attachment; */ class Factory { const DEFAULT_TRANSFORMER_MAPPING = array( - 'post' => 'activitypub/post', - 'page' => 'activitypub/post', - 'attachment' => 'activitypub/attachment', + 'WP_Post' => array( + 'post' => 'activitypub/post', + 'page' => 'activitypub/post', + 'attachment' => 'activitypub/attachment', + ), + 'WP_Comment' => 'activitypub/comment' ); /** @@ -252,7 +255,7 @@ class Factory { return $transformer; } - // use default transformer + // Use the built-in transformers. switch ( get_class( $object ) ) { case 'WP_Post': if ( 'attachment' === $object->post_type ) { @@ -283,13 +286,12 @@ class Factory { case 'WP_Post': $post_type = get_post_type( $object ); $transformer_mapping = \get_option( 'activitypub_transformer_mapping', self::DEFAULT_TRANSFORMER_MAPPING ); - $transformer_name = $transformer_mapping[ $post_type ]; + $transformer_name = $transformer_mapping[ 'WP_Post' ][ $post_type ]; if ( $transformer_name ) { $transformer_class = $this->get_transformer_class( $transformer_name ); } else { return self::get_default_transformer( $object ); } - if ( $transformer_class ) { return new $transformer_class( $object ); } else {