fix linter issues
All checks were successful
PHPUnit / PHPUnit – PHP 8.1 (push) Successful in 1m4s
PHPUnit / PHPUnit – PHP 8.2 (push) Successful in 1m0s
PHPUnit / PHPUnit – PHP 8.3 (push) Successful in 52s
PHP Code Checker / PHP Code Checker (pull_request) Successful in 41s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 57s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 1m3s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 58s

This commit is contained in:
André Menrath 2024-09-24 16:10:05 +02:00
parent 4febff50ef
commit 8fecbe792f
3 changed files with 19 additions and 5 deletions

View file

@ -59,14 +59,15 @@ class Setup {
* @since 1.0.0
*/
protected function __construct() {
$this->activitypub_plugin_is_active = defined( 'ACTIVITYPUB_PLUGIN_VERSION' ) || is_plugin_active( 'activitypub/activitypub.php' );
$this->activitypub_plugin_is_active = defined( 'ACTIVITYPUB_PLUGIN_VERSION' ) ||
is_plugin_active( 'activitypub/activitypub.php' );
// BeforeFirstRelease: decide whether we want to do anything at all when ActivityPub plugin is note active.
// if ( ! $this->activitypub_plugin_is_active ) {
// deactivate_plugins( ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_FILE );
// return;
// }.
$this->active_event_plugins = self::detect_active_event_plugins();
$this->activitypub_plugin_version = defined( 'ACTIVITYPUB_PLUGIN_VERSION' ) ? constant( 'ACTIVITYPUB_PLUGIN_VERSION' ): '0';
$this->activitypub_plugin_version = self::get_activitypub_plugin_version();
$this->setup_hooks();
}
@ -95,6 +96,19 @@ class Setup {
return self::$instance;
}
/**
* LooksUp the current version of the ActivityPub.
*
* @return string The semantic Version.
*/
private static function get_activitypub_plugin_version(): string {
if ( defined( 'ACTIVITYPUB_PLUGIN_VERSION' ) ) {
return constant( 'ACTIVITYPUB_PLUGIN_VERSION' );
}
$version = get_file_data( WP_PLUGIN_DIR . '/activitypub/activitypub.php', array( 'Version' ) )[0];
return $version ?? '0.0.0';
}
/**
* Getter function for the active event plugins.
*