Skip to content

Commit 8d10e68

Browse files
authored
Merge pull request #98 from mailchimp/enhancement/remove-sopresto-code
Enhancement/remove sopresto code
2 parents 0846802 + 19896b1 commit 8d10e68

File tree

2 files changed

+4
-59
lines changed

2 files changed

+4
-59
lines changed

mailchimp.php

Lines changed: 4 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@
7575
*/
7676
function mailchimp_sf_plugin_init() {
7777

78-
// Remove Sopresto check. If user does not have API key, make them authenticate.
79-
8078
if ( get_option( 'mc_list_id' ) && get_option( 'mc_merge_field_migrate' ) !== '1' && mailchimp_sf_get_api() !== false ) {
8179
mailchimp_sf_update_merge_fields();
8280
}
@@ -217,7 +215,7 @@ function mailchimp_sf_request_handler() {
217215
}
218216

219217
// erase auth information
220-
$options = array( 'mc_api_key', 'mailchimp_sf_access_token', 'mc_datacenter', 'mailchimp_sf_auth_error', 'mailchimp_sf_waiting_for_login', 'mc_sopresto_user', 'mc_sopresto_public_key', 'mc_sopresto_secret_key' );
218+
$options = array( 'mc_api_key', 'mailchimp_sf_access_token', 'mc_datacenter', 'mailchimp_sf_auth_error', 'mailchimp_sf_waiting_for_login' );
221219
mailchimp_sf_delete_options( $options );
222220
break;
223221
case 'change_form_settings':
@@ -261,58 +259,6 @@ function mailchimp_sf_request_handler() {
261259
}
262260
add_action( 'init', 'mailchimp_sf_request_handler' );
263261

264-
/**
265-
* Migrate Sopresto
266-
*
267-
* @return void
268-
*/
269-
function mailchimp_sf_migrate_sopresto() {
270-
$sopresto = get_option( 'mc_sopresto_secret_key' );
271-
if ( ! $sopresto ) {
272-
return;
273-
}
274-
275-
// Talk to Sopresto, make exchange, delete old sopresto things.
276-
$body = array(
277-
'public_key' => get_option( 'mc_sopresto_public_key' ),
278-
'hash' => sha1( get_option( 'mc_sopresto_public_key' ) . get_option( 'mc_sopresto_secret_key' ) ),
279-
);
280-
281-
$url = 'https://sopresto.socialize-this.com/mailchimp/exchange';
282-
$args = array(
283-
'method' => 'POST',
284-
'timeout' => 500,
285-
'redirection' => 5,
286-
'httpversion' => '1.0',
287-
'user-agent' => 'Mailchimp WordPress Plugin/' . get_bloginfo( 'url' ),
288-
'body' => $body,
289-
);
290-
291-
// post to sopresto
292-
$key = wp_remote_post( $url, $args );
293-
if ( ! is_wp_error( $key ) && 200 === $key['response']['code'] ) {
294-
$key = json_decode( $key['body'] );
295-
try {
296-
$api = new MailChimp_API( $key->response );
297-
} catch ( Exception $e ) {
298-
$msg = '<strong class="mc_error_msg">' . $e->getMessage() . '</strong>';
299-
mailchimp_sf_global_msg( $msg );
300-
return;
301-
}
302-
303-
$verify = mailchimp_sf_verify_key( $api );
304-
305-
// something went wrong with the key that we had
306-
if ( is_wp_error( $verify ) ) {
307-
return;
308-
}
309-
310-
delete_option( 'mc_sopresto_public_key' );
311-
delete_option( 'mc_sopresto_secret_key' );
312-
delete_option( 'mc_sopresto_user' );
313-
}
314-
}
315-
316262
/**
317263
* Update merge fields
318264
*
@@ -391,13 +337,13 @@ function mailchimp_sf_needs_upgrade() {
391337

392338
/**
393339
* Deletes all Mailchimp options
340+
*
341+
* TODO: The options names should be moved to a config file
342+
* or to a class dedicated to options
394343
**/
395344
function mailchimp_sf_delete_setup() {
396345
$options = array(
397346
'mc_user_id',
398-
'mc_sopresto_user',
399-
'mc_sopresto_public_key',
400-
'mc_sopresto_secret_key',
401347
'mc_use_javascript',
402348
'mc_use_datepicker',
403349
'mc_use_unsub_link',

views/setup_page.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77

88
$user = get_option( 'mc_user' );
9-
/* TODO MC SOPRESTO USER INFO */
109

1110
// If we have an API Key, see if we need to change the lists and its options
1211
mailchimp_sf_change_list_if_necessary();

0 commit comments

Comments
 (0)