From 574f770a654a5848e6815a093c38e5147335a385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 10:56:51 +0200 Subject: [PATCH] fix phpcs --- activitypub-event-extensions.php | 16 +++++----------- .../transformer/class-events-manager.php | 6 ++++-- .../transformer/class-the-events-calendar.php | 12 ++++-------- includes/class-setup.php | 2 +- includes/plugins/class-the-events-calendar.php | 8 ++++++-- 5 files changed, 20 insertions(+), 24 deletions(-) diff --git a/activitypub-event-extensions.php b/activitypub-event-extensions.php index d106516..9be6461 100644 --- a/activitypub-event-extensions.php +++ b/activitypub-event-extensions.php @@ -35,25 +35,21 @@ Activitypub_Event_Extensions\Autoloader::register(); // Initialize the plugin. Activitypub_Event_Extensions\Setup::get_instance(); -// For local development purposes: TODO. Remove everything after here. +// BeforeFirstRelease: Remove everything after this after here. /** * Add a filter for http_request_host_is_external * - * TODO: Remove this for release. - * - * @todo This filter is temporary code needed to do local testing. + * BeforeFirstRelease: Remove this for release. */ add_filter( 'http_request_host_is_external', 'activitypub_event_extensions_custom_http_request_host_is_external', 10, 3 ); /** * Add a filter for http_request_host_is_external * - * TODO: Remove this for release. + * BeforeFirstRelease: Remove this for release. * * @param bool $is_external Whether the request is external. - * - * @todo This filter is temporary code needed to do local testing. */ function activitypub_event_extensions_custom_http_request_host_is_external( $is_external ) { $is_external = true; @@ -64,14 +60,12 @@ function activitypub_event_extensions_custom_http_request_host_is_external( $is_ /** * Don't verify ssl certs for testing. * - * TODO: Remove this for release. - * - * @todo This filter is temporary code needed to do local testing. + * BeforeFirstRelease: Remove this for release. */ add_filter( 'https_ssl_verify', 'activitypub_event_extensions_dont_verify_local_dev_https', 10, 3 ); /** - * TODO: remove it. + * BeforeFirstRelease: remove it. */ function activitypub_event_extensions_dont_verify_local_dev_https() { return false; diff --git a/includes/activitypub/transformer/class-events-manager.php b/includes/activitypub/transformer/class-events-manager.php index 4cbc71d..487181c 100644 --- a/includes/activitypub/transformer/class-events-manager.php +++ b/includes/activitypub/transformer/class-events-manager.php @@ -9,6 +9,8 @@ namespace Activitypub_Event_Extensions\Activitypub\Transformer; use Activitypub_Event_Extensions\Activitypub\Transformer\Event as Event_Transformer; +use DateTime; +use DateTimeZone; use EM_Event; use Activitypub\Activity\Extended_Object\Event; use Activitypub\Activity\Extended_Object\Place; @@ -153,7 +155,7 @@ final class Events_Manager extends Event_Transformer { /** * Return the remaining attendee capacity * - * @todo decide whether to include pending bookings or not! + * @return int */ public function get_remaining_attendee_capacity() { $em_bookings = $this->em_event->get_bookings()->get_bookings(); @@ -166,7 +168,7 @@ final class Events_Manager extends Event_Transformer { * * @return int */ - public function get_participant_count() { + public function get_participant_count(): int { $em_bookings = $this->em_event->get_bookings()->get_bookings(); return count( $em_bookings->bookings ); } diff --git a/includes/activitypub/transformer/class-the-events-calendar.php b/includes/activitypub/transformer/class-the-events-calendar.php index aa5a16b..e1b42fb 100644 --- a/includes/activitypub/transformer/class-the-events-calendar.php +++ b/includes/activitypub/transformer/class-the-events-calendar.php @@ -51,8 +51,6 @@ final class The_Events_Calendar extends Event { * @return string|null tribe category if it exists */ public function get_tribe_category() { - // TODO: make it possible that one event can have multiple categories? - // Using cat_slugs isn't the best way to do this, don't know if it's a good idea. $categories = tribe_get_event_cat_slugs( $this->wp_object->ID ); if ( count( $categories ) === 0 ) { @@ -133,12 +131,10 @@ final class The_Events_Calendar extends Event { protected function get_content() { $content = parent::get_content(); - // TODO: remove link at the end of the content. - - // TODO: add organizer - // $this->tribe_event->organizers[0]. - - // TODO: do add Cancelled reason in the content (maybe at the end). + // /BeforeFirstRelease: + // * remove link at the end of the content. + // * add organizer. + // * do add Cancelled reason in the content.s return $content; } diff --git a/includes/class-setup.php b/includes/class-setup.php index 67f1999..2de709f 100644 --- a/includes/class-setup.php +++ b/includes/class-setup.php @@ -60,7 +60,7 @@ class Setup { */ protected function __construct() { $this->activitypub_plugin_is_active = is_plugin_active( 'activitypub/activitypub.php' ); - // TODO: decide whether we want to do anything at all when ActivityPub plugin is note active. + // BeforeFirstRelease: decide whether we want to do anything at all when ActivityPub plugin is note active. // if ( ! $this->activitypub_plugin_is_active ) { // deactivate_plugins( ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_FILE ); // return; diff --git a/includes/plugins/class-the-events-calendar.php b/includes/plugins/class-the-events-calendar.php index 1b77a61..6f18a5a 100644 --- a/includes/plugins/class-the-events-calendar.php +++ b/includes/plugins/class-the-events-calendar.php @@ -46,8 +46,12 @@ final class The_Events_Calendar extends Event_plugin { * @return string The settings page url. */ public static function get_settings_page(): string { - // TODO: Tribe\Events\Admin\Settings::settings_page_id. - return 'edit.php?post_type=tribe_events&page=tec-events-settings'; + if ( class_exists( '\Tribe\Events\Admin\Settings' ) ) { + $page = \Tribe\Events\Admin\Settings::$settings_page_id; + } else { + $page = 'tec-events-settings'; + } + return sprintf( 'edit.php?post_type=tribe_events&page=%s', $page ); } /**