updated plugin Event Bridge for ActivityPub version 1.3.0
This commit is contained in:
@ -13,11 +13,12 @@
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
\defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Event\Events_Manager as Events_Manager_Event_Transformer;
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Transformer\Place\Events_Manager as Events_Manager_Place_Transformer;
|
||||
|
||||
use WP_Post;
|
||||
use WP_Term;
|
||||
|
||||
/**
|
||||
* Events Manager.
|
||||
@ -43,7 +44,7 @@ final class Events_Manager extends Event_Plugin_Integration {
|
||||
* @return string
|
||||
*/
|
||||
public static function get_post_type(): string {
|
||||
return defined( 'EM_POST_TYPE_EVENT' ) ? constant( 'EM_POST_TYPE_EVENT' ) : 'event';
|
||||
return \defined( 'EM_POST_TYPE_EVENT' ) ? constant( 'EM_POST_TYPE_EVENT' ) : 'event';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -52,17 +53,17 @@ final class Events_Manager extends Event_Plugin_Integration {
|
||||
* @return string
|
||||
*/
|
||||
public static function get_place_post_type(): string {
|
||||
return defined( 'EM_POST_TYPE_LOCATION' ) ? constant( 'EM_POST_TYPE_LOCATION' ) : 'location';
|
||||
return \defined( 'EM_POST_TYPE_LOCATION' ) ? constant( 'EM_POST_TYPE_LOCATION' ) : 'location';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Activitypub transformer for places of the event plugins location post type.
|
||||
*
|
||||
* @param \WP_Post $post The WordPress post object of the Event.
|
||||
* @param WP_Post|WP_Term $post The WordPress post object of the Event.
|
||||
* @return Events_Manager_Place_Transformer
|
||||
*/
|
||||
public static function get_activitypub_place_transformer( $post ): Events_Manager_Place_Transformer {
|
||||
return new Events_Manager_Place_Transformer( $post );
|
||||
public static function get_activitypub_place_transformer( WP_Post|WP_Term $post ): ?Events_Manager_Place_Transformer {
|
||||
return $post instanceof WP_Post ? new Events_Manager_Place_Transformer( $post ) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -80,16 +81,16 @@ final class Events_Manager extends Event_Plugin_Integration {
|
||||
* @return string
|
||||
*/
|
||||
public static function get_event_category_taxonomy(): string {
|
||||
return defined( 'EM_TAXONOMY_CATEGORY' ) ? constant( 'EM_TAXONOMY_CATEGORY' ) : 'event-categories';
|
||||
return \defined( 'EM_TAXONOMY_CATEGORY' ) ? constant( 'EM_TAXONOMY_CATEGORY' ) : 'event-categories';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ActivityPub transformer for a Events_Manager event post.
|
||||
*
|
||||
* @param \WP_Post $post The WordPress post object of the Event.
|
||||
* @param WP_Post $post The WordPress post object of the Event.
|
||||
* @return Events_Manager_Event_Transformer
|
||||
*/
|
||||
public static function get_activitypub_event_transformer( $post ): Events_Manager_Event_Transformer {
|
||||
public static function get_activitypub_event_transformer( WP_Post $post ): Events_Manager_Event_Transformer {
|
||||
return new Events_Manager_Event_Transformer( $post, self::get_event_category_taxonomy() );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user