Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 79b9b35

Browse files
authoredMay 21, 2025··
Remove deprecated functions, filters and actions (#1723)
1 parent 9388a97 commit 79b9b35

File tree

11 files changed

+4
-373
lines changed

11 files changed

+4
-373
lines changed
 
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: major
2+
Type: removed
3+
4+
Cleaned up the codebase and removed deprecated functions.

‎activitypub.php

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -150,57 +150,3 @@ function activation_redirect( $plugin ) {
150150
'uninstall',
151151
)
152152
);
153-
154-
155-
/**
156-
* `get_plugin_data` wrapper.
157-
*
158-
* @deprecated 4.2.0 Use `get_plugin_data` instead.
159-
*
160-
* @param array $default_headers Optional. The default plugin headers. Default empty array.
161-
* @return array The plugin metadata array.
162-
*/
163-
function get_plugin_meta( $default_headers = array() ) {
164-
_deprecated_function( __FUNCTION__, '4.2.0', 'get_plugin_data' );
165-
166-
if ( ! $default_headers ) {
167-
$default_headers = array(
168-
'Name' => 'Plugin Name',
169-
'PluginURI' => 'Plugin URI',
170-
'Version' => 'Version',
171-
'Description' => 'Description',
172-
'Author' => 'Author',
173-
'AuthorURI' => 'Author URI',
174-
'TextDomain' => 'Text Domain',
175-
'DomainPath' => 'Domain Path',
176-
'Network' => 'Network',
177-
'RequiresWP' => 'Requires at least',
178-
'RequiresPHP' => 'Requires PHP',
179-
'UpdateURI' => 'Update URI',
180-
);
181-
}
182-
183-
return \get_file_data( __FILE__, $default_headers, 'plugin' );
184-
}
185-
186-
/**
187-
* Plugin Version Number used for caching.
188-
*
189-
* @deprecated 4.2.0 Use constant ACTIVITYPUB_PLUGIN_VERSION directly.
190-
*/
191-
function get_plugin_version() {
192-
_deprecated_function( __FUNCTION__, '4.2.0', 'ACTIVITYPUB_PLUGIN_VERSION' );
193-
194-
return ACTIVITYPUB_PLUGIN_VERSION;
195-
}
196-
197-
// Check for CLI env, to add the CLI commands.
198-
if ( defined( 'WP_CLI' ) && WP_CLI ) {
199-
WP_CLI::add_command(
200-
'activitypub',
201-
'\Activitypub\Cli',
202-
array(
203-
'shortdesc' => 'ActivityPub related commands to manage plugin functionality and the federation of posts and comments.',
204-
)
205-
);
206-
}

‎includes/class-comment.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -563,19 +563,6 @@ public static function get_comment_type_slugs() {
563563
return array_keys( self::get_comment_types() );
564564
}
565565

566-
/**
567-
* Return the registered custom comment type slugs.
568-
*
569-
* @deprecated 4.5.0 Use get_comment_type_slugs instead.
570-
*
571-
* @return array The registered custom comment type slugs.
572-
*/
573-
public static function get_comment_type_names() {
574-
_deprecated_function( __METHOD__, '4.5.0', 'get_comment_type_slugs' );
575-
576-
return self::get_comment_type_slugs();
577-
}
578-
579566
/**
580567
* Get the custom comment type.
581568
*

‎includes/class-dispatcher.php

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -45,29 +45,6 @@ public static function init() {
4545
\add_filter( 'activitypub_additional_inboxes', array( self::class, 'add_inboxes_by_mentioned_actors' ), 10, 3 );
4646
\add_filter( 'activitypub_additional_inboxes', array( self::class, 'add_inboxes_of_replied_urls' ), 10, 3 );
4747
\add_filter( 'activitypub_additional_inboxes', array( self::class, 'add_inboxes_of_relays' ), 10, 3 );
48-
49-
// Fallback for `activitypub_send_to_inboxes` filter.
50-
\add_filter(
51-
'activitypub_additional_inboxes',
52-
function ( $inboxes, $actor_id, $activity ) {
53-
/**
54-
* Filters the list of interactees inboxes to send the Activity to.
55-
*
56-
* @param array $inboxes The list of inboxes to send to.
57-
* @param int $actor_id The actor ID.
58-
* @param Activity $activity The ActivityPub Activity.
59-
*
60-
* @deprecated 5.2.0 Use `activitypub_additional_inboxes` instead.
61-
* @deprecated 5.4.0 Use `activitypub_additional_inboxes` instead.
62-
*/
63-
$inboxes = \apply_filters_deprecated( 'activitypub_send_to_inboxes', array( $inboxes, $actor_id, $activity ), '5.2.0', 'activitypub_additional_inboxes' );
64-
$inboxes = \apply_filters_deprecated( 'activitypub_interactees_inboxes', array( $inboxes, $actor_id, $activity ), '5.4.0', 'activitypub_additional_inboxes' );
65-
66-
return $inboxes;
67-
},
68-
10,
69-
3
70-
);
7148
}
7249

