fix skeleton for Events Manager
Some checks are pending
Deploy to https://wordpress-test.event-federation.eu/ / deploy (push) Waiting to run
Some checks are pending
Deploy to https://wordpress-test.event-federation.eu/ / deploy (push) Waiting to run
This commit is contained in:
parent
4adb4a563b
commit
baf6d43448
2 changed files with 29 additions and 5 deletions
|
@ -24,15 +24,29 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
*/
|
||||
add_filter(
|
||||
'activitypub_transformer',
|
||||
function( $transformer, $object, $object_class ) {
|
||||
function( $transformer, $wp_object, $object_class ) {
|
||||
if ( 'WP_Post' != $object_class) {
|
||||
return $transformer;
|
||||
}
|
||||
|
||||
/**
|
||||
* VS Event List
|
||||
* @see https://wordpress.org/plugins/very-simple-event-list/
|
||||
*/
|
||||
if ( $object->post_type === 'event' ) {
|
||||
require_once __DIR__ . '/includes/activitypub/transformer/class-vs-event.php';
|
||||
return new \VS_Event( $object );
|
||||
// if ( $wp_object->post_type === 'event' ) {
|
||||
// require_once __DIR__ . '/includes/activitypub/transformer/class-vs-event.php';
|
||||
// return new \VS_Event( $object );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Events manager
|
||||
* @see https://wordpress.org/plugins/events-manager/
|
||||
*/
|
||||
if ( class_exists( 'EM_Events') && $wp_object->post_type === 'event' ) {
|
||||
require_once __DIR__ . '/includes/activitypub/transformer/class-events-manager.php';
|
||||
return new \Events_Manager( $wp_object );
|
||||
}
|
||||
|
||||
// Return the default transformer.
|
||||
return $transformer;
|
||||
},
|
||||
|
|
|
@ -6,11 +6,12 @@
|
|||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
use EM_Event;
|
||||
|
||||
use Activitypub\Activity\Event;
|
||||
use Activitypub\Activity\Place;
|
||||
use Activitypub\Transformer\Post;
|
||||
use Activitypub\Model\Blog_user;
|
||||
|
||||
use function Activitypub\get_rest_url_by_path;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
@ -25,6 +26,13 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
* @since 1.0.0
|
||||
*/
|
||||
class Events_Manager extends Post {
|
||||
/**
|
||||
* Holds the EM_Event object.
|
||||
*
|
||||
* @var EM_Event
|
||||
*/
|
||||
protected $em_event;
|
||||
|
||||
/**
|
||||
* Get transformer name.
|
||||
*
|
||||
|
@ -121,7 +129,9 @@ class Events_Manager extends Post {
|
|||
* @return Activitypub\Activity\Event
|
||||
*/
|
||||
public function to_object() {
|
||||
$this->em_event = new EM_Event( $this->wp_object->ID, 'post_id');
|
||||
$activtiypub_object = new Event();
|
||||
|
||||
return $activtiypub_object;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue