Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync: avoid conflicts with other plugins using the filter #39681

Merged
merged 3 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions projects/packages/sync/changelog/fix-sync-filter-null-array
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Update plugin action links filter parameter to avoid conflicts with other plugins.
4 changes: 2 additions & 2 deletions projects/packages/sync/src/modules/class-callables.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,13 +396,13 @@ public function set_plugin_action_links() {
'edit' => '',
);
/** This filter is documented in src/wp-admin/includes/class-wp-plugins-list-table.php */
$action_links = apply_filters( 'plugin_action_links', $action_links, $plugin_file, null, 'all' );
$action_links = apply_filters( 'plugin_action_links', $action_links, $plugin_file, array(), 'all' );
Copy link
Contributor

@anomiex anomiex Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be worth trying to provide the actual plugin data, in case something tries to use it?

Looks like we could do that pretty easily by changing the code above from

$plugins = array_keys( Functions::get_plugins() );
foreach ( $plugins as $plugin_file ) {

to

$plugins = Functions::get_plugins();
foreach ( $plugins as $plugin_file => $plugin_data ) {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. Done in f83ba87

// Verify $action_links is still an array.
if ( ! is_array( $action_links ) ) {
$action_links = array();
}
/** This filter is documented in src/wp-admin/includes/class-wp-plugins-list-table.php */
$action_links = apply_filters( "plugin_action_links_{$plugin_file}", $action_links, $plugin_file, null, 'all' );
$action_links = apply_filters( "plugin_action_links_{$plugin_file}", $action_links, $plugin_file, array(), 'all' );
// Verify $action_links is still an array to resolve warnings from filters not returning an array.
if ( is_array( $action_links ) ) {
$action_links = array_filter( $action_links );
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


5 changes: 5 additions & 0 deletions projects/plugins/backup/changelog/fix-sync-filter-null-array
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


5 changes: 5 additions & 0 deletions projects/plugins/boost/changelog/fix-sync-filter-null-array
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/fix-sync-filter-null-array
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: compat

Plugin action links filters: update parameter to avoid any conflicts with other plugins.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


5 changes: 5 additions & 0 deletions projects/plugins/protect/changelog/fix-sync-filter-null-array
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


5 changes: 5 additions & 0 deletions projects/plugins/search/changelog/fix-sync-filter-null-array
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


5 changes: 5 additions & 0 deletions projects/plugins/social/changelog/fix-sync-filter-null-array
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


5 changes: 5 additions & 0 deletions projects/plugins/wpcomsh/changelog/fix-sync-filter-null-array
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


Loading