← All changes
|
includes/core/rest-api/Controllers/class-settings-controller.php
+3
-50
3.12.13
→
3.13.3
View file →
| @@ -151,19 +151,8 @@ | ||
| 151 | 151 | ) |
| 152 | 152 | ); |
| 153 | 153 | |
| 154 | 154 | register_rest_route( |
| 155 | - $this->namespace, '/' . $this->rest_funnel_settings . '/update-funnel-type' , array( | |
| 156 | - array( | |
| 157 | - 'methods' => 'POST', | |
| 158 | - 'callback' => array( $this, 'update_funnel_type' ), | |
| 159 | - 'permission_callback' => array( $this, 'update_items_permissions_check' ), | |
| 160 | - 'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ), | |
| 161 | - ) | |
| 162 | - ) | |
| 163 | - ); | |
| 164 | - | |
| 165 | - register_rest_route( | |
| 166 | 155 | $this->namespace, '/' . $this->rest_funnel_settings . '/update-builder-type' , array( |
| 167 | 156 | array( |
| 168 | 157 | 'methods' => 'POST', |
| 169 | 158 | 'callback' => array( $this, 'update_builder_type' ), |
| @@ -481,14 +470,10 @@ | ||
| 481 | 470 | $settings = Wpfnl_functions::get_admin_settings( '_wpfunnels_permalink_settings', $default); |
| 482 | 471 | } elseif( $request['settings_id'] === 'optin') { |
| 483 | 472 | $default = Wpfnl_functions::get_optin_settings(); |
| 484 | 473 | $settings = Wpfnl_functions::get_admin_settings( '_wpfunnels_optin_settings', $default); |
| 485 | - } elseif ($request['settings_id'] === 'funnel_type') { | |
| 474 | + } else { | |
| 486 | 475 | $default = Wpfnl_functions::get_general_settings(); |
| 487 | - $settings = Wpfnl_functions::get_admin_settings( $request['group_id'], $default); | |
| 488 | - } | |
| 489 | - else { | |
| 490 | - $default = Wpfnl_functions::get_general_settings(); | |
| 491 | 476 | $settings = Wpfnl_functions::get_admin_settings( $request['group_id'], $default ); |
| 492 | 477 | } |
| 493 | 478 | |
| 494 | 479 | if ( !$settings ) { |
| @@ -509,14 +494,9 @@ | ||
| 509 | 494 | Wpfnl_functions::update_admin_settings('_wpfunnels_permalink_saved', true); |
| 510 | 495 | Wpfnl_functions::update_admin_settings($request['group_id'], $settings); |
| 511 | 496 | |
| 512 | 497 | }else { |
| 513 | - if( 'funnel_type' === $request['settings_id'] ) { | |
| 514 | - $general_settings = get_option( '_wpfunnels_general_settings' ); | |
| 515 | - $settings[$request['settings_id']] = isset($general_settings['funnel_type']) ? $general_settings['funnel_type'] : 'sales'; | |
| 516 | - }else{ | |
| 517 | - $settings[$request['settings_id']] = $request['value']; | |
| 518 | - } | |
| 498 | + $settings[$request['settings_id']] = $request['value']; | |
| 519 | 499 | |
| 520 | 500 | Wpfnl_functions::update_admin_settings($request['group_id'], $settings); |
| 521 | 501 | |
| 522 | 502 | } |
| @@ -554,35 +534,8 @@ | ||
| 554 | 534 | } |
| 555 | 535 | |
| 556 | 536 | |
| 557 | 537 | /** |
| 558 | - * Update funnel type | |
| 559 | - * | |
| 560 | - * @param Array $request | |
| 561 | - * | |
| 562 | - * @return Array | |
| 563 | - * @since 2.5.3 | |
| 564 | - */ | |
| 565 | - public function update_funnel_type( $request ){ | |
| 566 | - | |
| 567 | - $response = [ | |
| 568 | - 'success' => false, | |
| 569 | - ]; | |
| 570 | - | |
| 571 | - if( $request['type'] ){ | |
| 572 | - $type = $request['type']; | |
| 573 | - $general_settings = get_option( '_wpfunnels_general_settings' ); | |
| 574 | - $general_settings['funnel_type'] = $type; | |
| 575 | - update_option('_wpfunnels_general_settings', $general_settings ); | |
| 576 | - $response = [ | |
| 577 | - 'success' => true, | |
| 578 | - ]; | |
| 579 | - } | |
| 580 | - return rest_ensure_response( $response ); | |
| 581 | - } | |
| 582 | - | |
| 583 | - | |
| 584 | - /** | |
| 585 | 538 | * Update funnel builder |
| 586 | 539 | * |
| 587 | 540 | * @param Array $request |
| 588 | 541 | * |
| @@ -681,9 +634,9 @@ | ||
| 681 | 634 | if( !isset( $request['name'],$request['value'] )){ |
| 682 | 635 | rest_ensure_response( $response ); |
| 683 | 636 | } |
| 684 | 637 | |
| 685 | - if( 'builder' === $request['name'] || 'funnel_type' === $request['name'] ){ | |
| 638 | + if( 'builder' === $request['name'] ){ | |
| 686 | 639 | // Get and process the value using the appropriate method. |
| 687 | 640 | $name = sanitize_text_field($request['name']); |
| 688 | 641 | $value = sanitize_text_field($request['value']); |
| 689 | 642 | |