add filter to never include permalink in summary
Some checks failed
Some checks failed
This commit is contained in:
parent
c13230ac6f
commit
20f0ea2823
2 changed files with 12 additions and 3 deletions
|
@ -217,12 +217,15 @@ abstract class Event extends Post {
|
||||||
* @return string $summary The custom event summary.
|
* @return string $summary The custom event summary.
|
||||||
*/
|
*/
|
||||||
public function get_summary(): ?string {
|
public function get_summary(): ?string {
|
||||||
|
add_filter( 'activitypub_object_content_template', array( self::class, 'remove_ap_permalink_from_template' ), 2 );
|
||||||
$excerpt = $this->extract_excerpt();
|
$excerpt = $this->extract_excerpt();
|
||||||
// BeforeFirstRelease: decide whether this should be a admin setting.
|
// BeforeFirstRelease: decide whether this should be a admin setting.
|
||||||
$fallback_to_content = true;
|
$fallback_to_content = true;
|
||||||
if ( is_null( $excerpt ) && $fallback_to_content ) {
|
if ( is_null( $excerpt ) && $fallback_to_content ) {
|
||||||
$excerpt = $this->get_content();
|
$excerpt = $this->get_content();
|
||||||
}
|
}
|
||||||
|
remove_filter( 'activitypub_object_content_template', array( self::class, 'remove_ap_permalink_from_template' ) );
|
||||||
|
|
||||||
$category = $this->format_category();
|
$category = $this->format_category();
|
||||||
$start_time = $this->format_time();
|
$start_time = $this->format_time();
|
||||||
$end_time = $this->format_time( false );
|
$end_time = $this->format_time( false );
|
||||||
|
@ -234,11 +237,11 @@ abstract class Event extends Post {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $start_time ) ) {
|
if ( ! empty( $start_time ) ) {
|
||||||
$formatted_items[] = "🗓️ . {$start_time}";
|
$formatted_items[] = "🗓️ {$start_time}";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $end_time ) ) {
|
if ( ! empty( $end_time ) ) {
|
||||||
$formatted_items[] = "⏳ . {$end_time}";
|
$formatted_items[] = "⏳ {$end_time}";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $address ) ) {
|
if ( ! empty( $address ) ) {
|
||||||
|
@ -257,6 +260,13 @@ abstract class Event extends Post {
|
||||||
return $summary;
|
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.
|
* Generic function that converts an WP-Event object to an ActivityPub-Event object.
|
||||||
*
|
*
|
||||||
|
|
|
@ -106,7 +106,6 @@ final class VS_Event_List extends Event_Transformer {
|
||||||
return $attachments;
|
return $attachments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the excerpt text (may be HTML). Used for constructing the summary.
|
* Retrieves the excerpt text (may be HTML). Used for constructing the summary.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue