This commit is contained in:
André Menrath 2024-08-01 20:08:35 +02:00
parent 8ef7cefeeb
commit 0999db945b
7 changed files with 32 additions and 12 deletions

View file

@ -16,7 +16,7 @@ For more information checkout our website https://event-federation.eu/. You can
* [The Events Calendar](https://de.wordpress.org/plugins/the-events-calendar/) * [The Events Calendar](https://de.wordpress.org/plugins/the-events-calendar/)
* [VS Event List](https://de.wordpress.org/plugins/very-simple-event-list/) * [VS Event List](https://de.wordpress.org/plugins/very-simple-event-list/)
* [Events Manager](https://de.wordpress.org/plugins/events-manager/) * [Events Manager](https://de.wordpress.org/plugins/events-manager/)
* [GatherPress](https://github.com/GatherPress/gatherpress) * [GatherPress](https://github.com/GatherPress/gatherpress)
### Later: ### Later:
- [All in One Events Calendar](https://de.wordpress.org/plugins/all-in-one-event-calendar/) - [All in One Events Calendar](https://de.wordpress.org/plugins/all-in-one-event-calendar/)

View file

@ -41,6 +41,13 @@ class Event extends Post {
return 'Event'; return 'Event';
} }
/**
* Format a human readable HTML summary.
*/
protected function format_html_summary($summary_text) {
}
/** /**
* Generic function that converts an WP-Event object to an ActivityPub-Event object. * Generic function that converts an WP-Event object to an ActivityPub-Event object.
* *

View file

@ -1,5 +1,4 @@
<?php <?php
/** /**
* ActivityPub Transformer for the plugin Very Simple Event List. * ActivityPub Transformer for the plugin Very Simple Event List.
* *
@ -83,6 +82,11 @@ class Events_Manager extends Event_Transformer {
return 'Event'; return 'Event';
} }
/**
* Returns whether the even is online
*
* @return bool
*/
protected function get_is_online() { protected function get_is_online() {
return 'url' === $this->em_event->event_location_type; return 'url' === $this->em_event->event_location_type;
} }
@ -135,22 +139,29 @@ class Events_Manager extends Event_Transformer {
$time_string = $this->em_event->event_start_time; $time_string = $this->em_event->event_start_time;
$timezone_string = $this->em_event->event_timezone; $timezone_string = $this->em_event->event_timezone;
// Create a DateTime object with the given date, time, and timezone // Create a DateTime object with the given date, time, and timezone.
$datetime = new DateTime( $date_string . ' ' . $time_string, new DateTimeZone( $timezone_string ) ); $datetime = new DateTime( $date_string . ' ' . $time_string, new DateTimeZone( $timezone_string ) );
// Set the timezone for proper formatting // Set the timezone for proper formatting.
$datetime->setTimezone( new DateTimeZone( 'UTC' ) ); $datetime->setTimezone( new DateTimeZone( 'UTC' ) );
// Format the DateTime object as 'Y-m-d\TH:i:s\Z' // Format the DateTime object as 'Y-m-d\TH:i:s\Z'.
$formatted_date = $datetime->format( 'Y-m-d\TH:i:s\Z' ); $formatted_date = $datetime->format( 'Y-m-d\TH:i:s\Z' );
return $formatted_date; return $formatted_date;
} }
/**
* Returns the maximum attendee capacity.
*
* @return int
*/
protected function get_maximum_attendee_capacity() { protected function get_maximum_attendee_capacity() {
return $this->em_event->event_spaces; return $this->em_event->event_spaces;
} }
/** /**
* Return the remaining attendee capacity
*
* @todo decide whether to include pending bookings or not! * @todo decide whether to include pending bookings or not!
*/ */
protected function get_remaining_attendee_capacity() { protected function get_remaining_attendee_capacity() {
@ -159,15 +170,16 @@ class Events_Manager extends Event_Transformer {
return $remaining_attendee_capacity; return $remaining_attendee_capacity;
} }
/**
* Returns the current participant count.
*
* @return int
*/
protected function get_participant_count() { protected function get_participant_count() {
$em_bookings = $this->em_event->get_bookings()->get_bookings(); $em_bookings = $this->em_event->get_bookings()->get_bookings();
return count( $em_bookings->bookings ); return count( $em_bookings->bookings );
} }
protected function get_content() {
return $this->wp_object->post_content;
}
protected function get_summary() { protected function get_summary() {
if ( $this->em_event->post_excerpt ) { if ( $this->em_event->post_excerpt ) {
$excerpt = $this->em_event->post_excerpt; $excerpt = $this->em_event->post_excerpt;
@ -223,7 +235,6 @@ class Events_Manager extends Event_Transformer {
* @return string $category * @return string $category
*/ */
protected function get_category() { protected function get_category() {
$categories = $this->em_event->get_categories()->terms; $categories = $this->em_event->get_categories()->terms;
if ( empty( $categories ) ) { if ( empty( $categories ) ) {
@ -286,7 +297,6 @@ class Events_Manager extends Event_Transformer {
} }
protected function get_name() { protected function get_name() {
return $this->em_event->event_name; return $this->em_event->event_name;
} }
@ -296,7 +306,6 @@ class Events_Manager extends Event_Transformer {
* @return Activitypub\Activity\Event * @return Activitypub\Activity\Event
*/ */
public function to_object() { public function to_object() {
$this->em_event = new EM_Event( $this->wp_object->ID, 'post_id' ); $this->em_event = new EM_Event( $this->wp_object->ID, 'post_id' );
$activitypub_object = new Event(); $activitypub_object = new Event();

View file

@ -6,6 +6,7 @@
* *
* @package Activitypub_Event_Extensions * @package Activitypub_Event_Extensions
* @since 1.0.0 * @since 1.0.0
* @license AGPL-3.0-or-later
*/ */
namespace Activitypub_Event_Extensions\Admin; namespace Activitypub_Event_Extensions\Admin;

View file

@ -6,6 +6,7 @@
* *
* @package Activitypub_Event_Extensions * @package Activitypub_Event_Extensions
* @since 1.0.0 * @since 1.0.0
* @license AGPL-3.0-or-later
*/ */
namespace Activitypub_Event_Extensions\Admin; namespace Activitypub_Event_Extensions\Admin;

View file

@ -8,6 +8,7 @@
* *
* @package Activitypub_Event_Extensions * @package Activitypub_Event_Extensions
* @since 1.0.0 * @since 1.0.0
* @license AGPL-3.0-or-later
*/ */
namespace Activitypub_Event_Extensions; namespace Activitypub_Event_Extensions;

View file

@ -7,6 +7,7 @@
* *
* @package Activitypub_Event_Extensions * @package Activitypub_Event_Extensions
* @since 1.0.0 * @since 1.0.0
* @license AGPL-3.0-or-later
*/ */
namespace Activitypub_Event_Extensions; namespace Activitypub_Event_Extensions;