| @@ -25,9 +25,9 @@ | ||
| 25 | 25 | public static function init() { |
| 26 | 26 | \add_filter( 'nodeinfo_data', array( self::class, 'add_nodeinfo_data' ), 10, 2 ); |
| 27 | 27 | \add_filter( 'nodeinfo2_data', array( self::class, 'add_nodeinfo2_data' ) ); |
| 28 | 28 | |
| 29 | - \add_filter( 'nodeinfo_discovery', array( self::class, 'add_wellknown_nodeinfo_data' ) ); | |
| 29 | + \add_filter( 'wellknown_nodeinfo_data', array( self::class, 'add_wellknown_nodeinfo_data' ) ); | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Extend NodeInfo data. |
| @@ -37,9 +37,9 @@ | ||
| 37 | 37 | * |
| 38 | 38 | * @return array The extended array. |
| 39 | 39 | */ |
| 40 | 40 | public static function add_nodeinfo_data( $nodeinfo, $version ) { |
| 41 | - $nodeinfo = \wp_parse_args( | |
| 41 | + $nodeinfo = wp_parse_args( | |
| 42 | 42 | $nodeinfo, |
| 43 | 43 | array( |
| 44 | 44 | 'version' => $version, |
| 45 | 45 | 'software' => array(), |
| @@ -65,17 +65,8 @@ | ||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $nodeinfo['protocols'][] = 'activitypub'; |
| 68 | 68 | |
| 69 | - $nodeinfo['services']['inbound'] = \array_merge( | |
| 70 | - $nodeinfo['services']['inbound'], | |
| 71 | - array( 'gnusocial' ) | |
| 72 | - ); | |
| 73 | - $nodeinfo['services']['outbound'] = \array_merge( | |
| 74 | - $nodeinfo['services']['outbound'], | |
| 75 | - array( 'friendica', 'gnusocial', 'mediagoblin', 'wordpress' ) | |
| 76 | - ); | |
| 77 | - | |
| 78 | 69 | $nodeinfo['usage']['users'] = array( |
| 79 | 70 | 'total' => get_total_users(), |
| 80 | 71 | 'activeMonth' => get_active_users(), |
| 81 | 72 | 'activeHalfyear' => get_active_users( 6 ), |
| @@ -83,8 +74,11 @@ | ||
| 83 | 74 | |
| 84 | 75 | $nodeinfo['metadata']['federation'] = array( 'enabled' => true ); |
| 85 | 76 | $nodeinfo['metadata']['staffAccounts'] = self::get_staff(); |
| 86 | 77 | |
| 78 | + $nodeinfo['services']['inbound'][] = 'activitypub'; | |
| 79 | + $nodeinfo['services']['outbound'][] = 'activitypub'; | |
| 80 | + | |
| 87 | 81 | return $nodeinfo; |
| 88 | 82 | } |
| 89 | 83 | |
| 90 | 84 | /** |
| @@ -128,18 +122,22 @@ | ||
| 128 | 122 | * @return array List of staff accounts in WebFinger resource format. |
| 129 | 123 | */ |
| 130 | 124 | private static function get_staff() { |
| 131 | 125 | // Get all admin users with the cap activitypub. |
| 132 | - $admins = \get_users( | |
| 126 | + $admins = get_users( | |
| 133 | 127 | array( |
| 134 | 128 | 'role' => 'administrator', |
| 135 | 129 | 'orderby' => 'ID', |
| 136 | 130 | 'order' => 'ASC', |
| 137 | 131 | 'cap' => 'activitypub', |
| 138 | - 'fields' => 'ID', | |
| 132 | + 'fields' => array( 'ID' ), | |
| 139 | 133 | ) |
| 140 | 134 | ); |
| 141 | - $admins = \array_map( array( Webfinger::class, 'get_user_resource' ), $admins ); | |
| 142 | 135 | |
| 143 | - return \array_values( \array_filter( $admins ) ); | |
| 136 | + return array_map( | |
| 137 | + function ( $user ) { | |
| 138 | + return Webfinger::get_user_resource( $user->ID ); | |
| 139 | + }, | |
| 140 | + $admins | |
| 141 | + ); | |
| 144 | 142 | } |
| 145 | 143 | } |