From 0999db945b4a23895fea38320a4c64ab93e5a5b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Thu, 1 Aug 2024 20:08:35 +0200 Subject: [PATCH] linting --- README.md | 2 +- .../activitypub/transformer/class-event.php | 7 +++++ .../transformer/class-events-manager.php | 31 ++++++++++++------- .../class-event-plugin-admin-notices.php | 1 + .../admin/class-general-admin-notices.php | 1 + includes/class-autoloader.php | 1 + includes/class-setup.php | 1 + 7 files changed, 32 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 75813ff..2e5babc 100644 --- a/README.md +++ b/README.md @@ -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/) * [VS Event List](https://de.wordpress.org/plugins/very-simple-event-list/) * [Events Manager](https://de.wordpress.org/plugins/events-manager/) -* [GatherPress](https://github.com/GatherPress/gatherpress) + * [GatherPress](https://github.com/GatherPress/gatherpress) ### Later: - [All in One Events Calendar](https://de.wordpress.org/plugins/all-in-one-event-calendar/) diff --git a/includes/activitypub/transformer/class-event.php b/includes/activitypub/transformer/class-event.php index e1ff34d..7c71022 100644 --- a/includes/activitypub/transformer/class-event.php +++ b/includes/activitypub/transformer/class-event.php @@ -41,6 +41,13 @@ class Event extends Post { 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. * diff --git a/includes/activitypub/transformer/class-events-manager.php b/includes/activitypub/transformer/class-events-manager.php index 8fb4b91..6234b6a 100644 --- a/includes/activitypub/transformer/class-events-manager.php +++ b/includes/activitypub/transformer/class-events-manager.php @@ -1,5 +1,4 @@ em_event->event_location_type; } @@ -135,22 +139,29 @@ class Events_Manager extends Event_Transformer { $time_string = $this->em_event->event_start_time; $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 ) ); - // Set the timezone for proper formatting + // Set the timezone for proper formatting. $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' ); return $formatted_date; } + /** + * Returns the maximum attendee capacity. + * + * @return int + */ protected function get_maximum_attendee_capacity() { return $this->em_event->event_spaces; } /** + * Return the remaining attendee capacity + * * @todo decide whether to include pending bookings or not! */ protected function get_remaining_attendee_capacity() { @@ -159,15 +170,16 @@ class Events_Manager extends Event_Transformer { return $remaining_attendee_capacity; } + /** + * Returns the current participant count. + * + * @return int + */ protected function get_participant_count() { $em_bookings = $this->em_event->get_bookings()->get_bookings(); return count( $em_bookings->bookings ); } - protected function get_content() { - return $this->wp_object->post_content; - } - protected function get_summary() { if ( $this->em_event->post_excerpt ) { $excerpt = $this->em_event->post_excerpt; @@ -223,7 +235,6 @@ class Events_Manager extends Event_Transformer { * @return string $category */ protected function get_category() { - $categories = $this->em_event->get_categories()->terms; if ( empty( $categories ) ) { @@ -286,7 +297,6 @@ class Events_Manager extends Event_Transformer { } protected function get_name() { - return $this->em_event->event_name; } @@ -296,7 +306,6 @@ class Events_Manager extends Event_Transformer { * @return Activitypub\Activity\Event */ public function to_object() { - $this->em_event = new EM_Event( $this->wp_object->ID, 'post_id' ); $activitypub_object = new Event(); diff --git a/includes/admin/class-event-plugin-admin-notices.php b/includes/admin/class-event-plugin-admin-notices.php index 9c0ba29..82e8670 100644 --- a/includes/admin/class-event-plugin-admin-notices.php +++ b/includes/admin/class-event-plugin-admin-notices.php @@ -6,6 +6,7 @@ * * @package Activitypub_Event_Extensions * @since 1.0.0 + * @license AGPL-3.0-or-later */ namespace Activitypub_Event_Extensions\Admin; diff --git a/includes/admin/class-general-admin-notices.php b/includes/admin/class-general-admin-notices.php index c265f00..8c69512 100644 --- a/includes/admin/class-general-admin-notices.php +++ b/includes/admin/class-general-admin-notices.php @@ -6,6 +6,7 @@ * * @package Activitypub_Event_Extensions * @since 1.0.0 + * @license AGPL-3.0-or-later */ namespace Activitypub_Event_Extensions\Admin; diff --git a/includes/class-autoloader.php b/includes/class-autoloader.php index dcc18dc..d23adf2 100644 --- a/includes/class-autoloader.php +++ b/includes/class-autoloader.php @@ -8,6 +8,7 @@ * * @package Activitypub_Event_Extensions * @since 1.0.0 + * @license AGPL-3.0-or-later */ namespace Activitypub_Event_Extensions; diff --git a/includes/class-setup.php b/includes/class-setup.php index cf2f799..4aec937 100644 --- a/includes/class-setup.php +++ b/includes/class-setup.php @@ -7,6 +7,7 @@ * * @package Activitypub_Event_Extensions * @since 1.0.0 + * @license AGPL-3.0-or-later */ namespace Activitypub_Event_Extensions;