rename plugin to extensions
Some checks failed
Deploy to https://wordpress-test.event-federation.eu/ / deploy (push) Has been cancelled
Some checks failed
Deploy to https://wordpress-test.event-federation.eu/ / deploy (push) Has been cancelled
This commit is contained in:
parent
5d6df84c8b
commit
2963794a6f
4 changed files with 74 additions and 15 deletions
|
@ -1 +1,7 @@
|
|||
This is a WordPress plugin that contains several example custom transformers for the [WordPress ActivityPub plugin](https://wordpress.org/plugins/activitypub/).
|
||||
This is a WordPress plugin improves the Fediverse integration of Events via the [WordPress ActivityPub plugin](https://wordpress.org/plugins/activitypub/).
|
||||
|
||||
Currently supported Event plugins:
|
||||
|
||||
- The Events Calendar
|
||||
- VS Event List
|
||||
- Events Manager
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<?php
|
||||
/**
|
||||
* Plugin Name: ActivityPub Transformers for Events
|
||||
* Description: Custom ActivityPub Transformers for Events
|
||||
* Plugin Name: ActivityPub Event Extensions
|
||||
* Description: Custom ActivityPub Transformers and Integretions for common Event Plugins
|
||||
* Plugin URI: https://event-federation.eu/
|
||||
* Version: 1.0.0
|
||||
* Author: André Menrath
|
||||
* Author URI: https://graz.social/@linos
|
||||
* Text Domain: activitypub-event-transformers
|
||||
* Text Domain: activitypub-event-extensions
|
||||
* License: AGPL-3.0-or-later
|
||||
*
|
||||
* ActivityPub tested up to: 1.3.0
|
||||
* ActivityPub tested up to: 2.0.1
|
||||
*
|
||||
* @package activitypub-event-transformer
|
||||
* @package activitypub-event-extensions
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
|
@ -220,22 +220,75 @@ class VS_Event extends Post {
|
|||
return $summary;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generic setter.
|
||||
*
|
||||
* @param string $key The key to set.
|
||||
* @param string $value The value to set.
|
||||
*
|
||||
* @return mixed The value.
|
||||
*/
|
||||
public function set( $key, $value ) {
|
||||
if ( ! $this->ap_object->has( $key ) ) {
|
||||
return new WP_Error( 'invalid_key', __( 'Invalid key', 'activitypub' ), array( 'status' => 404 ) );
|
||||
}
|
||||
|
||||
$setter_function = 'set_' . $key;
|
||||
|
||||
if ( in_array($key, get_class_methods( $this ) )) {
|
||||
$getter_function = 'get_' . $key;
|
||||
$this->ap_object->$setter_function( $this->$getter_function );
|
||||
} else {
|
||||
$this->ap_object->$setter_function( $value );
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic function to implement setter
|
||||
*
|
||||
* @param string $method The method name.
|
||||
* @param string $params The method params.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __call( $method, $params ) {
|
||||
$var = \strtolower( \substr( $method, 4 ) );
|
||||
|
||||
if ( \strncasecmp( $method, 'set', 3 ) === 0 ) {
|
||||
return $this->set( $var, $params[0] );
|
||||
}
|
||||
|
||||
// when do we need: call_user_func( array( $activitypub_object, $setter ), $value );
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform the WordPress Object into an ActivityPub Object.
|
||||
*
|
||||
* @return Activitypub\Activity\Event
|
||||
*/
|
||||
public function to_object() {
|
||||
$object = new Event();
|
||||
$object = $this->transform_object_properties( $object );
|
||||
$this->ap_object = new Event();
|
||||
|
||||
// Set hardcoded values/one-liners that don't have a get(ter) function defined.
|
||||
return $object
|
||||
$this
|
||||
->set_content()
|
||||
->set_content_map()
|
||||
->set_attributed_to()
|
||||
->set_published()
|
||||
->set_start_time()
|
||||
->set_end_time()
|
||||
->set_type()
|
||||
->set_category()
|
||||
->set_attachments()
|
||||
->set_location()
|
||||
->set_comments_enabled( true )
|
||||
->set_external_participation_url( $this->get_url() )
|
||||
->set_status( 'CONFIRMED' )
|
||||
->set_name( get_the_title( $this->wp_object->ID ) )
|
||||
->set_timezone( $object->get_locale )
|
||||
->set_is_online( false )
|
||||
->set_in_language( $this->get_locale() )
|
||||
->set_actor( get_rest_url_by_path( 'application' ) )
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== ActivityPub Event Plugin ===
|
||||
=== ActivityPub Event Extensions ===
|
||||
Contributors: menrath
|
||||
Tags: events, fediverse, activitypub, activitystream
|
||||
Requires at least: 6.4
|
||||
|
@ -8,7 +8,7 @@ Requires PHP: 5.6
|
|||
License: AGPL-3.0-or-later
|
||||
License URI: http://opensource.org/licenses/MIT
|
||||
|
||||
The ActivityPub Event Plugin is...
|
||||
The ActivityPub Event Extensions
|
||||
|
||||
== Description ==
|
||||
|
||||
|
|
Loading…
Reference in a new issue