PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | src/services/importing/conflicting-plugins-service.php +9 -6 18.0 → trunk View file →
@@ -23,9 +23,11 @@
23 23
24 24 /**
25 25 * Deactivates the specified plugin(s) if any, or the entire list of known conflicting plugins.
26 26 *
27 - * @param string|array|false $plugins (optional) The plugin filename, or array of plugin filenames, to deactivate.
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 ) {
@@ -36,9 +38,9 @@
36 38 if ( \is_string( $plugins ) ) {
37 39 $plugins = [ $plugins ];
38 40 }
39 41
40 - if ( ! is_array( $plugins ) ) {
42 + if ( ! \is_array( $plugins ) ) {
41 43 return;
42 44 }
43 45
44 46 // Deactivate all specified plugins across the network, while retaining their deactivation hook.
@@ -66,12 +68,12 @@
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 - // request a list of active plugins from WordPress.
75 + // Request a list of active plugins from WordPress.
74 76 $all_active_plugins = \get_option( 'active_plugins' );
75 77
76 78 return $this->ignore_deactivating_plugin( $all_active_plugins );
77 79 }
@@ -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 );