WooCommerce – Store Exporter - Version 1.9.2

Version Description

  • Changed: Product Visibility field matches WooCommerce 3.1 labels (thanks spbuckle)
  • Added: Filter for legacy Product Visibility labels
  • Changed: Updated list of supported Plugin modules
Download this release

Release Info

Developer visser
Plugin Icon 128x128 WooCommerce – Store Exporter
Version 1.9.2
Comparing to
See all releases

Code changes from version 1.8.1 to 1.9.2

Files changed (70) hide show
  1. common/common.php +16 -4
  2. exporter.php +232 -203
  3. includes/admin.php +231 -275
  4. includes/admin/brand.php +33 -0
  5. includes/admin/category.php +33 -0
  6. includes/admin/commission.php +83 -0
  7. includes/admin/coupon.php +33 -0
  8. includes/admin/customer.php +124 -0
  9. includes/admin/order.php +663 -0
  10. includes/admin/product.php +390 -0
  11. includes/admin/shipping_class.php +33 -0
  12. includes/admin/subscription.php +73 -0
  13. includes/admin/tag.php +33 -0
  14. includes/admin/user.php +91 -0
  15. includes/brand.php +153 -0
  16. includes/brands.php +0 -114
  17. includes/{categories.php → category.php} +37 -31
  18. includes/commission.php +252 -0
  19. includes/common-dashboard_widgets.php +11 -3
  20. includes/common.php +77 -0
  21. includes/{coupons.php → coupon.php} +59 -40
  22. includes/customer.php +248 -0
  23. includes/customers.php +0 -210
  24. includes/export-csv.php +3 -1
  25. includes/formatting.php +171 -197
  26. includes/functions.php +1546 -305
  27. includes/install.php +4 -3
  28. includes/order-extend.php +1360 -0
  29. includes/order.php +675 -0
  30. includes/orders.php +0 -1187
  31. includes/product-extend.php +1304 -0
  32. includes/product.php +1392 -0
  33. includes/product_vendor.php +173 -0
  34. includes/product_vendors.php +0 -85
  35. includes/products.php +0 -1380
  36. includes/settings.php +427 -117
  37. includes/shipping_class.php +91 -0
  38. includes/subscription.php +264 -0
  39. includes/subscriptions.php +0 -108
  40. includes/{tags.php → tag.php} +49 -50
  41. includes/user-extend.php +102 -0
  42. includes/{users.php → user.php} +71 -66
  43. js/chosen.jquery.js +988 -0
  44. js/jquery.timepicker.js +2245 -0
  45. languages/woocommerce-exporter-en_GB.mo +0 -0
  46. languages/woocommerce-exporter-en_GB.po +97 -0
  47. readme.txt +102 -11
  48. templates/admin/export.css +13 -3
  49. templates/admin/export.js +203 -4
  50. templates/admin/jquery-ui-timepicker.css +12 -0
  51. templates/admin/media-csv_file.php +3 -2
  52. templates/admin/media-export_details.php +38 -51
  53. templates/admin/tabs-archive.php +26 -25
  54. templates/admin/tabs-export.php +386 -199
  55. templates/admin/tabs-fields.php +5 -4
  56. templates/admin/tabs-overview.php +103 -53
  57. templates/admin/tabs-settings.php +88 -45
  58. templates/admin/tabs-tools.php +73 -7
  59. templates/admin/tabs.php +7 -5
  60. templates/admin/woo-admin_ce-export.css +76 -0
  61. templates/admin/woo-admin_ce-export.js +179 -0
  62. templates/admin/woo-admin_ce-export.php +13 -0
  63. templates/admin/woo-admin_ce-export_archive.php +65 -0
  64. templates/admin/woo-admin_ce-export_export.php +511 -0
  65. templates/admin/woo-admin_ce-export_overview.php +85 -0
  66. templates/admin/woo-admin_ce-export_settings.php +153 -0
  67. templates/admin/woo-admin_ce-export_tools.php +22 -0
  68. templates/admin/woo-admin_ce-media_csv_file.php +12 -0
  69. templates/admin/woo-admin_ce-media_export_details.php +54 -0
  70. templates/admin/woocommerce-admin_dashboard_vm-plugins.css +0 -3