7350
/**
@@ -364,23 +341,6 @@ public static function add_inboxes_of_replied_urls( $inboxes, $actor_id, $activi
364341
return $inboxes;
365342
}
366343

367-
/**
368-
* Adds Blog Actor inboxes to Updates so the Blog User's followers are notified of edits.
369-
*
370-
* @deprecated 5.2.0 Use {@see Followers::maybe_add_inboxes_of_blog_user} instead.
371-
*
372-
* @param array $inboxes The list of Inboxes.
373-
* @param int $actor_id The WordPress Actor-ID.
374-
* @param Activity $activity The ActivityPub Activity.
375-
*
376-
* @return array The filtered Inboxes.
377-
*/
378-
public static function maybe_add_inboxes_of_blog_user( $inboxes, $actor_id, $activity ) { // phpcs:ignore
379-
_deprecated_function( __METHOD__, '5.2.0', 'Followers::maybe_add_inboxes_of_blog_user' );
380-
381-
return $inboxes;
382-
}
383-
384344
/**
385345
* Check if passed Activity is public.
386346
*

‎includes/class-migration.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,6 @@ public static function init() {
3030
self::maybe_migrate();
3131
}
3232

33-
/**
34-
* Get the target version.
35-
*
36-
* This is the version that the database structure will be updated to.
37-
* It is the same as the plugin version.
38-
*
39-
* @deprecated 4.2.0 Use constant ACTIVITYPUB_PLUGIN_VERSION directly.
40-
*
41-
* @return string The target version.
42-
*/
43-
public static function get_target_version() {
44-
_deprecated_function( __FUNCTION__, '4.2.0', 'ACTIVITYPUB_PLUGIN_VERSION' );
45-
46-
return ACTIVITYPUB_PLUGIN_VERSION;
47-
}
48-
4933
/**
5034
* The current version of the database structure.
5135
*

‎includes/collection/class-users.php

Lines changed: 0 additions & 78 deletions
This file was deleted.

‎includes/functions.php

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -370,16 +370,6 @@ function user_can_activitypub( $user_id ) {
370370
$enabled = \user_can( $user_id, 'activitypub' );
371371
}
372372

373-
/**
374-
* Allow plugins to disable users for ActivityPub.
375-
*
376-
* @deprecated 5.7.0 Use the `activitypub_user_can_activitypub` filter instead.
377-
*
378-
* @param boolean $disabled True if the user is disabled, false otherwise.
379-
* @param int $user_id The user ID.
380-
*/
381-
$enabled = ! \apply_filters_deprecated( 'activitypub_is_user_disabled', array( ! $enabled, $user_id ), '5.7.0', 'activitypub_user_can_activitypub' );
382-
383373
/**
384374
* Allow plugins to enable/disable users for ActivityPub.
385375
*
@@ -389,21 +379,6 @@ function user_can_activitypub( $user_id ) {
389379
return apply_filters( 'activitypub_user_can_activitypub', $enabled, $user_id );
390380
}
391381

392-
/**
393-
* This function checks if a user is disabled for ActivityPub.
394-
*
395-
* @deprecated 5.7.0 Use the `user_can_activitypub` function instead.
396-
*
397-
* @param int $user_id The user ID.
398-
*
399-
* @return boolean True if the user is disabled, false otherwise.
400-
*/
401-
function is_user_disabled( $user_id ) {
402-
_deprecated_function( __FUNCTION__, 'unreleased', 'user_can_activitypub' );
403-
404-
return ! user_can_activitypub( $user_id );
405-
}
406-
407382
/**
408383
* Checks if a User-Type is disabled for ActivityPub.
409384
*

‎includes/transformer/class-base.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -246,28 +246,6 @@ public function to_activity( $type ) {
246246
protected function get_locale() {
247247
$lang = \strtolower( \strtok( \get_locale(), '_-' ) );
248248

249-
if ( $this->item instanceof \WP_Post ) {
250-
/**
251-
* Deprecates the `activitypub_post_locale` filter.
252-
*
253-
* @param string $lang The locale of the post.
254-
* @param mixed $item The post object.
255-
*
256-
* @return string The filtered locale of the post.
257-
*/
258-
$lang = apply_filters_deprecated(
259-
'activitypub_post_locale',
260-
array(
261-
$lang,
262-
$this->item->ID,
263-
$this->item,
264-
),
265-
'5.4.0',
266-
'activitypub_locale',
267-
'Use the `activitypub_locale` filter instead.'
268-
);
269-
}
270-
271249
/**
272250
* Filter the locale of the post.
273251
*

‎tests/includes/class-test-comment.php

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -525,34 +525,6 @@ public function test_get_comment_type_slugs() {
525525
$this->assertEquals( count( $slugs ), count( array_unique( $slugs ) ) );
526526
}
527527

528-
/**
529-
* Test get_comment_type_names to maintain backwards compatibility.
530-
*
531-
* @covers ::get_comment_type_names
532-
*/
533-
public function test_get_comment_type_names() {
534-
$this->setExpectedDeprecated( 'Activitypub\Comment::get_comment_type_names' );
535-
536-
// Get both types of results.
537-
$names = Comment::get_comment_type_names();
538-
$slugs = Comment::get_comment_type_slugs();
539-
540-
// Test that we get an array.
541-
$this->assertIsArray( $names );
542-
543-
// Test that the array is not empty.
544-
$this->assertNotEmpty( $names );
545-
546-
// Test that it returns exactly the same as get_comment_type_slugs().
547-
$this->assertEquals( $slugs, $names );
548-
549-
// Verify it returns slugs and not singular names.
550-
$this->assertContains( 'repost', $names );
551-
$this->assertContains( 'like', $names );
552-
$this->assertNotContains( 'Repost', $names );
553-
$this->assertNotContains( 'Like', $names );
554-
}
555-
556528
/**
557529
* Test object_id_to_comment method.
558530
*

‎tests/includes/class-test-dispatcher.php

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -39,54 +39,6 @@ public function tear_down() {
3939
parent::tear_down();
4040
}
4141

42-
/**
43-
* Test maybe_add_inboxes_of_blog_user when actor mode is not ACTIVITYPUB_ACTOR_AND_BLOG_MODE
44-
*
45-
* @covers ::maybe_add_inboxes_of_blog_user
46-
* @expectedDeprecated Activitypub\Dispatcher::maybe_add_inboxes_of_blog_user
47-
*/
48-
public function test_maybe_add_inboxes_of_blog_user_wrong_mode() {
49-
\update_option( 'activitypub_actor_mode', ACTIVITYPUB_BLOG_MODE );
50-
51-
$inboxes = array( 'https://example.com/inbox' );
52-
$activity = $this->createMock( Activity::class );
53-
54-
$result = Dispatcher::maybe_add_inboxes_of_blog_user( $inboxes, 1, $activity );
55-
$this->assertEquals( $inboxes, $result );
56-
}
57-
58-
/**
59-
* Test maybe_add_inboxes_of_blog_user when actor is blog user
60-
*
61-
* @covers ::maybe_add_inboxes_of_blog_user
62-
* @expectedDeprecated Activitypub\Dispatcher::maybe_add_inboxes_of_blog_user
63-
*/
64-
public function test_maybe_add_inboxes_of_blog_user_is_blog_user() {
65-
\update_option( 'activitypub_actor_mode', ACTIVITYPUB_ACTOR_AND_BLOG_MODE );
66-
67-
$inboxes = array( 'https://example.com/inbox' );
68-
$activity = $this->createMock( Activity::class );
69-
70-
$result = Dispatcher::maybe_add_inboxes_of_blog_user( $inboxes, Actors::BLOG_USER_ID, $activity );
71-
$this->assertEquals( $inboxes, $result );
72-
}
73-
74-
/**
75-
* Test maybe_add_inboxes_of_blog_user when activity type is not Update
76-
*
77-
* @covers ::maybe_add_inboxes_of_blog_user
78-
* @expectedDeprecated Activitypub\Dispatcher::maybe_add_inboxes_of_blog_user
79-
*/
80-
public function test_maybe_add_inboxes_of_blog_user_not_update() {
81-
\update_option( 'activitypub_actor_mode', ACTIVITYPUB_ACTOR_AND_BLOG_MODE );
82-
83-
$inboxes = array( 'https://example.com/inbox' );
84-
$activity = $this->get_activity_mock();
85-
86-
$result = Dispatcher::maybe_add_inboxes_of_blog_user( $inboxes, 1, $activity );
87-
$this->assertEquals( $inboxes, $result );
88-
}
89-
9042
/**
9143
* Tests send_to_followers.
9244
*
@@ -129,29 +81,6 @@ public function test_process_outbox() {
12981
remove_filter( 'activitypub_send_activity_to_followers', $test_callback );
13082
}
13183

132-
/**
133-
* Test that the deprecated filter activitypub_send_to_inboxes is still working.
134-
* This test can be removed when the filter is removed.
135-
*
136-
* @covers ::maybe_add_inboxes_of_blog_user
137-
* @expectedDeprecated activitypub_interactees_inboxes
138-
*/
139-
public function test_deprecated_filter() {
140-
add_filter(
141-
'activitypub_interactees_inboxes',
142-
function ( $inboxes ) {
143-
$inboxes[] = 'https://example.com/inbox';
144-
145-
return $inboxes;
146-
}
147-
);
148-
149-
$inboxes = apply_filters( 'activitypub_additional_inboxes', array(), 1, $this->get_activity_mock() );
150-
$this->assertContains( 'https://example.com/inbox', $inboxes );
151-
152-
remove_all_filters( 'activitypub_interactees_inboxes' );
153-
}
154-
15584
/**
15685
* Data provider for test_send_to_inboxes.
15786
*

‎tests/includes/collection/class-test-actors.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -66,32 +66,6 @@ function ( $url ) {
6666
$this->assertInstanceOf( $expected, $actors );
6767
}
6868

69-
/**
70-
* Test deprecated get_by_various.
71-
*
72-
* @dataProvider the_resource_provider
73-
* @covers ::get_by_resource
74-
* @expectedDeprecated Activitypub\Collection\Users::get_by_resource
75-
*
76-
* @param string $item The resource.
77-
* @param string $expected The expected class.
78-
*/
79-
public function test_deprecated_get_by_various( $item, $expected ) {
80-
$path = wp_parse_url( $item, PHP_URL_PATH ) ?? '';
81-
82-
if ( str_starts_with( $path, '/blog/' ) ) {
83-
add_filter(
84-
'home_url',
85-
function () {
86-
return 'http://example.org/blog/';
87-
}
88-
);
89-
}
90-
91-
$users = \Activitypub\Collection\Users::get_by_resource( $item );
92-
$this->assertInstanceOf( $expected, $users );
93-
}
94-
9569
/**
9670
* Resource provider.
9771
*

0 commit comments

Comments
 (0)
Please sign in to comment.