simple example

This commit is contained in:
André Menrath 2023-11-19 19:56:03 +01:00
parent ac45d28d2f
commit b92d2d01b4
2 changed files with 86 additions and 0 deletions

34
activitypub-tribe.php Normal file
View file

@ -0,0 +1,34 @@
<?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\Transformers_Manager $transformers_manager ActivtiyPub transformers manager.
* @return void
*/
function register_tribe_transformer( $transformers_manager ) {
require_once( __DIR__ . '/transformers/tribe-transformer.php' );
$transformers_manager->register( new \Activitypub_Tribe_Transformer() );
}
add_action( 'activitypub/transformers/register', 'register_tribe_transformer' );

View file

@ -0,0 +1,52 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* ActivityPub Tribe Transformer
*
* @since 1.0.0
*/
class Activitypub_Tribe_Transformer 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-tribe/tribe';
}
/**
* Get widget title.
*
* Retrieve Transformer title.
*
* @since 1.0.0
* @access public
* @return string Widget title.
*/
public function get_label() {
return 'The Events Calendar';
}
/**
* 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 [ 'tribe_events' ];
}
}