Compare commits

..

4 commits

Author SHA1 Message Date
dddd3e395f Fix: hook for ActivityPub transformer might also return null (#81)
All checks were successful
PHP Code Checker / PHP Code Checker (push) Successful in 51s
PHPUnit / PHPUnit – PHP 7.4 (push) Successful in 1m1s
PHPUnit / PHPUnit – PHP 8.0 (push) Successful in 59s
PHPUnit / PHPUnit – PHP 8.1 (push) Successful in 58s
PHPUnit / PHPUnit – PHP 8.2 (push) Successful in 1m0s
PHPUnit / PHPUnit – PHP 8.3 (push) Successful in 1m1s
Reviewed-on: #81
Co-authored-by: André Menrath <andre.menrath@posteo.de>
Co-committed-by: André Menrath <andre.menrath@posteo.de>
2024-11-24 10:19:46 +01:00
7eb011859a rename variable in tests bootstrap for consitency
All checks were successful
PHP Code Checker / PHP Code Checker (push) Successful in 45s
PHPUnit / PHPUnit – PHP 7.4 (push) Successful in 58s
PHPUnit / PHPUnit – PHP 8.0 (push) Successful in 1m0s
PHPUnit / PHPUnit – PHP 8.1 (push) Successful in 59s
PHPUnit / PHPUnit – PHP 8.2 (push) Successful in 59s
PHPUnit / PHPUnit – PHP 8.3 (push) Successful in 1m1s
2024-11-17 10:50:45 +01:00
9e51823595 Update Changelog
All checks were successful
PHP Code Checker / PHP Code Checker (push) Successful in 49s
PHPUnit / PHPUnit – PHP 7.4 (push) Successful in 1m1s
PHPUnit / PHPUnit – PHP 8.0 (push) Successful in 57s
PHPUnit / PHPUnit – PHP 8.1 (push) Successful in 1m0s
PHPUnit / PHPUnit – PHP 8.2 (push) Successful in 1m4s
PHPUnit / PHPUnit – PHP 8.3 (push) Successful in 1m7s
2024-11-17 08:45:06 +01:00
53cdbd3838 Fix issues for WordPress.org release (#77)
All checks were successful
PHP Code Checker / PHP Code Checker (push) Successful in 43s
PHPUnit / PHPUnit – PHP 7.4 (push) Successful in 1m1s
PHPUnit / PHPUnit – PHP 8.0 (push) Successful in 59s
PHPUnit / PHPUnit – PHP 8.1 (push) Successful in 1m3s
PHPUnit / PHPUnit – PHP 8.2 (push) Successful in 1m1s
PHPUnit / PHPUnit – PHP 8.3 (push) Successful in 57s
/ upload-release (push) Successful in 4s
Co-authored-by: André Menrath <andre.menrath@posteo.de>
Co-committed-by: André Menrath <andre.menrath@posteo.de>
2024-11-16 19:38:28 +01:00
29 changed files with 146 additions and 184 deletions

View file

@ -22,6 +22,7 @@ jobs:
strategy: strategy:
matrix: matrix:
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3'] php-version: ['7.4', '8.0', '8.1', '8.2', '8.3']
wordpress-version: ['6.7']
name: PHPUnit PHP ${{ matrix.php-version }} name: PHPUnit PHP ${{ matrix.php-version }}
env: env:
extensions: mysql extensions: mysql
@ -37,7 +38,7 @@ jobs:
path: | path: |
${{ env.WP_CORE_DIR }} ${{ env.WP_CORE_DIR }}
${{ env.WP_TESTS_DIR }} ${{ env.WP_TESTS_DIR }}
key: cache-wordpress-9 key: cache-wordpress-67-2
- name: Cache Composer - name: Cache Composer
id: cache-composer-phpunit id: cache-composer-phpunit
@ -68,11 +69,11 @@ jobs:
- name: Setup Test Environment - name: Setup Test Environment
if: steps.cache-wordpress.outputs.cache-hit != 'true' if: steps.cache-wordpress.outputs.cache-hit != 'true'
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 6.6 false false false false run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 ${{ matrix.wordpress-version }} false false false false
- name: Initialize WordPress test database - name: Initialize WordPress test database
if: steps.cache-wordpress.outputs.cache-hit != 'false' if: steps.cache-wordpress.outputs.cache-hit != 'false'
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 6.6 false true true true run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 ${{ matrix.wordpress-version }} false true true true
- name: Run Integration tests for The Events Calendar - name: Run Integration tests for The Events Calendar
run: cd /workspace/Event-Federation/wordpress-activitypub-event-bridge/ && ./vendor/bin/phpunit --filter=the_events_calendar run: cd /workspace/Event-Federation/wordpress-activitypub-event-bridge/ && ./vendor/bin/phpunit --filter=the_events_calendar

View file

@ -5,8 +5,24 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.1.0] - 2024-10-20 ## Unreleased
### Fixed
* Fixed that transformer hook function might also return `null`.
## [0.2.1] - 2024-11-16
### Added ### Added
* Initial version tag. * Initial release on WordPress.org
### Fixed
* Applied some WordPress best practices
## [0.2.0] - 2024-10-20
### Added
* Initial submission to WordPress.org

View file

@ -2,8 +2,8 @@
**Contributors:** [andremenrath](https://profiles.wordpress.org/andremenrath/) **Contributors:** [andremenrath](https://profiles.wordpress.org/andremenrath/)
**Tags:** events, fediverse, activitypub, calendar **Tags:** events, fediverse, activitypub, calendar
**Requires at least:** 6.5 **Requires at least:** 6.5
**Tested up to:** 6.6 **Tested up to:** 6.7
**Stable tag:** 0.2.0 **Stable tag:** 0.2.1
**Requires PHP:** 7.4 **Requires PHP:** 7.4
**License:** AGPL-3.0-or-later **License:** AGPL-3.0-or-later
**License URI:** https://www.gnu.org/licenses/agpl-3.0.html **License URI:** https://www.gnu.org/licenses/agpl-3.0.html
@ -73,6 +73,7 @@ If you're new to the [ActivityPub plugin](https://wordpress.org/plugins/activity
### Do I need to install another event plugin to use the Event Federation Plugin? ### ### Do I need to install another event plugin to use the Event Federation Plugin? ###
Yes, this plugin works as an add-on and requires both the ActivityPub plugin and a supported event plugin such as The Events Calendar, VS Event List, or Events Manager to manage your events. It just fills the missing gap between event plugins and the [ActivityPub plugin](https://wordpress.org/plugins/activitypub/). Yes, this plugin works as an add-on and requires both the ActivityPub plugin and a supported event plugin such as The Events Calendar, VS Event List, or Events Manager to manage your events. It just fills the missing gap between event plugins and the [ActivityPub plugin](https://wordpress.org/plugins/activitypub/).
### What platforms can follow my events? ### ### What platforms can follow my events? ###
Your events can be followed on platforms that support ActivityPub like [Mobilizon](https://joinmobilizon.org/), [Gancio](https://gancio.org), [Friendica](https://friendi.ca), [Hubzilla](https://hubzilla.org), and [Pleroma](https://pleroma.social/). Even other applications like [Mastodon](https://joinmastodon.org), which don't fully support events yet, will display all important information about the events. Your events can be followed on platforms that support ActivityPub like [Mobilizon](https://joinmobilizon.org/), [Gancio](https://gancio.org), [Friendica](https://friendi.ca), [Hubzilla](https://hubzilla.org), and [Pleroma](https://pleroma.social/). Even other applications like [Mastodon](https://joinmastodon.org), which don't fully support events yet, will display all important information about the events.
@ -99,6 +100,16 @@ We're always interested in your feedback. Feel free to reach out to us via [E-Ma
## Changelog ## ## Changelog ##
### [0.2.0] 2024-10-29 ### ## Unreleased
### Fixed
* Fixed that transformer hook function might also return `null`.
### [0.2.1] 2024-11-16 ###
* Initial release on https://wordpress.org/ * Initial release on https://wordpress.org/
### [0.2.0] 2024-10-29 ###
* Initial submission to https://wordpress.org/

View file

@ -3,7 +3,7 @@
* Plugin Name: ActivityPub Event Bridge * Plugin Name: ActivityPub Event Bridge
* Description: Integrating popular event plugins with the ActivityPub plugin. * Description: Integrating popular event plugins with the ActivityPub plugin.
* Plugin URI: https://event-federation.eu/ * Plugin URI: https://event-federation.eu/
* Version: 0.2.0 * Version: 0.2.1
* Author: André Menrath * Author: André Menrath
* Author URI: https://graz.social/@linos * Author URI: https://graz.social/@linos
* Text Domain: activitypub-event-bridge * Text Domain: activitypub-event-bridge
@ -11,7 +11,7 @@
* License URI: https://www.gnu.org/licenses/agpl-3.0.html * License URI: https://www.gnu.org/licenses/agpl-3.0.html
* Requires PHP: 7.4 * Requires PHP: 7.4
* *
* Requires at least ActivityPub plugin with version >= 3.2.2. ActivityPub plugin tested up to: 4.0.1. * Requires at least ActivityPub plugin with version >= 3.2.2. ActivityPub plugin tested up to: 4.2.0.
* *
* @package ActivityPub_Event_Bridge * @package ActivityPub_Event_Bridge
* @license AGPL-3.0-or-later * @license AGPL-3.0-or-later

View file

@ -208,9 +208,15 @@ install_wp_plugin() {
fi fi
# Get the latest tag. # Get the latest tag.
if [ -z "$2" ]; then
LATEST_TAG=$(svn log https://plugins.svn.wordpress.org/$PLUGIN_NAME/tags --limit 1 | awk 'NR == 4 { print $4 }') LATEST_TAG=$(svn log https://plugins.svn.wordpress.org/$PLUGIN_NAME/tags --limit 1 | awk 'NR == 4 { print $4 }')
if [ -n "$LATEST_TAG" ]; then PLUGIN_VERSION=$LATEST_TAG
PLUGIN_FILE="$PLUGIN_NAME.$LATEST_TAG.zip" else
PLUGIN_VERSION=$2
fi
if [ -n "$PLUGIN_VERSION" ]; then
PLUGIN_FILE="$PLUGIN_NAME.$PLUGIN_VERSION.zip"
else else
PLUGIN_FILE="$PLUGIN_NAME.zip" PLUGIN_FILE="$PLUGIN_NAME.zip"
fi fi
@ -248,12 +254,12 @@ install_wp_plugins() {
# Install the one and only ActivityPub plugin (greetings @pfefferle). # Install the one and only ActivityPub plugin (greetings @pfefferle).
install_wp_plugin activitypub install_wp_plugin activitypub
# Install (not-activate) all supported event plugins. # Install (not-activate) all supported event plugins.
install_wp_plugin the-events-calendar install_wp_plugin the-events-calendar "6.8.1"
install_wp_plugin very-simple-event-list install_wp_plugin very-simple-event-list
install_wp_plugin gatherpress install_wp_plugin gatherpress
install_wp_plugin events-manager install_wp_plugin events-manager "6.6.3"
install_wp_plugin wp-event-manager install_wp_plugin wp-event-manager "3.1.45.1"
install_wp_plugin wp-event-solution install_wp_plugin wp-event-solution "4.0.14"
# Mec is not installable via wordpress.org, we use our own mirror. # Mec is not installable via wordpress.org, we use our own mirror.
install_wp_plugin_mec install_wp_plugin_mec
} }

View file

@ -58,7 +58,7 @@
], ],
"test-debug": [ "test-debug": [
"@prepare-test", "@prepare-test",
"@test-the-events-calendar" "@test-gatherpress"
], ],
"test-vs-event-list": "phpunit --filter=vs_event_list", "test-vs-event-list": "phpunit --filter=vs_event_list",
"test-the-events-calendar": "phpunit --filter=the_events_calendar", "test-the-events-calendar": "phpunit --filter=the_events_calendar",

View file

@ -180,7 +180,7 @@ In the pipeline we want to run each event plugins integration tests in a single
To activate/load your plugin add it to the switch statement within the function `_manually_load_plugin()` within `tests/bootstrap.php`. To activate/load your plugin add it to the switch statement within the function `_manually_load_plugin()` within `tests/bootstrap.php`.
```php ```php
switch ( $activitypub_event_extension_integration_filter ) { switch ( $activitypub_event_bridge_integration_filter ) {
... ...
case 'my_event_plugin': case 'my_event_plugin':
$plugin_file = 'my-event-plugin/my-event-plugin.php'; $plugin_file = 'my-event-plugin/my-event-plugin.php';

View file

@ -6,7 +6,7 @@
* @license AGPL-3.0-or-later * @license AGPL-3.0-or-later
*/ */
namespace ActivityPub_Event_Bridge\Activitypub\Transformer\Event; namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
// Exit if accessed directly. // Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
@ -64,6 +64,17 @@ abstract class Event extends Post {
return '[ap_content]'; return '[ap_content]';
} }
/**
* Returns the title of the event.
*
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-name
*
* @return string The name.
*/
protected function get_name(): string {
return $this->wp_object->post_title;
}
/** /**
* Extend the construction of the Post Transformer to also set the according taxonomy of the event post type. * Extend the construction of the Post Transformer to also set the according taxonomy of the event post type.
* *
@ -202,7 +213,7 @@ abstract class Event extends Post {
return ''; return '';
} }
$address = $location->get_address(); $address = $location->get_address();
if ( ! $address && is_string( $location->get_name() ) ) { if ( ! $address ) {
return $location->get_name(); return $location->get_name();
} }
if ( is_string( $address ) ) { if ( is_string( $address ) ) {
@ -359,7 +370,7 @@ abstract class Event extends Post {
$activitypub_object->set_to( $activitypub_object->set_to(
array( array(
'https://www.w3.org/ns/activitystreams#Public', 'https://www.w3.org/ns/activitystreams#Public',
$this->get_actor_object()->get_followers(), $this->get_actor_object()->get_followers(), // this fails on my machine.
) )
); );

View file

@ -8,13 +8,15 @@
* @license AGPL-3.0-or-later * @license AGPL-3.0-or-later
*/ */
namespace ActivityPub_Event_Bridge\Activitypub\Transformer\Event; namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
// Exit if accessed directly. // Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
use Activitypub\Activity\Extended_Object\Place; use Activitypub\Activity\Extended_Object\Place;
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event\Event; use ActivityPub_Event_Bridge\Activitypub\Transformer\Event;
use DateTime;
use DateTimeZone;
use Etn\Core\Event\Event_Model; use Etn\Core\Event\Event_Model;
use function Activitypub\esc_hashtag; use function Activitypub\esc_hashtag;

View file

@ -6,13 +6,13 @@
* @license AGPL-3.0-or-later * @license AGPL-3.0-or-later
*/ */
namespace ActivityPub_Event_Bridge\Activitypub\Transformer\Event; namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
// Exit if accessed directly. // Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
use Activitypub\Activity\Extended_Object\Place; use Activitypub\Activity\Extended_Object\Place;
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event\Event as Event_Transformer; use ActivityPub_Event_Bridge\Activitypub\Transformer\Event as Event_Transformer;
use DateTime; use DateTime;
use DateTimeZone; use DateTimeZone;
use EM_Event; use EM_Event;

View file

@ -6,14 +6,14 @@
* @license AGPL-3.0-or-later * @license AGPL-3.0-or-later
*/ */
namespace ActivityPub_Event_Bridge\Activitypub\Transformer\Event; namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
// Exit if accessed directly. // Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
use Activitypub\Activity\Extended_Object\Event as Event_Object; use Activitypub\Activity\Extended_Object\Event as Event_Object;
use Activitypub\Activity\Extended_Object\Place; use Activitypub\Activity\Extended_Object\Place;
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event\Event; use ActivityPub_Event_Bridge\Activitypub\Transformer\Event;
use GatherPress\Core\Event as GatherPress_Event; use GatherPress\Core\Event as GatherPress_Event;
/** /**

View file

@ -6,13 +6,14 @@
* @license AGPL-3.0-or-later * @license AGPL-3.0-or-later
*/ */
namespace ActivityPub_Event_Bridge\Activitypub\Transformer\Event; namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
// Exit if accessed directly. // Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
use Activitypub\Activity\Extended_Object\Place; use Activitypub\Activity\Extended_Object\Place;
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event\Event; use ActivityPub_Event_Bridge\Activitypub\Transformer\Event;
use MEC; use MEC;
use MEC\Events\Event as MEC_Event; use MEC\Events\Event as MEC_Event;
use MEC_main; use MEC_main;

View file

@ -6,14 +6,13 @@
* @license AGPL-3.0-or-later * @license AGPL-3.0-or-later
*/ */
namespace ActivityPub_Event_Bridge\Activitypub\Transformer\Event; namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
// Exit if accessed directly. // Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
use Activitypub\Activity\Extended_Object\Place; use Activitypub\Activity\Extended_Object\Place;
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event\Event; use ActivityPub_Event_Bridge\Activitypub\Transformer\Event;
use ActivityPub_Event_Bridge\Activitypub\Transformer\Location\The_Events_Calendar as The_Events_Calendar_Location;
use WP_Post; use WP_Post;
use function Activitypub\esc_hashtag; use function Activitypub\esc_hashtag;
@ -141,9 +140,42 @@ final class The_Events_Calendar extends Event {
return null; return null;
} }
$location_transformer = new The_Events_Calendar_Location( $venue ); // Set the address.
$full_location_object = false; $address = array();
$location = $location_transformer->to_object( $full_location_object );
if ( ! empty( $venue->country ) ) {
$address['addressCountry'] = $venue->country;
}
if ( ! empty( $venue->city ) ) {
$address['addressLocality'] = $venue->city;
}
if ( ! empty( $venue->province ) ) {
$address['addressRegion'] = $venue->province;
}
if ( ! empty( $venue->zip ) ) {
$address['postalCode'] = $venue->zip;
}
if ( ! empty( $venue->address ) ) {
$address['streetAddress'] = $venue->address;
}
if ( ! empty( $venue->post_title ) ) {
$address['name'] = $venue->post_title;
}
$address['type'] = 'PostalAddress';
$location = new Place();
if ( count( $address ) > 1 ) {
$location->set_address( $address );
} else {
$location->set_address( $venue->post_title );
}
$location->set_id( $venue->ID );
$location->set_name( $venue->post_title );
return $location; return $location;
} }

View file

@ -6,13 +6,13 @@
* @license AGPL-3.0-or-later * @license AGPL-3.0-or-later
*/ */
namespace ActivityPub_Event_Bridge\Activitypub\Transformer\Event; namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
// Exit if accessed directly. // Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
use Activitypub\Activity\Extended_Object\Place; use Activitypub\Activity\Extended_Object\Place;
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event\Event as Event_Transformer; use ActivityPub_Event_Bridge\Activitypub\Transformer\Event as Event_Transformer;
/** /**
* ActivityPub Transformer for VS Event. * ActivityPub Transformer for VS Event.

View file

@ -6,13 +6,13 @@
* @license AGPL-3.0-or-later * @license AGPL-3.0-or-later
*/ */
namespace ActivityPub_Event_Bridge\Activitypub\Transformer\Event; namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
// Exit if accessed directly. // Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
use Activitypub\Activity\Extended_Object\Place; use Activitypub\Activity\Extended_Object\Place;
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event\Event as Event_Transformer; use ActivityPub_Event_Bridge\Activitypub\Transformer\Event as Event_Transformer;
use DateTime; use DateTime;
/** /**

View file

@ -1,125 +0,0 @@
<?php
/**
* ActivityPub Tribe Transformer
*
* @package ActivityPub_Event_Bridge
* @license AGPL-3.0-or-later
*/
namespace ActivityPub_Event_Bridge\Activitypub\Transformer\Location;
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
use Activitypub\Activity\Extended_Object\Place;
use Activitypub\Transformer\Post;
use WP_Post;
/**
* ActivityPub Tribe Transformer
*
* @since 1.0.0
*/
final class The_Events_Calendar extends Post {
/**
* Set the type of the object.
*/
public function get_type(): string {
return 'Place';
}
/**
* Set the type of the object.
*/
public function get_replies() {
return null;
}
/**
* Set the type of the object.
*/
public function get_sensitive() {
return null;
}
/**
* Get the event location.
*
* @return array|string|null The place/venue if one is set.
*/
public function get_address() {
$address = array();
if ( ! empty( $this->wp_object->country ) ) {
$address['addressCountry'] = $this->wp_object->country;
}
if ( ! empty( $this->wp_object->city ) ) {
$address['addressLocality'] = $this->wp_object->city;
}
if ( ! empty( $this->wp_object->province ) ) {
$address['addressRegion'] = $this->wp_object->province;
}
if ( ! empty( $this->wp_object->zip ) ) {
$address['postalCode'] = $this->wp_object->zip;
}
if ( ! empty( $this->wp_object->address ) ) {
$address['streetAddress'] = $this->wp_object->address;
}
if ( ! empty( $this->wp_object->post_title ) ) {
$address['name'] = $this->wp_object->post_title;
}
$address['type'] = 'PostalAddress';
if ( count( $address ) > 1 ) {
return $address;
} else {
return $this->get_name();
}
}
/**
* Generic function that converts an WP-Event object to an ActivityPub-Event object.
*
* @param bool $full_object bool Return an object with all properties set, or a minimal one as used within an `as:Event`s location.
* @return Event_Object
*/
public function to_object( $full_object = true ): Place {
$activitypub_object = new Place();
$activitypub_object = $this->transform_object_properties( $activitypub_object );
if ( ! empty( $activitypub_object->content ) ) {
$activitypub_object->set_content_map(
array(
$this->get_locale() => $this->get_content(),
)
);
}
if ( $full_object ) {
$published = \strtotime( $this->wp_object->post_date_gmt );
$activitypub_object->set_published( \gmdate( 'Y-m-d\TH:i:s\Z', $published ) );
$updated = \strtotime( $this->wp_object->post_modified_gmt );
if ( $updated > $published ) {
$activitypub_object->set_updated( \gmdate( 'Y-m-d\TH:i:s\Z', $updated ) );
}
$activitypub_object->set_to(
array(
'https://www.w3.org/ns/activitystreams#Public',
$this->get_actor_object()->get_followers(),
)
);
}
$activitypub_object->set_address( $this->get_address() );
return $activitypub_object;
}
}

View file

@ -252,7 +252,7 @@ class Setup {
* *
* @return \Activitypub\Transformer\Base|null * @return \Activitypub\Transformer\Base|null
*/ */
public function register_activitypub_event_transformer( $transformer, $wp_object, $object_class ): \Activitypub\Transformer\Base { public function register_activitypub_event_transformer( $transformer, $wp_object, $object_class ): ?\Activitypub\Transformer\Base {
// If the current WordPress object is not a post (e.g., a WP_Comment), don't change the transformer. // If the current WordPress object is not a post (e.g., a WP_Comment), don't change the transformer.
if ( 'WP_Post' !== $object_class ) { if ( 'WP_Post' !== $object_class ) {
return $transformer; return $transformer;

View file

@ -83,6 +83,6 @@ abstract class Event_Plugin {
* Returns the Activitypub transformer for the event plugins event post type. * Returns the Activitypub transformer for the event plugins event post type.
*/ */
public static function get_activitypub_event_transformer_class(): string { public static function get_activitypub_event_transformer_class(): string {
return str_replace( 'Plugins', 'Activitypub\Transformer\Event', static::class ); return str_replace( 'Plugins', 'Activitypub\Transformer', static::class );
} }
} }

View file

@ -38,7 +38,7 @@ final class Modern_Events_Calendar_Lite extends Event_plugin {
*/ */
public static function get_post_type(): string { public static function get_post_type(): string {
// See MEC_feature_events->get_main_post_type(). // See MEC_feature_events->get_main_post_type().
return apply_filters( 'mec_post_type_name', 'mec-events' ); // phpcs:ignore return 'mec-events';
} }
/** /**

View file

@ -2,8 +2,8 @@
Contributors: andremenrath Contributors: andremenrath
Tags: events, fediverse, activitypub, calendar Tags: events, fediverse, activitypub, calendar
Requires at least: 6.5 Requires at least: 6.5
Tested up to: 6.6 Tested up to: 6.7
Stable tag: 0.2.0 Stable tag: 0.2.1
Requires PHP: 7.4 Requires PHP: 7.4
License: AGPL-3.0-or-later License: AGPL-3.0-or-later
License URI: https://www.gnu.org/licenses/agpl-3.0.html License URI: https://www.gnu.org/licenses/agpl-3.0.html
@ -67,6 +67,7 @@ If you're new to the [ActivityPub plugin](https://wordpress.org/plugins/activity
= Do I need to install another event plugin to use the Event Federation Plugin? = = Do I need to install another event plugin to use the Event Federation Plugin? =
Yes, this plugin works as an add-on and requires both the ActivityPub plugin and a supported event plugin such as The Events Calendar, VS Event List, or Events Manager to manage your events. It just fills the missing gap between event plugins and the [ActivityPub plugin](https://wordpress.org/plugins/activitypub/). Yes, this plugin works as an add-on and requires both the ActivityPub plugin and a supported event plugin such as The Events Calendar, VS Event List, or Events Manager to manage your events. It just fills the missing gap between event plugins and the [ActivityPub plugin](https://wordpress.org/plugins/activitypub/).
= What platforms can follow my events? = = What platforms can follow my events? =
Your events can be followed on platforms that support ActivityPub like [Mobilizon](https://joinmobilizon.org/), [Gancio](https://gancio.org), [Friendica](https://friendi.ca), [Hubzilla](https://hubzilla.org), and [Pleroma](https://pleroma.social/). Even other applications like [Mastodon](https://joinmastodon.org), which don't fully support events yet, will display all important information about the events. Your events can be followed on platforms that support ActivityPub like [Mobilizon](https://joinmobilizon.org/), [Gancio](https://gancio.org), [Friendica](https://friendi.ca), [Hubzilla](https://hubzilla.org), and [Pleroma](https://pleroma.social/). Even other applications like [Mastodon](https://joinmastodon.org), which don't fully support events yet, will display all important information about the events.
@ -93,6 +94,10 @@ We're always interested in your feedback. Feel free to reach out to us via [E-Ma
== Changelog == == Changelog ==
= [0.2.0] 2024-10-29 = = [0.2.1] 2024-11-16 =
* Initial release on https://wordpress.org/ * Initial release on https://wordpress.org/
= [0.2.0] 2024-10-29 =
* Initial submission to https://wordpress.org/

View file

@ -5,6 +5,9 @@
* @package ActivityPub_Event_Bridge * @package ActivityPub_Event_Bridge
*/ */
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
/* @var array $args Template arguments. */ /* @var array $args Template arguments. */
$args = wp_parse_args( $args = wp_parse_args(
$args, $args,

View file

@ -35,10 +35,10 @@ function _manually_load_plugin() {
require_once $plugin_dir . 'activitypub/activitypub.php'; require_once $plugin_dir . 'activitypub/activitypub.php';
// Capture the --filter argument. // Capture the --filter argument.
$activitypub_event_extension_integration_filter = null; $activitypub_event_bridge_integration_filter = null;
foreach ( $_SERVER['argv'] as $arg ) { foreach ( $_SERVER['argv'] as $arg ) {
if ( strpos( $arg, '--filter=' ) === 0 ) { if ( strpos( $arg, '--filter=' ) === 0 ) {
$activitypub_event_extension_integration_filter = substr( $arg, strlen( '--filter=' ) ); $activitypub_event_bridge_integration_filter = substr( $arg, strlen( '--filter=' ) );
break; break;
} }
} }
@ -49,7 +49,7 @@ function _manually_load_plugin() {
$plugin_file = null; $plugin_file = null;
// See if we want to run integration tests for a specific event-plugin. // See if we want to run integration tests for a specific event-plugin.
switch ( $activitypub_event_extension_integration_filter ) { switch ( $activitypub_event_bridge_integration_filter ) {
case 'the_events_calendar': case 'the_events_calendar':
$plugin_file = 'the-events-calendar/the-events-calendar.php'; $plugin_file = 'the-events-calendar/the-events-calendar.php';
break; break;
@ -84,14 +84,14 @@ function _manually_load_plugin() {
} }
// Hot fix that allows using Events Manager within unit tests, because the em_init() is later not run as admin. // Hot fix that allows using Events Manager within unit tests, because the em_init() is later not run as admin.
if ( 'events_manager' === $activitypub_event_extension_integration_filter ) { if ( 'events_manager' === $activitypub_event_bridge_integration_filter ) {
require_once $plugin_dir . 'events-manager/em-install.php'; require_once $plugin_dir . 'events-manager/em-install.php';
em_create_events_table(); em_create_events_table();
em_create_events_meta_table(); em_create_events_meta_table();
em_create_locations_table(); em_create_locations_table();
} }
if ( 'modern_events_calendar_lite' === $activitypub_event_extension_integration_filter ) { if ( 'modern_events_calendar_lite' === $activitypub_event_bridge_integration_filter ) {
require_once $plugin_dir . 'modern-events-calendar-lite/app/libraries/factory.php'; require_once $plugin_dir . 'modern-events-calendar-lite/app/libraries/factory.php';
$mec_factory = new MEC_factory(); $mec_factory = new MEC_factory();
$mec_factory->install(); $mec_factory->install();

View file

@ -64,7 +64,7 @@ class Test_Eventin extends WP_UnitTestCase {
$transformer = \Activitypub\Transformer\Factory::get_transformer( get_post( $event->id ) ); $transformer = \Activitypub\Transformer\Factory::get_transformer( get_post( $event->id ) );
// Check that we got the right transformer. // Check that we got the right transformer.
$this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\Event\Eventin::class, $transformer ); $this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\Eventin::class, $transformer );
} }
/** /**

View file

@ -61,7 +61,7 @@ class Test_Events_Manager extends WP_UnitTestCase {
$transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object ); $transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object );
// Check that we got the right transformer. // Check that we got the right transformer.
$this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\Event\Events_Manager::class, $transformer ); $this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\Events_Manager::class, $transformer );
} }
/** /**

View file

@ -65,7 +65,7 @@ class Test_GatherPress extends WP_UnitTestCase {
$transformer = \Activitypub\Transformer\Factory::get_transformer( $event->event ); $transformer = \Activitypub\Transformer\Factory::get_transformer( $event->event );
// Check that we got the right transformer. // Check that we got the right transformer.
$this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\Event\GatherPress::class, $transformer ); $this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\GatherPress::class, $transformer );
} }
/** /**

View file

@ -74,7 +74,7 @@ class Test_Modern_Events_Calendar_Lite extends WP_UnitTestCase {
$transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object ); $transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object );
// Check that we got the right transformer. // Check that we got the right transformer.
$this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\Event\Modern_Events_Calendar_Lite::class, $transformer ); $this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\Modern_Events_Calendar_Lite::class, $transformer );
} }
/** /**

View file

@ -91,7 +91,7 @@ class Test_The_Events_Calendar extends WP_UnitTestCase {
$transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object ); $transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object );
// Check that we got the right transformer. // Check that we got the right transformer.
$this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\Event\The_Events_Calendar::class, $transformer ); $this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\The_Events_Calendar::class, $transformer );
} }
/** /**
@ -192,7 +192,6 @@ class Test_The_Events_Calendar extends WP_UnitTestCase {
->create(); ->create();
// Call the transformer. // Call the transformer.
$event_array = \Activitypub\Transformer\Factory::get_transformer( $wp_object )->to_object()->to_array(); $event_array = \Activitypub\Transformer\Factory::get_transformer( $wp_object )->to_object()->to_array();
// Check that the event ActivityStreams representation contains everything as expected. // Check that the event ActivityStreams representation contains everything as expected.

View file

@ -58,7 +58,7 @@ class Test_VS_Event_List extends WP_UnitTestCase {
$transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object ); $transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object );
// Check that we got the right transformer. // Check that we got the right transformer.
$this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\Event\VS_Event_List::class, $transformer ); $this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\VS_Event_List::class, $transformer );
} }
/** /**

View file

@ -58,7 +58,7 @@ class Test_WP_Event_Manager extends WP_UnitTestCase {
$transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object ); $transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object );
// Check that we got the right transformer. // Check that we got the right transformer.
$this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\Event\WP_Event_Manager::class, $transformer ); $this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\WP_Event_Manager::class, $transformer );
} }
/** /**