remove old get_summary from gatherpress and event manager in favour of the new one in class-event

This commit is contained in:
ruru4143 2024-09-29 15:00:13 +02:00
parent 228dba06ae
commit 24844f57c1
2 changed files with 0 additions and 42 deletions

View file

@ -150,23 +150,6 @@ final class Events_Manager extends Event_Transformer {
return count( $em_bookings->bookings ); return count( $em_bookings->bookings );
} }
/**
* Hardcoded function for generating a summary.
*/
public function get_summary(): ?string {
if ( $this->em_event->post_excerpt ) {
$excerpt = $this->em_event->post_excerpt;
} else {
$excerpt = $this->get_content();
}
$address = $this->em_event->get_location()->location_name;
$start_time = strtotime( $this->get_start_time() );
$datetime_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
$start_time_string = wp_date( $datetime_format, $start_time );
$summary = "📍 {$address}\n📅 {$start_time_string}\n\n{$excerpt}";
return $summary;
}
/** /**
* Get the event link as an ActivityPub Link object, but as an associative array. * Get the event link as an ActivityPub Link object, but as an associative array.
* *

View file

@ -129,31 +129,6 @@ final class GatherPress extends Event {
return $user->get_url(); return $user->get_url();
} }
/**
* Create a custom summary.
*
* It contains also the most important meta-information. The summary is often used when the
* ActivityPub object type 'Event' is not supported, e.g. in Mastodon.
*
* @return string $summary The custom event summary.
*/
public function get_summary(): string {
if ( $this->wp_object->excerpt ) {
$excerpt = $this->wp_object->post_excerpt;
} elseif ( get_post_meta( $this->wp_object->ID, 'event-summary', true ) ) {
$excerpt = get_post_meta( $this->wp_object->ID, 'event-summary', true );
} else {
$excerpt = $this->get_content();
}
$address = get_post_meta( $this->wp_object->ID, 'event-location', true );
$start_time = get_post_meta( $this->wp_object->ID, 'event-start-date', true );
$datetime_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
$start_time_string = wp_date( $datetime_format, $start_time );
$summary = "📍 {$address}\n📅 {$start_time_string}\n\n{$excerpt}";
return $summary;
}
/** /**
* Get the content. * Get the content.
*/ */