PluginProbe
MakeCommerce for WooCommerce / 3.0.12
MakeCommerce for WooCommerce v3.0.12
4.1.0 4.0.8 trunk 1.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 2.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2.0 2.2.1 2.2.2 All 96 releases
← All changes | api/api.php +130 -330 4.0.83.0.12 View file →
@@ -137,10 +137,9 @@
137 137 */
138 138 public function fill_ordersview_paymentmethod_column( $column, $post_id ) {
139 139
140 140 if ( 'makecommerce_payment_method' === $column ) {
141 - $order = wc_get_order( $post_id );
142 - echo $order->get_meta( '_makecommerce_preselected_method', true );
141 + echo get_post_meta( $post_id, '_makecommerce_preselected_method', true );
143 142 }
144 143 }
145 144
146 145 /**
@@ -217,227 +216,145 @@
217 216
218 217 /**
219 218 * Return array with fields for settings
220 219 */
221 - return [
222 - [ 'type' => 'title', 'desc' => \MakeCommerce::get_logo_html() ],
223 - [
224 - 'type' => 'title',
225 - 'title' => __('MakeCommerce Shipping+ is now available', 'wc_makecommerce_domain'),
226 - 'desc' => sprintf(
227 - __('You\'re still using the legacy version — <a href="%s">click here to switch to the new module</a>', 'wc_makecommerce_domain'),
228 - admin_url('admin.php?page=makecommerce_shipping_plus')
229 - ),
230 - 'id' => 'mk_api_settings'
231 - ],
232 - ['type' => 'sectionend', 'id' => 'mk_api_settings'],
233 - [
220 + return array(
221 + array( 'type' => 'title', 'desc' => \MakeCommerce::get_logo_html() ),
222 + array(
234 223 'type' => 'title',
235 224 'title' => __('MakeCommerce API access credentials', 'wc_makecommerce_domain'),
236 225 'desc' => __('To use MakeCommerce/Maksekeskus services you need to enter API credentials below here <br/> <br/>', 'wc_makecommerce_domain').
237 - sprintf( __('To further configure the Payment methods please go to <a href="%s">MakeCommerce Checkout Options</a>, links to settings of our Shipment methods are listed below', 'wc_makecommerce_domain'), 'admin.php?page=wc-settings&tab=checkout&section=makecommerce'),
226 + sprintf( __('To further configure the Payment methods please go to <a href=."%s">MakeCommerce Checkout Options</a>, links to settings of our Shipment methods are listed below', 'wc_makecommerce_domain'), 'admin.php?page=wc-settings&tab=checkout&section=makecommerce'),
238 227 'id' => 'mk_api_settings'
239 - ],
240 - [
241 - 'type' => 'select',
242 - 'title' => __('Current environment', 'wc_makecommerce_domain'),
243 - 'desc' => __('See more about <a href="https://maksekeskus.ee/en/for-developers/test-environment/">MakeCommerce Test environment</a>', 'wc_makecommerce_domain'),
244 - 'default' => 'live',
245 - 'options' => [
246 - 'live' => __('Live', 'wc_makecommerce_domain'),
247 - 'test' => __('Test', 'wc_makecommerce_domain'),
248 - ],
228 + ),
229 + array(
230 + 'type' => 'select',
231 + 'title' => __('Current environment', 'wc_makecommerce_domain'),
232 + 'desc' => __('See more about <a href="https://maksekeskus.ee/en/for-developers/test-environment/">MakeCommerce Test environment</a>', 'wc_makecommerce_domain'),
233 + 'default' => 'live',
234 + 'options' => array(
235 + 'live' => __('Live', 'wc_makecommerce_domain'),
236 + 'test' => __('Test', 'wc_makecommerce_domain'),
237 + ),
249 238 'id' => 'mk_api_type'
250 - ],
251 - [
252 - 'id' => 'mk_shop_id',
253 - 'type' => 'text',
254 - 'title' => __('Shop ID (live)', 'wc_makecommerce_domain'),
255 - 'desc' => __('Get it from <a href="https://merchant.maksekeskus.ee/api.html" target="_blank">Merchant Portal</a>','wc_makecommerce_domain'),
256 - 'class' => 'input-text regular-input',
257 - ],
258 - [
259 - 'id' => 'mk_private_key',
260 - 'type' => 'text',
261 - 'title' => __('Secret key (live)', 'wc_makecommerce_domain'),
262 - 'class' => 'input-text regular-input',
263 - ],
264 - [
265 - 'id' => 'mk_public_key',
266 - 'type' => 'text',
267 - 'title' => __('Publishable key (live)', 'wc_makecommerce_domain'),
268 - 'class' => 'input-text regular-input',
269 - ],
270 - [
271 - 'id' => 'mk_test_shop_id',
272 - 'type' => 'text',
273 - 'title' => __('Shop ID (test)', 'wc_makecommerce_domain'),
274 - 'class' => 'input-text regular-input',
275 - 'default' => 'f64b4f20-5ef9-4b7b-a6fa-d623d87f0b9c',
276 - 'desc' => __('Get it from <a href="https://merchant.test.maksekeskus.ee/api.html" target="_blank">Merchant Portal Test</a>','wc_makecommerce_domain'),
277 - ],
278 - [
279 - 'id' => 'mk_test_private_key',
280 - 'type' => 'text',
281 - 'title' => __('Secret key (test)', 'wc_makecommerce_domain'),
282 - 'default' => 'MPjcVMoRZPAucsTuGK5ZukOlV7BlzgSvXOowJUkk9IFSQPVooRwcVOxzz3mhEpgM',
283 - 'class' => 'input-text regular-input',
284 - ],
285 - [
286 - 'id' => 'mk_test_public_key',
287 - 'type' => 'text',
288 - 'title' => __('Publishable key (test)', 'wc_makecommerce_domain'),
289 - 'default' => '7Hog41ci2mKkmtviMycWxpNx14pNP70m',
290 - 'class' => 'input-text regular-input',
291 - ],
292 - [
293 - 'type' => 'select',
294 - 'title' => __('Label print format', 'wc_makecommerce_domain'),
295 - 'desc' => __('In which format should shipping labels be printed. (*make sure you have API access to see more options)', 'wc_makecommerce_domain'),
296 - 'default' => 'A4',
297 - 'options' => $this->label_formats(),
298 - 'id' => 'mk_label_format'
299 - ],
300 - ['type' => 'sectionend', 'id' => 'mk_api_settings'],
301 - [
302 - 'type' => 'title',
303 - 'desc' => '<br><hr><br>',
304 - ],
305 - [
306 - 'title' => __( 'Parcel Machine Map Settings', 'wc_makecommerce_domain' ),
307 - 'type' => 'title',
308 - 'desc' => __( 'Before using, please read more about the functionalities, benefits and security measures of our parcel machine map from', 'wc_makecommerce_domain' ) .
309 - ' ' . sprintf('<a target="_blank" href="%s">' .
310 - __( 'our plugin instructions', 'wc_makecommerce_domain' ) .
311 - '</a>', __( 'https://makecommerce.net/integration-modules/makecommerce-plugin-for-woocommerce/#map-view-for-the-selection-of-parcel-machines', 'wc_makecommerce_domain' ) ),
312 - 'id' => 'mc_map_settings',
313 - ],
314 - [
315 - 'title' => __( 'Enable map selection for parcel machines', 'wc_makecommerce_domain' ),
316 - 'label' => __( 'Allow customers to select their desired parcel machine from a map view', 'wc_makecommerce_domain' ),
317 - 'type' => 'checkbox',
318 - 'default' => 'no',
319 - 'id' => 'mc_parcel_machine_map',
320 - ],
321 - [
322 - 'title' => __( 'Define Google Javascript API key', 'wc_makecommerce_domain' ),
323 - 'type' => 'text',
324 - 'desc_tip' => __( 'In order to enable the map feature for parcel machine seletion, a Google Javascript API key needs to be obtained', 'wc_makecommerce_domain' ),
325 - 'class' => 'ui-map-identifier',
326 - 'id' => 'mc_google_api_key',
327 - ],
328 - [
329 - 'title' => __( 'Use Google Geocoding', 'wc_makecommerce_domain' ),
330 - 'label' => __( 'Geocoding allows the map to centralize on the shipping address', 'wc_makecommerce_domain' ),
331 - 'type' => 'checkbox',
332 - 'default' => 'no',
333 - 'id' => 'mc_map_geocoding',
334 - ],
335 - [
336 - 'title' => __( 'Define a Google Geocoding API key', 'wc_makecommerce_domain' ),
337 - 'type' => 'text',
338 - 'desc_tip' => __( 'A separate API key is recommended to be defined for Geocoding due to security reasons', 'wc_makecommerce_domain' ),
339 - 'class' => 'ui-map-identifier',
340 - 'id' => 'mc_map_geocoding_api_key',
341 - ],
342 - [
343 - 'type' => 'sectionend',
344 - 'id' => 'mc_map_settings',
345 - ],
346 - [
347 - 'type' => 'title',
348 - 'desc' => '<br><hr><br>',
349 - ],
350 - [
351 - 'id' => 'mk_module_title',
352 - 'type' => 'title',
353 - 'title' => __('Makecommerce modules', 'wc_makecommerce_domain'),
354 - 'desc' => __('Our plugin adds several modules to your shop. Here you can switch off modules that are not important for you, they will disappear from Woocommerce settings menus.<br> Each active module have their own settings dialog, where they must also be Enabled before use.', 'wc_makecommerce_domain'),
355 - 'class' => '',
356 - ],
357 - [
358 - 'id' => 'mk_transport_apt_omniva',
359 - 'type' => 'checkbox',
360 - 'default' => 'yes',
361 - 'title' => __('Omniva Parcel Machine', 'wc_makecommerce_domain'),
362 - 'desc' => __('enable Omniva parcel machines shipping method', 'wc_makecommerce_domain').' ('. sprintf(__('<a href="%s">module settings</a>', 'wc_makecommerce_domain'), admin_url('admin.php?page=wc-settings&tab=shipping&section=parcelmachine_omniva')).')',
363 - 'class' => '',
364 - ],
365 - [
366 - 'id' => 'mk_transport_apt_smartpost',
367 - 'type' => 'checkbox',
368 - 'default' => 'yes',
369 - 'title' => __('SmartPosti Parcel Machine', 'wc_makecommerce_domain'),
370 - 'desc' => __('enable SmartPosti parcel machines shipping method', 'wc_makecommerce_domain').' ('. sprintf(__('<a href="%s">module settings</a>', 'wc_makecommerce_domain'), admin_url('admin.php?page=wc-settings&tab=shipping&section=parcelmachine_smartpost')).')',
371 - 'class' => '',
372 - ],
373 - [
374 - 'id' => 'mk_transport_apt_dpd',
375 - 'type' => 'checkbox',
376 - 'default' => 'no',
377 - 'title' => __('DPD', 'wc_makecommerce_domain') . ' ' . __('parcel machine', 'wc_makecommerce_domain'),
378 - 'desc' => __('enable DPD parcel machine shipping method', 'wc_makecommerce_domain').' ('. sprintf(__('<a href="%s">module settings</a>', 'wc_makecommerce_domain'), admin_url('admin.php?page=wc-settings&tab=shipping&section=parcelmachine_dpd')).')',
379 - 'class' => '',
380 - ],
381 - [
382 - 'id' => 'mk_transport_apt_lp_express_lt',
383 - 'type' => 'checkbox',
384 - 'default' => 'no',
385 - 'title' => __('LP Express', 'wc_makecommerce_domain') . ' ' . __('parcel machine', 'wc_makecommerce_domain'),
386 - 'desc' => __('enable LP Express parcel machine shipping method', 'wc_makecommerce_domain').' ('. sprintf(__('<a href="%s">module settings</a>', 'wc_makecommerce_domain'), admin_url('admin.php?page=wc-settings&tab=shipping&section=parcelmachine_lp_express_lt')).')',
387 - 'class' => '',
388 - ],
389 - [
390 - 'id' => 'mk_transport_courier_omniva',
391 - 'type' => 'checkbox',
392 - 'default' => 'yes',
393 - 'title' => __('Omniva Courier', 'wc_makecommerce_domain'),
394 - 'desc' => __('enable Omniva courier shipping method', 'wc_makecommerce_domain').' ('. sprintf(__('<a href="%s">module settings</a>', 'wc_makecommerce_domain'), admin_url('admin.php?page=wc-settings&tab=shipping&section=courier_omniva')).')',
395 - 'class' => '',
396 - ],
397 - [
398 - 'id' => 'mk_transport_courier_smartpost',
399 - 'type' => 'checkbox',
400 - 'default' => 'yes',
401 - 'title' => __('Smartpost Courier', 'wc_makecommerce_domain'),
402 - 'desc' => __('enable Smartpost courier shipping method', 'wc_makecommerce_domain').' ('. sprintf(__('<a href="%s">module settings</a>', 'wc_makecommerce_domain'), admin_url('admin.php?page=wc-settings&tab=shipping&section=courier_smartpost')).')',
403 - 'class' => '',
404 - ],
405 - [
406 - 'id' => 'mk_transport_courier_dpd',
407 - 'type' => 'checkbox',
408 - 'default' => 'yes',
409 - 'title' => __('DPD Courier', 'wc_makecommerce_domain'),
410 - 'desc' => __('enable DPD courier shipping method', 'wc_makecommerce_domain').' ('. sprintf(__('<a href="%s">module settings</a>', 'wc_makecommerce_domain'), admin_url('admin.php?page=wc-settings&tab=shipping&section=courier_dpd')).')',
411 - 'class' => '',
412 - ],
413 - [
414 - 'id' => 'mk_javascript_ui',
415 - 'type' => 'api_javascript_ui',
416 - ],
417 - ['type' => 'sectionend', 'id' => 'mk_api_settings']
418 - ];
239 + ),
240 + array(
241 + 'id' => 'mk_shop_id',
242 + 'type' => 'text',
243 + 'title' => __('Shop ID (live)', 'wc_makecommerce_domain'),
244 + 'desc' => __('Get it from <a href="https://merchant.maksekeskus.ee/api.html" target="_blank">Merchant Portal</a>','wc_makecommerce_domain'),
245 + 'class' => 'input-text regular-input',
246 + ),
247 + array(
248 + 'id' => 'mk_private_key',
249 + 'type' => 'text',
250 + 'title' => __('Secret key (live)', 'wc_makecommerce_domain'),
251 + 'class' => 'input-text regular-input',
252 + ),
253 + array(
254 + 'id' => 'mk_public_key',
255 + 'type' => 'text',
256 + 'title' => __('Publishable key (live)', 'wc_makecommerce_domain'),
257 + 'class' => 'input-text regular-input',
258 + ),
259 + array(
260 + 'id' => 'mk_test_shop_id',
261 + 'type' => 'text',
262 + 'title' => __('Shop ID (test)', 'wc_makecommerce_domain'),
263 + 'class' => 'input-text regular-input',
264 + 'default' => 'f64b4f20-5ef9-4b7b-a6fa-d623d87f0b9c',
265 + 'desc' => __('Get it from <a href="https://merchant.test.maksekeskus.ee/api.html" target="_blank">Merchant Portal Test</a>','wc_makecommerce_domain'),
266 + ),
267 + array(
268 + 'id' => 'mk_test_private_key',
269 + 'type' => 'text',
270 + 'title' => __('Secret key (test)', 'wc_makecommerce_domain'),
271 + 'default' => 'MPjcVMoRZPAucsTuGK5ZukOlV7BlzgSvXOowJUkk9IFSQPVooRwcVOxzz3mhEpgM',
272 + 'class' => 'input-text regular-input',
273 + ),
274 + array(
275 + 'id' => 'mk_test_public_key',
276 + 'type' => 'text',
277 + 'title' => __('Publishable key (test)', 'wc_makecommerce_domain'),
278 + 'default' => '7Hog41ci2mKkmtviMycWxpNx14pNP70m',
279 + 'class' => 'input-text regular-input',
280 + ),
281 + array(
282 + 'type' => 'select',
283 + 'title' => __('Label print format', 'wc_makecommerce_domain'),
284 + 'desc' => __('In which format should shipping labels be printed. (*make sure you have API access to see more options)', 'wc_makecommerce_domain'),
285 + 'default' => 'A4',
286 + 'options' => $this->label_formats(),
287 + 'id' => 'mk_label_format'
288 + ),
289 + array('type' => 'sectionend', 'id' => 'mk_api_settings'),
290 + array(
291 + 'type' => 'title',
292 + 'desc' => '<br><hr><br>',
293 + ),
294 + array(
295 + 'id' => 'mk_module_title',
296 + 'type' => 'title',
297 + 'title' => __('Makecommerce modules', 'wc_makecommerce_domain'),
298 + 'desc' => __('Our plugin adds several modules to your shop. Here you can switch off modules that are not important for you, they will disappear from Woocommerce settings menus.<br> Each active module have their own settings dialog, where they must also be Enabled before use.', 'wc_makecommerce_domain'),
299 + 'class' => '',
300 + ),
301 + array(
302 + 'id' => 'mk_transport_apt_omniva',
303 + 'type' => 'checkbox',
304 + 'default' => 'yes',
305 + 'title' => __('Omniva Parcel Machine', 'wc_makecommerce_domain'),
306 + 'desc' => __('enable Omniva parcel machines shipping method', 'wc_makecommerce_domain').' ('. sprintf(__('<a href="%s">module settings</a>', 'wc_makecommerce_domain'), admin_url('admin.php?page=wc-settings&tab=shipping&section=parcelmachine_omniva')).')',
307 + 'class' => '',
308 + ),
309 + array(
310 + 'id' => 'mk_transport_apt_smartpost',
311 + 'type' => 'checkbox',
312 + 'default' => 'yes',
313 + 'title' => __('Smartpost Parcel Machine', 'wc_makecommerce_domain'),
314 + 'desc' => __('enable Smartpost parcel machines shipping method', 'wc_makecommerce_domain').' ('. sprintf(__('<a href="%s">module settings</a>', 'wc_makecommerce_domain'), admin_url('admin.php?page=wc-settings&tab=shipping&section=parcelmachine_smartpost')).')',
315 + 'class' => '',
316 + ),
317 + array(
318 + 'id' => 'mk_transport_apt_dpd',
319 + 'type' => 'checkbox',
320 + 'default' => 'no',
321 + 'title' => __('DPD', 'wc_makecommerce_domain') . ' ' . __('parcel machine', 'wc_makecommerce_domain'),
322 + 'desc' => __('enable DPD parcel machine shipping method', 'wc_makecommerce_domain').' ('. sprintf(__('<a href="%s">module settings</a>', 'wc_makecommerce_domain'), admin_url('admin.php?page=wc-settings&tab=shipping&section=parcelmachine_dpd')).')',
323 + 'class' => '',
324 + ),
325 + array(
326 + 'id' => 'mk_transport_courier_omniva',
327 + 'type' => 'checkbox',
328 + 'default' => 'yes',
329 + 'title' => __('Omniva Courier', 'wc_makecommerce_domain'),
330 + 'desc' => __('enable Omniva courier shipping method', 'wc_makecommerce_domain').' ('. sprintf(__('<a href="%s">module settings</a>', 'wc_makecommerce_domain'), admin_url('admin.php?page=wc-settings&tab=shipping&section=courier_omniva')).')',
331 + 'class' => '',
332 + ),
333 + array(
334 + 'id' => 'mk_transport_courier_smartpost',
335 + 'type' => 'checkbox',
336 + 'default' => 'yes',
337 + 'title' => __('Smartpost Courier', 'wc_makecommerce_domain'),
338 + 'desc' => __('enable Smartpost courier shipping method', 'wc_makecommerce_domain').' ('. sprintf(__('<a href="%s">module settings</a>', 'wc_makecommerce_domain'), admin_url('admin.php?page=wc-settings&tab=shipping&section=courier_smartpost')).')',
339 + 'class' => '',
340 + ),
341 + array(
342 + 'id' => 'mk_checkout_sco',
343 + 'type' => 'checkbox',
344 + 'title' => __('SimpleCheckout', 'wc_makecommerce_domain'),
345 + 'desc' => __('enable SimpleCheckout&trade; Checkout method', 'wc_makecommerce_domain').' ('. sprintf(__('<a href="%s">module settings</a>', 'wc_makecommerce_domain'), admin_url('admin.php?page=wc-settings&tab=checkout&section=makecommerce_sc')).')',
346 + 'class' => '',
347 + ),
348 + array(
349 + 'id' => 'mk_javascript_ui',
350 + 'type' => 'api_javascript_ui',
351 + ),
352 + array('type' => 'sectionend', 'id' => 'mk_api_settings')
353 + );
419 354 }
420 355
421 356 /**
422 - * Function for resetting machines and payment methods when API type is changed
423 - *
424 - * @since 3.2.1
425 - */
426 - public function mk_delete_api_cache() {
427 -
428 - global $wpdb;
429 - $tableName = $wpdb->prefix . MAKECOMMERCE_TABLENAME;
430 -
431 - // Delete machines' cache and timer
432 - delete_option( 'mk_machines_expires' );
433 - delete_option( 'mk_machines_cache' );
434 -
435 - // Delete payment methods
436 - $wpdb->query( 'TRUNCATE TABLE `'.$tableName.'`' );
437 - }
438 -
439 - /**
440 357 * Notice for missing API information
441 358 *
442 359 * @since 3.0.0
443 360 */
@@ -454,123 +371,6 @@
454 371 <?php } ?>
455 372 </p>
456 373 </div>
457 374 <?php
458 - }
459 -
460 -
461 - public function shipping_api_notice()
462 - {
463 - ?>
464 - <div class="notice notice-success">
465 - <p>
466 - <strong><?php echo __('MakeCommerce Shipping+ is now available', 'wc_makecommerce_domain'); ?> </strong> <br/>
467 - <?php echo __("You're still using the legacy version —", 'wc_makecommerce_domain'); ?>
468 - <a href="<?php echo admin_url('admin.php?page=makecommerce_shipping_plus'); ?>"><?php echo __('click here to switch to the new module', 'wc_makecommerce_domain'); ?></a>
469 - </p>
470 - </div>
471 - <?php
472 - }
473 -
474 - // Separate Admin page for Shipping+ confirmation, when user checks shipping+ in old version
475 - public function enqueue_shipping_plus_assets($hook): void
476 - {
477 - if ($hook !== 'admin_page_makecommerce_shipping_plus') {
478 - return;
479 - }
480 -
481 - wp_enqueue_style(
482 - 'makecommerce-bootstrap',
483 - plugin_dir_url(__DIR__) . 'makecommerce/assets/bootstrap.5.3.3.min.css'
484 - );
485 -
486 - wp_enqueue_style(
487 - 'shipping-confirm',
488 - 'https://static.maksekeskus.ee/modules/woocommerce/css/shipping-confirm.css'
489 - );
490 -
491 - wp_enqueue_script(
492 - 'makecommerce-bootstrap',
493 - plugin_dir_url(__DIR__) . 'makecommerce/assets/bootstrap.bundle.min.js',
494 - [],
495 - null,
496 - true
497 - );
498 - }
499 - public function add_shipping_plus_admin_page()
500 - {
501 - add_submenu_page(
502 - 'shipping_plus',
503 - 'Shipping+ Confirmation',
504 - 'Shipping+ Confirmation',
505 - 'manage_options',
506 - 'makecommerce_shipping_plus',
507 - [$this, 'render_shipping_plus_page']
508 - );
509 - }
510 -
511 - public function remove_shipping_confirm_menu(): void {
512 - remove_submenu_page( 'shipping_plus', 'makecommerce_shipping_plus' );
513 - }
514 -
515 - public function render_shipping_plus_page()
516 - {
517 - $file = plugin_dir_path(__FILE__) . 'templates/shipping_confirm.php';
518 -
519 - if (file_exists($file)) {
520 - include $file;
521 - } else {
522 - echo '<div class="wrap"><h1>Page not found</h1></div>';
523 - }
524 - }
525 -
526 - public function hide_shipping_admin_notices(): void
527 - {
528 - $screen = get_current_screen();
529 -
530 - if ($screen && $screen->id === 'admin_page_makecommerce_shipping_plus') {
531 - remove_all_actions('admin_notices');
532 - remove_all_actions('all_admin_notices');
533 - }
534 - }
535 -
536 - public function save_shipping_plus_confirmation(): void
537 - {
538 - if (
539 - isset($_POST['accept_shipping']) &&
540 - $_GET['page'] === 'makecommerce_shipping_plus'
541 - ) {
542 - update_option('mc_shipping_plus_confirmed', 'yes');
543 - update_option('mc_shipping_plus', 'yes');
544 - update_option('makecommerce_install_status', 'upgrade');
545 - $this->mc_shipping_plus_creds_migration();
546 - wp_redirect(admin_url('admin.php?page=makecommerce_dashboard'));
547 - exit;
548 - }
549 - }
550 -
551 - /**
552 - * Run credentials migration when 'mc_shipping_plus' is turned on
553 - *
554 - * @return void
555 - */
556 - private function mc_shipping_plus_creds_migration(): void
557 - {
558 - $migration_map = [
559 - 'mc_shop_id' => 'mk_shop_id',
560 - 'mc_secret_key' => 'mk_private_key',
561 - 'mc_public_key' => 'mk_public_key',
562 - 'mc_test_shop_id' => 'mk_test_shop_id',
563 - 'mc_test_secret_key' => 'mk_test_private_key',
564 - 'mc_test_public_key' => 'mk_test_public_key',
565 - 'mc_api_mode' => 'mk_api_type',
566 - ];
567 -
568 - foreach ($migration_map as $new_key => $old_key) {
569 - $old_value = get_option($old_key, null);
570 -
571 - if ($old_value !== null) {
572 - update_option($new_key, $old_value);
573 - }
574 - }
575 375 }
576 376 }