installed plugin Event Bridge for ActivityPub
version 1.1.0
This commit is contained in:
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/**
|
||||
* Event Organiser.
|
||||
*
|
||||
* Defines all the necessary meta information and methods for the integration
|
||||
* of the WordPress "Event Organiser" plugin.
|
||||
*
|
||||
* @link https://wordpress.org/plugins/event-organiser/
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Activitypub\Query;
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Event\Event_Organiser as Event_Organiser_Transformer;
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Place\Event_Organiser as Event_Organiser_Place_Transformer;
|
||||
|
||||
/**
|
||||
* Event Organiser.
|
||||
*
|
||||
* Defines all the necessary meta information and methods for the integration
|
||||
* of the WordPress "Event Organiser" plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class Event_Organiser extends Event_Plugin_Integration {
|
||||
/**
|
||||
* Returns the full plugin file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
return 'event-organiser/event-organiser.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the event post type of the plugin.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_post_type(): string {
|
||||
return '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( 'event-organiser' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the taxonomy used for the plugin's event categories.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_event_category_taxonomy(): string {
|
||||
return 'event-category';
|
||||
}
|
||||
|
||||
/**
|
||||
* In case an event plugin uses a custom taxonomy for storing locations/venues return it here.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_place_taxonomy() {
|
||||
return 'event-venue';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ActivityPub transformer for a Event_Organiser event post.
|
||||
*
|
||||
* @param \WP_Post $post The WordPress post object of the Event.
|
||||
* @return Event_Organiser_Transformer
|
||||
*/
|
||||
public static function get_activitypub_event_transformer( $post ): Event_Organiser_Transformer {
|
||||
return new Event_Organiser_Transformer( $post, self::get_event_category_taxonomy() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ActivityPub transformer for a Event_Organiser event venue which is stored in a taxonomy.
|
||||
*
|
||||
* @param \WP_Term $term The WordPress Term/Taxonomy of the venue.
|
||||
* @return Event_Organiser_Place_Transformer
|
||||
*/
|
||||
public static function get_activitypub_place_transformer( $term ): Event_Organiser_Place_Transformer {
|
||||
if ( Query::get_instance()->is_activitypub_request() && defined( 'EVENT_ORGANISER_DIR' ) ) {
|
||||
$class_path = constant( EVENT_ORGANISER_DIR ) . 'includes/class-eo-theme-compatability.php';
|
||||
|
||||
if ( file_exists( $class_path ) ) {
|
||||
require_once $class_path;
|
||||
|
||||
// Remove the theme filter which is not needed in ActivityStreams.
|
||||
$eo = \EO_Theme_Compatabilty::get_instance();
|
||||
if ( $eo instanceof \EO_Theme_Compatabilty ) {
|
||||
$eo->remove_filter( 'template_include', PHP_INT_MAX - 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Event_Organiser_Place_Transformer( $term );
|
||||
}
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/**
|
||||
* Abstract base class for a basic integration of a WordPress event plugin.
|
||||
*
|
||||
* Basic information and methods that each supported event needs for this plugin to work.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @since 1.0.0
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Event\Event as ActivityPub_Event_Transformer;
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Place\Base_Post_Place;
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Place\Base_Term_Place;
|
||||
use WP_Post;
|
||||
|
||||
require_once EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_DIR . 'includes/integrations/interface-feature-event-sources.php';
|
||||
|
||||
/**
|
||||
* Abstract base class for a basic integration of a WordPress event plugin.
|
||||
*
|
||||
* Basic information and methods that each supported event needs for this plugin to work.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
abstract class Event_Plugin_Integration {
|
||||
/**
|
||||
* Returns the plugin file relative to the plugins dir.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public static function get_relative_plugin_file(): string;
|
||||
|
||||
/**
|
||||
* Returns the event post type of the plugin.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public static function get_post_type(): string;
|
||||
|
||||
/**
|
||||
* Returns the taxonomy used for the plugin's event categories.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public static function get_event_category_taxonomy(): string;
|
||||
|
||||
/**
|
||||
* Returns the Activitypub transformer for events of the event plugins event post type.
|
||||
*
|
||||
* @param WP_Post $post The WordPress post object of the Event.
|
||||
* @return ActivityPub_Event_Transformer
|
||||
*/
|
||||
abstract public static function get_activitypub_event_transformer( $post ): ActivityPub_Event_Transformer;
|
||||
|
||||
/**
|
||||
* In case an event plugin uses a custom post type for the locations/venues return it here.
|
||||
*
|
||||
* @return ?string
|
||||
*/
|
||||
public static function get_place_post_type() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* In case an event plugin uses a custom taxonomy for storing locations/venues return it here.
|
||||
*
|
||||
* @return ?string
|
||||
*/
|
||||
public static function get_place_taxonomy() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Activitypub transformer for places of the event plugins location post type.
|
||||
*
|
||||
* @param WP_Post $post The WordPress post object of the Event.
|
||||
* @return Base_Post_Place|Base_Term_Place|null
|
||||
*/
|
||||
public static function get_activitypub_place_transformer( $post ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* In case an event plugin used a custom post type for organizers return it here.
|
||||
*
|
||||
* @return ?string
|
||||
*/
|
||||
public static function get_organizer_post_type() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the IDs of the admin pages of the plugin.
|
||||
*
|
||||
* @return array The IDs of one or several admin/settings pages.
|
||||
*/
|
||||
public static function get_settings_pages(): array {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plugins name from the main plugin-file's top-level-file-comment.
|
||||
*/
|
||||
public static function get_plugin_name(): string {
|
||||
$all_plugins = array_merge( get_plugins(), get_mu_plugins() );
|
||||
if ( isset( $all_plugins[ static::get_relative_plugin_file() ]['Name'] ) ) {
|
||||
return $all_plugins[ static::get_relative_plugin_file() ]['Name'];
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects whether the current screen is a admin page of the event plugin.
|
||||
*/
|
||||
public static function is_plugin_page(): bool {
|
||||
// Get the current page.
|
||||
$screen = get_current_screen();
|
||||
|
||||
// Check if we are on a edit page for the event, or on the settings page of the event plugin.
|
||||
$is_event_plugins_edit_page = 'edit' === $screen->base && static::get_post_type() === $screen->post_type;
|
||||
$is_event_plugins_settings_page = in_array( $screen->id, static::get_settings_pages(), true );
|
||||
|
||||
return $is_event_plugins_edit_page || $is_event_plugins_settings_page;
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* Eventin.
|
||||
*
|
||||
* Defines all the necessary meta information and methods for the integration of the
|
||||
* WordPress plugin "Eventin".
|
||||
*
|
||||
* @link https://wordpress.org/plugins/eventin/
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Event\Eventin as Eventin_Transformer;
|
||||
|
||||
/**
|
||||
* Eventin.
|
||||
*
|
||||
* Defines all the necessary meta information and methods for the integration of the
|
||||
* WordPress plugin "Eventin".
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class Eventin extends Event_Plugin_Integration {
|
||||
/**
|
||||
* Returns the full plugin file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
return 'wp-event-solution/eventin.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the event post type of the plugin.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_post_type(): string {
|
||||
return 'etn';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the IDs of the admin pages of the plugin.
|
||||
*
|
||||
* @return array The settings page url.
|
||||
*/
|
||||
public static function get_settings_pages(): array {
|
||||
return array( 'eventin' ); // Base always is wp-admin/admin.php?page=eventin.
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the taxonomy used for the plugin's event categories.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_event_category_taxonomy(): string {
|
||||
return 'etn_category';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ActivityPub transformer for a Eventin event post.
|
||||
*
|
||||
* @param \WP_Post $post The WordPress post object of the Event.
|
||||
* @return Eventin_Transformer
|
||||
*/
|
||||
public static function get_activitypub_event_transformer( $post ): Eventin_Transformer {
|
||||
return new Eventin_Transformer( $post, self::get_event_category_taxonomy() );
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* EventON – Events Calendar
|
||||
*
|
||||
* Defines all the necessary meta information for the integration of the WordPress event plugin
|
||||
* "EventON – Events Calendar".
|
||||
*
|
||||
* @link https://wordpress.org/plugins/eventon-lite
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Event\EventOn as EventOn_Event_Transformer;
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Place\EventOn as EventOn_Location_Transformer;
|
||||
|
||||
/**
|
||||
* EventON – Events Calendar
|
||||
*
|
||||
* Defines all the necessary meta information for the integration of the WordPress event plugin
|
||||
* "EventON – Events Calendar".
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class EventOn extends Event_Plugin_Integration {
|
||||
/**
|
||||
* Returns the full plugin file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
return 'eventon-lite/eventon.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the event post type of the plugin.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_post_type(): string {
|
||||
return 'ajde_events';
|
||||
}
|
||||
|
||||
/**
|
||||
* 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( 'admin.php?page=eventon' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the taxonomy used for the plugin's event categories.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_event_category_taxonomy(): string {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ActivityPub transformer for a VS_Event_List event post.
|
||||
*
|
||||
* @param \WP_Post $post The WordPress post object of the Event.
|
||||
* @return EventOn_Event_Transformer
|
||||
*/
|
||||
public static function get_activitypub_event_transformer( $post ): EventOn_Event_Transformer {
|
||||
return new EventOn_Event_Transformer( $post, self::get_event_category_taxonomy() );
|
||||
}
|
||||
|
||||
/**
|
||||
* In case an event plugin uses a custom taxonomy for storing locations/venues return it here.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_place_taxonomy() {
|
||||
return 'event_location';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ActivityPub transformer for a Event_Organiser event venue which is stored in a taxonomy.
|
||||
*
|
||||
* @param \WP_Term $term The WordPress Term/Taxonomy of the venue.
|
||||
* @return EventOn_Location_Transformer
|
||||
*/
|
||||
public static function get_activitypub_place_transformer( $term ): EventOn_Location_Transformer {
|
||||
return new EventOn_Location_Transformer( $term );
|
||||
}
|
||||
}
|
@ -0,0 +1,171 @@
|
||||
<?php
|
||||
/**
|
||||
* EventPrime – Events Calendar, Bookings and Tickets
|
||||
*
|
||||
* @link https://wordpress.org/plugins/eventprime-event-calendar-management/
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Event\EventPrime as EventPrime_Event_Transformer;
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Place\EventPrime as EventPrime_Place_Transformer;
|
||||
use Eventprime_Basic_Functions;
|
||||
|
||||
use function Activitypub\is_activitypub_request;
|
||||
|
||||
// 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_Integration {
|
||||
/**
|
||||
* Add filter for the template inclusion.
|
||||
*/
|
||||
public static function init() {
|
||||
// Forcefully enable 'activitypub' post type support for EventPrime, because it is not public and cannot be done in the admin UI.
|
||||
\add_post_type_support( self::get_post_type(), 'activitypub' );
|
||||
\add_filter( 'activitypub_transformer', array( self::class, 'register_activitypub_transformer' ), 10, 3 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full plugin file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_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 taxonomy used for storing venues.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_place_taxonomy(): string {
|
||||
return 'em_venue';
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param \WP_Post $post The WordPress post object of the Event.
|
||||
* @return EventPrime_Event_Transformer
|
||||
*/
|
||||
public static function get_activitypub_event_transformer( $post ): EventPrime_Event_Transformer {
|
||||
return new EventPrime_Event_Transformer( $post, self::get_event_category_taxonomy() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the taxonomy used for the plugin's event categories.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_event_category_taxonomy(): string {
|
||||
return 'em_event_type';
|
||||
}
|
||||
|
||||
/**
|
||||
* Maybe use the custom transformer for the EventPrime.
|
||||
*
|
||||
* @param mixed $transformer The transformer to use.
|
||||
* @param mixed $data The data to transform.
|
||||
* @param string $object_class The class of the object to transform.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function register_activitypub_transformer( $transformer, $data, $object_class ) {
|
||||
if ( 'WP_Post' !== $object_class ) {
|
||||
return $transformer;
|
||||
}
|
||||
|
||||
$object_type = self::post_contains_eventprime_object( $data );
|
||||
|
||||
if ( 'event' === $object_type ) {
|
||||
$post = get_post( self::get_object_id( $object_type ) );
|
||||
if ( $post && self::get_post_type() === $post->post_type ) {
|
||||
return new EventPrime_Event_Transformer( $post );
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'venue' === $object_type ) {
|
||||
$term = get_term( self::get_object_id( $object_type ) );
|
||||
if ( $term && self::get_place_taxonomy() === $term->taxonomy ) {
|
||||
return new EventPrime_Place_Transformer( $term );
|
||||
}
|
||||
}
|
||||
|
||||
return $transformer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the current post is actually just a shortcode Wrapper linking to an EventPrime event.
|
||||
*
|
||||
* @param \WP_Post $post The WordPress post object.
|
||||
* @return string|bool
|
||||
*/
|
||||
private static function post_contains_eventprime_object( $post ) {
|
||||
if ( 'page' !== $post->post_type ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( '[em_event]' === $post->post_content || '[em_events]' === $post->post_content ) {
|
||||
return 'event';
|
||||
}
|
||||
|
||||
if ( '[em_sites]' === $post->post_content ) {
|
||||
return 'venue';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the post id for events and term id for venues for an EventPrime event query.
|
||||
*
|
||||
* @param string $type 'event' or 'venue'.
|
||||
* @return bool|int The post ID, or term ID if found, false otherwise.
|
||||
*/
|
||||
private static function get_object_id( $type = 'event' ) {
|
||||
if ( ! in_array( $type, array( 'venue', 'event' ), true ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$event = get_query_var( $type );
|
||||
if ( ! $event ) {
|
||||
if ( ! empty( filter_input( INPUT_GET, $type, FILTER_SANITIZE_FULL_SPECIAL_CHARS ) ) ) {
|
||||
$event = rtrim( filter_input( INPUT_GET, $type, FILTER_SANITIZE_FULL_SPECIAL_CHARS ), '/\\' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $event ) {
|
||||
$ep_basic_functions = new Eventprime_Basic_Functions();
|
||||
return $ep_basic_functions->ep_get_id_by_slug( $event, "em_{$type}" );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/**
|
||||
* Events Manager.
|
||||
*
|
||||
* Defines all the necessary meta information and methods for the integration of the
|
||||
* WordPress plugin "Events Manager".
|
||||
*
|
||||
* @link https://wordpress.org/plugins/events-manager/
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Event\Events_Manager as Events_Manager_Event_Transformer;
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Place\Events_Manager as Events_Manager_Place_Transformer;
|
||||
|
||||
|
||||
/**
|
||||
* Events Manager.
|
||||
*
|
||||
* Defines all the necessary meta information and methods for the integration of the
|
||||
* WordPress plugin "Events Manager".
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class Events_Manager extends Event_Plugin_Integration {
|
||||
/**
|
||||
* Returns the full plugin file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
return 'events-manager/events-manager.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the event post type of the plugin.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_post_type(): string {
|
||||
return defined( 'EM_POST_TYPE_EVENT' ) ? constant( 'EM_POST_TYPE_EVENT' ) : 'event';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the place post type of the plugin.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_place_post_type(): string {
|
||||
return defined( 'EM_POST_TYPE_LOCATION' ) ? constant( 'EM_POST_TYPE_LOCATION' ) : 'location';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Activitypub transformer for places of the event plugins location post type.
|
||||
*
|
||||
* @param \WP_Post $post The WordPress post object of the Event.
|
||||
* @return Events_Manager_Place_Transformer
|
||||
*/
|
||||
public static function get_activitypub_place_transformer( $post ): Events_Manager_Place_Transformer {
|
||||
return new Events_Manager_Place_Transformer( $post );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the IDs of the admin pages of the plugin.
|
||||
*
|
||||
* @return array The settings page urls.
|
||||
*/
|
||||
public static function get_settings_page(): array {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the taxonomy used for the plugin's event categories.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_event_category_taxonomy(): string {
|
||||
return defined( 'EM_TAXONOMY_CATEGORY' ) ? constant( 'EM_TAXONOMY_CATEGORY' ) : 'event-categories';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ActivityPub transformer for a Events_Manager event post.
|
||||
*
|
||||
* @param \WP_Post $post The WordPress post object of the Event.
|
||||
* @return Events_Manager_Event_Transformer
|
||||
*/
|
||||
public static function get_activitypub_event_transformer( $post ): Events_Manager_Event_Transformer {
|
||||
return new Events_Manager_Event_Transformer( $post, self::get_event_category_taxonomy() );
|
||||
}
|
||||
}
|
@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/**
|
||||
* GatherPress.
|
||||
*
|
||||
* Defines all the necessary meta information and methods for the integration
|
||||
* of the WordPress event plugin "GatherPress".
|
||||
*
|
||||
* @link https://wordpress.org/plugins/gatherpress/
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Event\GatherPress as GatherPress_Transformer;
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transmogrifier\GatherPress as GatherPress_Transmogrifier;
|
||||
|
||||
/**
|
||||
* GatherPress.
|
||||
*
|
||||
* Defines all the necessary meta information and methods for the integration
|
||||
* of the WordPress event plugin "GatherPress".
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class GatherPress extends Event_Plugin_Integration implements Feature_Event_Sources {
|
||||
/**
|
||||
* Returns the full plugin file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
return 'gatherpress/gatherpress.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the event post type of the plugin.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_post_type(): string {
|
||||
return class_exists( '\GatherPress\Core\Event' ) ? \GatherPress\Core\Event::POST_TYPE : 'gatherpress_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( class_exists( '\GatherPress\Core\Utility' ) ? \GatherPress\Core\Utility::prefix_key( 'general' ) : 'gatherpress_general' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the taxonomy used for the plugin's event categories.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_event_category_taxonomy(): string {
|
||||
return class_exists( '\GatherPress\Core\Topic' ) ? \GatherPress\Core\Topic::TAXONOMY : 'gatherpress_topic';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ActivityPub transformer for a GatherPress event post.
|
||||
*
|
||||
* @param \WP_Post $post The WordPress post object of the Event.
|
||||
* @return GatherPress_Transformer
|
||||
*/
|
||||
public static function get_activitypub_event_transformer( $post ): GatherPress_Transformer {
|
||||
return new GatherPress_Transformer( $post, self::get_event_category_taxonomy() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Transmogrifier for GatherPress.
|
||||
*/
|
||||
public static function get_transmogrifier(): string {
|
||||
return GatherPress_Transmogrifier::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of Post IDs of events that have ended.
|
||||
*
|
||||
* @param int $ends_before_time Filter: only get events that ended before that datetime as unix-time.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_cached_remote_events( $ends_before_time ): array {
|
||||
global $wpdb;
|
||||
|
||||
$ends_before_time_string = gmdate( 'Y-m-d H:i:s', $ends_before_time );
|
||||
|
||||
$results = $wpdb->get_results(
|
||||
$wpdb->prepare(
|
||||
"SELECT DISTINCT {$wpdb->prefix}posts.ID
|
||||
FROM {$wpdb->prefix}posts
|
||||
LEFT JOIN {$wpdb->prefix}gatherpress_events
|
||||
ON {$wpdb->prefix}posts.ID = {$wpdb->prefix}gatherpress_events.post_id
|
||||
LEFT JOIN {$wpdb->prefix}postmeta
|
||||
ON {$wpdb->prefix}posts.ID = {$wpdb->prefix}postmeta.post_id
|
||||
WHERE {$wpdb->prefix}posts.post_type = 'gatherpress_event'
|
||||
AND {$wpdb->prefix}posts.post_status = 'publish'
|
||||
AND {$wpdb->prefix}gatherpress_events.datetime_end_gmt <= %s
|
||||
AND {$wpdb->prefix}postmeta.meta_key = '_event_bridge_for_activitypub_event_source'
|
||||
",
|
||||
$ends_before_time_string
|
||||
),
|
||||
ARRAY_N
|
||||
);
|
||||
|
||||
$post_ids = array_column( $results, 0 );
|
||||
|
||||
return $post_ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init function: force displaying online event link for federated events.
|
||||
*/
|
||||
public static function init(): void {
|
||||
\add_filter(
|
||||
'gatherpress_force_online_event_link',
|
||||
function ( $force_online_event_link ) {
|
||||
// Get the current post object.
|
||||
$post = get_post();
|
||||
|
||||
// Check if we are in a valid context and the post type is 'gatherpress'.
|
||||
if ( $post && 'gatherpress_event' === $post->post_type ) {
|
||||
// Add your custom logic here to decide whether to force the link.
|
||||
// For example, force it only if a specific meta field exists.
|
||||
if ( get_post_meta( $post->ID, '_event_bridge_for_activitypub_event_source', true ) ) {
|
||||
return true; // Force the online event link.
|
||||
}
|
||||
}
|
||||
|
||||
return $force_online_event_link; // Default behavior.
|
||||
},
|
||||
10,
|
||||
1
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* Modern Events Calendar (Lite)
|
||||
*
|
||||
* Defines all the necessary meta information for the integration of the
|
||||
* WordPress plugin "Modern Events Calendar (Lite)".
|
||||
*
|
||||
* @link https://webnus.net/modern-events-calendar/
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Event\Modern_Events_Calendar_Lite as Modern_Events_Calendar_Lite_Transformer;
|
||||
|
||||
/**
|
||||
* Modern Events Calendar (Lite)
|
||||
*
|
||||
* Defines all the necessary meta information for the integration of the
|
||||
* WordPress plugin "Modern Events Calendar (Lite)".
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class Modern_Events_Calendar_Lite extends Event_Plugin_Integration {
|
||||
/**
|
||||
* Returns the full plugin file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
return 'modern-events-calendar-lite/modern-events-calendar-lite.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the event post type of the plugin.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_post_type(): string {
|
||||
// See MEC_feature_events->get_main_post_type().
|
||||
return 'mec-events';
|
||||
}
|
||||
|
||||
/**
|
||||
* 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( 'MEC-settings', 'MEC-support', 'MEC-ix', 'MEC-wizard', 'MEC-addons', 'mec-intro' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the taxonomy used for the plugin's event categories.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_event_category_taxonomy(): string {
|
||||
return 'mec_category';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ActivityPub transformer for a Modern_Events_Calendar_Lite event post.
|
||||
*
|
||||
* @param \WP_Post $post The WordPress post object of the Event.
|
||||
* @return Modern_Events_Calendar_Lite_Transformer
|
||||
*/
|
||||
public static function get_activitypub_event_transformer( $post ): Modern_Events_Calendar_Lite_Transformer {
|
||||
return new Modern_Events_Calendar_Lite_Transformer( $post, self::get_event_category_taxonomy() );
|
||||
}
|
||||
}
|
@ -0,0 +1,155 @@
|
||||
<?php
|
||||
/**
|
||||
* The Events Calendar.
|
||||
*
|
||||
* Defines all the necessary meta information for the integration of the
|
||||
* WordPress plugin "The Events Calendar".
|
||||
*
|
||||
* @link https://wordpress.org/plugins/the-events-calendar/
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Event\The_Events_Calendar as The_Events_Calendar_Event_Transformer;
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Place\The_Events_Calendar as The_Events_Calendar_Place_Transformer;
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transmogrifier\The_Events_Calendar as The_Events_Calendar_Transmogrifier;
|
||||
|
||||
/**
|
||||
* The Events Calendar.
|
||||
*
|
||||
* Defines all the necessary meta information for the integration of the
|
||||
* WordPress plugin "The Events Calendar".
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class The_Events_Calendar extends Event_Plugin_Integration implements Feature_Event_Sources {
|
||||
/**
|
||||
* Returns the full plugin file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
return 'the-events-calendar/the-events-calendar.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the event post type of the plugin.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_post_type(): string {
|
||||
return class_exists( '\Tribe__Events__Main' ) ? \Tribe__Events__Main::POSTTYPE : 'tribe_event';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the taxonomy used for the plugin's event categories.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_event_category_taxonomy(): string {
|
||||
return class_exists( '\Tribe__Events__Main' ) ? \Tribe__Events__Main::TAXONOMY : 'tribe_events_cat';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ActivityPub transformer for a The_Events_Calendar event post.
|
||||
*
|
||||
* @param \WP_Post $post The WordPress post object of the Event.
|
||||
* @return The_Events_Calendar_Event_Transformer
|
||||
*/
|
||||
public static function get_activitypub_event_transformer( $post ): The_Events_Calendar_Event_Transformer {
|
||||
return new The_Events_Calendar_Event_Transformer( $post, self::get_event_category_taxonomy() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the location/venue post type used by tribe.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_place_post_type(): string {
|
||||
return class_exists( '\Tribe__Events__Venue' ) ? \Tribe__Events__Venue::POSTTYPE : 'tribe_venue';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the organizers post type used by tribe.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_organizer_post_type(): string {
|
||||
return class_exists( '\Tribe__Events__Organizer' ) ? \Tribe__Events__Organizer::POSTTYPE : 'tribe_organizer';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ActivityPub transformer for a The_Events_Calendar venue post.
|
||||
*
|
||||
* @param \WP_Post $post The WordPress post object of the venue.
|
||||
* @return The_Events_Calendar_Place_Transformer
|
||||
*/
|
||||
public static function get_activitypub_place_transformer( $post ): The_Events_Calendar_Place_Transformer {
|
||||
return new The_Events_Calendar_Place_Transformer( $post );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the IDs of the admin pages of the plugin.
|
||||
*
|
||||
* @return array The settings page urls.
|
||||
*/
|
||||
public static function get_settings_pages(): array {
|
||||
if ( class_exists( '\Tribe\Events\Admin\Settings' ) ) {
|
||||
$page = \Tribe\Events\Admin\Settings::$settings_page_id;
|
||||
} else {
|
||||
$page = 'tec-events-settings';
|
||||
}
|
||||
return array( $page );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Transmogrifier for The_Events_Calendar.
|
||||
*/
|
||||
public static function get_transmogrifier(): string {
|
||||
return The_Events_Calendar_Transmogrifier::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of Post IDs of events that have ended.
|
||||
*
|
||||
* @param int $ends_before_time Filter to only get events that ended before that datetime as unix-time.
|
||||
*
|
||||
* @return array<int>
|
||||
*/
|
||||
public static function get_cached_remote_events( $ends_before_time ): array {
|
||||
add_filter(
|
||||
'tribe_repository_events_apply_modifier_schema_entry',
|
||||
array( self::class, 'add_is_activitypub_remote_cached_to_query' ),
|
||||
10,
|
||||
1
|
||||
);
|
||||
|
||||
$events = tribe_events()->where( 'ends_before', $ends_before_time )->get_ids();
|
||||
|
||||
remove_filter(
|
||||
'tribe_repository_events_apply_modifier_schema_entry',
|
||||
array( self::class, 'add_is_activitypub_remote_cached_to_query' )
|
||||
);
|
||||
|
||||
return $events;
|
||||
}
|
||||
|
||||
/**
|
||||
* Only show remote cached ActivityPub events in Tribe query.
|
||||
*
|
||||
* @param array $schema_entry The current schema entry.
|
||||
* @return array The modified schema entry.
|
||||
*/
|
||||
public static function add_is_activitypub_remote_cached_to_query( $schema_entry ) {
|
||||
$schema_entry['meta_query']['is-remote-cached'] = array(
|
||||
'key' => '_event_bridge_for_activitypub_event_source',
|
||||
'compare' => 'EXISTS',
|
||||
);
|
||||
return $schema_entry;
|
||||
}
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/**
|
||||
* VS Events LIst.
|
||||
*
|
||||
* Defines all the necessary meta information for the integration of the WordPress event plugin
|
||||
* "Very Simple Events List".
|
||||
*
|
||||
* @link https://wordpress.org/plugins/very-simple-event-list/
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Event\VS_Event_List as VS_Event_List_Transformer;
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transmogrifier\VS_Event_List as VS_Event_List_Transmogrifier;
|
||||
use WP_Query;
|
||||
|
||||
/**
|
||||
* VS Events LIst.
|
||||
*
|
||||
* Defines all the necessary meta information for the integration of the WordPress event plugin
|
||||
* "Very Simple Events List".
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class VS_Event_List extends Event_Plugin_Integration implements Feature_Event_Sources {
|
||||
/**
|
||||
* Returns the full plugin file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
return 'very-simple-event-list/vsel.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the event post type of the plugin.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_post_type(): string {
|
||||
return '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( 'settings_page_vsel' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the taxonomy used for the plugin's event categories.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_event_category_taxonomy(): string {
|
||||
return 'event_cat';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ActivityPub transformer for a VS_Event_List event post.
|
||||
*
|
||||
* @param \WP_Post $post The WordPress post object of the Event.
|
||||
* @return VS_Event_List_Transformer
|
||||
*/
|
||||
public static function get_activitypub_event_transformer( $post ): VS_Event_List_Transformer {
|
||||
return new VS_Event_List_Transformer( $post, self::get_event_category_taxonomy() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Transmogrifier for The_Events_Calendar.
|
||||
*/
|
||||
public static function get_transmogrifier(): string {
|
||||
return VS_Event_List_Transmogrifier::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of Post IDs of events that have ended.
|
||||
*
|
||||
* @param int $ends_before_time Filter to only get events that ended before that datetime as unix-time.
|
||||
*
|
||||
* @return array<int>
|
||||
*/
|
||||
public static function get_cached_remote_events( $ends_before_time ): array {
|
||||
$args = array(
|
||||
'post_type' => 'event',
|
||||
'posts_per_page' => -1,
|
||||
'fields' => 'ids',
|
||||
'meta_query' => array(
|
||||
'relation' => 'AND',
|
||||
array(
|
||||
'key' => '_event_bridge_for_activitypub_event_source',
|
||||
'compare' => 'EXISTS',
|
||||
),
|
||||
array(
|
||||
'key' => 'event-date',
|
||||
'value' => $ends_before_time,
|
||||
'type' => 'NUMERIC',
|
||||
'compare' => '<',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$query = new WP_Query( $args );
|
||||
|
||||
$post_ids = $query->posts;
|
||||
|
||||
return $post_ids;
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* WP Event Manager.
|
||||
*
|
||||
* Defines all the necessary meta information for the Integration of the
|
||||
* WordPress event plugin "WP Event Manager".
|
||||
*
|
||||
* @link https://de.wordpress.org/plugins/wp-event-manager
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Event\WP_Event_Manager as WP_Event_Manager_Transformer;
|
||||
|
||||
/**
|
||||
* Interface for a supported event plugin.
|
||||
*
|
||||
* This interface defines which information is necessary for a supported event plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class WP_Event_Manager extends Event_Plugin_Integration {
|
||||
/**
|
||||
* Returns the full plugin file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
return 'wp-event-manager/wp-event-manager.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the event post type of the plugin.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_post_type(): string {
|
||||
return 'event_listing';
|
||||
}
|
||||
|
||||
/**
|
||||
* 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( 'event-manager-settings' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the taxonomy used for the plugin's event categories.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_event_category_taxonomy(): string {
|
||||
return 'event_listing_category';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ActivityPub transformer for a WP_Event_Manager event post.
|
||||
*
|
||||
* @param \WP_Post $post The WordPress post object of the Event.
|
||||
* @return WP_Event_Manager_Transformer
|
||||
*/
|
||||
public static function get_activitypub_event_transformer( $post ): WP_Event_Manager_Transformer {
|
||||
return new WP_Event_Manager_Transformer( $post, self::get_event_category_taxonomy() );
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Interface for defining Methods needed for the Event Sources feature.
|
||||
*
|
||||
* The Event Sources feature is about following other ActivityPub actors and
|
||||
* importing their events. That means treating them as cache and listing them.
|
||||
* Events should be deleted some time after they have ended.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @since 1.0.0
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
/**
|
||||
* Interface for an event plugin integration that supports the Event Sources feature.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
interface Feature_Event_Sources {
|
||||
/**
|
||||
* Returns the full class name of the transmogrifier.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_transmogrifier(): string;
|
||||
|
||||
/**
|
||||
* Retrieves a list of post IDs for cached remote events that have ended.
|
||||
*
|
||||
* Filters the events to include only those that ended before the specified timestamp.
|
||||
*
|
||||
* @param int $ends_before_time Unix timestamp. Only events ending before this time will be included.
|
||||
*
|
||||
* @return int[] List of post IDs for events that match the criteria.
|
||||
*/
|
||||
public static function get_cached_remote_events( $ends_before_time ): array;
|
||||
}
|
Reference in New Issue
Block a user