Skip to content

Commit 3c7475c

Browse files
committed
Call integrations directly instead of hooking on init
Integrations only register filters, so they don't need to wait for the init hook. This removes the need for priority handling.
1 parent bfd0ed5 commit 3c7475c

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

includes/class-nodeinfo.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,30 @@ public function init() {
6363
return;
6464
}
6565

66+
$this->register_integrations();
6667
$this->register_hooks();
6768
$this->register_admin_hooks();
6869

6970
$this->initialized = true;
7071
}
7172

73+
/**
74+
* Register NodeInfo version integrations.
75+
*
76+
* These only register filters, so they can be called directly.
77+
*/
78+
public function register_integrations() {
79+
Nodeinfo10::init();
80+
Nodeinfo11::init();
81+
Nodeinfo20::init();
82+
Nodeinfo21::init();
83+
Nodeinfo22::init();
84+
}
85+
7286
/**
7387
* Register hooks.
7488
*/
7589
public function register_hooks() {
76-
// Initialize NodeInfo version integrations.
77-
\add_action( 'init', array( Nodeinfo10::class, 'init' ), 9 );
78-
\add_action( 'init', array( Nodeinfo11::class, 'init' ), 9 );
79-
\add_action( 'init', array( Nodeinfo20::class, 'init' ), 9 );
80-
\add_action( 'init', array( Nodeinfo21::class, 'init' ), 9 );
81-
\add_action( 'init', array( Nodeinfo22::class, 'init' ), 9 );
82-
8390
// Register REST routes.
8491
\add_action( 'rest_api_init', array( $this, 'register_routes' ) );
8592

0 commit comments

Comments
 (0)