common/common.php CHANGED
@@ -4,11 +4,14 @@
4
* Filename: common.php
5
* Description: common.php loads commonly accessed functions across the Visser Labs suite.
6
*
7
* - woo_get_action
8
* - woo_is_wpsc_activated
9
* - woo_is_woo_activated
10
* - woo_is_jigo_activated
11
* - woo_get_woo_version
12
*/
13
14
if( is_admin() ) {
@@ -26,13 +29,13 @@ if( !function_exists( 'woo_get_action' ) ) {
26
function woo_get_action( $prefer_get = false ) {
27
28
if ( isset( $_GET['action'] ) && $prefer_get )
29
- return $_GET['action'];
30
31
if ( isset( $_POST['action'] ) )
32
- return $_POST['action'];
33
34
if ( isset( $_GET['action'] ) )
35
- return $_GET['action'];
36
37
return false;
38
@@ -66,13 +69,22 @@ if( !function_exists( 'woo_is_jigo_activated' ) ) {
66
}
67
}
68
69
if( !function_exists( 'woo_get_woo_version' ) ) {
70
function woo_get_woo_version() {
71
72
$version = false;
73
if( defined( 'WC_VERSION' ) ) {
74
$version = WC_VERSION;
75
- // Backwards compatibility
76
} else if( defined( 'WOOCOMMERCE_VERSION' ) ) {
77
$version = WOOCOMMERCE_VERSION;
78
}
4
* Filename: common.php
5
* Description: common.php loads commonly accessed functions across the Visser Labs suite.
6
*
7
+ * Free
8
* - woo_get_action
9
* - woo_is_wpsc_activated
10
* - woo_is_woo_activated
11
* - woo_is_jigo_activated
12
+ * - woo_is_exchange_activated
13
* - woo_get_woo_version
14
+ *
15
*/
16
17
if( is_admin() ) {
29
function woo_get_action( $prefer_get = false ) {
30
31
if ( isset( $_GET['action'] ) && $prefer_get )
32
+ return sanitize_text_field( $_GET['action'] );
33
34
if ( isset( $_POST['action'] ) )
35
+ return sanitize_text_field( $_POST['action'] );
36
37
if ( isset( $_GET['action'] ) )
38
+ return sanitize_text_field( $_GET['action'] );
39
40
return false;
41
69
}
70
}
71
72
+ if( !function_exists( 'woo_is_exchange_activated' ) ) {
73
+ function woo_is_exchange_activated() {
74
+
75
+ if( function_exists( 'IT_Exchange' ) )
76
+ return true;
77
+
78
+ }
79
+ }
80
+
81
if( !function_exists( 'woo_get_woo_version' ) ) {
82
function woo_get_woo_version() {
83
84
$version = false;
85
if( defined( 'WC_VERSION' ) ) {
86
$version = WC_VERSION;
87
+ // Backwards compatibility
88
} else if( defined( 'WOOCOMMERCE_VERSION' ) ) {
89
$version = WOOCOMMERCE_VERSION;
90
}
exporter.php CHANGED
@@ -2,11 +2,17 @@
2
/*
3
Plugin Name: WooCommerce - Store Exporter
4
Plugin URI: http://www.visser.com.au/woocommerce/plugins/exporter/
5
- Description: Export store details out of WooCommerce into simple formatted files (e.g. CSV, XML, Excel 2007 XLS, etc.).
6
- Version: 1.8.1
7
Author: Visser Labs
8
Author URI: http://www.visser.com.au/about/
9
License: GPL2
10
*/
11
12
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -17,25 +23,29 @@ define( 'WOO_CE_PATH', plugin_dir_path( __FILE__ ) );
17
define( 'WOO_CE_PREFIX', 'woo_ce' );
18
19
// Turn this on to enable additional debugging options at export time
20
- define( 'WOO_CE_DEBUG', false );
21
22
// Avoid conflicts if Store Exporter Deluxe is activated
23
include_once( WOO_CE_PATH . 'common/common.php' );
24
- if( defined( 'WOO_CD_PREFIX' ) == false ) {
25
include_once( WOO_CE_PATH . 'includes/functions.php' );
26
- }
27
28
function woo_ce_i18n() {
29
30
- load_plugin_textdomain( 'woo_ce', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
31
32
}
33
- add_action( 'init', 'woo_ce_i18n' );
34
35
if( is_admin() ) {
36
37
/* Start of: WordPress Administration */
38
39
include_once( WOO_CE_PATH . 'includes/install.php' );
40
register_activation_hook( __FILE__, 'woo_ce_install' );
41
@@ -44,124 +54,170 @@ if( is_admin() ) {
44
45
global $export, $wp_roles;
46
47
// Now is the time to de-activate Store Exporter if Store Exporter Deluxe is activated
48
if( defined( 'WOO_CD_PREFIX' ) ) {
49
include_once( WOO_CE_PATH . 'includes/install.php' );
50
woo_ce_deactivate_ce();
51
}
52
53
- // Check that we are on the Store Exporter screen
54
- $page = ( isset($_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : false );
55
- if( $page != strtolower( WOO_CE_PREFIX ) )
56
- return;
57
58
- // Detect other platform versions
59
- woo_ce_detect_non_woo_install();
60
-
61
- // Add Store Exporter widgets to Export screen
62
- add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_category' );
63
- add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_tag' );
64
- add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_status' );
65
- add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_type' );
66
- add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_stock_status' );
67
- add_action( 'woo_ce_export_product_options_after_table', 'woo_ce_products_product_sorting' );
68
- add_action( 'woo_ce_export_category_options_after_table', 'woo_ce_category_order_sorting' );
69
- add_action( 'woo_ce_export_tag_options_after_table', 'woo_ce_tag_order_sorting' );
70
- add_action( 'woo_ce_export_user_options_after_table', 'woo_ce_users_user_sorting' );
71
- add_action( 'woo_ce_export_options', 'woo_ce_products_upsells_formatting' );
72
- add_action( 'woo_ce_export_options', 'woo_ce_products_crosssells_formatting' );
73
- add_action( 'woo_ce_export_after_form', 'woo_ce_products_custom_fields' );
74
-
75
- // Add Store Exporter Deluxe widgets to Export screen
76
- add_action( 'woo_ce_export_brand_options_before_table', 'woo_ce_brands_brand_sorting' );
77
- add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_date' );
78
- add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_status' );
79
- add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_customer' );
80
- add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_user_role' );
81
- add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_coupon' );
82
- add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_product_category' );
83
- add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_product_tag' );
84
- add_action( 'woo_ce_export_order_options_after_table', 'woo_ce_orders_order_sorting' );
85
- add_action( 'woo_ce_export_customer_options_before_table', 'woo_ce_customers_filter_by_status' );
86
- add_action( 'woo_ce_export_coupon_options_before_table', 'woo_ce_coupons_coupon_sorting' );
87
- add_action( 'woo_ce_export_options', 'woo_ce_orders_items_formatting' );
88
- add_action( 'woo_ce_export_options', 'woo_ce_orders_max_order_items' );
89
- add_action( 'woo_ce_export_options', 'woo_ce_orders_items_types' );
90
- add_action( 'woo_ce_export_after_form', 'woo_ce_orders_custom_fields' );
91
- add_action( 'woo_ce_export_options', 'woo_ce_export_options_export_format' );
92
- add_action( 'woo_ce_export_options', 'woo_ce_export_options_gallery_format' );
93
-
94
- // Add Store Exporter Deluxe options to Settings screen
95
- add_action( 'woo_ce_export_settings_top', 'woo_ce_export_settings_quicklinks' );
96
- add_action( 'woo_ce_export_settings_general', 'woo_ce_export_settings_additional' );
97
- add_action( 'woo_ce_export_settings_after', 'woo_ce_export_settings_cron' );
98
-
99
- $action = woo_get_action();
100
- switch( $action ) {
101
102
- // Prompt on Export screen when insufficient memory (less than 64M is allocated)
103
- case 'dismiss_memory_prompt':
104
- woo_ce_update_option( 'dismiss_memory_prompt', 1 );
105
- $url = add_query_arg( 'action', null );
106
- wp_redirect( $url );
107
- exit();
108
- break;
109
110
- // Prompt on Export screen when insufficient memory (less than 64M is allocated)
111
- case 'dismiss_php_legacy':
112
- woo_ce_update_option( 'dismiss_php_legacy', 1 );
113
- $url = add_query_arg( 'action', null );
114
- wp_redirect( $url );
115
- exit();
116
- break;
117
118
- // Save skip overview preference
119
- case 'skip_overview':
120
- $skip_overview = false;
121
- if( isset( $_POST['skip_overview'] ) )
122
- $skip_overview = 1;
123
- woo_ce_update_option( 'skip_overview', $skip_overview );
124
-
125
- if( $skip_overview == 1 ) {
126
- $url = add_query_arg( 'tab', 'export' );
127
- wp_redirect( $url );
128
- exit();
129
}
130
- break;
131
132
// This is where the magic happens
133
case 'export':
134
135
// Set up the basic export options
136
$export = new stdClass();
137
$export->cron = 0;
138
$export->start_time = time();
139
$export->idle_memory_start = woo_ce_current_memory_usage();
140
- $export->delete_file = woo_ce_get_option( 'delete_file', 0 );
141
$export->encoding = woo_ce_get_option( 'encoding', get_option( 'blog_charset', 'UTF-8' ) );
142
- // Check for bad encoding
143
- if( $export->encoding == '' || $export->encoding == false || $export->encoding == 'System default' )
144
$export->encoding = 'UTF-8';
145
$export->delimiter = woo_ce_get_option( 'delimiter', ',' );
146
$export->category_separator = woo_ce_get_option( 'category_separator', '|' );
147
$export->bom = woo_ce_get_option( 'bom', 1 );
148
$export->escape_formatting = woo_ce_get_option( 'escape_formatting', 'all' );
149
- $export->date_format = woo_ce_get_option( 'date_format', 'd/m/Y' );
150
- if( $export->date_format == 1 || $export->date_format == '' )
151
- $export->date_format = 'd/m/Y';
152
153
// Save export option changes made on the Export screen
154
$export->limit_volume = ( isset( $_POST['limit_volume'] ) ? sanitize_text_field( $_POST['limit_volume'] ) : '' );
155
woo_ce_update_option( 'limit_volume', $export->limit_volume );
156
- if( $export->limit_volume == '' )
157
$export->limit_volume = -1;
158
$export->offset = ( isset( $_POST['offset'] ) ? sanitize_text_field( $_POST['offset'] ) : '' );
159
woo_ce_update_option( 'offset', $export->offset );
160
- if( $export->offset == '' )
161
$export->offset = 0;
162
163
// Set default values for all export options to be later passed onto the export process
164
- $export->fields = false;
165
$export->fields_order = false;
166
$export->export_format = 'csv';
167
@@ -172,6 +228,7 @@ if( is_admin() ) {
172
$export->product_type = false;
173
$export->product_orderby = false;
174
$export->product_order = false;
175
$export->upsell_formatting = false;
176
$export->crosssell_formatting = false;
177
@@ -187,21 +244,25 @@ if( is_admin() ) {
187
$export->user_orderby = false;
188
$export->user_order = false;
189
190
- $export->type = ( isset( $_POST['dataset'] ) ? sanitize_text_field( $_POST['dataset'] ) : false );
191
- if( $export->type )
192
woo_ce_update_option( 'last_export', $export->type );
193
switch( $export->type ) {
194
195
case 'product':
196
// Set up dataset specific options
197
- $export->fields = ( isset( $_POST['product_fields'] ) ? array_map( 'sanitize_text_field', $_POST['product_fields'] ) : false );
198
- $export->fields_order = ( isset( $_POST['product_fields_order'] ) ? array_map( 'absint', $_POST['product_fields_order'] ) : false );
199
$export->product_categories = ( isset( $_POST['product_filter_category'] ) ? woo_ce_format_product_filters( array_map( 'absint', $_POST['product_filter_category'] ) ) : false );
200
$export->product_tags = ( isset( $_POST['product_filter_tag'] ) ? woo_ce_format_product_filters( array_map( 'absint', $_POST['product_filter_tag'] ) ) : false );
201
$export->product_status = ( isset( $_POST['product_filter_status'] ) ? woo_ce_format_product_filters( array_map( 'sanitize_text_field', $_POST['product_filter_status'] ) ) : false );
202
$export->product_type = ( isset( $_POST['product_filter_type'] ) ? woo_ce_format_product_filters( array_map( 'sanitize_text_field', $_POST['product_filter_type'] ) ) : false );
203
$export->product_orderby = ( isset( $_POST['product_orderby'] ) ? sanitize_text_field( $_POST['product_orderby'] ) : false );
204
$export->product_order = ( isset( $_POST['product_order'] ) ? sanitize_text_field( $_POST['product_order'] ) : false );
205
$export->upsell_formatting = ( isset( $_POST['product_upsell_formatting'] ) ? absint( $_POST['product_upsell_formatting'] ) : false );
206
$export->crosssell_formatting = ( isset( $_POST['product_crosssell_formatting'] ) ? absint( $_POST['product_crosssell_formatting'] ) : false );
207
@@ -218,8 +279,6 @@ if( is_admin() ) {
218
219
case 'category':
220
// Set up dataset specific options
221
- $export->fields = ( isset( $_POST['category_fields'] ) ? array_map( 'sanitize_text_field', $_POST['category_fields'] ) : false );
222
- $export->fields_order = ( isset( $_POST['category_fields_order'] ) ? array_map( 'absint', $_POST['category_fields_order'] ) : false );
223
$export->category_orderby = ( isset( $_POST['category_orderby'] ) ? sanitize_text_field( $_POST['category_orderby'] ) : false );
224
$export->category_order = ( isset( $_POST['category_order'] ) ? sanitize_text_field( $_POST['category_order'] ) : false );
225
@@ -232,8 +291,6 @@ if( is_admin() ) {
232
233
case 'tag':
234
// Set up dataset specific options
235
- $export->fields = ( isset( $_POST['tag_fields'] ) ? array_map( 'sanitize_text_field', $_POST['tag_fields'] ) : false );
236
- $export->fields_order = ( isset( $_POST['tag_fields_order'] ) ? array_map( 'absint', $_POST['tag_fields_order'] ) : false );
237
$export->tag_orderby = ( isset( $_POST['tag_orderby'] ) ? sanitize_text_field( $_POST['tag_orderby'] ) : false );
238
$export->tag_order = ( isset( $_POST['tag_order'] ) ? sanitize_text_field( $_POST['tag_order'] ) : false );
239
@@ -246,8 +303,6 @@ if( is_admin() ) {
246
247
case 'user':
248
// Set up dataset specific options
249
- $export->fields = array_map( 'sanitize_text_field', $_POST['user_fields'] );
250
- $export->fields_order = ( isset( $_POST['user_fields_order'] ) ? array_map( 'absint', $_POST['user_fields_order'] ) : false );
251
$export->user_orderby = ( isset( $_POST['user_orderby'] ) ? sanitize_text_field( $_POST['user_orderby'] ) : false );
252
$export->user_order = ( isset( $_POST['user_order'] ) ? sanitize_text_field( $_POST['user_order'] ) : false );
253
@@ -263,21 +318,22 @@ if( is_admin() ) {
263
264
$timeout = 600;
265
if( isset( $_POST['timeout'] ) ) {
266
- $timeout = absint( (int)$_POST['timeout'] );
267
if( $timeout <> woo_ce_get_option( 'timeout' ) )
268
woo_ce_update_option( 'timeout', $timeout );
269
}
270
- if( !ini_get( 'safe_mode' ) )
271
- @set_time_limit( (int)$timeout );
272
273
@ini_set( 'memory_limit', WP_MAX_MEMORY_LIMIT );
274
- @ini_set( 'max_execution_time', (int)$timeout );
275
276
$export->args = array(
277
'limit_volume' => $export->limit_volume,
278
'offset' => $export->offset,
279
'encoding' => $export->encoding,
280
- 'date_format' => $export->date_format,
281
'product_categories' => $export->product_categories,
282
'product_tags' => $export->product_tags,
283
'product_status' => $export->product_status,
@@ -291,6 +347,11 @@ if( is_admin() ) {
291
'user_orderby' => $export->user_orderby,
292
'user_order' => $export->user_order
293
);
294
woo_ce_save_fields( $export->type, $export->fields, $export->fields_order );
295
296
if( $export->export_format == 'csv' ) {
@@ -313,14 +374,14 @@ if( is_admin() ) {
313
// Generate CSV contents
314
$bits = woo_ce_export_dataset( $export->type );
315
unset( $export->fields );
316
- if( !$bits ) {
317
- $message = __( 'No export entries were found, please try again with different export filters.', 'woo_ce' );
318
woo_ce_admin_notice( $message, 'error' );
319
return;
320
}
321
- if( $export->delete_file ) {
322
323
- // Print to browser
324
if( $export->export_format == 'csv' )
325
woo_ce_generate_csv_header( $export->type );
326
echo $bits;
@@ -336,9 +397,9 @@ if( is_admin() ) {
336
if( ( $post_ID == false ) || $upload['error'] ) {
337
wp_delete_attachment( $post_ID, true );
338
if( isset( $upload['error'] ) )
339
- wp_redirect( add_query_arg( array( 'failed' => true, 'message' => urlencode( $upload['error'] ) ) ) );
340
else
341
- wp_redirect( add_query_arg( array( 'failed' => true ) ) );
342
return;
343
}
344
$attach_data = wp_generate_attachment_metadata( $post_ID, $upload['file'] );
@@ -360,13 +421,16 @@ if( is_admin() ) {
360
unset( $export_type );
361
362
// Print file contents to screen
363
- if( $upload['file'] )
364
readfile( $upload['file'] );
365
- else
366
- wp_redirect( add_query_arg( 'failed', true ) );
367
unset( $upload );
368
} else {
369
- wp_redirect( add_query_arg( 'failed', true ) );
370
}
371
372
}
@@ -379,35 +443,29 @@ if( is_admin() ) {
379
380
// Save changes on Settings screen
381
case 'save-settings':
382
- // Sanitize each setting field as needed
383
- woo_ce_update_option( 'export_filename', strip_tags( (string)$_POST['export_filename'] ) );
384
- woo_ce_update_option( 'delete_file', sanitize_text_field( (int)$_POST['delete_file'] ) );
385
- woo_ce_update_option( 'encoding', sanitize_text_field( (string)$_POST['encoding'] ) );
386
- woo_ce_update_option( 'delimiter', sanitize_text_field( (string)$_POST['delimiter'] ) );
387
- woo_ce_update_option( 'category_separator', sanitize_text_field( (string)$_POST['category_separator'] ) );
388
- woo_ce_update_option( 'bom', absint( (int)$_POST['bom'] ) );
389
- woo_ce_update_option( 'escape_formatting', sanitize_text_field( (string)$_POST['escape_formatting'] ) );
390
- if( $_POST['date_format'] == 'custom' && !empty( $_POST['date_format_custom'] ) )
391
- woo_ce_update_option( 'date_format', sanitize_text_field( (string)$_POST['date_format_custom'] ) );
392
- else
393
- woo_ce_update_option( 'date_format', sanitize_text_field( (string)$_POST['date_format'] ) );
394
-
395
- $message = __( 'Changes have been saved.', 'woo_ce' );
396
- woo_ce_admin_notice( $message );
397
break;
398
399
// Save changes on Field Editor screen
400
case 'save-fields':
401
- $fields = ( isset( $_POST['fields'] ) ? array_filter( $_POST['fields'] ) : array() );
402
- $types = array_keys( woo_ce_return_export_types() );
403
- $export_type = ( isset( $_POST['type'] ) ? sanitize_text_field( $_POST['type'] ) : '' );
404
- if( in_array( $export_type, $types ) ) {
405
- woo_ce_update_option( $export_type . '_labels', $fields );
406
- $message = __( 'Changes have been saved.', 'woo_ce' );
407
- woo_ce_admin_notice( $message );
408
- } else {
409
- $message = __( 'Changes could not be saved.', 'woo_ce' );
410
- woo_ce_admin_notice( $message, 'error' );
411
}
412
break;
413
@@ -419,47 +477,51 @@ if( is_admin() ) {
419
// HTML templates and form processor for Store Exporter screen
420
function woo_ce_html_page() {
421
422
global $wpdb, $export;
423
424
- $title = apply_filters( 'woo_ce_template_header', __( 'Store Exporter', 'woo_ce' ) );
425
woo_ce_template_header( $title );
426
woo_ce_support_donate();
427
- $action = woo_get_action();
428
switch( $action ) {
429
430
case 'export':
431
- $message = __( 'Chosen WooCommerce details have been exported from your store.', 'woo_ce' );
432
- woo_ce_admin_notice( $message );
433
if( WOO_CE_DEBUG ) {
434
- $output = '';
435
- $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/';
436
if( false === ( $export_log = get_transient( WOO_CE_PREFIX . '_debug_log' ) ) ) {
437
- $export_log = __( 'No export entries were found, please try again with different export filters.', 'woo_ce' );
438
} else {
439
$export_log = base64_decode( $export_log );
440
- delete_transient( WOO_CE_PREFIX . '_debug_log' );
441
}
442
$output = '
443
- <h3>' . sprintf( __( 'Export Details: %s', 'woo_ce' ), esc_attr( $export->filename ) ) . '</h3>
444
- <p>' . __( 'This prints the $export global that contains the different export options and filters to help reproduce this on another instance of WordPress. Very useful for debugging blank or unexpected exports.', 'woo_ce' ) . '</p>
445
<textarea id="export_log">' . esc_textarea( print_r( $export, true ) ) . '</textarea>
446
<hr />';
447
if( in_array( $export->export_format, array( 'csv' ) ) ) {
448
$output .= '
449
- <script>
450
$j(function() {
451
- $j(\'#export_sheet\').CSVToTable(\'\', { startLine: 0 });
452
});
453
</script>
454
- <h3>' . __( 'Export', 'woo_ce' ) . '</h3>
455
- <p>' . __( 'We use the <a href="http://code.google.com/p/jquerycsvtotable/" target="_blank"><em>CSV to Table plugin</em></a> to see first hand formatting errors or unexpected values within the export file.', 'woo_ce' ) . '</p>
456
<div id="export_sheet">' . esc_textarea( $export_log ) . '</div>
457
- <p class="description">' . __( 'This jQuery plugin can fail with <code>\'Item count (#) does not match header count\'</code> notices which simply mean the number of headers detected does not match the number of cell contents.', 'woo_ce' ) . '</p>
458
<hr />';
459
}
460
$output .= '
461
- <h3>' . __( 'Export Log', 'woo_ce' ) . '</h3>
462
- <p>' . __( 'This prints the raw export contents and is helpful when the jQuery plugin above fails due to major formatting errors.', 'woo_ce' ) . '</p>
463
<textarea id="export_log" wrap="off">' . esc_textarea( $export_log ) . '</textarea>
464
<hr />
465
';
@@ -470,48 +532,10 @@ if( is_admin() ) {
470
break;
471
472
case 'update':
473
- // Save Custom Product Meta
474
- if( isset( $_POST['custom_products'] ) ) {
475
- $custom_products = $_POST['custom_products'];
476
- $custom_products = explode( "\n", trim( $custom_products ) );
477
- $size = count( $custom_products );
478
- if( $size ) {
479
- for( $i = 0; $i < $size; $i++ )
480
- $custom_products[$i] = sanitize_text_field( trim( $custom_products[$i] ) );
481
- woo_ce_update_option( 'custom_products', $custom_products );
482
- }
483
- }
484
-
485
- // Save Custom Order Meta
486
- if( isset( $_POST['custom_orders'] ) ) {
487
- $custom_orders = $_POST['custom_orders'];
488
- $custom_orders = explode( "\n", trim( $custom_orders ) );
489
- $size = count( $custom_orders );
490
- if( $size ) {
491
- for( $i = 0; $i < $size; $i++ )
492
- $custom_orders[$i] = sanitize_text_field( trim( $custom_orders[$i] ) );
493
- woo_ce_update_option( 'custom_orders', $custom_orders );
494
- }
495
- }
496
497
- // Save Custom Order Item Meta
498
- if( isset( $_POST['custom_order_items'] ) ) {
499
- $custom_order_items = $_POST['custom_order_items'];
500
- if( !empty( $custom_order_items ) ) {
501
- $custom_order_items = explode( "\n", trim( $custom_order_items ) );
502
- $size = count( $custom_order_items );
503
- if( $size ) {
504
- for( $i = 0; $i < $size; $i++ )
505
- $custom_order_items[$i] = sanitize_text_field( trim( $custom_order_items[$i] ) );
506
- woo_ce_update_option( 'custom_order_items', $custom_order_items );
507
- }
508
- } else {
509
- woo_ce_update_option( 'custom_order_items', '' );
510
- }
511
- }
512
-
513
- $message = __( 'Custom Fields saved.', 'woo_ce' );
514
- woo_ce_admin_notice( $message );
515
woo_ce_manage_form();
516
break;
517
@@ -527,15 +551,20 @@ if( is_admin() ) {
527
// HTML template for Export screen
528
function woo_ce_manage_form() {
529
530
- $tab = false;
531
- if( isset( $_GET['tab'] ) ) {
532
- $tab = sanitize_text_field( $_GET['tab'] );
533
// If Skip Overview is set then jump to Export screen
534
- } else if( woo_ce_get_option( 'skip_overview', false ) ) {
535
$tab = 'export';
536
}
537
- $url = add_query_arg( 'page', 'woo_ce' );
538
- woo_ce_fail_notices();
539
540
include_once( WOO_CE_PATH . 'templates/admin/tabs.php' );
541
2
/*
3
Plugin Name: WooCommerce - Store Exporter
4
Plugin URI: http://www.visser.com.au/woocommerce/plugins/exporter/
5
+ Description: Export store details out of WooCommerce into simple formatted files (e.g. CSV, XML, Excel formats including XLS and XLSX, etc.)
6
+ Version: 1.9.2
7
Author: Visser Labs
8
Author URI: http://www.visser.com.au/about/
9
License: GPL2
10
+
11
+ Text Domain: woocommerce-exporter
12
+ Domain Path: /languages/
13
+
14
+ WC requires at least: 2.3
15
+ WC tested up to: 3.1
16
*/
17
18
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
23
define( 'WOO_CE_PREFIX', 'woo_ce' );
24
25
// Turn this on to enable additional debugging options at export time
26
+ if( !defined( 'WOO_CE_DEBUG' ) )
27
+ define( 'WOO_CE_DEBUG', false );
28
29
// Avoid conflicts if Store Exporter Deluxe is activated
30
include_once( WOO_CE_PATH . 'common/common.php' );
31
+ if( defined( 'WOO_CD_PREFIX' ) == false )
32
include_once( WOO_CE_PATH . 'includes/functions.php' );
33
34
+ // Plugin language support
35
function woo_ce_i18n() {
36
37
+ $locale = apply_filters( 'plugin_locale', get_locale(), 'woocommerce-exporter' );
38
+ load_textdomain( 'woocommerce-exporter', WP_LANG_DIR . '/woocommerce-exporter/woocommerce-exporter-' . $locale . '.mo' );
39
+ load_plugin_textdomain( 'woocommerce-exporter', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
40
41
}
42
+ add_action( 'init', 'woo_ce_i18n', 11 );
43
44
if( is_admin() ) {
45
46
/* Start of: WordPress Administration */
47
48
+ // Register our install script for first time install
49
include_once( WOO_CE_PATH . 'includes/install.php' );
50
register_activation_hook( __FILE__, 'woo_ce_install' );
51
54
55
global $export, $wp_roles;
56
57
+ $action = ( function_exists( 'woo_get_action' ) ? woo_get_action() : false );
58
+
59
// Now is the time to de-activate Store Exporter if Store Exporter Deluxe is activated
60
if( defined( 'WOO_CD_PREFIX' ) ) {
61
include_once( WOO_CE_PATH . 'includes/install.php' );
62
woo_ce_deactivate_ce();
63
+ return;
64
}
65
66
+ // An effort to reduce the memory load at export time
67
+ if( $action <> 'export' ) {
68
69
+ $troubleshooting_url = 'https://www.visser.com.au/documentation/store-exporter-deluxe/troubleshooting/';
70
71
+ // Check the User has the activate_plugins capability
72
+ $user_capability = 'activate_plugins';
73
+ if( current_user_can( $user_capability ) ) {
74
75
+ // Detect if another e-Commerce platform is activated
76
+ if( !woo_is_woo_activated() && ( woo_is_jigo_activated() || woo_is_wpsc_activated() ) ) {
77
+ $message = __( 'We have detected another e-Commerce Plugin than WooCommerce activated, please check that you are using Store Exporter for the correct platform.', 'woocommerce-exporter' );
78
+ $message .= sprintf( ' <a href="%s" target="_blank">%s</a>', $troubleshooting_url, __( 'Need help?', 'woocommerce-exporter' ) );
79
+ woo_ce_admin_notice( $message, 'error', 'plugins.php' );
80
+ } else if( !woo_is_woo_activated() ) {
81
+ $message = __( 'We have been unable to detect the WooCommerce Plugin activated on this WordPress site, please check that you are using Store Exporter for the correct platform.', 'woocommerce-exporter' );
82
+ $message .= sprintf( ' <a href="%s" target="_blank">%s</a>', $troubleshooting_url, __( 'Need help?', 'woocommerce-exporter' ) );
83
+ woo_ce_admin_notice( $message, 'error', 'plugins.php' );
84
+ }
85
+
86
+ // Detect if any known conflict Plugins are activated
87
88
+ // WooCommerce Subscriptions Exporter - http://codecanyon.net/item/woocommerce-subscription-exporter/6569668
89
+ if( function_exists( 'wc_subs_exporter_admin_init' ) ) {
90
+ $message = __( 'We have detected an activated Plugin for WooCommerce that is known to conflict with Store Exporter, please de-activate WooCommerce Subscriptions Exporter to resolve export issues within Store Exporter.', 'woocommerce-exporter' );
91
+ $message .= sprintf( '<a href="%s" target="_blank">%s</a>', $troubleshooting_url, __( 'Need help?', 'woocommerce-exporter' ) );
92
+ woo_ce_admin_notice( $message, 'error', array( 'plugins.php', 'admin.php' ) );
93
}
94
+
95
+ // WP Easy Events Professional - https://emdplugins.com/plugins/wp-easy-events-professional/
96
+ if( class_exists( 'WP_Easy_Events_Professional' ) ) {
97
+ $message = __( 'We have detected an activated Plugin that is known to conflict with Store Exporter Deluxe, please de-activate WP Easy Events Professional to resolve export issues within Store Exporter Deluxe.', 'woocommerce-exporter' );
98
+ $message .= sprintf( '<a href="%s" target="_blank">%s</a>', $troubleshooting_url, __( 'Need help?', 'woocommerce-exporter' ) );
99
+ woo_ce_admin_notice( $message, 'error', array( 'plugins.php', 'admin.php' ) );
100
+ }
101
+
102
+ // Plugin row notices for the Plugins screen
103
+ add_action( 'after_plugin_row_' . WOO_CE_RELPATH, 'woo_ce_admin_plugin_row' );
104
+
105
+ }
106
+
107
+ // Check the User has the view_woocommerce_reports capability
108
+ $user_capability = apply_filters( 'woo_ce_admin_user_capability', 'view_woocommerce_reports' );
109
+ if( current_user_can( $user_capability ) == false )
110
+ return;
111
+
112
+ // Check that we are on the Store Exporter screen
113
+ $page = ( isset($_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : false );
114
+ if( $page != strtolower( WOO_CE_PREFIX ) )
115
+ return;
116
+
117
+ // Add memory usage to screen footer
118
+ add_filter( 'admin_footer_text', 'woo_ce_admin_footer_text' );
119
+
120
+ }
121
+
122
+ // Process any pre-export notice confirmations
123
+ switch( $action ) {
124
125
// This is where the magic happens
126
case 'export':
127
128
+ // Make sure we play nice with other WooCommerce and WordPress exporters
129
+ if( !isset( $_POST['woo_ce_export'] ) )
130
+ return;
131
+
132
+ check_admin_referer( 'manual_export', 'woo_ce_export' );
133
+
134
+ // Hide error logging during the export process
135
+ if( function_exists( 'ini_set' ) )
136
+ @ini_set( 'display_errors', 0 );
137
+
138
+ // Welcome in the age of GZIP compression and Object caching
139
+ if( !defined( 'DONOTCACHEPAGE' ) )
140
+ define( 'DONOTCACHEPAGE', true );
141
+ if( !defined( 'DONOTCACHCEOBJECT' ) )
142
+ define( 'DONOTCACHCEOBJECT', true );
143
+
144
+ // Set artificially high because we are building this export in memory
145
+ if( function_exists( 'wp_raise_memory_limit' ) ) {
146
+ add_filter( 'export_memory_limit', 'woo_ce_raise_export_memory_limit' );
147
+ wp_raise_memory_limit( 'export' );
148
+ }
149
+
150
+ $timeout = woo_ce_get_option( 'timeout', 0 );
151
+ $safe_mode = ( function_exists( 'safe_mode' ) ? ini_get( 'safe_mode' ) : false );
152
+ if( !$safe_mode ) {
153
+ if( function_exists( 'set_time_limit' ) )
154
+ @set_time_limit( $timeout );
155
+ if( function_exists( 'ini_set' ) )
156
+ @ini_set( 'max_execution_time', $timeout );
157
+ }
158
+ if( function_exists( 'ini_set' ) )
159
+ @ini_set( 'memory_limit', WP_MAX_MEMORY_LIMIT );
160
+
161
// Set up the basic export options
162
$export = new stdClass();
163
$export->cron = 0;
164
+ $export->scheduled_export = 0;
165
$export->start_time = time();
166
$export->idle_memory_start = woo_ce_current_memory_usage();
167
$export->encoding = woo_ce_get_option( 'encoding', get_option( 'blog_charset', 'UTF-8' ) );
168
+ // Reset the Encoding if corrupted
169
+ if( $export->encoding == '' || $export->encoding == false || $export->encoding == 'System default' ) {
170
+ woo_ce_error_log( sprintf( 'Warning: %s', __( 'Encoding export option was corrupted, defaulted to UTF-8', 'woocommerce-exporter' ) ) );
171
$export->encoding = 'UTF-8';
172
+ woo_ce_update_option( 'encoding', 'UTF-8' );
173
+ }
174
$export->delimiter = woo_ce_get_option( 'delimiter', ',' );
175
+ // Reset the Delimiter if corrupted
176
+ if( $export->delimiter == '' || $export->delimiter == false ) {
177
+ woo_ce_error_log( sprintf( 'Warning: %s', __( 'Delimiter export option was corrupted, defaulted to ,', 'woocommerce-exporter' ) ) );
178
+ $export->delimiter = ',';
179
+ woo_ce_update_option( 'delimiter', ',' );
180
+ }
181
$export->category_separator = woo_ce_get_option( 'category_separator', '|' );
182
+ // Reset the Category Separator if corrupted
183
+ if( $export->category_separator == '' || $export->category_separator == false ) {
184
+ woo_ce_error_log( sprintf( 'Warning: %s', __( 'Category Separator export option was corrupted, defaulted to |', 'woocommerce-exporter' ) ) );
185
+ $export->category_separator = '|';
186
+ woo_ce_update_option( 'category_separator', '|' );
187
+ }
188
$export->bom = woo_ce_get_option( 'bom', 1 );
189
$export->escape_formatting = woo_ce_get_option( 'escape_formatting', 'all' );
190
+ // Reset the Escape Formatting if corrupted
191
+ if( $export->escape_formatting == '' || $export->escape_formatting == false ) {
192
+ woo_ce_error_log( sprintf( 'Warning: %s', __( 'Escape Formatting export option was corrupted, defaulted to all.', 'woocommerce-exporter' ) ) );
193
+ $export->escape_formatting = 'all';
194
+ woo_ce_update_option( 'escape_formatting', 'all' );
195
+ }
196
+ $date_format = woo_ce_get_option( 'date_format', 'd/m/Y' );
197
+ // Reset the Date Format if corrupted
198
+ if( $date_format == '1' || $date_format == '' || $date_format == false ) {
199
+ woo_ce_error_log( sprintf( 'Warning: %s', __( 'Date Format export option was corrupted, defaulted to d/m/Y', 'woocommerce-exporter' ) ) );
200
+ $date_format = 'd/m/Y';
201
+ woo_ce_update_option( 'date_format', $date_format );
202
+ }
203
204
// Save export option changes made on the Export screen
205
$export->limit_volume = ( isset( $_POST['limit_volume'] ) ? sanitize_text_field( $_POST['limit_volume'] ) : '' );
206
woo_ce_update_option( 'limit_volume', $export->limit_volume );
207
+ if( in_array( $export->limit_volume, array( '', '0', '-1' ) ) ) {
208
+ woo_ce_update_option( 'limit_volume', '' );
209
$export->limit_volume = -1;
210
+ }
211
$export->offset = ( isset( $_POST['offset'] ) ? sanitize_text_field( $_POST['offset'] ) : '' );
212
woo_ce_update_option( 'offset', $export->offset );
213
+ if( in_array( $export->offset, array( '', '0' ) ) ) {
214
+ woo_ce_update_option( 'offset', '' );
215
$export->offset = 0;
216
+ }
217
+ $export->type = ( isset( $_POST['dataset'] ) ? sanitize_text_field( $_POST['dataset'] ) : false );
218
219
// Set default values for all export options to be later passed onto the export process
220
+ $export->fields = array();
221
$export->fields_order = false;
222
$export->export_format = 'csv';
223
228
$export->product_type = false;
229
$export->product_orderby = false;
230
$export->product_order = false;
231
+ $export->gallery_formatting = false;
232
$export->upsell_formatting = false;
233
$export->crosssell_formatting = false;
234
244
$export->user_orderby = false;
245
$export->user_order = false;
246
247
+ if( !empty( $export->type ) ) {
248
+ $export->fields = ( isset( $_POST[$export->type . '_fields'] ) ? array_map( 'sanitize_text_field', $_POST[$export->type . '_fields'] ) : false );
249
+ $export->fields_order = ( isset( $_POST[$export->type . '_fields_order'] ) ? array_map( 'absint', $_POST[$export->type . '_fields_order'] ) : false );
250
woo_ce_update_option( 'last_export', $export->type );
251
+ }
252
+
253
+ woo_ce_load_export_types();
254
+
255
switch( $export->type ) {
256
257
case 'product':
258
// Set up dataset specific options
259
$export->product_categories = ( isset( $_POST['product_filter_category'] ) ? woo_ce_format_product_filters( array_map( 'absint', $_POST['product_filter_category'] ) ) : false );
260
$export->product_tags = ( isset( $_POST['product_filter_tag'] ) ? woo_ce_format_product_filters( array_map( 'absint', $_POST['product_filter_tag'] ) ) : false );
261
$export->product_status = ( isset( $_POST['product_filter_status'] ) ? woo_ce_format_product_filters( array_map( 'sanitize_text_field', $_POST['product_filter_status'] ) ) : false );
262
$export->product_type = ( isset( $_POST['product_filter_type'] ) ? woo_ce_format_product_filters( array_map( 'sanitize_text_field', $_POST['product_filter_type'] ) ) : false );
263
$export->product_orderby = ( isset( $_POST['product_orderby'] ) ? sanitize_text_field( $_POST['product_orderby'] ) : false );
264
$export->product_order = ( isset( $_POST['product_order'] ) ? sanitize_text_field( $_POST['product_order'] ) : false );
265
+ $export->gallery_formatting = ( isset( $_POST['product_gallery_formatting'] ) ? absint( $_POST['product_gallery_formatting'] ) : false );
266
$export->upsell_formatting = ( isset( $_POST['product_upsell_formatting'] ) ? absint( $_POST['product_upsell_formatting'] ) : false );
267
$export->crosssell_formatting = ( isset( $_POST['product_crosssell_formatting'] ) ? absint( $_POST['product_crosssell_formatting'] ) : false );
268
279
280
case 'category':
281
// Set up dataset specific options
282
$export->category_orderby = ( isset( $_POST['category_orderby'] ) ? sanitize_text_field( $_POST['category_orderby'] ) : false );
283
$export->category_order = ( isset( $_POST['category_order'] ) ? sanitize_text_field( $_POST['category_order'] ) : false );
284
291
292
case 'tag':
293
// Set up dataset specific options
294
$export->tag_orderby = ( isset( $_POST['tag_orderby'] ) ? sanitize_text_field( $_POST['tag_orderby'] ) : false );
295
$export->tag_order = ( isset( $_POST['tag_order'] ) ? sanitize_text_field( $_POST['tag_order'] ) : false );
296
303
304
case 'user':
305
// Set up dataset specific options
306
$export->user_orderby = ( isset( $_POST['user_orderby'] ) ? sanitize_text_field( $_POST['user_orderby'] ) : false );
307
$export->user_order = ( isset( $_POST['user_order'] ) ? sanitize_text_field( $_POST['user_order'] ) : false );
308
318
319
$timeout = 600;
320
if( isset( $_POST['timeout'] ) ) {
321
+ $timeout = absint( $_POST['timeout'] );
322
if( $timeout <> woo_ce_get_option( 'timeout' ) )
323
woo_ce_update_option( 'timeout', $timeout );
324
}
325
+ if( !ini_get( 'safe_mode' ) ) {
326
+ @set_time_limit( $timeout );
327
+ @ini_set( 'max_execution_time', $timeout );
328
+ }
329
330
@ini_set( 'memory_limit', WP_MAX_MEMORY_LIMIT );
331
332
$export->args = array(
333
'limit_volume' => $export->limit_volume,
334
'offset' => $export->offset,
335
'encoding' => $export->encoding,
336
+ 'date_format' => $date_format,
337
'product_categories' => $export->product_categories,
338
'product_tags' => $export->product_tags,
339
'product_status' => $export->product_status,
347
'user_orderby' => $export->user_orderby,
348
'user_order' => $export->user_order
349
);
350
+ if( empty( $export->fields ) ) {
351
+ $message = __( 'No export fields were selected, please try again with at least a single export field.', 'woocommerce-exporter' );
352
+ woo_ce_admin_notice( $message, 'error' );
353
+ return;
354
+ }
355
woo_ce_save_fields( $export->type, $export->fields, $export->fields_order );
356
357
if( $export->export_format == 'csv' ) {
374
// Generate CSV contents
375
$bits = woo_ce_export_dataset( $export->type );
376
unset( $export->fields );
377
+ if( empty( $bits ) ) {
378
+ $message = __( 'No export entries were found, please try again with different export filters.', 'woocommerce-exporter' );
379
woo_ce_admin_notice( $message, 'error' );
380
return;
381
}
382
+ if( woo_ce_get_option( 'delete_file', 1 ) ) {
383
384
+ // Print directly to browser
385
if( $export->export_format == 'csv' )
386
woo_ce_generate_csv_header( $export->type );
387
echo $bits;
397
if( ( $post_ID == false ) || $upload['error'] ) {
398
wp_delete_attachment( $post_ID, true );
399
if( isset( $upload['error'] ) )
400
+ wp_redirect( esc_url( add_query_arg( array( 'failed' => true, 'message' => urlencode( $upload['error'] ) ) ) ) );
401
else
402
+ wp_redirect( esc_url( add_query_arg( array( 'failed' => true ) ) ) );
403
return;
404
}
405
$attach_data = wp_generate_attachment_metadata( $post_ID, $upload['file'] );
421
unset( $export_type );
422
423
// Print file contents to screen
424
+ if( $upload['file'] ) {
425
readfile( $upload['file'] );
426
+ } else {
427
+ $url = add_query_arg( 'failed', true );
428
+ wp_redirect( $url );
429
+ }
430
unset( $upload );
431
} else {
432
+ $url = add_query_arg( 'failed', true );
433
+ wp_redirect( $url );
434
}
435
436
}
443
444
// Save changes on Settings screen
445
case 'save-settings':
446
+ // We need to verify the nonce.
447
+ if( !empty( $_POST ) && wp_verify_nonce( $_REQUEST['_wpnonce'], 'woo_ce_save_settings' ) ) {
448
+ if( check_admin_referer( 'woo_ce_save_settings' ) )
449
+ woo_ce_export_settings_save();
450
+ }
451
break;
452
453
// Save changes on Field Editor screen
454
case 'save-fields':
455
+ // We need to verify the nonce.
456
+ if( !empty( $_POST ) && check_admin_referer( 'save_fields', 'woo_ce_save_fields' ) ) {
457
+ $fields = ( isset( $_POST['fields'] ) ? array_filter( $_POST['fields'] ) : array() );
458
+ $export_type = ( isset( $_POST['type'] ) ? sanitize_text_field( $_POST['type'] ) : '' );
459
+ $export_types = array_keys( woo_ce_get_export_types() );
460
+ // Check we are saving against a valid export type
461
+ if( in_array( $export_type, $export_types ) ) {
462
+ woo_ce_update_option( $export_type . '_labels', $fields );
463
+ $message = __( 'Field labels have been saved.', 'woocommerce-exporter' );
464
+ woo_ce_admin_notice( $message );
465
+ } else {
466
+ $message = __( 'Changes could not be saved as we could not detect a valid export type. Raise this as a Premium Support issue and include what export type you were editing.', 'woocommerce-exporter' );
467
+ woo_ce_admin_notice( $message, 'error' );
468
+ }
469
}
470
break;
471
477
// HTML templates and form processor for Store Exporter screen
478
function woo_ce_html_page() {
479
480
+ // Check the User has the view_woocommerce_reports capability
481
+ $user_capability = apply_filters( 'woo_ce_admin_user_capability', 'view_woocommerce_reports' );
482
+ if( current_user_can( $user_capability ) == false )
483
+ return;
484
+
485
global $wpdb, $export;
486
487
+ $title = apply_filters( 'woo_ce_template_header', __( 'Store Exporter', 'woocommerce-exporter' ) );
488
woo_ce_template_header( $title );
489
woo_ce_support_donate();
490
+ $action = ( function_exists( 'woo_get_action' ) ? woo_get_action() : false );
491
switch( $action ) {
492
493
case 'export':
494
if( WOO_CE_DEBUG ) {
495
if( false === ( $export_log = get_transient( WOO_CE_PREFIX . '_debug_log' ) ) ) {
496
+ $export_log = __( 'No export entries were found within the debug Transient, please try again with different export filters.', 'woocommerce-exporter' );
497
} else {
498
+ // We take the contents of our WordPress Transient and de-base64 it back to CSV format
499
$export_log = base64_decode( $export_log );
500
}
501
+ delete_transient( WOO_CE_PREFIX . '_debug_log' );
502
$output = '
503
+ <h3>' . sprintf( __( 'Export Details: %s', 'woocommerce-exporter' ), esc_attr( $export->filename ) ) . '</h3>
504
+ <p>' . __( 'This prints the $export global that contains the different export options and filters to help reproduce this on another instance of WordPress. Very useful for debugging blank or unexpected exports.', 'woocommerce-exporter' ) . '</p>
505
<textarea id="export_log">' . esc_textarea( print_r( $export, true ) ) . '</textarea>
506
<hr />';
507
if( in_array( $export->export_format, array( 'csv' ) ) ) {
508
$output .= '
509
+ <script type="text/javascript">
510
$j(function() {
511
+ $j(\'#export_sheet\').CSVToTable(\'\', {
512
+ startLine: 0
513
+ });
514
});
515
</script>
516
+ <h3>' . __( 'Export', 'woocommerce-exporter' ) . '</h3>
517
+ <p>' . __( 'We use the <a href="http://code.google.com/p/jquerycsvtotable/" target="_blank"><em>CSV to Table plugin</em></a> to see first hand formatting errors or unexpected values within the export file.', 'woocommerce-exporter' ) . '</p>
518
<div id="export_sheet">' . esc_textarea( $export_log ) . '</div>
519
+ <p class="description">' . __( 'This jQuery plugin can fail with <code>\'Item count (#) does not match header count\'</code> notices which simply mean the number of headers detected does not match the number of cell contents.', 'woocommerce-exporter' ) . '</p>
520
<hr />';
521
}
522
$output .= '
523
+ <h3>' . __( 'Export Log', 'woocommerce-exporter' ) . '</h3>
524
+ <p>' . __( 'This prints the raw export contents and is helpful when the jQuery plugin above fails due to major formatting errors.', 'woocommerce-exporter' ) . '</p>
525
<textarea id="export_log" wrap="off">' . esc_textarea( $export_log ) . '</textarea>
526
<hr />
527
';
532
break;
533
534
case 'update':
535
+ woo_ce_admin_custom_fields_save();
536
537
+ $message = __( 'Custom Fields saved. You can now select those additional fields from the Export Fields list.', 'woocommerce-exporter' );
538
+ woo_ce_admin_notice_html( $message );
539
woo_ce_manage_form();
540
break;
541
551
// HTML template for Export screen
552
function woo_ce_manage_form() {
553
554
+ $tab = ( isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : false );
555
// If Skip Overview is set then jump to Export screen
556
+ if( $tab == false && woo_ce_get_option( 'skip_overview', false ) )
557
$tab = 'export';
558
+
559
+ // Check that WC() is available
560
+ if( !function_exists( 'WC' ) ) {
561
+ $message = __( 'We couldn\'t load the WooCommerce resource WC(), check that WooCommerce is installed and active. If this persists get in touch with us.', 'woocommerce-exporter' );
562
+ woo_cd_admin_notice_html( $message, 'error' );
563
+ return;
564
}
565
+
566
+ woo_ce_load_export_types();
567
+ woo_ce_admin_fail_notices();
568
569
include_once( WOO_CE_PATH . 'templates/admin/tabs.php' );
570
includes/admin.php CHANGED
@@ -15,15 +15,20 @@ function woo_ce_admin_notice( $message = '', $priority = 'updated', $screen = ''
15
$existing_notice = base64_decode( $existing_notice );
16
$output = $existing_notice . $output;
17
}
18
- set_transient( WOO_CE_PREFIX . '_notice', base64_encode( $output ), MINUTE_IN_SECONDS );
19
- add_action( 'admin_notices', 'woo_ce_admin_notice_print' );
20
}
21
22
}
23
24
// HTML template for admin notice
25
- function woo_ce_admin_notice_html( $message = '', $priority = 'updated', $screen = '' ) {
26
27
// Display admin notice on specific screen
28
if( !empty( $screen ) ) {
29
@@ -37,8 +42,11 @@ function woo_ce_admin_notice_html( $message = '', $priority = 'updated', $screen
37
return;
38
}
39
40
- } ?>
41
- <div id="message" class="<?php echo $priority; ?>">
42
<p><?php echo $message; ?></p>
43
</div>
44
<?php
@@ -63,12 +71,11 @@ function woo_ce_template_header( $title = '', $icon = 'woocommerce' ) {
63
if( $title )
64
$output = $title;
65
else
66
- $output = __( 'Store Export', 'woo_ce' ); ?>
67
<div id="woo-ce" class="wrap">
68
<div id="icon-<?php echo $icon; ?>" class="icon32 icon32-woocommerce-importer"><br /></div>
69
<h2>
70
<?php echo $output; ?>
71
- <a href="<?php echo add_query_arg( array( 'tab' => 'export', 'empty' => null ) ); ?>" class="add-new-h2"><?php _e( 'Add New', 'woo_ce' ); ?></a>
72
</h2>
73
<?php
74
@@ -82,6 +89,32 @@ function woo_ce_template_footer() { ?>
82
83
}
84
85
// Add Export and Docs links to the Plugins screen
86
function woo_ce_add_settings_link( $links, $file ) {
87
@@ -90,8 +123,8 @@ function woo_ce_add_settings_link( $links, $file ) {
90
91
if( $file == $this_plugin ) {
92
$docs_url = 'http://www.visser.com.au/docs/';
93
- $docs_link = sprintf( '<a href="%s" target="_blank">' . __( 'Docs', 'woo_ce' ) . '</a>', $docs_url );
94
- $export_link = sprintf( '<a href="%s">' . __( 'Export', 'woo_ce' ) . '</a>', add_query_arg( 'page', 'woo_ce', 'admin.php' ) );
95
array_unshift( $links, $docs_link );
96
array_unshift( $links, $export_link );
97
}
@@ -100,6 +133,27 @@ function woo_ce_add_settings_link( $links, $file ) {
100
}
101
add_filter( 'plugin_action_links', 'woo_ce_add_settings_link', 10, 2 );
102
103
// Add Store Export page to WooCommerce screen IDs
104
function woo_ce_wc_screen_ids( $screen_ids = array() ) {
105
@@ -112,14 +166,15 @@ add_filter( 'woocommerce_screen_ids', 'woo_ce_wc_screen_ids', 10, 1 );
112
// Add Store Export to WordPress Administration menu
113
function woo_ce_admin_menu() {
114
115
- $page = add_submenu_page( 'woocommerce', __( 'Store Exporter', 'woo_ce' ), __( 'Store Export', 'woo_ce' ), 'view_woocommerce_reports', 'woo_ce', 'woo_ce_html_page' );
116
add_action( 'admin_print_styles-' . $page, 'woo_ce_enqueue_scripts' );
117
118
}
119
add_action( 'admin_menu', 'woo_ce_admin_menu', 11 );
120
121
// Load CSS and jQuery scripts for Store Exporter screen
122
- function woo_ce_enqueue_scripts( $hook ) {
123
124
// Simple check that WooCommerce is activated
125
if( class_exists( 'WooCommerce' ) ) {
@@ -131,10 +186,14 @@ function woo_ce_enqueue_scripts( $hook ) {
131
132
}
133
134
- // Date Picker
135
wp_enqueue_script( 'jquery-ui-datepicker' );
136
wp_enqueue_style( 'jquery-ui-datepicker', plugins_url( '/templates/admin/jquery-ui-datepicker.css', WOO_CE_RELPATH ) );
137
138
// Chosen
139
wp_enqueue_style( 'jquery-chosen', plugins_url( '/templates/admin/chosen.css', WOO_CE_RELPATH ) );
140
wp_enqueue_script( 'jquery-chosen', plugins_url( '/js/jquery.chosen.js', WOO_CE_RELPATH ), array( 'jquery' ) );
@@ -152,6 +211,39 @@ function woo_ce_enqueue_scripts( $hook ) {
152
153
}
154
155
// HTML active class for the currently selected tab on the Store Exporter screen
156
function woo_ce_admin_active_tab( $tab_name = null, $tab = null ) {
157
@@ -178,8 +270,8 @@ function woo_ce_tab_template( $tab = '' ) {
178
$tab = 'overview';
179
180
// Store Exporter Deluxe
181
- $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
182
- $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woo_ce' ) . '</a>', $woo_cd_url );
183
184
$troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/';
185
@@ -191,53 +283,111 @@ function woo_ce_tab_template( $tab = '' ) {
191
192
case 'export':
193
$export_type = sanitize_text_field( ( isset( $_POST['dataset'] ) ? $_POST['dataset'] : woo_ce_get_option( 'last_export', 'product' ) ) );
194
- $types = array_keys( woo_ce_return_export_types() );
195
// Check if the default export type exists
196
- if( !in_array( $export_type, $types ) )
197
$export_type = 'product';
198
199
- $products = woo_ce_return_count( 'product' );
200
- $categories = woo_ce_return_count( 'category' );
201
- $tags = woo_ce_return_count( 'tag' );
202
- $brands = '999';
203
- $orders = '999';
204
- $customers = '999';
205
- $users = woo_ce_return_count( 'user' );
206
- $coupons = '999';
207
- $attributes = '999';
208
- $subscriptions = '999';
209
- $product_vendors = '999';
210
-
211
if( $product_fields = woo_ce_get_product_fields() ) {
212
foreach( $product_fields as $key => $product_field )
213
$product_fields[$key]['disabled'] = ( isset( $product_field['disabled'] ) ? $product_field['disabled'] : 0 );
214
}
215
if( $category_fields = woo_ce_get_category_fields() ) {
216
foreach( $category_fields as $key => $category_field )
217
$category_fields[$key]['disabled'] = ( isset( $category_field['disabled'] ) ? $category_field['disabled'] : 0 );
218
}
219
if( $tag_fields = woo_ce_get_tag_fields() ) {
220
foreach( $tag_fields as $key => $tag_field )
221
$tag_fields[$key]['disabled'] = ( isset( $tag_field['disabled'] ) ? $tag_field['disabled'] : 0 );
222
}
223
if( $brand_fields = woo_ce_get_brand_fields() ) {
224
foreach( $brand_fields as $key => $brand_field )
225
$brand_fields[$key]['disabled'] = ( isset( $brand_field['disabled'] ) ? $brand_field['disabled'] : 0 );
226
}
227
- $order_fields = woo_ce_get_order_fields();
228
- $customer_fields = woo_ce_get_customer_fields();
229
if( $user_fields = woo_ce_get_user_fields() ) {
230
foreach( $user_fields as $key => $user_field )
231
$user_fields[$key]['disabled'] = ( isset( $user_field['disabled'] ) ? $user_field['disabled'] : 0 );
232
}
233
- $coupon_fields = woo_ce_get_coupon_fields();
234
- $subscription_fields = woo_ce_get_subscription_fields();
235
$product_vendor_fields = woo_ce_get_product_vendor_fields();
236
$attribute_fields = false;
237
238
- // Export modules
239
- $modules = woo_ce_modules_list();
240
-
241
// Export options
242
$limit_volume = woo_ce_get_option( 'limit_volume' );
243
$offset = woo_ce_get_option( 'offset' );
@@ -245,9 +395,9 @@ function woo_ce_tab_template( $tab = '' ) {
245
246
case 'fields':
247
$export_type = ( isset( $_GET['type'] ) ? sanitize_text_field( $_GET['type'] ) : '' );
248
- $types = array_keys( woo_ce_return_export_types() );
249
$fields = array();
250
- if( in_array( $export_type, $types ) ) {
251
if( has_filter( 'woo_ce_' . $export_type . '_fields', 'woo_ce_override_' . $export_type . '_field_labels' ) )
252
remove_filter( 'woo_ce_' . $export_type . '_fields', 'woo_ce_override_' . $export_type . '_field_labels', 11 );
253
if( function_exists( sprintf( 'woo_ce_get_%s_fields', $export_type ) ) )
@@ -258,7 +408,7 @@ function woo_ce_tab_template( $tab = '' ) {
258
259
case 'archive':
260
if( isset( $_GET['deleted'] ) ) {
261
- $message = __( 'Archived export has been deleted.', 'woo_ce' );
262
woo_ce_admin_notice( $message );
263
}
264
if( $files = woo_ce_get_archive_files() ) {
@@ -270,9 +420,9 @@ function woo_ce_tab_template( $tab = '' ) {
270
case 'settings':
271
$export_filename = woo_ce_get_option( 'export_filename', '' );
272
// Default export filename
273
- if( empty( $export_filename ) )
274
- $export_filename = 'woo-export_%dataset%-%date%.csv';
275
- $delete_file = woo_ce_get_option( 'delete_file', 0 );
276
$timeout = woo_ce_get_option( 'timeout', 0 );
277
$encoding = woo_ce_get_option( 'encoding', 'UTF-8' );
278
$bom = woo_ce_get_option( 'bom', 1 );
@@ -280,9 +430,13 @@ function woo_ce_tab_template( $tab = '' ) {
280
$category_separator = woo_ce_get_option( 'category_separator', '|' );
281
$escape_formatting = woo_ce_get_option( 'escape_formatting', 'all' );
282
$date_format = woo_ce_get_option( 'date_format', 'd/m/Y' );
283
- if( $date_format == 1 || $date_format == '' )
284
$date_format = 'd/m/Y';
285
$file_encodings = ( function_exists( 'mb_list_encodings' ) ? mb_list_encodings() : false );
286
break;
287
288
case 'tools':
@@ -290,7 +444,7 @@ function woo_ce_tab_template( $tab = '' ) {
290
$woo_pd_url = 'http://www.visser.com.au/woocommerce/plugins/product-importer-deluxe/';
291
$woo_pd_target = ' target="_blank"';
292
if( function_exists( 'woo_pd_init' ) ) {
293
- $woo_pd_url = add_query_arg( array( 'page' => 'woo_pd', 'tab' => null ) );
294
$woo_pd_target = false;
295
}
296
@@ -298,9 +452,16 @@ function woo_ce_tab_template( $tab = '' ) {
298
$woo_st_url = 'http://www.visser.com.au/woocommerce/plugins/store-toolkit/';
299
$woo_st_target = ' target="_blank"';
300
if( function_exists( 'woo_st_admin_init' ) ) {
301
- $woo_st_url = add_query_arg( array( 'page' => 'woo_st', 'tab' => null ) );
302
$woo_st_target = false;
303
}
304
break;
305
306
}
@@ -308,16 +469,16 @@ function woo_ce_tab_template( $tab = '' ) {
308
if( file_exists( WOO_CE_PATH . 'templates/admin/tabs-' . $tab . '.php' ) ) {
309
include_once( WOO_CE_PATH . 'templates/admin/tabs-' . $tab . '.php' );
310
} else {
311
- $message = sprintf( __( 'We couldn\'t load the export template file <code>%s</code> within <code>%s</code>, this file should be present.', 'woo_ce' ), 'tabs-' . $tab . '.php', WOO_CE_PATH . 'templates/admin/...' );
312
woo_ce_admin_notice_html( $message, 'error' );
313
ob_start(); ?>
314
- <p><?php _e( 'You can see this error for one of a few common reasons', 'woo_ce' ); ?>:</p>
315
<ul class="ul-disc">
316
- <li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woo_ce' ); ?></li>
317
- <li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woo_ce' ); ?></li>
318
- <li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woo_ce' ); ?></li>
319
</ul>
320
- <p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woo_ce' ); ?></p>
321
<?php
322
ob_end_flush();
323
}
@@ -325,231 +486,26 @@ function woo_ce_tab_template( $tab = '' ) {
325
326
}
327
328
- // List of WordPress Plugins that Product Importer Deluxe integrates with
329
- function woo_ce_modules_list( $modules = array() ) {
330
331
- $modules[] = array(
332
- 'name' => 'aioseop',
333
- 'title' => __( 'All in One SEO Pack', 'woo_ce' ),
334
- 'description' => __( 'Optimize your WooCommerce Products for Search Engines. Requires Store Toolkit for All in One SEO Pack integration.', 'woo_ce' ),
335
- 'url' => 'http://wordpress.org/extend/plugins/all-in-one-seo-pack/',
336
- 'slug' => 'all-in-one-seo-pack',
337
- 'function' => 'aioseop_activate'
338
- );
339
- $modules[] = array(
340
- 'name' => 'store_toolkit',
341
- 'title' => __( 'Store Toolkit', 'woo_ce' ),
342
- 'description' => __( 'Store Toolkit includes a growing set of commonly-used WooCommerce administration tools aimed at web developers and store maintainers.', 'woo_ce' ),
343
- 'url' => 'http://wordpress.org/extend/plugins/woocommerce-store-toolkit/',
344
- 'slug' => 'woocommerce-store-toolkit',
345
- 'function' => 'woo_st_admin_init'
346
- );
347
- $modules[] = array(
348
- 'name' => 'ultimate_seo',
349
- 'title' => __( 'SEO Ultimate', 'woo_ce' ),
350
- 'description' => __( 'This all-in-one SEO plugin gives you control over Product details.', 'woo_ce' ),
351
- 'url' => 'http://wordpress.org/extend/plugins/seo-ultimate/',
352
- 'slug' => 'seo-ultimate',
353
- 'function' => 'su_wp_incompat_notice'
354
- );
355
- $modules[] = array(
356
- 'name' => 'gpf',
357
- 'title' => __( 'Advanced Google Product Feed', 'woo_ce' ),
358
- 'description' => __( 'Easily configure data to be added to your Google Merchant Centre feed.', 'woo_ce' ),
359
- 'url' => 'http://www.leewillis.co.uk/wordpress-plugins/',
360
- 'function' => 'woocommerce_gpf_install'
361
- );
362
- $modules[] = array(
363
- 'name' => 'wpseo',
364
- 'title' => __( 'WordPress SEO by Yoast', 'woo_ce' ),
365
- 'description' => __( 'The first true all-in-one SEO solution for WordPress.', 'woo_ce' ),
366
- 'url' => 'http://yoast.com/wordpress/seo/#utm_source=wpadmin&utm_medium=plugin&utm_campaign=wpseoplugin',
367
- 'slug' => 'wordpress-seo',
368
- 'function' => 'wpseo_admin_init'
369
- );
370
- $modules[] = array(
371
- 'name' => 'msrp',
372
- 'title' => __( 'WooCommerce MSRP Pricing', 'woo_ce' ),
373
- 'description' => __( 'Define and display MSRP prices (Manufacturer\'s suggested retail price) to your customers.', 'woo_ce' ),
374
- 'url' => 'http://www.woothemes.com/products/msrp-pricing/',
375
- 'function' => 'woocommerce_msrp_activate'
376
- );
377
- $modules[] = array(
378
- 'name' => 'wc_brands',
379
- 'title' => __( 'WooCommerce Brands Addon', 'woo_ce' ),
380
- 'description' => __( 'Create, assign and list brands for products, and allow customers to filter by brand.', 'woo_ce' ),
381
- 'url' => 'http://www.woothemes.com/products/brands/',
382
- 'class' => 'WC_Brands'
383
- );
384
- $modules[] = array(
385
- 'name' => 'wc_cog',
386
- 'title' => __( 'Cost of Goods', 'woo_ce' ),
387
- 'description' => __( 'Easily track total profit and cost of goods by adding a Cost of Good field to simple and variable products.', 'woo_ce' ),
388
- 'url' => 'http://www.skyverge.com/product/woocommerce-cost-of-goods-tracking/',
389
- 'class' => 'WC_COG'
390
- );
391
- $modules[] = array(
392
- 'name' => 'per_product_shipping',
393
- 'title' => __( 'Per-Product Shipping', 'woo_ce' ),
394
- 'description' => __( 'Define separate shipping costs per product which are combined at checkout to provide a total shipping cost.', 'woo_ce' ),
395
- 'url' => 'http://www.woothemes.com/products/per-product-shipping/',
396
- 'function' => 'woocommerce_per_product_shipping_init'
397
- );
398
- $modules[] = array(
399
- 'name' => 'vendors',
400
- 'title' => __( 'Product Vendors', 'woo_ce' ),
401
- 'description' => __( 'Turn your store into a multi-vendor marketplace (such as Etsy or Creative Market).', 'woo_ce' ),
402
- 'url' => 'http://www.woothemes.com/products/product-vendors/',
403
- 'class' => 'WooCommerce_Product_Vendors'
404
- );
405
- $modules[] = array(
406
- 'name' => 'acf',
407
- 'title' => __( 'Advanced Custom Fields', 'woo_ce' ),
408
- 'description' => __( 'Powerful fields for WordPress developers.', 'woo_ce' ),
409
- 'url' => 'http://www.advancedcustomfields.com',
410
- 'class' => 'acf'
411
- );
412
- $modules[] = array(
413
- 'name' => 'product_addons',
414
- 'title' => __( 'Product Add-ons', 'woo_ce' ),
415
- 'description' => __( 'Allow your customers to customise your products by adding input boxes, dropdowns or a field set of checkboxes.', 'woo_ce' ),
416
- 'url' => 'http://www.woothemes.com/products/product-add-ons/',
417
- 'class' => 'Product_Addon_Admin'
418
- );
419
- $modules[] = array(
420
- 'name' => 'seq',
421
- 'title' => __( 'WooCommerce Sequential Order Numbers', 'woo_ce' ),
422
- 'description' => __( 'This plugin extends the WooCommerce e-commerce plugin by setting sequential order numbers for new orders.', 'woo_ce' ),
423
- 'url' => 'https://wordpress.org/plugins/woocommerce-sequential-order-numbers/',
424
- 'slug' => 'woocommerce-sequential-order-numbers',
425
- 'class' => 'WC_Seq_Order_Number'
426
- );
427
- $modules[] = array(
428
- 'name' => 'seq_pro',
429
- 'title' => __( 'WooCommerce Sequential Order Numbers Pro', 'woo_ce' ),
430
- 'description' => __( 'Tame your WooCommerce Order Numbers.', 'woo_ce' ),
431
- 'url' => 'http://www.woothemes.com/products/sequential-order-numbers-pro/',
432
- 'class' => 'WC_Seq_Order_Number'
433
);
434
- $modules[] = array(
435
- 'name' => 'print_invoice_delivery_note',
436
- 'title' => __( 'WooCommerce Print Invoice & Delivery Note', 'woo_ce' ),
437
- 'description' => __( 'Print invoices and delivery notes for WooCommerce orders.', 'woo_ce' ),
438
- 'url' => 'http://wordpress.org/plugins/woocommerce-delivery-notes/',
439
- 'slug' => 'woocommerce-delivery-notes',
440
- 'class' => 'WooCommerce_Delivery_Notes'
441
- );
442
- $modules[] = array(
443
- 'name' => 'pdf_invoices_packing_slips',
444
- 'title' => __( 'WooCommerce PDF Invoices & Packing Slips', 'woo_ce' ),
445
- 'description' => __( 'Create, print & automatically email PDF invoices & packing slips for WooCommerce orders.', 'woo_ce' ),
446
- 'url' => 'https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/',
447
- 'slug' => 'woocommerce-pdf-invoices-packing-slips',
448
- 'class' => 'WooCommerce_PDF_Invoices'
449
- );
450
- $modules[] = array(
451
- 'name' => 'checkout_manager',
452
- 'title' => __( 'WooCommerce Checkout Manager', 'woo_ce' ),
453
- 'description' => __( 'Manages WooCommerce Checkout.', 'woo_ce' ),
454
- 'url' => 'http://wordpress.org/plugins/woocommerce-checkout-manager/',
455
- 'slug' => 'woocommerce-checkout-manager',
456
- 'function' => 'wccs_install'
457
- );
458
- $modules[] = array(
459
- 'name' => 'checkout_manager_pro',
460
- 'title' => __( 'WooCommerce Checkout Manager Pro', 'woo_ce' ),
461
- 'description' => __( 'Manages the WooCommerce Checkout page and WooCommerce Checkout processes.', 'woo_ce' ),
462
- 'url' => 'http://www.trottyzone.com/product/woocommerce-checkout-manager-pro',
463
- 'function' => 'wccs_install'
464
- );
465
- $modules[] = array(
466
- 'name' => 'pgsk',
467
- 'title' => __( 'Poor Guys Swiss Knife', 'woo_ce' ),
468
- 'description' => __( 'A Swiss Knife for WooCommerce.', 'woo_ce' ),
469
- 'url' => 'http://wordpress.org/plugins/woocommerce-poor-guys-swiss-knife/',
470
- 'slug' => 'woocommerce-poor-guys-swiss-knife',
471
- 'function' => 'wcpgsk_init'
472
- );
473
- $modules[] = array(
474
- 'name' => 'checkout_field_editor',
475
- 'title' => __( 'Checkout Field Editor', 'woo_ce' ),
476
- 'description' => __( 'Add, edit and remove fields shown on your WooCommerce checkout page.', 'woo_ce' ),
477
- 'url' => 'http://www.woothemes.com/products/woocommerce-checkout-field-editor/',
478
- 'function' => 'woocommerce_init_checkout_field_editor'
479
- );
480
- $modules[] = array(
481
- 'name' => 'checkout_field_manager',
482
- 'title' => __( 'Checkout Field Manager', 'woo_ce' ),
483
- 'description' => __( 'Quickly and effortlessly add, remove and re-orders fields in the checkout process.', 'woo_ce' ),
484
- 'url' => 'http://61extensions.com/shop/woocommerce-checkout-field-manager/',
485
- 'function' => 'sod_woocommerce_checkout_manager_settings'
486
- );
487
- $modules[] = array(
488
- 'name' => 'checkout_addons',
489
- 'title' => __( 'WooCommerce Checkout Add-Ons', 'woo_ce' ),
490
- 'description' => __( 'Add fields at checkout for add-on products and services while optionally setting a cost for each add-on.', 'woo_ce' ),
491
- 'url' => 'http://www.skyverge.com/product/woocommerce-checkout-add-ons/',
492
- 'function' => 'init_woocommerce_checkout_add_ons'
493
- );
494
- $modules[] = array(
495
- 'name' => 'local_pickup_plus',
496
- 'title' => __( 'Local Pickup Plus', 'woo_ce' ),
497
- 'description' => __( 'Let customers pick up products from specific locations.', 'woo_ce' ),
498
- 'url' => 'http://www.woothemes.com/products/local-pickup-plus/',
499
- 'class' => 'WC_Local_Pickup_Plus'
500
- );
501
- $modules[] = array(
502
- 'name' => 'gravity_forms',
503
- 'title' => __( 'Gravity Forms', 'woo_ce' ),
504
- 'description' => __( 'Gravity Forms is hands down the best contact form plugin for WordPress powered websites.', 'woo_ce' ),
505
- 'url' => 'http://woothemes.com/woocommerce',
506
- 'class' => 'RGForms'
507
- );
508
- $modules[] = array(
509
- 'name' => 'currency_switcher',
510
- 'title' => __( 'WooCommerce Currency Switcher', 'woo_ce' ),
511
- 'description' => __( 'Currency Switcher for WooCommerce allows your shop to display prices and accept payments in multiple currencies.', 'woo_ce' ),
512
- 'url' => 'http://aelia.co/shop/currency-switcher-woocommerce/',
513
- 'class' => 'WC_Aelia_CurrencySwitcher'
514
- );
515
- $modules[] = array(
516
- 'name' => 'subscriptions',
517
- 'title' => __( 'WooCommerce Subscriptions', 'woo_ce' ),
518
- 'description' => __( 'WC Subscriptions makes it easy to create and manage products with recurring payments.', 'woo_ce' ),
519
- 'url' => 'http://www.woothemes.com/products/woocommerce-subscriptions/',
520
- 'class' => 'WC_Subscriptions_Manager'
521
- );
522
-
523
- /*
524
- $modules[] = array(
525
- 'name' => '',
526
- 'title' => __( '', 'woo_ce' ),
527
- 'description' => __( '', 'woo_ce' ),
528
- 'url' => '',
529
- 'slug' => '', // Define this if the Plugin is hosted on the WordPress repo
530
- 'function' => ''
531
- );
532
- */
533
-
534
- $modules = apply_filters( 'woo_ce_modules_addons', $modules );
535
-
536
- if( !empty( $modules ) ) {
537
- foreach( $modules as $key => $module ) {
538
- $modules[$key]['status'] = 'inactive';
539
- // Check if each module is activated
540
- if( isset( $module['function'] ) ) {
541
- if( function_exists( $module['function'] ) )
542
- $modules[$key]['status'] = 'active';
543
- } else if( isset( $module['class'] ) ) {
544
- if( class_exists( $module['class'] ) )
545
- $modules[$key]['status'] = 'active';
546
- }
547
- // Check if the Plugin has a slug and if current user can install Plugins
548
- if( current_user_can( 'install_plugins' ) && isset( $module['slug'] ) )
549
- $modules[$key]['url'] = admin_url( sprintf( 'plugin-install.php?tab=search&type=tag&s=%s', $module['slug'] ) );
550
- }
551
}
552
- return $modules;
553
554
}
555
@@ -577,11 +533,11 @@ function woo_ce_modules_status_label( $status = 'inactive' ) {
577
switch( $status ) {
578
579
case 'active':
580
- $output = __( 'OK', 'woo_ce' );
581
break;
582
583
case 'inactive':
584
- $output = __( 'Install', 'woo_ce' );
585
break;
586
587
}
@@ -603,7 +559,7 @@ function woo_ce_support_donate() {
603
$rate_url = 'http://wordpress.org/support/view/plugin-reviews/' . WOO_CE_DIRNAME;
604
$output = '
605
<div id="support-donate_rate" class="support-donate_rate">
606
- <p>' . sprintf( __( '<strong>Like this Plugin?</strong> %s and %s.', 'woo_ce' ), '<a href="' . $donate_url . '" target="_blank">' . __( 'Donate to support this Plugin', 'woo_ce' ) . '</a>', '<a href="' . add_query_arg( array( 'rate' => '5' ), $rate_url ) . '#postform" target="_blank">rate / review us on WordPress.org</a>' ) . '</p>
607
</div>
608
';
609
}
15
$existing_notice = base64_decode( $existing_notice );
16
$output = $existing_notice . $output;
17
}
18
+ $response = set_transient( WOO_CE_PREFIX . '_notice', base64_encode( $output ), DAY_IN_SECONDS );
19
+ // Check if the Transient was saved
20
+ if( $response !== false )
21
+ add_action( 'admin_notices', 'woo_ce_admin_notice_print' );
22
}
23
24
}
25
26
// HTML template for admin notice
27
+ function woo_ce_admin_notice_html( $message = '', $priority = 'updated', $screen = '', $id = '' ) {
28
29
+ // Default priority to updated
30
+ if( empty( $priority ) )
31
+ $priority = 'updated';
32
// Display admin notice on specific screen
33
if( !empty( $screen ) ) {
34
42
return;
43
}
44
45
+ }
46
+ // Override for WooCommerce notice styling
47
+ if( $priority == 'notice' )
48
+ $priority = 'updated woocommerce-message'; ?>
49
+ <div id="<?php echo ( !empty( $id ) ? sprintf( 'message-%s', $id ) : 'message' ); ?>" class="<?php echo $priority; ?>">
50
<p><?php echo $message; ?></p>
51
</div>
52
<?php
71
if( $title )
72
$output = $title;
73
else
74
+ $output = __( 'Store Export', 'woocommerce-exporter' ); ?>
75
<div id="woo-ce" class="wrap">
76
<div id="icon-<?php echo $icon; ?>" class="icon32 icon32-woocommerce-importer"><br /></div>
77
<h2>
78
<?php echo $output; ?>
79
</h2>
80
<?php
81
89
90
}
91
92
+ function woo_ce_export_options_export_format() {
93
+
94
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
95
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
96
+
97
+ ob_start(); ?>
98
+ <tr>
99
+ <th>
100
+ <label><?php _e( 'Export format', 'woocommerce-exporter' ); ?></label>
101
+ </th>
102
+ <td>
103
+ <label><input type="radio" name="export_format" value="csv"<?php checked( 'csv', 'csv' ); ?> /> <?php _e( 'CSV', 'woocommerce-exporter' ); ?> <span class="description"><?php _e( '(Comma Separated Values)', 'woocommerce-exporter' ); ?></span></label><br />
104
+ <label><input type="radio" name="export_format" value="xls" disabled="disabled" /> <?php _e( 'Excel (XLS)', 'woocommerce-exporter' ); ?> <span class="description"><?php _e( '(Excel 97-2003)', 'woocommerce-exporter' ); ?> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label><br />
105
+ <label><input type="radio" name="export_format" value="xlsx" disabled="disabled" /> <?php _e( 'Excel (XLSX)', 'woocommerce-exporter' ); ?> <span class="description"><?php _e( '(Excel 2007-2013)', 'woocommerce-exporter' ); ?> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label><br />
106
+ <label><input type="radio" name="export_format" value="xml" disabled="disabled" /> <?php _e( 'XML', 'woocommerce-exporter' ); ?> <span class="description"><?php _e( '(EXtensible Markup Language)', 'woocommerce-exporter' ); ?> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label><br />
107
+ <div class="export-options product-options">
108
+ <label><input type="radio" name="export_format" value="rss" disabled="disabled" /> <?php _e( 'RSS', 'woocommerce-exporter' ); ?> <span class="description"><?php printf( __( '(<attr title="%s">XML</attr> feed in RSS 2.0 format)', 'woocommerce-exporter' ), __( 'EXtensible Markup Language', 'woocommerce-exporter' ) ); ?> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label>
109
+ </div>
110
+ <p class="description"><?php _e( 'Adjust the export format to generate different export file formats.', 'woocommerce-exporter' ); ?></p>
111
+ </td>
112
+ </tr>
113
+ <?php
114
+ ob_end_flush();
115
+
116
+ }
117
+
118
// Add Export and Docs links to the Plugins screen
119
function woo_ce_add_settings_link( $links, $file ) {
120
123
124
if( $file == $this_plugin ) {
125
$docs_url = 'http://www.visser.com.au/docs/';
126
+ $docs_link = sprintf( '<a href="%s" target="_blank">' . __( 'Docs', 'woocommerce-exporter' ) . '</a>', $docs_url );
127
+ $export_link = sprintf( '<a href="%s">' . __( 'Export', 'woocommerce-exporter' ) . '</a>', esc_url( add_query_arg( 'page', 'woo_ce', 'admin.php' ) ) );
128
array_unshift( $links, $docs_link );
129
array_unshift( $links, $export_link );
130
}
133
}
134
add_filter( 'plugin_action_links', 'woo_ce_add_settings_link', 10, 2 );
135
136
+ function woo_ce_admin_custom_fields_save() {
137
+
138
+ // Save Custom Product Meta
139
+ if( isset( $_POST['custom_products'] ) ) {
140
+ $custom_products = $_POST['custom_products'];
141
+ $custom_products = explode( "\n", trim( $custom_products ) );
142
+ if( !empty( $custom_products ) ) {
143
+ $size = count( $custom_products );
144
+ if( !empty( $size ) ) {
145
+ for( $i = 0; $i < $size; $i++ )
146
+ $custom_products[$i] = sanitize_text_field( trim( stripslashes( $custom_products[$i] ) ) );
147
+ woo_ce_update_option( 'custom_products', $custom_products );
148
+ }
149
+ } else {
150
+ woo_ce_update_option( 'custom_products', '' );
151
+ }
152
+ unset( $custom_products );
153
+ }
154
+
155
+ }
156
+
157
// Add Store Export page to WooCommerce screen IDs
158
function woo_ce_wc_screen_ids( $screen_ids = array() ) {
159
166
// Add Store Export to WordPress Administration menu
167
function woo_ce_admin_menu() {
168
169
+ $page = add_submenu_page( 'woocommerce', __( 'Store Exporter', 'woocommerce-exporter' ), __( 'Store Export', 'woocommerce-exporter' ), 'view_woocommerce_reports', 'woo_ce', 'woo_ce_html_page' );
170
add_action( 'admin_print_styles-' . $page, 'woo_ce_enqueue_scripts' );
171
+ add_action( 'current_screen', 'woo_ce_add_help_tab' );
172
173
}
174
add_action( 'admin_menu', 'woo_ce_admin_menu', 11 );
175
176
// Load CSS and jQuery scripts for Store Exporter screen
177
+ function woo_ce_enqueue_scripts() {
178
179
// Simple check that WooCommerce is activated
180
if( class_exists( 'WooCommerce' ) ) {
186
187
}
188
189
+ // Date Picker Addon
190
wp_enqueue_script( 'jquery-ui-datepicker' );
191
wp_enqueue_style( 'jquery-ui-datepicker', plugins_url( '/templates/admin/jquery-ui-datepicker.css', WOO_CE_RELPATH ) );
192
193
+ // Time Picker, Date Picker Addon
194
+ wp_enqueue_script( 'jquery-ui-timepicker', plugins_url( '/js/jquery.timepicker.js', WOO_CE_RELPATH ), array( 'jquery', 'jquery-ui-datepicker' ) );
195
+ wp_enqueue_style( 'jquery-ui-datepicker', plugins_url( '/templates/admin/jquery-ui-timepicker.css', WOO_CE_RELPATH ) );
196
+
197
// Chosen
198
wp_enqueue_style( 'jquery-chosen', plugins_url( '/templates/admin/chosen.css', WOO_CE_RELPATH ) );
199
wp_enqueue_script( 'jquery-chosen', plugins_url( '/js/jquery.chosen.js', WOO_CE_RELPATH ), array( 'jquery' ) );
211
212
}
213
214
+ function woo_ce_add_help_tab() {
215
+
216
+ $screen = get_current_screen();
217
+ if( $screen->id <> 'woocommerce_page_woo_ce' )
218
+ return;
219
+
220
+ $screen->add_help_tab( array(
221
+ 'id' => 'woo_ce',
222
+ 'title' => __( 'Store Exporter', 'woocommerce-exporter' ),
223
+ 'content' =>
224
+ '<p>' . __( 'Thank you for using Store Exporter :) Should you need help using this Plugin please read the documentation, if an issue persists get in touch with us on the WordPress.org Support tab for this Plugin.', 'woocommerce-exporter' ) . '</p>' .
225
+ '<p><a href="' . 'http://www.visser.com.au/documentation/store-exporter/usage/' . '" target="_blank" class="button button-primary">' . __( 'Documentation', 'woocommerce-exporter' ) . '</a> <a href="' . 'http://wordpress.org/support/plugin/woocommerce-exporter' . '" target="_blank" class="button">' . __( 'Forum Support', 'woocommerce-exporter' ) . '</a></p>'
226
+ ) );
227
+
228
+ }
229
+
230
+ function woo_ce_admin_plugin_row() {
231
+
232
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/';
233
+
234
+ // Detect if another e-Commerce platform is activated
235
+ if( !woo_is_woo_activated() && ( woo_is_jigo_activated() || woo_is_wpsc_activated() ) ) {
236
+ $message = __( 'We have detected another e-Commerce Plugin than WooCommerce activated, please check that you are using Store Exporter for the correct platform.', 'woocommerce-exporter' );
237
+ $message .= sprintf( ' <a href="%s" target="_blank">%s</a>', __( 'Need help?', 'woocommerce-exporter' ), $troubleshooting_url );
238
+ echo '</tr><tr class="plugin-update-tr"><td colspan="3" class="plugin-update colspanchange"><div class="update-message">' . $message . '</div></td></tr>';
239
+ } else if( !woo_is_woo_activated() ) {
240
+ $message = __( 'We have been unable to detect the WooCommerce Plugin activated on this WordPress site, please check that you are using Exporter Deluxe for the correct platform.', 'woocommerce-exporter' );
241
+ $message .= sprintf( ' <a href="%s" target="_blank">%s</a>', $troubleshooting_url, __( 'Need help?', 'woocommerce-exporter' ) );
242
+ echo '</tr><tr class="plugin-update-tr"><td colspan="3" class="plugin-update colspanchange"><div class="update-message">' . $message . '</div></td></tr>';
243
+ }
244
+
245
+ }
246
+
247
// HTML active class for the currently selected tab on the Store Exporter screen
248
function woo_ce_admin_active_tab( $tab_name = null, $tab = null ) {
249
270
$tab = 'overview';
271
272
// Store Exporter Deluxe
273
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
274
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
275
276
$troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/';
277
283
284
case 'export':
285
$export_type = sanitize_text_field( ( isset( $_POST['dataset'] ) ? $_POST['dataset'] : woo_ce_get_option( 'last_export', 'product' ) ) );
286
+ $export_types = array_keys( woo_ce_get_export_types() );
287
+
288
// Check if the default export type exists
289
+ if( !in_array( $export_type, $export_types ) )
290
$export_type = 'product';
291
292
+ $product = woo_ce_get_export_type_count( 'product' );
293
+ $category = woo_ce_get_export_type_count( 'category' );
294
+ $tag = woo_ce_get_export_type_count( 'tag' );
295
+ $brand = '999';
296
+ $order = '999';
297
+ $customer = '999';
298
+ $user = woo_ce_get_export_type_count( 'user' );
299
+ $review = '999';
300
+ $coupon = '999';
301
+ $attribute = '999';
302
+ $subscription = '999';
303
+ $product_vendor = '999';
304
+ $commission = '999';
305
+ $shipping_class = '999';
306
+ $ticket = '999';
307
+
308
+ add_action( 'woo_ce_export_options', 'woo_ce_export_options_export_format' );
309
if( $product_fields = woo_ce_get_product_fields() ) {
310
foreach( $product_fields as $key => $product_field )
311
$product_fields[$key]['disabled'] = ( isset( $product_field['disabled'] ) ? $product_field['disabled'] : 0 );
312
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_category' );
313
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_tag' );
314
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_brand' );
315
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_vendor' );
316
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_status' );
317
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_type' );
318
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_stock_status' );
319
+ add_action( 'woo_ce_export_product_options_after_table', 'woo_ce_product_sorting' );
320
+ add_action( 'woo_ce_export_options', 'woo_ce_products_upsells_formatting' );
321
+ add_action( 'woo_ce_export_options', 'woo_ce_products_crosssells_formatting' );
322
+ add_action( 'woo_ce_export_options', 'woo_ce_export_options_gallery_format' );
323
+ add_action( 'woo_ce_export_after_form', 'woo_ce_products_custom_fields' );
324
}
325
if( $category_fields = woo_ce_get_category_fields() ) {
326
foreach( $category_fields as $key => $category_field )
327
$category_fields[$key]['disabled'] = ( isset( $category_field['disabled'] ) ? $category_field['disabled'] : 0 );
328
+ add_action( 'woo_ce_export_category_options_after_table', 'woo_ce_category_sorting' );
329
}
330
if( $tag_fields = woo_ce_get_tag_fields() ) {
331
foreach( $tag_fields as $key => $tag_field )
332
$tag_fields[$key]['disabled'] = ( isset( $tag_field['disabled'] ) ? $tag_field['disabled'] : 0 );
333
+ add_action( 'woo_ce_export_tag_options_after_table', 'woo_ce_tag_sorting' );
334
}
335
if( $brand_fields = woo_ce_get_brand_fields() ) {
336
foreach( $brand_fields as $key => $brand_field )
337
$brand_fields[$key]['disabled'] = ( isset( $brand_field['disabled'] ) ? $brand_field['disabled'] : 0 );
338
+ add_action( 'woo_ce_export_brand_options_before_table', 'woo_ce_brand_sorting' );
339
+ }
340
+ if( $order_fields = woo_ce_get_order_fields() ) {
341
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_date' );
342
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_status' );
343
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_customer' );
344
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_billing_country' );
345
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_shipping_country' );
346
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_user_role' );
347
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_coupon' );
348
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_product' );
349
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_product_category' );
350
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_product_tag' );
351
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_product_brand' );
352
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_order_id' );
353
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_payment_gateway' );
354
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_shipping_method' );
355
+ add_action( 'woo_ce_export_order_options_after_table', 'woo_ce_order_sorting' );
356
+ add_action( 'woo_ce_export_options', 'woo_ce_orders_items_formatting' );
357
+ add_action( 'woo_ce_export_options', 'woo_ce_orders_max_order_items' );
358
+ add_action( 'woo_ce_export_options', 'woo_ce_orders_items_types' );
359
+ add_action( 'woo_ce_export_after_form', 'woo_ce_orders_custom_fields' );
360
+ }
361
+ if( $customer_fields = woo_ce_get_customer_fields() ) {
362
+ add_action( 'woo_ce_export_customer_options_before_table', 'woo_ce_customers_filter_by_status' );
363
+ add_action( 'woo_ce_export_customer_options_before_table', 'woo_ce_customers_filter_by_user_role' );
364
+ add_action( 'woo_ce_export_after_form', 'woo_ce_customers_custom_fields' );
365
}
366
if( $user_fields = woo_ce_get_user_fields() ) {
367
foreach( $user_fields as $key => $user_field )
368
$user_fields[$key]['disabled'] = ( isset( $user_field['disabled'] ) ? $user_field['disabled'] : 0 );
369
+ add_action( 'woo_ce_export_user_options_after_table', 'woo_ce_user_sorting' );
370
+ add_action( 'woo_ce_export_after_form', 'woo_ce_users_custom_fields' );
371
+ }
372
+ if( $coupon_fields = woo_ce_get_coupon_fields() ) {
373
+ add_action( 'woo_ce_export_coupon_options_before_table', 'woo_ce_coupon_sorting' );
374
+ }
375
+ if( $subscription_fields = woo_ce_get_subscription_fields() ) {
376
+ add_action( 'woo_ce_export_subscription_options_before_table', 'woo_ce_subscriptions_filter_by_subscription_status' );
377
+ add_action( 'woo_ce_export_subscription_options_before_table', 'woo_ce_subscriptions_filter_by_subscription_product' );
378
}
379
$product_vendor_fields = woo_ce_get_product_vendor_fields();
380
+ if( $commission_fields = woo_ce_get_commission_fields() ) {
381
+ add_action( 'woo_ce_export_commission_options_before_table', 'woo_ce_commissions_filter_by_date' );
382
+ add_action( 'woo_ce_export_commission_options_before_table', 'woo_ce_commissions_filter_by_product_vendor' );
383
+ add_action( 'woo_ce_export_commission_options_before_table', 'woo_ce_commissions_filter_by_commission_status' );
384
+ add_action( 'woo_ce_export_commission_options_before_table', 'woo_ce_commission_sorting' );
385
+ }
386
+ if( $shipping_class_fields = woo_ce_get_shipping_class_fields() ) {
387
+ add_action( 'woo_ce_export_shipping_class_options_after_table', 'woo_ce_shipping_class_sorting' );
388
+ }
389
$attribute_fields = false;
390
391
// Export options
392
$limit_volume = woo_ce_get_option( 'limit_volume' );
393
$offset = woo_ce_get_option( 'offset' );
395
396
case 'fields':
397
$export_type = ( isset( $_GET['type'] ) ? sanitize_text_field( $_GET['type'] ) : '' );
398
+ $export_types = array_keys( woo_ce_get_export_types() );
399
$fields = array();
400
+ if( in_array( $export_type, $export_types ) ) {
401
if( has_filter( 'woo_ce_' . $export_type . '_fields', 'woo_ce_override_' . $export_type . '_field_labels' ) )
402
remove_filter( 'woo_ce_' . $export_type . '_fields', 'woo_ce_override_' . $export_type . '_field_labels', 11 );
403
if( function_exists( sprintf( 'woo_ce_get_%s_fields', $export_type ) ) )
408
409
case 'archive':
410
if( isset( $_GET['deleted'] ) ) {
411
+ $message = __( 'Archived export has been deleted.', 'woocommerce-exporter' );
412
woo_ce_admin_notice( $message );
413
}
414
if( $files = woo_ce_get_archive_files() ) {
420
case 'settings':
421
$export_filename = woo_ce_get_option( 'export_filename', '' );
422
// Default export filename
423
+ if( $export_filename == false )
424
+ $export_filename = '%store_name%-export_%dataset%-%date%-%time%-%random%.csv';
425
+ $delete_file = woo_ce_get_option( 'delete_file', 1 );
426
$timeout = woo_ce_get_option( 'timeout', 0 );
427
$encoding = woo_ce_get_option( 'encoding', 'UTF-8' );
428
$bom = woo_ce_get_option( 'bom', 1 );
430
$category_separator = woo_ce_get_option( 'category_separator', '|' );
431
$escape_formatting = woo_ce_get_option( 'escape_formatting', 'all' );
432
$date_format = woo_ce_get_option( 'date_format', 'd/m/Y' );
433
+ // Reset the Date Format if corrupted
434
+ if( $date_format == '1' || $date_format == '' || $date_format == false )
435
$date_format = 'd/m/Y';
436
$file_encodings = ( function_exists( 'mb_list_encodings' ) ? mb_list_encodings() : false );
437
+ add_action( 'woo_ce_export_settings_top', 'woo_ce_export_settings_quicklinks' );
438
+ add_action( 'woo_ce_export_settings_after', 'woo_ce_export_settings_csv' );
439
+ add_action( 'woo_ce_export_settings_after', 'woo_ce_export_settings_extend' );
440
break;
441
442
case 'tools':
444
$woo_pd_url = 'http://www.visser.com.au/woocommerce/plugins/product-importer-deluxe/';
445
$woo_pd_target = ' target="_blank"';
446
if( function_exists( 'woo_pd_init' ) ) {
447
+ $woo_pd_url = esc_url( add_query_arg( array( 'page' => 'woo_pd', 'tab' => null ) ) );
448
$woo_pd_target = false;
449
}
450
452
$woo_st_url = 'http://www.visser.com.au/woocommerce/plugins/store-toolkit/';
453
$woo_st_target = ' target="_blank"';
454
if( function_exists( 'woo_st_admin_init' ) ) {
455
+ $woo_st_url = esc_url( add_query_arg( array( 'page' => 'woo_st', 'tab' => null ) ) );
456
$woo_st_target = false;
457
}
458
+
459
+ // Export modules
460
+ $module_status = ( isset( $_GET['module_status'] ) ? sanitize_text_field( $_GET['module_status'] ) : false );
461
+ $modules = woo_ce_modules_list( $module_status );
462
+ $modules_all = get_transient( WOO_CE_PREFIX . '_modules_all_count' );
463
+ $modules_active = get_transient( WOO_CE_PREFIX . '_modules_active_count' );
464
+ $modules_inactive = get_transient( WOO_CE_PREFIX . '_modules_inactive_count' );
465
break;
466
467
}
469
if( file_exists( WOO_CE_PATH . 'templates/admin/tabs-' . $tab . '.php' ) ) {
470
include_once( WOO_CE_PATH . 'templates/admin/tabs-' . $tab . '.php' );
471
} else {
472
+ $message = sprintf( __( 'We couldn\'t load the export template file <code>%s</code> within <code>%s</code>, this file should be present.', 'woocommerce-exporter' ), 'tabs-' . $tab . '.php', WOO_CE_PATH . 'templates/admin/...' );
473
woo_ce_admin_notice_html( $message, 'error' );
474
ob_start(); ?>
475
+ <p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-exporter' ); ?>:</p>
476
<ul class="ul-disc">
477
+ <li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-exporter' ); ?></li>
478
+ <li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-exporter' ); ?></li>
479
+ <li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-exporter' ); ?></li>
480
</ul>
481
+ <p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-exporter' ); ?></p>
482
<?php
483
ob_end_flush();
484
}
486
487
}
488
489
+ // Display the memory usage in the screen footer
490
+ function woo_ce_admin_footer_text( $footer_text = '' ) {
491
492
+ $current_screen = get_current_screen();
493
+ $pages = array(
494
+ 'woocommerce_page_woo_ce'
495
);
496
+ // Check to make sure we're on the Export screen
497
+ if ( isset( $current_screen->id ) && apply_filters( 'woo_ce_display_admin_footer_text', in_array( $current_screen->id, $pages ) ) ) {
498
+ $memory_usage = woo_ce_current_memory_usage( false );
499
+ $memory_limit = absint( ini_get( 'memory_limit' ) );
500
+ $memory_percent = absint( $memory_usage / $memory_limit * 100 );
501
+ $memory_color = 'font-weight:normal;';
502
+ if( $memory_percent > 75 )
503
+ $memory_color = 'font-weight:bold; color:orange;';
504
+ if( $memory_percent > 90 )
505
+ $memory_color = 'font-weight:bold; color:red;';
506
+ $footer_text .= ' | ' . sprintf( __( 'Memory: %s of %s MB (%s)', 'woocommerce-exporter' ), $memory_usage, $memory_limit, sprintf( '<span style="%s">%s</span>', $memory_color, $memory_percent . '%' ) );
507
}
508
+ return $footer_text;
509
510
}
511
533
switch( $status ) {
534
535
case 'active':
536
+ $output = __( 'OK', 'woocommerce-exporter' );
537
break;
538
539
case 'inactive':
540
+ $output = __( 'Install', 'woocommerce-exporter' );
541
break;
542
543
}
559
$rate_url = 'http://wordpress.org/support/view/plugin-reviews/' . WOO_CE_DIRNAME;
560
$output = '
561
<div id="support-donate_rate" class="support-donate_rate">
562
+ <p>' . sprintf( __( '<strong>Like this Plugin?</strong> %s and %s.', 'woocommerce-exporter' ), '<a href="' . $donate_url . '" target="_blank">' . __( 'Donate to support this Plugin', 'woocommerce-exporter' ) . '</a>', '<a href="' . esc_url( add_query_arg( array( 'rate' => '5' ), $rate_url ) ) . '#postform" target="_blank">rate / review us on WordPress.org</a>' ) . '</p>
563
</div>
564
';
565
}
includes/admin/brand.php ADDED
@@ -0,0 +1,33 @@
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for Coupon Sorting widget on Store Exporter screen
7
+ function woo_ce_brand_sorting() {
8
+
9
+ $orderby = woo_ce_get_option( 'brand_orderby', 'ID' );
10
+ $order = woo_ce_get_option( 'brand_order', 'DESC' );
11
+
12
+ ob_start(); ?>
13
+ <p><label><?php _e( 'Brand Sorting', 'woocommerce-exporter' ); ?></label></p>
14
+ <div>
15
+ <select name="brand_orderby" disabled="disabled">
16
+ <option value="id"><?php _e( 'Term ID', 'woocommerce-exporter' ); ?></option>
17
+ <option value="name"><?php _e( 'Brand Name', 'woocommerce-exporter' ); ?></option>
18
+ </select>
19
+ <select name="brand_order" disabled="disabled">
20
+ <option value="ASC"><?php _e( 'Ascending', 'woocommerce-exporter' ); ?></option>
21
+ <option value="DESC"><?php _e( 'Descending', 'woocommerce-exporter' ); ?></option>
22
+ </select>
23
+ <p class="description"><?php _e( 'Select the sorting of Brands within the exported file. By default this is set to export Product Brands by Term ID in Desending order.', 'woocommerce-exporter' ); ?></p>
24
+ </div>
25
+ <?php
26
+ ob_end_flush();
27
+
28
+ }
29
+
30
+ /* End of: WordPress Administration */
31
+
32
+ }
33
+ ?>
includes/admin/category.php ADDED
@@ -0,0 +1,33 @@
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for Category Sorting widget on Store Exporter screen
7
+ function woo_ce_category_sorting() {
8
+
9
+ $category_orderby = woo_ce_get_option( 'category_orderby', 'ID' );
10
+ $category_order = woo_ce_get_option( 'category_order', 'DESC' );
11
+
12
+ ob_start(); ?>
13
+ <p><label><?php _e( 'Category Sorting', 'woocommerce-exporter' ); ?></label></p>
14
+ <div>
15
+ <select name="category_orderby">
16
+ <option value="id"<?php selected( 'id', $category_orderby ); ?>><?php _e( 'Term ID', 'woocommerce-exporter' ); ?></option>
17
+ <option value="name"<?php selected( 'name', $category_orderby ); ?>><?php _e( 'Category Name', 'woocommerce-exporter' ); ?></option>
18
+ </select>
19
+ <select name="category_order">
20
+ <option value="ASC"<?php selected( 'ASC', $category_order ); ?>><?php _e( 'Ascending', 'woocommerce-exporter' ); ?></option>
21
+ <option value="DESC"<?php selected( 'DESC', $category_order ); ?>><?php _e( 'Descending', 'woocommerce-exporter' ); ?></option>
22
+ </select>
23
+ <p class="description"><?php _e( 'Select the sorting of Categories within the exported file. By default this is set to export Categories by Term ID in Desending order.', 'woocommerce-exporter' ); ?></p>
24
+ </div>
25
+ <?php
26
+ ob_end_flush();
27
+
28
+ }
29
+
30
+ /* End of: WordPress Administration */
31
+
32
+ }
33
+ ?>
includes/admin/commission.php ADDED
@@ -0,0 +1,83 @@
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for Filter Commissions by Commission Date widget on Store Exporter screen
7
+ function woo_ce_commissions_filter_by_date() {
8
+
9
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
10
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
11
+
12
+ $today = date( 'l' );
13
+ $yesterday = date( 'l', strtotime( '-1 days' ) );
14
+ $current_month = date( 'F' );
15
+ $last_month = date( 'F', mktime( 0, 0, 0, date( 'n' )-1, 1, date( 'Y' ) ) );
16
+ $commission_dates_variable = '';
17
+ $commission_dates_variable_length = '';
18
+ $commission_dates_from = woo_ce_get_commission_first_date();
19
+ $commission_dates_to = date( 'd/m/Y' );
20
+
21
+ ob_start(); ?>
22
+ <p><label><input type="checkbox" id="commissions-filters-date" /> <?php _e( 'Filter Commissions by Commission Date', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
23
+ <div id="export-commissions-filters-date" class="separator">
24
+ <ul>
25
+ <li>
26
+ <label><input type="radio" name="commission_dates_filter" value="today" disabled="disabled" /> <?php _e( 'Today', 'woocommerce-exporter' ); ?> (<?php echo $today; ?>)</label>
27
+ </li>
28
+ <li>
29
+ <label><input type="radio" name="commission_dates_filter" value="yesterday" disabled="disabled" /> <?php _e( 'Yesterday', 'woocommerce-exporter' ); ?> (<?php echo $yesterday; ?>)</label>
30
+ </li>
31
+ <li>
32
+ <label><input type="radio" name="commission_dates_filter" value="current_week" disabled="disabled" /> <?php _e( 'Current week', 'woocommerce-exporter' ); ?></label>
33
+ </li>
34
+ <li>
35
+ <label><input type="radio" name="commission_dates_filter" value="last_week" disabled="disabled" /> <?php _e( 'Last week', 'woocommerce-exporter' ); ?></label>
36
+ </li>
37
+ <li>
38
+ <label><input type="radio" name="commission_dates_filter" value="current_month" disabled="disabled" /> <?php _e( 'Current month', 'woocommerce-exporter' ); ?> (<?php echo $current_month; ?>)</label>
39
+ </li>
40
+ <li>
41
+ <label><input type="radio" name="commission_dates_filter" value="last_month" disabled="disabled" /> <?php _e( 'Last month', 'woocommerce-exporter' ); ?> (<?php echo $last_month; ?>)</label>
42
+ </li>
43
+ <!--
44
+ <li>
45
+ <label><input type="radio" name="commission_dates_filter" value="last_quarter" disabled="disabled" /> <?php _e( 'Last quarter', 'woocommerce-exporter' ); ?> (Nov. - Jan.)</label>
46
+ </li>
47
+ -->
48
+ <li>
49
+ <label><input type="radio" name="commission_dates_filter" value="variable" disabled="disabled" /> <?php _e( 'Variable date', 'woocommerce-exporter' ); ?></label>
50
+ <div style="margin-top:0.2em;">
51
+ <?php _e( 'Last', 'woocommerce-exporter' ); ?>
52
+ <input type="text" name="commission_dates_filter_variable" class="text code" size="4" maxlength="4" value="<?php echo $commission_dates_variable; ?>" disabled="disabled" />
53
+ <select name="commission_dates_filter_variable_length" style="vertical-align:top;">
54
+ <option value=""<?php selected( $commission_dates_variable_length, '' ); ?>>&nbsp;</option>
55
+ <option value="second"<?php selected( $commission_dates_variable_length, 'second' ); ?> disabled="disabled"><?php _e( 'second(s)', 'woocommerce-exporter' ); ?></option>
56
+ <option value="minute"<?php selected( $commission_dates_variable_length, 'minute' ); ?> disabled="disabled"><?php _e( 'minute(s)', 'woocommerce-exporter' ); ?></option>
57
+ <option value="hour"<?php selected( $commission_dates_variable_length, 'hour' ); ?> disabled="disabled"><?php _e( 'hour(s)', 'woocommerce-exporter' ); ?></option>
58
+ <option value="day"<?php selected( $commission_dates_variable_length, 'day' ); ?> disabled="disabled"><?php _e( 'day(s)', 'woocommerce-exporter' ); ?></option>
59
+ <option value="week"<?php selected( $commission_dates_variable_length, 'week' ); ?> disabled="disabled"><?php _e( 'week(s)', 'woocommerce-exporter' ); ?></option>
60
+ <option value="month"<?php selected( $commission_dates_variable_length, 'month' ); ?> disabled="disabled"><?php _e( 'month(s)', 'woocommerce-exporter' ); ?></option>
61
+ <option value="year"<?php selected( $commission_dates_variable_length, 'year' ); ?> disabled="disabled"><?php _e( 'year(s)', 'woocommerce-exporter' ); ?></option>
62
+ </select>
63
+ </div>
64
+ </li>
65
+ <li>
66
+ <label><input type="radio" name="commission_dates_filter" value="manual" disabled="disabled" /> <?php _e( 'Fixed date', 'woocommerce-exporter' ); ?></label>
67
+ <div style="margin-top:0.2em;">
68
+ <input type="text" size="10" maxlength="10" id="commission_dates_from" name="commission_dates_from" value="<?php echo esc_attr( $commission_dates_from ); ?>" class="text code datepicker" disabled="disabled" /> to <input type="text" size="10" maxlength="10" id="commission_dates_to" name="commission_dates_to" value="<?php echo esc_attr( $commission_dates_to ); ?>" class="text code datepicker" disabled="disabled" />
69
+ <p class="description"><?php _e( 'Filter the dates of Orders to be included in the export. Default is the date of the first Commission to today.', 'woocommerce-exporter' ); ?></p>
70
+ </div>
71
+ </li>
72
+ </ul>
73
+ </div>
74
+ <!-- #export-commissions-filters-date -->
75
+ <?php
76
+ ob_end_flush();
77
+
78
+ }
79
+
80
+ /* End of: WordPress Administration */
81
+
82
+ }
83
+ ?>
includes/admin/coupon.php ADDED
@@ -0,0 +1,33 @@
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for disabled Coupon Sorting widget on Store Exporter screen
7
+ function woo_ce_coupon_sorting() {
8
+
9
+ ob_start(); ?>
10
+ <p><label><?php _e( 'Coupon Sorting', 'woocommerce-exporter' ); ?></label></p>
11
+ <div>
12
+ <select name="coupon_orderby" disabled="disabled">
13
+ <option value="ID"><?php _e( 'Coupon ID', 'woocommerce-exporter' ); ?></option>
14
+ <option value="title"><?php _e( 'Coupon Code', 'woocommerce-exporter' ); ?></option>
15
+ <option value="date"><?php _e( 'Date Created', 'woocommerce-exporter' ); ?></option>
16
+ <option value="modified"><?php _e( 'Date Modified', 'woocommerce-exporter' ); ?></option>
17
+ <option value="rand"><?php _e( 'Random', 'woocommerce-exporter' ); ?></option>
18
+ </select>
19
+ <select name="coupon_order" disabled="disabled">
20
+ <option value="ASC"><?php _e( 'Ascending', 'woocommerce-exporter' ); ?></option>
21
+ <option value="DESC"><?php _e( 'Descending', 'woocommerce-exporter' ); ?></option>
22
+ </select>
23
+ <p class="description"><?php _e( 'Select the sorting of Coupons within the exported file. By default this is set to export Coupons by Coupon ID in Desending order.', 'woocommerce-exporter' ); ?></p>
24
+ </div>
25
+ <?php
26
+ ob_end_flush();
27
+
28
+ }
29
+
30
+ /* End of: WordPress Administration */
31
+
32
+ }
33
+ ?>
includes/admin/customer.php ADDED
@@ -0,0 +1,124 @@
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for Filter Customers by Order Status widget on Store Exporter screen
7
+ function woo_ce_customers_filter_by_status() {
8
+
9
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
10
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
11
+
12
+ $order_statuses = woo_ce_get_order_statuses();
13
+
14
+ ob_start(); ?>
15
+ <p><label><input type="checkbox" id="customers-filters-status" /> <?php _e( 'Filter Customers by Order Status', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
16
+ <div id="export-customers-filters-status" class="separator">
17
+ <ul>
18
+ <li>
19
+ <?php if( !empty( $order_statuses ) ) { ?>
20
+ <select data-placeholder="<?php _e( 'Choose a Order Status...', 'woocommerce-exporter' ); ?>" name="customer_filter_status[]" multiple class="chzn-select" style="width:95%;">
21
+ <?php foreach( $order_statuses as $order_status ) { ?>
22
+ <option value="<?php echo $order_status->name; ?>"><?php echo ucfirst( $order_status->name ); ?></option>
23
+ <?php } ?>
24
+ </select>
25
+ <?php } else { ?>
26
+ <?php _e( 'No Order Status\'s were found.', 'woocommerce-exporter' ); ?>
27
+ <?php } ?>
28
+ </li>
29
+ </ul>
30
+ <p class="description"><?php _e( 'Select the Order Status you want to filter exported Customers by. Default is to include all Order Status options.', 'woocommerce-exporter' ); ?></p>
31
+ </div>
32
+ <!-- #export-customers-filters-status -->
33
+ <?php
34
+ ob_end_flush();
35
+
36
+ }
37
+
38
+ // HTML template for Filter Customers by User Role widget on Store Exporter screen
39
+ function woo_ce_customers_filter_by_user_role() {
40
+
41
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
42
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
43
+
44
+ $user_roles = woo_ce_get_user_roles();
45
+
46
+ ob_start(); ?>
47
+ <p><label><input type="checkbox" id="customers-filters-user_role" /> <?php _e( 'Filter Customers by User Role', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
48
+ <div id="export-customers-filters-user_role" class="separator">
49
+ <ul>
50
+ <li>
51
+ <?php if( !empty( $user_roles ) ) { ?>
52
+ <select data-placeholder="<?php _e( 'Choose a User Role...', 'woocommerce-exporter' ); ?>" name="customer_filter_user_role[]" multiple class="chzn-select" style="width:95%;">
53
+ <?php foreach( $user_roles as $key => $user_role ) { ?>
54
+ <option value="<?php echo $key; ?>"><?php echo ucfirst( $user_role['name'] ); ?></option>
55
+ <?php } ?>
56
+ </select>
57
+ <?php } else { ?>
58
+ <?php _e( 'No User Roles were found.', 'woocommerce-exporter' ); ?>
59
+ <?php } ?>
60
+ </li>
61
+ </ul>
62
+ <p class="description"><?php _e( 'Select the User Roles you want to filter exported Customers by. Default is to include all User Role options.', 'woocommerce-exporter' ); ?></p>
63
+ </div>
64
+ <!-- #export-customers-filters-user_role -->
65
+ <?php
66
+ ob_end_flush();
67
+
68
+ }
69
+
70
+ // HTML template for disabled Custom Customers widget on Store Exporter screen
71
+ function woo_ce_customers_custom_fields() {
72
+
73
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
74
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
75
+
76
+ $custom_customers = '-';
77
+
78
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/';
79
+
80
+ ob_start(); ?>
81
+ <form method="post" id="export-customers-custom-fields" class="export-options customer-options">
82
+ <div id="poststuff">
83
+
84
+ <div class="postbox" id="export-options customer-options">
85
+ <h3 class="hndle"><?php _e( 'Custom Customer Fields', 'woocommerce-exporter' ); ?></h3>
86
+ <div class="inside">
87
+ <p class="description"><?php _e( 'To include additional custom Customer meta in the Export Customers table above fill the Customers text box then click Save Custom Fields.', 'woocommerce-exporter' ); ?></p>
88
+ <table class="form-table">
89
+
90
+ <tr>
91
+ <th>
92
+ <label><?php _e( 'Customer meta', 'woocommerce-exporter' ); ?></label>
93
+ </th>
94
+ <td>
95
+ <textarea name="custom_customers" rows="5" cols="70" disabled="disabled"><?php echo esc_textarea( $custom_customers ); ?></textarea>
96
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
97
+ <p class="description"><?php _e( 'Include additional custom Customer meta in your export file by adding each custom Customer meta name to a new line above.<br />For example: <code>Customer UA, Customer IP Address</code>', 'woocommerce-exporter' ); ?></p>
98
+ </td>
99
+ </tr>
100
+
101
+ </table>
102
+ <p class="submit">
103
+ <input type="button" class="button button-disabled" value="<?php _e( 'Save Custom Fields', 'woocommerce-exporter' ); ?>" />
104
+ </p>
105
+ <p class="description"><?php printf( __( 'For more information on custom Customer meta consult our <a href="%s" target="_blank">online documentation</a>.', 'woocommerce-exporter' ), $troubleshooting_url ); ?></p>
106
+ </div>
107
+ <!-- .inside -->
108
+ </div>
109
+ <!-- .postbox -->
110
+
111
+ </div>
112
+ <!-- #poststuff -->
113
+ <input type="hidden" name="action" value="update" />
114
+ </form>
115
+ <!-- #export-customers-custom-fields -->
116
+ <?php
117
+ ob_end_flush();
118
+
119
+ }
120
+
121
+ /* End of: WordPress Administration */
122
+
123
+ }
124
+ ?>
includes/admin/order.php ADDED
@@ -0,0 +1,663 @@