Compare commits

..

1 commit

Author SHA1 Message Date
92fff2220d wip 2024-11-18 17:36:27 +01:00
6 changed files with 129 additions and 14 deletions

View file

@ -5,12 +5,6 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Fixed
* Fixed that transformer hook function might also return `null`.
## [0.2.1] - 2024-11-16 ## [0.2.1] - 2024-11-16
### Added ### Added

View file

@ -100,12 +100,6 @@ We're always interested in your feedback. Feel free to reach out to us via [E-Ma
## Changelog ## ## Changelog ##
## Unreleased
### Fixed
* Fixed that transformer hook function might also return `null`.
### [0.2.1] 2024-11-16 ### ### [0.2.1] 2024-11-16 ###
* Initial release on https://wordpress.org/ * Initial release on https://wordpress.org/

View file

@ -0,0 +1,61 @@
<?php
/**
* ActivityPub Transformer for the plugin EventPrime.
*
* @package ActivityPub_Event_Bridge
* @license AGPL-3.0-or-later
*/
namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
use Activitypub\Activity\Extended_Object\Event as Event_Object;
use Activitypub\Activity\Extended_Object\Place;
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event;
use GatherPress\Core\Event as GatherPress_Event;
/**
* ActivityPub Transformer for VS Event
*
* @since 1.0.0
*/
final class EventPrime extends Event {
/**
* The current GatherPress Event object.
*
* @var GatherPress_Event
*/
protected $gp_event;
/**
* Extend the constructor, to also set the GatherPress objects.
*
* This is a special class object form The Events Calendar which
* has a lot of useful functions, we make use of our getter functions.
*
* @param WP_Post $wp_object The WordPress object.
* @param string $wp_taxonomy The taxonomy slug of the event post type.
*/
public function __construct( $wp_object, $wp_taxonomy ) {
parent::__construct( $wp_object, $wp_taxonomy );
$this->gp_event = new GatherPress_Event( $this->wp_object->ID );
$this->gp_venue = $this->gp_event->get_venue_information();
}
/**
* Get the end time from the event object.
*/
protected function get_end_time(): ?string {
return $this->gp_event->get_datetime_end( 'Y-m-d\TH:i:s\Z' );
}
/**
* Get the end time from the event object.
*/
protected function get_start_time(): string {
return $this->gp_event->get_datetime_start( 'Y-m-d\TH:i:s\Z' );
}
}

View file

@ -1,6 +1,6 @@
<?php <?php
/** /**
* ActivityPub Transformer for the plugin Very Simple Event List. * ActivityPub Transformer for the GatherPress event plugin.
* *
* @package ActivityPub_Event_Bridge * @package ActivityPub_Event_Bridge
* @license AGPL-3.0-or-later * @license AGPL-3.0-or-later

View file

@ -132,6 +132,7 @@ class Setup {
'\ActivityPub_Event_Bridge\Plugins\WP_Event_Manager', '\ActivityPub_Event_Bridge\Plugins\WP_Event_Manager',
'\ActivityPub_Event_Bridge\Plugins\Eventin', '\ActivityPub_Event_Bridge\Plugins\Eventin',
'\ActivityPub_Event_Bridge\Plugins\Modern_Events_Calendar_Lite', '\ActivityPub_Event_Bridge\Plugins\Modern_Events_Calendar_Lite',
'\ActivityPub_Event_Bridge\Plugins\EventPrime',
); );
/** /**
@ -252,7 +253,7 @@ class Setup {
* *
* @return \Activitypub\Transformer\Base|null * @return \Activitypub\Transformer\Base|null
*/ */
public function register_activitypub_event_transformer( $transformer, $wp_object, $object_class ): ?\Activitypub\Transformer\Base { public function register_activitypub_event_transformer( $transformer, $wp_object, $object_class ): \Activitypub\Transformer\Base {
// If the current WordPress object is not a post (e.g., a WP_Comment), don't change the transformer. // If the current WordPress object is not a post (e.g., a WP_Comment), don't change the transformer.
if ( 'WP_Post' !== $object_class ) { if ( 'WP_Post' !== $object_class ) {
return $transformer; return $transformer;

View file

@ -0,0 +1,65 @@
<?php
/**
* EventPrime Events Calendar, Bookings and Tickets
*
* @link https://wordpress.org/plugins/eventprime-event-calendar-management/
* @package ActivityPub_Event_Bridge
* @since 1.0.0
*/
namespace ActivityPub_Event_Bridge\Plugins;
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
/**
* This class defines which information is necessary for the EventPrime event plugin.
*
* @since 1.0.0
*/
final class EventPrime extends Event_Plugin {
/**
* Returns the full plugin file.
*
* @return string
*/
public static function get_plugin_file(): string {
return 'eventprime-event-calendar-management/event-prime.php';
}
/**
* Returns the event post type of the plugin.
*
* @return string
*/
public static function get_post_type(): string {
return 'em_event';
}
/**
* Returns the IDs of the admin pages of the plugin.
*
* @return array The settings page urls.
*/
public static function get_settings_pages(): array {
return array( 'ep-settings' );
}
/**
* Returns the ActivityPub transformer class.
*
* @return string
*/
public static function get_activitypub_transformer_class_name(): string {
return 'EventPrime';
}
/**
* Returns the taxonomy used for the plugin's event categories.
*
* @return string
*/
public static function get_event_category_taxonomy(): string {
return 'em_event_type';
}
}