From b10b377b1ef7b8e25c5408a9d7e7722b22aa961e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sun, 1 Dec 2024 16:28:29 +0100 Subject: [PATCH] wip --- .../transformer/class-event-post.php | 73 +++++++++++++++++++ .../activitypub/transformer/class-event.php | 3 +- includes/class-setup.php | 1 + includes/plugins/class-event-post.php | 61 ++++++++++++++++ 4 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 includes/activitypub/transformer/class-event-post.php create mode 100644 includes/plugins/class-event-post.php diff --git a/includes/activitypub/transformer/class-event-post.php b/includes/activitypub/transformer/class-event-post.php new file mode 100644 index 0000000..18c0fcf --- /dev/null +++ b/includes/activitypub/transformer/class-event-post.php @@ -0,0 +1,73 @@ +ID, 'event_begin', true ) ); + } + + /** + * Get the type. + */ + protected function get_type() { + return $this->is_event_post ? 'Event' : Post::get_type(); + } + + /** + * Get the end time from the event object. + */ + protected function get_end_time(): ?string { + $end_time = get_post_meta( $this->wp_object->ID, 'event_end', true ); + return $end_time; + } + + /** + * Get the end time from the event object. + */ + protected function get_start_time(): string { + $start_time = get_post_meta( $this->wp_object->ID, 'event_begin', true ); + return $start_time; + } + + /** + * Get location from the event object. + */ + protected function get_location(): ?Place { + return null; + } +} diff --git a/includes/activitypub/transformer/class-event.php b/includes/activitypub/transformer/class-event.php index babf2b9..6f8d5a1 100644 --- a/includes/activitypub/transformer/class-event.php +++ b/includes/activitypub/transformer/class-event.php @@ -28,7 +28,6 @@ use DateTime; * [ ] do add Cancelled reason in the content. */ abstract class Event extends Post { - /** * The WordPress event taxonomy. * @@ -43,7 +42,7 @@ abstract class Event extends Post { * * @return string The Event Object-Type. */ - protected function get_type(): string { + protected function get_type() { return 'Event'; } diff --git a/includes/class-setup.php b/includes/class-setup.php index b99eda5..f140d6a 100644 --- a/includes/class-setup.php +++ b/includes/class-setup.php @@ -134,6 +134,7 @@ class Setup { '\ActivityPub_Event_Bridge\Plugins\Modern_Events_Calendar_Lite', '\ActivityPub_Event_Bridge\Plugins\EventPrime', '\ActivityPub_Event_Bridge\Plugins\Event_Organiser', + '\ActivityPub_Event_Bridge\Plugins\Event_Post', ); /** diff --git a/includes/plugins/class-event-post.php b/includes/plugins/class-event-post.php new file mode 100644 index 0000000..d4e57be --- /dev/null +++ b/includes/plugins/class-event-post.php @@ -0,0 +1,61 @@ +