← All changes
|
src/services/importing/conflicting-plugins-service.php
+6
-3
18.6
→
trunk
View file →
| @@ -24,8 +24,10 @@ | ||
| 24 | 24 | /** |
| 25 | 25 | * Deactivates the specified plugin(s) if any, or the entire list of known conflicting plugins. |
| 26 | 26 | * |
| 27 | 27 | * @param string|array|false $plugins Optional. The plugin filename, or array of plugin filenames, to deactivate. |
| 28 | + * | |
| 29 | + * @return void | |
| 28 | 30 | */ |
| 29 | 31 | public function deactivate_conflicting_plugins( $plugins = false ) { |
| 30 | 32 | // If no plugins are specified, deactivate any known conflicting plugins that are active. |
| 31 | 33 | if ( ! $plugins ) { |
| @@ -66,9 +68,9 @@ | ||
| 66 | 68 | |
| 67 | 69 | /** |
| 68 | 70 | * Get a list of all plugins active in the current WordPress instance. |
| 69 | 71 | * |
| 70 | - * @return false|array The names of all active plugins. | |
| 72 | + * @return array|false The names of all active plugins. | |
| 71 | 73 | */ |
| 72 | 74 | protected function get_active_plugins() { |
| 73 | 75 | // Request a list of active plugins from WordPress. |
| 74 | 76 | $all_active_plugins = \get_option( 'active_plugins' ); |
| @@ -83,10 +85,11 @@ | ||
| 83 | 85 | * |
| 84 | 86 | * @return array The remaining active plugins. |
| 85 | 87 | */ |
| 86 | 88 | protected function ignore_deactivating_plugin( $all_active_plugins ) { |
| 87 | - if ( isset( $_GET['action'] ) && isset( $_GET['plugin'] ) && \filter_var( \wp_unslash( $_GET['action'] ) ) === 'deactivate' ) { | |
| 88 | - $deactivated_plugin = \filter_var( \wp_unslash( $_GET['plugin'] ) ); | |
| 89 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are strictly comparing only. | |
| 90 | + if ( isset( $_GET['action'] ) && isset( $_GET['plugin'] ) && \is_string( $_GET['action'] ) && \is_string( $_GET['plugin'] ) && \wp_unslash( $_GET['action'] ) === 'deactivate' ) { | |
| 91 | + $deactivated_plugin = \sanitize_text_field( \wp_unslash( $_GET['plugin'] ) ); | |
| 89 | 92 | |
| 90 | 93 | \check_admin_referer( 'deactivate-plugin_' . $deactivated_plugin ); |
| 91 | 94 | |
| 92 | 95 | $key_to_remove = \array_search( $deactivated_plugin, $all_active_plugins, true ); |