9
9
10
10
use Activitypub \Activity \Activity ;
11
11
use Activitypub \Collection \Actors ;
12
+ use Activitypub \Collection \Extra_Fields ;
13
+ use Activitypub \Collection \Followers ;
12
14
use Activitypub \Collection \Inbox ;
13
15
use Activitypub \Collection \Outbox ;
14
- use Activitypub \Collection \Followers ;
15
- use Activitypub \Collection \Extra_Fields ;
16
16
17
17
/**
18
18
* ActivityPub Class.
@@ -24,41 +24,34 @@ class Activitypub {
24
24
* Initialize the class, registering WordPress hooks.
25
25
*/
26
26
public static function init () {
27
+ \add_action ( 'init ' , array ( self ::class, 'add_rewrite_rules ' ), 11 );
28
+ \add_action ( 'init ' , array ( self ::class, 'theme_compat ' ), 11 );
29
+ \add_action ( 'init ' , array ( self ::class, 'register_user_meta ' ), 11 );
30
+ \add_action ( 'init ' , array ( self ::class, 'register_post_types ' ), 11 );
31
+ \add_action ( 'init ' , array ( self ::class, 'register_oembed_providers ' ), 11 );
32
+
27
33
\add_filter ( 'template_include ' , array ( self ::class, 'render_activitypub_template ' ), 99 );
28
34
\add_action ( 'template_redirect ' , array ( self ::class, 'template_redirect ' ) );
29
35
\add_filter ( 'redirect_canonical ' , array ( self ::class, 'redirect_canonical ' ), 10 , 2 );
30
36
\add_filter ( 'redirect_canonical ' , array ( self ::class, 'no_trailing_redirect ' ), 10 , 2 );
31
37
\add_filter ( 'query_vars ' , array ( self ::class, 'add_query_vars ' ) );
32
38
\add_filter ( 'pre_get_avatar_data ' , array ( self ::class, 'pre_get_avatar_data ' ), 11 , 2 );
33
39
34
- // Add support for ActivityPub to custom post types.
35
- $ post_types = \get_option ( 'activitypub_support_post_types ' , array ( 'post ' ) );
36
-
37
- foreach ( $ post_types as $ post_type ) {
38
- \add_post_type_support ( $ post_type , 'activitypub ' );
39
- }
40
-
41
40
\add_action ( 'wp_trash_post ' , array ( self ::class, 'trash_post ' ), 1 );
42
41
\add_action ( 'untrash_post ' , array ( self ::class, 'untrash_post ' ), 1 );
43
42
44
- \add_action ( 'init ' , array ( self ::class, 'add_rewrite_rules ' ), 11 );
45
- \add_action ( 'init ' , array ( self ::class, 'theme_compat ' ), 11 );
46
-
47
43
\add_action ( 'user_register ' , array ( self ::class, 'user_register ' ) );
48
44
49
- \add_filter ( 'activitypub_get_actor_extra_fields ' , array ( Extra_Fields::class, 'default_actor_extra_fields ' ), 10 , 2 );
50
-
51
45
\add_filter ( 'add_post_metadata ' , array ( self ::class, 'prevent_empty_post_meta ' ), 10 , 4 );
52
46
\add_filter ( 'update_post_metadata ' , array ( self ::class, 'prevent_empty_post_meta ' ), 10 , 4 );
53
47
\add_filter ( 'default_post_metadata ' , array ( self ::class, 'default_post_metadata ' ), 10 , 3 );
54
48
55
- \add_action ( 'init ' , array ( self ::class, 'register_user_meta ' ), 11 );
56
-
57
- // Register several post_types.
58
- self ::register_post_types ();
49
+ \add_filter ( 'activitypub_get_actor_extra_fields ' , array ( Extra_Fields::class, 'default_actor_extra_fields ' ), 10 , 2 );
59
50
60
- self ::register_oembed_providers ();
61
- Embed::init ();
51
+ // Add support for ActivityPub to custom post types.
52
+ foreach ( \get_option ( 'activitypub_support_post_types ' , array ( 'post ' ) ) as $ post_type ) {
53
+ \add_post_type_support ( $ post_type , 'activitypub ' );
54
+ }
62
55
}
63
56
64
57
/**
@@ -449,7 +442,7 @@ public static function theme_compat() {
449
442
/**
450
443
* Register Custom Post Types.
451
444
*/
452
- private static function register_post_types () {
445
+ public static function register_post_types () {
453
446
\register_post_type (
454
447
Actors::POST_TYPE ,
455
448
array (
0 commit comments