transformer_refactoring #44
2 changed files with 0 additions and 42 deletions
|
@ -150,23 +150,6 @@ final class Events_Manager extends Event_Transformer {
|
|||
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.
|
||||
*
|
||||
|
|
|
@ -129,31 +129,6 @@ final class GatherPress extends Event {
|
|||
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.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue