mono-repo for transformers
This commit is contained in:
parent
3afd15a1a8
commit
898aea6d44
3 changed files with 109 additions and 32 deletions
39
activitypub-event-transformers.php
Normal file
39
activitypub-event-transformers.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* Plugin Name: ActivityPub Event Transformers for Events
|
||||
* Description: Custom ActivityPub Transformers for Events
|
||||
* Plugin URI: https://event-federation.eu/
|
||||
* Version: 1.0.0
|
||||
* Author: André Menrath
|
||||
* Author URI: https://graz.social/@linos
|
||||
* Text Domain: activitypub-event-transformers
|
||||
*
|
||||
* ActivityPub tested up to: 1.2.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Register Tribe Transformer.
|
||||
*
|
||||
* Include fransformer file and register transformer class.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @param \Activitypub\Transformer\Transformers_Manager $transformers_manager ActivtiyPub transformers manager.
|
||||
* @return void
|
||||
*/
|
||||
function register_event_transformers( $transformers_manager ) {
|
||||
if ( is_plugin_active( 'the-events-calendar/the-events-calendar.php' ) ) {
|
||||
require_once __DIR__ . '/activitypub/transformer/tribe.php';
|
||||
$transformers_manager->register( new \Tribe() );
|
||||
}
|
||||
|
||||
if ( is_plugin_active( 'vsel/vsel.php' ) ) {
|
||||
require_once __DIR__ . '/activitypub/transformer/vs-event.php';
|
||||
$transformers_manager->register( new \VS_Event() );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'activitypub_transformers_register', 'register_event_transformers' );
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Plugin Name: ActivityPub Transformer for The Events Calendar
|
||||
* Description: ActivityPub Transformer for The Events Calendar.
|
||||
* Plugin URI: https://event-federation.eu/
|
||||
* Version: 1.0.0
|
||||
* Author: André Menrath
|
||||
* Author URI: https://graz.social/@linos
|
||||
* Text Domain: activitypub-tribe
|
||||
*
|
||||
* ActivityPub tested up to: 1.2.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Register Tribe Transformer.
|
||||
*
|
||||
* Include fransformer file and register transformer class.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @param \Activitypub\Transformer\Transformers_Manager $transformers_manager ActivtiyPub transformers manager.
|
||||
* @return void
|
||||
*/
|
||||
function register_tribe_transformer( $transformers_manager ) {
|
||||
require_once( __DIR__ . '/activitypub/transformer/tribe.php' );
|
||||
$transformers_manager->register( new \Tribe() );
|
||||
}
|
||||
|
||||
add_action( 'activitypub_transformers_register', 'register_tribe_transformer' );
|
70
activitypub/transformer/vs-event.php
Normal file
70
activitypub/transformer/vs-event.php
Normal file
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* ActivityPub Tribe Transformer
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Tribe extends \Activitypub\Transformer\Base {
|
||||
|
||||
/**
|
||||
* Get widget name.
|
||||
*
|
||||
* Retrieve oEmbed widget name.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return string Widget name.
|
||||
*/
|
||||
public function get_name() {
|
||||
return 'activitypub-event-transformers/vs-event';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get widget title.
|
||||
*
|
||||
* Retrieve Transformer title.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return string Widget title.
|
||||
*/
|
||||
public function get_label() {
|
||||
return 'VS Event';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ActivityStreams 2.0 Object-Type for an Event.
|
||||
*
|
||||
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-event
|
||||
* @since 1.0.0
|
||||
* @return string The Event Object-Type.
|
||||
*/
|
||||
protected function get_object_type() {
|
||||
return 'Event';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get supported post types.
|
||||
*
|
||||
* Retrieve the list of supported WordPress post types this transformer widget can handle.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return array Widget categories.
|
||||
*/
|
||||
public function get_supported_post_types() {
|
||||
return [ 'event' ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the event location
|
||||
*/
|
||||
public function get_event_location() {
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue