Add Event plugin integration: EventPrime #82

Open
linos wants to merge 10 commits from eventprime into main
3 changed files with 41 additions and 4 deletions
Showing only changes of commit aa353c3795 - Show all commits

View file

@ -107,5 +107,10 @@ jobs:
- name: Run Integration tests for Modern Events Calendar Lite
run: cd /workspace/Event-Federation/wordpress-activitypub-event-bridge/ && ./vendor/bin/phpunit --filter=modern_events_calendar_lite
env:
PHP_VERSION: ${{ matrix.php-version }}
- name: Run Integration tests for EventPrime
run: cd /workspace/Event-Federation/wordpress-activitypub-event-bridge/ && ./vendor/bin/phpunit --filter=eventprime
env:
PHP_VERSION: ${{ matrix.php-version }}

View file

@ -54,11 +54,12 @@
"@test-events-manager",
"@test-wp-event-manager",
"@test-eventin",
"@test-modern-events-calendar-lite"
"@test-modern-events-calendar-lite",
"@test-eventprime"
],
"test-debug": [
"@prepare-test",
"@test-gatherpress"
"@test-eventprime"
],
"test-vs-event-list": "phpunit --filter=vs_event_list",
"test-the-events-calendar": "phpunit --filter=the_events_calendar",
@ -67,6 +68,7 @@
"test-wp-event-manager": "phpunit --filter=wp_event_manager",
"test-eventin": "phpunit --filter=eventin",
"test-modern-events-calendar-lite": "phpunit --filter=modern_events_calendar_lite",
"test-eventprime": "phpunit --filter=eventprime",
"test-all": "phpunit"
}
}

View file

@ -11,10 +11,8 @@ namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
use Activitypub\Activity\Extended_Object\Event as Event_Object;
use Activitypub\Activity\Extended_Object\Place;
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event;
use GatherPress\Core\Event as GatherPress_Event;
/**
* ActivityPub Transformer for VS Event
@ -45,4 +43,36 @@ final class EventPrime extends Event {
return '';
}
}
/**
* Get location from the event object.
*/
protected function get_location(): ?Place {
$venue_term_id = get_post_meta( $this->wp_object->ID, 'em_venue', true );
if ( ! $venue_term_id ) {
return null;
}
$venue = wp_get_post_terms( $this->wp_object->ID, 'em_venue' );
if ( empty( $venue ) ) {
return null;
} else {
$venue = $venue[0];
}
$place = new Place();
$place->set_name( $venue->name );
$place->set_content( $venue->description );
$address = get_term_meta( $venue->term_id, 'em_address', true );
$display_address = get_term_meta( $venue->term_id, 'em_display_address_on_frontend', true );
if ( $address && $display_address ) {
$place->set_address( get_term_meta( $venue->term_id, 'em_address', true ) );
}
return $place;
}
}