@@ -49,15 +49,9 @@ public static function init() {
49
49
50
50
\add_action ( 'updated_postmeta ' , array ( self ::class, 'updated_postmeta ' ), 10 , 4 );
51
51
\add_action ( 'added_post_meta ' , array ( self ::class, 'updated_postmeta ' ), 10 , 4 );
52
- \add_filter ( 'pre_option_activitypub_actor_mode ' , array ( self ::class, 'pre_option_activitypub_actor_mode ' ) );
53
- \add_filter ( 'pre_option_activitypub_authorized_fetch ' , array ( self ::class, 'pre_option_activitypub_authorized_fetch ' ) );
54
- \add_filter ( 'pre_option_activitypub_shared_inbox ' , array ( self ::class, 'pre_option_activitypub_shared_inbox ' ) );
55
52
56
53
\add_action ( 'init ' , array ( self ::class, 'register_user_meta ' ), 11 );
57
54
58
- \add_filter ( 'pre_option_activitypub_allow_likes ' , array ( self ::class, 'maybe_disable_interactions ' ) );
59
- \add_filter ( 'pre_option_activitypub_allow_replies ' , array ( self ::class, 'maybe_disable_interactions ' ) );
60
-
61
55
// Register several post_types.
62
56
self ::register_post_types ();
63
57
@@ -96,37 +90,38 @@ public static function uninstall() {
96
90
\remove_filter ( 'pre_wp_update_comment_count_now ' , array ( Comment::class, 'pre_wp_update_comment_count_now ' ) );
97
91
Migration::update_comment_counts ( 2000 );
98
92
99
- delete_option ( 'activitypub_actor_mode ' );
100
- delete_option ( 'activitypub_allow_likes ' );
101
- delete_option ( 'activitypub_allow_replies ' );
102
- delete_option ( 'activitypub_attribution_domains ' );
103
- delete_option ( 'activitypub_authorized_fetch ' );
104
- delete_option ( 'activitypub_application_user_private_key ' );
105
- delete_option ( 'activitypub_application_user_public_key ' );
106
- delete_option ( 'activitypub_blog_user_also_known_as ' );
107
- delete_option ( 'activitypub_blog_user_moved_to ' );
108
- delete_option ( 'activitypub_blog_user_private_key ' );
109
- delete_option ( 'activitypub_blog_user_public_key ' );
110
- delete_option ( 'activitypub_blog_description ' );
111
- delete_option ( 'activitypub_blog_identifier ' );
112
- delete_option ( 'activitypub_custom_post_content ' );
113
- delete_option ( 'activitypub_db_version ' );
114
- delete_option ( 'activitypub_default_extra_fields ' );
115
- delete_option ( 'activitypub_enable_blog_user ' );
116
- delete_option ( 'activitypub_enable_users ' );
117
- delete_option ( 'activitypub_header_image ' );
118
- delete_option ( 'activitypub_last_post_with_permalink_as_id ' );
119
- delete_option ( 'activitypub_mailer_new_follower ' );
120
- delete_option ( 'activitypub_mailer_new_dm ' );
121
- delete_option ( 'activitypub_max_image_attachments ' );
122
- delete_option ( 'activitypub_migration_lock ' );
123
- delete_option ( 'activitypub_object_type ' );
124
- delete_option ( 'activitypub_outbox_purge_days ' );
125
- delete_option ( 'activitypub_shared_inbox ' );
126
- delete_option ( 'activitypub_support_post_types ' );
127
- delete_option ( 'activitypub_use_hashtags ' );
128
- delete_option ( 'activitypub_use_opengraph ' );
129
- delete_option ( 'activitypub_use_permalink_as_id_for_blog ' );
93
+ \delete_option ( 'activitypub_actor_mode ' );
94
+ \delete_option ( 'activitypub_allow_likes ' );
95
+ \delete_option ( 'activitypub_allow_replies ' );
96
+ \delete_option ( 'activitypub_attribution_domains ' );
97
+ \delete_option ( 'activitypub_authorized_fetch ' );
98
+ \delete_option ( 'activitypub_application_user_private_key ' );
99
+ \delete_option ( 'activitypub_application_user_public_key ' );
100
+ \delete_option ( 'activitypub_blog_user_also_known_as ' );
101
+ \delete_option ( 'activitypub_blog_user_moved_to ' );
102
+ \delete_option ( 'activitypub_blog_user_private_key ' );
103
+ \delete_option ( 'activitypub_blog_user_public_key ' );
104
+ \delete_option ( 'activitypub_blog_description ' );
105
+ \delete_option ( 'activitypub_blog_identifier ' );
106
+ \delete_option ( 'activitypub_custom_post_content ' );
107
+ \delete_option ( 'activitypub_db_version ' );
108
+ \delete_option ( 'activitypub_default_extra_fields ' );
109
+ \delete_option ( 'activitypub_enable_blog_user ' );
110
+ \delete_option ( 'activitypub_enable_users ' );
111
+ \delete_option ( 'activitypub_header_image ' );
112
+ \delete_option ( 'activitypub_last_post_with_permalink_as_id ' );
113
+ \delete_option ( 'activitypub_mailer_new_follower ' );
114
+ \delete_option ( 'activitypub_mailer_new_dm ' );
115
+ \delete_option ( 'activitypub_max_image_attachments ' );
116
+ \delete_option ( 'activitypub_migration_lock ' );
117
+ \delete_option ( 'activitypub_object_type ' );
118
+ \delete_option ( 'activitypub_outbox_purge_days ' );
119
+ \delete_option ( 'activitypub_shared_inbox ' );
120
+ \delete_option ( 'activitypub_support_post_types ' );
121
+ \delete_option ( 'activitypub_use_hashtags ' );
122
+ \delete_option ( 'activitypub_use_opengraph ' );
123
+ \delete_option ( 'activitypub_use_permalink_as_id_for_blog ' );
124
+ \delete_option ( 'activitypub_vary_header ' );
130
125
}
131
126
132
127
/**
@@ -209,7 +204,7 @@ public static function add_headers() {
209
204
if ( ! headers_sent () ) {
210
205
\header ( 'Link: < ' . esc_url ( $ id ) . '>; title="ActivityPub (JSON)"; rel="alternate"; type="application/activity+json" ' , false );
211
206
212
- if ( ACTIVITYPUB_SEND_VARY_HEADER ) {
207
+ if ( \get_option ( ' activitypub_vary_header ' ) ) {
213
208
// Send Vary header for Accept header.
214
209
\header ( 'Vary: Accept ' , false );
215
210
}
@@ -396,68 +391,6 @@ public static function pre_get_avatar_data( $args, $id_or_email ) {
396
391
return $ args ;
397
392
}
398
393
399
- /**
400
- * Pre-get option filter for the Actor-Mode.
401
- *
402
- * @param string|false $pre The pre-get option value.
403
- *
404
- * @return string|false The actor mode or false if it should not be filtered.
405
- */
406
- public static function pre_option_activitypub_actor_mode ( $ pre ) {
407
- if ( \defined ( 'ACTIVITYPUB_SINGLE_USER_MODE ' ) && ACTIVITYPUB_SINGLE_USER_MODE ) {
408
- return ACTIVITYPUB_BLOG_MODE ;
409
- }
410
-
411
- if ( \defined ( 'ACTIVITYPUB_DISABLE_USER ' ) && ACTIVITYPUB_DISABLE_USER ) {
412
- return ACTIVITYPUB_BLOG_MODE ;
413
- }
414
-
415
- if ( \defined ( 'ACTIVITYPUB_DISABLE_BLOG_USER ' ) && ACTIVITYPUB_DISABLE_BLOG_USER ) {
416
- return ACTIVITYPUB_ACTOR_MODE ;
417
- }
418
-
419
- return $ pre ;
420
- }
421
-
422
- /**
423
- * Pre-get option filter for the Authorized Fetch.
424
- *
425
- * @param string $pre The pre-get option value.
426
- *
427
- * @return string If the constant is defined, return the value, otherwise return the pre-get option value.
428
- */
429
- public static function pre_option_activitypub_authorized_fetch ( $ pre ) {
430
- if ( ! \defined ( 'ACTIVITYPUB_AUTHORIZED_FETCH ' ) ) {
431
- return $ pre ;
432
- }
433
-
434
- if ( ACTIVITYPUB_AUTHORIZED_FETCH ) {
435
- return '1 ' ;
436
- }
437
-
438
- return '0 ' ;
439
- }
440
-
441
- /**
442
- * Pre-get option filter for the Shared Inbox.
443
- *
444
- * @param string $pre The pre-get option value.
445
- *
446
- * @return string If the constant is defined, return the value, otherwise return the pre-get option value.
447
- */
448
- public static function pre_option_activitypub_shared_inbox ( $ pre ) {
449
- if ( ! \defined ( 'ACTIVITYPUB_SHARED_INBOX_FEATURE ' ) ) {
450
- return $ pre ;
451
- }
452
-
453
- if ( ACTIVITYPUB_SHARED_INBOX_FEATURE ) {
454
- return '1 ' ;
455
- }
456
-
457
- return '0 ' ;
458
- }
459
-
460
-
461
394
/**
462
395
* Store permalink in meta, to send delete Activity.
463
396
*
@@ -902,18 +835,4 @@ public static function register_user_meta() {
902
835
)
903
836
);
904
837
}
905
-
906
- /**
907
- * Disallow interactions if the constant is set.
908
- *
909
- * @param bool $pre_option The value of the option.
910
- * @return bool|string The value of the option.
911
- */
912
- public static function maybe_disable_interactions ( $ pre_option ) {
913
- if ( ACTIVITYPUB_DISABLE_INCOMING_INTERACTIONS ) {
914
- return '0 ' ;
915
- }
916
-
917
- return $ pre_option ;
918
- }
919
838
}
0 commit comments