Compare commits
No commits in common. "7d979a1c5e5e5b7449671219361e291619cbc1bf" and "9be7cb2ce2d0ab30a84c34952d3b79a669284435" have entirely different histories.
7d979a1c5e
...
9be7cb2ce2
3 changed files with 41 additions and 14 deletions
|
@ -36,20 +36,6 @@ final class Events_Manager extends Event_Transformer {
|
||||||
*/
|
*/
|
||||||
protected $em_event;
|
protected $em_event;
|
||||||
|
|
||||||
/**
|
|
||||||
* Extend the constructor, to also set the Eventsmanager objects.
|
|
||||||
*
|
|
||||||
* This is a special class object form The Events Calendar which
|
|
||||||
* has a lot of useful functions, we make use of our getter functions.
|
|
||||||
*
|
|
||||||
* @param WP_Post $wp_object The WordPress object.
|
|
||||||
* @param string $wp_taxonomy The taxonomy slug of the event post type.
|
|
||||||
*/
|
|
||||||
public function __construct( $wp_object, $wp_taxonomy ) {
|
|
||||||
parent::__construct( $wp_object, $wp_taxonomy );
|
|
||||||
$this->em_event = new EM_Event( $this->wp_object->ID, 'post_id' );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the even is online
|
* Returns whether the even is online
|
||||||
*
|
*
|
||||||
|
@ -232,4 +218,20 @@ final class Events_Manager extends Event_Transformer {
|
||||||
protected function get_name(): string {
|
protected function get_name(): string {
|
||||||
return $this->em_event->event_name;
|
return $this->em_event->event_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transform the WordPress Object into an ActivityPub Object.
|
||||||
|
*
|
||||||
|
* @return Activitypub\Activity\Event
|
||||||
|
*/
|
||||||
|
public function to_object(): Event {
|
||||||
|
$this->em_event = new EM_Event( $this->wp_object->ID, 'post_id' );
|
||||||
|
$activitypub_object = new Event();
|
||||||
|
|
||||||
|
$activitypub_object = $this->transform_object_properties( $activitypub_object );
|
||||||
|
|
||||||
|
$activitypub_object->set_external_participation_url( $this->get_url() );
|
||||||
|
|
||||||
|
return $activitypub_object;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,4 +165,16 @@ final class GatherPress extends Event {
|
||||||
public function get_is_online(): bool {
|
public function get_is_online(): bool {
|
||||||
return $this->gp_event->maybe_get_online_event_link() ? true : false;
|
return $this->gp_event->maybe_get_online_event_link() ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transform the WordPress Object into an ActivityPub Object.
|
||||||
|
*
|
||||||
|
* @return Activitypub\Activity\Event
|
||||||
|
*/
|
||||||
|
public function to_object(): Event_Object {
|
||||||
|
$activitypub_object = parent::to_object();
|
||||||
|
|
||||||
|
return $activitypub_object;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,4 +196,17 @@ final class The_Events_Calendar extends Event {
|
||||||
|
|
||||||
return $location;
|
return $location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extend the default event transformers to_object function.
|
||||||
|
*
|
||||||
|
* This is the heart of the ActivityPub transformer.
|
||||||
|
*
|
||||||
|
* @return Event_Object
|
||||||
|
*/
|
||||||
|
public function to_object(): Event_Object {
|
||||||
|
$activitypub_object = parent::to_object();
|
||||||
|
|
||||||
|
return $activitypub_object;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue