diff --git a/includes/activitypub/transformer/class-events-manager.php b/includes/activitypub/transformer/class-events-manager.php
index 476fe2c..ccd2b13 100644
--- a/includes/activitypub/transformer/class-events-manager.php
+++ b/includes/activitypub/transformer/class-events-manager.php
@@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
*
* @since 1.0.0
*/
-class Events_Manager extends Event_Transformer {
+final class Events_Manager extends Event_Transformer {
/**
* Holds the EM_Event object.
diff --git a/includes/activitypub/transformer/class-gatherpress.php b/includes/activitypub/transformer/class-gatherpress.php
index 077c600..6ff8b4d 100644
--- a/includes/activitypub/transformer/class-gatherpress.php
+++ b/includes/activitypub/transformer/class-gatherpress.php
@@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
*
* @since 1.0.0
*/
-class GatherPress extends Event {
+final class GatherPress extends Event {
/**
* The target ActivityPub Event object of the transformer.
diff --git a/includes/activitypub/transformer/class-the-events-calendar.php b/includes/activitypub/transformer/class-the-events-calendar.php
index acfa499..1c40e95 100644
--- a/includes/activitypub/transformer/class-the-events-calendar.php
+++ b/includes/activitypub/transformer/class-the-events-calendar.php
@@ -22,7 +22,7 @@ use WP_Post;
*
* @since 1.0.0
*/
-class The_Events_Calendar extends Event {
+final class The_Events_Calendar extends Event {
/**
* The Tribe Event object.
@@ -38,9 +38,10 @@ class The_Events_Calendar extends Event {
* 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 ) {
- parent::__construct( $wp_object );
+ public function __construct( $wp_object, $wp_taxonomy ) {
+ parent::__construct( $wp_object, $wp_taxonomy );
$this->tribe_event = \tribe_get_event( $wp_object );
}
diff --git a/includes/activitypub/transformer/class-vs-event-list.php b/includes/activitypub/transformer/class-vs-event-list.php
index 8eb6af3..a91e5f1 100644
--- a/includes/activitypub/transformer/class-vs-event-list.php
+++ b/includes/activitypub/transformer/class-vs-event-list.php
@@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) {
*
* @since 1.0.0
*/
-class VS_Event_List extends Event_Transformer {
+final class VS_Event_List extends Event_Transformer {
/**
* The target transformer ActivityPub Event object.
@@ -44,7 +44,7 @@ class VS_Event_List extends Event_Transformer {
* @access public
* @return string Widget name.
*/
- public function get_transformer_name() {
+ public function get_transformer_name(): string {
return 'activitypub-event-transformers/vs-event';
}
@@ -57,7 +57,7 @@ class VS_Event_List extends Event_Transformer {
* @access public
* @return string Widget title.
*/
- public function get_transformer_label() {
+ public function get_transformer_label(): string {
return 'VS Event';
}
@@ -70,7 +70,7 @@ class VS_Event_List extends Event_Transformer {
* @access public
* @return array Widget categories.
*/
- public static function get_supported_post_types() {
+ public static function get_supported_post_types(): string {
return array( 'event' );
}
@@ -81,16 +81,16 @@ class VS_Event_List extends Event_Transformer {
* @since 1.0.0
* @return string The Event Object-Type.
*/
- protected function get_type() {
+ protected function get_type(): string {
return 'Event';
}
/**
* Get the event location.
*
- * @return array The Place.
+ * @return Place The Place.
*/
- public function get_location() {
+ public function get_location(): Place {
$address = get_post_meta( $this->wp_object->ID, 'event-location', true );
$place = new Place();
$place->set_type( 'Place' );
@@ -102,7 +102,7 @@ class VS_Event_List extends Event_Transformer {
/**
* Get the end time from the events metadata.
*/
- protected function get_end_time() {
+ protected function get_end_time(): string {
$end_time = get_post_meta( $this->wp_object->ID, 'event-date', true );
return \gmdate( 'Y-m-d\TH:i:s\Z', $end_time );
}
@@ -110,7 +110,7 @@ class VS_Event_List extends Event_Transformer {
/**
* Get the end time from the events metadata.
*/
- protected function get_start_time() {
+ protected function get_start_time(): string {
$start_time = get_post_meta( $this->wp_object->ID, 'event-start-date', true );
return \gmdate( 'Y-m-d\TH:i:s\Z', $start_time );
}
@@ -118,7 +118,7 @@ class VS_Event_List extends Event_Transformer {
/**
* Get the event link from the events metadata.
*/
- private function get_event_link() {
+ private function get_event_link(): array {
$event_link = get_post_meta( $this->wp_object->ID, 'event-link', true );
if ( $event_link ) {
return array(
diff --git a/includes/admin/class-event-plugin-admin-notices.php b/includes/admin/class-event-plugin-admin-notices.php
index 82e8670..9340e81 100644
--- a/includes/admin/class-event-plugin-admin-notices.php
+++ b/includes/admin/class-event-plugin-admin-notices.php
@@ -11,6 +11,8 @@
namespace Activitypub_Event_Extensions\Admin;
+use Activitypub_Event_Extensions\Plugins\Event_Plugin;
+
/**
* Class responsible for Event Plugin related admin notices.
*
@@ -22,14 +24,14 @@ class Event_Plugin_Admin_Notices {
/**
* Information about the event plugin.
*
- * @var array
+ * @var Event_Plugin
*/
protected $event_plugin;
/**
* Adds admin notices to an active supported event plugin.
*
- * @param array $event_plugin Information about the activate event plugin.
+ * @param Event_Plugin $event_plugin Class that has implements functions to handle a certain supported activate event plugin.
*/
public function __construct( $event_plugin ) {
$this->event_plugin = $event_plugin;
@@ -43,32 +45,28 @@ class Event_Plugin_Admin_Notices {
*
* @return bool
*/
- private function event_post_type_is_not_activitypub_enabled() {
- return ! in_array( $this->event_plugin['post_type'], get_option( 'activitypub_support_post_types', array() ), true );
+ private function event_post_type_is_not_activitypub_enabled(): bool {
+ return ! in_array( $this->event_plugin::get_post_type(), get_option( 'activitypub_support_post_types', array() ), true );
}
/**
* Display the admin notices for the plugins.
+ *
+ * @return void
*/
- public function admin_notice_activitypub_not_enabled_for_post_type() {
- // 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 && $this->event_plugin['post_type'] === $screen->post_type;
- $is_event_plugins_settings_page = $this->event_plugin['settings_page_id'] === $screen->id;
-
- if ( $is_event_plugins_edit_page || $is_event_plugins_settings_page ) {
- $this->do_admin_notice_post_type_not_activitypub_enabled( $this->event_plugin['plugin_file'] );
+ public function admin_notice_activitypub_not_enabled_for_post_type(): void {
+ if ( $this->event_plugin::is_plugin_page() ) {
+ $this->do_admin_notice_post_type_not_activitypub_enabled();
}
}
/**
* Print admin notice that the current post type is not enabled in the ActivityPub plugin.
*
- * @param string $event_plugin_file The event plugin file path.
+ * @return void
*/
- private function do_admin_notice_post_type_not_activitypub_enabled( $event_plugin_file ) {
- $event_plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $event_plugin_file );
+ private function do_admin_notice_post_type_not_activitypub_enabled(): void {
+ $event_plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $this->event_plugin::get_plugin_file() );
$activitypub_plugin_data = get_plugin_data( ACTIVITYPUB_PLUGIN_FILE );
$notice = sprintf(
/* translators: 1: the name of the event plugin a admin notice is shown. 2: The name of the ActivityPub plugin. */
diff --git a/includes/admin/class-general-admin-notices.php b/includes/admin/class-general-admin-notices.php
index 8c69512..a4de156 100644
--- a/includes/admin/class-general-admin-notices.php
+++ b/includes/admin/class-general-admin-notices.php
@@ -84,7 +84,7 @@ class General_Admin_Notices {
*
* @return void
*/
- public static function activitypub_plugin_not_enabled() {
+ public static function activitypub_plugin_not_enabled(): void {
$notice = self::get_admin_notice_activitypub_plugin_not_enabled();
echo '
' . \wp_kses( $notice, self::ALLOWED_HTML ) . '
';
}
@@ -94,7 +94,7 @@ class General_Admin_Notices {
*
* @return void
*/
- public static function no_supported_event_plugin_active() {
+ public static function no_supported_event_plugin_active(): void {
$notice = self::get_admin_notice_no_supported_event_plugin_active();
echo '' . \wp_kses( $notice, self::ALLOWED_HTML ) . '
';
}
diff --git a/includes/admin/class-settings-page.php b/includes/admin/class-settings-page.php
index 22c8b1a..2a3b569 100644
--- a/includes/admin/class-settings-page.php
+++ b/includes/admin/class-settings-page.php
@@ -12,6 +12,7 @@
namespace Activitypub_Event_Extensions\Admin;
use Activitypub_Event_Extensions\Setup;
+use Activitypub_Event_Extensions\Plugins\Event_Plugin;
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
@@ -59,19 +60,20 @@ class Settings_Page {
/**
* Receive the event categories (terms) used by the event plugin.
*
- * @param array $event_plugin Contains info about a certain event plugin.
+ * @param Event_Plugin $event_plugin Contains info about a certain event plugin.
*
* @return array An array of Terms.
*/
private static function get_event_terms( $event_plugin ) {
- if ( isset( $event_plugin['taxonomy'] ) ) {
+ $taxonomy = $event_plugin::get_taxonomy();
+ if ( $taxonomy ) {
$event_terms = get_terms(
array(
- 'taxonomy' => $event_plugin['taxonomy'],
+ 'taxonomy' => $taxonomy,
'hide_empty' => true,
)
);
- return $event_terms;
+ return ! is_wp_error( $event_terms ) ? $event_terms : array();
} else {
return array();
}
@@ -87,8 +89,8 @@ class Settings_Page {
$event_terms = array();
- foreach ( $event_plugins as $event_plugin_name => $events_plugin_info ) {
- $event_terms = array_merge( $event_terms, self::get_event_terms( $events_plugin_info ) );
+ foreach ( $event_plugins as $event_plugin ) {
+ $event_terms = array_merge( $event_terms, self::get_event_terms( $event_plugin ) );
}
$args = array(
diff --git a/includes/class-settings.php b/includes/class-settings.php
index 26248af..ceec701 100644
--- a/includes/class-settings.php
+++ b/includes/class-settings.php
@@ -26,12 +26,19 @@ defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
class Settings {
const SETTINGS_SLUG = 'activitypub-event-extensions';
+ /**
+ * The default ActivityPub event category.
+ *
+ * @var string
+ */
const DEFAULT_EVENT_CATEGORY = 'MEETING';
/**
* Register the settings for the ActivityPub Event Extensions plugin.
+ *
+ * @return void
*/
- public static function register_settings() {
+ public static function register_settings(): void {
\register_setting(
'activitypub-event-extensions',
'activitypub_event_extensions_default_event_category',
@@ -61,7 +68,7 @@ class Settings {
*
* @param string $event_category The ActivityPUb event category.
*/
- public static function sanitize_mapped_event_category( $event_category ) {
+ public static function sanitize_mapped_event_category( $event_category ): string {
return self::is_allowed_event_category( $event_category ) ? $event_category : self::DEFAULT_EVENT_CATEGORY;
}
@@ -71,8 +78,10 @@ class Settings {
* Currently only the default event categories are allowed to be target of a mapping.
*
* @param array $event_category_mappings The settings value.
+ *
+ * @return array An array that contains only valid mapping pairs.
*/
- public static function sanitize_event_category_mappings( $event_category_mappings ) {
+ public static function sanitize_event_category_mappings( $event_category_mappings ): array {
if ( empty( $event_category_mappings ) ) {
return array();
}
@@ -91,7 +100,7 @@ class Settings {
*
* @return bool True if allowed, false otherwise.
*/
- private static function is_allowed_event_category( $event_category ) {
+ private static function is_allowed_event_category( $event_category ): bool {
$allowed_event_categories = Event::DEFAULT_EVENT_CATEGORIES;
return in_array( $event_category, $allowed_event_categories, true );
}
diff --git a/includes/class-setup.php b/includes/class-setup.php
index 2a25e12..e075ee0 100644
--- a/includes/class-setup.php
+++ b/includes/class-setup.php
@@ -15,6 +15,7 @@ namespace Activitypub_Event_Extensions;
use Activitypub_Event_Extensions\Admin\Event_Plugin_Admin_Notices;
use Activitypub_Event_Extensions\Admin\General_Admin_Notices;
use Activitypub_Event_Extensions\Admin\Settings_Page;
+use Activitypub_Event_Extensions\Plugins\Event_Plugin;
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
@@ -29,34 +30,6 @@ require_once ABSPATH . 'wp-admin/includes/plugin.php';
* @since 1.0.0
*/
class Setup {
- const SUPPORTED_EVENT_PLUGINS = array(
- 'events_manager' => array(
- 'plugin_file' => 'events-manager/events-manager.php',
- 'post_type' => 'event',
- 'settings_page' => 'options-general.php?page=vsel',
- 'transformer_class' => 'Events_Manager',
- ),
- 'gatherpress' => array(
- 'plugin_file' => 'gatherpress/gatherpress.php',
- 'post_type' => 'gatherpress_event',
- 'transformer_class' => 'GatherPress',
- 'settings_page_id' => 'gatherpress_general',
- ),
- 'the_events_calendar' => array(
- 'plugin_file' => 'the-events-calendar/the-events-calendar.php',
- 'post_type' => 'tribe_events',
- 'transformer_class' => 'Tribe',
- 'settings_page_id' => 'tribe_general',
- ),
- 'vsel' => array(
- 'plugin_file' => 'very-simple-event-list/vsel.php',
- 'post_type' => 'event',
- 'settings_page_id' => 'settings_page_vsel',
- 'transformer_class' => 'VS_Event_List',
- 'taxonomy' => 'event_cat',
- ),
- );
-
/**
* Keep the information whether the ActivityPub plugin is active.
*
@@ -67,7 +40,7 @@ class Setup {
/**
* Holds an array of the currently activated supported event plugins.
*
- * @var array
+ * @var Event_Plugin[]
*/
protected $active_event_plugins = array();
@@ -80,7 +53,7 @@ class Setup {
*/
protected function __construct() {
$this->activitypub_plugin_is_active = is_plugin_active( 'activitypub/activitypub.php' );
- $this->active_event_plugins = self::detect_supported_event_plugins();
+ $this->active_event_plugins = self::detect_active_event_plugins();
$this->setup_hooks();
}
@@ -109,40 +82,47 @@ class Setup {
return self::$instance;
}
- public static function get_event_plugins() {
- // Get all plugin definition classes from the includes/plugins folder.
- $plugin_files = glob( ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_DIR . 'includes/plugins/class-*.php' );
-
- foreach ( $plugin_files as $plugin_file ) {
- require_once $plugin_file;
-
- }
- return $basenames;
+ /**
+ * Getter function for the active event plugins.
+ *
+ * @return Event_Plugin[]
+ */
+ public function get_active_event_plugins() {
+ return $this->active_event_plugins;
}
+ /**
+ * Holds all the classes for the supported event plugins.
+ *
+ * @var array
+ */
+ private const EVENT_PLUGIN_CLASSES = array(
+ '\Activitypub_Event_Extensions\Plugins\Events_Manager',
+ '\Activitypub_Event_Extensions\Plugins\GatherPress',
+ '\Activitypub_Event_Extensions\Plugins\The_Events_Calendar',
+ '\Activitypub_Event_Extensions\Plugins\VS_Event_List',
+ );
+
/**
* Function that checks for supported activated event plugins.
*
* @return array List of supported event plugins as keys from the SUPPORTED_EVENT_PLUGINS const.
*/
- public static function detect_supported_event_plugins(): array {
+ public static function detect_active_event_plugins(): array {
$active_event_plugins = array();
- foreach ( self::SUPPORTED_EVENT_PLUGINS as $event_plugin_key => $event_plugin ) {
- if ( \is_plugin_active( $event_plugin['plugin_file'] ) ) {
- $active_event_plugins[ $event_plugin_key ] = $event_plugin;
+
+ foreach ( self::EVENT_PLUGIN_CLASSES as $event_plugin_class ) {
+ if ( ! class_exists( $event_plugin_class ) || ! method_exists( $event_plugin_class, 'get_plugin_file' ) ) {
+ continue;
+ }
+ $event_plugin_file = call_user_func( array( $event_plugin_class, 'get_plugin_file' ) );
+ if ( \is_plugin_active( $event_plugin_file ) ) {
+ $active_event_plugins[] = new $event_plugin_class();
}
}
return $active_event_plugins;
}
- /**
- * Getter function for the active event plugins.
- */
- public function get_active_event_plugins() {
- return $this->active_event_plugins;
- }
-
-
/**
* Set up hooks for various purposes.
*
@@ -178,8 +158,10 @@ class Setup {
* Add the CSS for the admin pages.
*
* @param string $hook_suffix The suffix of the hook.
+ *
+ * @return void
*/
- public static function enqueue_styles( $hook_suffix ) {
+ public static function enqueue_styles( $hook_suffix ): void {
if ( false !== strpos( $hook_suffix, 'activitypub-event-extensions' ) ) {
wp_enqueue_style(
'activitypub-event-extensions-admin-styles',
@@ -229,9 +211,11 @@ class Setup {
// Get the transformer for a specific event plugins event-post type.
foreach ( $this->active_event_plugins as $event_plugin ) {
- if ( $wp_object->post_type === $event_plugin['post_type'] ) {
- $transformer_class = 'Activitypub_Event_Extensions\Activitypub\Transformer\\' . $event_plugin['transformer_class'];
- return new $transformer_class( $wp_object, $event_plugin['taxonomy'] );
+ if ( $wp_object->post_type === $event_plugin->get_post_type() ) {
+ $transformer_class = $event_plugin->get_activitypub_event_transformer_class();
+ if ( class_exists( $transformer_class ) ) {
+ return new $transformer_class( $wp_object, $event_plugin->get_taxonomy() );
+ }
}
}
@@ -266,7 +250,7 @@ class Setup {
*
* @return void
*/
- public function activate() {
+ public function activate(): void {
// Don't allow plugin activation, when the ActivityPub plugin is not activated yet.
if ( ! $this->activitypub_plugin_is_active ) {
deactivate_plugins( plugin_basename( ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_FILE ) );
diff --git a/includes/plugins/class-event-plugin.php b/includes/plugins/class-event-plugin.php
new file mode 100644
index 0000000..25b753b
--- /dev/null
+++ b/includes/plugins/class-event-plugin.php
@@ -0,0 +1,76 @@
+base && static::get_post_type() === $screen->post_type;
+ $is_event_plugins_settings_page = static::get_settings_page() === $screen->id;
+
+ return $is_event_plugins_edit_page || $is_event_plugins_settings_page;
+ }
+
+ /**
+ * Returns the Activitypub transformer for the event plugins event post type.
+ */
+ public static function get_activitypub_event_transformer_class(): string {
+ return str_replace( 'Plugins', 'Activitypub\Transformer', static::class );
+ }
+}
diff --git a/includes/plugins/class-events-manager.php b/includes/plugins/class-events-manager.php
index f50920e..26a8926 100644
--- a/includes/plugins/class-events-manager.php
+++ b/includes/plugins/class-events-manager.php
@@ -14,8 +14,6 @@ namespace Activitypub_Event_Extensions\Plugins;
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
-require_once __DIR__ . '/interface-event-plugin.php';
-
/**
* Interface for a supported event plugin.
*
@@ -23,14 +21,14 @@ require_once __DIR__ . '/interface-event-plugin.php';
*
* @since 1.0.0
*/
-class Events_Manager implements Event_Plugin {
+final class Events_Manager extends Event_Plugin {
/**
* Returns the full plugin file.
*
* @return string
*/
public static function get_plugin_file(): string {
- return 'the-events-calendar/the-events-calendar.php';
+ return 'events-manager/events-manager.php';
}
/**
@@ -51,15 +49,6 @@ class Events_Manager implements Event_Plugin {
return 'wp-admin/edit.php?post_type=event&page=events-manager-options#general';
}
- /**
- * Returns the ActivityPub transformer class.
- *
- * @return string
- */
- public static function get_activitypub_transformer_class_name(): string {
- return 'GatherPress';
- }
-
/**
* Returns the taxonomy used for the plugin's event categories.
*
diff --git a/includes/plugins/class-gatherpress.php b/includes/plugins/class-gatherpress.php
index 670916d..4754960 100644
--- a/includes/plugins/class-gatherpress.php
+++ b/includes/plugins/class-gatherpress.php
@@ -14,13 +14,6 @@ namespace Activitypub_Event_Extensions\Plugins;
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
-require_once __DIR__ . '/interface-event-plugin.php';
-
-use Activitypub_Event_Extensions\Plugins\Event_Plugin;
-use GatherPress\Core\Event;
-use GatherPress\Core\Topic;
-use GatherPress\Core\Utility;
-
/**
* Interface for a supported event plugin.
*
@@ -28,14 +21,14 @@ use GatherPress\Core\Utility;
*
* @since 1.0.0
*/
-class Gatherpress implements Event_Plugin {
+final class GatherPress extends Event_Plugin {
/**
* Returns the full plugin file.
*
* @return string
*/
public static function get_plugin_file(): string {
- return 'the-events-calendar/the-events-calendar.php';
+ return 'gatherpress/gatherpress.php';
}
/**
@@ -44,7 +37,7 @@ class Gatherpress implements Event_Plugin {
* @return string
*/
public static function get_post_type(): string {
- return Event::POST_TYPE;
+ return class_exists( '\GatherPress\Core\Event' ) ? \GatherPress\Core\Event::POST_TYPE : 'gatherpress_event';
}
/**
@@ -53,7 +46,7 @@ class Gatherpress implements Event_Plugin {
* @return string The settings page url.
*/
public static function get_settings_page(): string {
- return Utility::prefix_key( 'general' );
+ return class_exists( '\GatherPress\Core\Utility' ) ? \GatherPress\Core\Utility::prefix_key( 'general' ) : 'gatherpress_general';
}
/**
@@ -71,6 +64,6 @@ class Gatherpress implements Event_Plugin {
* @return string
*/
public static function get_taxonomy(): string {
- return Topic::TAXONOMY;
+ return class_exists( '\GatherPress\Core\Topic' ) ? \GatherPress\Core\Topic::TAXONOMY : 'gatherpress_topic';
}
}
diff --git a/includes/plugins/class-the-events-calendar.php b/includes/plugins/class-the-events-calendar.php
index e48505d..21e4c69 100644
--- a/includes/plugins/class-the-events-calendar.php
+++ b/includes/plugins/class-the-events-calendar.php
@@ -14,10 +14,6 @@ namespace Activitypub_Event_Extensions\Plugins;
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
-require_once __DIR__ . '/interface-event-plugin.php';
-
-use Activitypub_Event_Extensions\Plugins\Event_Plugin;
-
/**
* Interface for a supported event plugin.
*
@@ -25,7 +21,7 @@ use Activitypub_Event_Extensions\Plugins\Event_Plugin;
*
* @since 1.0.0
*/
-class The_Events_Calendar implements Event_plugin {
+final class The_Events_Calendar extends Event_plugin {
/**
* Returns the full plugin file.
*
@@ -41,11 +37,9 @@ class The_Events_Calendar implements Event_plugin {
* @return string
*/
public static function get_post_type(): string {
- return \Tribe__Events__Main::POSTTYPE;
+ return class_exists( '\Tribe__Events__Main' ) ? \Tribe__Events__Main::POSTTYPE : 'tribe_event';
}
- const POST_TYPE = class_exists( 'Tribe__Events__Main' ) ? \Tribe__Events__Main::POSTTYPE : 'tribe_event';
-
/**
* Returns the ID of the main settings page of the plugin.
*
@@ -56,21 +50,12 @@ class The_Events_Calendar implements Event_plugin {
return 'edit.php?post_type=tribe_events&page=tec-events-settings';
}
- /**
- * Returns the ActivityPub transformer class.
- *
- * @return string
- */
- public static function get_activitypub_transformer_class_name(): string {
- return 'Tribe';
- }
-
/**
* Returns the taxonomy used for the plugin's event categories.
*
* @return string
*/
public static function get_taxonomy(): string {
- return Tribe__Events__Main::TAXONOMY;
+ return class_exists( '\Tribe__Events__Main' ) ? \Tribe__Events__Main::TAXONOMY : 'tribe_events_cat';
}
}
diff --git a/includes/plugins/class-vs-event-list.php b/includes/plugins/class-vs-event-list.php
index e5bae52..ff96a47 100644
--- a/includes/plugins/class-vs-event-list.php
+++ b/includes/plugins/class-vs-event-list.php
@@ -12,11 +12,11 @@
namespace Activitypub_Event_Extensions\Plugins;
+use Activitypub_Event_Extensions\Event_Plugins;
+
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
-require_once __DIR__ . '/interface-event-plugin.php';
-
/**
* Interface for a supported event plugin.
*
@@ -24,7 +24,7 @@ require_once __DIR__ . '/interface-event-plugin.php';
*
* @since 1.0.0
*/
-class VS_Event_List implements Event_Plugin {
+final class VS_Event_List extends Event_Plugin {
/**
* Returns the full plugin file.
*
diff --git a/includes/plugins/interface-event-plugin.php b/includes/plugins/interface-event-plugin.php
deleted file mode 100644
index c4859e5..0000000
--- a/includes/plugins/interface-event-plugin.php
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
+