Skip to content

Commit 28c9e7e

Browse files
authored
Merge pull request #1413 from laterpay/GH-1409
GH-1409: Remove Wisdom integration.
2 parents 85b7352 + c1d344c commit 28c9e7e

15 files changed

Lines changed: 2 additions & 1542 deletions

File tree

laterpay/application/Controller/Admin/Account.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ public static function get_subscribed_events() {
3737
public function load_assets() {
3838
parent::load_assets();
3939

40-
// Update Wisdom opt_out status if necessary.
41-
$this->lp_update_optout_value();
42-
4340
// Get data for GA.
4441
$merchant_key = LaterPay_Controller_Admin::get_merchant_id_for_ga();
4542
$site_url = get_site_url();

laterpay/application/Controller/Admin/Advanced.php

Lines changed: 0 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ public static function get_subscribed_events() {
2828
public function load_assets() {
2929
parent::load_assets();
3030

31-
// Update Wisdom opt_out status if necessary.
32-
$this->lp_update_optout_value();
33-
3431
LaterPay_Controller_Admin::register_common_scripts( 'advanced' );
3532

3633
// Add thickbox to display modal.
@@ -48,7 +45,6 @@ public function load_assets() {
4845
wp_enqueue_script( 'laterpay-backend-advanced' );
4946

5047
$nonce = wp_create_nonce( 'plugin_disable_nonce' );
51-
$wisdom_nonce = wp_create_nonce( 'wisdom_goodbye_form' );
5248

5349
// pass localized strings and variables to script
5450
wp_localize_script(
@@ -58,7 +54,6 @@ public function load_assets() {
5854
'region' => get_option( 'laterpay_region', 'us' ),
5955
'liveKeyAvailable' => empty( get_option( 'laterpay_live_merchant_id', '' ) ) ? 'false' : 'true',
6056
'plugin_disable_nonce' => $nonce,
61-
'wisdom_survey_nonce' => $wisdom_nonce,
6257
'modal' => array(
6358
'id' => 'lp_plugin_disable_modal_id',
6459
'title' => ( laterpay_check_is_vip() ) ? esc_html__( 'Delete Plugin Data', 'laterpay' ) : esc_html__( 'Deactivate Plugin & Delete Data', 'laterpay' ),
@@ -74,28 +69,9 @@ public function load_assets() {
7469
public function render_page() {
7570
$this->load_assets();
7671

77-
// get current tracking status.
78-
$lp_wisdom_data = get_option( 'lp_wisdom_tracking_info' );
79-
$wisdom_tracking_info = get_option( 'wisdom_allow_tracking' );
80-
$lp_wisdom_data_enabled = 0;
81-
82-
if ( false !== $wisdom_tracking_info ) {
83-
$lp_wisdom_data_enabled = isset( $wisdom_tracking_info['laterpay'] ) ? 1 : 0;
84-
// get current wisdom option value and update accordingly.
85-
if ( 1 === $lp_wisdom_data_enabled ) {
86-
$lp_wisdom_data_enabled = 1;
87-
$lp_wisdom_data['wisdom_opt_out'] = 0;
88-
} else {
89-
$lp_wisdom_data_enabled = 0;
90-
unset( $lp_wisdom_data['wisdom_opt_out'] );
91-
}
92-
update_option( 'lp_wisdom_tracking_info', $lp_wisdom_data );
93-
}
94-
9572
// View data for laterpay/views/backend/advanced.php.
9673
$view_args = array(
9774
'plugin_is_in_live_mode' => $this->config->get( 'is_in_live_mode' ),
98-
'is_wisdom_tracking_allowed' => $lp_wisdom_data_enabled,
9975
'admin_menu' => LaterPay_Helper_View::get_admin_menu(),
10076
'advanced_obj' => $this,
10177
'live_key' => get_option( 'laterpay_live_merchant_id', '' ),
@@ -132,106 +108,6 @@ public static function process_ajax_requests( LaterPay_Core_Event $event ) {
132108
check_admin_referer( 'laterpay_form' );
133109
}
134110

135-
switch ( $submitted_form_value ) {
136-
137-
case 'laterpay_wisdom_optinout':
138-
self::change_tracking_status( $event );
139-
break;
140-
141-
default:
142-
break;
143-
}
144-
}
145-
146-
/**
147-
* Toggle LaterPay tracking
148-
*
149-
* @return void
150-
* @throws LaterPay_Core_Exception_FormValidation
151-
*
152-
*/
153-
protected static function change_tracking_status( LaterPay_Core_Event $event ) {
154-
$plugin_tracking_mode_form = new LaterPay_Form_TrackingMode();
155-
156-
if ( ! $plugin_tracking_mode_form->is_valid( $_POST ) ) { // phpcs:ignore
157-
array(
158-
'success' => false,
159-
'message' => __( 'Error occurred. Incorrect data provided.', 'laterpay' )
160-
);
161-
throw new LaterPay_Core_Exception_FormValidation( get_class( $plugin_tracking_mode_form ), $plugin_tracking_mode_form->get_errors() );
162-
}
163-
164-
$plugin_tracking_mode = $plugin_tracking_mode_form->get_field_value( 'is_wisdom_tracking_allowed' );
165-
166-
// get current option setting value and disable tracking.
167-
$lp_wisdom_info = get_option( 'lp_wisdom_tracking_info' );
168-
$lp_wisdom_info['wisdom_opt_out'] = $plugin_tracking_mode;
169-
170-
// update plugin info for wisdom tracking.
171-
if ( 0 === $plugin_tracking_mode ) {
172-
unset( $lp_wisdom_info['wisdom_opt_out'] );
173-
$lp_wisdom_info['lp_wisdom_opt_out'] = 1;
174-
update_option( 'lp_wisdom_tracking_info', $lp_wisdom_info );
175-
laterpay_start_plugin_tracking()->do_tracking( true );
176-
self::unset_wisdom_tracking_info();
177-
} else {
178-
$lp_wisdom_info['lp_wisdom_opt_out'] = 0;
179-
$lp_wisdom_info['wisdom_opt_out'] = 0;
180-
181-
// Options to update in wisdom library.
182-
$wisdom_tracking_info = get_option( 'wisdom_allow_tracking' );
183-
$wisdom_block_notice = get_option( 'wisdom_block_notice' );
184-
185-
// Update wisdom options when allowed from advanced section.
186-
if ( empty( $wisdom_tracking_info ) || ! is_array( $wisdom_tracking_info ) ) {
187-
$wisdom_tracking_info = [ 'laterpay' => 'laterpay' ];
188-
} else {
189-
$wisdom_tracking_info['laterpay'] = 'laterpay';
190-
}
191-
update_option( 'wisdom_allow_tracking', $wisdom_tracking_info );
192-
193-
if ( ! empty( $wisdom_block_notice ) && isset( $wisdom_block_notice['laterpay'] ) ) {
194-
unset( $wisdom_block_notice['laterpay'] );
195-
}
196-
update_option( 'wisdom_block_notice', $wisdom_block_notice );
197-
198-
update_option( 'lp_wisdom_tracking_info', $lp_wisdom_info );
199-
laterpay_start_plugin_tracking()->do_tracking( true );
200-
}
201-
202-
$event->set_result(
203-
array(
204-
'success' => true,
205-
'message' => __( 'Updated Laterpay tracking mode.', 'laterpay' ),
206-
)
207-
);
208-
209111
return;
210112
}
211-
212-
/**
213-
* Unset laterpay wisdom tracking options.
214-
*/
215-
public static function unset_wisdom_tracking_info() {
216-
// all wisdom tracking options.
217-
$wisdom_tracking_options = [
218-
'wisdom_notification_times',
219-
'wisdom_allow_tracking',
220-
'wisdom_block_notice',
221-
'wisdom_admin_emails',
222-
'wisdom_last_track_time',
223-
'wisdom_collect_email',
224-
];
225-
226-
// loop through each option and unset laterpay info.
227-
foreach ( $wisdom_tracking_options as $wisdom_option ) {
228-
$current_wisdom_option = get_option( $wisdom_option );
229-
if ( false !== $current_wisdom_option ) {
230-
if ( isset( $current_wisdom_option['laterpay'] ) ) {
231-
unset( $current_wisdom_option['laterpay'] );
232-
update_option( $wisdom_option, $current_wisdom_option );
233-
}
234-
}
235-
}
236-
}
237113
}

laterpay/application/Controller/Admin/Appearance.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ public function add_custom_styles() {
4141
public function load_assets() {
4242
parent::load_assets();
4343

44-
// Update Wisdom opt_out status if necessary.
45-
$this->lp_update_optout_value();
46-
4744
// Get data for GA.
4845
$merchant_key = LaterPay_Controller_Admin::get_merchant_id_for_ga();
4946

laterpay/application/Controller/Admin/Base.php

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -48,49 +48,4 @@ public function get_menu( $file = null, $view_dir = null ) {
4848
public function render_faq_support() {
4949
$this->render( 'backend/partials/faq-support' );
5050
}
51-
52-
/**
53-
* Check if laterpay wisdom is allowed tracking.
54-
*
55-
* @return bool
56-
*/
57-
public function lp_is_wisdom_tracking_allowed() {
58-
$lp_wisdom_allowed_tracking = get_option( 'wisdom_allow_tracking' );
59-
if ( false === $lp_wisdom_allowed_tracking ) {
60-
return false;
61-
} elseif ( isset( $lp_wisdom_allowed_tracking['laterpay'] ) && 'laterpay' === $lp_wisdom_allowed_tracking['laterpay'] ) {
62-
return true;
63-
}
64-
65-
return false;
66-
}
67-
68-
/**
69-
* Custom code to get opt out value since wisdom_opt_out can't be used with custom usage.
70-
* @return bool
71-
*/
72-
public function lp_update_optout_value() {
73-
if ( $this->lp_is_wisdom_tracking_allowed() ) {
74-
$lp_wisdom_tracking_info = get_option( 'lp_wisdom_tracking_info' );
75-
if ( false === $lp_wisdom_tracking_info ) {
76-
return false;
77-
}
78-
79-
if ( isset( $lp_wisdom_tracking_info['wisdom_opt_out'] ) ) {
80-
if ( 0 === absint( $lp_wisdom_tracking_info['wisdom_opt_out'] ) ) {
81-
return false;
82-
} else {
83-
$lp_wisdom_tracking_info['wisdom_opt_out'] = 0;
84-
$lp_wisdom_tracking_info['lp_wisdom_opt_out'] = 0;
85-
}
86-
} else {
87-
$lp_wisdom_tracking_info['wisdom_opt_out'] = 0;
88-
$lp_wisdom_tracking_info['lp_wisdom_opt_out'] = 0;
89-
}
90-
91-
return update_option( 'lp_wisdom_tracking_info', $lp_wisdom_tracking_info );
92-
}
93-
94-
return false;
95-
}
9651
}

laterpay/application/Controller/Admin/Notice.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ public static function get_subscribed_events() {
1111
array( 'laterpay_on_admin_view', 200 ),
1212
array( 'render_wpengine_notice' ),
1313
),
14-
'laterpay_marketing_notice' => array(
15-
array( 'laterpay_on_admin_view', 200 ),
16-
array( 'customize_marketing_notice' ),
17-
),
1814
'wp_ajax_laterpay_save_wpengine_status' => array(
1915
array( 'laterpay_on_plugin_is_working', 200 ),
2016
array( 'laterpay_on_ajax_send_json', 300 ),
@@ -86,17 +82,6 @@ function render_wpengine_notice() {
8682
);
8783
}
8884

89-
/**
90-
* Customize Marketing text for wisdom tracking.
91-
*
92-
* @param LaterPay_Core_Event $event
93-
*
94-
* @return void
95-
*/
96-
public function customize_marketing_notice( LaterPay_Core_Event $event ) {
97-
$event->set_result( esc_attr__( 'Thank you for opting in to tracking! May we contact you to provide updates or request feedback?', 'laterpay' ) );
98-
}
99-
10085
/**
10186
* Saves Wp engine notice status.
10287
*

laterpay/application/Controller/Admin/Pricing.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ public function register_subscription_cpt( LaterPay_Core_Event $event ) {
6060
public function load_assets() {
6161
parent::load_assets();
6262

63-
// Update Wisdom opt_out status if necessary.
64-
$this->lp_update_optout_value();
65-
6663
// Get data for GA.
6764
$merchant_key = LaterPay_Controller_Admin::get_merchant_id_for_ga();
6865
$data_for_localize = [

laterpay/application/Controller/Install.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,6 @@ public function install() {
495495
$this->add_update_highlights();
496496
$this->add_tabular_info_option();
497497
$this->setup_overlay_options_order();
498-
$this->add_merchant_id_wisdom_tracking();
499498

500499
}
501500

@@ -739,22 +738,4 @@ public function setup_overlay_options_order() {
739738
);
740739
}
741740
}
742-
743-
/**
744-
* Setup an option with Merchant ID information for wisdom tracking.
745-
*
746-
* @since 2.6.1
747-
*
748-
* @return void
749-
*/
750-
public function add_merchant_id_wisdom_tracking() {
751-
if ( false === get_option( 'lp_wisdom_tracking_info' ) ) {
752-
$wisdom_id_data = [
753-
'sandbox_id' => get_option( 'laterpay_sandbox_merchant_id', '' ),
754-
'live_id' => get_option( 'laterpay_live_merchant_id', '' ),
755-
'wisdom_registered_setting' => 1
756-
];
757-
update_option( 'lp_wisdom_tracking_info', $wisdom_id_data );
758-
}
759-
}
760741
}

laterpay/application/Form/TrackingMode.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,6 @@ class LaterPay_Form_TrackingMode extends LaterPay_Form_Abstract {
1515
* @return void
1616
*/
1717
public function init() {
18-
$this->set_field(
19-
'form',
20-
array(
21-
'validators' => array(
22-
'is_string',
23-
'cmp' => array(
24-
array(
25-
'eq' => 'laterpay_wisdom_optinout',
26-
),
27-
),
28-
),
29-
)
30-
);
31-
3218
$this->set_field(
3319
'action',
3420
array(
@@ -56,19 +42,6 @@ public function init() {
5642
),
5743
)
5844
);
59-
60-
$this->set_field(
61-
'is_wisdom_tracking_allowed',
62-
array(
63-
'validators' => array(
64-
'is_int',
65-
'in_array' => array( 0, 1 ),
66-
),
67-
'filters' => array(
68-
'to_int',
69-
),
70-
)
71-
);
7245
}
7346
}
7447

laterpay/application/Helper/Config.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,6 @@ public static function erase_plugin_data() {
424424
delete_option( 'lp_pass_count' );
425425
delete_option( 'lp_sub_count' );
426426

427-
// unset wisdom tracking data.
428-
LaterPay_Controller_Admin_Advanced::unset_wisdom_tracking_info();
429-
430427
// Delete Post Price Display Behaviour Option.
431428
delete_option( 'laterpay_post_price_behaviour' );
432429

laterpay/application/Hooks.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ public function init() {
8282
add_action( 'manage_' . $post_type . '_posts_custom_column', array( $this, self::$wp_action_prefix . 'laterpay_post_custom_column_data' ), 10, 2 );
8383
}
8484

85-
// Customize Marketing text for wisdom tracking.
86-
add_filter( 'wisdom_marketing_text_laterpay', array( $this, self::$wp_filter_prefix . 'laterpay_marketing_notice' ) );
87-
8885
add_action( 'template_redirect', array( $this, self::$wp_action_prefix . 'laterpay_loaded' ) );
8986
add_action( 'wp_footer', array( $this, self::$wp_action_prefix . 'laterpay_post_footer' ) );
9087
add_action( 'wp_enqueue_scripts', array( $this, self::$wp_action_prefix . 'laterpay_enqueue_scripts' ) );

0 commit comments

Comments
 (0)