PluginProbe
ActivityPub / 5.1.0
ActivityPub v5.1.0
9.3.1 9.3.0 9.2.2 9.2.1 9.2.0 9.1.0 9.0.2 9.0.1 9.0.0 8.3.0 8.2.1 8.2.0 8.1.1 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.2.0 1.3.0 2.0.0 2.0.1 2.1.0 2.1.1 All 160 releases
← All changes | integration/class-nodeinfo.php +20 -14 2.0.05.1.0 View file →
@@ -1,5 +1,11 @@
1 1 <?php
2 +/**
3 + * NodeInfo integration file.
4 + *
5 + * @package Activitypub
6 + */
7 +
2 8 namespace Activitypub\Integration;
3 9
4 10 use function Activitypub\get_total_users;
5 11 use function Activitypub\get_active_users;
@@ -5,30 +11,30 @@
5 11 use function Activitypub\get_active_users;
6 12 use function Activitypub\get_rest_url_by_path;
7 13
8 14 /**
9 - * Compatibility with the NodeInfo plugin
15 + * Compatibility with the NodeInfo plugin.
10 16 *
11 17 * @see https://wordpress.org/plugins/nodeinfo/
12 18 */
13 19 class Nodeinfo {
14 20 /**
15 - * Initialize the class, registering WordPress hooks
21 + * Initialize the class, registering WordPress hooks.
16 22 */
17 23 public static function init() {
18 24 \add_filter( 'nodeinfo_data', array( self::class, 'add_nodeinfo_data' ), 10, 2 );
19 - \add_filter( 'nodeinfo2_data', array( self::class, 'add_nodeinfo2_data' ), 10 );
25 + \add_filter( 'nodeinfo2_data', array( self::class, 'add_nodeinfo2_data' ) );
20 26
21 27 \add_filter( 'wellknown_nodeinfo_data', array( self::class, 'add_wellknown_nodeinfo_data' ), 10, 2 );
22 28 }
23 29
24 30 /**
25 - * Extend NodeInfo data
31 + * Extend NodeInfo data.
26 32 *
27 - * @param array $nodeinfo NodeInfo data
28 - * @param string The NodeInfo Version
33 + * @param array $nodeinfo NodeInfo data.
34 + * @param string $version The NodeInfo Version.
29 35 *
30 - * @return array The extended array
36 + * @return array The extended array.
31 37 */
32 38 public static function add_nodeinfo_data( $nodeinfo, $version ) {
33 39 if ( $version >= '2.0' ) {
34 40 $nodeinfo['protocols'][] = 'activitypub';
@@ -46,13 +52,13 @@
46 52 return $nodeinfo;
47 53 }
48 54
49 55 /**
50 - * Extend NodeInfo2 data
56 + * Extend NodeInfo2 data.
51 57 *
52 - * @param array $nodeinfo NodeInfo2 data
58 + * @param array $nodeinfo NodeInfo2 data.
53 59 *
54 - * @return array The extended array
60 + * @return array The extended array.
55 61 */
56 62 public static function add_nodeinfo2_data( $nodeinfo ) {
57 63 $nodeinfo['protocols'][] = 'activitypub';
58 64
@@ -65,17 +71,17 @@
65 71 return $nodeinfo;
66 72 }
67 73
68 74 /**
69 - * Extend the well-known nodeinfo data
75 + * Extend the well-known nodeinfo data.
70 76 *
71 - * @param array $data The well-known nodeinfo data
77 + * @param array $data The well-known nodeinfo data.
72 78 *
73 - * @return array The extended array
79 + * @return array The extended array.
74 80 */
75 81 public static function add_wellknown_nodeinfo_data( $data ) {
76 82 $data['links'][] = array(
77 - 'rel' => 'https://www.w3.org/ns/activitystreams#Application',
83 + 'rel' => 'https://www.w3.org/ns/activitystreams#Application',
78 84 'href' => get_rest_url_by_path( 'application' ),
79 85 );
80 86
81 87 return $data;