| 1 |
<?php |
| 2 |
/****************************************************************************************** |
| 3 |
* Copyright (C) Smackcoders. - All Rights Reserved under Smackcoders Proprietary License |
| 4 |
* Unauthorized copying of this file, via any medium is strictly prohibited |
| 5 |
* Proprietary and confidential |
| 6 |
* You can contact Smackcoders at email address info@smackcoders.com. |
| 7 |
*******************************************************************************************/ |
| 8 |
|
| 9 |
namespace Smackcoders\SMUSERS; |
| 10 |
|
| 11 |
if ( ! defined( 'ABSPATH' ) ) |
| 12 |
exit; // Exit if accessed directly |
| 13 |
|
| 14 |
class BSIImport extends UsersImport { |
| 15 |
private static $bsi_instance = null; |
| 16 |
|
| 17 |
public static function getInstance() { |
| 18 |
if (BSIImport::$bsi_instance == null) { |
| 19 |
BSIImport::$bsi_instance = new BSIImport; |
| 20 |
global $bsi_instance; |
| 21 |
return BSIImport::$bsi_instance; |
| 22 |
} |
| 23 |
return BSIImport::$bsi_instance; |
| 24 |
} |
| 25 |
public function set_bsi_values($header_array ,$value_array , $map, $post_id , $type){ |
| 26 |
$post_values = []; |
| 27 |
$helpers_instance = ImportHelpers::getInstance(); |
| 28 |
$post_values = $helpers_instance->get_header_values($map , $header_array , $value_array); |
| 29 |
|
| 30 |
$this->bsi_import_function($post_values, $post_id); |
| 31 |
} |
| 32 |
|
| 33 |
public function bsi_import_function($data_array, $uID){ |
| 34 |
foreach( $data_array as $daKey => $daVal ) { |
| 35 |
if(strpos($daKey, 'msi_') === 0) { |
| 36 |
$msi_custom_key = substr($daKey, 4); |
| 37 |
$msi_shipping_array[$msi_custom_key] = $daVal; |
| 38 |
} elseif(strpos($daKey, 'mbi_') === 0) { |
| 39 |
$mbi_custom_key = substr($daKey, 4); |
| 40 |
$mbi_billing_array[$mbi_custom_key] = $daVal; |
| 41 |
} else { |
| 42 |
update_user_meta($uID, $daKey, $daVal); |
| 43 |
} |
| 44 |
} |
| 45 |
//Import MarketPress Shipping Info |
| 46 |
if (!empty ($msi_shipping_array)) { |
| 47 |
$custom_key = 'mp_shipping_info'; |
| 48 |
update_user_meta($uID, $custom_key, $msi_shipping_array); |
| 49 |
} |
| 50 |
//Import MarketPress Billing Info |
| 51 |
if (!empty ($mbi_billing_array)) { |
| 52 |
$custom_key = 'mp_billing_info'; |
| 53 |
update_user_meta($uID, $custom_key, $mbi_billing_array); |
| 54 |
} |
| 55 |
} |
| 56 |
} |
| 57 |
global $billing_class; |
| 58 |
$billing_class = new BSIImport(); |
| 59 |
|