updated plugin ActivityPub
version 3.3.3
This commit is contained in:
@ -1,4 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* NodeInfo integration file.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
namespace Activitypub\Integration;
|
||||
|
||||
use function Activitypub\get_total_users;
|
||||
@ -6,28 +12,28 @@ use function Activitypub\get_active_users;
|
||||
use function Activitypub\get_rest_url_by_path;
|
||||
|
||||
/**
|
||||
* Compatibility with the NodeInfo plugin
|
||||
* Compatibility with the NodeInfo plugin.
|
||||
*
|
||||
* @see https://wordpress.org/plugins/nodeinfo/
|
||||
*/
|
||||
class Nodeinfo {
|
||||
/**
|
||||
* Initialize the class, registering WordPress hooks
|
||||
* Initialize the class, registering WordPress hooks.
|
||||
*/
|
||||
public static function init() {
|
||||
\add_filter( 'nodeinfo_data', array( self::class, 'add_nodeinfo_data' ), 10, 2 );
|
||||
\add_filter( 'nodeinfo2_data', array( self::class, 'add_nodeinfo2_data' ), 10 );
|
||||
\add_filter( 'nodeinfo2_data', array( self::class, 'add_nodeinfo2_data' ) );
|
||||
|
||||
\add_filter( 'wellknown_nodeinfo_data', array( self::class, 'add_wellknown_nodeinfo_data' ), 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend NodeInfo data
|
||||
* Extend NodeInfo data.
|
||||
*
|
||||
* @param array $nodeinfo NodeInfo data
|
||||
* @param string The NodeInfo Version
|
||||
* @param array $nodeinfo NodeInfo data.
|
||||
* @param string $version The NodeInfo Version.
|
||||
*
|
||||
* @return array The extended array
|
||||
* @return array The extended array.
|
||||
*/
|
||||
public static function add_nodeinfo_data( $nodeinfo, $version ) {
|
||||
if ( $version >= '2.0' ) {
|
||||
@ -47,11 +53,11 @@ class Nodeinfo {
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend NodeInfo2 data
|
||||
* Extend NodeInfo2 data.
|
||||
*
|
||||
* @param array $nodeinfo NodeInfo2 data
|
||||
* @param array $nodeinfo NodeInfo2 data.
|
||||
*
|
||||
* @return array The extended array
|
||||
* @return array The extended array.
|
||||
*/
|
||||
public static function add_nodeinfo2_data( $nodeinfo ) {
|
||||
$nodeinfo['protocols'][] = 'activitypub';
|
||||
@ -66,15 +72,15 @@ class Nodeinfo {
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend the well-known nodeinfo data
|
||||
* Extend the well-known nodeinfo data.
|
||||
*
|
||||
* @param array $data The well-known nodeinfo data
|
||||
* @param array $data The well-known nodeinfo data.
|
||||
*
|
||||
* @return array The extended array
|
||||
* @return array The extended array.
|
||||
*/
|
||||
public static function add_wellknown_nodeinfo_data( $data ) {
|
||||
$data['links'][] = array(
|
||||
'rel' => 'https://www.w3.org/ns/activitystreams#Application',
|
||||
'rel' => 'https://www.w3.org/ns/activitystreams#Application',
|
||||
'href' => get_rest_url_by_path( 'application' ),
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user