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 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for Filter Orders by Order Date widget on Store Exporter screen
7
+ function woo_ce_orders_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
+ $order_dates_variable = '-';
17
+ $order_dates_variable_length = '';
18
+ $order_dates_from = '-';
19
+ $order_dates_to = '-';
20
+
21
+ ob_start(); ?>
22
+ <p><label><input type="checkbox" id="orders-filters-date" /> <?php _e( 'Filter Orders by Order Date', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
23
+ <div id="export-orders-filters-date" class="separator">
24
+ <ul>
25
+ <li>
26
+ <label><input type="radio" name="order_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="order_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="order_dates_filter" value="current_week" disabled="disabled" /> <?php _e( 'Current week', 'woocommerce-exporter' ); ?></label>
33
+ </li>
34
+ <li>
35
+ <label><input type="radio" name="order_dates_filter" value="last_week" disabled="disabled" /> <?php _e( 'Last week', 'woocommerce-exporter' ); ?></label>
36
+ </li>
37
+ <li>
38
+ <label><input type="radio" name="order_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="order_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="order_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="order_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="order_dates_filter_variable" class="text code" size="4" maxlength="4" value="<?php echo $order_dates_variable; ?>" disabled="disabled" />
53
+ <select name="order_dates_filter_variable_length" style="vertical-align:top;">
54
+ <option value="">&nbsp;</option>
55
+ <option value="second" disabled="disabled"><?php _e( 'second(s)', 'woocommerce-exporter' ); ?></option>
56
+ <option value="minute" disabled="disabled"><?php _e( 'minute(s)', 'woocommerce-exporter' ); ?></option>
57
+ <option value="hour" disabled="disabled"><?php _e( 'hour(s)', 'woocommerce-exporter' ); ?></option>
58
+ <option value="day" disabled="disabled"><?php _e( 'day(s)', 'woocommerce-exporter' ); ?></option>
59
+ <option value="week" disabled="disabled"><?php _e( 'week(s)', 'woocommerce-exporter' ); ?></option>
60
+ <option value="month" disabled="disabled"><?php _e( 'month(s)', 'woocommerce-exporter' ); ?></option>
61
+ <option value="year" disabled="disabled"><?php _e( 'year(s)', 'woocommerce-exporter' ); ?></option>
62
+ </select>
63
+ </div>
64
+ </li>
65
+ <li>
66
+ <label><input type="radio" name="order_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="order_dates_from" name="order_dates_from" value="<?php echo esc_attr( $order_dates_from ); ?>" class="text" disabled="disabled" /> to <input type="text" size="10" maxlength="10" id="order_dates_to" name="order_dates_to" value="<?php echo esc_attr( $order_dates_to ); ?>" class="text" 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 order to today.', 'woocommerce-exporter' ); ?></p>
70
+ </div>
71
+ </li>
72
+ </ul>
73
+ </div>
74
+ <!-- #export-orders-filters-date -->
75
+ <?php
76
+ ob_end_flush();
77
+
78
+ }
79
+
80
+ // HTML template for Filter Orders by Customer widget on Store Exporter screen
81
+ function woo_ce_orders_filter_by_customer() {
82
+
83
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
84
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
85
+
86
+ ob_start(); ?>
87
+ <p><label><input type="checkbox" id="orders-filters-customer" /> <?php _e( 'Filter Orders by Customer', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
88
+ <div id="export-orders-filters-customer" class="separator">
89
+ <ul>
90
+ <li>
91
+ <select id="order_customer" name="order_filter_customer" class="chzn-select">
92
+ <option value=""><?php _e( 'Show all customers', 'woocommerce-exporter' ); ?></option>
93
+ </select>
94
+ </li>
95
+ </ul>
96
+ <p class="description"><?php _e( 'Filter Orders by Customer (unique e-mail address) to be included in the export. Default is to include all Orders.', 'woocommerce-exporter' ); ?></p>
97
+ </div>
98
+ <!-- #export-orders-filters-customer -->
99
+ <?php
100
+ ob_end_flush();
101
+
102
+ }
103
+
104
+ // HTML template for Filter Orders by Billing Country widget on Store Exporter screen
105
+ function woo_ce_orders_filter_by_billing_country() {
106
+
107
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
108
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
109
+
110
+ $countries = woo_ce_allowed_countries();
111
+
112
+ ob_start(); ?>
113
+ <p><label><input type="checkbox" id="orders-filters-billing_country" /> <?php _e( 'Filter Orders by Billing Country', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
114
+ <div id="export-orders-filters-billing_country" class="separator">
115
+ <ul>
116
+ <li>
117
+ <?php if( !empty( $countries ) ) { ?>
118
+ <select id="order_billing_country" name="order_filter_billing_country" class="chzn-select">
119
+ <option value="" disabled="disabled"><?php _e( 'Show all Countries', 'woocommerce-exporter' ); ?></option>
120
+ <?php if( $countries ) { ?>
121
+ <?php foreach( $countries as $country_prefix => $country ) { ?>
122
+ <option value="<?php echo $country_prefix; ?>" disabled="disabled"><?php printf( '%s (%s)', $country, $country_prefix ); ?></option>
123
+ <?php } ?>
124
+ <?php } ?>
125
+ </select>
126
+ <?php } else { ?>
127
+ <?php _e( 'No Countries were found.', 'woocommerce-exporter' ); ?>
128
+ <?php } ?>
129
+ </li>
130
+ </ul>
131
+ <p class="description"><?php _e( 'Filter Orders by Billing Country to be included in the export. Default is to include all Countries.', 'woocommerce-exporter' ); ?></p>
132
+ </div>
133
+ <!-- #export-orders-filters-customer -->
134
+ <?php
135
+ ob_end_flush();
136
+
137
+ }
138
+
139
+ // HTML template for Filter Orders by Shipping Country widget on Store Exporter screen
140
+ function woo_ce_orders_filter_by_shipping_country() {
141
+
142
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
143
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
144
+
145
+ $countries = woo_ce_allowed_countries();
146
+
147
+ ob_start(); ?>
148
+ <p><label><input type="checkbox" id="orders-filters-shipping_country" /> <?php _e( 'Filter Orders by Shipping Country', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
149
+ <div id="export-orders-filters-shipping_country" class="separator">
150
+ <ul>
151
+ <li>
152
+ <?php if( !empty( $countries ) ) { ?>
153
+ <select id="order_shipping_country" name="order_filter_shipping_country" class="chzn-select">
154
+ <option value="" disabled="disabled"><?php _e( 'Show all Countries', 'woocommerce-exporter' ); ?></option>
155
+ <?php foreach( $countries as $country_prefix => $country ) { ?>
156
+ <option value="<?php echo $country_prefix; ?>" disabled="disabled"><?php printf( '%s (%s)', $country, $country_prefix ); ?></option>
157
+ <?php } ?>
158
+ </select>
159
+ <?php } else { ?>
160
+ <?php _e( 'No Countries were found.', 'woocommerce-exporter' ); ?>
161
+ <?php } ?>
162
+ </li>
163
+ </ul>
164
+ <p class="description"><?php _e( 'Filter Orders by Shipping Country to be included in the export. Default is to include all Countries.', 'woocommerce-exporter' ); ?></p>
165
+ </div>
166
+ <!-- #export-orders-filters-customer -->
167
+ <?php
168
+ ob_end_flush();
169
+
170
+ }
171
+
172
+ // HTML template for Filter Orders by User Role widget on Store Exporter screen
173
+ function woo_ce_orders_filter_by_user_role() {
174
+
175
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
176
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
177
+
178
+ $user_roles = woo_ce_get_user_roles();
179
+
180
+ ob_start(); ?>
181
+ <p><label><input type="checkbox" id="orders-filters-user_role" /> <?php _e( 'Filter Orders by User Role', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
182
+ <div id="export-orders-filters-user_role" class="separator">
183
+ <ul>
184
+ <li>
185
+ <?php if( !empty( $user_roles ) ) { ?>
186
+ <select data-placeholder="<?php _e( 'Choose a User Role...', 'woocommerce-exporter' ); ?>" name="order_filter_user_role[]" multiple class="chzn-select" style="width:95%;">
187
+ <?php foreach( $user_roles as $key => $user_role ) { ?>
188
+ <option value="<?php echo $key; ?>"><?php echo ucfirst( $user_role['name'] ); ?></option>
189
+ <?php } ?>
190
+ </select>
191
+ <?php } else { ?>
192
+ <?php _e( 'No User Roles were found.', 'woocommerce-exporter' ); ?>
193
+ <?php } ?>
194
+ </li>
195
+ </ul>
196
+ <p class="description"><?php _e( 'Select the User Roles you want to filter exported Orders by. Default is to include all User Role options.', 'woocommerce-exporter' ); ?></p>
197
+ </div>
198
+ <!-- #export-orders-filters-user_role -->
199
+ <?php
200
+ ob_end_flush();
201
+
202
+ }
203
+
204
+ // HTML template for Filter Orders by Order ID widget on Store Exporter screen
205
+ function woo_ce_orders_filter_by_order_id() {
206
+
207
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
208
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
209
+
210
+ ob_start(); ?>
211
+ <p><label><input type="checkbox" id="orders-filters-id" /> <?php _e( 'Filter Orders by Order ID', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
212
+ <div id="export-orders-filters-id" class="separator">
213
+ <ul>
214
+ <li>
215
+ <label for="order_filter_id"><?php _e( 'Order ID', 'woocommerce-exporter' ); ?></label>:<br />
216
+ <input type="text" id="order_filter_id" name="order_filter_id" value="-" class="text code" disabled="disabled" />
217
+ </li>
218
+ </ul>
219
+ <p class="description"><?php _e( 'Enter the Order ID\'s you want to filter exported Orders by. Multiple Order ID\'s can be entered separated by the \',\' (comma) character. Default is to include all Orders.', 'woocommerce-exporter' ); ?></p>
220
+ </div>
221
+ <!-- #export-orders-filters-user_role -->
222
+ <?php
223
+ ob_end_flush();
224
+
225
+ }
226
+
227
+ // HTML template for Filter Orders by Coupon Code widget on Store Exporter screen
228
+ function woo_ce_orders_filter_by_coupon() {
229
+
230
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
231
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
232
+
233
+ $args = array(
234
+ 'coupon_orderby' => 'ID',
235
+ 'coupon_order' => 'DESC'
236
+ );
237
+ $coupons = woo_ce_get_coupons( $args );
238
+
239
+ ob_start(); ?>
240
+ <p><label><input type="checkbox" id="orders-filters-coupon" /> <?php _e( 'Filter Orders by Coupon Code', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
241
+ <div id="export-orders-filters-coupon" class="separator">
242
+ <ul>
243
+ <li>
244
+ <?php if( !empty( $coupons ) ) { ?>
245
+ <select data-placeholder="<?php _e( 'Choose a Coupon...', 'woocommerce-exporter' ); ?>" name="order_filter_coupon[]" multiple class="chzn-select" style="width:95%;">
246
+ <?php foreach( $coupons as $coupon ) { ?>
247
+ <option value="<?php echo $coupon; ?>"><?php echo get_the_title( $coupon ); ?> (<?php echo woo_ce_get_coupon_code_usage( get_the_title( $coupon ) ); ?>)</option>
248
+ <?php } ?>
249
+ </select>
250
+ <?php } else { ?>
251
+ <?php _e( 'No Coupons were found.', 'woocommerce-exporter' ); ?>
252
+ <?php } ?>
253
+ </li>
254
+ </ul>
255
+ <p class="description"><?php _e( 'Select the Coupon Codes you want to filter exported Orders by. Default is to include all Orders with and without assigned Coupon Codes.', 'woocommerce-exporter' ); ?></p>
256
+ </div>
257
+ <!-- #export-orders-filters-coupon -->
258
+ <?php
259
+ ob_end_flush();
260
+
261
+ }
262
+
263
+ // HTML template for Filter Orders by Payment Gateway widget on Store Exporter screen
264
+ function woo_ce_orders_filter_by_payment_gateway() {
265
+
266
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
267
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
268
+
269
+ ob_start(); ?>
270
+ <p><label><input type="checkbox" id="orders-filters-payment_gateway" /> <?php _e( 'Filter Orders by Payment Gateway', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
271
+ <div id="export-orders-filters-payment_gateway" class="separator">
272
+ <ul>
273
+ <li>
274
+ <select id="order_payment_gateway" name="order_payment_gateway" disabled="disabled">
275
+ <option value=""><?php _e( 'Show all payment gateways', 'woocommerce-exporter' ); ?></option>
276
+ </select>
277
+ </li>
278
+ </ul>
279
+ <p class="description"><?php _e( 'Select the Payment Gateways you want to filter exported Orders by. Default is to include all Orders.', 'woocommerce-exporter' ); ?></p>
280
+ </div>
281
+ <!-- #export-orders-filters-coupon -->
282
+ <?php
283
+ ob_end_flush();
284
+
285
+ }
286
+
287
+ // HTML template for Filter Orders by Shipping Gateway widget on Store Exporter screen
288
+ function woo_ce_orders_filter_by_shipping_method() {
289
+
290
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
291
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
292
+
293
+ ob_start(); ?>
294
+ <p><label><input type="checkbox" id="orders-filters-shipping_method" /> <?php _e( 'Filter Orders by Shipping Method', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
295
+ <div id="export-orders-filters-shipping_method" class="separator">
296
+ <ul>
297
+ <li>
298
+ <select id="order_shipping_method" name="order_shipping_method" disabled="disabled">
299
+ <option value=""><?php _e( 'Show all shipping methods', 'woocommerce-exporter' ); ?></option>
300
+ </select>
301
+ </li>
302
+ </ul>
303
+ <p class="description"><?php _e( 'Select the Shipping Methods you want to filter exported Orders by. Default is to include all Orders.', 'woocommerce-exporter' ); ?></p>
304
+ </div>
305
+ <!-- #export-orders-filters-coupon -->
306
+ <?php
307
+ ob_end_flush();
308
+
309
+ }
310
+
311
+ // HTML template for Order Items Formatting on Store Exporter screen
312
+ function woo_ce_orders_items_formatting() {
313
+
314
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
315
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
316
+
317
+ ob_start(); ?>
318
+ <tr class="export-options order-options">
319
+ <th><label for="order_items"><?php _e( 'Order items formatting', 'woocommerce-exporter' ); ?></label></th>
320
+ <td>
321
+ <ul>
322
+ <li>
323
+ <label><input type="radio" name="order_items" value="combined" disabled="disabled" />&nbsp;<?php _e( 'Place Order Items within a grouped single Order row', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label>
324
+ <p class="description"><?php _e( 'For example: <code>Order Items: SKU</code> cell might contain <code>SPECK-IPHONE|INCASE-NANO|-</code> for 3 Order items within an Order', 'woocommerce-exporter' ); ?></p>
325
+ </li>
326
+ <li>
327
+ <label><input type="radio" name="order_items" value="unique" disabled="disabled" />&nbsp;<?php _e( 'Place Order Items on individual cells within a single Order row', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label>
328
+ <p class="description"><?php _e( 'For example: <code>Order Items: SKU</code> would become <code>Order Item #1: SKU</code> with <codeSPECK-IPHONE</code> for the first Order item within an Order', 'woocommerce-exporter' ); ?></p>
329
+ <p><strong><?php _e( 'Note', 'woocommerce-exporter' ); ?></strong>: <?php _e( 'Custom field labels set for Order export fields will not be applied when using this Order Item Formatting rule, if you need custom field labels use another formatting rule.', 'woocommerce-exporter' ); ?></p>
330
+ </li>
331
+ <li>
332
+ <label><input type="radio" name="order_items" value="individual" disabled="disabled" />&nbsp;<?php _e( 'Place each Order Item within their own Order row', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label>
333
+ <p class="description"><?php _e( 'For example: An Order with 3 Order items will display a single Order item on each row', 'woocommerce-exporter' ); ?></p>
334
+ </li>
335
+ </ul>
336
+ <p class="description"><?php _e( 'Choose how you would like Order Items to be presented within Orders.', 'woocommerce-exporter' ); ?></p>
337
+ </td>
338
+ </tr>
339
+ <?php
340
+ ob_end_flush();
341
+
342
+ }
343
+
344
+ // HTML template for Max Order Items widget on Store Exporter screen
345
+ function woo_ce_orders_max_order_items() {
346
+
347
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
348
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
349
+
350
+ $max_size = 10;
351
+
352
+ ob_start(); ?>
353
+ <tr id="max_order_items_option" class="export-options order-options">
354
+ <th>
355
+ <label for="max_order_items"><?php _e( 'Max unique Order items', 'woocommerce-exporter' ); ?>: </label>
356
+ </th>
357
+ <td>
358
+ <input type="text" id="max_order_items" name="max_order_items" size="3" class="text" value="<?php echo esc_attr( $max_size ); ?>" disabled="disabled" /><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
359
+ <p class="description"><?php _e( 'Manage the number of Order Item colums displayed when the \'Place Order Items on individual cells within a single Order row\' Order items formatting option is selected.', 'woocommerce-exporter' ); ?></p>
360
+ </td>
361
+ </tr>
362
+ <?php
363
+ ob_end_flush();
364
+
365
+ }
366
+
367
+ // HTML template for Order Items Types on Store Exporter screen
368
+ function woo_ce_orders_items_types() {
369
+
370
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
371
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
372
+
373
+ $types = woo_ce_get_order_items_types();
374
+ $order_items_types = woo_ce_get_option( 'order_items_types', array() );
375
+ // Default to Line Item
376
+ if( empty( $order_items_types ) )
377
+ $order_items_types = array( 'line_item' );
378
+
379
+ ob_start(); ?>
380
+ <tr class="export-options order-options">
381
+ <th><label><?php _e( 'Order item types', 'woocommerce-exporter' ); ?></label></th>
382
+ <td>
383
+ <ul>
384
+ <?php foreach( $types as $key => $type ) { ?>
385
+ <li><label><input type="checkbox" name="order_items_types[<?php echo $key; ?>]" value="<?php echo $key; ?>" disabled="disabled" /> <?php echo ucfirst( $type ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
386
+ <?php } ?>
387
+ </ul>
388
+ <p class="description"><?php _e( 'Choose what Order Item types are included within the Orders export. Default is to include all Order Item types.', 'woocommerce-exporter' ); ?></p>
389
+ </td>
390
+ </tr>
391
+ <?php
392
+ ob_end_flush();
393
+
394
+ }
395
+
396
+ // HTML template for Filter Orders by Order Status widget on Store Exporter screen
397
+ function woo_ce_orders_filter_by_status() {
398
+
399
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
400
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
401
+
402
+ $order_statuses = woo_ce_get_order_statuses();
403
+
404
+ ob_start(); ?>
405
+ <p><label><input type="checkbox" id="orders-filters-status" /> <?php _e( 'Filter Orders by Order Status', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
406
+ <div id="export-orders-filters-status" class="separator">
407
+ <ul>
408
+ <li>
409
+ <?php if( !empty( $order_statuses ) ) { ?>
410
+ <select data-placeholder="<?php _e( 'Choose a Order Status...', 'woocommerce-exporter' ); ?>" name="order_filter_status[]" multiple class="chzn-select" style="width:95%;">
411
+ <?php foreach( $order_statuses as $order_status ) { ?>
412
+ <option value="<?php echo $order_status->slug; ?>"><?php echo ucfirst( $order_status->name ); ?> (<?php echo $order_status->count; ?>)</option>
413
+ <?php } ?>
414
+ </select>
415
+ <?php } else { ?>
416
+ <?php _e( 'No Order Status\'s were found.', 'woocommerce-exporter' ); ?>
417
+ <?php } ?>
418
+ </li>
419
+ </ul>
420
+ <p class="description"><?php _e( 'Select the Order Status you want to filter exported Orders by. Default is to include all Order Status options.', 'woocommerce-exporter' ); ?></p>
421
+ </div>
422
+ <!-- #export-orders-filters-status -->
423
+ <?php
424
+ ob_end_flush();
425
+
426
+ }
427
+
428
+ // HTML template for Filter Orders by Product widget on Store Exporter screen
429
+ function woo_ce_orders_filter_by_product() {
430
+
431
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
432
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
433
+
434
+ $args = array(
435
+ 'hide_empty' => 1
436
+ );
437
+ $products = woo_ce_get_products( $args );
438
+
439
+ ob_start(); ?>
440
+ <p><label><input type="checkbox" id="orders-filters-product" /> <?php _e( 'Filter Orders by Product', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
441
+ <div id="export-orders-filters-product" class="separator">
442
+ <ul>
443
+ <li>
444
+ <?php if( !empty( $products ) ) { ?>
445
+ <select data-placeholder="<?php _e( 'Choose a Product...', 'woocommerce-exporter' ); ?>" name="order_filter_product[]" multiple class="chzn-select" style="width:95%;">
446
+ <?php foreach( $products as $product ) { ?>
447
+ <option value="<?php echo $product; ?>" disabled="disabled"><?php echo get_the_title( $product ); ?> (<?php printf( __( 'SKU: %s', 'woocommerce-exporter' ), get_post_meta( $product, '_sku', true ) ); ?>)</option>
448
+ <?php } ?>
449
+ </select>
450
+ <?php } else { ?>
451
+ <?php _e( 'No Products were found.', 'woocommerce-exporter' ); ?>
452
+ <?php } ?>
453
+ </li>
454
+ </ul>
455
+ <p class="description"><?php _e( 'Select the Products you want to filter exported Orders by. Default is to include all Products.', 'woocommerce-exporter' ); ?></p>
456
+ </div>
457
+ <!-- #export-orders-filters-product -->
458
+ <?php
459
+ ob_end_flush();
460
+
461
+ }
462
+
463
+ // HTML template for Filter Orders by Product Category widget on Store Exporter screen
464
+ function woo_ce_orders_filter_by_product_category() {
465
+
466
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
467
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
468
+
469
+ $args = array(
470
+ 'hide_empty' => 1
471
+ );
472
+ $product_categories = woo_ce_get_product_categories( $args );
473
+
474
+ ob_start(); ?>
475
+ <p><label><input type="checkbox" id="orders-filters-category" /> <?php _e( 'Filter Orders by Product Category', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
476
+ <div id="export-orders-filters-category" class="separator">
477
+ <ul>
478
+ <li>
479
+ <?php if( !empty( $product_categories ) ) { ?>
480
+ <select data-placeholder="<?php _e( 'Choose a Product Category...', 'woocommerce-exporter' ); ?>" name="order_filter_category[]" multiple class="chzn-select" style="width:95%;">
481
+ <?php foreach( $product_categories as $product_category ) { ?>
482
+ <option value="<?php echo $product_category->term_id; ?>"><?php echo woo_ce_format_product_category_label( $product_category->name, $product_category->parent_name ); ?> (<?php printf( __( 'Term ID: %d', 'woocommerce-exporter' ), $product_category->term_id ); ?>)</option>
483
+ <?php } ?>
484
+ </select>
485
+ <?php } else { ?>
486
+ <?php _e( 'No Product Categories were found.', 'woocommerce-exporter' ); ?>
487
+ <?php } ?>
488
+ </li>
489
+ </ul>
490
+ <p class="description"><?php _e( 'Select the Product Categories you want to filter exported Orders by. Default is to include all Product Categories.', 'woocommerce-exporter' ); ?></p>
491
+ </div>
492
+ <!-- #export-orders-filters-category -->
493
+ <?php
494
+ ob_end_flush();
495
+
496
+ }
497
+
498
+ // HTML template for Filter Orders by Product Tag widget on Store Exporter screen
499
+ function woo_ce_orders_filter_by_product_tag() {
500
+
501
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
502
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
503
+
504
+ $args = array(
505
+ 'hide_empty' => 1
506
+ );
507
+ $product_tags = woo_ce_get_product_tags( $args );
508
+
509
+ ob_start(); ?>
510
+ <p><label><input type="checkbox" id="orders-filters-tag" /> <?php _e( 'Filter Orders by Product Tag', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
511
+ <div id="export-orders-filters-tag" class="separator">
512
+ <ul>
513
+ <li>
514
+ <?php if( !empty( $product_tags ) ) { ?>
515
+ <select data-placeholder="<?php _e( 'Choose a Product Tag...', 'woocommerce-exporter' ); ?>" name="order_filter_tag[]" multiple class="chzn-select" style="width:95%;">
516
+ <?php foreach( $product_tags as $product_tag ) { ?>
517
+ <option value="<?php echo $product_tag->term_id; ?>"><?php echo $product_tag->name; ?> (<?php printf( __( 'Term ID: %d', 'woocommerce-exporter' ), $product_tag->term_id ); ?>)</option>
518
+ <?php } ?>
519
+ </select>
520
+ <?php } else { ?>
521
+ <?php _e( 'No Product Tags were found.', 'woocommerce-exporter' ); ?>
522
+ <?php } ?>
523
+ </li>
524
+ </ul>
525
+ <p class="description"><?php _e( 'Select the Product Tags you want to filter exported Orders by. Default is to include all Product Tags.', 'woocommerce-exporter' ); ?></p>
526
+ </div>
527
+ <!-- #export-orders-filters-tag -->
528
+ <?php
529
+ ob_end_flush();
530
+
531
+ }
532
+
533
+ // HTML template for Filter Orders by Brand widget on Store Exporter screen
534
+ function woo_ce_orders_filter_by_product_brand() {
535
+
536
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
537
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
538
+
539
+ // WooCommerce Brands Addon - http://woothemes.com/woocommerce/
540
+ // WooCommerce Brands - http://proword.net/Woocommerce_Brands/
541
+ if( woo_ce_detect_product_brands() == false )
542
+ return;
543
+
544
+ $args = array(
545
+ 'hide_empty' => 1
546
+ );
547
+ $product_brands = woo_ce_get_product_brands( $args );
548
+
549
+ ob_start(); ?>
550
+ <p><label><input type="checkbox" id="orders-filters-brand" /> <?php _e( 'Filter Orders by Product Brand', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
551
+ <div id="export-orders-filters-brand" class="separator">
552
+ <ul>
553
+ <li>
554
+ <?php if( !empty( $product_brands ) ) { ?>
555
+ <select data-placeholder="<?php _e( 'Choose a Product Category...', 'woocommerce-exporter' ); ?>" name="order_filter_brand[]" multiple class="chzn-select" style="width:95%;">
556
+ <?php foreach( $product_brands as $product_brand ) { ?>
557
+ <option value="<?php echo $product_brand->term_id; ?>"><?php echo woo_ce_format_product_category_label( $product_brand->name, $product_brand->parent_name ); ?> (<?php printf( __( 'Term ID: %d', 'woocommerce-exporter' ), $product_brand->term_id ); ?>)</option>
558
+ <?php } ?>
559
+ </select>
560
+ <?php } else { ?>
561
+ <?php _e( 'No Product Brands were found.', 'woocommerce-exporter' ); ?>
562
+ <?php } ?>
563
+ </li>
564
+ </ul>
565
+ <p class="description"><?php _e( 'Select the Product Brands you want to filter exported Orders by. Default is to include all Product Brands.', 'woocommerce-exporter' ); ?></p>
566
+ </div>
567
+ <!-- #export-orders-filters-brand -->
568
+ <?php
569
+ ob_end_flush();
570
+
571
+ }
572
+
573
+ // HTML template for Order Sorting widget on Store Exporter screen
574
+ function woo_ce_order_sorting() {
575
+
576
+ ob_start(); ?>
577
+ <p><label><?php _e( 'Order Sorting', 'woocommerce-exporter' ); ?></label></p>
578
+ <div>
579
+ <select name="order_orderby" disabled="disabled">
580
+ <option value="ID"><?php _e( 'Order ID', 'woocommerce-exporter' ); ?></option>
581
+ <option value="title"><?php _e( 'Order Name', 'woocommerce-exporter' ); ?></option>
582
+ <option value="date"><?php _e( 'Date Created', 'woocommerce-exporter' ); ?></option>
583
+ <option value="modified"><?php _e( 'Date Modified', 'woocommerce-exporter' ); ?></option>
584
+ <option value="rand"><?php _e( 'Random', 'woocommerce-exporter' ); ?></option>
585
+ </select>
586
+ <select name="order_order" disabled="disabled">
587
+ <option value="ASC"><?php _e( 'Ascending', 'woocommerce-exporter' ); ?></option>
588
+ <option value="DESC"><?php _e( 'Descending', 'woocommerce-exporter' ); ?></option>
589
+ </select>
590
+ <p class="description"><?php _e( 'Select the sorting of Orders within the exported file. By default this is set to export Orders by Order ID in Desending order.', 'woocommerce-exporter' ); ?></p>
591
+ </div>
592
+ <?php
593
+ ob_end_flush();
594
+
595
+ }
596
+
597
+ // HTML template for Custom Orders widget on Store Exporter screen
598
+ function woo_ce_orders_custom_fields() {
599
+
600
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
601
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
602
+
603
+ $custom_orders = '-';
604
+ $custom_order_items = '-';
605
+
606
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/';
607
+
608
+ ob_start(); ?>
609
+ <form method="post" id="export-orders-custom-fields" class="export-options order-options">
610
+ <div id="poststuff">
611
+
612
+ <div class="postbox" id="export-options">
613
+ <h3 class="hndle"><?php _e( 'Custom Order Fields', 'woocommerce-exporter' ); ?></h3>
614
+ <div class="inside">
615
+ <p class="description"><?php _e( 'To include additional custom Order and Order Item meta in the Export Orders table above fill the Orders and Order Items text box then click Save Custom Fields.', 'woocommerce-exporter' ); ?></p>
616
+ <table class="form-table">
617
+
618
+ <tr>
619
+ <th>
620
+ <label><?php _e( 'Order meta', 'woocommerce-exporter' ); ?></label>
621
+ </th>
622
+ <td>
623
+ <textarea name="custom_orders" rows="5" cols="70" disabled="disabled"><?php echo esc_textarea( $custom_orders ); ?></textarea>
624
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
625
+ <p class="description"><?php _e( 'Include additional custom Order meta in your export file by adding each custom Order meta name to a new line above.<br />For example: <code>Customer UA, Customer IP Address</code>', 'woocommerce-exporter' ); ?></p>
626
+ </td>
627
+ </tr>
628
+
629
+ <tr>
630
+ <th>
631
+ <label><?php _e( 'Order Item meta', 'woocommerce-exporter' ); ?></label>
632
+ </th>
633
+ <td>
634
+ <textarea name="custom_order_items" rows="5" cols="70" disabled="disabled"><?php echo esc_textarea( $custom_order_items ); ?></textarea>
635
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
636
+ <p class="description"><?php _e( 'Include additional custom Order Item meta in your export file by adding each custom Order Item meta name to a new line above.<br />For example: <code>Personalized Message</code>.', 'woocommerce-exporter' ); ?></p>
637
+ </td>
638
+ </tr>
639
+
640
+ </table>
641
+ <p class="submit">
642
+ <input type="button" class="button button-disabled" value="<?php _e( 'Save Custom Fields', 'woocommerce-exporter' ); ?>" />
643
+ </p>
644
+ <p class="description"><?php printf( __( 'For more information on custom Order and Order Item meta consult our <a href="%s" target="_blank">online documentation</a>.', 'woocommerce-exporter' ), $troubleshooting_url ); ?></p>
645
+ </div>
646
+ <!-- .inside -->
647
+ </div>
648
+ <!-- .postbox -->
649
+
650
+ </div>
651
+ <!-- #poststuff -->
652
+ <input type="hidden" name="action" value="update" />
653
+ </form>
654
+ <!-- #export-orders-custom-fields -->
655
+ <?php
656
+ ob_end_flush();
657
+
658
+ }
659
+
660
+ /* End of: WordPress Administration */
661
+
662
+ }
663
+ ?>
includes/admin/product.php ADDED
@@ -0,0 +1,390 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for Filter Products by Product Category widget on Store Exporter screen
7
+ function woo_ce_products_filter_by_product_category() {
8
+
9
+ $args = array(
10
+ 'hide_empty' => 1
11
+ );
12
+ $product_categories = woo_ce_get_product_categories( $args );
13
+
14
+ ob_start(); ?>
15
+ <p><label><input type="checkbox" id="products-filters-categories" /> <?php _e( 'Filter Products by Product Category', 'woocommerce-exporter' ); ?></label></p>
16
+ <div id="export-products-filters-categories" class="separator">
17
+ <ul>
18
+ <li>
19
+ <?php if( !empty( $product_categories ) ) { ?>
20
+ <select data-placeholder="<?php _e( 'Choose a Product Category...', 'woocommerce-exporter' ); ?>" name="product_filter_category[]" multiple class="chzn-select" style="width:95%;">
21
+ <?php foreach( $product_categories as $product_category ) { ?>
22
+ <option value="<?php echo $product_category->term_id; ?>"<?php disabled( $product_category->count, 0 ); ?>><?php echo woo_ce_format_product_category_label( $product_category->name, $product_category->parent_name ); ?> (<?php printf( __( 'Term ID: %d', 'woocommerce-exporter' ), $product_category->term_id ); ?>)</option>
23
+ <?php } ?>
24
+ </select>
25
+ <?php } else { ?>
26
+ <?php _e( 'No Product Categories were found.', 'woocommerce-exporter' ); ?></li>
27
+ <?php } ?>
28
+ </li>
29
+ </ul>
30
+ <p class="description"><?php _e( 'Select the Product Categories you want to filter exported Products by. Product Categories not assigned to Products are hidden from view. Default is to include all Product Categories.', 'woocommerce-exporter' ); ?></p>
31
+ </div>
32
+ <!-- #export-products-filters-categories -->
33
+ <?php
34
+ ob_end_flush();
35
+
36
+ }
37
+
38
+ // HTML template for Filter Products by Product Tag widget on Store Exporter screen
39
+ function woo_ce_products_filter_by_product_tag() {
40
+
41
+ $args = array(
42
+ 'hide_empty' => 1
43
+ );
44
+ $product_tags = woo_ce_get_product_tags( $args );
45
+
46
+ ob_start(); ?>
47
+ <p><label><input type="checkbox" id="products-filters-tags" /> <?php _e( 'Filter Products by Product Tag', 'woocommerce-exporter' ); ?></label></p>
48
+ <div id="export-products-filters-tags" class="separator">
49
+ <ul>
50
+ <li>
51
+ <?php if( !empty( $product_tags ) ) { ?>
52
+ <select data-placeholder="<?php _e( 'Choose a Product Tag...', 'woocommerce-exporter' ); ?>" name="product_filter_tag[]" multiple class="chzn-select" style="width:95%;">
53
+ <?php foreach( $product_tags as $product_tag ) { ?>
54
+ <option value="<?php echo $product_tag->term_id; ?>"<?php disabled( $product_tag->count, 0 ); ?>><?php echo $product_tag->name; ?> (<?php printf( __( 'Term ID: %d', 'woocommerce-exporter' ), $product_tag->term_id ); ?>)</option>
55
+ <?php } ?>
56
+ </select>
57
+ <?php } else { ?>
58
+ <?php _e( 'No Product Tags were found.', 'woocommerce-exporter' ); ?></li>
59
+ <?php } ?>
60
+ </li>
61
+ </ul>
62
+ <p class="description"><?php _e( 'Select the Product Tags you want to filter exported Products by. Product Tags not assigned to Products are hidden from view. Default is to include all Product Tags.', 'woocommerce-exporter' ); ?></p>
63
+ </div>
64
+ <!-- #export-products-filters-tags -->
65
+ <?php
66
+ ob_end_flush();
67
+
68
+ }
69
+
70
+ // HTML template for Filter Products by Product Brand widget on Store Exporter screen
71
+ function woo_ce_products_filter_by_product_brand() {
72
+
73
+ // Check if Brands is available
74
+ if( woo_ce_detect_product_brands() == false )
75
+ return;
76
+
77
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
78
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
79
+
80
+ $args = array(
81
+ 'hide_empty' => 1,
82
+ 'orderby' => 'term_group'
83
+ );
84
+ $product_brands = woo_ce_get_product_brands( $args );
85
+
86
+ ob_start(); ?>
87
+ <p><label><input type="checkbox" id="products-filters-brands" /> <?php _e( 'Filter Products by Product Brands', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
88
+ <div id="export-products-filters-brands" class="separator">
89
+ <ul>
90
+ <li>
91
+ <?php if( !empty( $product_brands ) ) { ?>
92
+ <select data-placeholder="<?php _e( 'Choose a Product Brand...', 'woocommerce-exporter' ); ?>" name="product_filter_brand[]" multiple class="chzn-select" style="width:95%;">
93
+ <?php foreach( $product_brands as $product_brand ) { ?>
94
+ <option value="<?php echo $product_brand->term_id; ?>"<?php disabled( $product_brand->count, 0 ); ?>><?php echo woo_ce_format_product_category_label( $product_brand->name, $product_brand->parent_name ); ?> (<?php printf( __( 'Term ID: %d', 'woocommerce-exporter' ), $product_brand->term_id ); ?>)</option>
95
+ <?php } ?>
96
+ </select>
97
+ <?php } else { ?>
98
+ <?php _e( 'No Product Brands were found.', 'woocommerce-exporter' ); ?>
99
+ <?php } ?>
100
+ </li>
101
+ </ul>
102
+ <p class="description"><?php _e( 'Select the Product Brands you want to filter exported Products by. Default is to include all Product Brands.', 'woocommerce-exporter' ); ?></p>
103
+ </div>
104
+ <!-- #export-products-filters-brands -->
105
+ <?php
106
+ ob_end_flush();
107
+
108
+ }
109
+
110
+ // HTML template for Filter Products by Product Vendor widget on Store Exporter screen
111
+ function woo_ce_products_filter_by_product_vendor() {
112
+
113
+ if( class_exists( 'WooCommerce_Product_Vendors' ) == false )
114
+ return;
115
+
116
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
117
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
118
+
119
+ $args = array(
120
+ 'hide_empty' => 1
121
+ );
122
+ $product_vendors = woo_ce_get_product_vendors( $args, 'full' );
123
+
124
+ ob_start(); ?>
125
+ <p><label><input type="checkbox" id="products-filters-vendors" /> <?php _e( 'Filter Products by Product Vendors', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
126
+ <div id="export-products-filters-vendors" class="separator">
127
+ <?php if( $product_vendors ) { ?>
128
+ <ul>
129
+ <?php foreach( $product_vendors as $product_vendor ) { ?>
130
+ <li>
131
+ <label><input type="checkbox" name="product_filter_vendor[<?php echo $product_vendor->term_id; ?>]" value="<?php echo $product_vendor->term_id; ?>" title="<?php printf( __( 'Term ID: %d', 'woocommerce-exporter' ), $product_vendor->term_id ); ?>"<?php disabled( $product_vendor->count, 0 ); ?> disabled="disabled" /> <?php echo $product_vendor->name; ?></label>
132
+ <span class="description">(<?php echo $product_vendor->count; ?>)</span>
133
+ </li>
134
+ <?php } ?>
135
+ </ul>
136
+ <p class="description"><?php _e( 'Select the Product Vendors you want to filter exported Products by. Default is to include all Product Vendors.', 'woocommerce-exporter' ); ?></p>
137
+ <?php } else { ?>
138
+ <p><?php _e( 'No Product Vendors were found.', 'woocommerce-exporter' ); ?></p>
139
+ <?php } ?>
140
+ </div>
141
+ <!-- #export-products-filters-vendors -->
142
+ <?php
143
+ ob_end_flush();
144
+
145
+ }
146
+
147
+ // HTML template for Filter Products by Product Status widget on Store Exporter screen
148
+ function woo_ce_products_filter_by_product_status() {
149
+
150
+ $product_statuses = get_post_statuses();
151
+ if( !isset( $product_statuses['trash'] ) )
152
+ $product_statuses['trash'] = __( 'Trash', 'woocommerce-exporter' );
153
+
154
+ ob_start(); ?>
155
+ <p><label><input type="checkbox" id="products-filters-status" /> <?php _e( 'Filter Products by Product Status', 'woocommerce-exporter' ); ?></label></p>
156
+ <div id="export-products-filters-status" class="separator">
157
+ <ul>
158
+ <li>
159
+ <?php if( !empty( $product_statuses ) ) { ?>
160
+ <select data-placeholder="<?php _e( 'Choose a Product Status...', 'woocommerce-exporter' ); ?>" name="product_filter_status[]" multiple class="chzn-select" style="width:95%;">
161
+ <?php foreach( $product_statuses as $key => $product_status ) { ?>
162
+ <option value="<?php echo $key; ?>"><?php echo $product_status; ?></option>
163
+ <?php } ?>
164
+ </select>
165
+ <?php } else { ?>
166
+ <?php _e( 'No Product Status were found.', 'woocommerce-exporter' ); ?></li>
167
+ <?php } ?>
168
+ </li>
169
+ </ul>
170
+ <p class="description"><?php _e( 'Select the Product Status options you want to filter exported Products by. Default is to include all Product Status options.', 'woocommerce-exporter' ); ?></p>
171
+ </div>
172
+ <!-- #export-products-filters-status -->
173
+ <?php
174
+ ob_end_flush();
175
+
176
+ }
177
+
178
+ // HTML template for Filter Products by Product Type widget on Store Exporter screen
179
+ function woo_ce_products_filter_by_product_type() {
180
+
181
+ $product_types = woo_ce_get_product_types();
182
+
183
+ ob_start(); ?>
184
+ <p><label><input type="checkbox" id="products-filters-type" /> <?php _e( 'Filter Products by Product Type', 'woocommerce-exporter' ); ?></label></p>
185
+ <div id="export-products-filters-type" class="separator">
186
+ <ul>
187
+ <li>
188
+ <?php if( !empty( $product_types ) ) { ?>
189
+ <select data-placeholder="<?php _e( 'Choose a Product Type...', 'woocommerce-exporter' ); ?>" name="product_filter_type[]" multiple class="chzn-select" style="width:95%;">
190
+ <?php foreach( $product_types as $key => $product_type ) { ?>
191
+ <option value="<?php echo $key; ?>"><?php echo woo_ce_format_product_type( $product_type['name'] ); ?> (<?php echo $product_type['count']; ?>)</option>
192
+ <?php } ?>
193
+ </select>
194
+ <?php } else { ?>
195
+ <?php _e( 'No Product Types were found.', 'woocommerce-exporter' ); ?></li>
196
+ <?php } ?>
197
+ </li>
198
+ </ul>
199
+ <p class="description"><?php _e( 'Select the Product Type\'s you want to filter exported Products by. Default is to include all Product Types and Variations.', 'woocommerce-exporter' ); ?></p>
200
+ </div>
201
+ <!-- #export-products-filters-type -->
202
+ <?php
203
+ ob_end_flush();
204
+
205
+ }
206
+
207
+ // HTML template for Filter Products by Product Type widget on Store Exporter screen
208
+ function woo_ce_products_filter_by_stock_status() {
209
+
210
+ // Store Exporter Deluxe
211
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
212
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
213
+
214
+ ob_start(); ?>
215
+ <p><label><input type="checkbox" id="products-filters-stock" /> <?php _e( 'Filter Products by Stock Status', 'woocommerce-exporter' ); ?></label></p>
216
+ <div id="export-products-filters-stock" class="separator">
217
+ <ul>
218
+ <li value=""><label><input type="radio" name="product_filter_stock" value="" checked="checked" /><?php _e( 'Include both', 'woocommerce-exporter' ); ?></label></li>
219
+ <li value="instock"><label><input type="radio" name="product_filter_stock" value="instock" disabled="disabled" /><?php _e( 'In stock', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
220
+ <li value="outofstock"><label><input type="radio" name="product_filter_stock" value="outofstock" disabled="disabled" /><?php _e( 'Out of stock', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
221
+ </ul>
222
+ <p class="description"><?php _e( 'Select the Stock Status\'s you want to filter exported Products by. Default is to include all Stock Status\'s.', 'woocommerce-exporter' ); ?></p>
223
+ </div>
224
+ <!-- #export-products-filters-stock -->
225
+ <?php
226
+ ob_end_flush();
227
+
228
+ }
229
+
230
+ // HTML template for Product Sorting widget on Store Exporter screen
231
+ function woo_ce_product_sorting() {
232
+
233
+ $product_orderby = woo_ce_get_option( 'product_orderby', 'ID' );
234
+ $product_order = woo_ce_get_option( 'product_order', 'DESC' );
235
+
236
+ ob_start(); ?>
237
+ <p><label><?php _e( 'Product Sorting', 'woocommerce-exporter' ); ?></label></p>
238
+ <div>
239
+ <select name="product_orderby">
240
+ <option value="ID"<?php selected( 'ID', $product_orderby ); ?>><?php _e( 'Product ID', 'woocommerce-exporter' ); ?></option>
241
+ <option value="title"<?php selected( 'title', $product_orderby ); ?>><?php _e( 'Product Name', 'woocommerce-exporter' ); ?></option>
242
+ <option value="sku"<?php selected( 'sku', $product_orderby ); ?>><?php _e( 'Product SKU', 'woocommerce-exporter' ); ?></option>
243
+ <option value="date"<?php selected( 'date', $product_orderby ); ?>><?php _e( 'Date Created', 'woocommerce-exporter' ); ?></option>
244
+ <option value="modified"<?php selected( 'modified', $product_orderby ); ?>><?php _e( 'Date Modified', 'woocommerce-exporter' ); ?></option>
245
+ <option value="rand"<?php selected( 'rand', $product_orderby ); ?>><?php _e( 'Random', 'woocommerce-exporter' ); ?></option>
246
+ <option value="menu_order"<?php selected( 'menu_order', $product_orderby ); ?>><?php _e( 'Sort Order', 'woocommerce-exporter' ); ?></option>
247
+ </select>
248
+ <select name="product_order">
249
+ <option value="ASC"<?php selected( 'ASC', $product_order ); ?>><?php _e( 'Ascending', 'woocommerce-exporter' ); ?></option>
250
+ <option value="DESC"<?php selected( 'DESC', $product_order ); ?>><?php _e( 'Descending', 'woocommerce-exporter' ); ?></option>
251
+ </select>
252
+ <p class="description"><?php _e( 'Select the sorting of Products within the exported file. By default this is set to export Products by Product ID in Desending order.', 'woocommerce-exporter' ); ?></p>
253
+ </div>
254
+ <?php
255
+ ob_end_flush();
256
+
257
+ }
258
+
259
+ // HTML template for Up-sells formatting on Store Exporter screen
260
+ function woo_ce_products_upsells_formatting() {
261
+
262
+ $upsell_formatting = woo_ce_get_option( 'upsell_formatting', 1 );
263
+
264
+ ob_start(); ?>
265
+ <tr class="export-options product-options">
266
+ <th><label for=""><?php _e( 'Up-sells formatting', 'woocommerce-exporter' ); ?></label></th>
267
+ <td>
268
+ <label><input type="radio" name="product_upsell_formatting" value="0"<?php checked( $upsell_formatting, 0 ); ?> />&nbsp;<?php _e( 'Export Up-Sells as Product ID', 'woocommerce-exporter' ); ?></label><br />
269
+ <label><input type="radio" name="product_upsell_formatting" value="1"<?php checked( $upsell_formatting, 1 ); ?> />&nbsp;<?php _e( 'Export Up-Sells as Product SKU', 'woocommerce-exporter' ); ?></label>
270
+ <p class="description"><?php _e( 'Choose the up-sell formatting that is accepted by your WooCommerce import Plugin (e.g. Product Importer Deluxe, Product Import Suite, etc.).', 'woocommerce-exporter' ); ?></p>
271
+ </td>
272
+ </tr>
273
+
274
+ <?php
275
+ ob_end_flush();
276
+
277
+ }
278
+
279
+ // HTML template for Cross-sells formatting on Store Exporter screen
280
+ function woo_ce_products_crosssells_formatting() {
281
+
282
+ $crosssell_formatting = woo_ce_get_option( 'crosssell_formatting', 1 );
283
+
284
+ ob_start(); ?>
285
+ <tr class="export-options product-options">
286
+ <th><label for=""><?php _e( 'Cross-sells formatting', 'woocommerce-exporter' ); ?></label></th>
287
+ <td>
288
+ <label><input type="radio" name="product_crosssell_formatting" value="0"<?php checked( $crosssell_formatting, 0 ); ?> />&nbsp;<?php _e( 'Export Cross-Sells as Product ID', 'woocommerce-exporter' ); ?></label><br />
289
+ <label><input type="radio" name="product_crosssell_formatting" value="1"<?php checked( $crosssell_formatting, 1 ); ?> />&nbsp;<?php _e( 'Export Cross-Sells as Product SKU', 'woocommerce-exporter' ); ?></label>
290
+ <p class="description"><?php _e( 'Choose the cross-sell formatting that is accepted by your WooCommerce import Plugin (e.g. Product Importer Deluxe, Product Import Suite, etc.).', 'woocommerce-exporter' ); ?></p>
291
+ </td>
292
+ </tr>
293
+
294
+ <?php
295
+ ob_end_flush();
296
+
297
+ }
298
+
299
+ // HTML template for Custom Products widget on Store Exporter screen
300
+ function woo_ce_products_custom_fields() {
301
+
302
+ // Store Exporter Deluxe
303
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
304
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
305
+
306
+ if( $custom_products = woo_ce_get_option( 'custom_products', '' ) )
307
+ $custom_products = implode( "\n", $custom_products );
308
+ $custom_attributes = '';
309
+
310
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/';
311
+
312
+ ob_start(); ?>
313
+ <form method="post" id="export-products-custom-fields" class="export-options product-options">
314
+ <div id="poststuff">
315
+
316
+ <div class="postbox" id="export-options product-options">
317
+ <h3 class="hndle"><?php _e( 'Custom Product Fields', 'woocommerce-exporter' ); ?></h3>
318
+ <div class="inside">
319
+ <p class="description"><?php _e( 'To include additional custom Product meta or custom Attributes in the Export Products table above fill the meta text box then click Save Custom Fields.', 'woocommerce-exporter' ); ?></p>
320
+ <table class="form-table">
321
+
322
+ <tr>
323
+ <th>
324
+ <label><?php _e( 'Product meta', 'woocommerce-exporter' ); ?></label>
325
+ </th>
326
+ <td>
327
+ <textarea name="custom_products" rows="5" cols="70"><?php echo esc_textarea( $custom_products ); ?></textarea>
328
+ <p class="description"><?php _e( 'Include additional custom Product meta in your export file by adding each custom Product meta name to a new line above.<br />For example: <code>Customer UA</code> (new line) <code>Customer IP Address</code>', 'woocommerce-exporter' ); ?></p>
329
+ </td>
330
+ </tr>
331
+
332
+ <tr>
333
+ <th>
334
+ <label><?php _e( 'Custom attribute', 'woocommerce-exporter' ); ?></label>
335
+ </th>
336
+ <td>
337
+ <textarea name="custom_attributes" rows="5" cols="70" disabled="disabled"><?php echo esc_textarea( $custom_attributes ); ?></textarea><br /><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
338
+ <p class="description"><?php _e( 'Include custom Attributes in your export file by adding each custom Attribute name to a new line above.<br />For example: <code>condition</code> (new line) <code>colour</code>', 'woocommerce-exporter' ); ?></p>
339
+ </td>
340
+ </tr>
341
+
342
+ <?php do_action( 'woo_ce_products_custom_fields' ); ?>
343
+
344
+ </table>
345
+ <p class="submit">
346
+ <input type="submit" value="<?php _e( 'Save Custom Fields', 'woocommerce-exporter' ); ?>" class="button" />
347
+ </p>
348
+ <p class="description"><?php printf( __( 'For more information on custom Product meta and Attributes consult our <a href="%s" target="_blank">online documentation</a>.', 'woocommerce-exporter' ), $troubleshooting_url ); ?></p>
349
+ </div>
350
+ <!-- .inside -->
351
+ </div>
352
+ <!-- .postbox -->
353
+
354
+ </div>
355
+ <!-- #poststuff -->
356
+ <input type="hidden" name="action" value="update" />
357
+ </form>
358
+ <!-- #export-products-custom-fields -->
359
+ <?php
360
+ ob_end_flush();
361
+
362
+ }
363
+
364
+ function woo_ce_export_options_gallery_format() {
365
+
366
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
367
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
368
+
369
+ ob_start(); ?>
370
+ <tr class="export-options product-options">
371
+ <th><label for=""><?php _e( 'Product gallery formatting', 'woocommerce-exporter' ); ?></label></th>
372
+ <td>
373
+ <label><input type="radio" name="product_gallery_formatting" value="0"<?php checked( 0, 0 ); ?> />&nbsp;<?php _e( 'Export Product Gallery as Attachment ID', 'woocommerce-exporter' ); ?></label><br />
374
+ <label><input type="radio" name="product_gallery_formatting" value="1" disabled="disabled" />&nbsp;<?php _e( 'Export Product Gallery as Image URL', 'woocommerce-exporter' ); ?> <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label><br />
375
+ <label><input type="radio" name="product_gallery_formatting" value="2" disabled="disabled" />&nbsp;<?php _e( 'Export Product Gallery as Image filepath', 'woocommerce-exporter' ); ?> <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label>
376
+ <hr />
377
+ <label><input type="radio" name="product_gallery_unique" value="0"<?php checked( 0, 0 ); ?> />&nbsp;<?php _e( 'Export Product Gallery as a single combined image cell', 'woocommerce-exporter' ); ?></label><br />
378
+ <label><input type="radio" name="product_gallery_unique" value="1" disabled="disabled" />&nbsp;<?php _e( 'Export Product Gallery as individual image cells', 'woocommerce-exporter' ); ?> <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label>
379
+ <p class="description"><?php _e( 'Choose the product gallery formatting that is accepted by your WooCommerce import Plugin (e.g. Product Importer Deluxe, Product Import Suite, etc.).', 'woocommerce-exporter' ); ?></p>
380
+ </td>
381
+ </tr>
382
+ <?php
383
+ ob_end_flush();
384
+
385
+ }
386
+
387
+ /* End of: WordPress Administration */
388
+
389
+ }
390
+ ?>
includes/admin/shipping_class.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for disabled Shipping Class Sorting widget on Store Exporter screen
7
+ function woo_ce_shipping_class_sorting() {
8
+
9
+ $shipping_class_orderby = 'ID';
10
+ $shipping_class_order = 'DESC';
11
+
12
+ ob_start(); ?>
13
+ <p><label><?php _e( 'Shipping Class Sorting', 'woo_ce' ); ?></label></p>
14
+ <div>
15
+ <select name="shipping_class_orderby" disabled="disabled">
16
+ <option value="id"<?php selected( 'id', $shipping_class_orderby ); ?>><?php _e( 'Term ID', 'woo_ce' ); ?></option>
17
+ <option value="name"<?php selected( 'name', $shipping_class_orderby ); ?>><?php _e( 'Shipping Class Name', 'woo_ce' ); ?></option>
18
+ </select>
19
+ <select name="shipping_class_order" disabled="disabled">
20
+ <option value="ASC"<?php selected( 'ASC', $shipping_class_order ); ?>><?php _e( 'Ascending', 'woo_ce' ); ?></option>
21
+ <option value="DESC"<?php selected( 'DESC', $shipping_class_order ); ?>><?php _e( 'Descending', 'woo_ce' ); ?></option>
22
+ </select>
23
+ <p class="description"><?php _e( 'Select the sorting of Shipping Classes within the exported file. By default this is set to export Shipping Classes by Term ID in Desending order.', 'woo_ce' ); ?></p>
24
+ </div>
25
+ <?php
26
+ ob_end_flush();
27
+
28
+ }
29
+
30
+ /* End of: WordPress Administration */
31
+
32
+ }
33
+ ?>
includes/admin/subscription.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for Filter Subscriptions by Subscription Status widget on Store Exporter screen
7
+ function woo_ce_subscriptions_filter_by_subscription_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
+ $subscription_statuses = woo_ce_get_subscription_statuses();
13
+
14
+ ob_start(); ?>
15
+ <p><label><input type="checkbox" id="subscriptions-filters-status" /> <?php _e( 'Filter Subscriptions by Subscription Status', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
16
+ <div id="export-subscriptions-filters-status" class="separator">
17
+ <ul>
18
+ <li>
19
+ <?php if( !empty( $subscription_statuses ) ) { ?>
20
+ <select data-placeholder="<?php _e( 'Choose a Subscription Status...', 'woocommerce-exporter' ); ?>" name="subscription_filter_status[]" multiple class="chzn-select" style="width:95%;">
21
+ <?php foreach( $subscription_statuses as $key => $subscription_status ) { ?>
22
+ <option value="<?php echo $key; ?>"><?php echo $subscription_status; ?></option>
23
+ <?php } ?>
24
+ </select>
25
+ <?php } else { ?>
26
+ <?php _e( 'No Subscription Status\'s have been found.', 'woocommerce-exporter' ); ?>
27
+ <?php } ?>
28
+ </li>
29
+ </ul>
30
+ <p class="description"><?php _e( 'Select the Subscription Status options you want to filter exported Subscriptions by. Default is to include all Subscription Status options.', 'woocommerce-exporter' ); ?></p>
31
+ </div>
32
+ <!-- #export-subscriptions-filters-status -->
33
+ <?php
34
+ ob_end_flush();
35
+
36
+ }
37
+
38
+ // HTML template for Filter Subscriptions by Subscription Product widget on Store Exporter screen
39
+ function woo_ce_subscriptions_filter_by_subscription_product() {
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
+ $products = woo_ce_get_subscription_products();
45
+
46
+ ob_start(); ?>
47
+ <p><label><input type="checkbox" id="subscriptions-filters-product" /> <?php _e( 'Filter Subscriptions by Subscription Product', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
48
+ <div id="export-subscriptions-filters-product" class="separator">
49
+ <ul>
50
+ <li>
51
+ <?php if( !empty( $products ) ) { ?>
52
+ <select data-placeholder="<?php _e( 'Choose a Subscription Product...', 'woocommerce-exporter' ); ?>" name="subscription_filter_product[]" multiple class="chzn-select" style="width:95%;">
53
+ <?php foreach( $products as $product ) { ?>
54
+ <option value="<?php echo $product; ?>"><?php echo get_the_title( $product ); ?> (<?php printf( __( 'SKU: %s', 'woocommerce-exporter' ), get_post_meta( $product, '_sku', true ) ); ?>)</option>
55
+ <?php } ?>
56
+ </select>
57
+ <?php } else { ?>
58
+ <?php _e( 'No Subscription Products were found.', 'woocommerce-exporter' ); ?>
59
+ <?php } ?>
60
+ </li>
61
+ </ul>
62
+ <p class="description"><?php _e( 'Select the Subscription Product you want to filter exported Subscriptions by. Default is to include all Subscription Products.', 'woocommerce-exporter' ); ?></p>
63
+ </div>
64
+ <!-- #export-subscriptions-filters-status -->
65
+ <?php
66
+ ob_end_flush();
67
+
68
+ }
69
+
70
+ /* End of: WordPress Administration */
71
+
72
+ }
73
+ ?>
includes/admin/tag.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for Tag Sorting widget on Store Exporter screen
7
+ function woo_ce_tag_sorting() {
8
+
9
+ $tag_orderby = woo_ce_get_option( 'tag_orderby', 'ID' );
10
+ $tag_order = woo_ce_get_option( 'tag_order', 'DESC' );
11
+
12
+ ob_start(); ?>
13
+ <p><label><?php _e( 'Product Tag Sorting', 'woocommerce-exporter' ); ?></label></p>
14
+ <div>
15
+ <select name="tag_orderby">
16
+ <option value="id"<?php selected( 'id', $tag_orderby ); ?>><?php _e( 'Term ID', 'woocommerce-exporter' ); ?></option>
17
+ <option value="name"<?php selected( 'name', $tag_orderby ); ?>><?php _e( 'Tag Name', 'woocommerce-exporter' ); ?></option>
18
+ </select>
19
+ <select name="tag_order">
20
+ <option value="ASC"<?php selected( 'ASC', $tag_order ); ?>><?php _e( 'Ascending', 'woocommerce-exporter' ); ?></option>
21
+ <option value="DESC"<?php selected( 'DESC', $tag_order ); ?>><?php _e( 'Descending', 'woocommerce-exporter' ); ?></option>
22
+ </select>
23
+ <p class="description"><?php _e( 'Select the sorting of Product Tags within the exported file. By default this is set to export Product Tags 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/user.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for User Sorting widget on Store Exporter screen
7
+ function woo_ce_user_sorting() {
8
+
9
+ $orderby = woo_ce_get_option( 'user_orderby', 'ID' );
10
+ $order = woo_ce_get_option( 'user_order', 'ASC' );
11
+
12
+ ob_start(); ?>
13
+ <p><label><?php _e( 'User Sorting', 'woocommerce-exporter' ); ?></label></p>
14
+ <div>
15
+ <select name="user_orderby">
16
+ <option value="ID"<?php selected( 'ID', $orderby ); ?>><?php _e( 'User ID', 'woocommerce-exporter' ); ?></option>
17
+ <option value="display_name"<?php selected( 'display_name', $orderby ); ?>><?php _e( 'Display Name', 'woocommerce-exporter' ); ?></option>
18
+ <option value="user_name"<?php selected( 'user_name', $orderby ); ?>><?php _e( 'Name', 'woocommerce-exporter' ); ?></option>
19
+ <option value="user_login"<?php selected( 'user_login', $orderby ); ?>><?php _e( 'Username', 'woocommerce-exporter' ); ?></option>
20
+ <option value="nicename"<?php selected( 'nicename', $orderby ); ?>><?php _e( 'Nickname', 'woocommerce-exporter' ); ?></option>
21
+ <option value="email"<?php selected( 'email', $orderby ); ?>><?php _e( 'E-mail', 'woocommerce-exporter' ); ?></option>
22
+ <option value="url"<?php selected( 'url', $orderby ); ?>><?php _e( 'Website', 'woocommerce-exporter' ); ?></option>
23
+ <option value="registered"<?php selected( 'registered', $orderby ); ?>><?php _e( 'Date Registered', 'woocommerce-exporter' ); ?></option>
24
+ <option value="rand"<?php selected( 'rand', $orderby ); ?>><?php _e( 'Random', 'woocommerce-exporter' ); ?></option>
25
+ </select>
26
+ <select name="user_order">
27
+ <option value="ASC"<?php selected( 'ASC', $order ); ?>><?php _e( 'Ascending', 'woocommerce-exporter' ); ?></option>
28
+ <option value="DESC"<?php selected( 'DESC', $order ); ?>><?php _e( 'Descending', 'woocommerce-exporter' ); ?></option>
29
+ </select>
30
+ <p class="description"><?php _e( 'Select the sorting of Users within the exported file. By default this is set to export User by User ID in Desending order.', 'woocommerce-exporter' ); ?></p>
31
+ </div>
32
+ <?php
33
+ ob_end_flush();
34
+
35
+ }
36
+
37
+ // HTML template for disabled Custom Users widget on Store Exporter screen
38
+ function woo_ce_users_custom_fields() {
39
+
40
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
41
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
42
+
43
+ $custom_users = ' - ';
44
+
45
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/';
46
+
47
+ ob_start(); ?>
48
+ <form method="post" id="export-users-custom-fields" class="export-options user-options">
49
+ <div id="poststuff">
50
+
51
+ <div class="postbox" id="export-options user-options">
52
+ <h3 class="hndle"><?php _e( 'Custom User Fields', 'woocommerce-exporter' ); ?></h3>
53
+ <div class="inside">
54
+ <p class="description"><?php _e( 'To include additional custom User meta in the Export Users table above fill the Users text box then click Save Custom Fields.', 'woocommerce-exporter' ); ?></p>
55
+ <p class="description"><?php printf( __( 'For more information on exporting custom User meta consult our <a href="%s" target="_blank">online documentation</a>.', 'woocommerce-exporter' ), $troubleshooting_url ); ?></p>
56
+ <table class="form-table">
57
+
58
+ <tr>
59
+ <th>
60
+ <label><?php _e( 'User meta', 'woocommerce-exporter' ); ?></label>
61
+ </th>
62
+ <td>
63
+ <textarea name="custom_users" rows="5" cols="70"><?php echo esc_textarea( $custom_users ); ?></textarea>
64
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
65
+ <p class="description"><?php _e( 'Include additional custom User meta in your export file by adding each custom User meta name to a new line above.<br />For example: <code>Customer UA, Customer IP Address</code>', 'woocommerce-exporter' ); ?></p>
66
+ </td>
67
+ </tr>
68
+
69
+ </table>
70
+ <p class="submit">
71
+ <input type="button" class="button button-disabled" value="<?php _e( 'Save Custom Fields', 'woocommerce-exporter' ); ?>" />
72
+ </p>
73
+ </div>
74
+ <!-- .inside -->
75
+ </div>
76
+ <!-- .postbox -->
77
+
78
+ </div>
79
+ <!-- #poststuff -->
80
+ <input type="hidden" name="action" value="update" />
81
+ </form>
82
+ <!-- #export-users-custom-fields -->
83
+ <?php
84
+ ob_end_flush();
85
+
86
+ }
87
+
88
+ /* End of: WordPress Administration */
89
+
90
+ }
91
+ ?>
includes/brand.php ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ if( !function_exists( 'woo_ce_get_export_type_brand_count' ) ) {
7
+ function woo_ce_get_export_type_brand_count( $count = 0, $export_type = '', $args ) {
8
+
9
+ if( $export_type <> 'brand' )
10
+ return $count;
11
+
12
+ $count = 0;
13
+ // Check if the existing Transient exists
14
+ $cached = get_transient( WOO_CE_PREFIX . '_brand_count' );
15
+ if( $cached == false ) {
16
+ $term_taxonomy = apply_filters( 'woo_ce_brand_term_taxonomy', 'product_brand' );
17
+ if( taxonomy_exists( $term_taxonomy ) )
18
+ $count = wp_count_terms( $term_taxonomy );
19
+ set_transient( WOO_CE_PREFIX . '_brand_count', $count, HOUR_IN_SECONDS );
20
+ } else {
21
+ $count = $cached;
22
+ }
23
+ return $count;
24
+
25
+ }
26
+ add_filter( 'woo_ce_get_export_type_count', 'woo_ce_get_export_type_brand_count', 10, 3 );
27
+ }
28
+
29
+ /* End of: WordPress Administration */
30
+
31
+ }
32
+
33
+ // Returns a list of Brand export columns
34
+ function woo_ce_get_brand_fields( $format = 'full' ) {
35
+
36
+ $export_type = 'brand';
37
+
38
+ $fields = array();
39
+ $fields[] = array(
40
+ 'name' => 'term_id',
41
+ 'label' => __( 'Term ID', 'woocommerce-exporter' )
42
+ );
43
+ $fields[] = array(
44
+ 'name' => 'name',
45
+ 'label' => __( 'Brand Name', 'woocommerce-exporter' )
46
+ );
47
+ $fields[] = array(
48
+ 'name' => 'slug',
49
+ 'label' => __( 'Brand Slug', 'woocommerce-exporter' )
50
+ );
51
+ $fields[] = array(
52
+ 'name' => 'parent_id',
53
+ 'label' => __( 'Parent Term ID', 'woocommerce-exporter' )
54
+ );
55
+ $fields[] = array(
56
+ 'name' => 'description',
57
+ 'label' => __( 'Brand Description', 'woocommerce-exporter' )
58
+ );
59
+ $fields[] = array(
60
+ 'name' => 'image',
61
+ 'label' => __( 'Brand Image', 'woocommerce-exporter' )
62
+ );
63
+
64
+ /*
65
+ $fields[] = array(
66
+ 'name' => '',
67
+ 'label' => __( '', 'woocommerce-exporter' )
68
+ );
69
+ */
70
+
71
+ // Drop in our content filters here
72
+ add_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
73
+
74
+ // Allow Plugin/Theme authors to add support for additional columns
75
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
76
+
77
+ // Remove our content filters here to play nice with other Plugins
78
+ remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
79
+
80
+ switch( $format ) {
81
+
82
+ case 'summary':
83
+ $output = array();
84
+ $size = count( $fields );
85
+ for( $i = 0; $i < $size; $i++ ) {
86
+ if( isset( $fields[$i] ) )
87
+ $output[$fields[$i]['name']] = 'on';
88
+ }
89
+ return $output;
90
+ break;
91
+
92
+ case 'full':
93
+ default:
94
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
95
+ $size = count( $fields );
96
+ for( $i = 0; $i < $size; $i++ ) {
97
+ $fields[$i]['reset'] = $i;
98
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
99
+ }
100
+ // Check if we are using PHP 5.3 and above
101
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
102
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
103
+ return $fields;
104
+ break;
105
+
106
+ }
107
+
108
+ }
109
+
110
+ function woo_ce_override_brand_field_labels( $fields = array() ) {
111
+
112
+ $labels = woo_ce_get_option( 'brand_labels', array() );
113
+ if( !empty( $labels ) ) {
114
+ foreach( $fields as $key => $field ) {
115
+ if( isset( $labels[$field['name']] ) )
116
+ $fields[$key]['label'] = $labels[$field['name']];
117
+ }
118
+ }
119
+ return $fields;
120
+
121
+ }
122
+ add_filter( 'woo_ce_brand_fields', 'woo_ce_override_brand_field_labels', 11 );
123
+
124
+ // Returns a list of WooCommerce Product Brands to export process
125
+ function woo_ce_get_product_brands( $args = array() ) {
126
+
127
+ $term_taxonomy = apply_filters( 'woo_ce_brand_term_taxonomy', 'product_brand' );
128
+ $defaults = array(
129
+ 'orderby' => 'name',
130
+ 'order' => 'ASC',
131
+ 'hide_empty' => 0
132
+ );
133
+ $args = wp_parse_args( $args, $defaults );
134
+ $brands = get_terms( $term_taxonomy, $args );
135
+ if( !empty( $brands ) && is_wp_error( $brands ) == false ) {
136
+ foreach( $brands as $key => $brand ) {
137
+ $brands[$key]->description = woo_ce_format_description_excerpt( $brand->description );
138
+ $brands[$key]->parent_name = '';
139
+ if( $brands[$key]->parent_id = $brand->parent ) {
140
+ if( $parent_brand = get_term( $brands[$key]->parent_id, $term_taxonomy ) ) {
141
+ $brands[$key]->parent_name = $parent_brand->name;
142
+ }
143
+ unset( $parent_brand );
144
+ } else {
145
+ $brands[$key]->parent_id = '';
146
+ }
147
+ $brands[$key]->image = ( function_exists( 'get_brand_thumbnail_url' ) ? get_brand_thumbnail_url( $brand->term_id ) : false );
148
+ }
149
+ return $brands;
150
+ }
151
+
152
+ }
153
+ ?>
includes/brands.php DELETED
@@ -1,114 +0,0 @@
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_brands_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', 'woo_ce' ); ?></label></p>
14
- <div>
15
- <select name="brand_orderby" disabled="disabled">
16
- <option value="id"><?php _e( 'Term ID', 'woo_ce' ); ?></option>
17
- <option value="name"><?php _e( 'Brand Name', 'woo_ce' ); ?></option>
18
- </select>
19
- <select name="brand_order" disabled="disabled">
20
- <option value="ASC"><?php _e( 'Ascending', 'woo_ce' ); ?></option>
21
- <option value="DESC"><?php _e( 'Descending', 'woo_ce' ); ?></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.', 'woo_ce' ); ?></p>
24
- </div>
25
- <?php
26
- ob_end_flush();
27
-
28
- }
29
-
30
- /* End of: WordPress Administration */
31
-
32
- }
33
-
34
- // Returns a list of Brand export columns
35
- function woo_ce_get_brand_fields( $format = 'full' ) {
36
-
37
- $export_type = 'brand';
38
-
39
- $fields = array();
40
- $fields[] = array(
41
- 'name' => 'term_id',
42
- 'label' => __( 'Term ID', 'woo_ce' )
43
- );
44
- $fields[] = array(
45
- 'name' => 'name',
46
- 'label' => __( 'Brand Name', 'woo_ce' )
47
- );
48
- $fields[] = array(
49
- 'name' => 'slug',
50
- 'label' => __( 'Brand Slug', 'woo_ce' )
51
- );
52
- $fields[] = array(
53
- 'name' => 'parent_id',
54
- 'label' => __( 'Parent Term ID', 'woo_ce' )
55
- );
56
- $fields[] = array(
57
- 'name' => 'description',
58
- 'label' => __( 'Brand Description', 'woo_ce' )
59
- );
60
- $fields[] = array(
61
- 'name' => 'image',
62
- 'label' => __( 'Brand Image', 'woo_ce' )
63
- );
64
-
65
- /*
66
- $fields[] = array(
67
- 'name' => '',
68
- 'label' => __( '', 'woo_ce' )
69
- );
70
- */
71
-
72
- // Allow Plugin/Theme authors to add support for additional columns
73
- $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
74
-
75
- switch( $format ) {
76
-
77
- case 'summary':
78
- $output = array();
79
- $size = count( $fields );
80
- for( $i = 0; $i < $size; $i++ ) {
81
- if( isset( $fields[$i] ) )
82
- $output[$fields[$i]['name']] = 'on';
83
- }
84
- return $output;
85
- break;
86
-
87
- case 'full':
88
- default:
89
- $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
90
- $size = count( $fields );
91
- for( $i = 0; $i < $size; $i++ )
92
- $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
93
- usort( $fields, woo_ce_sort_fields( 'order' ) );
94
- return $fields;
95
- break;
96
-
97
- }
98
-
99
- }
100
-
101
- function woo_ce_override_brand_field_labels( $fields = array() ) {
102
-
103
- $labels = woo_ce_get_option( 'brand_labels', array() );
104
- if( !empty( $labels ) ) {
105
- foreach( $fields as $key => $field ) {
106
- if( isset( $labels[$field['name']] ) )
107
- $fields[$key]['label'] = $labels[$field['name']];
108
- }
109
- }
110
- return $fields;
111
-
112
- }
113
- add_filter( 'woo_ce_brand_fields', 'woo_ce_override_brand_field_labels', 11 );
114
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/{categories.php → category.php} RENAMED
@@ -3,28 +3,23 @@ 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_order_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', 'woo_ce' ); ?></label></p>
14
- <div>
15
- <select name="category_orderby">
16
- <option value="id"<?php selected( 'id', $category_orderby ); ?>><?php _e( 'Term ID', 'woo_ce' ); ?></option>
17
- <option value="name"<?php selected( 'name', $category_orderby ); ?>><?php _e( 'Category Name', 'woo_ce' ); ?></option>
18
- </select>
19
- <select name="category_order">
20
- <option value="ASC"<?php selected( 'ASC', $category_order ); ?>><?php _e( 'Ascending', 'woo_ce' ); ?></option>
21
- <option value="DESC"<?php selected( 'DESC', $category_order ); ?>><?php _e( 'Descending', 'woo_ce' ); ?></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.', 'woo_ce' ); ?></p>
24
- </div>
25
- <?php
26
- ob_end_flush();
27
 
 
28
  }
29
 
30
  /* End of: WordPress Administration */
@@ -39,43 +34,49 @@ function woo_ce_get_category_fields( $format = 'full' ) {
39
  $fields = array();
40
  $fields[] = array(
41
  'name' => 'term_id',
42
- 'label' => __( 'Term ID', 'woo_ce' )
43
  );
44
  $fields[] = array(
45
  'name' => 'name',
46
- 'label' => __( 'Category Name', 'woo_ce' )
47
  );
48
  $fields[] = array(
49
  'name' => 'slug',
50
- 'label' => __( 'Category Slug', 'woo_ce' )
51
  );
52
  $fields[] = array(
53
  'name' => 'parent_id',
54
- 'label' => __( 'Parent Term ID', 'woo_ce' )
55
  );
56
  $fields[] = array(
57
  'name' => 'description',
58
- 'label' => __( 'Category Description', 'woo_ce' )
59
  );
60
  $fields[] = array(
61
  'name' => 'display_type',
62
- 'label' => __( 'Display Type', 'woo_ce' )
63
  );
64
  $fields[] = array(
65
  'name' => 'image',
66
- 'label' => __( 'Category Image', 'woo_ce' )
67
  );
68
 
69
  /*
70
  $fields[] = array(
71
  'name' => '',
72
- 'label' => __( '', 'woo_ce' )
73
  );
74
  */
75
 
 
 
 
76
  // Allow Plugin/Theme authors to add support for additional columns
77
  $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
78
 
 
 
 
79
  if( $remember = woo_ce_get_option( $export_type . '_fields', array() ) ) {
80
  $remember = maybe_unserialize( $remember );
81
  $size = count( $fields );
@@ -103,9 +104,13 @@ function woo_ce_get_category_fields( $format = 'full' ) {
103
  default:
104
  $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
105
  $size = count( $fields );
106
- for( $i = 0; $i < $size; $i++ )
 
107
  $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
108
- usort( $fields, woo_ce_sort_fields( 'order' ) );
 
 
 
109
  return $fields;
110
  break;
111
 
@@ -168,6 +173,7 @@ function woo_ce_get_product_categories( $args = array() ) {
168
  $categories = get_terms( $term_taxonomy, $args );
169
  if( !empty( $categories ) && is_wp_error( $categories ) == false ) {
170
  foreach( $categories as $key => $category ) {
 
171
  $categories[$key]->parent_name = '';
172
  if( $categories[$key]->parent_id = $category->parent ) {
173
  if( $parent_category = get_term( $categories[$key]->parent_id, $term_taxonomy ) ) {
3
 
4
  /* Start of: WordPress Administration */
5
 
6
+ if( !function_exists( 'woo_ce_get_export_type_category_count' ) ) {
7
+ function woo_ce_get_export_type_category_count() {
8
+
9
+ $count = 0;
10
+ // Check if the existing Transient exists
11
+ $cached = get_transient( WOO_CE_PREFIX . '_category_count' );
12
+ if( $cached == false ) {
13
+ $term_taxonomy = 'product_cat';
14
+ if( taxonomy_exists( $term_taxonomy ) )
15
+ $count = wp_count_terms( $term_taxonomy );
16
+ set_transient( WOO_CE_PREFIX . '_category_count', $count, HOUR_IN_SECONDS );
17
+ } else {
18
+ $count = $cached;
19
+ }
20
+ return $count;
 
 
 
 
 
 
21
 
22
+ }
23
  }
24
 
25
  /* End of: WordPress Administration */
34
  $fields = array();
35
  $fields[] = array(
36
  'name' => 'term_id',
37
+ 'label' => __( 'Term ID', 'woocommerce-exporter' )
38
  );
39
  $fields[] = array(
40
  'name' => 'name',
41
+ 'label' => __( 'Category Name', 'woocommerce-exporter' )
42
  );
43
  $fields[] = array(
44
  'name' => 'slug',
45
+ 'label' => __( 'Category Slug', 'woocommerce-exporter' )
46
  );
47
  $fields[] = array(
48
  'name' => 'parent_id',
49
+ 'label' => __( 'Parent Term ID', 'woocommerce-exporter' )
50
  );
51
  $fields[] = array(
52
  'name' => 'description',
53
+ 'label' => __( 'Category Description', 'woocommerce-exporter' )
54
  );
55
  $fields[] = array(
56
  'name' => 'display_type',
57
+ 'label' => __( 'Display Type', 'woocommerce-exporter' )
58
  );
59
  $fields[] = array(
60
  'name' => 'image',
61
+ 'label' => __( 'Category Image', 'woocommerce-exporter' )
62
  );
63
 
64
  /*
65
  $fields[] = array(
66
  'name' => '',
67
+ 'label' => __( '', 'woocommerce-exporter' )
68
  );
69
  */
70
 
71
+ // Drop in our content filters here
72
+ add_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
73
+
74
  // Allow Plugin/Theme authors to add support for additional columns
75
  $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
76
 
77
+ // Remove our content filters here to play nice with other Plugins
78
+ remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
79
+
80
  if( $remember = woo_ce_get_option( $export_type . '_fields', array() ) ) {
81
  $remember = maybe_unserialize( $remember );
82
  $size = count( $fields );
104
  default:
105
  $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
106
  $size = count( $fields );
107
+ for( $i = 0; $i < $size; $i++ ) {
108
+ $fields[$i]['reset'] = $i;
109
  $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
110
+ }
111
+ // Check if we are using PHP 5.3 and above
112
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
113
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
114
  return $fields;
115
  break;
116
 
173
  $categories = get_terms( $term_taxonomy, $args );
174
  if( !empty( $categories ) && is_wp_error( $categories ) == false ) {
175
  foreach( $categories as $key => $category ) {
176
+ $categories[$key]->description = woo_ce_format_description_excerpt( $category->description );
177
  $categories[$key]->parent_name = '';
178
  if( $categories[$key]->parent_id = $category->parent ) {
179
  if( $parent_category = get_term( $categories[$key]->parent_id, $term_taxonomy ) ) {
includes/commission.php ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ if( !function_exists( 'woo_ce_get_export_type_commission_count' ) ) {
7
+ function woo_ce_get_export_type_commission_count( $count = 0, $export_type = '', $args ) {
8
+
9
+ if( $export_type <> 'commission' )
10
+ return $count;
11
+
12
+ $count = 0;
13
+ // Check if the existing Transient exists
14
+ $cached = get_transient( WOO_CE_PREFIX . '_commission_count' );
15
+ if( $cached == false ) {
16
+ $post_type = 'shop_commission';
17
+ if( post_type_exists( $post_type ) ) {
18
+ $count = wp_count_posts( $post_type );
19
+ } else if( class_exists( 'WC_Vendors' ) ) {
20
+ // Check for WC-Vendors
21
+ global $wpdb;
22
+ $count = $wpdb->get_var( 'SELECT COUNT(id) FROM `' . $wpdb->prefix . 'pv_commission`' );
23
+ }
24
+ set_transient( WOO_CE_PREFIX . '_commission_count', $count, HOUR_IN_SECONDS );
25
+ } else {
26
+ $count = $cached;
27
+ }
28
+ return $count;
29
+
30
+ }
31
+ add_filter( 'woo_ce_get_export_type_count', 'woo_ce_get_export_type_commission_count', 10, 3 );
32
+ }
33
+
34
+ // Returns date of first Commission received, any status
35
+ function woo_ce_get_commission_first_date() {
36
+
37
+ $output = date( 'd/m/Y', mktime( 0, 0, 0, date( 'n' ), 1 ) );
38
+ $post_type = 'shop_commission';
39
+ $args = array(
40
+ 'post_type' => $post_type,
41
+ 'orderby' => 'post_date',
42
+ 'order' => 'ASC',
43
+ 'numberposts' => 1
44
+ );
45
+ $commissions = get_posts( $args );
46
+ if( $commissions ) {
47
+ $commission = strtotime( $commissions[0]->post_date );
48
+ $output = date( 'd/m/Y', $commission );
49
+ unset( $commissions, $commission );
50
+ }
51
+ return $output;
52
+
53
+ }
54
+
55
+ // HTML template for disabled Commission Sorting widget on Store Exporter screen
56
+ function woo_ce_commission_sorting() {
57
+
58
+ ob_start(); ?>
59
+ <p><label><?php _e( 'Commission Sorting', 'woocommerce-exporter' ); ?></label></p>
60
+ <div>
61
+ <select name="commission_orderby" disabled="disabled">
62
+ <option value="ID"><?php _e( 'Commission ID', 'woocommerce-exporter' ); ?></option>
63
+ <option value="title"><?php _e( 'Commission Title', 'woocommerce-exporter' ); ?></option>
64
+ <option value="date"><?php _e( 'Date Created', 'woocommerce-exporter' ); ?></option>
65
+ <option value="modified"><?php _e( 'Date Modified', 'woocommerce-exporter' ); ?></option>
66
+ <option value="rand"><?php _e( 'Random', 'woocommerce-exporter' ); ?></option>
67
+ </select>
68
+ <select name="commission_order" disabled="disabled">
69
+ <option value="ASC"><?php _e( 'Ascending', 'woocommerce-exporter' ); ?></option>
70
+ <option value="DESC"><?php _e( 'Descending', 'woocommerce-exporter' ); ?></option>
71
+ </select>
72
+ <p class="description"><?php _e( 'Select the sorting of Commissions within the exported file. By default this is set to export Commissions by Commission ID in Desending order.', 'woocommerce-exporter' ); ?></p>
73
+ </div>
74
+ <?php
75
+ ob_end_flush();
76
+
77
+ }
78
+
79
+ // HTML template for disabled Filter Commissions by Product Vendor widget on Store Exporter screen
80
+ function woo_ce_commissions_filter_by_product_vendor() {
81
+
82
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
83
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
84
+
85
+ $product_vendors = woo_ce_get_product_vendors( array(), 'full' );
86
+
87
+ ob_start(); ?>
88
+ <p><label><input type="checkbox" id="commissions-filters-product_vendor" /> <?php _e( 'Filter Commissions by Product Vendors', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
89
+ <div id="export-commissions-filters-product_vendor" class="separator">
90
+ <?php if( $product_vendors ) { ?>
91
+ <ul>
92
+ <?php foreach( $product_vendors as $product_vendor ) { ?>
93
+ <li>
94
+ <label><input type="checkbox" name="commission_filter_product_vendor[<?php echo $product_vendor->term_id; ?>]" value="<?php echo $product_vendor->term_id; ?>" title="<?php printf( __( 'Term ID: %d', 'woocommerce-exporter' ), $product_vendor->term_id ); ?>"<?php disabled( $product_vendor->count, 0 ); ?> disabled="disabled" /> <?php echo $product_vendor->name; ?></label>
95
+ <span class="description">(<?php echo $product_vendor->count; ?>)</span>
96
+ </li>
97
+ <?php } ?>
98
+ </ul>
99
+ <p class="description"><?php _e( 'Select the Product Vendors you want to filter exported Commissions by. Default is to include all Product Vendors.', 'woocommerce-exporter' ); ?></p>
100
+ <?php } else { ?>
101
+ <p><?php _e( 'No Product Vendors were found.', 'woocommerce-exporter' ); ?></p>
102
+ <?php } ?>
103
+ </div>
104
+ <!-- #export-commissions-filters-product_vendor -->
105
+ <?php
106
+ ob_end_flush();
107
+
108
+ }
109
+
110
+ // HTML template for disabled Filter Commissions by Commission Status widget on Store Exporter screen
111
+ function woo_ce_commissions_filter_by_commission_status() {
112
+
113
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
114
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
115
+
116
+ ob_start(); ?>
117
+ <p><label><input type="checkbox" id="commissions-filters-commission_status" /> <?php _e( 'Filter Commissions by Commission Status', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
118
+ <div id="export-commissions-filters-commission_status" class="separator">
119
+ <ul>
120
+ <li>
121
+ <label><input type="checkbox" name="commission_filter_commission_status[]" value="unpaid"<?php disabled( woo_ce_commissions_stock_status_count( 'unpaid' ), 0 ); ?> disabled="disabled" /> <?php _e( 'Unpaid', 'woocommerce-exporter' ); ?></label>
122
+ <span class="description">(<?php echo woo_ce_commissions_stock_status_count( 'unpaid' ); ?>)</span>
123
+ </li>
124
+ <li>
125
+ <label><input type="checkbox" name="commission_filter_commission_status[]" value="paid"<?php disabled( woo_ce_commissions_stock_status_count( 'paid' ), 0 ); ?> disabled="disabled" /> <?php _e( 'Paid', 'woocommerce-exporter' ); ?></label>
126
+ <span class="description">(<?php echo woo_ce_commissions_stock_status_count( 'paid' ); ?>)</span>
127
+ </li>
128
+ </ul>
129
+ <p class="description"><?php _e( 'Select the Commission Status you want to filter exported Commissions by. Default is to include all Commission Statuses.', 'woocommerce-exporter' ); ?></p>
130
+ </div>
131
+ <!-- #export-commissions-filters-commission_status -->
132
+ <?php
133
+ ob_end_flush();
134
+
135
+ }
136
+
137
+ // HTML template for displaying the number of each export type filter on the Archives screen
138
+ function woo_ce_commissions_stock_status_count( $type = '' ) {
139
+
140
+ $output = 0;
141
+ $post_type = 'shop_commission';
142
+ $meta_key = '_paid_status';
143
+ $args = array(
144
+ 'post_type' => $post_type,
145
+ 'meta_key' => $meta_key,
146
+ 'meta_value' => null,
147
+ 'numberposts' => -1,
148
+ 'fields' => 'ids'
149
+ );
150
+ if( $type )
151
+ $args['meta_value'] = $type;
152
+ $commission_ids = new WP_Query( $args );
153
+ if( !empty( $commission_ids->posts ) )
154
+ $output = count( $commission_ids->posts );
155
+ return $output;
156
+
157
+ }
158
+
159
+ /* End of: WordPress Administration */
160
+
161
+ }
162
+
163
+ function woo_ce_get_commission_fields( $format = 'full' ) {
164
+
165
+ $export_type = 'commission';
166
+
167
+ $fields = array();
168
+ $fields[] = array(
169
+ 'name' => 'ID',
170
+ 'label' => __( 'Commission ID', 'woocommerce-exporter' )
171
+ );
172
+ $fields[] = array(
173
+ 'name' => 'post_date',
174
+ 'label' => __( 'Commission Date', 'woocommerce-exporter' )
175
+ );
176
+ $fields[] = array(
177
+ 'name' => 'title',
178
+ 'label' => __( 'Commission Title', 'woocommerce-exporter' )
179
+ );
180
+ $fields[] = array(
181
+ 'name' => 'product_id',
182
+ 'label' => __( 'Product ID', 'woocommerce-exporter' )
183
+ );
184
+ $fields[] = array(
185
+ 'name' => 'product_name',
186
+ 'label' => __( 'Product Name', 'woocommerce-exporter' )
187
+ );
188
+ $fields[] = array(
189
+ 'name' => 'product_sku',
190
+ 'label' => __( 'Product SKU', 'woocommerce-exporter' )
191
+ );
192
+ $fields[] = array(
193
+ 'name' => 'product_vendor_id',
194
+ 'label' => __( 'Product Vendor ID', 'woocommerce-exporter' )
195
+ );
196
+ $fields[] = array(
197
+ 'name' => 'product_vendor_name',
198
+ 'label' => __( 'Product Vendor Name', 'woocommerce-exporter' )
199
+ );
200
+ $fields[] = array(
201
+ 'name' => 'commission_amount',
202
+ 'label' => __( 'Commission Amount', 'woocommerce-exporter' )
203
+ );
204
+ $fields[] = array(
205
+ 'name' => 'paid_status',
206
+ 'label' => __( 'Commission Status', 'woocommerce-exporter' )
207
+ );
208
+ $fields[] = array(
209
+ 'name' => 'post_status',
210
+ 'label' => __( 'Post Status', 'woocommerce-exporter' )
211
+ );
212
+
213
+ /*
214
+ $fields[] = array(
215
+ 'name' => '',
216
+ 'label' => __( '', 'woocommerce-exporter' )
217
+ );
218
+ */
219
+
220
+ // Allow Plugin/Theme authors to add support for additional columns
221
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
222
+
223
+ switch( $format ) {
224
+
225
+ case 'summary':
226
+ $output = array();
227
+ $size = count( $fields );
228
+ for( $i = 0; $i < $size; $i++ ) {
229
+ if( isset( $fields[$i] ) )
230
+ $output[$fields[$i]['name']] = 'on';
231
+ }
232
+ return $output;
233
+ break;
234
+
235
+ case 'full':
236
+ default:
237
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
238
+ $size = count( $fields );
239
+ for( $i = 0; $i < $size; $i++ ) {
240
+ $fields[$i]['reset'] = $i;
241
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
242
+ }
243
+ // Check if we are using PHP 5.3 and above
244
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
245
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
246
+ return $fields;
247
+ break;
248
+
249
+ }
250
+
251
+ }
252
+ ?>
includes/common-dashboard_widgets.php CHANGED
@@ -3,7 +3,7 @@
3
 
4
  Filename: common-dashboard_widgets.php
5
  Description: common-dashboard_widgets.php loads commonly access Dashboard widgets across the Visser Labs suite.
6
- Version: 1.3
7
 
8
  */
9
 
@@ -13,7 +13,14 @@ if( !function_exists( 'woo_vl_dashboard_setup' ) ) {
13
 
14
  function woo_vl_dashboard_setup() {
15
 
16
- wp_add_dashboard_widget( 'woo_vl_news_widget', __( 'Plugin News - by Visser Labs', 'woo_vl' ), 'woo_vl_news_widget' );
 
 
 
 
 
 
 
17
 
18
  }
19
  add_action( 'wp_dashboard_setup', 'woo_vl_dashboard_setup' );
@@ -22,6 +29,7 @@ if( !function_exists( 'woo_vl_dashboard_setup' ) ) {
22
 
23
  include_once( ABSPATH . WPINC . '/feed.php' );
24
 
 
25
  $rss = fetch_feed( 'http://www.visser.com.au/blog/category/woocommerce/feed/' );
26
  $output = '<div class="rss-widget">';
27
  if( !is_wp_error( $rss ) ) {
@@ -37,7 +45,7 @@ if( !function_exists( 'woo_vl_dashboard_setup' ) ) {
37
  endforeach;
38
  $output .= '</ul>';
39
  } else {
40
- $message = __( 'Connection failed. Please check your network settings.', 'woo_vl' );
41
  $output .= '<p>' . $message . '</p>';
42
  }
43
  $output .= '</div>';
3
 
4
  Filename: common-dashboard_widgets.php
5
  Description: common-dashboard_widgets.php loads commonly access Dashboard widgets across the Visser Labs suite.
6
+ Version: 1.5
7
 
8
  */
9
 
13
 
14
  function woo_vl_dashboard_setup() {
15
 
16
+ // Limit the Dashboard widget to Users with the Manage Options capability
17
+ $user_capability = 'manage_options';
18
+ if( current_user_can( $user_capability ) ) {
19
+ if( apply_filters( 'woo_vl_news_widget', true ) ) {
20
+ $dashboard_widget_title = __( 'Plugin News - by Visser Labs', 'woocommerce-exporter' );
21
+ wp_add_dashboard_widget( 'woo_vl_news_widget', $dashboard_widget_title, 'woo_vl_news_widget' );
22
+ }
23
+ }
24
 
25
  }
26
  add_action( 'wp_dashboard_setup', 'woo_vl_dashboard_setup' );
29
 
30
  include_once( ABSPATH . WPINC . '/feed.php' );
31
 
32
+ // Get the RSS feed for WooCommerce Plugins
33
  $rss = fetch_feed( 'http://www.visser.com.au/blog/category/woocommerce/feed/' );
34
  $output = '<div class="rss-widget">';
35
  if( !is_wp_error( $rss ) ) {
45
  endforeach;
46
  $output .= '</ul>';
47
  } else {
48
+ $message = __( 'Connection failed. Please check your network settings.', 'woocommerce-exporter' );
49
  $output .= '<p>' . $message . '</p>';
50
  }
51
  $output .= '</div>';
includes/common.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
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
+ *
12
+ */
13
+
14
+ if( is_admin() ) {
15
+
16
+ /* Start of: WordPress Administration */
17
+
18
+ include_once( 'common-dashboard_widgets.php' );
19
+
20
+ /* End of: WordPress Administration */
21
+
22
+ }
23
+
24
+ if( !function_exists( 'woo_get_action' ) ) {
25
+ function woo_get_action( $switch = false ) {
26
+
27
+ if( $switch ) {
28
+
29
+ if( isset( $_GET['action'] ) )
30
+ $action = $_GET['action'];
31
+ else if( !isset( $action ) && isset( $_POST['action'] ) )
32
+ $action = $_POST['action'];
33
+ else
34
+ $action = false;
35
+
36
+ } else {
37
+
38
+ if( isset( $_POST['action'] ) )
39
+ $action = $_POST['action'];
40
+ else if( !isset( $action ) && isset( $_GET['action'] ) )
41
+ $action = $_GET['action'];
42
+ else
43
+ $action = false;
44
+
45
+ }
46
+ return $action;
47
+
48
+ }
49
+ }
50
+
51
+ if( !function_exists( 'woo_is_wpsc_activated' ) ) {
52
+ function woo_is_wpsc_activated() {
53
+
54
+ if( class_exists( 'WP_eCommerce' ) || defined( 'WPSC_VERSION' ) )
55
+ return true;
56
+
57
+ }
58
+ }
59
+
60
+ if( !function_exists( 'woo_is_woo_activated' ) ) {
61
+ function woo_is_woo_activated() {
62
+
63
+ if( class_exists( 'Woocommerce' ) )
64
+ return true;
65
+
66
+ }
67
+ }
68
+
69
+ if( !function_exists( 'woo_is_jigo_activated' ) ) {
70
+ function woo_is_jigo_activated() {
71
+
72
+ if( function_exists( 'jigoshop_init' ) )
73
+ return true;
74
+
75
+ }
76
+ }
77
+ ?>
includes/{coupons.php → coupon.php} RENAMED
@@ -3,28 +3,23 @@ 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_coupons_coupon_sorting() {
8
-
9
- ob_start(); ?>
10
- <p><label><?php _e( 'Coupon Sorting', 'woo_ce' ); ?></label></p>
11
- <div>
12
- <select name="coupon_orderby" disabled="disabled">
13
- <option value="ID"><?php _e( 'Coupon ID', 'woo_ce' ); ?></option>
14
- <option value="title"><?php _e( 'Coupon Code', 'woo_ce' ); ?></option>
15
- <option value="date"><?php _e( 'Date Created', 'woo_ce' ); ?></option>
16
- <option value="modified"><?php _e( 'Date Modified', 'woo_ce' ); ?></option>
17
- <option value="rand"><?php _e( 'Random', 'woo_ce' ); ?></option>
18
- </select>
19
- <select name="coupon_order" disabled="disabled">
20
- <option value="ASC"><?php _e( 'Ascending', 'woo_ce' ); ?></option>
21
- <option value="DESC"><?php _e( 'Descending', 'woo_ce' ); ?></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.', 'woo_ce' ); ?></p>
24
- </div>
25
- <?php
26
- ob_end_flush();
27
 
 
28
  }
29
 
30
  /* End of: WordPress Administration */
@@ -39,75 +34,81 @@ function woo_ce_get_coupon_fields( $format = 'full' ) {
39
  $fields = array();
40
  $fields[] = array(
41
  'name' => 'coupon_code',
42
- 'label' => __( 'Coupon Code', 'woo_ce' )
43
  );
44
  $fields[] = array(
45
  'name' => 'coupon_description',
46
- 'label' => __( 'Coupon Description', 'woo_ce' )
47
  );
48
  $fields[] = array(
49
  'name' => 'discount_type',
50
- 'label' => __( 'Discount Type', 'woo_ce' )
51
  );
52
  $fields[] = array(
53
  'name' => 'coupon_amount',
54
- 'label' => __( 'Coupon Amount', 'woo_ce' )
55
  );
56
  $fields[] = array(
57
  'name' => 'individual_use',
58
- 'label' => __( 'Individual Use', 'woo_ce' )
59
  );
60
  $fields[] = array(
61
  'name' => 'apply_before_tax',
62
- 'label' => __( 'Apply before tax', 'woo_ce' )
63
  );
64
  $fields[] = array(
65
  'name' => 'exclude_sale_items',
66
- 'label' => __( 'Exclude sale items', 'woo_ce' )
67
  );
68
  $fields[] = array(
69
  'name' => 'minimum_amount',
70
- 'label' => __( 'Minimum Amount', 'woo_ce' )
71
  );
72
  $fields[] = array(
73
  'name' => 'product_ids',
74
- 'label' => __( 'Products', 'woo_ce' )
75
  );
76
  $fields[] = array(
77
  'name' => 'exclude_product_ids',
78
- 'label' => __( 'Exclude Products', 'woo_ce' )
79
  );
80
  $fields[] = array(
81
  'name' => 'product_categories',
82
- 'label' => __( 'Product Categories', 'woo_ce' )
83
  );
84
  $fields[] = array(
85
  'name' => 'exclude_product_categories',
86
- 'label' => __( 'Exclude Product Categories', 'woo_ce' )
87
  );
88
  $fields[] = array(
89
  'name' => 'customer_email',
90
- 'label' => __( 'Customer e-mails', 'woo_ce' )
91
  );
92
  $fields[] = array(
93
  'name' => 'usage_limit',
94
- 'label' => __( 'Usage Limit', 'woo_ce' )
95
  );
96
  $fields[] = array(
97
  'name' => 'expiry_date',
98
- 'label' => __( 'Expiry Date', 'woo_ce' )
99
  );
100
 
101
  /*
102
  $fields[] = array(
103
  'name' => '',
104
- 'label' => __( '', 'woo_ce' )
105
  );
106
  */
107
 
 
 
 
108
  // Allow Plugin/Theme authors to add support for additional columns
109
  $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
110
 
 
 
 
111
  switch( $format ) {
112
 
113
  case 'summary':
@@ -124,9 +125,13 @@ function woo_ce_get_coupon_fields( $format = 'full' ) {
124
  default:
125
  $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
126
  $size = count( $fields );
127
- for( $i = 0; $i < $size; $i++ )
 
128
  $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
129
- usort( $fields, woo_ce_sort_fields( 'order' ) );
 
 
 
130
  return $fields;
131
  break;
132
 
@@ -171,7 +176,8 @@ function woo_ce_get_coupons( $args = array() ) {
171
  'offset' => $offset,
172
  'posts_per_page' => $limit_volume,
173
  'post_status' => woo_ce_post_statuses(),
174
- 'fields' => 'ids'
 
175
  );
176
  $coupons = array();
177
  $coupon_ids = new WP_Query( $args );
@@ -184,4 +190,17 @@ function woo_ce_get_coupons( $args = array() ) {
184
 
185
  }
186
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  ?>
3
 
4
  /* Start of: WordPress Administration */
5
 
6
+ if( !function_exists( 'woo_ce_get_export_type_coupon_count' ) ) {
7
+ function woo_ce_get_export_type_coupon_count() {
8
+
9
+ $count = 0;
10
+ // Check if the existing Transient exists
11
+ $cached = get_transient( WOO_CE_PREFIX . '_coupon_count' );
12
+ if( $cached == false ) {
13
+ $post_type = 'shop_coupon';
14
+ if( post_type_exists( $post_type ) )
15
+ $count = wp_count_posts( $post_type );
16
+ set_transient( WOO_CE_PREFIX . '_coupon_count', $count, HOUR_IN_SECONDS );
17
+ } else {
18
+ $count = $cached;
19
+ }
20
+ return $count;
 
 
 
 
 
 
21
 
22
+ }
23
  }
24
 
25
  /* End of: WordPress Administration */
34
  $fields = array();
35
  $fields[] = array(
36
  'name' => 'coupon_code',
37
+ 'label' => __( 'Coupon Code', 'woocommerce-exporter' )
38
  );
39
  $fields[] = array(
40
  'name' => 'coupon_description',
41
+ 'label' => __( 'Coupon Description', 'woocommerce-exporter' )
42
  );
43
  $fields[] = array(
44
  'name' => 'discount_type',
45
+ 'label' => __( 'Discount Type', 'woocommerce-exporter' )
46
  );
47
  $fields[] = array(
48
  'name' => 'coupon_amount',
49
+ 'label' => __( 'Coupon Amount', 'woocommerce-exporter' )
50
  );
51
  $fields[] = array(
52
  'name' => 'individual_use',
53
+ 'label' => __( 'Individual Use', 'woocommerce-exporter' )
54
  );
55
  $fields[] = array(
56
  'name' => 'apply_before_tax',
57
+ 'label' => __( 'Apply before tax', 'woocommerce-exporter' )
58
  );
59
  $fields[] = array(
60
  'name' => 'exclude_sale_items',
61
+ 'label' => __( 'Exclude sale items', 'woocommerce-exporter' )
62
  );
63
  $fields[] = array(
64
  'name' => 'minimum_amount',
65
+ 'label' => __( 'Minimum Amount', 'woocommerce-exporter' )
66
  );
67
  $fields[] = array(
68
  'name' => 'product_ids',
69
+ 'label' => __( 'Products', 'woocommerce-exporter' )
70
  );
71
  $fields[] = array(
72
  'name' => 'exclude_product_ids',
73
+ 'label' => __( 'Exclude Products', 'woocommerce-exporter' )
74
  );
75
  $fields[] = array(
76
  'name' => 'product_categories',
77
+ 'label' => __( 'Product Categories', 'woocommerce-exporter' )
78
  );
79
  $fields[] = array(
80
  'name' => 'exclude_product_categories',
81
+ 'label' => __( 'Exclude Product Categories', 'woocommerce-exporter' )
82
  );
83
  $fields[] = array(
84
  'name' => 'customer_email',
85
+ 'label' => __( 'Customer e-mails', 'woocommerce-exporter' )
86
  );
87
  $fields[] = array(
88
  'name' => 'usage_limit',
89
+ 'label' => __( 'Usage Limit', 'woocommerce-exporter' )
90
  );
91
  $fields[] = array(
92
  'name' => 'expiry_date',
93
+ 'label' => __( 'Expiry Date', 'woocommerce-exporter' )
94
  );
95
 
96
  /*
97
  $fields[] = array(
98
  'name' => '',
99
+ 'label' => __( '', 'woocommerce-exporter' )
100
  );
101
  */
102
 
103
+ // Drop in our content filters here
104
+ add_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
105
+
106
  // Allow Plugin/Theme authors to add support for additional columns
107
  $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
108
 
109
+ // Remove our content filters here to play nice with other Plugins
110
+ remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
111
+
112
  switch( $format ) {
113
 
114
  case 'summary':
125
  default:
126
  $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
127
  $size = count( $fields );
128
+ for( $i = 0; $i < $size; $i++ ) {
129
+ $fields[$i]['reset'] = $i;
130
  $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
131
+ }
132
+ // Check if we are using PHP 5.3 and above
133
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
134
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
135
  return $fields;
136
  break;
137
 
176
  'offset' => $offset,
177
  'posts_per_page' => $limit_volume,
178
  'post_status' => woo_ce_post_statuses(),
179
+ 'fields' => 'ids',
180
+ 'suppress_filters' => false
181
  );
182
  $coupons = array();
183
  $coupon_ids = new WP_Query( $args );
190
 
191
  }
192
 
193
+ function woo_ce_get_coupon_code_usage( $coupon_code = '' ) {
194
+
195
+ global $wpdb;
196
+
197
+ $count = 0;
198
+ if( $coupon_code ) {
199
+ $order_item_type = 'coupon';
200
+ $count_sql = $wpdb->prepare( "SELECT COUNT('order_item_id') FROM `" . $wpdb->prefix . "woocommerce_order_items` WHERE `order_item_type` = %s AND `order_item_name` = %s", $order_item_type, $coupon_code );
201
+ $count = $wpdb->get_var( $count_sql );
202
+ }
203
+ return $count;
204
+
205
+ }
206
  ?>
includes/customer.php ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ if( !function_exists( 'woo_ce_get_export_type_customer_count' ) ) {
7
+ function woo_ce_get_export_type_customer_count() {
8
+
9
+ $count = 0;
10
+ // Check if the existing Transient exists
11
+ $cached = get_transient( WOO_CE_PREFIX . '_customer_count' );
12
+ if( $cached == false ) {
13
+ if( $users = woo_ce_get_export_type_count( 'user' ) > 1000 ) {
14
+ $count = sprintf( '~%s+', 1000 );
15
+ } else {
16
+ $post_type = 'shop_order';
17
+ $args = array(
18
+ 'post_type' => $post_type,
19
+ 'posts_per_page' => -1,
20
+ 'fields' => 'ids'
21
+ );
22
+ $woocommerce_version = woo_get_woo_version();
23
+ // Check if this is a WooCommerce 2.2+ instance (new Post Status)
24
+ if( version_compare( $woocommerce_version, '2.2' ) >= 0 ) {
25
+ $args['post_status'] = apply_filters( 'woo_ce_customer_post_status', array( 'wc-pending', 'wc-on-hold', 'wc-processing', 'wc-completed' ) );
26
+ } else {
27
+ $args['post_status'] = apply_filters( 'woo_ce_customer_post_status', woo_ce_post_statuses() );
28
+ $args['tax_query'] = array(
29
+ array(
30
+ 'taxonomy' => 'shop_order_status',
31
+ 'field' => 'slug',
32
+ 'terms' => array( 'pending', 'on-hold', 'processing', 'completed' )
33
+ ),
34
+ );
35
+ }
36
+ $order_ids = new WP_Query( $args );
37
+ $count = $order_ids->found_posts;
38
+ if( $count > 100 ) {
39
+ $count = sprintf( '~%s', $count );
40
+ } else {
41
+ $customers = array();
42
+ if( $order_ids->posts ) {
43
+ foreach( $order_ids->posts as $order_id ) {
44
+ $email = get_post_meta( $order_id, '_billing_email', true );
45
+ if( !in_array( $email, $customers ) )
46
+ $customers[$order_id] = $email;
47
+ unset( $email );
48
+ }
49
+ $count = count( $customers );
50
+ }
51
+ }
52
+ }
53
+ set_transient( WOO_CE_PREFIX . '_customer_count', $count, HOUR_IN_SECONDS );
54
+ } else {
55
+ $count = $cached;
56
+ }
57
+ return $count;
58
+
59
+ }
60
+ }
61
+
62
+ /* End of: WordPress Administration */
63
+
64
+ }
65
+
66
+ // Returns a list of Customer export columns
67
+ function woo_ce_get_customer_fields( $format = 'full' ) {
68
+
69
+ $export_type = 'customer';
70
+
71
+ $fields = array();
72
+ $fields[] = array(
73
+ 'name' => 'user_id',
74
+ 'label' => __( 'User ID', 'woocommerce-exporter' )
75
+ );
76
+ $fields[] = array(
77
+ 'name' => 'user_name',
78
+ 'label' => __( 'Username', 'woocommerce-exporter' )
79
+ );
80
+ $fields[] = array(
81
+ 'name' => 'user_role',
82
+ 'label' => __( 'User Role', 'woocommerce-exporter' )
83
+ );
84
+ $fields[] = array(
85
+ 'name' => 'billing_full_name',
86
+ 'label' => __( 'Billing: Full Name', 'woocommerce-exporter' )
87
+ );
88
+ $fields[] = array(
89
+ 'name' => 'billing_first_name',
90
+ 'label' => __( 'Billing: First Name', 'woocommerce-exporter' )
91
+ );
92
+ $fields[] = array(
93
+ 'name' => 'billing_last_name',
94
+ 'label' => __( 'Billing: Last Name', 'woocommerce-exporter' )
95
+ );
96
+ $fields[] = array(
97
+ 'name' => 'billing_company',
98
+ 'label' => __( 'Billing: Company', 'woocommerce-exporter' )
99
+ );
100
+ $fields[] = array(
101
+ 'name' => 'billing_address',
102
+ 'label' => __( 'Billing: Street Address', 'woocommerce-exporter' )
103
+ );
104
+ $fields[] = array(
105
+ 'name' => 'billing_city',
106
+ 'label' => __( 'Billing: City', 'woocommerce-exporter' )
107
+ );
108
+ $fields[] = array(
109
+ 'name' => 'billing_postcode',
110
+ 'label' => __( 'Billing: ZIP Code', 'woocommerce-exporter' )
111
+ );
112
+ $fields[] = array(
113
+ 'name' => 'billing_state',
114
+ 'label' => __( 'Billing: State (prefix)', 'woocommerce-exporter' )
115
+ );
116
+ $fields[] = array(
117
+ 'name' => 'billing_state_full',
118
+ 'label' => __( 'Billing: State', 'woocommerce-exporter' )
119
+ );
120
+ $fields[] = array(
121
+ 'name' => 'billing_country',
122
+ 'label' => __( 'Billing: Country', 'woocommerce-exporter' )
123
+ );
124
+ $fields[] = array(
125
+ 'name' => 'billing_phone',
126
+ 'label' => __( 'Billing: Phone Number', 'woocommerce-exporter' )
127
+ );
128
+ $fields[] = array(
129
+ 'name' => 'billing_email',
130
+ 'label' => __( 'Billing: E-mail Address', 'woocommerce-exporter' )
131
+ );
132
+ $fields[] = array(
133
+ 'name' => 'shipping_full_name',
134
+ 'label' => __( 'Shipping: Full Name', 'woocommerce-exporter' )
135
+ );
136
+ $fields[] = array(
137
+ 'name' => 'shipping_first_name',
138
+ 'label' => __( 'Shipping: First Name', 'woocommerce-exporter' )
139
+ );
140
+ $fields[] = array(
141
+ 'name' => 'shipping_last_name',
142
+ 'label' => __( 'Shipping: Last Name', 'woocommerce-exporter' )
143
+ );
144
+ $fields[] = array(
145
+ 'name' => 'shipping_company',
146
+ 'label' => __( 'Shipping: Company', 'woocommerce-exporter' )
147
+ );
148
+ $fields[] = array(
149
+ 'name' => 'shipping_address',
150
+ 'label' => __( 'Shipping: Street Address', 'woocommerce-exporter' )
151
+ );
152
+ $fields[] = array(
153
+ 'name' => 'shipping_city',
154
+ 'label' => __( 'Shipping: City', 'woocommerce-exporter' )
155
+ );
156
+ $fields[] = array(
157
+ 'name' => 'shipping_postcode',
158
+ 'label' => __( 'Shipping: ZIP Code', 'woocommerce-exporter' )
159
+ );
160
+ $fields[] = array(
161
+ 'name' => 'shipping_state',
162
+ 'label' => __( 'Shipping: State (prefix)', 'woocommerce-exporter' )
163
+ );
164
+ $fields[] = array(
165
+ 'name' => 'shipping_state_full',
166
+ 'label' => __( 'Shipping: State', 'woocommerce-exporter' )
167
+ );
168
+ $fields[] = array(
169
+ 'name' => 'shipping_country',
170
+ 'label' => __( 'Shipping: Country (prefix)', 'woocommerce-exporter' )
171
+ );
172
+ $fields[] = array(
173
+ 'name' => 'shipping_country_full',
174
+ 'label' => __( 'Shipping: Country', 'woocommerce-exporter' )
175
+ );
176
+ $fields[] = array(
177
+ 'name' => 'total_spent',
178
+ 'label' => __( 'Total Spent', 'woocommerce-exporter' )
179
+ );
180
+ $fields[] = array(
181
+ 'name' => 'completed_orders',
182
+ 'label' => __( 'Completed Orders', 'woocommerce-exporter' )
183
+ );
184
+ $fields[] = array(
185
+ 'name' => 'total_orders',
186
+ 'label' => __( 'Total Orders', 'woocommerce-exporter' )
187
+ );
188
+
189
+ /*
190
+ $fields[] = array(
191
+ 'name' => '',
192
+ 'label' => __( '', 'woocommerce-exporter' )
193
+ );
194
+ */
195
+
196
+ // Drop in our content filters here
197
+ add_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
198
+
199
+ // Allow Plugin/Theme authors to add support for additional columns
200
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
201
+
202
+ // Remove our content filters here to play nice with other Plugins
203
+ remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
204
+
205
+ switch( $format ) {
206
+
207
+ case 'summary':
208
+ $output = array();
209
+ $size = count( $fields );
210
+ for( $i = 0; $i < $size; $i++ ) {
211
+ if( isset( $fields[$i] ) )
212
+ $output[$fields[$i]['name']] = 'on';
213
+ }
214
+ return $output;
215
+ break;
216
+
217
+ case 'full':
218
+ default:
219
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
220
+ $size = count( $fields );
221
+ for( $i = 0; $i < $size; $i++ ) {
222
+ $fields[$i]['reset'] = $i;
223
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
224
+ }
225
+ // Check if we are using PHP 5.3 and above
226
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
227
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
228
+ return $fields;
229
+ break;
230
+
231
+ }
232
+
233
+ }
234
+
235
+ function woo_ce_override_customer_field_labels( $fields = array() ) {
236
+
237
+ $labels = woo_ce_get_option( 'customer_labels', array() );
238
+ if( !empty( $labels ) ) {
239
+ foreach( $fields as $key => $field ) {
240
+ if( isset( $labels[$field['name']] ) )
241
+ $fields[$key]['label'] = $labels[$field['name']];
242
+ }
243
+ }
244
+ return $fields;
245
+
246
+ }
247
+ add_filter( 'woo_ce_customer_fields', 'woo_ce_override_customer_field_labels', 11 );
248
+ ?>
includes/customers.php DELETED
@@ -1,210 +0,0 @@
1
- <?php
2
- if( is_admin() ) {
3
-
4
- /* Start of: WordPress Administration */
5
-
6
- // HTML template for disabled Filter Customers by Order Status widget on Store Exporter screen
7
- function woo_ce_customers_filter_by_status() {
8
-
9
- $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
10
- $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woo_ce' ) . '</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', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></p>
16
- <div id="export-customers-filters-status" class="separator">
17
- <ul>
18
- <?php if( $order_statuses ) { ?>
19
- <?php foreach( $order_statuses as $order_status ) { ?>
20
- <li><label><input type="checkbox" name="customer_filter_status[<?php echo $order_status->name; ?>]" value="<?php echo $order_status->name; ?>" disabled="disabled" /> <?php echo ucfirst( $order_status->name ); ?></label></li>
21
- <?php } ?>
22
- <?php } else { ?>
23
- <li><?php _e( 'No Order Status\'s were found.', 'jigo_ce' ); ?></li>
24
- <?php } ?>
25
- </ul>
26
- <p class="description"><?php _e( 'Select the Order Status you want to filter exported Customers by. Default is to include all Order Status options.', 'woo_ce' ); ?></p>
27
- </div>
28
- <!-- #export-customers-filters-status -->
29
- <?php
30
- ob_end_flush();
31
-
32
- }
33
-
34
- /* End of: WordPress Administration */
35
-
36
- }
37
-
38
- // Returns a list of Customer export columns
39
- function woo_ce_get_customer_fields( $format = 'full' ) {
40
-
41
- $export_type = 'customer';
42
-
43
- $fields = array();
44
- $fields[] = array(
45
- 'name' => 'user_id',
46
- 'label' => __( 'User ID', 'woo_ce' )
47
- );
48
- $fields[] = array(
49
- 'name' => 'user_name',
50
- 'label' => __( 'Username', 'woo_ce' )
51
- );
52
- $fields[] = array(
53
- 'name' => 'user_role',
54
- 'label' => __( 'User Role', 'woo_ce' )
55
- );
56
- $fields[] = array(
57
- 'name' => 'billing_full_name',
58
- 'label' => __( 'Billing: Full Name', 'woo_ce' )
59
- );
60
- $fields[] = array(
61
- 'name' => 'billing_first_name',
62
- 'label' => __( 'Billing: First Name', 'woo_ce' )
63
- );
64
- $fields[] = array(
65
- 'name' => 'billing_last_name',
66
- 'label' => __( 'Billing: Last Name', 'woo_ce' )
67
- );
68
- $fields[] = array(
69
- 'name' => 'billing_company',
70
- 'label' => __( 'Billing: Company', 'woo_ce' )
71
- );
72
- $fields[] = array(
73
- 'name' => 'billing_address',
74
- 'label' => __( 'Billing: Street Address', 'woo_ce' )
75
- );
76
- $fields[] = array(
77
- 'name' => 'billing_city',
78
- 'label' => __( 'Billing: City', 'woo_ce' )
79
- );
80
- $fields[] = array(
81
- 'name' => 'billing_postcode',
82
- 'label' => __( 'Billing: ZIP Code', 'woo_ce' )
83
- );
84
- $fields[] = array(
85
- 'name' => 'billing_state',
86
- 'label' => __( 'Billing: State (prefix)', 'woo_ce' )
87
- );
88
- $fields[] = array(
89
- 'name' => 'billing_state_full',
90
- 'label' => __( 'Billing: State', 'woo_ce' )
91
- );
92
- $fields[] = array(
93
- 'name' => 'billing_country',
94
- 'label' => __( 'Billing: Country', 'woo_ce' )
95
- );
96
- $fields[] = array(
97
- 'name' => 'billing_phone',
98
- 'label' => __( 'Billing: Phone Number', 'woo_ce' )
99
- );
100
- $fields[] = array(
101
- 'name' => 'billing_email',
102
- 'label' => __( 'Billing: E-mail Address', 'woo_ce' )
103
- );
104
- $fields[] = array(
105
- 'name' => 'shipping_full_name',
106
- 'label' => __( 'Shipping: Full Name', 'woo_ce' )
107
- );
108
- $fields[] = array(
109
- 'name' => 'shipping_first_name',
110
- 'label' => __( 'Shipping: First Name', 'woo_ce' )
111
- );
112
- $fields[] = array(
113
- 'name' => 'shipping_last_name',
114
- 'label' => __( 'Shipping: Last Name', 'woo_ce' )
115
- );
116
- $fields[] = array(
117
- 'name' => 'shipping_company',
118
- 'label' => __( 'Shipping: Company', 'woo_ce' )
119
- );
120
- $fields[] = array(
121
- 'name' => 'shipping_address',
122
- 'label' => __( 'Shipping: Street Address', 'woo_ce' )
123
- );
124
- $fields[] = array(
125
- 'name' => 'shipping_city',
126
- 'label' => __( 'Shipping: City', 'woo_ce' )
127
- );
128
- $fields[] = array(
129
- 'name' => 'shipping_postcode',
130
- 'label' => __( 'Shipping: ZIP Code', 'woo_ce' )
131
- );
132
- $fields[] = array(
133
- 'name' => 'shipping_state',
134
- 'label' => __( 'Shipping: State (prefix)', 'woo_ce' )
135
- );
136
- $fields[] = array(
137
- 'name' => 'shipping_state_full',
138
- 'label' => __( 'Shipping: State', 'woo_ce' )
139
- );
140
- $fields[] = array(
141
- 'name' => 'shipping_country',
142
- 'label' => __( 'Shipping: Country (prefix)', 'woo_ce' )
143
- );
144
- $fields[] = array(
145
- 'name' => 'shipping_country_full',
146
- 'label' => __( 'Shipping: Country', 'woo_ce' )
147
- );
148
- $fields[] = array(
149
- 'name' => 'total_spent',
150
- 'label' => __( 'Total Spent', 'woo_ce' )
151
- );
152
- $fields[] = array(
153
- 'name' => 'completed_orders',
154
- 'label' => __( 'Completed Orders', 'woo_ce' )
155
- );
156
- $fields[] = array(
157
- 'name' => 'total_orders',
158
- 'label' => __( 'Total Orders', 'woo_ce' )
159
- );
160
-
161
- /*
162
- $fields[] = array(
163
- 'name' => '',
164
- 'label' => __( '', 'woo_ce' )
165
- );
166
- */
167
-
168
- // Allow Plugin/Theme authors to add support for additional columns
169
- $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
170
-
171
- switch( $format ) {
172
-
173
- case 'summary':
174
- $output = array();
175
- $size = count( $fields );
176
- for( $i = 0; $i < $size; $i++ ) {
177
- if( isset( $fields[$i] ) )
178
- $output[$fields[$i]['name']] = 'on';
179
- }
180
- return $output;
181
- break;
182
-
183
- case 'full':
184
- default:
185
- $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
186
- $size = count( $fields );
187
- for( $i = 0; $i < $size; $i++ )
188
- $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
189
- usort( $fields, woo_ce_sort_fields( 'order' ) );
190
- return $fields;
191
- break;
192
-
193
- }
194
-
195
- }
196
-
197
- function woo_ce_override_customer_field_labels( $fields = array() ) {
198
-
199
- $labels = woo_ce_get_option( 'customer_labels', array() );
200
- if( !empty( $labels ) ) {
201
- foreach( $fields as $key => $field ) {
202
- if( isset( $labels[$field['name']] ) )
203
- $fields[$key]['label'] = $labels[$field['name']];
204
- }
205
- }
206
- return $fields;
207
-
208
- }
209
- add_filter( 'woo_ce_customer_fields', 'woo_ce_override_customer_field_labels', 11 );
210
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/export-csv.php CHANGED
@@ -3,7 +3,7 @@
3
  function woo_ce_generate_csv_filename( $export_type = '' ) {
4
 
5
  // Get the filename from WordPress options
6
- $filename = woo_ce_get_option( 'export_filename', 'woo-export_%dataset%-%date%.csv' );
7
 
8
  // Strip other file extensions if present
9
  $filename = str_replace( array( 'xml', 'xls' ), 'csv', $filename );
@@ -17,12 +17,14 @@ function woo_ce_generate_csv_filename( $export_type = '' ) {
17
  // Populate the available tags
18
  $date = date( 'Y_m_d' );
19
  $time = date( 'H_i_s' );
 
20
  $store_name = sanitize_title( get_bloginfo( 'name' ) );
21
 
22
  // Switch out the tags for filled values
23
  $filename = str_replace( '%dataset%', $export_type, $filename );
24
  $filename = str_replace( '%date%', $date, $filename );
25
  $filename = str_replace( '%time%', $time, $filename );
 
26
  $filename = str_replace( '%store_name%', $store_name, $filename );
27
 
28
  // Return the filename
3
  function woo_ce_generate_csv_filename( $export_type = '' ) {
4
 
5
  // Get the filename from WordPress options
6
+ $filename = woo_ce_get_option( 'export_filename', 'woo-export_%dataset%-%date%-%random%.csv' );
7
 
8
  // Strip other file extensions if present
9
  $filename = str_replace( array( 'xml', 'xls' ), 'csv', $filename );
17
  // Populate the available tags
18
  $date = date( 'Y_m_d' );
19
  $time = date( 'H_i_s' );
20
+ $random = mt_rand( 10000000, 99999999 );
21
  $store_name = sanitize_title( get_bloginfo( 'name' ) );
22
 
23
  // Switch out the tags for filled values
24
  $filename = str_replace( '%dataset%', $export_type, $filename );
25
  $filename = str_replace( '%date%', $date, $filename );
26
  $filename = str_replace( '%time%', $time, $filename );
27
+ $filename = str_replace( '%random%', $random, $filename );
28
  $filename = str_replace( '%store_name%', $store_name, $filename );
29
 
30
  // Return the filename
includes/formatting.php CHANGED
@@ -15,38 +15,41 @@ function woo_ce_file_encoding( $content = '' ) {
15
 
16
  }
17
 
 
18
  function woo_ce_display_memory( $memory = 0 ) {
19
 
20
  $output = '-';
21
  if( !empty( $output ) )
22
- $output = sprintf( __( '%s MB', 'woo_ce' ), $memory );
23
  echo $output;
24
 
25
  }
26
 
 
27
  function woo_ce_display_time_elapsed( $from, $to ) {
28
 
29
- $output = __( '1 second', 'woo_ce' );
30
  $time = $to - $from;
31
  $tokens = array (
32
- 31536000 => __( 'year', 'woo_ce' ),
33
- 2592000 => __( 'month', 'woo_ce' ),
34
- 604800 => __( 'week', 'woo_ce' ),
35
- 86400 => __( 'day', 'woo_ce' ),
36
- 3600 => __( 'hour', 'woo_ce' ),
37
- 60 => __( 'minute', 'woo_ce' ),
38
- 1 => __( 'second', 'woo_ce' )
39
  );
40
- foreach ($tokens as $unit => $text) {
41
- if ($time < $unit) continue;
42
- $numberOfUnits = floor($time / $unit);
 
43
  $output = $numberOfUnits . ' ' . $text . ( ( $numberOfUnits > 1 ) ? 's' : '' );
44
  }
45
  return $output;
46
 
47
  }
48
 
49
- // This function escapes all cells in 'Excel' CSV escape formatting of a CSV file, also converts HTML entities to plain-text
50
  function woo_ce_escape_csv_value( $string = '', $delimiter = ',', $format = 'all' ) {
51
 
52
  $string = str_replace( '"', '""', $string );
@@ -68,11 +71,29 @@ function woo_ce_escape_csv_value( $string = '', $delimiter = ',', $format = 'all
68
 
69
  }
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  function woo_ce_count_object( $object = 0, $exclude_post_types = array() ) {
72
 
73
  $count = 0;
74
  if( is_object( $object ) ) {
75
- if( $exclude_post_types ) {
76
  $size = count( $exclude_post_types );
77
  for( $i = 0; $i < $size; $i++ ) {
78
  if( isset( $object->$exclude_post_types[$i] ) )
@@ -90,12 +111,13 @@ function woo_ce_count_object( $object = 0, $exclude_post_types = array() ) {
90
 
91
  }
92
 
 
93
  function woo_ce_convert_product_ids( $product_ids = null ) {
94
 
95
  global $export;
96
 
97
  $output = '';
98
- if( $product_ids ) {
99
  if( is_array( $product_ids ) ) {
100
  $size = count( $product_ids );
101
  for( $i = 0; $i < $size; $i++ )
@@ -109,87 +131,50 @@ function woo_ce_convert_product_ids( $product_ids = null ) {
109
 
110
  }
111
 
112
- function woo_ce_format_visibility( $visibility = '' ) {
113
-
114
- $output = '';
115
- if( $visibility ) {
116
- switch( $visibility ) {
117
-
118
- case 'visible':
119
- $output = __( 'Catalog & Search', 'woo_ce' );
120
- break;
121
-
122
- case 'catalog':
123
- $output = __( 'Catalog', 'woo_ce' );
124
- break;
125
-
126
- case 'search':
127
- $output = __( 'Search', 'woo_ce' );
128
- break;
129
-
130
- case 'hidden':
131
- $output = __( 'Hidden', 'woo_ce' );
132
- break;
133
-
134
- }
135
- }
136
- return $output;
137
-
138
- }
139
-
140
- function woo_ce_format_download_type( $download_type = '' ) {
141
-
142
- $output = __( 'Standard', 'woo_ce' );
143
- if( $download_type ) {
144
- switch( $download_type ) {
145
 
146
- case 'application':
147
- $output = __( 'Application', 'woo_ce' );
148
- break;
149
-
150
- case 'music':
151
- $output = __( 'Music', 'woo_ce' );
152
- break;
153
-
154
- }
155
- }
156
- return $output;
157
-
158
- }
159
-
160
- function woo_ce_format_product_status( $product_status = '' ) {
161
-
162
- $output = $product_status;
163
- switch( $product_status ) {
164
 
165
  case 'publish':
166
- $output = __( 'Publish', 'woo_ce' );
167
  break;
168
 
169
  case 'draft':
170
- $output = __( 'Draft', 'woo_ce' );
 
 
 
 
 
 
 
 
171
  break;
172
 
173
  case 'trash':
174
- $output = __( 'Trash', 'woo_ce' );
175
  break;
176
 
177
  }
 
178
  return $output;
179
 
180
  }
181
 
 
182
  function woo_ce_format_comment_status( $comment_status ) {
183
 
184
  $output = $comment_status;
185
  switch( $comment_status ) {
186
 
187
  case 'open':
188
- $output = __( 'Open', 'woo_ce' );
189
  break;
190
 
191
  case 'closed':
192
- $output = __( 'Closed', 'woo_ce' );
193
  break;
194
 
195
  }
@@ -231,11 +216,11 @@ function woo_ce_format_switch( $input = '', $output_format = 'answer' ) {
231
  switch( $input ) {
232
 
233
  case '1':
234
- $output = __( 'Yes', 'woo_ce' );
235
  break;
236
 
237
  case '0':
238
- $output = __( 'No', 'woo_ce' );
239
  break;
240
 
241
  }
@@ -260,87 +245,20 @@ function woo_ce_format_switch( $input = '', $output_format = 'answer' ) {
260
 
261
  }
262
 
263
- function woo_ce_format_stock_status( $stock_status = '', $stock = '' ) {
264
-
265
- $output = '';
266
- if( empty( $stock_status ) && !empty( $stock ) ) {
267
- if( $stock )
268
- $stock_status = 'instock';
269
- else
270
- $stock_status = 'outofstock';
271
- }
272
- if( $stock_status ) {
273
- switch( $stock_status ) {
274
-
275
- case 'instock':
276
- $output = __( 'In Stock', 'woo_ce' );
277
- break;
278
-
279
- case 'outofstock':
280
- $output = __( 'Out of Stock', 'woo_ce' );
281
- break;
282
-
283
- }
284
- }
285
- return $output;
286
-
287
- }
288
-
289
- function woo_ce_format_tax_status( $tax_status = null ) {
290
-
291
- $output = '';
292
- if( $tax_status ) {
293
- switch( $tax_status ) {
294
-
295
- case 'taxable':
296
- $output = __( 'Taxable', 'woo_ce' );
297
- break;
298
-
299
- case 'shipping':
300
- $output = __( 'Shipping Only', 'woo_ce' );
301
- break;
302
-
303
- case 'none':
304
- $output = __( 'None', 'woo_ce' );
305
- break;
306
-
307
- }
308
- }
309
- return $output;
310
-
311
- }
312
-
313
- function woo_ce_format_tax_class( $tax_class = '' ) {
314
-
315
- global $export;
316
-
317
- $output = '';
318
- if( $tax_class ) {
319
- switch( $tax_class ) {
320
-
321
- case '*':
322
- $tax_class = __( 'Standard', 'woo_ce' );
323
- break;
324
-
325
- case 'reduced-rate':
326
- $tax_class = __( 'Reduced Rate', 'woo_ce' );
327
- break;
328
-
329
- case 'zero-rate':
330
- $tax_class = __( 'Zero Rate', 'woo_ce' );
331
- break;
332
-
333
- }
334
- $output = $tax_class;
335
- }
336
- return $output;
337
-
338
- }
339
-
340
  function woo_ce_format_product_filters( $product_filters = array() ) {
341
 
342
  $output = array();
343
  if( !empty( $product_filters ) ) {
 
 
 
 
 
 
 
 
 
 
344
  foreach( $product_filters as $product_filter )
345
  $output[] = $product_filter;
346
  }
@@ -359,70 +277,91 @@ function woo_ce_format_user_role_filters( $user_role_filters = array() ) {
359
 
360
  }
361
 
362
- function woo_ce_format_user_role_label( $user_role = '' ) {
363
-
364
- global $wp_roles;
 
 
 
 
 
 
 
 
 
 
 
 
 
365
 
366
- $output = $user_role;
367
- if( $user_role ) {
368
- $user_roles = woo_ce_get_user_roles();
369
- if( isset( $user_roles[$user_role] ) )
370
- $output = ucfirst( $user_roles[$user_role]['name'] );
371
- unset( $user_roles );
372
  }
373
- return $output;
374
-
375
  }
376
 
377
- function woo_ce_format_product_type( $type_id = '' ) {
378
-
379
- $output = $type_id;
380
- if( $output ) {
381
- $product_types = apply_filters( 'woo_ce_format_product_types', array(
382
- 'simple' => __( 'Simple Product', 'woocommerce' ),
383
- 'downloadable' => __( 'Downloadable', 'woocommerce' ),
384
- 'grouped' => __( 'Grouped Product', 'woocommerce' ),
385
- 'virtual' => __( 'Virtual', 'woocommerce' ),
386
- 'variable' => __( 'Variable', 'woocommerce' ),
387
- 'external' => __( 'External/Affiliate Product', 'woocommerce' ),
388
- 'variation' => __( 'Variation', 'woo_ce' )
389
- ) );
390
- if( isset( $product_types[$type_id] ) )
391
- $output = $product_types[$type_id];
392
- }
393
- return $output;
394
 
395
  }
396
 
397
- function woo_ce_format_price( $price = '' ) {
398
 
399
- // Check that a valid price has been provided and that wc_format_localized_price() exists
400
- if( isset( $price ) && $price != '' && function_exists( 'wc_format_localized_price' ) )
401
- return wc_format_localized_price( $price );
402
- else
403
- return $price;
404
 
405
  }
406
 
407
- function woo_ce_format_sale_price_dates( $sale_date = '' ) {
 
408
 
409
- $output = $sale_date;
410
- if( $sale_date )
411
- $output = woo_ce_format_date( date( 'Y-m-d H:i:s', $sale_date ) );
412
- return $output;
413
 
414
  }
415
 
416
- function woo_ce_format_date( $date = '' ) {
417
 
418
  $output = $date;
419
  $date_format = woo_ce_get_option( 'date_format', 'd/m/Y' );
420
- if( !empty( $date ) && $date_format != '' )
 
 
421
  $output = mysql2date( $date_format, $date );
 
422
  return $output;
423
 
424
  }
425
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
426
  function woo_ce_format_product_category_label( $product_category = '', $parent_category = '' ) {
427
 
428
  $output = $product_category;
@@ -432,6 +371,19 @@ function woo_ce_format_product_category_label( $product_category = '', $parent_c
432
 
433
  }
434
 
 
 
 
 
 
 
 
 
 
 
 
 
 
435
  if( !function_exists( 'woo_ce_expand_state_name' ) ) {
436
  function woo_ce_expand_state_name( $country_prefix = '', $state_prefix = '' ) {
437
 
@@ -455,17 +407,39 @@ if( !function_exists( 'woo_ce_expand_state_name' ) ) {
455
  if( !function_exists( 'woo_ce_expand_country_name' ) ) {
456
  function woo_ce_expand_country_name( $country_prefix = '' ) {
457
 
458
- global $woocommerce;
459
-
460
  $output = $country_prefix;
461
- if( $output && method_exists( $woocommerce, 'countries' ) ) {
462
- $countries = $woocommerce->countries;
463
- if( isset( $countries[$country_prefix] ) )
464
- $output = $countries[$country_prefix];
 
465
  unset( $countries );
466
  }
467
  return $output;
468
 
469
  }
470
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
471
  ?>
15
 
16
  }
17
 
18
+ // Format the raw memory data provided by PHP
19
  function woo_ce_display_memory( $memory = 0 ) {
20
 
21
  $output = '-';
22
  if( !empty( $output ) )
23
+ $output = sprintf( __( '%s MB', 'woocommerce-exporter' ), $memory );
24
  echo $output;
25
 
26
  }
27
 
28
+ // Format the raw timestamps to something more friendly
29
  function woo_ce_display_time_elapsed( $from, $to ) {
30
 
31
+ $output = __( '1 second', 'woocommerce-exporter' );
32
  $time = $to - $from;
33
  $tokens = array (
34
+ 31536000 => __( 'year', 'woocommerce-exporter' ),
35
+ 2592000 => __( 'month', 'woocommerce-exporter' ),
36
+ 604800 => __( 'week', 'woocommerce-exporter' ),
37
+ 86400 => __( 'day', 'woocommerce-exporter' ),
38
+ 3600 => __( 'hour', 'woocommerce-exporter' ),
39
+ 60 => __( 'minute', 'woocommerce-exporter' ),
40
+ 1 => __( 'second', 'woocommerce-exporter' )
41
  );
42
+ foreach( $tokens as $unit => $text ) {
43
+ if( $time < $unit )
44
+ continue;
45
+ $numberOfUnits = floor( $time / $unit );
46
  $output = $numberOfUnits . ' ' . $text . ( ( $numberOfUnits > 1 ) ? 's' : '' );
47
  }
48
  return $output;
49
 
50
  }
51
 
52
+ // Escape all cells in 'Excel' CSV escape formatting of a CSV file, also converts HTML entities to plain-text
53
  function woo_ce_escape_csv_value( $string = '', $delimiter = ',', $format = 'all' ) {
54
 
55
  $string = str_replace( '"', '""', $string );
71
 
72
  }
73
 
74
+ function woo_ce_attribute_escape( $safe_text = '', $text = '' ) {
75
+
76
+ if( substr( $safe_text, 0, 1 ) == '=' ) {
77
+ $safe_text = ltrim( $safe_text, '=' );
78
+ }
79
+ return $safe_text;
80
+
81
+ }
82
+
83
+ function woo_ce_sanitize_key( $key ) {
84
+
85
+ // Limit length of key to 48 characters
86
+ $key = substr( $key, 0, 48 );
87
+ return $key;
88
+
89
+ }
90
+
91
+ // Return the element count of an object
92
  function woo_ce_count_object( $object = 0, $exclude_post_types = array() ) {
93
 
94
  $count = 0;
95
  if( is_object( $object ) ) {
96
+ if( !empty( $exclude_post_types ) ) {
97
  $size = count( $exclude_post_types );
98
  for( $i = 0; $i < $size; $i++ ) {
99
  if( isset( $object->$exclude_post_types[$i] ) )
111
 
112
  }
113
 
114
+ // Takes an array or comma separated string and returns an export formatted string
115
  function woo_ce_convert_product_ids( $product_ids = null ) {
116
 
117
  global $export;
118
 
119
  $output = '';
120
+ if( $product_ids !== null ) {
121
  if( is_array( $product_ids ) ) {
122
  $size = count( $product_ids );
123
  for( $i = 0; $i < $size; $i++ )
131
 
132
  }
133
 
134
+ // Format the raw post_status
135
+ function woo_ce_format_post_status( $post_status = '' ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
 
137
+ $output = $post_status;
138
+ switch( $post_status ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
 
140
  case 'publish':
141
+ $output = __( 'Publish', 'woocommerce-exporter' );
142
  break;
143
 
144
  case 'draft':
145
+ $output = __( 'Draft', 'woocommerce-exporter' );
146
+ break;
147
+
148
+ case 'pending':
149
+ $output = __( 'Pending', 'woocommerce-exporter' );
150
+ break;
151
+
152
+ case 'private':
153
+ $output = __( 'Private', 'woocommerce-exporter' );
154
  break;
155
 
156
  case 'trash':
157
+ $output = __( 'Trash', 'woocommerce-exporter' );
158
  break;
159
 
160
  }
161
+ $output = apply_filters( 'woo_ce_format_post_status', $output, $post_status );
162
  return $output;
163
 
164
  }
165
 
166
+ // Format the raw comment_status
167
  function woo_ce_format_comment_status( $comment_status ) {
168
 
169
  $output = $comment_status;
170
  switch( $comment_status ) {
171
 
172
  case 'open':
173
+ $output = __( 'Open', 'woocommerce-exporter' );
174
  break;
175
 
176
  case 'closed':
177
+ $output = __( 'Closed', 'woocommerce-exporter' );
178
  break;
179
 
180
  }
216
  switch( $input ) {
217
 
218
  case '1':
219
+ $output = __( 'Yes', 'woocommerce-exporter' );
220
  break;
221
 
222
  case '0':
223
+ $output = __( 'No', 'woocommerce-exporter' );
224
  break;
225
 
226
  }
245
 
246
  }
247
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  function woo_ce_format_product_filters( $product_filters = array() ) {
249
 
250
  $output = array();
251
  if( !empty( $product_filters ) ) {
252
+ $size = count( $product_filters );
253
+ if( $size == 1 ) {
254
+ // Check if we are dealing with an empty array or zero key
255
+ if( isset( $product_filters[0] ) && $product_filters[0] == '' ) {
256
+ return;
257
+ // Check if we are dealing with Select2 Enhanced
258
+ } else if( isset( $product_filters[0] ) && strpos( $product_filters[0], ',' ) !== false ) {
259
+ $product_filters = explode( ',', $product_filters[0] );
260
+ }
261
+ }
262
  foreach( $product_filters as $product_filter )
263
  $output[] = $product_filter;
264
  }
277
 
278
  }
279
 
280
+ // Allow store owners to create their own woo_ce_format_price() as needed
281
+ if( !function_exists( 'woo_ce_format_price' ) ) {
282
+ function woo_ce_format_price( $price = '', $currency = '' ) {
283
+
284
+ // Check that a valid price has been provided and that wc_price() exists
285
+ if( $price !== false && function_exists( 'wc_price' ) ) {
286
+ // WooCommerce adds currency formatting to the price, let's not do that
287
+ add_filter( 'wc_price', 'woo_ce_filter_wc_price', 10, 3 );
288
+ add_filter( 'formatted_woocommerce_price', 'woo_ce_formatted_woocommerce_price', 10, 5 );
289
+ add_filter( 'woocommerce_currency_symbol', 'woo_ce_woocommerce_currency_symbol', 10, 2 );
290
+ $price = wc_price( $price, array( 'currency' => $currency ) );
291
+ remove_filter( 'formatted_woocommerce_price', 'woo_ce_formatted_woocommerce_price' );
292
+ remove_filter( 'wc_price', 'woo_ce_filter_wc_price' );
293
+ remove_filter( 'woocommerce_currency_symbol', 'woo_ce_woocommerce_currency_symbol' );
294
+ }
295
+ return $price;
296
 
 
 
 
 
 
 
297
  }
 
 
298
  }
299
 
300
+ function woo_ce_filter_wc_price( $return, $price ) {
301
+
302
+ // Check price for negative values; weird method but neccesary
303
+ if( strstr( $return, '<span class="woocommerce-Price-amount amount">-' ) )
304
+ $price = '-' . $price;
305
+
306
+ return $price;
 
 
 
 
 
 
 
 
 
 
307
 
308
  }
309
 
310
+ function woo_ce_formatted_woocommerce_price( $return, $price, $num_decimals, $decimal_sep, $thousands_sep ) {
311
 
312
+ $decimal_sep = apply_filters( 'woo_ce_wc_price_decimal_sep', $decimal_sep );
313
+ $thousands_sep = apply_filters( 'woo_ce_wc_price_thousands_sep', $thousands_sep );
314
+
315
+ $price = number_format( $price, $num_decimals, $decimal_sep, $thousands_sep );
316
+ return $price;
317
 
318
  }
319
 
320
+ // Strip the currency symbol from the price
321
+ function woo_ce_woocommerce_currency_symbol( $currency_symbol, $currency ) {
322
 
323
+ $currency_symbol = apply_filters( 'woo_ce_wc_price_currency_symbol', '', $currency_symbol, $currency );
324
+ return $currency_symbol;
 
 
325
 
326
  }
327
 
328
+ function woo_ce_format_date( $date = '', $format = '' ) {
329
 
330
  $output = $date;
331
  $date_format = woo_ce_get_option( 'date_format', 'd/m/Y' );
332
+ if( !empty( $format ) )
333
+ $date_format = $format;
334
+ if( !empty( $date ) && $date_format != '' ) {
335
  $output = mysql2date( $date_format, $date );
336
+ }
337
  return $output;
338
 
339
  }
340
 
341
+ // Take our pretty slashed date format and make it play nice with strtotime() and date()
342
+ function woo_ce_format_order_date( $date = '', $format = 'export' ) {
343
+
344
+ $output = $date;
345
+ if( !empty( $date ) ) {
346
+ $output = str_replace( '/', '-', $date );
347
+ }
348
+ return $output;
349
+
350
+ }
351
+
352
+ function woo_ce_format_archive_date( $post_ID = 0, $time = false ) {
353
+
354
+ if( $time == false )
355
+ $time = get_post_time( 'G', true, $post_ID, false );
356
+ if( ( abs( $t_diff = time() - $time ) ) < 86400 )
357
+ $post_date = sprintf( __( '%s ago' ), human_time_diff( $time ) );
358
+ else
359
+ $post_date = mysql2date( get_option( 'date_format', 'd/m/Y' ), date( 'Y/m/d', $time ) );
360
+ unset( $time );
361
+ return $post_date;
362
+
363
+ }
364
+
365
  function woo_ce_format_product_category_label( $product_category = '', $parent_category = '' ) {
366
 
367
  $output = $product_category;
371
 
372
  }
373
 
374
+ function woo_ce_clean_export_label( $label = '' ) {
375
+
376
+ // If the first character is an underscore remove it
377
+ if( $label[0] === '_' )
378
+ $label = substr( $label, 1 );
379
+ // Replace any underscores with spaces
380
+ $label = str_replace( '_', ' ', $label );
381
+ // Auto-capitalise label
382
+ $label = ucfirst( $label );
383
+ return $label;
384
+
385
+ }
386
+
387
  if( !function_exists( 'woo_ce_expand_state_name' ) ) {
388
  function woo_ce_expand_state_name( $country_prefix = '', $state_prefix = '' ) {
389
 
407
  if( !function_exists( 'woo_ce_expand_country_name' ) ) {
408
  function woo_ce_expand_country_name( $country_prefix = '' ) {
409
 
 
 
410
  $output = $country_prefix;
411
+ if( !empty( $output ) && class_exists( 'WC_Countries' ) ) {
412
+ if( $countries = woo_ce_allowed_countries() ) {
413
+ if( isset( $countries[$country_prefix] ) )
414
+ $output = $countries[$country_prefix];
415
+ }
416
  unset( $countries );
417
  }
418
  return $output;
419
 
420
  }
421
  }
422
+
423
+ function woo_ce_allowed_countries() {
424
+
425
+ if( apply_filters( 'woo_ce_override_wc_countries', true ) ) {
426
+ if( class_exists( 'WC_Countries' ) ) {
427
+ $countries = new WC_Countries();
428
+ if( method_exists( $countries, 'get_allowed_countries' ) ) {
429
+ $countries = $countries->get_allowed_countries();
430
+ return $countries;
431
+ }
432
+ }
433
+ }
434
+
435
+ }
436
+
437
+ function woo_ce_format_description_excerpt( $string = '' ) {
438
+
439
+ if( $description_excerpt_formatting = woo_ce_get_option( 'description_excerpt_formatting', 0 ) ) {
440
+ $string = wp_kses( $string, apply_filters( 'woo_ce_format_description_excerpt_allowed_html', array() ), apply_filters( 'woo_ce_format_description_excerpt_allowed_protocols', array() ) );
441
+ }
442
+ return apply_filters( 'woo_ce_format_description_excerpt', $string );
443
+
444
+ }
445
  ?>
includes/functions.php CHANGED
@@ -1,16 +1,40 @@
1
  <?php
2
- include_once( WOO_CE_PATH . 'includes/products.php' );
3
- include_once( WOO_CE_PATH . 'includes/categories.php' );
4
- include_once( WOO_CE_PATH . 'includes/tags.php' );
5
- include_once( WOO_CE_PATH . 'includes/brands.php' );
6
- include_once( WOO_CE_PATH . 'includes/orders.php' );
7
- include_once( WOO_CE_PATH . 'includes/customers.php' );
8
- include_once( WOO_CE_PATH . 'includes/users.php' );
9
- include_once( WOO_CE_PATH . 'includes/coupons.php' );
10
- include_once( WOO_CE_PATH . 'includes/subscriptions.php' );
11
- include_once( WOO_CE_PATH . 'includes/product_vendors.php' );
12
-
13
- if( version_compare( phpversion(), '5.3', '>=' ) )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  include_once( WOO_CE_PATH . 'includes/legacy.php' );
15
  include_once( WOO_CE_PATH . 'includes/formatting.php' );
16
 
@@ -21,270 +45,360 @@ if( is_admin() ) {
21
  /* Start of: WordPress Administration */
22
 
23
  include_once( WOO_CE_PATH . 'includes/admin.php' );
 
24
  include_once( WOO_CE_PATH . 'includes/settings.php' );
25
 
26
- function woo_ce_detect_non_woo_install() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
- $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/';
29
- if( !woo_is_woo_activated() && ( woo_is_jigo_activated() || woo_is_wpsc_activated() ) ) {
30
- $message = sprintf( __( 'We have detected another e-Commerce Plugin than WooCommerce activated, please check that you are using Store Exporter Deluxe for the correct platform. <a href="%s" target="_blank">Need help?</a>', 'woo_ce' ), $troubleshooting_url );
31
- woo_ce_admin_notice( $message, 'error', 'plugins.php' );
32
- } else if( !woo_is_woo_activated() ) {
33
- $message = sprintf( __( 'We have been unable to detect the WooCommerce Plugin activated on this WordPress site, please check that you are using Store Exporter Deluxe for the correct platform. <a href="%s" target="_blank">Need help?</a>', 'woo_ce' ), $troubleshooting_url );
34
- woo_ce_admin_notice( $message, 'error', 'plugins.php' );
35
  }
36
- woo_ce_plugin_page_notices();
37
 
38
  }
39
 
40
  // Displays a HTML notice when a WordPress or Store Exporter error is encountered
41
- function woo_ce_fail_notices() {
42
 
43
- woo_ce_memory_prompt();
44
 
45
- $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/';
46
  if( isset( $_GET['failed'] ) ) {
47
  $message = '';
48
  if( isset( $_GET['message'] ) )
49
  $message = urldecode( $_GET['message'] );
50
  if( $message )
51
- $message = sprintf( __( 'A WordPress or server error caused the exporter to fail, the exporter was provided with a reason: <em>%s</em>', 'woo_ce' ), $message ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woo_ce' ) . '</a>)';
52
  else
53
- $message = __( 'A WordPress or server error caused the exporter to fail, no reason was provided, please get in touch so we can reproduce and resolve this.', 'woo_ce' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woo_ce' ) . '</a>)';
54
  woo_ce_admin_notice_html( $message, 'error' );
55
  }
56
- if( get_transient( WOO_CE_PREFIX . '_running' ) ) {
57
- $message = __( 'A WordPress or server error caused the exporter to fail with a blank screen, this is either a memory or timeout issue, please get in touch so we can reproduce and resolve this.', 'woo_ce' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woo_ce' ) . '</a>)';
58
- woo_ce_admin_notice_html( $message, 'error' );
59
- delete_transient( WOO_CE_PREFIX . '_running' );
60
- }
61
 
62
- }
63
-
64
- function woo_ce_memory_prompt() {
65
-
66
- $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/';
 
 
 
 
 
67
 
68
  // Displays a HTML notice where the memory allocated to WordPress falls below 64MB
69
- $memory_limit = (int)( ini_get( 'memory_limit' ) );
70
- $minimum_memory_limit = 64;
71
- if( ( $memory_limit < $minimum_memory_limit ) && !woo_ce_get_option( 'dismiss_memory_prompt', 0 ) ) {
72
- $dismiss_url = add_query_arg( 'action', 'dismiss_memory_prompt' );
73
- $message = sprintf( __( 'We recommend setting memory to at least %dMB, your site has only %dMB allocated to it. See: <a href="%s" target="_blank">Increasing memory allocated to PHP</a>', 'woo_ce' ), $minimum_memory_limit, $memory_limit, $troubleshooting_url ) . '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woo_ce' ) . '</a></span>';
74
- woo_ce_admin_notice_html( $message, 'error' );
 
 
75
  }
76
 
 
77
  if( version_compare( phpversion(), '5.3', '<' ) && !woo_ce_get_option( 'dismiss_php_legacy', 0 ) ) {
78
- $dismiss_url = add_query_arg( 'action', 'dismiss_php_legacy' );
79
- $message = sprintf( __( 'Your PHP version (%s) is not supported and is very much out of date, since 2010 all users are strongly encouraged to upgrade to PHP 5.3+ and above. Contact your hosting provider to make this happen. See: <a href="%s" target="_blank">Migrating from PHP 5.2 to 5.3</a>', 'woo_ce' ), phpversion(), $troubleshooting_url ) . '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woo_ce' ) . '</a></span>';
80
  woo_ce_admin_notice_html( $message, 'error' );
81
  }
82
 
83
- }
84
-
85
- function woo_ce_plugin_page_notices() {
86
-
87
- global $pagenow;
88
-
89
- if( $pagenow == 'plugins.php' ) {
90
- if( woo_is_jigo_activated() || woo_is_wpsc_activated() ) {
91
- $r_plugins = array(
92
- 'woocommerce-exporter/exporter.php',
93
- 'woocommerce-store-exporter/exporter.php'
94
- );
95
- $i_plugins = get_plugins();
96
- foreach( $r_plugins as $path ) {
97
- if( isset( $i_plugins[$path] ) ) {
98
- add_action( 'after_plugin_row_' . $path, 'woo_ce_plugin_page_notice', 10, 3 );
99
- break;
100
  }
101
  }
102
  }
103
  }
104
- }
105
 
106
- function woo_ce_plugin_page_notice( $file, $data, $context ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
- if( is_plugin_active( $file ) ) { ?>
109
- <tr class='plugin-update-tr su-plugin-notice'>
110
- <td colspan='3' class='plugin-update colspanchange'>
111
- <div class='update-message'>
112
- <?php printf( __( '%1$s is intended to be used with a WooCommerce store, please check that you are using Store Exporter with the correct e-Commerce platform.', 'woo_ce' ), $data['Name'] ); ?>
113
- </div>
114
- </td>
115
- </tr>
116
- <?php
117
  }
118
 
119
  }
120
 
121
  // Saves the state of Export fields for next export
122
- function woo_ce_save_fields( $type = '', $fields = array(), $sorting = array() ) {
123
 
124
- if( $fields == false )
 
125
  $fields = array();
126
- $types = array_keys( woo_ce_return_export_types() );
127
- if( in_array( $type, $types ) && !empty( $fields ) ) {
128
- woo_ce_update_option( $type . '_fields', array_map( 'sanitize_text_field', $fields ) );
129
- woo_ce_update_option( $type . '_sorting', array_map( 'absint', $sorting ) );
130
  }
131
 
132
  }
133
 
134
  // Returns number of an Export type prior to export, used on Store Exporter screen
135
- function woo_ce_return_count( $export_type = '', $args = array() ) {
136
 
137
  global $wpdb;
138
 
139
  $count_sql = null;
 
 
140
  switch( $export_type ) {
141
 
142
  case 'product':
143
- $post_type = array( 'product', 'product_variation' );
144
- $args = array(
145
- 'post_type' => $post_type,
146
- 'posts_per_page' => 1,
147
- 'fields' => 'ids'
148
- );
149
- $query = new WP_Query( $args );
150
- $count = $query->found_posts;
151
  break;
152
 
153
  case 'category':
154
- $term_taxonomy = 'product_cat';
155
- $count = wp_count_terms( $term_taxonomy );
156
  break;
157
 
158
  case 'tag':
159
- $term_taxonomy = 'product_tag';
160
- $count = wp_count_terms( $term_taxonomy );
161
- break;
162
-
163
- case 'brand':
164
- $term_taxonomy = apply_filters( 'woo_ce_return_count_brand', 'product_brand' );
165
- $count = wp_count_terms( $term_taxonomy );
166
  break;
167
 
168
  case 'order':
169
- $post_type = 'shop_order';
170
- $args = array(
171
- 'post_type' => $post_type,
172
- 'posts_per_page' => 1,
173
- 'fields' => 'ids'
174
- );
175
- $query = new WP_Query( $args );
176
- $count = $query->found_posts;
177
  break;
178
 
179
  case 'customer':
180
- if( $users = woo_ce_return_count( 'user' ) > 1000 ) {
181
- $count = sprintf( '~%s+', 1000 );
182
- } else {
183
- $post_type = 'shop_order';
184
- $args = array(
185
- 'post_type' => $post_type,
186
- 'posts_per_page' => -1,
187
- 'fields' => 'ids'
188
- );
189
- // Check if this is a WooCommerce 2.2+ instance (new Post Status)
190
- $woocommerce_version = woo_get_woo_version();
191
- if( version_compare( $woocommerce_version, '2.2', '>=' ) ) {
192
- $args['post_status'] = apply_filters( 'woo_ce_customer_post_status', array( 'wc-pending', 'wc-on-hold', 'wc-processing', 'wc-completed' ) );
193
- } else {
194
- $args['post_status'] = apply_filters( 'woo_ce_customer_post_status', woo_ce_post_statuses() );
195
- $args['tax_query'] = array(
196
- array(
197
- 'taxonomy' => 'shop_order_status',
198
- 'field' => 'slug',
199
- 'terms' => array( 'pending', 'on-hold', 'processing', 'completed' )
200
- ),
201
- );
202
- }
203
- $orders = new WP_Query( $args );
204
- $count = $orders->found_posts;
205
- if( $count > 100 ) {
206
- $count = sprintf( '~%s', $count );
207
- } else {
208
- $customers = array();
209
- if ( $orders->have_posts() ) {
210
- while ( $orders->have_posts() ) {
211
- $orders->the_post();
212
- $email = get_post_meta( get_the_ID(), '_billing_email', true );
213
- if( !in_array( $email, $customers ) ) {
214
- $customers[get_the_ID()] = $email;
215
- }
216
- unset( $email );
217
- }
218
- $count = count( $customers );
219
- }
220
- wp_reset_postdata();
221
- }
222
- }
223
- /*
224
- if( false ) {
225
- $orders = get_posts( $args );
226
- if( $orders ) {
227
- $customers = array();
228
- foreach( $orders as $order ) {
229
- $order->email = get_post_meta( $order->ID, '_billing_email', true );
230
- if( empty( $order->email ) ) {
231
- if( $order->user_id = get_post_meta( $order->ID, '_customer_user', true ) ) {
232
- $user = get_userdata( $order->user_id );
233
- if( $user )
234
- $order->email = $user->user_email;
235
- unset( $user );
236
- } else {
237
- $order->email = '-';
238
- }
239
- }
240
- if( !in_array( $order->email, $customers ) ) {
241
- $customers[$order->ID] = $order->email;
242
- $count++;
243
- }
244
- }
245
- unset( $orders, $order );
246
- }
247
- }
248
- */
249
  break;
250
 
251
  case 'user':
252
- if( $users = count_users() )
253
- $count = $users['total_users'];
254
  break;
255
 
256
- case 'coupon':
257
- $post_type = 'shop_coupon';
258
- $count = wp_count_posts( $post_type );
259
  break;
260
 
261
- case 'subscription':
262
- $count = 0;
263
- // Check that WooCommerce Subscriptions exists
264
- if( class_exists( 'WC_Subscriptions_Manager' ) ) {
265
- // Check that the get_all_users_subscriptions() function exists
266
- if( method_exists( 'WC_Subscriptions_Manager', 'get_all_users_subscriptions' ) ) {
267
- if( $subscriptions = WC_Subscriptions_Manager::get_all_users_subscriptions() ) {
268
- foreach( $subscriptions as $key => $user_subscription ) {
269
- if( !empty( $user_subscription ) ) {
270
- foreach( $user_subscription as $subscription )
271
- $count++;
272
- }
273
- }
274
- unset( $subscriptions, $subscription, $user_subscription );
275
- }
276
- }
277
- }
278
  break;
279
 
280
- case 'product_vendors':
281
- $term_taxonomy = 'shop_vendor';
282
- $count = wp_count_terms( $term_taxonomy );
283
  break;
284
 
285
  case 'attribute':
286
- $attributes = ( function_exists( 'wc_get_attribute_taxonomies' ) ? wc_get_attribute_taxonomies() : array() );
287
- $count = count( $attributes );
 
 
 
 
 
288
  break;
289
 
290
  }
@@ -292,7 +406,7 @@ if( is_admin() ) {
292
  if( isset( $count ) ) {
293
  if( is_object( $count ) ) {
294
  $count = (array)$count;
295
- $count = (int)array_sum( $count );
296
  }
297
  return $count;
298
  } else {
@@ -309,43 +423,49 @@ if( is_admin() ) {
309
  }
310
 
311
  // In-line display of export file and export details when viewed via WordPress Media screen
312
- function woo_ce_read_csv_file( $post = null ) {
313
 
314
- if( !$post ) {
315
  if( isset( $_GET['post'] ) )
316
  $post = get_post( $_GET['post'] );
317
  }
318
 
319
  if( $post->post_type != 'attachment' )
320
- return false;
321
 
322
- if( !in_array( $post->post_mime_type, array( 'text/csv', 'xml/application', 'application/vnd.ms-excel' ) ) )
323
- return false;
 
324
 
325
- $filename = $post->post_name;
326
  $filepath = get_attached_file( $post->ID );
327
- $contents = __( 'No export entries were found, please try again with different export filters.', 'woo_ce' );
328
- if( file_exists( $filepath ) ) {
329
- $handle = fopen( $filepath, "r" );
330
- $contents = stream_get_contents( $handle );
331
- fclose( $handle );
332
- } else {
333
- // This resets the _wp_attached_file Post meta key to the correct value
334
- update_attached_file( $post->ID, $post->guid );
335
- // Try grabbing the file contents again
336
- $filepath = get_attached_file( $post->ID );
337
  if( file_exists( $filepath ) ) {
338
- $handle = fopen( $filepath, "r" );
339
- $contents = stream_get_contents( $handle );
340
- fclose( $handle );
 
 
 
 
 
 
 
 
341
  }
 
 
 
342
  }
343
- if( !empty( $contents ) )
344
- include_once( WOO_CE_PATH . 'templates/admin/media-csv_file.php' );
345
 
 
346
  $export_type = get_post_meta( $post->ID, '_woo_export_type', true );
347
  $columns = get_post_meta( $post->ID, '_woo_columns', true );
348
  $rows = get_post_meta( $post->ID, '_woo_rows', true );
 
349
  $start_time = get_post_meta( $post->ID, '_woo_start_time', true );
350
  $end_time = get_post_meta( $post->ID, '_woo_end_time', true );
351
  $idle_memory_start = get_post_meta( $post->ID, '_woo_idle_memory_start', true );
@@ -356,14 +476,14 @@ if( is_admin() ) {
356
  include_once( WOO_CE_PATH . 'templates/admin/media-export_details.php' );
357
 
358
  }
359
- add_action( 'edit_form_after_editor', 'woo_ce_read_csv_file' );
360
 
361
  // Returns label of Export type slug used on Store Exporter screen
362
  function woo_ce_export_type_label( $export_type = '', $echo = false ) {
363
 
364
  $output = '';
365
  if( !empty( $export_type ) ) {
366
- $export_types = woo_ce_return_export_types();
367
  if( array_key_exists( $export_type, $export_types ) )
368
  $output = $export_types[$export_type];
369
  }
@@ -374,47 +494,6 @@ if( is_admin() ) {
374
 
375
  }
376
 
377
- function woo_ce_export_options_export_format() {
378
-
379
- $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
380
- $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woo_ce' ) . '</a>', $woo_cd_url );
381
-
382
- ob_start(); ?>
383
- <tr>
384
- <th>
385
- <label><?php _e( 'Export format', 'woo_ce' ); ?></label>
386
- </th>
387
- <td>
388
- <label><input type="radio" name="export_format" value="csv"<?php checked( 'csv', 'csv' ); ?> /> <?php _e( 'CSV', 'woo_ce' ); ?> <span class="description"><?php _e( '(Comma separated values)', 'woo_ce' ); ?></span></label><br />
389
- <label><input type="radio" name="export_format" value="xml" disabled="disabled" /> <?php _e( 'XML', 'woo_ce' ); ?> <span class="description"><?php _e( '(EXtensible Markup Language)', 'woo_ce' ); ?> <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label><br />
390
- <label><input type="radio" name="export_format" value="xls" disabled="disabled" /> <?php _e( 'Excel (XLS)', 'woo_ce' ); ?> <span class="description"><?php _e( '(Microsoft Excel 2007)', 'woo_ce' ); ?> <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label>
391
- <p class="description"><?php _e( 'Adjust the export format to generate different export file formats.', 'woo_ce' ); ?></p>
392
- </td>
393
- </tr>
394
- <?php
395
- ob_end_flush();
396
-
397
- }
398
-
399
- function woo_ce_export_options_gallery_format() {
400
-
401
- $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
402
- $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woo_ce' ) . '</a>', $woo_cd_url );
403
-
404
- ob_start(); ?>
405
- <tr class="export-options product-options">
406
- <th><label for=""><?php _e( 'Product gallery formatting', 'woo_ce' ); ?></label></th>
407
- <td>
408
- <label><input type="radio" name="product_gallery_formatting" value="0"<?php checked( 0, 0 ); ?> />&nbsp;<?php _e( 'Export Product Gallery as Post ID', 'woo_ce' ); ?></label><br />
409
- <label><input type="radio" name="product_gallery_formatting" value="1" disabled="disabled" />&nbsp;<?php _e( 'Export Product Gallery as Image URL', 'woo_ce' ); ?> <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label>
410
- <p class="description"><?php _e( 'Choose the product gallery formatting that is accepted by your WooCommerce import Plugin (e.g. Product Importer Deluxe, Product Import Suite, etc.).', 'woo_ce' ); ?></p>
411
- </td>
412
- </tr>
413
- <?php
414
- ob_end_flush();
415
-
416
- }
417
-
418
  // Returns a list of archived exports
419
  function woo_ce_get_archive_files() {
420
 
@@ -422,9 +501,10 @@ if( is_admin() ) {
422
  $meta_key = '_woo_export_type';
423
  $args = array(
424
  'post_type' => $post_type,
425
- 'post_mime_type' => array( 'text/csv', 'xml/application', 'application/vnd.ms-excel' ),
426
  'meta_key' => $meta_key,
427
  'meta_value' => null,
 
428
  'posts_per_page' => -1
429
  );
430
  if( isset( $_GET['filter'] ) ) {
@@ -437,28 +517,129 @@ if( is_admin() ) {
437
 
438
  }
439
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
440
  // Returns an archived export with additional details
441
  function woo_ce_get_archive_file( $file = '' ) {
442
 
443
- $wp_upload_dir = wp_upload_dir();
444
  $file->export_type = get_post_meta( $file->ID, '_woo_export_type', true );
445
  $file->export_type_label = woo_ce_export_type_label( $file->export_type );
446
  if( empty( $file->export_type ) )
447
- $file->export_type = __( 'Unassigned', 'woo_ce' );
448
  if( empty( $file->guid ) )
449
- $file->guid = $wp_upload_dir['url'] . '/' . basename( $file->post_title );
450
  $file->post_mime_type = get_post_mime_type( $file->ID );
451
  if( !$file->post_mime_type )
452
- $file->post_mime_type = __( 'N/A', 'woo_ce' );
453
  $file->media_icon = wp_get_attachment_image( $file->ID, array( 80, 60 ), true );
454
  if( $author_name = get_user_by( 'id', $file->post_author ) )
455
  $file->post_author_name = $author_name->display_name;
456
- $t_time = strtotime( $file->post_date, current_time( 'timestamp' ) );
457
- $time = get_post_time( 'G', true, $file->ID, false );
458
- if( ( abs( $t_diff = time() - $time ) ) < 86400 )
459
- $file->post_date = sprintf( __( '%s ago' ), human_time_diff( $time ) );
460
- else
461
- $file->post_date = mysql2date( __( 'Y/m/d' ), $file->post_date );
462
  unset( $author_name, $t_time, $time );
463
  return $file;
464
 
@@ -482,20 +663,20 @@ if( is_admin() ) {
482
  // HTML template for displaying the number of each export type filter on the Archives screen
483
  function woo_ce_archives_quicklink_count( $type = '' ) {
484
 
485
- $output = '0';
486
  $post_type = 'attachment';
487
  $meta_key = '_woo_export_type';
488
  $args = array(
489
  'post_type' => $post_type,
490
  'meta_key' => $meta_key,
491
  'meta_value' => null,
492
- 'numberposts' => -1
 
 
493
  );
494
- if( $type )
495
  $args['meta_value'] = $type;
496
- if( $posts = get_posts( $args ) )
497
- $output = count( $posts );
498
- echo $output;
499
 
500
  }
501
 
@@ -503,6 +684,15 @@ if( is_admin() ) {
503
 
504
  }
505
 
 
 
 
 
 
 
 
 
 
506
  // Export process for CSV file
507
  function woo_ce_export_dataset( $export_type = null, &$output = null ) {
508
 
@@ -512,7 +702,17 @@ function woo_ce_export_dataset( $export_type = null, &$output = null ) {
512
  $export->columns = array();
513
  $export->total_rows = 0;
514
  $export->total_columns = 0;
515
- set_transient( WOO_CE_PREFIX . '_running', time(), woo_ce_get_option( 'timeout', MINUTE_IN_SECONDS ) );
 
 
 
 
 
 
 
 
 
 
516
 
517
  switch( $export_type ) {
518
 
@@ -523,10 +723,11 @@ function woo_ce_export_dataset( $export_type = null, &$output = null ) {
523
  foreach( $export->fields as $key => $field )
524
  $export->columns[] = woo_ce_get_product_field( $key );
525
  }
 
526
  $export->data_memory_start = woo_ce_current_memory_usage();
527
  if( $products = woo_ce_get_products( $export->args ) ) {
528
  $export->total_rows = count( $products );
529
- $export->total_columns = $size = count( $export->columns );
530
  if( in_array( $export->export_format, array( 'csv' ) ) ) {
531
  for( $i = 0; $i < $size; $i++ ) {
532
  if( $i == ( $size - 1 ) )
@@ -578,6 +779,7 @@ function woo_ce_export_dataset( $export_type = null, &$output = null ) {
578
  foreach( $export->fields as $key => $field )
579
  $export->columns[] = woo_ce_get_category_field( $key );
580
  }
 
581
  $export->data_memory_start = woo_ce_current_memory_usage();
582
  $category_args = array(
583
  'orderby' => ( isset( $export->args['category_orderby'] ) ? $export->args['category_orderby'] : 'ID' ),
@@ -585,7 +787,7 @@ function woo_ce_export_dataset( $export_type = null, &$output = null ) {
585
  );
586
  if( $categories = woo_ce_get_product_categories( $category_args ) ) {
587
  $export->total_rows = count( $categories );
588
- $export->total_columns = $size = count( $export->columns );
589
  if( in_array( $export->export_format, array( 'csv' ) ) ) {
590
  for( $i = 0; $i < $size; $i++ ) {
591
  if( $i == ( $size - 1 ) )
@@ -621,6 +823,7 @@ function woo_ce_export_dataset( $export_type = null, &$output = null ) {
621
  foreach( $export->fields as $key => $field )
622
  $export->columns[] = woo_ce_get_tag_field( $key );
623
  }
 
624
  $export->data_memory_start = woo_ce_current_memory_usage();
625
  $tag_args = array(
626
  'orderby' => ( isset( $export->args['tag_orderby'] ) ? $export->args['tag_orderby'] : 'ID' ),
@@ -628,7 +831,7 @@ function woo_ce_export_dataset( $export_type = null, &$output = null ) {
628
  );
629
  if( $tags = woo_ce_get_product_tags( $tag_args ) ) {
630
  $export->total_rows = count( $tags );
631
- $export->total_columns = $size = count( $export->columns );
632
  if( in_array( $export->export_format, array( 'csv' ) ) ) {
633
  for( $i = 0; $i < $size; $i++ ) {
634
  if( $i == ( $size - 1 ) )
@@ -664,9 +867,10 @@ function woo_ce_export_dataset( $export_type = null, &$output = null ) {
664
  foreach( $export->fields as $key => $field )
665
  $export->columns[] = woo_ce_get_user_field( $key );
666
  }
 
667
  $export->data_memory_start = woo_ce_current_memory_usage();
668
  if( $users = woo_ce_get_users( $export->args ) ) {
669
- $export->total_columns = $size = count( $export->columns );
670
  if( in_array( $export->export_format, array( 'csv' ) ) ) {
671
  $i = 0;
672
  foreach( $export->columns as $column ) {
@@ -701,8 +905,17 @@ function woo_ce_export_dataset( $export_type = null, &$output = null ) {
701
  break;
702
 
703
  }
 
 
 
 
 
 
 
 
704
  // Export completed successfully
705
  delete_transient( WOO_CE_PREFIX . '_running' );
 
706
  // Check that the export file is populated, export columns have been assigned and rows counted
707
  if( $output && $export->total_rows && $export->total_columns ) {
708
  if( in_array( $export->export_format, array( 'csv' ) ) ) {
@@ -710,23 +923,71 @@ function woo_ce_export_dataset( $export_type = null, &$output = null ) {
710
  if( $export->export_format == 'csv' && $export->bom && ( WOO_CE_DEBUG == false ) )
711
  $output = "\xEF\xBB\xBF" . $output;
712
  }
713
- if( WOO_CE_DEBUG && !$export->cron )
714
- set_transient( WOO_CE_PREFIX . '_debug_log', base64_encode( $output ), woo_ce_get_option( 'timeout', MINUTE_IN_SECONDS ) );
715
- else
 
 
 
 
 
 
 
716
  return $output;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
717
  }
718
 
719
  }
720
 
721
  // List of Export types used on Store Exporter screen
722
- function woo_ce_return_export_types() {
723
-
724
- $types = array();
725
- $types['product'] = __( 'Products', 'woo_ce' );
726
- $types['category'] = __( 'Categories', 'woo_ce' );
727
- $types['tag'] = __( 'Tags', 'woo_ce' );
728
- $types['user'] = __( 'Users', 'woo_ce' );
729
- $types = apply_filters( 'woo_ce_types', $types );
 
730
  return $types;
731
 
732
  }
@@ -737,13 +998,14 @@ function woo_ce_save_file_attachment( $filename = '', $post_mime_type = 'text/cs
737
  if( !empty( $filename ) ) {
738
  $post_type = 'woo-export';
739
  $args = array(
 
740
  'post_title' => $filename,
741
  'post_type' => $post_type,
742
  'post_mime_type' => $post_mime_type
743
  );
744
  $post_ID = wp_insert_attachment( $args, $filename );
745
  if( is_wp_error( $post_ID ) )
746
- error_log( sprintf( '[store-exporter-deluxe] save_file_attachment() - $s: %s', $filename, $result->get_error_message() ) );
747
  else
748
  return $post_ID;
749
  }
@@ -807,15 +1069,57 @@ function woo_ce_post_statuses( $extra_status = array(), $override = false ) {
807
 
808
  }
809
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
810
  function woo_ce_add_missing_mime_type( $mime_types = array() ) {
811
 
812
  // Add CSV mime type if it has been removed
813
  if( !isset( $mime_types['csv'] ) )
814
  $mime_types['csv'] = 'text/csv';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
815
  return $mime_types;
816
 
817
  }
818
- add_filter( 'upload_mimes', 'woo_ce_add_missing_mime_type', 10, 1 );
819
 
820
  if( !function_exists( 'woo_ce_sort_fields' ) ) {
821
  function woo_ce_sort_fields( $key ) {
@@ -825,11 +1129,10 @@ if( !function_exists( 'woo_ce_sort_fields' ) ) {
825
  }
826
  }
827
 
828
-
829
  // Add Store Export to filter types on the WordPress Media screen
830
  function woo_ce_add_post_mime_type( $post_mime_types = array() ) {
831
 
832
- $post_mime_types['text/csv'] = array( __( 'Store Exports (CSV)', 'woo_ce' ), __( 'Manage Store Exports (CSV)', 'woo_ce' ), _n_noop( 'Store Export - CSV <span class="count">(%s)</span>', 'Store Exports - CSV <span class="count">(%s)</span>' ) );
833
  return $post_mime_types;
834
 
835
  }
@@ -844,10 +1147,948 @@ function woo_ce_current_memory_usage() {
844
 
845
  }
846
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
847
  function woo_ce_get_option( $option = null, $default = false, $allow_empty = false ) {
848
 
849
- $output = '';
850
- if( isset( $option ) ) {
851
  $separator = '_';
852
  $output = get_option( WOO_CE_PREFIX . $separator . $option, $default );
853
  if( $allow_empty == false && $output != 0 && ( $output == false || $output == '' ) )
@@ -860,7 +2101,7 @@ function woo_ce_get_option( $option = null, $default = false, $allow_empty = fal
860
  function woo_ce_update_option( $option = null, $value = null ) {
861
 
862
  $output = false;
863
- if( isset( $option ) && isset( $value ) ) {
864
  $separator = '_';
865
  $output = update_option( WOO_CE_PREFIX . $separator . $option, $value );
866
  }
1
  <?php
2
+ // Only load these resources if we are running an export
3
+ function woo_ce_load_export_types() {
4
+
5
+ include_once( WOO_CE_PATH . 'includes/product.php' );
6
+ include_once( WOO_CE_PATH . 'includes/product-extend.php' );
7
+ include_once( WOO_CE_PATH . 'includes/category.php' );
8
+ include_once( WOO_CE_PATH . 'includes/tag.php' );
9
+ include_once( WOO_CE_PATH . 'includes/brand.php' );
10
+ include_once( WOO_CE_PATH . 'includes/order.php' );
11
+ include_once( WOO_CE_PATH . 'includes/customer.php' );
12
+ include_once( WOO_CE_PATH . 'includes/user.php' );
13
+ include_once( WOO_CE_PATH . 'includes/user-extend.php' );
14
+ include_once( WOO_CE_PATH . 'includes/coupon.php' );
15
+ include_once( WOO_CE_PATH . 'includes/subscription.php' );
16
+ include_once( WOO_CE_PATH . 'includes/product_vendor.php' );
17
+ include_once( WOO_CE_PATH . 'includes/commission.php' );
18
+ include_once( WOO_CE_PATH . 'includes/shipping_class.php' );
19
+
20
+ // Load the export type resources first
21
+ include_once( WOO_CE_PATH . 'includes/admin/product.php' );
22
+ include_once( WOO_CE_PATH . 'includes/admin/category.php' );
23
+ include_once( WOO_CE_PATH . 'includes/admin/tag.php' );
24
+ include_once( WOO_CE_PATH . 'includes/admin/brand.php' );
25
+ include_once( WOO_CE_PATH . 'includes/admin/order.php' );
26
+ include_once( WOO_CE_PATH . 'includes/admin/customer.php' );
27
+ include_once( WOO_CE_PATH . 'includes/admin/user.php' );
28
+ include_once( WOO_CE_PATH . 'includes/admin/coupon.php' );
29
+ include_once( WOO_CE_PATH . 'includes/admin/subscription.php' );
30
+ include_once( WOO_CE_PATH . 'includes/admin/commission.php' );
31
+ include_once( WOO_CE_PATH . 'includes/admin/shipping_class.php' );
32
+
33
+ }
34
+
35
+
36
+ // Check if we are using PHP 5.3 and above
37
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
38
  include_once( WOO_CE_PATH . 'includes/legacy.php' );
39
  include_once( WOO_CE_PATH . 'includes/formatting.php' );
40
 
45
  /* Start of: WordPress Administration */
46
 
47
  include_once( WOO_CE_PATH . 'includes/admin.php' );
48
+ // WordPress Admin Pointers
49
  include_once( WOO_CE_PATH . 'includes/settings.php' );
50
 
51
+ function woo_ce_export_init() {
52
+
53
+ // Process any pre-export notice confirmations
54
+ $action = ( function_exists( 'woo_get_action' ) ? woo_get_action() : false );
55
+ switch( $action ) {
56
+
57
+ // Reset all dismissed notices within Store Exporter Deluxe
58
+ case 'nuke_notices':
59
+ // We need to verify the nonce.
60
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_nuke_notices' ) ) {
61
+ // Remember that we've dismissed this notice
62
+ woo_ce_nuke_dismissed_notices();
63
+ $message = __( 'All dimissed notices within Store Exporter Deluxe have been restored.', 'woocommerce-exporter' );
64
+ woo_ce_admin_notice( $message );
65
+ }
66
+ break;
67
+
68
+ // Delete all WordPress Options associated with Store Exporter Deluxe
69
+ case 'nuke_options':
70
+ // We need to verify the nonce.
71
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_nuke_options' ) ) {
72
+ // Delete WordPress Options used by Store Exporter Deluxe (Uninstall)
73
+ if( woo_ce_nuke_options() ) {
74
+ $message = __( 'All Store Exporter Deluxe WordPress Options have been deleted from your WordPress site, you can now de-activate and delete Store Exporter Deluxe.', 'woocommerce-exporter' );
75
+ woo_ce_admin_notice( $message );
76
+ } else {
77
+ $message = __( 'Not all Store Exporter Deluxe WordPress Options could be deleted from your WordPress site, please see the WordPress Options table for Options prefixed by <code>woo_ce_</code>.', 'woocommerce-exporter' );
78
+ woo_ce_admin_notice( $message, 'error' );
79
+ }
80
+ }
81
+ break;
82
+
83
+ // Delete all Archives
84
+ case 'nuke_archives':
85
+ // We need to verify the nonce.
86
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_nuke_archives' ) ) {
87
+ // Delete saved exports
88
+ if( woo_ce_nuke_archive_files() ) {
89
+ $message = __( 'All existing Archives and their export files have been deleted from your WordPress site.', 'woocommerce-exporter' );
90
+ woo_ce_admin_notice( $message );
91
+ } else {
92
+ $message = __( 'There were no existing Archives to be deleted from your WordPress site.', 'woocommerce-exporter' );
93
+ woo_ce_admin_notice( $message, 'error' );
94
+ }
95
+ }
96
+ break;
97
+
98
+ // Prompt on Export screen when insufficient memory (less than 64M is allocated)
99
+ case 'dismiss_memory_prompt':
100
+ // We need to verify the nonce.
101
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_dismiss_memory_prompt' ) ) {
102
+ // Remember that we've dismissed this notice
103
+ woo_ce_update_option( 'dismiss_memory_prompt', 1 );
104
+ $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
105
+ wp_redirect( $url );
106
+ exit();
107
+ }
108
+ break;
109
+
110
+ // Prompt on Export screen when PHP configuration option max_execution_time cannot be increased
111
+ case 'dismiss_execution_time_prompt':
112
+ // We need to verify the nonce.
113
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_dismiss_execution_time_prompt' ) ) {
114
+ // Remember that we've dismissed this notice
115
+ woo_ce_update_option( 'dismiss_execution_time_prompt', 1 );
116
+ $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
117
+ wp_redirect( $url );
118
+ exit();
119
+ }
120
+ break;
121
+
122
+ // Prompt on Export screen when PHP 5.2 or lower is installed
123
+ case 'dismiss_php_legacy':
124
+ // We need to verify the nonce.
125
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_dismiss_php_legacy' ) ) {
126
+ // Remember that we've dismissed this notice
127
+ woo_ce_update_option( 'dismiss_php_legacy', 1 );
128
+ $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
129
+ wp_redirect( $url );
130
+ exit();
131
+ }
132
+ break;
133
+
134
+ case 'dismiss_subscription_prompt':
135
+ // We need to verify the nonce.
136
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_dismiss_subscription_prompt' ) ) {
137
+ // Remember that we've dismissed this notice
138
+ woo_ce_update_option( 'dismiss_subscription_prompt', 1 );
139
+ $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
140
+ wp_redirect( $url );
141
+ exit();
142
+ }
143
+ break;
144
+
145
+ case 'dismiss_archives_prompt':
146
+ // We need to verify the nonce.
147
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_dismiss_archives_prompt' ) ) {
148
+ // Remember that we've dismissed this notice
149
+ woo_ce_update_option( 'dismiss_archives_prompt', 1 );
150
+ $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
151
+ wp_redirect( $url );
152
+ exit();
153
+ }
154
+ break;
155
+
156
+ case 'hide_archives_tab':
157
+ // We need to verify the nonce.
158
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_hide_archives_tab' ) ) {
159
+ // Remember to hide the Archives tab
160
+ woo_ce_update_option( 'hide_archives_tab', 1 );
161
+ $url = add_query_arg( array( 'tab' => 'export', 'action' => null, '_wpnonce' => null ) );
162
+ wp_redirect( $url );
163
+ exit();
164
+ }
165
+ break;
166
+
167
+ case 'restore_archives_tab':
168
+ // We need to verify the nonce.
169
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_restore_archives_tab' ) ) {
170
+ // Remember to show the Archives tab
171
+ woo_ce_update_option( 'hide_archives_tab', 0 );
172
+ $url = add_query_arg( array( 'tab' => 'archive', 'action' => null, '_wpnonce' => null ) );
173
+ wp_redirect( $url );
174
+ exit();
175
+ }
176
+ break;
177
+
178
+ // Reset the Transient counters for all export types
179
+ case 'refresh_export_type_counts':
180
+ // We need to verify the nonce.
181
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_refresh_export_type_counts' ) ) {
182
+ woo_ce_load_export_types();
183
+ $transients = array(
184
+ 'product',
185
+ 'category',
186
+ 'tag',
187
+ 'user'
188
+ );
189
+ foreach( $transients as $transient ) {
190
+ // Delete the existing count Transients
191
+ delete_transient( WOO_CE_PREFIX . '_' . $transient . '_count' );
192
+ // Refresh the count Transients
193
+ woo_ce_get_export_type_count( $transient );
194
+ }
195
+ $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
196
+ wp_redirect( $url );
197
+ exit();
198
+ }
199
+ break;
200
+
201
+ case 'refresh_module_counts':
202
+ // We need to verify the nonce.
203
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_refresh_module_counts' ) ) {
204
+
205
+ // Delete the existing count Transients
206
+ delete_transient( WOO_CE_PREFIX . '_modules_active' );
207
+ delete_transient( WOO_CE_PREFIX . '_modules_all_count' );
208
+ delete_transient( WOO_CE_PREFIX . '_modules_active_count' );
209
+ delete_transient( WOO_CE_PREFIX . '_modules_inactive_count' );
210
+
211
+ // Refresh the count Transients
212
+ woo_ce_modules_list();
213
+ woo_ce_refresh_active_export_plugins();
214
+
215
+ $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
216
+ wp_redirect( $url );
217
+ exit();
218
+ }
219
+ break;
220
+
221
+ // Save skip overview preference
222
+ case 'skip_overview':
223
+ // We need to verify the nonce.
224
+ if( !empty( $_POST ) && check_admin_referer( 'skip_overview', 'woo_ce_skip_overview' ) ) {
225
+ $skip_overview = false;
226
+ if( isset( $_POST['skip_overview'] ) )
227
+ $skip_overview = 1;
228
+ // Remember that we've dismissed this notice
229
+ woo_ce_update_option( 'skip_overview', $skip_overview );
230
+
231
+ if( $skip_overview == 1 ) {
232
+ $url = add_query_arg( array( 'tab' => 'export', '_wpnonce' => null ) );
233
+ wp_redirect( $url );
234
+ exit();
235
+ }
236
+ }
237
+ break;
238
 
 
 
 
 
 
 
 
239
  }
 
240
 
241
  }
242
 
243
  // Displays a HTML notice when a WordPress or Store Exporter error is encountered
244
+ function woo_ce_admin_fail_notices() {
245
 
246
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter/usage/';
247
 
248
+ // If the failed flag is set then prepare for an error notice
249
  if( isset( $_GET['failed'] ) ) {
250
  $message = '';
251
  if( isset( $_GET['message'] ) )
252
  $message = urldecode( $_GET['message'] );
253
  if( $message )
254
+ $message = sprintf( __( 'A WordPress or server error caused the exporter to fail, the exporter was provided with a reason: <em>%s</em>', 'woocommerce-exporter' ), $message ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woocommerce-exporter' ) . '</a>)';
255
  else
256
+ $message = __( 'A WordPress or server error caused the exporter to fail, no reason was provided, if this persists please get in touch so we can reproduce and resolve this with you.', 'woocommerce-exporter' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woocommerce-exporter' ) . '</a>)';
257
  woo_ce_admin_notice_html( $message, 'error' );
258
  }
 
 
 
 
 
259
 
260
+ // Displays a HTML notice where the maximum execution time cannot be set
261
+ if( !woo_ce_get_option( 'dismiss_execution_time_prompt', 0 ) ) {
262
+ $max_execution_time = absint( ini_get( 'max_execution_time' ) );
263
+ $response = @ini_set( 'max_execution_time', 120 );
264
+ if( $response == false || ( $response != $max_execution_time ) ) {
265
+ $dismiss_url = esc_url( add_query_arg( array( 'action' => 'dismiss_execution_time_prompt', '_wpnonce' => wp_create_nonce( 'woo_ce_dismiss_execution_time_prompt' ) ) ) );
266
+ $message = '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woocommerce-exporter' ) . '</a></span>' . sprintf( __( 'We could not override the PHP configuration option <code>max_execution_time</code>, this will limit the size of possible exports. See: <a href="%s" target="_blank">Increasing PHP max_execution_time configuration option</a>', 'woocommerce-exporter' ), $troubleshooting_url );
267
+ woo_ce_admin_notice_html( $message );
268
+ }
269
+ }
270
 
271
  // Displays a HTML notice where the memory allocated to WordPress falls below 64MB
272
+ if( !woo_ce_get_option( 'dismiss_memory_prompt', 0 ) ) {
273
+ $memory_limit = absint( ini_get( 'memory_limit' ) );
274
+ $minimum_memory_limit = 64;
275
+ if( $memory_limit < $minimum_memory_limit ) {
276
+ $dismiss_url = esc_url( add_query_arg( array( 'action' => 'dismiss_memory_prompt', '_wpnonce' => wp_create_nonce( 'woo_ce_dismiss_memory_prompt' ) ) ) );
277
+ $message = '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woocommerce-exporter' ) . '</a></span>' . sprintf( __( 'We recommend setting memory to at least %dMB, your site has only %dMB allocated to it. See: <a href="%s" target="_blank">Increasing memory allocated to PHP</a>', 'woocommerce-exporter' ), $minimum_memory_limit, $memory_limit, $troubleshooting_url );
278
+ woo_ce_admin_notice_html( $message, 'error' );
279
+ }
280
  }
281
 
282
+ // Displays a HTML notice if PHP 5.2 or lower is installed
283
  if( version_compare( phpversion(), '5.3', '<' ) && !woo_ce_get_option( 'dismiss_php_legacy', 0 ) ) {
284
+ $dismiss_url = esc_url( add_query_arg( array( 'action' => 'dismiss_php_legacy', '_wpnonce' => wp_create_nonce( 'woo_ce_dismiss_php_legacy' ) ) ) );
285
+ $message = '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woocommerce-exporter' ) . '</a></span>' . sprintf( __( 'Your PHP version (%s) is not supported and is very much out of date, since 2010 all users are strongly encouraged to upgrade to PHP 5.3+ and above. Contact your hosting provider to make this happen. See: <a href="%s" target="_blank">Migrating from PHP 5.2 to 5.3</a>', 'woocommerce-exporter' ), phpversion(), $troubleshooting_url );
286
  woo_ce_admin_notice_html( $message, 'error' );
287
  }
288
 
289
+ // Displays HTML notice if there are more than 2500 Subscriptions
290
+ if( !woo_ce_get_option( 'dismiss_subscription_prompt', 0 ) ) {
291
+ if( class_exists( 'WC_Subscriptions' ) ) {
292
+ $wcs_version = woo_ce_get_wc_subscriptions_version();
293
+ if( version_compare( $wcs_version, '2.0.1', '<' ) ) {
294
+ if( method_exists( 'WC_Subscriptions', 'is_large_site' ) ) {
295
+ // Does this store have roughly more than 3000 Subscriptions
296
+ if( WC_Subscriptions::is_large_site() ) {
297
+ $dismiss_url = esc_url( add_query_arg( array( 'action' => 'dismiss_subscription_prompt', '_wpnonce' => wp_create_nonce( 'woo_ce_dismiss_subscription_prompt' ) ) ) );
298
+ $message = '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woocommerce-exporter' ) . '</a></span>' . __( 'We\'ve detected the <em>is_large_site</em> flag has been set within WooCommerce Subscriptions. Please get in touch if exports are incomplete as we need to spin up an alternative export process to export Subscriptions from large stores.', 'woocommerce-exporter' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woocommerce-exporter' ) . '</a>)';
299
+ woo_ce_admin_notice_html( $message, 'error' );
300
+ }
 
 
 
 
 
301
  }
302
  }
303
  }
304
  }
 
305
 
306
+ // If the export failed the WordPress Transient will still exist
307
+ if( get_transient( WOO_CE_PREFIX . '_running' ) ) {
308
+ $message = __( 'A WordPress or server error caused the exporter to fail with a blank screen, this is either a memory or timeout issue, please get in touch so we can reproduce and resolve this.', 'woocommerce-exporter' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woocommerce-exporter' ) . '</a>)';
309
+ woo_ce_admin_notice_html( $message, 'error' );
310
+ delete_transient( WOO_CE_PREFIX . '_running' );
311
+ }
312
+ // Displays a HTML notice if Archives is disabled and the Archives tab is opened
313
+ if(
314
+ woo_ce_get_option( 'delete_file', '1' ) == 1
315
+ && ( isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : '' ) == 'archive'
316
+ && ( !woo_ce_get_option( 'dismiss_archives_prompt', 0 ) )
317
+ ) {
318
+ $dismiss_url = esc_url( add_query_arg( array( 'action' => 'dismiss_archives_prompt', '_wpnonce' => wp_create_nonce( 'woo_ce_dismiss_archives_prompt' ) ) ) );
319
+ $override_url = esc_url( add_query_arg( array( 'action' => 'hide_archives_tab', '_wpnonce' => wp_create_nonce( 'woo_ce_hide_archives_tab' ) ) ) );
320
+ $message = '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woocommerce-exporter' ) . '</a></span>' . __( 'It looks like the saving of export archives is disabled from the Enabled Archives option on the Settings tab, would you like to hide the Archives tab aswell?', 'woocommerce-exporter' ) . '<br /><br /><a href="' . $override_url . '" class="button-primary">' . __( 'Hide Archives tab', 'woocommerce-exporter' ) . '</a>';
321
+ woo_ce_admin_notice_html( $message );
322
+ }
323
 
324
+ // Displays a HTML notice if Archives are detected without a Post Status of private
325
+ if( woo_ce_get_unprotected_archives( array( 'count' => true ) ) && !woo_ce_get_option( 'dismiss_archives_privacy_prompt', 0 ) ) {
326
+ $dismiss_url = esc_url( add_query_arg( array( 'action' => 'dismiss_archives_privacy_prompt', '_wpnonce' => wp_create_nonce( 'woo_ce_dismiss_archives_privacy_prompt' ) ) ) );
327
+ $override_url = esc_url( add_query_arg( array( 'action' => 'override_archives_privacy', '_wpnonce' => wp_create_nonce( 'woo_ce_override_archives_privacy' ) ) ) );
328
+ $message = '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woocommerce-exporter' ) . '</a></span>' . __( 'It looks like some archived exports require updating, would you like to hide these archived exports now?', 'woocommerce-exporter' ) . '<br /><br /><a href="' . $override_url . '" class="button-primary">' . __( 'Update export archives', 'woocommerce-exporter' ) . '</a>';
329
+ woo_ce_admin_notice_html( $message );
 
 
 
330
  }
331
 
332
  }
333
 
334
  // Saves the state of Export fields for next export
335
+ function woo_ce_save_fields( $export_type = '', $fields = array(), $sorting = array() ) {
336
 
337
+ // Default fields
338
+ if( $fields == false && !is_array( $fields ) )
339
  $fields = array();
340
+ $export_types = array_keys( woo_ce_get_export_types() );
341
+ if( in_array( $export_type, $export_types ) && !empty( $fields ) ) {
342
+ woo_ce_update_option( $export_type . '_fields', array_map( 'sanitize_text_field', $fields ) );
343
+ woo_ce_update_option( $export_type . '_sorting', array_map( 'absint', $sorting ) );
344
  }
345
 
346
  }
347
 
348
  // Returns number of an Export type prior to export, used on Store Exporter screen
349
+ function woo_ce_get_export_type_count( $export_type = '', $args = array() ) {
350
 
351
  global $wpdb;
352
 
353
  $count_sql = null;
354
+ $woocommerce_version = woo_get_woo_version();
355
+
356
  switch( $export_type ) {
357
 
358
  case 'product':
359
+ $count = woo_ce_get_export_type_product_count();
 
 
 
 
 
 
 
360
  break;
361
 
362
  case 'category':
363
+ $count = woo_ce_get_export_type_category_count();
 
364
  break;
365
 
366
  case 'tag':
367
+ $count = woo_ce_get_export_type_tag_count();
 
 
 
 
 
 
368
  break;
369
 
370
  case 'order':
371
+ $count = woo_ce_get_export_type_order_count();
 
 
 
 
 
 
 
372
  break;
373
 
374
  case 'customer':
375
+ $count = woo_ce_get_export_type_customer_count();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376
  break;
377
 
378
  case 'user':
379
+ $count = woo_ce_get_export_type_user_count();
 
380
  break;
381
 
382
+ case 'review':
383
+ $count = woo_ce_get_export_type_review_count();
 
384
  break;
385
 
386
+ case 'coupon':
387
+ $count = woo_ce_get_export_type_coupon_count();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
388
  break;
389
 
390
+ case 'shipping_class':
391
+ $count = woo_ce_get_export_type_shipping_class_count();
 
392
  break;
393
 
394
  case 'attribute':
395
+ $count = woo_ce_get_export_type_attribute_count();
396
+ break;
397
+
398
+ // Allow Plugin/Theme authors to populate their own custom export type counts
399
+ default:
400
+ $count = 0;
401
+ $count = apply_filters( 'woo_ce_get_export_type_count', $count, $export_type, $args );
402
  break;
403
 
404
  }
406
  if( isset( $count ) ) {
407
  if( is_object( $count ) ) {
408
  $count = (array)$count;
409
+ $count = absint( array_sum( $count ) );
410
  }
411
  return $count;
412
  } else {
423
  }
424
 
425
  // In-line display of export file and export details when viewed via WordPress Media screen
426
+ function woo_ce_read_export_file( $post = false ) {
427
 
428
+ if( empty( $post ) ) {
429
  if( isset( $_GET['post'] ) )
430
  $post = get_post( $_GET['post'] );
431
  }
432
 
433
  if( $post->post_type != 'attachment' )
434
+ return;
435
 
436
+ // Check if the Post matches one of our Post Mime Types
437
+ if( !in_array( $post->post_mime_type, array_values( woo_ce_get_mime_types() ) ) )
438
+ return;
439
 
 
440
  $filepath = get_attached_file( $post->ID );
441
+
442
+ // We can only read CSV, TSV and XML file types, the others are encoded
443
+ if( in_array( $post->post_mime_type, array( 'text/csv', 'text/tab-separated-values', 'application/xml', 'application/rss+xml' ) ) ) {
444
+
445
+ $contents = __( 'No export entries were found, please try again with different export filters.', 'woocommerce-exporter' );
 
 
 
 
 
446
  if( file_exists( $filepath ) ) {
447
+ $contents = file_get_contents( $filepath );
448
+ } else {
449
+ // This resets the _wp_attached_file Post meta key to the correct value
450
+ update_attached_file( $post->ID, $post->guid );
451
+ // Try grabbing the file contents again
452
+ $filepath = get_attached_file( $post->ID );
453
+ if( file_exists( $filepath ) ) {
454
+ $handle = fopen( $filepath, "r" );
455
+ $contents = stream_get_contents( $handle );
456
+ fclose( $handle );
457
+ }
458
  }
459
+ if( !empty( $contents ) )
460
+ include_once( WOO_CE_PATH . 'templates/admin/media-csv_file.php' );
461
+
462
  }
 
 
463
 
464
+ // We can still show the Export Details for any supported Post Mime Type
465
  $export_type = get_post_meta( $post->ID, '_woo_export_type', true );
466
  $columns = get_post_meta( $post->ID, '_woo_columns', true );
467
  $rows = get_post_meta( $post->ID, '_woo_rows', true );
468
+ $scheduled_id = get_post_meta( $post->ID, '_scheduled_id', true );
469
  $start_time = get_post_meta( $post->ID, '_woo_start_time', true );
470
  $end_time = get_post_meta( $post->ID, '_woo_end_time', true );
471
  $idle_memory_start = get_post_meta( $post->ID, '_woo_idle_memory_start', true );
476
  include_once( WOO_CE_PATH . 'templates/admin/media-export_details.php' );
477
 
478
  }
479
+ add_action( 'edit_form_after_editor', 'woo_ce_read_export_file' );
480
 
481
  // Returns label of Export type slug used on Store Exporter screen
482
  function woo_ce_export_type_label( $export_type = '', $echo = false ) {
483
 
484
  $output = '';
485
  if( !empty( $export_type ) ) {
486
+ $export_types = woo_ce_get_export_types();
487
  if( array_key_exists( $export_type, $export_types ) )
488
  $output = $export_types[$export_type];
489
  }
494
 
495
  }
496
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
497
  // Returns a list of archived exports
498
  function woo_ce_get_archive_files() {
499
 
501
  $meta_key = '_woo_export_type';
502
  $args = array(
503
  'post_type' => $post_type,
504
+ 'post_mime_type' => array_values( woo_ce_get_mime_types() ),
505
  'meta_key' => $meta_key,
506
  'meta_value' => null,
507
+ 'post_status' => 'any',
508
  'posts_per_page' => -1
509
  );
510
  if( isset( $_GET['filter'] ) ) {
517
 
518
  }
519
 
520
+ function woo_ce_nuke_archive_files() {
521
+
522
+ $post_type = 'attachment';
523
+ $meta_key = '_woo_export_type';
524
+ $args = array(
525
+ 'post_type' => $post_type,
526
+ 'post_mime_type' => array_values( woo_ce_get_mime_types() ),
527
+ 'meta_key' => $meta_key,
528
+ 'meta_value' => null,
529
+ 'post_status' => 'any',
530
+ 'posts_per_page' => -1,
531
+ 'fields' => 'ids'
532
+ );
533
+ $post_query = new WP_Query( $args );
534
+ if( !empty( $post_query->found_posts ) ) {
535
+ foreach( $post_query->posts as $post_ID )
536
+ wp_delete_attachment( $post_ID, true );
537
+ return true;
538
+ }
539
+
540
+ }
541
+
542
+ // Delete all WordPress Options generated by Store Exporter
543
+ function woo_ce_nuke_options() {
544
+
545
+ global $wpdb;
546
+
547
+ $prefix = 'woo_ce_%';
548
+
549
+ // Get a list of WordPress Options prefixed by woo_ce_
550
+ $options_sql = $wpdb->prepare( "SELECT `option_name` FROM `" . $wpdb->prefix . "options` WHERE `option_name` LIKE %s", $prefix );
551
+ $options = $wpdb->get_col( $options_sql );
552
+ if( !empty( $options ) ) {
553
+ $count = 0;
554
+ // Get a count of WordPress Options to be deleted
555
+ $size = count( $options );
556
+ foreach( $options as $option ) {
557
+ // Get a count of deleted WordPress Options
558
+ if( delete_option( $option ) )
559
+ $count++;
560
+ }
561
+ // Compare the count of WordPress Options vs deleted WordPress Options
562
+ if( $count == $size )
563
+ return true;
564
+ }
565
+
566
+ }
567
+
568
+ // Reset all dismissed notices within Store Exporter
569
+ function woo_ce_nuke_dismissed_notices() {
570
+
571
+ global $wpdb;
572
+
573
+ $prefix = 'woo_ce_dismiss_%';
574
+
575
+ // Get a list of WordPress Options prefixed by woo_ce_dismiss_
576
+ $options_sql = $wpdb->prepare( "SELECT `option_name` FROM `" . $wpdb->prefix . "options` WHERE `option_name` LIKE %s", $prefix );
577
+ $options = $wpdb->get_col( $options_sql );
578
+ if( !empty( $options ) ) {
579
+ foreach( $options as $option )
580
+ delete_option( $option );
581
+ }
582
+
583
+ }
584
+
585
+ // Returns a list of Attachments which are exposed to the public
586
+ function woo_ce_get_unprotected_archives( $postarr = array() ) {
587
+
588
+ $post_type = 'attachment';
589
+ $meta_key = '_woo_export_type';
590
+ $args = array(
591
+ 'post_type' => $post_type,
592
+ 'post_mime_type' => array_values( woo_ce_get_mime_types() ),
593
+ 'meta_key' => $meta_key,
594
+ 'post_status' => 'inherit',
595
+ 'posts_per_page' => -1,
596
+ 'fields' => 'ids'
597
+ );
598
+ $args = wp_parse_args( $postarr, $args );
599
+ $post_query = new WP_Query( $args );
600
+ if( !empty( $post_query->found_posts ) ) {
601
+ // Check if we are returning a count or list
602
+ if( isset( $postarr['count'] ) ) {
603
+ return $post_query->found_posts;
604
+ }
605
+ return $post_query->posts;
606
+ }
607
+
608
+ }
609
+
610
+ function woo_ce_update_archives_privacy() {
611
+
612
+ $attachments = woo_ce_get_unprotected_archives();
613
+ if( !empty( $attachments ) ) {
614
+ foreach( $attachments as $post_ID ) {
615
+ $args = array(
616
+ 'ID' => $post_ID,
617
+ 'post_status' => 'private'
618
+ );
619
+ wp_update_post( $args );
620
+ }
621
+ return true;
622
+ }
623
+
624
+ }
625
+
626
  // Returns an archived export with additional details
627
  function woo_ce_get_archive_file( $file = '' ) {
628
 
629
+ $upload_dir = wp_upload_dir();
630
  $file->export_type = get_post_meta( $file->ID, '_woo_export_type', true );
631
  $file->export_type_label = woo_ce_export_type_label( $file->export_type );
632
  if( empty( $file->export_type ) )
633
+ $file->export_type = __( 'Unassigned', 'woocommerce-exporter' );
634
  if( empty( $file->guid ) )
635
+ $file->guid = $upload_dir['url'] . '/' . basename( $file->post_title );
636
  $file->post_mime_type = get_post_mime_type( $file->ID );
637
  if( !$file->post_mime_type )
638
+ $file->post_mime_type = __( 'N/A', 'woocommerce-exporter' );
639
  $file->media_icon = wp_get_attachment_image( $file->ID, array( 80, 60 ), true );
640
  if( $author_name = get_user_by( 'id', $file->post_author ) )
641
  $file->post_author_name = $author_name->display_name;
642
+ $file->post_date = woo_ce_format_archive_date( $file->ID );
 
 
 
 
 
643
  unset( $author_name, $t_time, $time );
644
  return $file;
645
 
663
  // HTML template for displaying the number of each export type filter on the Archives screen
664
  function woo_ce_archives_quicklink_count( $type = '' ) {
665
 
 
666
  $post_type = 'attachment';
667
  $meta_key = '_woo_export_type';
668
  $args = array(
669
  'post_type' => $post_type,
670
  'meta_key' => $meta_key,
671
  'meta_value' => null,
672
+ 'numberposts' => -1,
673
+ 'post_status' => 'any',
674
+ 'fields' => 'ids'
675
  );
676
+ if( !empty( $type ) )
677
  $args['meta_value'] = $type;
678
+ $post_query = new WP_Query( $args );
679
+ return absint( $post_query->found_posts );
 
680
 
681
  }
682
 
684
 
685
  }
686
 
687
+ function woo_ce_raise_export_memory_limit() {
688
+
689
+ // Check if WP_MAX_MEMORY_LIMIT is the same as the WP_MEMORY_LIMIT
690
+ if( wp_convert_hr_to_bytes( WP_MAX_MEMORY_LIMIT ) < wp_convert_hr_to_bytes( WP_MEMORY_LIMIT ) ) {
691
+ return WP_MEMORY_LIMIT;
692
+ }
693
+
694
+ }
695
+
696
  // Export process for CSV file
697
  function woo_ce_export_dataset( $export_type = null, &$output = null ) {
698
 
702
  $export->columns = array();
703
  $export->total_rows = 0;
704
  $export->total_columns = 0;
705
+
706
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/';
707
+
708
+ set_transient( WOO_CE_PREFIX . '_running', time(), woo_ce_get_option( 'timeout', HOUR_IN_SECONDS ) );
709
+
710
+ // Load up the fatal error notice if we 500 Internal Server Error (memory), hit a server timeout or encounter a fatal PHP error
711
+ add_action( 'shutdown', 'woo_ce_fatal_error' );
712
+
713
+ // Drop in our content filters here
714
+ add_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
715
+ add_filter( 'attribute_escape', 'woo_ce_attribute_escape', 10, 2 );
716
 
717
  switch( $export_type ) {
718
 
723
  foreach( $export->fields as $key => $field )
724
  $export->columns[] = woo_ce_get_product_field( $key );
725
  }
726
+ $export->total_columns = $size = count( $export->columns );
727
  $export->data_memory_start = woo_ce_current_memory_usage();
728
  if( $products = woo_ce_get_products( $export->args ) ) {
729
  $export->total_rows = count( $products );
730
+ // Generate the export headers
731
  if( in_array( $export->export_format, array( 'csv' ) ) ) {
732
  for( $i = 0; $i < $size; $i++ ) {
733
  if( $i == ( $size - 1 ) )
779
  foreach( $export->fields as $key => $field )
780
  $export->columns[] = woo_ce_get_category_field( $key );
781
  }
782
+ $export->total_columns = $size = count( $export->columns );
783
  $export->data_memory_start = woo_ce_current_memory_usage();
784
  $category_args = array(
785
  'orderby' => ( isset( $export->args['category_orderby'] ) ? $export->args['category_orderby'] : 'ID' ),
787
  );
788
  if( $categories = woo_ce_get_product_categories( $category_args ) ) {
789
  $export->total_rows = count( $categories );
790
+ // Generate the export headers
791
  if( in_array( $export->export_format, array( 'csv' ) ) ) {
792
  for( $i = 0; $i < $size; $i++ ) {
793
  if( $i == ( $size - 1 ) )
823
  foreach( $export->fields as $key => $field )
824
  $export->columns[] = woo_ce_get_tag_field( $key );
825
  }
826
+ $export->total_columns = $size = count( $export->columns );
827
  $export->data_memory_start = woo_ce_current_memory_usage();
828
  $tag_args = array(
829
  'orderby' => ( isset( $export->args['tag_orderby'] ) ? $export->args['tag_orderby'] : 'ID' ),
831
  );
832
  if( $tags = woo_ce_get_product_tags( $tag_args ) ) {
833
  $export->total_rows = count( $tags );
834
+ // Generate the export headers
835
  if( in_array( $export->export_format, array( 'csv' ) ) ) {
836
  for( $i = 0; $i < $size; $i++ ) {
837
  if( $i == ( $size - 1 ) )
867
  foreach( $export->fields as $key => $field )
868
  $export->columns[] = woo_ce_get_user_field( $key );
869
  }
870
+ $export->total_columns = $size = count( $export->columns );
871
  $export->data_memory_start = woo_ce_current_memory_usage();
872
  if( $users = woo_ce_get_users( $export->args ) ) {
873
+ // Generate the export headers
874
  if( in_array( $export->export_format, array( 'csv' ) ) ) {
875
  $i = 0;
876
  foreach( $export->columns as $column ) {
905
  break;
906
 
907
  }
908
+
909
+ // Remove our content filters here to play nice with other Plugins
910
+ remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
911
+ remove_filter( 'attribute_escape', 'woo_ce_attribute_escape' );
912
+
913
+ // Remove our fatal error notice so not to conflict with the CRON or scheduled export engine
914
+ remove_action( 'shutdown', 'woo_ce_fatal_error' );
915
+
916
  // Export completed successfully
917
  delete_transient( WOO_CE_PREFIX . '_running' );
918
+
919
  // Check that the export file is populated, export columns have been assigned and rows counted
920
  if( $output && $export->total_rows && $export->total_columns ) {
921
  if( in_array( $export->export_format, array( 'csv' ) ) ) {
923
  if( $export->export_format == 'csv' && $export->bom && ( WOO_CE_DEBUG == false ) )
924
  $output = "\xEF\xBB\xBF" . $output;
925
  }
926
+ if( WOO_CE_DEBUG && !$export->cron ) {
927
+ $response = set_transient( WOO_CE_PREFIX . '_debug_log', base64_encode( $output ), woo_ce_get_option( 'timeout', MINUTE_IN_SECONDS ) );
928
+ if( $response !== true ) {
929
+ $message = __( 'The export contents were too large to store in a single WordPress transient, use the Volume offset / Limit volume options to reduce the size of your export and try again.', 'woocommerce-exporter' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woocommerce-exporter' ) . '</a>)';
930
+ if( function_exists( 'woo_ce_admin_notice' ) )
931
+ woo_ce_admin_notice( $message, 'error' );
932
+ else
933
+ error_log( sprintf( '[store-exporter] woo_ce_export_dataset() - %s', $message ) );
934
+ }
935
+ } else {
936
  return $output;
937
+ }
938
+ }
939
+
940
+ }
941
+
942
+ function woo_ce_fatal_error() {
943
+
944
+ global $export;
945
+
946
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter/usage/';
947
+
948
+ $error = error_get_last();
949
+ if( $error !== null ) {
950
+ $message = '';
951
+ $notice = sprintf( __( 'Refer to the following error and contact us on http://wordpress.org/plugins/woocommerce-exporter/ for further assistance. Error: <code>%s</code>', 'woocommerce-exporter' ), $error['message'] );
952
+ if ( substr( $error['message'], 0, 22 ) === 'Maximum execution time' ) {
953
+ $message = __( 'The server\'s maximum execution time is too low to complete this export. This is commonly due to a low timeout limit set by your hosting provider or PHP Safe Mode being enabled.', 'woocommerce-exporter' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woocommerce-exporter' ) . '</a>)';
954
+ } elseif ( substr( $error['message'], 0, 19 ) === 'Allowed memory size' ) {
955
+ $message = __( 'The server\'s maximum memory size is too low to complete this export. Consider increasing available memory to WordPress or reducing the size of your export.', 'woocommerce-exporter' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woocommerce-exporter' ) . '</a>)';
956
+ } else if( $error['type'] === E_ERROR ) {
957
+ // Test if it's WP All Import conflicting with the PHPExcel library
958
+ if( substr( $error['message'], 0, 33 ) == "Class 'PHPExcel_Writer_Excel2007'" && ( strstr( $error['file'], 'wp-all-import' ) !== false ) ) {
959
+ $message = __( 'A fatal PHP error was encountered during the export process, this was due to the Plugin WP All Import pre-loading the PHPExcel library. Contact the Plugin author Soflyy for more information.', 'woocommerce-exporter' );
960
+ } else {
961
+ $message = __( 'A fatal PHP error was encountered during the export process, we couldn\'t detect or diagnose it further.', 'woocommerce-exporter' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woocommerce-exporter' ) . '</a>)';
962
+ }
963
+ }
964
+ if( !empty( $message ) ) {
965
+
966
+ // Save a record to the PHP error log
967
+ woo_ce_error_log( sprintf( __( 'Fatal error: %s - PHP response: %s in %s on line %s', 'woocommerce-exporter' ), $message, $error['message'], $error['file'], $error['line'] ) );
968
+ error_log( sprintf( __( 'Fatal error: %s - PHP response: %s in %s on line %s', 'woocommerce-exporter' ), $message, $error['message'], $error['file'], $error['line'] ) );
969
+
970
+ // Only display the message if this is a manual export
971
+ if( ( !$export->cron && !$export->scheduled_export ) ) {
972
+ $output = '<div id="message" class="error"><p>' . sprintf( __( '<strong>[store-exporter]</strong> An unexpected error occurred. %s', 'woocommerce-exporter' ), $message ) . '</p><p>' . $notice . '</p></div>';
973
+ echo $output;
974
+ }
975
+
976
+ }
977
  }
978
 
979
  }
980
 
981
  // List of Export types used on Store Exporter screen
982
+ function woo_ce_get_export_types() {
983
+
984
+ $types = array(
985
+ 'product' => __( 'Products', 'woocommerce-exporter' ),
986
+ 'category' => __( 'Categories', 'woocommerce-exporter' ),
987
+ 'tag' => __( 'Tags', 'woocommerce-exporter' ),
988
+ 'user' => __( 'Users', 'woocommerce-exporter' )
989
+ );
990
+ $types = apply_filters( 'woo_ce_export_types', $types );
991
  return $types;
992
 
993
  }
998
  if( !empty( $filename ) ) {
999
  $post_type = 'woo-export';
1000
  $args = array(
1001
+ 'post_status' => 'private',
1002
  'post_title' => $filename,
1003
  'post_type' => $post_type,
1004
  'post_mime_type' => $post_mime_type
1005
  );
1006
  $post_ID = wp_insert_attachment( $args, $filename );
1007
  if( is_wp_error( $post_ID ) )
1008
+ woo_ce_error_log( sprintf( 'save_file_attachment() - $s: %s', $filename, $result->get_error_message() ) );
1009
  else
1010
  return $post_ID;
1011
  }
1069
 
1070
  }
1071
 
1072
+ function woo_ce_get_mime_types() {
1073
+
1074
+ $mime_types = array(
1075
+ 'csv' => 'text/csv',
1076
+ 'tsv' => 'text/tab-separated-values',
1077
+ 'xls' => 'application/vnd.ms-excel',
1078
+ 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
1079
+ 'xml' => 'application/xml',
1080
+ 'rss' => 'application/rss+xml'
1081
+ );
1082
+ return $mime_types;
1083
+
1084
+ }
1085
+
1086
+ function woo_ce_get_mime_type_extension( $mime_type, $search_by = 'extension' ) {
1087
+
1088
+ $mime_types = woo_ce_get_mime_types();
1089
+ if( $search_by == 'extension' ) {
1090
+ if( isset( $mime_types[$mime_type] ) )
1091
+ return $mime_types[$mime_type];
1092
+ } else if( $search_by == 'mime_type' ) {
1093
+ if( $key = array_search( $mime_type, $mime_types ) )
1094
+ return strtoupper( $key );
1095
+ }
1096
+
1097
+ }
1098
+
1099
  function woo_ce_add_missing_mime_type( $mime_types = array() ) {
1100
 
1101
  // Add CSV mime type if it has been removed
1102
  if( !isset( $mime_types['csv'] ) )
1103
  $mime_types['csv'] = 'text/csv';
1104
+ // Add TSV mime type if it has been removed
1105
+ if( !isset( $mime_types['tsv'] ) )
1106
+ $mime_types['tsv'] = 'text/tab-separated-values';
1107
+ // Add XLS mime type if it has been removed
1108
+ if( !isset( $mime_types['xls'] ) )
1109
+ $mime_types['xls'] = 'application/vnd.ms-excel';
1110
+ // Add XLSX mime type if it has been removed
1111
+ if( !isset( $mime_types['xlsx'] ) )
1112
+ $mime_types['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1113
+ // Add XML mime type if it has been removed
1114
+ if( !isset( $mime_types['xml'] ) )
1115
+ $mime_types['xml'] = 'application/xml';
1116
+ // Add RSS mime type if it has been removed
1117
+ if( !isset( $mime_types['rss'] ) )
1118
+ $mime_types['rss'] = 'application/rss+xml';
1119
  return $mime_types;
1120
 
1121
  }
1122
+ add_filter( 'upload_mimes', 'woo_ce_add_missing_mime_type' );
1123
 
1124
  if( !function_exists( 'woo_ce_sort_fields' ) ) {
1125
  function woo_ce_sort_fields( $key ) {
1129
  }
1130
  }
1131
 
 
1132
  // Add Store Export to filter types on the WordPress Media screen
1133
  function woo_ce_add_post_mime_type( $post_mime_types = array() ) {
1134
 
1135
+ $post_mime_types['text/csv'] = array( __( 'Store Exports (CSV)', 'woocommerce-exporter' ), __( 'Manage Store Exports (CSV)', 'woocommerce-exporter' ), _n_noop( 'Store Export - CSV <span class="count">(%s)</span>', 'Store Exports - CSV <span class="count">(%s)</span>' ) );
1136
  return $post_mime_types;
1137
 
1138
  }
1147
 
1148
  }
1149
 
1150
+ function woo_ce_get_start_of_week_day() {
1151
+
1152
+ global $wp_locale;
1153
+
1154
+ $output = 'Monday';
1155
+ $start_of_week = get_option( 'start_of_week', 0 );
1156
+ for( $day_index = 0; $day_index <= 6; $day_index++ ) {
1157
+ if( $start_of_week == $day_index ) {
1158
+ $output = $wp_locale->get_weekday( $day_index );
1159
+ break;
1160
+ }
1161
+ }
1162
+ return $output;
1163
+
1164
+ }
1165
+
1166
+ function woo_ce_detect_product_brands() {
1167
+
1168
+ if( class_exists( 'WC_Brands' ) || class_exists( 'woo_brands' ) || taxonomy_exists( apply_filters( 'woo_ce_brand_term_taxonomy', 'product_brand' ) ) )
1169
+ return true;
1170
+
1171
+ }
1172
+
1173
+ // Return whether WPML exists
1174
+ function woo_ce_detect_wpml() {
1175
+
1176
+ if( defined( 'ICL_LANGUAGE_CODE' ) )
1177
+ return true;
1178
+
1179
+ }
1180
+
1181
+ // List of WordPress Plugins that Store Exporter integrates with
1182
+ function woo_ce_modules_list( $module_status = false ) {
1183
+
1184
+ $modules = array();
1185
+ $modules[] = array(
1186
+ 'name' => 'aioseop',
1187
+ 'title' => __( 'All in One SEO Pack', 'woocommerce-exporter' ),
1188
+ 'description' => __( 'Optimize your WooCommerce Products for Search Engines. Requires Store Toolkit for All in One SEO Pack integration.', 'woocommerce-exporter' ),
1189
+ 'url' => 'http://wordpress.org/extend/plugins/all-in-one-seo-pack/',
1190
+ 'slug' => 'all-in-one-seo-pack',
1191
+ 'function' => 'aioseop_activate'
1192
+ );
1193
+ $modules[] = array(
1194
+ 'name' => 'store_toolkit',
1195
+ 'title' => __( 'Store Toolkit', 'woocommerce-exporter' ),
1196
+ 'description' => __( 'Store Toolkit includes a growing set of commonly-used WooCommerce administration tools aimed at web developers and store maintainers.', 'woocommerce-exporter' ),
1197
+ 'url' => 'http://wordpress.org/extend/plugins/woocommerce-store-toolkit/',
1198
+ 'slug' => 'woocommerce-store-toolkit',
1199
+ 'function' => 'woo_st_admin_init'
1200
+ );
1201
+ $modules[] = array(
1202
+ 'name' => 'ultimate_seo',
1203
+ 'title' => __( 'SEO Ultimate', 'woocommerce-exporter' ),
1204
+ 'description' => __( 'This all-in-one SEO plugin gives you control over Product details.', 'woocommerce-exporter' ),
1205
+ 'url' => 'http://wordpress.org/extend/plugins/seo-ultimate/',
1206
+ 'slug' => 'seo-ultimate',
1207
+ 'function' => 'su_wp_incompat_notice'
1208
+ );
1209
+ $modules[] = array(
1210
+ 'name' => 'gpf',
1211
+ 'title' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' ),
1212
+ 'description' => __( 'Easily configure data to be added to your Google Merchant Centre feed.', 'woocommerce-exporter' ),
1213
+ 'url' => 'http://www.leewillis.co.uk/wordpress-plugins/',
1214
+ 'function' => 'woocommerce_gpf_install'
1215
+ );
1216
+ $modules[] = array(
1217
+ 'name' => 'wpseo',
1218
+ 'title' => __( 'Yoast SEO', 'woocommerce-exporter' ),
1219
+ 'description' => __( 'The first true all-in-one SEO solution for WordPress. Formally WordPress SEO.', 'woocommerce-exporter' ),
1220
+ 'url' => 'http://yoast.com/wordpress/seo/#utm_source=wpadmin&utm_medium=plugin&utm_campaign=wpseoplugin',
1221
+ 'slug' => 'wordpress-seo',
1222
+ 'function' => 'wpseo_admin_init'
1223
+ );
1224
+ $modules[] = array(
1225
+ 'name' => 'wpseo_wc',
1226
+ 'title' => __( 'Yoast SEO: WooCommerce', 'woocommerce-exporter' ),
1227
+ 'description' => __( 'This extension to WooCommerce and WordPress SEO by Yoast makes sure there\'s perfect communication between the two plugins.', 'woocommerce-exporter' ),
1228
+ 'url' => 'https://yoast.com/wordpress/plugins/yoast-woocommerce-seo/',
1229
+ 'function' => 'initialize_yoast_woocommerce_seo'
1230
+ );
1231
+ $modules[] = array(
1232
+ 'name' => 'wc_msrp',
1233
+ 'title' => __( 'WooCommerce MSRP Pricing', 'woocommerce-exporter' ),
1234
+ 'description' => __( 'Define and display MSRP prices (Manufacturer\'s suggested retail price) to your customers.', 'woocommerce-exporter' ),
1235
+ 'url' => 'http://www.woothemes.com/products/msrp-pricing/',
1236
+ 'function' => 'woocommerce_msrp_activate'
1237
+ );
1238
+ $modules[] = array(
1239
+ 'name' => 'wc_brands',
1240
+ 'title' => __( 'WooCommerce Brands Addon', 'woocommerce-exporter' ),
1241
+ 'description' => __( 'Create, assign and list brands for products, and allow customers to filter by brand.', 'woocommerce-exporter' ),
1242
+ 'url' => 'http://www.woothemes.com/products/brands/',
1243
+ 'class' => 'WC_Brands'
1244
+ );
1245
+ $modules[] = array(
1246
+ 'name' => 'wc_cog',
1247
+ 'title' => __( 'Cost of Goods', 'woocommerce-exporter' ),
1248
+ 'description' => __( 'Easily track total profit and cost of goods by adding a Cost of Good field to simple and variable products.', 'woocommerce-exporter' ),
1249
+ 'url' => 'http://www.skyverge.com/product/woocommerce-cost-of-goods-tracking/',
1250
+ 'class' => 'WC_COG'
1251
+ );
1252
+ $modules[] = array(
1253
+ 'name' => 'per_product_shipping',
1254
+ 'title' => __( 'Per Product Shipping', 'woocommerce-exporter' ),
1255
+ 'description' => __( 'Define separate shipping costs per product which are combined at checkout to provide a total shipping cost.', 'woocommerce-exporter' ),
1256
+ 'url' => 'http://www.woothemes.com/products/per-product-shipping/',
1257
+ 'class' => 'WC_Shipping_Per_Product_Init'
1258
+ );
1259
+ $modules[] = array(
1260
+ 'name' => 'vendors',
1261
+ 'title' => __( 'Product Vendors', 'woocommerce-exporter' ),
1262
+ 'description' => __( 'Turn your store into a multi-vendor marketplace (such as Etsy or Creative Market).', 'woocommerce-exporter' ),
1263
+ 'url' => 'http://www.woothemes.com/products/product-vendors/',
1264
+ 'class' => 'WC_Product_Vendors'
1265
+ );
1266
+ $modules[] = array(
1267
+ 'name' => 'wc_vendors',
1268
+ 'title' => __( 'WC Vendors', 'woocommerce-exporter' ),
1269
+ 'description' => __( 'Allow vendors to sell their own products and receive a commission for each sale.', 'woocommerce-exporter' ),
1270
+ 'url' => 'http://wcvendors.com',
1271
+ 'class' => 'WC_Vendors'
1272
+ );
1273
+ $modules[] = array(
1274
+ 'name' => 'acf',
1275
+ 'title' => __( 'Advanced Custom Fields', 'woocommerce-exporter' ),
1276
+ 'description' => __( 'Powerful fields for WordPress developers.', 'woocommerce-exporter' ),
1277
+ 'url' => 'http://www.advancedcustomfields.com',
1278
+ 'class' => 'acf'
1279
+ );
1280
+ $modules[] = array(
1281
+ 'name' => 'product_addons',
1282
+ 'title' => __( 'Product Add-ons', 'woocommerce-exporter' ),
1283
+ 'description' => __( 'Allow your customers to customise your products by adding input boxes, dropdowns or a field set of checkboxes.', 'woocommerce-exporter' ),
1284
+ 'url' => 'http://www.woothemes.com/products/product-add-ons/',
1285
+ 'class' => array( 'Product_Addon_Admin', 'Product_Addon_Display' )
1286
+ );
1287
+ $modules[] = array(
1288
+ 'name' => 'seq',
1289
+ 'title' => __( 'WooCommerce Sequential Order Numbers', 'woocommerce-exporter' ),
1290
+ 'description' => __( 'This plugin extends the WooCommerce e-commerce plugin by setting sequential order numbers for new orders.', 'woocommerce-exporter' ),
1291
+ 'url' => 'https://wordpress.org/plugins/woocommerce-sequential-order-numbers/',
1292
+ 'slug' => 'woocommerce-sequential-order-numbers',
1293
+ 'class' => 'WC_Seq_Order_Number'
1294
+ );
1295
+ $modules[] = array(
1296
+ 'name' => 'seq_pro',
1297
+ 'title' => __( 'WooCommerce Sequential Order Numbers Pro', 'woocommerce-exporter' ),
1298
+ 'description' => __( 'Tame your WooCommerce Order Numbers.', 'woocommerce-exporter' ),
1299
+ 'url' => 'http://www.woothemes.com/products/sequential-order-numbers-pro/',
1300
+ 'class' => 'WC_Seq_Order_Number_Pro'
1301
+ );
1302
+ $modules[] = array(
1303
+ 'name' => 'print_invoice_delivery_note',
1304
+ 'title' => __( 'WooCommerce Print Invoice & Delivery Note', 'woocommerce-exporter' ),
1305
+ 'description' => __( 'Print invoices and delivery notes for WooCommerce orders.', 'woocommerce-exporter' ),
1306
+ 'url' => 'http://wordpress.org/plugins/woocommerce-delivery-notes/',
1307
+ 'slug' => 'woocommerce-delivery-notes',
1308
+ 'class' => 'WooCommerce_Delivery_Notes'
1309
+ );
1310
+ $modules[] = array(
1311
+ 'name' => 'pdf_invoices_packing_slips',
1312
+ 'title' => __( 'WooCommerce PDF Invoices & Packing Slips', 'woocommerce-exporter' ),
1313
+ 'description' => __( 'Create, print & automatically email PDF invoices & packing slips for WooCommerce orders.', 'woocommerce-exporter' ),
1314
+ 'url' => 'https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/',
1315
+ 'slug' => 'woocommerce-pdf-invoices-packing-slips',
1316
+ 'class' => 'WooCommerce_PDF_Invoices'
1317
+ );
1318
+ $modules[] = array(
1319
+ 'name' => 'checkout_manager',
1320
+ 'title' => __( 'WooCommerce Checkout Manager & WooCommerce Checkout Manager Pro', 'woocommerce-exporter' ),
1321
+ 'description' => __( 'Manages the WooCommerce Checkout page and WooCommerce Checkout processes.', 'woocommerce-exporter' ),
1322
+ 'url' => 'http://wordpress.org/plugins/woocommerce-checkout-manager/',
1323
+ 'slug' => 'woocommerce-checkout-manager',
1324
+ 'function' => array( 'wccs_install', 'wooccm_install', 'wccs_install_pro' )
1325
+ );
1326
+ $modules[] = array(
1327
+ 'name' => 'wc_pgsk',
1328
+ 'title' => __( 'Poor Guys Swiss Knife', 'woocommerce-exporter' ),
1329
+ 'description' => __( 'A Swiss Knife for WooCommerce.', 'woocommerce-exporter' ),
1330
+ 'url' => 'http://wordpress.org/plugins/woocommerce-poor-guys-swiss-knife/',
1331
+ 'slug' => 'woocommerce-poor-guys-swiss-knife',
1332
+ 'function' => 'wcpgsk_init'
1333
+ );
1334
+ $modules[] = array(
1335
+ 'name' => 'checkout_field_editor',
1336
+ 'title' => __( 'Checkout Field Editor', 'woocommerce-exporter' ),
1337
+ 'description' => __( 'Add, edit and remove fields shown on your WooCommerce checkout page.', 'woocommerce-exporter' ),
1338
+ 'url' => 'http://www.woothemes.com/products/woocommerce-checkout-field-editor/',
1339
+ 'function' => 'woocommerce_init_checkout_field_editor'
1340
+ );
1341
+ $modules[] = array(
1342
+ 'name' => 'checkout_field_manager',
1343
+ 'title' => __( 'Checkout Field Manager', 'woocommerce-exporter' ),
1344
+ 'description' => __( 'Quickly and effortlessly add, remove and re-orders fields in the checkout process.', 'woocommerce-exporter' ),
1345
+ 'url' => 'http://61extensions.com/shop/woocommerce-checkout-field-manager/',
1346
+ 'function' => 'sod_woocommerce_checkout_manager_settings'
1347
+ );
1348
+ $modules[] = array(
1349
+ 'name' => 'checkout_addons',
1350
+ 'title' => __( 'WooCommerce Checkout Add-Ons', 'woocommerce-exporter' ),
1351
+ 'description' => __( 'Add fields at checkout for add-on products and services while optionally setting a cost for each add-on.', 'woocommerce-exporter' ),
1352
+ 'url' => 'http://www.skyverge.com/product/woocommerce-checkout-add-ons/',
1353
+ 'function' => 'init_woocommerce_checkout_add_ons'
1354
+ );
1355
+ $modules[] = array(
1356
+ 'name' => 'local_pickup_plus',
1357
+ 'title' => __( 'Local Pickup Plus', 'woocommerce-exporter' ),
1358
+ 'description' => __( 'Let customers pick up products from specific locations.', 'woocommerce-exporter' ),
1359
+ 'url' => 'http://www.woothemes.com/products/local-pickup-plus/',
1360
+ 'class' => 'WC_Local_Pickup_Plus'
1361
+ );
1362
+ $modules[] = array(
1363
+ 'name' => 'gravity_forms',
1364
+ 'title' => __( 'Gravity Forms', 'woocommerce-exporter' ),
1365
+ 'description' => __( 'Gravity Forms is hands down the best contact form plugin for WordPress powered websites.', 'woocommerce-exporter' ),
1366
+ 'url' => 'http://www.gravityforms.com/',
1367
+ 'class' => 'RGForms'
1368
+ );
1369
+ $modules[] = array(
1370
+ 'name' => 'woocommerce_gravity_forms',
1371
+ 'title' => __( 'WooCommerce Gravity Forms Product Add-Ons', 'woocommerce-exporter' ),
1372
+ 'description' => __( 'Allows you to use Gravity Forms on individual WooCommerce products.', 'woocommerce-exporter' ),
1373
+ 'url' => 'https://www.woothemes.com/products/gravity-forms-add-ons/',
1374
+ 'class' => array( 'woocommerce_gravityforms', 'WC_GFPA_Main' )
1375
+ );
1376
+ $modules[] = array(
1377
+ 'name' => 'currency_switcher',
1378
+ 'title' => __( 'WooCommerce Currency Switcher', 'woocommerce-exporter' ),
1379
+ 'description' => __( 'Currency Switcher for WooCommerce allows your shop to display prices and accept payments in multiple currencies.', 'woocommerce-exporter' ),
1380
+ 'url' => 'http://aelia.co/shop/currency-switcher-woocommerce/',
1381
+ 'class' => 'WC_Aelia_CurrencySwitcher'
1382
+ );
1383
+ $modules[] = array(
1384
+ 'name' => 'subscriptions',
1385
+ 'title' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
1386
+ 'description' => __( 'WC Subscriptions makes it easy to create and manage products with recurring payments.', 'woocommerce-exporter' ),
1387
+ 'url' => 'http://www.woothemes.com/products/woocommerce-subscriptions/',
1388
+ 'class' => array( 'WC_Subscriptions', 'WC_Subscriptions_Manager' )
1389
+ );
1390
+ $modules[] = array(
1391
+ 'name' => 'extra_product_options',
1392
+ 'title' => __( 'WooCommerce Extra Product Options', 'woocommerce-exporter' ),
1393
+ 'description' => __( 'Create extra price fields globally or per-Product', 'woocommerce-exporter' ),
1394
+ 'url' => 'http://codecanyon.net/item/woocommerce-extra-product-options/7908619',
1395
+ 'class' => 'TM_Extra_Product_Options'
1396
+ );
1397
+ $modules[] = array(
1398
+ 'name' => 'woocommerce_jetpack',
1399
+ 'title' => __( 'Booster for WooCommerce', 'woocommerce-exporter' ),
1400
+ 'description' => __( 'Supercharge your WooCommerce site with these awesome powerful features (formally WooCommerce Jetpack).', 'woocommerce-exporter' ),
1401
+ 'url' => 'https://wordpress.org/plugins/woocommerce-jetpack/',
1402
+ 'slug' => 'woocommerce-jetpack',
1403
+ 'class' => 'WC_Jetpack'
1404
+ );
1405
+ $modules[] = array(
1406
+ 'name' => 'woocommerce_jetpack_plus',
1407
+ 'title' => __( 'Booster Plus', 'woocommerce-exporter' ),
1408
+ 'description' => __( 'Unlock all WooCommerce Booster features and supercharge your WordPress WooCommerce site even more (formally WooCommerce Jetpack Plus).', 'woocommerce-exporter' ),
1409
+ 'url' => 'http://woojetpack.com/shop/wordpress-woocommerce-jetpack-plus/',
1410
+ 'class' => 'WC_Jetpack_Plus'
1411
+ );
1412
+ $modules[] = array(
1413
+ 'name' => 'woocommerce_brands',
1414
+ 'title' => __( 'WooCommerce Brands', 'woocommerce-exporter' ),
1415
+ 'description' => __( 'Woocommerce Brands Plugin. After Install and active this plugin you\'ll have some shortcode and some widget for display your brands in fornt-end website.', 'woocommerce-exporter' ),
1416
+ 'url' => 'http://proword.net/Woocommerce_Brands/',
1417
+ 'class' => 'woo_brands'
1418
+ );
1419
+ $modules[] = array(
1420
+ 'name' => 'woocommerce_bookings',
1421
+ 'title' => __( 'WooCommerce Bookings', 'woocommerce-exporter' ),
1422
+ 'description' => __( 'Setup bookable products such as for reservations, services and hires.', 'woocommerce-exporter' ),
1423
+ 'url' => 'http://www.woothemes.com/products/woocommerce-bookings/',
1424
+ 'class' => 'WC_Bookings'
1425
+ );
1426
+ $modules[] = array(
1427
+ 'name' => 'eu_vat',
1428
+ 'title' => __( 'WooCommerce EU VAT Number', 'woocommerce-exporter' ),
1429
+ 'description' => __( 'The EU VAT Number extension lets you collect and validate EU VAT numbers during checkout to identify B2B transactions verses B2C.', 'woocommerce-exporter' ),
1430
+ 'url' => 'https://www.woothemes.com/products/eu-vat-number/',
1431
+ 'function' => '__wc_eu_vat_number_init'
1432
+ );
1433
+ $modules[] = array(
1434
+ 'name' => 'aelia_eu_vat',
1435
+ 'title' => __( 'WooCommerce EU VAT Assistant', 'woocommerce-exporter' ),
1436
+ 'description' => __( 'Assists with EU VAT compliance, for the new VAT regime beginning 1st January 2015.', 'woocommerce-exporter' ),
1437
+ 'url' => 'https://wordpress.org/plugins/woocommerce-eu-vat-assistant/',
1438
+ 'slug' => 'woocommerce-eu-vat-assistant',
1439
+ 'class' => 'Aelia_WC_RequirementsChecks'
1440
+ );
1441
+ $modules[] = array(
1442
+ 'name' => 'hear_about_us',
1443
+ 'title' => __( 'WooCommerce Hear About Us', 'woocommerce-exporter' ),
1444
+ 'description' => __( 'Ask where your new customers come from at Checkout.', 'woocommerce-exporter' ),
1445
+ 'url' => 'https://wordpress.org/plugins/woocommerce-hear-about-us/',
1446
+ 'slug' => 'woocommerce-hear-about-us', // Define this if the Plugin is hosted on the WordPress repo
1447
+ 'class' => 'WooCommerce_HearAboutUs'
1448
+ );
1449
+ $modules[] = array(
1450
+ 'name' => 'wholesale_pricing',
1451
+ 'title' => __( 'WooCommerce Wholesale Pricing', 'woocommerce-exporter' ),
1452
+ 'description' => __( 'Allows you to set wholesale prices for products and variations.', 'woocommerce-exporter' ),
1453
+ 'url' => 'http://ignitewoo.com/woocommerce-extensions-plugins-themes/woocommerce-wholesale-pricing/',
1454
+ 'class' => 'woocommerce_wholesale_pricing'
1455
+ );
1456
+ $modules[] = array(
1457
+ 'name' => 'wc_barcodes',
1458
+ 'title' => __( 'Barcodes for WooCommerce', 'woocommerce-exporter' ),
1459
+ 'description' => __( 'Allows you to add GTIN (former EAN) codes natively to your products.', 'woocommerce-exporter' ),
1460
+ 'url' => 'http://www.wolkenkraft.com/produkte/barcodes-fuer-woocommerce/',
1461
+ 'function' => 'wpps_requirements_met'
1462
+ );
1463
+ $modules[] = array(
1464
+ 'name' => 'wc_smart_coupons',
1465
+ 'title' => __( 'WooCommerce Smart Coupons', 'woocommerce-exporter' ),
1466
+ 'description' => __( 'WooCommerce Smart Coupons lets customers buy gift certificates, store credits or coupons easily.', 'woocommerce-exporter' ),
1467
+ 'url' => 'http://www.woothemes.com/products/smart-coupons/',
1468
+ 'class' => 'WC_Smart_Coupons'
1469
+ );
1470
+ $modules[] = array(
1471
+ 'name' => 'wc_preorders',
1472
+ 'title' => __( 'WooCommerce Pre-Orders', 'woocommerce-exporter' ),
1473
+ 'description' => __( 'Sell pre-orders for products in your WooCommerce store.', 'woocommerce-exporter' ),
1474
+ 'url' => 'http://www.woothemes.com/products/woocommerce-pre-orders/',
1475
+ 'class' => 'WC_Pre_Orders'
1476
+ );
1477
+ $modules[] = array(
1478
+ 'name' => 'order_numbers_basic',
1479
+ 'title' => __( 'WooCommerce Basic Ordernumbers', 'woocommerce-exporter' ),
1480
+ 'description' => __( 'Lets the user freely configure the order numbers in WooCommerce.', 'woocommerce-exporter' ),
1481
+ 'url' => 'http://open-tools.net/woocommerce/advanced-ordernumbers-for-woocommerce.html',
1482
+ 'class' => 'OpenToolsOrdernumbersBasic'
1483
+ );
1484
+ $modules[] = array(
1485
+ 'name' => 'admin_custom_order_fields',
1486
+ 'title' => __( 'WooCommerce Admin Custom Order Fields', 'woocommerce-exporter' ),
1487
+ 'description' => __( 'Easily add custom fields to your WooCommerce orders and display them in the Orders admin, the My Orders section and order emails.', 'woocommerce-exporter' ),
1488
+ 'url' => 'http://www.woothemes.com/products/woocommerce-admin-custom-order-fields/',
1489
+ 'function' => 'init_woocommerce_admin_custom_order_fields'
1490
+ );
1491
+ $modules[] = array(
1492
+ 'name' => 'table_rate_shipping_plus',
1493
+ 'title' => __( 'WooCommerce Table Rate Shipping Plus', 'woocommerce-exporter' ),
1494
+ 'description' => __( 'Calculate shipping costs based on destination, weight and price.', 'woocommerce-exporter' ),
1495
+ 'url' => 'http://mangohour.com/plugins/woocommerce-table-rate-shipping',
1496
+ 'function' => 'mh_wc_table_rate_plus_init'
1497
+ );
1498
+ $modules[] = array(
1499
+ 'name' => 'wc_extra_checkout_fields_brazil',
1500
+ 'title' => __( 'WooCommerce Extra Checkout Fields for Brazil', 'woocommerce-exporter' ),
1501
+ 'description' => __( 'Adds Brazilian checkout fields in WooCommerce.', 'woocommerce-exporter' ),
1502
+ 'url' => 'https://wordpress.org/plugins/woocommerce-extra-checkout-fields-for-brazil/',
1503
+ 'slug' => 'woocommerce-extra-checkout-fields-for-brazil',
1504
+ 'class' => 'Extra_Checkout_Fields_For_Brazil'
1505
+ );
1506
+ $modules[] = array(
1507
+ 'name' => 'wc_quickdonation',
1508
+ 'title' => __( 'WooCommerce Quick Donation', 'woocommerce-exporter' ),
1509
+ 'description' => __( 'Turns WooCommerce into online donation.', 'woocommerce-exporter' ),
1510
+ 'url' => 'https://wordpress.org/plugins/woocommerce-quick-donation/',
1511
+ 'slug' => 'woocommerce-quick-donation',
1512
+ 'class' => 'WooCommerce_Quick_Donation'
1513
+ );
1514
+ $modules[] = array(
1515
+ 'name' => 'wc_easycheckout',
1516
+ 'title' => __( 'Easy Checkout Fields Editor', 'woocommerce-exporter' ),
1517
+ 'description' => __( 'WooCommerce Easy Checkout Fields Editor.', 'woocommerce-exporter' ),
1518
+ 'url' => 'http://codecanyon.net/item/woocommerce-easy-checkout-field-editor/9799777',
1519
+ 'function' => 'pcmfe_admin_form_field'
1520
+ );
1521
+ $modules[] = array(
1522
+ 'name' => 'wc_productfees',
1523
+ 'title' => __( 'Product Fees', 'woocommerce-exporter' ),
1524
+ 'description' => __( 'WooCommerce Product Fees allows you to add additional fees at checkout based on products that are in the cart.', 'woocommerce-exporter' ),
1525
+ 'url' => 'https://wordpress.org/plugins/woocommerce-product-fees/',
1526
+ 'slug' => 'woocommerce-product-fees',
1527
+ 'class' => 'WooCommerce_Product_Fees'
1528
+ );
1529
+ $modules[] = array(
1530
+ 'name' => 'wc_events',
1531
+ 'title' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
1532
+ 'description' => __( 'Adds event and ticketing features to WooCommerce.', 'woocommerce-exporter' ),
1533
+ 'url' => 'http://www.woocommerceevents.com/',
1534
+ 'class' => 'WooCommerce_Events'
1535
+ );
1536
+ $modules[] = array(
1537
+ 'name' => 'wc_tabmanager',
1538
+ 'title' => __( 'WooCommerce Tab Manager', 'woocommerce-exporter' ),
1539
+ 'description' => __( 'A product tab manager for WooCommerce.', 'woocommerce-exporter' ),
1540
+ 'url' => 'http://www.woothemes.com/products/woocommerce-tab-manager/',
1541
+ 'class' => 'WC_Tab_Manager'
1542
+ );
1543
+ $modules[] = array(
1544
+ 'name' => 'wc_customfields',
1545
+ 'title' => __( 'WooCommerce Custom Fields', 'woocommerce-exporter' ),
1546
+ 'description' => __( 'Create custom fields for WooCommerce product, checkout, order and customer pages.', 'woocommerce-exporter' ),
1547
+ 'url' => 'http://www.rightpress.net/woocommerce-custom-fields',
1548
+ 'class' => array( 'RP_WCCF', 'WCCF' )
1549
+ );
1550
+ $modules[] = array(
1551
+ 'name' => 'barcode_isbn',
1552
+ 'title' => __( 'WooCommerce Barcode & ISBN', 'woocommerce-exporter' ),
1553
+ 'description' => __( 'A plugin to add a barcode & ISBN to WooCommerce.', 'woocommerce-exporter' ),
1554
+ 'url' => 'https://wordpress.org/plugins/woocommerce-barcode-isbn/',
1555
+ 'slug' => 'woocommerce-barcode-isbn',
1556
+ 'function' => 'woo_add_barcode'
1557
+ );
1558
+ $modules[] = array(
1559
+ 'name' => 'video_product_tab',
1560
+ 'title' => __( 'WooCommerce Video Product Tab', 'woocommerce-exporter' ),
1561
+ 'description' => __( 'Extends WooCommerce to allow you to add a Video to the Product page.', 'woocommerce-exporter' ),
1562
+ 'url' => 'https://wordpress.org/plugins/woocommerce-video-product-tab/',
1563
+ 'slug' => 'woocommerce-video-product-tab',
1564
+ 'class' => 'WooCommerce_Video_Product_Tab'
1565
+ );
1566
+ $modules[] = array(
1567
+ 'name' => 'external_featured_image',
1568
+ 'title' => __( 'Nelio External Featured Image', 'woocommerce-exporter' ),
1569
+ 'description' => __( 'Use external images from anywhere as the featured image of your pages and posts.', 'woocommerce-exporter' ),
1570
+ 'url' => 'https://wordpress.org/plugins/external-featured-image/',
1571
+ 'slug' => 'external-featured-image', // Define this if the Plugin is hosted on the WordPress repo
1572
+ 'function' => '_nelioefi_url'
1573
+ );
1574
+ $modules[] = array(
1575
+ 'name' => 'variation_swatches_photos',
1576
+ 'title' => __( 'WooCommerce Variation Swatches and Photos', 'woocommerce-exporter' ),
1577
+ 'description' => __( 'Configure colors and photos for shoppers on your site to use when picking variations.', 'woocommerce-exporter' ),
1578
+ 'url' => 'https://www.woothemes.com/products/variation-swatches-and-photos/',
1579
+ 'class' => 'WC_SwatchesPlugin'
1580
+ );
1581
+ $modules[] = array(
1582
+ 'name' => 'wc_uploads',
1583
+ 'title' => __( 'WooCommerce Uploads', 'woocommerce-exporter' ),
1584
+ 'description' => __( 'Upload files in WooCommerce.', 'woocommerce-exporter' ),
1585
+ 'url' => 'https://wpfortune.com/shop/plugins/woocommerce-uploads/',
1586
+ 'class' => 'WPF_Uploads'
1587
+ );
1588
+ $modules[] = array(
1589
+ 'name' => 'wc_posr',
1590
+ 'title' => __( 'WooCommerce Profit of Sales Report', 'woocommerce-exporter' ),
1591
+ 'description' => __( 'This plugin provides Profit of Sales Report based on Cost of Goods.', 'woocommerce-exporter' ),
1592
+ 'url' => 'http://codecanyon.net/item/woocommerce-profit-of-sales-report/9190590',
1593
+ 'function' => 'POSRFront'
1594
+ );
1595
+ $modules[] = array(
1596
+ 'name' => 'orddd_free',
1597
+ 'title' => __( 'Order Delivery Date for WooCommerce', 'woocommerce-exporter' ),
1598
+ 'description' => __( 'Allow the customers to choose an order delivery date on the checkout page for WooCommerce store owners.', 'woocommerce-exporter' ),
1599
+ 'slug' => 'order-delivery-date-for-woocommerce',
1600
+ 'url' => 'https://wordpress.org/plugins/order-delivery-date-for-woocommerce/',
1601
+ 'class' => 'order_delivery_date_lite'
1602
+ );
1603
+ $modules[] = array(
1604
+ 'name' => 'orddd',
1605
+ 'title' => __( 'Order Delivery Date Pro for WooCommerce', 'woocommerce-exporter' ),
1606
+ 'description' => __( 'Allows customers to choose their preferred Order Delivery Date & Delivery Time during checkout.', 'woocommerce-exporter' ),
1607
+ 'url' => 'https://www.tychesoftwares.com/store/premium-plugins/order-delivery-date-for-woocommerce-pro-21/',
1608
+ 'class' => 'order_delivery_date'
1609
+ );
1610
+ $modules[] = array(
1611
+ 'name' => 'wc_eu_vat_compliance',
1612
+ 'title' => __( 'WooCommerce EU VAT Compliance', 'woocommerce-exporter' ),
1613
+ 'description' => __( 'Provides features to assist WooCommerce with EU VAT compliance.', 'woocommerce-exporter' ),
1614
+ 'url' => 'https://wordpress.org/plugins/woocommerce-eu-vat-compliance/',
1615
+ 'slug' => 'woocommerce-eu-vat-compliance',
1616
+ 'class' => 'WC_EU_VAT_Compliance'
1617
+ );
1618
+ $modules[] = array(
1619
+ 'name' => 'wc_eu_vat_compliance_pro',
1620
+ 'title' => __( 'WooCommerce EU VAT Compliance (Premium)', 'woocommerce-exporter' ),
1621
+ 'description' => __( 'Provides features to assist WooCommerce with EU VAT compliance.', 'woocommerce-exporter' ),
1622
+ 'url' => 'https://www.simbahosting.co.uk/s3/product/woocommerce-eu-vat-compliance/',
1623
+ 'slug' => 'woocommerce-eu-vat-compliance',
1624
+ 'class' => 'WC_EU_VAT_Compliance_Premium'
1625
+ );
1626
+ $modules[] = array(
1627
+ 'name' => 'yith_cm',
1628
+ 'title' => __( 'YITH WooCommerce Checkout Manager', 'woocommerce-exporter' ),
1629
+ 'description' => __( 'YITH WooCommerce Checkout Manager lets you add, edit or remove checkout fields.', 'woocommerce-exporter' ),
1630
+ 'url' => 'https://yithemes.com/themes/plugins/yith-woocommerce-checkout-manager/',
1631
+ 'function' => 'ywccp_init'
1632
+ );
1633
+ $modules[] = array(
1634
+ 'name' => 'vt_dp',
1635
+ 'title' => __( 'Discontinued Product for WooCommerce', 'woocommerce-exporter' ),
1636
+ 'description' => __( 'Adds the ability to flag a product as discontinued to WooCommerce.', 'woocommerce-exporter' ),
1637
+ 'url' => 'https://wordpress.org/plugins/discontinued-product-for-woocommerce/',
1638
+ 'slug' => 'discontinued-product-for-woocommerce',
1639
+ 'function' => 'discontinued_product_for_woocommerce_init'
1640
+ );
1641
+ $modules[] = array(
1642
+ 'name' => 'yith_vendor',
1643
+ 'title' => __( 'YITH WooCommerce Multi Vendor Premium', 'woocommerce-exporter' ),
1644
+ 'description' => __( 'Switch your website into a platform hosting more than one shop.', 'woocommerce-exporter' ),
1645
+ 'url' => 'http://yithemes.com/themes/plugins/yith-woocommerce-product-vendors/',
1646
+ 'function' => 'YITH_Vendors'
1647
+ );
1648
+
1649
+ $modules[] = array(
1650
+ 'name' => 'wc_memberships',
1651
+ 'title' => __( 'WooCommerce Memberships', 'woocommerce-exporter' ),
1652
+ 'description' => __( 'Sell memberships that provide access to restricted content, products, discounts, and more!', 'woocommerce-exporter' ),
1653
+ 'url' => 'http://www.woothemes.com/products/woocommerce-memberships/',
1654
+ 'function' => 'init_woocommerce_memberships'
1655
+ );
1656
+
1657
+ $modules[] = array(
1658
+ 'name' => 'wc_product_bundles',
1659
+ 'title' => __( 'WooCommerce Product Bundles', 'woocommerce-exporter' ),
1660
+ 'description' => __( 'WooCommerce extension for creating simple product bundles, kits and assemblies.', 'woocommerce-exporter' ),
1661
+ 'url' => 'http://www.woothemes.com/products/product-bundles/',
1662
+ 'class' => 'WC_Bundles'
1663
+ );
1664
+ $modules[] = array(
1665
+ 'name' => 'wc_min_max',
1666
+ 'title' => __( 'WooCommerce Min/Max Quantities', 'woocommerce-exporter' ),
1667
+ 'description' => __( 'Lets you define minimum/maximum allowed quantities for products, variations and orders.', 'woocommerce-exporter' ),
1668
+ 'url' => 'https://woocommerce.com/products/minmax-quantities/',
1669
+ 'class' => 'WC_Min_Max_Quantities'
1670
+ );
1671
+ $modules[] = array(
1672
+ 'name' => 'wc_followupemails',
1673
+ 'title' => __( 'WooCommerce Follow Ups', 'woocommerce-exporter' ),
1674
+ 'description' => __( 'Follow-Ups makes it easy to automate communications via email and Twitter to keep your customers engaged and spending money.', 'woocommerce-exporter' ),
1675
+ 'url' => 'https://woocommerce.com/products/follow-up-emails/',
1676
+ 'class' => 'FollowUpEmails'
1677
+ );
1678
+ $modules[] = array(
1679
+ 'name' => 'wc_ship_multiple',
1680
+ 'title' => __( 'Ship to Multiple Addresses', 'woocommerce-exporter' ),
1681
+ 'description' => __( 'Allow your customers to ship individual items in a single order to multiple addresses.', 'woocommerce-exporter' ),
1682
+ 'url' => 'https://woocommerce.com/products/shipping-multiple-addresses/',
1683
+ 'class' => 'WC_Ship_Multiple'
1684
+ );
1685
+ $modules[] = array(
1686
+ 'name' => 'awebooking',
1687
+ 'title' => __( 'AweBooking', 'woocommerce-exporter' ),
1688
+ 'description' => __( 'You can easily create a booking/reservation system into your WordPress website without any hassle', 'woocommerce-exporter' ),
1689
+ 'url' => 'https://codecanyon.net/item/awebooking-online-hotel-booking-for-wordpress/12323878',
1690
+ 'function' => 'awebooking_clean_room'
1691
+ );
1692
+ $modules[] = array(
1693
+ 'name' => 'yith_delivery_pro',
1694
+ 'title' => __( 'YITH WooCommerce Delivery Date Premium', 'woocommerce-exporter' ),
1695
+ 'description' => __( 'Let your customers choose a delivery date for their orders', 'woocommerce-exporter' ),
1696
+ 'url' => 'http://yithemes.com/themes/plugins/yith-woocommerce-delivery-date/',
1697
+ 'function' => 'yith_delivery_date_init_plugin'
1698
+ );
1699
+ $modules[] = array(
1700
+ 'name' => 'yith_brands_pro',
1701
+ 'title' => __( 'YITH WooCommerce Brands Add-On', 'woocommerce-exporter' ),
1702
+ 'description' => __( 'YITH WooCommerce Brands Add-on allows you to add brands functionality to the default WooCommerce Plugin.', 'woocommerce-exporter' ),
1703
+ 'url' => 'http://yithemes.com/themes/plugins/yith-woocommerce-brands-add-on/',
1704
+ 'function' => 'yith_brands_constructor'
1705
+ );
1706
+ $modules[] = array(
1707
+ 'name' => 'ign_tiered',
1708
+ 'title' => __( 'WooCommerce Tiered Pricing', 'woocommerce-exporter' ),
1709
+ 'description' => __( 'Allows you to set price tiers for products and variations based on user roles.', 'woocommerce-exporter' ),
1710
+ 'url' => 'http://ignitewoo.com/woocommerce-extensions-plugins-themes/woocommerce-tiered-pricing/',
1711
+ 'function' => 'ign_tiered_init'
1712
+ );
1713
+ $modules[] = array(
1714
+ 'name' => 'wc_books',
1715
+ 'title' => __( 'WooCommerce BookStore', 'woocommerce-exporter' ),
1716
+ 'description' => __( 'Convert your WooCommerce store to online book store. Sell books using WooCommerce.', 'woocommerce-exporter' ),
1717
+ 'url' => 'http://www.wpini.com/woocommerce-bookstore-plugin/',
1718
+ 'function' => 'woo_bookstore_init'
1719
+ );
1720
+ $modules[] = array(
1721
+ 'name' => 'wc_point_of_sales',
1722
+ 'title' => __( 'WooCommerce Point of Sale', 'woocommerce-exporter' ),
1723
+ 'description' => __( 'Extend your online WooCommerce store by adding a brick and mortar Point of Sale (POS) interface.', 'woocommerce-exporter' ),
1724
+ 'url' => 'https://codecanyon.net/item/woocommerce-point-of-sale-pos/7869665',
1725
+ 'function' => 'WC_POS'
1726
+ );
1727
+ $modules[] = array(
1728
+ 'name' => 'wc_pdf_product_vouchers',
1729
+ 'title' => __( 'WooCommerce PDF Product Vouchers', 'woocommerce-exporter' ),
1730
+ 'description' => __( 'Customize and sell PDF product vouchers with WooCommerce.', 'woocommerce-exporter' ),
1731
+ 'url' => 'http://www.woothemes.com/products/pdf-product-vouchers/',
1732
+ 'function' => 'init_woocommerce_pdf_product_vouchers'
1733
+ );
1734
+ $modules[] = array(
1735
+ 'name' => 'wpml',
1736
+ 'title' => __( 'WPML Multilingual CMS', 'woocommerce-exporter' ),
1737
+ 'description' => __( 'WPML Multilingual CMS.', 'woocommerce-exporter' ),
1738
+ 'url' => 'https://wpml.org/',
1739
+ 'function' => 'icl_sitepress_activate'
1740
+ );
1741
+ $modules[] = array(
1742
+ 'name' => 'wpml_wc',
1743
+ 'title' => __( 'WooCommerce Multilingual', 'woocommerce-exporter' ),
1744
+ 'description' => __( 'Allows running fully multilingual e-Commerce sites with WooCommerce and WPML.', 'woocommerce-exporter' ),
1745
+ 'url' => 'https://wordpress.org/plugins/woocommerce-multilingual/',
1746
+ 'slug' => 'woocommerce-multilingual',
1747
+ 'function' => 'wpml_wcml_startup'
1748
+ );
1749
+ $modules[] = array(
1750
+ 'name' => 'wootabs',
1751
+ 'title' => __( 'WooTabs', 'woocommerce-exporter' ),
1752
+ 'description' => __( 'WooTabs allows you to add extra tabs (as many as you want) to the WooCommerce Product Details page.', 'woocommerce-exporter' ),
1753
+ 'url' => 'https://codecanyon.net/item/wootabsadd-extra-tabs-to-woocommerce-product-page/7891253',
1754
+ 'function' => 'on_woocommerce_wootabs_loaded'
1755
+ );
1756
+ $modules[] = array(
1757
+ 'name' => 'wc_ean',
1758
+ 'title' => __( 'WooCommerce EAN Payment Gateway', 'woocommerce-exporter' ),
1759
+ 'description' => __( 'This plugin adds an EAN13 Payment Gateway for WooCommerce.', 'woocommerce-exporter' ),
1760
+ 'url' => 'http://plugins.yanco.dk/woocommerce-ean-payment-gateway',
1761
+ 'function' => 'WOOCMMERCE_EAN_PAYMENT_GATEWAY'
1762
+ );
1763
+ $modules[] = array(
1764
+ 'name' => 'wc_germanized',
1765
+ 'title' => __( 'WooCommerce Germanized', 'woocommerce-exporter' ),
1766
+ 'description' => __( 'Extends WooCommerce to become a legally compliant store for the German market.', 'woocommerce-exporter' ),
1767
+ 'url' => 'https://www.vendidero.de/woocommerce-germanized',
1768
+ 'function' => 'WC_germanized'
1769
+ );
1770
+ $modules[] = array(
1771
+ 'name' => 'wc_germanized_pro',
1772
+ 'title' => __( 'WooCommerce Germanized Pro', 'woocommerce-exporter' ),
1773
+ 'description' => __( 'Extends WooCommerce Germanized with professional features such as PDF invoices, legal text generators and many more.', 'woocommerce-exporter' ),
1774
+ 'url' => 'https://www.vendidero.de/woocommerce-germanized',
1775
+ 'function' => 'WC_germanized_pro'
1776
+ );
1777
+ $modules[] = array(
1778
+ 'name' => 'wc_umcs',
1779
+ 'title' => __( 'WooCommerce Ultimate Multi Currency Suite', 'woocommerce-exporter' ),
1780
+ 'description' => __( 'Multi currency e-commerce plugin for WordPress-WooCommerce systems.', 'woocommerce-exporter' ),
1781
+ 'url' => 'https://codecanyon.net/item/woocommerce-ultimate-multi-currency-suite/11997014',
1782
+ 'class' => 'WooCommerce_Ultimate_Multi_Currency_Suite_Main'
1783
+ );
1784
+ $modules[] = array(
1785
+ 'name' => 'wc_entrada',
1786
+ 'title' => __( 'Entrada', 'woocommerce-exporter' ),
1787
+ 'description' => __( 'Declares a plugin that will create custom taxonomy to WooCommerce Products.', 'woocommerce-exporter' ),
1788
+ 'url' => 'https://themeforest.net/item/tour-booking-adventure-tour-wordpress-theme-entrada/16867379',
1789
+ 'function' => 'entrada_create_product_taxnomy'
1790
+ );
1791
+ $modules[] = array(
1792
+ 'name' => 'wc_deliveryslots',
1793
+ 'title' => __( 'WooCommerce Delivery Slots', 'woocommerce-exporter' ),
1794
+ 'description' => __( 'Allow your customers to select a delivery slot for their order.', 'woocommerce-exporter' ),
1795
+ 'url' => 'https://iconicwp.com/products/woocommerce-delivery-slots/',
1796
+ 'class' => 'jckWooDeliverySlots'
1797
+ );
1798
+ $modules[] = array(
1799
+ 'name' => 'wc_products_purchase_price',
1800
+ 'title' => __( 'Products Purchase Price for WooCommerce', 'woocommerce-exporter' ),
1801
+ 'description' => __( 'Plug-in for WooCommerce that allows you to insert the cost (or purchase price) of your products!', 'woocommerce-exporter' ),
1802
+ 'url' => 'https://wordpress.org/plugins/products-purchase-price-for-woocommerce/',
1803
+ 'slug' => 'products-purchase-price-for-woocommerce',
1804
+ 'function' => 'product_purchase_price_admin_scripts'
1805
+ );
1806
+ $modules[] = array(
1807
+ 'name' => 'wc_product_custom_options',
1808
+ 'title' => __( 'WooCommerce Product Custom Options Lite', 'woocommerce-exporter' ),
1809
+ 'description' => __( 'Give your Ecommerce website the space to add customized options for your products.', 'woocommerce-exporter' ),
1810
+ 'url' => 'https://wordpress.org/plugins/woocommerce-custom-options-lite/',
1811
+ 'slug' => 'woocommerce-custom-options-lite',
1812
+ 'class' => 'Product_Custom_Options'
1813
+ );
1814
+ $modules[] = array(
1815
+ 'name' => 'wc_wholesale_prices',
1816
+ 'title' => __( 'WooCommerce Wholesale Prices', 'woocommerce-exporter' ),
1817
+ 'description' => __( 'WooCommerce Extension to provide Wholesale Prices functionality.', 'woocommerce-exporter' ),
1818
+ 'url' => 'https://wordpress.org/plugins/woocommerce-wholesale-prices/',
1819
+ 'slug' => 'woocommerce-wholesale-prices',
1820
+ 'function' => 'wwp_global_plugin_deactivate'
1821
+ );
1822
+ $modules[] = array(
1823
+ 'name' => 'wc_show_single_variations',
1824
+ 'title' => __( 'WooCommerce Show Single Variations', 'woocommerce-exporter' ),
1825
+ 'description' => __( 'Show product variations in the main product loops.', 'woocommerce-exporter' ),
1826
+ 'url' => 'https://codecanyon.net/item/woocommerce-show-single-variations/13523915',
1827
+ 'class' => 'JCK_WSSV'
1828
+ );
1829
+ $modules[] = array(
1830
+ 'name' => 'wc_deposits',
1831
+ 'title' => __( 'WooCommerce Deposits', 'woocommerce-exporter' ),
1832
+ 'description' => __( 'Adds deposits support to WooCommerce.', 'woocommerce-exporter' ),
1833
+ 'url' => 'https://woocommerce.com/products/woocommerce-deposits/',
1834
+ 'class' => 'WC_Deposits'
1835
+ );
1836
+ $modules[] = array(
1837
+ 'name' => 'wc_unitofmeasure',
1838
+ 'title' => __( 'WooCommerce Unit of Measure', 'woocommerce-exporter' ),
1839
+ 'description' => __( 'WooCommerce Unit Of Measure allows the user to add a unit of measure after the price on WooCommerce products.', 'woocommerce-exporter' ),
1840
+ 'url' => 'https://wordpress.org/plugins/woocommerce-unit-of-measure/',
1841
+ 'slug' => 'woocommerce-unit-of-measure',
1842
+ 'class' => 'Woo_UOM'
1843
+ );
1844
+ $modules[] = array(
1845
+ 'name' => 'wc_easybooking',
1846
+ 'title' => __( 'WooCommerce Easy Bookings', 'woocommerce-exporter' ),
1847
+ 'description' => __( 'Easily rent or book your products with WooCommerce.', 'woocommerce-exporter' ),
1848
+ 'url' => 'https://wordpress.org/plugins/woocommerce-easy-booking-system/',
1849
+ 'slug' => 'woocommerce-easy-booking-system',
1850
+ 'class' => 'Easy_booking'
1851
+ );
1852
+ $modules[] = array(
1853
+ 'name' => 'wc_advanced_quantities',
1854
+ 'title' => __( 'WooCommerce Advanced Product Quantities', 'woocommerce-exporter' ),
1855
+ 'description' => __( 'Easily require your customers to buy a minimum/maximum/incremental amount of products to continue with their Checkout.', 'woocommerce-exporter' ),
1856
+ 'url' => 'http://www.wpbackoffice.com/plugins/woocommerce-incremental-product-quantities/',
1857
+ 'function' => 'IPQ'
1858
+ );
1859
+
1860
+ // Ship to Multiple Addresses - WC_Ship_Multiple
1861
+
1862
+ /*
1863
+ $modules[] = array(
1864
+ 'name' => '',
1865
+ 'title' => __( '', 'woocommerce-exporter' ),
1866
+ 'description' => __( '', 'woocommerce-exporter' ),
1867
+ 'url' => '',
1868
+ 'slug' => '', // Define this if the Plugin is hosted on the WordPress repo
1869
+ 'function' => '' // Define this for function detection, if Class rename attribute to class
1870
+ );
1871
+ */
1872
+
1873
+ $modules = apply_filters( 'woo_ce_modules_addons', $modules );
1874
+
1875
+ // Check if the existing Transient exists
1876
+ $modules_all = count( $modules );
1877
+ $cached = get_transient( WOO_CE_PREFIX . '_modules_all_count' );
1878
+ if( $cached == false ) {
1879
+ set_transient( WOO_CE_PREFIX . '_modules_all_count', $modules_all, DAY_IN_SECONDS );
1880
+ }
1881
+
1882
+ $modules_active = 0;
1883
+ $modules_inactive = 0;
1884
+
1885
+ if( !empty( $modules ) ) {
1886
+ $user_capability = 'install_plugins';
1887
+ foreach( $modules as $key => $module ) {
1888
+ $modules[$key]['status'] = 'inactive';
1889
+ // Check if each module is activated
1890
+ if( isset( $module['function'] ) ) {
1891
+ if( is_array( $module['function'] ) ) {
1892
+ $size = count( $module['function'] );
1893
+ for( $i = 0; $i < $size; $i++ ) {
1894
+ if( function_exists( $module['function'][$i] ) ) {
1895
+ $modules[$key]['status'] = 'active';
1896
+ $modules_active++;
1897
+ break;
1898
+ }
1899
+ }
1900
+ } else {
1901
+ if( function_exists( $module['function'] ) ) {
1902
+ $modules[$key]['status'] = 'active';
1903
+ $modules_active++;
1904
+ }
1905
+ }
1906
+ } else if( isset( $module['class'] ) ) {
1907
+ if( is_array( $module['class'] ) ) {
1908
+ $size = count( $module['class'] );
1909
+ for( $i = 0; $i < $size; $i++ ) {
1910
+ if( class_exists( $module['class'][$i] ) ) {
1911
+ $modules[$key]['status'] = 'active';
1912
+ $modules_active++;
1913
+ break;
1914
+ }
1915
+ }
1916
+ } else {
1917
+ if( class_exists( $module['class'] ) ) {
1918
+ $modules[$key]['status'] = 'active';
1919
+ $modules_active++;
1920
+ }
1921
+ }
1922
+ }
1923
+ // Filter Modules by Module Status
1924
+ if( !empty( $module_status ) ) {
1925
+ switch( $module_status ) {
1926
+
1927
+ case 'active':
1928
+ if( $modules[$key]['status'] == 'inactive' )
1929
+ unset( $modules[$key] );
1930
+ break;
1931
+
1932
+ case 'inactive':
1933
+ if( $modules[$key]['status'] == 'active' )
1934
+ unset( $modules[$key] );
1935
+ break;
1936
+
1937
+ }
1938
+ }
1939
+ // Check that we've got these resources available
1940
+ if( isset( $modules[$key] ) && function_exists( 'current_user_can' ) && did_action( 'init' ) ) {
1941
+ // Check if the Plugin has a slug and if User can install Plugins
1942
+ if( current_user_can( $user_capability ) && isset( $module['slug'] ) )
1943
+ $modules[$key]['url'] = admin_url( sprintf( 'plugin-install.php?tab=search&type=term&s=%s', $module['slug'] ) );
1944
+ }
1945
+ }
1946
+ }
1947
+
1948
+ // Check if the existing Transient exists
1949
+ $cached = get_transient( WOO_CE_PREFIX . '_modules_active_count' );
1950
+ if( $cached == false ) {
1951
+ set_transient( WOO_CE_PREFIX . '_modules_active_count', $modules_active, DAY_IN_SECONDS );
1952
+ }
1953
+
1954
+ // Check if the existing Transient exists
1955
+ $cached = get_transient( WOO_CE_PREFIX . '_modules_inactive_count' );
1956
+ if( $cached == false ) {
1957
+ $modules_inactive = $modules_all - $modules_active;
1958
+ set_transient( WOO_CE_PREFIX . '_modules_inactive_count', $modules_inactive, DAY_IN_SECONDS );
1959
+ }
1960
+
1961
+ return $modules;
1962
+
1963
+ }
1964
+
1965
+ // Returns whether a supported export Plugin is activated
1966
+ function woo_ce_detect_export_plugin( $plugin_name = '' ) {
1967
+
1968
+ if( empty( $plugin_name ) )
1969
+ return;
1970
+
1971
+ // Check if a cached list of active modules is available
1972
+ if ( false === ( $active_modules = get_transient( WOO_CE_PREFIX . '_modules_active' ) ) ) {
1973
+ $active_modules = woo_ce_refresh_active_export_plugins();
1974
+ }
1975
+
1976
+ // Check if the requested Plugin is in the list of active export Plugins
1977
+ if( !empty( $active_modules ) ) {
1978
+ if( in_array( $plugin_name, $active_modules ) )
1979
+ return true;
1980
+ }
1981
+
1982
+ }
1983
+
1984
+ function woo_ce_refresh_active_export_plugins() {
1985
+
1986
+ // Delete the existing count Transients
1987
+ delete_transient( WOO_CE_PREFIX . '_modules_all_count' );
1988
+ delete_transient( WOO_CE_PREFIX . '_modules_active_count' );
1989
+ delete_transient( WOO_CE_PREFIX . '_modules_inactive_count' );
1990
+
1991
+ // Refresh the count Transients
1992
+ $modules = woo_ce_modules_list( 'active' );
1993
+
1994
+ // Create a list of active export Plugins
1995
+ $active_modules = false;
1996
+ if( !empty( $modules ) ) {
1997
+ $active_modules = array();
1998
+ foreach( $modules as $module )
1999
+ $active_modules[] = $module['name'];
2000
+ }
2001
+ unset( $modules );
2002
+
2003
+ // Save the list of active export Plugins
2004
+ set_transient( WOO_CE_PREFIX . '_modules_active', $active_modules, DAY_IN_SECONDS );
2005
+
2006
+ return $active_modules;
2007
+
2008
+ }
2009
+ function woo_ce_error_log( $message = '', $level = false ) {
2010
+
2011
+ if( $message == '' )
2012
+ return;
2013
+
2014
+ if( class_exists( 'WC_Logger' ) && apply_filters( 'woo_ce_error_log_use_wc_logger', true ) ) {
2015
+ $logger = new WC_Logger();
2016
+ if( version_compare( woo_get_woo_version(), '2.7', '>=' ) ) {
2017
+ $notice_level = ( !empty( $level ) ? $level : apply_filters( 'woo_ce_error_log_default_level', WC_Log_Levels::NOTICE ) );
2018
+ // Format notice levels to match WC_Log_Levels
2019
+ switch( $notice_level ) {
2020
+
2021
+ // System is unusable.
2022
+ case 'emergency':
2023
+ $notice_level = WC_Log_Levels::EMERGENCY;
2024
+ break;
2025
+
2026
+ // Action must be taken immediately. Example: Entire website down, database unavailable, etc.
2027
+ case 'alert':
2028
+ $notice_level = WC_Log_Levels::ALERT;
2029
+ break;
2030
+
2031
+ // Critical conditions. Example: Application component unavailable, unexpected exception.
2032
+ case 'critical':
2033
+ $notice_level = WC_Log_Levels::CRITICAL;
2034
+ break;
2035
+
2036
+ // Runtime errors that do not require immediate action but should typically be logged and monitored.
2037
+ case 'error':
2038
+ $notice_level = WC_Log_Levels::ERROR;
2039
+ break;
2040
+
2041
+ // Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
2042
+ case 'warning':
2043
+ $notice_level = WC_Log_Levels::WARNING;
2044
+ break;
2045
+
2046
+ // Normal but significant events.
2047
+ case 'notice':
2048
+ $notice_level = WC_Log_Levels::NOTICE;
2049
+ break;
2050
+
2051
+ // Interesting events.
2052
+ case 'info':
2053
+ $notice_level = WC_Log_Levels::INFO;
2054
+ break;
2055
+
2056
+ // Detailed debug information.
2057
+ case 'debug':
2058
+ $notice_level = WC_Log_Levels::DEBUG;
2059
+ break;
2060
+
2061
+ }
2062
+ $logger->log( $notice_level, $message, array( 'source' => WOO_CE_PREFIX ) );
2063
+ } else {
2064
+ $logger->add( WOO_CE_PREFIX, $message );
2065
+ }
2066
+ return true;
2067
+ } else {
2068
+ // Fallback where the WooCommerce logging engine is unavailable
2069
+ error_log( sprintf( '[store-exporter] %s', $message ) );
2070
+ }
2071
+
2072
+ }
2073
+
2074
+ function woo_ce_error_get_last_message() {
2075
+
2076
+ $output = '-';
2077
+ if( function_exists( 'error_get_last' ) ) {
2078
+ $last_error = error_get_last();
2079
+ if( isset( $last_error ) && isset( $last_error['message'] ) ) {
2080
+ $output = $last_error['message'];
2081
+ }
2082
+ unset( $last_error );
2083
+ }
2084
+ return $output;
2085
+
2086
+ }
2087
+
2088
  function woo_ce_get_option( $option = null, $default = false, $allow_empty = false ) {
2089
 
2090
+ $output = false;
2091
+ if( $option !== null ) {
2092
  $separator = '_';
2093
  $output = get_option( WOO_CE_PREFIX . $separator . $option, $default );
2094
  if( $allow_empty == false && $output != 0 && ( $output == false || $output == '' ) )
2101
  function woo_ce_update_option( $option = null, $value = null ) {
2102
 
2103
  $output = false;
2104
+ if( $option !== null && $value !== null ) {
2105
  $separator = '_';
2106
  $output = update_option( WOO_CE_PREFIX . $separator . $option, $value );
2107
  }
includes/install.php CHANGED
@@ -20,10 +20,11 @@ function woo_ce_install() {
20
  function woo_ce_create_options() {
21
 
22
  $prefix = 'woo_ce';
 
23
  if( !get_option( $prefix . '_export_filename' ) )
24
- add_option( $prefix . '_export_filename', 'export_%dataset%-%date%-%time%.csv' );
25
  if( !get_option( $prefix . '_delete_file' ) )
26
- add_option( $prefix . '_delete_file', 0 );
27
  if( !get_option( $prefix . '_delimiter' ) )
28
  add_option( $prefix . '_delimiter', ',' );
29
  if( !get_option( $prefix . '_category_separator' ) )
@@ -35,7 +36,7 @@ function woo_ce_create_options() {
35
  if( !get_option( $prefix . '_escape_formatting' ) )
36
  add_option( $prefix . '_escape_formatting', 'all' );
37
  if( !get_option( $prefix . '_date_format' ) )
38
- add_option( $prefix . '_date_format', 1 );
39
 
40
  }
41
  ?>
20
  function woo_ce_create_options() {
21
 
22
  $prefix = 'woo_ce';
23
+
24
  if( !get_option( $prefix . '_export_filename' ) )
25
+ add_option( $prefix . '_export_filename', 'export_%dataset%-%date%-%time%-%random%.csv' );
26
  if( !get_option( $prefix . '_delete_file' ) )
27
+ add_option( $prefix . '_delete_file', 1 );
28
  if( !get_option( $prefix . '_delimiter' ) )
29
  add_option( $prefix . '_delimiter', ',' );
30
  if( !get_option( $prefix . '_category_separator' ) )
36
  if( !get_option( $prefix . '_escape_formatting' ) )
37
  add_option( $prefix . '_escape_formatting', 'all' );
38
  if( !get_option( $prefix . '_date_format' ) )
39
+ add_option( $prefix . '_date_format', 'd/m/Y' );
40
 
41
  }
42
  ?>
includes/order-extend.php ADDED
@@ -0,0 +1,1360 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Adds custom Order columns to the Order fields list
3
+ function woo_ce_extend_order_fields( $fields = array() ) {
4
+
5
+ // Product Add-ons - http://www.woothemes.com/
6
+ if( class_exists( 'Product_Addon_Admin' ) || class_exists( 'Product_Addon_Display' ) ) {
7
+ $product_addons = woo_ce_get_product_addons();
8
+ if( !empty( $product_addons ) ) {
9
+ foreach( $product_addons as $product_addon ) {
10
+ if( !empty( $product_addon ) ) {
11
+ $fields[] = array(
12
+ 'name' => sprintf( 'order_items_product_addon_%s', $product_addon->post_name ),
13
+ 'label' => sprintf( __( 'Order Items: %s', 'woocommerce-exporter' ), ucfirst( $product_addon->post_title ) ),
14
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_order_fields_product_addons', '%s: %s' ), __( 'Product Add-ons', 'woocommerce-exporter' ), $product_addon->form_title )
15
+ );
16
+ }
17
+ }
18
+ }
19
+ unset( $product_addons, $product_addon );
20
+ }
21
+
22
+ // WooCommerce Sequential Order Numbers - http://www.skyverge.com/blog/woocommerce-sequential-order-numbers/
23
+ // Sequential Order Numbers Pro - http://www.woothemes.com/products/sequential-order-numbers-pro/
24
+ if( class_exists( 'WC_Seq_Order_Number' ) || class_exists( 'WC_Seq_Order_Number_Pro' ) ) {
25
+ $fields[] = array(
26
+ 'name' => 'order_number',
27
+ 'label' => __( 'Order Number', 'woocommerce-exporter' )
28
+ );
29
+ }
30
+
31
+ // WooCommerce Print Invoice & Delivery Note - https://wordpress.org/plugins/woocommerce-delivery-notes/
32
+ if( woo_ce_detect_export_plugin( 'print_invoice_delivery_note' ) ) {
33
+ $fields[] = array(
34
+ 'name' => 'invoice_number',
35
+ 'label' => __( 'Invoice Number', 'woocommerce-exporter' ),
36
+ 'hover' => __( 'WooCommerce Print Invoice & Delivery Note', 'woocommerce-exporter' )
37
+ );
38
+ $fields[] = array(
39
+ 'name' => 'invoice_date',
40
+ 'label' => __( 'Invoice Date', 'woocommerce-exporter' ),
41
+ 'hover' => __( 'WooCommerce Print Invoice & Delivery Note', 'woocommerce-exporter' )
42
+ );
43
+ }
44
+
45
+ // WooCommerce PDF Invoices & Packing Slips - http://www.wpovernight.com
46
+ if( woo_ce_detect_export_plugin( 'pdf_invoices_packing_slips' ) ) {
47
+ $fields[] = array(
48
+ 'name' => 'pdf_invoice_number',
49
+ 'label' => __( 'PDF Invoice Number', 'woocommerce-exporter' ),
50
+ 'hover' => __( 'WooCommerce PDF Invoices & Packing Slips', 'woocommerce-exporter' )
51
+ );
52
+ $fields[] = array(
53
+ 'name' => 'pdf_invoice_date',
54
+ 'label' => __( 'PDF Invoice Date', 'woocommerce-exporter' ),
55
+ 'hover' => __( 'WooCommerce PDF Invoices & Packing Slips', 'woocommerce-exporter' )
56
+ );
57
+ }
58
+
59
+ // WooCommerce Germanized - http://www.wpovernight.com
60
+ if( woo_ce_detect_export_plugin( 'wc_germanized_pro' ) ) {
61
+ $fields[] = array(
62
+ 'name' => 'invoice_number',
63
+ 'label' => __( 'Invoice Number', 'woocommerce-exporter' ),
64
+ 'hover' => __( 'WooCommerce Germanized', 'woocommerce-exporter' )
65
+ );
66
+ $fields[] = array(
67
+ 'name' => 'invoice_number_formatted',
68
+ 'label' => __( 'Invoice Number (Formatted)', 'woocommerce-exporter' ),
69
+ 'hover' => __( 'WooCommerce Germanized', 'woocommerce-exporter' )
70
+ );
71
+ $fields[] = array(
72
+ 'name' => 'invoice_status',
73
+ 'label' => __( 'Invoice Status', 'woocommerce-exporter' ),
74
+ 'hover' => __( 'WooCommerce Germanized', 'woocommerce-exporter' )
75
+ );
76
+ }
77
+
78
+ // WooCommerce Hear About Us - https://wordpress.org/plugins/woocommerce-hear-about-us/
79
+ if( woo_ce_detect_export_plugin( 'hear_about_us' ) ) {
80
+ $fields[] = array(
81
+ 'name' => 'hear_about_us',
82
+ 'label' => __( 'Source', 'woocommerce-exporter' ),
83
+ 'hover' => __( 'WooCommerce Hear About Us', 'woocommerce-exporter' )
84
+ );
85
+ }
86
+
87
+ // Order Delivery Date for WooCommerce - https://wordpress.org/plugins/order-delivery-date-for-woocommerce/
88
+ // Order Delivery Date Pro for WooCommerce - https://www.tychesoftwares.com/store/premium-plugins/order-delivery-date-for-woocommerce-pro-21/
89
+ if( woo_ce_detect_export_plugin( 'orddd_free' ) || woo_ce_detect_export_plugin( 'orddd' ) ) {
90
+ $fields[] = array(
91
+ 'name' => 'delivery_date',
92
+ 'label' => __( 'Delivery Date', 'woocommerce-exporter' ),
93
+ 'hover' => ( woo_ce_detect_export_plugin( 'orddd' ) ? __( 'Order Delivery Date Pro for WooCommerce', 'woocommerce-exporter' ) : __( 'Order Delivery Date for WooCommerce', 'woocommerce-exporter' ) )
94
+ );
95
+ }
96
+
97
+ // WooCommerce Memberships - http://www.woothemes.com/products/woocommerce-memberships/
98
+ if( woo_ce_detect_export_plugin( 'wc_memberships' ) ) {
99
+ $fields[] = array(
100
+ 'name' => 'active_memberships',
101
+ 'label' => __( 'Active Memberships', 'woocommerce-exporter' ),
102
+ 'hover' => __( 'WooCommerce Memberships', 'woocommerce-exporter' )
103
+ );
104
+ }
105
+
106
+ // WooCommerce Uploads - https://wpfortune.com/shop/plugins/woocommerce-uploads/
107
+ if( woo_ce_detect_export_plugin( 'wc_uploads' ) ) {
108
+ $fields[] = array(
109
+ 'name' => 'uploaded_files',
110
+ 'label' => __( 'Uploaded Files', 'woocommerce-exporter' ),
111
+ 'hover' => __( 'WooCommerce Uploads', 'woocommerce-exporter' )
112
+ );
113
+ $fields[] = array(
114
+ 'name' => 'uploaded_files_thumbnail',
115
+ 'label' => __( 'Uploaded Files (Thumbnail)', 'woocommerce-exporter' ),
116
+ 'hover' => __( 'WooCommerce Uploads', 'woocommerce-exporter' )
117
+ );
118
+ }
119
+
120
+ // WPML - https://wpml.org/
121
+ // WooCommerce Multilingual - https://wordpress.org/plugins/woocommerce-multilingual/
122
+ if( woo_ce_detect_wpml() && woo_ce_detect_export_plugin( 'wpml_wc' ) ) {
123
+ $fields[] = array(
124
+ 'name' => 'language',
125
+ 'label' => __( 'Language', 'woocommerce-exporter' ),
126
+ 'hover' => __( 'WooCommerce Multilingual', 'woocommerce-exporter' )
127
+ );
128
+ }
129
+
130
+ // WooCommerce EAN Payment Gateway - http://plugins.yanco.dk/woocommerce-ean-payment-gateway
131
+ if( woo_ce_detect_export_plugin( 'wc_ean' ) ) {
132
+ $fields[] = array(
133
+ 'name' => 'ean_number',
134
+ 'label' => __( 'EAN Number', 'woocommerce-exporter' ),
135
+ 'hover' => __( 'WooCommerce EAN Payment Gateway', 'woocommerce-exporter' )
136
+ );
137
+ }
138
+
139
+ // WooCommerce Checkout Manager - http://wordpress.org/plugins/woocommerce-checkout-manager/
140
+ // WooCommerce Checkout Manager Pro - http://wordpress.org/plugins/woocommerce-checkout-manager/
141
+ if( woo_ce_detect_export_plugin( 'checkout_manager' ) ) {
142
+
143
+ // Checkout Manager stores its settings in mulitple suffixed wccs_settings WordPress Options
144
+
145
+ // Load generic settings
146
+ $options = get_option( 'wccs_settings' );
147
+ if( isset( $options['buttons'] ) ) {
148
+ $buttons = $options['buttons'];
149
+ if( !empty( $buttons ) ) {
150
+ $header = ( $buttons[0]['type'] == 'heading' ? $buttons[0]['label'] : __( 'Additional', 'woocommerce-exporter' ) );
151
+ foreach( $buttons as $button ) {
152
+ // Skip headings
153
+ if( $button['type'] == 'heading' )
154
+ continue;
155
+ $label = ( !empty( $button['label'] ) ? $button['label'] : $button['cow'] );
156
+ $fields[] = array(
157
+ 'name' => sprintf( 'additional_%s', $button['cow'] ),
158
+ 'label' => ( !empty( $header ) ? sprintf( apply_filters( 'woo_ce_extend_order_fields_wccs', '%s: %s' ), ucfirst( $header ), ucfirst( $label ) ) : ucfirst( $label ) ),
159
+ 'hover' => __( 'WooCommerce Checkout Manager', 'woocommerce-exporter' )
160
+ );
161
+ }
162
+ unset( $buttons, $button, $header, $label );
163
+ }
164
+ }
165
+ unset( $options );
166
+
167
+ // Load Shipping settings
168
+ $options = get_option( 'wccs_settings2' );
169
+ if( isset( $options['shipping_buttons'] ) ) {
170
+ $buttons = $options['shipping_buttons'];
171
+ if( !empty( $buttons ) ) {
172
+ $header = ( $buttons[0]['type'] == 'heading' ? $buttons[0]['label'] : __( 'Shipping', 'woocommerce-exporter' ) );
173
+ foreach( $buttons as $button ) {
174
+ // Skip headings
175
+ if( $button['type'] == 'heading' )
176
+ continue;
177
+ $wccs_field_duplicate = false;
178
+ // Check if this isn't a duplicate Checkout Manager Pro field
179
+ foreach( $fields as $field ) {
180
+ if( isset( $field['name'] ) && $field['name'] == sprintf( 'shipping_%s', $button['cow'] ) ) {
181
+ // Duplicate exists
182
+ $wccs_field_duplicate = true;
183
+ break;
184
+ }
185
+ }
186
+ // If it's not a duplicate go ahead and add it to the list
187
+ if( $wccs_field_duplicate !== true ) {
188
+ $label = ( !empty( $button['label'] ) ? $button['label'] : $button['cow'] );
189
+ $fields[] = array(
190
+ 'name' => sprintf( 'shipping_%s', $button['cow'] ),
191
+ 'label' => ( !empty( $header ) ? sprintf( apply_filters( 'woo_ce_extend_order_fields_wccs', '%s: %s' ), ucfirst( $header ), ucfirst( $label ) ) : ucfirst( $label ) ),
192
+ 'hover' => __( 'WooCommerce Checkout Manager', 'woocommerce-exporter' )
193
+ );
194
+ }
195
+ unset( $wccs_field_duplicate );
196
+ }
197
+ unset( $buttons, $button, $header, $label );
198
+ }
199
+ }
200
+ unset( $options );
201
+
202
+ // Load Billing settings
203
+ $options = get_option( 'wccs_settings3' );
204
+ if( isset( $options['billing_buttons'] ) ) {
205
+ $buttons = $options['billing_buttons'];
206
+ if( !empty( $buttons ) ) {
207
+ $header = ( $buttons[0]['type'] == 'heading' ? $buttons[0]['label'] : __( 'Billing', 'woocommerce-exporter' ) );
208
+ foreach( $buttons as $button ) {
209
+ // Skip headings
210
+ if( $button['type'] == 'heading' )
211
+ continue;
212
+ $wccs_field_duplicate = false;
213
+ // Check if this isn't a duplicate Checkout Manager Pro field
214
+ foreach( $fields as $field ) {
215
+ if( isset( $field['name'] ) && $field['name'] == sprintf( 'billing_%s', $button['cow'] ) ) {
216
+ // Duplicate exists
217
+ $wccs_field_duplicate = true;
218
+ break;
219
+ }
220
+ }
221
+ // If it's not a duplicate go ahead and add it to the list
222
+ if( $wccs_field_duplicate !== true ) {
223
+ $label = ( !empty( $button['label'] ) ? $button['label'] : $button['cow'] );
224
+ $fields[] = array(
225
+ 'name' => sprintf( 'billing_%s', $button['cow'] ),
226
+ 'label' => ( !empty( $header ) ? sprintf( apply_filters( 'woo_ce_extend_order_fields_wccs', '%s: %s' ), ucfirst( $header ), ucfirst( $label ) ) : ucfirst( $label ) ),
227
+ 'hover' => __( 'WooCommerce Checkout Manager', 'woocommerce-exporter' )
228
+ );
229
+ }
230
+ unset( $wccs_field_duplicate );
231
+ }
232
+ unset( $buttons, $button, $header, $label );
233
+ }
234
+ }
235
+ unset( $options );
236
+
237
+ }
238
+
239
+ // Poor Guys Swiss Knife - http://wordpress.org/plugins/woocommerce-poor-guys-swiss-knife/
240
+ if( woo_ce_detect_export_plugin( 'wc_pgsk' ) ) {
241
+ $options = get_option( 'wcpgsk_settings' );
242
+ $billing_fields = ( isset( $options['woofields']['billing'] ) ? $options['woofields']['billing'] : array() );
243
+ $shipping_fields = ( isset( $options['woofields']['shipping'] ) ? $options['woofields']['shipping'] : array() );
244
+
245
+ // Custom billing fields
246
+ if( !empty( $billing_fields ) ) {
247
+ foreach( $billing_fields as $key => $billing_field ) {
248
+ $fields[] = array(
249
+ 'name' => $key,
250
+ 'label' => $options['woofields'][sprintf( 'label_%s', $key )],
251
+ 'hover' => __( 'Poor Guys Swiss Knife', 'woocommerce-exporter' )
252
+ );
253
+ }
254
+ unset( $billing_fields, $billing_field );
255
+ }
256
+
257
+ // Custom shipping fields
258
+ if( !empty( $shipping_fields ) ) {
259
+ foreach( $shipping_fields as $key => $shipping_field ) {
260
+ $fields[] = array(
261
+ 'name' => $key,
262
+ 'label' => $options['woofields'][sprintf( 'label_%s', $key )],
263
+ 'hover' => __( 'Poor Guys Swiss Knife', 'woocommerce-exporter' )
264
+ );
265
+ }
266
+ unset( $shipping_fields, $shipping_field );
267
+ }
268
+
269
+ unset( $options );
270
+ }
271
+
272
+ // Checkout Field Editor - http://woothemes.com/woocommerce/
273
+ if( woo_ce_detect_export_plugin( 'checkout_field_editor' ) ) {
274
+ $billing_fields = get_option( 'wc_fields_billing', array() );
275
+ $shipping_fields = get_option( 'wc_fields_shipping', array() );
276
+ $additional_fields = get_option( 'wc_fields_additional', array() );
277
+
278
+ // Custom billing fields
279
+ if( !empty( $billing_fields ) ) {
280
+ foreach( $billing_fields as $key => $billing_field ) {
281
+ // Only add non-default Checkout fields to export columns list
282
+ if( isset( $billing_field['custom'] ) && $billing_field['custom'] == 1 ) {
283
+ $fields[] = array(
284
+ 'name' => sprintf( 'wc_billing_%s', $key ),
285
+ 'label' => sprintf( __( 'Billing: %s', 'woocommerce-exporter' ), ucfirst( $billing_field['label'] ) ),
286
+ 'hover' => __( 'Checkout Field Editor', 'woocommerce-exporter' )
287
+ );
288
+ }
289
+ }
290
+ }
291
+ unset( $billing_fields, $billing_field );
292
+
293
+ // Custom shipping fields
294
+ if( !empty( $shipping_fields ) ) {
295
+ foreach( $shipping_fields as $key => $shipping_field ) {
296
+ // Only add non-default Checkout fields to export columns list
297
+ if( isset( $shipping_field['custom'] ) && $shipping_field['custom'] == 1 ) {
298
+ $fields[] = array(
299
+ 'name' => sprintf( 'wc_shipping_%s', $key ),
300
+ 'label' => sprintf( __( 'Shipping: %s', 'woocommerce-exporter' ), ucfirst( $shipping_field['label'] ) ),
301
+ 'hover' => __( 'Checkout Field Editor', 'woocommerce-exporter' )
302
+ );
303
+ }
304
+ }
305
+ }
306
+ unset( $shipping_fields, $shipping_field );
307
+
308
+ // Additional fields
309
+ if( !empty( $additional_fields ) ) {
310
+ foreach( $additional_fields as $key => $additional_field ) {
311
+ // Only add non-default Checkout fields to export columns list
312
+ if( isset( $additional_field['custom'] ) && $additional_field['custom'] == 1 ) {
313
+ $fields[] = array(
314
+ 'name' => sprintf( 'wc_additional_%s', $key ),
315
+ 'label' => sprintf( __( 'Additional: %s', 'woocommerce-exporter' ), ucfirst( $additional_field['label'] ) ),
316
+ 'hover' => __( 'Checkout Field Editor', 'woocommerce-exporter' )
317
+ );
318
+ }
319
+ }
320
+ }
321
+ unset( $additional_fields, $additional_field );
322
+ }
323
+
324
+ // Checkout Field Manager - http://61extensions.com
325
+ if( woo_ce_detect_export_plugin( 'checkout_field_manager' ) ) {
326
+ $billing_fields = get_option( 'woocommerce_checkout_billing_fields', array() );
327
+ $shipping_fields = get_option( 'woocommerce_checkout_shipping_fields', array() );
328
+ $custom_fields = get_option( 'woocommerce_checkout_additional_fields', array() );
329
+
330
+ // Custom billing fields
331
+ if( !empty( $billing_fields ) ) {
332
+ foreach( $billing_fields as $key => $billing_field ) {
333
+ // Only add non-default Checkout fields to export columns list
334
+ if( strtolower( $billing_field['default_field'] ) != 'on' ) {
335
+ $fields[] = array(
336
+ 'name' => sprintf( 'sod_billing_%s', $billing_field['name'] ),
337
+ 'label' => sprintf( __( 'Billing: %s', 'woocommerce-exporter' ), ucfirst( $billing_field['label'] ) ),
338
+ 'hover' => __( 'Checkout Field Manager', 'woocommerce-exporter' )
339
+ );
340
+ }
341
+ }
342
+ }
343
+ unset( $billing_fields, $billing_field );
344
+
345
+ // Custom shipping fields
346
+ if( !empty( $shipping_fields ) ) {
347
+ foreach( $shipping_fields as $key => $shipping_field ) {
348
+ // Only add non-default Checkout fields to export columns list
349
+ if( strtolower( $shipping_field['default_field'] ) != 'on' ) {
350
+ $fields[] = array(
351
+ 'name' => sprintf( 'sod_shipping_%s', $shipping_field['name'] ),
352
+ 'label' => sprintf( __( 'Shipping: %s', 'woocommerce-exporter' ), ucfirst( $shipping_field['label'] ) ),
353
+ 'hover' => __( 'Checkout Field Manager', 'woocommerce-exporter' )
354
+ );
355
+ }
356
+ }
357
+ }
358
+ unset( $shipping_fields, $shipping_field );
359
+
360
+ // Custom fields
361
+ if( !empty( $custom_fields ) ) {
362
+ foreach( $custom_fields as $key => $custom_field ) {
363
+ // Only add non-default Checkout fields to export columns list
364
+ if( strtolower( $custom_field['default_field'] ) != 'on' ) {
365
+ $fields[] = array(
366
+ 'name' => sprintf( 'sod_additional_%s', $custom_field['name'] ),
367
+ 'label' => sprintf( __( 'Additional: %s', 'woocommerce-exporter' ), ucfirst( $custom_field['label'] ) ),
368
+ 'hover' => __( 'Checkout Field Manager', 'woocommerce-exporter' )
369
+ );
370
+ }
371
+ }
372
+ }
373
+ unset( $custom_fields, $custom_field );
374
+ }
375
+
376
+ // WooCommerce Extra Checkout Fields for Brazil - https://wordpress.org/plugins/woocommerce-extra-checkout-fields-for-brazil/
377
+ if( woo_ce_detect_export_plugin( 'wc_extra_checkout_fields_brazil' ) ) {
378
+ $fields[] = array(
379
+ 'name' => 'billing_cpf',
380
+ 'label' => __( 'Billing: CPF', 'woocommerce-exporter' ),
381
+ 'hover' => __( 'WooCommerce Extra Checkout Fields for Brazil', 'woocommerce-exporter' )
382
+ );
383
+ $fields[] = array(
384
+ 'name' => 'billing_rg',
385
+ 'label' => __( 'Billing: RG', 'woocommerce-exporter' ),
386
+ 'hover' => __( 'WooCommerce Extra Checkout Fields for Brazil', 'woocommerce-exporter' )
387
+ );
388
+ $fields[] = array(
389
+ 'name' => 'billing_cnpj',
390
+ 'label' => __( 'Billing: CNPJ', 'woocommerce-exporter' ),
391
+ 'hover' => __( 'WooCommerce Extra Checkout Fields for Brazil', 'woocommerce-exporter' )
392
+ );
393
+ $fields[] = array(
394
+ 'name' => 'billing_ie',
395
+ 'label' => __( 'Billing: IE', 'woocommerce-exporter' ),
396
+ 'hover' => __( 'WooCommerce Extra Checkout Fields for Brazil', 'woocommerce-exporter' )
397
+ );
398
+ $fields[] = array(
399
+ 'name' => 'billing_birthdate',
400
+ 'label' => __( 'Billing: Birth Date', 'woocommerce-exporter' ),
401
+ 'hover' => __( 'WooCommerce Extra Checkout Fields for Brazil', 'woocommerce-exporter' )
402
+ );
403
+ $fields[] = array(
404
+ 'name' => 'billing_sex',
405
+ 'label' => __( 'Billing: Sex', 'woocommerce-exporter' ),
406
+ 'hover' => __( 'WooCommerce Extra Checkout Fields for Brazil', 'woocommerce-exporter' )
407
+ );
408
+ $fields[] = array(
409
+ 'name' => 'billing_number',
410
+ 'label' => __( 'Billing: Number', 'woocommerce-exporter' ),
411
+ 'hover' => __( 'WooCommerce Extra Checkout Fields for Brazil', 'woocommerce-exporter' )
412
+ );
413
+ $fields[] = array(
414
+ 'name' => 'billing_neighborhood',
415
+ 'label' => __( 'Billing: Neighborhood', 'woocommerce-exporter' ),
416
+ 'hover' => __( 'WooCommerce Extra Checkout Fields for Brazil', 'woocommerce-exporter' )
417
+ );
418
+ $fields[] = array(
419
+ 'name' => 'billing_cellphone',
420
+ 'label' => __( 'Billing: Cell Phone', 'woocommerce-exporter' ),
421
+ 'hover' => __( 'WooCommerce Extra Checkout Fields for Brazil', 'woocommerce-exporter' )
422
+ );
423
+ $fields[] = array(
424
+ 'name' => 'shipping_number',
425
+ 'label' => __( 'Shipping: Number', 'woocommerce-exporter' ),
426
+ 'hover' => __( 'WooCommerce Extra Checkout Fields for Brazil', 'woocommerce-exporter' )
427
+ );
428
+ $fields[] = array(
429
+ 'name' => 'shipping_neighborhood',
430
+ 'label' => __( 'Shipping: Neighborhood', 'woocommerce-exporter' ),
431
+ 'hover' => __( 'WooCommerce Extra Checkout Fields for Brazil', 'woocommerce-exporter' )
432
+ );
433
+ }
434
+
435
+ // YITH WooCommerce Checkout Manager - https://yithemes.com/themes/plugins/yith-woocommerce-checkout-manager/
436
+ if( woo_ce_detect_export_plugin( 'yith_cm' ) ) {
437
+ // YITH WooCommerce Checkout Manager stores its settings in separate Options
438
+ $billing_options = get_option( 'ywccp_fields_billing_options' );
439
+ $shipping_options = get_option( 'ywccp_fields_shipping_options' );
440
+ $additional_options = get_option( 'ywccp_fields_additional_options' );
441
+
442
+ // Custom billing fields
443
+ if( !empty( $billing_options ) ) {
444
+ // Only add non-default Checkout fields to export columns list
445
+ $default_keys = ywccp_get_default_fields_key( 'billing' );
446
+ $fields_keys = array_keys( $billing_options );
447
+ $billing_fields = array_diff( $fields_keys, $default_keys );
448
+ if( !empty( $billing_fields ) ) {
449
+ foreach( $billing_fields as $billing_field ) {
450
+ // Check that the custom Billing field exists
451
+ if( isset( $billing_options[$billing_field] ) ) {
452
+ // Skip headings
453
+ if( $billing_options[$billing_field]['type'] == 'heading' )
454
+ continue;
455
+ $fields[] = array(
456
+ 'name' => sprintf( 'ywccp_%s', sanitize_key( $billing_field ) ),
457
+ 'label' => sprintf( __( 'Billing: %s', 'woocommerce-exporter' ), ( !empty( $billing_options[$billing_field]['label'] ) ? $billing_options[$billing_field]['label'] : str_replace( 'billing_', '', $billing_field ) ) ),
458
+ 'hover' => __( 'YITH WooCommerce Checkout Manager', 'woocommerce-exporter' )
459
+ );
460
+ }
461
+ }
462
+ }
463
+ unset( $fields_keys, $default_keys, $billing_fields, $billing_field );
464
+ }
465
+ unset( $billing_options );
466
+
467
+ // Custom shipping fields
468
+ if( !empty( $shipping_options ) ) {
469
+ // Only add non-default Checkout fields to export columns list
470
+ $default_keys = ywccp_get_default_fields_key( 'shipping' );
471
+ $fields_keys = array_keys( $shipping_options );
472
+ $shipping_fields = array_diff( $fields_keys, $default_keys );
473
+ if( !empty( $shipping_fields ) ) {
474
+ foreach( $shipping_fields as $shipping_field ) {
475
+ // Check that the custom Shipping field exists
476
+ if( isset( $shipping_options[$shipping_field] ) ) {
477
+ // Skip headings
478
+ if( $shipping_options[$shipping_field]['type'] == 'heading' )
479
+ continue;
480
+ $fields[] = array(
481
+ 'name' => sprintf( 'ywccp_%s', sanitize_key( $shipping_field ) ),
482
+ 'label' => sprintf( __( 'Shipping: %s', 'woocommerce-exporter' ), ( !empty( $shipping_options[$shipping_field]['label'] ) ? $shipping_options[$shipping_field]['label'] : str_replace( 'shipping_', '', $shipping_field ) ) ),
483
+ 'hover' => __( 'YITH WooCommerce Checkout Manager', 'woocommerce-exporter' )
484
+ );
485
+ }
486
+ }
487
+ }
488
+ unset( $fields_keys, $default_keys, $shipping_fields, $shipping_field );
489
+ }
490
+ unset( $shipping_options );
491
+
492
+ // Custom additional fields
493
+ if( !empty( $additional_options ) ) {
494
+ // Only add non-default Checkout fields to export columns list
495
+ $default_keys = ywccp_get_default_fields_key( 'additional' );
496
+ $fields_keys = array_keys( $additional_options );
497
+ $additional_fields = array_diff( $fields_keys, $default_keys );
498
+ if( !empty( $additional_fields ) ) {
499
+ foreach( $additional_fields as $additional_field ) {
500
+ // Check that the custom Additional field exists
501
+ if( isset( $additional_options[$additional_field] ) ) {
502
+ // Skip headings
503
+ if( $additional_options[$additional_field]['type'] == 'heading' )
504
+ continue;
505
+ $fields[] = array(
506
+ 'name' => sprintf( 'ywccp_%s', sanitize_key( $additional_field ) ),
507
+ 'label' => sprintf( __( 'Additional: %s', 'woocommerce-exporter' ), ( !empty( $additional_options[$additional_field]['label'] ) ? $additional_options[$additional_field]['label'] : str_replace( 'additional_', '', $additional_field ) ) ),
508
+ 'hover' => __( 'YITH WooCommerce Checkout Manager', 'woocommerce-exporter' )
509
+ );
510
+ }
511
+ }
512
+ }
513
+ unset( $fields_keys, $default_keys, $additional_fields, $additional_field );
514
+ }
515
+ unset( $additional_options );
516
+
517
+ }
518
+
519
+ // WooCommerce Subscriptions - http://www.woothemes.com/products/woocommerce-subscriptions/
520
+ if( woo_ce_detect_export_plugin( 'subscriptions' ) ) {
521
+ $fields[] = array(
522
+ 'name' => 'order_type',
523
+ 'label' => __( 'Subscription Relationship', 'woocommerce-exporter' ),
524
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' )
525
+ );
526
+ $fields[] = array(
527
+ 'name' => 'subscription_renewal',
528
+ 'label' => __( 'Subscription Renewal', 'woocommerce-exporter' ),
529
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' )
530
+ );
531
+ $fields[] = array(
532
+ 'name' => 'subscription_resubscribe',
533
+ 'label' => __( 'Subscription Resubscribe', 'woocommerce-exporter' ),
534
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' )
535
+ );
536
+ $fields[] = array(
537
+ 'name' => 'subscription_switch',
538
+ 'label' => __( 'Subscription Switch', 'woocommerce-exporter' ),
539
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' )
540
+ );
541
+ }
542
+
543
+ // WooCommerce Quick Donation - http://wordpress.org/plugins/woocommerce-quick-donation/
544
+ if( woo_ce_detect_export_plugin( 'wc_quickdonation' ) ) {
545
+ $fields[] = array(
546
+ 'name' => 'project_id',
547
+ 'label' => __( 'Project ID', 'woocommerce-exporter' ),
548
+ 'hover' => __( 'WooCommerce Quick Donation', 'woocommerce-exporter' )
549
+ );
550
+ $fields[] = array(
551
+ 'name' => 'project_name',
552
+ 'label' => __( 'Project Name', 'woocommerce-exporter' ),
553
+ 'hover' => __( 'WooCommerce Quick Donation', 'woocommerce-exporter' )
554
+ );
555
+ }
556
+
557
+ // WooCommerce Easy Checkout Fields Editor - http://codecanyon.net/item/woocommerce-easy-checkout-field-editor/9799777
558
+ if( woo_ce_detect_export_plugin( 'wc_easycheckout' ) ) {
559
+ $custom_fields = get_option( 'pcfme_additional_settings' );
560
+ if( !empty( $custom_fields ) ) {
561
+ foreach( $custom_fields as $key => $custom_field ) {
562
+ $fields[] = array(
563
+ 'name' => $key,
564
+ 'label' => sprintf( __( 'Additional: %s', 'woocommerce-exporter' ), ucfirst( $custom_field['label'] ) ),
565
+ 'hover' => __( 'WooCommerce Easy Checkout Fields Editor', 'woocommerce-exporter' )
566
+ );
567
+ }
568
+ unset( $custom_fields, $custom_field );
569
+ }
570
+ }
571
+
572
+ // WooCommerce Events - http://www.woocommerceevents.com/
573
+ if( woo_ce_detect_export_plugin( 'wc_events' ) ) {
574
+ $fields[] = array(
575
+ 'name' => 'tickets_purchased',
576
+ 'label' => __( 'Tickets Purchased', 'woocommerce-exporter' ),
577
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' )
578
+ );
579
+ }
580
+
581
+ // WooCommerce Currency Switcher - http://dev.pathtoenlightenment.net/shop
582
+ if( woo_ce_detect_export_plugin( 'currency_switcher' ) ) {
583
+ $fields[] = array(
584
+ 'name' => 'order_currency',
585
+ 'label' => __( 'Order Currency', 'woocommerce-exporter' ),
586
+ 'hover' => __( 'WooCommerce Currency Switcher', 'woocommerce-exporter' )
587
+ );
588
+ }
589
+
590
+ // WooCommerce EU VAT Number - https://www.woothemes.com/products/eu-vat-number/
591
+ if( woo_ce_detect_export_plugin( 'eu_vat' ) ) {
592
+ $fields[] = array(
593
+ 'name' => 'eu_vat',
594
+ 'label' => __( 'VAT ID', 'woocommerce-exporter' ),
595
+ 'hover' => __( 'WooCommerce EU VAT Number', 'woocommerce-exporter' )
596
+ );
597
+ $fields[] = array(
598
+ 'name' => 'eu_vat_validated',
599
+ 'label' => __( 'VAT ID Validated', 'woocommerce-exporter' ),
600
+ 'hover' => __( 'WooCommerce EU VAT Number', 'woocommerce-exporter' )
601
+ );
602
+ $fields[] = array(
603
+ 'name' => 'eu_vat_b2b',
604
+ 'label' => __( 'VAT B2B Transaction', 'woocommerce-exporter' ),
605
+ 'hover' => __( 'WooCommerce EU VAT Number', 'woocommerce-exporter' )
606
+ );
607
+ }
608
+
609
+ // WooCommerce EU VAT Assistant - https://wordpress.org/plugins/woocommerce-eu-vat-assistant/
610
+ if( woo_ce_detect_export_plugin( 'aelia_eu_vat' ) ) {
611
+ $fields[] = array(
612
+ 'name' => 'eu_vat',
613
+ 'label' => __( 'VAT ID', 'woocommerce-exporter' ),
614
+ 'hover' => __( 'WooCommerce EU VAT Assistant', 'woocommerce-exporter' )
615
+ );
616
+ $fields[] = array(
617
+ 'name' => 'eu_vat_country',
618
+ 'label' => __( 'VAT ID Country', 'woocommerce-exporter' ),
619
+ 'hover' => __( 'WooCommerce EU VAT Assistant', 'woocommerce-exporter' )
620
+ );
621
+ $fields[] = array(
622
+ 'name' => 'eu_vat_validated',
623
+ 'label' => __( 'VAT ID Validated', 'woocommerce-exporter' ),
624
+ 'hover' => __( 'WooCommerce EU VAT Assistant', 'woocommerce-exporter' )
625
+ );
626
+ $fields[] = array(
627
+ 'name' => 'eu_vat_b2b',
628
+ 'label' => __( 'VAT B2B Transaction', 'woocommerce-exporter' ),
629
+ 'hover' => __( 'WooCommerce EU VAT Assistant', 'woocommerce-exporter' )
630
+ );
631
+ }
632
+
633
+ // WooCommerce EU VAT Compliance - https://wordpress.org/plugins/woocommerce-eu-vat-compliance/
634
+ // WooCommerce EU VAT Compliance (Premium) - https://www.simbahosting.co.uk/s3/product/woocommerce-eu-vat-compliance/
635
+ if( woo_ce_detect_export_plugin( 'wc_eu_vat_compliance' ) || woo_ce_detect_export_plugin( 'wc_eu_vat_compliance_pro' ) ) {
636
+ if( woo_ce_detect_export_plugin( 'wc_eu_vat_compliance_pro' ) ) {
637
+ $fields[] = array(
638
+ 'name' => 'eu_vat',
639
+ 'label' => __( 'VAT ID', 'woocommerce-exporter' ),
640
+ 'hover' => __( 'WooCommerce EU VAT Compliance (Premium)', 'woocommerce-exporter' )
641
+ );
642
+ $fields[] = array(
643
+ 'name' => 'eu_vat_validated',
644
+ 'label' => __( 'VAT ID Validated', 'woocommerce-exporter' ),
645
+ 'hover' => __( 'WooCommerce EU VAT Compliance (Premium)', 'woocommerce-exporter' )
646
+ );
647
+ $fields[] = array(
648
+ 'name' => 'eu_vat_valid_id',
649
+ 'label' => __( 'Valid VAT ID', 'woocommerce-exporter' ),
650
+ 'hover' => __( 'WooCommerce EU VAT Compliance (Premium)', 'woocommerce-exporter' )
651
+ );
652
+ }
653
+ $fields[] = array(
654
+ 'name' => 'eu_vat_country',
655
+ 'label' => __( 'VAT ID Country', 'woocommerce-exporter' ),
656
+ 'hover' => __( 'WooCommerce EU VAT Compliance', 'woocommerce-exporter' )
657
+ );
658
+ $fields[] = array(
659
+ 'name' => 'eu_vat_country_source',
660
+ 'label' => __( 'VAT Country Source', 'woocommerce-exporter' ),
661
+ 'hover' => __( 'WooCommerce EU VAT Compliance', 'woocommerce-exporter' )
662
+ );
663
+ if( woo_ce_detect_export_plugin( 'wc_eu_vat_compliance_pro' ) ) {
664
+ $fields[] = array(
665
+ 'name' => 'eu_vat_b2b',
666
+ 'label' => __( 'VAT B2B Transaction', 'woocommerce-exporter' ),
667
+ 'hover' => __( 'WooCommerce EU VAT Compliance (Premium)', 'woocommerce-exporter' )
668
+ );
669
+ }
670
+ }
671
+
672
+ // WooCommerce Jetpack - https://wordpress.org/plugins/woocommerce-jetpack/
673
+ // WooCommerce Jetpack Plus - http://woojetpack.com/shop/wordpress-woocommerce-jetpack-plus/
674
+ if( woo_ce_detect_export_plugin( 'woocommerce_jetpack' ) || woo_ce_detect_export_plugin( 'woocommerce_jetpack_plus' ) ) {
675
+ $fields[] = array(
676
+ 'name' => 'eu_vat',
677
+ 'label' => __( 'EU VAT Number', 'woocommerce-exporter' ),
678
+ 'hover' => __( 'Booster for WooCommerce', 'woocommerce-exporter' )
679
+ );
680
+ }
681
+
682
+ // AweBooking - https://codecanyon.net/item/awebooking-online-hotel-booking-for-wordpress/12323878
683
+ if( woo_ce_detect_export_plugin( 'awebooking' ) ) {
684
+ $fields[] = array(
685
+ 'name' => 'arrival_date',
686
+ 'label' => __( 'Arrival Date', 'woocommerce-exporter' ),
687
+ 'hover' => __( 'AweBooking', 'woocommerce-exporter' )
688
+ );
689
+ $fields[] = array(
690
+ 'name' => 'departure_date',
691
+ 'label' => __( 'Departure Date', 'woocommerce-exporter' ),
692
+ 'hover' => __( 'AweBooking', 'woocommerce-exporter' )
693
+ );
694
+ $fields[] = array(
695
+ 'name' => 'adults',
696
+ 'label' => __( 'Adults', 'woocommerce-exporter' ),
697
+ 'hover' => __( 'AweBooking', 'woocommerce-exporter' )
698
+ );
699
+ $fields[] = array(
700
+ 'name' => 'children',
701
+ 'label' => __( 'Children', 'woocommerce-exporter' ),
702
+ 'hover' => __( 'AweBooking', 'woocommerce-exporter' )
703
+ );
704
+ $fields[] = array(
705
+ 'name' => 'room_type_id',
706
+ 'label' => __( 'Room Type ID', 'woocommerce-exporter' ),
707
+ 'hover' => __( 'AweBooking', 'woocommerce-exporter' )
708
+ );
709
+ $fields[] = array(
710
+ 'name' => 'room_type_name',
711
+ 'label' => __( 'Room Type Name', 'woocommerce-exporter' ),
712
+ 'hover' => __( 'AweBooking', 'woocommerce-exporter' )
713
+ );
714
+ }
715
+
716
+ // WooCommerce Custom Admin Order Fields - http://www.woothemes.com/products/woocommerce-admin-custom-order-fields/
717
+ if( woo_ce_detect_export_plugin( 'admin_custom_order_fields' ) ) {
718
+ $ac_fields = get_option( 'wc_admin_custom_order_fields' );
719
+ if( !empty( $ac_fields ) ) {
720
+ foreach( $ac_fields as $ac_key => $ac_field ) {
721
+ $fields[] = array(
722
+ 'name' => sprintf( 'wc_acof_%d', $ac_key ),
723
+ 'label' => sprintf( __( 'Admin Custom Order Field: %s', 'woocommerce-exporter' ), $ac_field['label'] )
724
+ );
725
+ }
726
+ }
727
+ }
728
+
729
+ // YITH WooCommerce Delivery Date Premium - http://yithemes.com/themes/plugins/yith-woocommerce-delivery-date/
730
+ if( woo_ce_detect_export_plugin( 'yith_delivery_pro' ) ) {
731
+ $fields[] = array(
732
+ 'name' => 'shipping_date',
733
+ 'label' => __( 'Shipping Date', 'woocommerce-exporter' ),
734
+ 'hover' => __( 'YITH WooCommerce Delivery Date Premium', 'woocommerce-exporter' )
735
+ );
736
+ $fields[] = array(
737
+ 'name' => 'delivery_date',
738
+ 'label' => __( 'Delivery Date', 'woocommerce-exporter' ),
739
+ 'hover' => __( 'YITH WooCommerce Delivery Date Premium', 'woocommerce-exporter' )
740
+ );
741
+ $fields[] = array(
742
+ 'name' => 'delivery_time_slot',
743
+ 'label' => __( 'Delivery Time Slot', 'woocommerce-exporter' ),
744
+ 'hover' => __( 'YITH WooCommerce Delivery Date Premium', 'woocommerce-exporter' )
745
+ );
746
+ }
747
+
748
+ // WooCommerce Point of Sale - https://codecanyon.net/item/woocommerce-point-of-sale-pos/7869665
749
+ if( woo_ce_detect_export_plugin( 'wc_point_of_sales' ) ) {
750
+ $fields[] = array(
751
+ 'name' => 'order_type',
752
+ 'label' => __( 'Order Type', 'woocommerce-exporter' ),
753
+ 'hover' => __( 'WooCommerce Point of Sale', 'woocommerce-exporter' )
754
+ );
755
+ $fields[] = array(
756
+ 'name' => 'order_register_id',
757
+ 'label' => __( 'Register ID', 'woocommerce-exporter' ),
758
+ 'hover' => __( 'WooCommerce Point of Sale', 'woocommerce-exporter' )
759
+ );
760
+ $fields[] = array(
761
+ 'name' => 'order_cashier',
762
+ 'label' => __( 'Cashier', 'woocommerce-exporter' ),
763
+ 'hover' => __( 'WooCommerce Point of Sale', 'woocommerce-exporter' )
764
+ );
765
+ }
766
+
767
+ // WooCommerce PDF Product Vouchers - http://www.woothemes.com/products/pdf-product-vouchers/
768
+ if( woo_ce_detect_export_plugin( 'wc_pdf_product_vouchers' ) ) {
769
+ $fields[] = array(
770
+ 'name' => 'voucher_redeemed',
771
+ 'label' => __( 'Voucher Redeemed', 'woocommerce-exporter' ),
772
+ 'hover' => __( 'WooCommerce PDF Product Vouchers', 'woocommerce-exporter' )
773
+ );
774
+ }
775
+
776
+ // WooCommerce Delivery Slots - https://iconicwp.com/products/woocommerce-delivery-slots/
777
+ if( woo_ce_detect_export_plugin( 'wc_deliveryslots' ) ) {
778
+ $fields[] = array(
779
+ 'name' => 'delivery_date',
780
+ 'label' => __( 'Delivery Date', 'woocommerce-exporter' ),
781
+ 'hover' => __( 'WooCommerce Delivery Slots', 'woocommerce-exporter' )
782
+ );
783
+ $fields[] = array(
784
+ 'name' => 'delivery_timeslot',
785
+ 'label' => __( 'Delivery Timeslot', 'woocommerce-exporter' ),
786
+ 'hover' => __( 'WooCommerce Delivery Slots', 'woocommerce-exporter' )
787
+ );
788
+ }
789
+
790
+ // WooCommerce Ship to Multiple Addresses - http://woothemes.com/woocommerce
791
+ if( woo_ce_detect_export_plugin( 'wc_ship_multiple' ) ) {
792
+ $fields[] = array(
793
+ 'name' => 'wcms_number_packages',
794
+ 'label' => __( 'Number of Packages', 'woocommerce-exporter' ),
795
+ 'hover' => __( 'Ship to Multiple Addresses', 'woocommerce-exporter' )
796
+ );
797
+ }
798
+
799
+ // WooCommerce Deposits - https://woocommerce.com/products/woocommerce-deposits/
800
+ if( woo_ce_detect_export_plugin( 'wc_deposits' ) ) {
801
+ $fields[] = array(
802
+ 'name' => 'has_deposit',
803
+ 'label' => __( 'Has Deposit', 'woocommerce-exporter' ),
804
+ 'hover' => __( 'WooCommerce Deposits', 'woocommerce-exporter' )
805
+ );
806
+ $fields[] = array(
807
+ 'name' => 'deposit_paid',
808
+ 'label' => __( 'Deposit Paid', 'woocommerce-exporter' ),
809
+ 'hover' => __( 'WooCommerce Deposits', 'woocommerce-exporter' )
810
+ );
811
+ $fields[] = array(
812
+ 'name' => 'deposit_second_payment_paid',
813
+ 'label' => __( 'Second Payment Paid', 'woocommerce-exporter' ),
814
+ 'hover' => __( 'WooCommerce Deposits', 'woocommerce-exporter' )
815
+ );
816
+ $fields[] = array(
817
+ 'name' => 'deposit_amount',
818
+ 'label' => __( 'Deposit Amount', 'woocommerce-exporter' ),
819
+ 'hover' => __( 'WooCommerce Deposits', 'woocommerce-exporter' )
820
+ );
821
+ $fields[] = array(
822
+ 'name' => 'deposit_second_payment',
823
+ 'label' => __( 'Second Payment Amount', 'woocommerce-exporter' ),
824
+ 'hover' => __( 'WooCommerce Deposits', 'woocommerce-exporter' )
825
+ );
826
+ $fields[] = array(
827
+ 'name' => 'deposit_original_total',
828
+ 'label' => __( 'Original Total', 'woocommerce-exporter' ),
829
+ 'hover' => __( 'WooCommerce Deposits', 'woocommerce-exporter' )
830
+ );
831
+ }
832
+
833
+ // WooCommerce Custom Fields - http://www.rightpress.net/woocommerce-custom-fields
834
+ if( woo_ce_detect_export_plugin( 'wc_customfields' ) ) {
835
+ if( get_option( 'wccf_migrated_to_20' ) ) {
836
+ // Order Fields
837
+ $custom_fields = woo_ce_get_wccf_order_fields();
838
+ if( !empty( $custom_fields ) ) {
839
+ foreach( $custom_fields as $custom_field ) {
840
+ $label = get_post_meta( $custom_field->ID, 'label', true );
841
+ $key = get_post_meta( $custom_field->ID, 'key', true );
842
+ $fields[] = array(
843
+ 'name' => sprintf( 'wccf_of_%s', sanitize_key( $key ) ),
844
+ 'label' => ucfirst( $label ),
845
+ 'hover' => sprintf( '%s: %s (%s)', __( 'WooCommerce Custom Fields', 'woocommerce-exporter' ), __( 'Order Field', 'woocommerce-exporter' ), sanitize_key( $key ) )
846
+ );
847
+ }
848
+ }
849
+ unset( $custom_fields, $custom_field, $label, $key );
850
+ // Checkout Fields
851
+ $custom_fields = woo_ce_get_wccf_checkout_fields();
852
+ if( !empty( $custom_fields ) ) {
853
+ foreach( $custom_fields as $custom_field ) {
854
+ $label = get_post_meta( $custom_field->ID, 'label', true );
855
+ $key = get_post_meta( $custom_field->ID, 'key', true );
856
+ $fields[] = array(
857
+ 'name' => sprintf( 'wccf_cf_%s', sanitize_key( $key ) ),
858
+ 'label' => ucfirst( $label ),
859
+ 'hover' => sprintf( '%s: %s (%s)', __( 'WooCommerce Custom Fields', 'woocommerce-exporter' ), __( 'Checkout Field', 'woocommerce-exporter' ), sanitize_key( $key ) )
860
+ );
861
+ }
862
+ }
863
+ unset( $custom_fields, $custom_field, $label, $key );
864
+ }
865
+ }
866
+
867
+ // Custom User fields
868
+ $custom_users = woo_ce_get_option( 'custom_users', '' );
869
+ if( !empty( $custom_users ) ) {
870
+ foreach( $custom_users as $custom_user ) {
871
+ if( !empty( $custom_user ) ) {
872
+ $fields[] = array(
873
+ 'name' => $custom_user,
874
+ 'label' => woo_ce_clean_export_label( $custom_user ),
875
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_order_fields_custom_user_hover', '%s: %s' ), __( 'Custom User', 'woocommerce-exporter' ), $custom_user )
876
+ );
877
+ }
878
+ }
879
+ }
880
+ unset( $custom_users, $custom_user );
881
+
882
+ // Custom Order fields
883
+ $custom_orders = woo_ce_get_option( 'custom_orders', '' );
884
+ if( !empty( $custom_orders ) ) {
885
+ foreach( $custom_orders as $custom_order ) {
886
+ if( !empty( $custom_order ) ) {
887
+ $fields[] = array(
888
+ 'name' => $custom_order,
889
+ 'label' => woo_ce_clean_export_label( $custom_order ),
890
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_order_fields_custom_order_hover', '%s: %s' ), __( 'Custom Order', 'woocommerce-exporter' ), $custom_order )
891
+ );
892
+ }
893
+ }
894
+ unset( $custom_orders, $custom_order );
895
+ }
896
+
897
+ // Order Items go in woo_ce_extend_order_items_fields()
898
+
899
+ return $fields;
900
+
901
+ }
902
+ add_filter( 'woo_ce_order_fields', 'woo_ce_extend_order_fields' );
903
+
904
+ // Adds custom Order Item columns to the Order Items fields list
905
+ function woo_ce_extend_order_items_fields( $fields = array() ) {
906
+
907
+ // WooCommerce Checkout Add-Ons - http://www.skyverge.com/product/woocommerce-checkout-add-ons/
908
+ if( woo_ce_detect_export_plugin( 'checkout_addons' ) ) {
909
+ $fields[] = array(
910
+ 'name' => 'order_items_checkout_addon_id',
911
+ 'label' => __( 'Order Items: Checkout Add-ons ID', 'woocommerce-exporter' ),
912
+ 'hover' => __( 'WooCommerce Checkout Add-Ons', 'woocommerce-exporter' )
913
+ );
914
+ $fields[] = array(
915
+ 'name' => 'order_items_checkout_addon_label',
916
+ 'label' => __( 'Order Items: Checkout Add-ons Label', 'woocommerce-exporter' ),
917
+ 'hover' => __( 'WooCommerce Checkout Add-Ons', 'woocommerce-exporter' )
918
+ );
919
+ $fields[] = array(
920
+ 'name' => 'order_items_checkout_addon_value',
921
+ 'label' => __( 'Order Items: Checkout Add-ons Value', 'woocommerce-exporter' ),
922
+ 'hover' => __( 'WooCommerce Checkout Add-Ons', 'woocommerce-exporter' )
923
+ );
924
+ }
925
+
926
+ // WooCommerce Brands - http://proword.net/Woocommerce_Brands/
927
+ // WooCommerce Brands Addon - http://woothemes.com/woocommerce/
928
+ if( woo_ce_detect_product_brands() ) {
929
+ $fields[] = array(
930
+ 'name' => 'order_items_brand',
931
+ 'label' => __( 'Order Items: Brand', 'woocommerce-exporter' ),
932
+ 'hover' => __( 'WooCommerce Brands or WooCommerce Brands Addon', 'woocommerce-exporter' )
933
+ );
934
+ }
935
+
936
+ // Product Vendors - http://www.woothemes.com/products/product-vendors/
937
+ if( woo_ce_detect_export_plugin( 'vendors' ) ) {
938
+ $fields[] = array(
939
+ 'name' => 'order_items_vendor',
940
+ 'label' => __( 'Order Items: Product Vendor', 'woocommerce-exporter' ),
941
+ 'hover' => __( 'Product Vendors', 'woocommerce-exporter' )
942
+ );
943
+ }
944
+
945
+ // YITH WooCommerce Multi Vendor Premium - http://yithemes.com/themes/plugins/yith-woocommerce-product-vendors/
946
+ if( woo_ce_detect_export_plugin( 'yith_vendor' ) ) {
947
+ $fields[] = array(
948
+ 'name' => 'order_items_vendor',
949
+ 'label' => __( 'Order Items: Product Vendor', 'woocommerce-exporter' ),
950
+ 'hover' => __( 'Product Vendors', 'woocommerce-exporter' )
951
+ );
952
+ }
953
+
954
+ // Cost of Goods - http://www.skyverge.com/product/woocommerce-cost-of-goods-tracking/
955
+ if( woo_ce_detect_export_plugin( 'wc_cog' ) ) {
956
+ $fields[] = array(
957
+ 'name' => 'cost_of_goods',
958
+ 'label' => __( 'Order Total Cost of Goods', 'woocommerce-exporter' ),
959
+ 'hover' => __( 'Cost of Goods', 'woocommerce-exporter' )
960
+ );
961
+ $fields[] = array(
962
+ 'name' => 'order_items_cost_of_goods',
963
+ 'label' => __( 'Order Items: Cost of Goods', 'woocommerce-exporter' ),
964
+ 'hover' => __( 'Cost of Goods', 'woocommerce-exporter' )
965
+ );
966
+ $fields[] = array(
967
+ 'name' => 'order_items_total_cost_of_goods',
968
+ 'label' => __( 'Order Items: Total Cost of Goods', 'woocommerce-exporter' ),
969
+ 'hover' => __( 'Cost of Goods', 'woocommerce-exporter' )
970
+ );
971
+ }
972
+
973
+ // WooCommerce Profit of Sales Report - http://codecanyon.net/item/woocommerce-profit-of-sales-report/9190590
974
+ if( woo_ce_detect_export_plugin( 'wc_posr' ) ) {
975
+ $fields[] = array(
976
+ 'name' => 'order_items_posr',
977
+ 'label' => __( 'Order Items: Cost of Good', 'woocommerce-exporter' ),
978
+ 'hover' => __( 'WooCommerce Profit of Sales Report', 'woocommerce-exporter' )
979
+ );
980
+ }
981
+
982
+ // WooCommerce MSRP Pricing - http://woothemes.com/woocommerce/
983
+ if( woo_ce_detect_export_plugin( 'wc_msrp' ) ) {
984
+ $fields[] = array(
985
+ 'name' => 'order_items_msrp',
986
+ 'label' => __( 'Order Items: MSRP', 'woocommerce-exporter' ),
987
+ 'hover' => __( 'WooCommerce MSRP Pricing', 'woocommerce-exporter' )
988
+ );
989
+ }
990
+
991
+ // Local Pickup Plus - http://www.woothemes.com/products/local-pickup-plus/
992
+ if( woo_ce_detect_export_plugin( 'local_pickup_plus' ) ) {
993
+ $fields[] = array(
994
+ 'name' => 'order_items_pickup_location',
995
+ 'label' => __( 'Order Items: Pickup Location', 'woocommerce-exporter' ),
996
+ 'hover' => __( 'Local Pickup Plus', 'woocommerce-exporter' )
997
+ );
998
+ }
999
+
1000
+ // WooCommerce Bookings - http://www.woothemes.com/products/woocommerce-bookings/
1001
+ if( woo_ce_detect_export_plugin( 'woocommerce_bookings' ) ) {
1002
+ $fields[] = array(
1003
+ 'name' => 'order_items_booking_id',
1004
+ 'label' => __( 'Order Items: Booking ID', 'woocommerce-exporter' ),
1005
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' )
1006
+ );
1007
+ $fields[] = array(
1008
+ 'name' => 'order_items_booking_date',
1009
+ 'label' => __( 'Order Items: Booking Date', 'woocommerce-exporter' ),
1010
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' )
1011
+ );
1012
+ $fields[] = array(
1013
+ 'name' => 'order_items_booking_type',
1014
+ 'label' => __( 'Order Items: Booking Type', 'woocommerce-exporter' ),
1015
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' )
1016
+ );
1017
+ $fields[] = array(
1018
+ 'name' => 'order_items_booking_start_date',
1019
+ 'label' => __( 'Order Items: Start Date', 'woocommerce-exporter' ),
1020
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' )
1021
+ );
1022
+ $fields[] = array(
1023
+ 'name' => 'order_items_booking_end_date',
1024
+ 'label' => __( 'Order Items: End Date', 'woocommerce-exporter' ),
1025
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' )
1026
+ );
1027
+ $fields[] = array(
1028
+ 'name' => 'order_items_booking_all_day',
1029
+ 'label' => __( 'Order Items: All Day Booking' ),
1030
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' )
1031
+ );
1032
+ $fields[] = array(
1033
+ 'name' => 'order_items_booking_resource_id',
1034
+ 'label' => __( 'Order Items: Booking Resource ID', 'woocommerce-exporter' ),
1035
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' )
1036
+ );
1037
+ $fields[] = array(
1038
+ 'name' => 'order_items_booking_resource_title',
1039
+ 'label' => __( 'Order Items: Booking Resource Name', 'woocommerce-exporter' ),
1040
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' )
1041
+ );
1042
+ $fields[] = array(
1043
+ 'name' => 'order_items_booking_persons',
1044
+ 'label' => __( 'Order Items: Booking # of Persons', 'woocommerce-exporter' ),
1045
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' )
1046
+ );
1047
+ }
1048
+
1049
+ // Gravity Forms - http://woothemes.com/woocommerce
1050
+ if( woo_ce_detect_export_plugin( 'gravity_forms' ) && woo_ce_detect_export_plugin( 'woocommerce_gravity_forms' ) ) {
1051
+ // Check if there are any Products linked to Gravity Forms
1052
+ $gf_fields = woo_ce_get_gravity_forms_fields();
1053
+ if( !empty( $gf_fields ) ) {
1054
+ $fields[] = array(
1055
+ 'name' => 'order_items_gf_form_id',
1056
+ 'label' => __( 'Order Items: Gravity Form ID', 'woocommerce-exporter' ),
1057
+ 'hover' => __( 'Gravity Forms', 'woocommerce-exporter' )
1058
+ );
1059
+ $fields[] = array(
1060
+ 'name' => 'order_items_gf_form_label',
1061
+ 'label' => __( 'Order Items: Gravity Form Label', 'woocommerce-exporter' ),
1062
+ 'hover' => __( 'Gravity Forms', 'woocommerce-exporter' )
1063
+ );
1064
+ foreach( $gf_fields as $gf_field ) {
1065
+ $gf_field_duplicate = false;
1066
+ // Check if this isn't a duplicate Gravity Forms field
1067
+ foreach( $fields as $field ) {
1068
+ if( isset( $field['name'] ) && $field['name'] == sprintf( 'order_items_gf_%d_%s', $gf_field['formId'], $gf_field['id'] ) ) {
1069
+ // Duplicate exists
1070
+ $gf_field_duplicate = true;
1071
+ break;
1072
+ }
1073
+ }
1074
+ // If it's not a duplicate go ahead and add it to the list
1075
+ if( $gf_field_duplicate !== true ) {
1076
+ $fields[] = array(
1077
+ 'name' => sprintf( 'order_items_gf_%d_%s', $gf_field['formId'], $gf_field['id'] ),
1078
+ 'label' => sprintf( apply_filters( 'woo_ce_extend_order_fields_gf_label', __( 'Order Items: %s - %s', 'woocommerce-exporter' ) ), ucwords( strtolower( $gf_field['formTitle'] ) ), ucfirst( strtolower( $gf_field['label'] ) ) ),
1079
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_order_fields_gf_hover', '%s: %s (ID: %d)' ), __( 'Gravity Forms', 'woocommerce-exporter' ), ucwords( strtolower( $gf_field['formTitle'] ) ), $gf_field['formId'] )
1080
+ );
1081
+ }
1082
+ }
1083
+ }
1084
+ unset( $gf_fields, $gf_field );
1085
+ }
1086
+
1087
+ // WooCommerce TM Extra Product Options - http://codecanyon.net/item/woocommerce-extra-product-options/7908619
1088
+ if( woo_ce_detect_export_plugin( 'extra_product_options' ) ) {
1089
+ if( $tm_fields = woo_ce_get_extra_product_option_fields() ) {
1090
+ foreach( $tm_fields as $tm_field ) {
1091
+ $fields[] = array(
1092
+ 'name' => sprintf( 'order_items_tm_%s', sanitize_key( $tm_field['name'] ) ),
1093
+ 'label' => sprintf( __( 'Order Items: %s', 'woocommerce-exporter' ), ( !empty( $tm_field['section_label'] ) ? $tm_field['section_label'] : $tm_field['name'] ) ),
1094
+ 'hover' => __( 'WooCommerce TM Extra Product Options', 'woocommerce-exporter' )
1095
+ );
1096
+ }
1097
+ unset( $tm_fields, $tm_field );
1098
+ }
1099
+ }
1100
+
1101
+ // WooCommerce Custom Fields - http://www.rightpress.net/woocommerce-custom-fields
1102
+ if( woo_ce_detect_export_plugin( 'wc_customfields' ) ) {
1103
+ if( !get_option( 'wccf_migrated_to_20' ) ) {
1104
+ $options = get_option( 'rp_wccf_options' );
1105
+ if( !empty( $options ) ) {
1106
+ $options = ( isset( $options[1] ) ? $options[1] : false );
1107
+ if( !empty( $options ) ) {
1108
+ // Product Fields
1109
+ $custom_fields = ( isset( $options['product_fb_config'] ) ? $options['product_fb_config'] : false );
1110
+ if( !empty( $custom_fields ) ) {
1111
+ foreach( $custom_fields as $custom_field ) {
1112
+ $fields[] = array(
1113
+ 'name' => sprintf( 'order_items_wccf_%s', sanitize_key( $custom_field['key'] ) ),
1114
+ 'label' => sprintf( __( 'Order Items: %s', 'woocommerce-exporter' ), ucfirst( $custom_field['label'] ) ),
1115
+ 'hover' => sprintf( '%s: %s (ID: %s)', __( 'WooCommerce Custom Fields', 'woocommerce-exporter' ), __( 'Product Field', 'woocommerce-exporter' ), sanitize_key( $custom_field['key'] ) )
1116
+ );
1117
+ }
1118
+ unset( $custom_fields, $custom_field );
1119
+ }
1120
+ }
1121
+ unset( $options );
1122
+ }
1123
+ } else {
1124
+ // Product Fields
1125
+ $custom_fields = woo_ce_get_wccf_product_fields();
1126
+ if( !empty( $custom_fields ) ) {
1127
+ foreach( $custom_fields as $custom_field ) {
1128
+ $label = get_post_meta( $custom_field->ID, 'label', true );
1129
+ $key = get_post_meta( $custom_field->ID, 'key', true );
1130
+ $fields[] = array(
1131
+ 'name' => sprintf( 'order_items_wccf_%s', sanitize_key( $key ) ),
1132
+ 'label' => sprintf( __( 'Order Items: %s', 'woocommerce-exporter' ), ucfirst( $label ) ),
1133
+ 'hover' => sprintf( '%s: %s (ID: %s)', __( 'WooCommerce Custom Fields', 'woocommerce-exporter' ), __( 'Product Field', 'woocommerce-exporter' ), sanitize_key( $key ) )
1134
+ );
1135
+ }
1136
+ }
1137
+ unset( $custom_fields, $custom_field, $key );
1138
+ }
1139
+ }
1140
+
1141
+ // WooCommerce Product Custom Options Lite - https://wordpress.org/plugins/woocommerce-custom-options-lite/
1142
+ if( woo_ce_detect_export_plugin( 'wc_product_custom_options' ) ) {
1143
+ if( $custom_options = woo_ce_get_product_custom_options() ) {
1144
+ foreach( $custom_options as $custom_option ) {
1145
+ $fields[] = array(
1146
+ 'name' => sprintf( 'order_items_pco_%s', sanitize_key( $custom_option ) ),
1147
+ 'label' => sprintf( __( 'Order Items: %s', 'woocommerce-exporter' ), ucfirst( $custom_option ) ),
1148
+ 'hover' => __( 'WooCommerce Product Custom Options Lite', 'woocommerce-exporter' )
1149
+ );
1150
+ }
1151
+ }
1152
+ }
1153
+
1154
+ // Barcodes for WooCommerce - http://www.wolkenkraft.com/produkte/barcodes-fuer-woocommerce/
1155
+ if( woo_ce_detect_export_plugin( 'wc_barcodes' ) ) {
1156
+ $fields[] = array(
1157
+ 'name' => 'order_items_barcode_type',
1158
+ 'label' => __( 'Order Items: Barcode Type', 'woocommerce-exporter' ),
1159
+ 'hover' => __( 'Barcodes for WooCommerce', 'woocommerce-exporter' )
1160
+ );
1161
+ $fields[] = array(
1162
+ 'name' => 'order_items_barcode',
1163
+ 'label' => __( 'Order Items: Barcode', 'woocommerce-exporter' ),
1164
+ 'hover' => __( 'Barcodes for WooCommerce', 'woocommerce-exporter' )
1165
+ );
1166
+ }
1167
+
1168
+ // WooCommerce Easy Bookings - https://wordpress.org/plugins/woocommerce-easy-booking-system/
1169
+ if( woo_ce_detect_export_plugin( 'wc_easybooking' ) ) {
1170
+ $fields[] = array(
1171
+ 'name' => 'order_items_start_date',
1172
+ 'label' => __( 'Order Items: Start', 'woocommerce-exporter' ),
1173
+ 'hover' => __( 'WooCommerce Easy Bookings', 'woocommerce-exporter' )
1174
+ );
1175
+ $fields[] = array(
1176
+ 'name' => 'order_items_end_date',
1177
+ 'label' => __( 'Order Items: End', 'woocommerce-exporter' ),
1178
+ 'hover' => __( 'WooCommerce Easy Bookings', 'woocommerce-exporter' )
1179
+ );
1180
+ }
1181
+
1182
+ if( apply_filters( 'woo_ce_enable_product_attributes', true ) ) {
1183
+ // Attributes
1184
+ if( $attributes = woo_ce_get_product_attributes() ) {
1185
+ foreach( $attributes as $attribute ) {
1186
+ $attribute->attribute_label = trim( $attribute->attribute_label );
1187
+ if( empty( $attribute->attribute_label ) )
1188
+ $attribute->attribute_label = $attribute->attribute_name;
1189
+ // First row is to fetch the Variation Attribute linked to the Order Item
1190
+ $fields[] = array(
1191
+ 'name' => sprintf( 'order_items_attribute_%s', sanitize_key( $attribute->attribute_name ) ),
1192
+ 'label' => sprintf( __( 'Order Items: %s Variation', 'woocommerce-exporter' ), ucwords( $attribute->attribute_label ) ),
1193
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_order_fields_attribute', '%s: %s (#%d)' ), __( 'Product Variation', 'woocommerce-exporter' ), $attribute->attribute_name, $attribute->attribute_id )
1194
+ );
1195
+ // The second row is to fetch the Product Attribute from the Order Item Product
1196
+ $fields[] = array(
1197
+ 'name' => sprintf( 'order_items_product_attribute_%s', sanitize_key( $attribute->attribute_name ) ),
1198
+ 'label' => sprintf( __( 'Order Items: %s Attribute', 'woocommerce-exporter' ), ucwords( $attribute->attribute_label ) ),
1199
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_order_fields_product_attribute', '%s: %s (#%d)' ), __( 'Product Attribute', 'woocommerce-exporter' ), $attribute->attribute_name, $attribute->attribute_id )
1200
+ );
1201
+ }
1202
+ unset( $attributes, $attribute );
1203
+ }
1204
+ }
1205
+
1206
+ // Custom Order Items fields
1207
+ $custom_order_items = woo_ce_get_option( 'custom_order_items', '' );
1208
+ if( !empty( $custom_order_items ) ) {
1209
+ foreach( $custom_order_items as $custom_order_item ) {
1210
+ if( !empty( $custom_order_item ) ) {
1211
+ $fields[] = array(
1212
+ 'name' => sprintf( 'order_items_%s', sanitize_key( $custom_order_item ) ),
1213
+ 'label' => sprintf( __( 'Order Items: %s', 'woocommerce-exporter' ), woo_ce_clean_export_label( $custom_order_item ) ),
1214
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_order_fields_custom_order_item_hover', '%s: %s' ), __( 'Custom Order Item', 'woocommerce-exporter' ), $custom_order_item )
1215
+ );
1216
+ }
1217
+ }
1218
+ }
1219
+ unset( $custom_order_items, $custom_order_item );
1220
+
1221
+ // Custom Order Item Product fields
1222
+ $custom_order_products = woo_ce_get_option( 'custom_order_products', '' );
1223
+ if( !empty( $custom_order_products ) ) {
1224
+ foreach( $custom_order_products as $custom_order_product ) {
1225
+ if( !empty( $custom_order_product ) ) {
1226
+ $fields[] = array(
1227
+ 'name' => sprintf( 'order_items_%s', sanitize_key( $custom_order_product ) ),
1228
+ 'label' => sprintf( __( 'Order Items: %s', 'woocommerce-exporter' ), woo_ce_clean_export_label( $custom_order_product ) ),
1229
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_order_fields_custom_order_product_hover', '%s: %s' ), __( 'Custom Order Item Product', 'woocommerce-exporter' ), $custom_order_product )
1230
+ );
1231
+ }
1232
+ }
1233
+ }
1234
+ unset( $custom_order_products, $custom_order_product );
1235
+
1236
+ // Custom Product fields
1237
+ $custom_products = woo_ce_get_option( 'custom_products', '' );
1238
+ if( !empty( $custom_products ) ) {
1239
+ foreach( $custom_products as $custom_product ) {
1240
+ if( !empty( $custom_product ) ) {
1241
+ $fields[] = array(
1242
+ 'name' => sprintf( 'order_items_%s', sanitize_key( $custom_product ) ),
1243
+ 'label' => sprintf( __( 'Order Items: %s', 'woocommerce-exporter' ), woo_ce_clean_export_label( $custom_product ) ),
1244
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_order_fields_custom_product_hover', '%s: %s' ), __( 'Custom Product', 'woocommerce-exporter' ), $custom_product )
1245
+ );
1246
+ }
1247
+ }
1248
+ }
1249
+ unset( $custom_products, $custom_product );
1250
+
1251
+ return $fields;
1252
+
1253
+ }
1254
+ add_filter( 'woo_ce_order_items_fields', 'woo_ce_extend_order_items_fields' );
1255
+ // Gravity Forms - http://woothemes.com/woocommerce
1256
+ function woo_ce_get_gravity_forms_fields() {
1257
+
1258
+ if( apply_filters( 'woo_ce_enable_addon_gravity_forms', true ) == false )
1259
+ return;
1260
+
1261
+ global $export;
1262
+
1263
+ if( WOO_CD_LOGGING ) {
1264
+ if( isset( $export->start_time ) )
1265
+ woo_ce_error_log( sprintf( 'Debug: %s', 'begin woo_ce_get_gravity_forms_fields(): ' . ( time() - $export->start_time ) ) );
1266
+ }
1267
+
1268
+ // Can we use the existing Transient?
1269
+ if ( false === ( $fields = get_transient( WOO_CD_PREFIX . '_gravity_forms_fields' ) ) ) {
1270
+
1271
+ $fields = array();
1272
+ if( $gf_products = woo_ce_get_gravity_forms_products() ) {
1273
+ foreach( $gf_products as $gf_product ) {
1274
+ if( $gf_product_data = maybe_unserialize( get_post_meta( $gf_product->post_id, '_gravity_form_data', true ) ) ) {
1275
+ // Check the class and method for Gravity Forms exists
1276
+ if( class_exists( 'RGFormsModel' ) && method_exists( 'RGFormsModel', 'get_form_meta' ) ) {
1277
+ // Check the form exists
1278
+ $gf_form_meta = RGFormsModel::get_form_meta( $gf_product_data['id'] );
1279
+ if( !empty( $gf_form_meta ) ) {
1280
+ // Check that the form has fields assigned to it
1281
+ if( !empty( $gf_form_meta['fields'] ) ) {
1282
+ foreach( $gf_form_meta['fields'] as $gf_form_field ) {
1283
+ // Check for duplicate Gravity Form fields
1284
+ $gf_form_field['formTitle'] = $gf_form_meta['title'];
1285
+ // Do not include page and section breaks, hidden as exportable fields
1286
+ if( !in_array( $gf_form_field['type'], array( 'page', 'section', 'hidden' ) ) )
1287
+ $fields[] = $gf_form_field;
1288
+ }
1289
+ }
1290
+ }
1291
+ unset( $gf_form_meta );
1292
+ }
1293
+ }
1294
+ unset( $gf_product_data );
1295
+ }
1296
+ unset( $gf_products, $gf_product );
1297
+ }
1298
+
1299
+ // Save as Transient
1300
+ set_transient( WOO_CD_PREFIX . '_gravity_forms_fields', $fields, HOUR_IN_SECONDS );
1301
+
1302
+ }
1303
+
1304
+ if( WOO_CD_LOGGING ) {
1305
+ if( isset( $export->start_time ) )
1306
+ woo_ce_error_log( sprintf( 'Debug: %s', 'after woo_ce_get_gravity_forms_fields(): ' . ( time() - $export->start_time ) ) );
1307
+ }
1308
+
1309
+ return $fields;
1310
+
1311
+ }
1312
+
1313
+ // WooCommerce Custom Fields - http://www.rightpress.net/woocommerce-custom-fields
1314
+ function woo_ce_get_wccf_product_fields() {
1315
+
1316
+ $post_type = 'wccf_product_field';
1317
+ $args = array(
1318
+ 'post_type' => $post_type,
1319
+ 'post_status' => 'publish',
1320
+ 'posts_per_page' => -1
1321
+ );
1322
+ $product_fields = new WP_Query( $args );
1323
+ if( !empty( $product_fields->posts ) ) {
1324
+ return $product_fields->posts;
1325
+ }
1326
+
1327
+ }
1328
+
1329
+ // WooCommerce Custom Fields - http://www.rightpress.net/woocommerce-custom-fields
1330
+ function woo_ce_get_wccf_order_fields() {
1331
+
1332
+ $post_type = 'wccf_order_field';
1333
+ $args = array(
1334
+ 'post_type' => $post_type,
1335
+ 'post_status' => 'publish',
1336
+ 'posts_per_page' => -1
1337
+ );
1338
+ $order_fields = new WP_Query( $args );
1339
+ if( !empty( $order_fields->posts ) ) {
1340
+ return $order_fields->posts;
1341
+ }
1342
+
1343
+ }
1344
+
1345
+ // WooCommerce Custom Fields - http://www.rightpress.net/woocommerce-custom-fields
1346
+ function woo_ce_get_wccf_checkout_fields() {
1347
+
1348
+ $post_type = 'wccf_checkout_field';
1349
+ $args = array(
1350
+ 'post_type' => $post_type,
1351
+ 'post_status' => 'publish',
1352
+ 'posts_per_page' => -1
1353
+ );
1354
+ $checkout_fields = new WP_Query( $args );
1355
+ if( !empty( $checkout_fields->posts ) ) {
1356
+ return $checkout_fields->posts;
1357
+ }
1358
+
1359
+ }
1360
+ ?>
includes/order.php ADDED
@@ -0,0 +1,675 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ function woo_ce_get_export_type_order_count() {
7
+
8
+ $count = 0;
9
+ // Check if the existing Transient exists
10
+ $cached = get_transient( WOO_CE_PREFIX . '_order_count' );
11
+ if( $cached == false ) {
12
+ $post_type = 'shop_order';
13
+ $woocommerce_version = woo_get_woo_version();
14
+ // Check if this is a WooCommerce 2.2+ instance (new Post Status)
15
+ if( version_compare( $woocommerce_version, '2.2' ) >= 0 )
16
+ $post_status = ( function_exists( 'wc_get_order_statuses' ) ? apply_filters( 'woo_ce_order_post_status', array_keys( wc_get_order_statuses() ) ) : 'any' );
17
+ else
18
+ $post_status = apply_filters( 'woo_ce_order_post_status', woo_ce_post_statuses() );
19
+ $args = array(
20
+ 'post_type' => $post_type,
21
+ 'posts_per_page' => 1,
22
+ 'post_status' => $post_status,
23
+ 'fields' => 'ids'
24
+ );
25
+ $count_query = new WP_Query( $args );
26
+ $count = $count_query->found_posts;
27
+ set_transient( WOO_CE_PREFIX . '_order_count', $count, HOUR_IN_SECONDS );
28
+ } else {
29
+ $count = $cached;
30
+ }
31
+ return $count;
32
+
33
+ }
34
+
35
+
36
+ /* End of: WordPress Administration */
37
+
38
+ }
39
+
40
+ // Returns a list of Order export columns
41
+ function woo_ce_get_order_fields( $format = 'full', $post_ID = 0 ) {
42
+
43
+ $export_type = 'order';
44
+
45
+ $fields = array();
46
+ $fields[] = array(
47
+ 'name' => 'purchase_id',
48
+ 'label' => __( 'Order ID', 'woocommerce-exporter' )
49
+ );
50
+ $fields[] = array(
51
+ 'name' => 'post_id',
52
+ 'label' => __( 'Post ID', 'woocommerce-exporter' )
53
+ );
54
+ $fields[] = array(
55
+ 'name' => 'purchase_total',
56
+ 'label' => __( 'Order Total', 'woocommerce-exporter' )
57
+ );
58
+ $fields[] = array(
59
+ 'name' => 'purchase_subtotal',
60
+ 'label' => __( 'Order Subtotal', 'woocommerce-exporter' )
61
+ );
62
+ $fields[] = array(
63
+ 'name' => 'order_currency',
64
+ 'label' => __( 'Order Currency', 'woocommerce-exporter' )
65
+ );
66
+ $fields[] = array(
67
+ 'name' => 'order_discount',
68
+ 'label' => __( 'Order Discount', 'woocommerce-exporter' )
69
+ );
70
+ $fields[] = array(
71
+ 'name' => 'coupon_code',
72
+ 'label' => __( 'Coupon Code', 'woocommerce-exporter' )
73
+ );
74
+ $fields[] = array(
75
+ 'name' => 'coupon_expiry_date',
76
+ 'label' => __( 'Coupon Expiry Date', 'woocommerce-exporter' )
77
+ );
78
+ $fields[] = array(
79
+ 'name' => 'coupon_description',
80
+ 'label' => __( 'Coupon Description', 'woocommerce-exporter' )
81
+ );
82
+ $fields[] = array(
83
+ 'name' => 'purchase_total_tax',
84
+ 'label' => __( 'Order Total Tax', 'woocommerce-exporter' )
85
+ );
86
+ /*
87
+ $fields[] = array(
88
+ 'name' => 'order_incl_tax',
89
+ 'label' => __( 'Order Incl. Tax', 'woocommerce-exporter' )
90
+ );
91
+ */
92
+ $fields[] = array(
93
+ 'name' => 'order_subtotal_excl_tax',
94
+ 'label' => __( 'Order Subtotal Excl. Tax', 'woocommerce-exporter' )
95
+ );
96
+ /*
97
+ $fields[] = array(
98
+ 'name' => 'order_tax_rate',
99
+ 'label' => __( 'Order Tax Rate', 'woocommerce-exporter' )
100
+ );
101
+ */
102
+ $fields[] = array(
103
+ 'name' => 'order_sales_tax',
104
+ 'label' => __( 'Sales Tax Total', 'woocommerce-exporter' )
105
+ );
106
+ $fields[] = array(
107
+ 'name' => 'order_shipping_tax',
108
+ 'label' => __( 'Shipping Tax Total', 'woocommerce-exporter' )
109
+ );
110
+ $fields[] = array(
111
+ 'name' => 'shipping_incl_tax',
112
+ 'label' => __( 'Shipping Incl. Tax', 'woocommerce-exporter' )
113
+ );
114
+ $fields[] = array(
115
+ 'name' => 'shipping_excl_tax',
116
+ 'label' => __( 'Shipping Excl. Tax', 'woocommerce-exporter' )
117
+ );
118
+ $fields[] = array(
119
+ 'name' => 'refund_total',
120
+ 'label' => __( 'Refund Total', 'woocommerce-exporter' )
121
+ );
122
+ $fields[] = array(
123
+ 'name' => 'refund_date',
124
+ 'label' => __( 'Refund Date', 'woocommerce-exporter' )
125
+ );
126
+ $fields[] = array(
127
+ 'name' => 'order_tax_percentage',
128
+ 'label' => __( 'Order Tax Percentage', 'woocommerce-exporter' )
129
+ );
130
+ $fields[] = array(
131
+ 'name' => 'payment_gateway_id',
132
+ 'label' => __( 'Payment Gateway ID', 'woocommerce-exporter' )
133
+ );
134
+ $fields[] = array(
135
+ 'name' => 'payment_gateway',
136
+ 'label' => __( 'Payment Gateway', 'woocommerce-exporter' )
137
+ );
138
+ $fields[] = array(
139
+ 'name' => 'shipping_method_id',
140
+ 'label' => __( 'Shipping Method ID', 'woocommerce-exporter' )
141
+ );
142
+ $fields[] = array(
143
+ 'name' => 'shipping_method',
144
+ 'label' => __( 'Shipping Method', 'woocommerce-exporter' )
145
+ );
146
+ $fields[] = array(
147
+ 'name' => 'shipping_cost',
148
+ 'label' => __( 'Shipping Cost', 'woocommerce-exporter' )
149
+ );
150
+ $fields[] = array(
151
+ 'name' => 'shipping_weight',
152
+ 'label' => __( 'Shipping Weight', 'woocommerce-exporter' )
153
+ );
154
+ $fields[] = array(
155
+ 'name' => 'payment_status',
156
+ 'label' => __( 'Order Status', 'woocommerce-exporter' )
157
+ );
158
+ $fields[] = array(
159
+ 'name' => 'post_status',
160
+ 'label' => __( 'Post Status', 'woocommerce-exporter' )
161
+ );
162
+ $fields[] = array(
163
+ 'name' => 'order_key',
164
+ 'label' => __( 'Order Key', 'woocommerce-exporter' )
165
+ );
166
+ $fields[] = array(
167
+ 'name' => 'purchase_date',
168
+ 'label' => __( 'Order Date', 'woocommerce-exporter' )
169
+ );
170
+ $fields[] = array(
171
+ 'name' => 'purchase_time',
172
+ 'label' => __( 'Order Time', 'woocommerce-exporter' )
173
+ );
174
+ $fields[] = array(
175
+ 'name' => 'customer_message',
176
+ 'label' => __( 'Customer Message', 'woocommerce-exporter' )
177
+ );
178
+ $fields[] = array(
179
+ 'name' => 'customer_notes',
180
+ 'label' => __( 'Customer Notes', 'woocommerce-exporter' )
181
+ );
182
+ $fields[] = array(
183
+ 'name' => 'order_notes',
184
+ 'label' => __( 'Order Notes', 'woocommerce-exporter' )
185
+ );
186
+ $fields[] = array(
187
+ 'name' => 'total_quantity',
188
+ 'label' => __( 'Total Quantity', 'woocommerce-exporter' )
189
+ );
190
+ $fields[] = array(
191
+ 'name' => 'total_order_items',
192
+ 'label' => __( 'Total Order Items', 'woocommerce-exporter' )
193
+ );
194
+ $fields[] = array(
195
+ 'name' => 'user_id',
196
+ 'label' => __( 'User ID', 'woocommerce-exporter' )
197
+ );
198
+ $fields[] = array(
199
+ 'name' => 'user_name',
200
+ 'label' => __( 'Username', 'woocommerce-exporter' )
201
+ );
202
+ $fields[] = array(
203
+ 'name' => 'user_role',
204
+ 'label' => __( 'User Role', 'woocommerce-exporter' )
205
+ );
206
+ $fields[] = array(
207
+ 'name' => 'ip_address',
208
+ 'label' => __( 'Checkout IP Address', 'woocommerce-exporter' )
209
+ );
210
+ $fields[] = array(
211
+ 'name' => 'browser_agent',
212
+ 'label' => __( 'Checkout Browser Agent', 'woocommerce-exporter' )
213
+ );
214
+ $fields[] = array(
215
+ 'name' => 'has_downloads',
216
+ 'label' => __( 'Has Downloads', 'woocommerce-exporter' )
217
+ );
218
+ $fields[] = array(
219
+ 'name' => 'has_downloaded',
220
+ 'label' => __( 'Has Downloaded', 'woocommerce-exporter' )
221
+ );
222
+ $fields[] = array(
223
+ 'name' => 'billing_full_name',
224
+ 'label' => __( 'Billing: Full Name', 'woocommerce-exporter' )
225
+ );
226
+ $fields[] = array(
227
+ 'name' => 'billing_first_name',
228
+ 'label' => __( 'Billing: First Name', 'woocommerce-exporter' )
229
+ );
230
+ $fields[] = array(
231
+ 'name' => 'billing_last_name',
232
+ 'label' => __( 'Billing: Last Name', 'woocommerce-exporter' )
233
+ );
234
+ $fields[] = array(
235
+ 'name' => 'billing_company',
236
+ 'label' => __( 'Billing: Company', 'woocommerce-exporter' )
237
+ );
238
+ $fields[] = array(
239
+ 'name' => 'billing_address',
240
+ 'label' => __( 'Billing: Street Address (Full)', 'woocommerce-exporter' )
241
+ );
242
+ $fields[] = array(
243
+ 'name' => 'billing_address_1',
244
+ 'label' => __( 'Billing: Street Address 1', 'woocommerce-exporter' )
245
+ );
246
+ $fields[] = array(
247
+ 'name' => 'billing_address_2',
248
+ 'label' => __( 'Billing: Street Address 2', 'woocommerce-exporter' )
249
+ );
250
+ $fields[] = array(
251
+ 'name' => 'billing_city',
252
+ 'label' => __( 'Billing: City', 'woocommerce-exporter' )
253
+ );
254
+ $fields[] = array(
255
+ 'name' => 'billing_postcode',
256
+ 'label' => __( 'Billing: ZIP Code', 'woocommerce-exporter' )
257
+ );
258
+ $fields[] = array(
259
+ 'name' => 'billing_state',
260
+ 'label' => __( 'Billing: State (prefix)', 'woocommerce-exporter' )
261
+ );
262
+ $fields[] = array(
263
+ 'name' => 'billing_state_full',
264
+ 'label' => __( 'Billing: State', 'woocommerce-exporter' )
265
+ );
266
+ $fields[] = array(
267
+ 'name' => 'billing_country',
268
+ 'label' => __( 'Billing: Country (prefix)', 'woocommerce-exporter' )
269
+ );
270
+ $fields[] = array(
271
+ 'name' => 'billing_country_full',
272
+ 'label' => __( 'Billing: Country', 'woocommerce-exporter' )
273
+ );
274
+ $fields[] = array(
275
+ 'name' => 'billing_phone',
276
+ 'label' => __( 'Billing: Phone Number', 'woocommerce-exporter' )
277
+ );
278
+ $fields[] = array(
279
+ 'name' => 'billing_email',
280
+ 'label' => __( 'Billing: E-mail Address', 'woocommerce-exporter' )
281
+ );
282
+ $fields[] = array(
283
+ 'name' => 'shipping_full_name',
284
+ 'label' => __( 'Shipping: Full Name', 'woocommerce-exporter' )
285
+ );
286
+ $fields[] = array(
287
+ 'name' => 'shipping_first_name',
288
+ 'label' => __( 'Shipping: First Name', 'woocommerce-exporter' )
289
+ );
290
+ $fields[] = array(
291
+ 'name' => 'shipping_last_name',
292
+ 'label' => __( 'Shipping: Last Name', 'woocommerce-exporter' )
293
+ );
294
+ $fields[] = array(
295
+ 'name' => 'shipping_company',
296
+ 'label' => __( 'Shipping: Company', 'woocommerce-exporter' )
297
+ );
298
+ $fields[] = array(
299
+ 'name' => 'shipping_address',
300
+ 'label' => __( 'Shipping: Street Address (Full)', 'woocommerce-exporter' )
301
+ );
302
+ $fields[] = array(
303
+ 'name' => 'shipping_address_1',
304
+ 'label' => __( 'Shipping: Street Address 1', 'woocommerce-exporter' )
305
+ );
306
+ $fields[] = array(
307
+ 'name' => 'shipping_address_2',
308
+ 'label' => __( 'Shipping: Street Address 2', 'woocommerce-exporter' )
309
+ );
310
+ $fields[] = array(
311
+ 'name' => 'shipping_city',
312
+ 'label' => __( 'Shipping: City', 'woocommerce-exporter' )
313
+ );
314
+ $fields[] = array(
315
+ 'name' => 'shipping_postcode',
316
+ 'label' => __( 'Shipping: ZIP Code', 'woocommerce-exporter' )
317
+ );
318
+ $fields[] = array(
319
+ 'name' => 'shipping_state',
320
+ 'label' => __( 'Shipping: State (prefix)', 'woocommerce-exporter' )
321
+ );
322
+ $fields[] = array(
323
+ 'name' => 'shipping_state_full',
324
+ 'label' => __( 'Shipping: State', 'woocommerce-exporter' )
325
+ );
326
+ $fields[] = array(
327
+ 'name' => 'shipping_country',
328
+ 'label' => __( 'Shipping: Country (prefix)', 'woocommerce-exporter' )
329
+ );
330
+ $fields[] = array(
331
+ 'name' => 'shipping_country_full',
332
+ 'label' => __( 'Shipping: Country', 'woocommerce-exporter' )
333
+ );
334
+
335
+ /*
336
+ $fields[] = array(
337
+ 'name' => '',
338
+ 'label' => __( '', 'woocommerce-exporter' )
339
+ );
340
+ */
341
+
342
+ // Allow Plugin/Theme authors to add support for additional Order columns
343
+ $fields = apply_filters( sprintf( WOO_CE_PREFIX . '_%s_fields', $export_type ), $fields, $export_type );
344
+
345
+ $fields[] = array(
346
+ 'name' => 'order_items_id',
347
+ 'label' => __( 'Order Items: ID', 'woocommerce-exporter' )
348
+ );
349
+ $fields[] = array(
350
+ 'name' => 'order_items_product_id',
351
+ 'label' => __( 'Order Items: Product ID', 'woocommerce-exporter' )
352
+ );
353
+ $fields[] = array(
354
+ 'name' => 'order_items_variation_id',
355
+ 'label' => __( 'Order Items: Variation ID', 'woocommerce-exporter' )
356
+ );
357
+ $fields[] = array(
358
+ 'name' => 'order_items_sku',
359
+ 'label' => __( 'Order Items: SKU', 'woocommerce-exporter' )
360
+ );
361
+ $fields[] = array(
362
+ 'name' => 'order_items_name',
363
+ 'label' => __( 'Order Items: Product Name', 'woocommerce-exporter' )
364
+ );
365
+ $fields[] = array(
366
+ 'name' => 'order_items_variation',
367
+ 'label' => __( 'Order Items: Product Variation', 'woocommerce-exporter' )
368
+ );
369
+ $fields[] = array(
370
+ 'name' => 'order_items_image_embed',
371
+ 'label' => __( 'Order Items: Featured Image (Embed)', 'woocommerce-exporter' )
372
+ );
373
+ $fields[] = array(
374
+ 'name' => 'order_items_description',
375
+ 'label' => __( 'Order Items: Product Description', 'woocommerce-exporter' )
376
+ );
377
+ $fields[] = array(
378
+ 'name' => 'order_items_excerpt',
379
+ 'label' => __( 'Order Items: Product Excerpt', 'woocommerce-exporter' )
380
+ );
381
+ $fields[] = array(
382
+ 'name' => 'order_items_publish_date',
383
+ 'label' => __( 'Order Items: Publish Date', 'woocommerce-exporter' )
384
+ );
385
+ $fields[] = array(
386
+ 'name' => 'order_items_modified_date',
387
+ 'label' => __( 'Order Items: Modified Date', 'woocommerce-exporter' )
388
+ );
389
+ $fields[] = array(
390
+ 'name' => 'order_items_tax_class',
391
+ 'label' => __( 'Order Items: Tax Class', 'woocommerce-exporter' )
392
+ );
393
+ $fields[] = array(
394
+ 'name' => 'order_items_quantity',
395
+ 'label' => __( 'Order Items: Quantity', 'woocommerce-exporter' )
396
+ );
397
+ $fields[] = array(
398
+ 'name' => 'order_items_total',
399
+ 'label' => __( 'Order Items: Total', 'woocommerce-exporter' )
400
+ );
401
+ $fields[] = array(
402
+ 'name' => 'order_items_subtotal',
403
+ 'label' => __( 'Order Items: Subtotal', 'woocommerce-exporter' )
404
+ );
405
+ $fields[] = array(
406
+ 'name' => 'order_items_rrp',
407
+ 'label' => __( 'Order Items: RRP', 'woocommerce-exporter' )
408
+ );
409
+ $fields[] = array(
410
+ 'name' => 'order_items_stock',
411
+ 'label' => __( 'Order Items: Stock', 'woocommerce-exporter' )
412
+ );
413
+ $fields[] = array(
414
+ 'name' => 'order_items_tax',
415
+ 'label' => __( 'Order Items: Tax', 'woocommerce-exporter' )
416
+ );
417
+ $fields[] = array(
418
+ 'name' => 'order_items_tax_subtotal',
419
+ 'label' => __( 'Order Items: Tax Subtotal', 'woocommerce-exporter' )
420
+ );
421
+ // Order Item: Tax Rate - ...
422
+ $tax_rates = woo_ce_get_order_tax_rates();
423
+ if( !empty( $tax_rates ) ) {
424
+ foreach( $tax_rates as $tax_rate ) {
425
+ $fields[] = array(
426
+ 'name' => sprintf( 'order_items_tax_rate_%d', $tax_rate['rate_id'] ),
427
+ 'label' => sprintf( __( 'Order Items: Tax Rate - %s', 'woocommerce-exporter' ), $tax_rate['label'] )
428
+ );
429
+ }
430
+ }
431
+ unset( $tax_rates, $tax_rate );
432
+ $fields[] = array(
433
+ 'name' => 'order_items_refund_subtotal',
434
+ 'label' => __( 'Order Items: Refund Subtotal', 'woocommerce-exporter' )
435
+ );
436
+ $fields[] = array(
437
+ 'name' => 'order_items_refund_quantity',
438
+ 'label' => __( 'Order Items: Refund Quantity', 'woocommerce-exporter' )
439
+ );
440
+ $fields[] = array(
441
+ 'name' => 'order_items_type',
442
+ 'label' => __( 'Order Items: Type', 'woocommerce-exporter' )
443
+ );
444
+ $fields[] = array(
445
+ 'name' => 'order_items_type_id',
446
+ 'label' => __( 'Order Items: Type ID', 'woocommerce-exporter' )
447
+ );
448
+ $fields[] = array(
449
+ 'name' => 'order_items_category',
450
+ 'label' => __( 'Order Items: Category', 'woocommerce-exporter' )
451
+ );
452
+ $fields[] = array(
453
+ 'name' => 'order_items_tag',
454
+ 'label' => __( 'Order Items: Tag', 'woocommerce-exporter' )
455
+ );
456
+ $fields[] = array(
457
+ 'name' => 'order_items_total_sales',
458
+ 'label' => __( 'Order Items: Total Sales', 'woocommerce-exporter' )
459
+ );
460
+ $fields[] = array(
461
+ 'name' => 'order_items_weight',
462
+ 'label' => __( 'Order Items: Weight', 'woocommerce-exporter' )
463
+ );
464
+ $fields[] = array(
465
+ 'name' => 'order_items_height',
466
+ 'label' => __( 'Order Items: Height', 'woocommerce-exporter' )
467
+ );
468
+ $fields[] = array(
469
+ 'name' => 'order_items_width',
470
+ 'label' => __( 'Order Items: Width', 'woocommerce-exporter' )
471
+ );
472
+ $fields[] = array(
473
+ 'name' => 'order_items_length',
474
+ 'label' => __( 'Order Items: Length', 'woocommerce-exporter' )
475
+ );
476
+ $fields[] = array(
477
+ 'name' => 'order_items_total_weight',
478
+ 'label' => __( 'Order Items: Total Weight', 'woocommerce-exporter' )
479
+ );
480
+
481
+ // Allow Plugin/Theme authors to add support for additional Order Item columns
482
+ $fields = apply_filters( sprintf( WOO_CE_PREFIX . '_%s_fields', 'order_items' ), $fields, $export_type );
483
+
484
+ switch( $format ) {
485
+
486
+ case 'summary':
487
+ $output = array();
488
+ $size = count( $fields );
489
+ for( $i = 0; $i < $size; $i++ ) {
490
+ if( isset( $fields[$i] ) )
491
+ $output[$fields[$i]['name']] = 'on';
492
+ }
493
+ return $output;
494
+ break;
495
+
496
+ case 'full':
497
+ default:
498
+ // Load the default sorting
499
+ $sorting = woo_ce_get_option( sprintf( '%s_sorting', $export_type ), array() );
500
+ $size = count( $fields );
501
+ for( $i = 0; $i < $size; $i++ ) {
502
+ if( !isset( $fields[$i]['name'] ) ) {
503
+ unset( $fields[$i] );
504
+ continue;
505
+ }
506
+ $fields[$i]['reset'] = $i;
507
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
508
+ }
509
+ // Check if we are using PHP 5.3 and above
510
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
511
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
512
+ return $fields;
513
+ break;
514
+
515
+ }
516
+
517
+ }
518
+
519
+ // Check if we should override field labels from the Field Editor
520
+ function woo_ce_override_order_field_labels( $fields = array() ) {
521
+
522
+ $labels = woo_ce_get_option( 'order_labels', array() );
523
+ if( !empty( $labels ) ) {
524
+ foreach( $fields as $key => $field ) {
525
+ if( isset( $labels[$field['name']] ) )
526
+ $fields[$key]['label'] = $labels[$field['name']];
527
+ }
528
+ }
529
+ return $fields;
530
+
531
+ }
532
+ add_filter( 'woo_ce_order_fields', 'woo_ce_override_order_field_labels', 11 );
533
+ add_filter( 'woo_ce_order_items_fields', 'woo_ce_override_order_field_labels', 11 );
534
+
535
+ // Returns a list of WooCommerce Tax Rates based on existing Orders
536
+ function woo_ce_get_order_tax_rates( $order_id = 0 ) {
537
+
538
+ global $wpdb;
539
+
540
+ $order_item_type = 'tax';
541
+ $tax_rates_sql = $wpdb->prepare( "SELECT order_items.order_item_id as item_id FROM " . $wpdb->prefix . "woocommerce_order_items as order_items WHERE order_items.order_item_type = %s", $order_item_type );
542
+ if( !empty( $order_id ) ) {
543
+ $tax_rates_sql .= $wpdb->prepare( " AND order_items.order_id = %d", $order_id );
544
+ }
545
+ $tax_rates_sql .= " GROUP BY order_items.order_item_name";
546
+ $tax_rates = $wpdb->get_results( $tax_rates_sql, 'ARRAY_A' );
547
+ if( !empty( $tax_rates ) ) {
548
+ $meta_type = 'order_item';
549
+ foreach( $tax_rates as $key => $tax_rate ) {
550
+ $tax_rates[$key]['rate_id'] = get_metadata( $meta_type, $tax_rate['item_id'], 'rate_id', true );
551
+ $tax_rates[$key]['label'] = get_metadata( $meta_type, $tax_rate['item_id'], 'label', true );
552
+ }
553
+ return $tax_rates;
554
+ }
555
+
556
+ }
557
+
558
+ function woo_ce_get_gravity_forms_products() {
559
+
560
+ global $wpdb;
561
+
562
+ $meta_key = '_gravity_form_data';
563
+ $post_ids_sql = $wpdb->prepare( "SELECT `post_id`, `meta_value` FROM `$wpdb->postmeta` WHERE `meta_key` = %s GROUP BY `meta_value`", $meta_key );
564
+ return $wpdb->get_results( $post_ids_sql );
565
+
566
+ }
567
+
568
+ function woo_ce_get_gravity_form_fields() {
569
+
570
+ if( $gf_products = woo_ce_get_gravity_forms_products() ) {
571
+ $fields = array();
572
+ foreach( $gf_products as $gf_product ) {
573
+ if( $gf_product_data = maybe_unserialize( get_post_meta( $gf_product->post_id, '_gravity_form_data', true ) ) ) {
574
+ // Check the class and method for Gravity Forms exists
575
+ if( class_exists( 'RGFormsModel' ) && method_exists( 'RGFormsModel', 'get_form_meta' ) ) {
576
+ // Check the form exists
577
+ $gf_form_meta = RGFormsModel::get_form_meta( $gf_product_data['id'] );
578
+ if( !empty( $gf_form_meta ) ) {
579
+ // Check that the form has fields assigned to it
580
+ if( !empty( $gf_form_meta['fields'] ) ) {
581
+ foreach( $gf_form_meta['fields'] as $gf_form_field ) {
582
+ // Check for duplicate Gravity Form fields
583
+ $gf_form_field['formTitle'] = $gf_form_meta['title'];
584
+ // Do not include page and section breaks, hidden as exportable fields
585
+ if( !in_array( $gf_form_field['type'], array( 'page', 'section', 'hidden' ) ) )
586
+ $fields[] = $gf_form_field;
587
+ }
588
+ }
589
+ }
590
+ unset( $gf_form_meta );
591
+ }
592
+ }
593
+ }
594
+ return $fields;
595
+ }
596
+
597
+ }
598
+
599
+ function woo_ce_get_extra_product_option_fields() {
600
+
601
+ global $wpdb;
602
+
603
+ $meta_key = '_tmcartepo_data';
604
+ $tm_fields_sql = $wpdb->prepare( "SELECT order_itemmeta.`meta_value` FROM `" . $wpdb->prefix . "woocommerce_order_items` as order_items, `" . $wpdb->prefix . "woocommerce_order_itemmeta` as order_itemmeta WHERE order_items.`order_item_id` = order_itemmeta.`order_item_id` AND order_items.`order_item_type` = 'line_item' AND order_itemmeta.`meta_key` = %s", $meta_key );
605
+ $tm_fields = $wpdb->get_col( $tm_fields_sql );
606
+ if( !empty( $tm_fields ) ) {
607
+ $fields = array();
608
+ foreach( $tm_fields as $tm_field ) {
609
+ $tm_field = maybe_unserialize( $tm_field );
610
+ $size = count( $tm_field );
611
+ for( $i = 0; $i < $size; $i++ ) {
612
+ // Check that the name is set
613
+ if( !empty( $tm_field[$i]['name'] ) ) {
614
+ // Check if we haven't already set this
615
+ if( !array_key_exists( sanitize_key( $tm_field[$i]['name'] ), $fields ) )
616
+ $fields[sanitize_key( $tm_field[$i]['name'] )] = $tm_field[$i];
617
+ }
618
+ }
619
+ }
620
+ }
621
+ return $fields;
622
+
623
+ }
624
+
625
+ // Returns a list of WooCommerce Order statuses
626
+ function woo_ce_get_order_statuses() {
627
+
628
+ $terms = false;
629
+ // Check if this is a WooCommerce 2.2+ instance (new Post Status)
630
+ $woocommerce_version = woo_get_woo_version();
631
+ if( version_compare( $woocommerce_version, '2.2' ) >= 0 ) {
632
+ // Convert Order Status array into our magic sauce
633
+ $order_statuses = ( function_exists( 'wc_get_order_statuses' ) ? wc_get_order_statuses() : false );
634
+ if( !empty( $order_statuses ) ) {
635
+ $terms = array();
636
+ $post_type = 'shop_order';
637
+ $posts_count = wp_count_posts( $post_type );
638
+ foreach( $order_statuses as $key => $order_status ) {
639
+ $terms[] = (object)array(
640
+ 'name' => $order_status,
641
+ 'slug' => $key,
642
+ 'count' => ( isset( $posts_count->$key ) ? $posts_count->$key : 0 )
643
+ );
644
+ }
645
+ }
646
+ } else {
647
+ $args = array(
648
+ 'hide_empty' => false
649
+ );
650
+ $terms = get_terms( 'shop_order_status', $args );
651
+ if( empty( $terms ) || ( is_wp_error( $terms ) == true ) )
652
+ $terms = false;
653
+ }
654
+ return $terms;
655
+
656
+ }
657
+
658
+ // Returns a list of WooCommerce Order Item Types
659
+ function woo_ce_get_order_items_types() {
660
+
661
+ $order_item_types = array(
662
+ 'line_item' => __( 'Line Item', 'woocommerce-exporter' ),
663
+ 'coupon' => __( 'Coupon', 'woocommerce-exporter' ),
664
+ 'fee' => __( 'Fee', 'woocommerce-exporter' ),
665
+ 'tax' => __( 'Tax', 'woocommerce-exporter' ),
666
+ 'shipping' => __( 'Shipping', 'woocommerce-exporter' )
667
+ );
668
+
669
+ // Allow Plugin/Theme authors to add support for additional Order Item types
670
+ $order_item_types = apply_filters( 'woo_ce_order_item_types', $order_item_types );
671
+
672
+ return $order_item_types;
673
+
674
+ }
675
+ ?>
includes/orders.php DELETED
@@ -1,1187 +0,0 @@
1
- <?php
2
- if( is_admin() ) {
3
-
4
- /* Start of: WordPress Administration */
5
-
6
- // HTML template for disabled Filter Orders by Date widget on Store Exporter screen
7
- function woo_ce_orders_filter_by_date() {
8
-
9
- $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
10
- $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woo_ce' ) . '</a>', $woo_cd_url );
11
-
12
- $current_month = date( 'F' );
13
- $last_month = date( 'F', mktime( 0, 0, 0, date( 'n' )-1, 1, date( 'Y' ) ) );
14
- $order_dates_from = '-';
15
- $order_dates_to = '-';
16
-
17
- ob_start(); ?>
18
- <p><label><input type="checkbox" id="orders-filters-date" /> <?php _e( 'Filter Orders by Order Date', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></p>
19
- <div id="export-orders-filters-date" class="separator">
20
- <ul>
21
- <li>
22
- <label><input type="radio" name="order_dates_filter" value="current_month" disabled="disabled" /> <?php _e( 'Current month', 'woo_ce' ); ?> (<?php echo $current_month; ?>)</label>
23
- </li>
24
- <li>
25
- <label><input type="radio" name="order_dates_filter" value="last_month" disabled="disabled" /> <?php _e( 'Last month', 'woo_ce' ); ?> (<?php echo $last_month; ?>)</label>
26
- </li>
27
- <li>
28
- <label><input type="radio" name="order_dates_filter" value="last_quarter" disabled="disabled" /> <?php _e( 'Last quarter', 'woo_ce' ); ?> (Nov. - Jan.)</label>
29
- </li>
30
- <li>
31
- <label><input type="radio" name="order_dates_filter" value="manual" disabled="disabled" /> <?php _e( 'Manual', 'woo_ce' ); ?></label>
32
- <div style="margin-top:0.2em;">
33
- <input type="text" size="10" maxlength="10" id="order_dates_from" name="order_dates_from" value="<?php echo esc_attr( $order_dates_from ); ?>" class="text" disabled="disabled" /> to <input type="text" size="10" maxlength="10" id="order_dates_to" name="order_dates_to" value="<?php echo esc_attr( $order_dates_to ); ?>" class="text" disabled="disabled" />
34
- <p class="description"><?php _e( 'Filter the dates of Orders to be included in the export. Default is the date of the first order to today.', 'woo_ce' ); ?></p>
35
- </div>
36
- </li>
37
- </ul>
38
- </div>
39
- <!-- #export-orders-filters-date -->
40
- <?php
41
- ob_end_flush();
42
-
43
- }
44
-
45
- // HTML template for disabled Filter Orders by Customer widget on Store Exporter screen
46
- function woo_ce_orders_filter_by_customer() {
47
-
48
- $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
49
- $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woo_ce' ) . '</a>', $woo_cd_url );
50
-
51
- ob_start(); ?>
52
- <p><label><input type="checkbox" id="orders-filters-customer" /> <?php _e( 'Filter Orders by Customer', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></p>
53
- <div id="export-orders-filters-customer" class="separator">
54
- <select id="order_customer" name="order_customer" disabled="disabled">
55
- <option value=""><?php _e( 'Show all customers', 'woo_ce' ); ?></option>
56
- </select>
57
- <p class="description"><?php _e( 'Filter Orders by Customer (unique e-mail address) to be included in the export. Default is to include all Orders.', 'woo_ce' ); ?></p>
58
- </div>
59
- <!-- #export-orders-filters-customer -->
60
- <?php
61
- ob_end_flush();
62
-
63
- }
64
-
65
- // HTML template for disabled Filter Orders by User Role widget on Store Exporter screen
66
- function woo_ce_orders_filter_by_user_role() {
67
-
68
- $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
69
- $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woo_ce' ) . '</a>', $woo_cd_url );
70
-
71
- $user_roles = woo_ce_get_user_roles();
72
-
73
- ob_start(); ?>
74
- <p><label><input type="checkbox" id="orders-filters-user_role" /> <?php _e( 'Filter Orders by User Role', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></p>
75
- <div id="export-orders-filters-user_role" class="separator">
76
- <ul>
77
- <?php if( $user_roles ) { ?>
78
- <?php foreach( $user_roles as $key => $user_role ) { ?>
79
- <li><label><input type="checkbox" name="order_filter_user_role[<?php echo $key; ?>]" value="<?php echo $key; ?>" disabled="disabled" /> <?php echo ucfirst( $user_role['name'] ); ?></label></li>
80
- <?php } ?>
81
- <?php } else { ?>
82
- <li><?php _e( 'No User Roles were found.', 'woo_ce' ); ?></li>
83
- <?php } ?>
84
- </ul>
85
- <p class="description"><?php _e( 'Select the User Roles you want to filter exported Orders by. Default is to include all User Role options.', 'woo_ce' ); ?></p>
86
- </div>
87
- <!-- #export-orders-filters-user_role -->
88
- <?php
89
- ob_end_flush();
90
-
91
- }
92
-
93
- // HTML template for disabled Filter Orders by Coupon Code widget on Store Exporter screen
94
- function woo_ce_orders_filter_by_coupon() {
95
-
96
- $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
97
- $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woo_ce' ) . '</a>', $woo_cd_url );
98
-
99
- $args = array(
100
- 'coupon_orderby' => 'ID',
101
- 'coupon_order' => 'DESC'
102
- );
103
- $coupons = woo_ce_get_coupons( $args );
104
-
105
- ob_start(); ?>
106
- <p><label><input type="checkbox" id="orders-filters-coupon" /> <?php _e( 'Filter Orders by Coupon Code', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></p>
107
- <div id="export-orders-filters-coupon" class="separator">
108
- <ul>
109
- <?php foreach( $coupons as $key => $coupon ) { ?>
110
- <li><label><input type="checkbox" name="order_filter_coupon[<?php echo $key; ?>]" disabled="disabled" /> <?php echo get_the_title( $coupon ); ?></label></li>
111
- <?php } ?>
112
- </ul>
113
- <p class="description"><?php _e( 'Select the Coupon Codes you want to filter exported Orders by. Default is to include all Orders with and without assigned Coupon Codes.', 'woo_ce' ); ?></p>
114
- </div>
115
- <!-- #export-orders-filters-coupon -->
116
- <?php
117
- ob_end_flush();
118
-
119
- }
120
-
121
- // HTML template for disabled Order Items Formatting on Store Exporter screen
122
- function woo_ce_orders_items_formatting() {
123
-
124
- $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
125
- $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woo_ce' ) . '</a>', $woo_cd_url );
126
-
127
- ob_start(); ?>
128
- <tr class="export-options order-options">
129
- <th><label for="order_items"><?php _e( 'Order items formatting', 'woo_ce' ); ?></label></th>
130
- <td>
131
- <ul>
132
- <li>
133
- <label><input type="radio" name="order_items" value="combined" disabled="disabled" />&nbsp;<?php _e( 'Place Order Items within a grouped single Order row', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label>
134
- <p class="description"><?php _e( 'For example: <code>Order Items: SKU</code> cell might contain <code>SPECK-IPHONE|INCASE-NANO|-</code> for 3 Order items within an Order', 'woo_ce' ); ?></p>
135
- </li>
136
- <li>
137
- <label><input type="radio" name="order_items" value="unique" disabled="disabled" />&nbsp;<?php _e( 'Place Order Items on individual cells within a single Order row', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label>
138
- <p class="description"><?php _e( 'For example: <code>Order Items: SKU</code> would become <code>Order Item #1: SKU</code> with <codeSPECK-IPHONE</code> for the first Order item within an Order', 'woo_ce' ); ?></p>
139
- </li>
140
- <li>
141
- <label><input type="radio" name="order_items" value="individual" disabled="disabled" />&nbsp;<?php _e( 'Place each Order Item within their own Order row', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label>
142
- <p class="description"><?php _e( 'For example: An Order with 3 Order items will display a single Order item on each row', 'woo_ce' ); ?></p>
143
- </li>
144
- </ul>
145
- <p class="description"><?php _e( 'Choose how you would like Order Items to be presented within Orders.', 'woo_ce' ); ?></p>
146
- </td>
147
- </tr>
148
- <?php
149
- ob_end_flush();
150
-
151
- }
152
-
153
- // HTML template for disabled Max Order Items widget on Store Exporter screen
154
- function woo_ce_orders_max_order_items() {
155
-
156
- $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
157
- $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woo_ce' ) . '</a>', $woo_cd_url );
158
-
159
- $max_size = 10;
160
-
161
- ob_start(); ?>
162
- <tr id="max_order_items_option" class="export-options order-options">
163
- <th>
164
- <label for="max_order_items"><?php _e( 'Max unique Order items', 'woo_ce' ); ?>: </label>
165
- </th>
166
- <td>
167
- <input type="text" id="max_order_items" name="max_order_items" size="3" class="text" value="<?php echo esc_attr( $max_size ); ?>" disabled="disabled" /><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
168
- <p class="description"><?php _e( 'Manage the number of Order Item colums displayed when the \'Place Order Items on individual cells within a single Order row\' Order items formatting option is selected.', 'woo_ce' ); ?></p>
169
- </td>
170
- </tr>
171
- <?php
172
- ob_end_flush();
173
-
174
- }
175
-
176
- // HTML template for disabled Order Items Types on Store Exporter screen
177
- function woo_ce_orders_items_types() {
178
-
179
- $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
180
- $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woo_ce' ) . '</a>', $woo_cd_url );
181
-
182
- $types = woo_ce_get_order_items_types();
183
- $order_items_types = woo_ce_get_option( 'order_items_types', array() );
184
-
185
- ob_start(); ?>
186
- <tr class="export-options order-options">
187
- <th><label><?php _e( 'Order items types', 'woo_ce' ); ?></label></th>
188
- <td>
189
- <ul>
190
- <?php foreach( $types as $key => $type ) { ?>
191
- <li><label><input type="checkbox" name="order_filter_order_item_types[<?php echo $key; ?>]" value="<?php echo $key; ?>" disabled="disabled" /> <?php echo ucfirst( $type ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></li>
192
- <?php } ?>
193
- </ul>
194
- <p class="description"><?php _e( 'Choose what Order Item types are included within the Orders export. Default is to include all Order Item types.', 'woo_ce' ); ?></p>
195
- </td>
196
- </tr>
197
- <?php
198
- ob_end_flush();
199
-
200
- }
201
-
202
- // HTML template for disabled Filter Orders by Order Status widget on Store Exporter screen
203
- function woo_ce_orders_filter_by_status() {
204
-
205
- $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
206
- $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woo_ce' ) . '</a>', $woo_cd_url );
207
-
208
- $order_statuses = woo_ce_get_order_statuses();
209
-
210
- ob_start(); ?>
211
- <p><label><input type="checkbox" id="orders-filters-status" /> <?php _e( 'Filter Orders by Order Status', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></p>
212
- <div id="export-orders-filters-status" class="separator">
213
- <ul>
214
- <?php if( $order_statuses ) { ?>
215
- <?php foreach( $order_statuses as $order_status ) { ?>
216
- <li>
217
- <label><input type="checkbox" name="order_filter_status[<?php echo $order_status->slug; ?>]" value="<?php echo $order_status->slug; ?>" disabled="disabled" /> <?php echo ucfirst( $order_status->name ); ?></label>
218
- <span class="description">(<?php echo $order_status->count; ?>)</span>
219
- </li>
220
- <?php } ?>
221
- <?php } else { ?>
222
- <li><?php _e( 'No Order Status\'s were found.', 'woo_ce' ); ?></li>
223
- <?php } ?>
224
- </ul>
225
- <p class="description"><?php _e( 'Select the Order Status you want to filter exported Orders by. Default is to include all Order Status options.', 'woo_ce' ); ?></p>
226
- </div>
227
- <!-- #export-orders-filters-status -->
228
- <?php
229
- ob_end_flush();
230
-
231
- }
232
-
233
- // HTML template for disabled Filter Orders by Product Category widget on Store Exporter screen
234
- function woo_ce_orders_filter_by_product_category() {
235
-
236
- $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
237
- $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woo_ce' ) . '</a>', $woo_cd_url );
238
-
239
- $args = array(
240
- 'hide_empty' => 1
241
- );
242
- $product_categories = woo_ce_get_product_categories( $args );
243
-
244
- ob_start(); ?>
245
- <p><label><input type="checkbox" id="orders-filters-category" /> <?php _e( 'Filter Orders by Product Category', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></p>
246
- <div id="export-orders-filters-category" class="separator">
247
- <ul>
248
- <?php if( $product_categories ) { ?>
249
- <?php foreach( $product_categories as $product_category ) { ?>
250
- <li>
251
- <label><input type="checkbox" name="order_filter_category[<?php echo $product_category->name; ?>]" value="<?php echo $product_category->term_id; ?>" title="<?php printf( __( 'Term ID: %d', 'woo_ce' ), $product_category->term_id ); ?>" disabled="disabled" /> <?php echo woo_ce_format_product_category_label( $product_category->name, $product_category->parent_name ); ?></label>
252
- </li>
253
- <?php } ?>
254
- <?php } else { ?>
255
- <li><?php _e( 'No Product Categories were found.', 'woo_ce' ); ?></li>
256
- <?php } ?>
257
- </ul>
258
- <p class="description"><?php _e( 'Select the Product Categories you want to filter exported Orders by. Default is to include all Product Categories.', 'woo_ce' ); ?></p>
259
- </div>
260
- <!-- #export-orders-filters-category -->
261
- <?php
262
- ob_end_flush();
263
-
264
- }
265
-
266
- // HTML template for disabled Filter Orders by Product Tag widget on Store Exporter screen
267
- function woo_ce_orders_filter_by_product_tag() {
268
-
269
- $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
270
- $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woo_ce' ) . '</a>', $woo_cd_url );
271
-
272
- $args = array(
273
- 'hide_empty' => 1
274
- );
275
- $product_tags = woo_ce_get_product_tags( $args );
276
-
277
- ob_start(); ?>
278
- <p><label><input type="checkbox" id="orders-filters-tag" /> <?php _e( 'Filter Orders by Product Tag', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></p>
279
- <div id="export-orders-filters-tag" class="separator">
280
- <ul>
281
- <?php if( $product_tags ) { ?>
282
- <?php foreach( $product_tags as $product_tag ) { ?>
283
- <li>
284
- <label><input type="checkbox" name="order_filter_tag[<?php echo $product_tag->name; ?>]" value="<?php echo $product_tag->name; ?>" title="<?php printf( __( 'Term ID: %d', 'woo_ce' ), $product_tag->term_id ); ?>" disabled="disabled" /> <?php echo $product_tag->name; ?></label>
285
- <span class="description">(<?php echo $product_tag->count; ?>)</span>
286
- </li>
287
- <?php } ?>
288
- <?php } else { ?>
289
- <li><?php _e( 'No Product Tags have been found.', 'jigo_ce' ); ?></li>
290
- <?php } ?>
291
- </ul>
292
- <p class="description"><?php _e( 'Select the Product Tags you want to filter exported Orders by. Default is to include all Product Tags.', 'woo_ce' ); ?></p>
293
- </div>
294
- <!-- #export-orders-filters-tag -->
295
- <?php
296
- ob_end_flush();
297
-
298
- }
299
-
300
- // HTML template for disabled Order Sorting widget on Store Exporter screen
301
- function woo_ce_orders_order_sorting() {
302
-
303
- ob_start(); ?>
304
- <p><label><?php _e( 'Order Sorting', 'woo_ce' ); ?></label></p>
305
- <div>
306
- <select name="order_orderby" disabled="disabled">
307
- <option value="ID"><?php _e( 'Order ID', 'woo_ce' ); ?></option>
308
- <option value="title"><?php _e( 'Order Name', 'woo_ce' ); ?></option>
309
- <option value="date"><?php _e( 'Date Created', 'woo_ce' ); ?></option>
310
- <option value="modified"><?php _e( 'Date Modified', 'woo_ce' ); ?></option>
311
- <option value="rand"><?php _e( 'Random', 'woo_ce' ); ?></option>
312
- </select>
313
- <select name="order_order" disabled="disabled">
314
- <option value="ASC"><?php _e( 'Ascending', 'woo_ce' ); ?></option>
315
- <option value="DESC"><?php _e( 'Descending', 'woo_ce' ); ?></option>
316
- </select>
317
- <p class="description"><?php _e( 'Select the sorting of Orders within the exported file. By default this is set to export Orders by Order ID in Desending order.', 'woo_ce' ); ?></p>
318
- </div>
319
- <?php
320
- ob_end_flush();
321
-
322
- }
323
-
324
- // HTML template for disabled Custom Orders widget on Store Exporter screen
325
- function woo_ce_orders_custom_fields() {
326
-
327
- $custom_orders = '-';
328
- $custom_order_items = '-';
329
-
330
- $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/';
331
-
332
- ob_start(); ?>
333
- <form method="post" id="export-orders-custom-fields" class="export-options order-options">
334
- <div id="poststuff">
335
-
336
- <div class="postbox" id="export-options">
337
- <h3 class="hndle"><?php _e( 'Custom Order Fields', 'woo_ce' ); ?></h3>
338
- <div class="inside">
339
- <p class="description"><?php _e( 'To include additional custom Order and Order Item meta in the Export Orders table above fill the Orders and Order Items text box then click Save Custom Fields.', 'woo_ce' ); ?></p>
340
- <table class="form-table">
341
-
342
- <tr>
343
- <th>
344
- <label><?php _e( 'Order meta', 'woo_ce' ); ?></label>
345
- </th>
346
- <td>
347
- <textarea name="custom_orders" rows="5" cols="70" disabled="disabled"><?php echo esc_textarea( $custom_orders ); ?></textarea>
348
- <p class="description"><?php _e( 'Include additional custom Order meta in your export file by adding each custom Order meta name to a new line above.<br />For example: <code>Customer UA, Customer IP Address</code>', 'woo_ce' ); ?></p>
349
- </td>
350
- </tr>
351
-
352
- <tr>
353
- <th>
354
- <label><?php _e( 'Order Item meta', 'woo_ce' ); ?></label>
355
- </th>
356
- <td>
357
- <textarea name="custom_order_items" rows="5" cols="70" disabled="disabled"><?php echo esc_textarea( $custom_order_items ); ?></textarea>
358
- <p class="description"><?php _e( 'Include additional custom Order Item meta in your export file by adding each custom Order Item meta name to a new line above.<br />For example: <code>Personalized Message</code>.', 'woo_ce' ); ?></p>
359
- </td>
360
- </tr>
361
-
362
- </table>
363
- <p class="submit">
364
- <input type="submit" value="<?php _e( 'Save Custom Fields', 'woo_ce' ); ?>" class="button-primary" />
365
- </p>
366
- <p class="description"><?php printf( __( 'For more information on custom Order and Order Item meta consult our <a href="%s" target="_blank">online documentation</a>.', 'woo_ce' ), $troubleshooting_url ); ?></p>
367
- </div>
368
- <!-- .inside -->
369
- </div>
370
- <!-- .postbox -->
371
-
372
- </div>
373
- <!-- #poststuff -->
374
- <input type="hidden" name="action" value="update" />
375
- </form>
376
- <!-- #export-orders-custom-fields -->
377
- <?php
378
- ob_end_flush();
379
-
380
- }
381
-
382
- /* End of: WordPress Administration */
383
-
384
- }
385
-
386
- // Returns a list of Order export columns
387
- function woo_ce_get_order_fields( $format = 'full' ) {
388
-
389
- $export_type = 'order';
390
-
391
- $fields = array();
392
- $fields[] = array(
393
- 'name' => 'purchase_id',
394
- 'label' => __( 'Purchase ID', 'woo_ce' )
395
- );
396
- $fields[] = array(
397
- 'name' => 'purchase_total',
398
- 'label' => __( 'Order Total', 'woo_ce' )
399
- );
400
- $fields[] = array(
401
- 'name' => 'order_discount',
402
- 'label' => __( 'Order Discount', 'woo_ce' )
403
- );
404
- $fields[] = array(
405
- 'name' => 'coupon_code',
406
- 'label' => __( 'Coupon Code', 'woo_ce' )
407
- );
408
- /*
409
- $fields[] = array(
410
- 'name' => 'order_incl_tax',
411
- 'label' => __( 'Order Incl. Tax', 'woo_ce' )
412
- );
413
- */
414
- $fields[] = array(
415
- 'name' => 'order_excl_tax',
416
- 'label' => __( 'Order Excl. Tax', 'woo_ce' )
417
- );
418
- /*
419
- $fields[] = array(
420
- 'name' => 'order_tax_rate',
421
- 'label' => __( 'Order Tax Rate', 'woo_ce' )
422
- );
423
- */
424
- $fields[] = array(
425
- 'name' => 'order_sales_tax',
426
- 'label' => __( 'Sales Tax Total', 'woo_ce' )
427
- );
428
- $fields[] = array(
429
- 'name' => 'order_shipping_tax',
430
- 'label' => __( 'Shipping Tax Total', 'woo_ce' )
431
- );
432
- $fields[] = array(
433
- 'name' => 'payment_gateway_id',
434
- 'label' => __( 'Payment Gateway ID', 'woo_ce' )
435
- );
436
- $fields[] = array(
437
- 'name' => 'payment_gateway',
438
- 'label' => __( 'Payment Gateway', 'woo_ce' )
439
- );
440
- $fields[] = array(
441
- 'name' => 'shipping_method_id',
442
- 'label' => __( 'Shipping Method ID', 'woo_ce' )
443
- );
444
- $fields[] = array(
445
- 'name' => 'shipping_method',
446
- 'label' => __( 'Shipping Method', 'woo_ce' )
447
- );
448
- $fields[] = array(
449
- 'name' => 'shipping_cost',
450
- 'label' => __( 'Shipping Cost', 'woo_ce' )
451
- );
452
- $fields[] = array(
453
- 'name' => 'shipping_weight',
454
- 'label' => __( 'Shipping Weight', 'woo_ce' )
455
- );
456
- $fields[] = array(
457
- 'name' => 'payment_status',
458
- 'label' => __( 'Order Status', 'woo_ce' )
459
- );
460
- $fields[] = array(
461
- 'name' => 'post_status',
462
- 'label' => __( 'Post Status', 'woo_ce' )
463
- );
464
- $fields[] = array(
465
- 'name' => 'order_key',
466
- 'label' => __( 'Order Key', 'woo_ce' )
467
- );
468
- $fields[] = array(
469
- 'name' => 'purchase_date',
470
- 'label' => __( 'Purchase Date', 'woo_ce' )
471
- );
472
- $fields[] = array(
473
- 'name' => 'purchase_time',
474
- 'label' => __( 'Purchase Time', 'woo_ce' )
475
- );
476
- $fields[] = array(
477
- 'name' => 'customer_message',
478
- 'label' => __( 'Customer Message', 'woo_ce' )
479
- );
480
- $fields[] = array(
481
- 'name' => 'customer_note',
482
- 'label' => __( 'Customer Note', 'woo_ce' )
483
- );
484
- $fields[] = array(
485
- 'name' => 'order_notes',
486
- 'label' => __( 'Order Notes', 'woo_ce' )
487
- );
488
- $fields[] = array(
489
- 'name' => 'user_id',
490
- 'label' => __( 'User ID', 'woo_ce' )
491
- );
492
- $fields[] = array(
493
- 'name' => 'user_name',
494
- 'label' => __( 'Username', 'woo_ce' )
495
- );
496
- $fields[] = array(
497
- 'name' => 'user_role',
498
- 'label' => __( 'User Role', 'woo_ce' )
499
- );
500
- $fields[] = array(
501
- 'name' => 'ip_address',
502
- 'label' => __( 'Checkout IP Address', 'woo_ce' )
503
- );
504
- $fields[] = array(
505
- 'name' => 'browser_agent',
506
- 'label' => __( 'Checkout Browser Agent', 'woo_ce' )
507
- );
508
- $fields[] = array(
509
- 'name' => 'billing_full_name',
510
- 'label' => __( 'Billing: Full Name', 'woo_ce' )
511
- );
512
- $fields[] = array(
513
- 'name' => 'billing_first_name',
514
- 'label' => __( 'Billing: First Name', 'woo_ce' )
515
- );
516
- $fields[] = array(
517
- 'name' => 'billing_last_name',
518
- 'label' => __( 'Billing: Last Name', 'woo_ce' )
519
- );
520
- $fields[] = array(
521
- 'name' => 'billing_company',
522
- 'label' => __( 'Billing: Company', 'woo_ce' )
523
- );
524
- $fields[] = array(
525
- 'name' => 'billing_address',
526
- 'label' => __( 'Billing: Street Address (Full)', 'woo_ce' )
527
- );
528
- $fields[] = array(
529
- 'name' => 'billing_address_1',
530
- 'label' => __( 'Billing: Street Address 1', 'woo_ce' )
531
- );
532
- $fields[] = array(
533
- 'name' => 'billing_address_2',
534
- 'label' => __( 'Billing: Street Address 2', 'woo_ce' )
535
- );
536
- $fields[] = array(
537
- 'name' => 'billing_city',
538
- 'label' => __( 'Billing: City', 'woo_ce' )
539
- );
540
- $fields[] = array(
541
- 'name' => 'billing_postcode',
542
- 'label' => __( 'Billing: ZIP Code', 'woo_ce' )
543
- );
544
- $fields[] = array(
545
- 'name' => 'billing_state',
546
- 'label' => __( 'Billing: State (prefix)', 'woo_ce' )
547
- );
548
- $fields[] = array(
549
- 'name' => 'billing_state_full',
550
- 'label' => __( 'Billing: State', 'woo_ce' )
551
- );
552
- $fields[] = array(
553
- 'name' => 'billing_country',
554
- 'label' => __( 'Billing: Country (prefix)', 'woo_ce' )
555
- );
556
- $fields[] = array(
557
- 'name' => 'billing_country_full',
558
- 'label' => __( 'Billing: Country', 'woo_ce' )
559
- );
560
- $fields[] = array(
561
- 'name' => 'billing_phone',
562
- 'label' => __( 'Billing: Phone Number', 'woo_ce' )
563
- );
564
- $fields[] = array(
565
- 'name' => 'billing_email',
566
- 'label' => __( 'Billing: E-mail Address', 'woo_ce' )
567
- );
568
- $fields[] = array(
569
- 'name' => 'shipping_full_name',
570
- 'label' => __( 'Shipping: Full Name', 'woo_ce' )
571
- );
572
- $fields[] = array(
573
- 'name' => 'shipping_first_name',
574
- 'label' => __( 'Shipping: First Name', 'woo_ce' )
575
- );
576
- $fields[] = array(
577
- 'name' => 'shipping_last_name',
578
- 'label' => __( 'Shipping: Last Name', 'woo_ce' )
579
- );
580
- $fields[] = array(
581
- 'name' => 'shipping_company',
582
- 'label' => __( 'Shipping: Company', 'woo_ce' )
583
- );
584
- $fields[] = array(
585
- 'name' => 'shipping_address',
586
- 'label' => __( 'Shipping: Street Address (Full)', 'woo_ce' )
587
- );
588
- $fields[] = array(
589
- 'name' => 'shipping_address_1',
590
- 'label' => __( 'Shipping: Street Address 1', 'woo_ce' )
591
- );
592
- $fields[] = array(
593
- 'name' => 'shipping_address_2',
594
- 'label' => __( 'Shipping: Street Address 2', 'woo_ce' )
595
- );
596
- $fields[] = array(
597
- 'name' => 'shipping_city',
598
- 'label' => __( 'Shipping: City', 'woo_ce' )
599
- );
600
- $fields[] = array(
601
- 'name' => 'shipping_postcode',
602
- 'label' => __( 'Shipping: ZIP Code', 'woo_ce' )
603
- );
604
- $fields[] = array(
605
- 'name' => 'shipping_state',
606
- 'label' => __( 'Shipping: State (prefix)', 'woo_ce' )
607
- );
608
- $fields[] = array(
609
- 'name' => 'shipping_state_full',
610
- 'label' => __( 'Shipping: State', 'woo_ce' )
611
- );
612
- $fields[] = array(
613
- 'name' => 'shipping_country',
614
- 'label' => __( 'Shipping: Country (prefix)', 'woo_ce' )
615
- );
616
- $fields[] = array(
617
- 'name' => 'shipping_country_full',
618
- 'label' => __( 'Shipping: Country', 'woo_ce' )
619
- );
620
- $fields[] = array(
621
- 'name' => 'order_items_product_id',
622
- 'label' => __( 'Order Items: Product ID', 'woo_ce' )
623
- );
624
- $fields[] = array(
625
- 'name' => 'order_items_variation_id',
626
- 'label' => __( 'Order Items: Variation ID', 'woo_ce' )
627
- );
628
- $fields[] = array(
629
- 'name' => 'order_items_sku',
630
- 'label' => __( 'Order Items: SKU', 'woo_ce' )
631
- );
632
- $fields[] = array(
633
- 'name' => 'order_items_name',
634
- 'label' => __( 'Order Items: Product Name', 'woo_ce' )
635
- );
636
- $fields[] = array(
637
- 'name' => 'order_items_variation',
638
- 'label' => __( 'Order Items: Product Variation', 'woo_ce' )
639
- );
640
- $fields[] = array(
641
- 'name' => 'order_items_tax_class',
642
- 'label' => __( 'Order Items: Tax Class', 'woo_ce' )
643
- );
644
- $fields[] = array(
645
- 'name' => 'order_items_quantity',
646
- 'label' => __( 'Order Items: Quantity', 'woo_ce' )
647
- );
648
- $fields[] = array(
649
- 'name' => 'order_items_total',
650
- 'label' => __( 'Order Items: Total', 'woo_ce' )
651
- );
652
- $fields[] = array(
653
- 'name' => 'order_items_subtotal',
654
- 'label' => __( 'Order Items: Subtotal', 'woo_ce' )
655
- );
656
- $fields[] = array(
657
- 'name' => 'order_items_tax',
658
- 'label' => __( 'Order Items: Tax', 'woo_ce' )
659
- );
660
- $fields[] = array(
661
- 'name' => 'order_items_tax_subtotal',
662
- 'label' => __( 'Order Items: Tax Subtotal', 'woo_ce' )
663
- );
664
- $fields[] = array(
665
- 'name' => 'order_items_type',
666
- 'label' => __( 'Order Items: Type', 'woo_ce' )
667
- );
668
- $fields[] = array(
669
- 'name' => 'order_items_category',
670
- 'label' => __( 'Order Items: Category', 'woo_ce' )
671
- );
672
- $fields[] = array(
673
- 'name' => 'order_items_tag',
674
- 'label' => __( 'Order Items: Tag', 'woo_ce' )
675
- );
676
- $fields[] = array(
677
- 'name' => 'order_items_weight',
678
- 'label' => __( 'Order Items: Weight', 'woo_ce' )
679
- );
680
- $fields[] = array(
681
- 'name' => 'order_items_total_weight',
682
- 'label' => __( 'Order Items: Total Weight', 'woo_ce' )
683
- );
684
- $fields[] = array(
685
- 'name' => 'order_items_stock',
686
- 'label' => __( 'Order Items: Stock', 'woo_ce' )
687
- );
688
-
689
- /*
690
- $fields[] = array(
691
- 'name' => '',
692
- 'label' => __( '', 'woo_ce' )
693
- );
694
- */
695
-
696
- // Allow Plugin/Theme authors to add support for additional columns
697
- $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
698
-
699
- switch( $format ) {
700
-
701
- case 'summary':
702
- $output = array();
703
- $size = count( $fields );
704
- for( $i = 0; $i < $size; $i++ ) {
705
- if( isset( $fields[$i] ) )
706
- $output[$fields[$i]['name']] = 'on';
707
- }
708
- return $output;
709
- break;
710
-
711
- case 'full':
712
- default:
713
- $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
714
- $size = count( $fields );
715
- for( $i = 0; $i < $size; $i++ )
716
- $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
717
- usort( $fields, woo_ce_sort_fields( 'order' ) );
718
- return $fields;
719
- break;
720
-
721
- }
722
-
723
- }
724
-
725
- function woo_ce_override_order_field_labels( $fields = array() ) {
726
-
727
- $labels = woo_ce_get_option( 'order_labels', array() );
728
- if( !empty( $labels ) ) {
729
- foreach( $fields as $key => $field ) {
730
- if( isset( $labels[$field['name']] ) )
731
- $fields[$key]['label'] = $labels[$field['name']];
732
- }
733
- }
734
- return $fields;
735
-
736
- }
737
- add_filter( 'woo_ce_order_fields', 'woo_ce_override_order_field_labels', 11 );
738
-
739
- // Adds custom Order and Order Item columns to the Order fields list
740
- function woo_ce_extend_order_fields( $fields = array() ) {
741
-
742
- // Product Addons - http://www.woothemes.com/
743
- if( class_exists( 'Product_Addon_Admin' ) || class_exists( 'Product_Addon_Display' ) ) {
744
- $product_addons = woo_ce_get_product_addons();
745
- if( !empty( $product_addons ) ) {
746
- foreach( $product_addons as $product_addon ) {
747
- if( !empty( $product_addon ) ) {
748
- $fields[] = array(
749
- 'name' => sprintf( 'order_items_product_addon_%s', $product_addon->post_name ),
750
- 'label' => sprintf( __( 'Order Items: %s', 'woo_ce' ), ucfirst( $product_addon->post_title ) )
751
- );
752
- }
753
- }
754
- }
755
- unset( $product_addons, $product_addon );
756
- }
757
-
758
- // WooCommerce Sequential Order Numbers - http://www.skyverge.com/blog/woocommerce-sequential-order-numbers/
759
- // Sequential Order Numbers Pro - http://www.woothemes.com/products/sequential-order-numbers-pro/
760
- if( class_exists( 'WC_Seq_Order_Number' ) || class_exists( 'WC_Seq_Order_Number_Pro' ) ) {
761
- $fields[] = array(
762
- 'name' => 'order_number',
763
- 'label' => __( 'Order Number', 'woo_ce' )
764
- );
765
- }
766
-
767
- // WooCommerce Print Invoice & Delivery Note - https://wordpress.org/plugins/woocommerce-delivery-notes/
768
- if( class_exists( 'WooCommerce_Delivery_Notes' ) ) {
769
- $fields[] = array(
770
- 'name' => 'invoice_number',
771
- 'label' => __( 'Invoice Number', 'woo_ce' )
772
- );
773
- $fields[] = array(
774
- 'name' => 'invoice_date',
775
- 'label' => __( 'Invoice Date', 'woo_ce' )
776
- );
777
- }
778
-
779
- // WooCommerce PDF Invoices & Packing Slips - http://www.wpovernight.com
780
- if( class_exists( 'WooCommerce_PDF_Invoices' ) ) {
781
- $fields[] = array(
782
- 'name' => 'pdf_invoice_number',
783
- 'label' => __( 'PDF Invoice Number', 'woo_ce' )
784
- );
785
- $fields[] = array(
786
- 'name' => 'pdf_invoice_date',
787
- 'label' => __( 'PDF Invoice Date', 'woo_ce' )
788
- );
789
- }
790
-
791
- // WooCommerce Checkout Manager - http://wordpress.org/plugins/woocommerce-checkout-manager/
792
- // WooCommerce Checkout Manager Pro - http://www.trottyzone.com/product/woocommerce-checkout-manager-pro
793
- if( function_exists( 'wccs_install' ) ) {
794
- $options = get_option( 'wccs_settings' );
795
- if( isset( $options['buttons'] ) ) {
796
- $buttons = $options['buttons'];
797
- if( !empty( $buttons ) ) {
798
- foreach( $buttons as $button ) {
799
- $fields[] = array(
800
- 'name' => $button['label'],
801
- 'label' => ucfirst( $button['label'] )
802
- );
803
- }
804
- unset( $buttons, $button );
805
- }
806
- }
807
- unset( $options );
808
- }
809
-
810
- // Poor Guys Swiss Knife - http://wordpress.org/plugins/woocommerce-poor-guys-swiss-knife/
811
- if( function_exists( 'wcpgsk_init' ) ) {
812
- $options = get_option( 'wcpgsk_settings' );
813
- $billing_fields = ( isset( $options['woofields']['billing'] ) ? $options['woofields']['billing'] : array() );
814
- $shipping_fields = ( isset( $options['woofields']['shipping'] ) ? $options['woofields']['shipping'] : array() );
815
-
816
- // Custom billing fields
817
- if( !empty( $billing_fields ) ) {
818
- foreach( $billing_fields as $key => $billing_field ) {
819
- $fields[] = array(
820
- 'name' => $key,
821
- 'label' => $options['woofields']['label_' . $key]
822
- );
823
- }
824
- unset( $billing_fields, $billing_field );
825
- }
826
-
827
- // Custom shipping fields
828
- if( !empty( $shipping_fields ) ) {
829
- foreach( $shipping_fields as $key => $shipping_field ) {
830
- $fields[] = array(
831
- 'name' => $key,
832
- 'label' => $options['woofields']['label_' . $key]
833
- );
834
- }
835
- unset( $shipping_fields, $shipping_field );
836
- }
837
-
838
- unset( $options );
839
- }
840
-
841
- // Checkout Field Editor - http://woothemes.com/woocommerce/
842
- if( function_exists( 'woocommerce_init_checkout_field_editor' ) ) {
843
- $billing_fields = get_option( 'wc_fields_billing', array() );
844
- $shipping_fields = get_option( 'wc_fields_shipping', array() );
845
- $custom_fields = get_option( 'wc_fields_additional', array() );
846
-
847
- // Custom billing fields
848
- if( !empty( $billing_fields ) ) {
849
- foreach( $billing_fields as $key => $billing_field ) {
850
- // Only add non-default Checkout fields to export columns list
851
- if( $billing_field['custom'] == 1 ) {
852
- $fields[] = array(
853
- 'name' => sprintf( 'wc_billing_%s', $key ),
854
- 'label' => sprintf( __( 'Billing: %s', 'woo_ce' ), ucfirst( $billing_field['label'] ) )
855
- );
856
- }
857
- }
858
- }
859
- unset( $billing_fields, $billing_field );
860
-
861
- // Custom shipping fields
862
- if( !empty( $shipping_fields ) ) {
863
- foreach( $shipping_fields as $key => $shipping_field ) {
864
- // Only add non-default Checkout fields to export columns list
865
- if( $shipping_field['custom'] == 1 ) {
866
- $fields[] = array(
867
- 'name' => sprintf( 'wc_shipping_%s', $key ),
868
- 'label' => sprintf( __( 'Shipping: %s', 'woo_ce' ), ucfirst( $shipping_field['label'] ) )
869
- );
870
- }
871
- }
872
- }
873
- unset( $shipping_fields, $shipping_field );
874
-
875
- // Custom fields
876
- if( !empty( $custom_fields ) ) {
877
- foreach( $custom_fields as $key => $custom_field ) {
878
- // Only add non-default Checkout fields to export columns list
879
- if( $billing_field['custom'] == 1 ) {
880
- $fields[] = array(
881
- 'name' => sprintf( 'wc_additional_%s', $key ),
882
- 'label' => sprintf( __( 'Additional: %s', 'woo_ce' ), ucfirst( $custom_field['label'] ) )
883
- );
884
- }
885
- }
886
- }
887
- unset( $custom_fields, $custom_field );
888
- }
889
-
890
- // Checkout Field Manager - http://61extensions.com
891
- if( function_exists( 'sod_woocommerce_checkout_manager_settings' ) ) {
892
- $billing_fields = get_option( 'woocommerce_checkout_billing_fields', array() );
893
- $shipping_fields = get_option( 'woocommerce_checkout_shipping_fields', array() );
894
- $custom_fields = get_option( 'woocommerce_checkout_additional_fields', array() );
895
-
896
- // Custom billing fields
897
- if( !empty( $billing_fields ) ) {
898
- foreach( $billing_fields as $key => $billing_field ) {
899
- // Only add non-default Checkout fields to export columns list
900
- if( strtolower( $billing_field['default_field'] ) != 'on' ) {
901
- $fields[] = array(
902
- 'name' => sprintf( 'sod_billing_%s', $billing_field['name'] ),
903
- 'label' => sprintf( __( 'Billing: %s', 'woo_ce' ), ucfirst( $billing_field['label'] ) )
904
- );
905
- }
906
- }
907
- }
908
- unset( $billing_fields, $billing_field );
909
-
910
- // Custom shipping fields
911
- if( !empty( $shipping_fields ) ) {
912
- foreach( $shipping_fields as $key => $shipping_field ) {
913
- // Only add non-default Checkout fields to export columns list
914
- if( strtolower( $shipping_field['default_field'] ) != 'on' ) {
915
- $fields[] = array(
916
- 'name' => sprintf( 'sod_shipping_%s', $shipping_field['name'] ),
917
- 'label' => sprintf( __( 'Shipping: %s', 'woo_ce' ), ucfirst( $shipping_field['label'] ) )
918
- );
919
- }
920
- }
921
- }
922
- unset( $shipping_fields, $shipping_field );
923
-
924
- // Custom fields
925
- if( !empty( $custom_fields ) ) {
926
- foreach( $custom_fields as $key => $custom_field ) {
927
- // Only add non-default Checkout fields to export columns list
928
- if( strtolower( $custom_field['default_field'] ) != 'on' ) {
929
- $fields[] = array(
930
- 'name' => sprintf( 'sod_additional_%s', $custom_field['name'] ),
931
- 'label' => sprintf( __( 'Additional: %s', 'woo_ce' ), ucfirst( $custom_field['label'] ) )
932
- );
933
- }
934
- }
935
- }
936
- unset( $custom_fields, $custom_field );
937
- }
938
-
939
- // WooCommerce Checkout Add-Ons - http://www.skyverge.com/product/woocommerce-checkout-add-ons/
940
- if( function_exists( 'init_woocommerce_checkout_add_ons' ) ) {
941
- $fields[] = array(
942
- 'name' => 'order_items_checkout_addon_id',
943
- 'label' => __( 'Order Items: Checkout Add-ons ID', 'woo_ce' )
944
- );
945
- $fields[] = array(
946
- 'name' => 'order_items_checkout_addon_label',
947
- 'label' => __( 'Order Items: Checkout Add-ons Label', 'woo_ce' )
948
- );
949
- $fields[] = array(
950
- 'name' => 'order_items_checkout_addon_value',
951
- 'label' => __( 'Order Items: Checkout Add-ons Value', 'woo_ce' )
952
- );
953
- }
954
-
955
- // WooCommerce Brands Addon - http://woothemes.com/woocommerce/
956
- if( class_exists( 'WC_Brands' ) ) {
957
- $fields[] = array(
958
- 'name' => 'order_items_brand',
959
- 'label' => __( 'Order Items: Brand', 'woo_ce' )
960
- );
961
- }
962
-
963
- // Product Vendors - http://www.woothemes.com/products/product-vendors/
964
- if( class_exists( 'WooCommerce_Product_Vendors' ) ) {
965
- $fields[] = array(
966
- 'name' => 'order_items_vendor',
967
- 'label' => __( 'Order Items: Product Vendor', 'woo_ce' )
968
- );
969
- }
970
-
971
- // Cost of Goods - http://www.skyverge.com/product/woocommerce-cost-of-goods-tracking/
972
- if( class_exists( 'WC_COG' ) ) {
973
- $fields[] = array(
974
- 'name' => 'total_cost_of_goods',
975
- 'label' => __( 'Total Cost of Goods', 'woo_ce' )
976
- );
977
- $fields[] = array(
978
- 'name' => 'order_items_cost_of_goods',
979
- 'label' => __( 'Order Items: Cost of Goods', 'woo_ce' )
980
- );
981
- }
982
-
983
- // Local Pickup Plus - http://www.woothemes.com/products/local-pickup-plus/
984
- if( class_exists( 'WC_Local_Pickup_Plus' ) ) {
985
- $fields[] = array(
986
- 'name' => 'order_items_pickup_location',
987
- 'label' => __( 'Order Items: Pickup Location', 'woo_ce' )
988
- );
989
- }
990
-
991
- // Gravity Forms - http://woothemes.com/woocommerce
992
- if( class_exists( 'RGForms' ) && class_exists( 'woocommerce_gravityforms' ) ) {
993
- // Check if there are any Products linked to Gravity Forms
994
- if( $gf_fields = woo_ce_get_gravity_form_fields() ) {
995
- $fields[] = array(
996
- 'name' => 'order_items_gf_form_id',
997
- 'label' => __( 'Order Items: Gravity Form ID', 'woo_ce' )
998
- );
999
- $fields[] = array(
1000
- 'name' => 'order_items_gf_form_label',
1001
- 'label' => __( 'Order Items: Gravity Form Label', 'woo_ce' )
1002
- );
1003
- foreach( $gf_fields as $key => $gf_field ) {
1004
- $fields[] = array(
1005
- 'name' => sprintf( 'order_items_gf_%d_%s', $gf_field['formId'], $gf_field['id'] ),
1006
- 'label' => sprintf( __( 'Order Items: %s', 'woo_ce' ), ucfirst( $gf_field['label'] ) )
1007
- );
1008
- }
1009
- }
1010
- }
1011
-
1012
- // WooCommerce Currency Switcher - http://dev.pathtoenlightenment.net/shop
1013
- if( class_exists( 'WC_Aelia_CurrencySwitcher' ) ) {
1014
- $fields[] = array(
1015
- 'name' => 'order_currency',
1016
- 'label' => __( 'Order Currency', 'woo_ce' )
1017
- );
1018
- }
1019
-
1020
- // Custom Order fields
1021
- $custom_orders = woo_ce_get_option( 'custom_orders', '' );
1022
- if( !empty( $custom_orders ) ) {
1023
- foreach( $custom_orders as $custom_order ) {
1024
- if( !empty( $custom_order ) ) {
1025
- $fields[] = array(
1026
- 'name' => $custom_order,
1027
- 'label' => ucfirst( $custom_order )
1028
- );
1029
- }
1030
- }
1031
- unset( $custom_orders, $custom_order );
1032
- }
1033
-
1034
-
1035
- // Custom Order Items fields
1036
- $custom_order_items = woo_ce_get_option( 'custom_order_items', '' );
1037
- if( !empty( $custom_order_items ) ) {
1038
- foreach( $custom_order_items as $custom_order_item ) {
1039
- if( !empty( $custom_order_item ) ) {
1040
- $fields[] = array(
1041
- 'name' => sprintf( 'order_items_%s', $custom_order_item ),
1042
- 'label' => sprintf( __( 'Order Items: %s', 'woo_ce' ), $custom_order_item )
1043
- );
1044
- }
1045
- }
1046
- }
1047
-
1048
- return $fields;
1049
-
1050
- }
1051
- add_filter( 'woo_ce_order_fields', 'woo_ce_extend_order_fields' );
1052
-
1053
- function woo_ce_get_gravity_forms_products() {
1054
-
1055
- global $wpdb;
1056
-
1057
- $meta_key = '_gravity_form_data';
1058
- $post_ids_sql = $wpdb->prepare( "SELECT `post_id`, `meta_value` FROM `$wpdb->postmeta` WHERE `meta_key` = %s GROUP BY `meta_value`", $meta_key );
1059
- return $wpdb->get_results( $post_ids_sql );
1060
-
1061
- }
1062
-
1063
- function woo_ce_get_gravity_form_fields() {
1064
-
1065
- if( $gf_products = woo_ce_get_gravity_forms_products() ) {
1066
- $fields = array();
1067
- foreach( $gf_products as $gf_product ) {
1068
- if( $gf_product_data = maybe_unserialize( get_post_meta( $gf_product->post_id, '_gravity_form_data', true ) ) ) {
1069
- // Check the class and method for Gravity Forms exists
1070
- if( class_exists( 'RGFormsModel' ) && method_exists( 'RGFormsModel', 'get_form_meta' ) ) {
1071
- // Check the form exists
1072
- $gf_form_meta = RGFormsModel::get_form_meta( $gf_product_data['id'] );
1073
- if( !empty( $gf_form_meta ) ) {
1074
- // Check that the form has fields assigned to it
1075
- if( !empty( $gf_form_meta['fields'] ) ) {
1076
- foreach( $gf_form_meta['fields'] as $gf_form_field ) {
1077
- // Check for duplicate Gravity Form fields
1078
- $gf_form_field['formTitle'] = $gf_form_meta['title'];
1079
- $fields[] = $gf_form_field;
1080
- }
1081
- }
1082
- }
1083
- }
1084
- }
1085
- }
1086
- return $fields;
1087
- }
1088
-
1089
- }
1090
-
1091
- function woo_ce_format_order_date( $date ) {
1092
-
1093
- $output = $date;
1094
- if( $date )
1095
- $output = str_replace( '/', '-', $date );
1096
- return $output;
1097
-
1098
- }
1099
-
1100
- // Returns a list of WooCommerce Order statuses
1101
- function woo_ce_get_order_statuses() {
1102
-
1103
- $terms = false;
1104
- // Check if this is a WooCommerce 2.2+ instance (new Post Status)
1105
- $woocommerce_version = woo_get_woo_version();
1106
- if( version_compare( $woocommerce_version, '2.2', '>=' ) ) {
1107
- // Convert Order Status array into our magic sauce
1108
- $order_statuses = ( function_exists( 'wc_get_order_statuses' ) ? wc_get_order_statuses() : false );
1109
- if( !empty( $order_statuses ) ) {
1110
- $terms = array();
1111
- $post_type = 'shop_order';
1112
- $posts_count = wp_count_posts( $post_type );
1113
- foreach( $order_statuses as $key => $order_status ) {
1114
- $terms[] = (object)array(
1115
- 'name' => $order_status,
1116
- 'slug' => $key,
1117
- 'count' => ( isset( $posts_count->$key ) ? $posts_count->$key : 0 )
1118
- );
1119
- }
1120
- }
1121
- } else {
1122
- $args = array(
1123
- 'hide_empty' => false
1124
- );
1125
- $terms = get_terms( 'shop_order_status', $args );
1126
- if( empty( $terms ) || ( is_wp_error( $terms ) == true ) )
1127
- $terms = false;
1128
- }
1129
- return $terms;
1130
-
1131
- }
1132
-
1133
- function woo_ce_get_order_items_types() {
1134
-
1135
- $types = array(
1136
- 'line_item' => __( 'Line Item', 'woo_ce' ),
1137
- 'coupon' => __( 'Coupon', 'woo_ce' ),
1138
- 'fee' => __( 'Fee', 'woo_ce' ),
1139
- 'tax' => __( 'Tax', 'woo_ce' ),
1140
- 'shipping' => __( 'Shipping', 'woo_ce' )
1141
- );
1142
- $types = apply_filters( 'woo_ce_order_item_types', $types );
1143
- return $types;
1144
-
1145
- }
1146
-
1147
- // Returns list of Product Addon columns
1148
- function woo_ce_get_product_addons() {
1149
-
1150
- $output = array();
1151
-
1152
- // Product Addons - http://www.woothemes.com/
1153
- if( class_exists( 'Product_Addon_Admin' ) || class_exists( 'Product_Addon_Display' ) ) {
1154
- $post_type = 'global_product_addon';
1155
- $args = array(
1156
- 'post_type' => $post_type,
1157
- 'numberposts' => -1
1158
- );
1159
- if( $product_addons = get_posts( $args ) ) {
1160
- foreach( $product_addons as $product_addon ) {
1161
- if( $meta = maybe_unserialize( get_post_meta( $product_addon->ID, '_product_addons', true ) ) ) {
1162
- $size = count( $meta );
1163
- for( $i = 0; $i < $size; $i++ ) {
1164
- $output[] = (object)array(
1165
- 'post_name' => $meta[$i]['name'],
1166
- 'post_title' => $meta[$i]['name']
1167
- );
1168
- }
1169
- }
1170
- }
1171
- }
1172
- }
1173
-
1174
- // Custom Order Items
1175
- if( $custom_order_items = woo_ce_get_option( 'custom_order_items', '' ) ) {
1176
- foreach( $custom_order_items as $custom_order_item ) {
1177
- $output[] = (object)array(
1178
- 'post_name' => $custom_order_item,
1179
- 'post_title' => $custom_order_item
1180
- );
1181
- }
1182
- }
1183
-
1184
- return $output;
1185
-
1186
- }
1187
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/product-extend.php ADDED
@@ -0,0 +1,1304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function woo_ce_extend_product_fields( $fields = array() ) {
3
+
4
+ // WordPress MultiSite
5
+ if( is_multisite() ) {
6
+ $fields[] = array(
7
+ 'name' => 'blog_id',
8
+ 'label' => __( 'Blog ID', 'woocommerce-exporter' ),
9
+ 'hover' => __( 'WordPress Multisite', 'woocommerce-exporter' ),
10
+ 'disabled' => 1
11
+ );
12
+ }
13
+ /*
14
+ // Attributes
15
+ if( $attributes = woo_ce_get_product_attributes() ) {
16
+ foreach( $attributes as $attribute ) {
17
+ if( empty( $attribute->attribute_label ) )
18
+ $attribute->attribute_label = $attribute->attribute_name;
19
+ $fields[] = array(
20
+ 'name' => sprintf( 'attribute_%s', $attribute->attribute_name ),
21
+ 'label' => sprintf( __( 'Attribute: %s', 'woocommerce-exporter' ), $attribute->attribute_label )
22
+ );
23
+ }
24
+ }
25
+ */
26
+
27
+ // Advanced Google Product Feed - http://www.leewillis.co.uk/wordpress-plugins/
28
+ if( woo_ce_detect_export_plugin( 'gpf' ) ) {
29
+ $fields[] = array(
30
+ 'name' => 'gpf_availability',
31
+ 'label' => __( 'Advanced Google Product Feed - Availability', 'woocommerce-exporter' ),
32
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
33
+ );
34
+ $fields[] = array(
35
+ 'name' => 'gpf_condition',
36
+ 'label' => __( 'Advanced Google Product Feed - Condition', 'woocommerce-exporter' ),
37
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
38
+ );
39
+ $fields[] = array(
40
+ 'name' => 'gpf_brand',
41
+ 'label' => __( 'Advanced Google Product Feed - Brand', 'woocommerce-exporter' ),
42
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
43
+ );
44
+ $fields[] = array(
45
+ 'name' => 'gpf_product_type',
46
+ 'label' => __( 'Advanced Google Product Feed - Product Type', 'woocommerce-exporter' ),
47
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
48
+ );
49
+ $fields[] = array(
50
+ 'name' => 'gpf_google_product_category',
51
+ 'label' => __( 'Advanced Google Product Feed - Google Product Category', 'woocommerce-exporter' ),
52
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
53
+ );
54
+ $fields[] = array(
55
+ 'name' => 'gpf_gtin',
56
+ 'label' => __( 'Advanced Google Product Feed - Global Trade Item Number (GTIN)', 'woocommerce-exporter' ),
57
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
58
+ );
59
+ $fields[] = array(
60
+ 'name' => 'gpf_mpn',
61
+ 'label' => __( 'Advanced Google Product Feed - Manufacturer Part Number (MPN)', 'woocommerce-exporter' ),
62
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
63
+ );
64
+ $fields[] = array(
65
+ 'name' => 'gpf_gender',
66
+ 'label' => __( 'Advanced Google Product Feed - Gender', 'woocommerce-exporter' ),
67
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
68
+ );
69
+ $fields[] = array(
70
+ 'name' => 'gpf_agegroup',
71
+ 'label' => __( 'Advanced Google Product Feed - Age Group', 'woocommerce-exporter' ),
72
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
73
+ );
74
+ $fields[] = array(
75
+ 'name' => 'gpf_colour',
76
+ 'label' => __( 'Advanced Google Product Feed - Colour', 'woocommerce-exporter' ),
77
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
78
+ );
79
+ $fields[] = array(
80
+ 'name' => 'gpf_size',
81
+ 'label' => __( 'Advanced Google Product Feed - Size', 'woocommerce-exporter' ),
82
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
83
+ );
84
+ }
85
+
86
+ // All in One SEO Pack - http://wordpress.org/extend/plugins/all-in-one-seo-pack/
87
+ if( woo_ce_detect_export_plugin( 'aioseop' ) ) {
88
+ $fields[] = array(
89
+ 'name' => 'aioseop_keywords',
90
+ 'label' => __( 'All in One SEO - Keywords', 'woocommerce-exporter' ),
91
+ 'hover' => __( 'All in One SEO Pack', 'woocommerce-exporter' )
92
+ );
93
+ $fields[] = array(
94
+ 'name' => 'aioseop_description',
95
+ 'label' => __( 'All in One SEO - Description', 'woocommerce-exporter' ),
96
+ 'hover' => __( 'All in One SEO Pack', 'woocommerce-exporter' )
97
+ );
98
+ $fields[] = array(
99
+ 'name' => 'aioseop_title',
100
+ 'label' => __( 'All in One SEO - Title', 'woocommerce-exporter' ),
101
+ 'hover' => __( 'All in One SEO Pack', 'woocommerce-exporter' )
102
+ );
103
+ $fields[] = array(
104
+ 'name' => 'aioseop_title_attributes',
105
+ 'label' => __( 'All in One SEO - Title Attributes', 'woocommerce-exporter' ),
106
+ 'hover' => __( 'All in One SEO Pack', 'woocommerce-exporter' )
107
+ );
108
+ $fields[] = array(
109
+ 'name' => 'aioseop_menu_label',
110
+ 'label' => __( 'All in One SEO - Menu Label', 'woocommerce-exporter' ),
111
+ 'hover' => __( 'All in One SEO Pack', 'woocommerce-exporter' )
112
+ );
113
+ }
114
+
115
+ // WordPress SEO - http://wordpress.org/plugins/wordpress-seo/
116
+ if( woo_ce_detect_export_plugin( 'wpseo' ) ) {
117
+ $fields[] = array(
118
+ 'name' => 'wpseo_focuskw',
119
+ 'label' => __( 'WordPress SEO - Focus Keyword', 'woocommerce-exporter' ),
120
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
121
+ );
122
+ $fields[] = array(
123
+ 'name' => 'wpseo_metadesc',
124
+ 'label' => __( 'WordPress SEO - Meta Description', 'woocommerce-exporter' ),
125
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
126
+ );
127
+ $fields[] = array(
128
+ 'name' => 'wpseo_title',
129
+ 'label' => __( 'WordPress SEO - SEO Title', 'woocommerce-exporter' ),
130
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
131
+ );
132
+ $fields[] = array(
133
+ 'name' => 'wpseo_noindex',
134
+ 'label' => __( 'WordPress SEO - Noindex', 'woocommerce-exporter' ),
135
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
136
+ );
137
+ $fields[] = array(
138
+ 'name' => 'wpseo_follow',
139
+ 'label' => __( 'WordPress SEO - Follow', 'woocommerce-exporter' ),
140
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
141
+ );
142
+ $fields[] = array(
143
+ 'name' => 'wpseo_googleplus_description',
144
+ 'label' => __( 'WordPress SEO - Google+ Description', 'woocommerce-exporter' ),
145
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
146
+ );
147
+ $fields[] = array(
148
+ 'name' => 'wpseo_opengraph_title',
149
+ 'label' => __( 'WordPress SEO - Facebook Title', 'woocommerce-exporter' ),
150
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
151
+ );
152
+ $fields[] = array(
153
+ 'name' => 'wpseo_opengraph_description',
154
+ 'label' => __( 'WordPress SEO - Facebook Description', 'woocommerce-exporter' ),
155
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
156
+ );
157
+ $fields[] = array(
158
+ 'name' => 'wpseo_opengraph_image',
159
+ 'label' => __( 'WordPress SEO - Facebook Image', 'woocommerce-exporter' ),
160
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
161
+ );
162
+ $fields[] = array(
163
+ 'name' => 'wpseo_twitter_title',
164
+ 'label' => __( 'WordPress SEO - Twitter Title', 'woocommerce-exporter' ),
165
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
166
+ );
167
+ $fields[] = array(
168
+ 'name' => 'wpseo_twitter_description',
169
+ 'label' => __( 'WordPress SEO - Twitter Description', 'woocommerce-exporter' ),
170
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
171
+ );
172
+ $fields[] = array(
173
+ 'name' => 'wpseo_twitter_image',
174
+ 'label' => __( 'WordPress SEO - Twitter Image', 'woocommerce-exporter' ),
175
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
176
+ );
177
+ }
178
+
179
+ // Ultimate SEO - http://wordpress.org/plugins/seo-ultimate/
180
+ if( woo_ce_detect_export_plugin( 'ultimate_seo' ) ) {
181
+ $fields[] = array(
182
+ 'name' => 'useo_meta_title',
183
+ 'label' => __( 'Ultimate SEO - Title Tag', 'woocommerce-exporter' ),
184
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
185
+ );
186
+ $fields[] = array(
187
+ 'name' => 'useo_meta_description',
188
+ 'label' => __( 'Ultimate SEO - Meta Description', 'woocommerce-exporter' ),
189
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
190
+ );
191
+ $fields[] = array(
192
+ 'name' => 'useo_meta_keywords',
193
+ 'label' => __( 'Ultimate SEO - Meta Keywords', 'woocommerce-exporter' ),
194
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
195
+ );
196
+ $fields[] = array(
197
+ 'name' => 'useo_social_title',
198
+ 'label' => __( 'Ultimate SEO - Social Title', 'woocommerce-exporter' ),
199
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
200
+ );
201
+ $fields[] = array(
202
+ 'name' => 'useo_social_description',
203
+ 'label' => __( 'Ultimate SEO - Social Description', 'woocommerce-exporter' ),
204
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
205
+ );
206
+ $fields[] = array(
207
+ 'name' => 'useo_meta_noindex',
208
+ 'label' => __( 'Ultimate SEO - Noindex', 'woocommerce-exporter' ),
209
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
210
+ );
211
+ $fields[] = array(
212
+ 'name' => 'useo_meta_noautolinks',
213
+ 'label' => __( 'Ultimate SEO - Disable Autolinks', 'woocommerce-exporter' ),
214
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
215
+ );
216
+ }
217
+
218
+ // WooCommerce Brands Addon - http://woothemes.com/woocommerce/
219
+ // WooCommerce Brands - http://proword.net/Woocommerce_Brands/
220
+ if( woo_ce_detect_product_brands() ) {
221
+ $fields[] = array(
222
+ 'name' => 'brands',
223
+ 'label' => __( 'Brands', 'woocommerce-exporter' ),
224
+ 'hover' => __( 'WooCommerce Brands', 'woocommerce-exporter' ),
225
+ 'disabled' => 1
226
+ );
227
+ }
228
+
229
+ // WooCommerce MSRP Pricing - http://woothemes.com/woocommerce/
230
+ if( woo_ce_detect_export_plugin( 'wc_msrp' ) ) {
231
+ $fields[] = array(
232
+ 'name' => 'msrp',
233
+ 'label' => __( 'MSRP', 'woocommerce-exporter' ),
234
+ 'hover' => __( 'Manufacturer Suggested Retail Price (MSRP)', 'woocommerce-exporter' ),
235
+ 'disabled' => 1
236
+ );
237
+ }
238
+
239
+ // Cost of Goods - http://www.skyverge.com/product/woocommerce-cost-of-goods-tracking/
240
+ if( woo_ce_detect_export_plugin( 'wc_cog' ) ) {
241
+ $fields[] = array(
242
+ 'name' => 'cost_of_goods',
243
+ 'label' => __( 'Cost of Goods', 'woocommerce-exporter' ),
244
+ 'hover' => __( 'Cost of Goods', 'woocommerce-exporter' ),
245
+ 'disabled' => 1
246
+ );
247
+ }
248
+
249
+ // Per Product Shipping - http://www.woothemes.com/products/per-product-shipping/
250
+ if( woo_ce_detect_export_plugin( 'per_product_shipping' ) ) {
251
+ $fields[] = array(
252
+ 'name' => 'per_product_shipping',
253
+ 'label' => __( 'Per-Product Shipping', 'woocommerce-exporter' ),
254
+ 'hover' => __( 'Per-Product Shipping', 'woocommerce-exporter' ),
255
+ 'disabled' => 1
256
+ );
257
+ $fields[] = array(
258
+ 'name' => 'per_product_shipping_country',
259
+ 'label' => __( 'Per-Product Shipping - Country', 'woocommerce-exporter' ),
260
+ 'hover' => __( 'Per-Product Shipping', 'woocommerce-exporter' ),
261
+ 'disabled' => 1
262
+ );
263
+ $fields[] = array(
264
+ 'name' => 'per_product_shipping_state',
265
+ 'label' => __( 'Per-Product Shipping - State', 'woocommerce-exporter' ),
266
+ 'hover' => __( 'Per-Product Shipping', 'woocommerce-exporter' ),
267
+ 'disabled' => 1
268
+ );
269
+ $fields[] = array(
270
+ 'name' => 'per_product_shipping_postcode',
271
+ 'label' => __( 'Per-Product Shipping - Postcode', 'woocommerce-exporter' ),
272
+ 'hover' => __( 'Per-Product Shipping', 'woocommerce-exporter' ),
273
+ 'disabled' => 1
274
+ );
275
+ $fields[] = array(
276
+ 'name' => 'per_product_shipping_cost',
277
+ 'label' => __( 'Per-Product Shipping - Cost', 'woocommerce-exporter' ),
278
+ 'hover' => __( 'Per-Product Shipping', 'woocommerce-exporter' ),
279
+ 'disabled' => 1
280
+ );
281
+ $fields[] = array(
282
+ 'name' => 'per_product_shipping_item_cost',
283
+ 'label' => __( 'Per-Product Shipping - Item Cost', 'woocommerce-exporter' ),
284
+ 'hover' => __( 'Per-Product Shipping', 'woocommerce-exporter' ),
285
+ 'disabled' => 1
286
+ );
287
+ $fields[] = array(
288
+ 'name' => 'per_product_shipping_order',
289
+ 'label' => __( 'Per-Product Shipping - Priority', 'woocommerce-exporter' ),
290
+ 'hover' => __( 'Per-Product Shipping', 'woocommerce-exporter' ),
291
+ 'disabled' => 1
292
+ );
293
+ }
294
+
295
+ // Product Vendors - http://www.woothemes.com/products/product-vendors/
296
+ if( woo_ce_detect_export_plugin( 'vendors' ) ) {
297
+ $fields[] = array(
298
+ 'name' => 'vendors',
299
+ 'label' => __( 'Product Vendors', 'woocommerce-exporter' ),
300
+ 'hover' => __( 'Product Vendors', 'woocommerce-exporter' ),
301
+ 'disabled' => 1
302
+ );
303
+ $fields[] = array(
304
+ 'name' => 'vendor_ids',
305
+ 'label' => __( 'Product Vendor ID\'s', 'woocommerce-exporter' ),
306
+ 'hover' => __( 'Product Vendors', 'woocommerce-exporter' ),
307
+ 'disabled' => 1
308
+ );
309
+ $fields[] = array(
310
+ 'name' => 'vendor_commission',
311
+ 'label' => __( 'Vendor Commission', 'woocommerce-exporter' ),
312
+ 'hover' => __( 'Product Vendors', 'woocommerce-exporter' ),
313
+ 'disabled' => 1
314
+ );
315
+ }
316
+
317
+ // WC Vendors - http://wcvendors.com
318
+ if( woo_ce_detect_export_plugin( 'wc_vendors' ) ) {
319
+ $fields[] = array(
320
+ 'name' => 'vendor',
321
+ 'label' => __( 'Vendor' ),
322
+ 'hover' => __( 'WC Vendors', 'woocommerce-exporter' ),
323
+ 'disabled' => 1
324
+ );
325
+ $fields[] = array(
326
+ 'name' => 'vendor_commission_rate',
327
+ 'label' => __( 'Commission (%)' ),
328
+ 'hover' => __( 'WC Vendors', 'woocommerce-exporter' ),
329
+ 'disabled' => 1
330
+ );
331
+ }
332
+
333
+ // YITH WooCommerce Multi Vendor Premium - http://yithemes.com/themes/plugins/yith-woocommerce-product-vendors/
334
+ if( woo_ce_detect_export_plugin( 'yith_vendor' ) ) {
335
+ $fields[] = array(
336
+ 'name' => 'vendor',
337
+ 'label' => __( 'Vendor' ),
338
+ 'hover' => __( 'YITH WooCommerce Multi Vendor Premium', 'woocommerce-exporter' ),
339
+ 'disabled' => 1
340
+ );
341
+ $fields[] = array(
342
+ 'name' => 'vendor_commission_rate',
343
+ 'label' => __( 'Commission (%)' ),
344
+ 'hover' => __( 'YITH WooCommerce Multi Vendor Premium', 'woocommerce-exporter' ),
345
+ 'disabled' => 1
346
+ );
347
+ }
348
+
349
+ // WooCommerce Wholesale Pricing - http://ignitewoo.com/woocommerce-extensions-plugins-themes/woocommerce-wholesale-pricing/
350
+ if( woo_ce_detect_export_plugin( 'wholesale_pricing' ) ) {
351
+ $fields[] = array(
352
+ 'name' => 'wholesale_price',
353
+ 'label' => __( 'Wholesale Price', 'woocommerce-exporter' ),
354
+ 'hover' => __( 'WooCommerce Wholesale Pricing', 'woocommerce-exporter' ),
355
+ 'disabled' => 1
356
+ );
357
+ $fields[] = array(
358
+ 'name' => 'wholesale_price_text',
359
+ 'label' => __( 'Wholesale Text', 'woocommerce-exporter' ),
360
+ 'hover' => __( 'WooCommerce Wholesale Pricing', 'woocommerce-exporter' ),
361
+ 'disabled' => 1
362
+ );
363
+ }
364
+
365
+ // Advanced Custom Fields - http://www.advancedcustomfields.com
366
+ if( woo_ce_detect_export_plugin( 'acf' ) ) {
367
+ $custom_fields = woo_ce_get_acf_product_fields();
368
+ if( !empty( $custom_fields ) ) {
369
+ foreach( $custom_fields as $custom_field ) {
370
+ $fields[] = array(
371
+ 'name' => $custom_field['name'],
372
+ 'label' => $custom_field['label'],
373
+ 'hover' => __( 'Advanced Custom Fields', 'woocommerce-exporter' ),
374
+ 'disabled' => 1
375
+ );
376
+ }
377
+ unset( $custom_fields, $custom_field );
378
+ }
379
+ }
380
+
381
+ // WooCommerce Custom Fields - http://www.rightpress.net/woocommerce-custom-fields
382
+ if( woo_ce_detect_export_plugin( 'wc_customfields' ) ) {
383
+ if( !get_option( 'wccf_migrated_to_20' ) ) {
384
+ // Legacy WooCommerce Custom Fields was stored in a single Option
385
+ $options = get_option( 'rp_wccf_options' );
386
+ if( !empty( $options ) ) {
387
+ $custom_fields = ( isset( $options[1]['product_admin_fb_config'] ) ? $options[1]['product_admin_fb_config'] : false );
388
+ if( !empty( $custom_fields ) ) {
389
+ foreach( $custom_fields as $custom_field ) {
390
+ $fields[] = array(
391
+ 'name' => sprintf( 'wccf_%s', sanitize_key( $custom_field['key'] ) ),
392
+ 'label' => ucfirst( $custom_field['label'] ),
393
+ 'hover' => __( 'WooCommerce Custom Fields', 'woocommerce-exporter' ),
394
+ 'disabled' => 1
395
+ );
396
+ }
397
+ }
398
+ }
399
+ unset( $options );
400
+ } else {
401
+ // WooCommerce Custom Fields uses CPT for Product properties
402
+ $custom_fields = woo_ce_get_wccf_product_properties();
403
+ if( !empty( $custom_fields ) ) {
404
+ foreach( $custom_fields as $custom_field ) {
405
+ $label = get_post_meta( $custom_field->ID, 'label', true );
406
+ $key = get_post_meta( $custom_field->ID, 'key', true );
407
+ $fields[] = array(
408
+ 'name' => sprintf( 'wccf_pp_%s', sanitize_key( $key ) ),
409
+ 'label' => ucfirst( $label ),
410
+ 'hover' => __( 'WooCommerce Custom Fields', 'woocommerce-exporter' ),
411
+ 'disabled' => 1
412
+ );
413
+ }
414
+ }
415
+ unset( $label, $key );
416
+ }
417
+ unset( $custom_fields, $custom_field );
418
+ }
419
+
420
+ // WooCommerce Subscriptions - http://www.woothemes.com/products/woocommerce-subscriptions/
421
+ if( woo_ce_detect_export_plugin( 'subscriptions' ) ) {
422
+ $fields[] = array(
423
+ 'name' => 'subscription_price',
424
+ 'label' => __( 'Subscription Price', 'woocommerce-exporter' ),
425
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
426
+ 'disabled' => 1
427
+ );
428
+ $fields[] = array(
429
+ 'name' => 'subscription_period_interval',
430
+ 'label' => __( 'Subscription Period Interval', 'woocommerce-exporter' ),
431
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
432
+ 'disabled' => 1
433
+ );
434
+ $fields[] = array(
435
+ 'name' => 'subscription_period',
436
+ 'label' => __( 'Subscription Period', 'woocommerce-exporter' ),
437
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
438
+ 'disabled' => 1
439
+ );
440
+ $fields[] = array(
441
+ 'name' => 'subscription_length',
442
+ 'label' => __( 'Subscription Length', 'woocommerce-exporter' ),
443
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
444
+ 'disabled' => 1
445
+ );
446
+ $fields[] = array(
447
+ 'name' => 'subscription_sign_up_fee',
448
+ 'label' => __( 'Subscription Sign-up Fee', 'woocommerce-exporter' ),
449
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
450
+ 'disabled' => 1
451
+ );
452
+ $fields[] = array(
453
+ 'name' => 'subscription_trial_length',
454
+ 'label' => __( 'Subscription Trial Length', 'woocommerce-exporter' ),
455
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
456
+ 'disabled' => 1
457
+ );
458
+ $fields[] = array(
459
+ 'name' => 'subscription_trial_period',
460
+ 'label' => __( 'Subscription Trial Period', 'woocommerce-exporter' ),
461
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
462
+ 'disabled' => 1
463
+ );
464
+ $fields[] = array(
465
+ 'name' => 'subscription_limit',
466
+ 'label' => __( 'Limit Subscription', 'woocommerce-exporter' ),
467
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
468
+ 'disabled' => 1
469
+ );
470
+ }
471
+
472
+ // WooCommerce Bookings - http://www.woothemes.com/products/woocommerce-bookings/
473
+ if( woo_ce_detect_export_plugin( 'woocommerce_bookings' ) ) {
474
+ $fields[] = array(
475
+ 'name' => 'booking_has_persons',
476
+ 'label' => __( 'Booking Has Persons', 'woocommerce-exporter' ),
477
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' ),
478
+ 'disabled' => 1
479
+ );
480
+ $fields[] = array(
481
+ 'name' => 'booking_has_resources',
482
+ 'label' => __( 'Booking Has Resources', 'woocommerce-exporter' ),
483
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' ),
484
+ 'disabled' => 1
485
+ );
486
+ $fields[] = array(
487
+ 'name' => 'booking_base_cost',
488
+ 'label' => __( 'Booking Base Cost', 'woocommerce-exporter' ),
489
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' ),
490
+ 'disabled' => 1
491
+ );
492
+ $fields[] = array(
493
+ 'name' => 'booking_block_cost',
494
+ 'label' => __( 'Booking Block Cost', 'woocommerce-exporter' ),
495
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' ),
496
+ 'disabled' => 1
497
+ );
498
+ $fields[] = array(
499
+ 'name' => 'booking_display_cost',
500
+ 'label' => __( 'Booking Display Cost', 'woocommerce-exporter' ),
501
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' ),
502
+ 'disabled' => 1
503
+ );
504
+ $fields[] = array(
505
+ 'name' => 'booking_requires_confirmation',
506
+ 'label' => __( 'Booking Requires Confirmation', 'woocommerce-exporter' ),
507
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' ),
508
+ 'disabled' => 1
509
+ );
510
+ $fields[] = array(
511
+ 'name' => 'booking_user_can_cancel',
512
+ 'label' => __( 'Booking Can Be Cancelled', 'woocommerce-exporter' ),
513
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' ),
514
+ 'disabled' => 1
515
+ );
516
+ }
517
+
518
+ // Barcodes for WooCommerce - http://www.wolkenkraft.com/produkte/barcodes-fuer-woocommerce/
519
+ if( woo_ce_detect_export_plugin( 'wc_barcodes' ) ) {
520
+ $fields[] = array(
521
+ 'name' => 'barcode_type',
522
+ 'label' => __( 'Barcode Type', 'woocommerce-exporter' ),
523
+ 'hover' => __( 'Barcodes for WooCommerce', 'woocommerce-exporter' ),
524
+ 'disabled' => 1
525
+ );
526
+ $fields[] = array(
527
+ 'name' => 'barcode',
528
+ 'label' => __( 'Barcode', 'woocommerce-exporter' ),
529
+ 'hover' => __( 'Barcodes for WooCommerce', 'woocommerce-exporter' ),
530
+ 'disabled' => 1
531
+ );
532
+ }
533
+
534
+ // WooCommerce Pre-Orders - http://www.woothemes.com/products/woocommerce-pre-orders/
535
+ if( woo_ce_detect_export_plugin( 'wc_preorders' ) ) {
536
+ $fields[] = array(
537
+ 'name' => 'pre_orders_enabled',
538
+ 'label' => __( 'Pre-Order Enabled', 'woocommerce-exporter' ),
539
+ 'hover' => __( 'WooCommerce Pre-Orders', 'woocommerce-exporter' ),
540
+ 'disabled' => 1
541
+ );
542
+ $fields[] = array(
543
+ 'name' => 'pre_orders_availability_date',
544
+ 'label' => __( 'Pre-Order Availability Date', 'woocommerce-exporter' ),
545
+ 'hover' => __( 'WooCommerce Pre-Orders', 'woocommerce-exporter' ),
546
+ 'disabled' => 1
547
+ );
548
+ $fields[] = array(
549
+ 'name' => 'pre_orders_fee',
550
+ 'label' => __( 'Pre-Order Fee', 'woocommerce-exporter' ),
551
+ 'hover' => __( 'WooCommerce Pre-Orders', 'woocommerce-exporter' ),
552
+ 'disabled' => 1
553
+ );
554
+ $fields[] = array(
555
+ 'name' => 'pre_orders_charge',
556
+ 'label' => __( 'Pre-Order Charge', 'woocommerce-exporter' ),
557
+ 'hover' => __( 'WooCommerce Pre-Orders', 'woocommerce-exporter' ),
558
+ 'disabled' => 1
559
+ );
560
+ }
561
+
562
+ // WooCommerce Product Fees - https://wordpress.org/plugins/woocommerce-product-fees/
563
+ if( woo_ce_detect_export_plugin( 'wc_productfees' ) ) {
564
+ $fields[] = array(
565
+ 'name' => 'fee_name',
566
+ 'label' => __( 'Product Fee Name', 'woocommerce-exporter' ),
567
+ 'hover' => __( 'WooCommerce Product Fees', 'woocommerce-exporter' ),
568
+ 'disabled' => 1
569
+ );
570
+ $fields[] = array(
571
+ 'name' => 'fee_amount',
572
+ 'label' => __( 'Product Fee Amount', 'woocommerce-exporter' ),
573
+ 'hover' => __( 'WooCommerce Product Fees', 'woocommerce-exporter' ),
574
+ 'disabled' => 1
575
+ );
576
+ $fields[] = array(
577
+ 'name' => 'fee_multiplier',
578
+ 'label' => __( 'Product Fee Multiplier', 'woocommerce-exporter' ),
579
+ 'hover' => __( 'WooCommerce Product Fees', 'woocommerce-exporter' ),
580
+ 'disabled' => 1
581
+ );
582
+ }
583
+
584
+ // WooCommerce Events - http://www.woocommerceevents.com/
585
+ if( woo_ce_detect_export_plugin( 'wc_events' ) ) {
586
+ $fields[] = array(
587
+ 'name' => 'is_event',
588
+ 'label' => __( 'Is Event', 'woocommerce-exporter' ),
589
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
590
+ 'disabled' => 1
591
+ );
592
+ $fields[] = array(
593
+ 'name' => 'event_date',
594
+ 'label' => __( 'Event Date', 'woocommerce-exporter' ),
595
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
596
+ 'disabled' => 1
597
+ );
598
+ $fields[] = array(
599
+ 'name' => 'event_start_time',
600
+ 'label' => __( 'Event Start Time', 'woocommerce-exporter' ),
601
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
602
+ 'disabled' => 1
603
+ );
604
+ $fields[] = array(
605
+ 'name' => 'event_end_time',
606
+ 'label' => __( 'Event End Time', 'woocommerce-exporter' ),
607
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
608
+ 'disabled' => 1
609
+ );
610
+ $fields[] = array(
611
+ 'name' => 'event_venue',
612
+ 'label' => __( 'Event Venue', 'woocommerce-exporter' ),
613
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
614
+ 'disabled' => 1
615
+ );
616
+ $fields[] = array(
617
+ 'name' => 'event_gps',
618
+ 'label' => __( 'Event GPS Coordinates', 'woocommerce-exporter' ),
619
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
620
+ 'disabled' => 1
621
+ );
622
+ $fields[] = array(
623
+ 'name' => 'event_googlemaps',
624
+ 'label' => __( 'Event Google Maps Coordinates', 'woocommerce-exporter' ),
625
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
626
+ 'disabled' => 1
627
+ );
628
+ $fields[] = array(
629
+ 'name' => 'event_directions',
630
+ 'label' => __( 'Event Directions', 'woocommerce-exporter' ),
631
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
632
+ 'disabled' => 1
633
+ );
634
+ $fields[] = array(
635
+ 'name' => 'event_phone',
636
+ 'label' => __( 'Event Phone', 'woocommerce-exporter' ),
637
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
638
+ 'disabled' => 1
639
+ );
640
+ $fields[] = array(
641
+ 'name' => 'event_email',
642
+ 'label' => __( 'Event E-mail', 'woocommerce-exporter' ),
643
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
644
+ 'disabled' => 1
645
+ );
646
+ $fields[] = array(
647
+ 'name' => 'event_ticket_logo',
648
+ 'label' => __( 'Event Ticket Logo', 'woocommerce-exporter' ),
649
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
650
+ 'disabled' => 1
651
+ );
652
+ $fields[] = array(
653
+ 'name' => 'event_ticket_text',
654
+ 'label' => __( 'Event Ticket Text', 'woocommerce-exporter' ),
655
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
656
+ 'disabled' => 1
657
+ );
658
+ }
659
+
660
+ // WooCommerce Uploads - https://wpfortune.com/shop/plugins/woocommerce-uploads/
661
+ if( woo_ce_detect_export_plugin( 'wc_uploads' ) ) {
662
+ $fields[] = array(
663
+ 'name' => 'enable_uploads',
664
+ 'label' => __( 'Enable Uploads', 'woocommerce-exporter' ),
665
+ 'hover' => __( 'WooCommerce Uploads', 'woocommerce-exporter' ),
666
+ 'disabled' => 1
667
+ );
668
+ }
669
+
670
+ // WooCommerce Profit of Sales Report - http://codecanyon.net/item/woocommerce-profit-of-sales-report/9190590
671
+ if( woo_ce_detect_export_plugin( 'wc_posr' ) ) {
672
+ $fields[] = array(
673
+ 'name' => 'posr',
674
+ 'label' => __( 'Cost of Good', 'woocommerce-exporter' ),
675
+ 'hover' => __( 'WooCommerce Profit of Sales Report', 'woocommerce-exporter' ),
676
+ 'disabled' => 1
677
+ );
678
+ }
679
+
680
+ // WooCommerce Product Bundles - http://www.woothemes.com/products/product-bundles/
681
+ if( woo_ce_detect_export_plugin( 'wc_product_bundles' ) ) {
682
+ $fields[] = array(
683
+ 'name' => 'bundled_products',
684
+ 'label' => __( 'Bundled Products', 'woocommerce-exporter' ),
685
+ 'hover' => __( 'WooCommerce Product Bundles', 'woocommerce-exporter' ),
686
+ 'disabled' => 1
687
+ );
688
+ $fields[] = array(
689
+ 'name' => 'bundled_product_ids',
690
+ 'label' => __( 'Bundled Product ID\'s', 'woocommerce-exporter' ),
691
+ 'hover' => __( 'WooCommerce Product Bundles', 'woocommerce-exporter' ),
692
+ 'disabled' => 1
693
+ );
694
+ }
695
+
696
+ // WooCommerce Min/Max Quantities - https://woocommerce.com/products/minmax-quantities/
697
+ if( woo_ce_detect_export_plugin( 'wc_min_max' ) ) {
698
+ $fields[] = array(
699
+ 'name' => 'minimum_quantity',
700
+ 'label' => __( 'Minimum Quantity', 'woocommerce-exporter' ),
701
+ 'hover' => __( 'WooCommerce Min/Max Quantities', 'woocommerce-exporter' ),
702
+ 'disabled' => 1
703
+ );
704
+ $fields[] = array(
705
+ 'name' => 'maximum_quantity',
706
+ 'label' => __( 'Maximum Quantity', 'woocommerce-exporter' ),
707
+ 'hover' => __( 'WooCommerce Min/Max Quantities', 'woocommerce-exporter' ),
708
+ 'disabled' => 1
709
+ );
710
+ $fields[] = array(
711
+ 'name' => 'group_of',
712
+ 'label' => __( 'Group of', 'woocommerce-exporter' ),
713
+ 'hover' => __( 'WooCommerce Min/Max Quantities', 'woocommerce-exporter' ),
714
+ 'disabled' => 1
715
+ );
716
+ }
717
+
718
+ // WooCommerce Tab Manager - http://www.woothemes.com/products/woocommerce-tab-manager/
719
+ if( woo_ce_detect_export_plugin( 'wc_tabmanager' ) ) {
720
+ // Custom Product Tabs
721
+ $custom_product_tabs = woo_ce_get_option( 'custom_product_tabs', '' );
722
+ if( !empty( $custom_product_tabs ) ) {
723
+ foreach( $custom_product_tabs as $custom_product_tab ) {
724
+ if( !empty( $custom_product_tab ) ) {
725
+ $fields[] = array(
726
+ 'name' => sprintf( 'product_tab_%s', sanitize_key( $custom_product_tab ) ),
727
+ 'label' => sprintf( __( 'Product Tab: %s', 'woocommerce-exporter' ), woo_ce_clean_export_label( $custom_product_tab ) ),
728
+ 'hover' => sprintf( __( 'Custom Product Tab: %s', 'woocommerce-exporter' ), $custom_product_tab ),
729
+ 'disabled' => 1
730
+ );
731
+ }
732
+ }
733
+ }
734
+ unset( $custom_product_tabs, $custom_product_tab );
735
+ }
736
+
737
+ // WooTabs - https://codecanyon.net/item/wootabsadd-extra-tabs-to-woocommerce-product-page/7891253
738
+ if( woo_ce_detect_export_plugin( 'wootabs' ) ) {
739
+ // Custom WooTabs
740
+ $custom_wootabs = woo_ce_get_option( 'custom_wootabs', '' );
741
+ if( !empty( $custom_wootabs ) ) {
742
+ foreach( $custom_wootabs as $custom_wootab ) {
743
+ if( !empty( $custom_wootab ) ) {
744
+ $fields[] = array(
745
+ 'name' => sprintf( 'wootab_%s', sanitize_key( $custom_wootab ) ),
746
+ 'label' => sprintf( __( 'WooTab: %s', 'woocommerce-exporter' ), woo_ce_clean_export_label( $custom_wootab ) ),
747
+ 'hover' => sprintf( __( 'WooTab: %s', 'woocommerce-exporter' ), $custom_wootab ),
748
+ 'disabled' => 1
749
+ );
750
+ }
751
+ }
752
+ }
753
+ unset( $custom_wootabs, $custom_wootab );
754
+ }
755
+
756
+ // WooCommerce Tiered Pricing - http://ignitewoo.com/woocommerce-extensions-plugins-themes/woocommerce-tiered-pricing/
757
+ if( woo_ce_detect_export_plugin( 'ign_tiered' ) ) {
758
+
759
+ global $wp_roles;
760
+
761
+ // User Roles
762
+ if( isset( $wp_roles->roles ) ) {
763
+ asort( $wp_roles->roles );
764
+ foreach( $wp_roles->roles as $role => $role_data ) {
765
+ // Skip default User Roles
766
+ if( 'ignite_level_' != substr( $role, 0, 13 ) )
767
+ continue;
768
+ $fields[] = array(
769
+ 'name' => sanitize_key( $role ),
770
+ 'label' => sprintf( __( '%s ($)', 'woocommerce-exporter' ), woo_ce_clean_export_label( stripslashes( $role_data['name'] ) ) ),
771
+ 'hover' => __( 'WooCommerce Tiered Pricing', 'woocommerce-exporter' ),
772
+ 'disabled' => 1
773
+ );
774
+ }
775
+ unset( $role, $role_data );
776
+ }
777
+ }
778
+
779
+ // WooCommerce BookStore - http://www.wpini.com/woocommerce-bookstore-plugin/
780
+ if( woo_ce_detect_export_plugin( 'wc_books' ) ) {
781
+ $custom_books = ( function_exists( 'woo_book_get_custom_fields' ) ? woo_book_get_custom_fields() : false );
782
+ if( !empty( $custom_books ) ) {
783
+ foreach( $custom_books as $custom_book ) {
784
+ if( !empty( $custom_book ) ) {
785
+ $fields[] = array(
786
+ 'name' => sprintf( 'book_%s', sanitize_key( $custom_book['name'] ) ),
787
+ 'label' => $custom_book['name'],
788
+ 'hover' => __( 'WooCommerce BookStore', 'woocommerce-exporter' ),
789
+ 'disabled' => 1
790
+ );
791
+ }
792
+ }
793
+ }
794
+ unset( $custom_books, $custom_book );
795
+ $fields[] = array(
796
+ 'name' => 'book_category',
797
+ 'label' => __( 'Book Category', 'woocommerce-exporter' ),
798
+ 'hover' => __( 'WooCommerce BookStore', 'woocommerce-exporter' ),
799
+ 'disabled' => 1
800
+ );
801
+ $fields[] = array(
802
+ 'name' => 'book_author',
803
+ 'label' => __( 'Book Author', 'woocommerce-exporter' ),
804
+ 'hover' => __( 'WooCommerce BookStore', 'woocommerce-exporter' ),
805
+ 'disabled' => 1
806
+ );
807
+ $fields[] = array(
808
+ 'name' => 'book_publisher',
809
+ 'label' => __( 'Book Publisher', 'woocommerce-exporter' ),
810
+ 'hover' => __( 'WooCommerce BookStore', 'woocommerce-exporter' ),
811
+ 'disabled' => 1
812
+ );
813
+ }
814
+
815
+ // WooCommerce Multilingual - https://wordpress.org/plugins/woocommerce-multilingual/
816
+ if( woo_ce_detect_wpml() && woo_ce_detect_export_plugin( 'wpml_wc' ) ) {
817
+ $fields[] = array(
818
+ 'name' => 'language',
819
+ 'label' => __( 'Language', 'woocommerce-exporter' ),
820
+ 'hover' => __( 'WooCommerce Multilingual', 'woocommerce-exporter' ),
821
+ 'disabled' => 1
822
+ );
823
+ }
824
+
825
+ // WooCommerce Jetpack - http://woojetpack.com/shop/wordpress-woocommerce-jetpack-plus/
826
+ if( woo_ce_detect_export_plugin( 'woocommerce_jetpack' ) || woo_ce_detect_export_plugin( 'woocommerce_jetpack_plus' ) ) {
827
+
828
+ // @mod - Needs alot of love in 2.4+, JetPack Plus, now Booster is huge
829
+
830
+ // Check for Product Cost Price
831
+ if( get_option( 'wcj_purchase_price_enabled', false ) == 'yes' ) {
832
+ $fields[] = array(
833
+ 'name' => 'wcj_purchase_price',
834
+ 'label' => __( 'Product cost (purchase) price', 'woocommerce-jetpack' ),
835
+ 'hover' => __( 'WooCommerce Jetpack', 'woocommerce-exporter' ),
836
+ 'disabled' => 1
837
+ );
838
+ $fields[] = array(
839
+ 'name' => 'wcj_purchase_price_extra',
840
+ 'label' => __( 'Extra expenses (shipping etc.)', 'woocommerce-jetpack' ),
841
+ 'hover' => __( 'WooCommerce Jetpack', 'woocommerce-exporter' ),
842
+ 'disabled' => 1
843
+ );
844
+ $fields[] = array(
845
+ 'name' => 'wcj_purchase_price_affiliate_commission',
846
+ 'label' => __( 'Affiliate commission', 'woocommerce-jetpack' ),
847
+ 'hover' => __( 'WooCommerce Jetpack', 'woocommerce-exporter' ),
848
+ 'disabled' => 1
849
+ );
850
+ // @mod - Let's add custom Product Cost Price fields once we get some more Booster modules sorted.
851
+ $fields[] = array(
852
+ 'name' => 'wcj_purchase_date',
853
+ 'label' => __( '(Last) Purchase date', 'woocommerce-jetpack' ),
854
+ 'hover' => __( 'WooCommerce Jetpack', 'woocommerce-exporter' ),
855
+ 'disabled' => 1
856
+ );
857
+ $fields[] = array(
858
+ 'name' => 'wcj_purchase_partner',
859
+ 'label' => __( 'Seller', 'woocommerce-jetpack' ),
860
+ 'hover' => __( 'WooCommerce Jetpack', 'woocommerce-exporter' ),
861
+ 'disabled' => 1
862
+ );
863
+ $fields[] = array(
864
+ 'name' => 'wcj_purchase_info',
865
+ 'label' => __( 'Purchase info', 'woocommerce-jetpack' ),
866
+ 'hover' => __( 'WooCommerce Jetpack', 'woocommerce-exporter' ),
867
+ 'disabled' => 1
868
+ );
869
+ }
870
+
871
+ /*
872
+ // Check if Call for Price is enabled
873
+ if( get_option( 'wcj_call_for_price_enabled', false ) == 'yes' ) {
874
+ // Instead of the price
875
+ $fields[] = array(
876
+ 'name' => 'wcf_price_instead',
877
+ 'label' => __( 'Instead of the ', 'woocommerce-exporter' ),
878
+ 'hover' => __( 'WooCommerce Jetpack', 'woocommerce-exporter' ),
879
+ 'disabled' => 1
880
+ );
881
+ // WooCommerce Jetpack Plus fields
882
+ if( woo_ce_detect_export_plugin( 'woocommerce_jetpack_plus' ) ) {
883
+ // Do something
884
+ }
885
+ }
886
+ */
887
+
888
+ }
889
+
890
+ // WooCommerce Ultimate Multi Currency Suite - https://codecanyon.net/item/woocommerce-ultimate-multi-currency-suite/11997014
891
+ if( woo_ce_detect_export_plugin( 'wc_umcs' ) ) {
892
+ $currencies = json_decode( get_option( 'wcumcs_available_currencies' ) );
893
+ if( !empty( $currencies ) ) {
894
+ $current_currency = ( function_exists( 'get_woocommerce_currency' ) ? get_woocommerce_currency() : false );
895
+ foreach( $currencies as $currency_code => $currency_data ) {
896
+ // Skip the base currency
897
+ if( $currency_code == $current_currency )
898
+ continue;
899
+ // Regular Price
900
+ $fields[] = array(
901
+ 'name' => sprintf( 'wcumcs_regular_price_%s', sanitize_key( $currency_code ) ),
902
+ 'label' => sprintf( __( 'Regular Price (%s)', 'woocommerce-exporter' ), $currency_code ),
903
+ 'hover' => __( 'WooCommerce Ultimate Multi Currency Suite', 'woocommerce-exporter' ),
904
+ 'disabled' => 1
905
+ );
906
+ // Sale Price
907
+ $fields[] = array(
908
+ 'name' => sprintf( 'wcumcs_sale_price_%s', sanitize_key( $currency_code ) ),
909
+ 'label' => sprintf( __( 'Sale Price (%s)', 'woocommerce-exporter' ), $currency_code ),
910
+ 'hover' => __( 'WooCommerce Ultimate Multi Currency Suite', 'woocommerce-exporter' ),
911
+ 'disabled' => 1
912
+ );
913
+ }
914
+ unset( $currency_code, $currency_data, $current_currency );
915
+ }
916
+ unset( $currencies );
917
+ }
918
+
919
+ // Products Purchase Price for Woocommerce - https://wordpress.org/plugins/products-purchase-price-for-woocommerce/
920
+ if( woo_ce_detect_export_plugin( 'wc_products_purchase_price' ) ) {
921
+ $fields[] = array(
922
+ 'name' => 'purchase_price',
923
+ 'label' => __( 'Purchase Price', 'woocommerce-exporter' ),
924
+ 'hover' => __( 'Products Purchase Price for WooCommerce', 'woocommerce-exporter' ),
925
+ 'disabled' => 1
926
+ );
927
+ }
928
+
929
+ // WooCommerce Wholesale Prices - https://wordpress.org/plugins/woocommerce-wholesale-prices/
930
+ if( woo_ce_detect_export_plugin( 'wc_wholesale_prices' ) ) {
931
+ $wholesale_roles = woo_ce_get_wholesale_prices_roles();
932
+ if( !empty( $wholesale_roles ) ) {
933
+ foreach( $wholesale_roles as $key => $wholesale_role ) {
934
+ $fields[] = array(
935
+ 'name' => sprintf( '%s_wholesale_price', $key ),
936
+ 'label' => sprintf( __( 'Wholesale Price: %s', 'woocommerce-exporter' ), $wholesale_role['roleName'] ),
937
+ 'hover' => __( 'WooCommerce Wholesale Prices', 'woocommerce-exporter' ),
938
+ 'disabled' => 1
939
+ );
940
+ }
941
+ }
942
+ unset( $wholesale_roles, $wholesale_role, $key );
943
+ }
944
+
945
+ // WooCommerce Currency Switcher - http://dev.pathtoenlightenment.net/shop
946
+ if( woo_ce_detect_export_plugin( 'currency_switcher' ) ) {
947
+ $options = get_option( 'wc_aelia_currency_switcher' );
948
+ $currencies = ( isset( $options['enabled_currencies'] ) ? $options['enabled_currencies'] : false );
949
+ if( !empty( $currencies ) ) {
950
+ $woocommerce_currency = get_option( 'woocommerce_currency' );
951
+ foreach( $currencies as $currency ) {
952
+
953
+ // Skip the WooCommerce default currency
954
+ if( $woocommerce_currency == $currency )
955
+ continue;
956
+
957
+ $fields[] = array(
958
+ 'name' => sprintf( 'wcae_regular_price_%s', sanitize_key( $currency ) ),
959
+ 'label' => sprintf( __( 'Regular Price (%s)', 'woocommerce-exporter' ), $currency ),
960
+ 'hover' => __( 'WooCommerce Currency Switcher', 'woocommerce-exporter' ),
961
+ 'disabled' => 1
962
+ );
963
+ $fields[] = array(
964
+ 'name' => sprintf( 'wcae_sale_price_%s', sanitize_key( $currency ) ),
965
+ 'label' => sprintf( __( 'Sale Price (%s)', 'woocommerce-exporter' ), $currency ),
966
+ 'hover' => __( 'WooCommerce Currency Switcher', 'woocommerce-exporter' ),
967
+ 'disabled' => 1
968
+ );
969
+
970
+ }
971
+ unset( $woocommerce_currency, $currencies, $currency );
972
+ }
973
+ unset( $options );
974
+ }
975
+
976
+ // WooCommerce Show Single Variations - https://iconicwp.com/products/woocommerce-show-single-variations/
977
+ if( woo_ce_detect_export_plugin( 'wc_show_single_variations' ) ) {
978
+ $fields[] = array(
979
+ 'name' => 'show_search_results',
980
+ 'label' => __( 'Show in Search Results', 'woocommerce-exporter' ),
981
+ 'hover' => __( 'WooCommerce Show Single Variations', 'woocommerce-exporter' ),
982
+ 'disabled' => 1
983
+ );
984
+ $fields[] = array(
985
+ 'name' => 'show_filtered_results',
986
+ 'label' => __( 'Show in Filtered Results', 'woocommerce-exporter' ),
987
+ 'hover' => __( 'WooCommerce Show Single Variations', 'woocommerce-exporter' ),
988
+ 'disabled' => 1
989
+ );
990
+ $fields[] = array(
991
+ 'name' => 'show_catalog',
992
+ 'label' => __( 'Show in Catalog', 'woocommerce-exporter' ),
993
+ 'hover' => __( 'WooCommerce Show Single Variations', 'woocommerce-exporter' ),
994
+ 'disabled' => 1
995
+ );
996
+ $fields[] = array(
997
+ 'name' => 'disable_add_to_cart',
998
+ 'label' => __( 'Disable Add to Cart', 'woocommerce-exporter' ),
999
+ 'hover' => __( 'WooCommerce Show Single Variations', 'woocommerce-exporter' ),
1000
+ 'disabled' => 1
1001
+ );
1002
+ }
1003
+
1004
+ // WooCommerce Deposits - https://woocommerce.com/products/woocommerce-deposits/
1005
+ if( woo_ce_detect_export_plugin( 'wc_deposits' ) ) {
1006
+ $fields[] = array(
1007
+ 'name' => 'enable_deposit',
1008
+ 'label' => __( 'Enable Deposit', 'woocommerce-exporter' ),
1009
+ 'hover' => __( 'WooCommerce Deposits', 'woocommerce-exporter' ),
1010
+ 'disabled' => 1
1011
+ );
1012
+ $fields[] = array(
1013
+ 'name' => 'force_deposit',
1014
+ 'label' => __( 'Force Deposit', 'woocommerce-exporter' ),
1015
+ 'hover' => __( 'WooCommerce Deposits', 'woocommerce-exporter' ),
1016
+ 'disabled' => 1
1017
+ );
1018
+ $fields[] = array(
1019
+ 'name' => 'amount_type',
1020
+ 'label' => __( 'Deposit Type', 'woocommerce-exporter' ),
1021
+ 'hover' => __( 'WooCommerce Deposits', 'woocommerce-exporter' ),
1022
+ 'disabled' => 1
1023
+ );
1024
+ $fields[] = array(
1025
+ 'name' => 'deposit_amount',
1026
+ 'label' => __( 'Deposit Amount', 'woocommerce-exporter' ),
1027
+ 'hover' => __( 'WooCommerce Deposits', 'woocommerce-exporter' ),
1028
+ 'disabled' => 1
1029
+ );
1030
+ }
1031
+
1032
+ // WooCommerce Unit of Measure - https://wordpress.org/plugins/woocommerce-unit-of-measure/
1033
+ if( woo_ce_detect_export_plugin( 'wc_unitofmeasure' ) ) {
1034
+ $fields[] = array(
1035
+ 'name' => 'unit_of_measure',
1036
+ 'label' => __( 'Unit of Measure', 'woocommerce-exporter' ),
1037
+ 'hover' => __( 'WooCommerce Unit of Measure', 'woocommerce-exporter' ),
1038
+ 'disabled' => 1
1039
+ );
1040
+ }
1041
+
1042
+ // WooCommerce Easy Bookings - https://wordpress.org/plugins/woocommerce-easy-booking-system/
1043
+ if( woo_ce_detect_export_plugin( 'wc_easybooking' ) ) {
1044
+ $fields[] = array(
1045
+ 'name' => 'bookable',
1046
+ 'label' => __( 'Bookable', 'woocommerce-exporter' ),
1047
+ 'hover' => __( 'WooCommerce Easy Bookings', 'woocommerce-exporter' ),
1048
+ 'disabled' => 1
1049
+ );
1050
+ $fields[] = array(
1051
+ 'name' => 'booking_dates',
1052
+ 'label' => __( 'Number of Dates to Select', 'woocommerce-exporter' ),
1053
+ 'hover' => __( 'WooCommerce Easy Bookings', 'woocommerce-exporter' ),
1054
+ 'disabled' => 1
1055
+ );
1056
+ $fields[] = array(
1057
+ 'name' => 'booking_duration',
1058
+ 'label' => __( 'Booking Duration', 'woocommerce-exporter' ),
1059
+ 'hover' => __( 'WooCommerce Easy Bookings', 'woocommerce-exporter' ),
1060
+ 'disabled' => 1
1061
+ );
1062
+ $fields[] = array(
1063
+ 'name' => 'booking_min',
1064
+ 'label' => __( 'Minimum Booking Duration', 'woocommerce-exporter' ),
1065
+ 'hover' => __( 'WooCommerce Easy Bookings', 'woocommerce-exporter' ),
1066
+ 'disabled' => 1
1067
+ );
1068
+ $fields[] = array(
1069
+ 'name' => 'booking_max',
1070
+ 'label' => __( 'Maximum Booking Duration', 'woocommerce-exporter' ),
1071
+ 'hover' => __( 'WooCommerce Easy Bookings', 'woocommerce-exporter' ),
1072
+ 'disabled' => 1
1073
+ );
1074
+ $fields[] = array(
1075
+ 'name' => 'first_available_date',
1076
+ 'label' => __( 'First Available Date', 'woocommerce-exporter' ),
1077
+ 'hover' => __( 'WooCommerce Easy Bookings', 'woocommerce-exporter' ),
1078
+ 'disabled' => 1
1079
+ );
1080
+ }
1081
+
1082
+ // WooCommerce Advanced Product Quantities - http://www.wpbackoffice.com/plugins/woocommerce-incremental-product-quantities/
1083
+ if( woo_ce_detect_export_plugin( 'wc_advanced_quantities' ) ) {
1084
+ $fields[] = array(
1085
+ 'name' => 'deactivate_quantity_rules',
1086
+ 'label' => __( 'De-activate Quantity Rules', 'woocommerce-exporter' ),
1087
+ 'hover' => __( 'WooCommerce Advanced Product Quantities', 'woocommerce-exporter' ),
1088
+ 'disabled' => 1
1089
+ );
1090
+ $fields[] = array(
1091
+ 'name' => 'override_quantity_rules',
1092
+ 'label' => __( 'Override Quantity Rules', 'woocommerce-exporter' ),
1093
+ 'hover' => __( 'WooCommerce Advanced Product Quantities', 'woocommerce-exporter' ),
1094
+ 'disabled' => 1
1095
+ );
1096
+ $fields[] = array(
1097
+ 'name' => 'step_value',
1098
+ 'label' => __( 'Step Value', 'woocommerce-exporter' ),
1099
+ 'hover' => __( 'WooCommerce Advanced Product Quantities', 'woocommerce-exporter' ),
1100
+ 'disabled' => 1
1101
+ );
1102
+ $fields[] = array(
1103
+ 'name' => 'minimum_quantity',
1104
+ 'label' => __( 'Minimum Quantity', 'woocommerce-exporter' ),
1105
+ 'hover' => __( 'WooCommerce Advanced Product Quantities', 'woocommerce-exporter' ),
1106
+ 'disabled' => 1
1107
+ );
1108
+ $fields[] = array(
1109
+ 'name' => 'maximum_quantity',
1110
+ 'label' => __( 'Maximum Quantity', 'woocommerce-exporter' ),
1111
+ 'hover' => __( 'WooCommerce Advanced Product Quantities', 'woocommerce-exporter' ),
1112
+ 'disabled' => 1
1113
+ );
1114
+ $fields[] = array(
1115
+ 'name' => 'oos_minimum',
1116
+ 'label' => __( 'Out of Stock Minimum', 'woocommerce-exporter' ),
1117
+ 'hover' => __( 'WooCommerce Advanced Product Quantities', 'woocommerce-exporter' ),
1118
+ 'disabled' => 1
1119
+ );
1120
+ $fields[] = array(
1121
+ 'name' => 'oos_maximum',
1122
+ 'label' => __( 'Out of Stock Maximum', 'woocommerce-exporter' ),
1123
+ 'hover' => __( 'WooCommerce Advanced Product Quantities', 'woocommerce-exporter' ),
1124
+ 'disabled' => 1
1125
+ );
1126
+ }
1127
+
1128
+ // Custom Product meta
1129
+ $custom_products = woo_ce_get_option( 'custom_products', '' );
1130
+ if( !empty( $custom_products ) ) {
1131
+ foreach( $custom_products as $custom_product ) {
1132
+ if( !empty( $custom_product ) ) {
1133
+ $fields[] = array(
1134
+ 'name' => $custom_product,
1135
+ 'label' => woo_ce_clean_export_label( $custom_product ),
1136
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_product_fields_custom_product_hover', '%s: %s' ), __( 'Custom Product', 'woocommerce-exporter' ), $custom_product )
1137
+ );
1138
+ }
1139
+ }
1140
+ }
1141
+ unset( $custom_products, $custom_product );
1142
+
1143
+ return $fields;
1144
+
1145
+ }
1146
+ add_filter( 'woo_ce_product_fields', 'woo_ce_extend_product_fields' );
1147
+
1148
+ function woo_ce_extend_product_item( $product, $product_id ) {
1149
+
1150
+ // Advanced Google Product Feed - http://plugins.leewillis.co.uk/downloads/wp-e-commerce-product-feeds/
1151
+ if( woo_ce_detect_export_plugin( 'gpf' ) ) {
1152
+ $gpf_data = get_post_meta( $product_id, '_woocommerce_gpf_data', true );
1153
+ $product->gpf_availability = ( isset( $gpf_data['availability'] ) ? woo_ce_format_gpf_availability( $gpf_data['availability'] ) : '' );
1154
+ $product->gpf_condition = ( isset( $gpf_data['condition'] ) ? woo_ce_format_gpf_condition( $gpf_data['condition'] ) : '' );
1155
+ $product->gpf_brand = ( isset( $gpf_data['brand'] ) ? $gpf_data['brand'] : '' );
1156
+ $product->gpf_product_type = ( isset( $gpf_data['product_type'] ) ? $gpf_data['product_type'] : '' );
1157
+ $product->gpf_google_product_category = ( isset( $gpf_data['google_product_category'] ) ? $gpf_data['google_product_category'] : '' );
1158
+ $product->gpf_gtin = ( isset( $gpf_data['gtin'] ) ? $gpf_data['gtin'] : '' );
1159
+ $product->gpf_mpn = ( isset( $gpf_data['mpn'] ) ? $gpf_data['mpn'] : '' );
1160
+ $product->gpf_gender = ( isset( $gpf_data['gender'] ) ? $gpf_data['gender'] : '' );
1161
+ $product->gpf_age_group = ( isset( $gpf_data['age_group'] ) ? $gpf_data['age_group'] : '' );
1162
+ $product->gpf_color = ( isset( $gpf_data['color'] ) ? $gpf_data['color'] : '' );
1163
+ $product->gpf_size = ( isset( $gpf_data['size'] ) ? $gpf_data['size'] : '' );
1164
+ unset( $gpf_data );
1165
+ }
1166
+
1167
+ // All in One SEO Pack - http://wordpress.org/extend/plugins/all-in-one-seo-pack/
1168
+ if( woo_ce_detect_export_plugin( 'aioseop' ) ) {
1169
+ $product->aioseop_keywords = get_post_meta( $product_id, '_aioseop_keywords', true );
1170
+ $product->aioseop_description = get_post_meta( $product_id, '_aioseop_description', true );
1171
+ $product->aioseop_title = get_post_meta( $product_id, '_aioseop_title', true );
1172
+ $product->aioseop_title_attributes = get_post_meta( $product_id, '_aioseop_titleatr', true );
1173
+ $product->aioseop_menu_label = get_post_meta( $product_id, '_aioseop_menulabel', true );
1174
+ }
1175
+
1176
+ // WordPress SEO - http://wordpress.org/plugins/wordpress-seo/
1177
+ if( woo_ce_detect_export_plugin( 'wpseo' ) ) {
1178
+ $product->wpseo_focuskw = get_post_meta( $product_id, '_yoast_wpseo_focuskw', true );
1179
+ $product->wpseo_metadesc = get_post_meta( $product_id, '_yoast_wpseo_metadesc', true );
1180
+ $product->wpseo_title = get_post_meta( $product_id, '_yoast_wpseo_title', true );
1181
+ $product->wpseo_noindex = woo_ce_format_wpseo_noindex( get_post_meta( $product_id, '_yoast_wpseo_meta-robots-noindex', true ) );
1182
+ $product->wpseo_follow = woo_ce_format_wpseo_follow( get_post_meta( $product_id, '_yoast_wpseo_meta-robots-nofollow', true ) );
1183
+ $product->wpseo_googleplus_description = get_post_meta( $product_id, '_yoast_wpseo_google-plus-description', true );
1184
+ $product->wpseo_opengraph_title = get_post_meta( $product_id, '_yoast_wpseo_opengraph-title', true );
1185
+ $product->wpseo_opengraph_description = get_post_meta( $product_id, '_yoast_wpseo_opengraph-description', true );
1186
+ $product->wpseo_opengraph_image = get_post_meta( $product_id, '_yoast_wpseo_opengraph-image', true );
1187
+ $product->wpseo_twitter_title = get_post_meta( $product_id, '_yoast_wpseo_twitter-title', true );
1188
+ $product->wpseo_twitter_description = get_post_meta( $product_id, '_yoast_wpseo_twitter-description', true );
1189
+ $product->wpseo_twitter_image = get_post_meta( $product_id, '_yoast_wpseo_twitter-image', true );
1190
+ }
1191
+
1192
+ // Ultimate SEO - http://wordpress.org/plugins/seo-ultimate/
1193
+ if( woo_ce_detect_export_plugin( 'ultimate_seo' ) ) {
1194
+ $product->useo_meta_title = get_post_meta( $product_id, '_su_title', true );
1195
+ $product->useo_meta_description = get_post_meta( $product_id, '_su_description', true );
1196
+ $product->useo_meta_keywords = get_post_meta( $product_id, '_su_keywords', true );
1197
+ $product->useo_social_title = get_post_meta( $product_id, '_su_og_title', true );
1198
+ $product->useo_social_description = get_post_meta( $product_id, '_su_og_description', true );
1199
+ $product->useo_meta_noindex = get_post_meta( $product_id, '_su_meta_robots_noindex', true );
1200
+ $product->useo_meta_noautolinks = get_post_meta( $product_id, '_su_disable_autolinks', true );
1201
+ }
1202
+
1203
+ // WooCommerce MSRP Pricing - http://woothemes.com/woocommerce/
1204
+ if( woo_ce_detect_export_plugin( 'wc_msrp' ) ) {
1205
+ $product->msrp = get_post_meta( $product_id, '_msrp_price', true );
1206
+ if( $product->msrp == false && $product->post_type == 'product_variation' )
1207
+ $product->msrp = get_post_meta( $product_id, '_msrp', true );
1208
+ // Check that a valid price has been provided and that wc_format_localized_price() exists
1209
+ if( isset( $product->msrp ) && $product->msrp != '' && function_exists( 'wc_format_localized_price' ) )
1210
+ $product->msrp = wc_format_localized_price( $product->msrp );
1211
+ }
1212
+
1213
+ // Custom Product meta
1214
+ $custom_products = woo_ce_get_option( 'custom_products', '' );
1215
+ if( !empty( $custom_products ) ) {
1216
+ foreach( $custom_products as $custom_product ) {
1217
+ // Check that the custom Product name is filled and it hasn't previously been set
1218
+ if( !empty( $custom_product ) && !isset( $product->{$custom_product} ) )
1219
+ $product->{$custom_product} = get_post_meta( $product_id, $custom_product, true );
1220
+ }
1221
+ }
1222
+
1223
+ return $product;
1224
+
1225
+ }
1226
+ add_filter( 'woo_ce_product_item', 'woo_ce_extend_product_item', 10, 2 );
1227
+
1228
+ function woo_ce_get_wccf_product_properties() {
1229
+
1230
+ $post_type = 'wccf_product_prop';
1231
+ $args = array(
1232
+ 'post_type' => $post_type,
1233
+ 'post_status' => 'publish',
1234
+ 'posts_per_page' => -1
1235
+ );
1236
+ $product_fields = new WP_Query( $args );
1237
+ if( !empty( $product_fields->posts ) ) {
1238
+ return $product_fields->posts;
1239
+ }
1240
+
1241
+ }
1242
+
1243
+ function woo_ce_format_wpseo_noindex( $noindex = '' ) {
1244
+
1245
+ $output = $noindex;
1246
+ if( !empty( $noindex ) && $noindex !== '0' ) {
1247
+ switch( $noindex ) {
1248
+
1249
+ case '0':
1250
+ case 'default':
1251
+ default:
1252
+ $output = __( 'Default', 'woocommerce-exporter' );
1253
+ break;
1254
+
1255
+ case '2':
1256
+ case 'index':
1257
+ $output = __( 'Always index', 'woocommerce-exporter' );
1258
+ break;
1259
+
1260
+ case '1':
1261
+ case 'noindex':
1262
+ $output = __( 'Always noindex', 'woocommerce-exporter' );
1263
+ break;
1264
+
1265
+ }
1266
+ }
1267
+ return $output;
1268
+
1269
+ }
1270
+
1271
+ function woo_ce_format_wpseo_follow( $follow = '' ) {
1272
+
1273
+ $output = $follow;
1274
+ if( !empty( $follow ) && $follow !== '0' ) {
1275
+ switch( $follow ) {
1276
+
1277
+ case '0':
1278
+ default:
1279
+ $output = __( 'follow', 'woocommerce-exporter' );
1280
+ break;
1281
+
1282
+ case '1':
1283
+ $output = __( 'nofollow', 'woocommerce-exporter' );
1284
+ break;
1285
+
1286
+ }
1287
+ }
1288
+ return $output;
1289
+
1290
+ }
1291
+
1292
+ // WooCommerce Wholesale Prices - https://wordpress.org/plugins/woocommerce-wholesale-prices/
1293
+ function woo_ce_get_wholesale_prices_roles() {
1294
+
1295
+ $output = false;
1296
+ $option_name = ( defined( 'WWP_OPTIONS_REGISTERED_CUSTOM_ROLES' ) ? WWP_OPTIONS_REGISTERED_CUSTOM_ROLES : 'wwp_options_registered_custom_roles' );
1297
+ $wholesale_roles = unserialize( get_option( $option_name ) );
1298
+ if( is_array( $wholesale_roles ) )
1299
+ $output = $wholesale_roles;
1300
+ unset( $wholesale_roles );
1301
+ return $output;
1302
+
1303
+ }
1304
+ ?>
includes/product.php ADDED
@@ -0,0 +1,1392 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ if( !function_exists( 'woo_ce_get_export_type_product_count' ) ) {
7
+ function woo_ce_get_export_type_product_count() {
8
+
9
+ $count = 0;
10
+ $post_type = apply_filters( 'woo_ce_get_export_type_product_count_post_types', array( 'product', 'product_variation' ) );
11
+
12
+ // Check if the existing Transient exists
13
+ $cached = get_transient( WOO_CE_PREFIX . '_product_count' );
14
+ if( $cached == false ) {
15
+ $args = array(
16
+ 'post_type' => $post_type,
17
+ 'posts_per_page' => 1,
18
+ 'fields' => 'ids',
19
+ 'suppress_filters' => true
20
+ );
21
+ $count_query = new WP_Query( $args );
22
+ $count = $count_query->found_posts;
23
+ set_transient( WOO_CE_PREFIX . '_product_count', $count, HOUR_IN_SECONDS );
24
+ } else {
25
+ $count = $cached;
26
+ }
27
+ return $count;
28
+
29
+ }
30
+ }
31
+
32
+ /* End of: WordPress Administration */
33
+
34
+ }
35
+
36
+ // Returns a list of Product export columns
37
+ function woo_ce_get_product_fields( $format = 'full' ) {
38
+
39
+ $export_type = 'product';
40
+
41
+ $fields = array();
42
+ $fields[] = array(
43
+ 'name' => 'parent_id',
44
+ 'label' => __( 'Parent ID', 'woocommerce-exporter' )
45
+ );
46
+ $fields[] = array(
47
+ 'name' => 'parent_sku',
48
+ 'label' => __( 'Parent SKU', 'woocommerce-exporter' )
49
+ );
50
+ $fields[] = array(
51
+ 'name' => 'product_id',
52
+ 'label' => __( 'Product ID', 'woocommerce-exporter' )
53
+ );
54
+ $fields[] = array(
55
+ 'name' => 'sku',
56
+ 'label' => __( 'Product SKU', 'woocommerce-exporter' )
57
+ );
58
+ $fields[] = array(
59
+ 'name' => 'name',
60
+ 'label' => __( 'Product Name', 'woocommerce-exporter' )
61
+ );
62
+ $fields[] = array(
63
+ 'name' => 'post_title',
64
+ 'label' => __( 'Post Title', 'woocommerce-exporter' )
65
+ );
66
+ $fields[] = array(
67
+ 'name' => 'slug',
68
+ 'label' => __( 'Slug', 'woocommerce-exporter' )
69
+ );
70
+ $fields[] = array(
71
+ 'name' => 'permalink',
72
+ 'label' => __( 'Permalink', 'woocommerce-exporter' )
73
+ );
74
+ $fields[] = array(
75
+ 'name' => 'product_url',
76
+ 'label' => __( 'Product URI', 'woocommerce-exporter' )
77
+ );
78
+ $fields[] = array(
79
+ 'name' => 'description',
80
+ 'label' => __( 'Description', 'woocommerce-exporter' )
81
+ );
82
+ $fields[] = array(
83
+ 'name' => 'excerpt',
84
+ 'label' => __( 'Excerpt', 'woocommerce-exporter' )
85
+ );
86
+ $fields[] = array(
87
+ 'name' => 'post_date',
88
+ 'label' => __( 'Product Published', 'woocommerce-exporter' )
89
+ );
90
+ $fields[] = array(
91
+ 'name' => 'post_modified',
92
+ 'label' => __( 'Product Modified', 'woocommerce-exporter' )
93
+ );
94
+ $fields[] = array(
95
+ 'name' => 'type',
96
+ 'label' => __( 'Type', 'woocommerce-exporter' )
97
+ );
98
+ $fields[] = array(
99
+ 'name' => 'visibility',
100
+ 'label' => __( 'Visibility', 'woocommerce-exporter' )
101
+ );
102
+ $fields[] = array(
103
+ 'name' => 'featured',
104
+ 'label' => __( 'Featured', 'woocommerce-exporter' )
105
+ );
106
+ $fields[] = array(
107
+ 'name' => 'virtual',
108
+ 'label' => __( 'Virtual', 'woocommerce-exporter' )
109
+ );
110
+ $fields[] = array(
111
+ 'name' => 'downloadable',
112
+ 'label' => __( 'Downloadable', 'woocommerce-exporter' )
113
+ );
114
+ $fields[] = array(
115
+ 'name' => 'price',
116
+ 'label' => __( 'Price', 'woocommerce-exporter' )
117
+ );
118
+ $fields[] = array(
119
+ 'name' => 'sale_price',
120
+ 'label' => __( 'Sale Price', 'woocommerce-exporter' )
121
+ );
122
+ $fields[] = array(
123
+ 'name' => 'sale_price_dates_from',
124
+ 'label' => __( 'Sale Price Dates From', 'woocommerce-exporter' )
125
+ );
126
+ $fields[] = array(
127
+ 'name' => 'sale_price_dates_to',
128
+ 'label' => __( 'Sale Price Dates To', 'woocommerce-exporter' )
129
+ );
130
+ $fields[] = array(
131
+ 'name' => 'weight',
132
+ 'label' => __( 'Weight', 'woocommerce-exporter' )
133
+ );
134
+ $fields[] = array(
135
+ 'name' => 'weight_unit',
136
+ 'label' => __( 'Weight Unit', 'woocommerce-exporter' )
137
+ );
138
+ $fields[] = array(
139
+ 'name' => 'height',
140
+ 'label' => __( 'Height', 'woocommerce-exporter' )
141
+ );
142
+ $fields[] = array(
143
+ 'name' => 'height_unit',
144
+ 'label' => __( 'Height Unit', 'woocommerce-exporter' )
145
+ );
146
+ $fields[] = array(
147
+ 'name' => 'width',
148
+ 'label' => __( 'Width', 'woocommerce-exporter' )
149
+ );
150
+ $fields[] = array(
151
+ 'name' => 'width_unit',
152
+ 'label' => __( 'Width Unit', 'woocommerce-exporter' )
153
+ );
154
+ $fields[] = array(
155
+ 'name' => 'length',
156
+ 'label' => __( 'Length', 'woocommerce-exporter' )
157
+ );
158
+ $fields[] = array(
159
+ 'name' => 'length_unit',
160
+ 'label' => __( 'Length Unit', 'woocommerce-exporter' )
161
+ );
162
+ $fields[] = array(
163
+ 'name' => 'category',
164
+ 'label' => __( 'Category', 'woocommerce-exporter' )
165
+ );
166
+ $fields[] = array(
167
+ 'name' => 'category_level_1',
168
+ 'label' => __( 'Category: Level 1', 'woocommerce-exporter' ),
169
+ 'disabled' => 1
170
+ );
171
+ $fields[] = array(
172
+ 'name' => 'category_level_2',
173
+ 'label' => __( 'Category: Level 2', 'woocommerce-exporter' ),
174
+ 'disabled' => 1
175
+ );
176
+ $fields[] = array(
177
+ 'name' => 'category_level_3',
178
+ 'label' => __( 'Category: Level 3', 'woocommerce-exporter' ),
179
+ 'disabled' => 1
180
+ );
181
+ $fields[] = array(
182
+ 'name' => 'tag',
183
+ 'label' => __( 'Tag', 'woocommerce-exporter' )
184
+ );
185
+ $fields[] = array(
186
+ 'name' => 'image',
187
+ 'label' => __( 'Featured Image', 'woocommerce-exporter' )
188
+ );
189
+ $fields[] = array(
190
+ 'name' => 'image_thumbnail',
191
+ 'label' => __( 'Featured Image Thumbnail', 'woocommerce-exporter' ),
192
+ 'disabled' => 1
193
+ );
194
+ $fields[] = array(
195
+ 'name' => 'image_embed',
196
+ 'label' => __( 'Featured Image (Embed)', 'woocommerce-exporter' ),
197
+ 'disabled' => 1
198
+ );
199
+ $fields[] = array(
200
+ 'name' => 'image_title',
201
+ 'label' => __( 'Featured Image Title', 'woocommerce-exporter' ),
202
+ 'disabled' => 1
203
+ );
204
+ $fields[] = array(
205
+ 'name' => 'image_caption',
206
+ 'label' => __( 'Featured Image Caption', 'woocommerce-exporter' ),
207
+ 'disabled' => 1
208
+ );
209
+ $fields[] = array(
210
+ 'name' => 'image_alt',
211
+ 'label' => __( 'Featured Image Alternative Text', 'woocommerce-exporter' ),
212
+ 'disabled' => 1
213
+ );
214
+ $fields[] = array(
215
+ 'name' => 'image_description',
216
+ 'label' => __( 'Featured Image Description', 'woocommerce-exporter' ),
217
+ 'disabled' => 1
218
+ );
219
+ $fields[] = array(
220
+ 'name' => 'product_gallery',
221
+ 'label' => __( 'Product Gallery', 'woocommerce-exporter' )
222
+ );
223
+ $fields[] = array(
224
+ 'name' => 'product_gallery_thumbnail',
225
+ 'label' => __( 'Product Gallery Thumbnail', 'woocommerce-exporter' ),
226
+ 'disabled' => 1
227
+ );
228
+ $fields[] = array(
229
+ 'name' => 'product_gallery_embed',
230
+ 'label' => __( 'Product Gallery (Embed)', 'woocommerce-exporter' ),
231
+ 'disabled' => 1
232
+ );
233
+ $fields[] = array(
234
+ 'name' => 'tax_status',
235
+ 'label' => __( 'Tax Status', 'woocommerce-exporter' )
236
+ );
237
+ $fields[] = array(
238
+ 'name' => 'tax_class',
239
+ 'label' => __( 'Tax Class', 'woocommerce-exporter' )
240
+ );
241
+ $fields[] = array(
242
+ 'name' => 'shipping_class',
243
+ 'label' => __( 'Shipping Class', 'woocommerce-exporter' )
244
+ );
245
+ $fields[] = array(
246
+ 'name' => 'download_file_name',
247
+ 'label' => __( 'Download File Name', 'woocommerce-exporter' )
248
+ );
249
+ $fields[] = array(
250
+ 'name' => 'download_file_path',
251
+ 'label' => __( 'Download File URL Path', 'woocommerce-exporter' )
252
+ );
253
+ $fields[] = array(
254
+ 'name' => 'download_limit',
255
+ 'label' => __( 'Download Limit', 'woocommerce-exporter' )
256
+ );
257
+ $fields[] = array(
258
+ 'name' => 'download_expiry',
259
+ 'label' => __( 'Download Expiry', 'woocommerce-exporter' )
260
+ );
261
+ $fields[] = array(
262
+ 'name' => 'download_type',
263
+ 'label' => __( 'Download Type', 'woocommerce-exporter' )
264
+ );
265
+ $fields[] = array(
266
+ 'name' => 'manage_stock',
267
+ 'label' => __( 'Manage Stock', 'woocommerce-exporter' )
268
+ );
269
+ $fields[] = array(
270
+ 'name' => 'quantity',
271
+ 'label' => __( 'Quantity', 'woocommerce-exporter' )
272
+ );
273
+ $fields[] = array(
274
+ 'name' => 'stock_status',
275
+ 'label' => __( 'Stock Status', 'woocommerce-exporter' )
276
+ );
277
+ $fields[] = array(
278
+ 'name' => 'allow_backorders',
279
+ 'label' => __( 'Allow Backorders', 'woocommerce-exporter' )
280
+ );
281
+ $fields[] = array(
282
+ 'name' => 'sold_individually',
283
+ 'label' => __( 'Sold Individually', 'woocommerce-exporter' )
284
+ );
285
+ $fields[] = array(
286
+ 'name' => 'total_sales',
287
+ 'label' => __( 'Total Sales', 'woocommerce-exporter' ),
288
+ 'disabled' => 1
289
+ );
290
+ $fields[] = array(
291
+ 'name' => 'upsell_ids',
292
+ 'label' => __( 'Up-Sells', 'woocommerce-exporter' )
293
+ );
294
+ $fields[] = array(
295
+ 'name' => 'crosssell_ids',
296
+ 'label' => __( 'Cross-Sells', 'woocommerce-exporter' )
297
+ );
298
+ $fields[] = array(
299
+ 'name' => 'external_url',
300
+ 'label' => __( 'External URL', 'woocommerce-exporter' )
301
+ );
302
+ $fields[] = array(
303
+ 'name' => 'button_text',
304
+ 'label' => __( 'Button Text', 'woocommerce-exporter' )
305
+ );
306
+ $fields[] = array(
307
+ 'name' => 'purchase_note',
308
+ 'label' => __( 'Purchase Note', 'woocommerce-exporter' )
309
+ );
310
+ $fields[] = array(
311
+ 'name' => 'product_status',
312
+ 'label' => __( 'Product Status', 'woocommerce-exporter' )
313
+ );
314
+ $fields[] = array(
315
+ 'name' => 'enable_reviews',
316
+ 'label' => __( 'Enable Reviews', 'woocommerce-exporter' )
317
+ );
318
+ $fields[] = array(
319
+ 'name' => 'review_count',
320
+ 'label' => __( 'Review Count', 'woocommerce-exporter' ),
321
+ 'disabled' => 1
322
+ );
323
+ $fields[] = array(
324
+ 'name' => 'rating_count',
325
+ 'label' => __( 'Rating Count', 'woocommerce-exporter' ),
326
+ 'disabled' => 1
327
+ );
328
+ $fields[] = array(
329
+ 'name' => 'average_rating',
330
+ 'label' => __( 'Average Rating', 'woocommerce-exporter' ),
331
+ 'disabled' => 1
332
+ );
333
+ $fields[] = array(
334
+ 'name' => 'menu_order',
335
+ 'label' => __( 'Sort Order', 'woocommerce-exporter' )
336
+ );
337
+
338
+ /*
339
+ $fields[] = array(
340
+ 'name' => '',
341
+ 'label' => __( '', 'woocommerce-exporter' )
342
+ );
343
+ */
344
+
345
+ // Drop in our content filters here
346
+ add_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
347
+
348
+ // Allow Plugin/Theme authors to add support for additional columns
349
+ $fields = apply_filters( sprintf( WOO_CE_PREFIX . '_%s_fields', $export_type ), $fields, $export_type );
350
+
351
+ // Remove our content filters here to play nice with other Plugins
352
+ remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
353
+
354
+ $remember = woo_ce_get_option( $export_type . '_fields', array() );
355
+ if( !empty( $remember ) ) {
356
+ $remember = maybe_unserialize( $remember );
357
+ $size = count( $fields );
358
+ for( $i = 0; $i < $size; $i++ ) {
359
+ $fields[$i]['disabled'] = ( isset( $fields[$i]['disabled'] ) ? $fields[$i]['disabled'] : 0 );
360
+ $fields[$i]['default'] = 1;
361
+ if( !array_key_exists( $fields[$i]['name'], $remember ) )
362
+ $fields[$i]['default'] = 0;
363
+ }
364
+ }
365
+
366
+ switch( $format ) {
367
+
368
+ case 'summary':
369
+ $output = array();
370
+ $size = count( $fields );
371
+ for( $i = 0; $i < $size; $i++ ) {
372
+ if( isset( $fields[$i] ) )
373
+ $output[$fields[$i]['name']] = 'on';
374
+ }
375
+ return $output;
376
+ break;
377
+
378
+ case 'full':
379
+ default:
380
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
381
+ $size = count( $fields );
382
+ for( $i = 0; $i < $size; $i++ ) {
383
+ $fields[$i]['reset'] = $i;
384
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
385
+ }
386
+ // Check if we are using PHP 5.3 and above
387
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
388
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
389
+ return $fields;
390
+ break;
391
+
392
+ }
393
+
394
+ }
395
+
396
+ // Check if we should override field labels from the Field Editor
397
+ function woo_ce_override_product_field_labels( $fields = array() ) {
398
+
399
+ $labels = woo_ce_get_option( 'product_labels', array() );
400
+ if( !empty( $labels ) ) {
401
+ foreach( $fields as $key => $field ) {
402
+ if( isset( $labels[$field['name']] ) )
403
+ $fields[$key]['label'] = $labels[$field['name']];
404
+ }
405
+ }
406
+ return $fields;
407
+
408
+ }
409
+ add_filter( 'woo_ce_product_fields', 'woo_ce_override_product_field_labels', 11 );
410
+
411
+ // Returns the export column header label based on an export column slug
412
+ function woo_ce_get_product_field( $name = null, $format = 'name' ) {
413
+
414
+ $output = '';
415
+ if( $name ) {
416
+ $fields = woo_ce_get_product_fields();
417
+ $size = count( $fields );
418
+ for( $i = 0; $i < $size; $i++ ) {
419
+ if( $fields[$i]['name'] == $name ) {
420
+ switch( $format ) {
421
+
422
+ case 'name':
423
+ $output = $fields[$i]['label'];
424
+ break;
425
+
426
+ case 'full':
427
+ $output = $fields[$i];
428
+ break;
429
+
430
+ }
431
+ $i = $size;
432
+ }
433
+ }
434
+ }
435
+ return $output;
436
+
437
+ }
438
+
439
+ // Returns a list of WooCommerce Products
440
+ function woo_ce_get_products( $args = array() ) {
441
+
442
+ global $export;
443
+
444
+ $limit_volume = -1;
445
+ $offset = 0;
446
+ $product_categories = false;
447
+ $product_tags = false;
448
+ $product_status = false;
449
+ $product_type = false;
450
+ $orderby = 'ID';
451
+ $order = 'ASC';
452
+ if( $args ) {
453
+ $limit_volume = ( isset( $args['limit_volume'] ) ? $args['limit_volume'] : false );
454
+ $offset = ( isset( $args['offset'] ) ? $args['offset'] : false );
455
+ if( !empty( $args['product_categories'] ) )
456
+ $product_categories = $args['product_categories'];
457
+ if( !empty( $args['product_tags'] ) )
458
+ $product_tags = $args['product_tags'];
459
+ if( !empty( $args['product_status'] ) )
460
+ $product_status = $args['product_status'];
461
+ if( !empty( $args['product_type'] ) )
462
+ $product_type = $args['product_type'];
463
+ if( isset( $args['product_orderby'] ) )
464
+ $orderby = $args['product_orderby'];
465
+ if( isset( $args['product_order'] ) )
466
+ $order = $args['product_order'];
467
+ }
468
+ $post_type = array( 'product', 'product_variation' );
469
+ $args = array(
470
+ 'post_type' => $post_type,
471
+ 'orderby' => $orderby,
472
+ 'order' => $order,
473
+ 'offset' => $offset,
474
+ 'posts_per_page' => $limit_volume,
475
+ 'post_status' => woo_ce_post_statuses(),
476
+ 'fields' => 'ids',
477
+ 'suppress_filters' => false
478
+ );
479
+ // Filter Products by Product Category
480
+ if( $product_categories ) {
481
+ $term_taxonomy = 'product_cat';
482
+ // Check if tax_query has been created
483
+ if( !isset( $args['tax_query'] ) )
484
+ $args['tax_query'] = array();
485
+ $args['tax_query'][] = array(
486
+ array(
487
+ 'taxonomy' => $term_taxonomy,
488
+ 'field' => 'id',
489
+ 'terms' => $product_categories
490
+ )
491
+ );
492
+ }
493
+ // Filter Products by Product Tag
494
+ if( $product_tags ) {
495
+ $term_taxonomy = 'product_tag';
496
+ // Check if tax_query has been created
497
+ if( !isset( $args['tax_query'] ) )
498
+ $args['tax_query'] = array();
499
+ $args['tax_query'][] = array(
500
+ array(
501
+ 'taxonomy' => $term_taxonomy,
502
+ 'field' => 'id',
503
+ 'terms' => $product_tags
504
+ )
505
+ );
506
+ }
507
+ if( $product_status )
508
+ $args['post_status'] = woo_ce_post_statuses( $product_status, true );
509
+ if( $product_type ) {
510
+ if( in_array( 'variation', $product_type ) && count( $product_type ) == 1 )
511
+ $args['post_type'] = array( 'product_variation' );
512
+ if( !empty( $product_type ) ) {
513
+ $term_taxonomy = 'product_type';
514
+ $args['tax_query'] = array(
515
+ array(
516
+ 'taxonomy' => $term_taxonomy,
517
+ 'field' => 'slug',
518
+ 'terms' => $product_type
519
+ )
520
+ );
521
+ } else {
522
+ unset( $args['meta_query'] );
523
+ }
524
+ }
525
+ // Sort Products by SKU
526
+ if( $orderby == 'sku' ) {
527
+ $args['orderby'] = 'meta_value';
528
+ $args['meta_key'] = '_sku';
529
+ }
530
+ $products = array();
531
+ $product_ids = new WP_Query( $args );
532
+ if( $product_ids->posts ) {
533
+ foreach( $product_ids->posts as $product_id ) {
534
+
535
+ // Get Product details
536
+ $product = get_post( $product_id );
537
+
538
+ // Filter out Variations that don't have a Parent Product that exists
539
+ if( isset( $product->post_type ) && $product->post_type == 'product_variation' ) {
540
+ // Check if Parent exists
541
+ if( $product->post_parent ) {
542
+ if( get_post( $product->post_parent ) == false ) {
543
+ unset( $product_id, $product );
544
+ continue;
545
+ }
546
+ }
547
+ }
548
+ if( isset( $product_id ) )
549
+ $products[] = $product_id;
550
+ }
551
+ // Only populate the $export Global if it is an export
552
+ if( isset( $export ) )
553
+ $export->total_rows = count( $products );
554
+ unset( $product_ids, $product_id );
555
+ }
556
+ return $products;
557
+
558
+ }
559
+
560
+ function woo_ce_get_product_data( $product_id = 0, $args = array() ) {
561
+
562
+ // Get Product defaults
563
+ $weight_unit = get_option( 'woocommerce_weight_unit' );
564
+ $dimension_unit = get_option( 'woocommerce_dimension_unit' );
565
+ $height_unit = $dimension_unit;
566
+ $width_unit = $dimension_unit;
567
+ $length_unit = $dimension_unit;
568
+
569
+ $product = get_post( $product_id );
570
+ $_product = ( function_exists( 'wc_get_product' ) ? wc_get_product( $product_id ) : false );
571
+ // Check for corrupt Products
572
+ if( $_product == false )
573
+ return false;
574
+
575
+ $product->parent_id = '';
576
+ $product->parent_sku = '';
577
+ if( $product->post_type == 'product_variation' ) {
578
+ // Assign Parent ID for Variants then check if Parent exists
579
+ if( $product->parent_id = $product->post_parent )
580
+ $product->parent_sku = get_post_meta( $product->post_parent, '_sku', true );
581
+ else
582
+ $product->parent_id = '';
583
+ }
584
+ $product->product_id = $product_id;
585
+ $product->sku = get_post_meta( $product_id, '_sku', true );
586
+ $product->name = get_the_title( $product_id );
587
+ if( $product->post_type <> 'product_variation' )
588
+ $product->permalink = get_permalink( $product_id );
589
+ $product->product_url = ( method_exists( $_product, 'get_permalink' ) ? $_product->get_permalink() : get_permalink( $product_id ) );
590
+ $product->slug = $product->post_name;
591
+ $product->description = $product->post_content;
592
+ $product->excerpt = $product->post_excerpt;
593
+ $product->regular_price = get_post_meta( $product_id, '_regular_price', true );
594
+ // Check that a valid price has been provided and that wc_format_localized_price() exists
595
+ if( isset( $product->regular_price ) && $product->regular_price != '' && function_exists( 'wc_format_localized_price' ) )
596
+ $product->regular_price = wc_format_localized_price( $product->regular_price );
597
+ $product->price = get_post_meta( $product_id, '_price', true );
598
+ if( $product->regular_price != '' && ( $product->regular_price <> $product->price ) )
599
+ $product->price = $product->regular_price;
600
+ // Check that a valid price has been provided and that wc_format_localized_price() exists
601
+ if( isset( $product->price ) && $product->price != '' && function_exists( 'wc_format_localized_price' ) )
602
+ $product->price = wc_format_localized_price( $product->price );
603
+ $product->sale_price = get_post_meta( $product_id, '_sale_price', true );
604
+ // Check that a valid price has been provided and that wc_format_localized_price() exists
605
+ if( isset( $product->sale_price ) && $product->sale_price != '' && function_exists( 'wc_format_localized_price' ) )
606
+ $product->sale_price = wc_format_localized_price( $product->sale_price );
607
+ $product->sale_price_dates_from = woo_ce_format_product_sale_price_dates( get_post_meta( $product_id, '_sale_price_dates_from', true ) );
608
+ $product->sale_price_dates_to = woo_ce_format_product_sale_price_dates( get_post_meta( $product_id, '_sale_price_dates_to', true ) );
609
+ $product->post_date = woo_ce_format_date( $product->post_date );
610
+ $product->post_modified = woo_ce_format_date( $product->post_modified );
611
+ $product->type = woo_ce_get_product_assoc_type( $product_id );
612
+ if( $product->post_type == 'product_variation' ) {
613
+ $product->type = __( 'Variation', 'woocommerce-exporter' );
614
+ }
615
+ $product->visibility = woo_ce_format_product_visibility( $product_id, get_post_meta( $product_id, '_visibility', true ) );
616
+ $product->featured = woo_ce_format_switch( get_post_meta( $product_id, '_featured', true ) );
617
+ $product->virtual = woo_ce_format_switch( get_post_meta( $product_id, '_virtual', true ) );
618
+ $product->downloadable = woo_ce_format_switch( get_post_meta( $product_id, '_downloadable', true ) );
619
+ $product->weight = get_post_meta( $product_id, '_weight', true );
620
+ $product->weight_unit = ( $product->weight != '' ? $weight_unit : '' );
621
+ $product->height = get_post_meta( $product_id, '_height', true );
622
+ $product->height_unit = ( $product->height != '' ? $height_unit : '' );
623
+ $product->width = get_post_meta( $product_id, '_width', true );
624
+ $product->width_unit = ( $product->width != '' ? $width_unit : '' );
625
+ $product->length = get_post_meta( $product_id, '_length', true );
626
+ $product->length_unit = ( $product->length != '' ? $length_unit : '' );
627
+ $product->category = woo_ce_get_product_assoc_categories( $product_id, $product->parent_id );
628
+ $product->tag = woo_ce_get_product_assoc_tags( $product_id );
629
+ $product->manage_stock = get_post_meta( $product_id, '_manage_stock', true );
630
+ $product->allow_backorders = woo_ce_format_product_allow_backorders( get_post_meta( $product_id, '_backorders', true ) );
631
+ $product->sold_individually = woo_ce_format_switch( get_post_meta( $product_id, '_sold_individually', true ) );
632
+ $product->upsell_ids = woo_ce_get_product_assoc_upsell_ids( $product_id );
633
+ $product->crosssell_ids = woo_ce_get_product_assoc_crosssell_ids( $product_id );
634
+ $product->quantity = get_post_meta( $product_id, '_stock', true );
635
+ $product->stock_status = woo_ce_format_product_stock_status( get_post_meta( $product_id, '_stock_status', true ), $product->quantity );
636
+ $product->image = woo_ce_get_product_assoc_featured_image( $product_id );
637
+ $product->product_gallery = woo_ce_get_product_assoc_product_gallery( $product_id );
638
+ $product->tax_status = woo_ce_format_product_tax_status( get_post_meta( $product_id, '_tax_status', true ) );
639
+ $product->tax_class = woo_ce_format_product_tax_class( get_post_meta( $product_id, '_tax_class', true ) );
640
+ $product->shipping_class = woo_ce_get_product_assoc_shipping_class( $product_id );
641
+ $product->external_url = get_post_meta( $product_id, '_product_url', true );
642
+ $product->button_text = get_post_meta( $product_id, '_button_text', true );
643
+ $product->download_file_path = woo_ce_get_product_assoc_download_files( $product_id, 'url' );
644
+ $product->download_file_name = woo_ce_get_product_assoc_download_files( $product_id, 'name' );
645
+ $product->download_limit = get_post_meta( $product_id, '_download_limit', true );
646
+ $product->download_expiry = get_post_meta( $product_id, '_download_expiry', true );
647
+ $product->download_type = woo_ce_format_product_download_type( get_post_meta( $product_id, '_download_type', true ) );
648
+ $product->purchase_note = get_post_meta( $product_id, '_purchase_note', true );
649
+ $product->product_status = woo_ce_format_post_status( $product->post_status );
650
+ $product->enable_reviews = woo_ce_format_comment_status( $product->comment_status );
651
+ $product->menu_order = $product->menu_order;
652
+ unset( $_product );
653
+
654
+ // Scan for global Attributes first
655
+ $attributes = woo_ce_get_product_attributes();
656
+ if( !empty( $attributes ) && $product->post_type == 'product_variation' ) {
657
+ // We're dealing with a single Variation, strap yourself in.
658
+ foreach( $attributes as $attribute ) {
659
+ $attribute_value = get_post_meta( $product_id, sprintf( 'attribute_pa_%s', $attribute->attribute_name ), true );
660
+ if( !empty( $attribute_value ) ) {
661
+ $term_id = term_exists( $attribute_value, sprintf( 'pa_%s', $attribute->attribute_name ) );
662
+ if( $term_id !== 0 && $term_id !== null && !is_wp_error( $term_id ) ) {
663
+ $term = get_term( $term_id['term_id'], sprintf( 'pa_%s', $attribute->attribute_name ) );
664
+ $attribute_value = $term->name;
665
+ unset( $term );
666
+ }
667
+ unset( $term_id );
668
+ }
669
+ $product->{'attribute_' . $attribute->attribute_name} = $attribute_value;
670
+ unset( $attribute_value );
671
+ }
672
+ } else {
673
+ // Either the Variation Parent or a Simple Product, scan for global and custom Attributes
674
+ $product->attributes = maybe_unserialize( get_post_meta( $product_id, '_product_attributes', true ) );
675
+ if( !empty( $product->attributes ) ) {
676
+ // Check for taxonomy-based attributes
677
+ foreach( $attributes as $attribute ) {
678
+ if( isset( $product->attributes['pa_' . $attribute->attribute_name] ) )
679
+ $product->{'attribute_' . $attribute->attribute_name} = woo_ce_get_product_assoc_attributes( $product_id, $product->attributes['pa_' . $attribute->attribute_name], 'product' );
680
+ else
681
+ $product->{'attribute_' . $attribute->attribute_name} = woo_ce_get_product_assoc_attributes( $product_id, $attribute, 'global' );
682
+ }
683
+ // Check for per-Product attributes (custom)
684
+ foreach( $product->attributes as $key => $attribute ) {
685
+ if( $attribute['is_taxonomy'] == 0 ) {
686
+ if( !isset( $product->{'attribute_' . $key} ) )
687
+ $product->{'attribute_' . $key} = $attribute['value'];
688
+ }
689
+ }
690
+ }
691
+ }
692
+
693
+ // Allow Plugin/Theme authors to add support for additional Product columns
694
+ $product = apply_filters( 'woo_ce_product_item', $product, $product_id );
695
+
696
+ return $product;
697
+
698
+ }
699
+
700
+ // Returns Product Categories associated to a specific Product
701
+ function woo_ce_get_product_assoc_categories( $product_id = 0, $parent_id = 0 ) {
702
+
703
+ global $export;
704
+
705
+ $output = '';
706
+ $term_taxonomy = 'product_cat';
707
+ // Return Product Categories of Parent if this is a Variation
708
+ $categories = array();
709
+ if( !empty( $parent_id ) )
710
+ $product_id = $parent_id;
711
+ if( !empty( $product_id ) )
712
+ $categories = wp_get_object_terms( $product_id, $term_taxonomy );
713
+ if( !empty( $categories ) && !is_wp_error( $categories ) ) {
714
+ $size = apply_filters( 'woo_ce_get_product_assoc_categories_size', count( $categories ) );
715
+ for( $i = 0; $i < $size; $i++ ) {
716
+ if( $categories[$i]->parent == '0' ) {
717
+ $output .= $categories[$i]->name . $export->category_separator;
718
+ } else {
719
+ // Check if Parent -> Child
720
+ $parent_category = get_term( $categories[$i]->parent, $term_taxonomy );
721
+ // Check if Parent -> Child -> Subchild
722
+ if( $parent_category->parent == '0' ) {
723
+ $output .= $parent_category->name . '>' . $categories[$i]->name . $export->category_separator;
724
+ $output = str_replace( $parent_category->name . $export->category_separator, '', $output );
725
+ } else {
726
+ $root_category = get_term( $parent_category->parent, $term_taxonomy );
727
+ $output .= $root_category->name . '>' . $parent_category->name . '>' . $categories[$i]->name . $export->category_separator;
728
+ $output = str_replace( array(
729
+ $root_category->name . '>' . $parent_category->name . $export->category_separator,
730
+ $parent_category->name . $export->category_separator
731
+ ), '', $output );
732
+ }
733
+ unset( $root_category, $parent_category );
734
+ }
735
+ }
736
+ $output = substr( $output, 0, -1 );
737
+ } else {
738
+ $output .= __( 'Uncategorized', 'woocommerce-exporter' );
739
+ }
740
+ return $output;
741
+
742
+ }
743
+
744
+ // Returns Product Tags associated to a specific Product
745
+ function woo_ce_get_product_assoc_tags( $product_id = 0 ) {
746
+
747
+ global $export;
748
+
749
+ $output = '';
750
+ $term_taxonomy = 'product_tag';
751
+ $tags = wp_get_object_terms( $product_id, $term_taxonomy );
752
+ if( !empty( $tags ) && is_wp_error( $tags ) == false ) {
753
+ $size = count( $tags );
754
+ for( $i = 0; $i < $size; $i++ ) {
755
+ if( $tag = get_term( $tags[$i]->term_id, $term_taxonomy ) )
756
+ $output .= $tag->name . $export->category_separator;
757
+ }
758
+ $output = substr( $output, 0, -1 );
759
+ }
760
+ return $output;
761
+
762
+ }
763
+
764
+ // Returns the Featured Image associated to a specific Product
765
+ function woo_ce_get_product_assoc_featured_image( $product_id = 0 ) {
766
+
767
+ $output = '';
768
+ if( !empty( $product_id ) ) {
769
+ $thumbnail_id = get_post_meta( $product_id, '_thumbnail_id', true );
770
+ if( !empty( $thumbnail_id ) ) {
771
+ $output = wp_get_attachment_url( $thumbnail_id );
772
+ }
773
+ }
774
+ return $output;
775
+
776
+ }
777
+
778
+ // Returns the Product Galleries associated to a specific Product
779
+ function woo_ce_get_product_assoc_product_gallery( $product_id = 0, $size = 'full' ) {
780
+
781
+ global $export;
782
+
783
+ if( !empty( $product_id ) ) {
784
+ $images = get_post_meta( $product_id, '_product_image_gallery', true );
785
+ if( !empty( $images ) ) {
786
+ $images = explode( ',', $images );
787
+ $size = count( $images );
788
+ for( $i = 0; $i < $size; $i++ ) {
789
+ // Post ID
790
+ if( $export->gallery_formatting == 0 ) {
791
+ continue;
792
+ // Media URL
793
+ } else {
794
+ if( $size == 'full' )
795
+ $images[$i] = wp_get_attachment_url( $images[$i] );
796
+ else if( $size == 'thumbnail' )
797
+ $images[$i] = wp_get_attachment_thumb_url( $images[$i] );
798
+ }
799
+ }
800
+ $output = implode( $export->category_separator, $images );
801
+ return $output;
802
+ }
803
+ }
804
+
805
+ }
806
+
807
+ // Returns the Product Type of a specific Product
808
+ function woo_ce_get_product_assoc_type( $product_id = 0 ) {
809
+
810
+ global $export;
811
+
812
+ $output = '';
813
+ $term_taxonomy = 'product_type';
814
+ $types = wp_get_object_terms( $product_id, $term_taxonomy );
815
+ if( empty( $types ) )
816
+ $types = array( get_term_by( 'name', 'simple', $term_taxonomy ) );
817
+ if( $types ) {
818
+ $size = count( $types );
819
+ for( $i = 0; $i < $size; $i++ ) {
820
+ $type = get_term( $types[$i]->term_id, $term_taxonomy );
821
+ $output .= woo_ce_format_product_type( $type->name ) . $export->category_separator;
822
+ }
823
+ $output = substr( $output, 0, -1 );
824
+ }
825
+ return $output;
826
+
827
+ }
828
+
829
+ // Returns the Shipping Class of a specific Product
830
+ function woo_ce_get_product_assoc_shipping_class( $product_id = 0 ) {
831
+
832
+ global $export;
833
+
834
+ $output = '';
835
+ $term_taxonomy = 'product_shipping_class';
836
+ $types = wp_get_object_terms( $product_id, $term_taxonomy );
837
+ if( empty( $types ) )
838
+ $types = get_term_by( 'name', 'simple', $term_taxonomy );
839
+ if( !empty( $types ) ) {
840
+ $size = count( $types );
841
+ for( $i = 0; $i < $size; $i++ ) {
842
+ $type = get_term( $types[$i]->term_id, $term_taxonomy );
843
+ if( is_wp_error( $type ) !== true )
844
+ $output .= $type->name . $export->category_separator;
845
+ }
846
+ $output = substr( $output, 0, -1 );
847
+ }
848
+ return $output;
849
+
850
+ }
851
+
852
+ // Returns the Up-Sell associated to a specific Product
853
+ function woo_ce_get_product_assoc_upsell_ids( $product_id = 0 ) {
854
+
855
+ global $export;
856
+
857
+ $output = '';
858
+ if( $product_id ) {
859
+ $upsell_ids = get_post_meta( $product_id, '_upsell_ids', true );
860
+ // Convert Product ID to Product SKU as per Up-Sells Formatting
861
+ if( $export->upsell_formatting == 1 && !empty( $upsell_ids ) ) {
862
+ $size = count( $upsell_ids );
863
+ for( $i = 0; $i < $size; $i++ ) {
864
+ $upsell_ids[$i] = get_post_meta( $upsell_ids[$i], '_sku', true );
865
+ if( empty( $upsell_ids[$i] ) )
866
+ unset( $upsell_ids[$i] );
867
+ }
868
+ // 'reindex' array
869
+ $upsell_ids = array_values( $upsell_ids );
870
+ }
871
+ $output = woo_ce_convert_product_ids( $upsell_ids );
872
+ }
873
+ return $output;
874
+
875
+ }
876
+
877
+ // Returns the Cross-Sell associated to a specific Product
878
+ function woo_ce_get_product_assoc_crosssell_ids( $product_id = 0 ) {
879
+
880
+ global $export;
881
+
882
+ $output = '';
883
+ if( $product_id ) {
884
+ $crosssell_ids = get_post_meta( $product_id, '_crosssell_ids', true );
885
+ // Convert Product ID to Product SKU as per Cross-Sells Formatting
886
+ if( $export->crosssell_formatting == 1 && !empty( $crosssell_ids ) ) {
887
+ $size = count( $crosssell_ids );
888
+ for( $i = 0; $i < $size; $i++ ) {
889
+ $crosssell_ids[$i] = get_post_meta( $crosssell_ids[$i], '_sku', true );
890
+ // Remove Cross-Sell if SKU is empty
891
+ if( empty( $crosssell_ids[$i] ) )
892
+ unset( $crosssell_ids[$i] );
893
+ }
894
+ // 'reindex' array
895
+ $crosssell_ids = array_values( $crosssell_ids );
896
+ }
897
+ $output = woo_ce_convert_product_ids( $crosssell_ids );
898
+ }
899
+ return $output;
900
+
901
+ }
902
+
903
+ // Returns Product Attributes associated to a specific Product
904
+ function woo_ce_get_product_assoc_attributes( $product_id = 0, $attribute = array(), $type = 'product' ) {
905
+
906
+ global $export;
907
+
908
+ $output = '';
909
+ if( $product_id ) {
910
+ $terms = array();
911
+ if( $type == 'product' ) {
912
+ if( $attribute['is_taxonomy'] == 1 )
913
+ $term_taxonomy = $attribute['name'];
914
+ } else if( $type == 'global' ) {
915
+ $term_taxonomy = 'pa_' . $attribute->attribute_name;
916
+ }
917
+ $terms = wp_get_object_terms( $product_id, $term_taxonomy );
918
+ if( !empty( $terms ) && is_wp_error( $terms ) == false ) {
919
+ $size = count( $terms );
920
+ for( $i = 0; $i < $size; $i++ )
921
+ $output .= $terms[$i]->name . $export->category_separator;
922
+ unset( $terms );
923
+ }
924
+ $output = substr( $output, 0, -1 );
925
+ }
926
+ return $output;
927
+
928
+ }
929
+
930
+ // Returns File Downloads associated to a specific Product
931
+ function woo_ce_get_product_assoc_download_files( $product_id = 0, $type = 'url' ) {
932
+
933
+ global $export;
934
+
935
+ $output = '';
936
+ if( $product_id ) {
937
+ if( version_compare( WOOCOMMERCE_VERSION, '2.0', '>=' ) ) {
938
+ // If WooCommerce 2.0+ is installed then use new _downloadable_files Post meta key
939
+ if( $file_downloads = maybe_unserialize( get_post_meta( $product_id, '_downloadable_files', true ) ) ) {
940
+ foreach( $file_downloads as $file_download ) {
941
+ if( $type == 'url' )
942
+ $output .= $file_download['file'] . $export->category_separator;
943
+ else if( $type == 'name' )
944
+ $output .= $file_download['name'] . $export->category_separator;
945
+ }
946
+ unset( $file_download, $file_downloads );
947
+ }
948
+ $output = substr( $output, 0, -1 );
949
+ } else {
950
+ // If WooCommerce -2.0 is installed then use legacy _file_paths Post meta key
951
+ if( $file_downloads = maybe_unserialize( get_post_meta( $product_id, '_file_paths', true ) ) ) {
952
+ foreach( $file_downloads as $file_download ) {
953
+ if( $type == 'url' )
954
+ $output .= $file_download . $export->category_separator;
955
+ }
956
+ unset( $file_download, $file_downloads );
957
+ }
958
+ $output = substr( $output, 0, -1 );
959
+ }
960
+ }
961
+ return $output;
962
+
963
+ }
964
+
965
+ // Returns list of Product Add-on columns
966
+ function woo_ce_get_product_addons() {
967
+
968
+ // Product Add-ons - http://www.woothemes.com/
969
+ if( class_exists( 'Product_Addon_Admin' ) || class_exists( 'Product_Addon_Display' ) ) {
970
+ $post_type = 'global_product_addon';
971
+ $args = array(
972
+ 'post_type' => $post_type,
973
+ 'numberposts' => -1
974
+ );
975
+ $output = array();
976
+
977
+ // First grab the Global Product Add-ons
978
+ if( $product_addons = get_posts( $args ) ) {
979
+ foreach( $product_addons as $product_addon ) {
980
+ if( $meta = maybe_unserialize( get_post_meta( $product_addon->ID, '_product_addons', true ) ) ) {
981
+ $size = count( $meta );
982
+ for( $i = 0; $i < $size; $i++ ) {
983
+ $output[] = (object)array(
984
+ 'post_name' => $meta[$i]['name'],
985
+ 'post_title' => $meta[$i]['name'],
986
+ 'form_title' => $product_addon->post_title
987
+ );
988
+ }
989
+ }
990
+ }
991
+ }
992
+ }
993
+
994
+ // Custom Order Items
995
+ if( $custom_order_items = woo_ce_get_option( 'custom_order_items', '' ) ) {
996
+ foreach( $custom_order_items as $custom_order_item ) {
997
+ $output[] = (object)array(
998
+ 'post_name' => $custom_order_item,
999
+ 'post_title' => $custom_order_item
1000
+ );
1001
+ }
1002
+ }
1003
+
1004
+ return $output;
1005
+
1006
+ }
1007
+
1008
+ function woo_ce_format_product_visibility( $product_id = 0, $visibility = '' ) {
1009
+
1010
+ $output = '';
1011
+ // Check for empty default for Visibility
1012
+ if( empty( $visibility ) ) {
1013
+ $visibility = 'visible';
1014
+ if( !empty( $product_id ) ) {
1015
+ // Fall back to checking Term Taxonomy
1016
+ $term_taxonomy = 'product_visibility';
1017
+ $args = array(
1018
+ 'fields' => 'names'
1019
+ );
1020
+ $terms = wp_get_object_terms( $product_id, $term_taxonomy, $args );
1021
+ if( !empty( $terms ) && is_wp_error( $terms ) == false ) {
1022
+ // Just for fun we have to combine Terms to decipher the Visibility
1023
+ if( in_array( 'exclude-from-search', $terms ) && in_array( 'exclude-from-catalog', $terms) )
1024
+ $visibility = 'hidden';
1025
+ else if( in_array( 'exclude-from-search', $terms ) )
1026
+ $visibility = 'catalog';
1027
+ else if( in_array( 'exclude-from-catalog', $terms ) )
1028
+ $visibility = 'search';
1029
+ }
1030
+ }
1031
+ }
1032
+ switch( $visibility ) {
1033
+
1034
+ default:
1035
+ case 'visible':
1036
+ if( apply_filters( 'woo_ce_format_product_visibility_legacy_labels', false ) )
1037
+ $output = __( 'Catalog & Search', 'woocommerce-exporter' );
1038
+ else
1039
+ $output = __( 'Shop and search results', 'woocommerce-exporter' );
1040
+ break;
1041
+
1042
+ case 'catalog':
1043
+ if( apply_filters( 'woo_ce_format_product_visibility_legacy_labels', false ) )
1044
+ $output = __( 'Catalog', 'woocommerce-exporter' );
1045
+ else
1046
+ $output = __( 'Shop only', 'woocommerce-exporter' );
1047
+ break;
1048
+
1049
+ case 'search':
1050
+ if( apply_filters( 'woo_ce_format_product_visibility_legacy_labels', false ) )
1051
+ $output = __( 'Search', 'woocommerce-exporter' );
1052
+ else
1053
+ $output = __( 'Search results only', 'woocommerce-exporter' );
1054
+ break;
1055
+
1056
+ case 'hidden':
1057
+ $output = __( 'Hidden', 'woocommerce-exporter' );
1058
+ break;
1059
+
1060
+ }
1061
+ return $output;
1062
+
1063
+ }
1064
+
1065
+ function woo_ce_format_product_allow_backorders( $allow_backorders = '' ) {
1066
+
1067
+ $output = '';
1068
+ if( !empty( $allow_backorders ) ) {
1069
+ switch( $allow_backorders ) {
1070
+
1071
+ case 'yes':
1072
+ case 'no':
1073
+ $output = woo_ce_format_switch( $allow_backorders );
1074
+ break;
1075
+
1076
+ case 'notify':
1077
+ $output = __( 'Notify', 'woocommerce-exporter' );
1078
+ break;
1079
+
1080
+ }
1081
+ }
1082
+ return $output;
1083
+
1084
+ }
1085
+
1086
+ function woo_ce_format_product_download_type( $download_type = '' ) {
1087
+
1088
+ $output = __( 'Standard', 'woocommerce-exporter' );
1089
+ if( !empty( $download_type ) ) {
1090
+ switch( $download_type ) {
1091
+
1092
+ case 'application':
1093
+ $output = __( 'Application', 'woocommerce-exporter' );
1094
+ break;
1095
+
1096
+ case 'music':
1097
+ $output = __( 'Music', 'woocommerce-exporter' );
1098
+ break;
1099
+
1100
+ }
1101
+ }
1102
+ return $output;
1103
+
1104
+ }
1105
+
1106
+ function woo_ce_format_gpf_availability( $availability = null ) {
1107
+
1108
+ $output = '';
1109
+ if( !empty( $availability ) ) {
1110
+ switch( $availability ) {
1111
+
1112
+ case 'in stock':
1113
+ $output = __( 'In Stock', 'woocommerce-exporter' );
1114
+ break;
1115
+
1116
+ case 'available for order':
1117
+ $output = __( 'Available For Order', 'woocommerce-exporter' );
1118
+ break;
1119
+
1120
+ case 'preorder':
1121
+ $output = __( 'Pre-order', 'woocommerce-exporter' );
1122
+ break;
1123
+
1124
+ }
1125
+ }
1126
+ return $output;
1127
+
1128
+ }
1129
+
1130
+ function woo_ce_format_gpf_condition( $condition ) {
1131
+
1132
+ $output = '';
1133
+ if( !empty( $condition ) ) {
1134
+ switch( $condition ) {
1135
+
1136
+ case 'new':
1137
+ $output = __( 'New', 'woocommerce-exporter' );
1138
+ break;
1139
+
1140
+ case 'refurbished':
1141
+ $output = __( 'Refurbished', 'woocommerce-exporter' );
1142
+ break;
1143
+
1144
+ case 'used':
1145
+ $output = __( 'Used', 'woocommerce-exporter' );
1146
+ break;
1147
+
1148
+ }
1149
+ }
1150
+ return $output;
1151
+
1152
+ }
1153
+
1154
+ function woo_ce_format_product_stock_status( $stock_status = '', $stock = '' ) {
1155
+
1156
+ $output = '';
1157
+ if( empty( $stock_status ) && !empty( $stock ) ) {
1158
+ if( $stock )
1159
+ $stock_status = 'instock';
1160
+ else
1161
+ $stock_status = 'outofstock';
1162
+ }
1163
+ if( $stock_status ) {
1164
+ switch( $stock_status ) {
1165
+
1166
+ case 'instock':
1167
+ $output = __( 'In Stock', 'woocommerce-exporter' );
1168
+ break;
1169
+
1170
+ case 'outofstock':
1171
+ $output = __( 'Out of Stock', 'woocommerce-exporter' );
1172
+ break;
1173
+
1174
+ }
1175
+ }
1176
+ return $output;
1177
+
1178
+ }
1179
+
1180
+ function woo_ce_format_product_tax_status( $tax_status = null ) {
1181
+
1182
+ $output = '';
1183
+ if( !empty( $tax_status ) ) {
1184
+ switch( $tax_status ) {
1185
+
1186
+ case 'taxable':
1187
+ $output = __( 'Taxable', 'woocommerce-exporter' );
1188
+ break;
1189
+
1190
+ case 'shipping':
1191
+ $output = __( 'Shipping Only', 'woocommerce-exporter' );
1192
+ break;
1193
+
1194
+ case 'none':
1195
+ $output = __( 'None', 'woocommerce-exporter' );
1196
+ break;
1197
+
1198
+ }
1199
+ }
1200
+ return $output;
1201
+
1202
+ }
1203
+
1204
+ function woo_ce_format_product_tax_class( $tax_class = '' ) {
1205
+
1206
+ global $export;
1207
+
1208
+ $output = '';
1209
+ if( $tax_class ) {
1210
+ switch( $tax_class ) {
1211
+
1212
+ case '*':
1213
+ $tax_class = __( 'Standard', 'woocommerce-exporter' );
1214
+ break;
1215
+
1216
+ case 'reduced-rate':
1217
+ $tax_class = __( 'Reduced Rate', 'woocommerce-exporter' );
1218
+ break;
1219
+
1220
+ case 'zero-rate':
1221
+ $tax_class = __( 'Zero Rate', 'woocommerce-exporter' );
1222
+ break;
1223
+
1224
+ }
1225
+ $output = $tax_class;
1226
+ }
1227
+ return $output;
1228
+
1229
+ }
1230
+
1231
+ function woo_ce_format_product_type( $type_id = '' ) {
1232
+
1233
+ $output = $type_id;
1234
+ if( $output ) {
1235
+ $product_types = apply_filters( 'woo_ce_format_product_types', array(
1236
+ 'simple' => __( 'Simple Product', 'woocommerce' ),
1237
+ 'downloadable' => __( 'Downloadable', 'woocommerce' ),
1238
+ 'grouped' => __( 'Grouped Product', 'woocommerce' ),
1239
+ 'virtual' => __( 'Virtual', 'woocommerce' ),
1240
+ 'variable' => __( 'Variable', 'woocommerce' ),
1241
+ 'external' => __( 'External/Affiliate Product', 'woocommerce' ),
1242
+ 'variation' => __( 'Variation', 'woocommerce-exporter' ),
1243
+ 'subscription' => __( 'Simple Subscription', 'woocommerce-exporter' ),
1244
+ 'variable-subscription' => __( 'Variable Subscription', 'woocommerce-exporter' )
1245
+ ) );
1246
+ if( isset( $product_types[$type_id] ) )
1247
+ $output = $product_types[$type_id];
1248
+ }
1249
+ return $output;
1250
+
1251
+ }
1252
+
1253
+ // Returns a list of WooCommerce Product Types to export process
1254
+ function woo_ce_get_product_types() {
1255
+
1256
+ $term_taxonomy = 'product_type';
1257
+ $args = array(
1258
+ 'hide_empty' => 0
1259
+ );
1260
+
1261
+ // Allow other developers to bake in their own filters
1262
+ $args = apply_filters( 'woo_ce_get_product_types_args', $args );
1263
+
1264
+ $types = get_terms( $term_taxonomy, $args );
1265
+ if( !empty( $types ) && is_wp_error( $types ) == false ) {
1266
+ $output = array();
1267
+ $size = count( $types );
1268
+ for( $i = 0; $i < $size; $i++ ) {
1269
+ $output[$types[$i]->slug] = array(
1270
+ 'name' => ucfirst( $types[$i]->name ),
1271
+ 'count' => $types[$i]->count
1272
+ );
1273
+ // Override the Product Type count for Downloadable and Virtual
1274
+ if( in_array( $types[$i]->slug, array( 'downloadable', 'virtual' ) ) ) {
1275
+ if( $types[$i]->slug == 'downloadable' ) {
1276
+ $args = array(
1277
+ 'meta_key' => '_downloadable',
1278
+ 'meta_value' => 'yes'
1279
+ );
1280
+ } else if( $types[$i]->slug == 'virtual' ) {
1281
+ $args = array(
1282
+ 'meta_key' => '_virtual',
1283
+ 'meta_value' => 'yes'
1284
+ );
1285
+ }
1286
+ $output[$types[$i]->slug]['count'] = woo_ce_get_product_type_count( 'product', $args );
1287
+ }
1288
+ }
1289
+ $output['variation'] = array(
1290
+ 'name' => __( 'Variation', 'woocommerce-exporter' ),
1291
+ 'count' => woo_ce_get_product_type_count( 'product_variation' )
1292
+ );
1293
+
1294
+ // Allow Plugin/Theme authors to add support for additional Product Types
1295
+ $output = apply_filters( 'woo_ce_get_product_types_output', $output );
1296
+
1297
+ asort( $output );
1298
+ return $output;
1299
+ }
1300
+
1301
+ }
1302
+
1303
+ function woo_ce_get_product_type_count( $post_type = 'product', $args = array() ) {
1304
+
1305
+ $defaults = array(
1306
+ 'post_type' => $post_type,
1307
+ 'posts_per_page' => 1,
1308
+ 'fields' => 'ids'
1309
+ );
1310
+ $args = wp_parse_args( $args, $defaults );
1311
+ $product_ids = new WP_Query( $args );
1312
+ $size = $product_ids->found_posts;
1313
+
1314
+ // Allow Plugin/Theme authors to override Product Type counts as needed
1315
+ $size = apply_filters( 'woo_ce_get_product_type_count', $size, $post_type );
1316
+
1317
+ return $size;
1318
+
1319
+ }
1320
+
1321
+ // Returns a list of WooCommerce Product Attributes to export process
1322
+ function woo_ce_get_product_attributes() {
1323
+
1324
+ global $wpdb;
1325
+
1326
+ $output = array();
1327
+ $attributes_sql = "SELECT * FROM `" . $wpdb->prefix . "woocommerce_attribute_taxonomies`";
1328
+ $attributes = $wpdb->get_results( $attributes_sql );
1329
+ $wpdb->flush();
1330
+ if( !empty( $attributes ) ) {
1331
+ $output = $attributes;
1332
+ unset( $attributes );
1333
+ } else {
1334
+ $output = ( function_exists( 'wc_get_attribute_taxonomies' ) ? wc_get_attribute_taxonomies() : array() );
1335
+ }
1336
+ return $output;
1337
+
1338
+ }
1339
+
1340
+ function woo_ce_get_acf_product_fields() {
1341
+
1342
+ global $wpdb;
1343
+
1344
+ $post_type = 'acf';
1345
+ $args = array(
1346
+ 'post_type' => $post_type,
1347
+ 'numberposts' => -1
1348
+ );
1349
+ if( $field_groups = get_posts( $args ) ) {
1350
+ $fields = array();
1351
+ $post_types = array( 'product', 'product_variation' );
1352
+ foreach( $field_groups as $field_group ) {
1353
+ $has_fields = false;
1354
+ if( $rules = get_post_meta( $field_group->ID, 'rule' ) ) {
1355
+ $size = count( $rules );
1356
+ for( $i = 0; $i < $size; $i++ ) {
1357
+ if( ( $rules[$i]['param'] == 'post_type' ) && ( $rules[$i]['operator'] == '==' ) && ( in_array( $rules[$i]['value'], $post_types ) ) ) {
1358
+ $has_fields = true;
1359
+ $i = $size;
1360
+ }
1361
+ }
1362
+ }
1363
+ unset( $rules );
1364
+ if( $has_fields ) {
1365
+ $custom_fields_sql = "SELECT `meta_value` FROM `" . $wpdb->postmeta . "` WHERE `post_id` = " . absint( $field_group->ID ) . " AND `meta_key` LIKE 'field_%'";
1366
+ if( $custom_fields = $wpdb->get_col( $custom_fields_sql ) ) {
1367
+ foreach( $custom_fields as $custom_field ) {
1368
+ $custom_field = maybe_unserialize( $custom_field );
1369
+ $fields[] = array(
1370
+ 'name' => $custom_field['name'],
1371
+ 'label' => $custom_field['label']
1372
+ );
1373
+ }
1374
+ }
1375
+ unset( $custom_fields, $custom_field );
1376
+ }
1377
+ }
1378
+ return $fields;
1379
+ }
1380
+
1381
+ }
1382
+
1383
+ function woo_ce_format_product_sale_price_dates( $sale_date = '' ) {
1384
+
1385
+ $output = $sale_date;
1386
+ if( $sale_date )
1387
+ $output = woo_ce_format_date( date( 'Y-m-d H:i:s', $sale_date ) );
1388
+ return $output;
1389
+
1390
+ }
1391
+
1392
+ ?>
includes/product_vendor.php ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // Product Vendors - http://www.woothemes.com/products/product-vendors/
7
+ // YITH WooCommerce Multi Vendor Premium - http://yithemes.com/themes/plugins/yith-woocommerce-product-vendors/
8
+ function woo_ce_get_export_type_product_vendor_count( $count = 0, $export_type = '', $args ) {
9
+
10
+ if( $export_type <> 'product_vendor' )
11
+ return $count;
12
+
13
+ $count = 0;
14
+ $term_taxonomy = apply_filters( 'woo_ce_product_vendor_term_taxonomy', 'wcpv_product_vendors' );
15
+ // Check if the existing Transient exists
16
+ $cached = get_transient( WOO_CE_PREFIX . '_product_vendor_count' );
17
+ if( $cached == false ) {
18
+ if( taxonomy_exists( $term_taxonomy ) )
19
+ $count = wp_count_terms( $term_taxonomy );
20
+ set_transient( WOO_CE_PREFIX . '_product_vendor_count', $count, HOUR_IN_SECONDS );
21
+ } else {
22
+ $count = $cached;
23
+ }
24
+ return $count;
25
+
26
+ }
27
+ add_filter( 'woo_ce_get_export_type_count', 'woo_ce_get_export_type_product_vendor_count', 10, 3 );
28
+
29
+ /* End of: WordPress Administration */
30
+
31
+ }
32
+
33
+ // Returns a list of Product Vendor export columns
34
+ function woo_ce_get_product_vendor_fields( $format = 'full', $post_ID = 0 ) {
35
+
36
+ $export_type = 'product_vendor';
37
+
38
+ $fields = array();
39
+ $fields[] = array(
40
+ 'name' => 'ID',
41
+ 'label' => __( 'Product Vendor ID', 'woocommerce-exporter' )
42
+ );
43
+ $fields[] = array(
44
+ 'name' => 'title',
45
+ 'label' => __( 'Name', 'woocommerce-exporter' )
46
+ );
47
+ $fields[] = array(
48
+ 'name' => 'slug',
49
+ 'label' => __( 'Slug', 'woocommerce-exporter' )
50
+ );
51
+ $fields[] = array(
52
+ 'name' => 'description',
53
+ 'label' => __( 'Description', 'woocommerce-exporter' )
54
+ );
55
+ $fields[] = array(
56
+ 'name' => 'url',
57
+ 'label' => __( 'Product Vendor URL', 'woocommerce-exporter' )
58
+ );
59
+ $fields[] = array(
60
+ 'name' => 'commission',
61
+ 'label' => __( 'Commission', 'woocommerce-exporter' )
62
+ );
63
+ $fields[] = array(
64
+ 'name' => 'paypal_email',
65
+ 'label' => __( 'PayPal E-mail Address', 'woocommerce-exporter' )
66
+ );
67
+ $fields[] = array(
68
+ 'name' => 'user_name',
69
+ 'label' => __( 'Vendor Username', 'woocommerce-exporter' )
70
+ );
71
+ $fields[] = array(
72
+ 'name' => 'user_id',
73
+ 'label' => __( 'Vendor User ID', 'woocommerce-exporter' )
74
+ );
75
+
76
+ /*
77
+ $fields[] = array(
78
+ 'name' => '',
79
+ 'label' => __( '', 'woocommerce-exporter' )
80
+ );
81
+ */
82
+
83
+ // Drop in our content filters here
84
+ add_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
85
+
86
+ // Allow Plugin/Theme authors to add support for additional columns
87
+ $fields = apply_filters( sprintf( WOO_CE_PREFIX . '_%s_fields', $export_type ), $fields, $export_type );
88
+
89
+ // Remove our content filters here to play nice with other Plugins
90
+ remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
91
+
92
+ switch( $format ) {
93
+
94
+ case 'summary':
95
+ $output = array();
96
+ $size = count( $fields );
97
+ for( $i = 0; $i < $size; $i++ ) {
98
+ if( isset( $fields[$i] ) )
99
+ $output[$fields[$i]['name']] = 'on';
100
+ }
101
+ return $output;
102
+ break;
103
+
104
+ case 'full':
105
+ default:
106
+ // Load the default sorting
107
+ $sorting = woo_ce_get_option( sprintf( '%s_sorting', $export_type ), array() );
108
+ $size = count( $fields );
109
+ for( $i = 0; $i < $size; $i++ ) {
110
+ $fields[$i]['reset'] = $i;
111
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
112
+ }
113
+ // Check if we are using PHP 5.3 and above
114
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
115
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
116
+ return $fields;
117
+ break;
118
+
119
+ }
120
+
121
+ }
122
+
123
+ // Check if we should override field labels from the Field Editor
124
+ function woo_ce_override_product_vendor_field_labels( $fields = array() ) {
125
+
126
+ $labels = woo_ce_get_option( 'product_vendor_labels', array() );
127
+ if( !empty( $labels ) ) {
128
+ foreach( $fields as $key => $field ) {
129
+ if( isset( $labels[$field['name']] ) )
130
+ $fields[$key]['label'] = $labels[$field['name']];
131
+ }
132
+ }
133
+ return $fields;
134
+
135
+ }
136
+ add_filter( 'woo_ce_product_vendor_fields', 'woo_ce_override_product_vendor_field_labels', 11 );
137
+
138
+ // Returns a list of Product Vendor Term IDs
139
+ function woo_ce_get_product_vendors( $args = array(), $output = 'term_id' ) {
140
+
141
+ global $export;
142
+
143
+ // Product Vendors - http://www.woothemes.com/products/product-vendors/
144
+ // YITH WooCommerce Multi Vendor Premium - http://yithemes.com/themes/plugins/yith-woocommerce-product-vendors/
145
+ $term_taxonomy = apply_filters( 'woo_ce_product_vendor_term_taxonomy', 'wcpv_product_vendors' );
146
+ $defaults = array(
147
+ 'orderby' => 'name',
148
+ 'order' => 'ASC',
149
+ 'hide_empty' => 0
150
+ );
151
+ $args = wp_parse_args( $args, $defaults );
152
+
153
+ // Allow other developers to bake in their own filters
154
+ $args = apply_filters( 'woo_ce_get_product_vendors_args', $args );
155
+
156
+ $product_vendors = get_terms( $term_taxonomy, $args );
157
+ if( !empty( $product_vendors ) && is_wp_error( $product_vendors ) == false ) {
158
+ if( $output == 'term_id' ) {
159
+ $vendor_ids = array();
160
+ foreach( $product_vendors as $key => $product_vendor )
161
+ $vendor_ids[] = $product_vendor->term_id;
162
+ // Only populate the $export Global if it is an export
163
+ if( isset( $export ) )
164
+ $export->total_rows = count( $vendor_ids );
165
+ unset( $product_vendors, $product_vendor );
166
+ return $vendor_ids;
167
+ } else if( $output == 'full' ) {
168
+ return $product_vendors;
169
+ }
170
+ }
171
+
172
+ }
173
+ ?>
includes/product_vendors.php DELETED
@@ -1,85 +0,0 @@
1
- <?php
2
- function woo_ce_get_product_vendor_fields( $format = 'full' ) {
3
-
4
- $export_type = 'product_vendor';
5
-
6
- $fields = array();
7
- $fields[] = array(
8
- 'name' => 'title',
9
- 'label' => __( 'Name', 'woo_ce' )
10
- );
11
- $fields[] = array(
12
- 'name' => 'slug',
13
- 'label' => __( 'Slug', 'woo_ce' )
14
- );
15
- $fields[] = array(
16
- 'name' => 'description',
17
- 'label' => __( 'Description', 'woo_ce' )
18
- );
19
- $fields[] = array(
20
- 'name' => 'commission',
21
- 'label' => __( 'Commission', 'woo_ce' )
22
- );
23
- $fields[] = array(
24
- 'name' => 'paypal_email',
25
- 'label' => __( 'PayPal E-mail Address', 'woo_ce' )
26
- );
27
- $fields[] = array(
28
- 'name' => 'user_name',
29
- 'label' => __( 'Vendor Username', 'woo_ce' )
30
- );
31
- $fields[] = array(
32
- 'name' => 'user_id',
33
- 'label' => __( 'Vendor User ID', 'woo_ce' )
34
- );
35
-
36
- /*
37
- $fields[] = array(
38
- 'name' => '',
39
- 'label' => __( '', 'woo_ce' )
40
- );
41
- */
42
-
43
- // Allow Plugin/Theme authors to add support for additional columns
44
- $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
45
-
46
- switch( $format ) {
47
-
48
- case 'summary':
49
- $output = array();
50
- $size = count( $fields );
51
- for( $i = 0; $i < $size; $i++ ) {
52
- if( isset( $fields[$i] ) )
53
- $output[$fields[$i]['name']] = 'on';
54
- }
55
- return $output;
56
- break;
57
-
58
- case 'full':
59
- default:
60
- $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
61
- $size = count( $fields );
62
- for( $i = 0; $i < $size; $i++ )
63
- $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
64
- usort( $fields, woo_ce_sort_fields( 'order' ) );
65
- return $fields;
66
- break;
67
-
68
- }
69
-
70
- }
71
-
72
- function woo_ce_override_product_vendor_field_labels( $fields = array() ) {
73
-
74
- $labels = woo_ce_get_option( 'product_vendor_labels', array() );
75
- if( !empty( $labels ) ) {
76
- foreach( $fields as $key => $field ) {
77
- if( isset( $labels[$field['name']] ) )
78
- $fields[$key]['label'] = $labels[$field['name']];
79
- }
80
- }
81
- return $fields;
82
-
83
- }
84
- add_filter( 'woo_ce_product_vendor_fields', 'woo_ce_override_product_vendor_field_labels', 11 );
85
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/products.php DELETED
@@ -1,1380 +0,0 @@
1
- <?php
2
- if( is_admin() ) {
3
-
4
- /* Start of: WordPress Administration */
5
-
6
- // HTML template for Filter Products by Product Category widget on Store Exporter screen
7
- function woo_ce_products_filter_by_product_category() {
8
-
9
- $args = array(
10
- 'hide_empty' => 1
11
- );
12
- $product_categories = woo_ce_get_product_categories( $args );
13
-
14
- ob_start(); ?>
15
- <p><label><input type="checkbox" id="products-filters-categories" /> <?php _e( 'Filter Products by Product Categories', 'woo_ce' ); ?></label></p>
16
- <div id="export-products-filters-categories" class="separator">
17
- <?php if( $product_categories ) { ?>
18
- <ul>
19
- <?php foreach( $product_categories as $product_category ) { ?>
20
- <li>
21
- <label><input type="checkbox" name="product_filter_category[<?php echo $product_category->term_id; ?>]" value="<?php echo $product_category->term_id; ?>" title="<?php printf( __( 'Term ID: %d', 'woo_ce' ), $product_category->term_id ); ?>"<?php disabled( $product_category->count, 0 ); ?> /> <?php echo woo_ce_format_product_category_label( $product_category->name, $product_category->parent_name ); ?></label>
22
- <span class="description">(<?php echo $product_category->count; ?>)</span>
23
- </li>
24
- <?php } ?>
25
- </ul>
26
- <p class="description"><?php _e( 'Select the Product Categories you want to filter exported Products by. Default is to include all Product Categories.', 'woo_ce' ); ?></p>
27
- <?php } else { ?>
28
- <p><?php _e( 'No Product Categories were found.', 'woo_ce' ); ?></p>
29
- <?php } ?>
30
- </div>
31
- <!-- #export-products-filters-categories -->
32
- <?php
33
- ob_end_flush();
34
-
35
- }
36
-
37
- // HTML template for Filter Products by Product Tag widget on Store Exporter screen
38
- function woo_ce_products_filter_by_product_tag() {
39
-
40
- $args = array(
41
- 'hide_empty' => 1
42
- );
43
- $product_tags = woo_ce_get_product_tags( $args );
44
-
45
- ob_start(); ?>
46
- <p><label><input type="checkbox" id="products-filters-tags" /> <?php _e( 'Filter Products by Product Tags', 'woo_ce' ); ?></label></p>
47
- <div id="export-products-filters-tags" class="separator">
48
- <?php if( $product_tags ) { ?>
49
- <ul>
50
- <?php foreach( $product_tags as $product_tag ) { ?>
51
- <li>
52
- <label><input type="checkbox" name="product_filter_tag[<?php echo $product_tag->term_id; ?>]" value="<?php echo $product_tag->term_id; ?>" title="<?php printf( __( 'Term ID: %d', 'woo_ce' ), $product_tag->term_id ); ?>"<?php disabled( $product_tag->count, 0 ); ?> /> <?php echo $product_tag->name; ?></label>
53
- <span class="description">(<?php echo $product_tag->count; ?>)</span>
54
- </li>
55
- <?php } ?>
56
- </ul>
57
- <p class="description"><?php _e( 'Select the Product Tags you want to filter exported Products by. Default is to include all Product Tags.', 'woo_ce' ); ?></p>
58
- <?php } else { ?>
59
- <p><?php _e( 'No Product Tags were found.', 'woo_ce' ); ?></p>
60
- <?php } ?>
61
- </div>
62
- <!-- #export-products-filters-tags -->
63
- <?php
64
- ob_end_flush();
65
-
66
- }
67
-
68
- // HTML template for Filter Products by Product Status widget on Store Exporter screen
69
- function woo_ce_products_filter_by_product_status() {
70
-
71
- $product_statuses = get_post_statuses();
72
- if( !isset( $product_statuses['trash'] ) )
73
- $product_statuses['trash'] = __( 'Trash', 'woo_ce' );
74
-
75
- ob_start(); ?>
76
- <p><label><input type="checkbox" id="products-filters-status" /> <?php _e( 'Filter Products by Product Status', 'woo_ce' ); ?></label></p>
77
- <div id="export-products-filters-status" class="separator">
78
- <ul>
79
- <?php foreach( $product_statuses as $key => $product_status ) { ?>
80
- <li><label><input type="checkbox" name="product_filter_status[<?php echo $key; ?>]" value="<?php echo $key; ?>" /> <?php echo $product_status; ?></label></li>
81
- <?php } ?>
82
- </ul>
83
- <p class="description"><?php _e( 'Select the Product Status options you want to filter exported Products by. Default is to include all Product Status options.', 'woo_ce' ); ?></p>
84
- </div>
85
- <!-- #export-products-filters-status -->
86
- <?php
87
- ob_end_flush();
88
-
89
- }
90
-
91
- // HTML template for Filter Products by Product Type widget on Store Exporter screen
92
- function woo_ce_products_filter_by_product_type() {
93
-
94
- $product_types = woo_ce_get_product_types();
95
-
96
- ob_start(); ?>
97
- <p><label><input type="checkbox" id="products-filters-type" /> <?php _e( 'Filter Products by Product Type', 'woo_ce' ); ?></label></p>
98
- <div id="export-products-filters-type" class="separator">
99
- <ul>
100
- <?php if( $product_types ) { ?>
101
- <?php foreach( $product_types as $key => $product_type ) { ?>
102
- <li><label><input type="checkbox" name="product_filter_type[<?php echo $key; ?>]" value="<?php echo $key; ?>" /> <?php echo woo_ce_format_product_type( $product_type['name'] ); ?> (<?php echo $product_type['count']; ?>)</label></li>
103
- <?php } ?>
104
- <?php } ?>
105
- </ul>
106
- <p class="description"><?php _e( 'Select the Product Type\'s you want to filter exported Products by. Default is to include all Product Types and Variations.', 'woo_ce' ); ?></p>
107
- </div>
108
- <!-- #export-products-filters-type -->
109
- <?php
110
- ob_end_flush();
111
-
112
- }
113
-
114
- // HTML template for Filter Products by Product Type widget on Store Exporter screen
115
- function woo_ce_products_filter_by_stock_status() {
116
-
117
- // Store Exporter Deluxe
118
- $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
119
- $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woo_ce' ) . '</a>', $woo_cd_url );
120
-
121
- ob_start(); ?>
122
- <p><label><input type="checkbox" id="products-filters-stock" /> <?php _e( 'Filter Products by Stock Status', 'woo_ce' ); ?></label></p>
123
- <div id="export-products-filters-stock" class="separator">
124
- <ul>
125
- <li value=""><label><input type="radio" name="product_filter_stock" value="" checked="checked" /><?php _e( 'Include both', 'woo_ce' ); ?></label></li>
126
- <li value="instock"><label><input type="radio" name="product_filter_stock" value="instock" disabled="disabled" /><?php _e( 'In stock', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></li>
127
- <li value="outofstock"><label><input type="radio" name="product_filter_stock" value="outofstock" disabled="disabled" /><?php _e( 'Out of stock', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></li>
128
- </ul>
129
- </div>
130
- <!-- #export-products-filters-stock -->
131
- <?php
132
- ob_end_flush();
133
-
134
- }
135
-
136
- // HTML template for Product Sorting widget on Store Exporter screen
137
- function woo_ce_products_product_sorting() {
138
-
139
- $product_orderby = woo_ce_get_option( 'product_orderby', 'ID' );
140
- $product_order = woo_ce_get_option( 'product_order', 'DESC' );
141
-
142
- ob_start(); ?>
143
- <p><label><?php _e( 'Product Sorting', 'woo_ce' ); ?></label></p>
144
- <div>
145
- <select name="product_orderby">
146
- <option value="ID"<?php selected( 'ID', $product_orderby ); ?>><?php _e( 'Product ID', 'woo_ce' ); ?></option>
147
- <option value="title"<?php selected( 'title', $product_orderby ); ?>><?php _e( 'Product Name', 'woo_ce' ); ?></option>
148
- <option value="date"<?php selected( 'date', $product_orderby ); ?>><?php _e( 'Date Created', 'woo_ce' ); ?></option>
149
- <option value="modified"<?php selected( 'modified', $product_orderby ); ?>><?php _e( 'Date Modified', 'woo_ce' ); ?></option>
150
- <option value="rand"<?php selected( 'rand', $product_orderby ); ?>><?php _e( 'Random', 'woo_ce' ); ?></option>
151
- <option value="menu_order"<?php selected( 'menu_order', $product_orderby ); ?>><?php _e( 'Sort Order', 'woo_ce' ); ?></option>
152
- </select>
153
- <select name="product_order">
154
- <option value="ASC"<?php selected( 'ASC', $product_order ); ?>><?php _e( 'Ascending', 'woo_ce' ); ?></option>
155
- <option value="DESC"<?php selected( 'DESC', $product_order ); ?>><?php _e( 'Descending', 'woo_ce' ); ?></option>
156
- </select>
157
- <p class="description"><?php _e( 'Select the sorting of Products within the exported file. By default this is set to export Products by Product ID in Desending order.', 'woo_ce' ); ?></p>
158
- </div>
159
- <?php
160
- ob_end_flush();
161
-
162
- }
163
-
164
- // HTML template for Up-sells formatting on Store Exporter screen
165
- function woo_ce_products_upsells_formatting() {
166
-
167
- $upsell_formatting = woo_ce_get_option( 'upsell_formatting', 1 );
168
-
169
- ob_start(); ?>
170
- <tr class="export-options product-options">
171
- <th><label for=""><?php _e( 'Up-sells formatting', 'woo_ce' ); ?></label></th>
172
- <td>
173
- <label><input type="radio" name="product_upsell_formatting" value="0"<?php checked( $upsell_formatting, 0 ); ?> />&nbsp;<?php _e( 'Export Up-Sells as Product ID', 'woo_ce' ); ?></label><br />
174
- <label><input type="radio" name="product_upsell_formatting" value="1"<?php checked( $upsell_formatting, 1 ); ?> />&nbsp;<?php _e( 'Export Up-Sells as Product SKU', 'woo_ce' ); ?></label>
175
- <p class="description"><?php _e( 'Choose the up-sell formatting that is accepted by your WooCommerce import Plugin (e.g. Product Importer Deluxe, Product Import Suite, etc.).', 'woo_ce' ); ?></p>
176
- </td>
177
- </tr>
178
-
179
- <?php
180
- ob_end_flush();
181
-
182
- }
183
-
184
- // HTML template for Cross-sells formatting on Store Exporter screen
185
- function woo_ce_products_crosssells_formatting() {
186
-
187
- $crosssell_formatting = woo_ce_get_option( 'crosssell_formatting', 1 );
188
-
189
- ob_start(); ?>
190
- <tr class="export-options product-options">
191
- <th><label for=""><?php _e( 'Cross-sells formatting', 'woo_ce' ); ?></label></th>
192
- <td>
193
- <label><input type="radio" name="product_crosssell_formatting" value="0"<?php checked( $crosssell_formatting, 0 ); ?> />&nbsp;<?php _e( 'Export Cross-Sells as Product ID', 'woo_ce' ); ?></label><br />
194
- <label><input type="radio" name="product_crosssell_formatting" value="1"<?php checked( $crosssell_formatting, 1 ); ?> />&nbsp;<?php _e( 'Export Cross-Sells as Product SKU', 'woo_ce' ); ?></label>
195
- <p class="description"><?php _e( 'Choose the cross-sell formatting that is accepted by your WooCommerce import Plugin (e.g. Product Importer Deluxe, Product Import Suite, etc.).', 'woo_ce' ); ?></p>
196
- </td>
197
- </tr>
198
-
199
- <?php
200
- ob_end_flush();
201
-
202
- }
203
-
204
- // HTML template for Custom Products widget on Store Exporter screen
205
- function woo_ce_products_custom_fields() {
206
-
207
- if( $custom_products = woo_ce_get_option( 'custom_products', '' ) )
208
- $custom_products = implode( "\n", $custom_products );
209
-
210
- $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/';
211
-
212
- ob_start(); ?>
213
- <form method="post" id="export-products-custom-fields" class="export-options product-options">
214
- <div id="poststuff">
215
-
216
- <div class="postbox" id="export-options product-options">
217
- <h3 class="hndle"><?php _e( 'Custom Product Fields', 'woo_ce' ); ?></h3>
218
- <div class="inside">
219
- <p class="description"><?php _e( 'To include additional custom Product meta in the Export Products table above fill the Products text box then click Save Custom Fields.', 'woo_ce' ); ?></p>
220
- <table class="form-table">
221
-
222
- <tr>
223
- <th>
224
- <label><?php _e( 'Product meta', 'woo_ce' ); ?></label>
225
- </th>
226
- <td>
227
- <textarea name="custom_products" rows="5" cols="70"><?php echo esc_textarea( $custom_products ); ?></textarea>
228
- <p class="description"><?php _e( 'Include additional custom Product meta in your export file by adding each custom Product meta name to a new line above.<br />For example: <code>Customer UA, Customer IP Address</code>', 'woo_ce' ); ?></p>
229
- </td>
230
- </tr>
231
-
232
- </table>
233
- <p class="submit">
234
- <input type="submit" value="<?php _e( 'Save Custom Fields', 'woo_ce' ); ?>" class="button-primary" />
235
- </p>
236
- <p class="description"><?php printf( __( 'For more information on custom Product meta consult our <a href="%s" target="_blank">online documentation</a>.', 'woo_ce' ), $troubleshooting_url ); ?></p>
237
- </div>
238
- <!-- .inside -->
239
- </div>
240
- <!-- .postbox -->
241
-
242
- </div>
243
- <!-- #poststuff -->
244
- <input type="hidden" name="action" value="update" />
245
- </form>
246
- <!-- #export-products-custom-fields -->
247
- <?php
248
- ob_end_flush();
249
-
250
- }
251
-
252
- /* End of: WordPress Administration */
253
-
254
- }
255
-
256
- // Returns a list of WooCommerce Product IDs to export process
257
- function woo_ce_get_products( $args = array() ) {
258
-
259
- $limit_volume = -1;
260
- $offset = 0;
261
- $product_categories = false;
262
- $product_tags = false;
263
- $product_status = false;
264
- $product_type = false;
265
- $orderby = 'ID';
266
- $order = 'ASC';
267
- if( $args ) {
268
- $limit_volume = $args['limit_volume'];
269
- $offset = $args['offset'];
270
- if( !empty( $args['product_categories'] ) )
271
- $product_categories = $args['product_categories'];
272
- if( !empty( $args['product_tags'] ) )
273
- $product_tags = $args['product_tags'];
274
- if( !empty( $args['product_status'] ) )
275
- $product_status = $args['product_status'];
276
- if( !empty( $args['product_type'] ) )
277
- $product_type = $args['product_type'];
278
- if( isset( $args['product_orderby'] ) )
279
- $orderby = $args['product_orderby'];
280
- if( isset( $args['product_order'] ) )
281
- $order = $args['product_order'];
282
- }
283
- $post_type = array( 'product', 'product_variation' );
284
- $args = array(
285
- 'post_type' => $post_type,
286
- 'orderby' => $orderby,
287
- 'order' => $order,
288
- 'offset' => $offset,
289
- 'posts_per_page' => $limit_volume,
290
- 'post_status' => woo_ce_post_statuses(),
291
- 'fields' => 'ids'
292
- );
293
- if( $product_categories ) {
294
- $term_taxonomy = 'product_cat';
295
- $args['tax_query'] = array(
296
- array(
297
- 'taxonomy' => $term_taxonomy,
298
- 'field' => 'id',
299
- 'terms' => $product_categories
300
- )
301
- );
302
- }
303
- if( $product_tags ) {
304
- $term_taxonomy = 'product_tag';
305
- $args['tax_query'] = array(
306
- array(
307
- 'taxonomy' => $term_taxonomy,
308
- 'field' => 'id',
309
- 'terms' => $product_tags
310
- )
311
- );
312
- }
313
- if( $product_status )
314
- $args['post_status'] = woo_ce_post_statuses( $product_status, true );
315
- if( $product_type ) {
316
- if( in_array( 'variation', $product_type ) ) {
317
- $args['post_type'] = 'product_variation';
318
- } else {
319
- $args['tax_query'] = array(
320
- array(
321
- 'taxonomy' => 'product_type',
322
- 'field' => 'slug',
323
- 'terms' => $product_type
324
- )
325
- );
326
- }
327
- }
328
- $products = array();
329
- $product_ids = new WP_Query( $args );
330
- if( $product_ids->posts ) {
331
- foreach( $product_ids->posts as $product_id ) {
332
- $product = get_post( $product_id );
333
- // Filter out variations that don't have a Parent Product that exists
334
- if( $product->post_type == 'product_variation' ) {
335
- // Check if Parent exists
336
- if( $product->post_parent ) {
337
- if( !get_post( $product->post_parent ) ) {
338
- unset( $product_id, $product );
339
- continue;
340
- }
341
- }
342
- }
343
- if( isset( $product_id ) )
344
- $products[] = $product_id;
345
- }
346
- unset( $product_ids, $product_id );
347
- }
348
- return $products;
349
-
350
- }
351
-
352
- function woo_ce_get_product_data( $product_id = 0, $args = array() ) {
353
-
354
- // Get Product defaults
355
- $weight_unit = get_option( 'woocommerce_weight_unit' );
356
- $dimension_unit = get_option( 'woocommerce_dimension_unit' );
357
- $height_unit = $dimension_unit;
358
- $width_unit = $dimension_unit;
359
- $length_unit = $dimension_unit;
360
-
361
- $product = get_post( $product_id );
362
- $product->parent_id = '';
363
- $product->parent_sku = '';
364
- if( $product->post_type == 'product_variation' ) {
365
- // Assign Parent ID for Variants then check if Parent exists
366
- if( $product->parent_id = $product->post_parent )
367
- $product->parent_sku = get_post_meta( $product->post_parent, '_sku', true );
368
- else
369
- $product->parent_id = '';
370
- }
371
- $product->product_id = $product->ID;
372
- $product->sku = get_post_meta( $product->ID, '_sku', true );
373
- $product->name = get_the_title( $product->ID );
374
- $product->permalink = get_permalink( $product->ID );
375
- $product->slug = $product->post_name;
376
- $product->description = $product->post_content;
377
- $product->excerpt = $product->post_excerpt;
378
- $product->regular_price = get_post_meta( $product->ID, '_regular_price', true );
379
- // Check that a valid price has been provided and that wc_format_localized_price() exists
380
- if( isset( $product->regular_price ) && $product->regular_price != '' && function_exists( 'wc_format_localized_price' ) )
381
- $product->regular_price = wc_format_localized_price( $product->regular_price );
382
- $product->price = get_post_meta( $product->ID, '_price', true );
383
- if( $product->regular_price != '' && ( $product->regular_price <> $product->price ) )
384
- $product->price = $product->regular_price;
385
- // Check that a valid price has been provided and that wc_format_localized_price() exists
386
- if( isset( $product->price ) && $product->price != '' && function_exists( 'wc_format_localized_price' ) )
387
- $product->price = wc_format_localized_price( $product->price );
388
- $product->sale_price = get_post_meta( $product->ID, '_sale_price', true );
389
- // Check that a valid price has been provided and that wc_format_localized_price() exists
390
- if( isset( $product->sale_price ) && $product->sale_price != '' && function_exists( 'wc_format_localized_price' ) )
391
- $product->sale_price = wc_format_localized_price( $product->sale_price );
392
- $product->sale_price_dates_from = woo_ce_format_sale_price_dates( get_post_meta( $product->ID, '_sale_price_dates_from', true ) );
393
- $product->sale_price_dates_to = woo_ce_format_sale_price_dates( get_post_meta( $product->ID, '_sale_price_dates_to', true ) );
394
- $product->post_date = woo_ce_format_date( $product->post_date );
395
- $product->post_modified = woo_ce_format_date( $product->post_modified );
396
- $product->type = woo_ce_get_product_assoc_type( $product->ID );
397
- if( $product->post_type == 'product_variation' )
398
- $product->type = __( 'Variation', 'woo_ce' );
399
- $product->visibility = woo_ce_format_visibility( get_post_meta( $product->ID, '_visibility', true ) );
400
- $product->featured = woo_ce_format_switch( get_post_meta( $product->ID, '_featured', true ) );
401
- $product->virtual = woo_ce_format_switch( get_post_meta( $product->ID, '_virtual', true ) );
402
- $product->downloadable = woo_ce_format_switch( get_post_meta( $product->ID, '_downloadable', true ) );
403
- $product->weight = get_post_meta( $product->ID, '_weight', true );
404
- $product->weight_unit = ( $product->weight != '' ? $weight_unit : '' );
405
- $product->height = get_post_meta( $product->ID, '_height', true );
406
- $product->height_unit = ( $product->height != '' ? $height_unit : '' );
407
- $product->width = get_post_meta( $product->ID, '_width', true );
408
- $product->width_unit = ( $product->width != '' ? $width_unit : '' );
409
- $product->length = get_post_meta( $product->ID, '_length', true );
410
- $product->length_unit = ( $product->length != '' ? $length_unit : '' );
411
- $product->category = woo_ce_get_product_assoc_categories( $product->ID, $product->parent_id );
412
- $product->tag = woo_ce_get_product_assoc_tags( $product->ID );
413
- $product->manage_stock = woo_ce_format_switch( get_post_meta( $product->ID, '_manage_stock', true ) );
414
- $product->allow_backorders = woo_ce_format_switch( get_post_meta( $product->ID, '_backorders', true ) );
415
- $product->sold_individually = woo_ce_format_switch( get_post_meta( $product->ID, '_sold_individually', true ) );
416
- $product->upsell_ids = woo_ce_get_product_assoc_upsell_ids( $product->ID );
417
- $product->crosssell_ids = woo_ce_get_product_assoc_crosssell_ids( $product->ID );
418
- $product->quantity = get_post_meta( $product->ID, '_stock', true );
419
- $product->stock_status = woo_ce_format_stock_status( get_post_meta( $product->ID, '_stock_status', true ), $product->quantity );
420
- $product->image = woo_ce_get_product_assoc_featured_image( $product->ID );
421
- $product->tax_status = woo_ce_format_tax_status( get_post_meta( $product->ID, '_tax_status', true ) );
422
- $product->tax_class = woo_ce_format_tax_class( get_post_meta( $product->ID, '_tax_class', true ) );
423
- $product->product_url = get_post_meta( $product->ID, '_product_url', true );
424
- $product->button_text = get_post_meta( $product->ID, '_button_text', true );
425
- $product->file_download = woo_ce_get_product_assoc_file_downloads( $product->ID );
426
- $product->download_limit = get_post_meta( $product->ID, '_download_limit', true );
427
- $product->download_expiry = get_post_meta( $product->ID, '_download_expiry', true );
428
- $product->download_type = woo_ce_format_download_type( get_post_meta( $product->ID, '_download_type', true ) );
429
- $product->purchase_note = get_post_meta( $product->ID, '_purchase_note', true );
430
- $product->product_status = woo_ce_format_product_status( $product->post_status );
431
- $product->enable_reviews = woo_ce_format_comment_status( $product->comment_status );
432
- $product->menu_order = $product->menu_order;
433
-
434
- // Attributes
435
- if( $attributes = woo_ce_get_product_attributes() ) {
436
- if( $product->post_type == 'product_variation' ) {
437
- foreach( $attributes as $attribute ) {
438
- $attribute_value = get_post_meta( $product->ID, sprintf( 'attribute_pa_%s', $attribute->attribute_name ), true );
439
- if( !empty( $attribute_value ) ) {
440
- $term_id = term_exists( $attribute_value, sprintf( 'pa_%s', $attribute->attribute_name ) );
441
- if( $term_id !== 0 && $term_id !== null && !is_wp_error( $term_id ) ) {
442
- $term = get_term( $term_id['term_id'], sprintf( 'pa_%s', $attribute->attribute_name ) );
443
- $attribute_value = $term->name;
444
- unset( $term );
445
- }
446
- unset( $term_id );
447
- }
448
- $product->{'attribute_' . $attribute->attribute_name} = $attribute_value;
449
- unset( $attribute_value );
450
- }
451
- } else {
452
- $product->attributes = maybe_unserialize( get_post_meta( $product->ID, '_product_attributes', true ) );
453
- if( !empty( $product->attributes ) ) {
454
- // Check for taxonomy-based attributes
455
- foreach( $attributes as $attribute ) {
456
- if( isset( $product->attributes['pa_' . $attribute->attribute_name] ) )
457
- $product->{'attribute_' . $attribute->attribute_name} = woo_ce_get_product_assoc_attributes( $product->ID, $product->attributes['pa_' . $attribute->attribute_name], 'product' );
458
- else
459
- $product->{'attribute_' . $attribute->attribute_name} = woo_ce_get_product_assoc_attributes( $product->ID, $attribute, 'global' );
460
- }
461
- // Check for per-Product attributes (custom)
462
- foreach( $product->attributes as $key => $attribute ) {
463
- if( $attribute['is_taxonomy'] == 0 ) {
464
- if( !isset( $product->{'attribute_' . $key} ) )
465
- $product->{'attribute_' . $key} = $attribute['value'];
466
- }
467
- }
468
- }
469
- }
470
- }
471
-
472
- // Advanced Google Product Feed - http://plugins.leewillis.co.uk/downloads/wp-e-commerce-product-feeds/
473
- if( function_exists( 'woocommerce_gpf_install' ) ) {
474
- $product->gpf_data = get_post_meta( $product->ID, '_wpec_gpf_data', true );
475
- $product->gpf_availability = ( isset( $product->gpf_data['availability'] ) ? woo_ce_format_gpf_availability( $product->gpf_data['availability'] ) : '' );
476
- $product->gpf_condition = ( isset( $product->gpf_data['condition'] ) ? woo_ce_format_gpf_condition( $product->gpf_data['condition'] ) : '' );
477
- $product->gpf_brand = ( isset( $product->gpf_data['brand'] ) ? $product->gpf_data['brand'] : '' );
478
- $product->gpf_product_type = ( isset( $product->gpf_data['product_type'] ) ? $product->gpf_data['product_type'] : '' );
479
- $product->gpf_google_product_category = ( isset( $product->gpf_data['google_product_category'] ) ? $product->gpf_data['google_product_category'] : '' );
480
- $product->gpf_gtin = ( isset( $product->gpf_data['gtin'] ) ? $product->gpf_data['gtin'] : '' );
481
- $product->gpf_mpn = ( isset( $product->gpf_data['mpn'] ) ? $product->gpf_data['mpn'] : '' );
482
- $product->gpf_gender = ( isset( $product->gpf_data['gender'] ) ? $product->gpf_data['gender'] : '' );
483
- $product->gpf_age_group = ( isset( $product->gpf_data['age_group'] ) ? $product->gpf_data['age_group'] : '' );
484
- $product->gpf_color = ( isset( $product->gpf_data['color'] ) ? $product->gpf_data['color'] : '' );
485
- $product->gpf_size = ( isset( $product->gpf_data['size'] ) ? $product->gpf_data['size'] : '' );
486
- }
487
-
488
- // All in One SEO Pack - http://wordpress.org/extend/plugins/all-in-one-seo-pack/
489
- if( function_exists( 'aioseop_activate' ) ) {
490
- $product->aioseop_keywords = get_post_meta( $product->ID, '_aioseop_keywords', true );
491
- $product->aioseop_description = get_post_meta( $product->ID, '_aioseop_description', true );
492
- $product->aioseop_title = get_post_meta( $product->ID, '_aioseop_title', true );
493
- $product->aioseop_titleatr = get_post_meta( $product->ID, '_aioseop_titleatr', true );
494
- $product->aioseop_menulabel = get_post_meta( $product->ID, '_aioseop_menulabel', true );
495
- }
496
-
497
- // WordPress SEO - http://wordpress.org/plugins/wordpress-seo/
498
- if( function_exists( 'wpseo_admin_init' ) ) {
499
- $product->wpseo_focuskw = get_post_meta( $product->ID, '_yoast_wpseo_focuskw', true );
500
- $product->wpseo_metadesc = get_post_meta( $product->ID, '_yoast_wpseo_metadesc', true );
501
- $product->wpseo_title = get_post_meta( $product->ID, '_yoast_wpseo_title', true );
502
- $product->wpseo_googleplus_description = get_post_meta( $product->ID, '_yoast_wpseo_google-plus-description', true );
503
- $product->wpseo_opengraph_description = get_post_meta( $product->ID, '_yoast_wpseo_opengraph-description', true );
504
- }
505
-
506
- // Ultimate SEO - http://wordpress.org/plugins/seo-ultimate/
507
- if( function_exists( 'su_wp_incompat_notice' ) ) {
508
- $product->useo_meta_title = get_post_meta( $product->ID, '_su_title', true );
509
- $product->useo_meta_description = get_post_meta( $product->ID, '_su_description', true );
510
- $product->useo_meta_keywords = get_post_meta( $product->ID, '_su_keywords', true );
511
- $product->useo_social_title = get_post_meta( $product->ID, '_su_og_title', true );
512
- $product->useo_social_description = get_post_meta( $product->ID, '_su_og_description', true );
513
- $product->useo_meta_noindex = get_post_meta( $product->ID, '_su_meta_robots_noindex', true );
514
- $product->useo_meta_noautolinks = get_post_meta( $product->ID, '_su_disable_autolinks', true );
515
- }
516
-
517
- // WooCommerce MSRP Pricing - http://woothemes.com/woocommerce/
518
- if( function_exists( 'woocommerce_msrp_activate' ) ) {
519
- $product->msrp = get_post_meta( $product->ID, '_msrp_price', true );
520
- if( $product->msrp == false && $product->post_type == 'product_variation' )
521
- $product->msrp = get_post_meta( $product->ID, '_msrp', true );
522
- // Check that a valid price has been provided and that wc_format_localized_price() exists
523
- if( isset( $product->msrp ) && $product->msrp != '' && function_exists( 'wc_format_localized_price' ) )
524
- $product->msrp = wc_format_localized_price( $product->msrp );
525
- }
526
-
527
- // Allow Plugin/Theme authors to add support for additional Product columns
528
- return apply_filters( 'woo_ce_product_item', $product, $product->ID );
529
-
530
- }
531
-
532
- // Returns Product Categories associated to a specific Product
533
- function woo_ce_get_product_assoc_categories( $product_id = 0, $parent_id = 0 ) {
534
-
535
- global $export;
536
-
537
- $output = '';
538
- $term_taxonomy = 'product_cat';
539
- // Return Product Categories of Parent if this is a Variation
540
- if( $parent_id )
541
- $product_id = $parent_id;
542
- if( $product_id )
543
- $categories = wp_get_object_terms( $product_id, $term_taxonomy );
544
- if( !empty( $categories ) && is_wp_error( $categories ) == false ) {
545
- $size = count( $categories );
546
- for( $i = 0; $i < $size; $i++ ) {
547
- if( $categories[$i]->parent == '0' ) {
548
- $output .= $categories[$i]->name . $export->category_separator;
549
- } else {
550
- // Check if Parent -> Child
551
- $parent_category = get_term( $categories[$i]->parent, $term_taxonomy );
552
- // Check if Parent -> Child -> Subchild
553
- if( $parent_category->parent == '0' ) {
554
- $output .= $parent_category->name . '>' . $categories[$i]->name . $export->category_separator;
555
- $output = str_replace( $parent_category->name . $export->category_separator, '', $output );
556
- } else {
557
- $root_category = get_term( $parent_category->parent, $term_taxonomy );
558
- $output .= $root_category->name . '>' . $parent_category->name . '>' . $categories[$i]->name . $export->category_separator;
559
- $output = str_replace( array(
560
- $root_category->name . '>' . $parent_category->name . $export->category_separator,
561
- $parent_category->name . $export->category_separator
562
- ), '', $output );
563
- }
564
- unset( $root_category, $parent_category );
565
- }
566
- }
567
- $output = substr( $output, 0, -1 );
568
- } else {
569
- $output .= __( 'Uncategorized', 'woo_ce' );
570
- }
571
- return $output;
572
-
573
- }
574
-
575
- // Returns Product Tags associated to a specific Product
576
- function woo_ce_get_product_assoc_tags( $product_id = 0 ) {
577
-
578
- global $export;
579
-
580
- $output = '';
581
- $term_taxonomy = 'product_tag';
582
- $tags = wp_get_object_terms( $product_id, $term_taxonomy );
583
- if( !empty( $tags ) && is_wp_error( $tags ) == false ) {
584
- $size = count( $tags );
585
- for( $i = 0; $i < $size; $i++ ) {
586
- if( $tag = get_term( $tags[$i]->term_id, $term_taxonomy ) )
587
- $output .= $tag->name . $export->category_separator;
588
- }
589
- $output = substr( $output, 0, -1 );
590
- }
591
- return $output;
592
-
593
- }
594
-
595
- // Returns the Featured Image associated to a specific Product
596
- function woo_ce_get_product_assoc_featured_image( $product_id = 0 ) {
597
-
598
- $output = '';
599
- if( $product_id ) {
600
- if( $thumbnail_id = get_post_meta( $product_id, '_thumbnail_id', true ) )
601
- $output = wp_get_attachment_url( $thumbnail_id );
602
- }
603
- return $output;
604
-
605
- }
606
-
607
- // Returns the Product Type of a specific Product
608
- function woo_ce_get_product_assoc_type( $product_id = 0 ) {
609
-
610
- global $export;
611
-
612
- $output = '';
613
- $term_taxonomy = 'product_type';
614
- $types = wp_get_object_terms( $product_id, $term_taxonomy );
615
- if( empty( $types ) )
616
- $types = array( get_term_by( 'name', 'simple', $term_taxonomy ) );
617
- if( $types ) {
618
- $size = count( $types );
619
- for( $i = 0; $i < $size; $i++ ) {
620
- $type = get_term( $types[$i]->term_id, $term_taxonomy );
621
- $output .= woo_ce_format_product_type( $type->name ) . $export->category_separator;
622
- }
623
- $output = substr( $output, 0, -1 );
624
- }
625
- return $output;
626
-
627
- }
628
-
629
- // Returns the Up-Sell associated to a specific Product
630
- function woo_ce_get_product_assoc_upsell_ids( $product_id = 0 ) {
631
-
632
- global $export;
633
-
634
- $output = '';
635
- if( $product_id ) {
636
- $upsell_ids = get_post_meta( $product_id, '_upsell_ids', true );
637
- // Convert Product ID to Product SKU as per Up-Sells Formatting
638
- if( $export->upsell_formatting == 1 && !empty( $upsell_ids ) ) {
639
- $size = count( $upsell_ids );
640
- for( $i = 0; $i < $size; $i++ ) {
641
- $upsell_ids[$i] = get_post_meta( $upsell_ids[$i], '_sku', true );
642
- if( empty( $upsell_ids[$i] ) )
643
- unset( $upsell_ids[$i] );
644
- }
645
- // 'reindex' array
646
- $upsell_ids = array_values( $upsell_ids );
647
- }
648
- $output = woo_ce_convert_product_ids( $upsell_ids );
649
- }
650
- return $output;
651
-
652
- }
653
-
654
- // Returns the Cross-Sell associated to a specific Product
655
- function woo_ce_get_product_assoc_crosssell_ids( $product_id = 0 ) {
656
-
657
- global $export;
658
-
659
- $output = '';
660
- if( $product_id ) {
661
- $crosssell_ids = get_post_meta( $product_id, '_crosssell_ids', true );
662
- // Convert Product ID to Product SKU as per Cross-Sells Formatting
663
- if( $export->crosssell_formatting == 1 && !empty( $crosssell_ids ) ) {
664
- $size = count( $crosssell_ids );
665
- for( $i = 0; $i < $size; $i++ ) {
666
- $crosssell_ids[$i] = get_post_meta( $crosssell_ids[$i], '_sku', true );
667
- // Remove Cross-Sell if SKU is empty
668
- if( empty( $crosssell_ids[$i] ) )
669
- unset( $crosssell_ids[$i] );
670
- }
671
- // 'reindex' array
672
- $crosssell_ids = array_values( $crosssell_ids );
673
- }
674
- $output = woo_ce_convert_product_ids( $crosssell_ids );
675
- }
676
- return $output;
677
-
678
- }
679
-
680
- // Returns Product Attributes associated to a specific Product
681
- function woo_ce_get_product_assoc_attributes( $product_id = 0, $attribute = array(), $type = 'product' ) {
682
-
683
- global $export;
684
-
685
- $output = '';
686
- if( $product_id ) {
687
- $terms = array();
688
- if( $type == 'product' ) {
689
- if( $attribute['is_taxonomy'] == 1 )
690
- $term_taxonomy = $attribute['name'];
691
- } else if( $type == 'global' ) {
692
- $term_taxonomy = 'pa_' . $attribute->attribute_name;
693
- }
694
- $terms = wp_get_object_terms( $product_id, $term_taxonomy );
695
- if( !empty( $terms ) && is_wp_error( $terms ) == false ) {
696
- $size = count( $terms );
697
- for( $i = 0; $i < $size; $i++ )
698
- $output .= $terms[$i]->name . $export->category_separator;
699
- unset( $terms );
700
- }
701
- $output = substr( $output, 0, -1 );
702
- }
703
- return $output;
704
-
705
- }
706
-
707
- // Returns File Downloads associated to a specific Product
708
- function woo_ce_get_product_assoc_file_downloads( $product_id = 0 ) {
709
-
710
- global $export;
711
-
712
- $output = '';
713
- if( $product_id ) {
714
- if( version_compare( WOOCOMMERCE_VERSION, '2.0', '>=' ) ) {
715
- // If WooCommerce 2.0+ is installed then use new _downloadable_files Post meta key
716
- if( $file_downloads = maybe_unserialize( get_post_meta( $product_id, '_downloadable_files', true ) ) ) {
717
- foreach( $file_downloads as $file_download )
718
- $output .= $file_download['file'] . $export->category_separator;
719
- unset( $file_download, $file_downloads );
720
- }
721
- $output = substr( $output, 0, -1 );
722
- } else {
723
- // If WooCommerce -2.0 is installed then use legacy _file_paths Post meta key
724
- if( $file_downloads = maybe_unserialize( get_post_meta( $product_id, '_file_paths', true ) ) ) {
725
- foreach( $file_downloads as $file_download )
726
- $output .= $file_download . $export->category_separator;
727
- unset( $file_download, $file_downloads );
728
- }
729
- $output = substr( $output, 0, -1 );
730
- }
731
- }
732
- return $output;
733
-
734
- }
735
-
736
- // Returns a list of Product export columns
737
- function woo_ce_get_product_fields( $format = 'full' ) {
738
-
739
- $export_type = 'product';
740
-
741
- $fields = array();
742
- $fields[] = array(
743
- 'name' => 'parent_id',
744
- 'label' => __( 'Parent ID', 'woo_ce' )
745
- );
746
- $fields[] = array(
747
- 'name' => 'parent_sku',
748
- 'label' => __( 'Parent SKU', 'woo_ce' )
749
- );
750
- $fields[] = array(
751
- 'name' => 'product_id',
752
- 'label' => __( 'Product ID', 'woo_ce' )
753
- );
754
- $fields[] = array(
755
- 'name' => 'sku',
756
- 'label' => __( 'Product SKU', 'woo_ce' )
757
- );
758
- $fields[] = array(
759
- 'name' => 'name',
760
- 'label' => __( 'Product Name', 'woo_ce' )
761
- );
762
- $fields[] = array(
763
- 'name' => 'slug',
764
- 'label' => __( 'Slug', 'woo_ce' )
765
- );
766
- $fields[] = array(
767
- 'name' => 'permalink',
768
- 'label' => __( 'Permalink', 'woo_ce' )
769
- );
770
- $fields[] = array(
771
- 'name' => 'description',
772
- 'label' => __( 'Description', 'woo_ce' )
773
- );
774
- $fields[] = array(
775
- 'name' => 'excerpt',
776
- 'label' => __( 'Excerpt', 'woo_ce' )
777
- );
778
- $fields[] = array(
779
- 'name' => 'post_date',
780
- 'label' => __( 'Product Published', 'woo_ce' )
781
- );
782
- $fields[] = array(
783
- 'name' => 'post_modified',
784
- 'label' => __( 'Product Modified', 'woo_ce' )
785
- );
786
- $fields[] = array(
787
- 'name' => 'type',
788
- 'label' => __( 'Type', 'woo_ce' )
789
- );
790
- $fields[] = array(
791
- 'name' => 'visibility',
792
- 'label' => __( 'Visibility', 'woo_ce' )
793
- );
794
- $fields[] = array(
795
- 'name' => 'featured',
796
- 'label' => __( 'Featured', 'woo_ce' )
797
- );
798
- $fields[] = array(
799
- 'name' => 'virtual',
800
- 'label' => __( 'Virtual', 'woo_ce' )
801
- );
802
- $fields[] = array(
803
- 'name' => 'downloadable',
804
- 'label' => __( 'Downloadable', 'woo_ce' )
805
- );
806
- $fields[] = array(
807
- 'name' => 'price',
808
- 'label' => __( 'Price', 'woo_ce' )
809
- );
810
- $fields[] = array(
811
- 'name' => 'sale_price',
812
- 'label' => __( 'Sale Price', 'woo_ce' )
813
- );
814
- $fields[] = array(
815
- 'name' => 'sale_price_dates_from',
816
- 'label' => __( 'Sale Price Dates From', 'woo_ce' )
817
- );
818
- $fields[] = array(
819
- 'name' => 'sale_price_dates_to',
820
- 'label' => __( 'Sale Price Dates To', 'woo_ce' )
821
- );
822
- $fields[] = array(
823
- 'name' => 'weight',
824
- 'label' => __( 'Weight', 'woo_ce' )
825
- );
826
- $fields[] = array(
827
- 'name' => 'weight_unit',
828
- 'label' => __( 'Weight Unit', 'woo_ce' )
829
- );
830
- $fields[] = array(
831
- 'name' => 'height',
832
- 'label' => __( 'Height', 'woo_ce' )
833
- );
834
- $fields[] = array(
835
- 'name' => 'height_unit',
836
- 'label' => __( 'Height Unit', 'woo_ce' )
837
- );
838
- $fields[] = array(
839
- 'name' => 'width',
840
- 'label' => __( 'Width', 'woo_ce' )
841
- );
842
- $fields[] = array(
843
- 'name' => 'width_unit',
844
- 'label' => __( 'Width Unit', 'woo_ce' )
845
- );
846
- $fields[] = array(
847
- 'name' => 'length',
848
- 'label' => __( 'Length', 'woo_ce' )
849
- );
850
- $fields[] = array(
851
- 'name' => 'length_unit',
852
- 'label' => __( 'Length Unit', 'woo_ce' )
853
- );
854
- $fields[] = array(
855
- 'name' => 'category',
856
- 'label' => __( 'Category', 'woo_ce' )
857
- );
858
- $fields[] = array(
859
- 'name' => 'tag',
860
- 'label' => __( 'Tag', 'woo_ce' )
861
- );
862
- $fields[] = array(
863
- 'name' => 'image',
864
- 'label' => __( 'Featured Image', 'woo_ce' )
865
- );
866
- $fields[] = array(
867
- 'name' => 'product_gallery',
868
- 'label' => __( 'Product Gallery', 'woo_ce' ),
869
- 'disabled' => 1
870
- );
871
- $fields[] = array(
872
- 'name' => 'tax_status',
873
- 'label' => __( 'Tax Status', 'woo_ce' )
874
- );
875
- $fields[] = array(
876
- 'name' => 'tax_class',
877
- 'label' => __( 'Tax Class', 'woo_ce' )
878
- );
879
- $fields[] = array(
880
- 'name' => 'file_download',
881
- 'label' => __( 'File Download', 'woo_ce' )
882
- );
883
- $fields[] = array(
884
- 'name' => 'download_limit',
885
- 'label' => __( 'Download Limit', 'woo_ce' )
886
- );
887
- $fields[] = array(
888
- 'name' => 'download_expiry',
889
- 'label' => __( 'Download Expiry', 'woo_ce' )
890
- );
891
- $fields[] = array(
892
- 'name' => 'download_type',
893
- 'label' => __( 'Download Type', 'woo_ce' )
894
- );
895
- $fields[] = array(
896
- 'name' => 'manage_stock',
897
- 'label' => __( 'Manage Stock', 'woo_ce' )
898
- );
899
- $fields[] = array(
900
- 'name' => 'quantity',
901
- 'label' => __( 'Quantity', 'woo_ce' )
902
- );
903
- $fields[] = array(
904
- 'name' => 'stock_status',
905
- 'label' => __( 'Stock Status', 'woo_ce' )
906
- );
907
- $fields[] = array(
908
- 'name' => 'allow_backorders',
909
- 'label' => __( 'Allow Backorders', 'woo_ce' )
910
- );
911
- $fields[] = array(
912
- 'name' => 'sold_individually',
913
- 'label' => __( 'Sold Individually', 'woo_ce' )
914
- );
915
- $fields[] = array(
916
- 'name' => 'upsell_ids',
917
- 'label' => __( 'Up-Sells', 'woo_ce' )
918
- );
919
- $fields[] = array(
920
- 'name' => 'crosssell_ids',
921
- 'label' => __( 'Cross-Sells', 'woo_ce' )
922
- );
923
- $fields[] = array(
924
- 'name' => 'product_url',
925
- 'label' => __( 'Product URL', 'woo_ce' )
926
- );
927
- $fields[] = array(
928
- 'name' => 'button_text',
929
- 'label' => __( 'Button Text', 'woo_ce' )
930
- );
931
- $fields[] = array(
932
- 'name' => 'purchase_note',
933
- 'label' => __( 'Purchase Note', 'woo_ce' )
934
- );
935
- $fields[] = array(
936
- 'name' => 'product_status',
937
- 'label' => __( 'Product Status', 'woo_ce' )
938
- );
939
- $fields[] = array(
940
- 'name' => 'enable_reviews',
941
- 'label' => __( 'Enable Reviews', 'woo_ce' )
942
- );
943
- $fields[] = array(
944
- 'name' => 'menu_order',
945
- 'label' => __( 'Sort Order', 'woo_ce' )
946
- );
947
-
948
- /*
949
- $fields[] = array(
950
- 'name' => '',
951
- 'label' => __( '', 'woo_ce' )
952
- );
953
- */
954
-
955
- // Allow Plugin/Theme authors to add support for additional columns
956
- $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
957
-
958
- if( $remember = woo_ce_get_option( $export_type . '_fields', array() ) ) {
959
- $remember = maybe_unserialize( $remember );
960
- $size = count( $fields );
961
- for( $i = 0; $i < $size; $i++ ) {
962
- $fields[$i]['disabled'] = ( isset( $fields[$i]['disabled'] ) ? $fields[$i]['disabled'] : 0 );
963
- $fields[$i]['default'] = 1;
964
- if( !array_key_exists( $fields[$i]['name'], $remember ) )
965
- $fields[$i]['default'] = 0;
966
- }
967
- }
968
-
969
- switch( $format ) {
970
-
971
- case 'summary':
972
- $output = array();
973
- $size = count( $fields );
974
- for( $i = 0; $i < $size; $i++ ) {
975
- if( isset( $fields[$i] ) )
976
- $output[$fields[$i]['name']] = 'on';
977
- }
978
- return $output;
979
- break;
980
-
981
- case 'full':
982
- default:
983
- $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
984
- $size = count( $fields );
985
- for( $i = 0; $i < $size; $i++ )
986
- $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
987
- usort( $fields, woo_ce_sort_fields( 'order' ) );
988
- return $fields;
989
- break;
990
-
991
- }
992
-
993
- }
994
-
995
- function woo_ce_override_product_field_labels( $fields = array() ) {
996
-
997
- $labels = woo_ce_get_option( 'product_labels', array() );
998
- if( !empty( $labels ) ) {
999
- foreach( $fields as $key => $field ) {
1000
- if( isset( $labels[$field['name']] ) )
1001
- $fields[$key]['label'] = $labels[$field['name']];
1002
- }
1003
- }
1004
- return $fields;
1005
-
1006
- }
1007
- add_filter( 'woo_ce_product_fields', 'woo_ce_override_product_field_labels', 11 );
1008
-
1009
- function woo_ce_extend_product_fields( $fields ) {
1010
-
1011
- // Attributes
1012
- if( $attributes = woo_ce_get_product_attributes() ) {
1013
- foreach( $attributes as $attribute ) {
1014
- if( empty( $attribute->attribute_label ) )
1015
- $attribute->attribute_label = $attribute->attribute_name;
1016
- $fields[] = array(
1017
- 'name' => sprintf( 'attribute_%s', $attribute->attribute_name ),
1018
- 'label' => sprintf( __( 'Attribute: %s', 'woo_ce' ), ucwords( $attribute->attribute_label ) )
1019
- );
1020
- }
1021
- }
1022
-
1023
- // Advanced Google Product Feed - http://www.leewillis.co.uk/wordpress-plugins/
1024
- if( function_exists( 'woocommerce_gpf_install' ) ) {
1025
- $fields[] = array(
1026
- 'name' => 'gpf_availability',
1027
- 'label' => __( 'Advanced Google Product Feed - Availability', 'woo_ce' )
1028
- );
1029
- $fields[] = array(
1030
- 'name' => 'gpf_condition',
1031
- 'label' => __( 'Advanced Google Product Feed - Condition', 'woo_ce' )
1032
- );
1033
- $fields[] = array(
1034
- 'name' => 'gpf_brand',
1035
- 'label' => __( 'Advanced Google Product Feed - Brand', 'woo_ce' )
1036
- );
1037
- $fields[] = array(
1038
- 'name' => 'gpf_productype',
1039
- 'label' => __( 'Advanced Google Product Feed - Product Type', 'woo_ce' )
1040
- );
1041
- $fields[] = array(
1042
- 'name' => 'gpf_google_product_category',
1043
- 'label' => __( 'Advanced Google Product Feed - Google Product Category', 'woo_ce' )
1044
- );
1045
- $fields[] = array(
1046
- 'name' => 'gpf_gtin',
1047
- 'label' => __( 'Advanced Google Product Feed - Global Trade Item Number (GTIN)', 'woo_ce' )
1048
- );
1049
- $fields[] = array(
1050
- 'name' => 'gpf_mpn',
1051
- 'label' => __( 'Advanced Google Product Feed - Manufacturer Part Number (MPN)', 'woo_ce' )
1052
- );
1053
- $fields[] = array(
1054
- 'name' => 'gpf_gender',
1055
- 'label' => __( 'Advanced Google Product Feed - Gender', 'woo_ce' )
1056
- );
1057
- $fields[] = array(
1058
- 'name' => 'gpf_agegroup',
1059
- 'label' => __( 'Advanced Google Product Feed - Age Group', 'woo_ce' )
1060
- );
1061
- $fields[] = array(
1062
- 'name' => 'gpf_colour',
1063
- 'label' => __( 'Advanced Google Product Feed - Colour', 'woo_ce' )
1064
- );
1065
- $fields[] = array(
1066
- 'name' => 'gpf_size',
1067
- 'label' => __( 'Advanced Google Product Feed - Size', 'woo_ce' )
1068
- );
1069
- }
1070
-
1071
- // All in One SEO Pack - http://wordpress.org/extend/plugins/all-in-one-seo-pack/
1072
- if( function_exists( 'aioseop_activate' ) ) {
1073
- $fields[] = array(
1074
- 'name' => 'aioseop_keywords',
1075
- 'label' => __( 'All in One SEO - Keywords', 'woo_ce' )
1076
- );
1077
- $fields[] = array(
1078
- 'name' => 'aioseop_description',
1079
- 'label' => __( 'All in One SEO - Description', 'woo_ce' )
1080
- );
1081
- $fields[] = array(
1082
- 'name' => 'aioseop_title',
1083
- 'label' => __( 'All in One SEO - Title', 'woo_ce' )
1084
- );
1085
- $fields[] = array(
1086
- 'name' => 'aioseop_title_attributes',
1087
- 'label' => __( 'All in One SEO - Title Attributes', 'woo_ce' )
1088
- );
1089
- $fields[] = array(
1090
- 'name' => 'aioseop_menu_label',
1091
- 'label' => __( 'All in One SEO - Menu Label', 'woo_ce' )
1092
- );
1093
- }
1094
-
1095
- // WordPress SEO - http://wordpress.org/plugins/wordpress-seo/
1096
- if( function_exists( 'wpseo_admin_init' ) ) {
1097
- $fields[] = array(
1098
- 'name' => 'wpseo_focuskw',
1099
- 'label' => __( 'WordPress SEO - Focus Keyword', 'woo_ce' )
1100
- );
1101
- $fields[] = array(
1102
- 'name' => 'wpseo_metadesc',
1103
- 'label' => __( 'WordPress SEO - Meta Description', 'woo_ce' )
1104
- );
1105
- $fields[] = array(
1106
- 'name' => 'wpseo_title',
1107
- 'label' => __( 'WordPress SEO - SEO Title', 'woo_ce' )
1108
- );
1109
- $fields[] = array(
1110
- 'name' => 'wpseo_googleplus_description',
1111
- 'label' => __( 'WordPress SEO - Google+ Description', 'woo_ce' )
1112
- );
1113
- $fields[] = array(
1114
- 'name' => 'wpseo_opengraph_description',
1115
- 'label' => __( 'WordPress SEO - Facebook Description', 'woo_ce' )
1116
- );
1117
- }
1118
-
1119
- // Ultimate SEO - http://wordpress.org/plugins/seo-ultimate/
1120
- if( function_exists( 'su_wp_incompat_notice' ) ) {
1121
- $fields[] = array(
1122
- 'name' => 'useo_meta_title',
1123
- 'label' => __( 'Ultimate SEO - Title Tag', 'woo_ce' )
1124
- );
1125
- $fields[] = array(
1126
- 'name' => 'useo_meta_description',
1127
- 'label' => __( 'Ultimate SEO - Meta Description', 'woo_ce' )
1128
- );
1129
- $fields[] = array(
1130
- 'name' => 'useo_meta_keywords',
1131
- 'label' => __( 'Ultimate SEO - Meta Keywords', 'woo_ce' )
1132
- );
1133
- $fields[] = array(
1134
- 'name' => 'useo_social_title',
1135
- 'label' => __( 'Ultimate SEO - Social Title', 'woo_ce' )
1136
- );
1137
- $fields[] = array(
1138
- 'name' => 'useo_social_description',
1139
- 'label' => __( 'Ultimate SEO - Social Description', 'woo_ce' )
1140
- );
1141
- $fields[] = array(
1142
- 'name' => 'useo_meta_noindex',
1143
- 'label' => __( 'Ultimate SEO - NoIndex', 'woo_ce' )
1144
- );
1145
- $fields[] = array(
1146
- 'name' => 'useo_meta_noautolinks',
1147
- 'label' => __( 'Ultimate SEO - Disable Autolinks', 'woo_ce' )
1148
- );
1149
- }
1150
-
1151
- // WooCommerce MSRP Pricing - http://woothemes.com/woocommerce/
1152
- if( function_exists( 'woocommerce_msrp_activate' ) ) {
1153
- $fields[] = array(
1154
- 'name' => 'msrp',
1155
- 'label' => __( 'Manufacturer Suggested Retail Price (MSRP)', 'woo_ce' ),
1156
- 'disabled' => 1
1157
- );
1158
- }
1159
-
1160
- // WooCommerce Brands Addon - http://woothemes.com/woocommerce/
1161
- if( class_exists( 'WC_Brands' ) ) {
1162
- $fields[] = array(
1163
- 'name' => 'brands',
1164
- 'label' => __( 'Brands', 'woo_ce' ),
1165
- 'disabled' => 1
1166
- );
1167
- }
1168
-
1169
- // Cost of Goods - http://www.skyverge.com/product/woocommerce-cost-of-goods-tracking/
1170
- if( class_exists( 'WC_COG' ) ) {
1171
- $fields[] = array(
1172
- 'name' => 'cost_of_goods',
1173
- 'label' => __( 'Cost of Goods', 'woo_ce' ),
1174
- 'disabled' => 1
1175
- );
1176
- }
1177
-
1178
- // Per-Product Shipping - http://www.woothemes.com/products/per-product-shipping/
1179
- if( function_exists( 'woocommerce_per_product_shipping_init' ) ) {
1180
- $fields[] = array(
1181
- 'name' => 'per_product_shipping',
1182
- 'label' => __( 'Per-Product Shipping', 'woo_ce' ),
1183
- 'disabled' => 1
1184
- );
1185
- }
1186
-
1187
- // Product Vendors - http://www.woothemes.com/products/product-vendors/
1188
- if( class_exists( 'WooCommerce_Product_Vendors' ) ) {
1189
- $fields[] = array(
1190
- 'name' => 'vendors',
1191
- 'label' => __( 'Product Vendors', 'woo_ce' ),
1192
- 'disabled' => 1
1193
- );
1194
- $fields[] = array(
1195
- 'name' => 'vendor_ids',
1196
- 'label' => __( 'Product Vendor ID\'s', 'woo_ce' ),
1197
- 'disabled' => 1
1198
- );
1199
- $fields[] = array(
1200
- 'name' => 'vendor_commission',
1201
- 'label' => __( 'Vendor Commission', 'woo_ce' ),
1202
- 'disabled' => 1
1203
- );
1204
- }
1205
-
1206
- // Advanced Custom Fields - http://www.advancedcustomfields.com
1207
- if( class_exists( 'acf' ) ) {
1208
- if( $custom_fields = woo_ce_get_acf_product_fields() ) {
1209
- foreach( $custom_fields as $custom_field ) {
1210
- $fields[] = array(
1211
- 'name' => $custom_field['name'],
1212
- 'label' => $custom_field['label'],
1213
- 'disabled' => 1
1214
- );
1215
- }
1216
- unset( $custom_fields, $custom_field );
1217
- }
1218
- }
1219
-
1220
- // Custom Product meta
1221
- $custom_products = woo_ce_get_option( 'custom_products', '' );
1222
- if( !empty( $custom_products ) ) {
1223
- foreach( $custom_products as $custom_product ) {
1224
- if( !empty( $custom_product ) ) {
1225
- $fields[] = array(
1226
- 'name' => $custom_product,
1227
- 'label' => $custom_product
1228
- );
1229
- }
1230
- }
1231
- unset( $custom_products, $custom_product );
1232
- }
1233
-
1234
- return $fields;
1235
-
1236
- }
1237
- add_filter( 'woo_ce_product_fields', 'woo_ce_extend_product_fields' );
1238
-
1239
- // Returns the export column header label based on an export column slug
1240
- function woo_ce_get_product_field( $name = null, $format = 'name' ) {
1241
-
1242
- $output = '';
1243
- if( $name ) {
1244
- $fields = woo_ce_get_product_fields();
1245
- $size = count( $fields );
1246
- for( $i = 0; $i < $size; $i++ ) {
1247
- if( $fields[$i]['name'] == $name ) {
1248
- switch( $format ) {
1249
-
1250
- case 'name':
1251
- $output = $fields[$i]['label'];
1252
- break;
1253
-
1254
- case 'full':
1255
- $output = $fields[$i];
1256
- break;
1257
-
1258
- }
1259
- $i = $size;
1260
- }
1261
- }
1262
- }
1263
- return $output;
1264
-
1265
- }
1266
-
1267
- // Returns a list of WooCommerce Product Types to export process
1268
- function woo_ce_get_product_types() {
1269
-
1270
- $term_taxonomy = 'product_type';
1271
- $args = array(
1272
- 'hide_empty' => 0
1273
- );
1274
- $types = get_terms( $term_taxonomy, $args );
1275
- if( !empty( $types ) && is_wp_error( $types ) == false ) {
1276
- $size = count( $types );
1277
- for( $i = 0; $i < $size; $i++ ) {
1278
- $output[$types[$i]->slug] = array(
1279
- 'name' => $types[$i]->name,
1280
- 'count' => $types[$i]->count
1281
- );
1282
- }
1283
- $output['variation'] = array(
1284
- 'name' => __( 'variation', 'woo_ce' ),
1285
- 'count' => woo_ce_get_product_type_variation_count()
1286
- );
1287
- asort( $output );
1288
- return $output;
1289
- }
1290
-
1291
- }
1292
-
1293
- function woo_ce_get_product_type_variation_count() {
1294
-
1295
- $post_type = 'product_variation';
1296
- $args = array(
1297
- 'post_type' => $post_type,
1298
- 'posts_per_page' => 1
1299
- );
1300
- $query = new WP_Query( $args );
1301
- $size = $query->found_posts;
1302
- return $size;
1303
-
1304
- }
1305
-
1306
- // Returns a list of WooCommerce Product Attributes to export process
1307
- function woo_ce_get_product_attributes() {
1308
-
1309
- global $wpdb;
1310
-
1311
- $output = array();
1312
- $attributes_sql = "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies";
1313
- $attributes = $wpdb->get_results( $attributes_sql );
1314
- $wpdb->flush();
1315
- if( !empty( $attributes ) )
1316
- $output = $attributes;
1317
- unset( $attributes );
1318
- return $output;
1319
-
1320
- }
1321
-
1322
- function woo_ce_get_acf_product_fields() {
1323
-
1324
- global $wpdb;
1325
-
1326
- $post_type = 'acf';
1327
- $args = array(
1328
- 'post_type' => $post_type,
1329
- 'numberposts' => -1
1330
- );
1331
- if( $field_groups = get_posts( $args ) ) {
1332
- $fields = array();
1333
- $post_types = array( 'product', 'product_variation' );
1334
- foreach( $field_groups as $field_group ) {
1335
- $has_fields = false;
1336
- if( $rules = get_post_meta( $field_group->ID, 'rule' ) ) {
1337
- $size = count( $rules );
1338
- for( $i = 0; $i < $size; $i++ ) {
1339
- if( ( $rules[$i]['param'] == 'post_type' ) && ( $rules[$i]['operator'] == '==' ) && ( in_array( $rules[$i]['value'], $post_types ) ) ) {
1340
- $has_fields = true;
1341
- $i = $size;
1342
- }
1343
- }
1344
- }
1345
- unset( $rules );
1346
- if( $has_fields ) {
1347
- $custom_fields_sql = "SELECT `meta_value` FROM `" . $wpdb->postmeta . "` WHERE `post_id` = " . (int)$field_group->ID . " AND `meta_key` LIKE 'field_%'";
1348
- if( $custom_fields = $wpdb->get_col( $custom_fields_sql ) ) {
1349
- foreach( $custom_fields as $custom_field ) {
1350
- $custom_field = maybe_unserialize( $custom_field );
1351
- $fields[] = array(
1352
- 'name' => $custom_field['name'],
1353
- 'label' => $custom_field['label']
1354
- );
1355
- }
1356
- }
1357
- unset( $custom_fields, $custom_field );
1358
- }
1359
- }
1360
- return $fields;
1361
- }
1362
-
1363
- }
1364
-
1365
- function woo_ce_extend_product_item( $product, $product_id ) {
1366
-
1367
- $custom_products = woo_ce_get_option( 'custom_products', '' );
1368
- if( !empty( $custom_products ) ) {
1369
- foreach( $custom_products as $custom_product ) {
1370
- // Check that the custom Product name is filled and it hasn't previously been set
1371
- if( !empty( $custom_product ) && !isset( $product->{$custom_product} ) )
1372
- $product->{$custom_product} = get_post_meta( $product->ID, $custom_product, true );
1373
- }
1374
- }
1375
-
1376
- return $product;
1377
-
1378
- }
1379
- add_filter( 'woo_ce_product_item', 'woo_ce_extend_product_item', 10, 2 );
1380
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/settings.php CHANGED
@@ -2,277 +2,587 @@
2
  function woo_ce_export_settings_quicklinks() {
3
 
4
  ob_start(); ?>
5
- <li>| <a href="#xml-settings"><?php _e( 'XML Settings', 'woo_ce' ); ?></a> |</li>
6
- <li><a href="#scheduled-exports"><?php _e( 'Scheduled Exports', 'woo_ce' ); ?></a> |</li>
7
- <li><a href="#cron-exports"><?php _e( 'CRON Exports', 'woo_ce' ); ?></a></li>
 
 
8
  <?php
9
  ob_end_flush();
10
 
11
  }
12
 
13
- function woo_ce_export_settings_additional() {
14
 
15
- $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
16
- $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woo_ce' ) . '</a>', $woo_cd_url );
17
 
18
- $email_to = '-';
19
- $email_subject = __( '[%store_name%] Export: %export_type% (%export_filename%)', 'woo_ce' );
20
- $post_to = '-';
21
  ob_start(); ?>
22
  <tr>
23
  <th>
24
- <label for="email_to"><?php _e( 'Default e-mail recipient', 'woo_ce' ); ?></label>
25
  </th>
26
  <td>
27
- <input name="email_to" type="text" id="email_to" value="<?php echo esc_attr( $email_to ); ?>" class="regular-text code" disabled="disabled" /><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
28
- <p class="description"><?php _e( 'Set the default recipient of scheduled export e-mails, can be overriden via CRON using the <code>to</code> argument. Default is the WordPress Blog administrator e-mail address.', 'woo_ce' ); ?></p>
29
- </td>
30
- </tr>
31
- <tr>
32
- <th>
33
- <label for="email_to"><?php _e( 'Default e-mail subject', 'woo_ce' ); ?></label>
34
- </th>
35
- <td>
36
- <input name="email_to" type="text" id="email_subject" value="<?php echo esc_attr( $email_subject ); ?>" class="large-text code" disabled="disabled" /><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
37
- <p class="description"><?php _e( 'Set the default subject of scheduled export e-mails, can be overriden via CRON using the <code>subject</code> argument. Tags can be used: <code>%store_name%</code>, <code>%export_type%</code>, <code>%export_filename%</code>.', 'woo_ce' ); ?></p>
38
- </td>
39
- </tr>
40
- <tr>
41
- <th>
42
- <label for="post_to"><?php _e( 'Default remote POST URL', 'woo_ce' ); ?></label>
43
- </th>
44
- <td>
45
- <input name="post_to" type="text" id="post_to" value="<?php echo esc_url( $post_to ); ?>" class="full-text code" disabled="disabled" /><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
46
- <p class="description"><?php _e( 'Set the default remote POST address for scheduled exports, can be overriden via CRON using the <code>to</code> argument. Default is empty.', 'woo_ce' ); ?></p>
47
  </td>
48
  </tr>
49
  <?php
50
  ob_end_flush();
51
-
52
  }
53
 
54
  // Returns the disabled HTML template for the Enable CRON and Secret Export Key options for the Settings screen
55
- function woo_ce_export_settings_cron() {
56
 
57
- $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
58
- $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woo_ce' ) . '</a>', $woo_cd_url );
 
 
 
 
 
59
 
60
  // Scheduled exports
61
- $export_types = woo_ce_return_export_types();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  $order_statuses = woo_ce_get_order_statuses();
63
  $product_types = woo_ce_get_product_types();
 
 
 
 
 
 
64
  $auto_interval = 1440;
65
  $auto_format = 'csv';
 
 
 
 
 
 
 
 
 
 
66
  $ftp_method_host = 'ftp.domain.com';
 
 
67
  $ftp_method_user = 'export';
68
  $ftp_method_pass = '';
69
- $ftp_method_port = '';
70
  $ftp_method_path = 'wp-content/uploads/export/';
 
71
  $ftp_method_passive = 'auto';
72
  $ftp_method_timeout = '';
73
 
 
 
74
  // CRON exports
75
  $secret_key = '-';
 
 
 
 
 
 
 
 
 
76
 
77
  $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/';
 
78
  ob_start(); ?>
79
  <tr id="xml-settings">
80
  <td colspan="2" style="padding:0;">
81
  <hr />
82
- <h3><?php _e( 'XML Settings', 'woo_ce' ); ?></h3>
83
  </td>
84
  </tr>
85
  <tr>
86
  <th>
87
- <label><?php _e( 'Attribute display', 'woo_ce' ); ?></label>
88
  </th>
89
  <td>
90
  <ul>
91
- <li><label><input type="checkbox" name="xml_attribute_url" value="1" disabled="disabled" /> <?php _e( 'Site Address', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></li>
92
- <li><label><input type="checkbox" name="xml_attribute_title" value="1" disabled="disabled" /> <?php _e( 'Site Title', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></li>
93
- <li><label><input type="checkbox" name="xml_attribute_date" value="1" disabled="disabled" /> <?php _e( 'Export Date', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></li>
94
- <li><label><input type="checkbox" name="xml_attribute_time" value="1" disabled="disabled" /> <?php _e( 'Export Time', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></li>
95
- <li><label><input type="checkbox" name="xml_attribute_export" value="1" disabled="disabled" /> <?php _e( 'Export Type', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></li>
96
- <li><label><input type="checkbox" name="xml_attribute_orderby" value="1" disabled="disabled" /> <?php _e( 'Export Order By', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></li>
97
- <li><label><input type="checkbox" name="xml_attribute_order" value="1" disabled="disabled" /> <?php _e( 'Export Order', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></li>
98
- <li><label><input type="checkbox" name="xml_attribute_limit" value="1" disabled="disabled" /> <?php _e( 'Limit Volume', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></li>
99
- <li><label><input type="checkbox" name="xml_attribute_offset" value="1" disabled="disabled" /> <?php _e( 'Volume Offset', 'woo_ce' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></li>
100
  </ul>
101
- <p class="description"><?php _e( 'Control the visibility of different attributes in the XML export.', 'woo_ce' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  </td>
103
  </tr>
104
 
105
  <tr id="scheduled-exports">
106
  <td colspan="2" style="padding:0;">
107
  <hr />
108
- <h3><div class="dashicons dashicons-calendar"></div>&nbsp;<?php _e( 'Scheduled Exports', 'woo_ce' ); ?></h3>
109
- <p class="description"><?php _e( 'Configure Store Exporter Deluxe to automatically generate exports.', 'woo_ce' ); ?></p>
 
 
110
  </td>
111
  </tr>
112
  <tr>
113
  <th>
114
- <label for="enable_auto"><?php _e( 'Enable scheduled exports', 'woo_ce' ); ?></label>
115
  </th>
116
  <td>
117
  <select id="enable_auto" name="enable_auto">
118
- <option value="1" disabled="disabled"><?php _e( 'Yes', 'woo_ce' ); ?></option>
119
- <option value="0" selected="selected"><?php _e( 'No', 'woo_ce' ); ?></option>
120
  </select>
121
- <p class="description"><?php _e( 'Enabling Scheduled Exports will trigger automated exports at the interval specified under Once every (minutes).', 'woo_ce' ); ?></p>
122
  </td>
123
  </tr>
124
  <tr>
125
  <th>
126
- <label for="auto_type"><?php _e( 'Export type', 'woo_ce' ); ?></label>
127
  </th>
128
  <td>
129
  <select id="auto_type" name="auto_type">
130
- <?php if( $export_types ) { ?>
131
- <?php foreach( $export_types as $key => $export_type ) { ?>
132
- <option value="<?php echo $key; ?>"><?php echo $export_type; ?></option>
133
  <?php } ?>
134
  <?php } else { ?>
135
- <option value=""><?php _e( 'No export types were found.', 'woo_ce' ); ?></option>
136
  <?php } ?>
137
  </select>
138
- <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
139
- <p class="description"><?php _e( 'Select the data type you want to export.', 'woo_ce' ); ?></p>
140
  </td>
141
  </tr>
142
  <tr class="auto_type_options">
143
  <th>
144
- <label><?php _e( 'Export filters', 'woo_ce' ); ?></label>
145
  </th>
146
  <td>
147
  <ul>
 
148
  <li class="export-options product-options">
149
- <label><?php _e( 'Product Type', 'woo_ce' ); ?></label>
150
- <?php if( $product_types ) { ?>
151
- <ul style="margin-top:0.2em;">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  <?php foreach( $product_types as $key => $product_type ) { ?>
153
- <li><label><input type="checkbox" name="product_filter_type[<?php echo $key; ?>]" value="<?php echo $key; ?>" disabled="disabled" /> <?php echo woo_ce_format_product_type( $product_type['name'] ); ?> (<?php echo $product_type['count']; ?>)<span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label></li>
154
  <?php } ?>
155
- </ul>
 
 
156
  <?php } ?>
157
- <p class="description"><?php _e( 'Select the Product Type\'s you want to filter exported Products by. Default is to include all Product Types and Variations.', 'woo_ce' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
158
  </li>
159
- <li class="export-options category-options tag-options brand-options customer-options user-options coupon-options subscription-options product_vendor-options">
160
- <p><?php _e( 'No export filter options are available for this export type.', 'woo_ce' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  </li>
 
162
  <li class="export-options order-options">
163
- <label><?php _e( 'Order Status', 'woo_ce' ); ?></label>
164
- <select name="order_filter_status">
165
- <option value="" selected="selected"><?php _e( 'All', 'woo_ce' ); ?></option>
166
- <?php if( $order_statuses ) { ?>
167
  <?php foreach( $order_statuses as $order_status ) { ?>
168
  <option value="<?php echo $order_status->name; ?>" disabled="disabled"><?php echo ucfirst( $order_status->name ); ?></option>
169
  <?php } ?>
170
  <?php } ?>
171
  </select>
172
- <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
173
- <p class="description"><?php _e( 'Select the Order Status you want to filter exported Orders by. Default is to include all Order Status options.', 'woo_ce' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
174
  </li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  <li class="export-options order-options">
176
- <label><?php _e( 'Order Date', 'woo_ce' ); ?></label>
177
- <input type="text" size="10" maxlength="10" class="text" disabled="disabled"> to <input type="text" size="10" maxlength="10" class="text" disabled="disabled"><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
178
- <p class="description"><?php _e( 'Filter the dates of Orders to be included in the export. Default is empty.', 'woo_ce' ); ?></p>
 
 
 
 
 
 
179
  </li>
 
180
  </ul>
181
  </td>
182
  </tr>
 
183
  <tr>
184
  <th>
185
- <label for="auto_interval"><?php _e( 'Once every (minutes)', 'woo_ce' ); ?></label>
186
  </th>
187
  <td>
188
- <input name="auto_interval" type="text" id="auto_interval" value="<?php echo esc_attr( $auto_interval ); ?>" size="4" maxlength="4" class="text" disabled="disabled" /><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
189
- <p class="description"><?php _e( 'Choose how often Store Exporter Deluxe generates new exports. Default is every 1440 minutes (once every 24 hours).', 'woo_ce' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  </td>
191
  </tr>
 
192
  <tr>
193
  <th>
194
- <label><?php _e( 'Export format', 'woo_ce' ); ?></label>
195
  </th>
196
  <td>
197
- <label><input type="radio" name="auto_format" value="csv"<?php checked( $auto_format, 'csv' ); ?> disabled="disabled" /> <?php _e( 'CSV', 'woo_ce' ); ?> <span class="description"><?php _e( '(Comma separated values)', 'woo_ce' ); ?></span><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label><br />
198
- <label><input type="radio" name="auto_format" value="xml"<?php checked( $auto_format, 'xml' ); ?> disabled="disabled" /> <?php _e( 'XML', 'woo_ce' ); ?> <span class="description"><?php _e( '(EXtensible Markup Language)', 'woo_ce' ); ?></span><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label><br />
199
- <label><input type="radio" name="auto_format" value="xls"<?php checked( $auto_format, 'xls' ); ?> disabled="disabled" /> <?php _e( 'Excel (XLS)', 'woo_ce' ); ?> <span class="description"><?php _e( '(Microsoft Excel 2007)', 'woo_ce' ); ?></span><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span></label>
200
- <p class="description"><?php _e( 'Adjust the export format to generate different export file formats. Default is CSV.', 'woo_ce' ); ?></p>
 
 
 
201
  </td>
202
  </tr>
203
  <tr>
204
  <th>
205
- <label for="auto_method"><?php _e( 'Export method', 'woo_ce' ); ?></label>
206
  </th>
207
  <td>
208
  <select id="auto_method" name="auto_method">
209
- <option value="archive"><?php _e( 'Archive to WordPress Media', 'woo_ce' ); ?></option>
210
- <option value="email"><?php _e( 'Send as e-mail', 'woo_ce' ); ?></option>
211
- <option value="post"><?php _e( 'POST to remote URL', 'woo_ce' ); ?></option>
212
- <option value="ftp"><?php _e( 'Upload to remote FTP', 'woo_ce' ); ?></option>
213
  </select>
214
- <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
215
- <p class="description"><?php _e( 'Choose what Store Exporter Deluxe does with the generated export. Default is to archive the export to the WordPress Media for archival purposes.', 'woo_ce' ); ?></p>
216
  </td>
217
  </tr>
218
  <tr class="auto_method_options">
219
  <th>
220
- <label><?php _e( 'Export method options', 'woo_ce' ); ?></label>
221
  </th>
222
  <td>
223
  <ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  <li class="export-options ftp-options">
225
- <label for="ftp_method_host"><?php _e( 'Host', 'woo_ce' ); ?>:</label> <input type="text" id="ftp_method_host" name="ftp_method_host" size="15" class="regular-text code" value="<?php echo sanitize_text_field( $ftp_method_host ); ?>" disabled="disabled" /><br />
226
- <label for="ftp_method_user"><?php _e( 'Username', 'woo_ce' ); ?>:</label> <input type="text" id="ftp_method_user" name="ftp_method_user" size="15" class="regular-text code" value="<?php echo sanitize_text_field( $ftp_method_user ); ?>" disabled="disabled" /><br />
227
- <label for="ftp_method_pass"><?php _e( 'Password', 'woo_ce' ); ?>:</label> <input type="password" id="ftp_method_pass" name="ftp_method_pass" size="15" class="regular-text code" value="" disabled="disabled" /><?php if( !empty( $ftp_method_pass ) ) { echo ' ' . __( '(password is saved)', 'woo_ce' ); } ?><br />
228
- <label for="ftp_method_port"><?php _e( 'Port', 'woo_ce' ); ?>:</label> <input type="text" id="ftp_method_port" name="ftp_method_port" size="5" class="short-text code" value="<?php echo sanitize_text_field( $ftp_method_port ); ?>" maxlength="5" disabled="disabled" /><br />
229
- <label for="ftp_method_file_path"><?php _e( 'File path', 'woo_ce' ); ?>:</label> <input type="text" id="ftp_method_file_path" name="ftp_method_path" size="25" class="regular-text code" value="<?php echo sanitize_text_field( $ftp_method_path ); ?>" disabled="disabled" /><br />
230
- <label for="ftp_method_passive"><?php _e( 'Transfer mode', 'woo_ce' ); ?>:</label>
 
 
 
 
 
 
231
  <select id="ftp_method_passive" name="ftp_method_passive">
232
- <option value="auto" selected="selected"><?php _e( 'Auto', 'woo_ce' ); ?></option>
233
- <option value="active" disabled="disabled"><?php _e( 'Active', 'woo_ce' ); ?></option>
234
- <option value="passive" disabled="disabled"><?php _e( 'Passive', 'woo_ce' ); ?></option>
235
  </select><br />
236
- <label for="ftp_method_timeout"><?php _e( 'Timeout', 'woo_ce' ); ?>:</label> <input type="text" id="ftp_method_timeout" name="ftp_method_timeout" size="5" class="short-text code" value="<?php echo sanitize_text_field( $ftp_method_timeout ); ?>" /><br />
237
- <p class="description"><?php _e( 'Enter the FTP host, login details and path of where to save the export file, do not provide the filename, the export filename can be set on General Settings above. For file path example: <code>wp-content/uploads/exports/</code>', 'woo_ce' ); ?></p>
238
  </li>
239
- <li class="export-options archive-options email-options post-options">
240
- <p><?php _e( 'No export method options are available for this export method.', 'woo_ce' ); ?></p>
 
241
  </li>
 
 
 
 
 
 
 
 
 
 
 
 
242
  </ul>
 
243
  </td>
244
  </tr>
245
 
246
  <tr id="cron-exports">
247
  <td colspan="2" style="padding:0;">
248
  <hr />
249
- <h3><div class="dashicons dashicons-clock"></div>&nbsp;<?php _e( 'CRON Exports', 'woo_ce' ); ?></h3>
250
- <p class="description"><?php printf( __( 'Store Exporter Deluxe supports exporting via a command line request. For sample CRON requests and supported arguments consult our <a href="%s" target="_blank">online documentation</a>.', 'woo_ce' ), $troubleshooting_url ); ?></p>
251
  </td>
252
  </tr>
253
  <tr>
254
  <th>
255
- <label for="enable_cron"><?php _e( 'Enable CRON', 'woo_ce' ); ?></label>
256
  </th>
257
  <td>
258
  <select id="enable_cron" name="enable_cron">
259
- <option value="1" disabled="disabled"><?php _e( 'Yes', 'woo_ce' ); ?></option>
260
- <option value="0" selected="selected"><?php _e( 'No', 'woo_ce' ); ?></option>
261
  </select>
262
- <p class="description"><?php _e( 'Enabling CRON allows developers to schedule automated exports and connect with Store Exporter Deluxe remotely.', 'woo_ce' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  </td>
264
  </tr>
265
  <tr>
266
  <th>
267
- <label for="secret_key"><?php _e( 'Export secret key', 'woo_ce' ); ?></label>
268
  </th>
269
  <td>
270
- <input name="secret_key" type="text" id="secret_key" value="<?php echo esc_attr( $secret_key ); ?>" class="large-text code" disabled="disabled" /><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
271
- <p class="description"><?php _e( 'This secret key (can be left empty to allow unrestricted access) limits access to authorised developers who provide a matching key when working with Store Exporter Deluxe.', 'woo_ce' ); ?></p>
 
 
 
 
 
272
  </td>
273
  </tr>
274
  <?php
275
  ob_end_flush();
276
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  }
278
  ?>
2
  function woo_ce_export_settings_quicklinks() {
3
 
4
  ob_start(); ?>
5
+ <li>| <a href="#xml-settings"><?php _e( 'XML Settings', 'woocommerce-exporter' ); ?></a> |</li>
6
+ <li><a href="#rss-settings"><?php _e( 'RSS Settings', 'woocommerce-exporter' ); ?></a> |</li>
7
+ <li><a href="#scheduled-exports"><?php _e( 'Scheduled Exports', 'woocommerce-exporter' ); ?></a> |</li>
8
+ <li><a href="#cron-exports"><?php _e( 'CRON Exports', 'woocommerce-exporter' ); ?></a> |</li>
9
+ <li><a href="#orders-screen"><?php _e( 'Orders Screen', 'woocommerce-exporter' ); ?></a></li>
10
  <?php
11
  ob_end_flush();
12
 
13
  }
14
 
15
+ function woo_ce_export_settings_csv() {
16
 
17
+ $woo_cd_url = 'https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc';
18
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
19
 
 
 
 
20
  ob_start(); ?>
21
  <tr>
22
  <th>
23
+ <label for="header_formatting"><?php _e( 'Header formatting', 'woocommerce-exporter' ); ?></label>
24
  </th>
25
  <td>
26
+ <ul style="margin-top:0.2em;">
27
+ <li><label><input type="radio" name="header_formatting" value="1"<?php checked( 1, 1 ); ?> />&nbsp;<?php _e( 'Include export field column headers', 'woocommerce-exporter' ); ?></label></li>
28
+ <li><label><input type="radio" name="header_formatting" value="0" disabled="disabled" />&nbsp;<?php _e( 'Do not include export field column headers', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
29
+ </ul>
30
+ <p class="description"><?php _e( 'Choose the header format that suits your spreadsheet software (e.g. Excel, OpenOffice, etc.). This rule applies to CSV, XLS and XLSX export types.', 'woocommerce-exporter' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  </td>
32
  </tr>
33
  <?php
34
  ob_end_flush();
35
+
36
  }
37
 
38
  // Returns the disabled HTML template for the Enable CRON and Secret Export Key options for the Settings screen
39
+ function woo_ce_export_settings_extend() {
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
+ // RSS settings
45
+ $rss_title = __( 'Title of your RSS feed', 'woocommerce-exporter' );
46
+ $rss_link = __( 'URL to your RSS feed', 'woocommerce-exporter' );
47
+ $rss_description = __( 'Summary description of your RSS feed', 'woocommerce-exporter' );
48
 
49
  // Scheduled exports
50
+ $auto_commence_date = date( 'd/m/Y H:i', current_time( 'timestamp', 1 ) );
51
+ // Override to enable the Export Type to include all export types
52
+ $types = array(
53
+ 'product' => __( 'Products', 'woocommerce-exporter' ),
54
+ 'category' => __( 'Categories', 'woocommerce-exporter' ),
55
+ 'tag' => __( 'Tags', 'woocommerce-exporter' ),
56
+ 'brand' => __( 'Brands', 'woocommerce-exporter' ),
57
+ 'order' => __( 'Orders', 'woocommerce-exporter' ),
58
+ 'customer' => __( 'Customers', 'woocommerce-exporter' ),
59
+ 'user' => __( 'Users', 'woocommerce-exporter' ),
60
+ 'coupon' => __( 'Coupons', 'woocommerce-exporter' ),
61
+ 'subscription' => __( 'Subscriptions', 'woocommerce-exporter' ),
62
+ 'product_vendor' => __( 'Product Vendors', 'woocommerce-exporter' ),
63
+ 'shipping_class' => __( 'Shipping Classes', 'woocommerce-exporter' )
64
+ );
65
  $order_statuses = woo_ce_get_order_statuses();
66
  $product_types = woo_ce_get_product_types();
67
+ $args = array(
68
+ 'hide_empty' => 1
69
+ );
70
+ $product_categories = woo_ce_get_product_categories( $args );
71
+ $product_tags = woo_ce_get_product_tags( $args );
72
+
73
  $auto_interval = 1440;
74
  $auto_format = 'csv';
75
+ $order_filter_date_variable = '';
76
+
77
+ // Send to e-mail
78
+ $email_to = get_option( 'admin_email', '' );
79
+ $email_subject = __( '[%store_name%] Export: %export_type% (%export_filename%)', 'woocommerce-exporter' );
80
+
81
+ // Post to remote URL
82
+ $post_to = 'http://www.domain.com/custom-post-form-processor.php';
83
+
84
+ // Export to FTP
85
  $ftp_method_host = 'ftp.domain.com';
86
+ $ftp_method_port = '';
87
+ $ftp_method_protocol = 'ftp';
88
  $ftp_method_user = 'export';
89
  $ftp_method_pass = '';
 
90
  $ftp_method_path = 'wp-content/uploads/export/';
91
+ $ftp_method_filename = 'fixed-filename';
92
  $ftp_method_passive = 'auto';
93
  $ftp_method_timeout = '';
94
 
95
+ $scheduled_fields = 'all';
96
+
97
  // CRON exports
98
  $secret_key = '-';
99
+ $cron_fields = 'all';
100
+
101
+ $cron_fields = 'all';
102
+
103
+ // Orders Screen
104
+ $order_actions_csv = 1;
105
+ $order_actions_xml = 0;
106
+ $order_actions_xls = 1;
107
+ $order_actions_xlsx = 1;
108
 
109
  $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/';
110
+
111
  ob_start(); ?>
112
  <tr id="xml-settings">
113
  <td colspan="2" style="padding:0;">
114
  <hr />
115
+ <h3><div class="dashicons dashicons-media-code"></div>&nbsp;<?php _e( 'XML Settings', 'woocommerce-exporter' ); ?></h3>
116
  </td>
117
  </tr>
118
  <tr>
119
  <th>
120
+ <label><?php _e( 'Attribute display', 'woocommerce-exporter' ); ?></label>
121
  </th>
122
  <td>
123
  <ul>
124
+ <li><label><input type="checkbox" name="xml_attribute_url" value="1" disabled="disabled" /> <?php _e( 'Site Address', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
125
+ <li><label><input type="checkbox" name="xml_attribute_title" value="1" disabled="disabled" /> <?php _e( 'Site Title', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
126
+ <li><label><input type="checkbox" name="xml_attribute_date" value="1" disabled="disabled" /> <?php _e( 'Export Date', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
127
+ <li><label><input type="checkbox" name="xml_attribute_time" value="1" disabled="disabled" /> <?php _e( 'Export Time', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
128
+ <li><label><input type="checkbox" name="xml_attribute_export" value="1" disabled="disabled" /> <?php _e( 'Export Type', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
129
+ <li><label><input type="checkbox" name="xml_attribute_orderby" value="1" disabled="disabled" /> <?php _e( 'Export Order By', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
130
+ <li><label><input type="checkbox" name="xml_attribute_order" value="1" disabled="disabled" /> <?php _e( 'Export Order', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
131
+ <li><label><input type="checkbox" name="xml_attribute_limit" value="1" disabled="disabled" /> <?php _e( 'Limit Volume', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
132
+ <li><label><input type="checkbox" name="xml_attribute_offset" value="1" disabled="disabled" /> <?php _e( 'Volume Offset', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
133
  </ul>
134
+ <p class="description"><?php _e( 'Control the visibility of different attributes in the XML export.', 'woocommerce-exporter' ); ?></p>
135
+ </td>
136
+ </tr>
137
+ <!-- #xml-settings -->
138
+
139
+ <tr id="rss-settings">
140
+ <td colspan="2" style="padding:0;">
141
+ <hr />
142
+ <h3><div class="dashicons dashicons-media-code"></div>&nbsp;<?php _e( 'RSS Settings', 'woocommerce-exporter' ); ?></h3>
143
+ </td>
144
+ </tr>
145
+ <tr>
146
+ <th>
147
+ <label for="rss_title"><?php _e( 'Title element', 'woocommerce-exporter' ); ?></label>
148
+ </th>
149
+ <td>
150
+ <input name="rss_title" type="text" id="rss_title" value="<?php echo esc_attr( $rss_title ); ?>" class="regular-text" disabled="disabled" /><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
151
+ <p class="description"><?php _e( 'Defines the title of the data feed (e.g. Product export for WordPress Shop).', 'woocommerce-exporter' ); ?></p>
152
+ </td>
153
+ </tr>
154
+ <tr>
155
+ <th>
156
+ <label for="rss_link"><?php _e( 'Link element', 'woocommerce-exporter' ); ?></label>
157
+ </th>
158
+ <td>
159
+ <input name="rss_link" type="text" id="rss_link" value="<?php echo esc_attr( $rss_link ); ?>" class="regular-text" disabled="disabled" /><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
160
+ <p class="description"><?php _e( 'A link to your website, this doesn\'t have to be the location of the RSS feed.', 'woocommerce-exporter' ); ?></p>
161
+ </td>
162
+ </tr>
163
+ <tr>
164
+ <th>
165
+ <label for="rss_description"><?php _e( 'Description element', 'woocommerce-exporter' ); ?></label>
166
+ </th>
167
+ <td>
168
+ <input name="rss_description" type="text" id="rss_description" value="<?php echo esc_attr( $rss_description ); ?>" class="large-text" disabled="disabled" /><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
169
+ <p class="description"><?php _e( 'A description of your data feed.', 'woocommerce-exporter' ); ?></p>
170
  </td>
171
  </tr>
172
 
173
  <tr id="scheduled-exports">
174
  <td colspan="2" style="padding:0;">
175
  <hr />
176
+ <h3>
177
+ <div class="dashicons dashicons-calendar"></div>&nbsp;<?php _e( 'Scheduled Exports', 'woocommerce-exporter' ); ?>
178
+ </h3>
179
+ <p class="description"><?php _e( 'Configure Store Exporter Deluxe to automatically generate exports, apply filters to export just what you need.<br />Adjusting options within the Scheduling sub-section will after clicking Save Changes refresh the scheduled export engine, editing filters, formats, methods, etc. will not affect the scheduling of the current scheduled export.', 'woocommerce-exporter' ); ?></p>
180
  </td>
181
  </tr>
182
  <tr>
183
  <th>
184
+ <label for="enable_auto"><?php _e( 'Enable scheduled exports', 'woocommerce-exporter' ); ?></label>
185
  </th>
186
  <td>
187
  <select id="enable_auto" name="enable_auto">
188
+ <option value="1" disabled="disabled"><?php _e( 'Yes', 'woocommerce-exporter' ); ?></option>
189
+ <option value="0" selected="selected"><?php _e( 'No', 'woocommerce-exporter' ); ?></option>
190
  </select>
191
+ <p class="description"><?php _e( 'Enabling Scheduled Exports will trigger automated exports at the interval specified under Once every (minutes).', 'woocommerce-exporter' ); ?></p>
192
  </td>
193
  </tr>
194
  <tr>
195
  <th>
196
+ <label for="auto_type"><?php _e( 'Export type', 'woocommerce-exporter' ); ?></label>
197
  </th>
198
  <td>
199
  <select id="auto_type" name="auto_type">
200
+ <?php if( !empty( $types ) ) { ?>
201
+ <?php foreach( $types as $key => $type ) { ?>
202
+ <option value="<?php echo $key; ?>"><?php echo $type; ?></option>
203
  <?php } ?>
204
  <?php } else { ?>
205
+ <option value=""><?php _e( 'No export types were found.', 'woocommerce-exporter' ); ?></option>
206
  <?php } ?>
207
  </select>
208
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
209
+ <p class="description"><?php _e( 'Select the data type you want to export.', 'woocommerce-exporter' ); ?></p>
210
  </td>
211
  </tr>
212
  <tr class="auto_type_options">
213
  <th>
214
+ <label><?php _e( 'Export filters', 'woocommerce-exporter' ); ?></label>
215
  </th>
216
  <td>
217
  <ul>
218
+
219
  <li class="export-options product-options">
220
+ <p class="label"><?php _e( 'Product category', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></p>
221
+ <?php if( !empty( $product_categories ) ) { ?>
222
+ <select data-placeholder="<?php _e( 'Choose a Product Category...', 'woocommerce-exporter' ); ?>" name="product_filter_category[]" multiple class="chzn-select" style="width:95%;">
223
+ <?php foreach( $product_categories as $product_category ) { ?>
224
+ <option><?php echo woo_ce_format_product_category_label( $product_category->name, $product_category->parent_name ); ?> (<?php printf( __( 'Term ID: %d', 'woocommerce-exporter' ), $product_category->term_id ); ?>)</option>
225
+ <?php } ?>
226
+ </select>
227
+ <?php } else { ?>
228
+ <?php _e( 'No Product Categories were found.', 'woocommerce-exporter' ); ?>
229
+ <?php } ?>
230
+ <p class="description"><?php _e( 'Select the Product Category\'s you want to filter exported Products by. Default is to include all Product Categories.', 'woocommerce-exporter' ); ?></p>
231
+ <hr />
232
+ </li>
233
+
234
+ <li class="export-options product-options">
235
+ <p class="label"><?php _e( 'Product tag', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></p>
236
+ <?php if( !empty( $product_tags ) ) { ?>
237
+ <select data-placeholder="<?php _e( 'Choose a Product Tag...', 'woocommerce-exporter' ); ?>" name="product_filter_tag[]" multiple class="chzn-select" style="width:95%;">
238
+ <?php foreach( $product_tags as $product_tag ) { ?>
239
+ <option><?php echo $product_tag->name; ?> (<?php printf( __( 'Term ID: %d', 'woocommerce-exporter' ), $product_tag->term_id ); ?>)</option>
240
+ <?php } ?>
241
+ </select>
242
+ <?php } else { ?>
243
+ <?php _e( 'No Product Tags were found.', 'woocommerce-exporter' ); ?>
244
+ <?php } ?>
245
+ <p class="description"><?php _e( 'Select the Product Tag\'s you want to filter exported Products by. Default is to include all Product Tags.', 'woocommerce-exporter' ); ?></p>
246
+ <hr />
247
+ </li>
248
+
249
+ <li class="export-options product-options">
250
+ <p class="label"><?php _e( 'Product type', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></p>
251
+ <?php if( !empty( $product_types ) ) { ?>
252
+ <select data-placeholder="<?php _e( 'Choose a Product Type...', 'woocommerce-exporter' ); ?>" name="product_filter_type[]" multiple class="chzn-select" style="width:95%;">
253
  <?php foreach( $product_types as $key => $product_type ) { ?>
254
+ <option><?php echo woo_ce_format_product_type( $product_type['name'] ); ?> (<?php echo $product_type['count']; ?>)</option>
255
  <?php } ?>
256
+ </select>
257
+ <?php } else { ?>
258
+ <?php _e( 'No Product Types were found.', 'woocommerce-exporter' ); ?>
259
  <?php } ?>
260
+ <p class="description"><?php _e( 'Select the Product Type\'s you want to filter exported Products by. Default is to include all Product Types and Variations.', 'woocommerce-exporter' ); ?></p>
261
+ <hr />
262
+ </li>
263
+
264
+ <li class="export-options product-options">
265
+ <p class="label"><?php _e( 'Stock status', 'woocommerce-exporter' ); ?></p>
266
+ <ul style="margin-top:0.2em;">
267
+ <li><label><input type="radio" name="product_filter_stock" value="" disabled="disabled" /> <?php _e( 'Include both', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
268
+ <li><label><input type="radio" name="product_filter_stock" value="instock" disabled="disabled" /> <?php _e( 'In stock', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
269
+ <li><label><input type="radio" name="product_filter_stock" value="outofstock" disabled="disabled" /> <?php _e( 'Out of stock', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
270
+ </ul>
271
+ <p class="description"><?php _e( 'Select the Stock Status\'s you want to filter exported Products by. Default is to include all Stock Status\'s.', 'woocommerce-exporter' ); ?></p>
272
  </li>
273
+
274
+ <li class="export-options order-options">
275
+ <p class="label"><?php _e( 'Order date', 'woocommerce-exporter' ); ?></p>
276
+ <ul style="margin-top:0.2em;">
277
+ <li><label><input type="radio" name="order_dates_filter" value="" disabled="disabled" /><?php _e( 'All', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
278
+ <li><label><input type="radio" name="order_dates_filter" value="today" disabled="disabled" /><?php _e( 'Today', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
279
+ <li><label><input type="radio" name="order_dates_filter" value="yesterday" disabled="disabled" /><?php _e( 'Yesterday', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
280
+ <li><label><input type="radio" name="order_dates_filter" value="current_week" disabled="disabled" /><?php _e( 'Current week', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
281
+ <li><label><input type="radio" name="order_dates_filter" value="last_week" disabled="disabled" /><?php _e( 'Last week', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
282
+ <li><label><input type="radio" name="order_dates_filter" value="current_month" disabled="disabled" /><?php _e( 'Current month', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
283
+ <li><label><input type="radio" name="order_dates_filter" value="last_month" disabled="disabled" /><?php _e( 'Last month', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
284
+ <li>
285
+ <label><input type="radio" name="order_dates_filter" value="variable" disabled="disabled" /><?php _e( 'Variable date', 'woocommerce-exporter' ); ?></label>
286
+ <div style="margin-top:0.2em;">
287
+ <?php _e( 'Last', 'woocommerce-exporter' ); ?>
288
+ <input type="text" name="order_dates_filter_variable" class="text" size="4" value="<?php echo $order_filter_date_variable; ?>" disabled="disabled" />
289
+ <select name="order_dates_filter_variable_length">
290
+ <option value="">&nbsp;</option>
291
+ <option value="second" disabled="disabled"><?php _e( 'second(s)', 'woocommerce-exporter' ); ?></option>
292
+ <option value="minute" disabled="disabled"><?php _e( 'minute(s)', 'woocommerce-exporter' ); ?></option>
293
+ <option value="hour" disabled="disabled"><?php _e( 'hour(s)', 'woocommerce-exporter' ); ?></option>
294
+ <option value="day" disabled="disabled"><?php _e( 'day(s)', 'woocommerce-exporter' ); ?></option>
295
+ <option value="week" disabled="disabled"><?php _e( 'week(s)', 'woocommerce-exporter' ); ?></option>
296
+ <option value="month" disabled="disabled"><?php _e( 'month(s)', 'woocommerce-exporter' ); ?></option>
297
+ <option value="year" disabled="disabled"><?php _e( 'year(s)', 'woocommerce-exporter' ); ?></option>
298
+ </select>
299
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
300
+ </div>
301
+ </li>
302
+ <li>
303
+ <label><input type="radio" name="order_dates_filter" value="manual" disabled="disabled" /><?php _e( 'Fixed date', 'woocommerce-exporter' ); ?></label>
304
+ <div style="margin-top:0.2em;">
305
+ <input type="text" size="10" maxlength="10" class="text datepicker" /> to <input type="text" size="10" maxlength="10" class="text datepicker" /><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
306
+ </div>
307
+ </li>
308
+ </ul>
309
+ <p class="description"><?php _e( 'Filter the dates of Orders to be included in the export. If manually selecting dates ensure the Fixed date radio field is checked, likewise for variable dates. Default is to include all Orders made.', 'woocommerce-exporter' ); ?></p>
310
+ <hr />
311
  </li>
312
+
313
  <li class="export-options order-options">
314
+ <p class="label"><?php _e( 'Order status', 'woocommerce-exporter' ); ?></p>
315
+ <select data-placeholder="<?php _e( 'Choose a Order Status...', 'woocommerce-exporter' ); ?>" name="order_filter_status[]" multiple class="chzn-select" style="width:95%;">
316
+ <option value="" selected="selected"><?php _e( 'All', 'woocommerce-exporter' ); ?></option>
317
+ <?php if( !empty( $order_statuses ) ) { ?>
318
  <?php foreach( $order_statuses as $order_status ) { ?>
319
  <option value="<?php echo $order_status->name; ?>" disabled="disabled"><?php echo ucfirst( $order_status->name ); ?></option>
320
  <?php } ?>
321
  <?php } ?>
322
  </select>
323
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
324
+ <p class="description"><?php _e( 'Select the Order Status you want to filter exported Orders by. Default is to include all Order Status options.', 'woocommerce-exporter' ); ?></p>
325
+ <hr />
326
+ </li>
327
+
328
+ <li class="export-options order-options">
329
+ <p class="label"><?php _e( 'Payment gateway', 'woocommerce-exporter' ); ?></p>
330
+ <select data-placeholder="<?php _e( 'Choose a Payment Gateway...', 'woocommerce-exporter' ); ?>" name="order_filter_payment[]" multiple class="chzn-select" style="width:95%;">
331
+ <option value="" selected="selected"><?php _e( 'All', 'woocommerce-exporter' ); ?></option>
332
+ </select>
333
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
334
+ <p class="description"><?php _e( 'Select the Payment Gateways you want to filter exported Orders by. Default is to include all Payment Gateways.', 'woocommerce-exporter' ); ?></p>
335
+ <hr />
336
  </li>
337
+
338
+ <li class="export-options order-options">
339
+ <p class="label"><?php _e( 'Shipping method', 'woocommerce-exporter' ); ?></p>
340
+ <select data-placeholder="<?php _e( 'Choose a Shipping Method...', 'woocommerce-exporter' ); ?>" name="order_filter_shipping[]" multiple class="chzn-select" style="width:95%;">
341
+ <option value="" selected="selected"><?php _e( 'All', 'woocommerce-exporter' ); ?></option>
342
+ </select>
343
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
344
+ <p class="description"><?php _e( 'Select the Shipping Methods you want to filter exported Orders by. Default is to include all Shipping Methods.', 'woocommerce-exporter' ); ?></p>
345
+ <hr />
346
+ </li>
347
+
348
+ <li class="export-options order-options">
349
+ <p class="label"><?php _e( 'Billing country', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></p>
350
+ <select data-placeholder="<?php _e( 'Choose a Billing Country...', 'woocommerce-exporter' ); ?>" name="order_filter_billing_country[]" multiple class="chzn-select" style="width:95%;">
351
+ <option value="" selected="selected"><?php _e( 'All', 'woocommerce-exporter' ); ?></option>
352
+ </select>
353
+ <p class="description"><?php _e( 'Filter Orders by Billing Country to be included in the export. Default is to include all Countries.', 'woocommerce-exporter' ); ?></p>
354
+ <hr />
355
+ </li>
356
+
357
  <li class="export-options order-options">
358
+ <p class="label"><?php _e( 'Shipping country', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></p>
359
+ <select data-placeholder="<?php _e( 'Choose a Shipping Country...', 'woocommerce-exporter' ); ?>" id="order_filter_shipping_country" name="order_filter_shipping_country" class="chzn-select">
360
+ <option value="" selected="selected"><?php _e( 'All', 'woocommerce-exporter' ); ?></option>
361
+ </select>
362
+ <p class="description"><?php _e( 'Filter Orders by Shipping Country to be included in the export. Default is to include all Countries.', 'woocommerce-exporter' ); ?></p>
363
+ </li>
364
+
365
+ <li class="export-options category-options tag-options brand-options customer-options user-options coupon-options subscription-options product_vendor-options commission-options shipping_class-options">
366
+ <p><?php _e( 'No export filter options are available for this export type.', 'woocommerce-exporter' ); ?></p>
367
  </li>
368
+
369
  </ul>
370
  </td>
371
  </tr>
372
+
373
  <tr>
374
  <th>
375
+ <label><?php _e( 'Scheduling', 'woocommerce-exporter' ); ?></label>
376
  </th>
377
  <td>
378
+ <p><?php _e( 'How often do you want the export to run?', 'woocommerce-exporter' ); ?></p>
379
+ <ul>
380
+ <li>
381
+ <label><input type="radio" name="auto_schedule" value="custom" disabled="disabled" /> <?php _e( 'Once every ', 'woocommerce-exporter' ); ?></label>
382
+ <input name="auto_interval" type="text" id="auto_interval" value="<?php echo esc_attr( $auto_interval ); ?>" size="6" maxlength="6" class="text" disabled="disabled" />
383
+ <?php _e( 'minutes', 'woocommerce-exporter' ); ?>
384
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
385
+ </li>
386
+ <li><label><input type="radio" name="auto_schedule" value="daily" disabled="disabled" /> <?php _e( 'Daily', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
387
+ <li><label><input type="radio" name="auto_schedule" value="weekly" disabled="disabled" /> <?php _e( 'Weekly', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
388
+ <li><label><input type="radio" name="auto_schedule" value="monthly" disabled="disabled" /> <?php _e( 'Monthly', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
389
+ <li><label><input type="radio" name="auto_schedule" value="one-time" disabled="disabled" /> <?php _e( 'One time', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
390
+ </ul>
391
+ <p class="description"><?php _e( 'Choose how often Store Exporter Deluxe generates new exports. Default is every 1440 minutes (once every 24 hours).', 'woocommerce-exporter' ); ?></p>
392
+ <hr />
393
+ <p><?php _e( 'When do you want scheduled exports to start?', 'woocommerce-exporter' ); ?></p>
394
+ <ul>
395
+ <li><label><input type="radio" name="auto_commence" value="now" disabled="disabled" /><?php _e( 'From now', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
396
+ <li><label><input type="radio" name="auto_commence" value="future" disabled="disabled" /><?php _e( 'From the following', 'woocommerce-exporter' ); ?></label>: <input type="text" name="auto_commence_date" size="20" maxlength="20" class="text datetimepicker" value="<?php echo $auto_commence_date; ?>" /><!--, <?php _e( 'at this time', 'woocommerce-exporter' ); ?>: <input type="text" name="auto_interval_time" size="10" maxlength="10" class="text timepicker" />--><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
397
+ </ul>
398
  </td>
399
  </tr>
400
+
401
  <tr>
402
  <th>
403
+ <label><?php _e( 'Export format', 'woocommerce-exporter' ); ?></label>
404
  </th>
405
  <td>
406
+ <ul style="margin-top:0.2em;">
407
+ <li><label><input type="radio" name="auto_format" value="csv" disabled="disabled" /> <?php _e( 'CSV', 'woocommerce-exporter' ); ?> <span class="description"><?php _e( '(Comma Separated Values)', 'woocommerce-exporter' ); ?> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
408
+ <li><label><input type="radio" name="auto_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></li>
409
+ <li><label><input type="radio" name="auto_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></li>
410
+ <li><label><input type="radio" name="auto_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></li>
411
+ </ul>
412
+ <p class="description"><?php _e( 'Adjust the export format to generate different export file formats. Default is CSV.', 'woocommerce-exporter' ); ?></p>
413
  </td>
414
  </tr>
415
  <tr>
416
  <th>
417
+ <label for="auto_method"><?php _e( 'Export method', 'woocommerce-exporter' ); ?></label>
418
  </th>
419
  <td>
420
  <select id="auto_method" name="auto_method">
421
+ <option value="archive"><?php _e( 'Archive to WordPress Media', 'woocommerce-exporter' ); ?></option>
422
+ <option value="email"><?php _e( 'Send as e-mail', 'woocommerce-exporter' ); ?></option>
423
+ <option value="post"><?php _e( 'POST to remote URL', 'woocommerce-exporter' ); ?></option>
424
+ <option value="ftp"><?php _e( 'Upload to remote FTP', 'woocommerce-exporter' ); ?></option>
425
  </select>
426
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
427
+ <p class="description"><?php _e( 'Choose what Store Exporter Deluxe does with the generated export. Default is to archive the export to the WordPress Media for archival purposes.', 'woocommerce-exporter' ); ?></p>
428
  </td>
429
  </tr>
430
  <tr class="auto_method_options">
431
  <th>
432
+ <label><?php _e( 'Export method options', 'woocommerce-exporter' ); ?></label>
433
  </th>
434
  <td>
435
  <ul>
436
+
437
+ <li class="export-options email-options">
438
+ <p>
439
+ <label for="email_to"><?php _e( 'Default e-mail recipient', 'woocommerce-exporter' ); ?></label><br />
440
+ <input name="email_to" type="text" id="email_to" value="<?php echo esc_attr( $email_to ); ?>" class="regular-text code" disabled="disabled" /><br /><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
441
+ </p>
442
+ <p class="description"><?php _e( 'Set the default recipient of scheduled export e-mails, multiple recipients can be added using the <code><attr title="comma">,</attr></code> separator. This option can be overriden via CRON using the <code>to</code> argument.<br />Default is the Blog Administrator e-mail address set on the WordPress &raquo; Settings screen.', 'woocommerce-exporter' ); ?></p>
443
+
444
+ <p>
445
+ <label for="email_subject"><?php _e( 'Default e-mail subject', 'woocommerce-exporter' ); ?></label><br />
446
+ <input name="email_subject" type="text" id="email_subject" value="<?php echo esc_attr( $email_subject ); ?>" class="large-text code" disabled="disabled" /><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
447
+ </p>
448
+ <p class="description"><?php _e( 'Set the default subject of scheduled export e-mails, can be overriden via CRON using the <code>subject</code> argument. Tags can be used: <code>%store_name%</code>, <code>%export_type%</code>, <code>%export_filename%</code>.', 'woocommerce-exporter' ); ?></p>
449
+ </li>
450
+
451
+ <li class="export-options post-options">
452
+ <p>
453
+ <label for="post_to"><?php _e( 'Default remote POST URL', 'woocommerce-exporter' ); ?></label><br />
454
+ <input name="post_to" type="text" id="post_to" value="<?php echo esc_url( $post_to ); ?>" class="large-text code" disabled="disabled" /><br /><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
455
+ </p>
456
+ <p class="description"><?php printf( __( 'Set the default remote POST address for scheduled exports, can be overriden via CRON using the <code>to</code> argument. Default is empty. See our <a href="%s" target="_blank">Usage</a> document for more information on Default remote POST URL.', 'woocommerce-exporter' ), $troubleshooting_url ); ?></p>
457
+ </li>
458
+
459
  <li class="export-options ftp-options">
460
+ <label for="ftp_method_host"><?php _e( 'Host', 'woocommerce-exporter' ); ?>:</label> <input type="text" id="ftp_method_host" name="ftp_method_host" size="15" class="regular-text code" value="<?php echo sanitize_text_field( $ftp_method_host ); ?>" disabled="disabled" />&nbsp;
461
+ <label for="ftp_method_port" style="width:auto;"><?php _e( 'Port', 'woocommerce-exporter' ); ?>:</label> <input type="text" id="ftp_method_port" name="ftp_method_port" size="5" class="short-text code" value="<?php echo sanitize_text_field( $ftp_method_port ); ?>" disabled="disabled" maxlength="5" /><br />
462
+ <label for="ftp_method_protocol"><?php _e( 'Protocol', 'woocommerce-exporter' ); ?></label>
463
+ <select name="ftp_method_protocol">
464
+ <option><?php _e( 'FTP - File Transfer Protocol', 'woocommerce-exporter' ); ?></option>
465
+ <option disabled="disabled"><?php _e( 'SFTP - SSH File Transfer Protocol', 'woocommerce-exporter' ); ?></option>
466
+ </select><br />
467
+ <label for="ftp_method_user"><?php _e( 'Username', 'woocommerce-exporter' ); ?>:</label> <input type="text" id="ftp_method_user" name="ftp_method_user" size="15" class="regular-text code" value="<?php echo sanitize_text_field( $ftp_method_user ); ?>" disabled="disabled" /><br />
468
+ <label for="ftp_method_pass"><?php _e( 'Password', 'woocommerce-exporter' ); ?>:</label> <input type="password" id="ftp_method_pass" name="ftp_method_pass" size="15" class="regular-text code" value="" disabled="disabled" /><?php if( !empty( $ftp_method_pass ) ) { echo ' ' . __( '(password is saved)', 'woocommerce-exporter' ); } ?><br />
469
+ <label for="ftp_method_file_path"><?php _e( 'File path', 'woocommerce-exporter' ); ?>:</label> <input type="text" id="ftp_method_file_path" name="ftp_method_path" size="25" class="regular-text code" value="<?php echo sanitize_text_field( $ftp_method_path ); ?>" disabled="disabled" /><br />
470
+ <label for="ftp_method_filename"><?php _e( 'Fixed filename', 'woocommerce-exporter' ); ?>:</label> <input type="text" id="ftp_method_filename" name="ftp_method_filename" size="25" class="regular-text code" value="<?php echo sanitize_text_field( $ftp_method_filename ); ?>" disabled="disabled" /><br />
471
+ <label for="ftp_method_passive"><?php _e( 'Transfer mode', 'woocommerce-exporter' ); ?>:</label>
472
  <select id="ftp_method_passive" name="ftp_method_passive">
473
+ <option value="auto"><?php _e( 'Auto', 'woocommerce-exporter' ); ?></option>
474
+ <option value="active" disabled="disabled"><?php _e( 'Active', 'woocommerce-exporter' ); ?></option>
475
+ <option value="passive" disabled="disabled"><?php _e( 'Passive', 'woocommerce-exporter' ); ?></option>
476
  </select><br />
477
+ <label for="ftp_method_timeout"><?php _e( 'Timeout', 'woocommerce-exporter' ); ?>:</label> <input type="text" id="ftp_method_timeout" name="ftp_method_timeout" size="5" class="short-text code" value="<?php echo sanitize_text_field( $ftp_method_timeout ); ?>" disabled="disabled" /><br />
478
+ <p class="description"><?php _e( 'Enter the FTP host (minus <code>ftp://</code>), login details and path of where to save the export file, do not provide the filename, the export filename can be set on General Settings above. For file path example: <code>wp-content/uploads/exports/</code>', 'woocommerce-exporter' ); ?></p>
479
  </li>
480
+
481
+ <li class="export-options archive-options">
482
+ <p><?php _e( 'No export method options are available for this export method.', 'woocommerce-exporter' ); ?></p>
483
  </li>
484
+
485
+ </ul>
486
+ </td>
487
+ </tr>
488
+ <tr>
489
+ <th>
490
+ <label for="scheduled_fields"><?php _e( 'Export fields', 'woocommerce-exporter' ); ?></label>
491
+ </th>
492
+ <td>
493
+ <ul style="margin-top:0.2em;">
494
+ <li><label><input type="radio" id="scheduled_fields" name="scheduled_fields" value="all"<?php checked( $scheduled_fields, 'all' ); ?> /> <?php _e( 'Include all Export Fields for the requested Export Type', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
495
+ <li><label><input type="radio" name="scheduled_fields" value="saved"<?php checked( $scheduled_fields, 'saved' ); ?> disabled="disabled" /> <?php _e( 'Use the saved Export Fields preference set on the Export screen for the requested Export Type', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
496
  </ul>
497
+ <p class="description"><?php _e( 'Control whether all known export fields are included or only checked fields from the Export Fields section on the Export screen for each Export Type. Default is to include all export fields.', 'woocommerce-exporter' ); ?></p>
498
  </td>
499
  </tr>
500
 
501
  <tr id="cron-exports">
502
  <td colspan="2" style="padding:0;">
503
  <hr />
504
+ <h3><div class="dashicons dashicons-clock"></div>&nbsp;<?php _e( 'CRON Exports', 'woocommerce-exporter' ); ?></h3>
505
+ <p class="description"><?php printf( __( 'Store Exporter Deluxe supports exporting via a command line request. For sample CRON requests and supported arguments consult our <a href="%s" target="_blank">online documentation</a>.', 'woocommerce-exporter' ), $troubleshooting_url ); ?></p>
506
  </td>
507
  </tr>
508
  <tr>
509
  <th>
510
+ <label for="enable_cron"><?php _e( 'Enable CRON', 'woocommerce-exporter' ); ?></label>
511
  </th>
512
  <td>
513
  <select id="enable_cron" name="enable_cron">
514
+ <option value="1" disabled="disabled"><?php _e( 'Yes', 'woocommerce-exporter' ); ?></option>
515
+ <option value="0" selected="selected"><?php _e( 'No', 'woocommerce-exporter' ); ?></option>
516
  </select>
517
+ <p class="description"><?php _e( 'Enabling CRON allows developers to schedule automated exports and connect with Store Exporter Deluxe remotely.', 'woocommerce-exporter' ); ?></p>
518
+ </td>
519
+ </tr>
520
+ <tr>
521
+ <th>
522
+ <label for="secret_key"><?php _e( 'Export secret key', 'woocommerce-exporter' ); ?></label>
523
+ </th>
524
+ <td>
525
+ <input name="secret_key" type="text" id="secret_key" value="<?php echo esc_attr( $secret_key ); ?>" class="large-text code" disabled="disabled" /><br /><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
526
+ <p class="description"><?php _e( 'This secret key (can be left empty to allow unrestricted access) limits access to authorised developers who provide a matching key when working with Store Exporter Deluxe.', 'woocommerce-exporter' ); ?></p>
527
+ </td>
528
+ </tr>
529
+ <tr>
530
+ <th>
531
+ <label for="cron_fields"><?php _e( 'Export fields', 'woocommerce-exporter' ); ?></label>
532
+ </th>
533
+ <td>
534
+ <ul style="margin-top:0.2em;">
535
+ <li><label><input type="radio" id="cron_fields" name="cron_fields" value="all"<?php checked( $cron_fields, 'all' ); ?> /> <?php _e( 'Include all Export Fields for the requested Export Type', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
536
+ <li><label><input type="radio" name="cron_fields" value="saved"<?php checked( $cron_fields, 'saved' ); ?> disabled="disabled" /> <?php _e( 'Use the saved Export Fields preference set on the Export screen for the requested Export Type', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
537
+ </ul>
538
+ <p class="description"><?php _e( 'Control whether all known export fields are included or only checked fields from the Export Fields section on the Export screen for each Export Type. Default is to include all export fields.', 'woocommerce-exporter' ); ?></p>
539
+ </td>
540
+ </tr>
541
+ <!-- #cron-exports -->
542
+
543
+ <tr id="orders-screen">
544
+ <td colspan="2" style="padding:0;">
545
+ <hr />
546
+ <h3><div class="dashicons dashicons-admin-settings"></div>&nbsp;<?php _e( 'Orders Screen', 'woocommerce-exporter' ); ?></h3>
547
  </td>
548
  </tr>
549
  <tr>
550
  <th>
551
+ <label><?php _e( 'Actions display', 'woocommerce-exporter' ); ?></label>
552
  </th>
553
  <td>
554
+ <ul>
555
+ <li><label><input type="checkbox" name="order_actions_csv" value="1"<?php checked( $order_actions_csv ); ?> /> <?php _e( 'Export to CSV', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
556
+ <li><label><input type="checkbox" name="order_actions_xml" value="1"<?php checked( $order_actions_xml ); ?> /> <?php _e( 'Export to XML', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
557
+ <li><label><input type="checkbox" name="order_actions_xls" value="1"<?php checked( $order_actions_xls ); ?> /> <?php _e( 'Export to XLS', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
558
+ <li><label><input type="checkbox" name="order_actions_xlsx" value="1"<?php checked( $order_actions_xlsx ); ?> /> <?php _e( 'Export to XLSX', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
559
+ </ul>
560
+ <p class="description"><?php _e( 'Control the visibility of different Order actions on the WooCommerce &raquo; Orders screen.', 'woocommerce-exporter' ); ?></p>
561
  </td>
562
  </tr>
563
  <?php
564
  ob_end_flush();
565
 
566
+ }
567
+
568
+ function woo_ce_export_settings_save() {
569
+
570
+ // Strip file extension from export filename
571
+ $export_filename = strip_tags( (string)$_POST['export_filename'] );
572
+ woo_ce_update_option( 'export_filename', $export_filename );
573
+ woo_ce_update_option( 'delete_file', sanitize_text_field( absint( $_POST['delete_file'] ) ) );
574
+ woo_ce_update_option( 'encoding', sanitize_text_field( (string)$_POST['encoding'] ) );
575
+ woo_ce_update_option( 'delimiter', sanitize_text_field( (string)$_POST['delimiter'] ) );
576
+ woo_ce_update_option( 'category_separator', sanitize_text_field( (string)$_POST['category_separator'] ) );
577
+ woo_ce_update_option( 'bom', absint( $_POST['bom'] ) );
578
+ woo_ce_update_option( 'escape_formatting', sanitize_text_field( (string)$_POST['escape_formatting'] ) );
579
+ if( $_POST['date_format'] == 'custom' && !empty( $_POST['date_format_custom'] ) )
580
+ woo_ce_update_option( 'date_format', sanitize_text_field( (string)$_POST['date_format_custom'] ) );
581
+ else
582
+ woo_ce_update_option( 'date_format', sanitize_text_field( (string)$_POST['date_format'] ) );
583
+
584
+ $message = __( 'Changes have been saved.', 'woocommerce-exporter' );
585
+ woo_ce_admin_notice( $message );
586
+
587
  }
588
  ?>
includes/shipping_class.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ if( !function_exists( 'woo_ce_get_export_type_shipping_class_count' ) ) {
7
+ function woo_ce_get_export_type_shipping_class_count() {
8
+
9
+ $count = 0;
10
+ // Check if the existing Transient exists
11
+ $cached = get_transient( WOO_CE_PREFIX . '_shipping_class_count' );
12
+ if( $cached == false ) {
13
+ $term_taxonomy = 'product_shipping_class';
14
+ if( taxonomy_exists( $term_taxonomy ) )
15
+ $count = wp_count_terms( $term_taxonomy );
16
+ set_transient( WOO_CE_PREFIX . '_shipping_class_count', $count, HOUR_IN_SECONDS );
17
+ } else {
18
+ $count = $cached;
19
+ }
20
+ return $count;
21
+
22
+ }
23
+ }
24
+
25
+ /* End of: WordPress Administration */
26
+
27
+ }
28
+
29
+ // Returns a list of Shipping Classes export columns
30
+ function woo_ce_get_shipping_class_fields( $format = 'full' ) {
31
+
32
+ $export_type = 'shipping_class';
33
+
34
+ $fields = array();
35
+ $fields[] = array(
36
+ 'name' => 'term_id',
37
+ 'label' => __( 'Term ID', 'woo_ce' )
38
+ );
39
+ $fields[] = array(
40
+ 'name' => 'name',
41
+ 'label' => __( 'Shipping Class Name', 'woo_ce' )
42
+ );
43
+ $fields[] = array(
44
+ 'name' => 'slug',
45
+ 'label' => __( 'Shipping Class Slug', 'woo_ce' )
46
+ );
47
+ $fields[] = array(
48
+ 'name' => 'description',
49
+ 'label' => __( 'Shipping Class Description', 'woo_ce' )
50
+ );
51
+
52
+ /*
53
+ $fields[] = array(
54
+ 'name' => '',
55
+ 'label' => __( '', 'woo_ce' )
56
+ );
57
+ */
58
+
59
+ // Allow Plugin/Theme authors to add support for additional columns
60
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
61
+
62
+ switch( $format ) {
63
+
64
+ case 'summary':
65
+ $output = array();
66
+ $size = count( $fields );
67
+ for( $i = 0; $i < $size; $i++ ) {
68
+ if( isset( $fields[$i] ) )
69
+ $output[$fields[$i]['name']] = 'on';
70
+ }
71
+ return $output;
72
+ break;
73
+
74
+ case 'full':
75
+ default:
76
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
77
+ $size = count( $fields );
78
+ for( $i = 0; $i < $size; $i++ ) {
79
+ $fields[$i]['reset'] = $i;
80
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
81
+ }
82
+ // Check if we are using PHP 5.3 and above
83
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
84
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
85
+ return $fields;
86
+ break;
87
+
88
+ }
89
+
90
+ }
91
+ ?>
includes/subscription.php ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ if( !function_exists( 'woo_ce_get_export_type_subscription_count' ) ) {
7
+ function woo_ce_get_export_type_subscription_count( $count = 0, $export_type = '', $args ) {
8
+
9
+ if( $export_type <> 'subscription' )
10
+ return $count;
11
+
12
+ $count = 0;
13
+ // Check that WooCommerce Subscriptions exists
14
+ if( class_exists( 'WC_Subscriptions' ) ) {
15
+ $count = woo_ce_get_subscription_count();
16
+ }
17
+ return $count;
18
+
19
+ }
20
+ add_filter( 'woo_ce_get_export_type_count', 'woo_ce_get_export_type_subscription_count', 10, 3 );
21
+ }
22
+
23
+ function woo_ce_get_subscription_count() {
24
+
25
+ $count = 0;
26
+ // Check if the existing Transient exists
27
+ $cached = get_transient( WOO_CE_PREFIX . '_subscription_count' );
28
+ if( $cached == false ) {
29
+ // Allow store owners to force the Subscription count
30
+ $count = apply_filters( 'woo_ce_get_subscription_count', $count );
31
+ if( $count == 0 ) {
32
+ $wcs_version = woo_ce_get_wc_subscriptions_version();
33
+ if( version_compare( $wcs_version, '2.0.1', '<' ) ) {
34
+ if( method_exists( 'WC_Subscriptions', 'is_large_site' ) ) {
35
+ // Does this store have roughly more than 3000 Subscriptions
36
+ if( false === WC_Subscriptions::is_large_site() ) {
37
+ if( class_exists( 'WC_Subscriptions_Manager' ) ) {
38
+ // Check that the get_all_users_subscriptions() function exists
39
+ if( method_exists( 'WC_Subscriptions_Manager', 'get_all_users_subscriptions' ) ) {
40
+ if( $subscriptions = WC_Subscriptions_Manager::get_all_users_subscriptions() ) {
41
+ if( version_compare( $wcs_version, '2.0.1', '<' ) ) {
42
+ foreach( $subscriptions as $key => $user_subscription ) {
43
+ if( !empty( $user_subscription ) ) {
44
+ foreach( $user_subscription as $subscription )
45
+ $count++;
46
+ }
47
+ }
48
+ unset( $subscriptions, $subscription, $user_subscription );
49
+ }
50
+ }
51
+ }
52
+ }
53
+ } else {
54
+ if( method_exists( 'WC_Subscriptions', 'get_total_subscription_count' ) )
55
+ $count = WC_Subscriptions::get_total_subscription_count();
56
+ else
57
+ $count = "~2500";
58
+ }
59
+ } else {
60
+ if( method_exists( 'WC_Subscriptions', 'get_subscription_count' ) )
61
+ $count = WC_Subscriptions::get_subscription_count();
62
+ }
63
+ } else {
64
+ if( function_exists( 'wcs_get_subscriptions' ) ) {
65
+ $args = array(
66
+ 'subscriptions_per_page' => -1,
67
+ 'subscription_status' => 'trash'
68
+ );
69
+ $count += count( wcs_get_subscriptions( $args ) );
70
+ $args['subscription_status'] = 'any';
71
+ $count += count( wcs_get_subscriptions( $args ) );
72
+ }
73
+ }
74
+ }
75
+ set_transient( WOO_CE_PREFIX . '_subscription_count', $count, HOUR_IN_SECONDS );
76
+ } else {
77
+ $count = $cached;
78
+ }
79
+ return $count;
80
+
81
+ }
82
+
83
+ /* End of: WordPress Administration */
84
+
85
+ }
86
+
87
+ function woo_ce_get_subscription_fields( $format = 'full' ) {
88
+
89
+ $export_type = 'subscription';
90
+
91
+ $fields = array();
92
+ $fields[] = array(
93
+ 'name' => 'key',
94
+ 'label' => __( 'Subscription Key', 'woocommerce-exporter' )
95
+ );
96
+ $fields[] = array(
97
+ 'name' => 'status',
98
+ 'label' => __( 'Subscription Status', 'woocommerce-exporter' )
99
+ );
100
+ $fields[] = array(
101
+ 'name' => 'name',
102
+ 'label' => __( 'Subscription Name', 'woocommerce-exporter' )
103
+ );
104
+ $fields[] = array(
105
+ 'name' => 'user',
106
+ 'label' => __( 'User', 'woocommerce-exporter' )
107
+ );
108
+ $fields[] = array(
109
+ 'name' => 'user_id',
110
+ 'label' => __( 'User ID', 'woocommerce-exporter' )
111
+ );
112
+ $fields[] = array(
113
+ 'name' => 'email',
114
+ 'label' => __( 'E-mail Address', 'woocommerce-exporter' )
115
+ );
116
+ $fields[] = array(
117
+ 'name' => 'order_id',
118
+ 'label' => __( 'Order ID', 'woocommerce-exporter' )
119
+ );
120
+ $fields[] = array(
121
+ 'name' => 'order_status',
122
+ 'label' => __( 'Order Status', 'woocommerce-exporter' )
123
+ );
124
+ // Check if this is a pre-WooCommerce 2.2 instance
125
+ $woocommerce_version = woo_get_woo_version();
126
+ if( version_compare( $woocommerce_version, '2.2', '<' ) ) {
127
+ $fields[] = array(
128
+ 'name' => 'post_status',
129
+ 'label' => __( 'Post Status', 'woocommerce-exporter' )
130
+ );
131
+ }
132
+ $fields[] = array(
133
+ 'name' => 'start_date',
134
+ 'label' => __( 'Start Date', 'woocommerce-exporter' )
135
+ );
136
+ $fields[] = array(
137
+ 'name' => 'expiration',
138
+ 'label' => __( 'Expiration', 'woocommerce-exporter' )
139
+ );
140
+ $fields[] = array(
141
+ 'name' => 'end_date',
142
+ 'label' => __( 'End Date', 'woocommerce-exporter' )
143
+ );
144
+ $fields[] = array(
145
+ 'name' => 'trial_end_date',
146
+ 'label' => __( 'Trial End Date', 'woocommerce-exporter' )
147
+ );
148
+ $fields[] = array(
149
+ 'name' => 'last_payment',
150
+ 'label' => __( 'Last Payment', 'woocommerce-exporter' )
151
+ );
152
+ $fields[] = array(
153
+ 'name' => 'next_payment',
154
+ 'label' => __( 'Next Payment', 'woocommerce-exporter' )
155
+ );
156
+ $fields[] = array(
157
+ 'name' => 'renewals',
158
+ 'label' => __( 'Renewals', 'woocommerce-exporter' )
159
+ );
160
+ $fields[] = array(
161
+ 'name' => 'product_id',
162
+ 'label' => __( 'Product ID', 'woocommerce-exporter' )
163
+ );
164
+ $fields[] = array(
165
+ 'name' => 'product_sku',
166
+ 'label' => __( 'Product SKU', 'woocommerce-exporter' )
167
+ );
168
+ $fields[] = array(
169
+ 'name' => 'variation_id',
170
+ 'label' => __( 'Variation ID', 'woocommerce-exporter' )
171
+ );
172
+ $fields[] = array(
173
+ 'name' => 'coupon',
174
+ 'label' => __( 'Coupon Code', 'woocommerce-exporter' )
175
+ );
176
+ /*
177
+ $fields[] = array(
178
+ 'name' => '',
179
+ 'label' => __( '', 'woocommerce-exporter' )
180
+ );
181
+ */
182
+
183
+ // Allow Plugin/Theme authors to add support for additional columns
184
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
185
+
186
+ switch( $format ) {
187
+
188
+ case 'summary':
189
+ $output = array();
190
+ $size = count( $fields );
191
+ for( $i = 0; $i < $size; $i++ ) {
192
+ if( isset( $fields[$i] ) )
193
+ $output[$fields[$i]['name']] = 'on';
194
+ }
195
+ return $output;
196
+ break;
197
+
198
+ case 'full':
199
+ default:
200
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
201
+ $size = count( $fields );
202
+ for( $i = 0; $i < $size; $i++ ) {
203
+ $fields[$i]['reset'] = $i;
204
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
205
+ }
206
+ // Check if we are using PHP 5.3 and above
207
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
208
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
209
+ return $fields;
210
+ break;
211
+
212
+ }
213
+
214
+ }
215
+
216
+ function woo_ce_get_subscription_statuses() {
217
+
218
+ $subscription_statuses = array(
219
+ 'active' => __( 'Active', 'woocommerce-subscriptions' ),
220
+ 'cancelled' => __( 'Cancelled', 'woocommerce-subscriptions' ),
221
+ 'expired' => __( 'Expired', 'woocommerce-subscriptions' ),
222
+ 'pending' => __( 'Pending', 'woocommerce-subscriptions' ),
223
+ 'failed' => __( 'Failed', 'woocommerce-subscriptions' ),
224
+ 'on-hold' => __( 'On-hold', 'woocommerce-subscriptions' ),
225
+ 'trash' => __( 'Deleted', 'woocommerce-exporter' ),
226
+ );
227
+ return apply_filters( 'woo_ce_subscription_statuses', $subscription_statuses );
228
+
229
+ }
230
+
231
+ function woo_ce_get_wc_subscriptions_version() {
232
+
233
+ if( class_exists( 'WC_Subscriptions' ) ) {
234
+ return WC_Subscriptions::$version;
235
+ }
236
+
237
+ }
238
+
239
+ function woo_ce_get_subscription_products() {
240
+
241
+ $term_taxonomy = 'product_type';
242
+ $args = array(
243
+ 'post_type' => array( 'product', 'product_variation' ),
244
+ 'posts_per_page' => -1,
245
+ 'fields' => 'ids',
246
+ 'suppress_filters' => false,
247
+ 'tax_query' => array(
248
+ array(
249
+ 'taxonomy' => $term_taxonomy,
250
+ 'field' => 'slug',
251
+ 'terms' => array( 'subscription', 'variable-subscription' )
252
+ )
253
+ )
254
+ );
255
+ $products = array();
256
+ $product_ids = new WP_Query( $args );
257
+ if( $product_ids->posts ) {
258
+ foreach( $product_ids->posts as $product_id )
259
+ $products[] = $product_id;
260
+ }
261
+ return $products;
262
+
263
+ }
264
+ ?>
includes/subscriptions.php DELETED
@@ -1,108 +0,0 @@
1
- <?php
2
- function woo_ce_get_subscription_fields( $format = 'full' ) {
3
-
4
- $fields = array();
5
- $fields[] = array(
6
- 'name' => 'key',
7
- 'label' => __( 'Subscription Key', 'woo_ce' )
8
- );
9
- $fields[] = array(
10
- 'name' => 'status',
11
- 'label' => __( 'Subscription Status', 'woo_ce' )
12
- );
13
- $fields[] = array(
14
- 'name' => 'name',
15
- 'label' => __( 'Subscription Name', 'woo_ce' )
16
- );
17
- $fields[] = array(
18
- 'name' => 'user',
19
- 'label' => __( 'User', 'woo_ce' )
20
- );
21
- $fields[] = array(
22
- 'name' => 'user_id',
23
- 'label' => __( 'User ID', 'woo_ce' )
24
- );
25
- $fields[] = array(
26
- 'name' => 'order_id',
27
- 'label' => __( 'Order ID', 'woo_ce' )
28
- );
29
- $fields[] = array(
30
- 'name' => 'order_status',
31
- 'label' => __( 'Order Status', 'woo_ce' )
32
- );
33
- $fields[] = array(
34
- 'name' => 'post_status',
35
- 'label' => __( 'Post Status', 'woo_ce' )
36
- );
37
- $fields[] = array(
38
- 'name' => 'start_date',
39
- 'label' => __( 'Start Date', 'woo_ce' )
40
- );
41
- $fields[] = array(
42
- 'name' => 'expiration',
43
- 'label' => __( 'Expiration', 'woo_ce' )
44
- );
45
- $fields[] = array(
46
- 'name' => 'end_date',
47
- 'label' => __( 'End Date', 'woo_ce' )
48
- );
49
- $fields[] = array(
50
- 'name' => 'trial_end_date',
51
- 'label' => __( 'Trial End Date', 'woo_ce' )
52
- );
53
- $fields[] = array(
54
- 'name' => 'last_payment',
55
- 'label' => __( 'Last Payment', 'woo_ce' )
56
- );
57
- $fields[] = array(
58
- 'name' => 'next_payment',
59
- 'label' => __( 'Next Payment', 'woo_ce' )
60
- );
61
- $fields[] = array(
62
- 'name' => 'renewals',
63
- 'label' => __( 'Renewals', 'woo_ce' )
64
- );
65
- $fields[] = array(
66
- 'name' => 'product_id',
67
- 'label' => __( 'Product ID', 'woo_ce' )
68
- );
69
- $fields[] = array(
70
- 'name' => 'product_sku',
71
- 'label' => __( 'Product SKU', 'woo_ce' )
72
- );
73
- $fields[] = array(
74
- 'name' => 'variation_id',
75
- 'label' => __( 'Variation ID', 'woo_ce' )
76
- );
77
- $fields[] = array(
78
- 'name' => 'coupon',
79
- 'label' => __( 'Coupon Code', 'woo_ce' )
80
- );
81
- /*
82
- $fields[] = array(
83
- 'name' => '',
84
- 'label' => __( '', 'woo_ce' )
85
- );
86
- */
87
-
88
- // Allow Plugin/Theme authors to add support for additional Subscription columns
89
- $fields = apply_filters( 'woo_ce_subscription_fields', $fields );
90
-
91
- switch( $format ) {
92
-
93
- case 'summary':
94
- $output = array();
95
- $size = count( $fields );
96
- for( $i = 0; $i < $size; $i++ )
97
- $output[$fields[$i]['name']] = 'on';
98
- return $output;
99
- break;
100
-
101
- case 'full':
102
- default:
103
- return $fields;
104
- break;
105
-
106
- }
107
-
108
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/{tags.php → tag.php} RENAMED
@@ -3,57 +3,29 @@ if( is_admin() ) {
3
 
4
  /* Start of: WordPress Administration */
5
 
6
- // HTML template for Tag Sorting widget on Store Exporter screen
7
- function woo_ce_tag_order_sorting() {
8
-
9
- $tag_orderby = woo_ce_get_option( 'tag_orderby', 'ID' );
10
- $tag_order = woo_ce_get_option( 'tag_order', 'DESC' );
11
-
12
- ob_start(); ?>
13
- <p><label><?php _e( 'Product Tag Sorting', 'woo_ce' ); ?></label></p>
14
- <div>
15
- <select name="tag_orderby">
16
- <option value="id"<?php selected( 'id', $tag_orderby ); ?>><?php _e( 'Term ID', 'woo_ce' ); ?></option>
17
- <option value="name"<?php selected( 'name', $tag_orderby ); ?>><?php _e( 'Tag Name', 'woo_ce' ); ?></option>
18
- </select>
19
- <select name="tag_order">
20
- <option value="ASC"<?php selected( 'ASC', $tag_order ); ?>><?php _e( 'Ascending', 'woo_ce' ); ?></option>
21
- <option value="DESC"<?php selected( 'DESC', $tag_order ); ?>><?php _e( 'Descending', 'woo_ce' ); ?></option>
22
- </select>
23
- <p class="description"><?php _e( 'Select the sorting of Product Tags within the exported file. By default this is set to export Product Tags by Term ID in Desending order.', 'woo_ce' ); ?></p>
24
- </div>
25
- <?php
26
- ob_end_flush();
27
 
 
28
  }
29
 
30
  /* End of: WordPress Administration */
31
 
32
  }
33
 
34
- // Returns a list of WooCommerce Product Tags to export process
35
- function woo_ce_get_product_tags( $args = array() ) {
36
-
37
- $term_taxonomy = 'product_tag';
38
- $defaults = array(
39
- 'orderby' => 'name',
40
- 'order' => 'ASC',
41
- 'hide_empty' => 0
42
- );
43
- $args = wp_parse_args( $args, $defaults );
44
- $tags = get_terms( $term_taxonomy, $args );
45
- if( !empty( $tags ) && is_wp_error( $tags ) == false ) {
46
- $size = count( $tags );
47
- for( $i = 0; $i < $size; $i++ ) {
48
- $tags[$i]->disabled = 0;
49
- if( $tags[$i]->count == 0 )
50
- $tags[$i]->disabled = 1;
51
- }
52
- return $tags;
53
- }
54
-
55
- }
56
-
57
  // Returns a list of Product Tag export columns
58
  function woo_ce_get_tag_fields( $format = 'full' ) {
59
 
@@ -62,21 +34,21 @@ function woo_ce_get_tag_fields( $format = 'full' ) {
62
  $fields = array();
63
  $fields[] = array(
64
  'name' => 'term_id',
65
- 'label' => __( 'Term ID', 'woo_ce' )
66
  );
67
  $fields[] = array(
68
  'name' => 'name',
69
- 'label' => __( 'Tag Name', 'woo_ce' )
70
  );
71
  $fields[] = array(
72
  'name' => 'slug',
73
- 'label' => __( 'Tag Slug', 'woo_ce' )
74
  );
75
 
76
  /*
77
  $fields[] = array(
78
  'name' => '',
79
- 'label' => __( '', 'woo_ce' )
80
  );
81
  */
82
 
@@ -110,9 +82,13 @@ function woo_ce_get_tag_fields( $format = 'full' ) {
110
  default:
111
  $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
112
  $size = count( $fields );
113
- for( $i = 0; $i < $size; $i++ )
 
114
  $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
115
- usort( $fields, woo_ce_sort_fields( 'order' ) );
 
 
 
116
  return $fields;
117
  break;
118
 
@@ -134,6 +110,29 @@ function woo_ce_override_tag_field_labels( $fields = array() ) {
134
  }
135
  add_filter( 'woo_ce_tag_fields', 'woo_ce_override_tag_field_labels', 11 );
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  // Returns the export column header label based on an export column slug
138
  function woo_ce_get_tag_field( $name = null, $format = 'name' ) {
139
 
3
 
4
  /* Start of: WordPress Administration */
5
 
6
+ if( !function_exists( 'woo_ce_get_export_type_tag_count' ) ) {
7
+ function woo_ce_get_export_type_tag_count() {
8
+
9
+ $count = 0;
10
+ // Check if the existing Transient exists
11
+ $cached = get_transient( WOO_CE_PREFIX . '_tag_count' );
12
+ if( $cached == false ) {
13
+ $term_taxonomy = 'product_tag';
14
+ if( taxonomy_exists( $term_taxonomy ) )
15
+ $count = wp_count_terms( $term_taxonomy );
16
+ set_transient( WOO_CE_PREFIX . '_tag_count', $count, HOUR_IN_SECONDS );
17
+ } else {
18
+ $count = $cached;
19
+ }
20
+ return $count;
 
 
 
 
 
 
21
 
22
+ }
23
  }
24
 
25
  /* End of: WordPress Administration */
26
 
27
  }
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  // Returns a list of Product Tag export columns
30
  function woo_ce_get_tag_fields( $format = 'full' ) {
31
 
34
  $fields = array();
35
  $fields[] = array(
36
  'name' => 'term_id',
37
+ 'label' => __( 'Term ID', 'woocommerce-exporter' )
38
  );
39
  $fields[] = array(
40
  'name' => 'name',
41
+ 'label' => __( 'Tag Name', 'woocommerce-exporter' )
42
  );
43
  $fields[] = array(
44
  'name' => 'slug',
45
+ 'label' => __( 'Tag Slug', 'woocommerce-exporter' )
46
  );
47
 
48
  /*
49
  $fields[] = array(
50
  'name' => '',
51
+ 'label' => __( '', 'woocommerce-exporter' )
52
  );
53
  */
54
 
82
  default:
83
  $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
84
  $size = count( $fields );
85
+ for( $i = 0; $i < $size; $i++ ) {
86
+ $fields[$i]['reset'] = $i;
87
  $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
88
+ }
89
+ // Check if we are using PHP 5.3 and above
90
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
91
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
92
  return $fields;
93
  break;
94
 
110
  }
111
  add_filter( 'woo_ce_tag_fields', 'woo_ce_override_tag_field_labels', 11 );
112
 
113
+ // Returns a list of WooCommerce Product Tags to export process
114
+ function woo_ce_get_product_tags( $args = array() ) {
115
+
116
+ $term_taxonomy = 'product_tag';
117
+ $defaults = array(
118
+ 'orderby' => 'name',
119
+ 'order' => 'ASC',
120
+ 'hide_empty' => 0
121
+ );
122
+ $args = wp_parse_args( $args, $defaults );
123
+ $tags = get_terms( $term_taxonomy, $args );
124
+ if( !empty( $tags ) && is_wp_error( $tags ) == false ) {
125
+ $size = count( $tags );
126
+ for( $i = 0; $i < $size; $i++ ) {
127
+ $tags[$i]->disabled = 0;
128
+ if( $tags[$i]->count == 0 )
129
+ $tags[$i]->disabled = 1;
130
+ }
131
+ return $tags;
132
+ }
133
+
134
+ }
135
+
136
  // Returns the export column header label based on an export column slug
137
  function woo_ce_get_tag_field( $name = null, $format = 'name' ) {
138
 
includes/user-extend.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Adds custom User columns to the User fields list
3
+ function woo_ce_extend_user_fields( $fields = array() ) {
4
+
5
+ // WooCommerce Hear About Us - https://wordpress.org/plugins/woocommerce-hear-about-us/
6
+ if( class_exists( 'WooCommerce_HearAboutUs' ) ) {
7
+ $fields[] = array(
8
+ 'name' => 'hear_about_us',
9
+ 'label' => __( 'Source', 'woocommerce-exporter' ),
10
+ 'hover' => __( 'WooCommerce Hear About Us', 'woocommerce-exporter' ),
11
+ 'disabled' => 1
12
+ );
13
+ }
14
+
15
+ // WooCommerce User fields
16
+ if( class_exists( 'WC_Admin_Profile' ) ) {
17
+ $admin_profile = new WC_Admin_Profile();
18
+ if( method_exists( 'WC_Admin_Profile', 'get_customer_meta_fields' ) ) {
19
+ $show_fields = $admin_profile->get_customer_meta_fields();
20
+ foreach( $show_fields as $fieldset ) {
21
+ foreach( $fieldset['fields'] as $key => $field ) {
22
+ $fields[] = array(
23
+ 'name' => $key,
24
+ 'label' => sprintf( apply_filters( 'woo_ce_extend_user_fields_wc', '%s: %s' ), $fieldset['title'], esc_html( $field['label'] ) ),
25
+ 'disabled' => 1
26
+ );
27
+ }
28
+ }
29
+ unset( $show_fields, $fieldset, $field );
30
+ }
31
+ }
32
+
33
+ // WC Vendors - http://wcvendors.com
34
+ if( class_exists( 'WC_Vendors' ) ) {
35
+ $fields[] = array(
36
+ 'name' => 'shop_name',
37
+ 'label' => __( 'Shop Name' ),
38
+ 'hover' => __( 'WC Vendors', 'woocommerce-exporter' ),
39
+ 'disabled' => 1
40
+ );
41
+ $fields[] = array(
42
+ 'name' => 'shop_slug',
43
+ 'label' => __( 'Shop Slug' ),
44
+ 'hover' => __( 'WC Vendors', 'woocommerce-exporter' ),
45
+ 'disabled' => 1
46
+ );
47
+ $fields[] = array(
48
+ 'name' => 'paypal_email',
49
+ 'label' => __( 'PayPal E-mail' ),
50
+ 'hover' => __( 'WC Vendors', 'woocommerce-exporter' ),
51
+ 'disabled' => 1
52
+ );
53
+ $fields[] = array(
54
+ 'name' => 'commission_rate',
55
+ 'label' => __( 'Commission Rate (%)' ),
56
+ 'hover' => __( 'WC Vendors', 'woocommerce-exporter' ),
57
+ 'disabled' => 1
58
+ );
59
+ $fields[] = array(
60
+ 'name' => 'seller_info',
61
+ 'label' => __( 'Seller Info' ),
62
+ 'hover' => __( 'WC Vendors', 'woocommerce-exporter' ),
63
+ 'disabled' => 1
64
+ );
65
+ $fields[] = array(
66
+ 'name' => 'shop_description',
67
+ 'label' => __( 'Shop Description' ),
68
+ 'hover' => __( 'WC Vendors', 'woocommerce-exporter' ),
69
+ 'disabled' => 1
70
+ );
71
+ }
72
+
73
+ // WooCommerce Subscriptions - http://www.woothemes.com/products/woocommerce-subscriptions/
74
+ if( class_exists( 'WC_Subscriptions_Manager' ) ) {
75
+ $fields[] = array(
76
+ 'name' => 'active_subscriber',
77
+ 'label' => __( 'Active Subscriber' ),
78
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
79
+ 'disabled' => 1
80
+ );
81
+ }
82
+
83
+ // Custom User meta
84
+ $custom_users = woo_ce_get_option( 'custom_users', '' );
85
+ if( !empty( $custom_users ) ) {
86
+ foreach( $custom_users as $custom_user ) {
87
+ if( !empty( $custom_user ) ) {
88
+ $fields[] = array(
89
+ 'name' => $custom_user,
90
+ 'label' => $custom_user,
91
+ 'disabled' => 1
92
+ );
93
+ }
94
+ }
95
+ }
96
+ unset( $custom_users, $custom_user );
97
+
98
+ return $fields;
99
+
100
+ }
101
+ add_filter( 'woo_ce_user_fields', 'woo_ce_extend_user_fields' );
102
+ ?>
includes/{users.php → user.php} RENAMED
@@ -3,35 +3,22 @@ if( is_admin() ) {
3
 
4
  /* Start of: WordPress Administration */
5
 
6
- // HTML template for User Sorting widget on Store Exporter screen
7
- function woo_ce_users_user_sorting() {
8
-
9
- $orderby = woo_ce_get_option( 'user_orderby', 'ID' );
10
- $order = woo_ce_get_option( 'user_order', 'ASC' );
11
-
12
- ob_start(); ?>
13
- <p><label><?php _e( 'User Sorting', 'woo_ce' ); ?></label></p>
14
- <div>
15
- <select name="user_orderby">
16
- <option value="ID"<?php selected( 'ID', $orderby ); ?>><?php _e( 'User ID', 'woo_ce' ); ?></option>
17
- <option value="display_name"<?php selected( 'display_name', $orderby ); ?>><?php _e( 'Display Name', 'woo_ce' ); ?></option>
18
- <option value="user_name"<?php selected( 'user_name', $orderby ); ?>><?php _e( 'Name', 'woo_ce' ); ?></option>
19
- <option value="user_login"<?php selected( 'user_login', $orderby ); ?>><?php _e( 'Username', 'woo_ce' ); ?></option>
20
- <option value="nicename"<?php selected( 'nicename', $orderby ); ?>><?php _e( 'Nickname', 'woo_ce' ); ?></option>
21
- <option value="email"<?php selected( 'email', $orderby ); ?>><?php _e( 'E-mail', 'woo_ce' ); ?></option>
22
- <option value="url"<?php selected( 'url', $orderby ); ?>><?php _e( 'Website', 'woo_ce' ); ?></option>
23
- <option value="registered"<?php selected( 'registered', $orderby ); ?>><?php _e( 'Date Registered', 'woo_ce' ); ?></option>
24
- <option value="rand"<?php selected( 'rand', $orderby ); ?>><?php _e( 'Random', 'woo_ce' ); ?></option>
25
- </select>
26
- <select name="user_order">
27
- <option value="ASC"<?php selected( 'ASC', $order ); ?>><?php _e( 'Ascending', 'woo_ce' ); ?></option>
28
- <option value="DESC"<?php selected( 'DESC', $order ); ?>><?php _e( 'Descending', 'woo_ce' ); ?></option>
29
- </select>
30
- <p class="description"><?php _e( 'Select the sorting of Users within the exported file. By default this is set to export User by User ID in Desending order.', 'woo_ce' ); ?></p>
31
- </div>
32
- <?php
33
- ob_end_flush();
34
 
 
35
  }
36
 
37
  /* End of: WordPress Administration */
@@ -46,61 +33,79 @@ function woo_ce_get_user_fields( $format = 'full' ) {
46
  $fields = array();
47
  $fields[] = array(
48
  'name' => 'user_id',
49
- 'label' => __( 'User ID', 'woo_ce' )
50
  );
51
  $fields[] = array(
52
  'name' => 'user_name',
53
- 'label' => __( 'Username', 'woo_ce' )
54
  );
55
  $fields[] = array(
56
  'name' => 'user_role',
57
- 'label' => __( 'User Role', 'woo_ce' )
58
  );
59
  $fields[] = array(
60
  'name' => 'first_name',
61
- 'label' => __( 'First Name', 'woo_ce' )
62
  );
63
  $fields[] = array(
64
  'name' => 'last_name',
65
- 'label' => __( 'Last Name', 'woo_ce' )
66
  );
67
  $fields[] = array(
68
  'name' => 'full_name',
69
- 'label' => __( 'Full Name', 'woo_ce' )
70
  );
71
  $fields[] = array(
72
  'name' => 'nick_name',
73
- 'label' => __( 'Nickname', 'woo_ce' )
74
  );
75
  $fields[] = array(
76
  'name' => 'email',
77
- 'label' => __( 'E-mail', 'woo_ce' )
 
 
 
 
 
 
 
 
 
 
78
  );
79
  $fields[] = array(
80
  'name' => 'url',
81
- 'label' => __( 'Website', 'woo_ce' )
82
  );
83
  $fields[] = array(
84
  'name' => 'date_registered',
85
- 'label' => __( 'Date Registered', 'woo_ce' )
86
  );
87
 
88
  /*
89
  $fields[] = array(
90
  'name' => '',
91
- 'label' => __( '', 'woo_ce' )
92
  );
93
  */
94
 
 
 
 
95
  // Allow Plugin/Theme authors to add support for additional columns
96
- $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
 
 
 
97
 
98
- if( $remember = woo_ce_get_option( $export_type . '_fields', array() ) ) {
 
99
  $remember = maybe_unserialize( $remember );
100
  $size = count( $fields );
101
  for( $i = 0; $i < $size; $i++ ) {
102
  $fields[$i]['disabled'] = ( isset( $fields[$i]['disabled'] ) ? $fields[$i]['disabled'] : 0 );
103
  $fields[$i]['default'] = 1;
 
104
  if( !array_key_exists( $fields[$i]['name'], $remember ) )
105
  $fields[$i]['default'] = 0;
106
  }
@@ -122,9 +127,13 @@ function woo_ce_get_user_fields( $format = 'full' ) {
122
  default:
123
  $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
124
  $size = count( $fields );
125
- for( $i = 0; $i < $size; $i++ )
 
126
  $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
127
- usort( $fields, woo_ce_sort_fields( 'order' ) );
 
 
 
128
  return $fields;
129
  break;
130
 
@@ -132,6 +141,7 @@ function woo_ce_get_user_fields( $format = 'full' ) {
132
 
133
  }
134
 
 
135
  function woo_ce_override_user_field_labels( $fields = array() ) {
136
 
137
  $labels = woo_ce_get_option( 'user_labels', array() );
@@ -174,28 +184,6 @@ function woo_ce_get_user_field( $name = null, $format = 'name' ) {
174
 
175
  }
176
 
177
- // Adds custom User columns to the User fields list
178
- function woo_ce_extend_user_fields( $fields = array() ) {
179
-
180
- if( class_exists( 'WC_Admin_Profile' ) ) {
181
- $admin_profile = new WC_Admin_Profile();
182
- $show_fields = $admin_profile->get_customer_meta_fields();
183
- foreach( $show_fields as $fieldset ) {
184
- foreach( $fieldset['fields'] as $key => $field ) {
185
- $fields[] = array(
186
- 'name' => $key,
187
- 'label' => sprintf( '%s: %s', $fieldset['title'], esc_html( $field['label'] ) ),
188
- 'disabled' => 1
189
- );
190
- }
191
- }
192
- unset( $show_fields, $fieldset, $field );
193
- }
194
- return $fields;
195
-
196
- }
197
- add_filter( 'woo_ce_user_fields', 'woo_ce_extend_user_fields' );
198
-
199
  // Returns a list of User IDs
200
  function woo_ce_get_users( $args = array() ) {
201
 
@@ -247,12 +235,14 @@ function woo_ce_get_user_data( $user_id = 0, $args = array() ) {
247
  $user->user_role = $user_data->roles[0];
248
  $user->first_name = $user_data->first_name;
249
  $user->last_name = $user_data->last_name;
250
- $user->full_name = sprintf( '%s %s', $user->first_name, $user->last_name );
251
  $user->nick_name = $user_data->user_nicename;
252
  $user->email = $user_data->user_email;
253
  $user->url = $user_data->user_url;
254
  $user->date_registered = $user_data->user_registered;
255
  }
 
 
256
  return apply_filters( 'woo_ce_user', $user );
257
 
258
  }
@@ -267,4 +257,19 @@ function woo_ce_get_user_roles() {
267
 
268
  }
269
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  ?>
3
 
4
  /* Start of: WordPress Administration */
5
 
6
+ if( !function_exists( 'woo_ce_get_export_type_user_count' ) ) {
7
+ function woo_ce_get_export_type_user_count() {
8
+
9
+ $count = 0;
10
+ // Check if the existing Transient exists
11
+ $cached = get_transient( WOO_CE_PREFIX . '_user_count' );
12
+ if( $cached == false ) {
13
+ if( $users = count_users() )
14
+ $count = ( isset( $users['total_users'] ) ? $users['total_users'] : 0 );
15
+ set_transient( WOO_CE_PREFIX . '_user_count', $count, HOUR_IN_SECONDS );
16
+ } else {
17
+ $count = $cached;
18
+ }
19
+ return $count;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
+ }
22
  }
23
 
24
  /* End of: WordPress Administration */
33
  $fields = array();
34
  $fields[] = array(
35
  'name' => 'user_id',
36
+ 'label' => __( 'User ID', 'woocommerce-exporter' )
37
  );
38
  $fields[] = array(
39
  'name' => 'user_name',
40
+ 'label' => __( 'Username', 'woocommerce-exporter' )
41
  );
42
  $fields[] = array(
43
  'name' => 'user_role',
44
+ 'label' => __( 'User Role', 'woocommerce-exporter' )
45
  );
46
  $fields[] = array(
47
  'name' => 'first_name',
48
+ 'label' => __( 'First Name', 'woocommerce-exporter' )
49
  );
50
  $fields[] = array(
51
  'name' => 'last_name',
52
+ 'label' => __( 'Last Name', 'woocommerce-exporter' )
53
  );
54
  $fields[] = array(
55
  'name' => 'full_name',
56
+ 'label' => __( 'Full Name', 'woocommerce-exporter' )
57
  );
58
  $fields[] = array(
59
  'name' => 'nick_name',
60
+ 'label' => __( 'Nickname', 'woocommerce-exporter' )
61
  );
62
  $fields[] = array(
63
  'name' => 'email',
64
+ 'label' => __( 'E-mail', 'woocommerce-exporter' )
65
+ );
66
+ $fields[] = array(
67
+ 'name' => 'orders',
68
+ 'label' => __( 'Orders', 'woocommerce-exporter' ),
69
+ 'disabled' => 1
70
+ );
71
+ $fields[] = array(
72
+ 'name' => 'money_spent',
73
+ 'label' => __( 'Money Spent', 'woocommerce-exporter' ),
74
+ 'disabled' => 1
75
  );
76
  $fields[] = array(
77
  'name' => 'url',
78
+ 'label' => __( 'Website', 'woocommerce-exporter' )
79
  );
80
  $fields[] = array(
81
  'name' => 'date_registered',
82
+ 'label' => __( 'Date Registered', 'woocommerce-exporter' )
83
  );
84
 
85
  /*
86
  $fields[] = array(
87
  'name' => '',
88
+ 'label' => __( '', 'woocommerce-exporter' )
89
  );
90
  */
91
 
92
+ // Drop in our content filters here
93
+ add_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
94
+
95
  // Allow Plugin/Theme authors to add support for additional columns
96
+ $fields = apply_filters( sprintf( WOO_CE_PREFIX . '_%s_fields', $export_type ), $fields, $export_type );
97
+
98
+ // Remove our content filters here to play nice with other Plugins
99
+ remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
100
 
101
+ $remember = woo_ce_get_option( $export_type . '_fields', array() );
102
+ if( !empty( $remember ) ) {
103
  $remember = maybe_unserialize( $remember );
104
  $size = count( $fields );
105
  for( $i = 0; $i < $size; $i++ ) {
106
  $fields[$i]['disabled'] = ( isset( $fields[$i]['disabled'] ) ? $fields[$i]['disabled'] : 0 );
107
  $fields[$i]['default'] = 1;
108
+ // If not found turn off default
109
  if( !array_key_exists( $fields[$i]['name'], $remember ) )
110
  $fields[$i]['default'] = 0;
111
  }
127
  default:
128
  $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
129
  $size = count( $fields );
130
+ for( $i = 0; $i < $size; $i++ ) {
131
+ $fields[$i]['reset'] = $i;
132
  $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
133
+ }
134
+ // Check if we are using PHP 5.3 and above
135
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
136
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
137
  return $fields;
138
  break;
139
 
141
 
142
  }
143
 
144
+ // Check if we should override field labels from the Field Editor
145
  function woo_ce_override_user_field_labels( $fields = array() ) {
146
 
147
  $labels = woo_ce_get_option( 'user_labels', array() );
184
 
185
  }
186
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  // Returns a list of User IDs
188
  function woo_ce_get_users( $args = array() ) {
189
 
235
  $user->user_role = $user_data->roles[0];
236
  $user->first_name = $user_data->first_name;
237
  $user->last_name = $user_data->last_name;
238
+ $user->full_name = sprintf( apply_filters( 'woo_ce_get_user_data_full_name', '%s %s' ), $user->first_name, $user->last_name );
239
  $user->nick_name = $user_data->user_nicename;
240
  $user->email = $user_data->user_email;
241
  $user->url = $user_data->user_url;
242
  $user->date_registered = $user_data->user_registered;
243
  }
244
+
245
+ // Allow Plugin/Theme authors to add support for additional User columns
246
  return apply_filters( 'woo_ce_user', $user );
247
 
248
  }
257
 
258
  }
259
 
260
+ function woo_ce_format_user_role_label( $user_role = '' ) {
261
+
262
+ global $wp_roles;
263
+
264
+ $output = $user_role;
265
+ if( $user_role ) {
266
+ $user_roles = woo_ce_get_user_roles();
267
+ if( isset( $user_roles[$user_role] ) )
268
+ $output = ucfirst( $user_roles[$user_role]['name'] );
269
+ unset( $user_roles );
270
+ }
271
+ return $output;
272
+
273
+ }
274
+
275
  ?>
js/chosen.jquery.js ADDED
@@ -0,0 +1,988 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Chosen, a Select Box Enhancer for jQuery and Protoype
2
+ // by Patrick Filler for Harvest, http://getharvest.com
3
+ //
4
+ // Version 0.9.8
5
+ // Full source at https://github.com/harvesthq/chosen
6
+ // Copyright (c) 2011 Harvest http://getharvest.com
7
+
8
+ // MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
9
+ // This file is generated by `cake build`, do not edit it by hand.
10
+ (function() {
11
+ var SelectParser;
12
+
13
+ SelectParser = (function() {
14
+
15
+ function SelectParser() {
16
+ this.options_index = 0;
17
+ this.parsed = [];
18
+ }
19
+
20
+ SelectParser.prototype.add_node = function(child) {
21
+ if (child.nodeName === "OPTGROUP") {
22
+ return this.add_group(child);
23
+ } else {
24
+ return this.add_option(child);
25
+ }
26
+ };
27
+
28
+ SelectParser.prototype.add_group = function(group) {
29
+ var group_position, option, _i, _len, _ref, _results;
30
+ group_position = this.parsed.length;
31
+ this.parsed.push({
32
+ array_index: group_position,
33
+ group: true,
34
+ label: group.label,
35
+ children: 0,
36
+ disabled: group.disabled
37
+ });
38
+ _ref = group.childNodes;
39
+ _results = [];
40
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
41
+ option = _ref[_i];
42
+ _results.push(this.add_option(option, group_position, group.disabled));
43
+ }
44
+ return _results;
45
+ };
46
+
47
+ SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
48
+ if (option.nodeName === "OPTION") {
49
+ if (option.text !== "") {
50
+ if (group_position != null) this.parsed[group_position].children += 1;
51
+ this.parsed.push({
52
+ array_index: this.parsed.length,
53
+ options_index: this.options_index,
54
+ value: option.value,
55
+ text: option.text,
56
+ html: option.innerHTML,
57
+ selected: option.selected,
58
+ disabled: group_disabled === true ? group_disabled : option.disabled,
59
+ group_array_index: group_position,
60
+ classes: option.className,
61
+ style: option.style.cssText
62
+ });
63
+ } else {
64
+ this.parsed.push({
65
+ array_index: this.parsed.length,
66
+ options_index: this.options_index,
67
+ empty: true
68
+ });
69
+ }
70
+ return this.options_index += 1;
71
+ }
72
+ };
73
+
74
+ return SelectParser;
75
+
76
+ })();
77
+
78
+ SelectParser.select_to_array = function(select) {
79
+ var child, parser, _i, _len, _ref;
80
+ parser = new SelectParser();
81
+ _ref = select.childNodes;
82
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
83
+ child = _ref[_i];
84
+ parser.add_node(child);
85
+ }
86
+ return parser.parsed;
87
+ };
88
+
89
+ this.SelectParser = SelectParser;
90
+
91
+ }).call(this);
92
+
93
+ /*
94
+ Chosen source: generate output using 'cake build'
95
+ Copyright (c) 2011 by Harvest
96
+ */
97
+
98
+ (function() {
99
+ var AbstractChosen, root;
100
+
101
+ root = this;
102
+
103
+ AbstractChosen = (function() {
104
+
105
+ function AbstractChosen(form_field, options) {
106
+ this.form_field = form_field;
107
+ this.options = options != null ? options : {};
108
+ this.set_default_values();
109
+ this.is_multiple = this.form_field.multiple;
110
+ this.set_default_text();
111
+ this.setup();
112
+ this.set_up_html();
113
+ this.register_observers();
114
+ this.finish_setup();
115
+ }
116
+
117
+ AbstractChosen.prototype.set_default_values = function() {
118
+ var _this = this;
119
+ this.click_test_action = function(evt) {
120
+ return _this.test_active_click(evt);
121
+ };
122
+ this.activate_action = function(evt) {
123
+ return _this.activate_field(evt);
124
+ };
125
+ this.active_field = false;
126
+ this.mouse_on_container = false;
127
+ this.results_showing = false;
128
+ this.result_highlighted = null;
129
+ this.result_single_selected = null;
130
+ this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
131
+ this.disable_search_threshold = this.options.disable_search_threshold || 0;
132
+ this.search_contains = this.options.search_contains || false;
133
+ this.choices = 0;
134
+ return this.max_selected_options = this.options.max_selected_options || Infinity;
135
+ };
136
+
137
+ AbstractChosen.prototype.set_default_text = function() {
138
+ if (this.form_field.getAttribute("data-placeholder")) {
139
+ this.default_text = this.form_field.getAttribute("data-placeholder");
140
+ } else if (this.is_multiple) {
141
+ this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || "Select Some Options";
142
+ } else {
143
+ this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || "Select an Option";
144
+ }
145
+ return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || "No results match";
146
+ };
147
+
148
+ AbstractChosen.prototype.mouse_enter = function() {
149
+ return this.mouse_on_container = true;
150
+ };
151
+
152
+ AbstractChosen.prototype.mouse_leave = function() {
153
+ return this.mouse_on_container = false;
154
+ };
155
+
156
+ AbstractChosen.prototype.input_focus = function(evt) {
157
+ var _this = this;
158
+ if (!this.active_field) {
159
+ return setTimeout((function() {
160
+ return _this.container_mousedown();
161
+ }), 50);
162
+ }
163
+ };
164
+
165
+ AbstractChosen.prototype.input_blur = function(evt) {
166
+ var _this = this;
167
+ if (!this.mouse_on_container) {
168
+ this.active_field = false;
169
+ return setTimeout((function() {
170
+ return _this.blur_test();
171
+ }), 100);
172
+ }
173
+ };
174
+
175
+ AbstractChosen.prototype.result_add_option = function(option) {
176
+ var classes, style;
177
+ if (!option.disabled) {
178
+ option.dom_id = this.container_id + "_o_" + option.array_index;
179
+ classes = option.selected && this.is_multiple ? [] : ["active-result"];
180
+ if (option.selected) classes.push("result-selected");
181
+ if (option.group_array_index != null) classes.push("group-option");
182
+ if (option.classes !== "") classes.push(option.classes);
183
+ style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : "";
184
+ return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '"' + style + '>' + option.html + '</li>';
185
+ } else {
186
+ return "";
187
+ }
188
+ };
189
+
190
+ AbstractChosen.prototype.results_update_field = function() {
191
+ this.results_reset();
192
+ this.result_clear_highlight();
193
+ this.result_single_selected = null;
194
+ return this.results_build();
195
+ };
196
+
197
+ AbstractChosen.prototype.results_toggle = function() {
198
+ if (this.results_showing) {
199
+ return this.results_hide();
200
+ } else {
201
+ return this.results_show();
202
+ }
203
+ };
204
+
205
+ AbstractChosen.prototype.results_search = function(evt) {
206
+ if (this.results_showing) {
207
+ return this.winnow_results();
208
+ } else {
209
+ return this.results_show();
210
+ }
211
+ };
212
+
213
+ AbstractChosen.prototype.keyup_checker = function(evt) {
214
+ var stroke, _ref;
215
+ stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
216
+ this.search_field_scale();
217
+ switch (stroke) {
218
+ case 8:
219
+ if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) {
220
+ return this.keydown_backstroke();
221
+ } else if (!this.pending_backstroke) {
222
+ this.result_clear_highlight();
223
+ return this.results_search();
224
+ }
225
+ break;
226
+ case 13:
227
+ evt.preventDefault();
228
+ if (this.results_showing) return this.result_select(evt);
229
+ break;
230
+ case 27:
231
+ if (this.results_showing) this.results_hide();
232
+ return true;
233
+ case 9:
234
+ case 38:
235
+ case 40:
236
+ case 16:
237
+ case 91:
238
+ case 17:
239
+ break;
240
+ default:
241
+ return this.results_search();
242
+ }
243
+ };
244
+
245
+ AbstractChosen.prototype.generate_field_id = function() {
246
+ var new_id;
247
+ new_id = this.generate_random_id();
248
+ this.form_field.id = new_id;
249
+ return new_id;
250
+ };
251
+
252
+ AbstractChosen.prototype.generate_random_char = function() {
253
+ var chars, newchar, rand;
254
+ chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
255
+ rand = Math.floor(Math.random() * chars.length);
256
+ return newchar = chars.substring(rand, rand + 1);
257
+ };
258
+
259
+ return AbstractChosen;
260
+
261
+ })();
262
+
263
+ root.AbstractChosen = AbstractChosen;
264
+
265
+ }).call(this);
266
+
267
+ /*
268
+ Chosen source: generate output using 'cake build'
269
+ Copyright (c) 2011 by Harvest
270
+ */
271
+
272
+ (function() {
273
+ var $, Chosen, get_side_border_padding, root,
274
+ __hasProp = Object.prototype.hasOwnProperty,
275
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
276
+
277
+ root = this;
278
+
279
+ $ = jQuery;
280
+
281
+ $.fn.extend({
282
+ chosen: function(options) {
283
+ if ($.browser.msie && ($.browser.version === "6.0" || $.browser.version === "7.0")) {
284
+ return this;
285
+ }
286
+ return this.each(function(input_field) {
287
+ var $this;
288
+ $this = $(this);
289
+ if (!$this.hasClass("chzn-done")) {
290
+ return $this.data('chosen', new Chosen(this, options));
291
+ }
292
+ });
293
+ }
294
+ });
295
+
296
+ Chosen = (function(_super) {
297
+
298
+ __extends(Chosen, _super);
299
+
300
+ function Chosen() {
301
+ Chosen.__super__.constructor.apply(this, arguments);
302
+ }
303
+
304
+ Chosen.prototype.setup = function() {
305
+ this.form_field_jq = $(this.form_field);
306
+ return this.is_rtl = this.form_field_jq.hasClass("chzn-rtl");
307
+ };
308
+
309
+ Chosen.prototype.finish_setup = function() {
310
+ return this.form_field_jq.addClass("chzn-done");
311
+ };
312
+
313
+ Chosen.prototype.set_up_html = function() {
314
+ var container_div, dd_top, dd_width, sf_width;
315
+ this.container_id = this.form_field.id.length ? this.form_field.id.replace(/[^\w]/g, '_') : this.generate_field_id();
316
+ this.container_id += "_chzn";
317
+ this.f_width = this.form_field_jq.outerWidth();
318
+ container_div = $("<div />", {
319
+ id: this.container_id,
320
+ "class": "chzn-container" + (this.is_rtl ? ' chzn-rtl' : ''),
321
+ style: 'width: ' + this.f_width + 'px;'
322
+ });
323
+ if (this.is_multiple) {
324
+ container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
325
+ } else {
326
+ container_div.html('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
327
+ }
328
+ this.form_field_jq.hide().after(container_div);
329
+ this.container = $('#' + this.container_id);
330
+ this.container.addClass("chzn-container-" + (this.is_multiple ? "multi" : "single"));
331
+ this.dropdown = this.container.find('div.chzn-drop').first();
332
+ dd_top = this.container.height();
333
+ dd_width = this.f_width - get_side_border_padding(this.dropdown);
334
+ this.dropdown.css({
335
+ "width": dd_width + "px",
336
+ "top": dd_top + "px"
337
+ });
338
+ this.search_field = this.container.find('input').first();
339
+ this.search_results = this.container.find('ul.chzn-results').first();
340
+ this.search_field_scale();
341
+ this.search_no_results = this.container.find('li.no-results').first();
342
+ if (this.is_multiple) {
343
+ this.search_choices = this.container.find('ul.chzn-choices').first();
344
+ this.search_container = this.container.find('li.search-field').first();
345
+ } else {
346
+ this.search_container = this.container.find('div.chzn-search').first();
347
+ this.selected_item = this.container.find('.chzn-single').first();
348
+ sf_width = dd_width - get_side_border_padding(this.search_container) - get_side_border_padding(this.search_field);
349
+ this.search_field.css({
350
+ "width": sf_width + "px"
351
+ });
352
+ }
353
+ this.results_build();
354
+ this.set_tab_index();
355
+ return this.form_field_jq.trigger("liszt:ready", {
356
+ chosen: this
357
+ });
358
+ };
359
+
360
+ Chosen.prototype.register_observers = function() {
361
+ var _this = this;
362
+ this.container.mousedown(function(evt) {
363
+ return _this.container_mousedown(evt);
364
+ });
365
+ this.container.mouseup(function(evt) {
366
+ return _this.container_mouseup(evt);
367
+ });
368
+ this.container.mouseenter(function(evt) {
369
+ return _this.mouse_enter(evt);
370
+ });
371
+ this.container.mouseleave(function(evt) {
372
+ return _this.mouse_leave(evt);
373
+ });
374
+ this.search_results.mouseup(function(evt) {
375
+ return _this.search_results_mouseup(evt);
376
+ });
377
+ this.search_results.mouseover(function(evt) {
378
+ return _this.search_results_mouseover(evt);
379
+ });
380
+ this.search_results.mouseout(function(evt) {
381
+ return _this.search_results_mouseout(evt);
382
+ });
383
+ this.form_field_jq.bind("liszt:updated", function(evt) {
384
+ return _this.results_update_field(evt);
385
+ });
386
+ this.search_field.blur(function(evt) {
387
+ return _this.input_blur(evt);
388
+ });
389
+ this.search_field.keyup(function(evt) {
390
+ return _this.keyup_checker(evt);
391
+ });
392
+ this.search_field.keydown(function(evt) {
393
+ return _this.keydown_checker(evt);
394
+ });
395
+ if (this.is_multiple) {
396
+ this.search_choices.click(function(evt) {
397
+ return _this.choices_click(evt);
398
+ });
399
+ return this.search_field.focus(function(evt) {
400
+ return _this.input_focus(evt);
401
+ });
402
+ } else {
403
+ return this.container.click(function(evt) {
404
+ return evt.preventDefault();
405
+ });
406
+ }
407
+ };
408
+
409
+ Chosen.prototype.search_field_disabled = function() {
410
+ this.is_disabled = this.form_field_jq[0].disabled;
411
+ if (this.is_disabled) {
412
+ this.container.addClass('chzn-disabled');
413
+ this.search_field[0].disabled = true;
414
+ if (!this.is_multiple) {
415
+ this.selected_item.unbind("focus", this.activate_action);
416
+ }
417
+ return this.close_field();
418
+ } else {
419
+ this.container.removeClass('chzn-disabled');
420
+ this.search_field[0].disabled = false;
421
+ if (!this.is_multiple) {
422
+ return this.selected_item.bind("focus", this.activate_action);
423
+ }
424
+ }
425
+ };
426
+
427
+ Chosen.prototype.container_mousedown = function(evt) {
428
+ var target_closelink;
429
+ if (!this.is_disabled) {
430
+ target_closelink = evt != null ? ($(evt.target)).hasClass("search-choice-close") : false;
431
+ if (evt && evt.type === "mousedown" && !this.results_showing) {
432
+ evt.stopPropagation();
433
+ }
434
+ if (!this.pending_destroy_click && !target_closelink) {
435
+ if (!this.active_field) {
436
+ if (this.is_multiple) this.search_field.val("");
437
+ $(document).click(this.click_test_action);
438
+ this.results_show();
439
+ } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chzn-single").length)) {
440
+ evt.preventDefault();
441
+ this.results_toggle();
442
+ }
443
+ return this.activate_field();
444
+ } else {
445
+ return this.pending_destroy_click = false;
446
+ }
447
+ }
448
+ };
449
+
450
+ Chosen.prototype.container_mouseup = function(evt) {
451
+ if (evt.target.nodeName === "ABBR") return this.results_reset(evt);
452
+ };
453
+
454
+ Chosen.prototype.blur_test = function(evt) {
455
+ if (!this.active_field && this.container.hasClass("chzn-container-active")) {
456
+ return this.close_field();
457
+ }
458
+ };
459
+
460
+ Chosen.prototype.close_field = function() {
461
+ $(document).unbind("click", this.click_test_action);
462
+ if (!this.is_multiple) {
463
+ this.selected_item.attr("tabindex", this.search_field.attr("tabindex"));
464
+ this.search_field.attr("tabindex", -1);
465
+ }
466
+ this.active_field = false;
467
+ this.results_hide();
468
+ this.container.removeClass("chzn-container-active");
469
+ this.winnow_results_clear();
470
+ this.clear_backstroke();
471
+ this.show_search_field_default();
472
+ return this.search_field_scale();
473
+ };
474
+
475
+ Chosen.prototype.activate_field = function() {
476
+ if (!this.is_multiple && !this.active_field) {
477
+ this.search_field.attr("tabindex", this.selected_item.attr("tabindex"));
478
+ this.selected_item.attr("tabindex", -1);
479
+ }
480
+ this.container.addClass("chzn-container-active");
481
+ this.active_field = true;
482
+ this.search_field.val(this.search_field.val());
483
+ return this.search_field.focus();
484
+ };
485
+
486
+ Chosen.prototype.test_active_click = function(evt) {
487
+ if ($(evt.target).parents('#' + this.container_id).length) {
488
+ return this.active_field = true;
489
+ } else {
490
+ return this.close_field();
491
+ }
492
+ };
493
+
494
+ Chosen.prototype.results_build = function() {
495
+ var content, data, _i, _len, _ref;
496
+ this.parsing = true;
497
+ this.results_data = root.SelectParser.select_to_array(this.form_field);
498
+ if (this.is_multiple && this.choices > 0) {
499
+ this.search_choices.find("li.search-choice").remove();
500
+ this.choices = 0;
501
+ } else if (!this.is_multiple) {
502
+ this.selected_item.find("span").text(this.default_text);
503
+ if (this.form_field.options.length <= this.disable_search_threshold) {
504
+ this.container.addClass("chzn-container-single-nosearch");
505
+ } else {
506
+ this.container.removeClass("chzn-container-single-nosearch");
507
+ }
508
+ }
509
+ content = '';
510
+ _ref = this.results_data;
511
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
512
+ data = _ref[_i];
513
+ if (data.group) {
514
+ content += this.result_add_group(data);
515
+ } else if (!data.empty) {
516
+ content += this.result_add_option(data);
517
+ if (data.selected && this.is_multiple) {
518
+ this.choice_build(data);
519
+ } else if (data.selected && !this.is_multiple) {
520
+ this.selected_item.removeClass("chzn-default").find("span").text(data.text);
521
+ if (this.allow_single_deselect) this.single_deselect_control_build();
522
+ }
523
+ }
524
+ }
525
+ this.search_field_disabled();
526
+ this.show_search_field_default();
527
+ this.search_field_scale();
528
+ this.search_results.html(content);
529
+ return this.parsing = false;
530
+ };
531
+
532
+ Chosen.prototype.result_add_group = function(group) {
533
+ if (!group.disabled) {
534
+ group.dom_id = this.container_id + "_g_" + group.array_index;
535
+ return '<li id="' + group.dom_id + '" class="group-result">' + $("<div />").text(group.label).html() + '</li>';
536
+ } else {
537
+ return "";
538
+ }
539
+ };
540
+
541
+ Chosen.prototype.result_do_highlight = function(el) {
542
+ var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
543
+ if (el.length) {
544
+ this.result_clear_highlight();
545
+ this.result_highlight = el;
546
+ this.result_highlight.addClass("highlighted");
547
+ maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
548
+ visible_top = this.search_results.scrollTop();
549
+ visible_bottom = maxHeight + visible_top;
550
+ high_top = this.result_highlight.position().top + this.search_results.scrollTop();
551
+ high_bottom = high_top + this.result_highlight.outerHeight();
552
+ if (high_bottom >= visible_bottom) {
553
+ return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
554
+ } else if (high_top < visible_top) {
555
+ return this.search_results.scrollTop(high_top);
556
+ }
557
+ }
558
+ };
559
+
560
+ Chosen.prototype.result_clear_highlight = function() {
561
+ if (this.result_highlight) this.result_highlight.removeClass("highlighted");
562
+ return this.result_highlight = null;
563
+ };
564
+
565
+ Chosen.prototype.results_show = function() {
566
+ var dd_top;
567
+ if (!this.is_multiple) {
568
+ this.selected_item.addClass("chzn-single-with-drop");
569
+ if (this.result_single_selected) {
570
+ this.result_do_highlight(this.result_single_selected);
571
+ }
572
+ } else if (this.max_selected_options <= this.choices) {
573
+ this.form_field_jq.trigger("liszt:maxselected", {
574
+ chosen: this
575
+ });
576
+ return false;
577
+ }
578
+ dd_top = this.is_multiple ? this.container.height() : this.container.height() - 1;
579
+ this.form_field_jq.trigger("liszt:showing_dropdown", {
580
+ chosen: this
581
+ });
582
+ this.dropdown.css({
583
+ "top": dd_top + "px",
584
+ "left": 0
585
+ });
586
+ this.results_showing = true;
587
+ this.search_field.focus();
588
+ this.search_field.val(this.search_field.val());
589
+ return this.winnow_results();
590
+ };
591
+
592
+ Chosen.prototype.results_hide = function() {
593
+ if (!this.is_multiple) {
594
+ this.selected_item.removeClass("chzn-single-with-drop");
595
+ }
596
+ this.result_clear_highlight();
597
+ this.form_field_jq.trigger("liszt:hiding_dropdown", {
598
+ chosen: this
599
+ });
600
+ this.dropdown.css({
601
+ "left": "-9000px"
602
+ });
603
+ return this.results_showing = false;
604
+ };
605
+
606
+ Chosen.prototype.set_tab_index = function(el) {
607
+ var ti;
608
+ if (this.form_field_jq.attr("tabindex")) {
609
+ ti = this.form_field_jq.attr("tabindex");
610
+ this.form_field_jq.attr("tabindex", -1);
611
+ if (this.is_multiple) {
612
+ return this.search_field.attr("tabindex", ti);
613
+ } else {
614
+ this.selected_item.attr("tabindex", ti);
615
+ return this.search_field.attr("tabindex", -1);
616
+ }
617
+ }
618
+ };
619
+
620
+ Chosen.prototype.show_search_field_default = function() {
621
+ if (this.is_multiple && this.choices < 1 && !this.active_field) {
622
+ this.search_field.val(this.default_text);
623
+ return this.search_field.addClass("default");
624
+ } else {
625
+ this.search_field.val("");
626
+ return this.search_field.removeClass("default");
627
+ }
628
+ };
629
+
630
+ Chosen.prototype.search_results_mouseup = function(evt) {
631
+ var target;
632
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
633
+ if (target.length) {
634
+ this.result_highlight = target;
635
+ return this.result_select(evt);
636
+ }
637
+ };
638
+
639
+ Chosen.prototype.search_results_mouseover = function(evt) {
640
+ var target;
641
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
642
+ if (target) return this.result_do_highlight(target);
643
+ };
644
+
645
+ Chosen.prototype.search_results_mouseout = function(evt) {
646
+ if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
647
+ return this.result_clear_highlight();
648
+ }
649
+ };
650
+
651
+ Chosen.prototype.choices_click = function(evt) {
652
+ evt.preventDefault();
653
+ if (this.active_field && !($(evt.target).hasClass("search-choice" || $(evt.target).parents('.search-choice').first)) && !this.results_showing) {
654
+ return this.results_show();
655
+ }
656
+ };
657
+
658
+ Chosen.prototype.choice_build = function(item) {
659
+ var choice_id, link,
660
+ _this = this;
661
+ if (this.is_multiple && this.max_selected_options <= this.choices) {
662
+ this.form_field_jq.trigger("liszt:maxselected", {
663
+ chosen: this
664
+ });
665
+ return false;
666
+ }
667
+ choice_id = this.container_id + "_c_" + item.array_index;
668
+ this.choices += 1;
669
+ this.search_container.before('<li class="search-choice" id="' + choice_id + '"><span>' + item.html + '</span><a href="javascript:void(0)" class="search-choice-close" rel="' + item.array_index + '"></a></li>');
670
+ link = $('#' + choice_id).find("a").first();
671
+ return link.click(function(evt) {
672
+ return _this.choice_destroy_link_click(evt);
673
+ });
674
+ };
675
+
676
+ Chosen.prototype.choice_destroy_link_click = function(evt) {
677
+ evt.preventDefault();
678
+ if (!this.is_disabled) {
679
+ this.pending_destroy_click = true;
680
+ return this.choice_destroy($(evt.target));
681
+ } else {
682
+ return evt.stopPropagation;
683
+ }
684
+ };
685
+
686
+ Chosen.prototype.choice_destroy = function(link) {
687
+ this.choices -= 1;
688
+ this.show_search_field_default();
689
+ if (this.is_multiple && this.choices > 0 && this.search_field.val().length < 1) {
690
+ this.results_hide();
691
+ }
692
+ this.result_deselect(link.attr("rel"));
693
+ return link.parents('li').first().remove();
694
+ };
695
+
696
+ Chosen.prototype.results_reset = function() {
697
+ this.form_field.options[0].selected = true;
698
+ this.selected_item.find("span").text(this.default_text);
699
+ if (!this.is_multiple) this.selected_item.addClass("chzn-default");
700
+ this.show_search_field_default();
701
+ this.selected_item.find("abbr").remove();
702
+ this.form_field_jq.trigger("change");
703
+ if (this.active_field) return this.results_hide();
704
+ };
705
+
706
+ Chosen.prototype.result_select = function(evt) {
707
+ var high, high_id, item, position;
708
+ if (this.result_highlight) {
709
+ high = this.result_highlight;
710
+ high_id = high.attr("id");
711
+ this.result_clear_highlight();
712
+ if (this.is_multiple) {
713
+ this.result_deactivate(high);
714
+ } else {
715
+ this.search_results.find(".result-selected").removeClass("result-selected");
716
+ this.result_single_selected = high;
717
+ this.selected_item.removeClass("chzn-default");
718
+ }
719
+ high.addClass("result-selected");
720
+ position = high_id.substr(high_id.lastIndexOf("_") + 1);
721
+ item = this.results_data[position];
722
+ item.selected = true;
723
+ this.form_field.options[item.options_index].selected = true;
724
+ if (this.is_multiple) {
725
+ this.choice_build(item);
726
+ } else {
727
+ this.selected_item.find("span").first().text(item.text);
728
+ if (this.allow_single_deselect) this.single_deselect_control_build();
729
+ }
730
+ if (!(evt.metaKey && this.is_multiple)) this.results_hide();
731
+ this.search_field.val("");
732
+ this.form_field_jq.trigger("change", {
733
+ 'selected': this.form_field.options[item.options_index].value
734
+ });
735
+ return this.search_field_scale();
736
+ }
737
+ };
738
+
739
+ Chosen.prototype.result_activate = function(el) {
740
+ return el.addClass("active-result");
741
+ };
742
+
743
+ Chosen.prototype.result_deactivate = function(el) {
744
+ return el.removeClass("active-result");
745
+ };
746
+
747
+ Chosen.prototype.result_deselect = function(pos) {
748
+ var result, result_data;
749
+ result_data = this.results_data[pos];
750
+ result_data.selected = false;
751
+ this.form_field.options[result_data.options_index].selected = false;
752
+ result = $("#" + this.container_id + "_o_" + pos);
753
+ result.removeClass("result-selected").addClass("active-result").show();
754
+ this.result_clear_highlight();
755
+ this.winnow_results();
756
+ this.form_field_jq.trigger("change", {
757
+ deselected: this.form_field.options[result_data.options_index].value
758
+ });
759
+ return this.search_field_scale();
760
+ };
761
+
762
+ Chosen.prototype.single_deselect_control_build = function() {
763
+ if (this.allow_single_deselect && this.selected_item.find("abbr").length < 1) {
764
+ return this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
765
+ }
766
+ };
767
+
768
+ Chosen.prototype.winnow_results = function() {
769
+ var found, option, part, parts, regex, regexAnchor, result, result_id, results, searchText, startpos, text, zregex, _i, _j, _len, _len2, _ref;
770
+ this.no_results_clear();
771
+ results = 0;
772
+ searchText = this.search_field.val() === this.default_text ? "" : $('<div/>').text($.trim(this.search_field.val())).html();
773
+ regexAnchor = this.search_contains ? "" : "^";
774
+ regex = new RegExp(regexAnchor + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
775
+ zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
776
+ _ref = this.results_data;
777
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
778
+ option = _ref[_i];
779
+ if (!option.disabled && !option.empty) {
780
+ if (option.group) {
781
+ $('#' + option.dom_id).css('display', 'none');
782
+ } else if (!(this.is_multiple && option.selected)) {
783
+ found = false;
784
+ result_id = option.dom_id;
785
+ result = $("#" + result_id);
786
+ if (regex.test(option.html)) {
787
+ found = true;
788
+ results += 1;
789
+ } else if (option.html.indexOf(" ") >= 0 || option.html.indexOf("[") === 0) {
790
+ parts = option.html.replace(/\[|\]/g, "").split(" ");
791
+ if (parts.length) {
792
+ for (_j = 0, _len2 = parts.length; _j < _len2; _j++) {
793
+ part = parts[_j];
794
+ if (regex.test(part)) {
795
+ found = true;
796
+ results += 1;
797
+ }
798
+ }
799
+ }
800
+ }
801
+ if (found) {
802
+ if (searchText.length) {
803
+ startpos = option.html.search(zregex);
804
+ text = option.html.substr(0, startpos + searchText.length) + '</em>' + option.html.substr(startpos + searchText.length);
805
+ text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
806
+ } else {
807
+ text = option.html;
808
+ }
809
+ result.html(text);
810
+ this.result_activate(result);
811
+ if (option.group_array_index != null) {
812
+ $("#" + this.results_data[option.group_array_index].dom_id).css('display', 'list-item');
813
+ }
814
+ } else {
815
+ if (this.result_highlight && result_id === this.result_highlight.attr('id')) {
816
+ this.result_clear_highlight();
817
+ }
818
+ this.result_deactivate(result);
819
+ }
820
+ }
821
+ }
822
+ }
823
+ if (results < 1 && searchText.length) {
824
+ return this.no_results(searchText);
825
+ } else {
826
+ return this.winnow_results_set_highlight();
827
+ }
828
+ };
829
+
830
+ Chosen.prototype.winnow_results_clear = function() {
831
+ var li, lis, _i, _len, _results;
832
+ this.search_field.val("");
833
+ lis = this.search_results.find("li");
834
+ _results = [];
835
+ for (_i = 0, _len = lis.length; _i < _len; _i++) {
836
+ li = lis[_i];
837
+ li = $(li);
838
+ if (li.hasClass("group-result")) {
839
+ _results.push(li.css('display', 'auto'));
840
+ } else if (!this.is_multiple || !li.hasClass("result-selected")) {
841
+ _results.push(this.result_activate(li));
842
+ } else {
843
+ _results.push(void 0);
844
+ }
845
+ }
846
+ return _results;
847
+ };
848
+
849
+ Chosen.prototype.winnow_results_set_highlight = function() {
850
+ var do_high, selected_results;
851
+ if (!this.result_highlight) {
852
+ selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
853
+ do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
854
+ if (do_high != null) return this.result_do_highlight(do_high);
855
+ }
856
+ };
857
+
858
+ Chosen.prototype.no_results = function(terms) {
859
+ var no_results_html;
860
+ no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
861
+ no_results_html.find("span").first().html(terms);
862
+ return this.search_results.append(no_results_html);
863
+ };
864
+
865
+ Chosen.prototype.no_results_clear = function() {
866
+ return this.search_results.find(".no-results").remove();
867
+ };
868
+
869
+ Chosen.prototype.keydown_arrow = function() {
870
+ var first_active, next_sib;
871
+ if (!this.result_highlight) {
872
+ first_active = this.search_results.find("li.active-result").first();
873
+ if (first_active) this.result_do_highlight($(first_active));
874
+ } else if (this.results_showing) {
875
+ next_sib = this.result_highlight.nextAll("li.active-result").first();
876
+ if (next_sib) this.result_do_highlight(next_sib);
877
+ }
878
+ if (!this.results_showing) return this.results_show();
879
+ };
880
+
881
+ Chosen.prototype.keyup_arrow = function() {
882
+ var prev_sibs;
883
+ if (!this.results_showing && !this.is_multiple) {
884
+ return this.results_show();
885
+ } else if (this.result_highlight) {
886
+ prev_sibs = this.result_highlight.prevAll("li.active-result");
887
+ if (prev_sibs.length) {
888
+ return this.result_do_highlight(prev_sibs.first());
889
+ } else {
890
+ if (this.choices > 0) this.results_hide();
891
+ return this.result_clear_highlight();
892
+ }
893
+ }
894
+ };
895
+
896
+ Chosen.prototype.keydown_backstroke = function() {
897
+ if (this.pending_backstroke) {
898
+ this.choice_destroy(this.pending_backstroke.find("a").first());
899
+ return this.clear_backstroke();
900
+ } else {
901
+ this.pending_backstroke = this.search_container.siblings("li.search-choice").last();
902
+ return this.pending_backstroke.addClass("search-choice-focus");
903
+ }
904
+ };
905
+
906
+ Chosen.prototype.clear_backstroke = function() {
907
+ if (this.pending_backstroke) {
908
+ this.pending_backstroke.removeClass("search-choice-focus");
909
+ }
910
+ return this.pending_backstroke = null;
911
+ };
912
+
913
+ Chosen.prototype.keydown_checker = function(evt) {
914
+ var stroke, _ref;
915
+ stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
916
+ this.search_field_scale();
917
+ if (stroke !== 8 && this.pending_backstroke) this.clear_backstroke();
918
+ switch (stroke) {
919
+ case 8:
920
+ this.backstroke_length = this.search_field.val().length;
921
+ break;
922
+ case 9:
923
+ if (this.results_showing && !this.is_multiple) this.result_select(evt);
924
+ this.mouse_on_container = false;
925
+ break;
926
+ case 13:
927
+ evt.preventDefault();
928
+ break;
929
+ case 38:
930
+ evt.preventDefault();
931
+ this.keyup_arrow();
932
+ break;
933
+ case 40:
934
+ this.keydown_arrow();
935
+ break;
936
+ }
937
+ };
938
+
939
+ Chosen.prototype.search_field_scale = function() {
940
+ var dd_top, div, h, style, style_block, styles, w, _i, _len;
941
+ if (this.is_multiple) {
942
+ h = 0;
943
+ w = 0;
944
+ style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
945
+ styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
946
+ for (_i = 0, _len = styles.length; _i < _len; _i++) {
947
+ style = styles[_i];
948
+ style_block += style + ":" + this.search_field.css(style) + ";";
949
+ }
950
+ div = $('<div />', {
951
+ 'style': style_block
952
+ });
953
+ div.text(this.search_field.val());
954
+ $('body').append(div);
955
+ w = div.width() + 25;
956
+ div.remove();
957
+ if (w > this.f_width - 10) w = this.f_width - 10;
958
+ this.search_field.css({
959
+ 'width': w + 'px'
960
+ });
961
+ dd_top = this.container.height();
962
+ return this.dropdown.css({
963
+ "top": dd_top + "px"
964
+ });
965
+ }
966
+ };
967
+
968
+ Chosen.prototype.generate_random_id = function() {
969
+ var string;
970
+ string = "sel" + this.generate_random_char() + this.generate_random_char() + this.generate_random_char();
971
+ while ($("#" + string).length > 0) {
972
+ string += this.generate_random_char();
973
+ }
974
+ return string;
975
+ };
976
+
977
+ return Chosen;
978
+
979
+ })(AbstractChosen);
980
+
981
+ get_side_border_padding = function(elmt) {
982
+ var side_border_padding;
983
+ return side_border_padding = elmt.outerWidth() - elmt.width();
984
+ };
985
+
986
+ root.get_side_border_padding = get_side_border_padding;
987
+
988
+ }).call(this);
js/jquery.timepicker.js ADDED
@@ -0,0 +1,2245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! jQuery Timepicker Addon - v1.5.5 - 2015-05-24
2
+ * http://trentrichardson.com/examples/timepicker
3
+ * Copyright (c) 2015 Trent Richardson; Licensed MIT */
4
+ (function (factory) {
5
+ if (typeof define === 'function' && define.amd) {
6
+ define(['jquery', 'jquery.ui'], factory);
7
+ } else {
8
+ factory(jQuery);
9
+ }
10
+ }(function ($) {
11
+
12
+ /*
13
+ * Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded"
14
+ */
15
+ $.ui.timepicker = $.ui.timepicker || {};
16
+ if ($.ui.timepicker.version) {
17
+ return;
18
+ }
19
+
20
+ /*
21
+ * Extend jQueryUI, get it started with our version number
22
+ */
23
+ $.extend($.ui, {
24
+ timepicker: {
25
+ version: "1.5.5"
26
+ }
27
+ });
28
+
29
+ /*
30
+ * Timepicker manager.
31
+ * Use the singleton instance of this class, $.timepicker, to interact with the time picker.
32
+ * Settings for (groups of) time pickers are maintained in an instance object,
33
+ * allowing multiple different settings on the same page.
34
+ */
35
+ var Timepicker = function () {
36
+ this.regional = []; // Available regional settings, indexed by language code
37
+ this.regional[''] = { // Default regional settings
38
+ currentText: 'Now',
39
+ closeText: 'Done',
40
+ amNames: ['AM', 'A'],
41
+ pmNames: ['PM', 'P'],
42
+ timeFormat: 'HH:mm',
43
+ timeSuffix: '',
44
+ timeOnlyTitle: 'Choose Time',
45
+ timeText: 'Time',
46
+ hourText: 'Hour',
47
+ minuteText: 'Minute',
48
+ secondText: 'Second',
49
+ millisecText: 'Millisecond',
50
+ microsecText: 'Microsecond',
51
+ timezoneText: 'Time Zone',
52
+ isRTL: false
53
+ };
54
+ this._defaults = { // Global defaults for all the datetime picker instances
55
+ showButtonPanel: true,
56
+ timeOnly: false,
57
+ timeOnlyShowDate: false,
58
+ showHour: null,
59
+ showMinute: null,
60
+ showSecond: null,
61
+ showMillisec: null,
62
+ showMicrosec: null,
63
+ showTimezone: null,
64
+ showTime: true,
65
+ stepHour: 1,
66
+ stepMinute: 1,
67
+ stepSecond: 1,
68
+ stepMillisec: 1,
69
+ stepMicrosec: 1,
70
+ hour: 0,
71
+ minute: 0,
72
+ second: 0,
73
+ millisec: 0,
74
+ microsec: 0,
75
+ timezone: null,
76
+ hourMin: 0,
77
+ minuteMin: 0,
78
+ secondMin: 0,
79
+ millisecMin: 0,
80
+ microsecMin: 0,
81
+ hourMax: 23,
82
+ minuteMax: 59,
83
+ secondMax: 59,
84
+ millisecMax: 999,
85
+ microsecMax: 999,
86
+ minDateTime: null,
87
+ maxDateTime: null,
88
+ maxTime: null,
89
+ minTime: null,
90
+ onSelect: null,
91
+ hourGrid: 0,
92
+ minuteGrid: 0,
93
+ secondGrid: 0,
94
+ millisecGrid: 0,
95
+ microsecGrid: 0,
96
+ alwaysSetTime: true,
97
+ separator: ' ',
98
+ altFieldTimeOnly: true,
99
+ altTimeFormat: null,
100
+ altSeparator: null,
101
+ altTimeSuffix: null,
102
+ altRedirectFocus: true,
103
+ pickerTimeFormat: null,
104
+ pickerTimeSuffix: null,
105
+ showTimepicker: true,
106
+ timezoneList: null,
107
+ addSliderAccess: false,
108
+ sliderAccessArgs: null,
109
+ controlType: 'slider',
110
+ oneLine: false,
111
+ defaultValue: null,
112
+ parse: 'strict',
113
+ afterInject: null
114
+ };
115
+ $.extend(this._defaults, this.regional['']);
116
+ };
117
+
118
+ $.extend(Timepicker.prototype, {
119
+ $input: null,
120
+ $altInput: null,
121
+ $timeObj: null,
122
+ inst: null,
123
+ hour_slider: null,
124
+ minute_slider: null,
125
+ second_slider: null,
126
+ millisec_slider: null,
127
+ microsec_slider: null,
128
+ timezone_select: null,
129
+ maxTime: null,
130
+ minTime: null,
131
+ hour: 0,
132
+ minute: 0,
133
+ second: 0,
134
+ millisec: 0,
135
+ microsec: 0,
136
+ timezone: null,
137
+ hourMinOriginal: null,
138
+ minuteMinOriginal: null,
139
+ secondMinOriginal: null,
140
+ millisecMinOriginal: null,
141
+ microsecMinOriginal: null,
142
+ hourMaxOriginal: null,
143
+ minuteMaxOriginal: null,
144
+ secondMaxOriginal: null,
145
+ millisecMaxOriginal: null,
146
+ microsecMaxOriginal: null,
147
+ ampm: '',
148
+ formattedDate: '',
149
+ formattedTime: '',
150
+ formattedDateTime: '',
151
+ timezoneList: null,
152
+ units: ['hour', 'minute', 'second', 'millisec', 'microsec'],
153
+ support: {},
154
+ control: null,
155
+
156
+ /*
157
+ * Override the default settings for all instances of the time picker.
158
+ * @param {Object} settings object - the new settings to use as defaults (anonymous object)
159
+ * @return {Object} the manager object
160
+ */
161
+ setDefaults: function (settings) {
162
+ extendRemove(this._defaults, settings || {});
163
+ return this;
164
+ },
165
+
166
+ /*
167
+ * Create a new Timepicker instance
168
+ */
169
+ _newInst: function ($input, opts) {
170
+ var tp_inst = new Timepicker(),
171
+ inlineSettings = {},
172
+ fns = {},
173
+ overrides, i;
174
+
175
+ for (var attrName in this._defaults) {
176
+ if (this._defaults.hasOwnProperty(attrName)) {
177
+ var attrValue = $input.attr('time:' + attrName);
178
+ if (attrValue) {
179
+ try {
180
+ inlineSettings[attrName] = eval(attrValue);
181
+ } catch (err) {
182
+ inlineSettings[attrName] = attrValue;
183
+ }
184
+ }
185
+ }
186
+ }
187
+
188
+ overrides = {
189
+ beforeShow: function (input, dp_inst) {
190
+ if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) {
191
+ return tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst);
192
+ }
193
+ },
194
+ onChangeMonthYear: function (year, month, dp_inst) {
195
+ // Update the time as well : this prevents the time from disappearing from the $input field.
196
+ // tp_inst._updateDateTime(dp_inst);
197
+ if ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) {
198
+ tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
199
+ }
200
+ },
201
+ onClose: function (dateText, dp_inst) {
202
+ if (tp_inst.timeDefined === true && $input.val() !== '') {
203
+ tp_inst._updateDateTime(dp_inst);
204
+ }
205
+ if ($.isFunction(tp_inst._defaults.evnts.onClose)) {
206
+ tp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst);
207
+ }
208
+ }
209
+ };
210
+ for (i in overrides) {
211
+ if (overrides.hasOwnProperty(i)) {
212
+ fns[i] = opts[i] || this._defaults[i] || null;
213
+ }
214
+ }
215
+
216
+ tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, opts, overrides, {
217
+ evnts: fns,
218
+ timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
219
+ });
220
+ tp_inst.amNames = $.map(tp_inst._defaults.amNames, function (val) {
221
+ return val.toUpperCase();
222
+ });
223
+ tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function (val) {
224
+ return val.toUpperCase();
225
+ });
226
+
227
+ // detect which units are supported
228
+ tp_inst.support = detectSupport(
229
+ tp_inst._defaults.timeFormat +
230
+ (tp_inst._defaults.pickerTimeFormat ? tp_inst._defaults.pickerTimeFormat : '') +
231
+ (tp_inst._defaults.altTimeFormat ? tp_inst._defaults.altTimeFormat : ''));
232
+
233
+ // controlType is string - key to our this._controls
234
+ if (typeof(tp_inst._defaults.controlType) === 'string') {
235
+ if (tp_inst._defaults.controlType === 'slider' && typeof($.ui.slider) === 'undefined') {
236
+ tp_inst._defaults.controlType = 'select';
237
+ }
238
+ tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];
239
+ }
240
+ // controlType is an object and must implement create, options, value methods
241
+ else {
242
+ tp_inst.control = tp_inst._defaults.controlType;
243
+ }
244
+
245
+ // prep the timezone options
246
+ var timezoneList = [-720, -660, -600, -570, -540, -480, -420, -360, -300, -270, -240, -210, -180, -120, -60,
247
+ 0, 60, 120, 180, 210, 240, 270, 300, 330, 345, 360, 390, 420, 480, 525, 540, 570, 600, 630, 660, 690, 720, 765, 780, 840];
248
+ if (tp_inst._defaults.timezoneList !== null) {
249
+ timezoneList = tp_inst._defaults.timezoneList;
250
+ }
251
+ var tzl = timezoneList.length, tzi = 0, tzv = null;
252
+ if (tzl > 0 && typeof timezoneList[0] !== 'object') {
253
+ for (; tzi < tzl; tzi++) {
254
+ tzv = timezoneList[tzi];
255
+ timezoneList[tzi] = { value: tzv, label: $.timepicker.timezoneOffsetString(tzv, tp_inst.support.iso8601) };
256
+ }
257
+ }
258
+ tp_inst._defaults.timezoneList = timezoneList;
259
+
260
+ // set the default units
261
+ tp_inst.timezone = tp_inst._defaults.timezone !== null ? $.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone) :
262
+ ((new Date()).getTimezoneOffset() * -1);
263
+ tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin ? tp_inst._defaults.hourMin :
264
+ tp_inst._defaults.hour > tp_inst._defaults.hourMax ? tp_inst._defaults.hourMax : tp_inst._defaults.hour;
265
+ tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin ? tp_inst._defaults.minuteMin :
266
+ tp_inst._defaults.minute > tp_inst._defaults.minuteMax ? tp_inst._defaults.minuteMax : tp_inst._defaults.minute;
267
+ tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin ? tp_inst._defaults.secondMin :
268
+ tp_inst._defaults.second > tp_inst._defaults.secondMax ? tp_inst._defaults.secondMax : tp_inst._defaults.second;
269
+ tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin ? tp_inst._defaults.millisecMin :
270
+ tp_inst._defaults.millisec > tp_inst._defaults.millisecMax ? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec;
271
+ tp_inst.microsec = tp_inst._defaults.microsec < tp_inst._defaults.microsecMin ? tp_inst._defaults.microsecMin :
272
+ tp_inst._defaults.microsec > tp_inst._defaults.microsecMax ? tp_inst._defaults.microsecMax : tp_inst._defaults.microsec;
273
+ tp_inst.ampm = '';
274
+ tp_inst.$input = $input;
275
+
276
+ if (tp_inst._defaults.altField) {
277
+ tp_inst.$altInput = $(tp_inst._defaults.altField);
278
+ if (tp_inst._defaults.altRedirectFocus === true) {
279
+ tp_inst.$altInput.css({
280
+ cursor: 'pointer'
281
+ }).focus(function () {
282
+ $input.trigger("focus");
283
+ });
284
+ }
285
+ }
286
+
287
+ if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) {
288
+ tp_inst._defaults.minDate = new Date();
289
+ }
290
+ if (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) {
291
+ tp_inst._defaults.maxDate = new Date();
292
+ }
293
+
294
+ // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
295
+ if (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) {
296
+ tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
297
+ }
298
+ if (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) {
299
+ tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
300
+ }
301
+ if (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) {
302
+ tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
303
+ }
304
+ if (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) {
305
+ tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
306
+ }
307
+ tp_inst.$input.bind('focus', function () {
308
+ tp_inst._onFocus();
309
+ });
310
+
311
+ return tp_inst;
312
+ },
313
+
314
+ /*
315
+ * add our sliders to the calendar
316
+ */
317
+ _addTimePicker: function (dp_inst) {
318
+ var currDT = $.trim((this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val());
319
+
320
+ this.timeDefined = this._parseTime(currDT);
321
+ this._limitMinMaxDateTime(dp_inst, false);
322
+ this._injectTimePicker();
323
+ this._afterInject();
324
+ },
325
+
326
+ /*
327
+ * parse the time string from input value or _setTime
328
+ */
329
+ _parseTime: function (timeString, withDate) {
330
+ if (!this.inst) {
331
+ this.inst = $.datepicker._getInst(this.$input[0]);
332
+ }
333
+
334
+ if (withDate || !this._defaults.timeOnly) {
335
+ var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
336
+ try {
337
+ var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults);
338
+ if (!parseRes.timeObj) {
339
+ return false;
340
+ }
341
+ $.extend(this, parseRes.timeObj);
342
+ } catch (err) {
343
+ $.timepicker.log("Error parsing the date/time string: " + err +
344
+ "\ndate/time string = " + timeString +
345
+ "\ntimeFormat = " + this._defaults.timeFormat +
346
+ "\ndateFormat = " + dp_dateFormat);
347
+ return false;
348
+ }
349
+ return true;
350
+ } else {
351
+ var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults);
352
+ if (!timeObj) {
353
+ return false;
354
+ }
355
+ $.extend(this, timeObj);
356
+ return true;
357
+ }
358
+ },
359
+
360
+ /*
361
+ * Handle callback option after injecting timepicker
362
+ */
363
+ _afterInject: function() {
364
+ var o = this.inst.settings;
365
+ if ($.isFunction(o.afterInject)) {
366
+ o.afterInject.call(this);
367
+ }
368
+ },
369
+
370
+ /*
371
+ * generate and inject html for timepicker into ui datepicker
372
+ */
373
+ _injectTimePicker: function () {
374
+ var $dp = this.inst.dpDiv,
375
+ o = this.inst.settings,
376
+ tp_inst = this,
377
+ litem = '',
378
+ uitem = '',
379
+ show = null,
380
+ max = {},
381
+ gridSize = {},
382
+ size = null,
383
+ i = 0,
384
+ l = 0;
385
+
386
+ // Prevent displaying twice
387
+ if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
388
+ var noDisplay = ' ui_tpicker_unit_hide',
389
+ html = '<div class="ui-timepicker-div' + (o.isRTL ? ' ui-timepicker-rtl' : '') + (o.oneLine && o.controlType === 'select' ? ' ui-timepicker-oneLine' : '') + '"><dl>' + '<dt class="ui_tpicker_time_label' + ((o.showTime) ? '' : noDisplay) + '">' + o.timeText + '</dt>' +
390
+ '<dd class="ui_tpicker_time '+ ((o.showTime) ? '' : noDisplay) + '"></dd>';
391
+
392
+ // Create the markup
393
+ for (i = 0, l = this.units.length; i < l; i++) {
394
+ litem = this.units[i];
395
+ uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1);
396
+ show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem];
397
+
398
+ // Added by Peter Medeiros:
399
+ // - Figure out what the hour/minute/second max should be based on the step values.
400
+ // - Example: if stepMinute is 15, then minMax is 45.
401
+ max[litem] = parseInt((o[litem + 'Max'] - ((o[litem + 'Max'] - o[litem + 'Min']) % o['step' + uitem])), 10);
402
+ gridSize[litem] = 0;
403
+
404
+ html += '<dt class="ui_tpicker_' + litem + '_label' + (show ? '' : noDisplay) + '">' + o[litem + 'Text'] + '</dt>' +
405
+ '<dd class="ui_tpicker_' + litem + (show ? '' : noDisplay) + '"><div class="ui_tpicker_' + litem + '_slider' + (show ? '' : noDisplay) + '"></div>';
406
+
407
+ if (show && o[litem + 'Grid'] > 0) {
408
+ html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
409
+
410
+ if (litem === 'hour') {
411
+ for (var h = o[litem + 'Min']; h <= max[litem]; h += parseInt(o[litem + 'Grid'], 10)) {
412
+ gridSize[litem]++;
413
+ var tmph = $.datepicker.formatTime(this.support.ampm ? 'hht' : 'HH', {hour: h}, o);
414
+ html += '<td data-for="' + litem + '">' + tmph + '</td>';
415
+ }
416
+ }
417
+ else {
418
+ for (var m = o[litem + 'Min']; m <= max[litem]; m += parseInt(o[litem + 'Grid'], 10)) {
419
+ gridSize[litem]++;
420
+ html += '<td data-for="' + litem + '">' + ((m < 10) ? '0' : '') + m + '</td>';
421
+ }
422
+ }
423
+
424
+ html += '</tr></table></div>';
425
+ }
426
+ html += '</dd>';
427
+ }
428
+
429
+ // Timezone
430
+ var showTz = o.showTimezone !== null ? o.showTimezone : this.support.timezone;
431
+ html += '<dt class="ui_tpicker_timezone_label' + (showTz ? '' : noDisplay) + '">' + o.timezoneText + '</dt>';
432
+ html += '<dd class="ui_tpicker_timezone' + (showTz ? '' : noDisplay) + '"></dd>';
433
+
434
+ // Create the elements from string
435
+ html += '</dl></div>';
436
+ var $tp = $(html);
437
+
438
+ // if we only want time picker...
439
+ if (o.timeOnly === true) {
440
+ $tp.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all">' + '<div class="ui-datepicker-title">' + o.timeOnlyTitle + '</div>' + '</div>');
441
+ $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
442
+ }
443
+
444
+ // add sliders, adjust grids, add events
445
+ for (i = 0, l = tp_inst.units.length; i < l; i++) {
446
+ litem = tp_inst.units[i];
447
+ uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1);
448
+ show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem];
449
+
450
+ // add the slider
451
+ tp_inst[litem + '_slider'] = tp_inst.control.create(tp_inst, $tp.find('.ui_tpicker_' + litem + '_slider'), litem, tp_inst[litem], o[litem + 'Min'], max[litem], o['step' + uitem]);
452
+
453
+ // adjust the grid and add click event
454
+ if (show && o[litem + 'Grid'] > 0) {
455
+ size = 100 * gridSize[litem] * o[litem + 'Grid'] / (max[litem] - o[litem + 'Min']);
456
+ $tp.find('.ui_tpicker_' + litem + ' table').css({
457
+ width: size + "%",
458
+ marginLeft: o.isRTL ? '0' : ((size / (-2 * gridSize[litem])) + "%"),
459
+ marginRight: o.isRTL ? ((size / (-2 * gridSize[litem])) + "%") : '0',
460
+ borderCollapse: 'collapse'
461
+ }).find("td").click(function (e) {
462
+ var $t = $(this),
463
+ h = $t.html(),
464
+ n = parseInt(h.replace(/[^0-9]/g), 10),
465
+ ap = h.replace(/[^apm]/ig),
466
+ f = $t.data('for'); // loses scope, so we use data-for
467
+
468
+ if (f === 'hour') {
469
+ if (ap.indexOf('p') !== -1 && n < 12) {
470
+ n += 12;
471
+ }
472
+ else {
473
+ if (ap.indexOf('a') !== -1 && n === 12) {
474
+ n = 0;
475
+ }
476
+ }
477
+ }
478
+
479
+ tp_inst.control.value(tp_inst, tp_inst[f + '_slider'], litem, n);
480
+
481
+ tp_inst._onTimeChange();
482
+ tp_inst._onSelectHandler();
483
+ }).css({
484
+ cursor: 'pointer',
485
+ width: (100 / gridSize[litem]) + '%',
486
+ textAlign: 'center',
487
+ overflow: 'hidden'
488
+ });
489
+ } // end if grid > 0
490
+ } // end for loop
491
+
492
+ // Add timezone options
493
+ this.timezone_select = $tp.find('.ui_tpicker_timezone').append('<select></select>').find("select");
494
+ $.fn.append.apply(this.timezone_select,
495
+ $.map(o.timezoneList, function (val, idx) {
496
+ return $("<option />").val(typeof val === "object" ? val.value : val).text(typeof val === "object" ? val.label : val);
497
+ }));
498
+ if (typeof(this.timezone) !== "undefined" && this.timezone !== null && this.timezone !== "") {
499
+ var local_timezone = (new Date(this.inst.selectedYear, this.inst.selectedMonth, this.inst.selectedDay, 12)).getTimezoneOffset() * -1;
500
+ if (local_timezone === this.timezone) {
501
+ selectLocalTimezone(tp_inst);
502
+ } else {
503
+ this.timezone_select.val(this.timezone);
504
+ }
505
+ } else {
506
+ if (typeof(this.hour) !== "undefined" && this.hour !== null && this.hour !== "") {
507
+ this.timezone_select.val(o.timezone);
508
+ } else {
509
+ selectLocalTimezone(tp_inst);
510
+ }
511
+ }
512
+ this.timezone_select.change(function () {
513
+ tp_inst._onTimeChange();
514
+ tp_inst._onSelectHandler();
515
+ tp_inst._afterInject();
516
+ });
517
+ // End timezone options
518
+
519
+ // inject timepicker into datepicker
520
+ var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
521
+ if ($buttonPanel.length) {
522
+ $buttonPanel.before($tp);
523
+ } else {
524
+ $dp.append($tp);
525
+ }
526
+
527
+ this.$timeObj = $tp.find('.ui_tpicker_time');
528
+
529
+ if (this.inst !== null) {
530
+ var timeDefined = this.timeDefined;
531
+ this._onTimeChange();
532
+ this.timeDefined = timeDefined;
533
+ }
534
+
535
+ // slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
536
+ if (this._defaults.addSliderAccess) {
537
+ var sliderAccessArgs = this._defaults.sliderAccessArgs,
538
+ rtl = this._defaults.isRTL;
539
+ sliderAccessArgs.isRTL = rtl;
540
+
541
+ setTimeout(function () { // fix for inline mode
542
+ if ($tp.find('.ui-slider-access').length === 0) {
543
+ $tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
544
+
545
+ // fix any grids since sliders are shorter
546
+ var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
547
+ if (sliderAccessWidth) {
548
+ $tp.find('table:visible').each(function () {
549
+ var $g = $(this),
550
+ oldWidth = $g.outerWidth(),
551
+ oldMarginLeft = $g.css(rtl ? 'marginRight' : 'marginLeft').toString().replace('%', ''),
552
+ newWidth = oldWidth - sliderAccessWidth,
553
+ newMarginLeft = ((oldMarginLeft * newWidth) / oldWidth) + '%',
554
+ css = { width: newWidth, marginRight: 0, marginLeft: 0 };
555
+ css[rtl ? 'marginRight' : 'marginLeft'] = newMarginLeft;
556
+ $g.css(css);
557
+ });
558
+ }
559
+ }
560
+ }, 10);
561
+ }
562
+ // end slideAccess integration
563
+
564
+ tp_inst._limitMinMaxDateTime(this.inst, true);
565
+ }
566
+ },
567
+
568
+ /*
569
+ * This function tries to limit the ability to go outside the
570
+ * min/max date range
571
+ */
572
+ _limitMinMaxDateTime: function (dp_inst, adjustSliders) {
573
+ var o = this._defaults,
574
+ dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);
575
+
576
+ if (!this._defaults.showTimepicker) {
577
+ return;
578
+ } // No time so nothing to check here
579
+
580
+ if ($.datepicker._get(dp_inst, 'minDateTime') !== null && $.datepicker._get(dp_inst, 'minDateTime') !== undefined && dp_date) {
581
+ var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
582
+ minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
583
+
584
+ if (this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null || this.microsecMinOriginal === null) {
585
+ this.hourMinOriginal = o.hourMin;
586
+ this.minuteMinOriginal = o.minuteMin;
587
+ this.secondMinOriginal = o.secondMin;
588
+ this.millisecMinOriginal = o.millisecMin;
589
+ this.microsecMinOriginal = o.microsecMin;
590
+ }
591
+
592
+ if (dp_inst.settings.timeOnly || minDateTimeDate.getTime() === dp_date.getTime()) {
593
+ this._defaults.hourMin = minDateTime.getHours();
594
+ if (this.hour <= this._defaults.hourMin) {
595
+ this.hour = this._defaults.hourMin;
596
+ this._defaults.minuteMin = minDateTime.getMinutes();
597
+ if (this.minute <= this._defaults.minuteMin) {
598
+ this.minute = this._defaults.minuteMin;
599
+ this._defaults.secondMin = minDateTime.getSeconds();
600
+ if (this.second <= this._defaults.secondMin) {
601
+ this.second = this._defaults.secondMin;
602
+ this._defaults.millisecMin = minDateTime.getMilliseconds();
603
+ if (this.millisec <= this._defaults.millisecMin) {
604
+ this.millisec = this._defaults.millisecMin;
605
+ this._defaults.microsecMin = minDateTime.getMicroseconds();
606
+ } else {
607
+ if (this.microsec < this._defaults.microsecMin) {
608
+ this.microsec = this._defaults.microsecMin;
609
+ }
610
+ this._defaults.microsecMin = this.microsecMinOriginal;
611
+ }
612
+ } else {
613
+ this._defaults.millisecMin = this.millisecMinOriginal;
614
+ this._defaults.microsecMin = this.microsecMinOriginal;
615
+ }
616
+ } else {
617
+ this._defaults.secondMin = this.secondMinOriginal;
618
+ this._defaults.millisecMin = this.millisecMinOriginal;
619
+ this._defaults.microsecMin = this.microsecMinOriginal;
620
+ }
621
+ } else {
622
+ this._defaults.minuteMin = this.minuteMinOriginal;
623
+ this._defaults.secondMin = this.secondMinOriginal;
624
+ this._defaults.millisecMin = this.millisecMinOriginal;
625
+ this._defaults.microsecMin = this.microsecMinOriginal;
626
+ }
627
+ } else {
628
+ this._defaults.hourMin = this.hourMinOriginal;
629
+ this._defaults.minuteMin = this.minuteMinOriginal;
630
+ this._defaults.secondMin = this.secondMinOriginal;
631
+ this._defaults.millisecMin = this.millisecMinOriginal;
632
+ this._defaults.microsecMin = this.microsecMinOriginal;
633
+ }
634
+ }
635
+
636
+ if ($.datepicker._get(dp_inst, 'maxDateTime') !== null && $.datepicker._get(dp_inst, 'maxDateTime') !== undefined && dp_date) {
637
+ var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
638
+ maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
639
+
640
+ if (this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null || this.millisecMaxOriginal === null) {
641
+ this.hourMaxOriginal = o.hourMax;
642
+ this.minuteMaxOriginal = o.minuteMax;
643
+ this.secondMaxOriginal = o.secondMax;
644
+ this.millisecMaxOriginal = o.millisecMax;
645
+ this.microsecMaxOriginal = o.microsecMax;
646
+ }
647
+
648
+ if (dp_inst.settings.timeOnly || maxDateTimeDate.getTime() === dp_date.getTime()) {
649
+ this._defaults.hourMax = maxDateTime.getHours();
650
+ if (this.hour >= this._defaults.hourMax) {
651
+ this.hour = this._defaults.hourMax;
652
+ this._defaults.minuteMax = maxDateTime.getMinutes();
653
+ if (this.minute >= this._defaults.minuteMax) {
654
+ this.minute = this._defaults.minuteMax;
655
+ this._defaults.secondMax = maxDateTime.getSeconds();
656
+ if (this.second >= this._defaults.secondMax) {
657
+ this.second = this._defaults.secondMax;
658
+ this._defaults.millisecMax = maxDateTime.getMilliseconds();
659
+ if (this.millisec >= this._defaults.millisecMax) {
660
+ this.millisec = this._defaults.millisecMax;
661
+ this._defaults.microsecMax = maxDateTime.getMicroseconds();
662
+ } else {
663
+ if (this.microsec > this._defaults.microsecMax) {
664
+ this.microsec = this._defaults.microsecMax;
665
+ }
666
+ this._defaults.microsecMax = this.microsecMaxOriginal;
667
+ }
668
+ } else {
669
+ this._defaults.millisecMax = this.millisecMaxOriginal;
670
+ this._defaults.microsecMax = this.microsecMaxOriginal;
671
+ }
672
+ } else {
673
+ this._defaults.secondMax = this.secondMaxOriginal;
674
+ this._defaults.millisecMax = this.millisecMaxOriginal;
675
+ this._defaults.microsecMax = this.microsecMaxOriginal;
676
+ }
677
+ } else {
678
+ this._defaults.minuteMax = this.minuteMaxOriginal;
679
+ this._defaults.secondMax = this.secondMaxOriginal;
680
+ this._defaults.millisecMax = this.millisecMaxOriginal;
681
+ this._defaults.microsecMax = this.microsecMaxOriginal;
682
+ }
683
+ } else {
684
+ this._defaults.hourMax = this.hourMaxOriginal;
685
+ this._defaults.minuteMax = this.minuteMaxOriginal;
686
+ this._defaults.secondMax = this.secondMaxOriginal;
687
+ this._defaults.millisecMax = this.millisecMaxOriginal;
688
+ this._defaults.microsecMax = this.microsecMaxOriginal;
689
+ }
690
+ }
691
+
692
+ if (dp_inst.settings.minTime!==null) {
693
+ var tempMinTime=new Date("01/01/1970 " + dp_inst.settings.minTime);
694
+ if (this.hour<tempMinTime.getHours()) {
695
+ this.hour=this._defaults.hourMin=tempMinTime.getHours();
696
+ this.minute=this._defaults.minuteMin=tempMinTime.getMinutes();
697
+ } else if (this.hour===tempMinTime.getHours() && this.minute<tempMinTime.getMinutes()) {
698
+ this.minute=this._defaults.minuteMin=tempMinTime.getMinutes();
699
+ } else {
700
+ if (this._defaults.hourMin<tempMinTime.getHours()) {
701
+ this._defaults.hourMin=tempMinTime.getHours();
702
+ this._defaults.minuteMin=tempMinTime.getMinutes();
703
+ } else if (this._defaults.hourMin===tempMinTime.getHours()===this.hour && this._defaults.minuteMin<tempMinTime.getMinutes()) {
704
+ this._defaults.minuteMin=tempMinTime.getMinutes();
705
+ } else {
706
+ this._defaults.minuteMin=0;
707
+ }
708
+ }
709
+ }
710
+
711
+ if (dp_inst.settings.maxTime!==null) {
712
+ var tempMaxTime=new Date("01/01/1970 " + dp_inst.settings.maxTime);
713
+ if (this.hour>tempMaxTime.getHours()) {
714
+ this.hour=this._defaults.hourMax=tempMaxTime.getHours();
715
+ this.minute=this._defaults.minuteMax=tempMaxTime.getMinutes();
716
+ } else if (this.hour===tempMaxTime.getHours() && this.minute>tempMaxTime.getMinutes()) {
717
+ this.minute=this._defaults.minuteMax=tempMaxTime.getMinutes();
718
+ } else {
719
+ if (this._defaults.hourMax>tempMaxTime.getHours()) {
720
+ this._defaults.hourMax=tempMaxTime.getHours();
721
+ this._defaults.minuteMax=tempMaxTime.getMinutes();
722
+ } else if (this._defaults.hourMax===tempMaxTime.getHours()===this.hour && this._defaults.minuteMax>tempMaxTime.getMinutes()) {
723
+ this._defaults.minuteMax=tempMaxTime.getMinutes();
724
+ } else {
725
+ this._defaults.minuteMax=59;
726
+ }
727
+ }
728
+ }
729
+
730
+ if (adjustSliders !== undefined && adjustSliders === true) {
731
+ var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)), 10),
732
+ minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)), 10),
733
+ secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)), 10),
734
+ millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)), 10),
735
+ microsecMax = parseInt((this._defaults.microsecMax - ((this._defaults.microsecMax - this._defaults.microsecMin) % this._defaults.stepMicrosec)), 10);
736
+
737
+ if (this.hour_slider) {
738
+ this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax, step: this._defaults.stepHour });
739
+ this.control.value(this, this.hour_slider, 'hour', this.hour - (this.hour % this._defaults.stepHour));
740
+ }
741
+ if (this.minute_slider) {
742
+ this.control.options(this, this.minute_slider, 'minute', { min: this._defaults.minuteMin, max: minMax, step: this._defaults.stepMinute });
743
+ this.control.value(this, this.minute_slider, 'minute', this.minute - (this.minute % this._defaults.stepMinute));
744
+ }
745
+ if (this.second_slider) {
746
+ this.control.options(this, this.second_slider, 'second', { min: this._defaults.secondMin, max: secMax, step: this._defaults.stepSecond });
747
+ this.control.value(this, this.second_slider, 'second', this.second - (this.second % this._defaults.stepSecond));
748
+ }
749
+ if (this.millisec_slider) {
750
+ this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax, step: this._defaults.stepMillisec });
751
+ this.control.value(this, this.millisec_slider, 'millisec', this.millisec - (this.millisec % this._defaults.stepMillisec));
752
+ }
753
+ if (this.microsec_slider) {
754
+ this.control.options(this, this.microsec_slider, 'microsec', { min: this._defaults.microsecMin, max: microsecMax, step: this._defaults.stepMicrosec });
755
+ this.control.value(this, this.microsec_slider, 'microsec', this.microsec - (this.microsec % this._defaults.stepMicrosec));
756
+ }
757
+ }
758
+
759
+ },
760
+
761
+ /*
762
+ * when a slider moves, set the internal time...
763
+ * on time change is also called when the time is updated in the text field
764
+ */
765
+ _onTimeChange: function () {
766
+ if (!this._defaults.showTimepicker) {
767
+ return;
768
+ }
769
+ var hour = (this.hour_slider) ? this.control.value(this, this.hour_slider, 'hour') : false,
770
+ minute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false,
771
+ second = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false,
772
+ millisec = (this.millisec_slider) ? this.control.value(this, this.millisec_slider, 'millisec') : false,
773
+ microsec = (this.microsec_slider) ? this.control.value(this, this.microsec_slider, 'microsec') : false,
774
+ timezone = (this.timezone_select) ? this.timezone_select.val() : false,
775
+ o = this._defaults,
776
+ pickerTimeFormat = o.pickerTimeFormat || o.timeFormat,
777
+ pickerTimeSuffix = o.pickerTimeSuffix || o.timeSuffix;
778
+
779
+ if (typeof(hour) === 'object') {
780
+ hour = false;
781
+ }
782
+ if (typeof(minute) === 'object') {
783
+ minute = false;
784
+ }
785
+ if (typeof(second) === 'object') {
786
+ second = false;
787
+ }
788
+ if (typeof(millisec) === 'object') {
789
+ millisec = false;
790
+ }
791
+ if (typeof(microsec) === 'object') {
792
+ microsec = false;
793
+ }
794
+ if (typeof(timezone) === 'object') {
795
+ timezone = false;
796
+ }
797
+
798
+ if (hour !== false) {
799
+ hour = parseInt(hour, 10);
800
+ }
801
+ if (minute !== false) {
802
+ minute = parseInt(minute, 10);
803
+ }
804
+ if (second !== false) {
805
+ second = parseInt(second, 10);
806
+ }
807
+ if (millisec !== false) {
808
+ millisec = parseInt(millisec, 10);
809
+ }
810
+ if (microsec !== false) {
811
+ microsec = parseInt(microsec, 10);
812
+ }
813
+ if (timezone !== false) {
814
+ timezone = timezone.toString();
815
+ }
816
+
817
+ var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
818
+
819
+ // If the update was done in the input field, the input field should not be updated.
820
+ // If the update was done using the sliders, update the input field.
821
+ var hasChanged = (
822
+ hour !== parseInt(this.hour,10) || // sliders should all be numeric
823
+ minute !== parseInt(this.minute,10) ||
824
+ second !== parseInt(this.second,10) ||
825
+ millisec !== parseInt(this.millisec,10) ||
826
+ microsec !== parseInt(this.microsec,10) ||
827
+ (this.ampm.length > 0 && (hour < 12) !== ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1)) ||
828
+ (this.timezone !== null && timezone !== this.timezone.toString()) // could be numeric or "EST" format, so use toString()
829
+ );
830
+
831
+ if (hasChanged) {
832
+
833
+ if (hour !== false) {
834
+ this.hour = hour;
835
+ }
836
+ if (minute !== false) {
837
+ this.minute = minute;
838
+ }
839
+ if (second !== false) {
840
+ this.second = second;
841
+ }
842
+ if (millisec !== false) {
843
+ this.millisec = millisec;
844
+ }
845
+ if (microsec !== false) {
846
+ this.microsec = microsec;
847
+ }
848
+ if (timezone !== false) {
849
+ this.timezone = timezone;
850
+ }
851
+
852
+ if (!this.inst) {
853
+ this.inst = $.datepicker._getInst(this.$input[0]);
854
+ }
855
+
856
+ this._limitMinMaxDateTime(this.inst, true);
857
+ }
858
+ if (this.support.ampm) {
859
+ this.ampm = ampm;
860
+ }
861
+
862
+ // Updates the time within the timepicker
863
+ this.formattedTime = $.datepicker.formatTime(o.timeFormat, this, o);
864
+ if (this.$timeObj) {
865
+ if (pickerTimeFormat === o.timeFormat) {
866
+ this.$timeObj.text(this.formattedTime + pickerTimeSuffix);
867
+ }
868
+ else {
869
+ this.$timeObj.text($.datepicker.formatTime(pickerTimeFormat, this, o) + pickerTimeSuffix);
870
+ }
871
+ }
872
+
873
+ this.timeDefined = true;
874
+ if (hasChanged) {
875
+ this._updateDateTime();
876
+ //this.$input.focus(); // may automatically open the picker on setDate
877
+ }
878
+ },
879
+
880
+ /*
881
+ * call custom onSelect.
882
+ * bind to sliders slidestop, and grid click.
883
+ */
884
+ _onSelectHandler: function () {
885
+ var onSelect = this._defaults.onSelect || this.inst.settings.onSelect;
886
+ var inputEl = this.$input ? this.$input[0] : null;
887
+ if (onSelect && inputEl) {
888
+ onSelect.apply(inputEl, [this.formattedDateTime, this]);
889
+ }
890
+ },
891
+
892
+ /*
893
+ * update our input with the new date time..
894
+ */
895
+ _updateDateTime: function (dp_inst) {
896
+ dp_inst = this.inst || dp_inst;
897
+ var dtTmp = (dp_inst.currentYear > 0?
898
+ new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay) :
899
+ new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
900
+ dt = $.datepicker._daylightSavingAdjust(dtTmp),
901
+ //dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
902
+ //dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay)),
903
+ dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
904
+ formatCfg = $.datepicker._getFormatConfig(dp_inst),
905
+ timeAvailable = dt !== null && this.timeDefined;
906
+ this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
907
+ var formattedDateTime = this.formattedDate;
908
+
909
+ // if a slider was changed but datepicker doesn't have a value yet, set it
910
+ if (dp_inst.lastVal === "") {
911
+ dp_inst.currentYear = dp_inst.selectedYear;
912
+ dp_inst.currentMonth = dp_inst.selectedMonth;
913
+ dp_inst.currentDay = dp_inst.selectedDay;
914
+ }
915
+
916
+ /*
917
+ * remove following lines to force every changes in date picker to change the input value
918
+ * Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker.
919
+ * If the user manually empty the value in the input field, the date picker will never change selected value.
920
+ */
921
+ //if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) {
922
+ // return;
923
+ //}
924
+
925
+ if (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === false) {
926
+ formattedDateTime = this.formattedTime;
927
+ } else if ((this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) || (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === true)) {
928
+ formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
929
+ }
930
+
931
+ this.formattedDateTime = formattedDateTime;
932
+
933
+ if (!this._defaults.showTimepicker) {
934
+ this.$input.val(this.formattedDate);
935
+ } else if (this.$altInput && this._defaults.timeOnly === false && this._defaults.altFieldTimeOnly === true) {
936
+ this.$altInput.val(this.formattedTime);
937
+ this.$input.val(this.formattedDate);
938
+ } else if (this.$altInput) {
939
+ this.$input.val(formattedDateTime);
940
+ var altFormattedDateTime = '',
941
+ altSeparator = this._defaults.altSeparator !== null ? this._defaults.altSeparator : this._defaults.separator,
942
+ altTimeSuffix = this._defaults.altTimeSuffix !== null ? this._defaults.altTimeSuffix : this._defaults.timeSuffix;
943
+
944
+ if (!this._defaults.timeOnly) {
945
+ if (this._defaults.altFormat) {
946
+ altFormattedDateTime = $.datepicker.formatDate(this._defaults.altFormat, (dt === null ? new Date() : dt), formatCfg);
947
+ }
948
+ else {
949
+ altFormattedDateTime = this.formattedDate;
950
+ }
951
+
952
+ if (altFormattedDateTime) {
953
+ altFormattedDateTime += altSeparator;
954
+ }
955
+ }
956
+
957
+ if (this._defaults.altTimeFormat !== null) {
958
+ altFormattedDateTime += $.datepicker.formatTime(this._defaults.altTimeFormat, this, this._defaults) + altTimeSuffix;
959
+ }
960
+ else {
961
+ altFormattedDateTime += this.formattedTime + altTimeSuffix;
962
+ }
963
+ this.$altInput.val(altFormattedDateTime);
964
+ } else {
965
+ this.$input.val(formattedDateTime);
966
+ }
967
+
968
+ this.$input.trigger("change");
969
+ },
970
+
971
+ _onFocus: function () {
972
+ if (!this.$input.val() && this._defaults.defaultValue) {
973
+ this.$input.val(this._defaults.defaultValue);
974
+ var inst = $.datepicker._getInst(this.$input.get(0)),
975
+ tp_inst = $.datepicker._get(inst, 'timepicker');
976
+ if (tp_inst) {
977
+ if (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) {
978
+ try {
979
+ $.datepicker._updateDatepicker(inst);
980
+ } catch (err) {
981
+ $.timepicker.log(err);
982
+ }
983
+ }
984
+ }
985
+ }
986
+ },
987
+
988
+ /*
989
+ * Small abstraction to control types
990
+ * We can add more, just be sure to follow the pattern: create, options, value
991
+ */
992
+ _controls: {
993
+ // slider methods
994
+ slider: {
995
+ create: function (tp_inst, obj, unit, val, min, max, step) {
996
+ var rtl = tp_inst._defaults.isRTL; // if rtl go -60->0 instead of 0->60
997
+ return obj.prop('slide', null).slider({
998
+ orientation: "horizontal",
999
+ value: rtl ? val * -1 : val,
1000
+ min: rtl ? max * -1 : min,
1001
+ max: rtl ? min * -1 : max,
1002
+ step: step,
1003
+ slide: function (event, ui) {
1004
+ tp_inst.control.value(tp_inst, $(this), unit, rtl ? ui.value * -1 : ui.value);
1005
+ tp_inst._onTimeChange();
1006
+ },
1007
+ stop: function (event, ui) {
1008
+ tp_inst._onSelectHandler();
1009
+ }
1010
+ });
1011
+ },
1012
+ options: function (tp_inst, obj, unit, opts, val) {
1013
+ if (tp_inst._defaults.isRTL) {
1014
+ if (typeof(opts) === 'string') {
1015
+ if (opts === 'min' || opts === 'max') {
1016
+ if (val !== undefined) {
1017
+ return obj.slider(opts, val * -1);
1018
+ }
1019
+ return Math.abs(obj.slider(opts));
1020
+ }
1021
+ return obj.slider(opts);
1022
+ }
1023
+ var min = opts.min,
1024
+ max = opts.max;
1025
+ opts.min = opts.max = null;
1026
+ if (min !== undefined) {
1027
+ opts.max = min * -1;
1028
+ }
1029
+ if (max !== undefined) {
1030
+ opts.min = max * -1;
1031
+ }
1032
+ return obj.slider(opts);
1033
+ }
1034
+ if (typeof(opts) === 'string' && val !== undefined) {
1035
+ return obj.slider(opts, val);
1036
+ }
1037
+ return obj.slider(opts);
1038
+ },
1039
+ value: function (tp_inst, obj, unit, val) {
1040
+ if (tp_inst._defaults.isRTL) {
1041
+ if (val !== undefined) {
1042
+ return obj.slider('value', val * -1);
1043
+ }
1044
+ return Math.abs(obj.slider('value'));
1045
+ }
1046
+ if (val !== undefined) {
1047
+ return obj.slider('value', val);
1048
+ }
1049
+ return obj.slider('value');
1050
+ }
1051
+ },
1052
+ // select methods
1053
+ select: {
1054
+ create: function (tp_inst, obj, unit, val, min, max, step) {
1055
+ var sel = '<select class="ui-timepicker-select ui-state-default ui-corner-all" data-unit="' + unit + '" data-min="' + min + '" data-max="' + max + '" data-step="' + step + '">',
1056
+ format = tp_inst._defaults.pickerTimeFormat || tp_inst._defaults.timeFormat;
1057
+
1058
+ for (var i = min; i <= max; i += step) {
1059
+ sel += '<option value="' + i + '"' + (i === val ? ' selected' : '') + '>';
1060
+ if (unit === 'hour') {
1061
+ sel += $.datepicker.formatTime($.trim(format.replace(/[^ht ]/ig, '')), {hour: i}, tp_inst._defaults);
1062
+ }
1063
+ else if (unit === 'millisec' || unit === 'microsec' || i >= 10) { sel += i; }
1064
+ else {sel += '0' + i.toString(); }
1065
+ sel += '</option>';
1066
+ }
1067
+ sel += '</select>';
1068
+
1069
+ obj.children('select').remove();
1070
+
1071
+ $(sel).appendTo(obj).change(function (e) {
1072
+ tp_inst._onTimeChange();
1073
+ tp_inst._onSelectHandler();
1074
+ tp_inst._afterInject();
1075
+ });
1076
+
1077
+ return obj;
1078
+ },
1079
+ options: function (tp_inst, obj, unit, opts, val) {
1080
+ var o = {},
1081
+ $t = obj.children('select');
1082
+ if (typeof(opts) === 'string') {
1083
+ if (val === undefined) {
1084
+ return $t.data(opts);
1085
+ }
1086
+ o[opts] = val;
1087
+ }
1088
+ else { o = opts; }
1089
+ return tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min>=0 ? o.min : $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step'));
1090
+ },
1091
+ value: function (tp_inst, obj, unit, val) {
1092
+ var $t = obj.children('select');
1093
+ if (val !== undefined) {
1094
+ return $t.val(val);
1095
+ }
1096
+ return $t.val();
1097
+ }
1098
+ }
1099
+ } // end _controls
1100
+
1101
+ });
1102
+
1103
+ $.fn.extend({
1104
+ /*
1105
+ * shorthand just to use timepicker.
1106
+ */
1107
+ timepicker: function (o) {
1108
+ o = o || {};
1109
+ var tmp_args = Array.prototype.slice.call(arguments);
1110
+
1111
+ if (typeof o === 'object') {
1112
+ tmp_args[0] = $.extend(o, {
1113
+ timeOnly: true
1114
+ });
1115
+ }
1116
+
1117
+ return $(this).each(function () {
1118
+ $.fn.datetimepicker.apply($(this), tmp_args);
1119
+ });
1120
+ },
1121
+
1122
+ /*
1123
+ * extend timepicker to datepicker
1124
+ */
1125
+ datetimepicker: function (o) {
1126
+ o = o || {};
1127
+ var tmp_args = arguments;
1128
+
1129
+ if (typeof(o) === 'string') {
1130
+ if (o === 'getDate' || (o === 'option' && tmp_args.length === 2 && typeof (tmp_args[1]) === 'string')) {
1131
+ return $.fn.datepicker.apply($(this[0]), tmp_args);
1132
+ } else {
1133
+ return this.each(function () {
1134
+ var $t = $(this);
1135
+ $t.datepicker.apply($t, tmp_args);
1136
+ });
1137
+ }
1138
+ } else {
1139
+ return this.each(function () {
1140
+ var $t = $(this);
1141
+ $t.datepicker($.timepicker._newInst($t, o)._defaults);
1142
+ });
1143
+ }
1144
+ }
1145
+ });
1146
+
1147
+ /*
1148
+ * Public Utility to parse date and time
1149
+ */
1150
+ $.datepicker.parseDateTime = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
1151
+ var parseRes = parseDateTimeInternal(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings);
1152
+ if (parseRes.timeObj) {
1153
+ var t = parseRes.timeObj;
1154
+ parseRes.date.setHours(t.hour, t.minute, t.second, t.millisec);
1155
+ parseRes.date.setMicroseconds(t.microsec);
1156
+ }
1157
+
1158
+ return parseRes.date;
1159
+ };
1160
+
1161
+ /*
1162
+ * Public utility to parse time
1163
+ */
1164
+ $.datepicker.parseTime = function (timeFormat, timeString, options) {
1165
+ var o = extendRemove(extendRemove({}, $.timepicker._defaults), options || {}),
1166
+ iso8601 = (timeFormat.replace(/\'.*?\'/g, '').indexOf('Z') !== -1);
1167
+
1168
+ // Strict parse requires the timeString to match the timeFormat exactly
1169
+ var strictParse = function (f, s, o) {
1170
+
1171
+ // pattern for standard and localized AM/PM markers
1172
+ var getPatternAmpm = function (amNames, pmNames) {
1173
+ var markers = [];
1174
+ if (amNames) {
1175
+ $.merge(markers, amNames);
1176
+ }
1177
+ if (pmNames) {
1178
+ $.merge(markers, pmNames);
1179
+ }
1180
+ markers = $.map(markers, function (val) {
1181
+ return val.replace(/[.*+?|()\[\]{}\\]/g, '\\$&');
1182
+ });
1183
+ return '(' + markers.join('|') + ')?';
1184
+ };
1185
+
1186
+ // figure out position of time elements.. cause js cant do named captures
1187
+ var getFormatPositions = function (timeFormat) {
1188
+ var finds = timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),
1189
+ orders = {
1190
+ h: -1,
1191
+ m: -1,
1192
+ s: -1,
1193
+ l: -1,
1194
+ c: -1,
1195
+ t: -1,
1196
+ z: -1
1197
+ };
1198
+
1199
+ if (finds) {
1200
+ for (var i = 0; i < finds.length; i++) {
1201
+ if (orders[finds[i].toString().charAt(0)] === -1) {
1202
+ orders[finds[i].toString().charAt(0)] = i + 1;
1203
+ }
1204
+ }
1205
+ }
1206
+ return orders;
1207
+ };
1208
+
1209
+ var regstr = '^' + f.toString()
1210
+ .replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {
1211
+ var ml = match.length;
1212
+ switch (match.charAt(0).toLowerCase()) {
1213
+ case 'h':
1214
+ return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
1215
+ case 'm':
1216
+ return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
1217
+ case 's':
1218
+ return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
1219
+ case 'l':
1220
+ return '(\\d?\\d?\\d)';
1221
+ case 'c':
1222
+ return '(\\d?\\d?\\d)';
1223
+ case 'z':
1224
+ return '(z|[-+]\\d\\d:?\\d\\d|\\S+)?';
1225
+ case 't':
1226
+ return getPatternAmpm(o.amNames, o.pmNames);
1227
+ default: // literal escaped in quotes
1228
+ return '(' + match.replace(/\'/g, "").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g, function (m) { return "\\" + m; }) + ')?';
1229
+ }
1230
+ })
1231
+ .replace(/\s/g, '\\s?') +
1232
+ o.timeSuffix + '$',
1233
+ order = getFormatPositions(f),
1234
+ ampm = '',
1235
+ treg;
1236
+
1237
+ treg = s.match(new RegExp(regstr, 'i'));
1238
+
1239
+ var resTime = {
1240
+ hour: 0,
1241
+ minute: 0,
1242
+ second: 0,
1243
+ millisec: 0,
1244
+ microsec: 0
1245
+ };
1246
+
1247
+ if (treg) {
1248
+ if (order.t !== -1) {
1249
+ if (treg[order.t] === undefined || treg[order.t].length === 0) {
1250
+ ampm = '';
1251
+ resTime.ampm = '';
1252
+ } else {
1253
+ ampm = $.inArray(treg[order.t].toUpperCase(), $.map(o.amNames, function (x,i) { return x.toUpperCase(); })) !== -1 ? 'AM' : 'PM';
1254
+ resTime.ampm = o[ampm === 'AM' ? 'amNames' : 'pmNames'][0];
1255
+ }
1256
+ }
1257
+
1258
+ if (order.h !== -1) {
1259
+ if (ampm === 'AM' && treg[order.h] === '12') {
1260
+ resTime.hour = 0; // 12am = 0 hour
1261
+ } else {
1262
+ if (ampm === 'PM' && treg[order.h] !== '12') {
1263
+ resTime.hour = parseInt(treg[order.h], 10) + 12; // 12pm = 12 hour, any other pm = hour + 12
1264
+ } else {
1265
+ resTime.hour = Number(treg[order.h]);
1266
+ }
1267
+ }
1268
+ }
1269
+
1270
+ if (order.m !== -1) {
1271
+ resTime.minute = Number(treg[order.m]);
1272
+ }
1273
+ if (order.s !== -1) {
1274
+ resTime.second = Number(treg[order.s]);
1275
+ }
1276
+ if (order.l !== -1) {
1277
+ resTime.millisec = Number(treg[order.l]);
1278
+ }
1279
+ if (order.c !== -1) {
1280
+ resTime.microsec = Number(treg[order.c]);
1281
+ }
1282
+ if (order.z !== -1 && treg[order.z] !== undefined) {
1283
+ resTime.timezone = $.timepicker.timezoneOffsetNumber(treg[order.z]);
1284
+ }
1285
+
1286
+
1287
+ return resTime;
1288
+ }
1289
+ return false;
1290
+ };// end strictParse
1291
+
1292
+ // First try JS Date, if that fails, use strictParse
1293
+ var looseParse = function (f, s, o) {
1294
+ try {
1295
+ var d = new Date('2012-01-01 ' + s);
1296
+ if (isNaN(d.getTime())) {
1297
+ d = new Date('2012-01-01T' + s);
1298
+ if (isNaN(d.getTime())) {
1299
+ d = new Date('01/01/2012 ' + s);
1300
+ if (isNaN(d.getTime())) {
1301
+ throw "Unable to parse time with native Date: " + s;
1302
+ }
1303
+ }
1304
+ }
1305
+
1306
+ return {
1307
+ hour: d.getHours(),
1308
+ minute: d.getMinutes(),
1309
+ second: d.getSeconds(),
1310
+ millisec: d.getMilliseconds(),
1311
+ microsec: d.getMicroseconds(),
1312
+ timezone: d.getTimezoneOffset() * -1
1313
+ };
1314
+ }
1315
+ catch (err) {
1316
+ try {
1317
+ return strictParse(f, s, o);
1318
+ }
1319
+ catch (err2) {
1320
+ $.timepicker.log("Unable to parse \ntimeString: " + s + "\ntimeFormat: " + f);
1321
+ }
1322
+ }
1323
+ return false;
1324
+ }; // end looseParse
1325
+
1326
+ if (typeof o.parse === "function") {
1327
+ return o.parse(timeFormat, timeString, o);
1328
+ }
1329
+ if (o.parse === 'loose') {
1330
+ return looseParse(timeFormat, timeString, o);
1331
+ }
1332
+ return strictParse(timeFormat, timeString, o);
1333
+ };
1334
+
1335
+ /**
1336
+ * Public utility to format the time
1337
+ * @param {string} format format of the time
1338
+ * @param {Object} time Object not a Date for timezones
1339
+ * @param {Object} [options] essentially the regional[].. amNames, pmNames, ampm
1340
+ * @returns {string} the formatted time
1341
+ */
1342
+ $.datepicker.formatTime = function (format, time, options) {
1343
+ options = options || {};
1344
+ options = $.extend({}, $.timepicker._defaults, options);
1345
+ time = $.extend({
1346
+ hour: 0,
1347
+ minute: 0,
1348
+ second: 0,
1349
+ millisec: 0,
1350
+ microsec: 0,
1351
+ timezone: null
1352
+ }, time);
1353
+
1354
+ var tmptime = format,
1355
+ ampmName = options.amNames[0],
1356
+ hour = parseInt(time.hour, 10);
1357
+
1358
+ if (hour > 11) {
1359
+ ampmName = options.pmNames[0];
1360
+ }
1361
+
1362
+ tmptime = tmptime.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {
1363
+ switch (match) {
1364
+ case 'HH':
1365
+ return ('0' + hour).slice(-2);
1366
+ case 'H':
1367
+ return hour;
1368
+ case 'hh':
1369
+ return ('0' + convert24to12(hour)).slice(-2);
1370
+ case 'h':
1371
+ return convert24to12(hour);
1372
+ case 'mm':
1373
+ return ('0' + time.minute).slice(-2);
1374
+ case 'm':
1375
+ return time.minute;
1376
+ case 'ss':
1377
+ return ('0' + time.second).slice(-2);
1378
+ case 's':
1379
+ return time.second;
1380
+ case 'l':
1381
+ return ('00' + time.millisec).slice(-3);
1382
+ case 'c':
1383
+ return ('00' + time.microsec).slice(-3);
1384
+ case 'z':
1385
+ return $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, false);
1386
+ case 'Z':
1387
+ return $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, true);
1388
+ case 'T':
1389
+ return ampmName.charAt(0).toUpperCase();
1390
+ case 'TT':
1391
+ return ampmName.toUpperCase();
1392
+ case 't':
1393
+ return ampmName.charAt(0).toLowerCase();
1394
+ case 'tt':
1395
+ return ampmName.toLowerCase();
1396
+ default:
1397
+ return match.replace(/'/g, "");
1398
+ }
1399
+ });
1400
+
1401
+ return tmptime;
1402
+ };
1403
+
1404
+ /*
1405
+ * the bad hack :/ override datepicker so it doesn't close on select
1406
+ // inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378
1407
+ */
1408
+ $.datepicker._base_selectDate = $.datepicker._selectDate;
1409
+ $.datepicker._selectDate = function (id, dateStr) {
1410
+ var inst = this._getInst($(id)[0]),
1411
+ tp_inst = this._get(inst, 'timepicker'),
1412
+ was_inline;
1413
+
1414
+ if (tp_inst && inst.settings.showTimepicker) {
1415
+ tp_inst._limitMinMaxDateTime(inst, true);
1416
+ was_inline = inst.inline;
1417
+ inst.inline = inst.stay_open = true;
1418
+ //This way the onSelect handler called from calendarpicker get the full dateTime
1419
+ this._base_selectDate(id, dateStr);
1420
+ inst.inline = was_inline;
1421
+ inst.stay_open = false;
1422
+ this._notifyChange(inst);
1423
+ this._updateDatepicker(inst);
1424
+ } else {
1425
+ this._base_selectDate(id, dateStr);
1426
+ }
1427
+ };
1428
+
1429
+ /*
1430
+ * second bad hack :/ override datepicker so it triggers an event when changing the input field
1431
+ * and does not redraw the datepicker on every selectDate event
1432
+ */
1433
+ $.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;
1434
+ $.datepicker._updateDatepicker = function (inst) {
1435
+
1436
+ // don't popup the datepicker if there is another instance already opened
1437
+ var input = inst.input[0];
1438
+ if ($.datepicker._curInst && $.datepicker._curInst !== inst && $.datepicker._datepickerShowing && $.datepicker._lastInput !== input) {
1439
+ return;
1440
+ }
1441
+
1442
+ if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
1443
+
1444
+ this._base_updateDatepicker(inst);
1445
+
1446
+ // Reload the time control when changing something in the input text field.
1447
+ var tp_inst = this._get(inst, 'timepicker');
1448
+ if (tp_inst) {
1449
+ tp_inst._addTimePicker(inst);
1450
+ }
1451
+ }
1452
+ };
1453
+
1454
+ /*
1455
+ * third bad hack :/ override datepicker so it allows spaces and colon in the input field
1456
+ */
1457
+ $.datepicker._base_doKeyPress = $.datepicker._doKeyPress;
1458
+ $.datepicker._doKeyPress = function (event) {
1459
+ var inst = $.datepicker._getInst(event.target),
1460
+ tp_inst = $.datepicker._get(inst, 'timepicker');
1461
+
1462
+ if (tp_inst) {
1463
+ if ($.datepicker._get(inst, 'constrainInput')) {
1464
+ var ampm = tp_inst.support.ampm,
1465
+ tz = tp_inst._defaults.showTimezone !== null ? tp_inst._defaults.showTimezone : tp_inst.support.timezone,
1466
+ dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
1467
+ datetimeChars = tp_inst._defaults.timeFormat.toString()
1468
+ .replace(/[hms]/g, '')
1469
+ .replace(/TT/g, ampm ? 'APM' : '')
1470
+ .replace(/Tt/g, ampm ? 'AaPpMm' : '')
1471
+ .replace(/tT/g, ampm ? 'AaPpMm' : '')
1472
+ .replace(/T/g, ampm ? 'AP' : '')
1473
+ .replace(/tt/g, ampm ? 'apm' : '')
1474
+ .replace(/t/g, ampm ? 'ap' : '') +
1475
+ " " + tp_inst._defaults.separator +
1476
+ tp_inst._defaults.timeSuffix +
1477
+ (tz ? tp_inst._defaults.timezoneList.join('') : '') +
1478
+ (tp_inst._defaults.amNames.join('')) + (tp_inst._defaults.pmNames.join('')) +
1479
+ dateChars,
1480
+ chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
1481
+ return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
1482
+ }
1483
+ }
1484
+
1485
+ return $.datepicker._base_doKeyPress(event);
1486
+ };
1487
+
1488
+ /*
1489
+ * Fourth bad hack :/ override _updateAlternate function used in inline mode to init altField
1490
+ * Update any alternate field to synchronise with the main field.
1491
+ */
1492
+ $.datepicker._base_updateAlternate = $.datepicker._updateAlternate;
1493
+ $.datepicker._updateAlternate = function (inst) {
1494
+ var tp_inst = this._get(inst, 'timepicker');
1495
+ if (tp_inst) {
1496
+ var altField = tp_inst._defaults.altField;
1497
+ if (altField) { // update alternate field too
1498
+ var altFormat = tp_inst._defaults.altFormat || tp_inst._defaults.dateFormat,
1499
+ date = this._getDate(inst),
1500
+ formatCfg = $.datepicker._getFormatConfig(inst),
1501
+ altFormattedDateTime = '',
1502
+ altSeparator = tp_inst._defaults.altSeparator ? tp_inst._defaults.altSeparator : tp_inst._defaults.separator,
1503
+ altTimeSuffix = tp_inst._defaults.altTimeSuffix ? tp_inst._defaults.altTimeSuffix : tp_inst._defaults.timeSuffix,
1504
+ altTimeFormat = tp_inst._defaults.altTimeFormat !== null ? tp_inst._defaults.altTimeFormat : tp_inst._defaults.timeFormat;
1505
+
1506
+ altFormattedDateTime += $.datepicker.formatTime(altTimeFormat, tp_inst, tp_inst._defaults) + altTimeSuffix;
1507
+ if (!tp_inst._defaults.timeOnly && !tp_inst._defaults.altFieldTimeOnly && date !== null) {
1508
+ if (tp_inst._defaults.altFormat) {
1509
+ altFormattedDateTime = $.datepicker.formatDate(tp_inst._defaults.altFormat, date, formatCfg) + altSeparator + altFormattedDateTime;
1510
+ }
1511
+ else {
1512
+ altFormattedDateTime = tp_inst.formattedDate + altSeparator + altFormattedDateTime;
1513
+ }
1514
+ }
1515
+ $(altField).val( inst.input.val() ? altFormattedDateTime : "");
1516
+ }
1517
+ }
1518
+ else {
1519
+ $.datepicker._base_updateAlternate(inst);
1520
+ }
1521
+ };
1522
+
1523
+ /*
1524
+ * Override key up event to sync manual input changes.
1525
+ */
1526
+ $.datepicker._base_doKeyUp = $.datepicker._doKeyUp;
1527
+ $.datepicker._doKeyUp = function (event) {
1528
+ var inst = $.datepicker._getInst(event.target),
1529
+ tp_inst = $.datepicker._get(inst, 'timepicker');
1530
+
1531
+ if (tp_inst) {
1532
+ if (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) {
1533
+ try {
1534
+ $.datepicker._updateDatepicker(inst);
1535
+ } catch (err) {
1536
+ $.timepicker.log(err);
1537
+ }
1538
+ }
1539
+ }
1540
+
1541
+ return $.datepicker._base_doKeyUp(event);
1542
+ };
1543
+
1544
+ /*
1545
+ * override "Today" button to also grab the time.
1546
+ */
1547
+ $.datepicker._base_gotoToday = $.datepicker._gotoToday;
1548
+ $.datepicker._gotoToday = function (id) {
1549
+ var inst = this._getInst($(id)[0]),
1550
+ $dp = inst.dpDiv;
1551
+ var tp_inst = this._get(inst, 'timepicker');
1552
+ selectLocalTimezone(tp_inst);
1553
+ var now = new Date();
1554
+ this._setTime(inst, now);
1555
+ this._setDate(inst, now);
1556
+ this._base_gotoToday(id);
1557
+ };
1558
+
1559
+ /*
1560
+ * Disable & enable the Time in the datetimepicker
1561
+ */
1562
+ $.datepicker._disableTimepickerDatepicker = function (target) {
1563
+ var inst = this._getInst(target);
1564
+ if (!inst) {
1565
+ return;
1566
+ }
1567
+
1568
+ var tp_inst = this._get(inst, 'timepicker');
1569
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
1570
+ if (tp_inst) {
1571
+ inst.settings.showTimepicker = false;
1572
+ tp_inst._defaults.showTimepicker = false;
1573
+ tp_inst._updateDateTime(inst);
1574
+ }
1575
+ };
1576
+
1577
+ $.datepicker._enableTimepickerDatepicker = function (target) {
1578
+ var inst = this._getInst(target);
1579
+ if (!inst) {
1580
+ return;
1581
+ }
1582
+
1583
+ var tp_inst = this._get(inst, 'timepicker');
1584
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
1585
+ if (tp_inst) {
1586
+ inst.settings.showTimepicker = true;
1587
+ tp_inst._defaults.showTimepicker = true;
1588
+ tp_inst._addTimePicker(inst); // Could be disabled on page load
1589
+ tp_inst._updateDateTime(inst);
1590
+ }
1591
+ };
1592
+
1593
+ /*
1594
+ * Create our own set time function
1595
+ */
1596
+ $.datepicker._setTime = function (inst, date) {
1597
+ var tp_inst = this._get(inst, 'timepicker');
1598
+ if (tp_inst) {
1599
+ var defaults = tp_inst._defaults;
1600
+
1601
+ // calling _setTime with no date sets time to defaults
1602
+ tp_inst.hour = date ? date.getHours() : defaults.hour;
1603
+ tp_inst.minute = date ? date.getMinutes() : defaults.minute;
1604
+ tp_inst.second = date ? date.getSeconds() : defaults.second;
1605
+ tp_inst.millisec = date ? date.getMilliseconds() : defaults.millisec;
1606
+ tp_inst.microsec = date ? date.getMicroseconds() : defaults.microsec;
1607
+
1608
+ //check if within min/max times..
1609
+ tp_inst._limitMinMaxDateTime(inst, true);
1610
+
1611
+ tp_inst._onTimeChange();
1612
+ tp_inst._updateDateTime(inst);
1613
+ }
1614
+ };
1615
+
1616
+ /*
1617
+ * Create new public method to set only time, callable as $().datepicker('setTime', date)
1618
+ */
1619
+ $.datepicker._setTimeDatepicker = function (target, date, withDate) {
1620
+ var inst = this._getInst(target);
1621
+ if (!inst) {
1622
+ return;
1623
+ }
1624
+
1625
+ var tp_inst = this._get(inst, 'timepicker');
1626
+
1627
+ if (tp_inst) {
1628
+ this._setDateFromField(inst);
1629
+ var tp_date;
1630
+ if (date) {
1631
+ if (typeof date === "string") {
1632
+ tp_inst._parseTime(date, withDate);
1633
+ tp_date = new Date();
1634
+ tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1635
+ tp_date.setMicroseconds(tp_inst.microsec);
1636
+ } else {
1637
+ tp_date = new Date(date.getTime());
1638
+ tp_date.setMicroseconds(date.getMicroseconds());
1639
+ }
1640
+ if (tp_date.toString() === 'Invalid Date') {
1641
+ tp_date = undefined;
1642
+ }
1643
+ this._setTime(inst, tp_date);
1644
+ }
1645
+ }
1646
+
1647
+ };
1648
+
1649
+ /*
1650
+ * override setDate() to allow setting time too within Date object
1651
+ */
1652
+ $.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
1653
+ $.datepicker._setDateDatepicker = function (target, _date) {
1654
+ var inst = this._getInst(target);
1655
+ var date = _date;
1656
+ if (!inst) {
1657
+ return;
1658
+ }
1659
+
1660
+ if (typeof(_date) === 'string') {
1661
+ date = new Date(_date);
1662
+ if (!date.getTime()) {
1663
+ this._base_setDateDatepicker.apply(this, arguments);
1664
+ date = $(target).datepicker('getDate');
1665
+ }
1666
+ }
1667
+
1668
+ var tp_inst = this._get(inst, 'timepicker');
1669
+ var tp_date;
1670
+ if (date instanceof Date) {
1671
+ tp_date = new Date(date.getTime());
1672
+ tp_date.setMicroseconds(date.getMicroseconds());
1673
+ } else {
1674
+ tp_date = date;
1675
+ }
1676
+
1677
+ // This is important if you are using the timezone option, javascript's Date
1678
+ // object will only return the timezone offset for the current locale, so we
1679
+ // adjust it accordingly. If not using timezone option this won't matter..
1680
+ // If a timezone is different in tp, keep the timezone as is
1681
+ if (tp_inst && tp_date) {
1682
+ // look out for DST if tz wasn't specified
1683
+ if (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) {
1684
+ tp_inst.timezone = tp_date.getTimezoneOffset() * -1;
1685
+ }
1686
+ date = $.timepicker.timezoneAdjust(date, tp_inst.timezone);
1687
+ tp_date = $.timepicker.timezoneAdjust(tp_date, tp_inst.timezone);
1688
+ }
1689
+
1690
+ this._updateDatepicker(inst);
1691
+ this._base_setDateDatepicker.apply(this, arguments);
1692
+ this._setTimeDatepicker(target, tp_date, true);
1693
+ };
1694
+
1695
+ /*
1696
+ * override getDate() to allow getting time too within Date object
1697
+ */
1698
+ $.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;
1699
+ $.datepicker._getDateDatepicker = function (target, noDefault) {
1700
+ var inst = this._getInst(target);
1701
+ if (!inst) {
1702
+ return;
1703
+ }
1704
+
1705
+ var tp_inst = this._get(inst, 'timepicker');
1706
+
1707
+ if (tp_inst) {
1708
+ // if it hasn't yet been defined, grab from field
1709
+ if (inst.lastVal === undefined) {
1710
+ this._setDateFromField(inst, noDefault);
1711
+ }
1712
+
1713
+ var date = this._getDate(inst);
1714
+ var currDT = $.trim((tp_inst.$altInput && tp_inst._defaults.altFieldTimeOnly) ? tp_inst.$input.val() + ' ' + tp_inst.$altInput.val() : tp_inst.$input.val());
1715
+ if (date && tp_inst._parseTime(currDT, !inst.settings.timeOnly)) {
1716
+ date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1717
+ date.setMicroseconds(tp_inst.microsec);
1718
+
1719
+ // This is important if you are using the timezone option, javascript's Date
1720
+ // object will only return the timezone offset for the current locale, so we
1721
+ // adjust it accordingly. If not using timezone option this won't matter..
1722
+ if (tp_inst.timezone != null) {
1723
+ // look out for DST if tz wasn't specified
1724
+ if (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) {
1725
+ tp_inst.timezone = date.getTimezoneOffset() * -1;
1726
+ }
1727
+ date = $.timepicker.timezoneAdjust(date, tp_inst.timezone);
1728
+ }
1729
+ }
1730
+ return date;
1731
+ }
1732
+ return this._base_getDateDatepicker(target, noDefault);
1733
+ };
1734
+
1735
+ /*
1736
+ * override parseDate() because UI 1.8.14 throws an error about "Extra characters"
1737
+ * An option in datapicker to ignore extra format characters would be nicer.
1738
+ */
1739
+ $.datepicker._base_parseDate = $.datepicker.parseDate;
1740
+ $.datepicker.parseDate = function (format, value, settings) {
1741
+ var date;
1742
+ try {
1743
+ date = this._base_parseDate(format, value, settings);
1744
+ } catch (err) {
1745
+ // Hack! The error message ends with a colon, a space, and
1746
+ // the "extra" characters. We rely on that instead of
1747
+ // attempting to perfectly reproduce the parsing algorithm.
1748
+ if (err.indexOf(":") >= 0) {
1749
+ date = this._base_parseDate(format, value.substring(0, value.length - (err.length - err.indexOf(':') - 2)), settings);
1750
+ $.timepicker.log("Error parsing the date string: " + err + "\ndate string = " + value + "\ndate format = " + format);
1751
+ } else {
1752
+ throw err;
1753
+ }
1754
+ }
1755
+ return date;
1756
+ };
1757
+
1758
+ /*
1759
+ * override formatDate to set date with time to the input
1760
+ */
1761
+ $.datepicker._base_formatDate = $.datepicker._formatDate;
1762
+ $.datepicker._formatDate = function (inst, day, month, year) {
1763
+ var tp_inst = this._get(inst, 'timepicker');
1764
+ if (tp_inst) {
1765
+ tp_inst._updateDateTime(inst);
1766
+ return tp_inst.$input.val();
1767
+ }
1768
+ return this._base_formatDate(inst);
1769
+ };
1770
+
1771
+ /*
1772
+ * override options setter to add time to maxDate(Time) and minDate(Time). MaxDate
1773
+ */
1774
+ $.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;
1775
+ $.datepicker._optionDatepicker = function (target, name, value) {
1776
+ var inst = this._getInst(target),
1777
+ name_clone;
1778
+ if (!inst) {
1779
+ return null;
1780
+ }
1781
+
1782
+ var tp_inst = this._get(inst, 'timepicker');
1783
+ if (tp_inst) {
1784
+ var min = null,
1785
+ max = null,
1786
+ onselect = null,
1787
+ overrides = tp_inst._defaults.evnts,
1788
+ fns = {},
1789
+ prop,
1790
+ ret,
1791
+ oldVal,
1792
+ $target;
1793
+ if (typeof name === 'string') { // if min/max was set with the string
1794
+ if (name === 'minDate' || name === 'minDateTime') {
1795
+ min = value;
1796
+ } else if (name === 'maxDate' || name === 'maxDateTime') {
1797
+ max = value;
1798
+ } else if (name === 'onSelect') {
1799
+ onselect = value;
1800
+ } else if (overrides.hasOwnProperty(name)) {
1801
+ if (typeof (value) === 'undefined') {
1802
+ return overrides[name];
1803
+ }
1804
+ fns[name] = value;
1805
+ name_clone = {}; //empty results in exiting function after overrides updated
1806
+ }
1807
+ } else if (typeof name === 'object') { //if min/max was set with the JSON
1808
+ if (name.minDate) {
1809
+ min = name.minDate;
1810
+ } else if (name.minDateTime) {
1811
+ min = name.minDateTime;
1812
+ } else if (name.maxDate) {
1813
+ max = name.maxDate;
1814
+ } else if (name.maxDateTime) {
1815
+ max = name.maxDateTime;
1816
+ }
1817
+ for (prop in overrides) {
1818
+ if (overrides.hasOwnProperty(prop) && name[prop]) {
1819
+ fns[prop] = name[prop];
1820
+ }
1821
+ }
1822
+ }
1823
+ for (prop in fns) {
1824
+ if (fns.hasOwnProperty(prop)) {
1825
+ overrides[prop] = fns[prop];
1826
+ if (!name_clone) { name_clone = $.extend({}, name); }
1827
+ delete name_clone[prop];
1828
+ }
1829
+ }
1830
+ if (name_clone && isEmptyObject(name_clone)) { return; }
1831
+ if (min) { //if min was set
1832
+ if (min === 0) {
1833
+ min = new Date();
1834
+ } else {
1835
+ min = new Date(min);
1836
+ }
1837
+ tp_inst._defaults.minDate = min;
1838
+ tp_inst._defaults.minDateTime = min;
1839
+ } else if (max) { //if max was set
1840
+ if (max === 0) {
1841
+ max = new Date();
1842
+ } else {
1843
+ max = new Date(max);
1844
+ }
1845
+ tp_inst._defaults.maxDate = max;
1846
+ tp_inst._defaults.maxDateTime = max;
1847
+ } else if (onselect) {
1848
+ tp_inst._defaults.onSelect = onselect;
1849
+ }
1850
+
1851
+ // Datepicker will override our date when we call _base_optionDatepicker when
1852
+ // calling minDate/maxDate, so we will first grab the value, call
1853
+ // _base_optionDatepicker, then set our value back.
1854
+ if(min || max){
1855
+ $target = $(target);
1856
+ oldVal = $target.datetimepicker('getDate');
1857
+ ret = this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
1858
+ $target.datetimepicker('setDate', oldVal);
1859
+ return ret;
1860
+ }
1861
+ }
1862
+ if (value === undefined) {
1863
+ return this._base_optionDatepicker.call($.datepicker, target, name);
1864
+ }
1865
+ return this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
1866
+ };
1867
+
1868
+ /*
1869
+ * jQuery isEmptyObject does not check hasOwnProperty - if someone has added to the object prototype,
1870
+ * it will return false for all objects
1871
+ */
1872
+ var isEmptyObject = function (obj) {
1873
+ var prop;
1874
+ for (prop in obj) {
1875
+ if (obj.hasOwnProperty(prop)) {
1876
+ return false;
1877
+ }
1878
+ }
1879
+ return true;
1880
+ };
1881
+
1882
+ /*
1883
+ * jQuery extend now ignores nulls!
1884
+ */
1885
+ var extendRemove = function (target, props) {
1886
+ $.extend(target, props);
1887
+ for (var name in props) {
1888
+ if (props[name] === null || props[name] === undefined) {
1889
+ target[name] = props[name];
1890
+ }
1891
+ }
1892
+ return target;
1893
+ };
1894
+
1895
+ /*
1896
+ * Determine by the time format which units are supported
1897
+ * Returns an object of booleans for each unit
1898
+ */
1899
+ var detectSupport = function (timeFormat) {
1900
+ var tf = timeFormat.replace(/'.*?'/g, '').toLowerCase(), // removes literals
1901
+ isIn = function (f, t) { // does the format contain the token?
1902
+ return f.indexOf(t) !== -1 ? true : false;
1903
+ };
1904
+ return {
1905
+ hour: isIn(tf, 'h'),
1906
+ minute: isIn(tf, 'm'),
1907
+ second: isIn(tf, 's'),
1908
+ millisec: isIn(tf, 'l'),
1909
+ microsec: isIn(tf, 'c'),
1910
+ timezone: isIn(tf, 'z'),
1911
+ ampm: isIn(tf, 't') && isIn(timeFormat, 'h'),
1912
+ iso8601: isIn(timeFormat, 'Z')
1913
+ };
1914
+ };
1915
+
1916
+ /*
1917
+ * Converts 24 hour format into 12 hour
1918
+ * Returns 12 hour without leading 0
1919
+ */
1920
+ var convert24to12 = function (hour) {
1921
+ hour %= 12;
1922
+
1923
+ if (hour === 0) {
1924
+ hour = 12;
1925
+ }
1926
+
1927
+ return String(hour);
1928
+ };
1929
+
1930
+ var computeEffectiveSetting = function (settings, property) {
1931
+ return settings && settings[property] ? settings[property] : $.timepicker._defaults[property];
1932
+ };
1933
+
1934
+ /*
1935
+ * Splits datetime string into date and time substrings.
1936
+ * Throws exception when date can't be parsed
1937
+ * Returns {dateString: dateString, timeString: timeString}
1938
+ */
1939
+ var splitDateTime = function (dateTimeString, timeSettings) {
1940
+ // The idea is to get the number separator occurrences in datetime and the time format requested (since time has
1941
+ // fewer unknowns, mostly numbers and am/pm). We will use the time pattern to split.
1942
+ var separator = computeEffectiveSetting(timeSettings, 'separator'),
1943
+ format = computeEffectiveSetting(timeSettings, 'timeFormat'),
1944
+ timeParts = format.split(separator), // how many occurrences of separator may be in our format?
1945
+ timePartsLen = timeParts.length,
1946
+ allParts = dateTimeString.split(separator),
1947
+ allPartsLen = allParts.length;
1948
+
1949
+ if (allPartsLen > 1) {
1950
+ return {
1951
+ dateString: allParts.splice(0, allPartsLen - timePartsLen).join(separator),
1952
+ timeString: allParts.splice(0, timePartsLen).join(separator)
1953
+ };
1954
+ }
1955
+
1956
+ return {
1957
+ dateString: dateTimeString,
1958
+ timeString: ''
1959
+ };
1960
+ };
1961
+
1962
+ /*
1963
+ * Internal function to parse datetime interval
1964
+ * Returns: {date: Date, timeObj: Object}, where
1965
+ * date - parsed date without time (type Date)
1966
+ * timeObj = {hour: , minute: , second: , millisec: , microsec: } - parsed time. Optional
1967
+ */
1968
+ var parseDateTimeInternal = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
1969
+ var date,
1970
+ parts,
1971
+ parsedTime;
1972
+
1973
+ parts = splitDateTime(dateTimeString, timeSettings);
1974
+ date = $.datepicker._base_parseDate(dateFormat, parts.dateString, dateSettings);
1975
+
1976
+ if (parts.timeString === '') {
1977
+ return {
1978
+ date: date
1979
+ };
1980
+ }
1981
+
1982
+ parsedTime = $.datepicker.parseTime(timeFormat, parts.timeString, timeSettings);
1983
+
1984
+ if (!parsedTime) {
1985
+ throw 'Wrong time format';
1986
+ }
1987
+
1988
+ return {
1989
+ date: date,
1990
+ timeObj: parsedTime
1991
+ };
1992
+ };
1993
+
1994
+ /*
1995
+ * Internal function to set timezone_select to the local timezone
1996
+ */
1997
+ var selectLocalTimezone = function (tp_inst, date) {
1998
+ if (tp_inst && tp_inst.timezone_select) {
1999
+ var now = date || new Date();
2000
+ tp_inst.timezone_select.val(-now.getTimezoneOffset());
2001
+ }
2002
+ };
2003
+
2004
+ /*
2005
+ * Create a Singleton Instance
2006
+ */
2007
+ $.timepicker = new Timepicker();
2008
+
2009
+ /**
2010
+ * Get the timezone offset as string from a date object (eg '+0530' for UTC+5.5)
2011
+ * @param {number} tzMinutes if not a number, less than -720 (-1200), or greater than 840 (+1400) this value is returned
2012
+ * @param {boolean} iso8601 if true formats in accordance to iso8601 "+12:45"
2013
+ * @return {string}
2014
+ */
2015
+ $.timepicker.timezoneOffsetString = function (tzMinutes, iso8601) {
2016
+ if (isNaN(tzMinutes) || tzMinutes > 840 || tzMinutes < -720) {
2017
+ return tzMinutes;
2018
+ }
2019
+
2020
+ var off = tzMinutes,
2021
+ minutes = off % 60,
2022
+ hours = (off - minutes) / 60,
2023
+ iso = iso8601 ? ':' : '',
2024
+ tz = (off >= 0 ? '+' : '-') + ('0' + Math.abs(hours)).slice(-2) + iso + ('0' + Math.abs(minutes)).slice(-2);
2025
+
2026
+ if (tz === '+00:00') {
2027
+ return 'Z';
2028
+ }
2029
+ return tz;
2030
+ };
2031
+
2032
+ /**
2033
+ * Get the number in minutes that represents a timezone string
2034
+ * @param {string} tzString formatted like "+0500", "-1245", "Z"
2035
+ * @return {number} the offset minutes or the original string if it doesn't match expectations
2036
+ */
2037
+ $.timepicker.timezoneOffsetNumber = function (tzString) {
2038
+ var normalized = tzString.toString().replace(':', ''); // excuse any iso8601, end up with "+1245"
2039
+
2040
+ if (normalized.toUpperCase() === 'Z') { // if iso8601 with Z, its 0 minute offset
2041
+ return 0;
2042
+ }
2043
+
2044
+ if (!/^(\-|\+)\d{4}$/.test(normalized)) { // possibly a user defined tz, so just give it back
2045
+ return tzString;
2046
+ }
2047
+
2048
+ return ((normalized.substr(0, 1) === '-' ? -1 : 1) * // plus or minus
2049
+ ((parseInt(normalized.substr(1, 2), 10) * 60) + // hours (converted to minutes)
2050
+ parseInt(normalized.substr(3, 2), 10))); // minutes
2051
+ };
2052
+
2053
+ /**
2054
+ * No way to set timezone in js Date, so we must adjust the minutes to compensate. (think setDate, getDate)
2055
+ * @param {Date} date
2056
+ * @param {string} toTimezone formatted like "+0500", "-1245"
2057
+ * @return {Date}
2058
+ */
2059
+ $.timepicker.timezoneAdjust = function (date, toTimezone) {
2060
+ var toTz = $.timepicker.timezoneOffsetNumber(toTimezone);
2061
+ if (!isNaN(toTz)) {
2062
+ date.setMinutes(date.getMinutes() + -date.getTimezoneOffset() - toTz);
2063
+ }
2064
+ return date;
2065
+ };
2066
+
2067
+ /**
2068
+ * Calls `timepicker()` on the `startTime` and `endTime` elements, and configures them to
2069
+ * enforce date range limits.
2070
+ * n.b. The input value must be correctly formatted (reformatting is not supported)
2071
+ * @param {Element} startTime
2072
+ * @param {Element} endTime
2073
+ * @param {Object} options Options for the timepicker() call
2074
+ * @return {jQuery}
2075
+ */
2076
+ $.timepicker.timeRange = function (startTime, endTime, options) {
2077
+ return $.timepicker.handleRange('timepicker', startTime, endTime, options);
2078
+ };
2079
+
2080
+ /**
2081
+ * Calls `datetimepicker` on the `startTime` and `endTime` elements, and configures them to
2082
+ * enforce date range limits.
2083
+ * @param {Element} startTime
2084
+ * @param {Element} endTime
2085
+ * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
2086
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
2087
+ * @param {string} method Can be used to specify the type of picker to be added
2088
+ * @return {jQuery}
2089
+ */
2090
+ $.timepicker.datetimeRange = function (startTime, endTime, options) {
2091
+ $.timepicker.handleRange('datetimepicker', startTime, endTime, options);
2092
+ };
2093
+
2094
+ /**
2095
+ * Calls `datepicker` on the `startTime` and `endTime` elements, and configures them to
2096
+ * enforce date range limits.
2097
+ * @param {Element} startTime
2098
+ * @param {Element} endTime
2099
+ * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
2100
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
2101
+ * @return {jQuery}
2102
+ */
2103
+ $.timepicker.dateRange = function (startTime, endTime, options) {
2104
+ $.timepicker.handleRange('datepicker', startTime, endTime, options);
2105
+ };
2106
+
2107
+ /**
2108
+ * Calls `method` on the `startTime` and `endTime` elements, and configures them to
2109
+ * enforce date range limits.
2110
+ * @param {string} method Can be used to specify the type of picker to be added
2111
+ * @param {Element} startTime
2112
+ * @param {Element} endTime
2113
+ * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
2114
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
2115
+ * @return {jQuery}
2116
+ */
2117
+ $.timepicker.handleRange = function (method, startTime, endTime, options) {
2118
+ options = $.extend({}, {
2119
+ minInterval: 0, // min allowed interval in milliseconds
2120
+ maxInterval: 0, // max allowed interval in milliseconds
2121
+ start: {}, // options for start picker
2122
+ end: {} // options for end picker
2123
+ }, options);
2124
+
2125
+ // for the mean time this fixes an issue with calling getDate with timepicker()
2126
+ var timeOnly = false;
2127
+ if(method === 'timepicker'){
2128
+ timeOnly = true;
2129
+ method = 'datetimepicker';
2130
+ }
2131
+
2132
+ function checkDates(changed, other) {
2133
+ var startdt = startTime[method]('getDate'),
2134
+ enddt = endTime[method]('getDate'),
2135
+ changeddt = changed[method]('getDate');
2136
+
2137
+ if (startdt !== null) {
2138
+ var minDate = new Date(startdt.getTime()),
2139
+ maxDate = new Date(startdt.getTime());
2140
+
2141
+ minDate.setMilliseconds(minDate.getMilliseconds() + options.minInterval);
2142
+ maxDate.setMilliseconds(maxDate.getMilliseconds() + options.maxInterval);
2143
+
2144
+ if (options.minInterval > 0 && minDate > enddt) { // minInterval check
2145
+ endTime[method]('setDate', minDate);
2146
+ }
2147
+ else if (options.maxInterval > 0 && maxDate < enddt) { // max interval check
2148
+ endTime[method]('setDate', maxDate);
2149
+ }
2150
+ else if (startdt > enddt) {
2151
+ other[method]('setDate', changeddt);
2152
+ }
2153
+ }
2154
+ }
2155
+
2156
+ function selected(changed, other, option) {
2157
+ if (!changed.val()) {
2158
+ return;
2159
+ }
2160
+ var date = changed[method].call(changed, 'getDate');
2161
+ if (date !== null && options.minInterval > 0) {
2162
+ if (option === 'minDate') {
2163
+ date.setMilliseconds(date.getMilliseconds() + options.minInterval);
2164
+ }
2165
+ if (option === 'maxDate') {
2166
+ date.setMilliseconds(date.getMilliseconds() - options.minInterval);
2167
+ }
2168
+ }
2169
+
2170
+ if (date.getTime) {
2171
+ other[method].call(other, 'option', option, date);
2172
+ }
2173
+ }
2174
+
2175
+ $.fn[method].call(startTime, $.extend({
2176
+ timeOnly: timeOnly,
2177
+ onClose: function (dateText, inst) {
2178
+ checkDates($(this), endTime);
2179
+ },
2180
+ onSelect: function (selectedDateTime) {
2181
+ selected($(this), endTime, 'minDate');
2182
+ }
2183
+ }, options, options.start));
2184
+ $.fn[method].call(endTime, $.extend({
2185
+ timeOnly: timeOnly,
2186
+ onClose: function (dateText, inst) {
2187
+ checkDates($(this), startTime);
2188
+ },
2189
+ onSelect: function (selectedDateTime) {
2190
+ selected($(this), startTime, 'maxDate');
2191
+ }
2192
+ }, options, options.end));
2193
+
2194
+ checkDates(startTime, endTime);
2195
+
2196
+ selected(startTime, endTime, 'minDate');
2197
+ selected(endTime, startTime, 'maxDate');
2198
+
2199
+ return $([startTime.get(0), endTime.get(0)]);
2200
+ };
2201
+
2202
+ /**
2203
+ * Log error or data to the console during error or debugging
2204
+ * @param {Object} err pass any type object to log to the console during error or debugging
2205
+ * @return {void}
2206
+ */
2207
+ $.timepicker.log = function () {
2208
+ if (window.console) {
2209
+ window.console.log.apply(window.console, Array.prototype.slice.call(arguments));
2210
+ }
2211
+ };
2212
+
2213
+ /*
2214
+ * Add util object to allow access to private methods for testability.
2215
+ */
2216
+ $.timepicker._util = {
2217
+ _extendRemove: extendRemove,
2218
+ _isEmptyObject: isEmptyObject,
2219
+ _convert24to12: convert24to12,
2220
+ _detectSupport: detectSupport,
2221
+ _selectLocalTimezone: selectLocalTimezone,
2222
+ _computeEffectiveSetting: computeEffectiveSetting,
2223
+ _splitDateTime: splitDateTime,
2224
+ _parseDateTimeInternal: parseDateTimeInternal
2225
+ };
2226
+
2227
+ /*
2228
+ * Microsecond support
2229
+ */
2230
+ if (!Date.prototype.getMicroseconds) {
2231
+ Date.prototype.microseconds = 0;
2232
+ Date.prototype.getMicroseconds = function () { return this.microseconds; };
2233
+ Date.prototype.setMicroseconds = function (m) {
2234
+ this.setMilliseconds(this.getMilliseconds() + Math.floor(m / 1000));
2235
+ this.microseconds = m % 1000;
2236
+ return this;
2237
+ };
2238
+ }
2239
+
2240
+ /*
2241
+ * Keep up with the version
2242
+ */
2243
+ $.timepicker.version = "1.5.5";
2244
+
2245
+ }));
languages/woocommerce-exporter-en_GB.mo ADDED
Binary file
languages/woocommerce-exporter-en_GB.po ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: woocommerce-exporter\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-01-29 18:32+1000\n"
6
+ "PO-Revision-Date: 2012-01-29 18:32+1000\n"
7
+ "Last-Translator: \n"
8
+ "Language-Team: Visser Labs\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-SearchPath-0: ..\n"
15
+
16
+ #: ../exporter.php:26
17
+ msgid "WooCommerce Exporter"
18
+ msgstr ""
19
+
20
+ #: ../exporter.php:27
21
+ #: ../includes/functions.php:9
22
+ msgid "Store Export"
23
+ msgstr ""
24
+
25
+ #: ../exporter.php:69
26
+ msgid "Chosen WooCommerce details have been exported from your store."
27
+ msgstr ""
28
+
29
+ #: ../exporter.php:99
30
+ msgid "Export to CSV"
31
+ msgstr ""
32
+
33
+ #: ../exporter.php:103
34
+ msgid "Export WooCommerce Details"
35
+ msgstr ""
36
+
37
+ #: ../exporter.php:109
38
+ msgid "Products"
39
+ msgstr ""
40
+
41
+ #: ../exporter.php:122
42
+ msgid "Import Options"
43
+ msgstr ""
44
+
45
+ #: ../exporter.php:129
46
+ msgid "Script timeout"
47
+ msgstr ""
48
+
49
+ #: ../exporter.php:131
50
+ #: ../exporter.php:132
51
+ msgid "minutes"
52
+ msgstr ""
53
+
54
+ #: ../exporter.php:133
55
+ msgid "hour"
56
+ msgstr ""
57
+
58
+ #: ../exporter.php:134
59
+ msgid "Unlimited"
60
+ msgstr ""
61
+
62
+ #: ../exporter.php:136
63
+ msgid "Script timeout defines how long WooCommerce Exporter is 'allowed' to process your CSV file, once the time limit is reached the export process halts."
64
+ msgstr ""
65
+
66
+ #: ../exporter.php:146
67
+ msgid "Export"
68
+ msgstr ""
69
+
70
+ #: ../exporter.php:152
71
+ msgid "Chosen WooCommerce details are being exported, this process can take awhile. Time for a beer?"
72
+ msgstr ""
73
+
74
+ #: ../exporter.php:154
75
+ msgid "Return to <a href=\""
76
+ msgstr ""
77
+
78
+ #: ../includes/common-dashboard_widgets.php:8
79
+ msgid "Plugin News - by Visser Labs"
80
+ msgstr ""
81
+
82
+ #: ../includes/common-dashboard_widgets.php:32
83
+ msgid "Connection failed. Please check your network settings."
84
+ msgstr ""
85
+
86
+ #: ../includes/common-update.php:49
87
+ msgid "An Unexpected HTTP Error occurred during the API request.</p> <p><a href=\"?\" onclick=\"document.location.reload(); return false;\">Try again</a>"
88
+ msgstr ""
89
+
90
+ #: ../includes/common-update.php:53
91
+ msgid "An unknown error occurred"
92
+ msgstr ""
93
+
94
+ #: ../includes/functions.php:9
95
+ msgid "WP e-Commerce Exporter"
96
+ msgstr ""
97
+
readme.txt CHANGED
@@ -1,15 +1,22 @@
1
  === WooCommerce - Store Exporter ===
2
 
3
- Contributors: visser
4
- Donate link: http://www.visser.com.au/#donations
5
- Tags: e-commerce, woocommerce, shop, cart, ecommerce, export, csv, xml, xls, excel, customers, products, sales, orders, coupons, users, attributes, subscriptions
6
  Requires at least: 2.9.2
7
- Tested up to: 4.0
8
- Stable tag: 1.8.1
 
 
 
9
 
10
  == Description ==
11
 
12
- Export store details out of WooCommerce into simple formatted files (e.g. CSV, XML, Excel 2007 XLS, etc.).
 
 
 
 
13
 
14
  Features include:
15
 
@@ -30,26 +37,38 @@ Features include:
30
  * Export Users
31
  * Export Coupons (*)
32
  * Export Subscriptions (*)
 
33
  * Export Product Vendors (*)
 
34
  * Export Attributes (*)
35
  * Toggle and save export fields
36
  * Field label editor (*)
37
  * Works with WordPress Multisite
38
  * Export to CSV file
39
- * Export to XML file (*)
40
  * Export to Excel 2007 (XLS) file (*)
 
 
 
41
  * Export to WordPress Media
42
  * Export to e-mail addresses (*)
43
  * Export to remote POST (*)
44
- * Export to remote FTP (*)
45
  * Supports external CRON commands (*)
46
  * Supports scheduled exports (*)
47
 
48
  (*) Requires the Pro upgrade to enable additional store export functionality.
49
 
50
- Just a few of the features unlocked in the Pro upgrade of Product Importer include:
 
 
 
 
 
 
 
 
51
 
52
- - Compatibility with Product Importer Deluxe
53
  - Export All in One SEO Pack
54
  - Export Advanced Google Product Feed
55
  - Export Product Addons
@@ -67,8 +86,14 @@ Just a few of the features unlocked in the Pro upgrade of Product Importer inclu
67
  - Export WooCommerce PDF Invoices & Packing Slips
68
  - Export WooCommerce Checkout Add-ons
69
  - Export Product Vendors
 
 
 
 
70
 
71
- ... and more free and Premium extensions for WooCommerce.
 
 
72
 
73
  For more information visit: http://www.visser.com.au/woocommerce/
74
 
@@ -109,6 +134,72 @@ http://www.visser.com.au/woocommerce/forums/
109
 
110
  == Changelog ==
111
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  = 1.8.1 =
113
  * Adeded: Export modules to the Export screen
114
 
1
  === WooCommerce - Store Exporter ===
2
 
3
+ Contributors: visser, visser.labs
4
+ Donate link: https://www.visser.com.au/donations/
5
+ Tags: e-commerce, woocommerce, shop, cart, ecommerce, export, csv, xml, xls, xlsx, excel, customers, products, sales, orders, coupons, users, attributes, subscriptions
6
  Requires at least: 2.9.2
7
+ Tested up to: 4.8.1
8
+ Stable tag: 1.9.2
9
+ License: GPLv2 or later
10
+
11
+ Export store details out of WooCommerce into simple formatted files (e.g. CSV, XML, Excel 2007, XLS, etc.).
12
 
13
  == Description ==
14
 
15
+ **Screen-loads of options and filters let you design advanced exports to suit your store requirements, or simply go with the default and click Export to produce concise, ready to use exports.**
16
+
17
+ Store Exporter maintains compatibility with the latest WooCommerce updates receiving regular feature updates trusted by 20,000+ active users. Happy exporting!
18
+
19
+ = Features =
20
 
21
  Features include:
22
 
37
  * Export Users
38
  * Export Coupons (*)
39
  * Export Subscriptions (*)
40
+ * Export Commissions (*)
41
  * Export Product Vendors (*)
42
+ * Export Shipping Classes (*)
43
  * Export Attributes (*)
44
  * Toggle and save export fields
45
  * Field label editor (*)
46
  * Works with WordPress Multisite
47
  * Export to CSV file
48
+ * Export to TSV file (*)
49
  * Export to Excel 2007 (XLS) file (*)
50
+ * Export to Excel 2013 (XLSX) file (*)
51
+ * Export to XML file (*)
52
+ * Export to RSS file (*)
53
  * Export to WordPress Media
54
  * Export to e-mail addresses (*)
55
  * Export to remote POST (*)
56
+ * Export to remote FTP/FTPS/SFTP (*)
57
  * Supports external CRON commands (*)
58
  * Supports scheduled exports (*)
59
 
60
  (*) Requires the Pro upgrade to enable additional store export functionality.
61
 
62
+ > ** Go Pro **
63
+ >
64
+ > Unlock the business focused e-commerce features within Store Exporter such as scheduled exporting from [this link](https://www.visser.com.au/plugins/store-exporter-deluxe/?platform=wc).
65
+ >
66
+ > Full documentation and usage of Store Exporter Deluxe is available from the [support section for Store Exporter Deluxe](http://www.visser.com.au/documentation/store-exporter-deluxe/).
67
+
68
+ = Native integration with 90+ WooCommerce Plugins =
69
+
70
+ Just a few of the features unlocked in the Pro upgrade of Store Exporter include:
71
 
 
72
  - Export All in One SEO Pack
73
  - Export Advanced Google Product Feed
74
  - Export Product Addons
86
  - Export WooCommerce PDF Invoices & Packing Slips
87
  - Export WooCommerce Checkout Add-ons
88
  - Export Product Vendors
89
+ - Export WooCommerce Jetpack
90
+ - Import fields for Product Importer Deluxe
91
+
92
+ ... and more free and Premium extensions for WooCommerce and WordPress.
93
 
94
+ Want regular updates? Become a fan on Facebook!
95
+
96
+ http://www.facebook.com/visser.labs/
97
 
98
  For more information visit: http://www.visser.com.au/woocommerce/
99
 
134
 
135
  == Changelog ==
136
 
137
+ = 1.9.2 =
138
+ * Changed: Product Visibility field matches WooCommerce 3.1 labels (thanks spbuckle)
139
+ * Added: Filter for legacy Product Visibility labels
140
+ * Changed: Updated list of supported Plugin modules
141
+
142
+ = 1.9.1.1 =
143
+ * Fixed: Visibility field empty for default value
144
+
145
+ = 1.9.1 =
146
+ * Fixed: Visibility field empty for default value (thanks spbuckle)
147
+ * Changed: Compatibility with WooCommerce 3.0+
148
+ * Changed: Updated WordPress compatibility
149
+
150
+ = 1.9 =
151
+ * Changed: Moved export type filters to their own files
152
+ * Fixed: Product file downloads not working (thanks @bulfa)
153
+
154
+ = 1.8.8 =
155
+ * Fixed: Missing WordPress SEO resource
156
+
157
+ = 1.8.7 =
158
+ * Fixed: Compatibility with WooCommerce 2.6.9
159
+
160
+ = 1.8.6 =
161
+ * Fixed: Product export failing due to incorrect token check
162
+ * Added: Modules filter support on Tools screen
163
+ * Fixed: Export of custom meta with an apostrophe in the meta name
164
+ * Fixed: Field type detection giving false positive for integers
165
+ * Changed: Button styling of Save Custom Fields
166
+ * Fixed: Update all export Attachments to Post Status private
167
+ * Added: Notice prompt when non-private export Attachments are detected
168
+ * Added: Dismiss option to override detection of non-private export Attachments
169
+ * Changed: Reduction in memory requirements for $export Global
170
+ * Changed: Translation set to woocommerce-exporter
171
+
172
+ = 1.8.5 =
173
+ * Changed: Enable Archives is disabled by default
174
+ * Added: %random% Tag to export filename for random number generation
175
+
176
+ = 1.8.4 =
177
+ * Fixed: Privilege escalation vulnerability (thanks jamesgol)
178
+
179
+ = 1.8.3 =
180
+ * Added: Notice when fatal error is encountered from memory/timeout
181
+ * Fixed: Default to Attribute Name if Label is empty
182
+ * Fixed: Export Product Attributes in Product export
183
+ * Added: Support for custom Attributes in Product export
184
+ * Added: Default Attributes to Product export
185
+ * Fixed: Attribute taxonomy missing from Order Items: Product Variation in WC 2.2+
186
+ * Added: Support for Ship to Multiple Address for Order export
187
+ * Fixed: Variables not being included in Product export when filtering by Categories/Tags/Brands/Vendors
188
+ * Added: Delete All archives button to Archives screen
189
+
190
+ = 1.8.2 =
191
+ * Added: Order support for Extra Product Options
192
+ * Fixed: Detect corrupted Date Format
193
+ * Added: Detection of corrupted WordPress options at export time
194
+ * Added: Total Sales to Products export
195
+ * Fixed: Advanced Google Product Feed not being included in Products export
196
+ * Added: Custom User meta to Customers export
197
+ * Added: Support for exporting Shipping Classes
198
+ * Changed: Product URL is now External URL
199
+ * Added: Product URL is the absolute URL to the Product
200
+ * Added: Support for custom User fields
201
+ * Fixed: Admin notice not showing for saving custom fields
202
+
203
  = 1.8.1 =
204
  * Adeded: Export modules to the Export screen
205
 
templates/admin/export.css CHANGED
@@ -74,19 +74,29 @@
74
  width:80px;
75
  }
76
 
77
-
78
  /* Settings */
79
 
80
- #woo-ce .auto_method_options li.ftp-options label {
 
 
 
 
 
 
 
 
 
81
  display:inline-block;
82
  width:120px;
83
  }
 
 
 
84
 
85
  /* Support - Donate / Rate */
86
 
87
  #woo-ce .support-donate_rate {
88
  display:block;
89
- float:right;
90
  }
91
  #woo-ce .support-donate_rate p {
92
  margin-top:16px;
74
  width:80px;
75
  }
76
 
 
77
  /* Settings */
78
 
79
+ #woo-ce p.warning {
80
+ color:red;
81
+ }
82
+ #woo-ce .advanced-settings {
83
+ display:none;
84
+ }
85
+ #woo-ce .advanced-settings ul {
86
+ list-style-type:disc;
87
+ }
88
+ #woo-ce .export_method_options li.ftp-options label {
89
  display:inline-block;
90
  width:120px;
91
  }
92
+ #woo-ce .export_method_options li.ftp-options select {
93
+ width: 25em;
94
+ }
95
 
96
  /* Support - Donate / Rate */
97
 
98
  #woo-ce .support-donate_rate {
99
  display:block;
 
100
  }
101
  #woo-ce .support-donate_rate p {
102
  margin-top:16px;
templates/admin/export.js CHANGED
@@ -10,13 +10,34 @@ $j(function() {
10
  if( $j.isFunction($j.fn.datepicker) ) {
11
  $j('.datepicker').datepicker({
12
  dateFormat: 'dd/mm/yy'
 
 
13
  });
14
  }
15
 
16
- // Chosen
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  if( $j.isFunction($j.fn.chosen) ) {
18
  $j(".chzn-select").chosen({
19
- search_contains: true
 
20
  });
21
  }
22
 
@@ -56,11 +77,22 @@ $j(function() {
56
  $j('.checkall').click(function () {
57
  $j(this).closest('.postbox').find(':checkbox').attr('checked', true);
58
  });
 
59
  // Unselect all field options for this export type
60
  $j('.uncheckall').click(function () {
61
  $j(this).closest('.postbox').find(':checkbox').attr('checked', false);
62
  });
63
 
 
 
 
 
 
 
 
 
 
 
64
  $j('.export-types').hide();
65
  $j('.export-options').hide();
66
 
@@ -79,15 +111,22 @@ $j(function() {
79
  if( $j('#products-filters-brands').attr('checked') ) {
80
  $j('#export-products-filters-brands').show();
81
  }
 
 
 
 
 
82
  // Product Status
83
  $j('#export-products-filters-status').hide();
84
  if( $j('#products-filters-status').attr('checked') ) {
85
  $j('#export-products-filters-status').show();
86
  }
 
87
  $j('#export-products-filters-type').hide();
88
  if( $j('#products-filters-type').attr('checked') ) {
89
  $j('#export-products-filters-type').show();
90
  }
 
91
  $j('#export-products-filters-stock').hide();
92
  if( $j('#products-filters-stock').attr('checked') ) {
93
  $j('#export-products-filters-stock').show();
@@ -100,44 +139,122 @@ $j(function() {
100
  $j('#export-brand').hide();
101
 
102
  $j('#export-order').hide();
 
103
  $j('#export-orders-filters-status').hide();
104
  if( $j('#orders-filters-status').attr('checked') ) {
105
  $j('#export-orders-filters-status').show();
106
  }
 
107
  $j('#export-orders-filters-date').hide();
108
  if( $j('#orders-filters-date').attr('checked') ) {
109
  $j('#export-orders-filters-date').show();
110
  }
 
111
  $j('#export-orders-filters-customer').hide();
112
  if( $j('#orders-filters-customer').attr('checked') ) {
113
  $j('#export-orders-filters-customer').show();
114
  }
 
 
 
 
 
 
 
 
 
 
 
115
  $j('#export-orders-filters-user_role').hide();
116
  if( $j('#orders-filters-user_role').attr('checked') ) {
117
  $j('#export-orders-filters-user_role').show();
118
  }
 
119
  $j('#export-orders-filters-coupon').hide();
120
  if( $j('#orders-filters-coupon').attr('checked') ) {
121
  $j('#export-orders-filters-coupon').show();
122
  }
 
 
 
 
 
 
123
  $j('#export-orders-filters-category').hide();
124
  if( $j('#orders-filters-category').attr('checked') ) {
125
  $j('#export-orders-filters-category').show();
126
  }
 
127
  $j('#export-orders-filters-tag').hide();
128
  if( $j('#orders-filters-tag').attr('checked') ) {
129
  $j('#export-orders-filters-tag').show();
130
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
 
 
132
  $j('#export-customers-filters-status').hide();
133
  if( $j('#customers-filters-status').attr('checked') ) {
134
  $j('#export-customers-filters-status').show();
135
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  $j('#export-customer').hide();
137
  $j('#export-user').hide();
138
  $j('#export-coupon').hide();
139
  $j('#export-subscription').hide();
140
  $j('#export-product_vendor').hide();
 
 
141
  $j('#export-attribute').hide();
142
 
143
  $j('#products-filters-categories').click(function(){
@@ -146,6 +263,12 @@ $j(function() {
146
  $j('#products-filters-tags').click(function(){
147
  $j('#export-products-filters-tags').toggle();
148
  });
 
 
 
 
 
 
149
  $j('#products-filters-status').click(function(){
150
  $j('#export-products-filters-status').toggle();
151
  });
@@ -165,22 +288,63 @@ $j(function() {
165
  $j('#orders-filters-customer').click(function(){
166
  $j('#export-orders-filters-customer').toggle();
167
  });
 
 
 
 
 
 
168
  $j('#orders-filters-user_role').click(function(){
169
  $j('#export-orders-filters-user_role').toggle();
170
  });
171
  $j('#orders-filters-coupon').click(function(){
172
  $j('#export-orders-filters-coupon').toggle();
173
  });
 
 
 
174
  $j('#orders-filters-category').click(function(){
175
  $j('#export-orders-filters-category').toggle();
176
  });
177
  $j('#orders-filters-tag').click(function(){
178
  $j('#export-orders-filters-tag').toggle();
179
  });
 
 
 
 
 
 
 
 
 
 
 
 
180
 
181
  $j('#customers-filters-status').click(function(){
182
  $j('#export-customers-filters-status').toggle();
183
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
 
185
  // Export types
186
  $j('#product').click(function(){
@@ -253,6 +417,20 @@ $j(function() {
253
  $j('.export-options').hide();
254
  $j('.product_vendor-options').show();
255
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  $j('#attribute').click(function(){
257
  $j('.export-types').hide();
258
  $j('#export-attribute').show();
@@ -292,9 +470,15 @@ $j(function() {
292
  $j('#export_product_vendor').click(function(){
293
  $j('input:radio[name=dataset]:nth(9)').attr('checked',true);
294
  });
295
- $j('#export_attribute').click(function(){
296
  $j('input:radio[name=dataset]:nth(10)').attr('checked',true);
297
  });
 
 
 
 
 
 
298
 
299
  $j("#auto_type").change(function () {
300
  var type = $j('select[name=auto_type]').val();
@@ -308,6 +492,21 @@ $j(function() {
308
  $j('.auto_method_options .'+type+'-options').show();
309
  });
310
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  $j(document).ready(function() {
312
  // This auto-selects the export type based on the link from the Overview screen
313
  var href = jQuery(location).attr('href');
@@ -323,7 +522,7 @@ $j(function() {
323
  var type = $j('input:radio[name=dataset]:checked').val();
324
  $j('#'+type).trigger('click');
325
  }
326
- } else if (href.toLowerCase().indexOf('tab=settings') >= 0) {
327
  $j("#auto_type").trigger("change");
328
  $j("#auto_method").trigger("change");
329
  } else {
10
  if( $j.isFunction($j.fn.datepicker) ) {
11
  $j('.datepicker').datepicker({
12
  dateFormat: 'dd/mm/yy'
13
+ }).on('change', function() {
14
+ $j('input:radio[name="order_dates_filter"][value="manual"]').prop( 'checked', true );
15
  });
16
  }
17
 
18
+ // Time Picker element
19
+ if( $j.isFunction($j.fn.datetimepicker) ) {
20
+ var timezone = new Date(new Date().getTime());
21
+ $j('.datetimepicker').datetimepicker({
22
+ dateFormat: 'dd/mm/yy',
23
+ timeFormat: 'HH:mm',
24
+ controlType: 'select',
25
+ minDate: timezone,
26
+ showTimezone: false,
27
+ showSecond: false
28
+ });
29
+ }
30
+
31
+ // Order Dates
32
+ $j('input[name="order_dates_filter_variable"],select[name="order_dates_filter_variable_length"]').click(function () {
33
+ $j('input:radio[name="order_dates_filter"][value="variable"]').prop( 'checked', true );
34
+ });
35
+
36
+ // Chosen dropdown element
37
  if( $j.isFunction($j.fn.chosen) ) {
38
  $j(".chzn-select").chosen({
39
+ search_contains: true,
40
+ width: "95%"
41
  });
42
  }
43
 
77
  $j('.checkall').click(function () {
78
  $j(this).closest('.postbox').find(':checkbox').attr('checked', true);
79
  });
80
+
81
  // Unselect all field options for this export type
82
  $j('.uncheckall').click(function () {
83
  $j(this).closest('.postbox').find(':checkbox').attr('checked', false);
84
  });
85
 
86
+ // Reset sorting of fields for this export type
87
+ $j('.resetsorting').click(function () {
88
+ var type = $j(this).attr('id');
89
+ var type = type.replace('-resetsorting','');
90
+ for(i=0; i<$j('#' + type + '-fields tr').length; i++){
91
+ $j('#' + type + '-' + i).appendTo('#' + type + '-fields');
92
+ }
93
+ field_row_indexes($j('#' + type + '-fields'));
94
+ });
95
+
96
  $j('.export-types').hide();
97
  $j('.export-options').hide();
98
 
111
  if( $j('#products-filters-brands').attr('checked') ) {
112
  $j('#export-products-filters-brands').show();
113
  }
114
+ // Product Vendors
115
+ $j('#export-products-filters-vendors').hide();
116
+ if( $j('#products-filters-vendors').attr('checked') ) {
117
+ $j('#export-products-filters-vendors').show();
118
+ }
119
  // Product Status
120
  $j('#export-products-filters-status').hide();
121
  if( $j('#products-filters-status').attr('checked') ) {
122
  $j('#export-products-filters-status').show();
123
  }
124
+ // Type
125
  $j('#export-products-filters-type').hide();
126
  if( $j('#products-filters-type').attr('checked') ) {
127
  $j('#export-products-filters-type').show();
128
  }
129
+ // Stock
130
  $j('#export-products-filters-stock').hide();
131
  if( $j('#products-filters-stock').attr('checked') ) {
132
  $j('#export-products-filters-stock').show();
139
  $j('#export-brand').hide();
140
 
141
  $j('#export-order').hide();
142
+ // Order Status
143
  $j('#export-orders-filters-status').hide();
144
  if( $j('#orders-filters-status').attr('checked') ) {
145
  $j('#export-orders-filters-status').show();
146
  }
147
+ // Order Date
148
  $j('#export-orders-filters-date').hide();
149
  if( $j('#orders-filters-date').attr('checked') ) {
150
  $j('#export-orders-filters-date').show();
151
  }
152
+ // Customer
153
  $j('#export-orders-filters-customer').hide();
154
  if( $j('#orders-filters-customer').attr('checked') ) {
155
  $j('#export-orders-filters-customer').show();
156
  }
157
+ // Billing Country
158
+ $j('#export-orders-filters-billing_country').hide();
159
+ if( $j('#orders-filters-billing_country').attr('checked') ) {
160
+ $j('#export-orders-filters-billing_country').show();
161
+ }
162
+ // Shipping Country
163
+ $j('#export-orders-filters-shipping_country').hide();
164
+ if( $j('#orders-filters-shipping_country').attr('checked') ) {
165
+ $j('#export-orders-filters-shipping_country').show();
166
+ }
167
+ // User Role
168
  $j('#export-orders-filters-user_role').hide();
169
  if( $j('#orders-filters-user_role').attr('checked') ) {
170
  $j('#export-orders-filters-user_role').show();
171
  }
172
+ // Coupon Code
173
  $j('#export-orders-filters-coupon').hide();
174
  if( $j('#orders-filters-coupon').attr('checked') ) {
175
  $j('#export-orders-filters-coupon').show();
176
  }
177
+ // Products
178
+ $j('#export-orders-filters-product').hide();
179
+ if( $j('#orders-filters-product').attr('checked') ) {
180
+ $j('#export-orders-filters-product').show();
181
+ }
182
+ // Categories
183
  $j('#export-orders-filters-category').hide();
184
  if( $j('#orders-filters-category').attr('checked') ) {
185
  $j('#export-orders-filters-category').show();
186
  }
187
+ // Tags
188
  $j('#export-orders-filters-tag').hide();
189
  if( $j('#orders-filters-tag').attr('checked') ) {
190
  $j('#export-orders-filters-tag').show();
191
  }
192
+ // Brands
193
+ $j('#export-orders-filters-brand').hide();
194
+ if( $j('#orders-filters-brand').attr('checked') ) {
195
+ $j('#export-orders-filters-brand').show();
196
+ }
197
+ // Order ID
198
+ $j('#export-orders-filters-id').hide();
199
+ if( $j('#orders-filters-id').attr('checked') ) {
200
+ $j('#export-orders-filters-id').show();
201
+ }
202
+ // Payment Gateway
203
+ $j('#export-orders-filters-payment_gateway').hide();
204
+ if( $j('#orders-filters-payment_gateway').attr('checked') ) {
205
+ $j('#export-orders-filters-payment_gateway').show();
206
+ }
207
+ // Payment Gateway
208
+ $j('#export-orders-filters-shipping_method').hide();
209
+ if( $j('#orders-filters-shipping_method').attr('checked') ) {
210
+ $j('#export-orders-filters-shipping_method').show();
211
+ }
212
 
213
+ // Order Status
214
  $j('#export-customers-filters-status').hide();
215
  if( $j('#customers-filters-status').attr('checked') ) {
216
  $j('#export-customers-filters-status').show();
217
  }
218
+ // User Role
219
+ $j('#export-customers-filters-user_role').hide();
220
+ if( $j('#customers-filters-user_role').attr('checked') ) {
221
+ $j('#export-customers-filters-user_role').show();
222
+ }
223
+
224
+ // Subscription Status
225
+ $j('#export-subscriptions-filters-status').hide();
226
+ if( $j('#subscriptions-filters-status').attr('checked') ) {
227
+ $j('#export-subscriptions-filters-status').show();
228
+ }
229
+ // Subscription Product
230
+ $j('#export-subscriptions-filters-product').hide();
231
+ if( $j('#subscriptions-filters-product').attr('checked') ) {
232
+ $j('#export-subscriptions-filters-product').show();
233
+ }
234
+
235
+ // Order Date
236
+ $j('#export-commissions-filters-date').hide();
237
+ if( $j('#commissions-filters-date').attr('checked') ) {
238
+ $j('#export-commissions-filters-date').show();
239
+ }
240
+ // Product Vendor
241
+ $j('#export-commissions-filters-product_vendor').hide();
242
+ if( $j('#commissions-filters-product_vendor').attr('checked') ) {
243
+ $j('#export-commissions-filters-product_vendor').show();
244
+ }
245
+ // Commission Status
246
+ $j('#export-commissions-filters-commission_status').hide();
247
+ if( $j('#commissions-filters-commission_status').attr('checked') ) {
248
+ $j('#export-commissions-filters-commission_status').show();
249
+ }
250
+
251
  $j('#export-customer').hide();
252
  $j('#export-user').hide();
253
  $j('#export-coupon').hide();
254
  $j('#export-subscription').hide();
255
  $j('#export-product_vendor').hide();
256
+ $j('#export-commission').hide();
257
+ $j('#export-shipping_class').hide();
258
  $j('#export-attribute').hide();
259
 
260
  $j('#products-filters-categories').click(function(){
263
  $j('#products-filters-tags').click(function(){
264
  $j('#export-products-filters-tags').toggle();
265
  });
266
+ $j('#products-filters-brands').click(function(){
267
+ $j('#export-products-filters-brands').toggle();
268
+ });
269
+ $j('#products-filters-vendors').click(function(){
270
+ $j('#export-products-filters-vendors').toggle();
271
+ });
272
  $j('#products-filters-status').click(function(){
273
  $j('#export-products-filters-status').toggle();
274
  });
288
  $j('#orders-filters-customer').click(function(){
289
  $j('#export-orders-filters-customer').toggle();
290
  });
291
+ $j('#orders-filters-billing_country').click(function(){
292
+ $j('#export-orders-filters-billing_country').toggle();
293
+ });
294
+ $j('#orders-filters-shipping_country').click(function(){
295
+ $j('#export-orders-filters-shipping_country').toggle();
296
+ });
297
  $j('#orders-filters-user_role').click(function(){
298
  $j('#export-orders-filters-user_role').toggle();
299
  });
300
  $j('#orders-filters-coupon').click(function(){
301
  $j('#export-orders-filters-coupon').toggle();
302
  });
303
+ $j('#orders-filters-product').click(function(){
304
+ $j('#export-orders-filters-product').toggle();
305
+ });
306
  $j('#orders-filters-category').click(function(){
307
  $j('#export-orders-filters-category').toggle();
308
  });
309
  $j('#orders-filters-tag').click(function(){
310
  $j('#export-orders-filters-tag').toggle();
311
  });
312
+ $j('#orders-filters-brand').click(function(){
313
+ $j('#export-orders-filters-brand').toggle();
314
+ });
315
+ $j('#orders-filters-id').click(function(){
316
+ $j('#export-orders-filters-id').toggle();
317
+ });
318
+ $j('#orders-filters-payment_gateway').click(function(){
319
+ $j('#export-orders-filters-payment_gateway').toggle();
320
+ });
321
+ $j('#orders-filters-shipping_method').click(function(){
322
+ $j('#export-orders-filters-shipping_method').toggle();
323
+ });
324
 
325
  $j('#customers-filters-status').click(function(){
326
  $j('#export-customers-filters-status').toggle();
327
  });
328
+ $j('#customers-filters-user_role').click(function(){
329
+ $j('#export-customers-filters-user_role').toggle();
330
+ });
331
+
332
+ $j('#subscriptions-filters-status').click(function(){
333
+ $j('#export-subscriptions-filters-status').toggle();
334
+ });
335
+ $j('#subscriptions-filters-product').click(function(){
336
+ $j('#export-subscriptions-filters-product').toggle();
337
+ });
338
+
339
+ $j('#commissions-filters-date').click(function(){
340
+ $j('#export-commissions-filters-date').toggle();
341
+ });
342
+ $j('#commissions-filters-product_vendor').click(function(){
343
+ $j('#export-commissions-filters-product_vendor').toggle();
344
+ });
345
+ $j('#commissions-filters-commission_status').click(function(){
346
+ $j('#export-commissions-filters-commission_status').toggle();
347
+ });
348
 
349
  // Export types
350
  $j('#product').click(function(){
417
  $j('.export-options').hide();
418
  $j('.product_vendor-options').show();
419
  });
420
+ $j('#commission').click(function(){
421
+ $j('.export-types').hide();
422
+ $j('#export-commission').show();
423
+
424
+ $j('.export-options').hide();
425
+ $j('.commission-options').show();
426
+ });
427
+ $j('#shipping_class').click(function(){
428
+ $j('.export-types').hide();
429
+ $j('#export-shipping_class').show();
430
+
431
+ $j('.export-options').hide();
432
+ $j('.shipping_class-options').show();
433
+ });
434
  $j('#attribute').click(function(){
435
  $j('.export-types').hide();
436
  $j('#export-attribute').show();
470
  $j('#export_product_vendor').click(function(){
471
  $j('input:radio[name=dataset]:nth(9)').attr('checked',true);
472
  });
473
+ $j('#export_commission').click(function(){
474
  $j('input:radio[name=dataset]:nth(10)').attr('checked',true);
475
  });
476
+ $j('#export_shipping_class').click(function(){
477
+ $j('input:radio[name=dataset]:nth(11)').attr('checked',true);
478
+ });
479
+ $j('#export_attribute').click(function(){
480
+ $j('input:radio[name=dataset]:nth(12)').attr('checked',true);
481
+ });
482
 
483
  $j("#auto_type").change(function () {
484
  var type = $j('select[name=auto_type]').val();
492
  $j('.auto_method_options .'+type+'-options').show();
493
  });
494
 
495
+ // Display a list of advanced options on the Settings screen
496
+ $j('#advanced-settings').click(function(){
497
+ $j('.advanced-settings').toggle();
498
+ return false;
499
+ });
500
+
501
+ // Confirmation prompt on button actions
502
+ $j('.advanced-settings a.delete, .post-type-scheduled_export a.confirm-button').click(function(e){
503
+ e.preventDefault();
504
+ var choice = confirm($j(this).attr('data-confirm'));
505
+ if( choice ) {
506
+ window.location.href = $j(this).attr('href');
507
+ }
508
+ });
509
+
510
  $j(document).ready(function() {
511
  // This auto-selects the export type based on the link from the Overview screen
512
  var href = jQuery(location).attr('href');
522
  var type = $j('input:radio[name=dataset]:checked').val();
523
  $j('#'+type).trigger('click');
524
  }
525
+ } else if ( href.toLowerCase().indexOf('tab=settings') >= 0 ) {
526
  $j("#auto_type").trigger("change");
527
  $j("#auto_method").trigger("change");
528
  } else {
templates/admin/jquery-ui-timepicker.css ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* css for timepicker */
2
+ .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
3
+ .ui-timepicker-div dl { text-align: left; }
4
+ .ui-timepicker-div dl dt { float: left; clear:left; padding: 0 0 0 5px; }
5
+ .ui-timepicker-div dl dd { margin: 0 10px 10px 45%; }
6
+ .ui-timepicker-div td { font-size: 90%; }
7
+ .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
8
+
9
+ .ui-timepicker-rtl{ direction: rtl; }
10
+ .ui-timepicker-rtl dl { text-align: right; padding: 0 5px 0 0; }
11
+ .ui-timepicker-rtl dl dt{ float: right; clear: right; }
12
+ .ui-timepicker-rtl dl dd { margin: 0 45% 10px 10px; }
templates/admin/media-csv_file.php CHANGED
@@ -1,12 +1,13 @@
1
  <div class="postbox-container">
2
  <div class="postbox">
3
- <h3 class="hndle"><?php _e( 'Export File', 'woo_ce' ); ?></h3>
4
  <div class="inside">
 
5
  <textarea style="font:12px Consolas, Monaco, Courier, monospace; width:100%; height:200px;"><?php echo esc_textarea( $contents ); ?></textarea>
 
6
  </div>
7
  <!-- .inside -->
8
  </div>
9
  <!-- .postbox -->
10
-
11
  </div>
12
  <!-- .postbox-container -->
1
  <div class="postbox-container">
2
  <div class="postbox">
3
+ <h3 class="hndle"><?php _e( 'Export File', 'woocommerce-exporter' ); ?></h3>
4
  <div class="inside">
5
+
6
  <textarea style="font:12px Consolas, Monaco, Courier, monospace; width:100%; height:200px;"><?php echo esc_textarea( $contents ); ?></textarea>
7
+
8
  </div>
9
  <!-- .inside -->
10
  </div>
11
  <!-- .postbox -->
 
12
  </div>
13
  <!-- .postbox-container -->
templates/admin/media-export_details.php CHANGED
@@ -1,54 +1,41 @@
1
- <table class="widefat" style="font-family:monospace;">
2
- <thead>
 
 
3
 
4
- <tr>
5
- <th colspan="2"><?php _e( 'Export Details', 'woo_ce' ); ?></th>
6
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
- </thead>
9
- <tbody>
 
 
 
 
 
 
 
 
 
 
 
10
 
11
- <tr>
12
- <th style="width:20%;"><?php _e( 'Export type', 'woo_ce' ); ?></th>
13
- <td><?php echo woo_ce_export_type_label( $export_type ); ?></td>
14
- </tr>
15
- <tr>
16
- <th><?php _e( 'Filepath', 'woo_ce' ); ?></th>
17
- <td><?php echo $filepath; ?></td>
18
- </tr>
19
- <tr>
20
- <th><?php _e( 'Total columns', 'woo_ce' ); ?></th>
21
- <td><?php echo ( ( $columns != false ) ? $columns : '-' ); ?></td>
22
- </tr>
23
- <tr>
24
- <th><?php _e( 'Total rows', 'woo_ce' ); ?></th>
25
- <td><?php echo ( ( $rows != false ) ? $rows : '-' ); ?></td>
26
- </tr>
27
- <tr>
28
- <th><?php _e( 'Process time', 'woo_ce' ); ?></th>
29
- <td><?php echo ( ( ( $start_time != false ) && ( $end_time != false ) ) ? woo_ce_display_time_elapsed( $start_time, $end_time ) : '-' ); ?></td>
30
- </tr>
31
- <tr>
32
- <th><?php _e( 'Idle memory usage (start)', 'woo_ce' ); ?></th>
33
- <td><?php echo ( ( $idle_memory_start != false ) ? woo_ce_display_memory( $idle_memory_start ) : '-' ); ?></td>
34
- </tr>
35
- <tr>
36
- <th><?php _e( 'Memory usage prior to loading export type', 'woo_ce' ); ?></th>
37
- <td><?php echo ( ( $data_memory_start != false ) ? woo_ce_display_memory( $data_memory_start ) : '-' ); ?></td>
38
- </tr>
39
- <tr>
40
- <th><?php _e( 'Memory usage after loading export type', 'woo_ce' ); ?></th>
41
- <td><?php echo ( ( $data_memory_end != false ) ? woo_ce_display_memory( $data_memory_end ) : '-' ); ?></td>
42
- </tr>
43
- <tr>
44
- <th><?php _e( 'Memory usage at render time', 'woo_ce' ); ?></th>
45
- <td>-</td>
46
- </tr>
47
- <tr>
48
- <th><?php _e( 'Idle memory usage (end)', 'woo_ce' ); ?></th>
49
- <td><?php echo ( ( $idle_memory_end != false ) ? woo_ce_display_memory( $idle_memory_end ) : '-' ); ?></td>
50
- </tr>
51
-
52
- </tbody>
53
- </table>
54
- <br />
1
+ <div class="postbox-container">
2
+ <div id="woo_ce-media-export_details" class="postbox">
3
+ <h3 class="hndle"><?php _e( 'Export Details', 'woocommerce-exporter' ); ?></h3>
4
+ <div class="inside">
5
 
6
+ <h4><?php _e( 'General', 'woocommerce-exporter' ); ?></h4>
7
+ <dl>
8
+ <dt><?php _e( 'Export type', 'woocommerce-exporter' ); ?></dt>
9
+ <dd><?php echo woo_ce_export_type_label( $export_type ); ?></dd>
10
+ <dt><?php _e( 'Filepath', 'woocommerce-exporter' ); ?></dt>
11
+ <dd><?php echo $filepath; ?></dd>
12
+ <dt><?php _e( 'Total columns', 'woocommerce-exporter' ); ?></dt>
13
+ <dd><?php echo ( ( $columns != false ) ? $columns : '-' ); ?></dd>
14
+ <dt><?php _e( 'Total rows', 'woocommerce-exporter' ); ?></dt>
15
+ <dd><?php echo ( ( $rows != false ) ? $rows : '-' ); ?></dd>
16
+ <?php if( $scheduled_id ) { ?>
17
+ <dt><?php _e( 'Scheduled export', 'woocommerce-exporter' ); ?></dt>
18
+ <dd><a href="<?php echo get_edit_post_link( $scheduled_id ); ?>" title="<?php _e( 'Edit scheduled export', 'woocommerce-exporter' ); ?>"><?php echo woo_ce_format_post_title( get_the_title( $scheduled_id ) ); ?></a></dd>
19
+ <?php } ?>
20
+ </dl>
21
 
22
+ <h4><?php _e( 'Memory', 'woocommerce-exporter' ); ?></h4>
23
+ <dl>
24
+ <dt><?php _e( 'Process time', 'woocommerce-exporter' ); ?></dt>
25
+ <dd><?php echo ( ( ( $start_time != false ) && ( $end_time != false ) ) ? woo_ce_display_time_elapsed( $start_time, $end_time ) : '-' ); ?></dd>
26
+ <dt><?php _e( 'Idle memory usage (start)', 'woocommerce-exporter' ); ?></dt>
27
+ <dd><?php echo ( ( $idle_memory_start != false ) ? woo_ce_display_memory( $idle_memory_start ) : '-' ); ?></dd>
28
+ <dt><?php _e( 'Memory usage prior to loading export type', 'woocommerce-exporter' ); ?></dt>
29
+ <dd><?php echo ( ( $data_memory_start != false ) ? woo_ce_display_memory( $data_memory_start ) : '-' ); ?></dd>
30
+ <dt><?php _e( 'Memory usage after loading export type', 'woocommerce-exporter' ); ?></dt>
31
+ <dd><?php echo ( ( $data_memory_end != false ) ? woo_ce_display_memory( $data_memory_end ) : '-' ); ?></dd>
32
+ <dt><?php _e( 'Idle memory usage (end)', 'woocommerce-exporter' ); ?></dt>
33
+ <dd><?php echo ( ( $idle_memory_end != false ) ? woo_ce_display_memory( $idle_memory_end ) : '-' ); ?></dd>
34
+ </dl>
35
 
36
+ </div>
37
+ <!-- .inside -->
38
+ </div>
39
+ <!-- .postbox -->
40
+ </div>
41
+ <!-- .postbox-container -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/admin/tabs-archive.php CHANGED
@@ -1,16 +1,17 @@
1
  <ul class="subsubsub">
2
- <li><a href="<?php echo add_query_arg( 'filter', null ); ?>"<?php woo_ce_archives_quicklink_current( 'all' ); ?>><?php _e( 'All', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count(); ?>)</span></a> |</li>
3
- <li><a href="<?php echo add_query_arg( 'filter', 'product' ); ?>"<?php woo_ce_archives_quicklink_current( 'product' ); ?>><?php _e( 'Products', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'product' ); ?>)</span></a> |</li>
4
- <li><a href="<?php echo add_query_arg( 'filter', 'category' ); ?>"<?php woo_ce_archives_quicklink_current( 'category' ); ?>><?php _e( 'Categories', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'category' ); ?>)</span></a> |</li>
5
- <li><a href="<?php echo add_query_arg( 'filter', 'tag' ); ?>"<?php woo_ce_archives_quicklink_current( 'tag' ); ?>><?php _e( 'Tags', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'tag' ); ?>)</span></a> |</li>
6
- <li><?php _e( 'Brands', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'brand' ); ?>)</span> |</li>
7
- <li><?php _e( 'Orders', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'order' ); ?>)</span> |</li>
8
- <li><?php _e( 'Customers', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'customer' ); ?>)</span> |</li>
9
- <li><a href="<?php echo add_query_arg( 'filter', 'user' ); ?>"<?php woo_ce_archives_quicklink_current( 'user' ); ?>><?php _e( 'Users', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'user' ); ?>)</span></a> |</li>
10
- <li><?php _e( 'Coupon', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'coupon' ); ?>)</span> |</li>
11
- <li><?php _e( 'Subscriptions', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'subscription' ); ?>)</span></li>
12
- <li><?php _e( 'Product Vendors', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'product_vendor' ); ?>)</span> |</li>
13
- <!-- <li><?php _e( 'Attributes', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'attribute' ); ?>)</span></li> -->
 
14
  </ul>
15
  <!-- .subsubsub -->
16
  <br class="clear" />
@@ -20,10 +21,10 @@
20
 
21
  <tr>
22
  <th scope="col" id="icon" class="manage-column column-icon"></th>
23
- <th scope="col" id="title" class="manage-column column-title"><?php _e( 'Filename', 'woo_ce' ); ?></th>
24
- <th scope="col" class="manage-column column-type"><?php _e( 'Type', 'woo_ce' ); ?></th>
25
- <th scope="col" class="manage-column column-author"><?php _e( 'Author', 'woo_ce' ); ?></th>
26
- <th scope="col" id="title" class="manage-column column-title"><?php _e( 'Date', 'woo_ce' ); ?></th>
27
  </tr>
28
 
29
  </thead>
@@ -31,10 +32,10 @@
31
 
32
  <tr>
33
  <th scope="col" class="manage-column column-icon"></th>
34
- <th scope="col" class="manage-column column-title"><?php _e( 'Filename', 'woo_ce' ); ?></th>
35
- <th scope="col" class="manage-column column-type"><?php _e( 'Type', 'woo_ce' ); ?></th>
36
- <th scope="col" class="manage-column column-author"><?php _e( 'Author', 'woo_ce' ); ?></th>
37
- <th scope="col" class="manage-column column-title"><?php _e( 'Date', 'woo_ce' ); ?></th>
38
  </tr>
39
 
40
  </tfoot>
@@ -49,12 +50,12 @@
49
  <td class="post-title page-title column-title">
50
  <strong><a href="<?php echo $file->guid; ?>" class="row-title"><?php echo $file->post_title; ?></a></strong>
51
  <div class="row-actions">
52
- <span class="view"><a href="<?php echo get_edit_post_link( $file->ID ); ?>" title="<?php _e( 'Edit', 'woo_ce' ); ?>"><?php _e( 'Edit', 'woo_ce' ); ?></a></span> |
53
- <span class="trash"><a href="<?php echo get_delete_post_link( $file->ID, '', true ); ?>" title="<?php _e( 'Delete Permanently', 'woo_ce' ); ?>"><?php _e( 'Delete', 'woo_ce' ); ?></a></span>
54
  </div>
55
  </td>
56
  <td class="title">
57
- <a href="<?php echo add_query_arg( 'filter', $file->export_type ); ?>"><?php echo $file->export_type_label; ?></a>
58
  </td>
59
  <td class="author column-author"><?php echo $file->post_author_name; ?></td>
60
  <td class="date column-date"><?php echo $file->post_date; ?></td>
@@ -62,7 +63,7 @@
62
  <?php } ?>
63
  <?php } else { ?>
64
  <tr id="post-<?php echo $file->ID; ?>" class="author-self" valign="top">
65
- <td colspan="3" class="colspanchange"><?php _e( 'No past exports were found.', 'woo_ce' ); ?></td>
66
  </tr>
67
  <?php } ?>
68
 
@@ -70,7 +71,7 @@
70
  </table>
71
  <div class="tablenav bottom">
72
  <div class="tablenav-pages one-page">
73
- <span class="displaying-num"><?php printf( __( '%d items', 'woo_ce' ), woo_ce_archives_quicklink_count() ); ?></span>
74
  </div>
75
  <!-- .tablenav-pages -->
76
  <br class="clear">
1
  <ul class="subsubsub">
2
+ <li><a href="<?php echo esc_url( add_query_arg( 'filter', null ) ); ?>"<?php woo_ce_archives_quicklink_current( 'all' ); ?>><?php _e( 'All', 'woocommerce-exporter' ); ?> <span class="count">(<?php echo woo_ce_archives_quicklink_count(); ?>)</span></a> |</li>
3
+ <li><a href="<?php echo esc_url( add_query_arg( 'filter', 'product' ) ); ?>"<?php woo_ce_archives_quicklink_current( 'product' ); ?>><?php _e( 'Products', 'woocommerce-exporter' ); ?> <span class="count">(<?php echo woo_ce_archives_quicklink_count( 'product' ); ?>)</span></a> |</li>
4
+ <li><a href="<?php echo esc_url( add_query_arg( 'filter', 'category' ) ); ?>"<?php woo_ce_archives_quicklink_current( 'category' ); ?>><?php _e( 'Categories', 'woocommerce-exporter' ); ?> <span class="count">(<?php echo woo_ce_archives_quicklink_count( 'category' ); ?>)</span></a> |</li>
5
+ <li><a href="<?php echo esc_url( add_query_arg( 'filter', 'tag' ) ); ?>"<?php woo_ce_archives_quicklink_current( 'tag' ); ?>><?php _e( 'Tags', 'woocommerce-exporter' ); ?> <span class="count">(<?php echo woo_ce_archives_quicklink_count( 'tag' ); ?>)</span></a> |</li>
6
+ <li><?php _e( 'Brands', 'woocommerce-exporter' ); ?> <span class="count">(<?php echo woo_ce_archives_quicklink_count( 'brand' ); ?>)</span> |</li>
7
+ <li><?php _e( 'Orders', 'woocommerce-exporter' ); ?> <span class="count">(<?php echo woo_ce_archives_quicklink_count( 'order' ); ?>)</span> |</li>
8
+ <li><?php _e( 'Customers', 'woocommerce-exporter' ); ?> <span class="count">(<?php echo woo_ce_archives_quicklink_count( 'customer' ); ?>)</span> |</li>
9
+ <li><a href="<?php echo esc_url( add_query_arg( 'filter', 'user' ) ); ?>"<?php woo_ce_archives_quicklink_current( 'user' ); ?>><?php _e( 'Users', 'woocommerce-exporter' ); ?> <span class="count">(<?php echo woo_ce_archives_quicklink_count( 'user' ); ?>)</span></a> |</li>
10
+ <li><?php _e( 'Coupon', 'woocommerce-exporter' ); ?> <span class="count">(<?php echo woo_ce_archives_quicklink_count( 'coupon' ); ?>)</span> |</li>
11
+ <li><?php _e( 'Subscriptions', 'woocommerce-exporter' ); ?> <span class="count">(<?php echo woo_ce_archives_quicklink_count( 'subscription' ); ?>)</span> |</li>
12
+ <li><?php _e( 'Product Vendors', 'woocommerce-exporter' ); ?> <span class="count">(<?php echo woo_ce_archives_quicklink_count( 'product_vendor' ); ?>)</span> |</li>
13
+ <li><?php _e( 'Shipping Classes', 'woocommerce-exporter' ); ?> <span class="count">(<?php echo woo_ce_archives_quicklink_count( 'shipping_class' ); ?>)</span></li>
14
+ <!-- <li><?php _e( 'Attributes', 'woocommerce-exporter' ); ?> <span class="count">(<?php echo woo_ce_archives_quicklink_count( 'attribute' ); ?>)</span></li> -->
15
  </ul>
16
  <!-- .subsubsub -->
17
  <br class="clear" />
21
 
22
  <tr>
23
  <th scope="col" id="icon" class="manage-column column-icon"></th>
24
+ <th scope="col" id="title" class="manage-column column-title"><?php _e( 'Filename', 'woocommerce-exporter' ); ?></th>
25
+ <th scope="col" class="manage-column column-type"><?php _e( 'Type', 'woocommerce-exporter' ); ?></th>
26
+ <th scope="col" class="manage-column column-author"><?php _e( 'Author', 'woocommerce-exporter' ); ?></th>
27
+ <th scope="col" id="title" class="manage-column column-title"><?php _e( 'Date', 'woocommerce-exporter' ); ?></th>
28
  </tr>
29
 
30
  </thead>
32
 
33
  <tr>
34
  <th scope="col" class="manage-column column-icon"></th>
35
+ <th scope="col" class="manage-column column-title"><?php _e( 'Filename', 'woocommerce-exporter' ); ?></th>
36
+ <th scope="col" class="manage-column column-type"><?php _e( 'Type', 'woocommerce-exporter' ); ?></th>
37
+ <th scope="col" class="manage-column column-author"><?php _e( 'Author', 'woocommerce-exporter' ); ?></th>
38
+ <th scope="col" class="manage-column column-title"><?php _e( 'Date', 'woocommerce-exporter' ); ?></th>
39
  </tr>
40
 
41
  </tfoot>
50
  <td class="post-title page-title column-title">
51
  <strong><a href="<?php echo $file->guid; ?>" class="row-title"><?php echo $file->post_title; ?></a></strong>
52
  <div class="row-actions">
53
+ <span class="view"><a href="<?php echo get_edit_post_link( $file->ID ); ?>" title="<?php _e( 'Edit', 'woocommerce-exporter' ); ?>"><?php _e( 'Edit', 'woocommerce-exporter' ); ?></a></span> |
54
+ <span class="trash"><a href="<?php echo get_delete_post_link( $file->ID, '', true ); ?>" title="<?php _e( 'Delete Permanently', 'woocommerce-exporter' ); ?>"><?php _e( 'Delete', 'woocommerce-exporter' ); ?></a></span>
55
  </div>
56
  </td>
57
  <td class="title">
58
+ <a href="<?php echo esc_url( add_query_arg( 'filter', $file->export_type ) ); ?>"><?php echo $file->export_type_label; ?></a>
59
  </td>
60
  <td class="author column-author"><?php echo $file->post_author_name; ?></td>
61
  <td class="date column-date"><?php echo $file->post_date; ?></td>
63
  <?php } ?>
64
  <?php } else { ?>
65
  <tr id="post-<?php echo $file->ID; ?>" class="author-self" valign="top">
66
+ <td colspan="3" class="colspanchange"><?php _e( 'No past exports were found.', 'woocommerce-exporter' ); ?></td>
67
  </tr>
68
  <?php } ?>
69
 
71
  </table>
72
  <div class="tablenav bottom">
73
  <div class="tablenav-pages one-page">
74
+ <span class="displaying-num"><?php printf( __( '%d items', 'woocommerce-exporter' ), woo_ce_archives_quicklink_count() ); ?></span>
75
  </div>
76
  <!-- .tablenav-pages -->
77
  <br class="clear">
templates/admin/tabs-export.php CHANGED
@@ -1,136 +1,160 @@
1
  <ul class="subsubsub">
2
- <li><a href="#export-type"><?php _e( 'Export Type', 'woo_ce' ); ?></a> |</li>
3
- <li><a href="#export-options"><?php _e( 'Export Options', 'woo_ce' ); ?></a></li>
4
- <li>| <a href="#export-modules"><?php _e( 'Export Modules', 'woo_ce' ); ?></a></li>
5
  <?php do_action( 'woo_ce_export_quicklinks' ); ?>
6
  </ul>
7
  <!-- .subsubsub -->
8
  <br class="clear" />
9
 
10
- <p><?php _e( 'Select an export type from the list below to export entries. Once you have selected an export type you may select the fields you would like to export and optional filters available for each export type. When you click the export button below, Store Exporter will create an export file for you to save to your computer.', 'woo_ce' ); ?></p>
11
  <div id="poststuff">
12
- <form method="post" action="<?php echo add_query_arg( array( 'failed' => null, 'empty' => null, 'message' => null ) ); ?>" id="postform">
13
 
14
  <div id="export-type" class="postbox">
15
- <h3 class="hndle"><?php _e( 'Export Type', 'woo_ce' ); ?></h3>
 
 
 
16
  <div class="inside">
17
- <p class="description"><?php _e( 'Select the data type you want to export.', 'woo_ce' ); ?></p>
18
  <table class="form-table">
19
 
20
  <tr>
21
  <th>
22
- <input type="radio" id="product" name="dataset" value="product"<?php disabled( $products, 0 ); ?><?php checked( $export_type, 'product' ); ?> />
23
- <label for="product"><?php _e( 'Products', 'woo_ce' ); ?></label>
24
  </th>
25
  <td>
26
- <span class="description">(<?php echo $products; ?>)</span>
27
  </td>
28
  </tr>
29
 
30
  <tr>
31
  <th>
32
- <input type="radio" id="category" name="dataset" value="category"<?php disabled( $categories, 0 ); ?><?php checked( $export_type, 'category' ); ?> />
33
- <label for="category"><?php _e( 'Categories', 'woo_ce' ); ?></label>
34
  </th>
35
  <td>
36
- <span class="description">(<?php echo $categories; ?>)</span>
37
  </td>
38
  </tr>
39
 
40
  <tr>
41
  <th>
42
- <input type="radio" id="tag" name="dataset" value="tag"<?php disabled( $tags, 0 ); ?><?php checked( $export_type, 'tag' ); ?> />
43
- <label for="tag"><?php _e( 'Tags', 'woo_ce' ); ?></label>
44
  </th>
45
  <td>
46
- <span class="description">(<?php echo $tags; ?>)</span>
47
  </td>
48
  </tr>
49
 
50
  <tr>
51
  <th>
52
- <input type="radio" id="brand" name="dataset" value="brand"<?php disabled( $brands, 0 ); ?><?php checked( $export_type, 'brand' ); ?> />
53
- <label for="brand"><?php _e( 'Brands', 'woo_ce' ); ?></label>
54
  </th>
55
  <td>
56
- <span class="description">(<?php echo $brands; ?>)</span>
57
- <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
58
  </td>
59
  </tr>
60
 
61
  <tr>
62
  <th>
63
- <input type="radio" id="order" name="dataset" value="order"<?php disabled( $orders, 0 ); ?><?php checked( $export_type, 'order' ); ?>/>
64
- <label for="order"><?php _e( 'Orders', 'woo_ce' ); ?></label>
65
  </th>
66
  <td>
67
- <span class="description">(<?php echo $orders; ?>)</span>
68
- <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
69
  </td>
70
  </tr>
71
 
72
  <tr>
73
  <th>
74
- <input type="radio" id="customer" name="dataset" value="customer"<?php disabled( $customers, 0 ); ?><?php checked( $export_type, 'customer' ); ?>/>
75
- <label for="customer"><?php _e( 'Customers', 'woo_ce' ); ?></label>
76
  </th>
77
  <td>
78
- <span class="description">(<?php echo $customers; ?>)</span>
79
- <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
80
  </td>
81
  </tr>
82
 
83
  <tr>
84
  <th>
85
- <input type="radio" id="user" name="dataset" value="user"<?php disabled( $users, 0 ); ?><?php checked( $export_type, 'user' ); ?>/>
86
- <label for="user"><?php _e( 'Users', 'woo_ce' ); ?></label>
87
  </th>
88
  <td>
89
- <span class="description">(<?php echo $users; ?>)</span>
90
  </td>
91
  </tr>
92
 
93
  <tr>
94
  <th>
95
- <input type="radio" id="coupon" name="dataset" value="coupon"<?php disabled( $coupons, 0 ); ?><?php checked( $export_type, 'coupon' ); ?> />
96
- <label for="coupon"><?php _e( 'Coupons', 'woo_ce' ); ?></label>
97
  </th>
98
  <td>
99
- <span class="description">(<?php echo $coupons; ?>)</span>
100
- <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
101
  </td>
102
  </tr>
103
 
104
  <tr>
105
  <th>
106
- <input type="radio" id="subscription" name="dataset" value="subscription"<?php disabled( $subscriptions, 0 ); ?><?php checked( $export_type, 'subscription' ); ?> />
107
- <label for="subscription"><?php _e( 'Subscriptions', 'woo_ce' ); ?></label>
108
  </th>
109
  <td>
110
- <span class="description">(<?php echo $subscriptions; ?>)</span>
111
- <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
112
  </td>
113
  </tr>
114
 
115
  <tr>
116
  <th>
117
- <input type="radio" id="product_vendor" name="dataset" value="product_vendor"<?php disabled( $product_vendors, 0 ); ?><?php checked( $export_type, 'product_vendor' ); ?> />
118
- <label for="product_vendor"><?php _e( 'Product Vendors', 'woo_ce' ); ?></label>
119
  </th>
120
  <td>
121
- <span class="description">(<?php echo $product_vendors; ?>)</span>
122
- <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  </td>
124
  </tr>
125
 
126
  <!--
127
  <tr>
128
  <th>
129
- <input type="radio" id="attribute" name="dataset" value="attribute"<?php disabled( $attributes, 0 ); ?><?php checked( $export_type, 'attribute' ); ?> />
130
- <label for="attribute"><?php _e( 'Attributes', 'woo_ce' ); ?></label>
131
  </th>
132
  <td>
133
- <span class="description">(<?php echo $attributes; ?>)</span>
134
  </td>
135
  </tr>
136
  -->
@@ -142,27 +166,42 @@
142
  </div>
143
  <!-- .postbox -->
144
 
 
 
 
 
 
 
 
 
 
 
 
145
  <?php if( $product_fields ) { ?>
146
  <div id="export-product" class="export-types">
147
 
148
  <div class="postbox">
149
  <h3 class="hndle">
150
- <?php _e( 'Product Fields', 'woo_ce' ); ?>
151
- <a href="<?php echo add_query_arg( array( 'tab' => 'fields', 'type' => 'product' ) ); ?>" style="float:right;"><?php _e( 'Configure', 'woo_ce' ); ?></a>
152
  </h3>
153
  <div class="inside">
154
- <?php if( $products ) { ?>
155
- <p class="description"><?php _e( 'Select the Product fields you would like to export, your field selection is saved for future exports.', 'woo_ce' ); ?></p>
156
- <p><a href="javascript:void(0)" id="product-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="product-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
 
 
 
 
157
  <table id="product-fields" class="ui-sortable">
158
 
159
  <?php foreach( $product_fields as $product_field ) { ?>
160
- <tr>
161
  <td>
162
- <label>
163
  <input type="checkbox" name="product_fields[<?php echo $product_field['name']; ?>]" class="product_field"<?php ( isset( $product_field['default'] ) ? checked( $product_field['default'], 1 ) : '' ); ?><?php disabled( $product_field['disabled'], 1 ); ?> />
164
  <?php echo $product_field['label']; ?>
165
- <?php if( $product_field['disabled'] ) { ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span><?php } ?>
166
  <input type="hidden" name="product_fields_order[<?php echo $product_field['name']; ?>]" class="field_order" value="<?php echo $product_field['order']; ?>" />
167
  </label>
168
  </td>
@@ -171,18 +210,18 @@
171
  <?php } ?>
172
  </table>
173
  <p class="submit">
174
- <input type="submit" id="export_product" value="<?php _e( 'Export Products', 'woo_ce' ); ?> " class="button-primary" />
175
  </p>
176
- <p class="description"><?php _e( 'Can\'t find a particular Product field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
177
  <?php } else { ?>
178
- <p><?php _e( 'No Products were found.', 'woo_ce' ); ?></p>
179
  <?php } ?>
180
  </div>
181
  </div>
182
  <!-- .postbox -->
183
 
184
  <div id="export-products-filters" class="postbox">
185
- <h3 class="hndle"><?php _e( 'Product Filters', 'woo_ce' ); ?></h3>
186
  <div class="inside">
187
 
188
  <?php do_action( 'woo_ce_export_product_options_before_table' ); ?>
@@ -208,21 +247,25 @@
208
 
209
  <div class="postbox">
210
  <h3 class="hndle">
211
- <?php _e( 'Category Fields', 'woo_ce' ); ?>
212
- <a href="<?php echo add_query_arg( array( 'tab' => 'fields', 'type' => 'category' ) ); ?>" style="float:right;"><?php _e( 'Configure', 'woo_ce' ); ?></a>
213
  </h3>
214
  <div class="inside">
215
- <p class="description"><?php _e( 'Select the Category fields you would like to export.', 'woo_ce' ); ?></p>
216
- <p><a href="javascript:void(0)" id="category-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="category-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
 
 
 
 
217
  <table id="category-fields" class="ui-sortable">
218
 
219
  <?php foreach( $category_fields as $category_field ) { ?>
220
- <tr>
221
  <td>
222
- <label>
223
  <input type="checkbox" name="category_fields[<?php echo $category_field['name']; ?>]" class="category_field"<?php ( isset( $category_field['default'] ) ? checked( $category_field['default'], 1 ) : '' ); ?><?php disabled( $category_field['disabled'], 1 ); ?> />
224
  <?php echo $category_field['label']; ?>
225
- <input type="hidden" name="category_fields_order[<?php echo $category_field['name']; ?>]" class="field_order" value="" />
226
  </label>
227
  </td>
228
  </tr>
@@ -230,16 +273,16 @@
230
  <?php } ?>
231
  </table>
232
  <p class="submit">
233
- <input type="submit" id="export_category" value="<?php _e( 'Export Categories', 'woo_ce' ); ?> " class="button-primary" />
234
  </p>
235
- <p class="description"><?php _e( 'Can\'t find a particular Category field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
236
  </div>
237
  <!-- .inside -->
238
  </div>
239
  <!-- .postbox -->
240
 
241
  <div id="export-categories-filters" class="postbox">
242
- <h3 class="hndle"><?php _e( 'Category Filters', 'woo_ce' ); ?></h3>
243
  <div class="inside">
244
 
245
  <?php do_action( 'woo_ce_export_category_options_before_table' ); ?>
@@ -263,21 +306,25 @@
263
 
264
  <div class="postbox">
265
  <h3 class="hndle">
266
- <?php _e( 'Tag Fields', 'woo_ce' ); ?>
267
- <a href="<?php echo add_query_arg( array( 'tab' => 'fields', 'type' => 'tag' ) ); ?>" style="float:right;"><?php _e( 'Configure', 'woo_ce' ); ?></a>
268
  </h3>
269
  <div class="inside">
270
- <p class="description"><?php _e( 'Select the Tag fields you would like to export.', 'woo_ce' ); ?></p>
271
- <p><a href="javascript:void(0)" id="tag-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="tag-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
 
 
 
 
272
  <table id="tag-fields" class="ui-sortable">
273
 
274
  <?php foreach( $tag_fields as $tag_field ) { ?>
275
- <tr>
276
  <td>
277
- <label>
278
  <input type="checkbox" name="tag_fields[<?php echo $tag_field['name']; ?>]" class="tag_field"<?php ( isset( $tag_field['default'] ) ? checked( $tag_field['default'], 1 ) : '' ); ?><?php disabled( $tag_field['disabled'], 1 ); ?> />
279
  <?php echo $tag_field['label']; ?>
280
- <input type="hidden" name="tag_fields_order[<?php echo $tag_field['name']; ?>]" class="field_order" value="" />
281
  </label>
282
  </td>
283
  </tr>
@@ -285,16 +332,16 @@
285
  <?php } ?>
286
  </table>
287
  <p class="submit">
288
- <input type="submit" id="export_tag" value="<?php _e( 'Export Tags', 'woo_ce' ); ?> " class="button-primary" />
289
  </p>
290
- <p class="description"><?php _e( 'Can\'t find a particular Tag field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
291
  </div>
292
  <!-- .inside -->
293
  </div>
294
  <!-- .postbox -->
295
 
296
  <div id="export-tags-filters" class="postbox">
297
- <h3 class="hndle"><?php _e( 'Product Tag Filters', 'woo_ce' ); ?></h3>
298
  <div class="inside">
299
 
300
  <?php do_action( 'woo_ce_export_tag_options_before_table' ); ?>
@@ -319,20 +366,25 @@
319
 
320
  <div class="postbox">
321
  <h3 class="hndle">
322
- <?php _e( 'Brand Fields', 'woo_ce' ); ?>
323
  </h3>
324
  <div class="inside">
325
- <?php if( $brands ) { ?>
326
- <p class="description"><?php _e( 'Select the Brand fields you would like to export.', 'woo_ce' ); ?></p>
327
- <p><a href="javascript:void(0)" id="brand-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="brand-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
 
 
 
 
328
  <table id="brand-fields" class="ui-sortable">
329
 
330
  <?php foreach( $brand_fields as $brand_field ) { ?>
331
- <tr>
332
  <td>
333
- <label>
334
  <input type="checkbox" name="brand_fields[<?php echo $brand_field['name']; ?>]" class="brand_field"<?php ( isset( $brand_field['default'] ) ? checked( $brand_field['default'], 1 ) : '' ); ?> disabled="disabled" />
335
  <?php echo $brand_field['label']; ?>
 
336
  </label>
337
  </td>
338
  </tr>
@@ -340,11 +392,11 @@
340
  <?php } ?>
341
  </table>
342
  <p class="submit">
343
- <input type="button" class="button button-disabled" value="<?php _e( 'Export Brands', 'woo_ce' ); ?>" />
344
  </p>
345
- <p class="description"><?php _e( 'Can\'t find a particular Brand field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
346
  <?php } else { ?>
347
- <p><?php _e( 'No Brands were found.', 'woo_ce' ); ?></p>
348
  <?php } ?>
349
  </div>
350
  <!-- .inside -->
@@ -352,7 +404,7 @@
352
  <!-- .postbox -->
353
 
354
  <div id="export-brands-filters" class="postbox">
355
- <h3 class="hndle"><?php _e( 'Brand Filters', 'woo_ce' ); ?></h3>
356
  <div class="inside">
357
 
358
  <?php do_action( 'woo_ce_export_brand_options_before_table' ); ?>
@@ -377,21 +429,26 @@
377
 
378
  <div class="postbox">
379
  <h3 class="hndle">
380
- <?php _e( 'Order Fields', 'woo_ce' ); ?>
381
  </h3>
382
  <div class="inside">
383
 
384
- <?php if( $orders ) { ?>
385
- <p class="description"><?php _e( 'Select the Order fields you would like to export.', 'woo_ce' ); ?></p>
386
- <p><a href="javascript:void(0)" id="order-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="order-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
 
 
 
 
387
  <table id="order-fields" class="ui-sortable">
388
 
389
  <?php foreach( $order_fields as $order_field ) { ?>
390
- <tr>
391
  <td>
392
- <label>
393
  <input type="checkbox" name="order_fields[<?php echo $order_field['name']; ?>]" class="order_field"<?php ( isset( $order_field['default'] ) ? checked( $order_field['default'], 1 ) : '' ); ?> disabled="disabled" />
394
  <?php echo $order_field['label']; ?>
 
395
  </label>
396
  </td>
397
  </tr>
@@ -399,11 +456,11 @@
399
  <?php } ?>
400
  </table>
401
  <p class="submit">
402
- <input type="button" class="button button-disabled" value="<?php _e( 'Export Orders', 'woo_ce' ); ?>" />
403
  </p>
404
- <p class="description"><?php _e( 'Can\'t find a particular Order field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
405
  <?php } else { ?>
406
- <p><?php _e( 'No Orders were found.', 'woo_ce' ); ?></p>
407
  <?php } ?>
408
 
409
  </div>
@@ -411,7 +468,7 @@
411
  <!-- .postbox -->
412
 
413
  <div id="export-orders-filters" class="postbox">
414
- <h3 class="hndle"><?php _e( 'Order Filters', 'woo_ce' ); ?></h3>
415
  <div class="inside">
416
 
417
  <?php do_action( 'woo_ce_export_order_options_before_table' ); ?>
@@ -436,20 +493,25 @@
436
 
437
  <div class="postbox">
438
  <h3 class="hndle">
439
- <?php _e( 'Customer Fields', 'woo_ce' ); ?>
440
  </h3>
441
  <div class="inside">
442
- <?php if( $customers ) { ?>
443
- <p class="description"><?php _e( 'Select the Customer fields you would like to export.', 'woo_ce' ); ?></p>
444
- <p><a href="javascript:void(0)" id="customer-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="customer-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
 
 
 
 
445
  <table id="customer-fields" class="ui-sortable">
446
 
447
  <?php foreach( $customer_fields as $customer_field ) { ?>
448
- <tr>
449
  <td>
450
- <label>
451
  <input type="checkbox" name="customer_fields[<?php echo $customer_field['name']; ?>]" class="customer_field"<?php ( isset( $customer_field['default'] ) ? checked( $customer_field['default'], 1 ) : '' ); ?> disabled="disabled" />
452
  <?php echo $customer_field['label']; ?>
 
453
  </label>
454
  </td>
455
  </tr>
@@ -457,11 +519,11 @@
457
  <?php } ?>
458
  </table>
459
  <p class="submit">
460
- <input type="button" class="button button-disabled" value="<?php _e( 'Export Customers', 'woo_ce' ); ?>" />
461
  </p>
462
- <p class="description"><?php _e( 'Can\'t find a particular Customer field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
463
  <?php } else { ?>
464
- <p><?php _e( 'No Customers were found.', 'woo_ce' ); ?></p>
465
  <?php } ?>
466
  </div>
467
  <!-- .inside -->
@@ -469,7 +531,7 @@
469
  <!-- .postbox -->
470
 
471
  <div id="export-customers-filters" class="postbox">
472
- <h3 class="hndle"><?php _e( 'Customer Filters', 'woo_ce' ); ?></h3>
473
  <div class="inside">
474
 
475
  <?php do_action( 'woo_ce_export_customer_options_before_table' ); ?>
@@ -494,23 +556,27 @@
494
 
495
  <div class="postbox">
496
  <h3 class="hndle">
497
- <?php _e( 'User Fields', 'woo_ce' ); ?>
498
- <a href="<?php echo add_query_arg( array( 'tab' => 'fields', 'type' => 'user' ) ); ?>" style="float:right;"><?php _e( 'Configure', 'woo_ce' ); ?></a>
499
  </h3>
500
  <div class="inside">
501
- <?php if( $users ) { ?>
502
- <p class="description"><?php _e( 'Select the User fields you would like to export.', 'woo_ce' ); ?></p>
503
- <p><a href="javascript:void(0)" id="user-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="user-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
 
 
 
 
504
  <table id="user-fields" class="ui-sortable">
505
 
506
  <?php foreach( $user_fields as $user_field ) { ?>
507
- <tr>
508
  <td>
509
- <label>
510
  <input type="checkbox" name="user_fields[<?php echo $user_field['name']; ?>]" class="user_field"<?php ( isset( $user_field['default'] ) ? checked( $user_field['default'], 1 ) : '' ); ?><?php disabled( $user_field['disabled'], 1 ); ?> />
511
  <?php echo $user_field['label']; ?>
512
- <?php if( $user_field['disabled'] ) { ?><span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span><?php } ?>
513
- <input type="hidden" name="user_fields_order[<?php echo $user_field['name']; ?>]" class="field_order" value="" />
514
  </label>
515
  </td>
516
  </tr>
@@ -518,11 +584,11 @@
518
  <?php } ?>
519
  </table>
520
  <p class="submit">
521
- <input type="submit" id="export_user" class="button-primary" value="<?php _e( 'Export Users', 'woo_ce' ); ?>" />
522
  </p>
523
- <p class="description"><?php _e( 'Can\'t find a particular User field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
524
  <?php } else { ?>
525
- <p><?php _e( 'No Users were found.', 'woo_ce' ); ?></p>
526
  <?php } ?>
527
  </div>
528
  <!-- .inside -->
@@ -530,7 +596,7 @@
530
  <!-- .postbox -->
531
 
532
  <div id="export-users-filters" class="postbox">
533
- <h3 class="hndle"><?php _e( 'User Filters', 'woo_ce' ); ?></h3>
534
  <div class="inside">
535
 
536
  <?php do_action( 'woo_ce_export_user_options_before_table' ); ?>
@@ -555,20 +621,25 @@
555
 
556
  <div class="postbox">
557
  <h3 class="hndle">
558
- <?php _e( 'Coupon Fields', 'woo_ce' ); ?>
559
  </h3>
560
  <div class="inside">
561
- <?php if( $coupons ) { ?>
562
- <p class="description"><?php _e( 'Select the Coupon fields you would like to export.', 'woo_ce' ); ?></p>
563
- <p><a href="javascript:void(0)" id="coupon-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="coupon-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
 
 
 
 
564
  <table id="coupon-fields" class="ui-sortable">
565
 
566
  <?php foreach( $coupon_fields as $coupon_field ) { ?>
567
- <tr>
568
  <td>
569
- <label>
570
  <input type="checkbox" name="coupon_fields[<?php echo $coupon_field['name']; ?>]" class="coupon_field"<?php ( isset( $coupon_field['default'] ) ? checked( $coupon_field['default'], 1 ) : '' ); ?> disabled="disabled" />
571
  <?php echo $coupon_field['label']; ?>
 
572
  </label>
573
  </td>
574
  </tr>
@@ -576,11 +647,11 @@
576
  <?php } ?>
577
  </table>
578
  <p class="submit">
579
- <input type="button" class="button button-disabled" value="<?php _e( 'Export Coupons', 'woo_ce' ); ?>" />
580
  </p>
581
- <p class="description"><?php _e( 'Can\'t find a particular Coupon field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
582
  <?php } else { ?>
583
- <p><?php _e( 'No Coupons were found.', 'woo_ce' ); ?></p>
584
  <?php } ?>
585
  </div>
586
  <!-- .inside -->
@@ -588,7 +659,7 @@
588
  <!-- .postbox -->
589
 
590
  <div id="export-coupons-filters" class="postbox">
591
- <h3 class="hndle"><?php _e( 'Coupon Filters', 'woo_ce' ); ?></h3>
592
  <div class="inside">
593
 
594
  <?php do_action( 'woo_ce_export_coupon_options_before_table' ); ?>
@@ -613,20 +684,25 @@
613
 
614
  <div class="postbox">
615
  <h3 class="hndle">
616
- <?php _e( 'Subscription Fields', 'woo_ce' ); ?>
617
  </h3>
618
  <div class="inside">
619
- <?php if( $subscriptions ) { ?>
620
- <p class="description"><?php _e( 'Select the Subscription fields you would like to export.', 'woo_ce' ); ?></p>
621
- <p><a href="javascript:void(0)" id="subscription-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="subscription-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
 
 
 
 
622
  <table id="subscription-fields" class="ui-sortable">
623
 
624
  <?php foreach( $subscription_fields as $subscription_field ) { ?>
625
- <tr>
626
  <td>
627
- <label>
628
  <input type="checkbox" name="subscription_fields[<?php echo $subscription_field['name']; ?>]" class="subscription_field"<?php ( isset( $subscription_field['default'] ) ? checked( $subscription_field['default'], 1 ) : '' ); ?> disabled="disabled" />
629
  <?php echo $subscription_field['label']; ?>
 
630
  </label>
631
  </td>
632
  </tr>
@@ -634,16 +710,34 @@
634
  <?php } ?>
635
  </table>
636
  <p class="submit">
637
- <input type="button" class="button button-disabled" value="<?php _e( 'Export Subscriptions', 'woo_ce' ); ?>" />
638
  </p>
639
- <p class="description"><?php _e( 'Can\'t find a particular Subscription field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
640
  <?php } else { ?>
641
- <p><?php _e( 'No Subscriptions were found.', 'woo_ce' ); ?></p>
642
  <?php } ?>
643
  </div>
644
  <!-- .inside -->
645
  </div>
646
  <!-- .postbox -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
647
  </div>
648
  <!-- #export-subscription -->
649
 
@@ -653,21 +747,25 @@
653
 
654
  <div class="postbox">
655
  <h3 class="hndle">
656
- <?php _e( 'Product Vendor Fields', 'woo_ce' ); ?>
657
  </h3>
658
  <div class="inside">
659
- <?php if( $product_vendors ) { ?>
660
- <p class="description"><?php _e( 'Select the Product Vendor fields you would like to export.', 'woo_ce' ); ?></p>
661
- <p><a href="javascript:void(0)" id="product_vendor-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="product_vendor-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
 
 
 
 
662
  <table id="product_vendor-fields" class="ui-sortable">
663
 
664
  <?php foreach( $product_vendor_fields as $product_vendor_field ) { ?>
665
- <tr>
666
  <td>
667
- <label>
668
  <input type="checkbox" name="product_vendor_fields[<?php echo $product_vendor_field['name']; ?>]" class="product_vendor_field"<?php ( isset( $product_vendor_field['default'] ) ? checked( $product_vendor_field['default'], 1 ) : '' ); ?> disabled="disabled" />
669
  <?php echo $product_vendor_field['label']; ?>
670
- <input type="hidden" name="product_vendor_fields_order[<?php echo $product_vendor_field['name']; ?>]" class="field_order" value="" />
671
  </label>
672
  </td>
673
  </tr>
@@ -675,26 +773,153 @@
675
  <?php } ?>
676
  </table>
677
  <p class="submit">
678
- <input type="button" class="button button-disabled" value="<?php _e( 'Export Product Vendors', 'woo_ce' ); ?>" />
679
  </p>
680
- <p class="description"><?php _e( 'Can\'t find a particular Product Vendor field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
681
  <?php } else { ?>
682
- <p><?php _e( 'No Product Vendors were found.', 'woo_ce' ); ?></p>
683
  <?php } ?>
684
  </div>
685
  <!-- .inside -->
686
  </div>
687
  <!-- .postbox -->
 
688
  </div>
689
  <!-- #export-product_vendor -->
690
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
691
  <?php } ?>
692
  <?php do_action( 'woo_ce_before_options' ); ?>
693
 
694
  <div class="postbox" id="export-options">
695
- <h3 class="hndle"><?php _e( 'Export Options', 'woo_ce' ); ?></h3>
696
  <div class="inside">
697
- <p class="description"><?php _e( 'You can find additional export options under the Settings tab at the top of this screen.', 'woo_ce' ); ?></p>
698
 
699
  <?php do_action( 'woo_ce_export_options_before' ); ?>
700
 
@@ -704,17 +929,21 @@
704
 
705
  <tr>
706
  <th>
707
- <label for="offset"><?php _e( 'Volume offset', 'woo_ce' ); ?></label> / <label for="limit_volume"><?php _e( 'Limit volume', 'woo_ce' ); ?></label>
708
  </th>
709
  <td>
710
- <input type="text" size="3" id="offset" name="offset" value="<?php echo esc_attr( $offset ); ?>" size="5" class="text" title="<?php _e( 'Volume Offset', 'woo_ce' ); ?>" /> <?php _e( 'to', 'woo_ce' ); ?> <input type="text" size="3" id="limit_volume" name="limit_volume" value="<?php echo esc_attr( $limit_volume ); ?>" size="5" class="text" title="<?php _e( 'Limit Volume', 'woo_ce' ); ?>" />
711
- <p class="description"><?php _e( 'Volume offset and limit allows for partial exporting of an export type (e.g. records 0 to 500, etc.). This is useful when encountering timeout and/or memory errors during the a large or memory intensive export. To be used effectively both fields must be filled. By default this is not used and is left empty.', 'woo_ce' ); ?></p>
 
 
 
712
  </td>
713
  </tr>
714
 
715
  <?php do_action( 'woo_ce_export_options_table_after' ); ?>
716
 
717
  </table>
 
718
 
719
  <?php do_action( 'woo_ce_export_options_after' ); ?>
720
 
@@ -725,53 +954,11 @@
725
  <?php do_action( 'woo_ce_after_options' ); ?>
726
 
727
  <input type="hidden" name="action" value="export" />
 
 
728
  </form>
729
 
730
  <?php do_action( 'woo_ce_export_after_form' ); ?>
731
 
732
- <?php do_action( 'woo_ce_before_modules' ); ?>
733
-
734
- <div id="export-modules" class="postbox">
735
- <h3 class="hndle"><?php _e( 'Export Modules', 'woo_ce' ); ?></h3>
736
- <div class="inside">
737
- <p><?php _e( 'Export store details from other WooCommerce and WordPress Plugins, simply install and activate one of the below Plugins to enable those additional export options.', 'woo_ce' ); ?></p>
738
- <?php if( $modules ) { ?>
739
- <div class="table table_content">
740
- <table class="woo_vm_version_table">
741
- <?php foreach( $modules as $module ) { ?>
742
- <tr>
743
- <td class="export_module">
744
- <?php if( $module['description'] ) { ?>
745
- <strong><?php echo $module['title']; ?></strong>: <span class="description"><?php echo $module['description']; ?></span>
746
- <?php } else { ?>
747
- <strong><?php echo $module['title']; ?></strong>
748
- <?php } ?>
749
- </td>
750
- <td class="status">
751
- <div class="<?php woo_ce_modules_status_class( $module['status'] ); ?>">
752
- <?php if( $module['status'] == 'active' ) { ?>
753
- <div class="dashicons dashicons-yes" style="color:#008000;"></div><?php woo_ce_modules_status_label( $module['status'] ); ?>
754
- <?php } else { ?>
755
- <?php if( $module['url'] ) { ?>
756
- <?php if( isset( $module['slug'] ) ) { echo '<div class="dashicons dashicons-download" style="color:#0074a2;"></div>'; } else { echo '<div class="dashicons dashicons-admin-links"></div>'; } ?>&nbsp;<a href="<?php echo $module['url']; ?>" target="_blank"<?php if( isset( $module['slug'] ) ) { echo ' title="' . __( 'Install via WordPress Plugin Directory', 'woo_ce' ) . '"'; } else { echo ' title="' . __( 'Visit the Plugin website', 'woo_ce' ) . '"'; } ?>><?php woo_ce_modules_status_label( $module['status'] ); ?></a>
757
- <?php } ?>
758
- <?php } ?>
759
- </div>
760
- </td>
761
- </tr>
762
- <?php } ?>
763
- </table>
764
- </div>
765
- <!-- .table -->
766
- <?php } else { ?>
767
- <p><?php _e( 'No export modules are available at this time.', 'woo_ce' ); ?></p>
768
- <?php } ?>
769
- </div>
770
- <!-- .inside -->
771
- </div>
772
- <!-- .postbox -->
773
-
774
- <?php do_action( 'woo_ce_after_modules' ); ?>
775
-
776
  </div>
777
  <!-- #poststuff -->
1
  <ul class="subsubsub">
2
+ <li><a href="#export-type"><?php _e( 'Export Type', 'woocommerce-exporter' ); ?></a> |</li>
3
+ <li><a href="#export-options"><?php _e( 'Export Options', 'woocommerce-exporter' ); ?></a></li>
 
4
  <?php do_action( 'woo_ce_export_quicklinks' ); ?>
5
  </ul>
6
  <!-- .subsubsub -->
7
  <br class="clear" />
8
 
9
+ <p><?php _e( 'Select an export type from the list below to export entries. Once you have selected an export type you may select the fields you would like to export and optional filters available for each export type. When you click the Export button below, Store Exporter will create an export file for you to save to your computer.', 'woocommerce-exporter' ); ?></p>
10
  <div id="poststuff">
11
+ <form method="post" action="<?php echo esc_url( add_query_arg( array( 'failed' => null, 'empty' => null, 'message' => null ) ) ); ?>" id="postform">
12
 
13
  <div id="export-type" class="postbox">
14
+ <h3 class="hndle">
15
+ <?php _e( 'Export Types', 'woocommerce-exporter' ); ?>
16
+ <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'refresh_export_type_counts', '_wpnonce' => wp_create_nonce( 'woo_ce_refresh_export_type_counts' ) ) ) ); ?>" style="float:right;"><?php _e( 'Refresh counts', 'woocommerce-exporter' ); ?></a>
17
+ </h3>
18
  <div class="inside">
19
+ <p class="description"><?php _e( 'Select the data type you want to export. Export Type counts are refreshed hourly and can be manually refreshed by clicking the <em>Refresh counts</em> link to the right.', 'woocommerce-exporter' ); ?></p>
20
  <table class="form-table">
21
 
22
  <tr>
23
  <th>
24
+ <input type="radio" id="product" name="dataset" value="product"<?php disabled( $product, 0 ); ?><?php checked( ( empty( $product ) ? '' : $export_type ), 'product' ); ?> />
25
+ <label for="product"><?php _e( 'Products', 'woocommerce-exporter' ); ?></label>
26
  </th>
27
  <td>
28
+ <span class="description">(<?php echo $product; ?>)</span>
29
  </td>
30
  </tr>
31
 
32
  <tr>
33
  <th>
34
+ <input type="radio" id="category" name="dataset" value="category"<?php disabled( $category, 0 ); ?><?php checked( ( empty( $category ) ? '' : $export_type ), 'category' ); ?> />
35
+ <label for="category"><?php _e( 'Categories', 'woocommerce-exporter' ); ?></label>
36
  </th>
37
  <td>
38
+ <span class="description">(<?php echo $category; ?>)</span>
39
  </td>
40
  </tr>
41
 
42
  <tr>
43
  <th>
44
+ <input type="radio" id="tag" name="dataset" value="tag"<?php disabled( $tag, 0 ); ?><?php checked( ( empty( $tag ) ? '' : $export_type ), 'tag' ); ?> />
45
+ <label for="tag"><?php _e( 'Tags', 'woocommerce-exporter' ); ?></label>
46
  </th>
47
  <td>
48
+ <span class="description">(<?php echo $tag; ?>)</span>
49
  </td>
50
  </tr>
51
 
52
  <tr>
53
  <th>
54
+ <input type="radio" id="brand" name="dataset" value="brand"<?php disabled( $brand, 0 ); ?><?php checked( ( empty( $brand ) ? '' : $export_type ), 'brand' ); ?> />
55
+ <label for="brand"><?php _e( 'Brands', 'woocommerce-exporter' ); ?></label>
56
  </th>
57
  <td>
58
+ <span class="description">(<?php echo $brand; ?>)</span>
59
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
60
  </td>
61
  </tr>
62
 
63
  <tr>
64
  <th>
65
+ <input type="radio" id="order" name="dataset" value="order"<?php disabled( $order, 0 ); ?><?php checked( ( empty( $order ) ? '' : $export_type ), 'order' ); ?>/>
66
+ <label for="order"><?php _e( 'Orders', 'woocommerce-exporter' ); ?></label>
67
  </th>
68
  <td>
69
+ <span class="description">(<?php echo $order; ?>)</span>
70
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
71
  </td>
72
  </tr>
73
 
74
  <tr>
75
  <th>
76
+ <input type="radio" id="customer" name="dataset" value="customer"<?php disabled( $customer, 0 ); ?><?php checked( ( empty( $customer ) ? '' : $export_type ), 'customer' ); ?>/>
77
+ <label for="customer"><?php _e( 'Customers', 'woocommerce-exporter' ); ?></label>
78
  </th>
79
  <td>
80
+ <span class="description">(<?php echo $customer; ?>)</span>
81
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
82
  </td>
83
  </tr>
84
 
85
  <tr>
86
  <th>
87
+ <input type="radio" id="user" name="dataset" value="user"<?php disabled( $user, 0 ); ?><?php checked( ( empty( $user ) ? '' : $export_type ), 'user' ); ?>/>
88
+ <label for="user"><?php _e( 'Users', 'woocommerce-exporter' ); ?></label>
89
  </th>
90
  <td>
91
+ <span class="description">(<?php echo $user; ?>)</span>
92
  </td>
93
  </tr>
94
 
95
  <tr>
96
  <th>
97
+ <input type="radio" id="coupon" name="dataset" value="coupon"<?php disabled( $coupon, 0 ); ?><?php checked( ( empty( $coupon ) ? '' : $export_type ), 'coupon' ); ?> />
98
+ <label for="coupon"><?php _e( 'Coupons', 'woocommerce-exporter' ); ?></label>
99
  </th>
100
  <td>
101
+ <span class="description">(<?php echo $coupon; ?>)</span>
102
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
103
  </td>
104
  </tr>
105
 
106
  <tr>
107
  <th>
108
+ <input type="radio" id="subscription" name="dataset" value="subscription"<?php disabled( $subscription, 0 ); ?><?php checked( ( empty( $subscription ) ? '' : $export_type ), 'subscription' ); ?> />
109
+ <label for="subscription"><?php _e( 'Subscriptions', 'woocommerce-exporter' ); ?></label>
110
  </th>
111
  <td>
112
+ <span class="description">(<?php echo $subscription; ?>)</span>
113
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
114
  </td>
115
  </tr>
116
 
117
  <tr>
118
  <th>
119
+ <input type="radio" id="product_vendor" name="dataset" value="product_vendor"<?php disabled( $product_vendor, 0 ); ?><?php checked( ( empty( $product_vendor ) ? '' : $export_type ), 'product_vendor' ); ?> />
120
+ <label for="product_vendor"><?php _e( 'Product Vendors', 'woocommerce-exporter' ); ?></label>
121
  </th>
122
  <td>
123
+ <span class="description">(<?php echo $product_vendor; ?>)</span>
124
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
125
+ </td>
126
+ </tr>
127
+
128
+ <tr>
129
+ <th>
130
+ <input type="radio" id="commission" name="dataset" value="commission"<?php disabled( $commission, 0 ); ?><?php checked( ( empty( $commission ) ? '' : $export_type ), 'commission' ); ?> />
131
+ <label for="commission"><?php _e( 'Commissions', 'woocommerce-exporter' ); ?></label>
132
+ </th>
133
+ <td>
134
+ <span class="description">(<?php echo $commission; ?>)</span>
135
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
136
+ </td>
137
+ </tr>
138
+
139
+ <tr>
140
+ <th>
141
+ <input type="radio" id="shipping_class" name="dataset" value="shipping_class"<?php disabled( $shipping_class, 0 ); ?><?php checked( ( empty( $shipping_class ) ? '' : $export_type ), 'shipping_class' ); ?> />
142
+ <label for="shipping_class"><?php _e( 'Shipping Classes', 'woocommerce-exporter' ); ?></label>
143
+ </th>
144
+ <td>
145
+ <span class="description">(<?php echo $shipping_class; ?>)</span>
146
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
147
  </td>
148
  </tr>
149
 
150
  <!--
151
  <tr>
152
  <th>
153
+ <input type="radio" id="attribute" name="dataset" value="attribute"<?php disabled( $attribute, 0 ); ?><?php checked( ( empty( $attribute ) ? '' : $export_type ), 'attribute' ); ?> />
154
+ <label for="attribute"><?php _e( 'Attributes', 'woocommerce-exporter' ); ?></label>
155
  </th>
156
  <td>
157
+ <span class="description">(<?php echo $attribute; ?>)</span>
158
  </td>
159
  </tr>
160
  -->
166
  </div>
167
  <!-- .postbox -->
168
 
169
+ <div class="export-types">
170
+ <div class="postbox">
171
+ <h3 class="hndle"><?php _e( 'Loading...', 'woocommerce-exporter' ); ?></h3>
172
+ <div class="inside">
173
+ <p><strong><?php _e( 'The Export screen is loading elements in the background.', 'woocommerce-exporter' ); ?></strong></p>
174
+ <p><?php _e( 'If this notice does not dissapear once the browser has finished loading then something has gone wrong. This could be due to a <a href="http://www.visser.com.au/documentation/store-exporter-deluxe/usage/#The_Export_screen_loads_but_is_missing_fields_andor_elements_including_the_Export_button" target="_blank">JavaScript error</a> or <a href="http://www.visser.com.au/documentation/store-exporter-deluxe/usage/#Increasing_memory_allocated_to_PHP" target="_blank">memory/timeout limitation</a> whilst loading the Export screen, please open a <a href="http://www.visser.com.au/premium-support/" target="_blank">Support ticket</a> with us to look at this with you. :)', 'woocommerce-exporter' ); ?></p>
175
+ </div>
176
+ </div>
177
+ <!-- .postbox -->
178
+ </div>
179
+
180
  <?php if( $product_fields ) { ?>
181
  <div id="export-product" class="export-types">
182
 
183
  <div class="postbox">
184
  <h3 class="hndle">
185
+ <?php _e( 'Product Fields', 'woocommerce-exporter' ); ?>
186
+ <a href="<?php echo esc_url( add_query_arg( array( 'tab' => 'fields', 'type' => 'product' ) ) ); ?>" style="float:right;"><?php _e( 'Configure', 'woocommerce-exporter' ); ?></a>
187
  </h3>
188
  <div class="inside">
189
+ <?php if( $product ) { ?>
190
+ <p class="description"><?php _e( 'Select the Product fields you would like to export, you can also drag-and-drop to reorder export fields. To the right you can change the label of export fields from the Configure link. Your field selection - but not filters - are saved for future exports.', 'woocommerce-exporter' ); ?></p>
191
+ <p>
192
+ <a href="javascript:void(0)" id="product-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
193
+ <a href="javascript:void(0)" id="product-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
194
+ <a href="javascript:void(0)" id="product-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
195
+ </p>
196
  <table id="product-fields" class="ui-sortable">
197
 
198
  <?php foreach( $product_fields as $product_field ) { ?>
199
+ <tr id="product-<?php echo $product_field['reset']; ?>">
200
  <td>
201
+ <label<?php if( isset( $product_field['hover'] ) ) { ?> title="<?php echo $product_field['hover']; ?>"<?php } ?>>
202
  <input type="checkbox" name="product_fields[<?php echo $product_field['name']; ?>]" class="product_field"<?php ( isset( $product_field['default'] ) ? checked( $product_field['default'], 1 ) : '' ); ?><?php disabled( $product_field['disabled'], 1 ); ?> />
203
  <?php echo $product_field['label']; ?>
204
+ <?php if( $product_field['disabled'] ) { ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span><?php } ?>
205
  <input type="hidden" name="product_fields_order[<?php echo $product_field['name']; ?>]" class="field_order" value="<?php echo $product_field['order']; ?>" />
206
  </label>
207
  </td>
210
  <?php } ?>
211
  </table>
212
  <p class="submit">
213
+ <input type="submit" id="export_product" value="<?php _e( 'Export Products', 'woocommerce-exporter' ); ?> " class="button-primary" />
214
  </p>
215
+ <p class="description"><?php _e( 'Can\'t find a particular Product field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
216
  <?php } else { ?>
217
+ <p><?php _e( 'No Products were found.', 'woocommerce-exporter' ); ?></p>
218
  <?php } ?>
219
  </div>
220
  </div>
221
  <!-- .postbox -->
222
 
223
  <div id="export-products-filters" class="postbox">
224
+ <h3 class="hndle"><?php _e( 'Product Filters', 'woocommerce-exporter' ); ?></h3>
225
  <div class="inside">
226
 
227
  <?php do_action( 'woo_ce_export_product_options_before_table' ); ?>
247
 
248
  <div class="postbox">
249
  <h3 class="hndle">
250
+ <?php _e( 'Category Fields', 'woocommerce-exporter' ); ?>
251
+ <a href="<?php echo esc_url( add_query_arg( array( 'tab' => 'fields', 'type' => 'category' ) ) ); ?>" style="float:right;"><?php _e( 'Configure', 'woocommerce-exporter' ); ?></a>
252
  </h3>
253
  <div class="inside">
254
+ <p class="description"><?php _e( 'Select the Category fields you would like to export.', 'woocommerce-exporter' ); ?></p>
255
+ <p>
256
+ <a href="javascript:void(0)" id="category-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
257
+ <a href="javascript:void(0)" id="category-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
258
+ <a href="javascript:void(0)" id="category-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
259
+ </p>
260
  <table id="category-fields" class="ui-sortable">
261
 
262
  <?php foreach( $category_fields as $category_field ) { ?>
263
+ <tr id="category-<?php echo $category_field['reset']; ?>">
264
  <td>
265
+ <label<?php if( isset( $category_field['hover'] ) ) { ?> title="<?php echo $category_field['hover']; ?>"<?php } ?>>
266
  <input type="checkbox" name="category_fields[<?php echo $category_field['name']; ?>]" class="category_field"<?php ( isset( $category_field['default'] ) ? checked( $category_field['default'], 1 ) : '' ); ?><?php disabled( $category_field['disabled'], 1 ); ?> />
267
  <?php echo $category_field['label']; ?>
268
+ <input type="hidden" name="category_fields_order[<?php echo $category_field['name']; ?>]" class="field_order" value="<?php echo $category_field['order']; ?>" />
269
  </label>
270
  </td>
271
  </tr>
273
  <?php } ?>
274
  </table>
275
  <p class="submit">
276
+ <input type="submit" id="export_category" value="<?php _e( 'Export Categories', 'woocommerce-exporter' ); ?> " class="button-primary" />
277
  </p>
278
+ <p class="description"><?php _e( 'Can\'t find a particular Category field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
279
  </div>
280
  <!-- .inside -->
281
  </div>
282
  <!-- .postbox -->
283
 
284
  <div id="export-categories-filters" class="postbox">
285
+ <h3 class="hndle"><?php _e( 'Category Filters', 'woocommerce-exporter' ); ?></h3>
286
  <div class="inside">
287
 
288
  <?php do_action( 'woo_ce_export_category_options_before_table' ); ?>
306
 
307
  <div class="postbox">
308
  <h3 class="hndle">
309
+ <?php _e( 'Tag Fields', 'woocommerce-exporter' ); ?>
310
+ <a href="<?php echo esc_url( add_query_arg( array( 'tab' => 'fields', 'type' => 'tag' ) ) ); ?>" style="float:right;"><?php _e( 'Configure', 'woocommerce-exporter' ); ?></a>
311
  </h3>
312
  <div class="inside">
313
+ <p class="description"><?php _e( 'Select the Tag fields you would like to export.', 'woocommerce-exporter' ); ?></p>
314
+ <p>
315
+ <a href="javascript:void(0)" id="tag-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
316
+ <a href="javascript:void(0)" id="tag-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
317
+ <a href="javascript:void(0)" id="tag-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
318
+ </p>
319
  <table id="tag-fields" class="ui-sortable">
320
 
321
  <?php foreach( $tag_fields as $tag_field ) { ?>
322
+ <tr id="tag-<?php echo $tag_field['reset']; ?>">
323
  <td>
324
+ <label<?php if( isset( $tag_field['hover'] ) ) { ?> title="<?php echo $tag_field['hover']; ?>"<?php } ?>>
325
  <input type="checkbox" name="tag_fields[<?php echo $tag_field['name']; ?>]" class="tag_field"<?php ( isset( $tag_field['default'] ) ? checked( $tag_field['default'], 1 ) : '' ); ?><?php disabled( $tag_field['disabled'], 1 ); ?> />
326
  <?php echo $tag_field['label']; ?>
327
+ <input type="hidden" name="tag_fields_order[<?php echo $tag_field['name']; ?>]" class="field_order" value="<?php echo $tag_field['order']; ?>" />
328
  </label>
329
  </td>
330
  </tr>
332
  <?php } ?>
333
  </table>
334
  <p class="submit">
335
+ <input type="submit" id="export_tag" value="<?php _e( 'Export Tags', 'woocommerce-exporter' ); ?> " class="button-primary" />
336
  </p>
337
+ <p class="description"><?php _e( 'Can\'t find a particular Tag field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
338
  </div>
339
  <!-- .inside -->
340
  </div>
341
  <!-- .postbox -->
342
 
343
  <div id="export-tags-filters" class="postbox">
344
+ <h3 class="hndle"><?php _e( 'Product Tag Filters', 'woocommerce-exporter' ); ?></h3>
345
  <div class="inside">
346
 
347
  <?php do_action( 'woo_ce_export_tag_options_before_table' ); ?>
366
 
367
  <div class="postbox">
368
  <h3 class="hndle">
369
+ <?php _e( 'Brand Fields', 'woocommerce-exporter' ); ?>
370
  </h3>
371
  <div class="inside">
372
+ <?php if( $brand ) { ?>
373
+ <p class="description"><?php _e( 'Select the Brand fields you would like to export.', 'woocommerce-exporter' ); ?></p>
374
+ <p>
375
+ <a href="javascript:void(0)" id="brand-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
376
+ <a href="javascript:void(0)" id="brand-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
377
+ <a href="javascript:void(0)" id="brand-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
378
+ </p>
379
  <table id="brand-fields" class="ui-sortable">
380
 
381
  <?php foreach( $brand_fields as $brand_field ) { ?>
382
+ <tr id="brand-<?php echo $brand_field['reset']; ?>">
383
  <td>
384
+ <label<?php if( isset( $brand_field['hover'] ) ) { ?> title="<?php echo $brand_field['hover']; ?>"<?php } ?>>
385
  <input type="checkbox" name="brand_fields[<?php echo $brand_field['name']; ?>]" class="brand_field"<?php ( isset( $brand_field['default'] ) ? checked( $brand_field['default'], 1 ) : '' ); ?> disabled="disabled" />
386
  <?php echo $brand_field['label']; ?>
387
+ <input type="hidden" name="brand_fields_order[<?php echo $brand_field['name']; ?>]" class="field_order" value="<?php echo $brand_field['order']; ?>" />
388
  </label>
389
  </td>
390
  </tr>
392
  <?php } ?>
393
  </table>
394
  <p class="submit">
395
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Brands', 'woocommerce-exporter' ); ?>" />
396
  </p>
397
+ <p class="description"><?php _e( 'Can\'t find a particular Brand field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
398
  <?php } else { ?>
399
+ <p><?php _e( 'No Brands were found.', 'woocommerce-exporter' ); ?></p>
400
  <?php } ?>
401
  </div>
402
  <!-- .inside -->
404
  <!-- .postbox -->
405
 
406
  <div id="export-brands-filters" class="postbox">
407
+ <h3 class="hndle"><?php _e( 'Brand Filters', 'woocommerce-exporter' ); ?></h3>
408
  <div class="inside">
409
 
410
  <?php do_action( 'woo_ce_export_brand_options_before_table' ); ?>
429
 
430
  <div class="postbox">
431
  <h3 class="hndle">
432
+ <?php _e( 'Order Fields', 'woocommerce-exporter' ); ?>
433
  </h3>
434
  <div class="inside">
435
 
436
+ <?php if( $order ) { ?>
437
+ <p class="description"><?php _e( 'Select the Order fields you would like to export.', 'woocommerce-exporter' ); ?></p>
438
+ <p>
439
+ <a href="javascript:void(0)" id="order-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
440
+ <a href="javascript:void(0)" id="order-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
441
+ <a href="javascript:void(0)" id="order-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
442
+ </p>
443
  <table id="order-fields" class="ui-sortable">
444
 
445
  <?php foreach( $order_fields as $order_field ) { ?>
446
+ <tr id="order-<?php echo $order_field['reset']; ?>">
447
  <td>
448
+ <label<?php if( isset( $order_field['hover'] ) ) { ?> title="<?php echo $order_field['hover']; ?>"<?php } ?>>
449
  <input type="checkbox" name="order_fields[<?php echo $order_field['name']; ?>]" class="order_field"<?php ( isset( $order_field['default'] ) ? checked( $order_field['default'], 1 ) : '' ); ?> disabled="disabled" />
450
  <?php echo $order_field['label']; ?>
451
+ <input type="hidden" name="order_fields_order[<?php echo $order_field['name']; ?>]" class="field_order" value="<?php echo $order_field['order']; ?>" />
452
  </label>
453
  </td>
454
  </tr>
456
  <?php } ?>
457
  </table>
458
  <p class="submit">
459
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Orders', 'woocommerce-exporter' ); ?>" />
460
  </p>
461
+ <p class="description"><?php _e( 'Can\'t find a particular Order field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
462
  <?php } else { ?>
463
+ <p><?php _e( 'No Orders were found.', 'woocommerce-exporter' ); ?></p>
464
  <?php } ?>
465
 
466
  </div>
468
  <!-- .postbox -->
469
 
470
  <div id="export-orders-filters" class="postbox">
471
+ <h3 class="hndle"><?php _e( 'Order Filters', 'woocommerce-exporter' ); ?></h3>
472
  <div class="inside">
473
 
474
  <?php do_action( 'woo_ce_export_order_options_before_table' ); ?>
493
 
494
  <div class="postbox">
495
  <h3 class="hndle">
496
+ <?php _e( 'Customer Fields', 'woocommerce-exporter' ); ?>
497
  </h3>
498
  <div class="inside">
499
+ <?php if( $customer ) { ?>
500
+ <p class="description"><?php _e( 'Select the Customer fields you would like to export.', 'woocommerce-exporter' ); ?></p>
501
+ <p>
502
+ <a href="javascript:void(0)" id="customer-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
503
+ <a href="javascript:void(0)" id="customer-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
504
+ <a href="javascript:void(0)" id="customer-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
505
+ </p>
506
  <table id="customer-fields" class="ui-sortable">
507
 
508
  <?php foreach( $customer_fields as $customer_field ) { ?>
509
+ <tr id="customer-<?php echo $customer_field['reset']; ?>">
510
  <td>
511
+ <label<?php if( isset( $customer_field['hover'] ) ) { ?> title="<?php echo $customer_field['hover']; ?>"<?php } ?>>
512
  <input type="checkbox" name="customer_fields[<?php echo $customer_field['name']; ?>]" class="customer_field"<?php ( isset( $customer_field['default'] ) ? checked( $customer_field['default'], 1 ) : '' ); ?> disabled="disabled" />
513
  <?php echo $customer_field['label']; ?>
514
+ <input type="hidden" name="customer_fields_order[<?php echo $customer_field['name']; ?>]" class="field_order" value="<?php echo $customer_field['order']; ?>" />
515
  </label>
516
  </td>
517
  </tr>
519
  <?php } ?>
520
  </table>
521
  <p class="submit">
522
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Customers', 'woocommerce-exporter' ); ?>" />
523
  </p>
524
+ <p class="description"><?php _e( 'Can\'t find a particular Customer field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
525
  <?php } else { ?>
526
+ <p><?php _e( 'No Customers were found.', 'woocommerce-exporter' ); ?></p>
527
  <?php } ?>
528
  </div>
529
  <!-- .inside -->
531
  <!-- .postbox -->
532
 
533
  <div id="export-customers-filters" class="postbox">
534
+ <h3 class="hndle"><?php _e( 'Customer Filters', 'woocommerce-exporter' ); ?></h3>
535
  <div class="inside">
536
 
537
  <?php do_action( 'woo_ce_export_customer_options_before_table' ); ?>
556
 
557
  <div class="postbox">
558
  <h3 class="hndle">
559
+ <?php _e( 'User Fields', 'woocommerce-exporter' ); ?>
560
+ <a href="<?php echo esc_url( add_query_arg( array( 'tab' => 'fields', 'type' => 'user' ) ) ); ?>" style="float:right;"><?php _e( 'Configure', 'woocommerce-exporter' ); ?></a>
561
  </h3>
562
  <div class="inside">
563
+ <?php if( $user ) { ?>
564
+ <p class="description"><?php _e( 'Select the User fields you would like to export.', 'woocommerce-exporter' ); ?></p>
565
+ <p>
566
+ <a href="javascript:void(0)" id="user-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
567
+ <a href="javascript:void(0)" id="user-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
568
+ <a href="javascript:void(0)" id="user-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
569
+ </p>
570
  <table id="user-fields" class="ui-sortable">
571
 
572
  <?php foreach( $user_fields as $user_field ) { ?>
573
+ <tr id="user-<?php echo $user_field['reset']; ?>">
574
  <td>
575
+ <label<?php if( isset( $user_field['hover'] ) ) { ?> title="<?php echo $user_field['hover']; ?>"<?php } ?>>
576
  <input type="checkbox" name="user_fields[<?php echo $user_field['name']; ?>]" class="user_field"<?php ( isset( $user_field['default'] ) ? checked( $user_field['default'], 1 ) : '' ); ?><?php disabled( $user_field['disabled'], 1 ); ?> />
577
  <?php echo $user_field['label']; ?>
578
+ <?php if( $user_field['disabled'] ) { ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span><?php } ?>
579
+ <input type="hidden" name="user_fields_order[<?php echo $user_field['name']; ?>]" class="field_order" value="<?php echo $user_field['order']; ?>" />
580
  </label>
581
  </td>
582
  </tr>
584
  <?php } ?>
585
  </table>
586
  <p class="submit">
587
+ <input type="submit" id="export_user" class="button-primary" value="<?php _e( 'Export Users', 'woocommerce-exporter' ); ?>" />
588
  </p>
589
+ <p class="description"><?php _e( 'Can\'t find a particular User field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
590
  <?php } else { ?>
591
+ <p><?php _e( 'No Users were found.', 'woocommerce-exporter' ); ?></p>
592
  <?php } ?>
593
  </div>
594
  <!-- .inside -->
596
  <!-- .postbox -->
597
 
598
  <div id="export-users-filters" class="postbox">
599
+ <h3 class="hndle"><?php _e( 'User Filters', 'woocommerce-exporter' ); ?></h3>
600
  <div class="inside">
601
 
602
  <?php do_action( 'woo_ce_export_user_options_before_table' ); ?>
621
 
622
  <div class="postbox">
623
  <h3 class="hndle">
624
+ <?php _e( 'Coupon Fields', 'woocommerce-exporter' ); ?>
625
  </h3>
626
  <div class="inside">
627
+ <?php if( $coupon ) { ?>
628
+ <p class="description"><?php _e( 'Select the Coupon fields you would like to export.', 'woocommerce-exporter' ); ?></p>
629
+ <p>
630
+ <a href="javascript:void(0)" id="coupon-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
631
+ <a href="javascript:void(0)" id="coupon-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
632
+ <a href="javascript:void(0)" id="coupon-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
633
+ </p>
634
  <table id="coupon-fields" class="ui-sortable">
635
 
636
  <?php foreach( $coupon_fields as $coupon_field ) { ?>
637
+ <tr id="coupon-<?php echo $coupon_field['reset']; ?>">
638
  <td>
639
+ <label<?php if( isset( $coupon_field['hover'] ) ) { ?> title="<?php echo $coupon_field['hover']; ?>"<?php } ?>>
640
  <input type="checkbox" name="coupon_fields[<?php echo $coupon_field['name']; ?>]" class="coupon_field"<?php ( isset( $coupon_field['default'] ) ? checked( $coupon_field['default'], 1 ) : '' ); ?> disabled="disabled" />
641
  <?php echo $coupon_field['label']; ?>
642
+ <input type="hidden" name="coupon_fields_order[<?php echo $coupon_field['name']; ?>]" class="field_order" value="<?php echo $coupon_field['order']; ?>" />
643
  </label>
644
  </td>
645
  </tr>
647
  <?php } ?>
648
  </table>
649
  <p class="submit">
650
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Coupons', 'woocommerce-exporter' ); ?>" />
651
  </p>
652
+ <p class="description"><?php _e( 'Can\'t find a particular Coupon field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
653
  <?php } else { ?>
654
+ <p><?php _e( 'No Coupons were found.', 'woocommerce-exporter' ); ?></p>
655
  <?php } ?>
656
  </div>
657
  <!-- .inside -->
659
  <!-- .postbox -->
660
 
661
  <div id="export-coupons-filters" class="postbox">
662
+ <h3 class="hndle"><?php _e( 'Coupon Filters', 'woocommerce-exporter' ); ?></h3>
663
  <div class="inside">
664
 
665
  <?php do_action( 'woo_ce_export_coupon_options_before_table' ); ?>
684
 
685
  <div class="postbox">
686
  <h3 class="hndle">
687
+ <?php _e( 'Subscription Fields', 'woocommerce-exporter' ); ?>
688
  </h3>
689
  <div class="inside">
690
+ <?php if( $subscription ) { ?>
691
+ <p class="description"><?php _e( 'Select the Subscription fields you would like to export.', 'woocommerce-exporter' ); ?></p>
692
+ <p>
693
+ <a href="javascript:void(0)" id="subscription-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
694
+ <a href="javascript:void(0)" id="subscription-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
695
+ <a href="javascript:void(0)" id="subscription-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
696
+ </p>
697
  <table id="subscription-fields" class="ui-sortable">
698
 
699
  <?php foreach( $subscription_fields as $subscription_field ) { ?>
700
+ <tr id="subscription-<?php echo $subscription_field['reset']; ?>">
701
  <td>
702
+ <label<?php if( isset( $subscription_field['hover'] ) ) { ?> title="<?php echo $subscription_field['hover']; ?>"<?php } ?>>
703
  <input type="checkbox" name="subscription_fields[<?php echo $subscription_field['name']; ?>]" class="subscription_field"<?php ( isset( $subscription_field['default'] ) ? checked( $subscription_field['default'], 1 ) : '' ); ?> disabled="disabled" />
704
  <?php echo $subscription_field['label']; ?>
705
+ <input type="hidden" name="subscription_fields_order[<?php echo $subscription_field['name']; ?>]" class="field_order" value="<?php echo $subscription_field['order']; ?>" />
706
  </label>
707
  </td>
708
  </tr>
710
  <?php } ?>
711
  </table>
712
  <p class="submit">
713
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Subscriptions', 'woocommerce-exporter' ); ?>" />
714
  </p>
715
+ <p class="description"><?php _e( 'Can\'t find a particular Subscription field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
716
  <?php } else { ?>
717
+ <p><?php _e( 'No Subscriptions were found.', 'woocommerce-exporter' ); ?></p>
718
  <?php } ?>
719
  </div>
720
  <!-- .inside -->
721
  </div>
722
  <!-- .postbox -->
723
+
724
+ <div id="export-subscriptions-filters" class="postbox">
725
+ <h3 class="hndle"><?php _e( 'Subscription Filters', 'woocommerce-exporter' ); ?></h3>
726
+ <div class="inside">
727
+
728
+ <?php do_action( 'woo_ce_export_subscription_options_before_table' ); ?>
729
+
730
+ <table class="form-table">
731
+ <?php do_action( 'woo_ce_export_subscription_options_table' ); ?>
732
+ </table>
733
+
734
+ <?php do_action( 'woo_ce_export_subscription_options_after_table' ); ?>
735
+
736
+ </div>
737
+ <!-- .inside -->
738
+ </div>
739
+ <!-- .postbox -->
740
+
741
  </div>
742
  <!-- #export-subscription -->
743
 
747
 
748
  <div class="postbox">
749
  <h3 class="hndle">
750
+ <?php _e( 'Product Vendor Fields', 'woocommerce-exporter' ); ?>
751
  </h3>
752
  <div class="inside">
753
+ <?php if( $product_vendor ) { ?>
754
+ <p class="description"><?php _e( 'Select the Product Vendor fields you would like to export.', 'woocommerce-exporter' ); ?></p>
755
+ <p>
756
+ <a href="javascript:void(0)" id="product_vendor-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
757
+ <a href="javascript:void(0)" id="product_vendor-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
758
+ <a href="javascript:void(0)" id="product_vendor-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
759
+ </p>
760
  <table id="product_vendor-fields" class="ui-sortable">
761
 
762
  <?php foreach( $product_vendor_fields as $product_vendor_field ) { ?>
763
+ <tr id="product_vendor-<?php echo $product_vendor_field['reset']; ?>">
764
  <td>
765
+ <label<?php if( isset( $product_vendor_field['hover'] ) ) { ?> title="<?php echo $product_vendor_field['hover']; ?>"<?php } ?>>
766
  <input type="checkbox" name="product_vendor_fields[<?php echo $product_vendor_field['name']; ?>]" class="product_vendor_field"<?php ( isset( $product_vendor_field['default'] ) ? checked( $product_vendor_field['default'], 1 ) : '' ); ?> disabled="disabled" />
767
  <?php echo $product_vendor_field['label']; ?>
768
+ <input type="hidden" name="product_vendor_fields_order[<?php echo $product_vendor_field['name']; ?>]" class="field_order" value="<?php echo $product_vendor_field['order']; ?>" />
769
  </label>
770
  </td>
771
  </tr>
773
  <?php } ?>
774
  </table>
775
  <p class="submit">
776
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Product Vendors', 'woocommerce-exporter' ); ?>" />
777
  </p>
778
+ <p class="description"><?php _e( 'Can\'t find a particular Product Vendor field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
779
  <?php } else { ?>
780
+ <p><?php _e( 'No Product Vendors were found.', 'woocommerce-exporter' ); ?></p>
781
  <?php } ?>
782
  </div>
783
  <!-- .inside -->
784
  </div>
785
  <!-- .postbox -->
786
+
787
  </div>
788
  <!-- #export-product_vendor -->
789
 
790
+ <?php } ?>
791
+ <?php if( $commission_fields ) { ?>
792
+ <div id="export-commission" class="export-types">
793
+
794
+ <div class="postbox">
795
+ <h3 class="hndle">
796
+ <?php _e( 'Commission Fields', 'woocommerce-exporter' ); ?>
797
+ </h3>
798
+ <div class="inside">
799
+ <?php if( $commission ) { ?>
800
+ <p class="description"><?php _e( 'Select the Commission fields you would like to export.', 'woocommerce-exporter' ); ?></p>
801
+ <p>
802
+ <a href="javascript:void(0)" id="commission-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
803
+ <a href="javascript:void(0)" id="commission-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
804
+ <a href="javascript:void(0)" id="commission-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
805
+ </p>
806
+ <table id="commission-fields" class="ui-sortable">
807
+
808
+ <?php foreach( $commission_fields as $commission_field ) { ?>
809
+ <tr id="commission-<?php echo $commission_field['reset']; ?>">
810
+ <td>
811
+ <label<?php if( isset( $commission_field['hover'] ) ) { ?> title="<?php echo $commission_field['hover']; ?>"<?php } ?>>
812
+ <input type="checkbox" name="commission_fields[<?php echo $commission_field['name']; ?>]" class="commission_field"<?php ( isset( $commission_field['default'] ) ? checked( $commission_field['default'], 1 ) : '' ); ?> disabled="disabled" />
813
+ <?php echo $commission_field['label']; ?>
814
+ <input type="hidden" name="commission_fields_order[<?php echo $commission_field['name']; ?>]" class="field_order" value="<?php echo $commission_field['order']; ?>" />
815
+ </label>
816
+ </td>
817
+ </tr>
818
+
819
+ <?php } ?>
820
+ </table>
821
+ <p class="submit">
822
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Commissions', 'woocommerce-exporter' ); ?>" />
823
+ </p>
824
+ <p class="description"><?php _e( 'Can\'t find a particular Commission field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
825
+ <?php } else { ?>
826
+ <p><?php _e( 'No Commissions were found.', 'woocommerce-exporter' ); ?></p>
827
+ <?php } ?>
828
+ </div>
829
+ <!-- .inside -->
830
+ </div>
831
+ <!-- .postbox -->
832
+
833
+ <div id="export-commissions-filters" class="postbox">
834
+ <h3 class="hndle"><?php _e( 'Commission Filters', 'woocommerce-exporter' ); ?></h3>
835
+ <div class="inside">
836
+
837
+ <?php do_action( 'woo_ce_export_commission_options_before_table' ); ?>
838
+
839
+ <table class="form-table">
840
+ <?php do_action( 'woo_ce_export_commission_options_table' ); ?>
841
+ </table>
842
+
843
+ <?php do_action( 'woo_ce_export_commission_options_after_table' ); ?>
844
+
845
+ </div>
846
+ <!-- .inside -->
847
+ </div>
848
+ <!-- .postbox -->
849
+
850
+ </div>
851
+ <!-- #export-commission -->
852
+
853
+ <?php } ?>
854
+ <?php if( $shipping_class_fields ) { ?>
855
+ <div id="export-shipping_class" class="export-types">
856
+
857
+ <div class="postbox">
858
+ <h3 class="hndle">
859
+ <?php _e( 'Shipping Class Fields', 'woocommerce-exporter' ); ?>
860
+ </h3>
861
+ <div class="inside">
862
+ <?php if( $shipping_class ) { ?>
863
+ <p class="description"><?php _e( 'Select the Shipping Class fields you would like to export.', 'woocommerce-exporter' ); ?></p>
864
+ <p>
865
+ <a href="javascript:void(0)" id="shipping_class-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
866
+ <a href="javascript:void(0)" id="shipping_class-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
867
+ <a href="javascript:void(0)" id="shipping_class-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
868
+ </p>
869
+ <table id="shipping_class-fields" class="ui-sortable">
870
+
871
+ <?php foreach( $shipping_class_fields as $shipping_class_field ) { ?>
872
+ <tr id="shipping_class-<?php echo $shipping_class_field['reset']; ?>">
873
+ <td>
874
+ <label<?php if( isset( $shipping_class_field['hover'] ) ) { ?> title="<?php echo $shipping_class_field['hover']; ?>"<?php } ?>>
875
+ <input type="checkbox" name="shipping_class_fields[<?php echo $shipping_class_field['name']; ?>]" class="shipping_class_field"<?php ( isset( $shipping_class_field['default'] ) ? checked( $shipping_class_field['default'], 1 ) : '' ); ?> disabled="disabled" />
876
+ <?php echo $shipping_class_field['label']; ?>
877
+ <input type="hidden" name="shipping_class_fields_order[<?php echo $shipping_class_field['name']; ?>]" class="field_order" value="<?php echo $shipping_class_field['order']; ?>" />
878
+ </label>
879
+ </td>
880
+ </tr>
881
+
882
+ <?php } ?>
883
+ </table>
884
+ <p class="submit">
885
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Shipping Classes', 'woocommerce-exporter' ); ?>" />
886
+ </p>
887
+ <p class="description"><?php _e( 'Can\'t find a particular Shipping Class field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
888
+ <?php } else { ?>
889
+ <p><?php _e( 'No Shipping Classes were found.', 'woocommerce-exporter' ); ?></p>
890
+ <?php } ?>
891
+ </div>
892
+ <!-- .inside -->
893
+ </div>
894
+ <!-- .postbox -->
895
+
896
+ <div id="export-shipping-classes-filters" class="postbox">
897
+ <h3 class="hndle"><?php _e( 'Shipping Class Filters', 'woocommerce-exporter' ); ?></h3>
898
+ <div class="inside">
899
+
900
+ <?php do_action( 'woo_ce_export_shipping_class_options_before_table' ); ?>
901
+
902
+ <table class="form-table">
903
+ <?php do_action( 'woo_ce_export_shipping_class_options_table' ); ?>
904
+ </table>
905
+
906
+ <?php do_action( 'woo_ce_export_shipping_class_options_after_table' ); ?>
907
+
908
+ </div>
909
+ <!-- .inside -->
910
+ </div>
911
+ <!-- .postbox -->
912
+
913
+ </div>
914
+ <!-- #export-shipping_class -->
915
+
916
  <?php } ?>
917
  <?php do_action( 'woo_ce_before_options' ); ?>
918
 
919
  <div class="postbox" id="export-options">
920
+ <h3 class="hndle"><?php _e( 'Export Options', 'woocommerce-exporter' ); ?></h3>
921
  <div class="inside">
922
+ <p class="description"><?php _e( 'You can find additional export options under the Settings tab at the top of this screen.', 'woocommerce-exporter' ); ?></p>
923
 
924
  <?php do_action( 'woo_ce_export_options_before' ); ?>
925
 
929
 
930
  <tr>
931
  <th>
932
+ <label for="offset"><?php _e( 'Volume offset', 'woocommerce-exporter' ); ?></label> / <label for="limit_volume"><?php _e( 'Limit volume', 'woocommerce-exporter' ); ?></label>
933
  </th>
934
  <td>
935
+ <input type="text" size="3" id="offset" name="offset" value="<?php echo esc_attr( $offset ); ?>" size="5" class="text" title="<?php _e( 'Volume Offset', 'woocommerce-exporter' ); ?>" /> <?php _e( 'to', 'woocommerce-exporter' ); ?> <input type="text" size="3" id="limit_volume" name="limit_volume" value="<?php echo esc_attr( $limit_volume ); ?>" size="5" class="text" title="<?php _e( 'Limit Volume', 'woocommerce-exporter' ); ?>" />
936
+ <p class="description">
937
+ <?php _e( 'Volume offset and limit allows for partial exporting of an export type (e.g. records 0 to 500, etc.) by entering 0 and 500, incrementing the Limit Volume field to 500 will export the next 500 records.', 'woocommerce-exporter' ); ?><br />
938
+ <?php _e( 'This is useful when encountering timeout and/or memory errors during the a large or memory intensive export. By default this is not used and is left empty.', 'woocommerce-exporter' ); ?>
939
+ </p>
940
  </td>
941
  </tr>
942
 
943
  <?php do_action( 'woo_ce_export_options_table_after' ); ?>
944
 
945
  </table>
946
+ <p><?php _e( 'Click the Export button above to apply these changes and generate your export file.', 'woocommerce-exporter' ); ?></p>
947
 
948
  <?php do_action( 'woo_ce_export_options_after' ); ?>
949
 
954
  <?php do_action( 'woo_ce_after_options' ); ?>
955
 
956
  <input type="hidden" name="action" value="export" />
957
+ <?php wp_nonce_field( 'manual_export', 'woo_ce_export' ); ?>
958
+
959
  </form>
960
 
961
  <?php do_action( 'woo_ce_export_after_form' ); ?>
962
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
963
  </div>
964
  <!-- #poststuff -->
templates/admin/tabs-fields.php CHANGED
@@ -1,5 +1,5 @@
1
- <h3><?php _e( 'Field Editor', 'woo_ce' ); ?></h3>
2
- <p><?php _e( 'Customise the field labels for this export type by filling in the fields, an empty field label will revert to the default Store Exporter field label at export time.', 'woo_ce' ); ?></p>
3
  <?php if( $fields ) { ?>
4
  <form method="post" id="postform">
5
  <table class="form-table">
@@ -9,7 +9,7 @@
9
  <tr>
10
  <th scope="row"><label for="<?php echo $field['name']; ?>"><?php echo $field['name']; ?></label></th>
11
  <td>
12
- <input type="text" name="fields[<?php echo $field['name']; ?>]" placeholder="<?php echo $field['label']; ?>" value="<?php if( isset( $labels[$field['name']] ) ) { echo $labels[$field['name']]; } ?>" class="regular-text all-options" />
13
  </td>
14
  </tr>
15
  <?php } ?>
@@ -19,9 +19,10 @@
19
  <!-- .form-table -->
20
 
21
  <p class="submit">
22
- <input type="submit" value="<?php _e( 'Save Changes', 'woo_ce' ); ?> " class="button-primary" />
23
  </p>
24
  <input type="hidden" name="action" value="save-fields" />
 
25
  <input type="hidden" name="type" value="<?php echo esc_attr( $export_type ); ?>" />
26
 
27
  </form>
1
+ <h3><?php _e( 'Field Editor', 'woocommerce-exporter' ); ?></h3>
2
+ <p><?php _e( 'Customise the field labels for this export type by filling in the fields, an empty field label will revert to the default Store Exporter field label at export time.', 'woocommerce-exporter' ); ?></p>
3
  <?php if( $fields ) { ?>
4
  <form method="post" id="postform">
5
  <table class="form-table">
9
  <tr>
10
  <th scope="row"><label for="<?php echo $field['name']; ?>"><?php echo $field['name']; ?></label></th>
11
  <td>
12
+ <input type="text" name="fields[<?php echo $field['name']; ?>]" title="<?php echo $field['name']; ?>" placeholder="<?php echo $field['label']; ?>" value="<?php if( isset( $labels[$field['name']] ) ) { echo $labels[$field['name']]; } ?>" class="regular-text all-options" />
13
  </td>
14
  </tr>
15
  <?php } ?>
19
  <!-- .form-table -->
20
 
21
  <p class="submit">
22
+ <input type="submit" value="<?php _e( 'Save Changes', 'woocommerce-exporter' ); ?> " class="button-primary" />
23
  </p>
24
  <input type="hidden" name="action" value="save-fields" />
25
+ <?php wp_nonce_field( 'save_fields', 'woo_ce_save_fields' ); ?>
26
  <input type="hidden" name="type" value="<?php echo esc_attr( $export_type ); ?>" />
27
 
28
  </form>
templates/admin/tabs-overview.php CHANGED
@@ -1,98 +1,148 @@
1
  <div class="overview-left">
2
 
3
- <h3><div class="dashicons dashicons-migrate"></div>&nbsp;<a href="<?php echo add_query_arg( 'tab', 'export' ); ?>"><?php _e( 'Export', 'woo_ce' ); ?></a></h3>
4
- <p><?php _e( 'Export store details out of WooCommerce into a CSV-formatted file.', 'woo_ce' ); ?></p>
5
  <ul class="ul-disc">
6
  <li>
7
- <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-product"><?php _e( 'Export Products', 'woo_ce' ); ?></a>
8
  </li>
9
  <li>
10
- <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-category"><?php _e( 'Export Categories', 'woo_ce' ); ?></a>
11
  </li>
12
  <li>
13
- <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-tag"><?php _e( 'Export Tags', 'woo_ce' ); ?></a>
14
  </li>
15
  <li>
16
- <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-brand"><?php _e( 'Export Brands', 'woo_ce' ); ?></a>
17
- <span class="description">(<?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?>)</span>
18
  </li>
19
  <li>
20
- <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-order"><?php _e( 'Export Orders', 'woo_ce' ); ?></a>
21
- <span class="description">(<?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?>)</span>
22
  </li>
23
  <li>
24
- <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-customer"><?php _e( 'Export Customers', 'woo_ce' ); ?></a>
25
- <span class="description">(<?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?>)</span>
26
  </li>
27
  <li>
28
- <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-user"><?php _e( 'Export Users', 'woo_ce' ); ?></a>
29
  </li>
30
  <li>
31
- <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-coupon"><?php _e( 'Export Coupons', 'woo_ce' ); ?></a>
32
- <span class="description">(<?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?>)</span>
33
  </li>
34
  <li>
35
- <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-subscription"><?php _e( 'Export Subscriptions', 'woo_ce' ); ?></a>
36
- <span class="description">(<?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?>)</span>
37
  </li>
38
  <li>
39
- <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-product_vendor"><?php _e( 'Export Product Vendors', 'woo_ce' ); ?></a>
40
- <span class="description">(<?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?>)</span>
41
  </li>
42
- <!--
43
  <li>
44
- <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-attribute"><?php _e( 'Export Attributes', 'woo_ce' ); ?></a>
45
- <span class="description">(<?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?>)</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  </li>
47
- -->
48
  </ul>
49
 
50
- <h3><div class="dashicons dashicons-list-view"></div>&nbsp;<a href="<?php echo add_query_arg( 'tab', 'archive' ); ?>"><?php _e( 'Archives', 'woo_ce' ); ?></a></h3>
51
- <p><?php _e( 'Download copies of prior store exports.', 'woo_ce' ); ?></p>
52
 
53
- <h3><div class="dashicons dashicons-admin-settings"></div>&nbsp;<a href="<?php echo add_query_arg( 'tab', 'settings' ); ?>"><?php _e( 'Settings', 'woo_ce' ); ?></a></h3>
54
- <p><?php _e( 'Manage export options from a single detailed screen.', 'woo_ce' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
- <h3><div class="dashicons dashicons-hammer"></div>&nbsp;<a href="<?php echo add_query_arg( 'tab', 'tools' ); ?>"><?php _e( 'Tools', 'woo_ce' ); ?></a></h3>
57
- <p><?php _e( 'Export tools for WooCommerce.', 'woo_ce' ); ?></p>
58
 
59
  <hr />
60
  <label class="description">
61
- <input type="checkbox" disabled="disabled" /> <?php _e( 'Jump to Export screen in the future', 'woo_ce' ); ?>
62
- <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
63
  </label>
64
 
65
  </div>
66
  <!-- .overview-left -->
67
  <div class="welcome-panel overview-right">
68
  <h3>
69
- <!-- <span><a href="#"><attr title="<?php _e( 'Dismiss this message', 'woo_ce' ); ?>"><?php _e( 'Dismiss', 'woo_ce' ); ?></attr></a></span> -->
70
- <?php _e( 'Upgrade to Pro', 'woo_ce' ); ?>
71
  </h3>
72
- <p class="clear"><?php _e( 'Upgrade to Store Exporter Deluxe to unlock business focused e-commerce features within Store Exporter, including:', 'woo_ce' ); ?></p>
73
  <ul class="ul-disc">
74
- <li><?php _e( 'Select export date ranges', 'woo_ce' ); ?></li>
75
- <li><?php _e( 'Select export fields to export', 'woo_ce' ); ?></li>
76
- <li><?php _e( 'Filter exports by multiple filter options', 'woo_ce' ); ?></li>
77
- <li><?php _e( 'Export Orders', 'woo_ce' ); ?></li>
78
- <li><?php _e( 'Export custom Order and Order Item meta', 'woo_ce' ); ?></li>
79
- <li><?php _e( 'Export Customers', 'woo_ce' ); ?></li>
80
- <li><?php _e( 'Export Coupons', 'woo_ce' ); ?></li>
81
- <li><?php _e( 'Export Subscriptions', 'woo_ce' ); ?></li>
82
- <li><?php _e( 'Export Product Vendors', 'woo_ce' ); ?></li>
83
- <li><?php _e( 'CRON export engine', 'woo_ce' ); ?></li>
84
- <li><?php _e( 'Schedule automatic exports with filtering options', 'woo_ce' ); ?></li>
85
- <li><?php _e( 'Export to remote POST', 'woo_ce' ); ?></li>
86
- <li><?php _e( 'Export to e-mail addresses', 'woo_ce' ); ?></li>
87
- <li><?php _e( 'Export to remote FTP', 'woo_ce' ); ?></li>
88
- <li><?php _e( 'Export to XML file', 'woo_ce' ); ?></li>
89
- <li><?php _e( 'Export to Excel 2007 (XLS) file', 'woo_ce' ); ?></li>
90
- <li><?php _e( 'Premium Support', 'woo_ce' ); ?></li>
91
- <li><?php _e( '...and more.', 'woo_ce' ); ?></li>
 
 
 
 
 
 
 
 
92
  </ul>
93
  <p>
94
- <a href="<?php echo $woo_cd_url; ?>" target="_blank" class="button"><?php _e( 'More Features', 'woo_ce' ); ?></a>&nbsp;
95
- <a href="<?php echo $woo_cd_url; ?>" target="_blank" class="button button-primary"><?php _e( 'Buy Now', 'woo_ce' ); ?></a>
96
  </p>
97
  </div>
98
  <!-- .overview-right -->
1
  <div class="overview-left">
2
 
3
+ <h3><div class="dashicons dashicons-migrate"></div>&nbsp;<a href="<?php echo esc_url( add_query_arg( 'tab', 'export' ) ); ?>"><?php _e( 'Quick Export', 'woocommerce-exporter' ); ?></a></h3>
4
+ <p><?php _e( 'Export store details out of WooCommerce into common export files (e.g. CSV, XLSX, XML, etc.).', 'woocommerce-exporter' ); ?></p>
5
  <ul class="ul-disc">
6
  <li>
7
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'export' ) ); ?>#export-product"><?php _e( 'Export Products', 'woocommerce-exporter' ); ?></a>
8
  </li>
9
  <li>
10
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'export' ) ); ?>#export-category"><?php _e( 'Export Categories', 'woocommerce-exporter' ); ?></a>
11
  </li>
12
  <li>
13
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'export' ) ); ?>#export-tag"><?php _e( 'Export Tags', 'woocommerce-exporter' ); ?></a>
14
  </li>
15
  <li>
16
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'export' ) ); ?>#export-brand"><?php _e( 'Export Brands', 'woocommerce-exporter' ); ?></a>
17
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
18
  </li>
19
  <li>
20
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'export' ) ); ?>#export-order"><?php _e( 'Export Orders', 'woocommerce-exporter' ); ?></a>
21
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
22
  </li>
23
  <li>
24
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'export' ) ); ?>#export-customer"><?php _e( 'Export Customers', 'woocommerce-exporter' ); ?></a>
25
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
26
  </li>
27
  <li>
28
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'export' ) ); ?>#export-user"><?php _e( 'Export Users', 'woocommerce-exporter' ); ?></a>
29
  </li>
30
  <li>
31
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'export' ) ); ?>#export-user"><?php _e( 'Export Reviews', 'woocommerce-exporter' ); ?></a>
32
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
33
  </li>
34
  <li>
35
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'export' ) ); ?>#export-coupon"><?php _e( 'Export Coupons', 'woocommerce-exporter' ); ?></a>
36
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
37
  </li>
38
  <li>
39
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'export' ) ); ?>#export-subscription"><?php _e( 'Export Subscriptions', 'woocommerce-exporter' ); ?></a>
40
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
41
  </li>
 
42
  <li>
43
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'export' ) ); ?>#export-product_vendor"><?php _e( 'Export Product Vendors', 'woocommerce-exporter' ); ?></a>
44
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
45
+ </li>
46
+ <li>
47
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'export' ) ); ?>#export-commission"><?php _e( 'Export Commissions', 'woocommerce-exporter' ); ?></a>
48
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
49
+ </li>
50
+ <li>
51
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'export' ) ); ?>#export-shipping_class"><?php _e( 'Export Shipping Classes', 'woocommerce-exporter' ); ?></a>
52
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
53
+ </li>
54
+ <li>
55
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'export' ) ); ?>#export-ticket"><?php _e( 'Export Tickets', 'woocommerce-exporter' ); ?></a>
56
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
57
+ </li>
58
+ <li>
59
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'export' ) ); ?>#export-booking"><?php _e( 'Export Bookings', 'woocommerce-exporter' ); ?></a>
60
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
61
+ </li>
62
+ <li>
63
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'export' ) ); ?>#export-attribute"><?php _e( 'Export Attributes', 'woocommerce-exporter' ); ?></a>
64
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
65
  </li>
 
66
  </ul>
67
 
68
+ <h3><div class="dashicons dashicons-list-view"></div>&nbsp;<a href="<?php echo esc_url( add_query_arg( 'tab', 'archive' ) ); ?>"><?php _e( 'Archives', 'woocommerce-exporter' ); ?></a></h3>
69
+ <p><?php _e( 'Download copies of prior store exports.', 'woocommerce-exporter' ); ?></p>
70
 
71
+ <h3><div class="dashicons dashicons-admin-settings"></div>&nbsp;<a href="<?php echo esc_url( add_query_arg( 'tab', 'settings' ) ); ?>"><?php _e( 'Settings', 'woocommerce-exporter' ); ?></a></h3>
72
+ <p><?php _e( 'Manage export options from a single detailed screen.', 'woocommerce-exporter' ); ?></p>
73
+ <ul class="ul-disc">
74
+ <li>
75
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'settings' ) ); ?>#general-settings"><?php _e( 'General Settings', 'woocommerce-exporter' ); ?></a>
76
+ </li>
77
+ <li>
78
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'settings' ) ); ?>#csv-settings"><?php _e( 'CSV Settings', 'woocommerce-exporter' ); ?></a>
79
+ </li>
80
+ <li>
81
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'settings' ) ); ?>#xml-settings"><?php _e( 'XML Settings', 'woocommerce-exporter' ); ?></a>
82
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
83
+ </li>
84
+ <li>
85
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'settings' ) ); ?>#scheduled-exports"><?php _e( 'Scheduled Exports', 'woocommerce-exporter' ); ?></a>
86
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
87
+ </li>
88
+ <li>
89
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'settings' ) ); ?>#cron-exports"><?php _e( 'CRON Exports', 'woocommerce-exporter' ); ?></a>
90
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
91
+ </li>
92
+ <li>
93
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'settings' ) ); ?>#orders-screen"><?php _e( 'Orders Screen', 'woocommerce-exporter' ); ?></a>
94
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
95
+ </li>
96
+ </ul>
97
 
98
+ <h3><div class="dashicons dashicons-hammer"></div>&nbsp;<a href="<?php echo esc_url( add_query_arg( 'tab', 'tools' ) ); ?>"><?php _e( 'Tools', 'woocommerce-exporter' ); ?></a></h3>
99
+ <p><?php _e( 'Export tools for WooCommerce.', 'woocommerce-exporter' ); ?></p>
100
 
101
  <hr />
102
  <label class="description">
103
+ <input type="checkbox" disabled="disabled" /> <?php _e( 'Jump to Export screen in the future', 'woocommerce-exporter' ); ?>
104
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
105
  </label>
106
 
107
  </div>
108
  <!-- .overview-left -->
109
  <div class="welcome-panel overview-right">
110
  <h3>
111
+ <!-- <span><a href="#"><attr title="<?php _e( 'Dismiss this message', 'woocommerce-exporter' ); ?>"><?php _e( 'Dismiss', 'woocommerce-exporter' ); ?></attr></a></span> -->
112
+ <?php _e( 'Upgrade to Pro', 'woocommerce-exporter' ); ?>
113
  </h3>
114
+ <p class="clear"><?php _e( 'Upgrade to Store Exporter Deluxe to unlock business focused e-commerce features within Store Exporter, including:', 'woocommerce-exporter' ); ?></p>
115
  <ul class="ul-disc">
116
+ <li><?php _e( 'Select export date ranges', 'woocommerce-exporter' ); ?></li>
117
+ <li><?php _e( 'Select export fields to export', 'woocommerce-exporter' ); ?></li>
118
+ <li><?php _e( 'Filter exports by multiple filter options', 'woocommerce-exporter' ); ?></li>
119
+ <li><?php _e( 'Export Orders', 'woocommerce-exporter' ); ?></li>
120
+ <li><?php _e( 'Export custom Order and Order Item meta', 'woocommerce-exporter' ); ?></li>
121
+ <li><?php _e( 'Export Customers', 'woocommerce-exporter' ); ?></li>
122
+ <li><?php _e( 'Export custom Customer meta', 'woocommerce-exporter' ); ?></li>
123
+ <li><?php _e( 'Export Coupons', 'woocommerce-exporter' ); ?></li>
124
+ <li><?php _e( 'Export custom User meta', 'woocommerce-exporter' ); ?></li>
125
+ <li><?php _e( 'Export Subscriptions', 'woocommerce-exporter' ); ?></li>
126
+ <li><?php _e( 'Export Product Vendors', 'woocommerce-exporter' ); ?></li>
127
+ <li><?php _e( 'Export Shipping Classes', 'woocommerce-exporter' ); ?></li>
128
+ <li><?php _e( 'Export Bookings', 'woocommerce-exporter' ); ?></li>
129
+ <li><?php _e( 'Export Tickets', 'woocommerce-exporter' ); ?></li>
130
+ <li><?php _e( 'Export Attributes', 'woocommerce-exporter' ); ?></li>
131
+ <li><?php _e( 'CRON export engine', 'woocommerce-exporter' ); ?></li>
132
+ <li><?php _e( 'Schedule automatic exports with filtering options', 'woocommerce-exporter' ); ?></li>
133
+ <li><?php _e( 'Export to remote POST', 'woocommerce-exporter' ); ?></li>
134
+ <li><?php _e( 'Export to e-mail addresses', 'woocommerce-exporter' ); ?></li>
135
+ <li><?php _e( 'Export to remote FTP/FTPS/SFTP', 'woocommerce-exporter' ); ?></li>
136
+ <li><?php _e( 'Export to XML file', 'woocommerce-exporter' ); ?></li>
137
+ <li><?php _e( 'Export to RSS file', 'woocommerce-exporter' ); ?></li>
138
+ <li><?php _e( 'Export to Excel 97-2003 (XLS) file', 'woocommerce-exporter' ); ?></li>
139
+ <li><?php _e( 'Export to Excel 2007-2013 (XLSX) file', 'woocommerce-exporter' ); ?></li>
140
+ <li><?php _e( 'Premium Support', 'woocommerce-exporter' ); ?></li>
141
+ <li><?php _e( '...and more.', 'woocommerce-exporter' ); ?></li>
142
  </ul>
143
  <p>
144
+ <a href="<?php echo $woo_cd_url; ?>" target="_blank" class="button"><?php _e( 'More Features', 'woocommerce-exporter' ); ?></a>&nbsp;
145
+ <a href="<?php echo $woo_cd_url; ?>" target="_blank" class="button button-primary"><?php _e( 'Buy Now', 'woocommerce-exporter' ); ?></a>
146
  </p>
147
  </div>
148
  <!-- .overview-right -->
templates/admin/tabs-settings.php CHANGED
@@ -1,6 +1,6 @@
1
  <ul class="subsubsub">
2
- <li><a href="#general-settings"><?php _e( 'General Settings', 'woo_ce' ); ?></a> |</li>
3
- <li><a href="#csv-settings"><?php _e( 'CSV Settings', 'woo_ce' ); ?></a></li>
4
  <?php do_action( 'woo_ce_export_settings_top' ); ?>
5
  </ul>
6
  <!-- .subsubsub -->
@@ -14,77 +14,103 @@
14
 
15
  <tr id="general-settings">
16
  <td colspan="2" style="padding:0;">
17
- <h3><div class="dashicons dashicons-admin-settings"></div>&nbsp;<?php _e( 'General Settings', 'woo_ce' ); ?></h3>
18
- <p class="description"><?php _e( 'Manage export options across Store Exporter from this screen.', 'woo_ce' ); ?></p>
19
  </td>
20
  </tr>
21
 
22
  <tr valign="top">
23
- <th scope="row"><label for="export_filename"><?php _e( 'Export filename', 'woo_ce' ); ?></label></th>
24
  <td>
25
  <input type="text" name="export_filename" id="export_filename" value="<?php echo esc_attr( $export_filename ); ?>" class="large-text code" />
26
- <p class="description"><?php _e( 'The filename of the exported export type. Tags can be used: ', 'woo_ce' ); ?> <code>%dataset%</code>, <code>%date%</code>, <code>%time%</code>, <code>%store_name%</code>.</p>
27
  </td>
28
  </tr>
29
 
30
  <tr>
31
  <th>
32
- <label for="delete_file"><?php _e( 'Enable archives', 'woo_ce' ); ?></label>
33
  </th>
34
  <td>
35
  <select id="delete_file" name="delete_file">
36
- <option value="0"<?php selected( $delete_file, 0 ); ?>><?php _e( 'Yes', 'woo_ce' ); ?></option>
37
- <option value="1"<?php selected( $delete_file, 1 ); ?>><?php _e( 'No', 'woo_ce' ); ?></option>
38
  </select>
39
- <p class="description"><?php _e( 'Save copies of exports to the WordPress Media for later downloading. By default this option is turned on.', 'woo_ce' ); ?></p>
 
 
 
 
 
 
40
  </td>
41
  </tr>
42
  <tr>
43
  <th>
44
- <label for="encoding"><?php _e( 'Character encoding', 'woo_ce' ); ?></label>
45
  </th>
46
  <td>
47
  <?php if( $file_encodings ) { ?>
48
  <select id="encoding" name="encoding">
49
- <option value=""><?php _e( 'System default', 'woo_ce' ); ?></option>
50
  <?php foreach( $file_encodings as $key => $chr ) { ?>
51
  <option value="<?php echo $chr; ?>"<?php selected( $chr, $encoding ); ?>><?php echo $chr; ?></option>
52
  <?php } ?>
53
  </select>
54
  <?php } else { ?>
55
- <p class="description"><?php _e( 'Character encoding options are unavailable in PHP 4, contact your hosting provider to update your site install to use PHP 5 or higher.', 'woo_ce' ); ?></p>
 
 
 
 
56
  <?php } ?>
57
  </td>
58
  </tr>
59
  <tr>
60
- <th><?php _e( 'Date format', 'woo_ce' ); ?></th>
61
  <td>
62
- <fieldset>
63
- <label title="F j, Y"><input type="radio" name="date_format" value="F j, Y"<?php checked( $date_format, 'F j, Y' ); ?>> <span><?php echo date( 'F j, Y' ); ?></span></label><br>
64
- <label title="Y/m/d"><input type="radio" name="date_format" value="Y/m/d"<?php checked( $date_format, 'Y/m/d' ); ?>> <span><?php echo date( 'Y/m/d' ); ?></span></label><br>
65
- <label title="m/d/Y"><input type="radio" name="date_format" value="m/d/Y"<?php checked( $date_format, 'm/d/Y' ); ?>> <span><?php echo date( 'm/d/Y' ); ?></span></label><br>
66
- <label title="d/m/Y"><input type="radio" name="date_format" value="d/m/Y"<?php checked( $date_format, 'd/m/Y' ); ?>> <span><?php echo date( 'd/m/Y' ); ?></span></label><br>
67
- <label><input type="radio" name="date_format" value="custom"<?php checked( in_array( $date_format, array( 'F j, Y', 'Y/m/d', 'm/d/Y', 'd/m/Y' ) ), false ); ?>/> <?php _e( 'Custom', 'woo_ce' ); ?>: </label><input type="text" name="date_format_custom" value="<?php echo sanitize_text_field( $date_format ); ?>" class="text" />
68
- <p><a href="http://codex.wordpress.org/Formatting_Date_and_Time" target="_blank"><?php _e( 'Documentation on date and time formatting', 'woo_ce' ); ?></a>.</p>
69
- </fieldset>
70
- <p class="description"><?php _e( 'The date format option affects how date\'s are presented within your export file. Default is set to DD/MM/YYYY.', 'woo_ce' ); ?></p>
71
  </td>
72
  </tr>
73
  <?php if( !ini_get( 'safe_mode' ) ) { ?>
74
  <tr>
75
  <th>
76
- <label for="timeout"><?php _e( 'Script timeout', 'woo_ce' ); ?></label>
77
  </th>
78
  <td>
79
  <select id="timeout" name="timeout">
80
- <option value="600"<?php selected( $timeout, 600 ); ?>><?php printf( __( '%s minutes', 'woo_ce' ), 10 ); ?></option>
81
- <option value="1800"<?php selected( $timeout, 1800 ); ?>><?php printf( __( '%s minutes', 'woo_ce' ), 30 ); ?></option>
82
- <option value="3600"<?php selected( $timeout, 3600 ); ?>><?php printf( __( '%s hour', 'woo_ce' ), 1 ); ?></option>
83
- <option value="0"<?php selected( $timeout, 0 ); ?>><?php _e( 'Unlimited', 'woo_ce' ); ?></option>
84
  </select>
85
- <p class="description"><?php _e( 'Script timeout defines how long Store Exporter is \'allowed\' to process your export file, once the time limit is reached the export process halts.', 'woo_ce' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  </td>
87
  </tr>
 
88
  <?php } ?>
89
 
90
  <?php do_action( 'woo_ce_export_settings_general' ); ?>
@@ -92,47 +118,63 @@
92
  <tr id="csv-settings">
93
  <td colspan="2" style="padding:0;">
94
  <hr />
95
- <h3><div class="dashicons dashicons-media-spreadsheet"></div>&nbsp;<?php _e( 'CSV Settings', 'woo_ce' ); ?></h3>
96
  </td>
97
  </tr>
98
  <tr>
99
  <th>
100
- <label for="delimiter"><?php _e( 'Field delimiter', 'woo_ce' ); ?></label>
101
  </th>
102
  <td>
103
- <input type="text" size="3" id="delimiter" name="delimiter" value="<?php echo esc_attr( $delimiter ); ?>" maxlength="1" class="text" />
104
- <p class="description"><?php _e( 'The field delimiter is the character separating each cell in your CSV. This is typically the \',\' (comma) character.', 'woo_pc' ); ?></p>
105
  </td>
106
  </tr>
107
  <tr>
108
  <th>
109
- <label for="category_separator"><?php _e( 'Category separator', 'woo_ce' ); ?></label>
110
  </th>
111
  <td>
112
- <input type="text" size="3" id="category_separator" name="category_separator" value="<?php echo esc_attr( $category_separator ); ?>" maxlength="1" class="text" />
113
- <p class="description"><?php _e( 'The Product Category separator allows you to assign individual Products to multiple Product Categories/Tags/Images at a time. It is suggested to use the \'|\' (vertical pipe) character between each item. For instance: <code>Clothing|Mens|Shirts</code>.', 'woo_ce' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  </td>
115
  </tr>
116
  <tr>
117
  <th>
118
- <label for="bom"><?php _e( 'Add BOM character', 'woo_ce' ); ?></label>
119
  </th>
120
  <td>
121
  <select id="bom" name="bom">
122
- <option value="1"<?php selected( $bom, 1 ); ?>><?php _e( 'Yes', 'woo_ce' ); ?></option>
123
- <option value="0"<?php selected( $bom, 0 ); ?>><?php _e( 'No', 'woo_ce' ); ?></option>
124
  </select>
125
- <p class="description"><?php _e( 'Mark the CSV file as UTF8 by adding a byte order mark (BOM) to the export, useful for non-English character sets.', 'woo_ce' ); ?></p>
126
  </td>
127
  </tr>
128
  <tr>
129
  <th>
130
- <label for="escape_formatting"><?php _e( 'Field escape formatting', 'woo_ce' ); ?></label>
131
  </th>
132
  <td>
133
- <label><input type="radio" name="escape_formatting" value="all"<?php checked( $escape_formatting, 'all' ); ?> />&nbsp;<?php _e( 'Escape all fields', 'woo_ce' ); ?></label><br />
134
- <label><input type="radio" name="escape_formatting" value="excel"<?php checked( $escape_formatting, 'excel' ); ?> />&nbsp;<?php _e( 'Escape fields as Excel would', 'woo_ce' ); ?></label>
135
- <p class="description"><?php _e( 'Choose the field escape format that suits your spreadsheet software (e.g. Excel).', 'woo_ce' ); ?></p>
 
 
136
  </td>
137
  </tr>
138
 
@@ -142,8 +184,9 @@
142
  </table>
143
  <!-- .form-table -->
144
  <p class="submit">
145
- <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e( 'Save Changes', 'woo_ce' ); ?>" />
146
  </p>
147
  <input type="hidden" name="action" value="save-settings" />
 
148
  </form>
149
  <?php do_action( 'woo_ce_export_settings_bottom' ); ?>
1
  <ul class="subsubsub">
2
+ <li><a href="#general-settings"><?php _e( 'General Settings', 'woocommerce-exporter' ); ?></a> |</li>
3
+ <li><a href="#csv-settings"><?php _e( 'CSV Settings', 'woocommerce-exporter' ); ?></a></li>
4
  <?php do_action( 'woo_ce_export_settings_top' ); ?>
5
  </ul>
6
  <!-- .subsubsub -->
14
 
15
  <tr id="general-settings">
16
  <td colspan="2" style="padding:0;">
17
+ <h3><div class="dashicons dashicons-admin-settings"></div>&nbsp;<?php _e( 'General Settings', 'woocommerce-exporter' ); ?></h3>
18
+ <p class="description"><?php _e( 'Manage export options across Store Exporter from this screen. Options are broken into sections for different export formats and methods. Click Save Changes to apply changes.', 'woocommerce-exporter' ); ?></p>
19
  </td>
20
  </tr>
21
 
22
  <tr valign="top">
23
+ <th scope="row"><label for="export_filename"><?php _e( 'Export filename', 'woocommerce-exporter' ); ?></label></th>
24
  <td>
25
  <input type="text" name="export_filename" id="export_filename" value="<?php echo esc_attr( $export_filename ); ?>" class="large-text code" />
26
+ <p class="description"><?php _e( 'The filename of the exported export type. Tags can be used: ', 'woocommerce-exporter' ); ?> <code>%dataset%</code>, <code>%date%</code>, <code>%time%</code>, <code>%random</code>, <code>%store_name%</code>.</p>
27
  </td>
28
  </tr>
29
 
30
  <tr>
31
  <th>
32
+ <label for="delete_file"><?php _e( 'Enable archives', 'woocommerce-exporter' ); ?></label>
33
  </th>
34
  <td>
35
  <select id="delete_file" name="delete_file">
36
+ <option value="0"<?php selected( $delete_file, 0 ); ?>><?php _e( 'Yes', 'woocommerce-exporter' ); ?></option>
37
+ <option value="1"<?php selected( $delete_file, 1 ); ?>><?php _e( 'No', 'woocommerce-exporter' ); ?></option>
38
  </select>
39
+ <?php if( $delete_file == 1 && woo_ce_get_option( 'hide_archives_tab', 0 ) == 1 ) { ?>
40
+ <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'restore_archives_tab', '_wpnonce' => wp_create_nonce( 'woo_ce_restore_archives_tab' ) ) ) ); ?>"><?php _e( 'Restore Archives tab', 'woocommerce-exporter' ); ?></a>
41
+ <?php } ?>
42
+ <?php if( $delete_file == 0 ) { ?>
43
+ <p class="warning"><?php _e( 'Warning: Saving sensitve export files (e.g. Customers, Orders, etc.) to the WordPress Media directory will make the export files accessible to the public without restriction.', 'woocommerce-exporter' ); ?></p>
44
+ <?php } ?>
45
+ <p class="description"><?php _e( 'Save copies of exports to the WordPress Media for later downloading. By default this option is turned off.', 'woocommerce-exporter' ); ?></p>
46
  </td>
47
  </tr>
48
  <tr>
49
  <th>
50
+ <label for="encoding"><?php _e( 'Character encoding', 'woocommerce-exporter' ); ?></label>
51
  </th>
52
  <td>
53
  <?php if( $file_encodings ) { ?>
54
  <select id="encoding" name="encoding">
55
+ <option value=""><?php _e( 'System default', 'woocommerce-exporter' ); ?></option>
56
  <?php foreach( $file_encodings as $key => $chr ) { ?>
57
  <option value="<?php echo $chr; ?>"<?php selected( $chr, $encoding ); ?>><?php echo $chr; ?></option>
58
  <?php } ?>
59
  </select>
60
  <?php } else { ?>
61
+ <?php if( version_compare( phpversion(), '5', '<' ) ) { ?>
62
+ <p class="description"><?php _e( 'Character encoding options are unavailable in PHP 4, contact your hosting provider to update your site install to use PHP 5 or higher.', 'woocommerce-exporter' ); ?></p>
63
+ <?php } else { ?>
64
+ <p class="description"><?php _e( 'Character encoding options are unavailable as the required mb_list_encodings() function is missing, contact your hosting provider to have the mbstring extension installed.', 'woocommerce-exporter' ); ?></p>
65
+ <?php } ?>
66
  <?php } ?>
67
  </td>
68
  </tr>
69
  <tr>
70
+ <th><?php _e( 'Date format', 'woocommerce-exporter' ); ?></th>
71
  <td>
72
+ <ul style="margin-top:0.2em;">
73
+ <li><label title="F j, Y"><input type="radio" name="date_format" value="F j, Y"<?php checked( $date_format, 'F j, Y' ); ?>> <span><?php echo date( 'F j, Y' ); ?></span></label></li>
74
+ <li><label title="Y/m/d"><input type="radio" name="date_format" value="Y/m/d"<?php checked( $date_format, 'Y/m/d' ); ?>> <span><?php echo date( 'Y/m/d' ); ?></span></label></li>
75
+ <li><label title="m/d/Y"><input type="radio" name="date_format" value="m/d/Y"<?php checked( $date_format, 'm/d/Y' ); ?>> <span><?php echo date( 'm/d/Y' ); ?></span></label></li>
76
+ <li><label title="d/m/Y"><input type="radio" name="date_format" value="d/m/Y"<?php checked( $date_format, 'd/m/Y' ); ?>> <span><?php echo date( 'd/m/Y' ); ?></span></label></li>
77
+ <li><label><input type="radio" name="date_format" value="custom"<?php checked( in_array( $date_format, array( 'F j, Y', 'Y/m/d', 'm/d/Y', 'd/m/Y' ) ), false ); ?>/> <?php _e( 'Custom', 'woocommerce-exporter' ); ?>: </label><input type="text" name="date_format_custom" value="<?php echo sanitize_text_field( $date_format ); ?>" class="text" /></li>
78
+ <li><a href="http://codex.wordpress.org/Formatting_Date_and_Time" target="_blank"><?php _e( 'Documentation on date and time formatting', 'woocommerce-exporter' ); ?></a>.</li>
79
+ </ul>
80
+ <p class="description"><?php _e( 'The date format option affects how date\'s are presented within your export file. Default is set to DD/MM/YYYY.', 'woocommerce-exporter' ); ?></p>
81
  </td>
82
  </tr>
83
  <?php if( !ini_get( 'safe_mode' ) ) { ?>
84
  <tr>
85
  <th>
86
+ <label for="timeout"><?php _e( 'Script timeout', 'woocommerce-exporter' ); ?></label>
87
  </th>
88
  <td>
89
  <select id="timeout" name="timeout">
90
+ <option value="600"<?php selected( $timeout, 600 ); ?>><?php printf( __( '%s minutes', 'woocommerce-exporter' ), 10 ); ?></option>
91
+ <option value="1800"<?php selected( $timeout, 1800 ); ?>><?php printf( __( '%s minutes', 'woocommerce-exporter' ), 30 ); ?></option>
92
+ <option value="3600"<?php selected( $timeout, 3600 ); ?>><?php printf( __( '%s hour', 'woocommerce-exporter' ), 1 ); ?></option>
93
+ <option value="0"<?php selected( $timeout, 0 ); ?>><?php _e( 'Unlimited', 'woocommerce-exporter' ); ?></option>
94
  </select>
95
+ <p class="description"><?php _e( 'Script timeout defines how long Store Exporter is \'allowed\' to process your export file, once the time limit is reached the export process halts.', 'woocommerce-exporter' ); ?></p>
96
+ </td>
97
+ </tr>
98
+
99
+ <tr>
100
+ <th>&nbsp;</th>
101
+ <td style="vertical-align:top;">
102
+ <p><a href="#" id="advanced-settings"><?php _e( 'View advanced settings', 'woocommerce-exporter' ); ?></a></p>
103
+ <div class="advanced-settings">
104
+ <ul>
105
+ <li><a href="<?php echo esc_url( add_query_arg( array( 'action' => 'nuke_notices', '_wpnonce' => wp_create_nonce( 'woo_ce_nuke_notices' ) ) ) ); ?>" class="delete" data-confirm="<?php _e( 'This will restore all dismissed notices associated with Store Exporter Deluxe. Are you sure you want to proceed?', 'woocommerce-exporter' ); ?>"><?php _e( 'Reset dismissed Store Export Deluxe notices', 'woocommerce-exporter' ); ?></a></li>
106
+ <li><a href="<?php echo esc_url( add_query_arg( array( 'action' => 'nuke_options', '_wpnonce' => wp_create_nonce( 'woo_ce_nuke_options' ) ) ) ); ?>" class="delete" data-confirm="<?php _e( 'This will permanently delete all WordPress Options associated with Store Exporter Deluxe. Are you sure you want to proceed?', 'woocommerce-exporter' ); ?>"><?php _e( 'Delete Store Exporter Deluxe WordPress Options', 'woocommerce-exporter' ); ?></a></li>
107
+ <li><a href="<?php echo esc_url( add_query_arg( array( 'action' => 'nuke_archives', '_wpnonce' => wp_create_nonce( 'woo_ce_nuke_archives' ) ) ) ); ?>" class="delete" data-confirm="<?php _e( 'This will permanently delete all saved exports listed within the Archives screen of Store Exporter Deluxe. Are you sure you want to proceed?', 'woocommerce-exporter' ); ?>"><?php _e( 'Delete archived exports', 'woocommerce-exporter' ); ?></a></li>
108
+ </ul>
109
+ </div>
110
+ <!-- .advanced-settings -->
111
  </td>
112
  </tr>
113
+
114
  <?php } ?>
115
 
116
  <?php do_action( 'woo_ce_export_settings_general' ); ?>
118
  <tr id="csv-settings">
119
  <td colspan="2" style="padding:0;">
120
  <hr />
121
+ <h3><div class="dashicons dashicons-media-spreadsheet"></div>&nbsp;<?php _e( 'CSV Settings', 'woocommerce-exporter' ); ?></h3>
122
  </td>
123
  </tr>
124
  <tr>
125
  <th>
126
+ <label for="delimiter"><?php _e( 'Field delimiter', 'woocommerce-exporter' ); ?></label>
127
  </th>
128
  <td>
129
+ <input type="text" size="3" id="delimiter" name="delimiter" value="<?php echo esc_attr( $delimiter ); ?>" maxlength="5" class="text" />
130
+ <p class="description"><?php _e( 'The field delimiter is the character separating each cell in your CSV. This is typically the \',\' (comma) character.', 'woocommerce-exporter' ); ?></p>
131
  </td>
132
  </tr>
133
  <tr>
134
  <th>
135
+ <label for="category_separator"><?php _e( 'Category separator', 'woocommerce-exporter' ); ?></label>
136
  </th>
137
  <td>
138
+ <input type="text" size="3" id="category_separator" name="category_separator" value="<?php echo esc_attr( $category_separator ); ?>" maxlength="5" class="text" />
139
+ <p class="description"><?php _e( 'The Product Category separator allows you to assign individual Products to multiple Product Categories/Tags/Images at a time. It is suggested to use the \'|\' (vertical pipe) character or \'LF\' for line breaks between each item. For instance: <code>Clothing|Mens|Shirts</code>.', 'woocommerce-exporter' ); ?></p>
140
+ </td>
141
+ </tr>
142
+ <tr>
143
+ <th>
144
+ <label for="line_ending"><?php _e( 'Line ending formatting', 'woocommerce-exporter' ); ?></label>
145
+ </th>
146
+ <td>
147
+ <select id="line_ending" name="line_ending">
148
+ <option value="windows" selected="selected"><?php _e( 'Windows', 'woocommerce-exporter' ); ?></option>
149
+ <option value="mac" disabled="disabled"><?php _e( 'Mac' ,'woocommerce-exporter' ); ?></option>
150
+ <option value="unix" disabled="disabled"><?php _e( 'Unix', 'woocommerce-exporter' ); ?></option>
151
+ </select>
152
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
153
+ <p class="description"><?php _e( 'Choose the line ending formatting that suits the Operating System you plan to use the export file with (e.g. a Windows desktop, Mac laptop, etc.). Default is Windows.', 'woocommerce-exporter' ); ?></p>
154
  </td>
155
  </tr>
156
  <tr>
157
  <th>
158
+ <label for="bom"><?php _e( 'Add BOM character', 'woocommerce-exporter' ); ?></label>
159
  </th>
160
  <td>
161
  <select id="bom" name="bom">
162
+ <option value="1"<?php selected( $bom, 1 ); ?>><?php _e( 'Yes', 'woocommerce-exporter' ); ?></option>
163
+ <option value="0"<?php selected( $bom, 0 ); ?>><?php _e( 'No', 'woocommerce-exporter' ); ?></option>
164
  </select>
165
+ <p class="description"><?php _e( 'Mark the CSV file as UTF8 by adding a byte order mark (BOM) to the export, useful for non-English character sets.', 'woocommerce-exporter' ); ?></p>
166
  </td>
167
  </tr>
168
  <tr>
169
  <th>
170
+ <label for="escape_formatting"><?php _e( 'Field escape formatting', 'woocommerce-exporter' ); ?></label>
171
  </th>
172
  <td>
173
+ <ul style="margin-top:0.2em;">
174
+ <li><label><input type="radio" name="escape_formatting" value="all"<?php checked( $escape_formatting, 'all' ); ?> />&nbsp;<?php _e( 'Escape all fields', 'woocommerce-exporter' ); ?></label></li>
175
+ <li><label><input type="radio" name="escape_formatting" value="excel"<?php checked( $escape_formatting, 'excel' ); ?> />&nbsp;<?php _e( 'Escape fields as Excel would', 'woocommerce-exporter' ); ?></label></li>
176
+ </ul>
177
+ <p class="description"><?php _e( 'Choose the field escape format that suits your spreadsheet software (e.g. Excel).', 'woocommerce-exporter' ); ?></p>
178
  </td>
179
  </tr>
180
 
184
  </table>
185
  <!-- .form-table -->
186
  <p class="submit">
187
+ <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e( 'Save Changes', 'woocommerce-exporter' ); ?>" />
188
  </p>
189
  <input type="hidden" name="action" value="save-settings" />
190
+ <?php wp_nonce_field( 'woo_ce_save_settings' ); ?>
191
  </form>
192
  <?php do_action( 'woo_ce_export_settings_bottom' ); ?>
templates/admin/tabs-tools.php CHANGED
@@ -1,23 +1,31 @@
1
- <h3><div class="dashicons dashicons-hammer"></div>&nbsp;<?php _e( 'WooCommerce Tools', 'woo_ce' ); ?></h3>
2
- <p class="description"><?php _e( 'Extend your store with other WooCommerce extensions from us.', 'woo_ce' ); ?></p>
 
 
 
 
 
3
  <div id="poststuff">
4
 
 
 
5
  <div id="tools" class="postbox">
6
- <h3 class="hndle"><?php _e( 'Tools', 'woo_pd' ); ?></h3>
7
  <div class="inside">
 
8
  <table class="form-table">
9
 
10
  <tr>
11
  <td>
12
- <a href="<?php echo $woo_pd_url; ?>"<?php echo $woo_pd_target; ?>><?php _e( 'Import Products from CSV', 'woo_ce' ); ?></a>
13
- <p class="description"><?php _e( 'Use Product Importer Deluxe to import Product changes back into your WooCommerce store.', 'woo_ce' ); ?></p>
14
  </td>
15
  </tr>
16
 
17
  <tr>
18
  <td>
19
- <a href="<?php echo $woo_st_url; ?>"<?php echo $woo_st_target; ?>><?php _e( 'Store Toolkit', 'woo_ce' ); ?></a>
20
- <p class="description"><?php _e( 'Store Toolkit includes a growing set of commonly-used WooCommerce administration tools aimed at web developers and store maintainers.', 'woo_ce' ); ?></p>
21
  </td>
22
  </tr>
23
 
@@ -26,5 +34,63 @@
26
  </div>
27
  <!-- .postbox -->
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  </div>
30
  <!-- #poststuff -->
1
+ <ul class="subsubsub">
2
+ <li><a href="#tools"><?php _e( 'Tools', 'woocommerce-exporter' ); ?></a> |</li>
3
+ <li><a href="#export-modules"><?php _e( 'Export Modules', 'woocommerce-exporter' ); ?></a></li>
4
+ </ul>
5
+ <!-- .subsubsub -->
6
+ <br class="clear" />
7
+
8
  <div id="poststuff">
9
 
10
+ <?php do_action( 'woo_ce_before_tools' ); ?>
11
+
12
  <div id="tools" class="postbox">
13
+ <h3 class="hndle"><?php _e( 'WooCommerce Tools', 'woocommerce-exporter' ); ?></h3>
14
  <div class="inside">
15
+ <p><?php _e( 'Extend your store with other WooCommerce extensions from us.', 'woocommerce-exporter' ); ?></p>
16
  <table class="form-table">
17
 
18
  <tr>
19
  <td>
20
+ <a href="<?php echo $woo_pd_url; ?>"<?php echo $woo_pd_target; ?>><?php _e( 'Import Products from CSV', 'woocommerce-exporter' ); ?></a>
21
+ <p class="description"><?php _e( 'Use Product Importer Deluxe to import Product changes back into your WooCommerce store.', 'woocommerce-exporter' ); ?></p>
22
  </td>
23
  </tr>
24
 
25
  <tr>
26
  <td>
27
+ <a href="<?php echo $woo_st_url; ?>"<?php echo $woo_st_target; ?>><?php _e( 'Store Toolkit', 'woocommerce-exporter' ); ?></a>
28
+ <p class="description"><?php _e( 'Store Toolkit includes a growing set of commonly-used WooCommerce administration tools aimed at web developers and store maintainers.', 'woocommerce-exporter' ); ?></p>
29
  </td>
30
  </tr>
31
 
34
  </div>
35
  <!-- .postbox -->
36
 
37
+ <?php do_action( 'woo_ce_after_tools' ); ?>
38
+
39
+ <?php do_action( 'woo_ce_before_modules' ); ?>
40
+
41
+ <div id="export-modules" class="postbox">
42
+ <h3 class="hndle">
43
+ <?php _e( 'Export Modules', 'woocommerce-exporter' ); ?>
44
+ <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'refresh_module_counts', '_wpnonce' => wp_create_nonce( 'woo_ce_refresh_module_counts' ) ) ) ); ?>" style="float:right;"><?php _e( 'Refresh counts', 'woocommerce-exporter' ); ?></a>
45
+ </h3>
46
+ <div class="inside">
47
+ <p><?php _e( 'Export store details from other WooCommerce and WordPress Plugins, simply install and activate one of the below Plugins to enable those additional export options.', 'woocommerce-exporter' ); ?></p>
48
+ <?php if( $modules ) { ?>
49
+ <ul class="subsubsub">
50
+ <li><a href="<?php echo esc_url( add_query_arg( 'module_status', 'all' ) ); ?>"<?php echo ( empty( $module_status ) ? 'class="current"' : '' ); ?>><?php _e( 'All', 'woocommerce-exporter' ); ?></a> <span class="count">(<?php echo $modules_all; ?>)</span> |</li>
51
+ <li><a href="<?php echo esc_url( add_query_arg( 'module_status', 'active' ) ); ?>"<?php echo ( $module_status == 'active' ? 'class="current"' : '' ); ?>><?php _e( 'Active', 'woocommerce-exporter' ); ?></a> <span class="count">(<?php echo $modules_active; ?>)</span> |</li>
52
+ <li><a href="<?php echo esc_url( add_query_arg( 'module_status', 'inactive' ) ); ?>"<?php echo ( $module_status == 'inactive' ? 'class="current"' : '' ); ?>><?php _e( 'Inactive', 'woocommerce-exporter' ); ?></a> <span class="count">(<?php echo $modules_inactive; ?>)</span></li>
53
+ </ul>
54
+ <!-- .subsubsub -->
55
+ <br class="clear" />
56
+ <hr />
57
+
58
+ <div class="table table_content">
59
+ <table class="woo_vm_version_table">
60
+ <?php foreach( $modules as $module ) { ?>
61
+ <tr>
62
+ <td class="export_module">
63
+ <?php if( $module['description'] ) { ?>
64
+ <strong><?php echo $module['title']; ?></strong>: <span class="description"><?php echo $module['description']; ?></span>
65
+ <?php } else { ?>
66
+ <strong><?php echo $module['title']; ?></strong>
67
+ <?php } ?>
68
+ </td>
69
+ <td class="status">
70
+ <div class="<?php woo_ce_modules_status_class( $module['status'] ); ?>">
71
+ <?php if( $module['status'] == 'active' ) { ?>
72
+ <div class="dashicons dashicons-yes" style="color:#008000;"></div><?php woo_ce_modules_status_label( $module['status'] ); ?>
73
+ <?php } else { ?>
74
+ <?php if( $module['url'] ) { ?>
75
+ <?php if( isset( $module['slug'] ) ) { echo '<div class="dashicons dashicons-download" style="color:#0074a2;"></div>'; } else { echo '<div class="dashicons dashicons-admin-links"></div>'; } ?>&nbsp;<a href="<?php echo ( isset( $module['slug'] ) ? $module['url'] : add_query_arg( 'ref', 'visserlabs', $module['url'] ) ); ?>" target="_blank"<?php if( isset( $module['slug'] ) ) { echo ' title="' . __( 'Install via WordPress Plugin Directory', 'woocommerce-exporter' ) . '"'; } else { echo ' title="' . __( 'Visit the Plugin website', 'woocommerce-exporter' ) . '"'; } ?>><?php woo_ce_modules_status_label( $module['status'] ); ?></a>
76
+ <?php } ?>
77
+ <?php } ?>
78
+ </div>
79
+ </td>
80
+ </tr>
81
+ <?php } ?>
82
+ </table>
83
+ </div>
84
+ <!-- .table -->
85
+ <?php } else { ?>
86
+ <p><?php _e( 'No export modules are available at this time.', 'woocommerce-exporter' ); ?></p>
87
+ <?php } ?>
88
+ </div>
89
+ <!-- .inside -->
90
+ </div>
91
+ <!-- .postbox -->
92
+
93
+ <?php do_action( 'woo_ce_after_modules' ); ?>
94
+
95
  </div>
96
  <!-- #poststuff -->
templates/admin/tabs.php CHANGED
@@ -1,11 +1,13 @@
1
  <div id="content">
2
 
3
  <h2 class="nav-tab-wrapper">
4
- <a data-tab-id="overview" class="nav-tab<?php woo_ce_admin_active_tab( 'overview' ); ?>" href="<?php echo add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'overview' ), 'admin.php' ); ?>"><?php _e( 'Overview', 'woo_ce' ); ?></a>
5
- <a data-tab-id="export" class="nav-tab<?php woo_ce_admin_active_tab( 'export' ); ?>" href="<?php echo add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'export' ), 'admin.php' ); ?>"><?php _e( 'Export', 'woo_ce' ); ?></a>
6
- <a data-tab-id="archive" class="nav-tab<?php woo_ce_admin_active_tab( 'archive' ); ?>" href="<?php echo add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'archive' ), 'admin.php' ); ?>"><?php _e( 'Archives', 'woo_ce' ); ?></a>
7
- <a data-tab-id="settings" class="nav-tab<?php woo_ce_admin_active_tab( 'settings' ); ?>" href="<?php echo add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'settings' ), 'admin.php' ); ?>"><?php _e( 'Settings', 'woo_ce' ); ?></a>
8
- <a data-tab-id="tools" class="nav-tab<?php woo_ce_admin_active_tab( 'tools' ); ?>" href="<?php echo add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'tools' ), 'admin.php' ); ?>"><?php _e( 'Tools', 'woo_ce' ); ?></a>
 
 
9
  </h2>
10
  <?php woo_ce_tab_template( $tab ); ?>
11
 
1
  <div id="content">
2
 
3
  <h2 class="nav-tab-wrapper">
4
+ <a data-tab-id="overview" class="nav-tab<?php woo_ce_admin_active_tab( 'overview' ); ?>" href="<?php echo esc_url( add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'overview' ), 'admin.php' ) ); ?>"><?php _e( 'Overview', 'woocommerce-exporter' ); ?></a>
5
+ <a data-tab-id="export" class="nav-tab<?php woo_ce_admin_active_tab( 'export' ); ?>" href="<?php echo esc_url( add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'export' ), 'admin.php' ) ); ?>"><?php _e( 'Quick Export', 'woocommerce-exporter' ); ?></a>
6
+ <?php if( !woo_ce_get_option( 'hide_archives_tab', 0 ) ) { ?>
7
+ <a data-tab-id="archive" class="nav-tab<?php woo_ce_admin_active_tab( 'archive' ); ?>" href="<?php echo esc_url( add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'archive' ), 'admin.php' ) ); ?>"><?php _e( 'Archives', 'woocommerce-exporter' ); ?></a>
8
+ <?php } ?>
9
+ <a data-tab-id="settings" class="nav-tab<?php woo_ce_admin_active_tab( 'settings' ); ?>" href="<?php echo esc_url( add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'settings' ), 'admin.php' ) ); ?>"><?php _e( 'Settings', 'woocommerce-exporter' ); ?></a>
10
+ <a data-tab-id="tools" class="nav-tab<?php woo_ce_admin_active_tab( 'tools' ); ?>" href="<?php echo esc_url( add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'tools' ), 'admin.php' ) ); ?>"><?php _e( 'Tools', 'woocommerce-exporter' ); ?></a>
11
  </h2>
12
  <?php woo_ce_tab_template( $tab ); ?>
13
 
templates/admin/woo-admin_ce-export.css ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Tabbed navigation */
2
+
3
+ .woocommerce_page_woo_ce h2 .nav-tab {
4
+ font-size: 16px;
5
+ margin-right:0;
6
+ }
7
+
8
+ .woocommerce_page_woo_ce h2.nav-tab-wrapper {
9
+ padding-left:7px;
10
+ }
11
+
12
+ /* Export */
13
+
14
+ .woocommerce_page_woo_ce #export-type th {
15
+ padding:0;
16
+ }
17
+ .woocommerce_page_woo_ce #export-type td {
18
+ padding:0;
19
+ }
20
+ .woocommerce_page_woo_ce .postbox .submit {
21
+ padding:0.3em 0;
22
+ }
23
+ .woocommerce_page_woo_ce textarea#export_log {
24
+ font:12px Consolas, Monaco, Courier, monospace;
25
+ width:100%;
26
+ height:200px;
27
+ }
28
+ .woocommerce_page_woo_ce .separator {
29
+ border-bottom:1px solid #dfdfdf;
30
+ }
31
+
32
+ .woocommerce_page_woo_ce .overview-left {
33
+ float:left;
34
+ width:73%;
35
+ }
36
+ .woocommerce_page_woo_ce .overview-right {
37
+ float:left;
38
+ width:24%;
39
+ }
40
+ .woocommerce_page_woo_ce .overview-right h3 {
41
+ font-size:16px;
42
+ }
43
+ .woocommerce_page_woo_ce .overview-right h3 span {
44
+ float:right;
45
+ font-size:11px;
46
+ font-weight:normal;
47
+ }
48
+ .woocommerce_page_woo_ce .overview-right p {
49
+ font-size:12px;
50
+ color:#333;
51
+ line-height:1.6em;
52
+ }
53
+ .woocommerce_page_woo_ce .overview-right ul {
54
+ font-size:12px;
55
+ line-height:1.2em;
56
+ }
57
+
58
+ /* Support - Donate / Rate */
59
+
60
+ .woocommerce_page_woo_ce .support-donate_rate {
61
+ display:block;
62
+ float:right;
63
+ }
64
+ .woocommerce_page_woo_ce .support-donate_rate p {
65
+ margin-top:16px;
66
+ }
67
+ .woocommerce_page_woo_ce .support-donate_rate .star {
68
+ vertical-align:bottom;
69
+ display:inline-block;
70
+ width:17px;
71
+ height:17px;
72
+ background:url('images/star.png') no-repeat;
73
+ }
74
+ .woocommerce_page_woo_ce .support-donate_rate span {
75
+ display:none;
76
+ }
templates/admin/woo-admin_ce-export.js ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var $j = jQuery.noConflict();
2
+ $j(function() {
3
+
4
+ $j('#skip_overview').click(function(){
5
+ $j('#skip_overview_form').submit();
6
+ });
7
+
8
+ // Date Picker
9
+ $j('.datepicker').datepicker({
10
+ dateFormat: 'dd/mm/yy'
11
+ });
12
+
13
+ // Chosen
14
+ $j(".chzn-select").chosen({
15
+ search_contains: true
16
+ });
17
+
18
+ $j('#export-products').show();
19
+ // Categories
20
+ $j('#export-products-filters-categories').hide();
21
+ if( $j('#products-filters-categories').attr('checked') ) {
22
+ $j('#export-products-filters-categories').show();
23
+ }
24
+ // Tags
25
+ $j('#export-products-filters-tags').hide();
26
+ if( $j('#products-filters-tags').attr('checked') ) {
27
+ $j('#export-products-filters-tags').show();
28
+ }
29
+ // Product Status
30
+ $j('#export-products-filters-status').hide();
31
+ if( $j('#products-filters-status').attr('checked') ) {
32
+ $j('#export-products-filters-status').show();
33
+ }
34
+ $j('#export-products-filters-type').hide();
35
+ if( $j('#products-filters-type').attr('checked') ) {
36
+ $j('#export-products-filters-type').show();
37
+ }
38
+ $j('#export-categories').hide();
39
+ $j('#export-tags').hide();
40
+ $j('#export-orders').hide();
41
+ $j('#export-orders-filters-status').hide();
42
+ if( $j('#orders-filters-status').attr('checked') ) {
43
+ $j('#export-orders-filters-status').show();
44
+ }
45
+ $j('#export-orders-filters-date').hide();
46
+ if( $j('#orders-filters-date').attr('checked') ) {
47
+ $j('#export-orders-filters-date').show();
48
+ }
49
+ $j('#export-orders-filters-user_role').hide();
50
+ if( $j('#orders-filters-user_role').attr('checked') ) {
51
+ $j('#export-orders-filters-user_role').show();
52
+ }
53
+ $j('#export-customers').hide();
54
+ $j('#export-coupons').hide();
55
+
56
+ $j('#products-filters-categories').click(function(){
57
+ $j('#export-products-filters-categories').toggle();
58
+ });
59
+ $j('#products-filters-tags').click(function(){
60
+ $j('#export-products-filters-tags').toggle();
61
+ });
62
+ $j('#products-filters-status').click(function(){
63
+ $j('#export-products-filters-status').toggle();
64
+ });
65
+ $j('#products-filters-type').click(function(){
66
+ $j('#export-products-filters-type').toggle();
67
+ });
68
+ $j('#orders-filters-status').click(function(){
69
+ $j('#export-orders-filters-status').toggle();
70
+ });
71
+ $j('#orders-filters-date').click(function(){
72
+ $j('#export-orders-filters-date').toggle();
73
+ });
74
+ $j('#orders-filters-user_role').click(function(){
75
+ $j('#export-orders-filters-user_role').toggle();
76
+ });
77
+
78
+ // Export types
79
+ $j('#products').click(function(){
80
+ $j('#export-products').show();
81
+ $j('#export-categories').hide();
82
+ $j('#export-tags').hide();
83
+ $j('#export-orders').hide();
84
+ $j('#export-customers').hide();
85
+ $j('#export-coupons').hide();
86
+
87
+ $j('.export-options').hide();
88
+ $j('.product-options').show();
89
+ });
90
+ $j('#categories').click(function(){
91
+ $j('#export-products').hide();
92
+ $j('#export-categories').show();
93
+ $j('#export-tags').hide();
94
+ $j('#export-orders').hide();
95
+ $j('#export-customers').hide();
96
+ $j('#export-coupons').hide();
97
+
98
+ $j('.export-options').hide();
99
+ $j('.category-options').show();
100
+ });
101
+ $j('#tags').click(function(){
102
+ $j('#export-products').hide();
103
+ $j('#export-categories').hide();
104
+ $j('#export-tags').show();
105
+ $j('#export-orders').hide();
106
+ $j('#export-customers').hide();
107
+ $j('#export-coupons').hide();
108
+
109
+ $j('.export-options').hide();
110
+ $j('.tag-options').show();
111
+ });
112
+ $j('#orders').click(function(){
113
+ $j('#export-products').hide();
114
+ $j('#export-categories').hide();
115
+ $j('#export-tags').hide();
116
+ $j('#export-orders').show();
117
+ $j('#export-customers').hide();
118
+ $j('#export-coupons').hide();
119
+
120
+ $j('.export-options').hide();
121
+ $j('.order-options').show();
122
+ });
123
+ $j('#customers').click(function(){
124
+ $j('#export-products').hide();
125
+ $j('#export-categories').hide();
126
+ $j('#export-tags').hide();
127
+ $j('#export-orders').hide();
128
+ $j('#export-customers').show();
129
+ $j('#export-coupons').hide();
130
+
131
+ $j('.export-options').hide();
132
+ $j('.customer-options').show();
133
+ });
134
+ $j('#coupons').click(function(){
135
+ $j('#export-products').hide();
136
+ $j('#export-categories').hide();
137
+ $j('#export-tags').hide();
138
+ $j('#export-orders').hide();
139
+ $j('#export-customers').hide();
140
+ $j('#export-coupons').show();
141
+
142
+ $j('.export-options').hide();
143
+ $j('.coupon-options').show();
144
+ });
145
+
146
+ // Export button
147
+ $j('#export_products').click(function(){
148
+ $j('input:radio[name=dataset]:nth(0)').attr('checked',true);
149
+ });
150
+ $j('#export_orders').click(function(){
151
+ $j('input:radio[name=dataset]:nth(3)').attr('checked',true);
152
+ });
153
+ $j('#export_customers').click(function(){
154
+ $j('input:radio[name=dataset]:nth(4)').attr('checked',true);
155
+ });
156
+ $j('#export_coupons').click(function(){
157
+ $j('input:radio[name=dataset]:nth(5)').attr('checked',true);
158
+ });
159
+
160
+ // Select all
161
+ $j('.checkall').click(function () {
162
+ $j(this).closest('.postbox').find(':checkbox').attr('checked', true);
163
+ });
164
+ $j('.uncheckall').click(function () {
165
+ $j(this).closest('.postbox').find(':checkbox').attr('checked', false);
166
+ });
167
+
168
+ $j(document).ready(function() {
169
+ var href = jQuery(location).attr('href');
170
+ if (href.toLowerCase().indexOf('tab=export') >= 0) {
171
+ if (href.toLowerCase().indexOf('#') >= 0 ) {
172
+ var type = href.substr(href.indexOf("#") + 1)
173
+ var type = type.replace('export-','');
174
+ $j('#'+type).trigger('click');
175
+ }
176
+ }
177
+ });
178
+
179
+ });
templates/admin/woo-admin_ce-export.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="content">
2
+
3
+ <h2 class="nav-tab-wrapper">
4
+ <a data-tab-id="overview" class="nav-tab<?php woo_ce_admin_active_tab( 'overview' ); ?>" href="<?php echo add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'overview' ), 'admin.php' ); ?>"><?php _e( 'Overview', 'woo_ce' ); ?></a>
5
+ <a data-tab-id="export" class="nav-tab<?php woo_ce_admin_active_tab( 'export' ); ?>" href="<?php echo add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'export' ), 'admin.php' ); ?>"><?php _e( 'Export', 'woo_ce' ); ?></a>
6
+ <a data-tab-id="archive" class="nav-tab<?php woo_ce_admin_active_tab( 'archive' ); ?>" href="<?php echo add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'archive' ), 'admin.php' ); ?>"><?php _e( 'Archives', 'woo_ce' ); ?></a>
7
+ <a data-tab-id="settings" class="nav-tab<?php woo_ce_admin_active_tab( 'settings' ); ?>" href="<?php echo add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'settings' ), 'admin.php' ); ?>"><?php _e( 'Settings', 'woo_ce' ); ?></a>
8
+ <a data-tab-id="tools" class="nav-tab<?php woo_ce_admin_active_tab( 'tools' ); ?>" href="<?php echo add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'tools' ), 'admin.php' ); ?>"><?php _e( 'Tools', 'woo_ce' ); ?></a>
9
+ </h2>
10
+ <?php woo_ce_tab_template( $tab ); ?>
11
+
12
+ </div>
13
+ <!-- #content -->
templates/admin/woo-admin_ce-export_archive.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <ul class="subsubsub">
2
+ <li><a href="<?php echo add_query_arg( 'filter', null ); ?>"<?php woo_ce_archives_quicklink_current( 'all' ); ?>><?php _e( 'All', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count(); ?>)</span></a> |</li>
3
+ <li><a href="<?php echo add_query_arg( 'filter', 'products' ); ?>"<?php woo_ce_archives_quicklink_current( 'products' ); ?>><?php _e( 'Products', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'products' ); ?>)</span></a> |</li>
4
+ <li><a href="<?php echo add_query_arg( 'filter', 'categories' ); ?>"<?php woo_ce_archives_quicklink_current( 'categories' ); ?>><?php _e( 'Categories', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'categories' ); ?>)</span></a> |</li>
5
+ <li><a href="<?php echo add_query_arg( 'filter', 'tags' ); ?>"<?php woo_ce_archives_quicklink_current( 'tags' ); ?>><?php _e( 'Tags', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'tags' ); ?>)</span></a> |</li>
6
+ <li><a href="<?php echo add_query_arg( 'filter', 'orders' ); ?>"<?php woo_ce_archives_quicklink_current( 'orders' ); ?>><?php _e( 'Orders', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'orders' ); ?>)</span></a> |</li>
7
+ <li><a href="<?php echo add_query_arg( 'filter', 'customers' ); ?>"<?php woo_ce_archives_quicklink_current( 'customers' ); ?>><?php _e( 'Customers', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'customers' ); ?>)</span></a> |</li>
8
+ <li><a href="<?php echo add_query_arg( 'filter', 'coupons' ); ?>"<?php woo_ce_archives_quicklink_current( 'coupons' ); ?>><?php _e( 'Coupons', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'coupons' ); ?>)</span></a></li>
9
+ </ul>
10
+ <br class="clear" />
11
+ <form action="" method="GET">
12
+ <table class="widefat fixed media" cellspacing="0">
13
+ <thead>
14
+
15
+ <tr>
16
+ <th scope="col" id="icon" class="manage-column column-icon"></th>
17
+ <th scope="col" id="title" class="manage-column column-title"><?php _e( 'Filename', 'woo_ce' ); ?></th>
18
+ <th scope="col" class="manage-column column-type"><?php _e( 'Type', 'woo_ce' ); ?></th>
19
+ <th scope="col" class="manage-column column-author"><?php _e( 'Author', 'woo_ce' ); ?></th>
20
+ <th scope="col" id="title" class="manage-column column-title"><?php _e( 'Date', 'woo_ce' ); ?></th>
21
+ </tr>
22
+
23
+ </thead>
24
+ <tfoot>
25
+
26
+ <tr>
27
+ <th scope="col" class="manage-column column-icon"></th>
28
+ <th scope="col" class="manage-column column-title"><?php _e( 'Filename', 'woo_ce' ); ?></th>
29
+ <th scope="col" class="manage-column column-type"><?php _e( 'Type', 'woo_ce' ); ?></th>
30
+ <th scope="col" class="manage-column column-author"><?php _e( 'Author', 'woo_ce' ); ?></th>
31
+ <th scope="col" class="manage-column column-title"><?php _e( 'Date', 'woo_ce' ); ?></th>
32
+ </tr>
33
+
34
+ </tfoot>
35
+ <tbody id="the-list">
36
+
37
+ <?php if( $files ) { ?>
38
+ <?php foreach( $files as $file ) { ?>
39
+ <tr id="post-<?php echo $file->ID; ?>" class="author-self status-<?php echo $file->post_status; ?>" valign="top">
40
+ <td class="column-icon media-icon">
41
+ <?php echo $file->media_icon; ?>
42
+ </td>
43
+ <td class="post-title page-title column-title">
44
+ <strong><a href="<?php echo $file->guid; ?>" class="row-title"><?php echo $file->post_title; ?></a></strong>
45
+ <div class="row-actions">
46
+ <span class="view"><a href="<?php echo get_edit_post_link( $file->ID ); ?>" title="<?php _e( 'Edit', 'woo_ce' ); ?>"><?php _e( 'Edit', 'woo_ce' ); ?></a></span> |
47
+ <span class="trash"><a href="<?php echo get_delete_post_link( $file->ID, '', true ); ?>" title="<?php _e( 'Delete Permanently', 'woo_ce' ); ?>"><?php _e( 'Delete', 'woo_ce' ); ?></a></span>
48
+ </div>
49
+ </td>
50
+ <td class="title">
51
+ <a href="<?php echo add_query_arg( 'filter', $file->export_type ); ?>"><?php echo $file->export_type_label; ?></a>
52
+ </td>
53
+ <td class="author column-author"><?php echo $file->post_author_name; ?></td>
54
+ <td class="date column-date"><?php echo $file->post_date; ?></td>
55
+ </tr>
56
+ <?php } ?>
57
+ <?php } else { ?>
58
+ <tr id="post-<?php echo $file->ID; ?>" class="author-self" valign="top">
59
+ <td colspan="3" class="colspanchange"><?php _e( 'No past exports found.', 'woo_ce' ); ?></td>
60
+ </tr>
61
+ <?php } ?>
62
+
63
+ </tbody>
64
+ </table>
65
+ </form>
templates/admin/woo-admin_ce-export_export.php ADDED
@@ -0,0 +1,511 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <ul class="subsubsub">
2
+ <li><a href="#export-type"><?php _e( 'Export Type', 'woo_ce' ); ?></a> |</li>
3
+ <li><a href="#export-options"><?php _e( 'Export Options', 'woo_ce' ); ?></a></li>
4
+ <?php do_action( 'woo_ce_export_quicklinks' ); ?>
5
+ </ul>
6
+ <br class="clear" />
7
+ <p><?php _e( 'Select an export type from the list below to export entries. Once you have selected an export type you may select the fields you would like to export and optional filters available for each export type. When you click the export button below, Store Exporter will create a CSV file for you to save to your computer.', 'woo_ce' ); ?></p>
8
+ <form method="post" action="<?php echo add_query_arg( array( 'failed' => null, 'empty' => null, 'message' => null ) ); ?>" id="postform">
9
+ <div id="poststuff">
10
+
11
+ <div class="postbox" id="export-type">
12
+ <h3 class="hndle"><?php _e( 'Export Type', 'woo_ce' ); ?></h3>
13
+ <div class="inside">
14
+ <p class="description"><?php _e( 'Select the data type you want to export.', 'woo_ce' ); ?></p>
15
+ <table class="form-table">
16
+
17
+ <tr>
18
+ <th>
19
+ <input type="radio" id="products" name="dataset" value="products"<?php disabled( $products, 0 ); ?><?php checked( $dataset, 'products' ); ?> />
20
+ <label for="products"><?php _e( 'Products', 'woo_ce' ); ?></label>
21
+ </th>
22
+ <td>
23
+ <span class="description">(<?php echo $products; ?>)</span>
24
+ </td>
25
+ </tr>
26
+
27
+ <tr>
28
+ <th>
29
+ <input type="radio" id="categories" name="dataset" value="categories"<?php disabled( $categories, 0 ); ?><?php checked( $dataset, 'categories' ); ?> />
30
+ <label for="categories"><?php _e( 'Categories', 'woo_ce' ); ?></label>
31
+ </th>
32
+ <td>
33
+ <span class="description">(<?php echo $categories; ?>)</span>
34
+ </td>
35
+ </tr>
36
+
37
+ <tr>
38
+ <th>
39
+ <input type="radio" id="tags" name="dataset" value="tags"<?php disabled( $tags, 0 ); ?><?php checked( $dataset, 'tags' ); ?> />
40
+ <label for="tags"><?php _e( 'Tags', 'woo_ce' ); ?></label>
41
+ </th>
42
+ <td>
43
+ <span class="description">(<?php echo $tags; ?>)</span>
44
+ </td>
45
+ </tr>
46
+
47
+ <tr>
48
+ <th>
49
+ <input type="radio" id="orders" name="dataset" value="orders"<?php disabled( $orders, 0 ); ?><?php checked( $dataset, 'orders' ); ?>/>
50
+ <label for="orders"><?php _e( 'Orders', 'woo_ce' ); ?></label>
51
+ </th>
52
+ <td>
53
+ <span class="description">(<?php echo $orders; ?>)</span>
54
+ <?php if( !function_exists( 'woo_cd_admin_init' ) ) { ?>
55
+ <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
56
+ <?php } ?>
57
+ </td>
58
+ </tr>
59
+
60
+ <tr>
61
+ <th>
62
+ <input type="radio" id="customers" name="dataset" value="customers"<?php disabled( $customers, 0 ); ?><?php checked( $dataset, 'customers' ); ?>/>
63
+ <label for="customers"><?php _e( 'Customers', 'woo_ce' ); ?></label>
64
+ </th>
65
+ <td>
66
+ <span class="description">(<?php echo $customers; ?>)</span>
67
+ <?php if( !function_exists( 'woo_cd_admin_init' ) ) { ?>
68
+ <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
69
+ <?php } ?>
70
+ </td>
71
+ </tr>
72
+
73
+ <tr>
74
+ <th>
75
+ <input type="radio" id="coupons" name="dataset" value="coupons"<?php disabled( $coupons, 0 ); ?><?php checked( $dataset, 'coupons' ); ?> />
76
+ <label for="coupons"><?php _e( 'Coupons', 'woo_ce' ); ?></label>
77
+ </th>
78
+ <td>
79
+ <span class="description">(<?php echo $coupons; ?>)</span>
80
+ <?php if( !function_exists( 'woo_cd_admin_init' ) ) { ?>
81
+ <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
82
+ <?php } ?>
83
+ </td>
84
+ </tr>
85
+
86
+ </table>
87
+ <!--
88
+ <p class="submit">
89
+ <input type="submit" value="<?php _e( 'Export', 'woo_ce' ); ?>" class="button-primary" />
90
+ </p>
91
+ -->
92
+ </div>
93
+ </div>
94
+ <!-- .postbox -->
95
+
96
+ <?php if( $product_fields ) { ?>
97
+ <div id="export-products">
98
+
99
+ <div class="postbox">
100
+ <h3 class="hndle"><?php _e( 'Product Fields', 'woo_ce' ); ?></h3>
101
+ <div class="inside">
102
+ <?php if( $products ) { ?>
103
+ <p class="description"><?php _e( 'Select the Product fields you would like to export, your field selection is saved for future exports.', 'woo_ce' ); ?></p>
104
+ <p><a href="javascript:void(0)" id="products-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="products-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
105
+ <table>
106
+
107
+ <?php foreach( $product_fields as $product_field ) { ?>
108
+ <tr>
109
+ <td>
110
+ <label>
111
+ <input type="checkbox" name="product_fields[<?php echo $product_field['name']; ?>]" class="product_field"<?php checked( $product_field['default'], 1 ); ?><?php disabled( $product_field['disabled'], 1 ); ?> />
112
+ <?php echo $product_field['label']; ?>
113
+ </label>
114
+ </td>
115
+ </tr>
116
+
117
+ <?php } ?>
118
+ </table>
119
+ <p class="submit">
120
+ <input type="submit" id="export_products" value="<?php _e( 'Export Products', 'woo_ce' ); ?> " class="button-primary" />
121
+ </p>
122
+ <p class="description"><?php _e( 'Can\'t find a particular Product field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
123
+ <?php } else { ?>
124
+ <p><?php _e( 'No Products have been found.', 'woo_ce' ); ?></p>
125
+ <?php } ?>
126
+ </div>
127
+ </div>
128
+ <!-- .postbox -->
129
+
130
+ <div id="export-products-filters" class="postbox">
131
+ <h3 class="hndle"><?php _e( 'Product Filters', 'woo_ce' ); ?></h3>
132
+ <div class="inside">
133
+
134
+ <p><label><input type="checkbox" id="products-filters-categories" /> <?php _e( 'Filter Products by Product Categories', 'woo_ce' ); ?></label></p>
135
+ <div id="export-products-filters-categories" class="separator">
136
+ <?php if( $product_categories ) { ?>
137
+ <ul>
138
+ <?php foreach( $product_categories as $product_category ) { ?>
139
+ <li><label><input type="checkbox" name="product_filter_categories[<?php echo $product_category->term_id; ?>]" value="<?php echo $product_category->term_id; ?>" title="<?php printf( __( 'Term ID: %d', 'woo_ce' ), $product_category->term_id ); ?>"<?php disabled( $product_category->count, 0 ); ?> /> <?php echo woo_ce_format_product_category_label( $product_category->name, $product_category->parent_name ); ?> (<?php echo $product_category->count; ?>)</label></li>
140
+ <?php } ?>
141
+ </ul>
142
+ <p class="description"><?php _e( 'Select the Product Categories you want to filter exported Products by. Default is to include all Product Categories.', 'woo_ce' ); ?></p>
143
+ <?php } else { ?>
144
+ <p><?php _e( 'No Product Categories have been found.', 'woo_ce' ); ?></p>
145
+ <?php } ?>
146
+ </div>
147
+ <!-- #export-products-filters-categories -->
148
+
149
+ <p><label><input type="checkbox" id="products-filters-tags" /> <?php _e( 'Filter Products by Product Tags', 'woo_ce' ); ?></label></p>
150
+ <div id="export-products-filters-tags" class="separator">
151
+ <?php if( $product_tags ) { ?>
152
+ <ul>
153
+ <?php foreach( $product_tags as $product_tag ) { ?>
154
+ <li><label><input type="checkbox" name="product_filter_tags[<?php echo $product_tag->term_id; ?>]" value="<?php echo $product_tag->term_id; ?>" title="<?php printf( __( 'Term ID: %d', 'woo_ce' ), $product_tag->term_id ); ?>"<?php disabled( $product_tag->count, 0 ); ?> /> <?php echo $product_tag->name; ?> (<?php echo $product_tag->count; ?>)</label></li>
155
+ <?php } ?>
156
+ </ul>
157
+ <p class="description"><?php _e( 'Select the Product Tags you want to filter exported Products by. Default is to include all Product Tags.', 'woo_ce' ); ?></p>
158
+ <?php } else { ?>
159
+ <p><?php _e( 'No Product Tags have been found.', 'woo_ce' ); ?></p>
160
+ <?php } ?>
161
+ </div>
162
+ <!-- #export-products-filters-tags -->
163
+
164
+ <p><label><input type="checkbox" id="products-filters-status" /> <?php _e( 'Filter Products by Product Status', 'woo_ce' ); ?></label></p>
165
+ <div id="export-products-filters-status" class="separator">
166
+ <ul>
167
+ <?php foreach( $product_statuses as $key => $product_status ) { ?>
168
+ <li><label><input type="checkbox" name="product_filter_status[<?php echo $key; ?>]" value="<?php echo $key; ?>" /> <?php echo $product_status; ?></label></li>
169
+ <?php } ?>
170
+ </ul>
171
+ <p class="description"><?php _e( 'Select the Product Status options you want to filter exported Products by. Default is to include all Product Status options.', 'woo_ce' ); ?></p>
172
+ </div>
173
+ <!-- #export-products-filters-status -->
174
+
175
+ <p><label><input type="checkbox" id="products-filters-type" /> <?php _e( 'Filter Products by Product Type', 'woo_ce' ); ?></label></p>
176
+ <div id="export-products-filters-type" class="separator">
177
+ <ul>
178
+ <?php foreach( $product_types as $key => $product_type ) { ?>
179
+ <li><label><input type="checkbox" name="product_filter_type[<?php echo $key; ?>]" value="<?php echo $key; ?>" /> <?php echo woo_ce_format_product_type( $product_type['name'] ); ?> (<?php echo $product_type['count']; ?>)</label></li>
180
+ <?php } ?>
181
+ </ul>
182
+ <p class="description"><?php _e( 'Select the Product Type\'s you want to filter exported Products by. Default is to include all Product Types and Variations.', 'woo_ce' ); ?></p>
183
+ </div>
184
+ <!-- #export-products-filters-type -->
185
+
186
+ <p><label><?php _e( 'Product Sorting', 'woo_ce' ); ?></label></p>
187
+ <div>
188
+ <select name="product_orderby">
189
+ <option value="ID"<?php selected( 'ID', $product_orderby ); ?>><?php _e( 'Product ID', 'woo_ce' ); ?></option>
190
+ <option value="title"<?php selected( 'title', $product_orderby ); ?>><?php _e( 'Product Name', 'woo_ce' ); ?></option>
191
+ <option value="date"<?php selected( 'date', $product_orderby ); ?>><?php _e( 'Date Created', 'woo_ce' ); ?></option>
192
+ <option value="modified"<?php selected( 'modified', $product_orderby ); ?>><?php _e( 'Date Modified', 'woo_ce' ); ?></option>
193
+ <option value="rand"<?php selected( 'rand', $product_orderby ); ?>><?php _e( 'Random', 'woo_ce' ); ?></option>
194
+ <option value="menu_order"<?php selected( 'menu_order', $product_orderby ); ?>><?php _e( 'Sort Order', 'woo_ce' ); ?></option>
195
+ </select>
196
+ <select name="product_order">
197
+ <option value="ASC"<?php selected( 'ASC', $product_order ); ?>><?php _e( 'Ascending', 'woo_ce' ); ?></option>
198
+ <option value="DESC"<?php selected( 'DESC', $product_order ); ?>><?php _e( 'Descending', 'woo_ce' ); ?></option>
199
+ </select>
200
+ <p class="description"><?php _e( 'Select the sorting of Products within the exported file. By default this is set to export Products by Product ID in Desending order.', 'woo_ce' ); ?></p>
201
+ </div>
202
+
203
+ </div>
204
+ <!-- .inside -->
205
+ </div>
206
+ <!-- .postbox -->
207
+
208
+ </div>
209
+ <!-- #export-products -->
210
+
211
+ <?php } ?>
212
+ <div id="export-categories">
213
+
214
+ <div class="postbox">
215
+ <h3 class="hndle"><?php _e( 'Category Fields', 'woo_ce' ); ?></h3>
216
+ <div class="inside">
217
+ <p class="description"><?php _e( 'Select the Category fields you would like to export.', 'woo_ce' ); ?></p>
218
+ <p><a href="javascript:void(0)" id="categories-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="categories-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
219
+ <table>
220
+
221
+ <?php foreach( $category_fields as $category_field ) { ?>
222
+ <tr>
223
+ <td>
224
+ <label>
225
+ <input type="checkbox" name="category_fields[<?php echo $category_field['name']; ?>]" class="category_field"<?php checked( $category_field['default'], 1 ); ?><?php disabled( $category_field['disabled'], 1 ); ?> />
226
+ <?php echo $category_field['label']; ?>
227
+ </label>
228
+ </td>
229
+ </tr>
230
+
231
+ <?php } ?>
232
+ </table>
233
+ <p class="submit">
234
+ <input type="submit" id="export_categories" value="<?php _e( 'Export Categories', 'woo_ce' ); ?> " class="button-primary" />
235
+ </p>
236
+ <p class="description"><?php _e( 'Can\'t find a particular Category field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
237
+ </div>
238
+ <!-- .inside -->
239
+ </div>
240
+ <!-- .postbox -->
241
+
242
+ <div id="export-categories-filters" class="postbox">
243
+ <h3 class="hndle"><?php _e( 'Category Filters', 'woo_ce' ); ?></h3>
244
+ <div class="inside">
245
+
246
+ <p><label><?php _e( 'Category Sorting', 'woo_ce' ); ?></label></p>
247
+ <div>
248
+ <select name="category_orderby">
249
+ <option value="id"<?php selected( 'id', $category_orderby ); ?>><?php _e( 'Term ID', 'woo_ce' ); ?></option>
250
+ <option value="name"<?php selected( 'name', $category_orderby ); ?>><?php _e( 'Category Name', 'woo_ce' ); ?></option>
251
+ </select>
252
+ <select name="category_order">
253
+ <option value="ASC"<?php selected( 'ASC', $category_order ); ?>><?php _e( 'Ascending', 'woo_ce' ); ?></option>
254
+ <option value="DESC"<?php selected( 'DESC', $category_order ); ?>><?php _e( 'Descending', 'woo_ce' ); ?></option>
255
+ </select>
256
+ <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.', 'woo_ce' ); ?></p>
257
+ </div>
258
+
259
+ </div>
260
+ <!-- .inside -->
261
+ </div>
262
+ <!-- #export-categories-filters -->
263
+
264
+ </div>
265
+ <!-- #export-categories -->
266
+
267
+ <div id="export-tags">
268
+
269
+ <div class="postbox">
270
+ <h3 class="hndle"><?php _e( 'Tag Fields', 'woo_ce' ); ?></h3>
271
+ <div class="inside">
272
+ <p class="description"><?php _e( 'Select the Tag fields you would like to export.', 'woo_ce' ); ?></p>
273
+ <p><a href="javascript:void(0)" id="tags-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="tags-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
274
+ <table>
275
+
276
+ <?php foreach( $tag_fields as $tag_field ) { ?>
277
+ <tr>
278
+ <td>
279
+ <label>
280
+ <input type="checkbox" name="tag_fields[<?php echo $tag_field['name']; ?>]" class="tag_field"<?php checked( $tag_field['default'], 1 ); ?><?php disabled( $tag_field['disabled'], 1 ); ?> />
281
+ <?php echo $tag_field['label']; ?>
282
+ </label>
283
+ </td>
284
+ </tr>
285
+
286
+ <?php } ?>
287
+ </table>
288
+ <p class="submit">
289
+ <input type="submit" id="export_tags" value="<?php _e( 'Export Tags', 'woo_ce' ); ?> " class="button-primary" />
290
+ </p>
291
+ <p class="description"><?php _e( 'Can\'t find a particular Tag field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
292
+ </div>
293
+ <!-- .inside -->
294
+ </div>
295
+ <!-- .postbox -->
296
+
297
+ <div id="export-tags-filters" class="postbox">
298
+ <h3 class="hndle"><?php _e( 'Product Tag Filters', 'woo_ce' ); ?></h3>
299
+ <div class="inside">
300
+
301
+ <p><label><?php _e( 'Product Tag Sorting', 'woo_ce' ); ?></label></p>
302
+ <div>
303
+ <select name="tag_orderby">
304
+ <option value="id"<?php selected( 'id', $tag_orderby ); ?>><?php _e( 'Term ID', 'woo_ce' ); ?></option>
305
+ <option value="name"<?php selected( 'name', $tag_orderby ); ?>><?php _e( 'Tag Name', 'woo_ce' ); ?></option>
306
+ </select>
307
+ <select name="tag_order">
308
+ <option value="ASC"<?php selected( 'ASC', $tag_order ); ?>><?php _e( 'Ascending', 'woo_ce' ); ?></option>
309
+ <option value="DESC"<?php selected( 'DESC', $tag_order ); ?>><?php _e( 'Descending', 'woo_ce' ); ?></option>
310
+ </select>
311
+ <p class="description"><?php _e( 'Select the sorting of Product Tags within the exported file. By default this is set to export Product Tags by Term ID in Desending order.', 'woo_ce' ); ?></p>
312
+ </div>
313
+
314
+ </div>
315
+ <!-- .inside -->
316
+ </div>
317
+ <!-- #export-tags-filters -->
318
+
319
+ </div>
320
+ <!-- #export-tags -->
321
+
322
+ <?php if( $order_fields ) { ?>
323
+ <div id="export-orders">
324
+
325
+ <div class="postbox">
326
+ <h3 class="hndle"><?php _e( 'Order Fields', 'woo_ce' ); ?></h3>
327
+ <div class="inside">
328
+
329
+ <?php if( $orders ) { ?>
330
+ <p class="description"><?php _e( 'Select the Order fields you would like to export.', 'woo_ce' ); ?></p>
331
+ <p><a href="javascript:void(0)" id="orders-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="orders-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
332
+ <table>
333
+
334
+ <?php foreach( $order_fields as $order_field ) { ?>
335
+ <tr>
336
+ <td>
337
+ <label>
338
+ <input type="checkbox" name="order_fields[<?php echo $order_field['name']; ?>]" class="order_field"<?php checked( $order_field['default'], 1 ); ?><?php disabled( $woo_cd_exists, false ); ?> />
339
+ <?php echo $order_field['label']; ?>
340
+ </label>
341
+ </td>
342
+ </tr>
343
+
344
+ <?php } ?>
345
+ </table>
346
+ <p class="submit">
347
+ <?php if( function_exists( 'woo_cd_admin_init' ) ) { ?>
348
+ <input type="submit" id="export_orders" value="<?php _e( 'Export Orders', 'woo_ce' ); ?> " class="button-primary" />
349
+ <?php } else { ?>
350
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Orders', 'woo_ce' ); ?>" />
351
+ <?php } ?>
352
+ </p>
353
+ <p class="description"><?php _e( 'Can\'t find a particular Order field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
354
+ <?php } else { ?>
355
+ <p><?php _e( 'No Orders have been found.', 'woo_ce' ); ?></p>
356
+ <?php } ?>
357
+
358
+ </div>
359
+ </div>
360
+ <!-- .postbox -->
361
+
362
+ <div id="export-orders-filters" class="postbox">
363
+ <h3 class="hndle"><?php _e( 'Order Filters', 'woo_ce' ); ?></h3>
364
+ <div class="inside">
365
+
366
+ <?php do_action( 'woo_ce_export_order_options_before_table' ); ?>
367
+
368
+ <table class="form-table">
369
+ <?php do_action( 'woo_ce_export_order_options_table' ); ?>
370
+ </table>
371
+
372
+ <?php do_action( 'woo_ce_export_order_options_after_table' ); ?>
373
+
374
+ </div>
375
+ <!-- .inside -->
376
+ </div>
377
+ <!-- .postbox -->
378
+
379
+ </div>
380
+ <!-- #export-orders -->
381
+
382
+ <?php } ?>
383
+ <?php if( $customer_fields ) { ?>
384
+ <div class="postbox" id="export-customers">
385
+ <h3 class="hndle"><?php _e( 'Customer Fields', 'woo_ce' ); ?></h3>
386
+ <div class="inside">
387
+ <?php if( $customers ) { ?>
388
+ <p class="description"><?php _e( 'Select the Customer fields you would like to export.', 'woo_ce' ); ?></p>
389
+ <p><a href="javascript:void(0)" id="customers-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="customers-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
390
+ <table>
391
+
392
+ <?php foreach( $customer_fields as $customer_field ) { ?>
393
+ <tr>
394
+ <td>
395
+ <label>
396
+ <input type="checkbox" name="customer_fields[<?php echo $customer_field['name']; ?>]" class="customer_field"<?php checked( $customer_field['default'], 1 ); ?><?php disabled( $woo_cd_exists, false ); ?> />
397
+ <?php echo $customer_field['label']; ?>
398
+ </label>
399
+ </td>
400
+ </tr>
401
+
402
+ <?php } ?>
403
+ </table>
404
+ <p class="submit">
405
+ <?php if( function_exists( 'woo_cd_admin_init' ) ) { ?>
406
+ <input type="submit" id="export_customers" value="<?php _e( 'Export Customers', 'woo_ce' ); ?>" class="button-primary" />
407
+ <?php } else { ?>
408
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Customers', 'woo_ce' ); ?>" />
409
+ <?php } ?>
410
+ </p>
411
+ <p class="description"><?php _e( 'Can\'t find a particular Customer field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
412
+ <?php } else { ?>
413
+ <p><?php _e( 'No Customers have been found.', 'woo_ce' ); ?></p>
414
+ <?php } ?>
415
+ </div>
416
+ </div>
417
+ <!-- .postbox -->
418
+
419
+ <?php } ?>
420
+ <?php if( $coupon_fields ) { ?>
421
+ <div class="postbox" id="export-coupons">
422
+ <h3 class="hndle"><?php _e( 'Coupon Fields', 'woo_ce' ); ?></h3>
423
+ <div class="inside">
424
+ <?php if( $coupons ) { ?>
425
+ <p class="description"><?php _e( 'Select the Coupon fields you would like to export.', 'woo_ce' ); ?></p>
426
+ <p><a href="javascript:void(0)" id="coupons-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="coupons-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
427
+ <table>
428
+
429
+ <?php foreach( $coupon_fields as $coupon_field ) { ?>
430
+ <tr>
431
+ <td>
432
+ <label>
433
+ <input type="checkbox" name="coupon_fields[<?php echo $coupon_field['name']; ?>]" class="coupon_field"<?php checked( $coupon_field['default'], 1 ); ?><?php disabled( $woo_cd_exists, false ); ?> />
434
+ <?php echo $coupon_field['label']; ?>
435
+ </label>
436
+ </td>
437
+ </tr>
438
+
439
+ <?php } ?>
440
+ </table>
441
+ <p class="submit">
442
+ <?php if( function_exists( 'woo_cd_admin_init' ) ) { ?>
443
+ <input type="submit" id="export_coupons" value="<?php _e( 'Export Coupons', 'woo_ce' ); ?>" class="button-primary" />
444
+ <?php } else { ?>
445
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Coupons', 'woo_ce' ); ?>" />
446
+ <?php } ?>
447
+ </p>
448
+ <p class="description"><?php _e( 'Can\'t find a particular Coupon field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
449
+ <?php } else { ?>
450
+ <p><?php _e( 'No Coupons have been found.', 'woo_ce' ); ?></p>
451
+ <?php } ?>
452
+ </div>
453
+ </div>
454
+ <!-- .postbox -->
455
+
456
+ <?php } ?>
457
+ <div class="postbox" id="export-options">
458
+ <h3 class="hndle"><?php _e( 'Export Options', 'woo_ce' ); ?></h3>
459
+ <div class="inside">
460
+ <p class="description"><?php _e( 'You can find additional export options under the Settings tab at the top of this screen.', 'woo_ce' ); ?></p>
461
+
462
+ <?php do_action( 'woo_ce_export_options_before' ); ?>
463
+
464
+ <table class="form-table">
465
+
466
+ <?php do_action( 'woo_ce_export_options' ); ?>
467
+
468
+ <tr class="export-options product-options">
469
+ <th><label for=""><?php _e( 'Up-sells formatting', 'woo_ce' ); ?></label></th>
470
+ <td>
471
+ <label><input type="radio" name="product_upsell_formatting" value="0"<?php checked( $upsell_formatting, 0 ); ?> />&nbsp;<?php _e( 'Export Up-Sells as Product ID', 'woo_ce' ); ?></label><br />
472
+ <label><input type="radio" name="product_upsell_formatting" value="1"<?php checked( $upsell_formatting, 1 ); ?> />&nbsp;<?php _e( 'Export Up-Sells as Product SKU', 'woo_ce' ); ?></label>
473
+ <p class="description"><?php _e( 'Choose the up-sell formatting that is accepted by your WooCommerce import Plugin (e.g. Product Importer Deluxe, Product Import Suite, etc.).', 'woo_ce' ); ?></p>
474
+ </td>
475
+ </tr>
476
+
477
+ <tr class="export-options product-options">
478
+ <th><label for=""><?php _e( 'Cross-sells formatting', 'woo_ce' ); ?></label></th>
479
+ <td>
480
+ <label><input type="radio" name="product_crosssell_formatting" value="0"<?php checked( $crosssell_formatting, 0 ); ?> />&nbsp;<?php _e( 'Export Cross-Sells as Product ID', 'woo_ce' ); ?></label><br />
481
+ <label><input type="radio" name="product_crosssell_formatting" value="1"<?php checked( $crosssell_formatting, 1 ); ?> />&nbsp;<?php _e( 'Export Cross-Sells as Product SKU', 'woo_ce' ); ?></label>
482
+ <p class="description"><?php _e( 'Choose the cross-sell formatting that is accepted by your WooCommerce import Plugin (e.g. Product Importer Deluxe, Product Import Suite, etc.).', 'woo_ce' ); ?></p>
483
+ </td>
484
+ </tr>
485
+
486
+ <tr>
487
+ <th>
488
+ <label for="offset"><?php _e( 'Volume offset', 'woo_ce' ); ?></label> / <label for="limit_volume"><?php _e( 'Limit volume', 'woo_ce' ); ?></label>
489
+ </th>
490
+ <td>
491
+ <input type="text" size="3" id="offset" name="offset" value="<?php echo $offset; ?>" size="5" class="text" /> <?php _e( 'to', 'woo_ce' ); ?> <input type="text" size="3" id="limit_volume" name="limit_volume" value="<?php echo $limit_volume; ?>" size="5" class="text" />
492
+ <p class="description"><?php _e( 'Volume offset and limit allows for partial exporting of an export type (e.g. records 0 to 500, etc.). This is useful when encountering timeout and/or memory errors during the a large or memory intensive export. To be used effectively both fields must be filled. By default this is not used and is left empty.', 'woo_ce' ); ?></p>
493
+ </td>
494
+ </tr>
495
+
496
+ <?php do_action( 'woo_ce_export_options_table_after' ); ?>
497
+
498
+ </table>
499
+
500
+ <?php do_action( 'woo_ce_export_options_after' ); ?>
501
+
502
+ </div>
503
+ </div>
504
+ <!-- .postbox -->
505
+
506
+ </div>
507
+ <!-- #poststuff -->
508
+ <input type="hidden" name="action" value="export" />
509
+ </form>
510
+
511
+ <?php do_action( 'woo_ce_export_after_form' ); ?>
templates/admin/woo-admin_ce-export_overview.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="overview-left">
2
+
3
+ <h3><a href="<?php echo add_query_arg( 'tab', 'export' ); ?>"><?php _e( 'Export', 'woo_ce' ); ?></a></h3>
4
+ <p><?php _e( 'Export store details out of WooCommerce into a CSV-formatted file.', 'woo_ce' ); ?></p>
5
+ <ul class="ul-disc">
6
+ <li>
7
+ <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-products"><?php _e( 'Export Products', 'woo_ce' ); ?></a>
8
+ </li>
9
+ <li>
10
+ <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-categories"><?php _e( 'Export Categories', 'woo_ce' ); ?></a>
11
+ </li>
12
+ <li>
13
+ <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-tags"><?php _e( 'Export Tags', 'woo_ce' ); ?></a>
14
+ </li>
15
+ <li>
16
+ <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-orders"><?php _e( 'Export Orders', 'woo_ce' ); ?></a>
17
+ <?php if( !function_exists( 'woo_cd_admin_init' ) ) { ?>
18
+ <span class="description">(<?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?>)</span>
19
+ <?php } ?>
20
+ </li>
21
+ <li>
22
+ <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-customers"><?php _e( 'Export Customers', 'woo_ce' ); ?></a>
23
+ <?php if( !function_exists( 'woo_cd_admin_init' ) ) { ?>
24
+ <span class="description">(<?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?>)</span>
25
+ <?php } ?>
26
+ </li>
27
+ <li>
28
+ <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-coupons"><?php _e( 'Export Coupons', 'woo_ce' ); ?></a>
29
+ <?php if( !function_exists( 'woo_cd_admin_init' ) ) { ?>
30
+ <span class="description">(<?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?>)</span>
31
+ <?php } ?>
32
+ </li>
33
+ </ul>
34
+
35
+ <h3><a href="<?php echo add_query_arg( 'tab', 'archive' ); ?>"><?php _e( 'Archives', 'woo_ce' ); ?></a></h3>
36
+ <p><?php _e( 'Download copies of prior store exports.', 'woo_ce' ); ?></p>
37
+
38
+ <h3><a href="<?php echo add_query_arg( 'tab', 'settings' ); ?>"><?php _e( 'Settings', 'woo_ce' ); ?></a></h3>
39
+ <p><?php _e( 'Manage CSV export options from a single detailed screen.', 'woo_ce' ); ?></p>
40
+
41
+ <h3><a href="<?php echo add_query_arg( 'tab', 'tools' ); ?>"><?php _e( 'Tools', 'woo_ce' ); ?></a></h3>
42
+ <p><?php _e( 'Export tools for WooCommerce.', 'woo_ce' ); ?></p>
43
+
44
+ <hr />
45
+ <?php if( !function_exists( 'woo_cd_admin_init' ) ) { ?>
46
+ <label class="description">
47
+ <input type="checkbox" disabled="disabled" /> <?php _e( 'Jump to Export screen in the future', 'woo_ce' ); ?>
48
+ <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
49
+ </label>
50
+ <?php } else { ?>
51
+ <form id="skip_overview_form" method="post">
52
+ <label><input type="checkbox" id="skip_overview" name="skip_overview"<?php checked( $skip_overview ); ?> /> <?php _e( 'Jump to Export screen in the future', 'woo_ce' ); ?></label>
53
+ <input type="hidden" name="action" value="skip_overview" />
54
+ </form>
55
+ <?php } ?>
56
+
57
+ </div>
58
+ <!-- .overview-left -->
59
+ <?php if( !function_exists( 'woo_cd_admin_init' ) ) { ?>
60
+ <div class="welcome-panel overview-right">
61
+ <h3>
62
+ <!-- <span><a href="#"><attr title="<?php _e( 'Dismiss this message', 'woo_ce' ); ?>"><?php _e( 'Dismiss', 'woo_ce' ); ?></attr></a></span> -->
63
+ <?php _e( 'Upgrade to Pro', 'woo_ce' ); ?>
64
+ </h3>
65
+ <p class="clear"><?php _e( 'Upgrade to Store Exporter Deluxe to unlock business focused e-commerce features within Store Exporter, including:', 'woo_ce' ); ?></p>
66
+ <ul class="ul-disc">
67
+ <li><?php _e( 'Select export date ranges', 'woo_ce' ); ?></li>
68
+ <li><?php _e( 'Export Orders', 'woo_ce' ); ?></li>
69
+ <li><?php _e( 'Select Order fields to export', 'woo_ce' ); ?></li>
70
+ <li><?php _e( 'Export custom Order and Order Item meta', 'woo_ce' ); ?></li>
71
+ <li><?php _e( 'Export Customers', 'woo_ce' ); ?></li>
72
+ <li><?php _e( 'Select Customer fields to export', 'woo_ce' ); ?></li>
73
+ <li><?php _e( 'Export Coupons', 'woo_ce' ); ?></li>
74
+ <li><?php _e( 'Select Coupon fields to export', 'woo_ce' ); ?></li>
75
+ <li><?php _e( 'CRON / Scheduled Exports', 'woo_ce' ); ?></li>
76
+ <li><?php _e( 'Export to XML', 'woo_ce' ); ?></li>
77
+ <li><?php _e( 'Premium Support', 'woo_ce' ); ?></li>
78
+ </ul>
79
+ <p>
80
+ <a href="<?php echo $woo_cd_url; ?>" target="_blank" class="button"><?php _e( 'More Features', 'woo_ce' ); ?></a>&nbsp;
81
+ <a href="<?php echo $woo_cd_url; ?>" target="_blank" class="button button-primary"><?php _e( 'Buy Now', 'woo_ce' ); ?></a>
82
+ </p>
83
+ </div>
84
+ <!-- .overview-right -->
85
+ <?php } ?>
templates/admin/woo-admin_ce-export_settings.php ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <ul class="subsubsub">
2
+ <li><a href="#general-settings"><?php _e( 'General Settings', 'woo_ce' ); ?></a> |</li>
3
+ <li><a href="#csv-settings"><?php _e( 'CSV Settings', 'woo_ce' ); ?></a></li>
4
+ <?php do_action( 'woo_ce_export_settings_top' ); ?>
5
+ </ul>
6
+ <!-- .subsubsub -->
7
+ <form method="post">
8
+ <table class="form-table">
9
+ <tbody>
10
+
11
+ <?php do_action( 'woo_ce_export_settings_before' ); ?>
12
+
13
+ <tr id="general-settings">
14
+ <td colspan="2" style="padding:0;">
15
+ <h3><?php _e( 'General Settings', 'woo_ce' ); ?></h3>
16
+ </td>
17
+ </tr>
18
+
19
+ <tr valign="top">
20
+ <th scope="row"><label for="export_filename"><?php _e( 'Export filename', 'woo_ce' ); ?></label></th>
21
+ <td>
22
+ <input name="export_filename" type="text" id="export_filename" value="<?php echo $export_filename; ?>" class="regular-text code" />
23
+ <p class="description"><?php _e( 'The filename of the exported export type. Tags can be used: ', 'woo_ce' ); ?> <code>%dataset%</code>, <code>%date%</code>, <code>%time%</code>, <code>%store_name%</code>.</p>
24
+ </td>
25
+ </tr>
26
+
27
+ <tr>
28
+ <th>
29
+ <label for="delete_temporary_csv"><?php _e( 'Enable archives', 'woo_ce' ); ?></label>
30
+ </th>
31
+ <td>
32
+ <select id="delete_temporary_csv" name="delete_temporary_csv">
33
+ <option value="0"<?php selected( $delete_csv, 0 ); ?>><?php _e( 'Yes', 'woo_ce' ); ?></option>
34
+ <option value="1"<?php selected( $delete_csv, 1 ); ?>><?php _e( 'No', 'woo_ce' ); ?></option>
35
+ </select>
36
+ <p class="description"><?php _e( 'Save copies of CSV exports to the WordPress Media for downloading later. By default this option is turned on.', 'woo_ce' ); ?></p>
37
+ </td>
38
+ </tr>
39
+
40
+ <tr>
41
+ <th>
42
+ <label for="encoding"><?php _e( 'Character encoding', 'woo_ce' ); ?></label>
43
+ </th>
44
+ <td>
45
+ <?php if( $file_encodings ) { ?>
46
+ <select id="encoding" name="encoding">
47
+ <option value=""><?php _e( 'System default', 'woo_ce' ); ?></option>
48
+ <?php foreach( $file_encodings as $key => $chr ) { ?>
49
+ <option value="<?php echo $chr; ?>"<?php selected( $chr, $encoding ); ?>><?php echo $chr; ?></option>
50
+ <?php } ?>
51
+ </select>
52
+ <?php } else { ?>
53
+ <p class="description"><?php _e( 'Character encoding options are unavailable in PHP 4, contact your hosting provider to update your site install to use PHP 5 or higher.', 'woo_ce' ); ?></p>
54
+ <?php } ?>
55
+ </td>
56
+ </tr>
57
+
58
+ <tr>
59
+ <th><?php _e( 'Date format', 'woo_ce' ); ?></th>
60
+ <td>
61
+ <fieldset>
62
+ <label title="F j, Y"><input type="radio" name="date_format" value="F j, Y"<?php checked( $date_format, 'F j, Y' ); ?>> <span><?php echo date( 'F j, Y' ); ?></span></label><br>
63
+ <label title="Y/m/d"><input type="radio" name="date_format" value="Y/m/d"<?php checked( $date_format, 'Y/m/d' ); ?>> <span><?php echo date( 'Y/m/d' ); ?></span></label><br>
64
+ <label title="m/d/Y"><input type="radio" name="date_format" value="m/d/Y"<?php checked( $date_format, 'm/d/Y' ); ?>> <span><?php echo date( 'm/d/Y' ); ?></span></label><br>
65
+ <label title="d/m/Y"><input type="radio" name="date_format" value="d/m/Y"<?php checked( $date_format, 'd/m/Y' ); ?>> <span><?php echo date( 'd/m/Y' ); ?></span></label><br>
66
+ <!--
67
+ <label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"> Custom: </label><input type="text" name="date_format_custom" value="F j, Y" class="small-text"> <span class="example"> January 6, 2014</span> <span class="spinner"></span>
68
+ <p><a href="http://codex.wordpress.org/Formatting_Date_and_Time"><?php _e( 'Documentation on date and time formatting', 'woo_ce' ); ?></a>.</p>
69
+ -->
70
+ </fieldset>
71
+ <p class="description"><?php _e( 'The date format option affects how date\'s are presented within your CSV file. Default is set to DD/MM/YYYY.', 'woo_ce' ); ?></p>
72
+ </td>
73
+ </tr>
74
+
75
+ <?php if( !ini_get( 'safe_mode' ) ) { ?>
76
+ <tr>
77
+ <th>
78
+ <label for="timeout"><?php _e( 'Script timeout', 'woo_ce' ); ?></label>
79
+ </th>
80
+ <td>
81
+ <select id="timeout" name="timeout">
82
+ <option value="600"<?php selected( $timeout, 600 ); ?>><?php printf( __( '%s minutes', 'woo_ce' ), 10 ); ?></option>
83
+ <option value="1800"<?php selected( $timeout, 1800 ); ?>><?php printf( __( '%s minutes', 'woo_ce' ), 30 ); ?></option>
84
+ <option value="3600"<?php selected( $timeout, 3600 ); ?>><?php printf( __( '%s hour', 'woo_ce' ), 1 ); ?></option>
85
+ <option value="0"<?php selected( $timeout, 0 ); ?>><?php _e( 'Unlimited', 'woo_ce' ); ?></option>
86
+ </select>
87
+ <p class="description"><?php _e( 'Script timeout defines how long Store Exporter is \'allowed\' to process your CSV file, once the time limit is reached the export process halts.', 'woo_ce' ); ?></p>
88
+ </td>
89
+ </tr>
90
+ <?php } ?>
91
+
92
+ <tr id="csv-settings">
93
+ <td colspan="2" style="padding:0;">
94
+ <hr />
95
+ <h3><?php _e( 'CSV Settings', 'woo_ce' ); ?></h3>
96
+ </td>
97
+ </tr>
98
+
99
+ <tr>
100
+ <th>
101
+ <label for="delimiter"><?php _e( 'Field delimiter', 'woo_ce' ); ?></label>
102
+ </th>
103
+ <td>
104
+ <input type="text" size="3" id="delimiter" name="delimiter" value="<?php echo $delimiter; ?>" maxlength="1" class="text" />
105
+ <p class="description"><?php _e( 'The field delimiter is the character separating each cell in your CSV. This is typically the \',\' (comma) character.', 'woo_pc' ); ?></p>
106
+ </td>
107
+ </tr>
108
+
109
+ <tr>
110
+ <th>
111
+ <label for="category_separator"><?php _e( 'Category separator', 'woo_ce' ); ?></label>
112
+ </th>
113
+ <td>
114
+ <input type="text" size="3" id="category_separator" name="category_separator" value="<?php echo $category_separator; ?>" maxlength="1" class="text" />
115
+ <p class="description"><?php _e( 'The Product Category separator allows you to assign individual Products to multiple Product Categories/Tags/Images at a time. It is suggested to use the \'|\' (vertical pipe) character between each item. For instance: <code>Clothing|Mens|Shirts</code>.', 'woo_ce' ); ?></p>
116
+ </td>
117
+ </tr>
118
+
119
+ <tr>
120
+ <th>
121
+ <label for="bom"><?php _e( 'Add BOM character', 'woo_ce' ); ?></label>
122
+ </th>
123
+ <td>
124
+ <select id="bom" name="bom">
125
+ <option value="1"<?php selected( $bom, 1 ); ?>><?php _e( 'Yes', 'woo_ce' ); ?></option>
126
+ <option value="0"<?php selected( $bom, 0 ); ?>><?php _e( 'No', 'woo_ce' ); ?></option>
127
+ </select>
128
+ <p class="description"><?php _e( 'Mark the CSV file as UTF8 by adding a byte order mark (BOM) to the export, useful for non-English character sets.', 'woo_ce' ); ?></p>
129
+ </td>
130
+ </tr>
131
+
132
+ <tr>
133
+ <th>
134
+ <label for="escape_formatting"><?php _e( 'Field escape formatting', 'woo_ce' ); ?></label>
135
+ </th>
136
+ <td>
137
+ <label><input type="radio" name="escape_formatting" value="all"<?php checked( $escape_formatting, 'all' ); ?> />&nbsp;<?php _e( 'Escape all fields', 'woo_ce' ); ?></label><br />
138
+ <label><input type="radio" name="escape_formatting" value="excel"<?php checked( $escape_formatting, 'excel' ); ?> />&nbsp;<?php _e( 'Escape fields as Excel would', 'woo_ce' ); ?></label>
139
+ <p class="description"><?php _e( 'Choose the field escape format that suits your spreadsheet software (e.g. Excel).', 'woo_ce' ); ?></p>
140
+ </td>
141
+ </tr>
142
+
143
+ <?php do_action( 'woo_ce_export_settings_after' ); ?>
144
+
145
+ </tbody>
146
+ </table>
147
+ <p class="submit">
148
+ <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e( 'Save Changes', 'woo_ce' ); ?>" />
149
+ </p>
150
+
151
+ <input type="hidden" name="action" value="save" />
152
+ </form>
153
+ <?php do_action( 'woo_ce_export_settings_bottom' ); ?>
templates/admin/woo-admin_ce-export_tools.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h3><?php _e( 'WooCommerce Tools', 'woo_ce' ); ?></h3>
2
+ <div id="poststuff">
3
+
4
+ <div class="postbox">
5
+ <h3 class="hndle"><?php _e( 'Tools', 'woo_pd' ); ?></h3>
6
+ <div class="inside">
7
+ <table class="form-table">
8
+
9
+ <tr>
10
+ <td>
11
+ <a href="<?php echo $woo_pd_url; ?>"<?php echo $woo_pd_target; ?>><?php _e( 'Import Products from CSV', 'woo_ce' ); ?></a>
12
+ <p class="description"><?php _e( 'Use Product Importer Deluxe to import Product changes back into your store.', 'woo_ce' ); ?></p>
13
+ </td>
14
+ </tr>
15
+
16
+ </table>
17
+ </div>
18
+ </div>
19
+ <!-- .postbox -->
20
+
21
+ </div>
22
+ <!-- #poststuff -->
templates/admin/woo-admin_ce-media_csv_file.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="postbox-container">
2
+ <div class="postbox">
3
+ <h3 class="hndle"><?php _e( 'CSV File', 'woo_ce' ); ?></h3>
4
+ <div class="inside">
5
+ <textarea style="font:12px Consolas, Monaco, Courier, monospace; width:100%; height:200px;"><?php echo $contents; ?></textarea>
6
+ </div>
7
+ <!-- .inside -->
8
+ </div>
9
+ <!-- .postbox -->
10
+
11
+ </div>
12
+ <!-- .postbox-container -->
templates/admin/woo-admin_ce-media_export_details.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <table class="widefat" style="font-family:monospace;">
2
+ <thead>
3
+
4
+ <tr>
5
+ <th colspan="2"><?php _e( 'Export Details', 'woo_ce' ); ?></th>
6
+ </tr>
7
+
8
+ </thead>
9
+ <tbody>
10
+
11
+ <tr>
12
+ <th style="width:20%;"><?php _e( 'Export type', 'woo_ce' ); ?></th>
13
+ <td><?php echo woo_ce_export_type_label( $export_type ); ?></td>
14
+ </tr>
15
+ <tr>
16
+ <th><?php _e( 'Filepath', 'woo_ce' ); ?></th>
17
+ <td><?php echo $filepath; ?></td>
18
+ </tr>
19
+ <tr>
20
+ <th><?php _e( 'Total columns', 'woo_ce' ); ?></th>
21
+ <td><?php echo ( ( $columns != false ) ? $columns : '-' ); ?></td>
22
+ </tr>
23
+ <tr>
24
+ <th><?php _e( 'Total rows', 'woo_ce' ); ?></th>
25
+ <td><?php echo ( ( $rows != false ) ? $rows : '-' ); ?></td>
26
+ </tr>
27
+ <tr>
28
+ <th><?php _e( 'Process time', 'woo_ce' ); ?></th>
29
+ <td><?php echo ( ( ( $start_time != false ) && ( $end_time != false ) ) ? woo_ce_display_time_elapsed( $start_time, $end_time ) : '-' ); ?></td>
30
+ </tr>
31
+ <tr>
32
+ <th><?php _e( 'Idle memory usage (start)', 'woo_ce' ); ?></th>
33
+ <td><?php echo ( ( $idle_memory_start != false ) ? woo_ce_display_memory( $idle_memory_start ) : '-' ); ?></td>
34
+ </tr>
35
+ <tr>
36
+ <th><?php _e( 'Memory usage prior to loading export type', 'woo_ce' ); ?></th>
37
+ <td><?php echo ( ( $data_memory_start != false ) ? woo_ce_display_memory( $data_memory_start ) : '-' ); ?></td>
38
+ </tr>
39
+ <tr>
40
+ <th><?php _e( 'Memory usage after loading export type', 'woo_ce' ); ?></th>
41
+ <td><?php echo ( ( $data_memory_end != false ) ? woo_ce_display_memory( $data_memory_end ) : '-' ); ?></td>
42
+ </tr>
43
+ <tr>
44
+ <th><?php _e( 'Memory usage at render time', 'woo_ce' ); ?></th>
45
+ <td>-</td>
46
+ </tr>
47
+ <tr>
48
+ <th><?php _e( 'Idle memory usage (end)', 'woo_ce' ); ?></th>
49
+ <td><?php echo ( ( $idle_memory_end != false ) ? woo_ce_display_memory( $idle_memory_end ) : '-' ); ?></td>
50
+ </tr>
51
+
52
+ </tbody>
53
+ </table>
54
+ <br />
templates/admin/woocommerce-admin_dashboard_vm-plugins.css CHANGED
@@ -33,9 +33,6 @@
33
  .woo_vm_version_table td.status .yellow {
34
  color:#e66f00;
35
  }
36
- #woo_vm_status_widget p {
37
- font-size:12px;
38
- }
39
  #woo_vm_status_widget .message {
40
  color:#000;
41
  font-size:12px;
33
  .woo_vm_version_table td.status .yellow {
34
  color:#e66f00;
35
  }
 
 
 
36
  #woo_vm_status_widget .message {
37
  color:#000;
38
  font-size:12px;