Compare commits
No commits in common. "fdb4f000a36986872eec9f8e92c4e9af26b6e412" and "82dca423e152507b1860bea6f19a13f215494cb8" have entirely different histories.
fdb4f000a3
...
82dca423e1
3 changed files with 13 additions and 48 deletions
|
@ -6,14 +6,14 @@
|
|||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace ActivityPub_Event_Bridge\Activitypub\Transformer;
|
||||
namespace Activitypub_Event_Extensions\Activitypub\Transformer;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Activitypub\Activity\Extended_Object\Event;
|
||||
use Activitypub\Activity\Extended_Object\Place;
|
||||
use ActivityPub_Event_Bridge\Activitypub\Transformer\Event as Event_Transformer;
|
||||
use Activitypub_Event_Extensions\Activitypub\Transformer\Event as Event_Transformer;
|
||||
use DateTime;
|
||||
use DateTimeZone;
|
||||
use EM_Event;
|
||||
|
@ -34,7 +34,6 @@ final class My_Calendar extends Event_Transformer {
|
|||
* @var array
|
||||
*/
|
||||
protected $mc_event;
|
||||
protected $mc_event_schema;
|
||||
|
||||
/**
|
||||
* Extend the constructor, to also set the Eventsmanager objects.
|
||||
|
@ -47,10 +46,7 @@ final class My_Calendar extends Event_Transformer {
|
|||
*/
|
||||
public function __construct( $wp_object, $wp_taxonomy ) {
|
||||
parent::__construct( $wp_object, $wp_taxonomy );
|
||||
$mc_event_id = get_post_meta( $this->wp_object->ID, '_mc_event_id', true );
|
||||
$this->mc_event = mc_get_event( $mc_event_id );
|
||||
|
||||
$this->mc_event_schema = mc_event_schema( $this->mc_event );
|
||||
$this->mc_event = get_post_meta( $wp_object->ID, '_mc_event_data', true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,52 +68,21 @@ final class My_Calendar extends Event_Transformer {
|
|||
* Get the start time from the events metadata.
|
||||
*/
|
||||
public function get_start_time(): string {
|
||||
return $this->convert_time( $this->mc_event->event_begin, $this->mc_event->event_time);
|
||||
return $this->convert_time( $this->mc_event['event_begin'], $this->mc_event['event_time']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the end time from the events metadata.
|
||||
*/
|
||||
public function get_end_time(): ?string {
|
||||
return $this->convert_time( $this->mc_event->event_end, $this->mc_event->event_endtime);
|
||||
return $this->convert_time( $this->mc_event['event_end'], $this->mc_event['event_endtime']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the event location.
|
||||
*
|
||||
* @return Place|null The place/venue if one is set.
|
||||
*/
|
||||
public function get_location(): ?Place {
|
||||
if ( array_key_exists('location', $this->mc_event_schema ) && $this->mc_event_schema['location']['@type'] == 'Place' ) {
|
||||
$mc_place = $this->mc_event_schema['location'];
|
||||
|
||||
$place = new Place();
|
||||
$place->set_name( $mc_place['name'] );
|
||||
$place->set_url( $mc_place['url'] );
|
||||
$place->set_address( $mc_place['address'] );
|
||||
|
||||
if ( ! empty( $mc_place['geo'] ) ) {
|
||||
$place->set_latitude( $mc_place['geo']['latitude'] );
|
||||
$place->set_longitude( $mc_place['geo']['longitude'] );
|
||||
}
|
||||
return $place;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status of the event
|
||||
*
|
||||
* @return string status of the event
|
||||
*/
|
||||
public function get_status(): ?string {
|
||||
return 'CONFIRMED'; # my-calender doesn't implement canceled events.
|
||||
}
|
||||
|
||||
|
||||
public function to_object(): Event {
|
||||
$activitypub_object = parent::to_object();
|
||||
|
||||
return $activitypub_object;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -124,11 +124,11 @@ class Setup {
|
|||
* @var array
|
||||
*/
|
||||
private const EVENT_PLUGIN_CLASSES = array(
|
||||
'\ActivityPub_Event_Bridge\Plugins\Events_Manager',
|
||||
'\ActivityPub_Event_Bridge\Plugins\GatherPress',
|
||||
'\ActivityPub_Event_Bridge\Plugins\The_Events_Calendar',
|
||||
'\ActivityPub_Event_Bridge\Plugins\VS_Event_List',
|
||||
'\ActivityPub_Event_Bridge\Plugins\My_Calendar',
|
||||
'\Activitypub_Event_Extensions\Plugins\Events_Manager',
|
||||
'\Activitypub_Event_Extensions\Plugins\GatherPress',
|
||||
'\Activitypub_Event_Extensions\Plugins\The_Events_Calendar',
|
||||
'\Activitypub_Event_Extensions\Plugins\VS_Event_List',
|
||||
'\Activitypub_Event_Extensions\Plugins\My_Calendar',
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace ActivityPub_Event_Bridge\Plugins;
|
||||
namespace Activitypub_Event_Extensions\Plugins;
|
||||
|
||||
use Activitypub_Event_Extensions\Event_Plugins;
|
||||
|
||||
|
|
Loading…
Reference in a new issue