|
75 | 75 | */
|
76 | 76 | function mailchimp_sf_plugin_init() {
|
77 | 77 |
|
78 |
| - // Remove Sopresto check. If user does not have API key, make them authenticate. |
79 |
| - |
80 | 78 | if ( get_option( 'mc_list_id' ) && get_option( 'mc_merge_field_migrate' ) !== '1' && mailchimp_sf_get_api() !== false ) {
|
81 | 79 | mailchimp_sf_update_merge_fields();
|
82 | 80 | }
|
@@ -217,7 +215,7 @@ function mailchimp_sf_request_handler() {
|
217 | 215 | }
|
218 | 216 |
|
219 | 217 | // 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' ); |
221 | 219 | mailchimp_sf_delete_options( $options );
|
222 | 220 | break;
|
223 | 221 | case 'change_form_settings':
|
@@ -261,58 +259,6 @@ function mailchimp_sf_request_handler() {
|
261 | 259 | }
|
262 | 260 | add_action( 'init', 'mailchimp_sf_request_handler' );
|
263 | 261 |
|
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 |
| - |
316 | 262 | /**
|
317 | 263 | * Update merge fields
|
318 | 264 | *
|
@@ -391,13 +337,13 @@ function mailchimp_sf_needs_upgrade() {
|
391 | 337 |
|
392 | 338 | /**
|
393 | 339 | * 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 |
394 | 343 | **/
|
395 | 344 | function mailchimp_sf_delete_setup() {
|
396 | 345 | $options = array(
|
397 | 346 | 'mc_user_id',
|
398 |
| - 'mc_sopresto_user', |
399 |
| - 'mc_sopresto_public_key', |
400 |
| - 'mc_sopresto_secret_key', |
401 | 347 | 'mc_use_javascript',
|
402 | 348 | 'mc_use_datepicker',
|
403 | 349 | 'mc_use_unsub_link',
|
|
0 commit comments