PluginProbe
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce / 3.3.0
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce v3.3.0
3.3.0 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.1 trunk 1.0.4 1.1.0 1.1.0.1 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 All 162 releases
← All changes | admin-legacy-core/ajax/common-settings.php +33 -0 3.1.2 → 3.3.0 View file →
@@ -29,8 +29,20 @@
29 29 */
30 30 private static $instance;
31 31
32 32 /**
33 + * URL the client should hard-navigate to after a successful save.
34 + *
35 + * Set by save_other_settings() when the "Switch to New UI" toggle is
36 + * enabled so the dashboard reloads through the new admin loader. Read by
37 + * save_global_settings() and merged into the final response payload so
38 + * do_action() hooks and other side-effects still run before the redirect.
39 + *
40 + * @var string
41 + */
42 + private $pending_redirect = '';
43 +
44 + /**
33 45 * Initiator
34 46 *
35 47 * @since 1.0.0
36 48 * @return object initialized object of class.
@@ -179,8 +191,17 @@
179 191
180 192 $response_data = array(
181 193 'messsage' => __( 'Successfully saved data!', 'cartflows' ),
182 194 );
195 +
196 + // If a tab handler queued a redirect (e.g. "Switch to New UI" toggle
197 + // was just enabled), pass it through so the client hard-navigates
198 + // after save.
199 + if ( ! empty( $this->pending_redirect ) ) {
200 + $response_data['redirect_to'] = $this->pending_redirect;
201 + $response_data['messsage'] = __( 'Switching to the new CartFlows UI…', 'cartflows' );
202 + }
203 +
183 204 wp_send_json_success( $response_data );
184 205 }
185 206
186 207 /**
@@ -334,8 +355,20 @@
334 355 // Update the option to enable/disable the non sensitive data tracking.
335 356 if ( isset( $_POST['cf_usage_optin'] ) ) {
336 357 $enable_non_sensative_data_tracking = sanitize_text_field( $_POST['cf_usage_optin'] );
337 358 AdminHelper::update_admin_settings_option( 'cf_usage_optin', $enable_non_sensative_data_tracking, false );
359 + }
360 +
361 + // "Switch to New UI" — one-shot toggle. When enabled, drop the legacy-admin
362 + // option so the next request boots the new admin loader, and queue a redirect
363 + // that save_global_settings() will merge into the final response.
364 + if ( isset( $_POST['cartflows-switch-to-new-ui'] ) ) {
365 + $switch_to_new_ui = sanitize_text_field( wp_unslash( $_POST['cartflows-switch-to-new-ui'] ) );
366 +
367 + if ( 'enable' === $switch_to_new_ui ) {
368 + delete_option( 'cartflows-legacy-admin' );
369 + $this->pending_redirect = admin_url( 'admin.php?page=' . CARTFLOWS_SLUG );
370 + }
338 371 }
339 372 }
340 373
341 374 /**