Add most minimal setup wizard, welcome page with status and basic health checks #67

Merged
linos merged 6 commits from status_page into main 2024-10-19 16:46:51 +02:00
9 changed files with 39 additions and 40 deletions
Showing only changes of commit fdfdf6c0b2 - Show all commits

View file

@ -168,6 +168,12 @@ class Setup {
add_action( 'admin_init', array( $this, 'do_admin_notices' ) );
add_action( 'admin_init', array( Settings::class, 'register_settings' ) );
add_action( 'admin_enqueue_scripts', array( self::class, 'enqueue_styles' ) );
add_action( 'admin_menu', array( Settings_Page::class, 'admin_menu' ) );
add_filter(
'plugin_action_links_' . ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_BASENAME,
array( Settings_Page::class, 'settings_link' )
);
// If we don't have any active event plugins, or the ActivityPub plugin is not enabled, abort here.
if ( empty( $this->active_event_plugins ) || ! $this->activitypub_plugin_is_active ) {
@ -175,13 +181,6 @@ class Setup {
}
add_action( 'init', array( Health_Check::class, 'init' ) );
add_action( 'admin_enqueue_scripts', array( self::class, 'enqueue_styles' ) );
add_action( 'admin_menu', array( Settings_Page::class, 'admin_menu' ) );
add_filter(
'plugin_action_links_' . ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_BASENAME,
array( Settings_Page::class, 'settings_link' )
);
// Check if the minimum required version of the ActivityPub plugin is installed.
if ( ! version_compare( $this->activitypub_plugin_version, ACTIVITYPUB_EVENT_BRIDGE_ACTIVITYPUB_PLUGIN_MIN_VERSION ) ) {

View file

@ -45,12 +45,12 @@ abstract class Event_Plugin {
abstract public static function get_event_category_taxonomy(): string;
/**
* Returns the ID of the main settings page of the plugin.
* Returns the IDs of the admin pages of the plugin.
*
* @return string The settings page url.
* @return array The IDs of one or several admin/settings pages.
*/
public static function get_settings_page(): string {
return '';
public static function get_settings_pages(): array {
return array();
}
/**
@ -74,7 +74,7 @@ abstract class Event_Plugin {
// Check if we are on a edit page for the event, or on the settings page of the event plugin.
$is_event_plugins_edit_page = 'edit' === $screen->base && static::get_post_type() === $screen->post_type;
$is_event_plugins_settings_page = static::get_settings_page() === $screen->id;
$is_event_plugins_settings_page = in_array( $screen->id, static::get_settings_pages(), true);
return $is_event_plugins_edit_page || $is_event_plugins_settings_page;
}

View file

@ -41,12 +41,12 @@ final class Eventin extends Event_plugin {
}
/**
* Returns the ID of the main settings page of the plugin.
* Returns the IDs of the admin pages of the plugin.
*
* @return string The settings page url.
* @return array The settings page url.
*/
public static function get_settings_page(): string {
return 'eventin'; // Base always is wp-admin/admin.php?page=eventin.
public static function get_settings_pages(): array {
return array( 'eventin' ); // Base always is wp-admin/admin.php?page=eventin.
}
/**

View file

@ -41,12 +41,12 @@ final class Events_Manager extends Event_Plugin {
}
/**
* Returns the ID of the main settings page of the plugin.
* Returns the IDs of the admin pages of the plugin.
*
* @return string The settings page url.
* @return array The settings page urls.
*/
public static function get_settings_page(): string {
return 'wp-admin/edit.php?post_type=event&page=events-manager-options#general';
public static function get_settings_page(): array {
return array();
}
/**

View file

@ -41,12 +41,12 @@ final class GatherPress extends Event_Plugin {
}
/**
* Returns the ID of the main settings page of the plugin.
* Returns the IDs of the admin pages of the plugin.
*
* @return string The settings page url.
* @return array The settings page urls.
*/
public static function get_settings_page(): string {
return class_exists( '\GatherPress\Core\Utility' ) ? \GatherPress\Core\Utility::prefix_key( 'general' ) : 'gatherpress_general';
public static function get_settings_pages(): array {
return array( class_exists( '\GatherPress\Core\Utility' ) ? \GatherPress\Core\Utility::prefix_key( 'general' ) : 'gatherpress_general' );
}
/**

View file

@ -42,12 +42,12 @@ final class Modern_Events_Calendar_Lite extends Event_plugin {
}
/**
* Returns the ID of the main settings page of the plugin.
* Returns the IDs of the admin pages of the plugin.
*
* @return string The settings page url.
* @return array The settings page urls.
*/
public static function get_settings_page(): string {
return 'mec-event';
public static function get_settings_pages(): array {
return array( 'MEC-settings', 'MEC-support', 'MEC-ix', 'MEC-wizard', 'MEC-addons', 'mec-intro' );
}
/**

View file

@ -41,17 +41,17 @@ final class The_Events_Calendar extends Event_plugin {
}
/**
* Returns the ID of the main settings page of the plugin.
* Returns the IDs of the admin pages of the plugin.
*
* @return string The settings page url.
* @return array The settings page urls.
*/
public static function get_settings_page(): string {
public static function get_settings_pages(): array {
if ( class_exists( '\Tribe\Events\Admin\Settings' ) ) {
$page = \Tribe\Events\Admin\Settings::$settings_page_id;
} else {
$page = 'tec-events-settings';
}
return sprintf( 'edit.php?post_type=tribe_events&page=%s', $page );
return array( $page );
}
/**

View file

@ -44,12 +44,12 @@ final class VS_Event_List extends Event_Plugin {
}
/**
* Returns the ID of the main settings page of the plugin.
* Returns the IDs of the admin pages of the plugin.
*
* @return string The settings page url.
* @return array The settings page urls.
*/
public static function get_settings_page(): string {
return 'settings_page_vsel';
public static function get_settings_pages(): array {
return array( 'settings_page_vsel' );
}
/**

View file

@ -44,12 +44,12 @@ final class WP_Event_Manager extends Event_Plugin {
}
/**
* Returns the ID of the main settings page of the plugin.
* Returns the IDs of the admin pages of the plugin.
*
* @return string The settings page url.
* @return array The settings page urls.
*/
public static function get_settings_page(): string {
return 'event-manager-settings';
public static function get_settings_pages(): array {
return array( 'event-manager-settings' );
}
/**