ange_feature_enable_from_query_params(): void { if ( ! current_user_can( 'manage_woocommerce' ) ) { return; } $is_feature_nonce_invalid = ( ! isset( $_GET['_feature_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_feature_nonce'] ) ), 'change_feature_enable' ) ); $query_params_to_remove = array( '_feature_nonce' ); foreach ( array_keys( $this->features ) as $feature_id ) { if ( isset( $_GET[ $feature_id ] ) && is_numeric( $_GET[ $feature_id ] ) ) { $value = absint( $_GET[ $feature_id ] ); if ( $is_feature_nonce_invalid ) { wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) ); return; } if ( 1 === $value ) { $this->change_feature_enable( $feature_id, true ); } elseif ( 0 === $value ) { $this->change_feature_enable( $feature_id, false ); } $query_params_to_remove[] = $feature_id; } } if ( count( $query_params_to_remove ) > 1 && isset( $_SERVER['REQUEST_URI'] ) ) { // phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized wp_safe_redirect( remove_query_arg( $query_params_to_remove, $_SERVER['REQUEST_URI'] ) ); } } }