wip
All checks were successful
PHP Code Checker / PHP Code Checker (pull_request) Successful in 33s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 58s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 1m0s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 59s

This commit is contained in:
André Menrath 2024-10-12 10:34:21 +02:00
parent 596e32fe26
commit dedc0079ac
3 changed files with 124 additions and 0 deletions

View file

@ -0,0 +1,63 @@
<?php
/**
* ActivityPub Transformer for Events managed with Eventin.
*
* @link https://support.themewinter.com/docs/plugins/docs-category/eventin/
*
* @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\Place;
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event;
use Etn\Core\Event\Event_Model;
/**
* ActivityPub Transformer for Events managed with Eventin.
*
* @since 1.0.0
*/
final class Eventin extends Event {
/**
* Holds the EM_Event object.
*
* @var Event_Model
*/
protected $event_model;
/**
* Extend the constructor, to also set the Event Model.
*
* 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->event_model = new Event_Model( $this->wp_object->ID );
}
/**
* Get the end time from the event object.
*/
protected function get_start_time(): string {
return \gmdate( 'Y-m-d\TH:i:s\Z', \time() );
}
/**
* Get status of the tribe event
*
* @return string status of the event
*/
public function get_status(): ?string {
return 'CONFIRMED';
}
}

View file

@ -129,6 +129,7 @@ class Setup {
'\ActivityPub_Event_Bridge\Plugins\The_Events_Calendar',
'\ActivityPub_Event_Bridge\Plugins\VS_Event_List',
'\ActivityPub_Event_Bridge\Plugins\WP_Event_Manager',
'\ActivityPub_Event_Bridge\Plugins\Eventin',
);
/**

View file

@ -0,0 +1,60 @@
<?php
/**
* The Events Calendar.
*
* Defines all the necessary meta information for the events calendar.
*
* @link https://wordpress.org/plugins/the-events-calendar/
* @package ActivityPub_Event_Bridge
* @since 1.0.0
*/
namespace ActivityPub_Event_Bridge\Plugins;
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
/**
* Interface for a supported event plugin.
*
* This interface defines which information is necessary for a supported event plugin.
*
* @since 1.0.0
*/
final class Eventin extends Event_plugin {
/**
* Returns the full plugin file.
*
* @return string
*/
public static function get_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 ID of the main settings page of the plugin.
*
* @return string The settings page url.
*/
public static function get_settings_page(): string {
return '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';
}
}