fix phpcs
All checks were successful
PHP Code Checker / Run PHP Code Checker (pull_request) Successful in 43s
Unit Testing / Run phpunit tests (pull_request) Successful in 4m2s

This commit is contained in:
André Menrath 2024-09-21 10:56:51 +02:00
parent 53a6e267aa
commit 574f770a65
5 changed files with 20 additions and 24 deletions

View file

@ -35,25 +35,21 @@ Activitypub_Event_Extensions\Autoloader::register();
// Initialize the plugin. // Initialize the plugin.
Activitypub_Event_Extensions\Setup::get_instance(); 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 * Add a filter for http_request_host_is_external
* *
* TODO: Remove this for release. * BeforeFirstRelease: Remove this for release.
*
* @todo This filter is temporary code needed to do local testing.
*/ */
add_filter( 'http_request_host_is_external', 'activitypub_event_extensions_custom_http_request_host_is_external', 10, 3 ); 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 * 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. * @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 ) { function activitypub_event_extensions_custom_http_request_host_is_external( $is_external ) {
$is_external = true; $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. * Don't verify ssl certs for testing.
* *
* TODO: Remove this for release. * BeforeFirstRelease: Remove this for release.
*
* @todo This filter is temporary code needed to do local testing.
*/ */
add_filter( 'https_ssl_verify', 'activitypub_event_extensions_dont_verify_local_dev_https', 10, 3 ); 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() { function activitypub_event_extensions_dont_verify_local_dev_https() {
return false; return false;

View file

@ -9,6 +9,8 @@
namespace Activitypub_Event_Extensions\Activitypub\Transformer; namespace Activitypub_Event_Extensions\Activitypub\Transformer;
use Activitypub_Event_Extensions\Activitypub\Transformer\Event as Event_Transformer; use Activitypub_Event_Extensions\Activitypub\Transformer\Event as Event_Transformer;
use DateTime;
use DateTimeZone;
use EM_Event; use EM_Event;
use Activitypub\Activity\Extended_Object\Event; use Activitypub\Activity\Extended_Object\Event;
use Activitypub\Activity\Extended_Object\Place; use Activitypub\Activity\Extended_Object\Place;
@ -153,7 +155,7 @@ final class Events_Manager extends Event_Transformer {
/** /**
* Return the remaining attendee capacity * Return the remaining attendee capacity
* *
* @todo decide whether to include pending bookings or not! * @return int
*/ */
public function get_remaining_attendee_capacity() { public function get_remaining_attendee_capacity() {
$em_bookings = $this->em_event->get_bookings()->get_bookings(); $em_bookings = $this->em_event->get_bookings()->get_bookings();
@ -166,7 +168,7 @@ final class Events_Manager extends Event_Transformer {
* *
* @return int * @return int
*/ */
public function get_participant_count() { public function get_participant_count(): int {
$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 );
} }

View file

@ -51,8 +51,6 @@ final class The_Events_Calendar extends Event {
* @return string|null tribe category if it exists * @return string|null tribe category if it exists
*/ */
public function get_tribe_category() { 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 ); $categories = tribe_get_event_cat_slugs( $this->wp_object->ID );
if ( count( $categories ) === 0 ) { if ( count( $categories ) === 0 ) {
@ -133,12 +131,10 @@ final class The_Events_Calendar extends Event {
protected function get_content() { protected function get_content() {
$content = parent::get_content(); $content = parent::get_content();
// TODO: remove link at the end of the content. // /BeforeFirstRelease:
// * remove link at the end of the content.
// TODO: add organizer // * add organizer.
// $this->tribe_event->organizers[0]. // * do add Cancelled reason in the content.s
// TODO: do add Cancelled reason in the content (maybe at the end).
return $content; return $content;
} }

View file

@ -60,7 +60,7 @@ class Setup {
*/ */
protected function __construct() { protected function __construct() {
$this->activitypub_plugin_is_active = is_plugin_active( 'activitypub/activitypub.php' ); $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 ) { // if ( ! $this->activitypub_plugin_is_active ) {
// deactivate_plugins( ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_FILE ); // deactivate_plugins( ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_FILE );
// return; // return;

View file

@ -46,8 +46,12 @@ final class The_Events_Calendar extends Event_plugin {
* @return string The settings page url. * @return string The settings page url.
*/ */
public static function get_settings_page(): string { public static function get_settings_page(): string {
// TODO: Tribe\Events\Admin\Settings::settings_page_id. if ( class_exists( '\Tribe\Events\Admin\Settings' ) ) {
return 'edit.php?post_type=tribe_events&page=tec-events-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 );
} }
/** /**