improve warning notices when event post type is not enabled for activitypub
Some checks failed
Some checks failed
This commit is contained in:
parent
127df329b6
commit
fdfdf6c0b2
9 changed files with 39 additions and 40 deletions
|
@ -168,6 +168,12 @@ class Setup {
|
||||||
|
|
||||||
add_action( 'admin_init', array( $this, 'do_admin_notices' ) );
|
add_action( 'admin_init', array( $this, 'do_admin_notices' ) );
|
||||||
add_action( 'admin_init', array( Settings::class, 'register_settings' ) );
|
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 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 ) {
|
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( '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.
|
// 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 ) ) {
|
if ( ! version_compare( $this->activitypub_plugin_version, ACTIVITYPUB_EVENT_BRIDGE_ACTIVITYPUB_PLUGIN_MIN_VERSION ) ) {
|
||||||
|
|
|
@ -45,12 +45,12 @@ abstract class Event_Plugin {
|
||||||
abstract public static function get_event_category_taxonomy(): string;
|
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 {
|
public static function get_settings_pages(): array {
|
||||||
return '';
|
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.
|
// 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_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;
|
return $is_event_plugins_edit_page || $is_event_plugins_settings_page;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
public static function get_settings_pages(): array {
|
||||||
return 'eventin'; // Base always is wp-admin/admin.php?page=eventin.
|
return array( 'eventin' ); // Base always is wp-admin/admin.php?page=eventin.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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 {
|
public static function get_settings_page(): array {
|
||||||
return 'wp-admin/edit.php?post_type=event&page=events-manager-options#general';
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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 {
|
public static function get_settings_pages(): array {
|
||||||
return class_exists( '\GatherPress\Core\Utility' ) ? \GatherPress\Core\Utility::prefix_key( 'general' ) : 'gatherpress_general';
|
return array( class_exists( '\GatherPress\Core\Utility' ) ? \GatherPress\Core\Utility::prefix_key( 'general' ) : 'gatherpress_general' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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 {
|
public static function get_settings_pages(): array {
|
||||||
return 'mec-event';
|
return array( 'MEC-settings', 'MEC-support', 'MEC-ix', 'MEC-wizard', 'MEC-addons', 'mec-intro' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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' ) ) {
|
if ( class_exists( '\Tribe\Events\Admin\Settings' ) ) {
|
||||||
$page = \Tribe\Events\Admin\Settings::$settings_page_id;
|
$page = \Tribe\Events\Admin\Settings::$settings_page_id;
|
||||||
} else {
|
} else {
|
||||||
$page = 'tec-events-settings';
|
$page = 'tec-events-settings';
|
||||||
}
|
}
|
||||||
return sprintf( 'edit.php?post_type=tribe_events&page=%s', $page );
|
return array( $page );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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 {
|
public static function get_settings_pages(): array {
|
||||||
return 'settings_page_vsel';
|
return array( 'settings_page_vsel' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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 {
|
public static function get_settings_pages(): array {
|
||||||
return 'event-manager-settings';
|
return array( 'event-manager-settings' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue