Add Transformer for Eventin (WP Event Solution) #62
3 changed files with 124 additions and 0 deletions
63
includes/activitypub/transformer/class-eventin.php
Normal file
63
includes/activitypub/transformer/class-eventin.php
Normal 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';
|
||||
}
|
||||
}
|
|
@ -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',
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
60
includes/plugins/class-eventin.php
Normal file
60
includes/plugins/class-eventin.php
Normal 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';
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue