2023-11-24 15:36:51 +01:00
|
|
|
<?php
|
|
|
|
/**
|
2023-11-25 12:05:12 +01:00
|
|
|
* Plugin Name: ActivityPub Transformers for Events
|
2023-11-24 15:36:51 +01:00
|
|
|
* 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
|
2023-11-27 19:18:06 +01:00
|
|
|
*
|
|
|
|
* @package activitypub-event-transformer
|
2023-11-24 15:36:51 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
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 ) {
|
2023-11-27 19:18:06 +01:00
|
|
|
require_once __DIR__ . '/activitypub/transformer/class-tribe.php';
|
|
|
|
$transformers_manager->register( new \Tribe() );
|
2023-11-25 12:05:12 +01:00
|
|
|
|
2023-11-27 19:18:06 +01:00
|
|
|
require_once __DIR__ . '/activitypub/transformer/class-vs-event.php';
|
|
|
|
$transformers_manager->register( new \VS_Event() );
|
2023-11-24 15:36:51 +01:00
|
|
|
}
|
|
|
|
|
2023-11-27 19:18:06 +01:00
|
|
|
add_filter(
|
|
|
|
'activitypub_json_context',
|
|
|
|
function ( $context ) {
|
|
|
|
$context[2]['commentsEnabled'] = array(
|
|
|
|
'@id' => 'pt:commentsEnabled',
|
|
|
|
'@type' => 'sc:Boolean',
|
|
|
|
);
|
|
|
|
return $context;
|
|
|
|
},
|
|
|
|
10,
|
|
|
|
2
|
|
|
|
);
|
|
|
|
|
2023-11-24 15:36:51 +01:00
|
|
|
add_action( 'activitypub_transformers_register', 'register_event_transformers' );
|