do not load NodeInfo class if blog is private
This commit is contained in:
parent
827aacc450
commit
2a1cc45124
2 changed files with 8 additions and 7 deletions
|
@ -52,8 +52,11 @@ function init() {
|
|||
require_once \dirname( __FILE__ ) . '/includes/rest/class-webfinger.php';
|
||||
\Activitypub\Rest\Webfinger::init();
|
||||
|
||||
require_once \dirname( __FILE__ ) . '/includes/rest/class-nodeinfo.php';
|
||||
\Activitypub\Rest\NodeInfo::init();
|
||||
// load NodeInfo endpoints only if blog is public
|
||||
if ( 1 === get_option( 'blog_public', 1 ) ) {
|
||||
require_once \dirname( __FILE__ ) . '/includes/rest/class-nodeinfo.php';
|
||||
\Activitypub\Rest\NodeInfo::init();
|
||||
}
|
||||
|
||||
require_once \dirname( __FILE__ ) . '/includes/class-admin.php';
|
||||
\Activitypub\Admin::init();
|
||||
|
|
|
@ -13,11 +13,9 @@ class Nodeinfo {
|
|||
* Initialize the class, registering WordPress hooks
|
||||
*/
|
||||
public static function init() {
|
||||
if ( 1 === get_option( 'blog_public', 1 ) ) {
|
||||
\add_action( 'rest_api_init', array( '\Activitypub\Rest\Nodeinfo', 'register_routes' ) );
|
||||
\add_filter( 'nodeinfo_data', array( '\Activitypub\Rest\Nodeinfo', 'add_nodeinfo_discovery' ), 10, 2 );
|
||||
\add_filter( 'nodeinfo2_data', array( '\Activitypub\Rest\Nodeinfo', 'add_nodeinfo2_discovery' ), 10 );
|
||||
}
|
||||
\add_action( 'rest_api_init', array( '\Activitypub\Rest\Nodeinfo', 'register_routes' ) );
|
||||
\add_filter( 'nodeinfo_data', array( '\Activitypub\Rest\Nodeinfo', 'add_nodeinfo_discovery' ), 10, 2 );
|
||||
\add_filter( 'nodeinfo2_data', array( '\Activitypub\Rest\Nodeinfo', 'add_nodeinfo2_discovery' ), 10 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue