From 4852c4b2e65b62b0070d09d0fe564b0d839804b4 Mon Sep 17 00:00:00 2001 From: MaxwellGarceau Date: Sat, 28 Dec 2024 12:58:06 -0500 Subject: [PATCH 1/3] Remove sopresto code --- mailchimp.php | 59 +------------------------------------------- views/setup_page.php | 1 - 2 files changed, 1 insertion(+), 59 deletions(-) diff --git a/mailchimp.php b/mailchimp.php index f9870e5..e1f1787 100644 --- a/mailchimp.php +++ b/mailchimp.php @@ -75,8 +75,6 @@ */ function mailchimp_sf_plugin_init() { - // Remove Sopresto check. If user does not have API key, make them authenticate. - if ( get_option( 'mc_list_id' ) && get_option( 'mc_merge_field_migrate' ) !== '1' && mailchimp_sf_get_api() !== false ) { mailchimp_sf_update_merge_fields(); } @@ -217,7 +215,7 @@ function mailchimp_sf_request_handler() { } // erase auth information - $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' ); + $options = array( 'mc_api_key', 'mailchimp_sf_access_token', 'mc_datacenter', 'mailchimp_sf_auth_error', 'mailchimp_sf_waiting_for_login' ); mailchimp_sf_delete_options( $options ); break; case 'change_form_settings': @@ -261,58 +259,6 @@ function mailchimp_sf_request_handler() { } add_action( 'init', 'mailchimp_sf_request_handler' ); -/** - * Migrate Sopresto - * - * @return void - */ -function mailchimp_sf_migrate_sopresto() { - $sopresto = get_option( 'mc_sopresto_secret_key' ); - if ( ! $sopresto ) { - return; - } - - // Talk to Sopresto, make exchange, delete old sopresto things. - $body = array( - 'public_key' => get_option( 'mc_sopresto_public_key' ), - 'hash' => sha1( get_option( 'mc_sopresto_public_key' ) . get_option( 'mc_sopresto_secret_key' ) ), - ); - - $url = 'https://sopresto.socialize-this.com/mailchimp/exchange'; - $args = array( - 'method' => 'POST', - 'timeout' => 500, - 'redirection' => 5, - 'httpversion' => '1.0', - 'user-agent' => 'Mailchimp WordPress Plugin/' . get_bloginfo( 'url' ), - 'body' => $body, - ); - - // post to sopresto - $key = wp_remote_post( $url, $args ); - if ( ! is_wp_error( $key ) && 200 === $key['response']['code'] ) { - $key = json_decode( $key['body'] ); - try { - $api = new MailChimp_API( $key->response ); - } catch ( Exception $e ) { - $msg = '' . $e->getMessage() . ''; - mailchimp_sf_global_msg( $msg ); - return; - } - - $verify = mailchimp_sf_verify_key( $api ); - - // something went wrong with the key that we had - if ( is_wp_error( $verify ) ) { - return; - } - - delete_option( 'mc_sopresto_public_key' ); - delete_option( 'mc_sopresto_secret_key' ); - delete_option( 'mc_sopresto_user' ); - } -} - /** * Update merge fields * @@ -395,9 +341,6 @@ function mailchimp_sf_needs_upgrade() { function mailchimp_sf_delete_setup() { $options = array( 'mc_user_id', - 'mc_sopresto_user', - 'mc_sopresto_public_key', - 'mc_sopresto_secret_key', 'mc_use_javascript', 'mc_use_datepicker', 'mc_use_unsub_link', diff --git a/views/setup_page.php b/views/setup_page.php index d1f1fcd..7fe3a16 100644 --- a/views/setup_page.php +++ b/views/setup_page.php @@ -6,7 +6,6 @@ */ $user = get_option( 'mc_user' ); -/* TODO MC SOPRESTO USER INFO */ // If we have an API Key, see if we need to change the lists and its options mailchimp_sf_change_list_if_necessary(); From 1be18502bf39adc0c4f1b1ebae24f8df65c2f873 Mon Sep 17 00:00:00 2001 From: MaxwellGarceau Date: Sat, 28 Dec 2024 13:01:57 -0500 Subject: [PATCH 2/3] Add note --- mailchimp.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mailchimp.php b/mailchimp.php index e1f1787..31185e6 100644 --- a/mailchimp.php +++ b/mailchimp.php @@ -337,6 +337,9 @@ function mailchimp_sf_needs_upgrade() { /** * Deletes all Mailchimp options + * + * TODO: The options names should be moved to a config file + * or to a class dedicated to options **/ function mailchimp_sf_delete_setup() { $options = array( From 19896b15ca1bb8120780a576805808ccf664c4f4 Mon Sep 17 00:00:00 2001 From: MaxwellGarceau Date: Sat, 28 Dec 2024 13:13:19 -0500 Subject: [PATCH 3/3] Remove trailing whitespace --- mailchimp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailchimp.php b/mailchimp.php index 31185e6..57f8813 100644 --- a/mailchimp.php +++ b/mailchimp.php @@ -337,7 +337,7 @@ function mailchimp_sf_needs_upgrade() { /** * Deletes all Mailchimp options - * + * * TODO: The options names should be moved to a config file * or to a class dedicated to options **/