Version Description
- Import /Export WordPress Users.
=
Download this release
Release Info
Developer | hikeforce |
Plugin | Import Export WordPress Users and WooCommerce Customers |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- Sample_Users.csv +2 -0
- customer-import-export.php +130 -0
- images/calendar.png +0 -0
- images/wf-ajax-loader.gif +0 -0
- images/wf-failed.png +0 -0
- images/wf-import.png +0 -0
- images/wf-notice.png +0 -0
- images/wf-success.png +0 -0
- includes/class-wf-customerimpexpcsv-admin-screen.php +84 -0
- includes/class-wf-customerimpexpcsv-ajax-handler.php +25 -0
- includes/exporter/class-wf-customerimpexpcsv-exporter.php +133 -0
- includes/exporter/data/data-wf-post-columns.php +22 -0
- includes/importer/class-wf-csv-parser.php +231 -0
- includes/importer/class-wf-customerimpexpcsv-customer-import.php +814 -0
- includes/importer/class-wf-customerimpexpcsv-importer.php +41 -0
- includes/importer/data/data-wf-reserved-fields-pair.php +21 -0
- includes/importer/views/html-wf-import-greeting.php +29 -0
- includes/importer/views/html-wf-import-options.php +15 -0
- includes/settings/class-wf-customerimpexpcsv-settings.php +17 -0
- includes/views/export/html-wf-export-customers.php +85 -0
- includes/views/html-wf-admin-screen.php +17 -0
- includes/views/import/html-wf-import-customers.php +42 -0
- lang/wf_customer_import_export-fr_FR.po +0 -0
- license.txt +708 -0
- readme.txt +85 -0
- styles/wf-style.css +125 -0
- temp-import.csv +0 -0
Sample_Users.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
ID,user_login,user_pass,user_nicename,user_email,user_url,user_registered,display_name,first_name,last_name,user_status,roles
|
2 |
+
9,Mark,$P$By6K6/oknjRBovyyxs3sCDogZgO6ST1,mark,mark@xadapter.com,http://www.xadapter.com,2016-10-20 11:52:04,Mark,Mark,Wough,,"subscriber, customer"
|
customer-import-export.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Plugin Name: WordPress Users & WooCommerce Customers Import Export(BASIC)
|
5 |
+
Plugin URI: http://www.xadapter.com/product/wordpress-users-woocommerce-customers-import-export/
|
6 |
+
Description: Export and Import User/Customers details From and To your WordPress/WooCommerce.
|
7 |
+
Author: HikeForce
|
8 |
+
Author URI: http://www.xadapter.com/vendor/hikeforce/
|
9 |
+
Version: 1.0.0
|
10 |
+
Text Domain: wf_customer_import_export
|
11 |
+
*/
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
if (!defined('ABSPATH') || !is_admin()) {
|
16 |
+
return;
|
17 |
+
}
|
18 |
+
|
19 |
+
define("WF_CUSTOMER_IMP_EXP_ID", "wf_customer_imp_exp");
|
20 |
+
define("HF_WORDPRESS_CUSTOMER_IM_EX", "hf_wordpress_customer_im_ex");
|
21 |
+
|
22 |
+
|
23 |
+
if (!class_exists('WF_Customer_Import_Export_CSV')) :
|
24 |
+
|
25 |
+
/*
|
26 |
+
* Main CSV Import class
|
27 |
+
*/
|
28 |
+
|
29 |
+
class WF_Customer_Import_Export_CSV {
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*/
|
34 |
+
public function __construct() {
|
35 |
+
define('WF_CustomerImpExpCsv_FILE', __FILE__);
|
36 |
+
|
37 |
+
add_filter('woocommerce_screen_ids', array($this, 'woocommerce_screen_ids'));
|
38 |
+
add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'wf_plugin_action_links'));
|
39 |
+
add_action('init', array($this, 'load_plugin_textdomain'));
|
40 |
+
add_action('init', array($this, 'catch_export_request'), 20);
|
41 |
+
add_action('init', array($this, 'catch_save_settings'), 20);
|
42 |
+
add_action('admin_init', array($this, 'register_importers'));
|
43 |
+
|
44 |
+
include_once( 'includes/class-wf-customerimpexpcsv-admin-screen.php' );
|
45 |
+
include_once( 'includes/importer/class-wf-customerimpexpcsv-importer.php' );
|
46 |
+
|
47 |
+
if (defined('DOING_AJAX')) {
|
48 |
+
include_once( 'includes/class-wf-customerimpexpcsv-ajax-handler.php' );
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
public function wf_plugin_action_links($links) {
|
53 |
+
$plugin_links = array(
|
54 |
+
'<a href="' . admin_url('admin.php?page=hf_wordpress_customer_im_ex') . '">' . __('Import Export Users/Customers', 'wf_customer_import_export') . '</a>',
|
55 |
+
'<a href="http://www.xadapter.com/support/forum/wordpress-users-woocommerce-customers-import-export/">' . __('Support', 'wf_customer_import_export') . '</a>',
|
56 |
+
);
|
57 |
+
return array_merge($plugin_links, $links);
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Add screen ID
|
62 |
+
*/
|
63 |
+
public function woocommerce_screen_ids($ids) {
|
64 |
+
$ids[] = 'admin'; // For import screen
|
65 |
+
return $ids;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Handle localisation
|
70 |
+
*/
|
71 |
+
public function load_plugin_textdomain() {
|
72 |
+
load_plugin_textdomain('wf_customer_import_export', false, dirname(plugin_basename(__FILE__)) . '/lang/');
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Catches an export request and exports the data. This class is only loaded in admin.
|
77 |
+
*/
|
78 |
+
public function catch_export_request() {
|
79 |
+
if (!empty($_GET['action']) && !empty($_GET['page']) && $_GET['page'] == 'hf_wordpress_customer_im_ex') {
|
80 |
+
switch ($_GET['action']) {
|
81 |
+
case "export" :
|
82 |
+
$user_ok = $this->hf_user_permission();
|
83 |
+
if ($user_ok) {
|
84 |
+
include_once( 'includes/exporter/class-wf-customerimpexpcsv-exporter.php' );
|
85 |
+
WF_CustomerImpExpCsv_Exporter::do_export();
|
86 |
+
} else {
|
87 |
+
wp_redirect(wp_login_url());
|
88 |
+
}
|
89 |
+
break;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
public function catch_save_settings() {
|
95 |
+
if (!empty($_GET['action']) && !empty($_GET['page']) && $_GET['page'] == 'hf_wordpress_customer_im_ex') {
|
96 |
+
switch ($_GET['action']) {
|
97 |
+
case "settings" :
|
98 |
+
include_once( 'includes/settings/class-wf-customerimpexpcsv-settings.php' );
|
99 |
+
WF_CustomerImpExpCsv_Settings::save_settings();
|
100 |
+
break;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Register importers for use
|
107 |
+
*/
|
108 |
+
public function register_importers() {
|
109 |
+
register_importer('wordpress_hf_user_csv', 'WordPress User/Customers (CSV)', __('Import <strong>users/customers</strong> to your site via a csv file.', 'wf_customer_import_export'), 'WF_CustomerImpExpCsv_Importer::customer_importer');
|
110 |
+
}
|
111 |
+
|
112 |
+
private function hf_user_permission() {
|
113 |
+
// Check if user has rights to export
|
114 |
+
$current_user = wp_get_current_user();
|
115 |
+
$user_ok = false;
|
116 |
+
$wf_roles = apply_filters('hf_user_permission_roles', array('administrator', 'shop_manager'));
|
117 |
+
if ($current_user instanceof WP_User) {
|
118 |
+
$can_users = array_intersect($wf_roles, $current_user->roles);
|
119 |
+
if (!empty($can_users)) {
|
120 |
+
$user_ok = true;
|
121 |
+
}
|
122 |
+
}
|
123 |
+
return $user_ok;
|
124 |
+
}
|
125 |
+
|
126 |
+
}
|
127 |
+
|
128 |
+
endif;
|
129 |
+
|
130 |
+
new WF_Customer_Import_Export_CSV();
|
images/calendar.png
ADDED
Binary file
|
images/wf-ajax-loader.gif
ADDED
Binary file
|
images/wf-failed.png
ADDED
Binary file
|
images/wf-import.png
ADDED
Binary file
|
images/wf-notice.png
ADDED
Binary file
|
images/wf-success.png
ADDED
Binary file
|
includes/class-wf-customerimpexpcsv-admin-screen.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (!defined('ABSPATH')) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
|
6 |
+
class WF_CustomerImpExpCsv_Admin_Screen {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Constructor
|
10 |
+
*/
|
11 |
+
public function __construct() {
|
12 |
+
add_action('admin_menu', array($this, 'admin_menu'));
|
13 |
+
add_action('admin_print_styles', array($this, 'admin_scripts'));
|
14 |
+
add_action('admin_notices', array($this, 'admin_notices'));
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Notices in admin
|
19 |
+
*/
|
20 |
+
public function admin_notices() {
|
21 |
+
if (!function_exists('mb_detect_encoding')) {
|
22 |
+
echo '<div class="error"><p>' . __('User/Customer CSV Import Export requires the function <code>mb_detect_encoding</code> to import and export CSV files. Please ask your hosting provider to enable this function.', 'wf_customer_import_export') . '</p></div>';
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Admin Menu
|
28 |
+
*/
|
29 |
+
public function admin_menu() {
|
30 |
+
$page = add_users_page( __( 'User Import Export', 'wf_customer_import_export' ), __( 'User Import Export', 'wf_customer_import_export' ), 'list_users', 'hf_wordpress_customer_im_ex', array( $this, 'output' ) );
|
31 |
+
$page1 = add_submenu_page( 'woocommerce', __( 'Customer Import Export', 'wf_customer_import_export' ), __( 'Customer Import Export', 'wf_customer_import_export' ), 'manage_woocommerce', 'hf_wordpress_customer_im_ex', array( $this, 'output' ) );
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Admin Scripts
|
36 |
+
*/
|
37 |
+
public function admin_scripts() {
|
38 |
+
global $wp_scripts;
|
39 |
+
if(function_exists('WC')){
|
40 |
+
wp_enqueue_style('woocommerce_admin_styles', WC()->plugin_url() . '/assets/css/admin.css');
|
41 |
+
}
|
42 |
+
wp_enqueue_style('woocommerce-user-csv-importer', plugins_url(basename(plugin_dir_path(WF_CustomerImpExpCsv_FILE)) . '/styles/wf-style.css', basename(__FILE__)), '', '1.0.0', 'screen');
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Admin Screen output
|
47 |
+
*/
|
48 |
+
public function output() {
|
49 |
+
$tab = 'import';
|
50 |
+
|
51 |
+
if (!empty($_GET['tab'])) {
|
52 |
+
if ($_GET['tab'] == 'export') {
|
53 |
+
$tab = 'export';
|
54 |
+
} else if ($_GET['tab'] == 'settings') {
|
55 |
+
$tab = 'settings';
|
56 |
+
}
|
57 |
+
}
|
58 |
+
include( 'views/html-wf-admin-screen.php' );
|
59 |
+
}
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Admin page for importing
|
65 |
+
*/
|
66 |
+
public function admin_import_page() {
|
67 |
+
|
68 |
+
include( 'views/import/html-wf-import-customers.php' );
|
69 |
+
$post_columns = include( 'exporter/data/data-wf-post-columns.php' );
|
70 |
+
include( 'views/export/html-wf-export-customers.php' );
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Admin Page for exporting
|
75 |
+
*/
|
76 |
+
public function admin_export_page() {
|
77 |
+
$post_columns = include( 'exporter/data/data-wf-post-columns.php' );
|
78 |
+
include( 'views/export/html-wf-export-customers.php' );
|
79 |
+
}
|
80 |
+
|
81 |
+
|
82 |
+
}
|
83 |
+
|
84 |
+
new WF_CustomerImpExpCsv_Admin_Screen();
|
includes/class-wf-customerimpexpcsv-ajax-handler.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
|
6 |
+
class WF_CustomerImpExpCsv_AJAX_Handler {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Constructor
|
10 |
+
*/
|
11 |
+
public function __construct() {
|
12 |
+
add_action( 'wp_ajax_user_csv_import_request', array( $this, 'csv_customer_import_request' ) );
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Ajax event for importing a CSV
|
17 |
+
*/
|
18 |
+
public function csv_customer_import_request() {
|
19 |
+
define( 'WP_LOAD_IMPORTERS', true );
|
20 |
+
WF_CustomerImpExpCsv_Importer::customer_importer();
|
21 |
+
}
|
22 |
+
|
23 |
+
}
|
24 |
+
|
25 |
+
new WF_CustomerImpExpCsv_AJAX_Handler();
|
includes/exporter/class-wf-customerimpexpcsv-exporter.php
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
class WF_CustomerImpExpCsv_Exporter {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Customer Exporter Tool
|
11 |
+
*/
|
12 |
+
public static function do_export() {
|
13 |
+
global $wpdb;
|
14 |
+
|
15 |
+
$export_limit = !empty($_POST['limit']) ? intval($_POST['limit']) : 999999999;
|
16 |
+
$export_offset = !empty($_POST['offset']) ? intval($_POST['offset']) : 0;
|
17 |
+
$csv_columns = include( 'data/data-wf-post-columns.php' );
|
18 |
+
|
19 |
+
$user_columns_name = !empty($_POST['columns_name']) ? $_POST['columns_name'] : $csv_columns;
|
20 |
+
$export_columns = !empty($_POST['columns']) ? $_POST['columns'] : array();
|
21 |
+
|
22 |
+
$export_user_roles = !empty($_POST['user_roles']) ? $_POST['user_roles'] : array();
|
23 |
+
$delimiter = !empty($_POST['delimiter']) ? $_POST['delimiter'] : ',';
|
24 |
+
|
25 |
+
|
26 |
+
$wpdb->hide_errors();
|
27 |
+
@set_time_limit(0);
|
28 |
+
if (function_exists('apache_setenv'))
|
29 |
+
@apache_setenv('no-gzip', 1);
|
30 |
+
@ini_set('zlib.output_compression', 0);
|
31 |
+
@ob_clean();
|
32 |
+
|
33 |
+
header('Content-Type: text/csv; charset=UTF-8');
|
34 |
+
header('Content-Disposition: attachment; filename=Customer-Export-' . date('Y_m_d_H_i_s', current_time('timestamp')) . ".csv");
|
35 |
+
header('Pragma: no-cache');
|
36 |
+
header('Expires: 0');
|
37 |
+
|
38 |
+
$fp = fopen('php://output', 'w');
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
$args = array(
|
43 |
+
'fields' => 'ID', // exclude standard wp_users fields from get_users query -> get Only ID##
|
44 |
+
'role__in' => $export_user_roles, //An array of role names. Matched users must have at least one of these roles. Default empty array.
|
45 |
+
'number' => $export_limit, // number of users to retrieve
|
46 |
+
'offset' => $export_offset // offset to skip from list
|
47 |
+
);
|
48 |
+
|
49 |
+
$users = get_users($args);
|
50 |
+
|
51 |
+
// Variable to hold the CSV data we're exporting
|
52 |
+
$row = array();
|
53 |
+
|
54 |
+
// Export header rows
|
55 |
+
foreach ($csv_columns as $column => $value) {
|
56 |
+
$temp_head = esc_attr($user_columns_name[$column]);
|
57 |
+
if (!$export_columns || in_array($column, $export_columns))
|
58 |
+
$row[] = $temp_head;
|
59 |
+
}
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
$row = array_map('WF_CustomerImpExpCsv_Exporter::wrap_column', $row);
|
65 |
+
fwrite($fp, implode($delimiter, $row) . "\n");
|
66 |
+
unset($row);
|
67 |
+
|
68 |
+
// Loop users
|
69 |
+
foreach ($users as $user) {
|
70 |
+
//$row = array();
|
71 |
+
$data = WF_CustomerImpExpCsv_Exporter::get_customers_csv_row($user, $export_columns, $csv_columns);
|
72 |
+
$row = array_map('WF_CustomerImpExpCsv_Exporter::wrap_column', $data);
|
73 |
+
fwrite($fp, implode($delimiter, $row) . "\n");
|
74 |
+
unset($row);
|
75 |
+
unset($data);
|
76 |
+
}
|
77 |
+
|
78 |
+
fclose($fp);
|
79 |
+
exit;
|
80 |
+
}
|
81 |
+
|
82 |
+
public static function format_data($data) {
|
83 |
+
//if (!is_array($data));
|
84 |
+
//$data = (string) urldecode($data);
|
85 |
+
$enc = mb_detect_encoding($data, 'UTF-8, ISO-8859-1', true);
|
86 |
+
$data = ( $enc == 'UTF-8' ) ? $data : utf8_encode($data);
|
87 |
+
return $data;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Wrap a column in quotes for the CSV
|
92 |
+
* @param string data to wrap
|
93 |
+
* @return string wrapped data
|
94 |
+
*/
|
95 |
+
public static function wrap_column($data) {
|
96 |
+
return '"' . str_replace('"', '""', $data) . '"';
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Get the customer data for a single CSV row
|
101 |
+
* @since 3.0
|
102 |
+
* @param int $customer_id
|
103 |
+
* @param array $export_columns - user selected columns / all
|
104 |
+
* @return array $meta_keys customer/user meta data
|
105 |
+
*/
|
106 |
+
public static function get_customers_csv_row($id, $export_columns, $csv_columns) {
|
107 |
+
|
108 |
+
$user = get_user_by('ID', $id);
|
109 |
+
|
110 |
+
$customer_data = array();
|
111 |
+
foreach ($csv_columns as $key) {
|
112 |
+
|
113 |
+
$customer_data[$key] = !empty($user->{$key}) ? maybe_serialize($user->{$key}) : '';
|
114 |
+
}
|
115 |
+
$customer_data['roles'] = implode(', ', $user->roles);
|
116 |
+
|
117 |
+
foreach ($customer_data as $key => $value) {
|
118 |
+
if (!$export_columns || in_array($key, $export_columns)) {
|
119 |
+
// need to modify code
|
120 |
+
} else {
|
121 |
+
unset($customer_data[$key]);
|
122 |
+
}
|
123 |
+
}
|
124 |
+
/*
|
125 |
+
* CSV Customer Export Row.
|
126 |
+
* Filter the individual row data for the customer export
|
127 |
+
* @since 3.0
|
128 |
+
* @param array $customer_data
|
129 |
+
*/
|
130 |
+
return apply_filters('hf_customer_csv_export_data', $customer_data);
|
131 |
+
}
|
132 |
+
|
133 |
+
}
|
includes/exporter/data/data-wf-post-columns.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
$columns = array(
|
8 |
+
'ID' => 'ID',
|
9 |
+
'user_login' => 'user_login',
|
10 |
+
'user_pass' => 'user_pass',
|
11 |
+
'user_nicename' => 'user_nicename',
|
12 |
+
'user_email' => 'user_email',
|
13 |
+
'user_url' => 'user_url',
|
14 |
+
'user_registered' => 'user_registered',
|
15 |
+
'display_name' => 'display_name',
|
16 |
+
'first_name' => 'first_name',
|
17 |
+
'last_name' => 'last_name',
|
18 |
+
'user_status' => 'user_status',
|
19 |
+
'roles' => 'roles'
|
20 |
+
);
|
21 |
+
|
22 |
+
return apply_filters('hf_csv_customer_post_columns', $columns);
|
includes/importer/class-wf-csv-parser.php
ADDED
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce CSV Importer class for managing parsing of CSV files.
|
4 |
+
*/
|
5 |
+
class WF_CSV_Parser {
|
6 |
+
|
7 |
+
var $row;
|
8 |
+
var $post_type;
|
9 |
+
var $posts = array();
|
10 |
+
var $processed_posts = array();
|
11 |
+
var $file_url_import_enabled = true;
|
12 |
+
var $log;
|
13 |
+
var $merged = 0;
|
14 |
+
var $skipped = 0;
|
15 |
+
var $imported = 0;
|
16 |
+
var $errored = 0;
|
17 |
+
var $id;
|
18 |
+
var $file_url;
|
19 |
+
var $delimiter;
|
20 |
+
var $send_mail;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Constructor
|
24 |
+
*/
|
25 |
+
public function __construct( $post_type = 'user' ) {
|
26 |
+
$this->post_type = $post_type;
|
27 |
+
$this->user_base_fields = array(
|
28 |
+
'ID' => 'ID',
|
29 |
+
'user_login' => 'user_login',
|
30 |
+
'user_pass' => 'user_pass',
|
31 |
+
'user_nicename' => 'user_nicename',
|
32 |
+
'user_email' => 'user_email',
|
33 |
+
'user_url' => 'user_url',
|
34 |
+
'user_registered' => 'user_registered',
|
35 |
+
'display_name' => 'display_name',
|
36 |
+
'first_name' => 'first_name',
|
37 |
+
'last_name' => 'last_name',
|
38 |
+
'user_status' => 'user_status',
|
39 |
+
'roles' => 'roles'
|
40 |
+
);
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Format data from the csv file
|
47 |
+
* @param string $data
|
48 |
+
* @param string $enc
|
49 |
+
* @return string
|
50 |
+
*/
|
51 |
+
public function format_data_from_csv( $data, $enc ) {
|
52 |
+
return ( $enc == 'UTF-8' ) ? $data : utf8_encode( $data );
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Parse the data
|
57 |
+
* @param string $file [description]
|
58 |
+
* @param string $delimiter [description]
|
59 |
+
* @param array $mapping [description]
|
60 |
+
* @param integer $start_pos [description]
|
61 |
+
* @param integer $end_pos [description]
|
62 |
+
* @return array
|
63 |
+
*/
|
64 |
+
public function parse_data( $file, $delimiter, $mapping, $start_pos = 0, $end_pos = null, $eval_field ) {
|
65 |
+
// Set locale
|
66 |
+
$enc = mb_detect_encoding( $file, 'UTF-8, ISO-8859-1', true );
|
67 |
+
if ( $enc )
|
68 |
+
setlocale( LC_ALL, 'en_US.' . $enc );
|
69 |
+
@ini_set( 'auto_detect_line_endings', true );
|
70 |
+
|
71 |
+
$parsed_data = array();
|
72 |
+
$raw_headers = array();
|
73 |
+
|
74 |
+
// Put all CSV data into an associative array
|
75 |
+
if ( ( $handle = fopen( $file, "r" ) ) !== FALSE ) {
|
76 |
+
|
77 |
+
$header = fgetcsv( $handle, 0, $delimiter );
|
78 |
+
if ( $start_pos != 0 )
|
79 |
+
fseek( $handle, $start_pos );
|
80 |
+
|
81 |
+
while ( ( $postmeta = fgetcsv( $handle, 0, $delimiter ) ) !== FALSE ) {
|
82 |
+
$row = array();
|
83 |
+
|
84 |
+
foreach ( $header as $key => $heading ) {
|
85 |
+
$s_heading = $heading;
|
86 |
+
|
87 |
+
// Check if this heading is being mapped to a different field
|
88 |
+
if ( isset( $mapping[$s_heading] ) ) {
|
89 |
+
if ( $mapping[$s_heading] == 'import_as_meta' ) {
|
90 |
+
|
91 |
+
$s_heading = 'meta:' . $s_heading;
|
92 |
+
|
93 |
+
}else {
|
94 |
+
$s_heading = esc_attr( $mapping[$s_heading] );
|
95 |
+
}
|
96 |
+
}
|
97 |
+
foreach ($mapping as $mkey => $mvalue) {
|
98 |
+
if(trim($mvalue) === trim($heading)){
|
99 |
+
$s_heading = $mkey;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
if ( $s_heading == '' )
|
104 |
+
continue;
|
105 |
+
|
106 |
+
// Add the heading to the parsed data
|
107 |
+
$row[$s_heading] = ( isset( $postmeta[$key] ) ) ? $this->format_data_from_csv( $postmeta[$key], $enc ) : '';
|
108 |
+
|
109 |
+
$row[$s_heading] = $this->evaluate_field($row[$s_heading], $eval_field[$s_heading]);
|
110 |
+
|
111 |
+
// Raw Headers stores the actual column name in the CSV
|
112 |
+
$raw_headers[ $s_heading ] = $heading;
|
113 |
+
}
|
114 |
+
$parsed_data[] = $row;
|
115 |
+
|
116 |
+
unset( $postmeta, $row );
|
117 |
+
|
118 |
+
$position = ftell( $handle );
|
119 |
+
|
120 |
+
if ( $end_pos && $position >= $end_pos )
|
121 |
+
break;
|
122 |
+
}
|
123 |
+
fclose( $handle );
|
124 |
+
}
|
125 |
+
return array( $parsed_data, $raw_headers, $position );
|
126 |
+
}
|
127 |
+
|
128 |
+
private function evaluate_field($value, $evaluation_field){
|
129 |
+
$processed_value = $value;
|
130 |
+
if(!empty($evaluation_field)){
|
131 |
+
$operator = substr($evaluation_field, 0, 1);
|
132 |
+
if(in_array($operator, array('=', '+', '-', '*', '/', '&' , '@'))){
|
133 |
+
$eval_val = substr($evaluation_field, 1);
|
134 |
+
switch($operator){
|
135 |
+
case '=':
|
136 |
+
$processed_value = trim($eval_val);
|
137 |
+
break;
|
138 |
+
case '+':
|
139 |
+
$processed_value = $this->hf_currency_formatter($value) + $eval_val;
|
140 |
+
break;
|
141 |
+
case '-':
|
142 |
+
$processed_value = $value - $eval_val;
|
143 |
+
break;
|
144 |
+
case '*':
|
145 |
+
$processed_value = $value * $eval_val;
|
146 |
+
break;
|
147 |
+
case '/':
|
148 |
+
$processed_value = $value / $eval_val;
|
149 |
+
break;
|
150 |
+
case '@':
|
151 |
+
$date = DateTime::createFromFormat($eval_val, $value);
|
152 |
+
$processed_value = $date->format('Y-m-d H:i:s');
|
153 |
+
break;
|
154 |
+
case '&':
|
155 |
+
if (strpos($eval_val, '[VAL]') !== false) {
|
156 |
+
$processed_value = str_replace('[VAL]',$value,$eval_val);
|
157 |
+
}
|
158 |
+
else{
|
159 |
+
$processed_value = $value . $eval_val;
|
160 |
+
}
|
161 |
+
break;
|
162 |
+
}
|
163 |
+
}
|
164 |
+
}
|
165 |
+
return $processed_value;
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Parse users
|
170 |
+
* @param array $item
|
171 |
+
* @param integer $merge_empty_cells
|
172 |
+
* @return array
|
173 |
+
*/
|
174 |
+
|
175 |
+
|
176 |
+
|
177 |
+
|
178 |
+
public function parse_users( $item, $raw_headers, $merging, $record_offset ) {
|
179 |
+
|
180 |
+
|
181 |
+
global $WF_CSV_User_Import, $wpdb;
|
182 |
+
|
183 |
+
$results = array();
|
184 |
+
$row = 0;
|
185 |
+
$skipped = 0;
|
186 |
+
|
187 |
+
$row++;
|
188 |
+
if ( $row <= $record_offset ) {
|
189 |
+
if($WF_CSV_User_Import->log)
|
190 |
+
$WF_CSV_User_Import->log->add( 'user-csv-import', sprintf( __( '> Row %s - skipped due to record offset.', 'wf_customer_import_export' ), $row ) );
|
191 |
+
unset($item);
|
192 |
+
return;
|
193 |
+
}
|
194 |
+
if ( empty($item['user_email']) ) {
|
195 |
+
if($WF_CSV_User_Import->log)
|
196 |
+
$WF_CSV_User_Import->log->add( 'user-csv-import', sprintf( __( '> Row %s - skipped: cannot insert user without email.', 'wf_customer_import_export' ), $row ) );
|
197 |
+
unset($item);
|
198 |
+
return;
|
199 |
+
}elseif(!is_email($item['user_email'])){
|
200 |
+
if($WF_CSV_User_Import->log)
|
201 |
+
$WF_CSV_User_Import->log->add( 'user-csv-import', sprintf( __( '> Row %s - skipped: Email is not valid.', 'wf_customer_import_export' ), $row ) );
|
202 |
+
unset($item);
|
203 |
+
return;
|
204 |
+
}
|
205 |
+
|
206 |
+
$user_details = array();
|
207 |
+
foreach ($this->user_base_fields as $key => $value) {
|
208 |
+
$user_details[$key] = isset( $item[$value] ) ? $item[$value] : "" ;
|
209 |
+
}
|
210 |
+
|
211 |
+
|
212 |
+
$parsed_details = array();
|
213 |
+
|
214 |
+
$parsed_details['user_details'] = $user_details;
|
215 |
+
|
216 |
+
|
217 |
+
// the $user_details array will now contain the necessary name-value pairs for the wp_users table
|
218 |
+
$results[] = $parsed_details;
|
219 |
+
|
220 |
+
// Result
|
221 |
+
return array(
|
222 |
+
$this->post_type => $results,
|
223 |
+
'skipped' => $skipped,
|
224 |
+
);
|
225 |
+
}
|
226 |
+
|
227 |
+
function hf_currency_formatter($price){
|
228 |
+
$decimal_seperator = wc_get_price_decimal_separator();
|
229 |
+
return ereg_replace("[^0-9\\'.$decimal_seperator.']", "", $price);
|
230 |
+
}
|
231 |
+
}
|
includes/importer/class-wf-customerimpexpcsv-customer-import.php
ADDED
@@ -0,0 +1,814 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WordPress Importer class for managing the import process of a CSV file
|
4 |
+
*
|
5 |
+
* @package WordPress
|
6 |
+
* @subpackage Importer
|
7 |
+
*/
|
8 |
+
if (!class_exists('WP_Importer'))
|
9 |
+
return;
|
10 |
+
|
11 |
+
class WF_CustomerImpExpCsv_Customer_Import extends WP_Importer {
|
12 |
+
|
13 |
+
var $id;
|
14 |
+
var $file_url;
|
15 |
+
var $delimiter;
|
16 |
+
var $send_mail;
|
17 |
+
var $profile;
|
18 |
+
var $merge_empty_cells;
|
19 |
+
var $processed_terms = array();
|
20 |
+
var $processed_posts = array();
|
21 |
+
var $merged = 0;
|
22 |
+
var $skipped = 0;
|
23 |
+
var $imported = 0;
|
24 |
+
var $errored = 0;
|
25 |
+
// Results
|
26 |
+
var $import_results = array();
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Constructor
|
30 |
+
*/
|
31 |
+
public function __construct() {
|
32 |
+
|
33 |
+
// Check that the class exists before trying to use it
|
34 |
+
if (class_exists('WC_Logger')) {
|
35 |
+
$this->log = new WC_Logger();
|
36 |
+
}
|
37 |
+
|
38 |
+
$this->import_page = 'wordpress_hf_user_csv';
|
39 |
+
$this->file_url_import_enabled = apply_filters('woocommerce_csv_product_file_url_import_enabled', true);
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Registered callback function for the WordPress Importer
|
45 |
+
*
|
46 |
+
* Manages the three separate stages of the CSV import process
|
47 |
+
*/
|
48 |
+
public function dispatch() {
|
49 |
+
|
50 |
+
global $woocommerce, $wpdb;
|
51 |
+
|
52 |
+
if (!empty($_POST['delimiter'])) {
|
53 |
+
$this->delimiter = stripslashes(trim($_POST['delimiter']));
|
54 |
+
} else if (!empty($_GET['delimiter'])) {
|
55 |
+
$this->delimiter = stripslashes(trim($_GET['delimiter']));
|
56 |
+
}
|
57 |
+
|
58 |
+
if (!$this->delimiter)
|
59 |
+
$this->delimiter = ',';
|
60 |
+
|
61 |
+
|
62 |
+
$this->send_mail = !empty($_POST['send_mail']) ? 1 : 0;
|
63 |
+
|
64 |
+
|
65 |
+
if (!empty($_POST['profile'])) {
|
66 |
+
$this->profile = stripslashes(trim($_POST['profile']));
|
67 |
+
} else if (!empty($_GET['profile'])) {
|
68 |
+
$this->profile = stripslashes(trim($_GET['profile']));
|
69 |
+
}
|
70 |
+
if (!$this->profile)
|
71 |
+
$this->profile = '';
|
72 |
+
|
73 |
+
if (!empty($_POST['merge_empty_cells']) || !empty($_GET['merge_empty_cells'])) {
|
74 |
+
$this->merge_empty_cells = 1;
|
75 |
+
} else {
|
76 |
+
$this->merge_empty_cells = 0;
|
77 |
+
}
|
78 |
+
|
79 |
+
$step = empty($_GET['step']) ? 0 : (int) $_GET['step'];
|
80 |
+
|
81 |
+
switch ($step) {
|
82 |
+
case 0 :
|
83 |
+
$this->header();
|
84 |
+
$this->greet();
|
85 |
+
break;
|
86 |
+
case 1 :
|
87 |
+
$this->header();
|
88 |
+
|
89 |
+
check_admin_referer('import-upload');
|
90 |
+
|
91 |
+
if (!empty($_GET['file_url']))
|
92 |
+
$this->file_url = esc_attr($_GET['file_url']);
|
93 |
+
if (!empty($_GET['file_id']))
|
94 |
+
$this->id = $_GET['file_id'];
|
95 |
+
|
96 |
+
if (!empty($_GET['clearmapping']) || $this->handle_upload())
|
97 |
+
$this->import_options();
|
98 |
+
else
|
99 |
+
_e('Error with handle_upload!', 'wf_customer_import_export');
|
100 |
+
break;
|
101 |
+
case 2 :
|
102 |
+
$this->header();
|
103 |
+
|
104 |
+
check_admin_referer('import-woocommerce');
|
105 |
+
|
106 |
+
$this->id = (int) $_POST['import_id'];
|
107 |
+
|
108 |
+
if ($this->file_url_import_enabled)
|
109 |
+
$this->file_url = esc_attr($_POST['import_url']);
|
110 |
+
|
111 |
+
if ($this->id)
|
112 |
+
$file = get_attached_file($this->id);
|
113 |
+
else if ($this->file_url_import_enabled)
|
114 |
+
$file = ABSPATH . $this->file_url;
|
115 |
+
|
116 |
+
$file = str_replace("\\", "/", $file);
|
117 |
+
|
118 |
+
if ($file) {
|
119 |
+
?>
|
120 |
+
<table id="import-progress" class="widefat_importer widefat">
|
121 |
+
<thead>
|
122 |
+
<tr>
|
123 |
+
<th class="status"> </th>
|
124 |
+
<th class="row"><?php _e('Row', 'wf_customer_import_export'); ?></th>
|
125 |
+
<th><?php _e('User ID', 'wf_customer_import_export'); ?></th>
|
126 |
+
<th><?php _e('User Status', 'wf_customer_import_export'); ?></th>
|
127 |
+
<th class="reason"><?php _e('Status Msg', 'wf_customer_import_export'); ?></th>
|
128 |
+
</tr>
|
129 |
+
</thead>
|
130 |
+
<tfoot>
|
131 |
+
<tr class="importer-loading">
|
132 |
+
<td colspan="5"></td> </tr>
|
133 |
+
</tfoot>
|
134 |
+
<tbody></tbody>
|
135 |
+
</table>
|
136 |
+
<script type="text/javascript">
|
137 |
+
jQuery(document).ready(function($) {
|
138 |
+
|
139 |
+
if (! window.console) { window.console = function(){}; }
|
140 |
+
|
141 |
+
var processed_terms = [];
|
142 |
+
var processed_posts = [];
|
143 |
+
var i = 1;
|
144 |
+
var done_count = 0;
|
145 |
+
function import_rows(start_pos, end_pos) {
|
146 |
+
|
147 |
+
var data = {
|
148 |
+
action: 'user_csv_import_request',
|
149 |
+
file: '<?php echo addslashes($file); ?>',
|
150 |
+
mapping: '<?php echo json_encode($_POST['map_from']); ?>',
|
151 |
+
profile: '<?php echo $this->profile; ?>',
|
152 |
+
eval_field: '<?php echo stripslashes(json_encode(($_POST['eval_field']), JSON_HEX_APOS)) ?>',
|
153 |
+
start_pos: start_pos,
|
154 |
+
end_pos: end_pos,
|
155 |
+
};
|
156 |
+
data.eval_field = $.parseJSON(data.eval_field);
|
157 |
+
return $.ajax({
|
158 |
+
url: '<?php echo add_query_arg(array('import_page' => $this->import_page, 'step' => '3', 'merge' => !empty($_GET['merge']) ? '1' : '0'), admin_url('admin-ajax.php')); ?>',
|
159 |
+
data: data,
|
160 |
+
type: 'POST',
|
161 |
+
success: function(response) {
|
162 |
+
if (response) {
|
163 |
+
|
164 |
+
try {
|
165 |
+
// Get the valid JSON only from the returned string
|
166 |
+
if (response.indexOf("<!--WC_START-->") >= 0)
|
167 |
+
response = response.split("<!--WC_START-->")[1]; // Strip off before after WC_START
|
168 |
+
|
169 |
+
if (response.indexOf("<!--WC_END-->") >= 0)
|
170 |
+
response = response.split("<!--WC_END-->")[0]; // Strip off anything after WC_END
|
171 |
+
|
172 |
+
// Parse
|
173 |
+
|
174 |
+
var results = $.parseJSON(response);
|
175 |
+
if (results.error) {
|
176 |
+
|
177 |
+
$('#import-progress tbody').append('<tr id="row-' + i + '" class="error"><td class="status" colspan="5">' + results.error + '</td></tr>');
|
178 |
+
i++;
|
179 |
+
} else if (results.import_results && $(results.import_results).size() > 0) {
|
180 |
+
|
181 |
+
$.each(results.processed_terms, function(index, value) {
|
182 |
+
processed_terms.push(value);
|
183 |
+
});
|
184 |
+
$.each(results.processed_posts, function(index, value) {
|
185 |
+
processed_posts.push(value);
|
186 |
+
});
|
187 |
+
$(results.import_results).each(function(index, row) {
|
188 |
+
$('#import-progress tbody').append('<tr id="row-' + i + '" class="' + row['status'] + '"><td><mark class="result" title="' + row['status'] + '">' + row['status'] + '</mark></td><td class="row">' + i + '</td><td>' + row['user_id'] + '</td><td>' + row['post_id'] + ' - ' + row['post_title'] + '</td><td class="reason">' + row['reason'] + '</td></tr>');
|
189 |
+
i++;
|
190 |
+
});
|
191 |
+
}
|
192 |
+
|
193 |
+
} catch (err) {}
|
194 |
+
|
195 |
+
} else {
|
196 |
+
$('#import-progress tbody').append('<tr class="error"><td class="status" colspan="5">' + '<?php _e('AJAX Error', 'wf_customer_import_export'); ?>' + '</td></tr>');
|
197 |
+
}
|
198 |
+
|
199 |
+
var w = $(window);
|
200 |
+
var row = $("#row-" + (i - 1));
|
201 |
+
if (row.length) {
|
202 |
+
w.scrollTop(row.offset().top - (w.height() / 2));
|
203 |
+
}
|
204 |
+
|
205 |
+
done_count++;
|
206 |
+
$('body').trigger('user_csv_import_request_complete');
|
207 |
+
}
|
208 |
+
});
|
209 |
+
}
|
210 |
+
|
211 |
+
var rows = [];
|
212 |
+
<?php
|
213 |
+
$limit = apply_filters('woocommerce_csv_import_limit_per_request', 10);
|
214 |
+
$enc = mb_detect_encoding($file, 'UTF-8, ISO-8859-1', true);
|
215 |
+
if ($enc)
|
216 |
+
setlocale(LC_ALL, 'en_US.' . $enc);
|
217 |
+
@ini_set('auto_detect_line_endings', true);
|
218 |
+
|
219 |
+
$count = 0;
|
220 |
+
$previous_position = 0;
|
221 |
+
$position = 0;
|
222 |
+
$import_count = 0;
|
223 |
+
|
224 |
+
// Get CSV positions
|
225 |
+
if (( $handle = fopen($file, "r") ) !== FALSE) {
|
226 |
+
|
227 |
+
while (( $postmeta = fgetcsv($handle, 0, $this->delimiter) ) !== FALSE) {
|
228 |
+
$count++;
|
229 |
+
|
230 |
+
if ($count >= $limit) {
|
231 |
+
$previous_position = $position;
|
232 |
+
$position = ftell($handle);
|
233 |
+
$count = 0;
|
234 |
+
$import_count ++;
|
235 |
+
|
236 |
+
// Import rows between $previous_position $position
|
237 |
+
?>rows.push([ <?php echo $previous_position; ?>, <?php echo $position; ?> ]); <?php
|
238 |
+
}
|
239 |
+
}
|
240 |
+
|
241 |
+
// Remainder
|
242 |
+
if ($count > 0) {
|
243 |
+
?>rows.push([ <?php echo $position; ?>, '' ]); <?php
|
244 |
+
$import_count ++;
|
245 |
+
}
|
246 |
+
|
247 |
+
fclose($handle);
|
248 |
+
}
|
249 |
+
?>
|
250 |
+
|
251 |
+
var data = rows.shift();
|
252 |
+
var regen_count = 0;
|
253 |
+
import_rows( data[0], data[1] );
|
254 |
+
|
255 |
+
$('body').on( 'user_csv_import_request_complete', function() {
|
256 |
+
if ( done_count == <?php echo $import_count; ?> ) {
|
257 |
+
|
258 |
+
import_done();
|
259 |
+
} else {
|
260 |
+
// Call next request
|
261 |
+
data = rows.shift();
|
262 |
+
import_rows( data[0], data[1] );
|
263 |
+
}
|
264 |
+
} );
|
265 |
+
|
266 |
+
function import_done() {
|
267 |
+
var data = {
|
268 |
+
action: 'user_csv_import_request',
|
269 |
+
file: '<?php echo $file; ?>',
|
270 |
+
processed_terms: processed_terms,
|
271 |
+
processed_posts: processed_posts,
|
272 |
+
};
|
273 |
+
|
274 |
+
$.ajax({
|
275 |
+
url: '<?php echo add_query_arg(array('import_page' => $this->import_page, 'step' => '4', 'merge' => !empty($_GET['merge']) ? 1 : 0), admin_url('admin-ajax.php')); ?>',
|
276 |
+
data: data,
|
277 |
+
type: 'POST',
|
278 |
+
success: function( response ) {
|
279 |
+
console.log( response );
|
280 |
+
$('#import-progress tbody').append( '<tr class="complete"><td colspan="5">' + response + '</td></tr>' );
|
281 |
+
$('.importer-loading').hide();
|
282 |
+
}
|
283 |
+
});
|
284 |
+
}
|
285 |
+
});
|
286 |
+
</script>
|
287 |
+
<?php
|
288 |
+
} else {
|
289 |
+
echo '<p class="error">' . __('Error finding uploaded file!', 'wf_customer_import_export') . '</p>';
|
290 |
+
}
|
291 |
+
break;
|
292 |
+
case 3 :
|
293 |
+
|
294 |
+
// Check access - cannot use nonce here as it will expire after multiple requests
|
295 |
+
if (function_exists('WC')) {
|
296 |
+
if (!current_user_can('manage_woocommerce'))
|
297 |
+
die();
|
298 |
+
}
|
299 |
+
add_filter('http_request_timeout', array($this, 'bump_request_timeout'));
|
300 |
+
|
301 |
+
if (function_exists('gc_enable'))
|
302 |
+
gc_enable();
|
303 |
+
|
304 |
+
@set_time_limit(0);
|
305 |
+
@ob_flush();
|
306 |
+
@flush();
|
307 |
+
$wpdb->hide_errors();
|
308 |
+
|
309 |
+
$file = stripslashes($_POST['file']);
|
310 |
+
$mapping = json_decode(stripslashes($_POST['mapping']), true);
|
311 |
+
$profile = isset($_POST['profile']) ? $_POST['profile'] : '';
|
312 |
+
$eval_field = $_POST['eval_field'];
|
313 |
+
$start_pos = isset($_POST['start_pos']) ? absint($_POST['start_pos']) : 0;
|
314 |
+
$end_pos = isset($_POST['end_pos']) ? absint($_POST['end_pos']) : '';
|
315 |
+
|
316 |
+
if ($profile !== '') {
|
317 |
+
$profile_array = get_option('wf_user_csv_imp_exp_mapping');
|
318 |
+
$profile_array[$profile] = array($mapping, $eval_field);
|
319 |
+
update_option('wf_user_csv_imp_exp_mapping', $profile_array);
|
320 |
+
}
|
321 |
+
|
322 |
+
$position = $this->import_start($file, $mapping, $start_pos, $end_pos, $eval_field);
|
323 |
+
$this->import();
|
324 |
+
$this->import_end();
|
325 |
+
|
326 |
+
$results = array();
|
327 |
+
$results['import_results'] = $this->import_results;
|
328 |
+
$results['processed_terms'] = $this->processed_terms;
|
329 |
+
$results['processed_posts'] = $this->processed_posts;
|
330 |
+
|
331 |
+
echo "<!--WC_START-->";
|
332 |
+
echo json_encode($results);
|
333 |
+
echo "<!--WC_END-->";
|
334 |
+
exit;
|
335 |
+
break;
|
336 |
+
case 4 :
|
337 |
+
// Check access - cannot use nonce here as it will expire after multiple requests
|
338 |
+
if (function_exists('WC')) {
|
339 |
+
if (!current_user_can('manage_woocommerce'))
|
340 |
+
die();
|
341 |
+
}
|
342 |
+
|
343 |
+
add_filter('http_request_timeout', array($this, 'bump_request_timeout'));
|
344 |
+
|
345 |
+
if (function_exists('gc_enable'))
|
346 |
+
gc_enable();
|
347 |
+
|
348 |
+
@set_time_limit(0);
|
349 |
+
@ob_flush();
|
350 |
+
@flush();
|
351 |
+
$wpdb->hide_errors();
|
352 |
+
|
353 |
+
$this->processed_terms = isset($_POST['processed_terms']) ? $_POST['processed_terms'] : array();
|
354 |
+
$this->processed_posts = isset($_POST['processed_posts']) ? $_POST['processed_posts'] : array();
|
355 |
+
|
356 |
+
_e('Step 1...', 'wf_customer_import_export') . ' ';
|
357 |
+
|
358 |
+
wp_defer_term_counting(true);
|
359 |
+
wp_defer_comment_counting(true);
|
360 |
+
|
361 |
+
_e('Step 2...', 'wf_customer_import_export') . ' ';
|
362 |
+
|
363 |
+
echo 'Step 3...' . ' '; // Easter egg
|
364 |
+
|
365 |
+
_e('Finalizing...', 'wf_customer_import_export') . ' ';
|
366 |
+
|
367 |
+
// SUCCESS
|
368 |
+
_e('Finished. Import complete.', 'wf_customer_import_export');
|
369 |
+
|
370 |
+
$this->import_end();
|
371 |
+
exit;
|
372 |
+
break;
|
373 |
+
}
|
374 |
+
|
375 |
+
$this->footer();
|
376 |
+
}
|
377 |
+
|
378 |
+
/**
|
379 |
+
* format_data_from_csv
|
380 |
+
*/
|
381 |
+
public function format_data_from_csv($data, $enc) {
|
382 |
+
return ( $enc == 'UTF-8' ) ? $data : utf8_encode($data);
|
383 |
+
}
|
384 |
+
|
385 |
+
/**
|
386 |
+
* Display pre-import options
|
387 |
+
*/
|
388 |
+
public function import_options() {
|
389 |
+
$j = 0;
|
390 |
+
|
391 |
+
if ($this->id)
|
392 |
+
$file = get_attached_file($this->id);
|
393 |
+
else if ($this->file_url_import_enabled)
|
394 |
+
$file = ABSPATH . $this->file_url;
|
395 |
+
else
|
396 |
+
return;
|
397 |
+
|
398 |
+
// Set locale
|
399 |
+
$enc = mb_detect_encoding($file, 'UTF-8, ISO-8859-1', true);
|
400 |
+
if ($enc)
|
401 |
+
setlocale(LC_ALL, 'en_US.' . $enc);
|
402 |
+
@ini_set('auto_detect_line_endings', true);
|
403 |
+
|
404 |
+
// Get headers
|
405 |
+
if (( $handle = fopen($file, "r") ) !== FALSE) {
|
406 |
+
|
407 |
+
$row = $raw_headers = array();
|
408 |
+
$header = fgetcsv($handle, 0, $this->delimiter);
|
409 |
+
|
410 |
+
while (( $postmeta = fgetcsv($handle, 0, $this->delimiter) ) !== FALSE) {
|
411 |
+
foreach ($header as $key => $heading) {
|
412 |
+
if (!$heading)
|
413 |
+
continue;
|
414 |
+
$s_heading = $heading;
|
415 |
+
$row[$s_heading] = ( isset($postmeta[$key]) ) ? $this->format_data_from_csv($postmeta[$key], $enc) : '';
|
416 |
+
$raw_headers[$s_heading] = $heading;
|
417 |
+
}
|
418 |
+
break;
|
419 |
+
}
|
420 |
+
fclose($handle);
|
421 |
+
}
|
422 |
+
|
423 |
+
$mapping_from_db = get_option('wf_user_csv_imp_exp_mapping');
|
424 |
+
|
425 |
+
if ($this->profile !== '' && !empty($_GET['clearmapping'])) {
|
426 |
+
unset($mapping_from_db[$this->profile]);
|
427 |
+
update_option('wf_user_csv_imp_exp_mapping', $mapping_from_db);
|
428 |
+
$this->profile = '';
|
429 |
+
}
|
430 |
+
if ($this->profile !== '')
|
431 |
+
$mapping_from_db = $mapping_from_db[$this->profile];
|
432 |
+
|
433 |
+
$saved_mapping = null;
|
434 |
+
$saved_evaluation = null;
|
435 |
+
if ($mapping_from_db && is_array($mapping_from_db) && count($mapping_from_db) == 2 && empty($_GET['clearmapping'])) {
|
436 |
+
$reset_action = 'admin.php?clearmapping=1&profile=' . $this->profile . '&import=' . $this->import_page . '&step=1&merge=' . (!empty($_GET['merge']) ? 1 : 0 ) . '&file_url=' . $this->file_url . '&delimiter=' . $this->delimiter . '&merge_empty_cells=' . $this->merge_empty_cells. '&send_mail=' . $this->send_mail . '&file_id=' . $this->id . '';
|
437 |
+
$reset_action = esc_attr(wp_nonce_url($reset_action, 'import-upload'));
|
438 |
+
echo '<h3>' . __('Columns are pre-selected using the Mapping file: "<b style="color:gray">' . $this->profile . '</b>". <a href="' . $reset_action . '"> Delete</a> this mapping file.', 'wf_customer_import_export') . '</h3>';
|
439 |
+
$saved_mapping = $mapping_from_db[0];
|
440 |
+
$saved_evaluation = $mapping_from_db[1];
|
441 |
+
}
|
442 |
+
|
443 |
+
$merge = (!empty($_GET['merge']) && $_GET['merge']) ? 1 : 0;
|
444 |
+
|
445 |
+
include( 'views/html-wf-import-options.php' );
|
446 |
+
}
|
447 |
+
|
448 |
+
/**
|
449 |
+
* The main controller for the actual import stage.
|
450 |
+
*/
|
451 |
+
public function import() {
|
452 |
+
global $woocommerce, $wpdb;
|
453 |
+
|
454 |
+
wp_suspend_cache_invalidation(true);
|
455 |
+
if ($this->log) {
|
456 |
+
$this->log->add('user-csv-import', '---');
|
457 |
+
$this->log->add('user-csv-import', __('Processing users.', 'wf_customer_import_export'));
|
458 |
+
}
|
459 |
+
$merging = 1;
|
460 |
+
$record_offset = 0;
|
461 |
+
|
462 |
+
$i = 0;
|
463 |
+
//echo '<pre>';print_r($this->parsed_data);exit;
|
464 |
+
foreach ($this->parsed_data as $key => &$item) {
|
465 |
+
$user = $this->parser->parse_users($item, $this->raw_headers, $merging, $record_offset);
|
466 |
+
if (!is_wp_error($user))
|
467 |
+
$this->process_users($user['user'][0]);
|
468 |
+
else
|
469 |
+
$this->add_import_result('failed', $user->get_error_message(), 'Not parsed', json_encode($item), '-');
|
470 |
+
|
471 |
+
unset($item, $user);
|
472 |
+
$i++;
|
473 |
+
}
|
474 |
+
if ($this->log)
|
475 |
+
$this->log->add('user-csv-import', __('Finished processing Users.', 'wf_customer_import_export'));
|
476 |
+
wp_suspend_cache_invalidation(false);
|
477 |
+
}
|
478 |
+
|
479 |
+
/**
|
480 |
+
* Parses the CSV file and prepares us for the task of processing parsed data
|
481 |
+
*
|
482 |
+
* @param string $file Path to the CSV file for importing
|
483 |
+
*/
|
484 |
+
public function import_start($file, $mapping, $start_pos, $end_pos, $eval_field) {
|
485 |
+
|
486 |
+
|
487 |
+
if (function_exists('WC')) {
|
488 |
+
$memory = size_format(woocommerce_let_to_num(ini_get('memory_limit')));
|
489 |
+
$wp_memory = size_format(woocommerce_let_to_num(WP_MEMORY_LIMIT));
|
490 |
+
} else {
|
491 |
+
$memory = size_format($this->wf_let_to_num(ini_get('memory_limit')));
|
492 |
+
$wp_memory = size_format($this->wf_let_to_num(WP_MEMORY_LIMIT));
|
493 |
+
}
|
494 |
+
|
495 |
+
if ($this->log) {
|
496 |
+
$this->log->add('user-csv-import', '---[ New Import ] PHP Memory: ' . $memory . ', WP Memory: ' . $wp_memory);
|
497 |
+
$this->log->add('user-csv-import', __('Parsing products CSV.', 'wf_customer_import_export'));
|
498 |
+
}
|
499 |
+
$this->parser = new WF_CSV_Parser('user');
|
500 |
+
|
501 |
+
|
502 |
+
list( $this->parsed_data, $this->raw_headers, $position ) = $this->parser->parse_data($file, $this->delimiter, $mapping, $start_pos, $end_pos, $eval_field);
|
503 |
+
if ($this->log)
|
504 |
+
$this->log->add('user-csv-import', __('Finished parsing products CSV.', 'wf_customer_import_export'));
|
505 |
+
|
506 |
+
unset($import_data);
|
507 |
+
|
508 |
+
wp_defer_term_counting(true);
|
509 |
+
wp_defer_comment_counting(true);
|
510 |
+
|
511 |
+
return $position;
|
512 |
+
}
|
513 |
+
|
514 |
+
/**
|
515 |
+
* Performs post-import cleanup of files and the cache
|
516 |
+
*/
|
517 |
+
public function import_end() {
|
518 |
+
|
519 |
+
//wp_cache_flush(); Stops output in some hosting environments
|
520 |
+
foreach (get_taxonomies() as $tax) {
|
521 |
+
delete_option("{$tax}_children");
|
522 |
+
_get_term_hierarchy($tax);
|
523 |
+
}
|
524 |
+
|
525 |
+
wp_defer_term_counting(false);
|
526 |
+
wp_defer_comment_counting(false);
|
527 |
+
|
528 |
+
do_action('import_end');
|
529 |
+
}
|
530 |
+
|
531 |
+
/**
|
532 |
+
* Handles the CSV upload and initial parsing of the file to prepare for
|
533 |
+
* displaying author import options
|
534 |
+
*
|
535 |
+
* @return bool False if error uploading or invalid file, true otherwise
|
536 |
+
*/
|
537 |
+
public function handle_upload() {
|
538 |
+
|
539 |
+
if (empty($_POST['file_url'])) {
|
540 |
+
|
541 |
+
$file = wp_import_handle_upload();
|
542 |
+
|
543 |
+
if (isset($file['error'])) {
|
544 |
+
echo '<p><strong>' . __('Sorry, there has been an error.', 'wf_customer_import_export') . '</strong><br />';
|
545 |
+
echo esc_html($file['error']) . '</p>';
|
546 |
+
return false;
|
547 |
+
}
|
548 |
+
|
549 |
+
$this->id = (int) $file['id'];
|
550 |
+
return true;
|
551 |
+
} else {
|
552 |
+
|
553 |
+
if (file_exists(ABSPATH . $_POST['file_url'])) {
|
554 |
+
|
555 |
+
$this->file_url = esc_attr($_POST['file_url']);
|
556 |
+
return true;
|
557 |
+
} else {
|
558 |
+
|
559 |
+
echo '<p><strong>' . __('Sorry, there has been an error.', 'wf_customer_import_export') . '</strong></p>';
|
560 |
+
return false;
|
561 |
+
}
|
562 |
+
}
|
563 |
+
|
564 |
+
return false;
|
565 |
+
}
|
566 |
+
|
567 |
+
/**
|
568 |
+
* Create new posts based on import information
|
569 |
+
*/
|
570 |
+
private function process_users($post) {
|
571 |
+
|
572 |
+
|
573 |
+
global $wpdb;
|
574 |
+
$this->imported = $this->merged = 0;
|
575 |
+
|
576 |
+
// plan a dry run
|
577 |
+
//$dry_run = isset( $_POST['dry_run'] ) && $_POST['dry_run'] ? true : false;
|
578 |
+
$dry_run = 0; //mockup import and check weather the users can be imported without fail
|
579 |
+
if ($this->log) {
|
580 |
+
$this->log->add('user-csv-import', '---');
|
581 |
+
$this->log->add('user-csv-import', __('Processing users.', 'wf_customer_import_export'));
|
582 |
+
}
|
583 |
+
|
584 |
+
if (empty($post['user_details']['user_email'])) {
|
585 |
+
$this->add_import_result('skipped', __('Cannot insert user without email', 'wf_customer_import_export'), 1, 1, 1);
|
586 |
+
unset($post);
|
587 |
+
return;
|
588 |
+
} elseif (!is_email($post['user_details']['user_email'])) {
|
589 |
+
$this->add_import_result('skipped', __('skipped: Email is not valid.', 'wf_customer_import_export'), 1, $post['user_details']['user_email'], 1);
|
590 |
+
unset($post);
|
591 |
+
return;
|
592 |
+
}
|
593 |
+
|
594 |
+
$user_id = $this->hf_check_customer($post);
|
595 |
+
|
596 |
+
$new_added = false;
|
597 |
+
|
598 |
+
|
599 |
+
if ($user_id) {
|
600 |
+
$usr_msg = 'User already exists.';
|
601 |
+
$user_info = get_userdata($user_id);
|
602 |
+
$user_string = sprintf('<a href="%s">%s</a>', get_edit_user_link($user_id), $user_info->first_name);
|
603 |
+
$this->add_import_result('skipped', __($usr_msg, 'wf_customer_import_export'),$user_id , $user_string, $user_id);
|
604 |
+
if ($this->log)
|
605 |
+
$this->log->add('user-csv-import', sprintf(__('> “%s”' . $usr_msg, 'wf_customer_import_export'), $user_id), true);
|
606 |
+
unset($post);
|
607 |
+
return;
|
608 |
+
} else{
|
609 |
+
$user_id = $this->hf_create_customer($post);
|
610 |
+
$new_added = true;
|
611 |
+
if (is_wp_error($user_id)) {
|
612 |
+
$this->errored++;
|
613 |
+
$this->add_import_result('failed', __($user_id->get_error_message(), 'wf_customer_import_export'), 0, 'failed', 1);
|
614 |
+
if ($this->log)
|
615 |
+
$this->log->add('user-csv-import', sprintf(__('> Error inserting %s: %s', 'wf_customer_import_export'), 1, $user_id->get_error_message()), true);
|
616 |
+
$skipped++;
|
617 |
+
unset($post);
|
618 |
+
return;
|
619 |
+
} elseif (empty($user_id)) {
|
620 |
+
$this->errored++;
|
621 |
+
if ($this->log)
|
622 |
+
$this->log->add('user-csv-import', sprintf(__('An error occurred with the customer information provided.', 'wf_customer_import_export')));
|
623 |
+
$this->add_import_result('skipped', __('An error occurred with the customer information provided.', 'wf_customer_import_export'), 0, 'failed', 1);
|
624 |
+
$skipped++;
|
625 |
+
unset($post);
|
626 |
+
return;
|
627 |
+
}
|
628 |
+
}
|
629 |
+
|
630 |
+
$out_msg = 'User Imported Successfully.';
|
631 |
+
|
632 |
+
$user_info = get_userdata($user_id);
|
633 |
+
$user_string = sprintf('<a href="%s">%s</a>', get_edit_user_link($user_id), $user_info->first_name);
|
634 |
+
|
635 |
+
|
636 |
+
$this->add_import_result('imported', __($out_msg, 'wf_customer_import_export'), $user_id , $user_string, $user_id);
|
637 |
+
if ($this->log)
|
638 |
+
$this->log->add('user-csv-import', sprintf(__('> “%s”' . $out_msg, 'wf_customer_import_export'), $user_id), true);
|
639 |
+
$this->imported++;
|
640 |
+
if ($this->log) {
|
641 |
+
$this->log->add('user-csv-import', sprintf(__('> Finished importing user %s', 'wf_customer_import_export'), $dry_run ? "" : $user_id ));
|
642 |
+
$this->log->add('user-csv-import', __('Finished processing users.', 'wf_customer_import_export'));
|
643 |
+
}
|
644 |
+
|
645 |
+
unset($post);
|
646 |
+
}
|
647 |
+
|
648 |
+
public function hf_check_customer($data) {
|
649 |
+
$customer_email = (!empty($data['user_details']['user_email']) ) ? $data['user_details']['user_email'] : '';
|
650 |
+
$username = (!empty($data['user_details']['user_login']) ) ? $data['user_details']['user_login'] : '';
|
651 |
+
$customer_id = (!empty($data['user_details']['ID']) ) ? $data['user_details']['ID'] : '';
|
652 |
+
|
653 |
+
$found_customer = false;
|
654 |
+
|
655 |
+
if (!empty($customer_email)) {
|
656 |
+
|
657 |
+
if (is_email($customer_email) && false !== email_exists($customer_email)) {
|
658 |
+
$found_customer = email_exists($customer_email);
|
659 |
+
} elseif (!empty($username) && false !== username_exists($username)) {
|
660 |
+
$found_customer = username_exists($username);
|
661 |
+
}
|
662 |
+
}
|
663 |
+
return $found_customer;
|
664 |
+
}
|
665 |
+
|
666 |
+
public function hf_create_customer($data) {
|
667 |
+
|
668 |
+
$customer_email = (!empty($data['user_details']['user_email']) ) ? $data['user_details']['user_email'] : '';
|
669 |
+
$username = (!empty($data['user_details']['user_login']) ) ? $data['user_details']['user_login'] : '';
|
670 |
+
$customer_id = (!empty($data['user_details']['ID']) ) ? $data['user_details']['ID'] : '';
|
671 |
+
|
672 |
+
if (!empty($data['user_details']['user_pass'])) {
|
673 |
+
$password = $data['user_details']['user_pass'];
|
674 |
+
$password_generated = false;
|
675 |
+
} else {
|
676 |
+
$password = wp_generate_password(12, true);
|
677 |
+
$password_generated = true;
|
678 |
+
}
|
679 |
+
$found_customer = false;
|
680 |
+
if (is_email($customer_email)) {
|
681 |
+
|
682 |
+
|
683 |
+
|
684 |
+
// Not in test mode, create a user account for this email
|
685 |
+
if (empty($username)) {
|
686 |
+
|
687 |
+
$maybe_username = explode('@', $customer_email);
|
688 |
+
$maybe_username = sanitize_user($maybe_username[0]);
|
689 |
+
$counter = 1;
|
690 |
+
$username = $maybe_username;
|
691 |
+
|
692 |
+
while (username_exists($username)) {
|
693 |
+
$username = $maybe_username . $counter;
|
694 |
+
$counter++;
|
695 |
+
}
|
696 |
+
}
|
697 |
+
|
698 |
+
$found_customer = wp_create_user($username, $password, $customer_email);
|
699 |
+
|
700 |
+
if (!is_wp_error($found_customer)) {
|
701 |
+
|
702 |
+
|
703 |
+
$wp_user_object = new WP_User($found_customer);
|
704 |
+
|
705 |
+
$roles = explode(',', $data['user_details']['roles']);
|
706 |
+
if(!empty($roles)){
|
707 |
+
foreach ($roles as $role) {
|
708 |
+
$wp_user_object->add_role($role);
|
709 |
+
}
|
710 |
+
//$wp_user_object->set_role($role);
|
711 |
+
}
|
712 |
+
$user_nicename = (!empty($data['user_details']['user_nicename'])) ? $data['user_details']['user_nicename'] : '';
|
713 |
+
$website = (!empty($data['user_details']['user_url'])) ? $data['user_details']['user_url'] : '';
|
714 |
+
$user_registered = (!empty($data['user_details']['user_registered'])) ? $data['user_details']['user_registered'] : '';
|
715 |
+
$display_name = (!empty($data['user_details']['display_name'])) ? $data['user_details']['display_name'] : '';
|
716 |
+
$first_name = (!empty($data['user_details']['first_name'])) ? $data['user_details']['first_name'] : '';
|
717 |
+
$last_name = (!empty($data['user_details']['last_name'])) ? $data['user_details']['last_name'] : '';
|
718 |
+
$user_status = (!empty($data['user_details']['user_status'])) ? $data['user_details']['user_status'] : '';
|
719 |
+
wp_update_user( array(
|
720 |
+
'ID' => $found_customer,
|
721 |
+
'user_nicename' => $user_nicename,
|
722 |
+
'user_url' => $website,
|
723 |
+
'user_registered' => $user_registered,
|
724 |
+
'display_name' => $display_name,
|
725 |
+
'first_name' => $first_name,
|
726 |
+
'last_name' => $last_name,
|
727 |
+
'user_status' => $user_status,
|
728 |
+
|
729 |
+
)
|
730 |
+
);
|
731 |
+
|
732 |
+
}
|
733 |
+
} else {
|
734 |
+
|
735 |
+
$found_customer = new WP_Error('hf_invalid_customer', sprintf(__('User could not be created without Email.', 'wf_customer_import_export'), $customer_id));
|
736 |
+
}
|
737 |
+
|
738 |
+
return $found_customer;
|
739 |
+
}
|
740 |
+
|
741 |
+
|
742 |
+
/**
|
743 |
+
* Log a row's import status
|
744 |
+
*/
|
745 |
+
protected function add_import_result($status, $reason, $post_id = '', $post_title = '', $user_id = '') {
|
746 |
+
$this->import_results[] = array(
|
747 |
+
'post_title' => $post_title,
|
748 |
+
'post_id' => $post_id,
|
749 |
+
'user_id' => $user_id,
|
750 |
+
'status' => $status,
|
751 |
+
'reason' => $reason
|
752 |
+
);
|
753 |
+
}
|
754 |
+
|
755 |
+
/**
|
756 |
+
* Decide what the maximum file size for downloaded attachments is.
|
757 |
+
* Default is 0 (unlimited), can be filtered via import_attachment_size_limit
|
758 |
+
*
|
759 |
+
* @return int Maximum attachment file size to import
|
760 |
+
*/
|
761 |
+
public function max_attachment_size() {
|
762 |
+
return apply_filters('import_attachment_size_limit', 0);
|
763 |
+
}
|
764 |
+
|
765 |
+
// Display import page title
|
766 |
+
public function header() {
|
767 |
+
echo '<div class="wrap"><div class="icon32" id="icon-woocommerce-importer"><br></div>';
|
768 |
+
echo '<h2>' . ( empty($_GET['merge']) ? __('Import', 'wf_customer_import_export') : __('Merge Users', 'wf_customer_import_export') ) . '</h2>';
|
769 |
+
}
|
770 |
+
|
771 |
+
// Close div.wrap
|
772 |
+
public function footer() {
|
773 |
+
echo '</div>';
|
774 |
+
}
|
775 |
+
|
776 |
+
/**
|
777 |
+
* Display introductory text and file upload form
|
778 |
+
*/
|
779 |
+
public function greet() {
|
780 |
+
$action = 'admin.php?import=wordpress_hf_user_csv&step=1';
|
781 |
+
$bytes = apply_filters('import_upload_size_limit', wp_max_upload_size());
|
782 |
+
$size = size_format($bytes);
|
783 |
+
$upload_dir = wp_upload_dir();
|
784 |
+
|
785 |
+
include( 'views/html-wf-import-greeting.php' );
|
786 |
+
}
|
787 |
+
|
788 |
+
/**
|
789 |
+
* Added to http_request_timeout filter to force timeout at 60 seconds during import
|
790 |
+
* @return int 60
|
791 |
+
*/
|
792 |
+
public function bump_request_timeout($val) {
|
793 |
+
return 60;
|
794 |
+
}
|
795 |
+
|
796 |
+
public function wf_let_to_num($size) {
|
797 |
+
$l = substr($size, -1);
|
798 |
+
$ret = substr($size, 0, -1);
|
799 |
+
switch (strtoupper($l)) {
|
800 |
+
case 'P':
|
801 |
+
$ret *= 1024;
|
802 |
+
case 'T':
|
803 |
+
$ret *= 1024;
|
804 |
+
case 'G':
|
805 |
+
$ret *= 1024;
|
806 |
+
case 'M':
|
807 |
+
$ret *= 1024;
|
808 |
+
case 'K':
|
809 |
+
$ret *= 1024;
|
810 |
+
}
|
811 |
+
return $ret;
|
812 |
+
}
|
813 |
+
|
814 |
+
}
|
includes/importer/class-wf-customerimpexpcsv-importer.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
|
6 |
+
class WF_CustomerImpExpCsv_Importer {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* User Exporter Tool
|
10 |
+
*/
|
11 |
+
public static function load_wp_importer() {
|
12 |
+
// Load Importer API
|
13 |
+
require_once ABSPATH . 'wp-admin/includes/import.php';
|
14 |
+
|
15 |
+
if ( ! class_exists( 'WP_Importer' ) ) {
|
16 |
+
$class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php';
|
17 |
+
if ( file_exists( $class_wp_importer ) ) {
|
18 |
+
require $class_wp_importer;
|
19 |
+
}
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* User Importer Tool
|
25 |
+
*/
|
26 |
+
public static function customer_importer() {
|
27 |
+
if ( ! defined( 'WP_LOAD_IMPORTERS' ) ) {
|
28 |
+
return;
|
29 |
+
}
|
30 |
+
|
31 |
+
self::load_wp_importer();
|
32 |
+
|
33 |
+
// includes
|
34 |
+
require_once 'class-wf-customerimpexpcsv-customer-import.php';
|
35 |
+
require_once 'class-wf-csv-parser.php';
|
36 |
+
|
37 |
+
// Dispatch
|
38 |
+
$GLOBALS['WF_CSV_Customer_Import'] = new WF_CustomerImpExpCsv_Customer_Import();
|
39 |
+
$GLOBALS['WF_CSV_Customer_Import'] ->dispatch();
|
40 |
+
}
|
41 |
+
}
|
includes/importer/data/data-wf-reserved-fields-pair.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (!defined('ABSPATH')) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
|
6 |
+
$columns = array(
|
7 |
+
'ID' => 'ID | Customer/User ID ',
|
8 |
+
'user_login' => 'User Login | User Login',
|
9 |
+
'user_pass' => 'user_pass | user_pass',
|
10 |
+
'user_nicename' => 'user_nicename | user_nicename',
|
11 |
+
'user_email' => 'user_email | user_email',
|
12 |
+
'user_url' => 'user_url | user_url',
|
13 |
+
'user_registered' => 'user_registered | user_registered',
|
14 |
+
'display_name' => 'display_name | display_name',
|
15 |
+
'first_name' => 'first_name | first_name',
|
16 |
+
'last_name' => 'last_name | last_name',
|
17 |
+
'user_status' => 'user_status | user_status',
|
18 |
+
'roles' => 'roles | roles'
|
19 |
+
);
|
20 |
+
|
21 |
+
return apply_filters('hf_csv_customer_import_columns', $columns);
|
includes/importer/views/html-wf-import-greeting.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div>
|
2 |
+
<p><?php _e('You can import users/customers (in CSV format) in to the shop.', 'wf_customer_import_export'); ?></p>
|
3 |
+
<?php if (!empty($upload_dir['error'])) : ?>
|
4 |
+
<div class="error"><p><?php _e('Before you can upload your import file, you will need to fix the following error:', 'wf_customer_import_export'); ?></p>
|
5 |
+
<p><strong><?php echo $upload_dir['error']; ?></strong></p></div>
|
6 |
+
|
7 |
+
<?php else : ?>
|
8 |
+
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo esc_attr(wp_nonce_url($action, 'import-upload')); ?>">
|
9 |
+
<table class="form-table">
|
10 |
+
<tbody>
|
11 |
+
<tr>
|
12 |
+
<th>
|
13 |
+
<label for="upload"><?php _e('Select a file from your computer', 'wf_customer_import_export'); ?></label>
|
14 |
+
</th>
|
15 |
+
<td>
|
16 |
+
<input type="file" id="upload" name="import" size="25" />
|
17 |
+
<input type="hidden" name="action" value="save" />
|
18 |
+
<input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
|
19 |
+
<small><?php printf(__('Maximum size: %s'), $size); ?></small>
|
20 |
+
</td>
|
21 |
+
</tr>
|
22 |
+
</tbody>
|
23 |
+
</table>
|
24 |
+
<p class="submit">
|
25 |
+
<input type="submit" class="button button-primary" value="<?php esc_attr_e('Upload file and import'); ?>" />
|
26 |
+
</p>
|
27 |
+
</form>
|
28 |
+
<?php endif; ?>
|
29 |
+
</div>
|
includes/importer/views/html-wf-import-options.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<form action="<?php echo admin_url('admin.php?import=' . $this->import_page . '&step=2'); ?>" method="post" id="nomap">
|
2 |
+
<?php wp_nonce_field('import-woocommerce'); ?>
|
3 |
+
<input type="hidden" name="import_id" value="<?php echo $this->id; ?>" />
|
4 |
+
<?php if ($this->file_url_import_enabled) : ?>
|
5 |
+
<input type="hidden" name="import_url" value="<?php echo $this->file_url; ?>" />
|
6 |
+
<?php endif; ?>
|
7 |
+
<p class="submit">
|
8 |
+
<input style="display:none" type="submit" class="button button-primary" value="<?php esc_attr_e('Submit', 'wf_customer_import_export'); ?>" />
|
9 |
+
</p>
|
10 |
+
</form>
|
11 |
+
<script type="text/javascript">
|
12 |
+
jQuery(document).ready(function(){
|
13 |
+
jQuery("form#nomap").submit();
|
14 |
+
});
|
15 |
+
</script>
|
includes/settings/class-wf-customerimpexpcsv-settings.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
class WF_CustomerImpExpCsv_Settings {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* User Exporter Tool
|
11 |
+
*/
|
12 |
+
public static function save_settings() {
|
13 |
+
wp_redirect(admin_url('/admin.php?page=' . HF_WORDPRESS_CUSTOMER_IM_EX . '&tab=settings'));
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
includes/views/export/html-wf-export-customers.php
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="tool-box">
|
2 |
+
<h3 class="title"><?php _e('Export Users in CSV Format:', 'wf_customer_import_export'); ?></h3>
|
3 |
+
<p><?php _e('Export and download your Users in CSV format. This file can be used to import users back into your Website.', 'wf_customer_import_export'); ?></p>
|
4 |
+
<form action="<?php echo admin_url('admin.php?page=hf_wordpress_customer_im_ex&action=export'); ?>" method="post">
|
5 |
+
|
6 |
+
<table class="form-table">
|
7 |
+
<tr>
|
8 |
+
<th>
|
9 |
+
<label for="v_user_roles"><?php _e('User Roles', 'wf_customer_import_export'); ?></label>
|
10 |
+
</th>
|
11 |
+
<td>
|
12 |
+
<select id="v_user_roles" name="user_roles" >
|
13 |
+
<?php
|
14 |
+
global $wp_roles;
|
15 |
+
foreach ( $wp_roles->role_names as $role => $name ) {
|
16 |
+
echo '<option value="' . esc_attr( $role ) . '">' . $name . '</option>';
|
17 |
+
}
|
18 |
+
?>
|
19 |
+
</select>
|
20 |
+
|
21 |
+
<p style="font-size: 12px"><?php _e('Users with these roles will be exported.', 'wf_customer_import_export'); ?></p>
|
22 |
+
</td>
|
23 |
+
</tr>
|
24 |
+
<tr>
|
25 |
+
<th>
|
26 |
+
<label for="v_offset"><?php _e('Offset', 'wf_customer_import_export'); ?></label>
|
27 |
+
</th>
|
28 |
+
<td>
|
29 |
+
<input type="text" name="offset" id="v_offset" placeholder="<?php _e('0', 'wf_customer_import_export'); ?>" class="input-text" />
|
30 |
+
<p style="font-size: 12px"><?php _e('The number of users to skip before returning.', 'wf_customer_import_export'); ?></p>
|
31 |
+
</td>
|
32 |
+
</tr>
|
33 |
+
<tr>
|
34 |
+
<th>
|
35 |
+
<label for="v_limit"><?php _e('Limit', 'wf_customer_import_export'); ?></label>
|
36 |
+
</th>
|
37 |
+
<td>
|
38 |
+
<input type="text" name="limit" id="v_limit" placeholder="<?php _e('Unlimited', 'wf_customer_import_export'); ?>" class="input-text" />
|
39 |
+
<p style="font-size: 12px"><?php _e('The number of users to return.', 'wf_customer_import_export'); ?></p>
|
40 |
+
</td>
|
41 |
+
</tr>
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
|
46 |
+
|
47 |
+
<tr>
|
48 |
+
<th>
|
49 |
+
<label for="v_columns"><?php _e('Columns', 'wf_customer_import_export'); ?></label>
|
50 |
+
</th>
|
51 |
+
<table id="datagrid">
|
52 |
+
<th style="text-align: left;">
|
53 |
+
<label for="v_columns"><?php _e('Column', 'wf_customer_import_export'); ?></label>
|
54 |
+
</th>
|
55 |
+
<th style="text-align: left;">
|
56 |
+
<label for="v_columns_name"><?php _e('Column Name', 'wf_customer_import_export'); ?></label>
|
57 |
+
</th>
|
58 |
+
<?php
|
59 |
+
?>
|
60 |
+
<?php foreach ($post_columns as $pkey => $pcolumn) {
|
61 |
+
|
62 |
+
?>
|
63 |
+
<tr>
|
64 |
+
<td>
|
65 |
+
<input name= "columns[<?php echo $pkey; ?>]" type="checkbox" value="<?php echo $pkey; ?>" checked>
|
66 |
+
<label for="columns[<?php echo $pkey; ?>]"><?php _e($pcolumn, 'wf_customer_import_export'); ?></label>
|
67 |
+
</td>
|
68 |
+
<td>
|
69 |
+
<input type="text" name="columns_name[<?php echo $pkey; ?>]" value="<?php echo $pkey; ?>" class="input-text" />
|
70 |
+
</td>
|
71 |
+
</tr>
|
72 |
+
<?php } ?>
|
73 |
+
|
74 |
+
</table><br/>
|
75 |
+
</tr>
|
76 |
+
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
</table>
|
83 |
+
<p class="submit"><input type="submit" class="button button-primary" value="<?php _e('Export Users', 'wf_customer_import_export'); ?>" /></p>
|
84 |
+
</form>
|
85 |
+
</div>
|
includes/views/html-wf-admin-screen.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap woocommerce">
|
2 |
+
<div class="icon32" id="icon-woocommerce-importer"><br></div>
|
3 |
+
<h2 class="nav-tab-wrapper woo-nav-tab-wrapper">
|
4 |
+
<a href="<?php echo admin_url('admin.php?page=hf_wordpress_customer_im_ex') ?>" class="nav-tab <?php echo ($tab == 'import') ? 'nav-tab-active' : ''; ?>"><?php _e('User/Customer Import / Export', 'wf_customer_import_export'); ?></a>
|
5 |
+
</h2>
|
6 |
+
|
7 |
+
<?php
|
8 |
+
switch ($tab) {
|
9 |
+
case "export" :
|
10 |
+
$this->admin_export_page();
|
11 |
+
break;
|
12 |
+
default :
|
13 |
+
$this->admin_import_page();
|
14 |
+
break;
|
15 |
+
}
|
16 |
+
?>
|
17 |
+
</div>
|
includes/views/import/html-wf-import-customers.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wf-banner updated below-h2">
|
2 |
+
<p class="main">
|
3 |
+
<ul>
|
4 |
+
<li style='color:red;'><strong><?php _e('Your Business is precious! Go Premium!','wf_customer_import_export'); ?></strong></li>
|
5 |
+
<strong>
|
6 |
+
<?php _e('HikeForce Import Export Users Plugin Premium version helps you to seamlessly import/export Customer details into your Woocommerce Store.', 'wf_customer_import_export'); ?>
|
7 |
+
</strong><br/><br/>
|
8 |
+
<?php _e('- Export/Import <strong>WooCommerce Customer</strong> details into a CSV file.', 'wf_customer_import_export'); ?><strong><?php _e('( Basic version supports only WordPress User details )', 'wf_customer_import_export'); ?></strong><br/>
|
9 |
+
<?php _e('- Option to choose All Roles or Multiple Roles while export (Basic Supports only single role at a time).', 'wf_customer_import_export'); ?><br/>
|
10 |
+
<?php _e('- Various Filter options for exporting Customers.', 'wf_customer_import_export'); ?><br/>
|
11 |
+
<?php _e('- Map and Transform fields while Importing Customers.', 'wf_customer_import_export'); ?><br/>
|
12 |
+
<?php _e('- Change values while improting Customers using Evaluation Fields.', 'wf_customer_import_export'); ?><br/>
|
13 |
+
<?php _e('- Choice to Update or Skip existing imported Customers.', 'wf_customer_import_export'); ?><br/>
|
14 |
+
<?php _e('- Choice to Send or Skip Emails for newly imported Customers.', 'wf_customer_import_export'); ?><br/>
|
15 |
+
<?php _e('- WPML Supported. French language support Out of the Box.', 'wf_customer_import_export'); ?><br/>
|
16 |
+
<?php _e('- Import/Export file from/to a remote server via FTP in Scheduled time interval with Cron Job.', 'wf_customer_import_export'); ?><br/>
|
17 |
+
<?php _e('- Excellent Support for setting it up!', 'wf_customer_import_export'); ?><br/>
|
18 |
+
</ul>
|
19 |
+
</p>
|
20 |
+
<p>
|
21 |
+
<a href="http://www.xadapter.com/product/wordpress-users-woocommerce-customers-import-export/" target="_blank" class="button button-primary"><?php _e( 'Upgrade to Premium Version', 'wf_customer_import_export'); ?></a>
|
22 |
+
<a href="http://userexportimportwoodemo.hikeforce.com/wp-admin/admin.php?page=hf_wordpress_customer_im_ex" target="_blank" class="button"><?php _e( 'Live Demo', 'wf_customer_import_export'); ?></a>
|
23 |
+
<a href="http://www.xadapter.com/category/product/wordpress-users-woocommerce-customers-import-export" target="_blank" class="button"><?php _e( 'Documentation', 'wf_customer_import_export' ); ?></a>
|
24 |
+
<a href="<?php echo plugins_url( 'Sample_Users.csv', WF_CustomerImpExpCsv_FILE ); ?>" target="_blank" class="button"><?php _e('Sample User CSV', 'wf_customer_import_export'); ?></a>
|
25 |
+
</p>
|
26 |
+
</div>
|
27 |
+
<style>
|
28 |
+
.wf-banner img {
|
29 |
+
float: right;
|
30 |
+
margin-left: 1em;
|
31 |
+
padding: 15px 0
|
32 |
+
}
|
33 |
+
</style>
|
34 |
+
|
35 |
+
<div class="tool-box">
|
36 |
+
<h3 class="title"><?php _e('Import Users in CSV Format:', 'wf_customer_import_export'); ?></h3>
|
37 |
+
<p><?php _e('Import Users in CSV format from your computer', 'wf_customer_import_export'); ?></p>
|
38 |
+
<p class="submit">
|
39 |
+
<?php $import_url = admin_url('admin.php?import=wordpress_hf_user_csv'); ?>
|
40 |
+
<a class="button button-primary" id="mylink" href="<?php echo $import_url; ?>"><?php _e('Import Users', 'wf_customer_import_export'); ?></a>
|
41 |
+
</p>
|
42 |
+
</div>
|
lang/wf_customer_import_export-fr_FR.po
ADDED
File without changes
|
license.txt
ADDED
@@ -0,0 +1,708 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
WordPress Users & WooCommerce Customers Import Export
|
2 |
+
|
3 |
+
Copyright 2015 by the contributors
|
4 |
+
|
5 |
+
This program is free software; you can redistribute it and/or modify
|
6 |
+
it under the terms of the GNU General Public License as published by
|
7 |
+
the Free Software Foundation; either version 3 of the License, or
|
8 |
+
(at your option) any later version.
|
9 |
+
|
10 |
+
This program is distributed in the hope that it will be useful,
|
11 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
GNU General Public License for more details.
|
14 |
+
|
15 |
+
You should have received a copy of the GNU General Public License
|
16 |
+
along with this program; if not, write to the Free Software
|
17 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
18 |
+
|
19 |
+
This program incorporates work covered by the following copyright and
|
20 |
+
permission notices:
|
21 |
+
|
22 |
+
WordPress Users & WooCommerce Customers Import Export
|
23 |
+
Copyright: 2015-2017 Hikeforce.
|
24 |
+
License: GNU General Public License v3.0
|
25 |
+
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
26 |
+
|
27 |
+
and
|
28 |
+
|
29 |
+
HikeForce
|
30 |
+
|
31 |
+
WordPress Users & WooCommerce Customers Import Export is released under the GPL
|
32 |
+
|
33 |
+
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
34 |
+
|
35 |
+
GNU GENERAL PUBLIC LICENSE
|
36 |
+
Version 3, 29 June 2007
|
37 |
+
|
38 |
+
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
39 |
+
Everyone is permitted to copy and distribute verbatim copies
|
40 |
+
of this license document, but changing it is not allowed.
|
41 |
+
|
42 |
+
Preamble
|
43 |
+
|
44 |
+
The GNU General Public License is a free, copyleft license for
|
45 |
+
software and other kinds of works.
|
46 |
+
|
47 |
+
The licenses for most software and other practical works are designed
|
48 |
+
to take away your freedom to share and change the works. By contrast,
|
49 |
+
the GNU General Public License is intended to guarantee your freedom to
|
50 |
+
share and change all versions of a program--to make sure it remains free
|
51 |
+
software for all its users. We, the Free Software Foundation, use the
|
52 |
+
GNU General Public License for most of our software; it applies also to
|
53 |
+
any other work released this way by its authors. You can apply it to
|
54 |
+
your programs, too.
|
55 |
+
|
56 |
+
When we speak of free software, we are referring to freedom, not
|
57 |
+
price. Our General Public Licenses are designed to make sure that you
|
58 |
+
have the freedom to distribute copies of free software (and charge for
|
59 |
+
them if you wish), that you receive source code or can get it if you
|
60 |
+
want it, that you can change the software or use pieces of it in new
|
61 |
+
free programs, and that you know you can do these things.
|
62 |
+
|
63 |
+
To protect your rights, we need to prevent others from denying you
|
64 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
65 |
+
certain responsibilities if you distribute copies of the software, or if
|
66 |
+
you modify it: responsibilities to respect the freedom of others.
|
67 |
+
|
68 |
+
For example, if you distribute copies of such a program, whether
|
69 |
+
gratis or for a fee, you must pass on to the recipients the same
|
70 |
+
freedoms that you received. You must make sure that they, too, receive
|
71 |
+
or can get the source code. And you must show them these terms so they
|
72 |
+
know their rights.
|
73 |
+
|
74 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
75 |
+
(1) assert copyright on the software, and (2) offer you this License
|
76 |
+
giving you legal permission to copy, distribute and/or modify it.
|
77 |
+
|
78 |
+
For the developers' and authors' protection, the GPL clearly explains
|
79 |
+
that there is no warranty for this free software. For both users' and
|
80 |
+
authors' sake, the GPL requires that modified versions be marked as
|
81 |
+
changed, so that their problems will not be attributed erroneously to
|
82 |
+
authors of previous versions.
|
83 |
+
|
84 |
+
Some devices are designed to deny users access to install or run
|
85 |
+
modified versions of the software inside them, although the manufacturer
|
86 |
+
can do so. This is fundamentally incompatible with the aim of
|
87 |
+
protecting users' freedom to change the software. The systematic
|
88 |
+
pattern of such abuse occurs in the area of products for individuals to
|
89 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
90 |
+
have designed this version of the GPL to prohibit the practice for those
|
91 |
+
products. If such problems arise substantially in other domains, we
|
92 |
+
stand ready to extend this provision to those domains in future versions
|
93 |
+
of the GPL, as needed to protect the freedom of users.
|
94 |
+
|
95 |
+
Finally, every program is threatened constantly by software patents.
|
96 |
+
States should not allow patents to restrict development and use of
|
97 |
+
software on general-purpose computers, but in those that do, we wish to
|
98 |
+
avoid the special danger that patents applied to a free program could
|
99 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
100 |
+
patents cannot be used to render the program non-free.
|
101 |
+
|
102 |
+
The precise terms and conditions for copying, distribution and
|
103 |
+
modification follow.
|
104 |
+
|
105 |
+
TERMS AND CONDITIONS
|
106 |
+
|
107 |
+
0. Definitions.
|
108 |
+
|
109 |
+
"This License" refers to version 3 of the GNU General Public License.
|
110 |
+
|
111 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
112 |
+
works, such as semiconductor masks.
|
113 |
+
|
114 |
+
"The Program" refers to any copyrightable work licensed under this
|
115 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
116 |
+
"recipients" may be individuals or organizations.
|
117 |
+
|
118 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
119 |
+
in a fashion requiring copyright permission, other than the making of an
|
120 |
+
exact copy. The resulting work is called a "modified version" of the
|
121 |
+
earlier work or a work "based on" the earlier work.
|
122 |
+
|
123 |
+
A "covered work" means either the unmodified Program or a work based
|
124 |
+
on the Program.
|
125 |
+
|
126 |
+
To "propagate" a work means to do anything with it that, without
|
127 |
+
permission, would make you directly or secondarily liable for
|
128 |
+
infringement under applicable copyright law, except executing it on a
|
129 |
+
computer or modifying a private copy. Propagation includes copying,
|
130 |
+
distribution (with or without modification), making available to the
|
131 |
+
public, and in some countries other activities as well.
|
132 |
+
|
133 |
+
To "convey" a work means any kind of propagation that enables other
|
134 |
+
parties to make or receive copies. Mere interaction with a user through
|
135 |
+
a computer network, with no transfer of a copy, is not conveying.
|
136 |
+
|
137 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
138 |
+
to the extent that it includes a convenient and prominently visible
|
139 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
140 |
+
tells the user that there is no warranty for the work (except to the
|
141 |
+
extent that warranties are provided), that licensees may convey the
|
142 |
+
work under this License, and how to view a copy of this License. If
|
143 |
+
the interface presents a list of user commands or options, such as a
|
144 |
+
menu, a prominent item in the list meets this criterion.
|
145 |
+
|
146 |
+
1. Source Code.
|
147 |
+
|
148 |
+
The "source code" for a work means the preferred form of the work
|
149 |
+
for making modifications to it. "Object code" means any non-source
|
150 |
+
form of a work.
|
151 |
+
|
152 |
+
A "Standard Interface" means an interface that either is an official
|
153 |
+
standard defined by a recognized standards body, or, in the case of
|
154 |
+
interfaces specified for a particular programming language, one that
|
155 |
+
is widely used among developers working in that language.
|
156 |
+
|
157 |
+
The "System Libraries" of an executable work include anything, other
|
158 |
+
than the work as a whole, that (a) is included in the normal form of
|
159 |
+
packaging a Major Component, but which is not part of that Major
|
160 |
+
Component, and (b) serves only to enable use of the work with that
|
161 |
+
Major Component, or to implement a Standard Interface for which an
|
162 |
+
implementation is available to the public in source code form. A
|
163 |
+
"Major Component", in this context, means a major essential component
|
164 |
+
(kernel, window system, and so on) of the specific operating system
|
165 |
+
(if any) on which the executable work runs, or a compiler used to
|
166 |
+
produce the work, or an object code interpreter used to run it.
|
167 |
+
|
168 |
+
The "Corresponding Source" for a work in object code form means all
|
169 |
+
the source code needed to generate, install, and (for an executable
|
170 |
+
work) run the object code and to modify the work, including scripts to
|
171 |
+
control those activities. However, it does not include the work's
|
172 |
+
System Libraries, or general-purpose tools or generally available free
|
173 |
+
programs which are used unmodified in performing those activities but
|
174 |
+
which are not part of the work. For example, Corresponding Source
|
175 |
+
includes interface definition files associated with source files for
|
176 |
+
the work, and the source code for shared libraries and dynamically
|
177 |
+
linked subprograms that the work is specifically designed to require,
|
178 |
+
such as by intimate data communication or control flow between those
|
179 |
+
subprograms and other parts of the work.
|
180 |
+
|
181 |
+
The Corresponding Source need not include anything that users
|
182 |
+
can regenerate automatically from other parts of the Corresponding
|
183 |
+
Source.
|
184 |
+
|
185 |
+
The Corresponding Source for a work in source code form is that
|
186 |
+
same work.
|
187 |
+
|
188 |
+
2. Basic Permissions.
|
189 |
+
|
190 |
+
All rights granted under this License are granted for the term of
|
191 |
+
copyright on the Program, and are irrevocable provided the stated
|
192 |
+
conditions are met. This License explicitly affirms your unlimited
|
193 |
+
permission to run the unmodified Program. The output from running a
|
194 |
+
covered work is covered by this License only if the output, given its
|
195 |
+
content, constitutes a covered work. This License acknowledges your
|
196 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
197 |
+
|
198 |
+
You may make, run and propagate covered works that you do not
|
199 |
+
convey, without conditions so long as your license otherwise remains
|
200 |
+
in force. You may convey covered works to others for the sole purpose
|
201 |
+
of having them make modifications exclusively for you, or provide you
|
202 |
+
with facilities for running those works, provided that you comply with
|
203 |
+
the terms of this License in conveying all material for which you do
|
204 |
+
not control copyright. Those thus making or running the covered works
|
205 |
+
for you must do so exclusively on your behalf, under your direction
|
206 |
+
and control, on terms that prohibit them from making any copies of
|
207 |
+
your copyrighted material outside their relationship with you.
|
208 |
+
|
209 |
+
Conveying under any other circumstances is permitted solely under
|
210 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
211 |
+
makes it unnecessary.
|
212 |
+
|
213 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
214 |
+
|
215 |
+
No covered work shall be deemed part of an effective technological
|
216 |
+
measure under any applicable law fulfilling obligations under article
|
217 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
218 |
+
similar laws prohibiting or restricting circumvention of such
|
219 |
+
measures.
|
220 |
+
|
221 |
+
When you convey a covered work, you waive any legal power to forbid
|
222 |
+
circumvention of technological measures to the extent such circumvention
|
223 |
+
is effected by exercising rights under this License with respect to
|
224 |
+
the covered work, and you disclaim any intention to limit operation or
|
225 |
+
modification of the work as a means of enforcing, against the work's
|
226 |
+
users, your or third parties' legal rights to forbid circumvention of
|
227 |
+
technological measures.
|
228 |
+
|
229 |
+
4. Conveying Verbatim Copies.
|
230 |
+
|
231 |
+
You may convey verbatim copies of the Program's source code as you
|
232 |
+
receive it, in any medium, provided that you conspicuously and
|
233 |
+
appropriately publish on each copy an appropriate copyright notice;
|
234 |
+
keep intact all notices stating that this License and any
|
235 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
236 |
+
keep intact all notices of the absence of any warranty; and give all
|
237 |
+
recipients a copy of this License along with the Program.
|
238 |
+
|
239 |
+
You may charge any price or no price for each copy that you convey,
|
240 |
+
and you may offer support or warranty protection for a fee.
|
241 |
+
|
242 |
+
5. Conveying Modified Source Versions.
|
243 |
+
|
244 |
+
You may convey a work based on the Program, or the modifications to
|
245 |
+
produce it from the Program, in the form of source code under the
|
246 |
+
terms of section 4, provided that you also meet all of these conditions:
|
247 |
+
|
248 |
+
a) The work must carry prominent notices stating that you modified
|
249 |
+
it, and giving a relevant date.
|
250 |
+
|
251 |
+
b) The work must carry prominent notices stating that it is
|
252 |
+
released under this License and any conditions added under section
|
253 |
+
7. This requirement modifies the requirement in section 4 to
|
254 |
+
"keep intact all notices".
|
255 |
+
|
256 |
+
c) You must license the entire work, as a whole, under this
|
257 |
+
License to anyone who comes into possession of a copy. This
|
258 |
+
License will therefore apply, along with any applicable section 7
|
259 |
+
additional terms, to the whole of the work, and all its parts,
|
260 |
+
regardless of how they are packaged. This License gives no
|
261 |
+
permission to license the work in any other way, but it does not
|
262 |
+
invalidate such permission if you have separately received it.
|
263 |
+
|
264 |
+
d) If the work has interactive user interfaces, each must display
|
265 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
266 |
+
interfaces that do not display Appropriate Legal Notices, your
|
267 |
+
work need not make them do so.
|
268 |
+
|
269 |
+
A compilation of a covered work with other separate and independent
|
270 |
+
works, which are not by their nature extensions of the covered work,
|
271 |
+
and which are not combined with it such as to form a larger program,
|
272 |
+
in or on a volume of a storage or distribution medium, is called an
|
273 |
+
"aggregate" if the compilation and its resulting copyright are not
|
274 |
+
used to limit the access or legal rights of the compilation's users
|
275 |
+
beyond what the individual works permit. Inclusion of a covered work
|
276 |
+
in an aggregate does not cause this License to apply to the other
|
277 |
+
parts of the aggregate.
|
278 |
+
|
279 |
+
6. Conveying Non-Source Forms.
|
280 |
+
|
281 |
+
You may convey a covered work in object code form under the terms
|
282 |
+
of sections 4 and 5, provided that you also convey the
|
283 |
+
machine-readable Corresponding Source under the terms of this License,
|
284 |
+
in one of these ways:
|
285 |
+
|
286 |
+
a) Convey the object code in, or embodied in, a physical product
|
287 |
+
(including a physical distribution medium), accompanied by the
|
288 |
+
Corresponding Source fixed on a durable physical medium
|
289 |
+
customarily used for software interchange.
|
290 |
+
|
291 |
+
b) Convey the object code in, or embodied in, a physical product
|
292 |
+
(including a physical distribution medium), accompanied by a
|
293 |
+
written offer, valid for at least three years and valid for as
|
294 |
+
long as you offer spare parts or customer support for that product
|
295 |
+
model, to give anyone who possesses the object code either (1) a
|
296 |
+
copy of the Corresponding Source for all the software in the
|
297 |
+
product that is covered by this License, on a durable physical
|
298 |
+
medium customarily used for software interchange, for a price no
|
299 |
+
more than your reasonable cost of physically performing this
|
300 |
+
conveying of source, or (2) access to copy the
|
301 |
+
Corresponding Source from a network server at no charge.
|
302 |
+
|
303 |
+
c) Convey individual copies of the object code with a copy of the
|
304 |
+
written offer to provide the Corresponding Source. This
|
305 |
+
alternative is allowed only occasionally and noncommercially, and
|
306 |
+
only if you received the object code with such an offer, in accord
|
307 |
+
with subsection 6b.
|
308 |
+
|
309 |
+
d) Convey the object code by offering access from a designated
|
310 |
+
place (gratis or for a charge), and offer equivalent access to the
|
311 |
+
Corresponding Source in the same way through the same place at no
|
312 |
+
further charge. You need not require recipients to copy the
|
313 |
+
Corresponding Source along with the object code. If the place to
|
314 |
+
copy the object code is a network server, the Corresponding Source
|
315 |
+
may be on a different server (operated by you or a third party)
|
316 |
+
that supports equivalent copying facilities, provided you maintain
|
317 |
+
clear directions next to the object code saying where to find the
|
318 |
+
Corresponding Source. Regardless of what server hosts the
|
319 |
+
Corresponding Source, you remain obligated to ensure that it is
|
320 |
+
available for as long as needed to satisfy these requirements.
|
321 |
+
|
322 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
323 |
+
you inform other peers where the object code and Corresponding
|
324 |
+
Source of the work are being offered to the general public at no
|
325 |
+
charge under subsection 6d.
|
326 |
+
|
327 |
+
A separable portion of the object code, whose source code is excluded
|
328 |
+
from the Corresponding Source as a System Library, need not be
|
329 |
+
included in conveying the object code work.
|
330 |
+
|
331 |
+
A "User Product" is either (1) a "consumer product", which means any
|
332 |
+
tangible personal property which is normally used for personal, family,
|
333 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
334 |
+
into a dwelling. In determining whether a product is a consumer product,
|
335 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
336 |
+
product received by a particular user, "normally used" refers to a
|
337 |
+
typical or common use of that class of product, regardless of the status
|
338 |
+
of the particular user or of the way in which the particular user
|
339 |
+
actually uses, or expects or is expected to use, the product. A product
|
340 |
+
is a consumer product regardless of whether the product has substantial
|
341 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
342 |
+
the only significant mode of use of the product.
|
343 |
+
|
344 |
+
"Installation Information" for a User Product means any methods,
|
345 |
+
procedures, authorization keys, or other information required to install
|
346 |
+
and execute modified versions of a covered work in that User Product from
|
347 |
+
a modified version of its Corresponding Source. The information must
|
348 |
+
suffice to ensure that the continued functioning of the modified object
|
349 |
+
code is in no case prevented or interfered with solely because
|
350 |
+
modification has been made.
|
351 |
+
|
352 |
+
If you convey an object code work under this section in, or with, or
|
353 |
+
specifically for use in, a User Product, and the conveying occurs as
|
354 |
+
part of a transaction in which the right of possession and use of the
|
355 |
+
User Product is transferred to the recipient in perpetuity or for a
|
356 |
+
fixed term (regardless of how the transaction is characterized), the
|
357 |
+
Corresponding Source conveyed under this section must be accompanied
|
358 |
+
by the Installation Information. But this requirement does not apply
|
359 |
+
if neither you nor any third party retains the ability to install
|
360 |
+
modified object code on the User Product (for example, the work has
|
361 |
+
been installed in ROM).
|
362 |
+
|
363 |
+
The requirement to provide Installation Information does not include a
|
364 |
+
requirement to continue to provide support service, warranty, or updates
|
365 |
+
for a work that has been modified or installed by the recipient, or for
|
366 |
+
the User Product in which it has been modified or installed. Access to a
|
367 |
+
network may be denied when the modification itself materially and
|
368 |
+
adversely affects the operation of the network or violates the rules and
|
369 |
+
protocols for communication across the network.
|
370 |
+
|
371 |
+
Corresponding Source conveyed, and Installation Information provided,
|
372 |
+
in accord with this section must be in a format that is publicly
|
373 |
+
documented (and with an implementation available to the public in
|
374 |
+
source code form), and must require no special password or key for
|
375 |
+
unpacking, reading or copying.
|
376 |
+
|
377 |
+
7. Additional Terms.
|
378 |
+
|
379 |
+
"Additional permissions" are terms that supplement the terms of this
|
380 |
+
License by making exceptions from one or more of its conditions.
|
381 |
+
Additional permissions that are applicable to the entire Program shall
|
382 |
+
be treated as though they were included in this License, to the extent
|
383 |
+
that they are valid under applicable law. If additional permissions
|
384 |
+
apply only to part of the Program, that part may be used separately
|
385 |
+
under those permissions, but the entire Program remains governed by
|
386 |
+
this License without regard to the additional permissions.
|
387 |
+
|
388 |
+
When you convey a copy of a covered work, you may at your option
|
389 |
+
remove any additional permissions from that copy, or from any part of
|
390 |
+
it. (Additional permissions may be written to require their own
|
391 |
+
removal in certain cases when you modify the work.) You may place
|
392 |
+
additional permissions on material, added by you to a covered work,
|
393 |
+
for which you have or can give appropriate copyright permission.
|
394 |
+
|
395 |
+
Notwithstanding any other provision of this License, for material you
|
396 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
397 |
+
that material) supplement the terms of this License with terms:
|
398 |
+
|
399 |
+
a) Disclaiming warranty or limiting liability differently from the
|
400 |
+
terms of sections 15 and 16 of this License; or
|
401 |
+
|
402 |
+
b) Requiring preservation of specified reasonable legal notices or
|
403 |
+
author attributions in that material or in the Appropriate Legal
|
404 |
+
Notices displayed by works containing it; or
|
405 |
+
|
406 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
407 |
+
requiring that modified versions of such material be marked in
|
408 |
+
reasonable ways as different from the original version; or
|
409 |
+
|
410 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
411 |
+
authors of the material; or
|
412 |
+
|
413 |
+
e) Declining to grant rights under trademark law for use of some
|
414 |
+
trade names, trademarks, or service marks; or
|
415 |
+
|
416 |
+
f) Requiring indemnification of licensors and authors of that
|
417 |
+
material by anyone who conveys the material (or modified versions of
|
418 |
+
it) with contractual assumptions of liability to the recipient, for
|
419 |
+
any liability that these contractual assumptions directly impose on
|
420 |
+
those licensors and authors.
|
421 |
+
|
422 |
+
All other non-permissive additional terms are considered "further
|
423 |
+
restrictions" within the meaning of section 10. If the Program as you
|
424 |
+
received it, or any part of it, contains a notice stating that it is
|
425 |
+
governed by this License along with a term that is a further
|
426 |
+
restriction, you may remove that term. If a license document contains
|
427 |
+
a further restriction but permits relicensing or conveying under this
|
428 |
+
License, you may add to a covered work material governed by the terms
|
429 |
+
of that license document, provided that the further restriction does
|
430 |
+
not survive such relicensing or conveying.
|
431 |
+
|
432 |
+
If you add terms to a covered work in accord with this section, you
|
433 |
+
must place, in the relevant source files, a statement of the
|
434 |
+
additional terms that apply to those files, or a notice indicating
|
435 |
+
where to find the applicable terms.
|
436 |
+
|
437 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
438 |
+
form of a separately written license, or stated as exceptions;
|
439 |
+
the above requirements apply either way.
|
440 |
+
|
441 |
+
8. Termination.
|
442 |
+
|
443 |
+
You may not propagate or modify a covered work except as expressly
|
444 |
+
provided under this License. Any attempt otherwise to propagate or
|
445 |
+
modify it is void, and will automatically terminate your rights under
|
446 |
+
this License (including any patent licenses granted under the third
|
447 |
+
paragraph of section 11).
|
448 |
+
|
449 |
+
However, if you cease all violation of this License, then your
|
450 |
+
license from a particular copyright holder is reinstated (a)
|
451 |
+
provisionally, unless and until the copyright holder explicitly and
|
452 |
+
finally terminates your license, and (b) permanently, if the copyright
|
453 |
+
holder fails to notify you of the violation by some reasonable means
|
454 |
+
prior to 60 days after the cessation.
|
455 |
+
|
456 |
+
Moreover, your license from a particular copyright holder is
|
457 |
+
reinstated permanently if the copyright holder notifies you of the
|
458 |
+
violation by some reasonable means, this is the first time you have
|
459 |
+
received notice of violation of this License (for any work) from that
|
460 |
+
copyright holder, and you cure the violation prior to 30 days after
|
461 |
+
your receipt of the notice.
|
462 |
+
|
463 |
+
Termination of your rights under this section does not terminate the
|
464 |
+
licenses of parties who have received copies or rights from you under
|
465 |
+
this License. If your rights have been terminated and not permanently
|
466 |
+
reinstated, you do not qualify to receive new licenses for the same
|
467 |
+
material under section 10.
|
468 |
+
|
469 |
+
9. Acceptance Not Required for Having Copies.
|
470 |
+
|
471 |
+
You are not required to accept this License in order to receive or
|
472 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
473 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
474 |
+
to receive a copy likewise does not require acceptance. However,
|
475 |
+
nothing other than this License grants you permission to propagate or
|
476 |
+
modify any covered work. These actions infringe copyright if you do
|
477 |
+
not accept this License. Therefore, by modifying or propagating a
|
478 |
+
covered work, you indicate your acceptance of this License to do so.
|
479 |
+
|
480 |
+
10. Automatic Licensing of Downstream Recipients.
|
481 |
+
|
482 |
+
Each time you convey a covered work, the recipient automatically
|
483 |
+
receives a license from the original licensors, to run, modify and
|
484 |
+
propagate that work, subject to this License. You are not responsible
|
485 |
+
for enforcing compliance by third parties with this License.
|
486 |
+
|
487 |
+
An "entity transaction" is a transaction transferring control of an
|
488 |
+
organization, or substantially all assets of one, or subdividing an
|
489 |
+
organization, or merging organizations. If propagation of a covered
|
490 |
+
work results from an entity transaction, each party to that
|
491 |
+
transaction who receives a copy of the work also receives whatever
|
492 |
+
licenses to the work the party's predecessor in interest had or could
|
493 |
+
give under the previous paragraph, plus a right to possession of the
|
494 |
+
Corresponding Source of the work from the predecessor in interest, if
|
495 |
+
the predecessor has it or can get it with reasonable efforts.
|
496 |
+
|
497 |
+
You may not impose any further restrictions on the exercise of the
|
498 |
+
rights granted or affirmed under this License. For example, you may
|
499 |
+
not impose a license fee, royalty, or other charge for exercise of
|
500 |
+
rights granted under this License, and you may not initiate litigation
|
501 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
502 |
+
any patent claim is infringed by making, using, selling, offering for
|
503 |
+
sale, or importing the Program or any portion of it.
|
504 |
+
|
505 |
+
11. Patents.
|
506 |
+
|
507 |
+
A "contributor" is a copyright holder who authorizes use under this
|
508 |
+
License of the Program or a work on which the Program is based. The
|
509 |
+
work thus licensed is called the contributor's "contributor version".
|
510 |
+
|
511 |
+
A contributor's "essential patent claims" are all patent claims
|
512 |
+
owned or controlled by the contributor, whether already acquired or
|
513 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
514 |
+
by this License, of making, using, or selling its contributor version,
|
515 |
+
but do not include claims that would be infringed only as a
|
516 |
+
consequence of further modification of the contributor version. For
|
517 |
+
purposes of this definition, "control" includes the right to grant
|
518 |
+
patent sublicenses in a manner consistent with the requirements of
|
519 |
+
this License.
|
520 |
+
|
521 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
522 |
+
patent license under the contributor's essential patent claims, to
|
523 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
524 |
+
propagate the contents of its contributor version.
|
525 |
+
|
526 |
+
In the following three paragraphs, a "patent license" is any express
|
527 |
+
agreement or commitment, however denominated, not to enforce a patent
|
528 |
+
(such as an express permission to practice a patent or covenant not to
|
529 |
+
sue for patent infringement). To "grant" such a patent license to a
|
530 |
+
party means to make such an agreement or commitment not to enforce a
|
531 |
+
patent against the party.
|
532 |
+
|
533 |
+
If you convey a covered work, knowingly relying on a patent license,
|
534 |
+
and the Corresponding Source of the work is not available for anyone
|
535 |
+
to copy, free of charge and under the terms of this License, through a
|
536 |
+
publicly available network server or other readily accessible means,
|
537 |
+
then you must either (1) cause the Corresponding Source to be so
|
538 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
539 |
+
patent license for this particular work, or (3) arrange, in a manner
|
540 |
+
consistent with the requirements of this License, to extend the patent
|
541 |
+
license to downstream recipients. "Knowingly relying" means you have
|
542 |
+
actual knowledge that, but for the patent license, your conveying the
|
543 |
+
covered work in a country, or your recipient's use of the covered work
|
544 |
+
in a country, would infringe one or more identifiable patents in that
|
545 |
+
country that you have reason to believe are valid.
|
546 |
+
|
547 |
+
If, pursuant to or in connection with a single transaction or
|
548 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
549 |
+
covered work, and grant a patent license to some of the parties
|
550 |
+
receiving the covered work authorizing them to use, propagate, modify
|
551 |
+
or convey a specific copy of the covered work, then the patent license
|
552 |
+
you grant is automatically extended to all recipients of the covered
|
553 |
+
work and works based on it.
|
554 |
+
|
555 |
+
A patent license is "discriminatory" if it does not include within
|
556 |
+
the scope of its coverage, prohibits the exercise of, or is
|
557 |
+
conditioned on the non-exercise of one or more of the rights that are
|
558 |
+
specifically granted under this License. You may not convey a covered
|
559 |
+
work if you are a party to an arrangement with a third party that is
|
560 |
+
in the business of distributing software, under which you make payment
|
561 |
+
to the third party based on the extent of your activity of conveying
|
562 |
+
the work, and under which the third party grants, to any of the
|
563 |
+
parties who would receive the covered work from you, a discriminatory
|
564 |
+
patent license (a) in connection with copies of the covered work
|
565 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
566 |
+
for and in connection with specific products or compilations that
|
567 |
+
contain the covered work, unless you entered into that arrangement,
|
568 |
+
or that patent license was granted, prior to 28 March 2007.
|
569 |
+
|
570 |
+
Nothing in this License shall be construed as excluding or limiting
|
571 |
+
any implied license or other defenses to infringement that may
|
572 |
+
otherwise be available to you under applicable patent law.
|
573 |
+
|
574 |
+
12. No Surrender of Others' Freedom.
|
575 |
+
|
576 |
+
If conditions are imposed on you (whether by court order, agreement or
|
577 |
+
otherwise) that contradict the conditions of this License, they do not
|
578 |
+
excuse you from the conditions of this License. If you cannot convey a
|
579 |
+
covered work so as to satisfy simultaneously your obligations under this
|
580 |
+
License and any other pertinent obligations, then as a consequence you may
|
581 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
582 |
+
to collect a royalty for further conveying from those to whom you convey
|
583 |
+
the Program, the only way you could satisfy both those terms and this
|
584 |
+
License would be to refrain entirely from conveying the Program.
|
585 |
+
|
586 |
+
13. Use with the GNU Affero General Public License.
|
587 |
+
|
588 |
+
Notwithstanding any other provision of this License, you have
|
589 |
+
permission to link or combine any covered work with a work licensed
|
590 |
+
under version 3 of the GNU Affero General Public License into a single
|
591 |
+
combined work, and to convey the resulting work. The terms of this
|
592 |
+
License will continue to apply to the part which is the covered work,
|
593 |
+
but the special requirements of the GNU Affero General Public License,
|
594 |
+
section 13, concerning interaction through a network will apply to the
|
595 |
+
combination as such.
|
596 |
+
|
597 |
+
14. Revised Versions of this License.
|
598 |
+
|
599 |
+
The Free Software Foundation may publish revised and/or new versions of
|
600 |
+
the GNU General Public License from time to time. Such new versions will
|
601 |
+
be similar in spirit to the present version, but may differ in detail to
|
602 |
+
address new problems or concerns.
|
603 |
+
|
604 |
+
Each version is given a distinguishing version number. If the
|
605 |
+
Program specifies that a certain numbered version of the GNU General
|
606 |
+
Public License "or any later version" applies to it, you have the
|
607 |
+
option of following the terms and conditions either of that numbered
|
608 |
+
version or of any later version published by the Free Software
|
609 |
+
Foundation. If the Program does not specify a version number of the
|
610 |
+
GNU General Public License, you may choose any version ever published
|
611 |
+
by the Free Software Foundation.
|
612 |
+
|
613 |
+
If the Program specifies that a proxy can decide which future
|
614 |
+
versions of the GNU General Public License can be used, that proxy's
|
615 |
+
public statement of acceptance of a version permanently authorizes you
|
616 |
+
to choose that version for the Program.
|
617 |
+
|
618 |
+
Later license versions may give you additional or different
|
619 |
+
permissions. However, no additional obligations are imposed on any
|
620 |
+
author or copyright holder as a result of your choosing to follow a
|
621 |
+
later version.
|
622 |
+
|
623 |
+
15. Disclaimer of Warranty.
|
624 |
+
|
625 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
626 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
627 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
628 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
629 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
630 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
631 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
632 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
633 |
+
|
634 |
+
16. Limitation of Liability.
|
635 |
+
|
636 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
637 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
638 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
639 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
640 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
641 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
642 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
643 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
644 |
+
SUCH DAMAGES.
|
645 |
+
|
646 |
+
17. Interpretation of Sections 15 and 16.
|
647 |
+
|
648 |
+
If the disclaimer of warranty and limitation of liability provided
|
649 |
+
above cannot be given local legal effect according to their terms,
|
650 |
+
reviewing courts shall apply local law that most closely approximates
|
651 |
+
an absolute waiver of all civil liability in connection with the
|
652 |
+
Program, unless a warranty or assumption of liability accompanies a
|
653 |
+
copy of the Program in return for a fee.
|
654 |
+
|
655 |
+
END OF TERMS AND CONDITIONS
|
656 |
+
|
657 |
+
How to Apply These Terms to Your New Programs
|
658 |
+
|
659 |
+
If you develop a new program, and you want it to be of the greatest
|
660 |
+
possible use to the public, the best way to achieve this is to make it
|
661 |
+
free software which everyone can redistribute and change under these terms.
|
662 |
+
|
663 |
+
To do so, attach the following notices to the program. It is safest
|
664 |
+
to attach them to the start of each source file to most effectively
|
665 |
+
state the exclusion of warranty; and each file should have at least
|
666 |
+
the "copyright" line and a pointer to where the full notice is found.
|
667 |
+
|
668 |
+
<one line to give the program's name and a brief idea of what it does.>
|
669 |
+
Copyright © <year> <name of author>
|
670 |
+
|
671 |
+
This program is free software: you can redistribute it and/or modify
|
672 |
+
it under the terms of the GNU General Public License as published by
|
673 |
+
the Free Software Foundation, either version 3 of the License, or
|
674 |
+
(at your option) any later version.
|
675 |
+
|
676 |
+
This program is distributed in the hope that it will be useful,
|
677 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
678 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
679 |
+
GNU General Public License for more details.
|
680 |
+
|
681 |
+
You should have received a copy of the GNU General Public License
|
682 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
683 |
+
|
684 |
+
Also add information on how to contact you by electronic and paper mail.
|
685 |
+
|
686 |
+
If the program does terminal interaction, make it output a short
|
687 |
+
notice like this when it starts in an interactive mode:
|
688 |
+
|
689 |
+
<program> Copyright © <year> <name of author>
|
690 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
691 |
+
This is free software, and you are welcome to redistribute it
|
692 |
+
under certain conditions; type `show c' for details.
|
693 |
+
|
694 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
695 |
+
parts of the General Public License. Of course, your program's commands
|
696 |
+
might be different; for a GUI interface, you would use an "about box".
|
697 |
+
|
698 |
+
You should also get your employer (if you work as a programmer) or school,
|
699 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
700 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
701 |
+
<http://www.gnu.org/licenses/>.
|
702 |
+
|
703 |
+
The GNU General Public License does not permit incorporating your program
|
704 |
+
into proprietary programs. If your program is a subroutine library, you
|
705 |
+
may consider it more useful to permit linking proprietary applications with
|
706 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
707 |
+
Public License instead of this License. But first, please read
|
708 |
+
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
readme.txt
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== WordPress Users & WooCommerce Customers Import Export(BASIC) ===
|
2 |
+
Contributors: hikeforce, elvinwf
|
3 |
+
Tags: CSV, Export, Import, WooCommerce Customers, Wordpress Users
|
4 |
+
Requires at least: 3.0.1
|
5 |
+
Tested up to: 4.7
|
6 |
+
Stable tag: 1.0.0
|
7 |
+
License: GPLv2 or later
|
8 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
+
|
10 |
+
Easily Import and Export WordPress Users in CSV format(Premium Version Supports WooCommerce Customers & All User Meta).
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
= Introduction =
|
15 |
+
|
16 |
+
WordPress Users & WooCommerce Customers Import Export(BASIC) helps you to easily export and import users in your WordPress. This plugin lets you import/export user details. It is super simple!
|
17 |
+
|
18 |
+
<ul>
|
19 |
+
<li>Export Users in to a CSV file.</li>
|
20 |
+
<li>Import Users from CSV format in to WordPress/WooCommerce Store.</li>
|
21 |
+
</ul>
|
22 |
+
|
23 |
+
Highlights: WordPress Users Export, WordPress Users CSV Import Suite, Export WordPress Users to CSV. Pro Version supports export and import of all additional user meta like WooCommerce deatils.
|
24 |
+
|
25 |
+
= How does it work? =
|
26 |
+
|
27 |
+
The WordPress Users & WooCommerce Customers Import Export(BASIC) Plugin takes CSV (Comma-Separated Values) file as input. You must create a CSV file and enter the user details in a structured format as explained in the tutorial. This is to match each field of CSV file to the field of a particular user fields , otherwise Admin need to input manually. For example: the user_email field gets mapped to the User Email. For the plugin to work correctly, you must map headers of all of the column correctly and you must ensure that all of the fields you enter must be in the correct format.
|
28 |
+
|
29 |
+
You can create the CSV from the scratch or you can export the users to get the format of CSV. You can use a spreadsheet program, such as Microsoft Excel, OpenOffice or Google Spreadsheets for creating and modifying the CSV file. Save this file in UTF-8 encoding with extension .CSV. After entering all details about users in spreadsheet, you can import users to your online Site/Store. With this plugin, you can also export and download user details as a CSV file.
|
30 |
+
|
31 |
+
<blockquote>
|
32 |
+
|
33 |
+
= Premium version Features =
|
34 |
+
|
35 |
+
WordPress Users & WooCommerce Customers Import Export
|
36 |
+
|
37 |
+
<ul>
|
38 |
+
<li>Export/Import <strong>WooCommerce Customer</strong> details into a CSV file.( Basic version supports only WordPress User details )</li>
|
39 |
+
<li>Option to choose All Roles or Multiple Roles while export (Basic Supports only single role at a time)</li>
|
40 |
+
<li>Various Filter options for exporting Customers.</li>
|
41 |
+
<li>Map and Transform fields while Importing Customers.</li>
|
42 |
+
<li>Change values while improting Customers using Evaluation Fields.</li>
|
43 |
+
<li>Choice to Update or Skip existing imported Customers.</li>
|
44 |
+
<li>Choice to Send or Skip Emails for newly imported Customers.</li>
|
45 |
+
<li>WPML Supported. French language support Out of the Box.</li>
|
46 |
+
<li>Import/Export file from/to a remote server via FTP in Scheduled time interval with Cron Job.</li>
|
47 |
+
<li>Excellent Support for setting it up!'</li>
|
48 |
+
</ul>
|
49 |
+
|
50 |
+
Please visit <a rel="nofollow" href="http://www.xadapter.com/product/wordpress-users-woocommerce-customers-import-export/">WordPress Users & WooCommerce Customers Import Export</a> for more details
|
51 |
+
|
52 |
+
</blockquote>
|
53 |
+
|
54 |
+
= About HikeForce.com =
|
55 |
+
|
56 |
+
HikeForce creates quality WordPress/WooCommerce plugins that are easy to use and customize. We are proud to have thousands of customers actively using our plugins across the globe.
|
57 |
+
|
58 |
+
|
59 |
+
== Installation ==
|
60 |
+
|
61 |
+
1. Upload the plugin folder to the /wp-content/plugins/ directory.
|
62 |
+
2. Activate the plugin through the Plugins menu in WordPress.
|
63 |
+
3. Thats it! you can now configure the plugin.
|
64 |
+
|
65 |
+
== Frequently Asked Questions ==
|
66 |
+
|
67 |
+
= Does this plugin support multiple roles? =
|
68 |
+
|
69 |
+
Yes. You can import or export multiple user roles along with other basic user details
|
70 |
+
|
71 |
+
== Screenshots ==
|
72 |
+
|
73 |
+
1. User Export Screen
|
74 |
+
|
75 |
+
2. User Import Screen
|
76 |
+
|
77 |
+
3. Premium export Screen
|
78 |
+
|
79 |
+
== Changelog ==
|
80 |
+
= 1.0.0 =
|
81 |
+
* Import /Export WordPress Users.
|
82 |
+
|
83 |
+
== Upgrade Notice ==
|
84 |
+
= 1.0.0 =
|
85 |
+
* Import /Export WordPress Users.
|
styles/wf-style.css
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#icon-woocommerce-importer {
|
2 |
+
background-image: url(../images/wf-import.png) !important;
|
3 |
+
background-position: -3px -5px;
|
4 |
+
}
|
5 |
+
.widefat_importer td {
|
6 |
+
vertical-align: middle;
|
7 |
+
padding: 5px 9px;
|
8 |
+
}
|
9 |
+
#import-progress {
|
10 |
+
width: 100%;
|
11 |
+
}
|
12 |
+
#import-progress td, #import-progress th {
|
13 |
+
padding: .5em 1em;
|
14 |
+
}
|
15 |
+
#import-progress td.status, #import-progress th.status {
|
16 |
+
width: 32px;
|
17 |
+
}
|
18 |
+
#import-progress td.row, #import-progress th.row {
|
19 |
+
width: 3em;
|
20 |
+
text-align: center;
|
21 |
+
}
|
22 |
+
#import-progress td.reason, #import-progress th.reason {
|
23 |
+
text-align: right;
|
24 |
+
}
|
25 |
+
#import-progress tr.importer-loading td {
|
26 |
+
background: url(../images/wf-ajax-loader.gif) no-repeat center center;
|
27 |
+
height: 32px;
|
28 |
+
}
|
29 |
+
#import-progress .merged td,
|
30 |
+
#import-progress .imported td {
|
31 |
+
}
|
32 |
+
#import-progress .skipped td {
|
33 |
+
border-bottom-color: #dbcb83;
|
34 |
+
background: #f2ecd2;
|
35 |
+
}
|
36 |
+
#import-progress .failed td {
|
37 |
+
border-bottom-color: #e6adaa;
|
38 |
+
background: #f2d3d2;
|
39 |
+
}
|
40 |
+
#import-progress mark.result {
|
41 |
+
height: 0;
|
42 |
+
display: block;
|
43 |
+
line-height: 16px;
|
44 |
+
overflow: hidden;
|
45 |
+
padding: 16px 0 0 0;
|
46 |
+
}
|
47 |
+
#import-progress .skipped mark.result {
|
48 |
+
background: url(../images/wf-notice.png) no-repeat center top;
|
49 |
+
}
|
50 |
+
#import-progress .merged mark.result,
|
51 |
+
#import-progress .imported mark.result {
|
52 |
+
background: url(../images/wf-success.png) no-repeat center top;
|
53 |
+
}
|
54 |
+
#import-progress .failed mark.result {
|
55 |
+
background: url(../images/wf-failed.png) no-repeat center top;
|
56 |
+
}
|
57 |
+
#import-progress .complete td {
|
58 |
+
background: #000;
|
59 |
+
border-color: #000;
|
60 |
+
border-top: 4px solid #000;
|
61 |
+
color: #fff;
|
62 |
+
font-size: 1.5em;
|
63 |
+
padding: .95em 1em 1em;
|
64 |
+
text-align: center;
|
65 |
+
}
|
66 |
+
#import-progress .regenerating td {
|
67 |
+
padding: 0;
|
68 |
+
}
|
69 |
+
#import-progress .regenerating div.progress {
|
70 |
+
background: #464646;
|
71 |
+
padding: .95em 1em 1em;
|
72 |
+
color: #fff;
|
73 |
+
overflow: hidden;
|
74 |
+
width: 0;
|
75 |
+
float: left;
|
76 |
+
text-align: left;
|
77 |
+
white-space: nowrap;
|
78 |
+
}
|
79 |
+
.update{
|
80 |
+
background: #fff;
|
81 |
+
border-left: 4px solid #fff;
|
82 |
+
padding: 1px 12px;
|
83 |
+
border-left-color: #46b450;
|
84 |
+
margin-top: 10px;
|
85 |
+
}
|
86 |
+
#datagrid { border-collapse: collapse; text-align: left; width: 80%; }
|
87 |
+
#datagrid {
|
88 |
+
background: #fff; overflow: hidden;
|
89 |
+
}
|
90 |
+
#datagrid td{ padding: 3px 10px; }
|
91 |
+
#datagrid th { padding: 3px 25px; color: #fff; background-color: #ccc; font-weight: bold;font-size: 15px; }
|
92 |
+
|
93 |
+
.woocommerce-message a.button-primary, .woocommerce-message button.button-primary{
|
94 |
+
background: #0085ba none repeat scroll 0 0 !important;
|
95 |
+
border-color: #0073aa #006799 #006799 !important;}
|
96 |
+
.woocommerce-message{border-left-color:#46b450 !important;}
|
97 |
+
.chosen-container-multi .chosen-choices li.search-field{
|
98 |
+
padding: 5px !important;
|
99 |
+
}
|
100 |
+
.chosen-container-multi .chosen-choices li.search-field input[type="text"]{
|
101 |
+
padding: 1px !important;
|
102 |
+
}
|
103 |
+
.order_actions .download_to_csv_wf {
|
104 |
+
display: block;
|
105 |
+
height: 2em !important;
|
106 |
+
padding: 0 !important;
|
107 |
+
position: relative;
|
108 |
+
text-indent: -9999px;
|
109 |
+
width: 2em;
|
110 |
+
}
|
111 |
+
.order_actions .download_to_csv_wf::after {
|
112 |
+
content: "";
|
113 |
+
font-family: "dashicons";
|
114 |
+
font-variant: normal;
|
115 |
+
font-weight: normal;
|
116 |
+
height: 100%;
|
117 |
+
left: 0;
|
118 |
+
margin: 0;
|
119 |
+
position: absolute;
|
120 |
+
text-align: center;
|
121 |
+
text-indent: 0;
|
122 |
+
text-transform: none;
|
123 |
+
top: 0;
|
124 |
+
width: 100%;
|
125 |
+
}
|
temp-import.csv
ADDED
File without changes
|