refactoring setup class

This commit is contained in:
André Menrath 2024-09-10 18:39:26 +02:00
parent 69d2458ea8
commit ef858c91e0

View file

@ -228,6 +228,24 @@ class Setup {
return $transformer;
}
/**
* Activates ActivityPub support for all active event plugins event post-types.
*
* @since 1.0.0
*
* @return void
*/
public function activate_activitypub_support_for_active_event_plugins(): void {
// If someone installs this plugin, we simply enable ActivityPub support for all currently active event post types.
$activitypub_supported_post_types = get_option( 'activitypub_support_post_types', array() );
foreach ( $this->active_event_plugins as $event_plugin ) {
if ( ! in_array( $event_plugin['post_type'], $activitypub_supported_post_types, true ) ) {
$activitypub_supported_post_types[] = $event_plugin['post_type'];
}
}
update_option( 'activitypub_support_post_types', $activitypub_supported_post_types );
}
/**
* Activates the ActivityPub Event Extensions plugin.
*
@ -258,13 +276,7 @@ class Setup {
array( 'back_link' => true ),
);
}
// If someone installs this plugin, we simply enable ActivityPub support for all currently active event post types.
$activitypub_supported_post_types = get_option( 'activitypub_support_post_types', array() );
foreach ( $this->active_event_plugins as $event_plugin ) {
if ( ! in_array( $event_plugin['post_type'], $activitypub_supported_post_types, true ) ) {
$activitypub_supported_post_types[] = $event_plugin['post_type'];
}
}
update_option( 'activitypub_support_post_types', $activitypub_supported_post_types );
self::activate_activitypub_support_for_active_event_plugins();
}
}