diff --git a/includes/activitypub/transformer/class-event.php b/includes/activitypub/transformer/class-event.php index f870aef..04b53a4 100644 --- a/includes/activitypub/transformer/class-event.php +++ b/includes/activitypub/transformer/class-event.php @@ -217,12 +217,15 @@ abstract class Event extends Post { * @return string $summary The custom event summary. */ public function get_summary(): ?string { + add_filter( 'activitypub_object_content_template', array( self::class, 'remove_ap_permalink_from_template' ), 2 ); $excerpt = $this->extract_excerpt(); // BeforeFirstRelease: decide whether this should be a admin setting. $fallback_to_content = true; if ( is_null( $excerpt ) && $fallback_to_content ) { $excerpt = $this->get_content(); } + remove_filter( 'activitypub_object_content_template', array( self::class, 'remove_ap_permalink_from_template' ) ); + $category = $this->format_category(); $start_time = $this->format_time(); $end_time = $this->format_time( false ); @@ -234,11 +237,11 @@ abstract class Event extends Post { } if ( ! empty( $start_time ) ) { - $formatted_items[] = "🗓️ . {$start_time}"; + $formatted_items[] = "🗓️ {$start_time}"; } if ( ! empty( $end_time ) ) { - $formatted_items[] = "⏳ . {$end_time}"; + $formatted_items[] = "⏳ {$end_time}"; } if ( ! empty( $address ) ) { @@ -257,6 +260,13 @@ abstract class Event extends Post { return $summary; } + public static function remove_ap_permalink_from_template( $template) { + $template = str_replace( '[ap_permalink]', '', $template ); + $template = str_replace( '[ap_permalink type="html"]', '', $template ); + + return $template; + } + /** * Generic function that converts an WP-Event object to an ActivityPub-Event object. * diff --git a/includes/activitypub/transformer/class-vs-event-list.php b/includes/activitypub/transformer/class-vs-event-list.php index adce99e..d995e83 100644 --- a/includes/activitypub/transformer/class-vs-event-list.php +++ b/includes/activitypub/transformer/class-vs-event-list.php @@ -106,7 +106,6 @@ final class VS_Event_List extends Event_Transformer { return $attachments; } - /** * Retrieves the excerpt text (may be HTML). Used for constructing the summary. *