Compare commits
6 commits
Author | SHA1 | Date | |
---|---|---|---|
e7c57e48bd | |||
97d04c2e47 | |||
b1f41cc124 | |||
60d9aa909f | |||
0057c3ddcc | |||
d42f83ea5b |
58 changed files with 520 additions and 1940 deletions
|
@ -21,8 +21,7 @@ jobs:
|
|||
MYSQL_ROOT_PASSWORD: root
|
||||
strategy:
|
||||
matrix:
|
||||
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
|
||||
wordpress-version: ['6.7']
|
||||
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3']
|
||||
name: PHPUnit – PHP ${{ matrix.php-version }}
|
||||
env:
|
||||
extensions: mysql
|
||||
|
@ -38,7 +37,7 @@ jobs:
|
|||
path: |
|
||||
${{ env.WP_CORE_DIR }}
|
||||
${{ env.WP_TESTS_DIR }}
|
||||
key: cache-wordpress-67-4
|
||||
key: cache-wordpress-9
|
||||
|
||||
- name: Cache Composer
|
||||
id: cache-composer-phpunit
|
||||
|
@ -69,58 +68,43 @@ jobs:
|
|||
|
||||
- name: Setup Test Environment
|
||||
if: steps.cache-wordpress.outputs.cache-hit != 'true'
|
||||
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 ${{ matrix.wordpress-version }} false false false false
|
||||
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 6.6 false false false false
|
||||
|
||||
- name: Initialize WordPress test database
|
||||
if: steps.cache-wordpress.outputs.cache-hit != 'false'
|
||||
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 ${{ matrix.wordpress-version }} false true true true
|
||||
|
||||
- name: Run General Tests
|
||||
run: cd /workspace/Event-Federation/wordpress-event-bridge-for-activitypub/ && ./vendor/bin/phpunit --filter=event_bridge_for_activitypub
|
||||
env:
|
||||
PHP_VERSION: ${{ matrix.php-version }}
|
||||
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 6.6 false true true true
|
||||
|
||||
- name: Run Integration tests for The Events Calendar
|
||||
run: cd /workspace/Event-Federation/wordpress-event-bridge-for-activitypub/ && ./vendor/bin/phpunit --filter=the_events_calendar
|
||||
run: cd /workspace/Event-Federation/wordpress-activitypub-event-bridge/ && ./vendor/bin/phpunit --filter=the_events_calendar
|
||||
env:
|
||||
PHP_VERSION: ${{ matrix.php-version }}
|
||||
|
||||
- name: Run Integration tests for VS Event List
|
||||
run: cd /workspace/Event-Federation/wordpress-event-bridge-for-activitypub/ && ./vendor/bin/phpunit --filter=vs_event_list
|
||||
run: cd /workspace/Event-Federation/wordpress-activitypub-event-bridge/ && ./vendor/bin/phpunit --filter=vs_event_list
|
||||
env:
|
||||
PHP_VERSION: ${{ matrix.php-version }}
|
||||
|
||||
- name: Run Integration tests for GatherPress
|
||||
run: cd /workspace/Event-Federation/wordpress-event-bridge-for-activitypub/ && ./vendor/bin/phpunit --filter=gatherpress
|
||||
run: cd /workspace/Event-Federation/wordpress-activitypub-event-bridge/ && ./vendor/bin/phpunit --filter=gatherpress
|
||||
env:
|
||||
PHP_VERSION: ${{ matrix.php-version }}
|
||||
|
||||
- name: Run Integration tests for Events Manager
|
||||
run: cd /workspace/Event-Federation/wordpress-event-bridge-for-activitypub/ && ./vendor/bin/phpunit --filter=events_manager
|
||||
run: cd /workspace/Event-Federation/wordpress-activitypub-event-bridge/ && ./vendor/bin/phpunit --filter=events_manager
|
||||
env:
|
||||
PHP_VERSION: ${{ matrix.php-version }}
|
||||
|
||||
- name: Run Integration tests for WP Event Manager
|
||||
run: cd /workspace/Event-Federation/wordpress-event-bridge-for-activitypub/ && ./vendor/bin/phpunit --filter=wp_event_manager
|
||||
run: cd /workspace/Event-Federation/wordpress-activitypub-event-bridge/ && ./vendor/bin/phpunit --filter=wp_event_manager
|
||||
env:
|
||||
PHP_VERSION: ${{ matrix.php-version }}
|
||||
|
||||
- name: Run Integration tests for Eventin (WP Event Solution)
|
||||
run: cd /workspace/Event-Federation/wordpress-event-bridge-for-activitypub/ && ./vendor/bin/phpunit --filter=eventin
|
||||
run: cd /workspace/Event-Federation/wordpress-activitypub-event-bridge/ && ./vendor/bin/phpunit --filter=eventin
|
||||
env:
|
||||
PHP_VERSION: ${{ matrix.php-version }}
|
||||
|
||||
- name: Run Integration tests for Modern Events Calendar Lite
|
||||
run: cd /workspace/Event-Federation/wordpress-event-bridge-for-activitypub/ && ./vendor/bin/phpunit --filter=modern_events_calendar_lite
|
||||
run: cd /workspace/Event-Federation/wordpress-activitypub-event-bridge/ && ./vendor/bin/phpunit --filter=modern_events_calendar_lite
|
||||
env:
|
||||
PHP_VERSION: ${{ matrix.php-version }}
|
||||
|
||||
- name: Run Integration tests for EventPrime
|
||||
run: cd /workspace/Event-Federation/wordpress-event-bridge-for-activitypub/ && ./vendor/bin/phpunit --filter=eventprime
|
||||
env:
|
||||
PHP_VERSION: ${{ matrix.php-version }}
|
||||
|
||||
- name: Run Integration tests for Event Organiser
|
||||
run: cd /workspace/Event-Federation/wordpress-event-bridge-for-activitypub/ && ./vendor/bin/phpunit --filter=event_organiser
|
||||
env:
|
||||
PHP_VERSION: ${{ matrix.php-version }}
|
||||
PHP_VERSION: ${{ matrix.php-version }}
|
|
@ -5,13 +5,8 @@ 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/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## Unreleased
|
||||
## [0.1.0] - 2024-10-20
|
||||
|
||||
### Added
|
||||
|
||||
* Add custom summary via shortcodes
|
||||
|
||||
## [0.3.2] - 2024-12-12
|
||||
|
||||
* Initial release on WordPress.org
|
||||
|
||||
* Initial version tag.
|
||||
|
|
|
@ -4,7 +4,7 @@ module.exports = function (grunt) {
|
|||
{
|
||||
checktextdomain: {
|
||||
options:{
|
||||
text_domain: 'event-bridge-for-activitypub',
|
||||
text_domain: 'activitypub-event-bridge',
|
||||
keywords: [
|
||||
'__:1,2d',
|
||||
'_e:1,2d',
|
||||
|
|
23
README.md
23
README.md
|
@ -1,9 +1,9 @@
|
|||
# Event Bridge for ActivityPub #
|
||||
# ActivityPub Event Bridge #
|
||||
**Contributors:** [andremenrath](https://profiles.wordpress.org/andremenrath/)
|
||||
**Tags:** events, fediverse, activitypub, calendar
|
||||
**Requires at least:** 6.5
|
||||
**Tested up to:** 6.7
|
||||
**Stable tag:** 0.3.2
|
||||
**Tested up to:** 6.6
|
||||
**Stable tag:** 0.2.0
|
||||
**Requires PHP:** 7.4
|
||||
**License:** AGPL-3.0-or-later
|
||||
**License URI:** https://www.gnu.org/licenses/agpl-3.0.html
|
||||
|
@ -14,7 +14,7 @@ Integrating popular event plugins with the ActivityPub plugin.
|
|||
## Description ##
|
||||
|
||||
Make your events more discoverable, expand your reach effortlessly while being independent of other (commercial) platforms, and be a part of the growing decentralized web (the Fediverse).
|
||||
With the Event Bridge for ActivityPub Plugin for WordPress, your events can be automatically followed, aggregated and displayed across decentralized platforms like [Mastodon](https://joinmastodon.org) or [Gancio](https://gancio.org), without any extra work.
|
||||
With the ActivityPub Event Bridge Plugin for WordPress, your events can be automatically followed, aggregated and displayed across decentralized platforms like [Mastodon](https://joinmastodon.org) or [Gancio](https://gancio.org), without any extra work.
|
||||
Forget the hassle of managing multiple social media accounts just to keep your audience informed.
|
||||
|
||||
This plugin is not an event managing plugin but an add-on to popular event plugins. It extends their functionality to fully support the [ActivityPub plugin](https://wordpress.org/plugins/activitypub/).
|
||||
|
@ -23,7 +23,7 @@ You retain full ownership of your content. By integrating into your existing set
|
|||
|
||||
### How It Works ###
|
||||
|
||||
With the Event Bridge for ActivityPub WordPress plugin, sharing your events is effortless and automatic!
|
||||
With the ActivityPub Event Bridge WordPress plugin, sharing your events is effortless and automatic!
|
||||
Once you create an event on your WordPress site, it is seamlessly shared across the decentralized web using the ActivityPub protocol.
|
||||
|
||||
<p align="center">
|
||||
|
@ -44,7 +44,7 @@ The Event Federation plugin ensures that users from those platforms are provided
|
|||
|
||||
**ActivityPub-Enabled Event Sharing:** Your WordPress events are now compatible with the Fediverse, using the ActivityStreams format. This means your events can be easily discovered and followed by users on platforms like Mastodon and other ActivityPub-compatible services.
|
||||
|
||||
**Automatic Event Summaries:** When your event is shared on the Fediverse, platforms like Mastodon that don't fully support events will display a brief HTML summary of key details — such as the event's title, start time, and location. This ensures that even if someone can't view the full event on their platform, they still get the important info at a glance, with a link to your WordPress event page. Advanced users can create custom summaries via a set of shortcodes.
|
||||
**Automatic Event Summaries:** When your event is shared on the Fediverse, platforms like Mastodon that don't fully support events will display a brief HTML summary of key details — such as the event's title, start time, and location. This ensures that even if someone can't view the full event on their platform, they still get the important info at a glance, with a link to your WordPress event page.
|
||||
|
||||
**Improved Event Discoverability:** Your custom event categories are mapped to a set of default categories used in the Fediverse, helping your events reach a wider audience. This improves the chances that users searching for similar events on other platforms will find yours.
|
||||
|
||||
|
@ -63,8 +63,6 @@ This plugin depends on the [ActivityPub plugin](https://wordpress.org/plugins/ac
|
|||
* [Eventin](https://de.wordpress.org/plugins/wp-event-solution/)
|
||||
* [Modern Events Calendar Lite](https://webnus.net/modern-events-calendar/)
|
||||
* [GatherPress](https://gatherpress.org/)
|
||||
* [EventPrime – Events Calendar, Bookings and Tickets](https://wordpress.org/plugins/eventprime-event-calendar-management/)
|
||||
* [Event Organiser](https://wordpress.org/plugins/event-organiser/)
|
||||
|
||||
## Configuration ##
|
||||
|
||||
|
@ -75,7 +73,6 @@ 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? ###
|
||||
|
||||
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? ###
|
||||
|
||||
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.
|
||||
|
@ -94,16 +91,14 @@ No, the Event Federation Plugin depends on the [ActivityPub plugin](https://word
|
|||
|
||||
### My event plugin is not supported, what can I do? ###
|
||||
|
||||
If you know about coding have a look at the documentation of how to add your plugin or open an [issue](https://code.event-federation.eu/Event-Federation/wordpress-event-bridge-for-activitypub/issues), if we can spare some free hours we might add it.
|
||||
If you know about coding have a look at the documentation of how to add your plugin or open an [issue](https://code.event-federation.eu/Event-Federation/wordpress-activitypub-event-bridge/issues), if we can spare some free hours we might add it.
|
||||
|
||||
### What if I experience problems? ###
|
||||
|
||||
We're always interested in your feedback. Feel free to reach out to us via [E-Mail](https://event-federation.eu/contact/) or create an [issue](https://code.event-federation.eu/Event-Federation/wordpress-event-bridge-for-activitypub/issues).
|
||||
We're always interested in your feedback. Feel free to reach out to us via [E-Mail](https://event-federation.eu/contact/) or create an [issue](https://code.event-federation.eu/Event-Federation/wordpress-activitypub-event-bridge/issues).
|
||||
|
||||
## Changelog ##
|
||||
|
||||
### [0.3.2] 2024-12-12 ###
|
||||
### [0.2.0] 2024-10-29 ###
|
||||
|
||||
* Initial release on https://wordpress.org/
|
||||
|
||||
|
||||
|
|
36
activitypub-event-bridge.php
Normal file
36
activitypub-event-bridge.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
/**
|
||||
* Plugin Name: ActivityPub Event Bridge
|
||||
* Description: Integrating popular event plugins with the ActivityPub plugin.
|
||||
* Plugin URI: https://event-federation.eu/
|
||||
* Version: 0.2.0
|
||||
* Author: André Menrath
|
||||
* Author URI: https://graz.social/@linos
|
||||
* Text Domain: activitypub-event-bridge
|
||||
* License: AGPL-3.0-or-later
|
||||
* License URI: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
* Requires PHP: 7.4
|
||||
*
|
||||
* Requires at least ActivityPub plugin with version >= 3.2.2. ActivityPub plugin tested up to: 4.0.1.
|
||||
*
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
define( 'ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
||||
define( 'ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
||||
define( 'ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . '/' . basename( __FILE__ ) );
|
||||
define( 'ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
||||
define( 'ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_VERSION', current( get_file_data( __FILE__, array( 'Version' ), 'plugin' ) ) );
|
||||
define( 'ACTIVITYPUB_EVENT_BRIDGE_DOMAIN', 'activitypub-event-bridge' );
|
||||
define( 'ACTIVITYPUB_EVENT_BRIDGE_ACTIVITYPUB_PLUGIN_MIN_VERSION', '3.2.2' );
|
||||
|
||||
// Include and register the autoloader class for automatic loading of plugin classes.
|
||||
require_once ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_DIR . '/includes/class-autoloader.php';
|
||||
ActivityPub_Event_Bridge\Autoloader::register();
|
||||
|
||||
// Initialize the plugin.
|
||||
ActivityPub_Event_Bridge\Setup::get_instance();
|
|
@ -1,19 +1,19 @@
|
|||
.settings_page_event-bridge-for-activitypub #wpcontent {
|
||||
.settings_page_activitypub-event-bridge #wpcontent {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-page .box {
|
||||
.activitypub-event-bridge-settings-page .box {
|
||||
border: 1px solid #c3c4c7;
|
||||
background-color: #fff;
|
||||
padding: 1em 1.5em;
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-page .box ul.event-bridge-for-activitypub-list {
|
||||
.activitypub-event-bridge-settings-page .box ul.activitypub-event-bridge-list {
|
||||
margin-left: 0.6em;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-page .box pre {
|
||||
.activitypub-event-bridge-settings-page .box pre {
|
||||
padding: 1rem;
|
||||
min-height: 200px;
|
||||
box-shadow: none;
|
||||
|
@ -22,19 +22,19 @@
|
|||
background-color: #f7f7f7;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings {
|
||||
.activitypub-event-bridge-settings {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-header {
|
||||
.activitypub-event-bridge-settings-header {
|
||||
text-align: center;
|
||||
margin: 0 0 1rem;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #dcdcde;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-title-section {
|
||||
.activitypub-event-bridge-settings-title-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
@ -42,7 +42,7 @@
|
|||
padding-top: 8px;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-tabs-wrapper {
|
||||
.activitypub-event-bridge-settings-tabs-wrapper {
|
||||
display: -ms-inline-grid;
|
||||
-ms-grid-columns: auto auto auto auto;
|
||||
vertical-align: top;
|
||||
|
@ -50,12 +50,12 @@
|
|||
grid-template-columns: auto auto auto auto;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-tab.active {
|
||||
.activitypub-event-bridge-settings-tab.active {
|
||||
box-shadow: inset 0 -3px #3582c4;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-tab {
|
||||
.activitypub-event-bridge-settings-tab {
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
|
@ -64,21 +64,21 @@
|
|||
transition: box-shadow .5s ease-in-out;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings .box h3 {
|
||||
.activitypub-event-bridge-settings .box h3 {
|
||||
font-size: 1.15em;
|
||||
margin-bottom: 0em;
|
||||
}
|
||||
|
||||
#event_bridge_for_activitypub_initially_activated {
|
||||
#activitypub_event_bridge_initially_activated {
|
||||
display: hidden;
|
||||
}
|
||||
|
||||
/* Accordions for admin pages */
|
||||
.event-bridge-for-activitypub-settings-accordion {
|
||||
.activitypub-event-bridge-settings-accordion {
|
||||
border: 1px solid #c3c4c7;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-accordion-heading {
|
||||
.activitypub-event-bridge-settings-accordion-heading {
|
||||
margin: 0;
|
||||
border-top: 1px solid #c3c4c7;
|
||||
font-size: inherit;
|
||||
|
@ -87,17 +87,17 @@
|
|||
color: inherit;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-accordion-heading:first-child {
|
||||
.activitypub-event-bridge-settings-accordion-heading:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-accordion-panel {
|
||||
.activitypub-event-bridge-settings-accordion-panel {
|
||||
margin: 0;
|
||||
padding: 1em 1.5em;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-accordion-trigger {
|
||||
.activitypub-event-bridge-settings-accordion-trigger {
|
||||
background: #fff;
|
||||
border: 0;
|
||||
color: #2c3338;
|
||||
|
@ -116,21 +116,21 @@
|
|||
user-select: auto;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-accordion-trigger {
|
||||
.activitypub-event-bridge-settings-accordion-trigger {
|
||||
color: #2c3338;
|
||||
cursor: pointer;
|
||||
font-weight: 400;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-accordion-trigger .title {
|
||||
.activitypub-event-bridge-settings-accordion-trigger .title {
|
||||
pointer-events: none;
|
||||
font-weight: 600;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-accordion-trigger .icon,
|
||||
.event-bridge-for-activitypub-settings-accordion-viewed .icon {
|
||||
.activitypub-event-bridge-settings-accordion-trigger .icon,
|
||||
.activitypub-event-bridge-settings-accordion-viewed .icon {
|
||||
border: solid #50575e medium;
|
||||
border-width: 0 2px 2px 0;
|
||||
height: .5rem;
|
||||
|
@ -142,16 +142,16 @@
|
|||
width: .5rem;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-accordion-trigger[aria-expanded="true"] .icon {
|
||||
.activitypub-event-bridge-settings-accordion-trigger[aria-expanded="true"] .icon {
|
||||
transform: translateY(-30%) rotate(-135deg);
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-accordion-trigger:active,
|
||||
.event-bridge-for-activitypub-settings-accordion-trigger:hover {
|
||||
.activitypub-event-bridge-settings-accordion-trigger:active,
|
||||
.activitypub-event-bridge-settings-accordion-trigger:hover {
|
||||
background: #f6f7f7;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-accordion-trigger:focus {
|
||||
.activitypub-event-bridge-settings-accordion-trigger:focus {
|
||||
color: #1d2327;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
|
@ -160,14 +160,14 @@
|
|||
background-color: #f6f7f7;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-inline-icon {
|
||||
.activitypub-event-bridge-settings-inline-icon {
|
||||
width: 1.5em;
|
||||
height: 1.5em;
|
||||
vertical-align: middle;
|
||||
margin: 0 0.3em;
|
||||
}
|
||||
|
||||
code.event-bridge-for-activitypub-settings-example-url {
|
||||
code.activitypub-event-bridge-settings-example-url {
|
||||
display: block;
|
||||
background: rgb(28, 29, 33);
|
||||
padding: 8px;
|
||||
|
@ -177,11 +177,3 @@ code.event-bridge-for-activitypub-settings-example-url {
|
|||
overflow-x: auto;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
#event_bridge_for_activitypub_summary_type_custom-details {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#event_bridge_for_activitypub_summary_type_custom-details > details {
|
||||
padding: 0.5em;
|
||||
}
|
14
assets/js/activitypub-event-bridge-admin.js
Normal file
14
assets/js/activitypub-event-bridge-admin.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
jQuery( function( $ ) {
|
||||
// Accordion handling in various areas.
|
||||
$( '.activitypub-event-bridge-settings-accordion' ).on( 'click', '.activitypub-event-bridge-settings-accordion-trigger', function() {
|
||||
var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) );
|
||||
|
||||
if ( isExpanded ) {
|
||||
$( this ).attr( 'aria-expanded', 'false' );
|
||||
$( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', true );
|
||||
} else {
|
||||
$( this ).attr( 'aria-expanded', 'true' );
|
||||
$( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', false );
|
||||
}
|
||||
} );
|
||||
} );
|
|
@ -1,34 +0,0 @@
|
|||
jQuery( function( $ ) {
|
||||
// Accordion handling in various areas.
|
||||
$( '.event-bridge-for-activitypub-settings-accordion' ).on( 'click', '.event-bridge-for-activitypub-settings-accordion-trigger', function() {
|
||||
var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) );
|
||||
|
||||
if ( isExpanded ) {
|
||||
$( this ).attr( 'aria-expanded', 'false' );
|
||||
$( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', true );
|
||||
} else {
|
||||
$( this ).attr( 'aria-expanded', 'true' );
|
||||
$( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', false );
|
||||
}
|
||||
} );
|
||||
|
||||
// Function to toggle visibility of custom details based on selected radio button.
|
||||
function toggleCustomDetailsForSummary() {
|
||||
if ($("#event_bridge_for_activitypub_summary_type_custom").is(':checked')) {
|
||||
$("#event_bridge_for_activitypub_summary_type_custom-details").show();
|
||||
} else {
|
||||
$("#event_bridge_for_activitypub_summary_type_custom-details").hide();
|
||||
}
|
||||
}
|
||||
|
||||
// Run the toggle function on page load.
|
||||
$(document).ready(function() {
|
||||
window.console.log("test");
|
||||
toggleCustomDetailsForSummary(); // Set the correct state on load.
|
||||
|
||||
// Listen for changes on the radio buttons
|
||||
$("input[name=event_bridge_for_activitypub_summary_type]").change(function() {
|
||||
toggleCustomDetailsForSummary(); // Update visibility on change.
|
||||
});
|
||||
});
|
||||
} );
|
|
@ -208,15 +208,9 @@ install_wp_plugin() {
|
|||
fi
|
||||
|
||||
# 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 }')
|
||||
PLUGIN_VERSION=$LATEST_TAG
|
||||
else
|
||||
PLUGIN_VERSION=$2
|
||||
fi
|
||||
|
||||
if [ -n "$PLUGIN_VERSION" ]; then
|
||||
PLUGIN_FILE="$PLUGIN_NAME.$PLUGIN_VERSION.zip"
|
||||
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_FILE="$PLUGIN_NAME.$LATEST_TAG.zip"
|
||||
else
|
||||
PLUGIN_FILE="$PLUGIN_NAME.zip"
|
||||
fi
|
||||
|
@ -254,14 +248,12 @@ install_wp_plugins() {
|
|||
# Install the one and only ActivityPub plugin (greetings @pfefferle).
|
||||
install_wp_plugin activitypub
|
||||
# Install (not-activate) all supported event plugins.
|
||||
install_wp_plugin the-events-calendar "6.8.1"
|
||||
install_wp_plugin the-events-calendar
|
||||
install_wp_plugin very-simple-event-list
|
||||
install_wp_plugin gatherpress
|
||||
install_wp_plugin eventprime-event-calendar-management
|
||||
install_wp_plugin events-manager "6.6.3"
|
||||
install_wp_plugin wp-event-manager "3.1.45.1"
|
||||
install_wp_plugin wp-event-solution "4.0.14"
|
||||
install_wp_plugin event-organiser "3.12.8"
|
||||
install_wp_plugin events-manager
|
||||
install_wp_plugin wp-event-manager
|
||||
install_wp_plugin wp-event-solution
|
||||
# Mec is not installable via wordpress.org, we use our own mirror.
|
||||
install_wp_plugin_mec
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "menrath/wordpress-event-bridge-for-activitypub",
|
||||
"name": "menrath/wordpress-activitypub-event-bridge",
|
||||
"version": "1.0.0",
|
||||
"description": "The Event Bridge for ActivityPub help for event custom post types to federate properly.",
|
||||
"description": "The ActivityPub Event Bridge help for event custom post types to federate properly.",
|
||||
"type": "wordpress-plugin",
|
||||
"require": {
|
||||
"php": ">=7.4.0",
|
||||
|
@ -33,7 +33,7 @@
|
|||
}
|
||||
],
|
||||
"extra": {
|
||||
"installer-name": "event-bridge-for-activitypub"
|
||||
"installer-name": "activitypub-event-bridge"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": [
|
||||
|
@ -54,13 +54,11 @@
|
|||
"@test-events-manager",
|
||||
"@test-wp-event-manager",
|
||||
"@test-eventin",
|
||||
"@test-modern-events-calendar-lite",
|
||||
"@test-eventprime",
|
||||
"@test-event-organiser"
|
||||
"@test-modern-events-calendar-lite"
|
||||
],
|
||||
"test-debug": [
|
||||
"@prepare-test",
|
||||
"@test-event-bridge-for-activitypub-shortcodes"
|
||||
"@test-gatherpress"
|
||||
],
|
||||
"test-vs-event-list": "phpunit --filter=vs_event_list",
|
||||
"test-the-events-calendar": "phpunit --filter=the_events_calendar",
|
||||
|
@ -69,9 +67,6 @@
|
|||
"test-wp-event-manager": "phpunit --filter=wp_event_manager",
|
||||
"test-eventin": "phpunit --filter=eventin",
|
||||
"test-modern-events-calendar-lite": "phpunit --filter=modern_events_calendar_lite",
|
||||
"test-eventprime": "phpunit --filter=eventprime",
|
||||
"test-event-organiser": "phpunit --filter=event_organiser",
|
||||
"test-event-bridge-for-activitypub-shortcodes": "phpunit --filter=event_bridge_for_activitypub_shortcodes",
|
||||
"test-all": "phpunit"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ version: '3'
|
|||
# "request": "launch",
|
||||
# "port": 9003,
|
||||
# "pathMappings": {
|
||||
# "/app/": "${workspaceRoot}/wp-content/plugins/event-bridge-for-activitypub/",
|
||||
# "/app/": "${workspaceRoot}/wp-content/plugins/activitypub-event-bridge/",
|
||||
# "/tmp/wordpress/": "${workspaceRoot}/"
|
||||
# },
|
||||
# },
|
||||
|
|
|
@ -13,7 +13,7 @@ To make the WordPress ActivityPub plugin use a custom transformer simply add a f
|
|||
First you need to add some basic information about your event plugin. Just create a new file in `./includes/plugins/my-event-plugin.php`. Implement at least all abstract functions of the `Event_Plugin` class.
|
||||
|
||||
```php
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
namespace ActivityPub_Event_Bridge\Plugins;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
@ -28,16 +28,16 @@ First you need to add some basic information about your event plugin. Just creat
|
|||
final class My_Event_Plugin extends Event_Plugin {
|
||||
```
|
||||
|
||||
Then you need to tell the Event Bridge for ActivityPub about that class by adding it to the `EVENT_PLUGIN_CLASSES` constant in the `includes/setup.php` file:
|
||||
Then you need to tell the ActivityPub Event Bridge about that class by adding it to the `EVENT_PLUGIN_CLASSES` constant in the `includes/setup.php` file:
|
||||
|
||||
```php
|
||||
private const EVENT_PLUGIN_CLASSES = array(
|
||||
...
|
||||
'\Event_Bridge_For_ActivityPub\Integrations\My_Event_Plugin',
|
||||
'\ActivityPub_Event_Bridge\Plugins\My_Event_Plugin',
|
||||
);
|
||||
```
|
||||
|
||||
The Event Bridge for ActivityPub then takes care of applying the transformer, so you can jump right into implementing it.
|
||||
The ActivityPub Event Bridge then takes care of applying the transformer, so you can jump right into implementing it.
|
||||
|
||||
## Writing an event transformer class
|
||||
|
||||
|
@ -48,9 +48,9 @@ If you are writing a transformer for your event post type we recommend to start
|
|||
So create a new file at `./includes/activitypub/transformer/my-event-plugin.php`.
|
||||
|
||||
```php
|
||||
namespace Event_Bridge_For_ActivityPub\Activitypub\Transformer;
|
||||
namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
|
||||
|
||||
use Event_Bridge_For_ActivityPub\Activitypub\Transformer\Event as Event_Transformer;
|
||||
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event as Event_Transformer;
|
||||
|
||||
/**
|
||||
* ActivityPub Transformer for My Event Plugin' event post type.
|
||||
|
@ -142,7 +142,7 @@ Implement a check whether your event plugin is active in the `set_up` function.
|
|||
}
|
||||
|
||||
// Make sure that ActivityPub support is enabled for The Events Calendar.
|
||||
$aec = \Event_Bridge_For_ActivityPub\Setup::get_instance();
|
||||
$aec = \ActivityPub_Event_Bridge\Setup::get_instance();
|
||||
$aec->activate_activitypub_support_for_active_event_plugins();
|
||||
|
||||
// Delete all posts afterwards.
|
||||
|
@ -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`.
|
||||
|
||||
```php
|
||||
switch ( $event_bridge_for_activitypub_integration_filter ) {
|
||||
switch ( $activitypub_event_extension_integration_filter ) {
|
||||
...
|
||||
case 'my_event_plugin':
|
||||
$plugin_file = 'my-event-plugin/my-event-plugin.php';
|
||||
|
@ -213,7 +213,7 @@ If you are using Visual Studio Code or VSCodium you can step-debug within the te
|
|||
"request": "launch",
|
||||
"port": 9003,
|
||||
"pathMappings": {
|
||||
"/app/": "${workspaceRoot}/wp-content/plugins/event-bridge-for-activitypub/",
|
||||
"/app/": "${workspaceRoot}/wp-content/plugins/activitypub-event-bridge/",
|
||||
"/tmp/wordpress/": "${workspaceRoot}/"
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Plugin Name: Event Bridge for ActivityPub
|
||||
* Description: Integrating popular event plugins with the ActivityPub plugin.
|
||||
* Plugin URI: https://event-federation.eu/
|
||||
* Version: 0.3.2
|
||||
* Author: André Menrath
|
||||
* Author URI: https://graz.social/@linos
|
||||
* Text Domain: event-bridge-for-activitypub
|
||||
* License: AGPL-3.0-or-later
|
||||
* License URI: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
* Requires PHP: 7.4
|
||||
*
|
||||
* Requires at least ActivityPub plugin with version >= 3.2.2. ActivityPub plugin tested up to: 4.3.0.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
define( 'EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
||||
define( 'EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
||||
define( 'EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . '/' . basename( __FILE__ ) );
|
||||
define( 'EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
||||
define( 'EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_VERSION', current( get_file_data( __FILE__, array( 'Version' ), 'plugin' ) ) );
|
||||
define( 'EVENT_BRIDGE_FOR_ACTIVITYPUB_DOMAIN', 'event-bridge-for-activitypub' );
|
||||
define( 'EVENT_BRIDGE_FOR_ACTIVITYPUB_ACTIVITYPUB_PLUGIN_MIN_VERSION', '3.2.2' );
|
||||
define( 'EVENT_BRIDGE_FOR_ACTIVITYPUB_CUSTOM_SUMMARY', "<ul>\n <li>[ap_start_time]</li>\n <li>[ap_end_time]</li>\n <li>[ap_location]</li>\n</ul>\n[ap_hashcats] [ap_hashtags]" );
|
||||
define( 'EVENT_BRIDGE_FOR_ACTIVITYPUB_DEFAULT_SUMMARY_TYPE', 'preset' );
|
||||
|
||||
// Include and register the autoloader class for automatic loading of plugin classes.
|
||||
require_once EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_DIR . '/includes/class-autoloader.php';
|
||||
Event_Bridge_For_ActivityPub\Autoloader::register();
|
||||
|
||||
// Initialize the plugin.
|
||||
Event_Bridge_For_ActivityPub\Setup::get_instance();
|
|
@ -1,99 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* ActivityPub Transformer for the plugin Event Organiser.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Activitypub\Transformer;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Activitypub\Activity\Extended_Object\Place;
|
||||
use Event_Bridge_For_ActivityPub\Activitypub\Transformer\Event;
|
||||
|
||||
/**
|
||||
* ActivityPub Transformer for Event Organiser.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class Event_Organiser extends Event {
|
||||
/**
|
||||
* Extended constructor.
|
||||
*
|
||||
* The wp_object is overridden with a the wp_object with filters. This object
|
||||
* also contains attributes specific to the Event organiser plugin like the
|
||||
* occurrence id.
|
||||
*
|
||||
* @param WP_Post $wp_object The WordPress object.
|
||||
* @param string $wp_taxonomy The taxonomy slug of the event post type.
|
||||
*/
|
||||
public function __construct( $wp_object, $wp_taxonomy ) {
|
||||
parent::__construct( $wp_object, $wp_taxonomy );
|
||||
$this->wp_object = get_posts(
|
||||
array(
|
||||
'ID' => $wp_object->ID,
|
||||
'post_type' => 'event',
|
||||
'suppress_filters' => false,
|
||||
)
|
||||
)[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the end time from the event object.
|
||||
*/
|
||||
public function get_end_time(): ?string {
|
||||
return eo_get_the_end( 'Y-m-d\TH:i:s\Z', $this->wp_object->ID, $this->wp_object->occurrence_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the end time from the event object.
|
||||
*/
|
||||
public function get_start_time(): string {
|
||||
return eo_get_the_start( 'Y-m-d\TH:i:s\Z', $this->wp_object->ID, $this->wp_object->occurrence_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get location from the event object.
|
||||
*/
|
||||
public function get_location(): ?Place {
|
||||
$venue_id = eo_get_venue( $this->wp_object->ID );
|
||||
|
||||
if ( ! $venue_id ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$address = eo_get_venue_address( $venue_id );
|
||||
|
||||
$venue_name = eo_get_venue_name( $venue_id );
|
||||
|
||||
$address['streetAddress'] = $address['address'];
|
||||
unset( $address['address'] );
|
||||
|
||||
$address['postalCode'] = $address['postcode'];
|
||||
unset( $address['postcode'] );
|
||||
|
||||
$address['addressRegion'] = $address['state'];
|
||||
unset( $address['state'] );
|
||||
|
||||
$address['addressLocality'] = $address['city'];
|
||||
unset( $address['city'] );
|
||||
|
||||
$address['addressCountry'] = $address['country'];
|
||||
unset( $address['country'] );
|
||||
|
||||
$address['type'] = 'PostalAddress';
|
||||
|
||||
$location = new Place();
|
||||
$location->set_name( eo_get_venue_name( $this->wp_object->ID ) );
|
||||
$location->set_latitude( eo_get_venue_lat( $this->wp_object->ID ) ?? null );
|
||||
$location->set_longitude( eo_get_venue_lng( $this->wp_object->ID ) ?? null );
|
||||
$location->set_address( $address );
|
||||
$location->set_name( $venue_name );
|
||||
$location->set_content( eo_get_venue_description( $venue_id ) );
|
||||
|
||||
return $location;
|
||||
}
|
||||
}
|
|
@ -2,20 +2,18 @@
|
|||
/**
|
||||
* Replace the default ActivityPub Transformer
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Activitypub\Transformer;
|
||||
namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Activitypub\Activity\Extended_Object\Event as Event_Object;
|
||||
use Activitypub\Activity\Extended_Object\Place;
|
||||
use Activitypub\Shortcodes;
|
||||
use Activitypub\Transformer\Post;
|
||||
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
|
@ -120,7 +118,7 @@ abstract class Event extends Post {
|
|||
if ( is_null( $this->wp_taxonomy ) ) {
|
||||
return null;
|
||||
}
|
||||
$current_category_mapping = \get_option( 'event_bridge_for_activitypub_event_category_mappings', array() );
|
||||
$current_category_mapping = \get_option( 'activitypub_event_bridge_event_category_mappings', array() );
|
||||
$terms = \get_the_terms( $this->wp_object, $this->wp_taxonomy );
|
||||
|
||||
// Check if the event has a category set and if that category has a specific mapping return that one.
|
||||
|
@ -128,7 +126,7 @@ abstract class Event extends Post {
|
|||
return sanitize_text_field( $current_category_mapping[ $terms[0]->slug ] );
|
||||
} else {
|
||||
// Return the default event category.
|
||||
return sanitize_text_field( \get_option( 'event_bridge_for_activitypub_default_event_category', 'MEETING' ) );
|
||||
return sanitize_text_field( \get_option( 'activitypub_event_bridge_default_event_category', 'MEETING' ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,14 +148,14 @@ abstract class Event extends Post {
|
|||
*
|
||||
* This is mandatory and must be implemented in the final event transformer class.
|
||||
*/
|
||||
abstract public function get_start_time(): string;
|
||||
abstract protected function get_start_time(): string;
|
||||
|
||||
/**
|
||||
* Get the end time.
|
||||
*
|
||||
* This is not mandatory and therefore just return null by default.
|
||||
*/
|
||||
public function get_end_time(): ?string {
|
||||
protected function get_end_time(): ?string {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -166,14 +164,14 @@ abstract class Event extends Post {
|
|||
*
|
||||
* This should be overridden in the actual event transformer.
|
||||
*/
|
||||
public function get_location(): ?Place {
|
||||
protected function get_location(): ?Place {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default value for the event status.
|
||||
*/
|
||||
public function get_status(): ?string {
|
||||
protected function get_status(): ?string {
|
||||
return 'CONFIRMED';
|
||||
}
|
||||
|
||||
|
@ -196,7 +194,7 @@ abstract class Event extends Post {
|
|||
*
|
||||
* @param ?string $time The time which needs to be formatted.
|
||||
*/
|
||||
protected static function format_time( $time ) {
|
||||
private static function format_time( $time ) {
|
||||
if ( is_null( $time ) ) {
|
||||
return '';
|
||||
}
|
||||
|
@ -207,160 +205,24 @@ abstract class Event extends Post {
|
|||
}
|
||||
|
||||
/**
|
||||
* Generates output for the 'ap_start_time' shortcode.
|
||||
*
|
||||
* @param ?array $atts The shortcode's attributes.
|
||||
* @return string The formatted start date and time of the event.
|
||||
* Format a human readable address.
|
||||
*/
|
||||
public function shortcode_start_time( $atts ) {
|
||||
$start_timestamp = $this->get_start_time();
|
||||
return $this->generate_time_output( $start_timestamp, $atts, '🗓️', __( 'Start', 'event-bridge-for-activitypub' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates output for the 'ap_end_time' shortcode.
|
||||
*
|
||||
* @param ?array $atts The shortcode's attributes.
|
||||
* @return string The formatted end date and time of the event.
|
||||
*/
|
||||
public function shortcode_end_time( $atts ) {
|
||||
$end_timestamp = $this->get_end_time();
|
||||
return $this->generate_time_output( $end_timestamp, $atts, '⏳', __( 'End', 'event-bridge-for-activitypub' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the formatted time output for a shortcode.
|
||||
*
|
||||
* @param int|null $timestamp The timestamp for the event time.
|
||||
* @param array $atts The shortcode attributes.
|
||||
* @param string $icon The icon to display.
|
||||
* @param string $label The label to display (e.g., 'Start', 'End').
|
||||
* @return string The formatted date and time, or an empty string if the timestamp is invalid.
|
||||
*/
|
||||
private function generate_time_output( $timestamp, $atts, $icon, $label ) {
|
||||
if ( ! $timestamp ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$args = shortcode_atts(
|
||||
array(
|
||||
'icon' => 'true',
|
||||
'label' => 'true',
|
||||
),
|
||||
$atts
|
||||
);
|
||||
|
||||
$args['icon'] = filter_var( $args['icon'], FILTER_VALIDATE_BOOLEAN );
|
||||
$args['label'] = filter_var( $args['label'], FILTER_VALIDATE_BOOLEAN );
|
||||
|
||||
$output = array();
|
||||
|
||||
if ( $args['icon'] ) {
|
||||
$output[] = $icon;
|
||||
}
|
||||
|
||||
if ( $args['label'] ) {
|
||||
$output[] = $label . ':';
|
||||
}
|
||||
|
||||
$output[] = self::format_time( $timestamp );
|
||||
|
||||
return implode( ' ', $output );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates output for the 'ap_location' shortcode.
|
||||
*
|
||||
* @param ?array $atts The shortcode's attributes.
|
||||
* @return string The formatted location/address of the event.
|
||||
*/
|
||||
public function shortcode_location( $atts ) {
|
||||
$args = shortcode_atts(
|
||||
array(
|
||||
'icon' => 'true',
|
||||
'label' => 'true',
|
||||
'country' => 'true',
|
||||
'zip' => 'true',
|
||||
'city' => 'true',
|
||||
'street' => 'true',
|
||||
'name' => 'true',
|
||||
),
|
||||
$atts,
|
||||
'ap_location'
|
||||
);
|
||||
|
||||
// Convert attributes to booleans.
|
||||
$args = array_map(
|
||||
function ( $value ) {
|
||||
return filter_var( $value, FILTER_VALIDATE_BOOLEAN );
|
||||
},
|
||||
$args
|
||||
);
|
||||
|
||||
protected function format_address(): string {
|
||||
$location = $this->get_location();
|
||||
if ( ! $location ) {
|
||||
if ( is_null( $location ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$output = array();
|
||||
if ( $args['icon'] ) {
|
||||
$output[] = '📍';
|
||||
$address = $location->get_address();
|
||||
if ( ! $address ) {
|
||||
return $location->get_name();
|
||||
}
|
||||
if ( $args['label'] ) {
|
||||
$output[] = esc_html__( 'Location', 'event-bridge-for-activitypub' ) . ':';
|
||||
}
|
||||
|
||||
$output[] = self::format_address( $location->get_address(), $args );
|
||||
|
||||
// Join output array into a single string with spaces and return.
|
||||
return implode( ' ', array_filter( $output ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the address based on provided arguments.
|
||||
*
|
||||
* @param mixed $address The address data, either as a string or an array.
|
||||
* @param array $args The arguments for which components to include.
|
||||
* @return string The formatted address.
|
||||
*/
|
||||
protected static function format_address( $address, $args = null ) {
|
||||
if ( is_string( $address ) ) {
|
||||
return esc_html( $address );
|
||||
return $address;
|
||||
}
|
||||
|
||||
if ( is_null( $args ) ) {
|
||||
$args = array(
|
||||
'icon' => 'true',
|
||||
'title' => 'true',
|
||||
'country' => 'true',
|
||||
'zip' => 'true',
|
||||
'city' => 'true',
|
||||
'street' => 'true',
|
||||
'name' => 'true',
|
||||
);
|
||||
if ( ! is_array( $address ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( is_array( $address ) ) {
|
||||
$address_parts = array();
|
||||
|
||||
$components = array(
|
||||
'name' => 'name',
|
||||
'street' => 'streetAddress',
|
||||
'zip' => 'postalCode',
|
||||
'city' => 'addressLocality',
|
||||
'country' => 'addressCountry',
|
||||
);
|
||||
|
||||
foreach ( $components as $arg_key => $address_key ) {
|
||||
if ( $args[ $arg_key ] && ! empty( $address[ $address_key ] ) ) {
|
||||
$address_parts[] = esc_html( $address[ $address_key ] );
|
||||
}
|
||||
}
|
||||
|
||||
return implode( ', ', $address_parts );
|
||||
}
|
||||
|
||||
return '';
|
||||
return isset( $address['locality'] ) ? $address['locality'] : '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -373,10 +235,10 @@ abstract class Event extends Post {
|
|||
$categories = array();
|
||||
|
||||
// Add the federated category string.
|
||||
require_once EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_DIR . '/includes/event-categories.php';
|
||||
require_once ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_DIR . '/includes/event-categories.php';
|
||||
$federated_category = $this->get_category();
|
||||
if ( array_key_exists( $federated_category, EVENT_BRIDGE_FOR_ACTIVITYPUB_EVENT_CATEGORIES ) ) {
|
||||
$categories[] = EVENT_BRIDGE_FOR_ACTIVITYPUB_EVENT_CATEGORIES[ $federated_category ];
|
||||
if ( array_key_exists( $federated_category, ACTIVITYPUB_EVENT_BRIDGE_EVENT_CATEGORIES ) ) {
|
||||
$categories[] = ACTIVITYPUB_EVENT_BRIDGE_EVENT_CATEGORIES[ $federated_category ];
|
||||
}
|
||||
|
||||
// Add all category terms.
|
||||
|
@ -393,68 +255,6 @@ abstract class Event extends Post {
|
|||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the shortcodes.
|
||||
*/
|
||||
public function register_shortcodes() {
|
||||
foreach ( get_class_methods( self::class ) as $function ) {
|
||||
if ( 'shortcode_' === substr( $function, 0, 10 ) ) {
|
||||
add_shortcode( 'ap_' . substr( $function, 10, strlen( $function ) ), array( $this, $function ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the shortcodes.
|
||||
*/
|
||||
public function unregister_shortcodes() {
|
||||
foreach ( get_class_methods( self::class ) as $function ) {
|
||||
if ( 'shortcode_' === substr( $function, 0, 10 ) ) {
|
||||
remove_shortcode( 'ap_' . substr( $function, 10, strlen( $function ) ), array( $this, $function ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the summary.
|
||||
*/
|
||||
public function get_summary(): ?string {
|
||||
if ( 'preset' === get_option( 'event_bridge_for_activitypub_summary_type', 'preset' ) ) {
|
||||
return $this->format_preset_summary();
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
$post = $this->wp_object;
|
||||
$summary = $this->get_event_summary_template();
|
||||
|
||||
// It seems that shortcodes are only applied to published posts.
|
||||
if ( is_preview() ) {
|
||||
$post->post_status = 'publish';
|
||||
}
|
||||
|
||||
// Register our shortcodes just in time.
|
||||
|
||||
Shortcodes::register();
|
||||
$this->register_shortcodes();
|
||||
|
||||
// Fill in the shortcodes.
|
||||
\setup_postdata( $post );
|
||||
$summary = \do_shortcode( $summary );
|
||||
\wp_reset_postdata();
|
||||
|
||||
$summary = \wpautop( $summary );
|
||||
$summary = \preg_replace( '/[\n\r\t]/', '', $summary );
|
||||
$summary = \trim( $summary );
|
||||
|
||||
$summary = \apply_filters( 'event_bridge_for_activitypub_the_summary', $summary, $post );
|
||||
|
||||
// Unregister the shortcodes.
|
||||
Shortcodes::unregister();
|
||||
$this->unregister_shortcodes();
|
||||
|
||||
return $summary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a custom summary.
|
||||
*
|
||||
|
@ -463,7 +263,7 @@ abstract class Event extends Post {
|
|||
*
|
||||
* @return string $summary The custom event summary.
|
||||
*/
|
||||
public function format_preset_summary(): ?string {
|
||||
public function get_summary(): ?string {
|
||||
add_filter( 'activitypub_object_content_template', array( self::class, 'remove_ap_permalink_from_template' ), 2, 2 );
|
||||
$excerpt = $this->retrieve_excerpt();
|
||||
// BeforeFirstRelease: decide whether this should be a admin setting.
|
||||
|
@ -474,29 +274,25 @@ abstract class Event extends Post {
|
|||
remove_filter( 'activitypub_object_content_template', array( self::class, 'remove_ap_permalink_from_template' ) );
|
||||
|
||||
$category = $this->format_categories();
|
||||
$start_time = $this->get_start_time();
|
||||
$end_time = $this->get_end_time();
|
||||
$address = $this->format_address( $this->get_location() );
|
||||
$time_atts = array(
|
||||
'icon' => true,
|
||||
'label' => true,
|
||||
);
|
||||
$start_time = $this->format_start_time();
|
||||
$end_time = $this->format_end_time();
|
||||
$address = $this->format_address();
|
||||
|
||||
$formatted_items = array();
|
||||
if ( ! empty( $category ) ) {
|
||||
$formatted_items[] = '🏷️ ' . __( 'Category', 'event-bridge-for-activitypub' ) . ': ' . $category;
|
||||
$formatted_items[] = '🏷️ ' . __( 'Category', 'activitypub-event-bridge' ) . ': ' . $category;
|
||||
}
|
||||
|
||||
if ( ! empty( $start_time ) ) {
|
||||
$formatted_items[] = $this->generate_time_output( $start_time, $time_atts, '🗓️', __( 'Start', 'event-bridge-for-activitypub' ) );
|
||||
$formatted_items[] = '🗓️ ' . __( 'Start', 'activitypub-event-bridge' ) . ': ' . $start_time;
|
||||
}
|
||||
|
||||
if ( ! empty( $end_time ) ) {
|
||||
$formatted_items[] = $this->generate_time_output( $end_time, $time_atts, '⏳', __( 'End', 'event-bridge-for-activitypub' ) );
|
||||
$formatted_items[] = '⏳ ' . __( 'End', 'activitypub-event-bridge' ) . ': ' . $end_time;
|
||||
}
|
||||
|
||||
if ( ! empty( $address ) ) {
|
||||
$formatted_items[] = '📍 ' . __( 'Address', 'event-bridge-for-activitypub' ) . ': ' . $address;
|
||||
$formatted_items[] = '📍 ' . __( 'Address', 'activitypub-event-bridge' ) . ': ' . $address;
|
||||
}
|
||||
|
||||
// Compose the summary based on the number of meta items.
|
||||
|
@ -512,18 +308,6 @@ abstract class Event extends Post {
|
|||
return $summary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the template to use to generate the summary of the ActivityStreams representation of an event post.
|
||||
*
|
||||
* @return string The Template.
|
||||
*/
|
||||
protected function get_event_summary_template() {
|
||||
$summary = \get_option( 'event_bridge_for_activitypub_custom_summary', EVENT_BRIDGE_FOR_ACTIVITYPUB_CUSTOM_SUMMARY );
|
||||
$template = $summary ?? EVENT_BRIDGE_FOR_ACTIVITYPUB_CUSTOM_SUMMARY;
|
||||
|
||||
return apply_filters( 'event_bridge_for_activitypub_summary_template', $template, $this->wp_object );
|
||||
}
|
||||
|
||||
/**
|
||||
* By default set the timezone of the WordPress site.
|
||||
*
|
||||
|
|
|
@ -4,17 +4,17 @@
|
|||
*
|
||||
* @link https://support.themewinter.com/docs/plugins/docs-category/eventin/
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Activitypub\Transformer;
|
||||
namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Activitypub\Activity\Extended_Object\Place;
|
||||
use Event_Bridge_For_ActivityPub\Activitypub\Transformer\Event;
|
||||
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event;
|
||||
use DateTime;
|
||||
use DateTimeZone;
|
||||
use Etn\Core\Event\Event_Model;
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* ActivityPub Transformer for the plugin EventPrime.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Activitypub\Transformer;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Activitypub\Activity\Extended_Object\Place;
|
||||
use Event_Bridge_For_ActivityPub\Activitypub\Transformer\Event;
|
||||
|
||||
/**
|
||||
* ActivityPub Transformer for VS Event
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class EventPrime extends Event {
|
||||
/**
|
||||
* Get the end time from the event object.
|
||||
*/
|
||||
public function get_end_time(): ?string {
|
||||
$timestamp = get_post_meta( $this->wp_object->ID, 'em_end_date', true );
|
||||
if ( $timestamp ) {
|
||||
return \gmdate( 'Y-m-d\TH:i:s\Z', $timestamp );
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the end time from the event object.
|
||||
*/
|
||||
public function get_start_time(): string {
|
||||
$timestamp = get_post_meta( $this->wp_object->ID, 'em_start_date', true );
|
||||
if ( $timestamp ) {
|
||||
return \gmdate( 'Y-m-d\TH:i:s\Z', $timestamp );
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get location from the event object.
|
||||
*/
|
||||
public function get_location(): ?Place {
|
||||
$venue_term_id = get_post_meta( $this->wp_object->ID, 'em_venue', true );
|
||||
if ( ! $venue_term_id ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$venue = wp_get_post_terms( $this->wp_object->ID, 'em_venue' );
|
||||
|
||||
if ( empty( $venue ) ) {
|
||||
return null;
|
||||
} else {
|
||||
$venue = $venue[0];
|
||||
}
|
||||
|
||||
$place = new Place();
|
||||
|
||||
$place->set_name( $venue->name );
|
||||
$place->set_content( $venue->description );
|
||||
|
||||
$address = get_term_meta( $venue->term_id, 'em_address', true );
|
||||
$display_address = get_term_meta( $venue->term_id, 'em_display_address_on_frontend', true );
|
||||
|
||||
if ( $address && $display_address ) {
|
||||
$place->set_address( get_term_meta( $venue->term_id, 'em_address', true ) );
|
||||
}
|
||||
|
||||
return $place;
|
||||
}
|
||||
}
|
|
@ -2,17 +2,17 @@
|
|||
/**
|
||||
* ActivityPub Transformer for the plugin Very Simple Event List.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Activitypub\Transformer;
|
||||
namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Activitypub\Activity\Extended_Object\Place;
|
||||
use Event_Bridge_For_ActivityPub\Activitypub\Transformer\Event as Event_Transformer;
|
||||
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event as Event_Transformer;
|
||||
use DateTime;
|
||||
use DateTimeZone;
|
||||
use EM_Event;
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
<?php
|
||||
/**
|
||||
* ActivityPub Transformer for the GatherPress event plugin.
|
||||
* ActivityPub Transformer for the plugin Very Simple Event List.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Activitypub\Transformer;
|
||||
namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Activitypub\Activity\Extended_Object\Event as Event_Object;
|
||||
use Activitypub\Activity\Extended_Object\Place;
|
||||
use Event_Bridge_For_ActivityPub\Activitypub\Transformer\Event;
|
||||
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event;
|
||||
use GatherPress\Core\Event as GatherPress_Event;
|
||||
|
||||
/**
|
||||
|
@ -73,14 +73,14 @@ final class GatherPress extends Event {
|
|||
/**
|
||||
* Get the end time from the event object.
|
||||
*/
|
||||
public function get_end_time(): ?string {
|
||||
protected function get_end_time(): ?string {
|
||||
return $this->gp_event->get_datetime_end( 'Y-m-d\TH:i:s\Z' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the end time from the event object.
|
||||
*/
|
||||
public function get_start_time(): string {
|
||||
protected function get_start_time(): string {
|
||||
return $this->gp_event->get_datetime_start( 'Y-m-d\TH:i:s\Z' );
|
||||
}
|
||||
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
/**
|
||||
* ActivityPub Tribe Transformer
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Activitypub\Transformer;
|
||||
namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Activitypub\Activity\Extended_Object\Place;
|
||||
use Event_Bridge_For_ActivityPub\Activitypub\Transformer\Event;
|
||||
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event;
|
||||
|
||||
use MEC;
|
||||
use MEC\Events\Event as MEC_Event;
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
/**
|
||||
* ActivityPub Tribe Transformer
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Activitypub\Transformer;
|
||||
namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Activitypub\Activity\Extended_Object\Place;
|
||||
use Event_Bridge_For_ActivityPub\Activitypub\Transformer\Event;
|
||||
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event;
|
||||
use WP_Post;
|
||||
|
||||
use function Activitypub\esc_hashtag;
|
||||
|
@ -72,7 +72,7 @@ final class The_Events_Calendar extends Event {
|
|||
/**
|
||||
* Get the end time from the event object.
|
||||
*/
|
||||
public function get_end_time(): ?string {
|
||||
protected function get_end_time(): ?string {
|
||||
if ( empty( $this->tribe_event->end_date ) ) {
|
||||
return null;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ final class The_Events_Calendar extends Event {
|
|||
/**
|
||||
* Get the end time from the event object.
|
||||
*/
|
||||
public function get_start_time(): string {
|
||||
protected function get_start_time(): string {
|
||||
$date = date_create( $this->tribe_event->start_date, wp_timezone() );
|
||||
return \gmdate( 'Y-m-d\TH:i:s\Z', $date->getTimestamp() );
|
||||
}
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
/**
|
||||
* ActivityPub Transformer for the plugin Very Simple Event List.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Activitypub\Transformer;
|
||||
namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Activitypub\Activity\Extended_Object\Place;
|
||||
use Event_Bridge_For_ActivityPub\Activitypub\Transformer\Event as Event_Transformer;
|
||||
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event as Event_Transformer;
|
||||
|
||||
/**
|
||||
* ActivityPub Transformer for VS Event.
|
||||
|
@ -44,7 +44,7 @@ final class VS_Event_List extends Event_Transformer {
|
|||
/**
|
||||
* Get the end time from the events metadata.
|
||||
*/
|
||||
public function get_end_time(): ?string {
|
||||
protected function get_end_time(): ?string {
|
||||
if ( 'yes' === get_post_meta( $this->wp_object->ID, 'event-hide-end-time', true ) ) {
|
||||
return null;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ final class VS_Event_List extends Event_Transformer {
|
|||
/**
|
||||
* Get the end time from the events metadata.
|
||||
*/
|
||||
public function get_start_time(): string {
|
||||
protected function get_start_time(): string {
|
||||
$start_time = get_post_meta( $this->wp_object->ID, 'event-start-date', true );
|
||||
return \gmdate( 'Y-m-d\TH:i:s\Z', $start_time );
|
||||
}
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
/**
|
||||
* ActivityPub Transformer for the plugin Very Simple Event List.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Activitypub\Transformer;
|
||||
namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Activitypub\Activity\Extended_Object\Place;
|
||||
use Event_Bridge_For_ActivityPub\Activitypub\Transformer\Event as Event_Transformer;
|
||||
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event as Event_Transformer;
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
|
@ -101,7 +101,7 @@ final class WP_Event_Manager extends Event_Transformer {
|
|||
if ( str_starts_with( $event_link_url, 'http' ) ) {
|
||||
return array(
|
||||
'type' => 'Link',
|
||||
'name' => \esc_html__( 'Video URL', 'event-bridge-for-activitypub' ),
|
||||
'name' => \esc_html__( 'Video URL', 'activitypub-event-bridge' ),
|
||||
'href' => \esc_url( $event_link_url ),
|
||||
'mediaType' => 'text/html',
|
||||
);
|
||||
|
|
|
@ -4,17 +4,17 @@
|
|||
*
|
||||
* Notices for guiding to proper configuration of ActivityPub with event plugins.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @since 1.0.0
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Admin;
|
||||
namespace ActivityPub_Event_Bridge\Admin;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Event_Bridge_For_ActivityPub\Integrations\Event_Plugin;
|
||||
use ActivityPub_Event_Bridge\Plugins\Event_Plugin;
|
||||
|
||||
/**
|
||||
* Class responsible for Event Plugin related admin notices.
|
||||
|
@ -69,25 +69,17 @@ class Event_Plugin_Admin_Notices {
|
|||
* @return void
|
||||
*/
|
||||
private function do_admin_notice_post_type_not_activitypub_enabled(): void {
|
||||
$all_plugins = get_plugins();
|
||||
$event_plugin_file = $this->event_plugin::get_relative_plugin_file();
|
||||
if ( isset( $all_plugins[ $event_plugin_file ]['Name'] ) ) {
|
||||
$event_plugin_name = $all_plugins[ $event_plugin_file ]['Name'];
|
||||
} elseif ( isset( get_mu_plugins()[ $event_plugin_file ]['Name'] ) ) {
|
||||
$event_plugin_name = get_mu_plugins()[ $event_plugin_file ]['Name'];
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
$event_plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $this->event_plugin::get_plugin_file() );
|
||||
$activitypub_plugin_data = get_plugin_data( ACTIVITYPUB_PLUGIN_FILE );
|
||||
$notice = sprintf(
|
||||
/* translators: 1: the name of the event plugin a admin notice is shown. 2: The name of the ActivityPub plugin. */
|
||||
_x(
|
||||
'You have installed the <i>%1$s</i> plugin, but the event post type of the plugin <i>%2$s</i> is <b>not enabled</b> in the <a href="%3$s">%1$s settings</a>.',
|
||||
'admin notice',
|
||||
'event-bridge-for-activitypub'
|
||||
'activitypub-event-bridge'
|
||||
),
|
||||
esc_html( $activitypub_plugin_data['Name'] ),
|
||||
esc_html( $event_plugin_name ),
|
||||
esc_html( $event_plugin_data['Name'] ),
|
||||
admin_url( 'options-general.php?page=activitypub&tab=settings' )
|
||||
);
|
||||
$allowed_html = array(
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
*
|
||||
* Notices for guiding to proper configuration of this plugin.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @since 1.0.0
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Admin;
|
||||
namespace ActivityPub_Event_Bridge\Admin;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
@ -29,7 +29,7 @@ class General_Admin_Notices {
|
|||
*/
|
||||
const ACTIVITYPUB_PLUGIN_URL = 'https://wordpress.org/plugins/activitypub';
|
||||
|
||||
const EVENT_BRIDGE_FOR_ACTIVITYPUB_SUPPORTED_EVENT_PLUGINS_URL = 'https://code.event-federation.eu/Event-Federation/wordpress-event-bridge-for-activitypub#events-plugin-that-will-be-supported-at-first';
|
||||
const ACTIVITYPUB_EVENT_BRIDGE_SUPPORTED_EVENT_PLUGINS_URL = 'https://code.event-federation.eu/Event-Federation/wordpress-activitypub-event-bridge#events-plugin-that-will-be-supported-at-first';
|
||||
|
||||
/**
|
||||
* Allowed HTML for admin notices.
|
||||
|
@ -54,9 +54,9 @@ class General_Admin_Notices {
|
|||
return sprintf(
|
||||
/* translators: 1: An URL that points to the ActivityPub plugin. */
|
||||
_x(
|
||||
'For the Event Bridge for ActivityPub to work, you will need to install and activate the <a href="%1$s">ActivityPub</a> plugin.',
|
||||
'For the ActivityPub Event Bridge to work, you will need to install and activate the <a href="%1$s">ActivityPub</a> plugin.',
|
||||
'admin notice',
|
||||
'event-bridge-for-activitypub'
|
||||
'activitypub-event-bridge'
|
||||
),
|
||||
esc_html( self::ACTIVITYPUB_PLUGIN_URL )
|
||||
);
|
||||
|
@ -71,12 +71,12 @@ class General_Admin_Notices {
|
|||
return sprintf(
|
||||
/* translators: 1: The name of the ActivityPub plugin. 2: The minimum required version number of the ActivityPub plugin. */
|
||||
_x(
|
||||
'Please upgrade your <a href="%1$s">ActivityPub</a> plugin. At least version %2$s is required for the Event Bridge for ActivityPub to work.',
|
||||
'Please upgrade your <a href="%1$s">ActivityPub</a> plugin. At least version %2$s is required for the ActivityPub Event Bridge to work.',
|
||||
'admin notice',
|
||||
'event-bridge-for-activitypub'
|
||||
'activitypub-event-bridge'
|
||||
),
|
||||
esc_html( self::ACTIVITYPUB_PLUGIN_URL ),
|
||||
esc_html( EVENT_BRIDGE_FOR_ACTIVITYPUB_ACTIVITYPUB_PLUGIN_MIN_VERSION )
|
||||
esc_html( ACTIVITYPUB_EVENT_BRIDGE_ACTIVITYPUB_PLUGIN_MIN_VERSION )
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -89,12 +89,12 @@ class General_Admin_Notices {
|
|||
return sprintf(
|
||||
/* translators: 1: An URL to the list of supported event plugins. */
|
||||
_x(
|
||||
'The Plugin <i>Event Bridge for ActivityPub</i> is of no use, because you do not have installed and activated a supported Event Plugin.
|
||||
'The Plugin <i>ActivityPub Event Bridge</i> is of no use, because you do not have installed and activated a supported Event Plugin.
|
||||
<br> For a list of supported Event Plugins see <a href="%1$s">here</a>.',
|
||||
'admin notice',
|
||||
'event-bridge-for-activitypub'
|
||||
'activitypub-event-bridge'
|
||||
),
|
||||
esc_html( self::EVENT_BRIDGE_FOR_ACTIVITYPUB_SUPPORTED_EVENT_PLUGINS_URL )
|
||||
esc_html( self::ACTIVITYPUB_EVENT_BRIDGE_SUPPORTED_EVENT_PLUGINS_URL )
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -107,12 +107,12 @@ class General_Admin_Notices {
|
|||
return sprintf(
|
||||
/* translators: 1: An URL to the list of supported event plugins. */
|
||||
_x(
|
||||
'The Plugin <i>Event Bridge for ActivityPub</i> is of no use, because you do not have installed and activated a supported Event Plugin.
|
||||
'The Plugin <i>ActivityPub Event Bridge</i> is of no use, because you do not have installed and activated a supported Event Plugin.
|
||||
<br> For a list of supported Event Plugins see <a href="%1$s">here</a>.',
|
||||
'admin notice',
|
||||
'event-bridge-for-activitypub'
|
||||
'activitypub-event-bridge'
|
||||
),
|
||||
esc_html( self::EVENT_BRIDGE_FOR_ACTIVITYPUB_SUPPORTED_EVENT_PLUGINS_URL )
|
||||
esc_html( self::ACTIVITYPUB_EVENT_BRIDGE_SUPPORTED_EVENT_PLUGINS_URL )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
* @package Activitypub_Event_Bridge
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Admin;
|
||||
namespace ActivityPub_Event_Bridge\Admin;
|
||||
|
||||
use Activitypub\Transformer\Factory as Transformer_Factory;
|
||||
use Event_Bridge_For_ActivityPub\Integrations\Event_Plugin;
|
||||
use Event_Bridge_For_ActivityPub\Setup;
|
||||
use ActivityPub_Event_Bridge\Plugins\Event_Plugin;
|
||||
use ActivityPub_Event_Bridge\Setup;
|
||||
use WP_Query;
|
||||
|
||||
/**
|
||||
|
@ -32,8 +32,8 @@ class Health_Check {
|
|||
* @return array The filtered test array.
|
||||
*/
|
||||
public static function add_tests( $tests ) {
|
||||
$tests['direct']['event_bridge_for_activitypub_test'] = array(
|
||||
'label' => __( 'ActivityPub Event Transformer Test', 'event-bridge-for-activitypub' ),
|
||||
$tests['direct']['activitypub_event_bridge_test'] = array(
|
||||
'label' => __( 'ActivityPub Event Transformer Test', 'activitypub-event-bridge' ),
|
||||
'test' => array( self::class, 'test_event_transformation' ),
|
||||
);
|
||||
|
||||
|
@ -47,15 +47,15 @@ class Health_Check {
|
|||
*/
|
||||
public static function test_event_transformation() {
|
||||
$result = array(
|
||||
'label' => \__( 'Transformation of Events to a valid ActivityStreams representation.', 'event-bridge-for-activitypub' ),
|
||||
'label' => \__( 'Transformation of Events to a valid ActivityStreams representation.', 'activitypub-event-bridge' ),
|
||||
'status' => 'good',
|
||||
'badge' => array(
|
||||
'label' => \__( 'Event Bridge for ActivityPub', 'event-bridge-for-activitypub' ),
|
||||
'label' => \__( 'ActivityPub Event Bridge', 'activitypub-event-bridge' ),
|
||||
'color' => 'green',
|
||||
),
|
||||
'description' => \sprintf(
|
||||
'<p>%s</p>',
|
||||
\__( 'The transformation of your most recent events was successful.', 'event-bridge-for-activitypub' )
|
||||
\__( 'The transformation of your most recent events was successful.', 'activitypub-event-bridge' )
|
||||
),
|
||||
'actions' => '',
|
||||
'test' => 'test_event_transformation',
|
||||
|
@ -68,7 +68,7 @@ class Health_Check {
|
|||
}
|
||||
|
||||
$result['status'] = 'critical';
|
||||
$result['label'] = \__( 'One or more of your most recent events failed to transform to ActivityPub', 'event-bridge-for-activitypub' );
|
||||
$result['label'] = \__( 'One or more of your most recent events failed to transform to ActivityPub', 'activitypub-event-bridge' );
|
||||
$result['badge']['color'] = 'red';
|
||||
$result['description'] = \sprintf(
|
||||
'<p>%s</p>',
|
||||
|
@ -114,9 +114,7 @@ class Health_Check {
|
|||
*/
|
||||
public static function get_most_recent_event_posts( $event_post_type = null, $number_of_posts = 5 ) {
|
||||
if ( ! $event_post_type ) {
|
||||
$active_event_plugins = Setup::get_instance()->get_active_event_plugins();
|
||||
$active_event_plugin = reset( $active_event_plugins );
|
||||
$event_post_type = $active_event_plugin->get_post_type();
|
||||
$event_post_type = Setup::get_instance()->get_active_event_plugins()[0]->get_post_type();
|
||||
}
|
||||
|
||||
$args = array(
|
||||
|
@ -150,7 +148,7 @@ class Health_Check {
|
|||
$active_event_plugins = Setup::get_instance()->get_active_event_plugins();
|
||||
$info = array();
|
||||
foreach ( $active_event_plugins as $active_event_plugin ) {
|
||||
$event_plugin_file = $active_event_plugin->get_relative_plugin_file();
|
||||
$event_plugin_file = $active_event_plugin->get_plugin_file();
|
||||
$event_plugin_data = \get_plugin_data( $event_plugin_file );
|
||||
$event_plugin_name = isset( $event_plugin_data['Plugin Name'] ) ? $event_plugin_data['Plugin Name'] : 'Name not found';
|
||||
$event_plugin_version = isset( $event_plugin_version['Plugin Version'] ) ? $event_plugin_version['Plugin Version'] : 'Version not found';
|
||||
|
@ -170,12 +168,12 @@ class Health_Check {
|
|||
* @return array The extended information.
|
||||
*/
|
||||
public static function add_debug_information( $info ) {
|
||||
$info['event_bridge_for_activitypub'] = array(
|
||||
'label' => __( 'Event Bridge for ActivityPub', 'event-bridge-for-activitypub' ),
|
||||
$info['activitypub_event_bridge'] = array(
|
||||
'label' => __( 'ActivityPub Event Bridge', 'activitypub-event-bridge' ),
|
||||
'fields' => array(
|
||||
'plugin_version' => array(
|
||||
'label' => __( 'Plugin Version', 'event-bridge-for-activitypub' ),
|
||||
'value' => EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_VERSION,
|
||||
'label' => __( 'Plugin Version', 'activitypub-event-bridge' ),
|
||||
'value' => ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_VERSION,
|
||||
'private' => true,
|
||||
),
|
||||
'active_event_plugins' => self::get_info_about_active_event_plugins(),
|
||||
|
|
|
@ -3,32 +3,32 @@
|
|||
* General settings class.
|
||||
*
|
||||
* This file contains the General class definition, which handles the "General" settings
|
||||
* page for the Event Bridge for ActivityPub Plugin, providing options for configuring various general settings.
|
||||
* page for the Activitypub Event Bridge Plugin, providing options for configuring various general settings.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Admin;
|
||||
namespace ActivityPub_Event_Bridge\Admin;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Event_Bridge_For_ActivityPub\Integrations\Event_Plugin;
|
||||
use Event_Bridge_For_ActivityPub\Setup;
|
||||
use ActivityPub_Event_Bridge\Plugins\Event_Plugin;
|
||||
use ActivityPub_Event_Bridge\Setup;
|
||||
|
||||
/**
|
||||
* Class responsible for the Event Bridge for ActivityPub related Settings.
|
||||
* Class responsible for the Activitypub Event Bridge related Settings.
|
||||
*
|
||||
* Class which handles the "General" settings page for the Event Bridge for ActivityPub Plugin,
|
||||
* Class which handles the "General" settings page for the Activitypub Event Bridge Plugin,
|
||||
* providing options for configuring various general settings.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Settings_Page {
|
||||
const STATIC = 'Event_Bridge_For_ActivityPub\Admin\Settings_Page';
|
||||
const STATIC = 'ActivityPub_Event_Bridge\Admin\Settings_Page';
|
||||
|
||||
const SETTINGS_SLUG = 'event-bridge-for-activitypub';
|
||||
const SETTINGS_SLUG = 'activitypub-event-bridge';
|
||||
/**
|
||||
* Warning if the plugin is Active and the ActivityPub plugin is not.
|
||||
*
|
||||
|
@ -36,8 +36,8 @@ class Settings_Page {
|
|||
*/
|
||||
public static function admin_menu(): void {
|
||||
\add_options_page(
|
||||
'Event Bridge for ActivityPub',
|
||||
__( 'Event Bridge for ActivityPub', 'event-bridge-for-activitypub' ),
|
||||
'Activitypub Event Bridge',
|
||||
__( 'ActivityPub Event Bridge', 'activitypub-event-bridge' ),
|
||||
'manage_options',
|
||||
self::SETTINGS_SLUG,
|
||||
array( self::STATIC, 'settings_page' ),
|
||||
|
@ -97,9 +97,6 @@ class Settings_Page {
|
|||
$tab = sanitize_key( $_GET['tab'] );
|
||||
}
|
||||
|
||||
// Fallback to always re-scan active event plugins, when user visits admin area of this plugin.
|
||||
Setup::get_instance()->redetect_active_event_plugins();
|
||||
|
||||
switch ( $tab ) {
|
||||
case 'settings':
|
||||
$plugin_setup = Setup::get_instance();
|
||||
|
@ -117,7 +114,7 @@ class Settings_Page {
|
|||
'event_terms' => $event_terms,
|
||||
);
|
||||
|
||||
\load_template( EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_DIR . 'templates/settings.php', true, $args );
|
||||
\load_template( ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_DIR . 'templates/settings.php', true, $args );
|
||||
break;
|
||||
case 'welcome':
|
||||
default:
|
||||
|
@ -125,7 +122,7 @@ class Settings_Page {
|
|||
add_thickbox();
|
||||
wp_enqueue_script( 'updates' );
|
||||
|
||||
\load_template( EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_DIR . 'templates/welcome.php', true );
|
||||
\load_template( ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_DIR . 'templates/welcome.php', true );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<?php
|
||||
/**
|
||||
* Class responsible for autoloading Event Bridge for ActivityPub class files.
|
||||
* Class responsible for autoloading ActivityPub Event Bridge class files.
|
||||
*
|
||||
* The Autoloader class is responsible for automatically loading class files as needed
|
||||
* to ensure a clean and organized codebase. It maps class names to their corresponding
|
||||
* file locations within the GatherPress plugin.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @since 1.0.0
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub;
|
||||
namespace ActivityPub_Event_Bridge;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
@ -34,8 +34,8 @@ class Autoloader {
|
|||
public static function register(): void {
|
||||
spl_autoload_register(
|
||||
function ( $full_class ) {
|
||||
$base_dir = EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_DIR . '/includes/';
|
||||
$base = 'Event_Bridge_For_ActivityPub\\';
|
||||
$base_dir = ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_DIR . '/includes/';
|
||||
$base = 'ActivityPub_Event_Bridge\\';
|
||||
|
||||
if ( strncmp( $full_class, $base, strlen( $base ) ) === 0 ) {
|
||||
$maybe_uppercase = str_replace( $base, '', $full_class );
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
* General settings class.
|
||||
*
|
||||
* This file contains the General class definition, which handles the "General" settings
|
||||
* page for the Event Bridge for ActivityPub Plugin, providing options for configuring various general settings.
|
||||
* page for the Activitypub Event Bridge Plugin, providing options for configuring various general settings.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub;
|
||||
namespace ActivityPub_Event_Bridge;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
@ -24,7 +24,7 @@ use Activitypub\Activity\Extended_Object\Event;
|
|||
* @since 1.0.0
|
||||
*/
|
||||
class Settings {
|
||||
const SETTINGS_SLUG = 'event-bridge-for-activitypub';
|
||||
const SETTINGS_SLUG = 'activitypub-event-bridge';
|
||||
|
||||
/**
|
||||
* The default ActivityPub event category.
|
||||
|
@ -34,17 +34,17 @@ class Settings {
|
|||
const DEFAULT_EVENT_CATEGORY = 'MEETING';
|
||||
|
||||
/**
|
||||
* Register the settings for the Event Bridge for ActivityPub plugin.
|
||||
* Register the settings for the ActivityPub Event Bridge plugin.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function register_settings(): void {
|
||||
\register_setting(
|
||||
'event-bridge-for-activitypub',
|
||||
'event_bridge_for_activitypub_default_event_category',
|
||||
'activitypub-event-bridge',
|
||||
'activitypub_event_bridge_default_event_category',
|
||||
array(
|
||||
'type' => 'string',
|
||||
'description' => \__( 'Define your own custom post template', 'event-bridge-for-activitypub' ),
|
||||
'description' => \__( 'Define your own custom post template', 'activitypub-event-bridge' ),
|
||||
'show_in_rest' => true,
|
||||
'default' => self::DEFAULT_EVENT_CATEGORY,
|
||||
'sanitize_callback' => array( self::class, 'sanitize_mapped_event_category' ),
|
||||
|
@ -52,47 +52,25 @@ class Settings {
|
|||
);
|
||||
|
||||
\register_setting(
|
||||
'event-bridge-for-activitypub',
|
||||
'event_bridge_for_activitypub_event_category_mappings',
|
||||
'activitypub-event-bridge',
|
||||
'activitypub_event_bridge_event_category_mappings',
|
||||
array(
|
||||
'type' => 'array',
|
||||
'description' => \__( 'Define your own custom post template', 'event-bridge-for-activitypub' ),
|
||||
'description' => \__( 'Define your own custom post template', 'activitypub-event-bridge' ),
|
||||
'default' => array(),
|
||||
'sanitize_callback' => array( self::class, 'sanitize_event_category_mappings' ),
|
||||
)
|
||||
);
|
||||
|
||||
\register_setting(
|
||||
'event-bridge-for-activitypub',
|
||||
'event_bridge_for_activitypub_initially_activated',
|
||||
'activitypub-event-bridge',
|
||||
'activitypub_event_bridge_initially_activated',
|
||||
array(
|
||||
'type' => 'boolean',
|
||||
'description' => \__( 'Whether the plugin just got activated for the first time.', 'event-bridge-for-activitypub' ),
|
||||
'description' => \__( 'Whether the plugin just got activated for the first time.', 'activitypub-event-bridge' ),
|
||||
'default' => 1,
|
||||
)
|
||||
);
|
||||
|
||||
\register_setting(
|
||||
'event-bridge-for-activitypub',
|
||||
'event_bridge_for_activitypub_summary_type',
|
||||
array(
|
||||
'type' => 'string',
|
||||
'description' => \__( 'Summary type to use for ActivityStreams', 'event-bridge-for-activitypub' ),
|
||||
'show_in_rest' => true,
|
||||
'default' => 'preset',
|
||||
)
|
||||
);
|
||||
|
||||
\register_setting(
|
||||
'event-bridge-for-activitypub',
|
||||
'event_bridge_for_activitypub_custom_summary',
|
||||
array(
|
||||
'type' => 'string',
|
||||
'description' => \__( 'Define your own custom summary template for events', 'event-bridge-for-activitypub' ),
|
||||
'show_in_rest' => true,
|
||||
'default' => EVENT_BRIDGE_FOR_ACTIVITYPUB_CUSTOM_SUMMARY,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Class responsible for initializing Event Bridge for ActivityPub.
|
||||
* Class responsible for initializing ActivityPub Event Bridge.
|
||||
*
|
||||
* The setup class provides function for checking if this plugin should be activated.
|
||||
* It detects supported event plugins and provides all setup hooks and filters.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @since 1.0.0
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub;
|
||||
namespace ActivityPub_Event_Bridge;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Event_Bridge_For_ActivityPub\Admin\Event_Plugin_Admin_Notices;
|
||||
use Event_Bridge_For_ActivityPub\Admin\General_Admin_Notices;
|
||||
use Event_Bridge_For_ActivityPub\Admin\Health_Check;
|
||||
use Event_Bridge_For_ActivityPub\Admin\Settings_Page;
|
||||
use Event_Bridge_For_ActivityPub\Integrations\Event_Plugin;
|
||||
use ActivityPub_Event_Bridge\Admin\Event_Plugin_Admin_Notices;
|
||||
use ActivityPub_Event_Bridge\Admin\General_Admin_Notices;
|
||||
use ActivityPub_Event_Bridge\Admin\Health_Check;
|
||||
use ActivityPub_Event_Bridge\Admin\Settings_Page;
|
||||
use ActivityPub_Event_Bridge\Plugins\Event_Plugin;
|
||||
|
||||
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||
|
||||
/**
|
||||
* Class Setup.
|
||||
*
|
||||
* This class is responsible for initializing Event Bridge for ActivityPub.
|
||||
* This class is responsible for initializing ActivityPub Event Bridge.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
@ -64,11 +64,12 @@ class Setup {
|
|||
is_plugin_active( 'activitypub/activitypub.php' );
|
||||
// BeforeFirstRelease: decide whether we want to do anything at all when ActivityPub plugin is note active.
|
||||
// if ( ! $this->activitypub_plugin_is_active ) {
|
||||
// deactivate_plugins( EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_FILE );
|
||||
// deactivate_plugins( ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_FILE );
|
||||
// return;
|
||||
// }.
|
||||
$this->active_event_plugins = self::detect_active_event_plugins();
|
||||
$this->activitypub_plugin_version = self::get_activitypub_plugin_version();
|
||||
add_action( 'plugins_loaded', array( $this, 'setup_hooks' ) );
|
||||
$this->setup_hooks();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,7 +106,8 @@ class Setup {
|
|||
if ( defined( 'ACTIVITYPUB_PLUGIN_VERSION' ) ) {
|
||||
return constant( 'ACTIVITYPUB_PLUGIN_VERSION' );
|
||||
}
|
||||
return '0.0.0';
|
||||
$version = get_file_data( WP_PLUGIN_DIR . '/activitypub/activitypub.php', array( 'Version' ) )[0];
|
||||
return $version ?? '0.0.0';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -123,58 +125,32 @@ class Setup {
|
|||
* @var array
|
||||
*/
|
||||
private const EVENT_PLUGIN_CLASSES = array(
|
||||
'\Event_Bridge_For_ActivityPub\Integrations\Events_Manager',
|
||||
'\Event_Bridge_For_ActivityPub\Integrations\GatherPress',
|
||||
'\Event_Bridge_For_ActivityPub\Integrations\The_Events_Calendar',
|
||||
'\Event_Bridge_For_ActivityPub\Integrations\VS_Event_List',
|
||||
'\Event_Bridge_For_ActivityPub\Integrations\WP_Event_Manager',
|
||||
'\Event_Bridge_For_ActivityPub\Integrations\Eventin',
|
||||
'\Event_Bridge_For_ActivityPub\Integrations\Modern_Events_Calendar_Lite',
|
||||
'\Event_Bridge_For_ActivityPub\Integrations\EventPrime',
|
||||
'\Event_Bridge_For_ActivityPub\Integrations\Event_Organiser',
|
||||
'\ActivityPub_Event_Bridge\Plugins\Events_Manager',
|
||||
'\ActivityPub_Event_Bridge\Plugins\GatherPress',
|
||||
'\ActivityPub_Event_Bridge\Plugins\The_Events_Calendar',
|
||||
'\ActivityPub_Event_Bridge\Plugins\VS_Event_List',
|
||||
'\ActivityPub_Event_Bridge\Plugins\WP_Event_Manager',
|
||||
'\ActivityPub_Event_Bridge\Plugins\Eventin',
|
||||
'\ActivityPub_Event_Bridge\Plugins\Modern_Events_Calendar_Lite',
|
||||
);
|
||||
|
||||
/**
|
||||
* Force the re-scan for active event plugins without using the cached transient.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function redetect_active_event_plugins(): void {
|
||||
delete_transient( 'event_bridge_for_activitypub_active_event_plugins' );
|
||||
$this->detect_active_event_plugins();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that checks for supported activated event plugins.
|
||||
*
|
||||
* @return array List of supported event plugins as keys from the SUPPORTED_EVENT_PLUGINS const.
|
||||
*/
|
||||
public function detect_active_event_plugins(): array {
|
||||
$active_event_plugins = get_transient( 'event_bridge_for_activitypub_active_event_plugins' );
|
||||
|
||||
if ( $active_event_plugins ) {
|
||||
$this->active_event_plugins = $active_event_plugins;
|
||||
return $active_event_plugins;
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'get_plugins' ) ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||
}
|
||||
|
||||
$all_plugins = array_merge( get_plugins(), get_mu_plugins() );
|
||||
|
||||
public static function detect_active_event_plugins(): array {
|
||||
$active_event_plugins = array();
|
||||
|
||||
foreach ( self::EVENT_PLUGIN_CLASSES as $event_plugin_class ) {
|
||||
$event_plugin_file = call_user_func( array( $event_plugin_class, 'get_relative_plugin_file' ) );
|
||||
if ( ! $event_plugin_file ) {
|
||||
if ( ! class_exists( $event_plugin_class ) || ! method_exists( $event_plugin_class, 'get_plugin_file' ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( array_key_exists( $event_plugin_file, $all_plugins ) && \is_plugin_active( $event_plugin_file ) ) {
|
||||
$active_event_plugins[ $event_plugin_file ] = new $event_plugin_class();
|
||||
$event_plugin_file = call_user_func( array( $event_plugin_class, 'get_plugin_file' ) );
|
||||
if ( \is_plugin_active( $event_plugin_file ) ) {
|
||||
$active_event_plugins[] = new $event_plugin_class();
|
||||
}
|
||||
}
|
||||
set_transient( 'event_bridge_for_activitypub_active_event_plugins', $active_event_plugins );
|
||||
$this->active_event_plugins = $active_event_plugins;
|
||||
return $active_event_plugins;
|
||||
}
|
||||
|
||||
|
@ -187,20 +163,15 @@ class Setup {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setup_hooks(): void {
|
||||
$this->detect_active_event_plugins();
|
||||
|
||||
register_activation_hook( EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_FILE, array( $this, 'activate' ) );
|
||||
|
||||
add_action( 'activated_plugin', array( $this, 'redetect_active_event_plugins' ) );
|
||||
add_action( 'deactivated_plugin', array( $this, 'redetect_active_event_plugins' ) );
|
||||
protected function setup_hooks(): void {
|
||||
register_activation_hook( ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_FILE, array( $this, 'activate' ) );
|
||||
|
||||
add_action( 'admin_init', array( $this, 'do_admin_notices' ) );
|
||||
add_action( 'admin_init', array( Settings::class, 'register_settings' ) );
|
||||
add_action( 'admin_enqueue_scripts', array( self::class, 'enqueue_styles' ) );
|
||||
add_action( 'admin_menu', array( Settings_Page::class, 'admin_menu' ) );
|
||||
add_filter(
|
||||
'plugin_action_links_' . EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_BASENAME,
|
||||
'plugin_action_links_' . ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_BASENAME,
|
||||
array( Settings_Page::class, 'settings_link' )
|
||||
);
|
||||
|
||||
|
@ -212,7 +183,7 @@ class Setup {
|
|||
add_action( 'init', array( Health_Check::class, 'init' ) );
|
||||
|
||||
// Check if the minimum required version of the ActivityPub plugin is installed.
|
||||
if ( ! version_compare( $this->activitypub_plugin_version, EVENT_BRIDGE_FOR_ACTIVITYPUB_ACTIVITYPUB_PLUGIN_MIN_VERSION ) ) {
|
||||
if ( ! version_compare( $this->activitypub_plugin_version, ACTIVITYPUB_EVENT_BRIDGE_ACTIVITYPUB_PLUGIN_MIN_VERSION ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -227,24 +198,24 @@ class Setup {
|
|||
* @return void
|
||||
*/
|
||||
public static function enqueue_styles( $hook_suffix ): void {
|
||||
if ( false !== strpos( $hook_suffix, 'event-bridge-for-activitypub' ) ) {
|
||||
if ( false !== strpos( $hook_suffix, 'activitypub-event-bridge' ) ) {
|
||||
wp_enqueue_style(
|
||||
'event-bridge-for-activitypub-admin-styles',
|
||||
'activitypub-event-bridge-admin-styles',
|
||||
plugins_url(
|
||||
'assets/css/event-bridge-for-activitypub-admin.css',
|
||||
EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_FILE
|
||||
'assets/css/activitypub-event-bridge-admin.css',
|
||||
ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_FILE
|
||||
),
|
||||
array(),
|
||||
EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_VERSION
|
||||
ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_VERSION
|
||||
);
|
||||
wp_enqueue_script(
|
||||
'event-bridge-for-activitypub-admin-script',
|
||||
'activitypub-event-bridge-admin-script',
|
||||
plugins_url(
|
||||
'assets/js/event-bridge-for-activitypub-admin.js',
|
||||
EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_FILE
|
||||
'assets/js/activitypub-event-bridge-admin.js',
|
||||
ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_FILE
|
||||
),
|
||||
array( 'jquery' ),
|
||||
EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_VERSION,
|
||||
ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_VERSION,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
@ -260,15 +231,15 @@ class Setup {
|
|||
// Check if any general admin notices are needed and add actions to insert the needed admin notices.
|
||||
if ( ! $this->activitypub_plugin_is_active ) {
|
||||
// The ActivityPub plugin is not active.
|
||||
add_action( 'admin_notices', array( 'Event_Bridge_For_ActivityPub\Admin\General_Admin_Notices', 'activitypub_plugin_not_enabled' ), 10, 1 );
|
||||
add_action( 'admin_notices', array( 'ActivityPub_Event_Bridge\Admin\General_Admin_Notices', 'activitypub_plugin_not_enabled' ), 10, 1 );
|
||||
}
|
||||
if ( ! version_compare( $this->activitypub_plugin_version, EVENT_BRIDGE_FOR_ACTIVITYPUB_ACTIVITYPUB_PLUGIN_MIN_VERSION ) ) {
|
||||
if ( ! version_compare( $this->activitypub_plugin_version, ACTIVITYPUB_EVENT_BRIDGE_ACTIVITYPUB_PLUGIN_MIN_VERSION ) ) {
|
||||
// The ActivityPub plugin is too old.
|
||||
add_action( 'admin_notices', array( 'Event_Bridge_For_ActivityPub\Admin\General_Admin_Notices', 'activitypub_plugin_version_too_old' ), 10, 1 );
|
||||
add_action( 'admin_notices', array( 'ActivityPub_Event_Bridge\Admin\General_Admin_Notices', 'activitypub_plugin_version_too_old' ), 10, 1 );
|
||||
}
|
||||
if ( empty( $this->active_event_plugins ) ) {
|
||||
// No supported Event Plugin is active.
|
||||
add_action( 'admin_notices', array( 'Event_Bridge_For_ActivityPub\Admin\General_Admin_Notices', 'no_supported_event_plugin_active' ), 10, 1 );
|
||||
add_action( 'admin_notices', array( 'ActivityPub_Event_Bridge\Admin\General_Admin_Notices', 'no_supported_event_plugin_active' ), 10, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -281,7 +252,7 @@ class Setup {
|
|||
*
|
||||
* @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 ( 'WP_Post' !== $object_class ) {
|
||||
return $transformer;
|
||||
|
@ -321,19 +292,18 @@ class Setup {
|
|||
}
|
||||
|
||||
/**
|
||||
* Activates the Event Bridge for ActivityPub plugin.
|
||||
* Activates the ActivityPub Event Bridge plugin.
|
||||
*
|
||||
* This method handles the activation of the Event Bridge for ActivityPub plugin.
|
||||
* This method handles the activation of the ActivityPub Event Bridge plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @see register_activation_hook()
|
||||
* @return void
|
||||
*/
|
||||
public function activate(): void {
|
||||
$this->redetect_active_event_plugins();
|
||||
// Don't allow plugin activation, when the ActivityPub plugin is not activated yet.
|
||||
if ( ! $this->activitypub_plugin_is_active ) {
|
||||
deactivate_plugins( plugin_basename( EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_FILE ) );
|
||||
deactivate_plugins( plugin_basename( ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_FILE ) );
|
||||
$notice = General_Admin_Notices::get_admin_notice_activitypub_plugin_not_enabled();
|
||||
wp_die(
|
||||
wp_kses( $notice, General_Admin_Notices::ALLOWED_HTML ),
|
||||
|
@ -343,7 +313,7 @@ class Setup {
|
|||
}
|
||||
|
||||
if ( empty( $this->active_event_plugins ) ) {
|
||||
deactivate_plugins( plugin_basename( EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_FILE ) );
|
||||
deactivate_plugins( plugin_basename( ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_FILE ) );
|
||||
$notice = General_Admin_Notices::get_admin_notice_no_supported_event_plugin_active();
|
||||
wp_die(
|
||||
wp_kses( $notice, General_Admin_Notices::ALLOWED_HTML ),
|
||||
|
|
|
@ -2,46 +2,46 @@
|
|||
/**
|
||||
* File responsible for defining the event category strings.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @since 1.0.0
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub;
|
||||
namespace ActivityPub_Event_Bridge;
|
||||
|
||||
define(
|
||||
'EVENT_BRIDGE_FOR_ACTIVITYPUB_EVENT_CATEGORIES',
|
||||
'ACTIVITYPUB_EVENT_BRIDGE_EVENT_CATEGORIES',
|
||||
array(
|
||||
'ARTS' => __( 'Arts', 'event-bridge-for-activitypub' ),
|
||||
'BOOK_CLUBS' => __( 'Book clubs', 'event-bridge-for-activitypub' ),
|
||||
'BUSINESS' => __( 'Business', 'event-bridge-for-activitypub' ),
|
||||
'CAUSES' => __( 'Causes', 'event-bridge-for-activitypub' ),
|
||||
'COMEDY' => __( 'Comedy', 'event-bridge-for-activitypub' ),
|
||||
'CRAFTS' => __( 'Crafts', 'event-bridge-for-activitypub' ),
|
||||
'FOOD_DRINK' => __( 'Food & Drink', 'event-bridge-for-activitypub' ),
|
||||
'HEALTH' => __( 'Health', 'event-bridge-for-activitypub' ),
|
||||
'MUSIC' => __( 'Music', 'event-bridge-for-activitypub' ),
|
||||
'AUTO_BOAT_AIR' => __( 'Auto, boat and air', 'event-bridge-for-activitypub' ),
|
||||
'COMMUNITY' => __( 'Community', 'event-bridge-for-activitypub' ),
|
||||
'FAMILY_EDUCATION' => __( 'Family & Education', 'event-bridge-for-activitypub' ),
|
||||
'FASHION_BEAUTY' => __( 'Fashion & Beauty', 'event-bridge-for-activitypub' ),
|
||||
'FILM_MEDIA' => __( 'Film & Media', 'event-bridge-for-activitypub' ),
|
||||
'GAMES' => __( 'Games', 'event-bridge-for-activitypub' ),
|
||||
'LANGUAGE_CULTURE' => __( 'Language & Culture', 'event-bridge-for-activitypub' ),
|
||||
'LEARNING' => __( 'Learning', 'event-bridge-for-activitypub' ),
|
||||
'LGBTQ' => __( 'LGBTQ', 'event-bridge-for-activitypub' ),
|
||||
'MOVEMENTS_POLITICS' => __( 'Movements and politics', 'event-bridge-for-activitypub' ),
|
||||
'NETWORKING' => __( 'Networking', 'event-bridge-for-activitypub' ),
|
||||
'PARTY' => __( 'Party', 'event-bridge-for-activitypub' ),
|
||||
'PERFORMING_VISUAL_ARTS' => __( 'Performing & Visual Arts', 'event-bridge-for-activitypub' ),
|
||||
'PETS' => __( 'Pets', 'event-bridge-for-activitypub' ),
|
||||
'PHOTOGRAPHY' => __( 'Photography', 'event-bridge-for-activitypub' ),
|
||||
'OUTDOORS_ADVENTURE' => __( 'Outdoors & Adventure', 'event-bridge-for-activitypub' ),
|
||||
'SPIRITUALITY_RELIGION_BELIEFS' => __( 'Spirituality, Religion & Beliefs', 'event-bridge-for-activitypub' ),
|
||||
'SCIENCE_TECH' => __( 'Science & Tech', 'event-bridge-for-activitypub' ),
|
||||
'SPORTS' => __( 'Sports', 'event-bridge-for-activitypub' ),
|
||||
'THEATRE' => __( 'Theatre', 'event-bridge-for-activitypub' ),
|
||||
'MEETING' => __( 'Meeting', 'event-bridge-for-activitypub' ), // Default value in federation.
|
||||
'DEFAULT' => __( 'Default', 'event-bridge-for-activitypub' ), // Internal default for overrides.
|
||||
'ARTS' => __( 'Arts', 'activitypub-event-bridge' ),
|
||||
'BOOK_CLUBS' => __( 'Book clubs', 'activitypub-event-bridge' ),
|
||||
'BUSINESS' => __( 'Business', 'activitypub-event-bridge' ),
|
||||
'CAUSES' => __( 'Causes', 'activitypub-event-bridge' ),
|
||||
'COMEDY' => __( 'Comedy', 'activitypub-event-bridge' ),
|
||||
'CRAFTS' => __( 'Crafts', 'activitypub-event-bridge' ),
|
||||
'FOOD_DRINK' => __( 'Food & Drink', 'activitypub-event-bridge' ),
|
||||
'HEALTH' => __( 'Health', 'activitypub-event-bridge' ),
|
||||
'MUSIC' => __( 'Music', 'activitypub-event-bridge' ),
|
||||
'AUTO_BOAT_AIR' => __( 'Auto, boat and air', 'activitypub-event-bridge' ),
|
||||
'COMMUNITY' => __( 'Community', 'activitypub-event-bridge' ),
|
||||
'FAMILY_EDUCATION' => __( 'Family & Education', 'activitypub-event-bridge' ),
|
||||
'FASHION_BEAUTY' => __( 'Fashion & Beauty', 'activitypub-event-bridge' ),
|
||||
'FILM_MEDIA' => __( 'Film & Media', 'activitypub-event-bridge' ),
|
||||
'GAMES' => __( 'Games', 'activitypub-event-bridge' ),
|
||||
'LANGUAGE_CULTURE' => __( 'Language & Culture', 'activitypub-event-bridge' ),
|
||||
'LEARNING' => __( 'Learning', 'activitypub-event-bridge' ),
|
||||
'LGBTQ' => __( 'LGBTQ', 'activitypub-event-bridge' ),
|
||||
'MOVEMENTS_POLITICS' => __( 'Movements and politics', 'activitypub-event-bridge' ),
|
||||
'NETWORKING' => __( 'Networking', 'activitypub-event-bridge' ),
|
||||
'PARTY' => __( 'Party', 'activitypub-event-bridge' ),
|
||||
'PERFORMING_VISUAL_ARTS' => __( 'Performing & Visual Arts', 'activitypub-event-bridge' ),
|
||||
'PETS' => __( 'Pets', 'activitypub-event-bridge' ),
|
||||
'PHOTOGRAPHY' => __( 'Photography', 'activitypub-event-bridge' ),
|
||||
'OUTDOORS_ADVENTURE' => __( 'Outdoors & Adventure', 'activitypub-event-bridge' ),
|
||||
'SPIRITUALITY_RELIGION_BELIEFS' => __( 'Spirituality, Religion & Beliefs', 'activitypub-event-bridge' ),
|
||||
'SCIENCE_TECH' => __( 'Science & Tech', 'activitypub-event-bridge' ),
|
||||
'SPORTS' => __( 'Sports', 'activitypub-event-bridge' ),
|
||||
'THEATRE' => __( 'Theatre', 'activitypub-event-bridge' ),
|
||||
'MEETING' => __( 'Meeting', 'activitypub-event-bridge' ), // Default value in federation.
|
||||
'DEFAULT' => __( 'Default', 'activitypub-event-bridge' ), // Internal default for overrides.
|
||||
),
|
||||
);
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Event Organiser.
|
||||
*
|
||||
* Defines all the necessary meta information for the Event Organiser plugin.
|
||||
*
|
||||
* @link https://wordpress.org/plugins/event-organiser/
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
/**
|
||||
* Interface for a supported event plugin.
|
||||
*
|
||||
* This interface defines which information is necessary for a supported event plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class Event_Organiser extends Event_Plugin {
|
||||
/**
|
||||
* Returns the full plugin file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
return 'event-organiser/event-organiser.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the event post type of the plugin.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_post_type(): string {
|
||||
return 'event';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the IDs of the admin pages of the plugin.
|
||||
*
|
||||
* @return array The settings page urls.
|
||||
*/
|
||||
public static function get_settings_pages(): array {
|
||||
return array( 'event-organiser' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ActivityPub transformer class.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_activitypub_transformer_class_name(): string {
|
||||
return 'Event_Organiser';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the taxonomy used for the plugin's event categories.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_event_category_taxonomy(): string {
|
||||
return 'event-category';
|
||||
}
|
||||
}
|
|
@ -1,221 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* EventPrime – Events Calendar, Bookings and Tickets
|
||||
*
|
||||
* @link https://wordpress.org/plugins/eventprime-event-calendar-management/
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
|
||||
use Activitypub\Signature;
|
||||
use Eventprime_Basic_Functions;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
/**
|
||||
* This class defines which information is necessary for the EventPrime event plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class EventPrime extends Event_Plugin {
|
||||
/**
|
||||
* Add filter for the template inclusion.
|
||||
*/
|
||||
public function __construct() {
|
||||
\add_filter( 'template_include', array( self::class, 'render_activitypub_template' ), 100 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full plugin file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
return 'eventprime-event-calendar-management/event-prime.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the event post type of the plugin.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_post_type(): string {
|
||||
return 'em_event';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the IDs of the admin pages of the plugin.
|
||||
*
|
||||
* @return array The settings page urls.
|
||||
*/
|
||||
public static function get_settings_pages(): array {
|
||||
return array( 'ep-settings' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ActivityPub transformer class.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_activitypub_transformer_class_name(): string {
|
||||
return 'EventPrime';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the taxonomy used for the plugin's event categories.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_event_category_taxonomy(): string {
|
||||
return 'em_event_type';
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the current request is an EventPrime ActivityPub request.
|
||||
*
|
||||
* Forked from https://github.com/Automattic/wordpress-activitypub/blob/trunk/includes/functions.php
|
||||
* the function is_activitypub_request.
|
||||
*/
|
||||
private static function is_eventprime_activitypub_request() {
|
||||
global $wp_query;
|
||||
|
||||
/*
|
||||
* ActivityPub requests are currently only made for
|
||||
* author archives, singular posts, and the homepage.
|
||||
*/
|
||||
if ( ! \is_author() && ! \is_singular() && ! \is_home() && ! defined( '\REST_REQUEST' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the current post type supports ActivityPub.
|
||||
if ( \is_singular() ) {
|
||||
$queried_object = \get_queried_object();
|
||||
|
||||
if ( ! $queried_object instanceof \WP_Post ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( '[em_event]' !== $queried_object->post_content && '[em_events]' !== $queried_object->post_content ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if header already sent.
|
||||
if ( ! \headers_sent() && ACTIVITYPUB_SEND_VARY_HEADER ) {
|
||||
// Send Vary header for Accept header.
|
||||
\header( 'Vary: Accept' );
|
||||
}
|
||||
|
||||
// One can trigger an ActivityPub request by adding ?activitypub to the URL.
|
||||
if ( isset( $wp_query->query_vars['activitypub'] ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* The other (more common) option to make an ActivityPub request
|
||||
* is to send an Accept header.
|
||||
*/
|
||||
if ( isset( $_SERVER['HTTP_ACCEPT'] ) ) {
|
||||
$accept = sanitize_text_field( wp_unslash( $_SERVER['HTTP_ACCEPT'] ) );
|
||||
|
||||
/*
|
||||
* $accept can be a single value, or a comma separated list of values.
|
||||
* We want to support both scenarios,
|
||||
* and return true when the header includes at least one of the following:
|
||||
* - application/activity+json
|
||||
* - application/ld+json
|
||||
* - application/json
|
||||
*/
|
||||
if ( preg_match( '/(application\/(ld\+json|activity\+json|json))/i', $accept ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the post id of the event for an EventPrime event query.
|
||||
*
|
||||
* @return bool|int The post ID if an event could be identified, false otherwise.
|
||||
*/
|
||||
private static function get_eventprime_post_id() {
|
||||
$event = get_query_var( 'event' );
|
||||
if ( ! $event ) {
|
||||
if ( ! empty( filter_input( INPUT_GET, 'event', FILTER_SANITIZE_FULL_SPECIAL_CHARS ) ) ) {
|
||||
$event = rtrim( filter_input( INPUT_GET, 'event', FILTER_SANITIZE_FULL_SPECIAL_CHARS ), '/\\' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $event ) {
|
||||
$ep_basic_functions = new Eventprime_Basic_Functions();
|
||||
return $ep_basic_functions->ep_get_id_by_slug( $event, 'em_event' );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the ActivityPub template for EventPrime.
|
||||
*
|
||||
* @param string $template The path to the template object.
|
||||
* @return string The new path to the JSON template.
|
||||
*/
|
||||
public static function render_activitypub_template( $template ) {
|
||||
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
|
||||
return $template;
|
||||
}
|
||||
|
||||
// Check if the request is a page with (solely) the eventprime shortcode in it.
|
||||
if ( ! self::is_eventprime_activitypub_request() ) {
|
||||
return $template;
|
||||
}
|
||||
|
||||
if ( ! \is_singular() ) {
|
||||
return $template;
|
||||
}
|
||||
|
||||
$post_id = self::get_eventprime_post_id();
|
||||
|
||||
if ( $post_id ) {
|
||||
$preview = \get_query_var( 'preview' );
|
||||
if ( $preview ) {
|
||||
$activitypub_template = ACTIVITYPUB_PLUGIN_DIR . '/templates/post-preview.php';
|
||||
} else {
|
||||
$activitypub_template = ACTIVITYPUB_PLUGIN_DIR . '/templates/post-json.php';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if the request is authorized.
|
||||
*
|
||||
* @see https://www.w3.org/wiki/SocialCG/ActivityPub/Primer/Authentication_Authorization#Authorized_fetch
|
||||
* @see https://swicg.github.io/activitypub-http-signature/#authorized-fetch
|
||||
*/
|
||||
if ( $activitypub_template && defined( 'ACTIVITYPUB_AUTHORIZED_FETCH' ) && constant( 'ACTIVITYPUB_AUTHORIZED_FETCH' ) ) {
|
||||
$verification = Signature::verify_http_signature( $_SERVER );
|
||||
if ( \is_wp_error( $verification ) ) {
|
||||
header( 'HTTP/1.1 401 Unauthorized' );
|
||||
|
||||
// Fallback as template_loader can't return http headers.
|
||||
return $template;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $activitypub_template ) {
|
||||
global $post;
|
||||
|
||||
$post = get_post( $post_id ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
|
||||
// Ensure WordPress functions use the new post data.
|
||||
setup_postdata( $post );
|
||||
// Return the default ActivityPub template.
|
||||
return $activitypub_template;
|
||||
}
|
||||
|
||||
return $template;
|
||||
}
|
||||
}
|
|
@ -4,13 +4,13 @@
|
|||
*
|
||||
* Basic information that each supported event needs for this plugin to work.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
namespace ActivityPub_Event_Bridge\Plugins;
|
||||
|
||||
use Event_Bridge_For_ActivityPub\Activitypub\Transformer\Event as Event_Transformer;
|
||||
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event as Event_Transformer;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
@ -24,11 +24,11 @@ defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
|||
*/
|
||||
abstract class Event_Plugin {
|
||||
/**
|
||||
* Returns the plugin file relative to the plugins dir.
|
||||
* Returns the full plugin file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public static function get_relative_plugin_file(): string;
|
||||
abstract public static function get_plugin_file(): string;
|
||||
|
||||
/**
|
||||
* Returns the event post type of the plugin.
|
||||
|
@ -57,9 +57,9 @@ abstract class Event_Plugin {
|
|||
* Get the plugins name from the main plugin-file's top-level-file-comment.
|
||||
*/
|
||||
final public static function get_plugin_name(): string {
|
||||
$all_plugins = array_merge( get_plugins(), get_mu_plugins() );
|
||||
if ( isset( $all_plugins[ static::get_relative_plugin_file() ]['Name'] ) ) {
|
||||
return $all_plugins[ static::get_relative_plugin_file() ]['Name'];
|
||||
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . static::get_plugin_file() );
|
||||
if ( isset( $plugin_data['Name'] ) ) {
|
||||
return $plugin_data['Name'];
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
@ -83,6 +83,6 @@ abstract class Event_Plugin {
|
|||
* Returns the Activitypub transformer for the event plugins event post type.
|
||||
*/
|
||||
public static function get_activitypub_event_transformer_class(): string {
|
||||
return str_replace( 'Integrations', 'Activitypub\Transformer', static::class );
|
||||
return str_replace( 'Plugins', 'Activitypub\Transformer', static::class );
|
||||
}
|
||||
}
|
|
@ -5,11 +5,11 @@
|
|||
* Defines all the necessary meta information for the events calendar.
|
||||
*
|
||||
* @link https://wordpress.org/plugins/the-events-calendar/
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
namespace ActivityPub_Event_Bridge\Plugins;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
@ -27,7 +27,7 @@ final class Eventin extends Event_plugin {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
public static function get_plugin_file(): string {
|
||||
return 'wp-event-solution/eventin.php';
|
||||
}
|
||||
|
|
@ -5,11 +5,11 @@
|
|||
* Defines all the necessary meta information for the Events Manager WordPress Plugin.
|
||||
*
|
||||
* @link https://wordpress.org/plugins/events-manager/
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
namespace ActivityPub_Event_Bridge\Plugins;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
@ -27,7 +27,7 @@ final class Events_Manager extends Event_Plugin {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
public static function get_plugin_file(): string {
|
||||
return 'events-manager/events-manager.php';
|
||||
}
|
||||
|
|
@ -5,11 +5,11 @@
|
|||
* Defines all the necessary meta information for the GatherPress plugin.
|
||||
*
|
||||
* @link https://wordpress.org/plugins/gatherpress/
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
namespace ActivityPub_Event_Bridge\Plugins;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
@ -27,7 +27,7 @@ final class GatherPress extends Event_Plugin {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
public static function get_plugin_file(): string {
|
||||
return 'gatherpress/gatherpress.php';
|
||||
}
|
||||
|
|
@ -5,11 +5,11 @@
|
|||
* Defines all the necessary meta information for the Modern Events Calendar (Lite).
|
||||
*
|
||||
* @link https://webnus.net/modern-events-calendar/
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
namespace ActivityPub_Event_Bridge\Plugins;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
@ -27,7 +27,7 @@ final class Modern_Events_Calendar_Lite extends Event_plugin {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
public static function get_plugin_file(): string {
|
||||
return 'modern-events-calendar-lite/modern-events-calendar-lite.php';
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ final class Modern_Events_Calendar_Lite extends Event_plugin {
|
|||
*/
|
||||
public static function get_post_type(): string {
|
||||
// See MEC_feature_events->get_main_post_type().
|
||||
return 'mec-events';
|
||||
return apply_filters( 'mec_post_type_name', 'mec-events' ); // phpcs:ignore
|
||||
}
|
||||
|
||||
/**
|
|
@ -5,11 +5,11 @@
|
|||
* Defines all the necessary meta information for the events calendar.
|
||||
*
|
||||
* @link https://wordpress.org/plugins/the-events-calendar/
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
namespace ActivityPub_Event_Bridge\Plugins;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
@ -27,7 +27,7 @@ final class The_Events_Calendar extends Event_plugin {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
public static function get_plugin_file(): string {
|
||||
return 'the-events-calendar/the-events-calendar.php';
|
||||
}
|
||||
|
|
@ -6,13 +6,13 @@
|
|||
* "Very Simple Events List".
|
||||
*
|
||||
* @link https://de.wordpress.org/plugins/very-simple-event-list/
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
namespace ActivityPub_Event_Bridge\Plugins;
|
||||
|
||||
use Event_Bridge_For_ActivityPub\Event_Plugins;
|
||||
use ActivityPub_Event_Bridge\Event_Plugins;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
@ -30,7 +30,7 @@ final class VS_Event_List extends Event_Plugin {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
public static function get_plugin_file(): string {
|
||||
return 'very-simple-event-list/vsel.php';
|
||||
}
|
||||
|
|
@ -6,13 +6,13 @@
|
|||
* "WP Event Manager"
|
||||
*
|
||||
* @link https://de.wordpress.org/plugins/wp-event-manager
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
namespace ActivityPub_Event_Bridge\Plugins;
|
||||
|
||||
use Event_Bridge_For_ActivityPub\Integrations\Event_Plugin;
|
||||
use ActivityPub_Event_Bridge\Plugins\Event_Plugin;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
@ -30,7 +30,7 @@ final class WP_Event_Manager extends Event_Plugin {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
public static function get_plugin_file(): string {
|
||||
return 'wp-event-manager/wp-event-manager.php';
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
{
|
||||
"name": "event-bridge-for-activitypub",
|
||||
"name": "activitypub-event-bridge",
|
||||
"version": "0.1.0",
|
||||
"author": {
|
||||
"name": "André Menrath",
|
||||
|
@ -15,7 +15,7 @@
|
|||
},
|
||||
"license": "AGPL-3.0",
|
||||
"bugs": {
|
||||
"url": "https://code.event-federation.eu/Event-Federation/wordpress-event-bridge-for-activitypub/issues"
|
||||
"url": "https://code.event-federation.eu/Event-Federation/wordpress-activitypub-event-bridge/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@wordpress/env": "^10.10.0",
|
||||
|
|
|
@ -108,7 +108,8 @@
|
|||
<rule ref="WordPress.WP.I18n">
|
||||
<properties>
|
||||
<property name="text_domain" type="array">
|
||||
<element value="event-bridge-for-activitypub"/>
|
||||
<element value="activitypub-event-bridge"/>
|
||||
<element value="activitypub"/>
|
||||
</property>
|
||||
</properties>
|
||||
</rule>
|
||||
|
@ -116,7 +117,7 @@
|
|||
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
|
||||
<properties>
|
||||
<property name="prefixes" type="array">
|
||||
<element value="EVENT_BRIDGE_FOR_ACTIVITYPUB"/>
|
||||
<element value="ACTIVITYPUB_EVENT_BRIDGE"/>
|
||||
</property>
|
||||
</properties>
|
||||
</rule>
|
||||
|
|
21
readme.txt
21
readme.txt
|
@ -1,9 +1,9 @@
|
|||
=== Event Bridge for ActivityPub ===
|
||||
=== ActivityPub Event Bridge ===
|
||||
Contributors: andremenrath
|
||||
Tags: events, fediverse, activitypub, calendar
|
||||
Requires at least: 6.5
|
||||
Tested up to: 6.7
|
||||
Stable tag: 0.3.2
|
||||
Tested up to: 6.6
|
||||
Stable tag: 0.2.0
|
||||
Requires PHP: 7.4
|
||||
License: AGPL-3.0-or-later
|
||||
License URI: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
|
@ -12,7 +12,7 @@ Integrating popular event plugins with the ActivityPub plugin.
|
|||
== Description ==
|
||||
|
||||
Make your events more discoverable, expand your reach effortlessly while being independent of other (commercial) platforms, and be a part of the growing decentralized web (the Fediverse).
|
||||
With the Event Bridge for ActivityPub Plugin for WordPress, your events can be automatically followed, aggregated and displayed across decentralized platforms like [Mastodon](https://joinmastodon.org) or [Gancio](https://gancio.org), without any extra work.
|
||||
With the ActivityPub Event Bridge Plugin for WordPress, your events can be automatically followed, aggregated and displayed across decentralized platforms like [Mastodon](https://joinmastodon.org) or [Gancio](https://gancio.org), without any extra work.
|
||||
Forget the hassle of managing multiple social media accounts just to keep your audience informed.
|
||||
|
||||
This plugin is not an event managing plugin but an add-on to popular event plugins. It extends their functionality to fully support the [ActivityPub plugin](https://wordpress.org/plugins/activitypub/).
|
||||
|
@ -21,7 +21,7 @@ You retain full ownership of your content. By integrating into your existing set
|
|||
|
||||
= How It Works =
|
||||
|
||||
With the Event Bridge for ActivityPub WordPress plugin, sharing your events is effortless and automatic!
|
||||
With the ActivityPub Event Bridge WordPress plugin, sharing your events is effortless and automatic!
|
||||
Once you create an event on your WordPress site, it is seamlessly shared across the decentralized web using the ActivityPub protocol.
|
||||
|
||||
![](./.wordpress-org/event-activitypub-publishing.gif)
|
||||
|
@ -38,7 +38,7 @@ The Event Federation plugin ensures that users from those platforms are provided
|
|||
|
||||
**ActivityPub-Enabled Event Sharing:** Your WordPress events are now compatible with the Fediverse, using the ActivityStreams format. This means your events can be easily discovered and followed by users on platforms like Mastodon and other ActivityPub-compatible services.
|
||||
|
||||
**Automatic Event Summaries:** When your event is shared on the Fediverse, platforms like Mastodon that don't fully support events will display a brief HTML summary of key details — such as the event's title, start time, and location. This ensures that even if someone can't view the full event on their platform, they still get the important info at a glance, with a link to your WordPress event page. Advanced users can create custom summaries via a set of shortcodes.
|
||||
**Automatic Event Summaries:** When your event is shared on the Fediverse, platforms like Mastodon that don't fully support events will display a brief HTML summary of key details — such as the event's title, start time, and location. This ensures that even if someone can't view the full event on their platform, they still get the important info at a glance, with a link to your WordPress event page.
|
||||
|
||||
**Improved Event Discoverability:** Your custom event categories are mapped to a set of default categories used in the Fediverse, helping your events reach a wider audience. This improves the chances that users searching for similar events on other platforms will find yours.
|
||||
|
||||
|
@ -57,8 +57,6 @@ This plugin depends on the [ActivityPub plugin](https://wordpress.org/plugins/ac
|
|||
* [Eventin](https://de.wordpress.org/plugins/wp-event-solution/)
|
||||
* [Modern Events Calendar Lite](https://webnus.net/modern-events-calendar/)
|
||||
* [GatherPress](https://gatherpress.org/)
|
||||
* [EventPrime – Events Calendar, Bookings and Tickets](https://wordpress.org/plugins/eventprime-event-calendar-management/)
|
||||
* [Event Organiser](https://wordpress.org/plugins/event-organiser/)
|
||||
|
||||
== Configuration ==
|
||||
|
||||
|
@ -69,7 +67,6 @@ 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? =
|
||||
|
||||
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? =
|
||||
|
||||
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.
|
||||
|
@ -88,14 +85,14 @@ No, the Event Federation Plugin depends on the [ActivityPub plugin](https://word
|
|||
|
||||
= My event plugin is not supported, what can I do? =
|
||||
|
||||
If you know about coding have a look at the documentation of how to add your plugin or open an [issue](https://code.event-federation.eu/Event-Federation/wordpress-event-bridge-for-activitypub/issues), if we can spare some free hours we might add it.
|
||||
If you know about coding have a look at the documentation of how to add your plugin or open an [issue](https://code.event-federation.eu/Event-Federation/wordpress-activitypub-event-bridge/issues), if we can spare some free hours we might add it.
|
||||
|
||||
= What if I experience problems? =
|
||||
|
||||
We're always interested in your feedback. Feel free to reach out to us via [E-Mail](https://event-federation.eu/contact/) or create an [issue](https://code.event-federation.eu/Event-Federation/wordpress-event-bridge-for-activitypub/issues).
|
||||
We're always interested in your feedback. Feel free to reach out to us via [E-Mail](https://event-federation.eu/contact/) or create an [issue](https://code.event-federation.eu/Event-Federation/wordpress-activitypub-event-bridge/issues).
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= [0.3.2] 2024-12-12 =
|
||||
= [0.2.0] 2024-10-29 =
|
||||
|
||||
* Initial release on https://wordpress.org/
|
||||
|
|
|
@ -2,12 +2,9 @@
|
|||
/**
|
||||
* Template for the header and navigation of the admin pages.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
/* @var array $args Template arguments. */
|
||||
$args = wp_parse_args(
|
||||
$args,
|
||||
|
@ -18,18 +15,18 @@ $args = wp_parse_args(
|
|||
);
|
||||
?>
|
||||
|
||||
<div class="event-bridge-for-activitypub-settings-header">
|
||||
<div class="event-bridge-for-activitypub-settings-title-section">
|
||||
<h1><?php \esc_html_e( 'Event Bridge for ActivityPub', 'event-bridge-for-activitypub' ); ?></h1>
|
||||
<div class="activitypub-event-bridge-settings-header">
|
||||
<div class="activitypub-event-bridge-settings-title-section">
|
||||
<h1><?php \esc_html_e( 'ActivityPub Event Bridge', 'activitypub-event-bridge' ); ?></h1>
|
||||
</div>
|
||||
|
||||
<nav class="event-bridge-for-activitypub-settings-tabs-wrapper" aria-label="<?php \esc_attr_e( 'Secondary menu', 'event-bridge-for-activitypub' ); ?>">
|
||||
<a href="<?php echo \esc_url( admin_url( 'options-general.php?page=event-bridge-for-activitypub' ) ); ?>" class="event-bridge-for-activitypub-settings-tab <?php echo \esc_attr( $args['welcome'] ); ?>">
|
||||
<?php \esc_html_e( 'Welcome', 'event-bridge-for-activitypub' ); ?>
|
||||
<nav class="activitypub-event-bridge-settings-tabs-wrapper" aria-label="<?php \esc_attr_e( 'Secondary menu', 'activitypub-event-bridge' ); ?>">
|
||||
<a href="<?php echo \esc_url( admin_url( 'options-general.php?page=activitypub-event-bridge' ) ); ?>" class="activitypub-event-bridge-settings-tab <?php echo \esc_attr( $args['welcome'] ); ?>">
|
||||
<?php \esc_html_e( 'Welcome', 'activitypub-event-bridge' ); ?>
|
||||
</a>
|
||||
|
||||
<a href="<?php echo \esc_url( admin_url( 'options-general.php?page=event-bridge-for-activitypub&tab=settings' ) ); ?>" class="event-bridge-for-activitypub-settings-tab <?php echo \esc_attr( $args['settings'] ); ?>">
|
||||
<?php \esc_html_e( 'Settings', 'event-bridge-for-activitypub' ); ?>
|
||||
<a href="<?php echo \esc_url( admin_url( 'options-general.php?page=activitypub-event-bridge&tab=settings' ) ); ?>" class="activitypub-event-bridge-settings-tab <?php echo \esc_attr( $args['settings'] ); ?>">
|
||||
<?php \esc_html_e( 'Settings', 'activitypub-event-bridge' ); ?>
|
||||
</a>
|
||||
</nav>
|
||||
</div>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
/**
|
||||
* Template for Event Bridge for ActivityPub settings page.
|
||||
* Template for ActivityPub Event Bridge settings page.
|
||||
*
|
||||
* This template is used to display and manage settings for the Event Bridge for ActivityPub plugin.
|
||||
* This template is used to display and manage settings for the ActivityPub Event Bridge plugin.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param array $args An array of arguments for the settings page.
|
||||
|
@ -33,72 +33,26 @@ if ( ! current_user_can( 'manage_options' ) ) {
|
|||
|
||||
$event_terms = $args['event_terms'];
|
||||
|
||||
require_once EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_DIR . '/includes/event-categories.php';
|
||||
require_once ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_DIR . '/includes/event-categories.php';
|
||||
|
||||
$selected_default_event_category = \get_option( 'event_bridge_for_activitypub_default_event_category', 'MEETING' );
|
||||
$current_category_mapping = \get_option( 'event_bridge_for_activitypub_event_category_mappings', array() );
|
||||
$selected_default_event_category = \get_option( 'activitypub_event_bridge_default_event_category', 'MEETING' );
|
||||
$current_category_mapping = \get_option( 'activitypub_event_bridge_event_category_mappings', array() );
|
||||
?>
|
||||
|
||||
<div class="event-bridge-for-activitypub-settings event-bridge-for-activitypub-settings-page hide-if-no-js">
|
||||
<div class="activitypub-event-bridge-settings activitypub-event-bridge-settings-page hide-if-no-js">
|
||||
<form method="post" action="options.php">
|
||||
<?php \settings_fields( 'event-bridge-for-activitypub' ); ?>
|
||||
<div class="box">
|
||||
<h2> <?php esc_html_e( 'Event Summary Text', 'event-bridge-for-activitypub' ); ?> </h2>
|
||||
<p><?php esc_html_e( 'Many Fediverse applications (e.g., Mastodon) don\'t fully support events, instead they will show a summary text along with the events title and the URL to your Website.', 'event-bridge-for-activitypub' ); ?></p>
|
||||
<p>
|
||||
<label for="event_bridge_for_activitypub_summary_type_preset">
|
||||
<input type="radio" name="event_bridge_for_activitypub_summary_type" id="event_bridge_for_activitypub_summary_type_preset" value="preset" <?php echo \checked( 'preset', \get_option( 'event_bridge_for_activitypub_summary_type', EVENT_BRIDGE_FOR_ACTIVITYPUB_DEFAULT_SUMMARY_TYPE ) ); ?> />
|
||||
<?php \esc_html_e( 'Automatic (default)', 'event-bridge-for-activitypub' ); ?>
|
||||
-
|
||||
<span class="description">
|
||||
<?php \esc_html_e( 'Let the plugin compose a summary for you. ', 'event-bridge-for-activitypub' ); ?>
|
||||
</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label for="event_bridge_for_activitypub_summary_type_custom">
|
||||
<input type="radio" name="event_bridge_for_activitypub_summary_type" id="event_bridge_for_activitypub_summary_type_custom" value="custom" <?php echo \checked( 'custom', \get_option( 'event_bridge_for_activitypub_summary_type', EVENT_BRIDGE_FOR_ACTIVITYPUB_DEFAULT_SUMMARY_TYPE ) ); ?> />
|
||||
<?php \esc_html_e( 'Custom', 'event-bridge-for-activitypub' ); ?>
|
||||
-
|
||||
<span class="description">
|
||||
<?php \esc_html_e( 'For advanced users: compose your custom summary via shortcodes.', 'event-bridge-for-activitypub' ); ?>
|
||||
</span>
|
||||
</label>
|
||||
</p>
|
||||
<div id="event_bridge_for_activitypub_summary_type_custom-details">
|
||||
<textarea name="event_bridge_for_activitypub_custom_summary" id="event_bridge_for_activitypub_custom_summary" rows="10" cols="50" class="large-text" placeholder="<?php echo wp_kses( EVENT_BRIDGE_FOR_ACTIVITYPUB_CUSTOM_SUMMARY, 'post' ); ?>"><?php echo esc_textarea( wp_kses( \get_option( 'event_bridge_for_activitypub_custom_summary', EVENT_BRIDGE_FOR_ACTIVITYPUB_CUSTOM_SUMMARY ), 'post' ) ); ?></textarea>
|
||||
<details>
|
||||
<summary><?php esc_html_e( 'See a list Template Tags available for the summary.', 'event-bridge-for-activitypub' ); ?></summary>
|
||||
<div class="description">
|
||||
<dl>
|
||||
<dt><code>[ap_start_time]</code><dt>
|
||||
<dd><?php \esc_html_e( 'The events title.', 'event-bridge-for-activitypub' ); ?></dd>
|
||||
<dt><code>[ap_end_time]</code><dt>
|
||||
<dd><?php \esc_html_e( 'The events content.', 'event-bridge-for-activitypub' ); ?></dd>
|
||||
<dt><code>[ap_location]</code><dt>
|
||||
<dd><?php \esc_html_e( 'The events location.', 'event-bridge-for-activitypub' ); ?></dd>
|
||||
<dt><code>[ap_hashtags]</code><dt>
|
||||
<dd><?php \esc_html_e( 'The events tags as hashtags.', 'event-bridge-for-activitypub' ); ?></dd>
|
||||
<dt><code>[ap_excerpt]</code><dt>
|
||||
<dd><?php \esc_html_e( 'The events excerpt (may be truncated).', 'event-bridge-for-activitypub' ); ?></dd>
|
||||
<dt><code>[ap_content]</code><dt>
|
||||
<dd><?php \esc_html_e( 'The events description.', 'event-bridge-for-activitypub' ); ?></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
<?php \settings_fields( 'activitypub-event-bridge' ); ?>
|
||||
|
||||
<div class="box">
|
||||
<h2> <?php esc_html_e( 'ActivityPub Event Category', 'event-bridge-for-activitypub' ); ?> </h2>
|
||||
<p> <?php esc_html_e( 'To help visitors find events more easily, the community created a set of basic event categories. Please select the category that best matches the majority of the events you organize.', 'event-bridge-for-activitypub' ); ?> </p>
|
||||
<h2> <?php esc_html_e( 'ActivityPub Event Category', 'activitypub-event-bridge' ); ?> </h2>
|
||||
<p> <?php esc_html_e( 'To help visitors find events more easily, the community created a set of basic event categories. Please select the category that best matches the majority of the events you organize.', 'activitypub-event-bridge' ); ?> </p>
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row"> <?php esc_html_e( 'Default Category', 'event-bridge-for-activitypub' ); ?> </th>
|
||||
<th scope="row"> <?php esc_html_e( 'Default Category', 'activitypub-event-bridge' ); ?> </th>
|
||||
<td>
|
||||
<select id="event_bridge_for_activitypub_default_event_category" name="event_bridge_for_activitypub_default_event_category">';
|
||||
<select id="activitypub_event_bridge_default_event_category" name="activitypub_event_bridge_default_event_category">';
|
||||
<?php
|
||||
foreach ( EVENT_BRIDGE_FOR_ACTIVITYPUB_EVENT_CATEGORIES as $value => $label ) {
|
||||
foreach ( ACTIVITYPUB_EVENT_BRIDGE_EVENT_CATEGORIES as $value => $label ) {
|
||||
echo '<option value="' . esc_attr( $value ) . '" ' . selected( $selected_default_event_category, $value, false ) . '>' . esc_html( $label ) . '</option>';
|
||||
}
|
||||
?>
|
||||
|
@ -108,14 +62,14 @@ $current_category_mapping = \get_option( 'event_bridge_for_activitypub_ev
|
|||
</table>
|
||||
|
||||
<?php if ( ! empty( $event_terms ) ) : ?>
|
||||
<h3> <?php esc_html_e( 'Advanced Event Category Settings', 'event-bridge-for-activitypub' ); ?> </h3>
|
||||
<p> <?php esc_html_e( 'Take more control by adjusting how your event categories are mapped to the basic category set used in ActivityPub. This option lets you override the default selection above, ensuring more accurate categorization and better visibility for your events.', 'event-bridge-for-activitypub' ); ?> </p>
|
||||
<h3> <?php esc_html_e( 'Advanced Event Category Settings', 'activitypub-event-bridge' ); ?> </h3>
|
||||
<p> <?php esc_html_e( 'Take more control by adjusting how your event categories are mapped to the basic category set used in ActivityPub. This option lets you override the default selection above, ensuring more accurate categorization and better visibility for your events.', 'activitypub-event-bridge' ); ?> </p>
|
||||
<table class="form-table">
|
||||
<?php foreach ( $event_terms as $event_term ) { ?>
|
||||
<tr>
|
||||
<th scope="row"> <?php echo esc_html( $event_term->name ); ?> </th>
|
||||
<td>
|
||||
<select name="event_bridge_for_activitypub_event_category_mappings[<?php echo esc_attr( $event_term->slug ); ?>]">
|
||||
<select name="activitypub_event_bridge_event_category_mappings[<?php echo esc_attr( $event_term->slug ); ?>]">
|
||||
<?php
|
||||
$current_mapping_is_set = false;
|
||||
if ( ! empty( $current_category_mapping ) ) {
|
||||
|
@ -127,13 +81,13 @@ $current_category_mapping = \get_option( 'event_bridge_for_activitypub_ev
|
|||
$mapping = 'DEFAULT';
|
||||
}
|
||||
if ( 'DEFAULT' === $mapping ) {
|
||||
echo '<option value="' . esc_attr( $mapping ) . '"> -- ' . esc_html( EVENT_BRIDGE_FOR_ACTIVITYPUB_EVENT_CATEGORIES[ $mapping ] ) . ' -- </option>';
|
||||
echo '<option value="' . esc_attr( $mapping ) . '"> -- ' . esc_html( ACTIVITYPUB_EVENT_BRIDGE_EVENT_CATEGORIES[ $mapping ] ) . ' -- </option>';
|
||||
} else {
|
||||
echo '<option value="' . esc_attr( $mapping ) . '">' . esc_html( EVENT_BRIDGE_FOR_ACTIVITYPUB_EVENT_CATEGORIES[ $mapping ] ) . '</option>';
|
||||
echo '<option value="' . esc_attr( $mapping ) . '">' . esc_html( ACTIVITYPUB_EVENT_BRIDGE_EVENT_CATEGORIES[ $mapping ] ) . '</option>';
|
||||
}
|
||||
echo '<option value="DEFAULT" ' . selected( $selected_default_event_category, 'DEFAULT', false ) . '> -- ' . esc_html__( 'Default', 'event-bridge-for-activitypub' ) . ' -- </option>';
|
||||
echo '<option value="DEFAULT" ' . selected( $selected_default_event_category, 'DEFAULT', false ) . '> -- ' . esc_html__( 'Default', 'activitypub-event-bridge' ) . ' -- </option>';
|
||||
foreach ( Event::DEFAULT_EVENT_CATEGORIES as $event_category ) {
|
||||
echo '<option value="' . esc_attr( $event_category ) . '" ' . selected( $mappings[ $event_term->slug ] ?? '', $event_category, false ) . '>' . esc_html( EVENT_BRIDGE_FOR_ACTIVITYPUB_EVENT_CATEGORIES[ $event_category ] ) . '</option>';
|
||||
echo '<option value="' . esc_attr( $event_category ) . '" ' . selected( $mappings[ $event_term->slug ] ?? '', $event_category, false ) . '>' . esc_html( ACTIVITYPUB_EVENT_BRIDGE_EVENT_CATEGORIES[ $event_category ] ) . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
@ -145,7 +99,7 @@ $current_category_mapping = \get_option( 'event_bridge_for_activitypub_ev
|
|||
</div>
|
||||
<!-- This disables the setup wizard. -->
|
||||
<div class="hidden">
|
||||
<input type="checkbox" id="event_bridge_for_activitypub_initially_activated" name="event_bridge_for_activitypub_initially_activated"/>
|
||||
<input type="checkbox" id="activitypub_event_bridge_initially_activated" name="activitypub_event_bridge_initially_activated"/>
|
||||
</div>
|
||||
<?php \submit_button(); ?>
|
||||
</form>
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<?php
|
||||
/**
|
||||
* Status page for the Event Bridge for ActivityPub.
|
||||
* Status page for the ActivityPub Event Bridge.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Event_Bridge_For_ActivityPub\Setup;
|
||||
use Event_Bridge_For_ActivityPub\Admin\Settings_Page;
|
||||
use Event_Bridge_For_ActivityPub\Admin\Health_Check;
|
||||
use ActivityPub_Event_Bridge\Setup;
|
||||
use ActivityPub_Event_Bridge\Admin\Settings_Page;
|
||||
use ActivityPub_Event_Bridge\Admin\Health_Check;
|
||||
|
||||
\load_template(
|
||||
__DIR__ . '/admin-header.php',
|
||||
|
@ -20,9 +20,9 @@ use Event_Bridge_For_ActivityPub\Admin\Health_Check;
|
|||
)
|
||||
);
|
||||
|
||||
$active_event_plugins = Setup::get_instance()->get_active_event_plugins();
|
||||
$event_bridge_for_activitypub_status_ok = true;
|
||||
$example_event_post = Health_Check::get_most_recent_event_posts();
|
||||
$active_event_plugins = Setup::get_instance()->get_active_event_plugins();
|
||||
$activitypub_event_bridge_status_ok = true;
|
||||
$example_event_post = Health_Check::get_most_recent_event_posts();
|
||||
|
||||
if ( empty( $example_event_post ) ) {
|
||||
$example_event_post = 'https://yoursite.com/events/event-name';
|
||||
|
@ -37,13 +37,13 @@ WP_Filesystem();
|
|||
|
||||
?>
|
||||
|
||||
<div class="event-bridge-for-activitypub-settings event-bridge-for-activitypub-settings-page hide-if-no-js">
|
||||
<div class="activitypub-event-bridge-settings activitypub-event-bridge-settings-page hide-if-no-js">
|
||||
<div class="box">
|
||||
<h2><?php \esc_html_e( 'Status', 'event-bridge-for-activitypub' ); ?></h2>
|
||||
<p><?php \esc_html_e( 'The Event Bridge for ActivityPub detected the following (activated) event plugins:', 'event-bridge-for-activitypub' ); ?></p>
|
||||
<h2><?php \esc_html_e( 'Status', 'activitypub-event-bridge' ); ?></h2>
|
||||
<p><?php \esc_html_e( 'The ActivityPub Event Bridge detected the following (activated) event plugins:', 'activitypub-event-bridge' ); ?></p>
|
||||
<?php foreach ( $active_event_plugins as $active_event_plugin ) { ?>
|
||||
<h3><?php echo esc_html( $active_event_plugin->get_plugin_name() ); ?>:</h3>
|
||||
<ul class="event-bridge-for-activitypub-list">
|
||||
<ul class="activitypub-event-bridge-list">
|
||||
<li>
|
||||
<?php
|
||||
if ( in_array( $active_event_plugin::get_post_type(), get_option( 'activitypub_support_post_types', array() ), true ) ) {
|
||||
|
@ -53,21 +53,21 @@ WP_Filesystem();
|
|||
_x(
|
||||
'The ActivityPub support for the event post type of the plugin <i>%2$s</i> is enabled in the <a href="%3$s">%1$s settings</a>.',
|
||||
'admin notice',
|
||||
'event-bridge-for-activitypub'
|
||||
'activitypub-event-bridge'
|
||||
),
|
||||
esc_html( get_plugin_data( ACTIVITYPUB_PLUGIN_FILE )['Name'] ),
|
||||
esc_html( $active_event_plugin->get_plugin_name() ),
|
||||
admin_url( 'options-general.php?page=activitypub&tab=settings' )
|
||||
);
|
||||
} else {
|
||||
$event_bridge_for_activitypub_status_ok = false;
|
||||
$activitypub_event_bridge_status_ok = false;
|
||||
echo '❌ ';
|
||||
$status_message_post_type_enabled = sprintf(
|
||||
/* translators: 1: the name of the event plugin a admin notice is shown. 2: The name of the ActivityPub plugin. */
|
||||
_x(
|
||||
'The post type for events of the plugin <i>%2$s</i> is <b>not enabled</b> in the <a href="%3$s">%1$s settings</a>.',
|
||||
'admin notice',
|
||||
'event-bridge-for-activitypub'
|
||||
'activitypub-event-bridge'
|
||||
),
|
||||
esc_html( get_plugin_data( ACTIVITYPUB_PLUGIN_FILE )['Name'] ),
|
||||
esc_html( $active_event_plugin->get_plugin_name() ),
|
||||
|
@ -89,11 +89,11 @@ WP_Filesystem();
|
|||
<?php
|
||||
if ( Health_Check::test_if_event_transformer_is_used( $active_event_plugin ) ) {
|
||||
echo '✅ ';
|
||||
esc_html_e( 'The Event Bridge for ActivityPub successfully registered to the ActivityPub plugin.', 'event-bridge-for-activitypub' );
|
||||
esc_html_e( 'The ActivityPub Event Bridge successfully registered to the ActivityPub plugin.', 'activitypub-event-bridge' );
|
||||
} else {
|
||||
$event_bridge_for_activitypub_status_ok = false;
|
||||
$activitypub_event_bridge_status_ok = false;
|
||||
echo '❌ ';
|
||||
esc_html_e( 'The Event Bridge for ActivityPub could not register to the ActivityPub plugin.', 'event-bridge-for-activitypub' );
|
||||
esc_html_e( 'The ActivityPub Event Bridge could not register to the ActivityPub plugin.', 'activitypub-event-bridge' );
|
||||
}
|
||||
?>
|
||||
</li>
|
||||
|
@ -101,95 +101,95 @@ WP_Filesystem();
|
|||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<?php if ( get_option( 'event_bridge_for_activitypub_initially_activated', true ) ) : ?>
|
||||
<?php if ( get_option( 'activitypub_event_bridge_initially_activated', true ) ) : ?>
|
||||
<a href="<?php echo esc_url( admin_url( 'options-general.php?page=' . Settings_Page::SETTINGS_SLUG ) . '&tab=settings' ); ?>" role="button">
|
||||
<button class="button button-primary">
|
||||
<strong>→</strong> <?php \esc_html_e( 'Continue your setup', 'event-bridge-for-activitypub' ); ?>
|
||||
<strong>→</strong> <?php \esc_html_e( 'Continue your setup', 'activitypub-event-bridge' ); ?>
|
||||
</button>
|
||||
</a>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<div class="box">
|
||||
<h2><?php \esc_html_e( 'How to Check if It\'s Working', 'event-bridge-for-activitypub' ); ?></h2>
|
||||
<h2><?php \esc_html_e( 'How to Check if It\'s Working', 'activitypub-event-bridge' ); ?></h2>
|
||||
<?php
|
||||
if ( ! $event_bridge_for_activitypub_status_ok ) {
|
||||
echo '<div class="notice-warning"><p>' . \esc_html__( 'Please fix the status issues above first.', 'event-bridge-for-activitypub' ) . '</p></div>';
|
||||
if ( ! $activitypub_event_bridge_status_ok ) {
|
||||
echo '<div class="notice-warning"><p>' . \esc_html__( 'Please fix the status issues above first.', 'activitypub-event-bridge' ) . '</p></div>';
|
||||
}
|
||||
?>
|
||||
<p><?php esc_html_e( 'Most of the magic happens behind the scenes, but here is how you can verify that your events are ready to be discovered:', 'event-bridge-for-activitypub' ); ?></p>
|
||||
<div class="event-bridge-for-activitypub-settings-accordion">
|
||||
<h4 class="event-bridge-for-activitypub-settings-accordion-heading">
|
||||
<button aria-expanded="false" class="event-bridge-for-activitypub-settings-accordion-trigger" aria-controls="event-bridge-for-activitypub-help-accordion-mastodon" type="button">
|
||||
<p><?php esc_html_e( 'Most of the magic happens behind the scenes, but here is how you can verify that your events are ready to be discovered:', 'activitypub-event-bridge' ); ?></p>
|
||||
<div class="activitypub-event-bridge-settings-accordion">
|
||||
<h4 class="activitypub-event-bridge-settings-accordion-heading">
|
||||
<button aria-expanded="false" class="activitypub-event-bridge-settings-accordion-trigger" aria-controls="activitypub-event-bridge-help-accordion-mastodon" type="button">
|
||||
<span class="title">
|
||||
1.
|
||||
<img src="<?php echo esc_url( plugins_url( '/assets/img/mastodon.svg', EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_FILE ) ); ?>" alt="Mastodon Icon" class="event-bridge-for-activitypub-settings-inline-icon">
|
||||
<?php \esc_html_e( 'Using Your Mastodon Account', 'event-bridge-for-activitypub' ); ?>
|
||||
<img src="<?php echo esc_url( plugins_url( '/assets/img/mastodon.svg', ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_FILE ) ); ?>" alt="Mastodon Icon" class="activitypub-event-bridge-settings-inline-icon">
|
||||
<?php \esc_html_e( 'Using Your Mastodon Account', 'activitypub-event-bridge' ); ?>
|
||||
</span>
|
||||
<span class="icon"></span>
|
||||
</button>
|
||||
</h4>
|
||||
<div id="event-bridge-for-activitypub-help-accordion-mastodon" class="event-bridge-for-activitypub-settings-accordion-panel" hidden="hidden">
|
||||
<ol class="event-bridge-for-activitypub-settings-numbered-list">
|
||||
<li><?php \esc_html_e( 'Log into your Mastodon account.', 'event-bridge-for-activitypub' ); ?></li>
|
||||
<div id="activitypub-event-bridge-help-accordion-mastodon" class="activitypub-event-bridge-settings-accordion-panel" hidden="hidden">
|
||||
<ol class="activitypub-event-bridge-settings-numbered-list">
|
||||
<li><?php \esc_html_e( 'Log into your Mastodon account.', 'activitypub-event-bridge' ); ?></li>
|
||||
<li>
|
||||
<?php \esc_html_e( 'In the search bar, type or copy the full URL of one of your event pages. For example:', 'event-bridge-for-activitypub' ); ?>
|
||||
<code class="event-bridge-for-activitypub-settings-example-url"><?php echo \esc_url( $example_event_post ); ?></code>
|
||||
<?php \esc_html_e( 'In the search bar, type or copy the full URL of one of your event pages. For example:', 'activitypub-event-bridge' ); ?>
|
||||
<code class="activitypub-event-bridge-settings-example-url"><?php echo \esc_url( $example_event_post ); ?></code>
|
||||
</li>
|
||||
<li><?php \esc_html_e( 'If everything is set up correctly, you\'ll see a post representing your event. It should include the event\'s image, title, and a brief description.', 'event-bridge-for-activitypub' ); ?></li>
|
||||
<li><?php \esc_html_e( 'If everything is set up correctly, you\'ll see a post representing your event. It should include the event\'s image, title, and a brief description.', 'activitypub-event-bridge' ); ?></li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="event-bridge-for-activitypub-settings-accordion-heading">
|
||||
<button aria-expanded="false" class="event-bridge-for-activitypub-settings-accordion-trigger" aria-controls="event-bridge-for-activitypub-help-accordion-mobilizon" type="button">
|
||||
<h4 class="activitypub-event-bridge-settings-accordion-heading">
|
||||
<button aria-expanded="false" class="activitypub-event-bridge-settings-accordion-trigger" aria-controls="activitypub-event-bridge-help-accordion-mobilizon" type="button">
|
||||
<span class="title">
|
||||
2.
|
||||
<img src="<?php echo esc_url( plugins_url( '/assets/img/mobilizon.svg', EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_FILE ) ); ?>" alt="Mastodon Icon" class="event-bridge-for-activitypub-settings-inline-icon">
|
||||
<?php \esc_html_e( 'Using Your Mobilizon Account', 'event-bridge-for-activitypub' ); ?>
|
||||
<img src="<?php echo esc_url( plugins_url( '/assets/img/mobilizon.svg', ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_FILE ) ); ?>" alt="Mastodon Icon" class="activitypub-event-bridge-settings-inline-icon">
|
||||
<?php \esc_html_e( 'Using Your Mobilizon Account', 'activitypub-event-bridge' ); ?>
|
||||
</span>
|
||||
<span class="icon"></span>
|
||||
</button>
|
||||
</h4>
|
||||
<div id="event-bridge-for-activitypub-help-accordion-mobilizon" class="event-bridge-for-activitypub-settings-accordion-panel" hidden="hidden">
|
||||
<ol class="event-bridge-for-activitypub-settings-numbered-list">
|
||||
<li><?php \esc_html_e( 'Log into your Mobilizon account.', 'event-bridge-for-activitypub' ); ?></li>
|
||||
<div id="activitypub-event-bridge-help-accordion-mobilizon" class="activitypub-event-bridge-settings-accordion-panel" hidden="hidden">
|
||||
<ol class="activitypub-event-bridge-settings-numbered-list">
|
||||
<li><?php \esc_html_e( 'Log into your Mobilizon account.', 'activitypub-event-bridge' ); ?></li>
|
||||
<li>
|
||||
<?php \esc_html_e( 'In the search bar, type or copy the full URL of one of your event pages. For example:', 'event-bridge-for-activitypub' ); ?>
|
||||
<code class="event-bridge-for-activitypub-settings-example-url"><?php echo \esc_url( $example_event_post ); ?></code>
|
||||
<?php \esc_html_e( 'In the search bar, type or copy the full URL of one of your event pages. For example:', 'activitypub-event-bridge' ); ?>
|
||||
<code class="activitypub-event-bridge-settings-example-url"><?php echo \esc_url( $example_event_post ); ?></code>
|
||||
</li>
|
||||
<li><?php \esc_html_e( 'If everything is set up correctly, you\'ll see a full representation of your WordPress event. This will include the event\'s banner image, title, complete description, start and end times, categories, tags, and whether it\'s an online event.', 'event-bridge-for-activitypub' ); ?></li>
|
||||
<li><?php \esc_html_e( 'If everything is set up correctly, you\'ll see a full representation of your WordPress event. This will include the event\'s banner image, title, complete description, start and end times, categories, tags, and whether it\'s an online event.', 'activitypub-event-bridge' ); ?></li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="event-bridge-for-activitypub-settings-accordion-heading">
|
||||
<button aria-expanded="false" class="event-bridge-for-activitypub-settings-accordion-trigger" aria-controls="event-bridge-for-activitypub-help-accordion-fediverse" type="button">
|
||||
<h4 class="activitypub-event-bridge-settings-accordion-heading">
|
||||
<button aria-expanded="false" class="activitypub-event-bridge-settings-accordion-trigger" aria-controls="activitypub-event-bridge-help-accordion-fediverse" type="button">
|
||||
<span class="title">
|
||||
3.
|
||||
<img src="<?php echo esc_url( plugins_url( '/assets/img/fediverse.svg', EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_FILE ) ); ?>" alt="Mastodon Icon" class="event-bridge-for-activitypub-settings-inline-icon">
|
||||
<?php \esc_html_e( 'Using Any Other Fediverse Application', 'event-bridge-for-activitypub' ); ?>
|
||||
<img src="<?php echo esc_url( plugins_url( '/assets/img/fediverse.svg', ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_FILE ) ); ?>" alt="Mastodon Icon" class="activitypub-event-bridge-settings-inline-icon">
|
||||
<?php \esc_html_e( 'Using Any Other Fediverse Application', 'activitypub-event-bridge' ); ?>
|
||||
</span>
|
||||
<span class="icon"></span>
|
||||
</button>
|
||||
</h4>
|
||||
<div id="event-bridge-for-activitypub-help-accordion-fediverse" class="event-bridge-for-activitypub-settings-accordion-panel" hidden="hidden">
|
||||
<p><?php \esc_html_e( 'Of course any other application in the Fediverse should work as well. Most applications support importing external content via searching for the contents full URL.', 'event-bridge-for-activitypub' ); ?></p>
|
||||
<ol class="event-bridge-for-activitypub-settings-numbered-list">
|
||||
<li><?php \esc_html_e( 'Log into your account on any Fediverse app.', 'event-bridge-for-activitypub' ); ?></li>
|
||||
<div id="activitypub-event-bridge-help-accordion-fediverse" class="activitypub-event-bridge-settings-accordion-panel" hidden="hidden">
|
||||
<p><?php \esc_html_e( 'Of course any other application in the Fediverse should work as well. Most applications support importing external content via searching for the contents full URL.', 'activitypub-event-bridge' ); ?></p>
|
||||
<ol class="activitypub-event-bridge-settings-numbered-list">
|
||||
<li><?php \esc_html_e( 'Log into your account on any Fediverse app.', 'activitypub-event-bridge' ); ?></li>
|
||||
<li>
|
||||
<?php \esc_html_e( 'In the search bar, type or copy the full URL of one of your event pages. For example:', 'event-bridge-for-activitypub' ); ?>
|
||||
<code class="event-bridge-for-activitypub-settings-example-url"><?php echo \esc_url( $example_event_post ); ?></code>
|
||||
<?php \esc_html_e( 'In the search bar, type or copy the full URL of one of your event pages. For example:', 'activitypub-event-bridge' ); ?>
|
||||
<code class="activitypub-event-bridge-settings-example-url"><?php echo \esc_url( $example_event_post ); ?></code>
|
||||
</li>
|
||||
<li><?php \esc_html_e( 'If the application which your are using natively supports ActivityPub events, you should see a representation of your WordPress event. If your application is supports receiving ActivityPub events you will get a post which summarizes the event. Keep in mind that some apps may not support events at all.', 'event-bridge-for-activitypub' ); ?></li>
|
||||
<li><?php \esc_html_e( 'If the application which your are using natively supports ActivityPub events, you should see a representation of your WordPress event. If your application is supports receiving ActivityPub events you will get a post which summarizes the event. Keep in mind that some apps may not support events at all.', 'activitypub-event-bridge' ); ?></li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="event-bridge-for-activitypub-settings-accordion-heading">
|
||||
<button aria-expanded="false" class="event-bridge-for-activitypub-settings-accordion-trigger" aria-controls="event-bridge-for-activitypub-help-accordion-advanced" type="button">
|
||||
<h4 class="activitypub-event-bridge-settings-accordion-heading">
|
||||
<button aria-expanded="false" class="activitypub-event-bridge-settings-accordion-trigger" aria-controls="activitypub-event-bridge-help-accordion-advanced" type="button">
|
||||
<span class="title">
|
||||
4.
|
||||
<img src="<?php echo esc_url( plugins_url( '/assets/img/activitypub.svg', EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_FILE ) ); ?>" alt="Mastodon Icon" class="event-bridge-for-activitypub-settings-inline-icon">
|
||||
<?php \esc_html_e( 'Advanced: Verifying the ActivityStreams JSON', 'event-bridge-for-activitypub' ); ?></span>
|
||||
<img src="<?php echo esc_url( plugins_url( '/assets/img/activitypub.svg', ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_FILE ) ); ?>" alt="Mastodon Icon" class="activitypub-event-bridge-settings-inline-icon">
|
||||
<?php \esc_html_e( 'Advanced: Verifying the ActivityStreams JSON', 'activitypub-event-bridge' ); ?></span>
|
||||
<span class="icon"></span>
|
||||
</button>
|
||||
</h4>
|
||||
<div id="event-bridge-for-activitypub-help-accordion-advanced" class="event-bridge-for-activitypub-settings-accordion-panel" hidden="hidden">
|
||||
<div id="activitypub-event-bridge-help-accordion-advanced" class="activitypub-event-bridge-settings-accordion-panel" hidden="hidden">
|
||||
<p>
|
||||
<?php
|
||||
// Assume $event_url contains the dynamic URL, and '?activitypub' is appended to it.
|
||||
|
@ -202,7 +202,7 @@ WP_Filesystem();
|
|||
|
||||
// Translator comment to explain the placeholder.
|
||||
/* translators: %1$s is the <code>?activitypub</code> string, and %2$s is the full URL of an example event */
|
||||
$raw_string = sprintf( __( 'For more technical users, you can inspect how your event is converted into an ActivityPub object. Simply append %1$s to the end of any single event pages URL to view the raw ActivityStreams JSON data (e.g., %2$s).', 'event-bridge-for-activitypub' ), $activitypub_query, $activitypub_url_html );
|
||||
$raw_string = sprintf( __( 'For more technical users, you can inspect how your event is converted into an ActivityPub object. Simply append %1$s to the end of any single event pages URL to view the raw ActivityStreams JSON data (e.g., %2$s).', 'activitypub-event-bridge' ), $activitypub_query, $activitypub_url_html );
|
||||
|
||||
// Allowed HTML tags in the string (only <code> and <a>).
|
||||
$allowed_html = array(
|
||||
|
@ -223,10 +223,10 @@ WP_Filesystem();
|
|||
</div>
|
||||
|
||||
<div class="box">
|
||||
<h2><?php \esc_html_e( 'Changelog', 'event-bridge-for-activitypub' ); ?></h2>
|
||||
<h2><?php \esc_html_e( 'Changelog', 'activitypub-event-bridge' ); ?></h2>
|
||||
<pre>
|
||||
<?php
|
||||
$changelog = $wp_filesystem->get_contents( EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_DIR . '/CHANGELOG.md' );
|
||||
$changelog = $wp_filesystem->get_contents( ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_DIR . '/CHANGELOG.md' );
|
||||
echo esc_html( substr( $changelog, strpos( $changelog, "\n", 180 ) + 1 ) );
|
||||
?>
|
||||
</pre>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPUnit bootstrap file.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
*/
|
||||
|
||||
$_tests_dir = getenv( 'WP_TESTS_DIR' );
|
||||
|
@ -25,21 +25,6 @@ if ( ! file_exists( "{$_tests_dir}/includes/functions.php" ) ) {
|
|||
// Give access to tests_add_filter() function.
|
||||
require_once "{$_tests_dir}/includes/functions.php";
|
||||
|
||||
/**
|
||||
* Function to manually load an event plugin.
|
||||
*
|
||||
* @param string $plugin_file The main plugin file of the event plugin.
|
||||
*/
|
||||
function _manually_load_event_plugin( $plugin_file ) {
|
||||
$plugin_dir = ABSPATH . '/wp-content/plugins/';
|
||||
require_once $plugin_dir . $plugin_file;
|
||||
update_option( 'purchase_history_table_structure_migration_done', true );
|
||||
$current = get_option( 'active_plugins', array() );
|
||||
$current[] = $plugin_file;
|
||||
sort( $current );
|
||||
update_option( 'active_plugins', $current );
|
||||
}
|
||||
|
||||
/**
|
||||
* Manually load the plugin being tested and its integrations.
|
||||
*/
|
||||
|
@ -50,10 +35,10 @@ function _manually_load_plugin() {
|
|||
require_once $plugin_dir . 'activitypub/activitypub.php';
|
||||
|
||||
// Capture the --filter argument.
|
||||
$event_bridge_for_activitypub_integration_filter = null;
|
||||
$activitypub_event_extension_integration_filter = null;
|
||||
foreach ( $_SERVER['argv'] as $arg ) {
|
||||
if ( strpos( $arg, '--filter=' ) === 0 ) {
|
||||
$event_bridge_for_activitypub_integration_filter = substr( $arg, strlen( '--filter=' ) );
|
||||
$activitypub_event_extension_integration_filter = substr( $arg, strlen( '--filter=' ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +49,7 @@ function _manually_load_plugin() {
|
|||
|
||||
$plugin_file = null;
|
||||
// See if we want to run integration tests for a specific event-plugin.
|
||||
switch ( $event_bridge_for_activitypub_integration_filter ) {
|
||||
switch ( $activitypub_event_extension_integration_filter ) {
|
||||
case 'the_events_calendar':
|
||||
$plugin_file = 'the-events-calendar/the-events-calendar.php';
|
||||
break;
|
||||
|
@ -86,39 +71,34 @@ function _manually_load_plugin() {
|
|||
case 'wp_event_manager':
|
||||
$plugin_file = 'wp-event-manager/wp-event-manager.php';
|
||||
break;
|
||||
case 'eventprime':
|
||||
$plugin_file = 'eventprime-event-calendar-management/event-prime.php';
|
||||
break;
|
||||
case 'event_organiser':
|
||||
$plugin_file = 'event-organiser/event-organiser.php';
|
||||
break;
|
||||
}
|
||||
|
||||
if ( $plugin_file ) {
|
||||
_manually_load_event_plugin( $plugin_file );
|
||||
} else {
|
||||
// For all other tests we mainly use the Events Calendar as a reference.
|
||||
_manually_load_event_plugin( 'the-events-calendar/the-events-calendar.php' );
|
||||
_manually_load_event_plugin( 'very-simple-event-list/vsel.php' );
|
||||
|
||||
// Manually load the event plugin.
|
||||
require_once $plugin_dir . $plugin_file;
|
||||
update_option( 'purchase_history_table_structure_migration_done', true );
|
||||
$current = get_option( 'active_plugins', array() );
|
||||
$current[] = $plugin_file;
|
||||
sort( $current );
|
||||
update_option( 'active_plugins', $current );
|
||||
}
|
||||
|
||||
// Hot fix that allows using Events Manager within unit tests, because the em_init() is later not run as admin.
|
||||
if ( 'events_manager' === $event_bridge_for_activitypub_integration_filter ) {
|
||||
if ( 'events_manager' === $activitypub_event_extension_integration_filter ) {
|
||||
require_once $plugin_dir . 'events-manager/em-install.php';
|
||||
em_create_events_table();
|
||||
em_create_events_meta_table();
|
||||
em_create_locations_table();
|
||||
}
|
||||
|
||||
if ( 'modern_events_calendar_lite' === $event_bridge_for_activitypub_integration_filter ) {
|
||||
if ( 'modern_events_calendar_lite' === $activitypub_event_extension_integration_filter ) {
|
||||
require_once $plugin_dir . 'modern-events-calendar-lite/app/libraries/factory.php';
|
||||
$mec_factory = new MEC_factory();
|
||||
$mec_factory->install();
|
||||
}
|
||||
|
||||
// At last manually load our WordPress plugin.
|
||||
require dirname( __DIR__ ) . '/event-bridge-for-activitypub.php';
|
||||
require dirname( __DIR__ ) . '/activitypub-event-bridge.php';
|
||||
}
|
||||
|
||||
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
|
||||
|
|
|
@ -1,193 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Test file for Activitypub Shortcodes.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
use Activitypub\Shortcodes;
|
||||
|
||||
/**
|
||||
* Test class for Activitypub Shortcodes.
|
||||
*
|
||||
* @coversDefaultClass \Activitypub\Shortcodes
|
||||
*/
|
||||
class Test_Activitypub_Event_Bridge_Shortcodes extends WP_UnitTestCase {
|
||||
/**
|
||||
* Override the setup function, so that tests don't run if the Events Calendar is not active.
|
||||
*/
|
||||
public function set_up() {
|
||||
parent::set_up();
|
||||
|
||||
if ( ! class_exists( '\Tribe__Events__Main' ) ) {
|
||||
self::markTestSkipped( 'The Events Calendar plugin is needed to test Event Shortcodes' );
|
||||
}
|
||||
|
||||
// Make sure that ActivityPub support is enabled for The Events Calendar.
|
||||
$aec = \Event_Bridge_For_ActivityPub\Setup::get_instance();
|
||||
$aec->activate_activitypub_support_for_active_event_plugins();
|
||||
|
||||
// Delete all posts afterwards.
|
||||
_delete_all_posts();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the shortcode for rendering the events start time.
|
||||
*/
|
||||
public function test_start_time() {
|
||||
// Create a The Events Calendar Event without content.
|
||||
$wp_object = tribe_events()
|
||||
->set_args( Test_The_Events_Calendar::MOCKUP_EVENTS['minimal_event'] )
|
||||
->create();
|
||||
|
||||
// Call the transformer Factory.
|
||||
$transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object );
|
||||
|
||||
if ( ! $transformer instanceof \Event_Bridge_For_ActivityPub\Activitypub\Transformer\Event ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$transformer->register_shortcodes();
|
||||
|
||||
$summary = '[ap_start_time]';
|
||||
$summary = do_shortcode( $summary );
|
||||
$this->assertEquals( '🗓️ Start: December 1, 2024 3:00 pm', $summary );
|
||||
|
||||
$summary = '[ap_start_time icon="false"]';
|
||||
$summary = do_shortcode( $summary );
|
||||
$this->assertEquals( 'Start: December 1, 2024 3:00 pm', $summary );
|
||||
|
||||
$summary = '[ap_start_time icon="false" label="false"]';
|
||||
$summary = do_shortcode( $summary );
|
||||
$this->assertEquals( 'December 1, 2024 3:00 pm', $summary );
|
||||
|
||||
$transformer->unregister_shortcodes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the shortcode for rendering the events end time.
|
||||
*/
|
||||
public function test_end_time() {
|
||||
// Create a The Events Calendar Event without content.
|
||||
$wp_object = tribe_events()
|
||||
->set_args( Test_The_Events_Calendar::MOCKUP_EVENTS['minimal_event'] )
|
||||
->create();
|
||||
|
||||
// Call the transformer Factory.
|
||||
$transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object );
|
||||
|
||||
if ( ! $transformer instanceof \Event_Bridge_For_ActivityPub\Activitypub\Transformer\Event ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$transformer->register_shortcodes();
|
||||
|
||||
$summary = '[ap_end_time]';
|
||||
$summary = do_shortcode( $summary );
|
||||
$this->assertEquals( '⏳ End: December 1, 2024 4:00 pm', $summary );
|
||||
|
||||
$summary = '[ap_end_time icon="false"]';
|
||||
$summary = do_shortcode( $summary );
|
||||
$this->assertEquals( 'End: December 1, 2024 4:00 pm', $summary );
|
||||
|
||||
$summary = '[ap_end_time icon="false" label="false"]';
|
||||
$summary = do_shortcode( $summary );
|
||||
$this->assertEquals( 'December 1, 2024 4:00 pm', $summary );
|
||||
|
||||
$transformer->unregister_shortcodes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the shortcode for rendering the events location when no location is set.
|
||||
*/
|
||||
public function test_location_when_no_location_is_set() {
|
||||
// Create a The Events Calendar Event without content.
|
||||
$wp_object = tribe_events()
|
||||
->set_args( Test_The_Events_Calendar::MOCKUP_EVENTS['minimal_event'] )
|
||||
->create();
|
||||
|
||||
// Call the transformer Factory.
|
||||
$transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object );
|
||||
|
||||
if ( ! $transformer instanceof \Event_Bridge_For_ActivityPub\Activitypub\Transformer\Event ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$transformer->register_shortcodes();
|
||||
|
||||
$summary = '[ap_location]';
|
||||
$summary = do_shortcode( $summary );
|
||||
$this->assertEquals( '', $summary );
|
||||
|
||||
$transformer->unregister_shortcodes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the shortcode for rendering the events location when location is set.
|
||||
*/
|
||||
public function test_location_when_location_is_set() {
|
||||
// Create Venue.
|
||||
$venue = tribe_venues()->set_args( Test_The_Events_Calendar::MOCKUP_VENUS['minimal_venue'] )->create();
|
||||
// Create a The Events Calendar Event.
|
||||
$wp_object = tribe_events()
|
||||
->set_args( Test_The_Events_Calendar::MOCKUP_EVENTS['complex_event'] )
|
||||
->set( 'venue', $venue->ID )
|
||||
->create();
|
||||
|
||||
// Call the transformer Factory.
|
||||
$transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object );
|
||||
|
||||
if ( ! $transformer instanceof \Event_Bridge_For_ActivityPub\Activitypub\Transformer\Event ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$transformer->register_shortcodes();
|
||||
|
||||
$summary = '[ap_location]';
|
||||
$summary = do_shortcode( $summary );
|
||||
$this->assertEquals( '📍 Location: Minimal Venue', $summary );
|
||||
|
||||
$summary = '[ap_location icon="false"]';
|
||||
$summary = do_shortcode( $summary );
|
||||
$this->assertEquals( 'Location: Minimal Venue', $summary );
|
||||
|
||||
$summary = '[ap_location icon="false" label="false"]';
|
||||
$summary = do_shortcode( $summary );
|
||||
$this->assertEquals( 'Minimal Venue', $summary );
|
||||
|
||||
$transformer->unregister_shortcodes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the shortcode for rendering the events location when location with detailed address is set.
|
||||
*/
|
||||
public function test_location_when_detailed_location_is_set() {
|
||||
// Create Venue.
|
||||
$venue = tribe_venues()->set_args( Test_The_Events_Calendar::MOCKUP_VENUS['complex_venue'] )->create();
|
||||
// Create a The Events Calendar Event.
|
||||
$wp_object = tribe_events()
|
||||
->set_args( Test_The_Events_Calendar::MOCKUP_EVENTS['complex_event'] )
|
||||
->set( 'venue', $venue->ID )
|
||||
->create();
|
||||
|
||||
// Call the transformer Factory.
|
||||
$transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object );
|
||||
|
||||
if ( ! $transformer instanceof \Event_Bridge_For_ActivityPub\Activitypub\Transformer\Event ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$transformer->register_shortcodes();
|
||||
|
||||
$summary = '[ap_location]';
|
||||
$summary = do_shortcode( $summary );
|
||||
$this->assertEquals( '📍 Location: Complex Venue, Venue address, Venue zip, Venue city, Venue country', $summary );
|
||||
|
||||
$summary = '[ap_location country="false"]';
|
||||
$summary = do_shortcode( $summary );
|
||||
$this->assertEquals( '📍 Location: Complex Venue, Venue address, Venue zip, Venue city', $summary );
|
||||
|
||||
$transformer->unregister_shortcodes();
|
||||
}
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Test class for the integration of the Event Organiser.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sample test case.
|
||||
*/
|
||||
class Test_Event_Organiser extends WP_UnitTestCase {
|
||||
/**
|
||||
* Override the setup function, so that tests don't run if the Events Calendar is not active.
|
||||
*/
|
||||
public function set_up() {
|
||||
parent::set_up();
|
||||
|
||||
if ( ! function_exists( 'eo_get_events' ) ) {
|
||||
self::markTestSkipped( 'Event Organiser plugin is not active.' );
|
||||
}
|
||||
|
||||
// Make sure that ActivityPub support is enabled.
|
||||
$aec = \Event_Bridge_For_ActivityPub\Setup::get_instance();
|
||||
$aec->activate_activitypub_support_for_active_event_plugins();
|
||||
|
||||
// Run the install script just in time which makes sure the custom tables exist and more.
|
||||
eventorganiser_install();
|
||||
|
||||
// Delete all posts afterwards.
|
||||
_delete_all_posts();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the right transformer gets applied.
|
||||
*/
|
||||
public function test_transformer_class() {
|
||||
// We only test for one event plugin being active at the same time,
|
||||
// even though we support multiple onces in theory.
|
||||
// But testing all combinations is beyond scope.
|
||||
$active_event_plugins = \Event_Bridge_For_ActivityPub\Setup::get_instance()->get_active_event_plugins();
|
||||
$this->assertEquals( 1, count( $active_event_plugins ) );
|
||||
|
||||
// Enable ActivityPub support for the event plugin.
|
||||
$this->assertContains( 'event', get_option( 'activitypub_support_post_types' ) );
|
||||
|
||||
$event_data = array(
|
||||
'start' => new DateTime( '+10 days 15:00:00', eo_get_blog_timezone() ),
|
||||
'end' => new DateTime( '+10 days 16:00:00', eo_get_blog_timezone() ),
|
||||
'all_day' => 0,
|
||||
'schedule' => 'once',
|
||||
);
|
||||
|
||||
$post_data = array(
|
||||
'post_title' => 'Unit Test Event',
|
||||
'post_content' => 'Unit Test description.',
|
||||
'post_status' => 'publish',
|
||||
);
|
||||
|
||||
$post_id = eo_insert_event( $post_data, $event_data );
|
||||
|
||||
// Call the transformer Factory.
|
||||
$transformer = \Activitypub\Transformer\Factory::get_transformer( get_post( $post_id ) );
|
||||
|
||||
// Check that we got the right transformer.
|
||||
$this->assertInstanceOf( \Event_Bridge_For_ActivityPub\Activitypub\Transformer\Event_Organiser::class, $transformer );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test transformation to ActivityPub for basic event.
|
||||
*/
|
||||
public function test_transform_of_basic_event() {
|
||||
// Mock Event.
|
||||
$event_data = array(
|
||||
'start' => new DateTime( '+10 days 15:00:00', eo_get_blog_timezone() ),
|
||||
'end' => new DateTime( '+10 days 16:00:00', eo_get_blog_timezone() ),
|
||||
'all_day' => 0,
|
||||
'schedule' => 'once',
|
||||
);
|
||||
|
||||
$post_data = array(
|
||||
'post_title' => 'Unit Test Event',
|
||||
'post_content' => 'Unit Test description.',
|
||||
'post_status' => 'publish',
|
||||
);
|
||||
|
||||
$post_id = eo_insert_event( $post_data, $event_data );
|
||||
|
||||
// Call the transformer Factory.
|
||||
$event_array = \Activitypub\Transformer\Factory::get_transformer( get_post( $post_id ) )->to_object()->to_array();
|
||||
|
||||
// Check that the event ActivityStreams representation contains everything as expected.
|
||||
$this->assertEquals( 'Event', $event_array['type'] );
|
||||
$this->assertEquals( 'Unit Test Event', $event_array['name'] );
|
||||
$this->assertEquals( 'Unit Test description.', wp_strip_all_tags( $event_array['content'] ) );
|
||||
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] );
|
||||
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 16:00:00' ) ) . 'T16:00:00Z', $event_array['endTime'] );
|
||||
$this->assertEquals( 'external', $event_array['joinMode'] );
|
||||
$this->assertArrayNotHasKey( 'location', $event_array );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test transformation to ActivityPub for event with location.
|
||||
*/
|
||||
public function test_transform_of_event_with_location() {
|
||||
// Create venue.
|
||||
$venue_args = array(
|
||||
'description' => 'This is a test venue for the Fediverse.',
|
||||
'address' => 'Fediverse-Street 1337',
|
||||
'city' => 'Fediverse-Town',
|
||||
'state' => 'Fediverse-Sate',
|
||||
'postcode' => '1337',
|
||||
'country' => 'Fediverse-Country',
|
||||
'latitude' => 7.076668,
|
||||
'longitude' => 15.421371,
|
||||
);
|
||||
$venue_name = 'Fediverse Venue';
|
||||
$venue = eo_insert_venue( $venue_name, $venue_args );
|
||||
|
||||
// Mock Event.
|
||||
$event_data = array(
|
||||
'start' => new DateTime( '+10 days 15:00:00', eo_get_blog_timezone() ),
|
||||
'end' => new DateTime( '+10 days 16:00:00', eo_get_blog_timezone() ),
|
||||
'all_day' => 0,
|
||||
'schedule' => 'once',
|
||||
);
|
||||
$post_data = array(
|
||||
'post_title' => 'Unit Test Event',
|
||||
'post_content' => 'Unit Test description.',
|
||||
'post_status' => 'publish',
|
||||
);
|
||||
$post_id = eo_insert_event( $post_data, $event_data );
|
||||
wp_set_object_terms( $post_id, $venue['term_id'], 'event-venue' );
|
||||
|
||||
// Call the transformer Factory.
|
||||
$event_array = \Activitypub\Transformer\Factory::get_transformer( get_post( $post_id ) )->to_object()->to_array();
|
||||
|
||||
// Check that the event ActivityStreams representation contains everything as expected.
|
||||
$this->assertEquals( 'Event', $event_array['type'] );
|
||||
$this->assertEquals( 'Unit Test Event', $event_array['name'] );
|
||||
$this->assertEquals( 'Unit Test description.', wp_strip_all_tags( $event_array['content'] ) );
|
||||
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] );
|
||||
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 16:00:00' ) ) . 'T16:00:00Z', $event_array['endTime'] );
|
||||
$this->assertEquals( 'external', $event_array['joinMode'] );
|
||||
$this->assertArrayHasKey( 'location', $event_array );
|
||||
$this->assertEquals( $venue_args['description'], wp_strip_all_tags( $event_array['location']['content'] ) );
|
||||
$this->assertEquals( $venue_args['address'], $event_array['location']['address']['streetAddress'] );
|
||||
$this->assertEquals( $venue_args['city'], $event_array['location']['address']['addressLocality'] );
|
||||
$this->assertEquals( $venue_args['state'], $event_array['location']['address']['addressRegion'] );
|
||||
$this->assertEquals( $venue_args['country'], $event_array['location']['address']['addressCountry'] );
|
||||
$this->assertEquals( $venue_args['postcode'], $event_array['location']['address']['postalCode'] );
|
||||
$this->assertEquals( $venue_name, $event_array['location']['name'] );
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Tests for WP Event Solution.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -36,7 +36,7 @@ class Test_Eventin extends WP_UnitTestCase {
|
|||
}
|
||||
|
||||
// Make sure that ActivityPub support is enabled for The Events Calendar.
|
||||
$aec = \Event_Bridge_For_ActivityPub\Setup::get_instance();
|
||||
$aec = \ActivityPub_Event_Bridge\Setup::get_instance();
|
||||
$aec->activate_activitypub_support_for_active_event_plugins();
|
||||
|
||||
// Delete all posts afterwards.
|
||||
|
@ -50,7 +50,7 @@ class Test_Eventin extends WP_UnitTestCase {
|
|||
// We only test for one event plugin being active at the same time,
|
||||
// even though we support multiple onces in theory.
|
||||
// But testing all combinations is beyond scope.
|
||||
$active_event_plugins = \Event_Bridge_For_ActivityPub\Setup::get_instance()->get_active_event_plugins();
|
||||
$active_event_plugins = \ActivityPub_Event_Bridge\Setup::get_instance()->get_active_event_plugins();
|
||||
$this->assertEquals( 1, count( $active_event_plugins ) );
|
||||
|
||||
// Enable ActivityPub support for the event plugin.
|
||||
|
@ -64,7 +64,7 @@ class Test_Eventin extends WP_UnitTestCase {
|
|||
$transformer = \Activitypub\Transformer\Factory::get_transformer( get_post( $event->id ) );
|
||||
|
||||
// Check that we got the right transformer.
|
||||
$this->assertInstanceOf( \Event_Bridge_For_ActivityPub\Activitypub\Transformer\Eventin::class, $transformer );
|
||||
$this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\Eventin::class, $transformer );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,186 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Class SampleTest
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sample test case.
|
||||
*/
|
||||
class Test_EventPrime extends WP_UnitTestCase {
|
||||
/**
|
||||
* Mockup venues of certain complexity.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $mockup_venue = array();
|
||||
|
||||
/**
|
||||
* Mockup events for tests.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $mockup_events = array();
|
||||
|
||||
/**
|
||||
* Override the setup function, so that tests don't run if the Events Calendar is not active.
|
||||
*/
|
||||
public function set_up() {
|
||||
parent::set_up();
|
||||
|
||||
if ( ! class_exists( '\Eventprime_Basic_Functions' ) ) {
|
||||
self::markTestSkipped( 'The EventPrime Calendar management plugin is not active.' );
|
||||
}
|
||||
|
||||
// Make sure that ActivityPub support is enabled for The Events Calendar.
|
||||
$aeb = \Event_Bridge_For_ActivityPub\Setup::get_instance();
|
||||
$aeb->activate_activitypub_support_for_active_event_plugins();
|
||||
|
||||
// Delete all posts afterwards.
|
||||
_delete_all_posts();
|
||||
|
||||
$this->setup_mockup_data();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup mockup events.
|
||||
*/
|
||||
private function setup_mockup_data() {
|
||||
$this->mockup_events = array(
|
||||
'minimal_event' => array(
|
||||
'name' => 'EventPrime Event title',
|
||||
'description' => 'EventPrime event description',
|
||||
'status' => 'Publish',
|
||||
'em_event_type' => '',
|
||||
'em_venue' => '',
|
||||
'em_organizer' => '',
|
||||
'em_performer' => '',
|
||||
'em_start_date' => strtotime( '+10 days 15:00:00' ),
|
||||
'em_end_date' => strtotime( '+10 days 16:00:00' ),
|
||||
'em_enable_booking' => 'bookings_off',
|
||||
'em_ticket_price' => 0,
|
||||
),
|
||||
);
|
||||
|
||||
$this->mockup_venue = array(
|
||||
'name' => 'Test Venue',
|
||||
'address' => 'Fediverse-street 1337, 1234 Fediverse-town',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the right transformer gets applied.
|
||||
*/
|
||||
public function test_the_events_calendar_transformer_class() {
|
||||
// We only test for one event plugin being active at the same time,
|
||||
// even though we support multiple onces in theory.
|
||||
// But testing all combinations is beyond scope.
|
||||
$active_event_plugins = \Event_Bridge_For_ActivityPub\Setup::get_instance()->get_active_event_plugins();
|
||||
$this->assertEquals( 1, count( $active_event_plugins ) );
|
||||
|
||||
// Enable ActivityPub support for the event plugin.
|
||||
$this->assertContains( 'em_event', get_option( 'activitypub_support_post_types' ) );
|
||||
|
||||
// Create an EventPrime Event without content.
|
||||
$ep_functions = new Eventprime_Basic_Functions();
|
||||
|
||||
$post_id = $ep_functions->insert_event_post_data( $this->mockup_events['minimal_event'] );
|
||||
|
||||
$wp_object = get_post( $post_id );
|
||||
|
||||
// Call the transformer Factory.
|
||||
$transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object );
|
||||
|
||||
// Check that we got the right transformer.
|
||||
$this->assertInstanceOf( \Event_Bridge_For_ActivityPub\Activitypub\Transformer\EventPrime::class, $transformer );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test transformation of minimal event.
|
||||
*/
|
||||
public function test_transformation_of_minimal_event() {
|
||||
// Create an EventPrime Event without content.
|
||||
$ep_functions = new Eventprime_Basic_Functions();
|
||||
|
||||
$post_id = $ep_functions->insert_event_post_data( $this->mockup_events['minimal_event'] );
|
||||
|
||||
$wp_object = get_post( $post_id );
|
||||
|
||||
// Call the transformer Factory.
|
||||
$event_array = \Activitypub\Transformer\Factory::get_transformer( $wp_object )->to_object()->to_array();
|
||||
|
||||
// Check that the event ActivityStreams representation contains everything as expected.
|
||||
$this->assertEquals( 'Event', $event_array['type'] );
|
||||
$this->assertEquals( 'EventPrime Event title', $event_array['name'] );
|
||||
$this->assertEquals( 'EventPrime event description', wp_strip_all_tags( $event_array['content'] ) );
|
||||
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] );
|
||||
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 16:00:00' ) ) . 'T16:00:00Z', $event_array['endTime'] );
|
||||
$this->assertTrue( $event_array['commentsEnabled'] );
|
||||
$this->assertEquals( 'allow_all', $event_array['repliesModerationOption'] );
|
||||
$this->assertEquals( 'external', $event_array['joinMode'] );
|
||||
$this->assertArrayNotHasKey( 'location', $event_array );
|
||||
$this->assertEquals( 'MEETING', $event_array['category'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test transformation of minimal event.
|
||||
*/
|
||||
public function test_transformation_of_minimal_event_with_venue() {
|
||||
// Create an EventPrime Event without content.
|
||||
$ep_functions = new Eventprime_Basic_Functions();
|
||||
|
||||
$venue_term_id = wp_insert_term( $this->mockup_venue['name'], 'em_venue' )['term_id'];
|
||||
add_term_meta( $venue_term_id, 'em_address', $this->mockup_venue['address'], true );
|
||||
add_term_meta( $venue_term_id, 'em_display_address_on_frontend', true, true );
|
||||
|
||||
$event_data = $this->mockup_events['minimal_event'];
|
||||
$event_data['em_venue'] = $venue_term_id;
|
||||
|
||||
$post_id = $ep_functions->insert_event_post_data( $event_data );
|
||||
|
||||
$wp_object = get_post( $post_id );
|
||||
|
||||
// Call the transformer Factory.
|
||||
$event_array = \Activitypub\Transformer\Factory::get_transformer( $wp_object )->to_object()->to_array();
|
||||
|
||||
// Check that the event ActivityStreams representation contains everything as expected.
|
||||
$this->assertEquals( 'Event', $event_array['type'] );
|
||||
$this->assertEquals( 'EventPrime Event title', $event_array['name'] );
|
||||
$this->assertEquals( 'EventPrime event description', wp_strip_all_tags( $event_array['content'] ) );
|
||||
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] );
|
||||
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 16:00:00' ) ) . 'T16:00:00Z', $event_array['endTime'] );
|
||||
$this->assertTrue( $event_array['commentsEnabled'] );
|
||||
$this->assertEquals( 'allow_all', $event_array['repliesModerationOption'] );
|
||||
$this->assertEquals( 'external', $event_array['joinMode'] );
|
||||
$this->assertEquals( $this->mockup_venue['name'], $event_array['location']['name'] );
|
||||
$this->assertEquals( $this->mockup_venue['address'], $event_array['location']['address'] );
|
||||
|
||||
$this->assertEquals( 'MEETING', $event_array['category'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test transformation of minimal event with venue which has a hidden address.
|
||||
*/
|
||||
public function test_transformation_of_minimal_event_with_venue_with_hidden_address() {
|
||||
// Create an EventPrime Event without content.
|
||||
$ep_functions = new Eventprime_Basic_Functions();
|
||||
|
||||
$venue_term_id = wp_insert_term( $this->mockup_venue['name'], 'em_venue' )['term_id'];
|
||||
add_term_meta( $venue_term_id, 'em_address', $this->mockup_venue['address'], true );
|
||||
add_term_meta( $venue_term_id, 'em_display_address_on_frontend', false, true );
|
||||
|
||||
$event_data = $this->mockup_events['minimal_event'];
|
||||
$event_data['em_venue'] = $venue_term_id;
|
||||
|
||||
$post_id = $ep_functions->insert_event_post_data( $event_data );
|
||||
|
||||
$wp_object = get_post( $post_id );
|
||||
|
||||
// Call the transformer Factory.
|
||||
$event_array = \Activitypub\Transformer\Factory::get_transformer( $wp_object )->to_object()->to_array();
|
||||
|
||||
// Check that the event ActivityStreams representation contains everything as expected.
|
||||
$this->assertArrayNotHasKey( 'address', $event_array['location'] );
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Class SampleTest
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -23,7 +23,7 @@ class Test_Events_Manager extends WP_UnitTestCase {
|
|||
update_option( 'dbem_events_anonymous_submissions', true );
|
||||
|
||||
// Make sure that ActivityPub support is enabled for Events Manager.
|
||||
$aec = \Event_Bridge_For_ActivityPub\Setup::get_instance();
|
||||
$aec = \ActivityPub_Event_Bridge\Setup::get_instance();
|
||||
$aec->activate_activitypub_support_for_active_event_plugins();
|
||||
|
||||
// Delete all posts afterwards.
|
||||
|
@ -37,7 +37,7 @@ class Test_Events_Manager extends WP_UnitTestCase {
|
|||
// We only test for one event plugin being active at the same time,
|
||||
// even though we support multiple onces in theory.
|
||||
// But testing all combinations is beyond scope.
|
||||
$active_event_plugins = \Event_Bridge_For_ActivityPub\Setup::get_instance()->get_active_event_plugins();
|
||||
$active_event_plugins = \ActivityPub_Event_Bridge\Setup::get_instance()->get_active_event_plugins();
|
||||
$this->assertEquals( 1, count( $active_event_plugins ) );
|
||||
|
||||
// Enable ActivityPub support for the event plugin.
|
||||
|
@ -61,7 +61,7 @@ class Test_Events_Manager extends WP_UnitTestCase {
|
|||
$transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object );
|
||||
|
||||
// Check that we got the right transformer.
|
||||
$this->assertInstanceOf( \Event_Bridge_For_ActivityPub\Activitypub\Transformer\Events_Manager::class, $transformer );
|
||||
$this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\Events_Manager::class, $transformer );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Class SampleTest
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -23,7 +23,7 @@ class Test_GatherPress extends WP_UnitTestCase {
|
|||
GatherPress\Core\Setup::get_instance()->activate_gatherpress_plugin( false );
|
||||
|
||||
// Make sure that ActivityPub support is enabled for The Events Calendar.
|
||||
$aec = \Event_Bridge_For_ActivityPub\Setup::get_instance();
|
||||
$aec = \ActivityPub_Event_Bridge\Setup::get_instance();
|
||||
$aec->activate_activitypub_support_for_active_event_plugins();
|
||||
|
||||
// Delete all posts afterwards.
|
||||
|
@ -37,7 +37,7 @@ class Test_GatherPress extends WP_UnitTestCase {
|
|||
// We only test for one event plugin being active at the same time,
|
||||
// even though we support multiple onces in theory.
|
||||
// But testing all combinations is beyond scope.
|
||||
$active_event_plugins = \Event_Bridge_For_ActivityPub\Setup::get_instance()->get_active_event_plugins();
|
||||
$active_event_plugins = \ActivityPub_Event_Bridge\Setup::get_instance()->get_active_event_plugins();
|
||||
$this->assertEquals( 1, count( $active_event_plugins ) );
|
||||
|
||||
// Enable ActivityPub support for the event plugin.
|
||||
|
@ -65,7 +65,7 @@ class Test_GatherPress extends WP_UnitTestCase {
|
|||
$transformer = \Activitypub\Transformer\Factory::get_transformer( $event->event );
|
||||
|
||||
// Check that we got the right transformer.
|
||||
$this->assertInstanceOf( \Event_Bridge_For_ActivityPub\Activitypub\Transformer\GatherPress::class, $transformer );
|
||||
$this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\GatherPress::class, $transformer );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Tests or Modern Events Calendar Lite
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -27,7 +27,7 @@ class Test_Modern_Events_Calendar_Lite extends WP_UnitTestCase {
|
|||
}
|
||||
|
||||
// Make sure that ActivityPub support is enabled for The Events Calendar.
|
||||
$aec = \Event_Bridge_For_ActivityPub\Setup::get_instance();
|
||||
$aec = \ActivityPub_Event_Bridge\Setup::get_instance();
|
||||
$aec->activate_activitypub_support_for_active_event_plugins();
|
||||
|
||||
$this->mec_main = \MEC::getInstance( 'app.libraries.main' );
|
||||
|
@ -43,7 +43,7 @@ class Test_Modern_Events_Calendar_Lite extends WP_UnitTestCase {
|
|||
// We only test for one event plugin being active at the same time,
|
||||
// even though we support multiple onces in theory.
|
||||
// But testing all combinations is beyond scope.
|
||||
$active_event_plugins = \Event_Bridge_For_ActivityPub\Setup::get_instance()->get_active_event_plugins();
|
||||
$active_event_plugins = \ActivityPub_Event_Bridge\Setup::get_instance()->get_active_event_plugins();
|
||||
$this->assertEquals( 1, count( $active_event_plugins ) );
|
||||
|
||||
// Enable ActivityPub support for the event plugin.
|
||||
|
@ -74,7 +74,7 @@ class Test_Modern_Events_Calendar_Lite extends WP_UnitTestCase {
|
|||
$transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object );
|
||||
|
||||
// Check that we got the right transformer.
|
||||
$this->assertInstanceOf( \Event_Bridge_For_ActivityPub\Activitypub\Transformer\Modern_Events_Calendar_Lite::class, $transformer );
|
||||
$this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\Modern_Events_Calendar_Lite::class, $transformer );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Class SampleTest
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -62,7 +62,7 @@ class Test_The_Events_Calendar extends WP_UnitTestCase {
|
|||
}
|
||||
|
||||
// Make sure that ActivityPub support is enabled for The Events Calendar.
|
||||
$aec = \Event_Bridge_For_ActivityPub\Setup::get_instance();
|
||||
$aec = \ActivityPub_Event_Bridge\Setup::get_instance();
|
||||
$aec->activate_activitypub_support_for_active_event_plugins();
|
||||
|
||||
// Delete all posts afterwards.
|
||||
|
@ -76,7 +76,7 @@ class Test_The_Events_Calendar extends WP_UnitTestCase {
|
|||
// We only test for one event plugin being active at the same time,
|
||||
// even though we support multiple onces in theory.
|
||||
// But testing all combinations is beyond scope.
|
||||
$active_event_plugins = \Event_Bridge_For_ActivityPub\Setup::get_instance()->get_active_event_plugins();
|
||||
$active_event_plugins = \ActivityPub_Event_Bridge\Setup::get_instance()->get_active_event_plugins();
|
||||
$this->assertEquals( 1, count( $active_event_plugins ) );
|
||||
|
||||
// Enable ActivityPub support for the event plugin.
|
||||
|
@ -91,7 +91,7 @@ class Test_The_Events_Calendar extends WP_UnitTestCase {
|
|||
$transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object );
|
||||
|
||||
// Check that we got the right transformer.
|
||||
$this->assertInstanceOf( \Event_Bridge_For_ActivityPub\Activitypub\Transformer\The_Events_Calendar::class, $transformer );
|
||||
$this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\The_Events_Calendar::class, $transformer );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,10 +128,10 @@ class Test_The_Events_Calendar extends WP_UnitTestCase {
|
|||
$category_id_theatre = wp_insert_term( 'Theatre', Tribe__Events__Main::TAXONOMY, array( 'slug' => 'theatre' ) );
|
||||
|
||||
// Set default mapping for event categories.
|
||||
update_option( 'event_bridge_for_activitypub_default_event_category', 'MUSIC' );
|
||||
update_option( 'activitypub_event_bridge_default_event_category', 'MUSIC' );
|
||||
|
||||
// Set an override for the category with the slug theatre.
|
||||
update_option( 'event_bridge_for_activitypub_event_category_mappings', array( 'theatre' => 'THEATRE' ) );
|
||||
update_option( 'activitypub_event_bridge_event_category_mappings', array( 'theatre' => 'THEATRE' ) );
|
||||
|
||||
// Create a The Events Calendar event with the music category.
|
||||
$wp_object = tribe_events()
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Class SampleTest
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@ class Test_VS_Event_List extends WP_UnitTestCase {
|
|||
}
|
||||
|
||||
// Make sure that ActivityPub support is enabled for The Events Calendar.
|
||||
$aec = \Event_Bridge_For_ActivityPub\Setup::get_instance();
|
||||
$aec = \ActivityPub_Event_Bridge\Setup::get_instance();
|
||||
$aec->activate_activitypub_support_for_active_event_plugins();
|
||||
|
||||
// Delete all posts afterwards.
|
||||
|
@ -34,7 +34,7 @@ class Test_VS_Event_List extends WP_UnitTestCase {
|
|||
// We only test for one event plugin being active at the same time,
|
||||
// even though we support multiple onces in theory.
|
||||
// But testing all combinations is beyond scope.
|
||||
$active_event_plugins = \Event_Bridge_For_ActivityPub\Setup::get_instance()->get_active_event_plugins();
|
||||
$active_event_plugins = \ActivityPub_Event_Bridge\Setup::get_instance()->get_active_event_plugins();
|
||||
$this->assertEquals( 1, count( $active_event_plugins ) );
|
||||
|
||||
// Enable ActivityPub support for the event plugin.
|
||||
|
@ -58,7 +58,7 @@ class Test_VS_Event_List extends WP_UnitTestCase {
|
|||
$transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object );
|
||||
|
||||
// Check that we got the right transformer.
|
||||
$this->assertInstanceOf( \Event_Bridge_For_ActivityPub\Activitypub\Transformer\VS_Event_List::class, $transformer );
|
||||
$this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\VS_Event_List::class, $transformer );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -173,10 +173,10 @@ class Test_VS_Event_List extends WP_UnitTestCase {
|
|||
$category_id_theatre = wp_insert_term( 'Theatre', 'event_cat', array( 'slug' => 'theatre' ) );
|
||||
|
||||
// Set default mapping for event categories.
|
||||
update_option( 'event_bridge_for_activitypub_default_event_category', 'MUSIC' );
|
||||
update_option( 'activitypub_event_bridge_default_event_category', 'MUSIC' );
|
||||
|
||||
// Set an override for the category with the slug theatre.
|
||||
update_option( 'event_bridge_for_activitypub_event_category_mappings', array( 'theatre' => 'THEATRE' ) );
|
||||
update_option( 'activitypub_event_bridge_event_category_mappings', array( 'theatre' => 'THEATRE' ) );
|
||||
|
||||
// Create a VS Event List event with the music category.
|
||||
$wp_post_id = wp_insert_post(
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Class SampleTest
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @package ActivityPub_Event_Bridge
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@ class Test_WP_Event_Manager extends WP_UnitTestCase {
|
|||
}
|
||||
|
||||
// Make sure that ActivityPub support is enabled for The Events Calendar.
|
||||
$aec = \Event_Bridge_For_ActivityPub\Setup::get_instance();
|
||||
$aec = \ActivityPub_Event_Bridge\Setup::get_instance();
|
||||
$aec->activate_activitypub_support_for_active_event_plugins();
|
||||
|
||||
// Delete all posts afterwards.
|
||||
|
@ -34,7 +34,7 @@ class Test_WP_Event_Manager extends WP_UnitTestCase {
|
|||
// We only test for one event plugin being active at the same time,
|
||||
// even though we support multiple onces in theory.
|
||||
// But testing all combinations is beyond scope.
|
||||
$active_event_plugins = \Event_Bridge_For_ActivityPub\Setup::get_instance()->get_active_event_plugins();
|
||||
$active_event_plugins = \ActivityPub_Event_Bridge\Setup::get_instance()->get_active_event_plugins();
|
||||
$this->assertEquals( 1, count( $active_event_plugins ) );
|
||||
|
||||
// Enable ActivityPub support for the event plugin.
|
||||
|
@ -58,7 +58,7 @@ class Test_WP_Event_Manager extends WP_UnitTestCase {
|
|||
$transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object );
|
||||
|
||||
// Check that we got the right transformer.
|
||||
$this->assertInstanceOf( \Event_Bridge_For_ActivityPub\Activitypub\Transformer\WP_Event_Manager::class, $transformer );
|
||||
$this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\WP_Event_Manager::class, $transformer );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -134,7 +134,7 @@ class Test_WP_Event_Manager extends WP_UnitTestCase {
|
|||
$this->assertContains(
|
||||
array(
|
||||
'type' => 'Link',
|
||||
'name' => __( 'Video URL', 'event-bridge-for-activitypub' ),
|
||||
'name' => __( 'Video URL', 'activitypub-event-bridge' ),
|
||||
'href' => 'https://event-federation.eu/meeting-room',
|
||||
'mediaType' => 'text/html',
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue