Fix code to follow latest upstream changes
Some checks are pending
Deploy to https://wordpress-test.event-federation.eu/ / deploy (push) Waiting to run

4c297acfd4
This commit is contained in:
André Menrath 2024-01-04 14:50:29 +01:00
parent 78d83c859a
commit e861ade6b6
3 changed files with 20 additions and 21 deletions

View file

@ -97,7 +97,7 @@ class Tribe extends Post {
// todo make it possible that one event can have multiple categories? // todo make it possible that one event can have multiple categories?
// using cat_slugs isn't 100% nice way to do this, don't know if it's a good idea // using cat_slugs isn't 100% nice way to do this, don't know if it's a good idea
$categories = tribe_get_event_cat_slugs( $this->object->ID ); $categories = tribe_get_event_cat_slugs( $this->wp_object->ID );
if ( count( $categories ) === 0 ) { if ( count( $categories ) === 0 ) {
return null; return null;

View file

@ -13,7 +13,6 @@ use Activitypub\Model\Blog_user;
use function Activitypub\get_rest_url_by_path; use function Activitypub\get_rest_url_by_path;
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
@ -81,7 +80,7 @@ class VS_Event extends Post {
* @return array The Place. * @return array The Place.
*/ */
public function get_location() { public function get_location() {
$address = get_post_meta( $this->object->ID, 'event-location', true ); $address = get_post_meta( $this->wp_object->ID, 'event-location', true );
$place = new Place(); $place = new Place();
$place->set_type( 'Place' ); $place->set_type( 'Place' );
$place->set_name( $address ); $place->set_name( $address );
@ -93,7 +92,7 @@ class VS_Event extends Post {
* Get the end time from the events metadata. * Get the end time from the events metadata.
*/ */
protected function get_end_time() { protected function get_end_time() {
$end_time = get_post_meta( $this->object->ID, 'event-date', true ); $end_time = get_post_meta( $this->wp_object->ID, 'event-date', true );
return \gmdate( 'Y-m-d\TH:i:s\Z', $end_time ); return \gmdate( 'Y-m-d\TH:i:s\Z', $end_time );
} }
@ -101,7 +100,7 @@ class VS_Event extends Post {
* Get the end time from the events metadata. * Get the end time from the events metadata.
*/ */
protected function get_start_time() { protected function get_start_time() {
$start_time = get_post_meta( $this->object->ID, 'event-start-date', true ); $start_time = get_post_meta( $this->wp_object->ID, 'event-start-date', true );
return \gmdate( 'Y-m-d\TH:i:s\Z', $start_time ); return \gmdate( 'Y-m-d\TH:i:s\Z', $start_time );
} }
@ -109,7 +108,7 @@ class VS_Event extends Post {
* Get the event link from the events metadata. * Get the event link from the events metadata.
*/ */
private function get_event_link() { private function get_event_link() {
$event_link = get_post_meta( $this->object->ID, 'event-link', true ); $event_link = get_post_meta( $this->wp_object->ID, 'event-link', true );
if ( $event_link ) { if ( $event_link ) {
return array( return array(
'type' => 'Link', 'type' => 'Link',
@ -140,7 +139,7 @@ class VS_Event extends Post {
* @return string $category * @return string $category
*/ */
protected function get_category() { protected function get_category() {
$post_categories = wp_get_post_terms( $this->object->ID, 'event_cat' ); $post_categories = wp_get_post_terms( $this->wp_object->ID, 'event_cat' );
if ( empty( $post_categories ) ) { if ( empty( $post_categories ) ) {
return 'MEETING'; return 'MEETING';
@ -201,16 +200,16 @@ class VS_Event extends Post {
* @return string $summary The custom event summary. * @return string $summary The custom event summary.
*/ */
public function get_summary() { public function get_summary() {
if ( $this->object->excerpt ) { if ( $this->wp_object->excerpt ) {
$excerpt = $this->object->post_excerpt; $excerpt = $this->wp_object->post_excerpt;
} else if ( get_post_meta( $this->object->ID, 'event-summary', true ) ) { } else if ( get_post_meta( $this->wp_object->ID, 'event-summary', true ) ) {
$excerpt = get_post_meta( $this->object->ID, 'event-summary', true ); $excerpt = get_post_meta( $this->wp_object->ID, 'event-summary', true );
} else { } else {
$excerpt = $this->get_content(); $excerpt = $this->get_content();
} }
$address = get_post_meta( $this->object->ID, 'event-location', true ); $address = get_post_meta( $this->wp_object->ID, 'event-location', true );
$start_time = get_post_meta( $this->object->ID, 'event-start-date', true ); $start_time = get_post_meta( $this->wp_object->ID, 'event-start-date', true );
$datetime_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' ); $datetime_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
$start_time_string = wp_date( $datetime_format, $start_time ); $start_time_string = wp_date( $datetime_format, $start_time );
$summary = "📍 {$address}\n📅 {$start_time_string}\n\n{$excerpt}"; $summary = "📍 {$address}\n📅 {$start_time_string}\n\n{$excerpt}";
@ -231,7 +230,7 @@ class VS_Event extends Post {
->set_comments_enabled( true ) ->set_comments_enabled( true )
->set_external_participation_url( $this->get_url() ) ->set_external_participation_url( $this->get_url() )
->set_status( 'CONFIRMED' ) ->set_status( 'CONFIRMED' )
->set_name( get_the_title( $this->object->ID ) ) ->set_name( get_the_title( $this->wp_object->ID ) )
->set_timezone( $object->get_locale ) ->set_timezone( $object->get_locale )
->set_is_online( false ) ->set_is_online( false )
->set_in_language( $this->get_locale() ) ->set_in_language( $this->get_locale() )