diff --git a/activitypub-event-bridge.php b/activitypub-event-bridge.php
index a4e0cad..b1cb2ea 100644
--- a/activitypub-event-bridge.php
+++ b/activitypub-event-bridge.php
@@ -3,7 +3,7 @@
* Plugin Name: ActivityPub Event Bridge
* Description: Integrating popular event plugins with the ActivityPub plugin.
* Plugin URI: https://event-federation.eu/
- * Version: 0.1.0
+ * Version: 0.1.1
* Author: André Menrath
* Author URI: https://graz.social/@linos
* Text Domain: activitypub-event-bridge
@@ -11,7 +11,7 @@
* License URI: https://www.gnu.org/licenses/agpl-3.0.de.html
* Requires PHP: 8.1
*
- * Requires at least ActivityPub plugin with version >= 3.2.2. ActivityPub plugin tested up to: 3.2.2.
+ * Requires at least ActivityPub plugin with version >= 3.2.2. ActivityPub plugin tested up to: 3.3.3.
*
* @package ActivityPub_Event_Bridge
* @license AGPL-3.0-or-later
diff --git a/assets/css/activitypub-event-bridge-admin.css b/assets/css/activitypub-event-bridge-admin.css
index b6eaae1..c89ec6e 100644
--- a/assets/css/activitypub-event-bridge-admin.css
+++ b/assets/css/activitypub-event-bridge-admin.css
@@ -1,3 +1,7 @@
+.settings_page_activitypub-event-bridge #wpcontent {
+ padding-left: 0;
+}
+
.activitypub-event-bridge-settings-page .box {
border: 1px solid #c3c4c7;
background-color: #fff;
@@ -6,8 +10,7 @@
}
.activitypub-event-bridge-settings-page .box ul.activitypub-event-bridge-list {
- list-style-type: disc;
- margin-left: 1.4rem;
+ margin-left: 0.6em;
}
.activitypub-event-bridge-settings-page .box pre {
@@ -62,9 +65,115 @@
}
.activitypub-event-bridge-settings .box h3 {
- font-size: 1.1rem!important;
+ font-size: 1.15em;
+ margin-bottom: 0em;
}
#activitypub_event_bridge_initially_activated {
display: hidden;
}
+
+/* Accordions for admin pages */
+.activitypub-event-bridge-settings-accordion {
+ border: 1px solid #c3c4c7;
+}
+
+.activitypub-event-bridge-settings-accordion-heading {
+ margin: 0;
+ border-top: 1px solid #c3c4c7;
+ font-size: inherit;
+ line-height: inherit;
+ font-weight: 600;
+ color: inherit;
+}
+
+.activitypub-event-bridge-settings-accordion-heading:first-child {
+ border-top: none;
+}
+
+.activitypub-event-bridge-settings-accordion-panel {
+ margin: 0;
+ padding: 1em 1.5em;
+ background: #fff;
+}
+
+.activitypub-event-bridge-settings-accordion-trigger {
+ background: #fff;
+ border: 0;
+ color: #2c3338;
+ cursor: pointer;
+ display: flex;
+ font-weight: 400;
+ margin: 0;
+ padding: 1em 3.5em 1em 1.5em;
+ min-height: 46px;
+ position: relative;
+ text-align: left;
+ width: 100%;
+ align-items: center;
+ justify-content: space-between;
+ -webkit-user-select: auto;
+ user-select: auto;
+}
+
+.activitypub-event-bridge-settings-accordion-trigger {
+ color: #2c3338;
+ cursor: pointer;
+ font-weight: 400;
+ text-align: left;
+}
+
+.activitypub-event-bridge-settings-accordion-trigger .title {
+ pointer-events: none;
+ font-weight: 600;
+ flex-grow: 1;
+}
+
+.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;
+ pointer-events: none;
+ position: absolute;
+ right: 1.5em;
+ top: 50%;
+ transform: translateY(-70%) rotate(45deg);
+ width: .5rem;
+}
+
+.activitypub-event-bridge-settings-accordion-trigger[aria-expanded="true"] .icon {
+ transform: translateY(-30%) rotate(-135deg);
+}
+
+.activitypub-event-bridge-settings-accordion-trigger:active,
+.activitypub-event-bridge-settings-accordion-trigger:hover {
+ background: #f6f7f7;
+}
+
+.activitypub-event-bridge-settings-accordion-trigger:focus {
+ color: #1d2327;
+ border: none;
+ box-shadow: none;
+ outline-offset: -1px;
+ outline: 2px solid #2271b1;
+ background-color: #f6f7f7;
+}
+
+.activitypub-event-bridge-settings-inline-icon {
+ width: 1.5em;
+ height: 1.5em;
+ vertical-align: middle;
+ margin: 0 0.3em;
+}
+
+code.activitypub-event-bridge-settings-example-url {
+ display: block;
+ background: rgb(28, 29, 33);
+ padding: 8px;
+ margin: 10px 0px 10px 0;
+ border-radius: 7px;
+ color: #d5d5d6;
+ overflow-x: auto;
+ word-break: break-all;
+}
diff --git a/assets/img/activitypub.svg b/assets/img/activitypub.svg
new file mode 100644
index 0000000..f56d428
--- /dev/null
+++ b/assets/img/activitypub.svg
@@ -0,0 +1,288 @@
+
+
+
+
diff --git a/assets/img/fediverse.svg b/assets/img/fediverse.svg
new file mode 100644
index 0000000..a789df2
--- /dev/null
+++ b/assets/img/fediverse.svg
@@ -0,0 +1,17 @@
+
diff --git a/assets/img/mastodon.svg b/assets/img/mastodon.svg
new file mode 100644
index 0000000..0f8baeb
--- /dev/null
+++ b/assets/img/mastodon.svg
@@ -0,0 +1,10 @@
+
diff --git a/assets/img/mobilizon.svg b/assets/img/mobilizon.svg
new file mode 100644
index 0000000..8b5d57e
--- /dev/null
+++ b/assets/img/mobilizon.svg
@@ -0,0 +1 @@
+
diff --git a/assets/js/activitypub-event-bridge-admin.js b/assets/js/activitypub-event-bridge-admin.js
new file mode 100644
index 0000000..bf00a1c
--- /dev/null
+++ b/assets/js/activitypub-event-bridge-admin.js
@@ -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 );
+ }
+ } );
+} );
diff --git a/includes/activitypub/transformer/class-the-events-calendar.php b/includes/activitypub/transformer/class-the-events-calendar.php
index 9d76aaa..2fe7274 100644
--- a/includes/activitypub/transformer/class-the-events-calendar.php
+++ b/includes/activitypub/transformer/class-the-events-calendar.php
@@ -173,7 +173,7 @@ final class The_Events_Calendar extends Event {
} else {
$location->set_address( $venue->post_title );
}
- $location->set_id( $venue->permalink );
+ $location->set_id( $venue->ID );
$location->set_name( $venue->post_title );
return $location;
diff --git a/includes/admin/class-general-admin-notices.php b/includes/admin/class-general-admin-notices.php
index 43cb4f3..7ab1f2b 100644
--- a/includes/admin/class-general-admin-notices.php
+++ b/includes/admin/class-general-admin-notices.php
@@ -98,6 +98,24 @@ class General_Admin_Notices {
);
}
+ /**
+ * Warning to fix status issues first.
+ *
+ * @return string
+ */
+ public static function get_admin_notice_status_not_ok(): string {
+ return sprintf(
+ /* translators: 1: An URL to the list of supported event plugins. */
+ _x(
+ 'The Plugin ActivityPub Event Bridge is of no use, because you do not have installed and activated a supported Event Plugin.
+
For a list of supported Event Plugins see here.',
+ 'admin notice',
+ 'activitypub-event-bridge'
+ ),
+ esc_html( self::ACTIVITYPUB_EVENT_BRIDGE_SUPPORTED_EVENT_PLUGINS_URL )
+ );
+ }
+
/**
* Warning if the plugin is Active and the ActivityPub plugin is not.
*
diff --git a/includes/admin/class-health-check.php b/includes/admin/class-health-check.php
index 1f44905..5fa3f9a 100644
--- a/includes/admin/class-health-check.php
+++ b/includes/admin/class-health-check.php
@@ -107,12 +107,16 @@ class Health_Check {
/**
* Retrieves the most recently published event posts of a certain event post type.
*
- * @param string $event_post_type The post type of the events.
- * @param int $number_of_posts The maximum number of events to return.
+ * @param ?string $event_post_type The post type of the events.
+ * @param ?int $number_of_posts The maximum number of events to return.
*
* @return WP_Post[]|false Array of event posts, or false if none are found.
*/
- public static function get_most_recent_event_posts( $event_post_type, $number_of_posts = 5 ) {
+ public static function get_most_recent_event_posts( $event_post_type = null, $number_of_posts = 5 ) {
+ if ( ! $event_post_type ) {
+ $event_post_type = Setup::get_instance()->get_active_event_plugins()[0]->get_post_type();
+ }
+
$args = array(
'numberposts' => $number_of_posts,
'category' => 0,
diff --git a/includes/admin/class-settings-page.php b/includes/admin/class-settings-page.php
index 9694d98..b2dbb3e 100644
--- a/includes/admin/class-settings-page.php
+++ b/includes/admin/class-settings-page.php
@@ -3,7 +3,7 @@
* General settings class.
*
* This file contains the General class definition, which handles the "General" settings
- * page for the ActivityPub Event Extension Plugin, providing options for configuring various general settings.
+ * page for the Activitypub Event Bridge Plugin, providing options for configuring various general settings.
*
* @package ActivityPub_Event_Bridge
* @since 1.0.0
@@ -18,9 +18,9 @@ use ActivityPub_Event_Bridge\Plugins\Event_Plugin;
use ActivityPub_Event_Bridge\Setup;
/**
- * Class responsible for the ActivityPub Event Extension related Settings.
+ * Class responsible for the Activitypub Event Bridge related Settings.
*
- * Class which handles the "General" settings page for the ActivityPub Event Extension 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
@@ -36,11 +36,11 @@ class Settings_Page {
*/
public static function admin_menu(): void {
\add_options_page(
- 'Activitypub Event Extension',
- __( 'ActivityPub Events', 'activitypub-event-bridge' ),
+ 'Activitypub Event Bridge',
+ __( 'ActivityPub Event Bridge', 'activitypub-event-bridge' ),
'manage_options',
self::SETTINGS_SLUG,
- array( self::STATIC, 'settings_page' )
+ array( self::STATIC, 'settings_page' ),
);
}
diff --git a/includes/class-settings.php b/includes/class-settings.php
index e5f69f0..3367dd1 100644
--- a/includes/class-settings.php
+++ b/includes/class-settings.php
@@ -3,7 +3,7 @@
* General settings class.
*
* This file contains the General class definition, which handles the "General" settings
- * page for the ActivityPub Event Extension Plugin, providing options for configuring various general settings.
+ * page for the Activitypub Event Bridge Plugin, providing options for configuring various general settings.
*
* @package ActivityPub_Event_Bridge
* @since 1.0.0
diff --git a/includes/class-setup.php b/includes/class-setup.php
index e9b602c..966d1d3 100644
--- a/includes/class-setup.php
+++ b/includes/class-setup.php
@@ -208,6 +208,16 @@ class Setup {
array(),
ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_VERSION
);
+ wp_enqueue_script(
+ 'activitypub-event-bridge-admin-script',
+ plugins_url(
+ 'assets/js/activitypub-event-bridge-admin.js',
+ ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_FILE
+ ),
+ array( 'jquery' ),
+ ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_VERSION,
+ false
+ );
}
}
diff --git a/templates/welcome.php b/templates/welcome.php
index 3fbed43..cb63f5c 100644
--- a/templates/welcome.php
+++ b/templates/welcome.php
@@ -20,7 +20,17 @@ use ActivityPub_Event_Bridge\Admin\Health_Check;
)
);
-$active_event_plugins = Setup::get_instance()->get_active_event_plugins();
+$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';
+ $example_event_post_is_dummy = true;
+} else {
+ $example_event_post = \get_permalink( $example_event_post[0] );
+ $example_event_post_is_dummy = false;
+}
global $wp_filesystem;
WP_Filesystem();
@@ -31,21 +41,64 @@ WP_Filesystem();
' . \esc_html__( 'Please fix the status issues above first.', 'activitypub-event-bridge' ) . '
+
+
+
+ element.
+ $activitypub_query = '' . esc_html( '?activitypub' ) . '
?activitypub
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).', 'activitypub-event-bridge' ), $activitypub_query, $activitypub_url_html );
+
+ // Allowed HTML tags in the string (only and ).
+ $allowed_html = array(
+ 'a' => array(
+ 'href' => array(),
+ 'target' => array(),
+ ),
+ 'nobr' => array(),
+ 'code' => array(),
+ );
+
+ // Output the formatted string with the allowed HTML elements.
+ echo wp_kses( $raw_string, $allowed_html );
+ ?>
+