WooCommerce – Store Exporter - Version 1.8.4

Version Description

  • Fixed: Privilege escalation vulnerability (thanks jamesgol)
Download this release

Release Info

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

Version 1.8.4

Files changed (63) hide show
  1. common/common.php +95 -0
  2. exporter.php +570 -0
  3. includes/admin.php +893 -0
  4. includes/brand.php +148 -0
  5. includes/category.php +202 -0
  6. includes/commission.php +298 -0
  7. includes/common-dashboard_widgets.php +56 -0
  8. includes/coupon.php +205 -0
  9. includes/customer.php +301 -0
  10. includes/export-csv.php +49 -0
  11. includes/formatting.php +599 -0
  12. includes/functions.php +1002 -0
  13. includes/install.php +42 -0
  14. includes/legacy.php +10 -0
  15. includes/order.php +1636 -0
  16. includes/product.php +1697 -0
  17. includes/product_vendor.php +125 -0
  18. includes/settings.php +565 -0
  19. includes/shipping_class.php +96 -0
  20. includes/subscription.php +244 -0
  21. includes/tag.php +168 -0
  22. includes/user.php +344 -0
  23. js/jquery-ui.js +48 -0
  24. js/jquery.chosen.js +988 -0
  25. js/jquery.csvToTable.js +154 -0
  26. js/jquery.timepicker.js +2244 -0
  27. js/ui-datepicker.js +84 -0
  28. languages/woocommerce-exporter-en_GB.mo +0 -0
  29. languages/woocommerce-exporter-en_GB.po +97 -0
  30. license.txt +281 -0
  31. readme.txt +607 -0
  32. templates/admin/chosen-sprite.png +0 -0
  33. templates/admin/chosen.css +397 -0
  34. templates/admin/export.css +105 -0
  35. templates/admin/export.js +514 -0
  36. templates/admin/images/animated-overlay.gif +0 -0
  37. templates/admin/images/progress.gif +0 -0
  38. templates/admin/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  39. templates/admin/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  40. templates/admin/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  41. templates/admin/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  42. templates/admin/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  43. templates/admin/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  44. templates/admin/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  45. templates/admin/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  46. templates/admin/images/ui-icons_222222_256x240.png +0 -0
  47. templates/admin/images/ui-icons_2e83ff_256x240.png +0 -0
  48. templates/admin/images/ui-icons_454545_256x240.png +0 -0
  49. templates/admin/images/ui-icons_888888_256x240.png +0 -0
  50. templates/admin/images/ui-icons_cd0a0a_256x240.png +0 -0
  51. templates/admin/jquery-csvtable.css +40 -0
  52. templates/admin/jquery-ui-datepicker.css +347 -0
  53. templates/admin/jquery-ui-timepicker.css +12 -0
  54. templates/admin/media-csv_file.php +12 -0
  55. templates/admin/media-export_details.php +58 -0
  56. templates/admin/tabs-archive.php +80 -0
  57. templates/admin/tabs-export.php +990 -0
  58. templates/admin/tabs-fields.php +29 -0
  59. templates/admin/tabs-overview.php +135 -0
  60. templates/admin/tabs-settings.php +168 -0
  61. templates/admin/tabs-tools.php +30 -0
  62. templates/admin/tabs.php +13 -0
  63. templates/admin/woocommerce-admin_dashboard_vm-plugins.css +55 -0
common/common.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
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() ) {
18
+
19
+ /* Start of: WordPress Administration */
20
+
21
+ // Load Dashboard widgets
22
+ include_once( WOO_CE_PATH . 'includes/common-dashboard_widgets.php' );
23
+
24
+ /* End of: WordPress Administration */
25
+
26
+ }
27
+
28
+ if( !function_exists( 'woo_get_action' ) ) {
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
+
42
+ }
43
+ }
44
+
45
+ if( !function_exists( 'woo_is_wpsc_activated' ) ) {
46
+ function woo_is_wpsc_activated() {
47
+
48
+ if( class_exists( 'WP_eCommerce' ) || defined( 'WPSC_VERSION' ) )
49
+ return true;
50
+
51
+ }
52
+ }
53
+
54
+ if( !function_exists( 'woo_is_woo_activated' ) ) {
55
+ function woo_is_woo_activated() {
56
+
57
+ if( class_exists( 'Woocommerce' ) )
58
+ return true;
59
+
60
+ }
61
+ }
62
+
63
+ if( !function_exists( 'woo_is_jigo_activated' ) ) {
64
+ function woo_is_jigo_activated() {
65
+
66
+ if( function_exists( 'jigoshop_init' ) )
67
+ return true;
68
+
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
+ }
91
+ return $version;
92
+
93
+ }
94
+ }
95
+ ?>
exporter.php ADDED
@@ -0,0 +1,570 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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.8.4
7
+ Author: Visser Labs
8
+ Author URI: http://www.visser.com.au/about/
9
+ License: GPL2
10
+ Text Domain: woocommerce-exporter
11
+ */
12
+
13
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
+
15
+ define( 'WOO_CE_DIRNAME', basename( dirname( __FILE__ ) ) );
16
+ define( 'WOO_CE_RELPATH', basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ) );
17
+ define( 'WOO_CE_PATH', plugin_dir_path( __FILE__ ) );
18
+ define( 'WOO_CE_PREFIX', 'woo_ce' );
19
+
20
+ // Turn this on to enable additional debugging options at export time
21
+ define( 'WOO_CE_DEBUG', false );
22
+
23
+ // Avoid conflicts if Store Exporter Deluxe is activated
24
+ include_once( WOO_CE_PATH . 'common/common.php' );
25
+ if( defined( 'WOO_CD_PREFIX' ) == false )
26
+ include_once( WOO_CE_PATH . 'includes/functions.php' );
27
+
28
+ function woo_ce_i18n() {
29
+
30
+ $locale = apply_filters( 'plugin_locale', get_locale(), 'woocommerce-exporter' );
31
+ load_plugin_textdomain( 'woocommerce-exporter', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
32
+
33
+ }
34
+ add_action( 'init', 'woo_ce_i18n' );
35
+
36
+ if( is_admin() ) {
37
+
38
+ /* Start of: WordPress Administration */
39
+
40
+ // Register our install script for first time install
41
+ include_once( WOO_CE_PATH . 'includes/install.php' );
42
+ register_activation_hook( __FILE__, 'woo_ce_install' );
43
+
44
+ // Initial scripts and export process
45
+ function woo_ce_admin_init() {
46
+
47
+ global $export, $wp_roles;
48
+
49
+ // Now is the time to de-activate Store Exporter if Store Exporter Deluxe is activated
50
+ if( defined( 'WOO_CD_PREFIX' ) ) {
51
+ include_once( WOO_CE_PATH . 'includes/install.php' );
52
+ woo_ce_deactivate_ce();
53
+ return;
54
+ }
55
+
56
+ // Check the User has the activate_plugins capability
57
+ if( current_user_can( 'activate_plugins' ) ) {
58
+
59
+ // Detect if any known conflict Plugins are activated
60
+
61
+ // WooCommerce Subscriptions Exporter - http://codecanyon.net/item/woocommerce-subscription-exporter/6569668
62
+ if( function_exists( 'wc_subs_exporter_admin_init' ) ) {
63
+ $message = sprintf( __( '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. <a href="%s" target="_blank">Need help?</a>', 'woocommerce-exporter' ), $troubleshooting_url );
64
+ woo_cd_admin_notice( $message, 'error', array( 'plugins.php', 'admin.php' ) );
65
+ }
66
+
67
+ }
68
+
69
+ // Check the User has the view_woocommerce_reports capability
70
+ if( current_user_can( 'view_woocommerce_reports' ) == false )
71
+ return;
72
+
73
+ // Check that we are on the Store Exporter screen
74
+ $page = ( isset($_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : false );
75
+ if( $page != strtolower( WOO_CE_PREFIX ) )
76
+ return;
77
+
78
+ // Detect other platform versions
79
+ woo_ce_detect_non_woo_install();
80
+
81
+ // Process any pre-export notice confirmations
82
+ $action = ( function_exists( 'woo_get_action' ) ? woo_get_action() : false );
83
+ switch( $action ) {
84
+
85
+ // Prompt on Export screen when insufficient memory (less than 64M is allocated)
86
+ case 'dismiss_memory_prompt':
87
+ // We need to verify the nonce.
88
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_dismiss_memory_prompt' ) ) {
89
+ woo_ce_update_option( 'dismiss_memory_prompt', 1 );
90
+ $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
91
+ wp_redirect( $url );
92
+ exit();
93
+ }
94
+ break;
95
+
96
+ // Prompt on Export screen when PHP configuration option max_execution_time cannot be increased
97
+ case 'dismiss_execution_time_prompt':
98
+ // We need to verify the nonce.
99
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_dismiss_execution_time_prompt' ) ) {
100
+ woo_ce_update_option( 'dismiss_execution_time_prompt', 1 );
101
+ $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
102
+ wp_redirect( $url );
103
+ exit();
104
+ }
105
+ break;
106
+
107
+ // Prompt on Export screen when insufficient memory (less than 64M is allocated)
108
+ case 'dismiss_php_legacy':
109
+ // We need to verify the nonce.
110
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_dismiss_php_legacy' ) ) {
111
+ woo_ce_update_option( 'dismiss_php_legacy', 1 );
112
+ $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
113
+ wp_redirect( $url );
114
+ exit();
115
+ }
116
+ break;
117
+
118
+ case 'dismiss_subscription_prompt':
119
+ // We need to verify the nonce.
120
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_dismiss_subscription_prompt' ) ) {
121
+ woo_ce_update_option( 'dismiss_subscription_prompt', 1 );
122
+ $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
123
+ wp_redirect( $url );
124
+ exit();
125
+ }
126
+ break;
127
+
128
+ // Save skip overview preference
129
+ case 'skip_overview':
130
+ if( !empty( $_POST ) && check_admin_referer( 'skip_overview', 'woo_ce_skip_overview' ) ) {
131
+ $skip_overview = false;
132
+ if( isset( $_POST['skip_overview'] ) )
133
+ $skip_overview = 1;
134
+ woo_ce_update_option( 'skip_overview', $skip_overview );
135
+
136
+ if( $skip_overview == 1 ) {
137
+ $url = add_query_arg( array( 'tab' => 'export', '_wpnonce' => null ) );
138
+ wp_redirect( $url );
139
+ exit();
140
+ }
141
+ }
142
+ break;
143
+
144
+ // This is where the magic happens
145
+ case 'export':
146
+
147
+ // Make sure we play nice with other WooCommerce and WordPress exporters
148
+ if( !isset( $_POST['woo_ce_export'] ) )
149
+ return;
150
+
151
+ check_admin_referer( 'manual_export', 'woo_ce_export' );
152
+
153
+ // Set up the basic export options
154
+ $export = new stdClass();
155
+ $export->cron = 0;
156
+ $export->scheduled_export = 0;
157
+ $export->start_time = time();
158
+ $export->idle_memory_start = woo_ce_current_memory_usage();
159
+ $export->delete_file = woo_ce_get_option( 'delete_file', 1 );
160
+ $export->encoding = woo_ce_get_option( 'encoding', get_option( 'blog_charset', 'UTF-8' ) );
161
+ // Reset the Encoding if corrupted
162
+ if( $export->encoding == '' || $export->encoding == false || $export->encoding == 'System default' ) {
163
+ woo_ce_error_log( sprintf( 'Warning: %s', __( 'Encoding export option was corrupted, defaulted to UTF-8', 'woo_ce' ) ) );
164
+ $export->encoding = 'UTF-8';
165
+ woo_ce_update_option( 'encoding', 'UTF-8' );
166
+ }
167
+ $export->delimiter = woo_ce_get_option( 'delimiter', ',' );
168
+ // Reset the Delimiter if corrupted
169
+ if( $export->delimiter == '' || $export->delimiter == false ) {
170
+ woo_ce_error_log( sprintf( 'Warning: %s', __( 'Delimiter export option was corrupted, defaulted to ,', 'woo_ce' ) ) );
171
+ $export->delimiter = ',';
172
+ woo_ce_update_option( 'delimiter', ',' );
173
+ }
174
+ $export->category_separator = woo_ce_get_option( 'category_separator', '|' );
175
+ // Reset the Category Separator if corrupted
176
+ if( $export->category_separator == '' || $export->category_separator == false ) {
177
+ woo_ce_error_log( sprintf( 'Warning: %s', __( 'Category Separator export option was corrupted, defaulted to |', 'woo_ce' ) ) );
178
+ $export->category_separator = '|';
179
+ woo_ce_update_option( 'category_separator', '|' );
180
+ }
181
+ $export->bom = woo_ce_get_option( 'bom', 1 );
182
+ $export->escape_formatting = woo_ce_get_option( 'escape_formatting', 'all' );
183
+ // Reset the Escape Formatting if corrupted
184
+ if( $export->escape_formatting == '' || $export->escape_formatting == false ) {
185
+ woo_ce_error_log( sprintf( 'Warning: %s', __( 'Escape Formatting export option was corrupted, defaulted to all', 'woo_ce' ) ) );
186
+ $export->escape_formatting = 'all';
187
+ woo_ce_update_option( 'escape_formatting', 'all' );
188
+ }
189
+ $export->date_format = woo_ce_get_option( 'date_format', 'd/m/Y' );
190
+ // Reset the Date Format if corrupted
191
+ if( $export->date_format == '1' || $export->date_format == '' || $export->date_format == false ) {
192
+ woo_ce_error_log( sprintf( 'Warning: %s', __( 'Date Format export option was corrupted, defaulted to d/m/Y', 'woo_ce' ) ) );
193
+ $export->date_format = 'd/m/Y';
194
+ woo_ce_update_option( 'date_format', 'd/m/Y' );
195
+ }
196
+
197
+ // Save export option changes made on the Export screen
198
+ $export->limit_volume = ( isset( $_POST['limit_volume'] ) ? sanitize_text_field( $_POST['limit_volume'] ) : '' );
199
+ woo_ce_update_option( 'limit_volume', $export->limit_volume );
200
+ if( $export->limit_volume == '' )
201
+ $export->limit_volume = -1;
202
+ $export->offset = ( isset( $_POST['offset'] ) ? sanitize_text_field( $_POST['offset'] ) : '' );
203
+ woo_ce_update_option( 'offset', $export->offset );
204
+ if( $export->offset == '' )
205
+ $export->offset = 0;
206
+
207
+ // Set default values for all export options to be later passed onto the export process
208
+ $export->fields = array();
209
+ $export->fields_order = false;
210
+ $export->export_format = 'csv';
211
+
212
+ // Product sorting
213
+ $export->product_categories = false;
214
+ $export->product_tags = false;
215
+ $export->product_status = false;
216
+ $export->product_type = false;
217
+ $export->product_orderby = false;
218
+ $export->product_order = false;
219
+ $export->gallery_formatting = false;
220
+ $export->upsell_formatting = false;
221
+ $export->crosssell_formatting = false;
222
+
223
+ // Category sorting
224
+ $export->category_orderby = false;
225
+ $export->category_order = false;
226
+
227
+ // Tag sorting
228
+ $export->tag_orderby = false;
229
+ $export->tag_order = false;
230
+
231
+ // User sorting
232
+ $export->user_orderby = false;
233
+ $export->user_order = false;
234
+
235
+ $export->type = ( isset( $_POST['dataset'] ) ? sanitize_text_field( $_POST['dataset'] ) : false );
236
+ if( $export->type ) {
237
+ $export->fields = ( isset( $_POST[$export->type . '_fields'] ) ? array_map( 'sanitize_text_field', $_POST[$export->type . '_fields'] ) : false );
238
+ $export->fields_order = ( isset( $_POST[$export->type . '_fields_order'] ) ? array_map( 'absint', $_POST[$export->type . '_fields_order'] ) : false );
239
+ woo_ce_update_option( 'last_export', $export->type );
240
+ }
241
+ switch( $export->type ) {
242
+
243
+ case 'product':
244
+ // Set up dataset specific options
245
+ $export->product_categories = ( isset( $_POST['product_filter_category'] ) ? woo_ce_format_product_filters( array_map( 'absint', $_POST['product_filter_category'] ) ) : false );
246
+ $export->product_tags = ( isset( $_POST['product_filter_tag'] ) ? woo_ce_format_product_filters( array_map( 'absint', $_POST['product_filter_tag'] ) ) : false );
247
+ $export->product_status = ( isset( $_POST['product_filter_status'] ) ? woo_ce_format_product_filters( array_map( 'sanitize_text_field', $_POST['product_filter_status'] ) ) : false );
248
+ $export->product_type = ( isset( $_POST['product_filter_type'] ) ? woo_ce_format_product_filters( array_map( 'sanitize_text_field', $_POST['product_filter_type'] ) ) : false );
249
+ $export->product_orderby = ( isset( $_POST['product_orderby'] ) ? sanitize_text_field( $_POST['product_orderby'] ) : false );
250
+ $export->product_order = ( isset( $_POST['product_order'] ) ? sanitize_text_field( $_POST['product_order'] ) : false );
251
+ $export->gallery_formatting = ( isset( $_POST['product_gallery_formatting'] ) ? absint( $_POST['product_gallery_formatting'] ) : false );
252
+ $export->upsell_formatting = ( isset( $_POST['product_upsell_formatting'] ) ? absint( $_POST['product_upsell_formatting'] ) : false );
253
+ $export->crosssell_formatting = ( isset( $_POST['product_crosssell_formatting'] ) ? absint( $_POST['product_crosssell_formatting'] ) : false );
254
+
255
+ // Save dataset export specific options
256
+ if( $export->product_orderby <> woo_ce_get_option( 'product_orderby' ) )
257
+ woo_ce_update_option( 'product_orderby', $export->product_orderby );
258
+ if( $export->product_order <> woo_ce_get_option( 'product_order' ) )
259
+ woo_ce_update_option( 'product_order', $export->product_order );
260
+ if( $export->upsell_formatting <> woo_ce_get_option( 'upsell_formatting' ) )
261
+ woo_ce_update_option( 'upsell_formatting', $export->upsell_formatting );
262
+ if( $export->crosssell_formatting <> woo_ce_get_option( 'crosssell_formatting' ) )
263
+ woo_ce_update_option( 'crosssell_formatting', $export->crosssell_formatting );
264
+ break;
265
+
266
+ case 'category':
267
+ // Set up dataset specific options
268
+ $export->category_orderby = ( isset( $_POST['category_orderby'] ) ? sanitize_text_field( $_POST['category_orderby'] ) : false );
269
+ $export->category_order = ( isset( $_POST['category_order'] ) ? sanitize_text_field( $_POST['category_order'] ) : false );
270
+
271
+ // Save dataset export specific options
272
+ if( $export->category_orderby <> woo_ce_get_option( 'category_orderby' ) )
273
+ woo_ce_update_option( 'category_orderby', $export->category_orderby );
274
+ if( $export->category_order <> woo_ce_get_option( 'category_order' ) )
275
+ woo_ce_update_option( 'category_order', $export->category_order );
276
+ break;
277
+
278
+ case 'tag':
279
+ // Set up dataset specific options
280
+ $export->tag_orderby = ( isset( $_POST['tag_orderby'] ) ? sanitize_text_field( $_POST['tag_orderby'] ) : false );
281
+ $export->tag_order = ( isset( $_POST['tag_order'] ) ? sanitize_text_field( $_POST['tag_order'] ) : false );
282
+
283
+ // Save dataset export specific options
284
+ if( $export->tag_orderby <> woo_ce_get_option( 'tag_orderby' ) )
285
+ woo_ce_update_option( 'tag_orderby', $export->tag_orderby );
286
+ if( $export->tag_order <> woo_ce_get_option( 'tag_order' ) )
287
+ woo_ce_update_option( 'tag_order', $export->tag_order );
288
+ break;
289
+
290
+ case 'user':
291
+ // Set up dataset specific options
292
+ $export->user_orderby = ( isset( $_POST['user_orderby'] ) ? sanitize_text_field( $_POST['user_orderby'] ) : false );
293
+ $export->user_order = ( isset( $_POST['user_order'] ) ? sanitize_text_field( $_POST['user_order'] ) : false );
294
+
295
+ // Save dataset export specific options
296
+ if( $export->user_orderby <> woo_ce_get_option( 'user_orderby' ) )
297
+ woo_ce_update_option( 'user_orderby', $export->user_orderby );
298
+ if( $export->user_order <> woo_ce_get_option( 'user_order' ) )
299
+ woo_ce_update_option( 'user_order', $export->user_order );
300
+ break;
301
+
302
+ }
303
+ if( $export->type ) {
304
+
305
+ $timeout = 600;
306
+ if( isset( $_POST['timeout'] ) ) {
307
+ $timeout = absint( $_POST['timeout'] );
308
+ if( $timeout <> woo_ce_get_option( 'timeout' ) )
309
+ woo_ce_update_option( 'timeout', $timeout );
310
+ }
311
+ if( !ini_get( 'safe_mode' ) ) {
312
+ @set_time_limit( $timeout );
313
+ @ini_set( 'max_execution_time', $timeout );
314
+ }
315
+
316
+ @ini_set( 'memory_limit', WP_MAX_MEMORY_LIMIT );
317
+
318
+ $export->args = array(
319
+ 'limit_volume' => $export->limit_volume,
320
+ 'offset' => $export->offset,
321
+ 'encoding' => $export->encoding,
322
+ 'date_format' => $export->date_format,
323
+ 'product_categories' => $export->product_categories,
324
+ 'product_tags' => $export->product_tags,
325
+ 'product_status' => $export->product_status,
326
+ 'product_type' => $export->product_type,
327
+ 'product_orderby' => $export->product_orderby,
328
+ 'product_order' => $export->product_order,
329
+ 'category_orderby' => $export->category_orderby,
330
+ 'category_order' => $export->category_order,
331
+ 'tag_orderby' => $export->tag_orderby,
332
+ 'tag_order' => $export->tag_order,
333
+ 'user_orderby' => $export->user_orderby,
334
+ 'user_order' => $export->user_order
335
+ );
336
+ if( empty( $export->fields ) ) {
337
+ $message = __( 'No export fields were selected, please try again with at least a single export field.', 'woocommerce-exporter' );
338
+ woo_ce_admin_notice( $message, 'error' );
339
+ return false;
340
+ }
341
+ woo_ce_save_fields( $export->type, $export->fields, $export->fields_order );
342
+
343
+ if( $export->export_format == 'csv' ) {
344
+ $export->filename = woo_ce_generate_csv_filename( $export->type );
345
+ }
346
+
347
+ // Print file contents to debug export screen
348
+ if( WOO_CE_DEBUG ) {
349
+
350
+ if( in_array( $export->export_format, array( 'csv' ) ) ) {
351
+ woo_ce_export_dataset( $export->type );
352
+ }
353
+ $export->idle_memory_end = woo_ce_current_memory_usage();
354
+ $export->end_time = time();
355
+
356
+ // Print file contents to browser
357
+ } else {
358
+ if( in_array( $export->export_format, array( 'csv' ) ) ) {
359
+
360
+ // Generate CSV contents
361
+ $bits = woo_ce_export_dataset( $export->type );
362
+ unset( $export->fields );
363
+ if( empty( $bits ) ) {
364
+ $message = __( 'No export entries were found, please try again with different export filters.', 'woocommerce-exporter' );
365
+ woo_ce_admin_notice( $message, 'error' );
366
+ return;
367
+ }
368
+ if( $export->delete_file ) {
369
+
370
+ // Print to browser
371
+ if( $export->export_format == 'csv' )
372
+ woo_ce_generate_csv_header( $export->type );
373
+ echo $bits;
374
+ exit();
375
+
376
+ } else {
377
+
378
+ // Save to file and insert to WordPress Media
379
+ if( $export->filename && $bits ) {
380
+ if( $export->export_format == 'csv' )
381
+ $post_ID = woo_ce_save_file_attachment( $export->filename, 'text/csv' );
382
+ $upload = wp_upload_bits( $export->filename, null, $bits );
383
+ if( ( $post_ID == false ) || $upload['error'] ) {
384
+ wp_delete_attachment( $post_ID, true );
385
+ if( isset( $upload['error'] ) )
386
+ wp_redirect( esc_url( add_query_arg( array( 'failed' => true, 'message' => urlencode( $upload['error'] ) ) ) ) );
387
+ else
388
+ wp_redirect( esc_url( add_query_arg( array( 'failed' => true ) ) ) );
389
+ return;
390
+ }
391
+ $attach_data = wp_generate_attachment_metadata( $post_ID, $upload['file'] );
392
+ wp_update_attachment_metadata( $post_ID, $attach_data );
393
+ update_attached_file( $post_ID, $upload['file'] );
394
+ if( $post_ID ) {
395
+ woo_ce_save_file_guid( $post_ID, $export->type, $upload['url'] );
396
+ woo_ce_save_file_details( $post_ID );
397
+ }
398
+ $export_type = $export->type;
399
+ unset( $export );
400
+
401
+ // The end memory usage and time is collected at the very last opportunity prior to the CSV header being rendered to the screen
402
+ woo_ce_update_file_detail( $post_ID, '_woo_idle_memory_end', woo_ce_current_memory_usage() );
403
+ woo_ce_update_file_detail( $post_ID, '_woo_end_time', time() );
404
+
405
+ // Generate CSV header
406
+ woo_ce_generate_csv_header( $export_type );
407
+ unset( $export_type );
408
+
409
+ // Print file contents to screen
410
+ if( $upload['file'] ) {
411
+ readfile( $upload['file'] );
412
+ } else {
413
+ $url = add_query_arg( 'failed', true );
414
+ wp_redirect( $url );
415
+ }
416
+ unset( $upload );
417
+ } else {
418
+ $url = add_query_arg( 'failed', true );
419
+ wp_redirect( $url );
420
+ }
421
+
422
+ }
423
+
424
+ }
425
+ exit();
426
+ }
427
+ }
428
+ break;
429
+
430
+ // Save changes on Settings screen
431
+ case 'save-settings':
432
+ // We need to verify the nonce.
433
+ if( !empty( $_POST ) && check_admin_referer( 'save_settings', 'woo_ce_save_settings' ) ) {
434
+ // Sanitize each setting field as needed
435
+ woo_ce_update_option( 'export_filename', strip_tags( (string)$_POST['export_filename'] ) );
436
+ woo_ce_update_option( 'delete_file', sanitize_text_field( (int)$_POST['delete_file'] ) );
437
+ woo_ce_update_option( 'encoding', sanitize_text_field( (string)$_POST['encoding'] ) );
438
+ woo_ce_update_option( 'delimiter', sanitize_text_field( (string)$_POST['delimiter'] ) );
439
+ woo_ce_update_option( 'category_separator', sanitize_text_field( (string)$_POST['category_separator'] ) );
440
+ woo_ce_update_option( 'bom', absint( (int)$_POST['bom'] ) );
441
+ woo_ce_update_option( 'escape_formatting', sanitize_text_field( (string)$_POST['escape_formatting'] ) );
442
+ if( $_POST['date_format'] == 'custom' && !empty( $_POST['date_format_custom'] ) )
443
+ woo_ce_update_option( 'date_format', sanitize_text_field( (string)$_POST['date_format_custom'] ) );
444
+ else
445
+ woo_ce_update_option( 'date_format', sanitize_text_field( (string)$_POST['date_format'] ) );
446
+
447
+ $message = __( 'Changes have been saved.', 'woocommerce-exporter' );
448
+ woo_ce_admin_notice( $message );
449
+ }
450
+ break;
451
+
452
+ // Save changes on Field Editor screen
453
+ case 'save-fields':
454
+ // We need to verify the nonce.
455
+ if( !empty( $_POST ) && check_admin_referer( 'save_fields', 'woo_ce_save_fields' ) ) {
456
+ $fields = ( isset( $_POST['fields'] ) ? array_filter( $_POST['fields'] ) : array() );
457
+ $export_type = ( isset( $_POST['type'] ) ? sanitize_text_field( $_POST['type'] ) : '' );
458
+ $export_types = array_keys( woo_ce_get_export_types() );
459
+ // Check we are saving against a valid export type
460
+ if( in_array( $export_type, $export_types ) ) {
461
+ woo_ce_update_option( $export_type . '_labels', $fields );
462
+ $message = __( 'Field labels have been saved.', 'woocommerce-exporter' );
463
+ woo_ce_admin_notice( $message );
464
+ } else {
465
+ $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' );
466
+ woo_ce_admin_notice( $message, 'error' );
467
+ }
468
+ }
469
+ break;
470
+
471
+ }
472
+
473
+ }
474
+ add_action( 'admin_init', 'woo_ce_admin_init', 10 );
475
+
476
+ // HTML templates and form processor for Store Exporter screen
477
+ function woo_ce_html_page() {
478
+
479
+ global $wpdb, $export;
480
+
481
+ $title = apply_filters( 'woo_ce_template_header', __( 'Store Exporter', 'woocommerce-exporter' ) );
482
+ woo_ce_template_header( $title );
483
+ woo_ce_support_donate();
484
+ $action = ( function_exists( 'woo_get_action' ) ? woo_get_action() : false );
485
+ switch( $action ) {
486
+
487
+ case 'export':
488
+ if( WOO_CE_DEBUG ) {
489
+ if( false === ( $export_log = get_transient( WOO_CE_PREFIX . '_debug_log' ) ) ) {
490
+ $export_log = __( 'No export entries were found, please try again with different export filters.', 'woocommerce-exporter' );
491
+ } else {
492
+ // We take the contents of our WordPress Transient and de-base64 it back to CSV format
493
+ $export_log = base64_decode( $export_log );
494
+ }
495
+ delete_transient( WOO_CE_PREFIX . '_debug_log' );
496
+ $output = '
497
+ <h3>' . sprintf( __( 'Export Details: %s', 'woocommerce-exporter' ), esc_attr( $export->filename ) ) . '</h3>
498
+ <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>
499
+ <textarea id="export_log">' . esc_textarea( print_r( $export, true ) ) . '</textarea>
500
+ <hr />';
501
+ if( in_array( $export->export_format, array( 'csv' ) ) ) {
502
+ $output .= '
503
+ <script type="text/javascript">
504
+ $j(function() {
505
+ $j(\'#export_sheet\').CSVToTable(\'\', { startLine: 0 });
506
+ });
507
+ </script>
508
+ <h3>' . __( 'Export', 'woocommerce-exporter' ) . '</h3>
509
+ <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>
510
+ <div id="export_sheet">' . esc_textarea( $export_log ) . '</div>
511
+ <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>
512
+ <hr />';
513
+ }
514
+ $output .= '
515
+ <h3>' . __( 'Export Log', 'woocommerce-exporter' ) . '</h3>
516
+ <p>' . __( 'This prints the raw export contents and is helpful when the jQuery plugin above fails due to major formatting errors.', 'woocommerce-exporter' ) . '</p>
517
+ <textarea id="export_log" wrap="off">' . esc_textarea( $export_log ) . '</textarea>
518
+ <hr />
519
+ ';
520
+ echo $output;
521
+ }
522
+
523
+ woo_ce_manage_form();
524
+ break;
525
+
526
+ case 'update':
527
+ // Save Custom Product Meta
528
+ if( isset( $_POST['custom_products'] ) ) {
529
+ $custom_products = $_POST['custom_products'];
530
+ $custom_products = explode( "\n", trim( $custom_products ) );
531
+ $size = count( $custom_products );
532
+ if( !empty( $size ) ) {
533
+ for( $i = 0; $i < $size; $i++ )
534
+ $custom_products[$i] = sanitize_text_field( trim( $custom_products[$i] ) );
535
+ woo_ce_update_option( 'custom_products', $custom_products );
536
+ }
537
+ }
538
+
539
+ $message = __( 'Custom Fields saved. You can now select those additional fields from the Export Fields list.', 'woocommerce-exporter' );
540
+ woo_ce_admin_notice_html( $message );
541
+ woo_ce_manage_form();
542
+ break;
543
+
544
+ default:
545
+ woo_ce_manage_form();
546
+ break;
547
+
548
+ }
549
+ woo_ce_template_footer();
550
+
551
+ }
552
+
553
+ // HTML template for Export screen
554
+ function woo_ce_manage_form() {
555
+
556
+ $tab = ( isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : false );
557
+ // If Skip Overview is set then jump to Export screen
558
+ if( $tab == false && woo_ce_get_option( 'skip_overview', false ) )
559
+ $tab = 'export';
560
+
561
+ woo_ce_admin_fail_notices();
562
+
563
+ include_once( WOO_CE_PATH . 'templates/admin/tabs.php' );
564
+
565
+ }
566
+
567
+ /* End of: WordPress Administration */
568
+
569
+ }
570
+ ?>
includes/admin.php ADDED
@@ -0,0 +1,893 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Display admin notice on screen load
3
+ function woo_ce_admin_notice( $message = '', $priority = 'updated', $screen = '' ) {
4
+
5
+ if( $priority == false || $priority == '' )
6
+ $priority = 'updated';
7
+ if( $message <> '' ) {
8
+ ob_start();
9
+ woo_ce_admin_notice_html( $message, $priority, $screen );
10
+ $output = ob_get_contents();
11
+ ob_end_clean();
12
+ // Check if an existing notice is already in queue
13
+ $existing_notice = get_transient( WOO_CE_PREFIX . '_notice' );
14
+ if( $existing_notice !== false ) {
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
+
30
+ global $pagenow;
31
+
32
+ if( is_array( $screen ) ) {
33
+ if( in_array( $pagenow, $screen ) == false )
34
+ return;
35
+ } else {
36
+ if( $pagenow <> $screen )
37
+ return;
38
+ }
39
+
40
+ } ?>
41
+ <div id="message" class="<?php echo $priority; ?>">
42
+ <p><?php echo $message; ?></p>
43
+ </div>
44
+ <?php
45
+
46
+ }
47
+
48
+ // Grabs the WordPress transient that holds the admin notice and prints it
49
+ function woo_ce_admin_notice_print() {
50
+
51
+ $output = get_transient( WOO_CE_PREFIX . '_notice' );
52
+ if( $output !== false ) {
53
+ delete_transient( WOO_CE_PREFIX . '_notice' );
54
+ $output = base64_decode( $output );
55
+ echo $output;
56
+ }
57
+
58
+ }
59
+
60
+ // HTML template header on Store Exporter screen
61
+ function woo_ce_template_header( $title = '', $icon = 'woocommerce' ) {
62
+
63
+ if( $title )
64
+ $output = $title;
65
+ else
66
+ $output = __( 'Store Export', 'woocommerce-exporter' ); ?>
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
+ </h2>
72
+ <?php
73
+
74
+ }
75
+
76
+ // HTML template footer on Store Exporter screen
77
+ function woo_ce_template_footer() { ?>
78
+ </div>
79
+ <!-- .wrap -->
80
+ <?php
81
+
82
+ }
83
+
84
+ function woo_ce_export_options_export_format() {
85
+
86
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
87
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
88
+
89
+ ob_start(); ?>
90
+ <tr>
91
+ <th>
92
+ <label><?php _e( 'Export format', 'woocommerce-exporter' ); ?></label>
93
+ </th>
94
+ <td>
95
+ <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 />
96
+ <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 />
97
+ <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 />
98
+ <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 />
99
+ <div class="export-options product-options">
100
+ <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>
101
+ </div>
102
+ <p class="description"><?php _e( 'Adjust the export format to generate different export file formats.', 'woocommerce-exporter' ); ?></p>
103
+ </td>
104
+ </tr>
105
+ <?php
106
+ ob_end_flush();
107
+
108
+ }
109
+
110
+ // Add Export and Docs links to the Plugins screen
111
+ function woo_ce_add_settings_link( $links, $file ) {
112
+
113
+ // Manually force slug
114
+ $this_plugin = WOO_CE_RELPATH;
115
+
116
+ if( $file == $this_plugin ) {
117
+ $docs_url = 'http://www.visser.com.au/docs/';
118
+ $docs_link = sprintf( '<a href="%s" target="_blank">' . __( 'Docs', 'woocommerce-exporter' ) . '</a>', $docs_url );
119
+ $export_link = sprintf( '<a href="%s">' . __( 'Export', 'woocommerce-exporter' ) . '</a>', esc_url( add_query_arg( 'page', 'woo_ce', 'admin.php' ) ) );
120
+ array_unshift( $links, $docs_link );
121
+ array_unshift( $links, $export_link );
122
+ }
123
+ return $links;
124
+
125
+ }
126
+ add_filter( 'plugin_action_links', 'woo_ce_add_settings_link', 10, 2 );
127
+
128
+ // Add Store Export page to WooCommerce screen IDs
129
+ function woo_ce_wc_screen_ids( $screen_ids = array() ) {
130
+
131
+ $screen_ids[] = 'woocommerce_page_woo_ce';
132
+ return $screen_ids;
133
+
134
+ }
135
+ add_filter( 'woocommerce_screen_ids', 'woo_ce_wc_screen_ids', 10, 1 );
136
+
137
+ // Add Store Export to WordPress Administration menu
138
+ function woo_ce_admin_menu() {
139
+
140
+ $page = add_submenu_page( 'woocommerce', __( 'Store Exporter', 'woocommerce-exporter' ), __( 'Store Export', 'woocommerce-exporter' ), 'view_woocommerce_reports', 'woo_ce', 'woo_ce_html_page' );
141
+ add_action( 'admin_print_styles-' . $page, 'woo_ce_enqueue_scripts' );
142
+ add_action( 'current_screen', 'woo_ce_add_help_tab' );
143
+
144
+ }
145
+ add_action( 'admin_menu', 'woo_ce_admin_menu', 11 );
146
+
147
+ // Load CSS and jQuery scripts for Store Exporter screen
148
+ function woo_ce_enqueue_scripts() {
149
+
150
+ // Simple check that WooCommerce is activated
151
+ if( class_exists( 'WooCommerce' ) ) {
152
+
153
+ global $woocommerce;
154
+
155
+ // Load WooCommerce default Admin styling
156
+ wp_enqueue_style( 'woocommerce_admin_styles', $woocommerce->plugin_url() . '/assets/css/admin.css' );
157
+
158
+ }
159
+
160
+ // Date Picker
161
+ wp_enqueue_script( 'jquery-ui-datepicker' );
162
+ wp_enqueue_style( 'jquery-ui-datepicker', plugins_url( '/templates/admin/jquery-ui-datepicker.css', WOO_CE_RELPATH ) );
163
+
164
+ // Time Picker, Date Picker Addon
165
+ wp_enqueue_script( 'jquery-ui-timepicker', plugins_url( '/js/jquery.timepicker.js', WOO_CE_RELPATH ), array( 'jquery', 'jquery-ui-datepicker' ) );
166
+ wp_enqueue_style( 'jquery-ui-datepicker', plugins_url( '/templates/admin/jquery-ui-timepicker.css', WOO_CE_RELPATH ) );
167
+
168
+ // Chosen
169
+ wp_enqueue_style( 'jquery-chosen', plugins_url( '/templates/admin/chosen.css', WOO_CE_RELPATH ) );
170
+ wp_enqueue_script( 'jquery-chosen', plugins_url( '/js/jquery.chosen.js', WOO_CE_RELPATH ), array( 'jquery' ) );
171
+
172
+ // Common
173
+ wp_enqueue_style( 'woo_ce_styles', plugins_url( '/templates/admin/export.css', WOO_CE_RELPATH ) );
174
+ wp_enqueue_script( 'woo_ce_scripts', plugins_url( '/templates/admin/export.js', WOO_CE_RELPATH ), array( 'jquery', 'jquery-ui-sortable' ) );
175
+ wp_enqueue_style( 'dashicons' );
176
+
177
+ if( WOO_CE_DEBUG ) {
178
+ wp_enqueue_style( 'jquery-csvToTable', plugins_url( '/templates/admin/jquery-csvtable.css', WOO_CE_RELPATH ) );
179
+ wp_enqueue_script( 'jquery-csvToTable', plugins_url( '/js/jquery.csvToTable.js', WOO_CE_RELPATH ), array( 'jquery' ) );
180
+ }
181
+ wp_enqueue_style( 'woo_vm_styles', plugins_url( '/templates/admin/woocommerce-admin_dashboard_vm-plugins.css', WOO_CE_RELPATH ) );
182
+
183
+ }
184
+
185
+ function woo_ce_add_help_tab() {
186
+
187
+ $screen = get_current_screen();
188
+ if( $screen->id <> 'woocommerce_page_woo_ce' )
189
+ return;
190
+
191
+ $screen->add_help_tab( array(
192
+ 'id' => 'woo_ce',
193
+ 'title' => __( 'Store Exporter', 'woocommerce-exporter' ),
194
+ 'content' =>
195
+ '<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>' .
196
+ '<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>'
197
+ ) );
198
+
199
+ }
200
+
201
+ function woo_ce_plugin_page_notices() {
202
+
203
+ global $pagenow;
204
+
205
+ if( $pagenow == 'plugins.php' ) {
206
+ if( woo_is_jigo_activated() || woo_is_wpsc_activated() ) {
207
+ $r_plugins = array(
208
+ 'woocommerce-exporter/exporter.php',
209
+ 'woocommerce-store-exporter/exporter.php'
210
+ );
211
+ $i_plugins = get_plugins();
212
+ foreach( $r_plugins as $path ) {
213
+ if( isset( $i_plugins[$path] ) ) {
214
+ add_action( 'after_plugin_row_' . $path, 'woo_ce_plugin_page_notice', 10, 3 );
215
+ break;
216
+ }
217
+ }
218
+ }
219
+ }
220
+
221
+ }
222
+
223
+ // HTML active class for the currently selected tab on the Store Exporter screen
224
+ function woo_ce_admin_active_tab( $tab_name = null, $tab = null ) {
225
+
226
+ if( isset( $_GET['tab'] ) && !$tab )
227
+ $tab = $_GET['tab'];
228
+ else if( !isset( $_GET['tab'] ) && woo_ce_get_option( 'skip_overview', false ) )
229
+ $tab = 'export';
230
+ else
231
+ $tab = 'overview';
232
+
233
+ $output = '';
234
+ if( isset( $tab_name ) && $tab_name ) {
235
+ if( $tab_name == $tab )
236
+ $output = ' nav-tab-active';
237
+ }
238
+ echo $output;
239
+
240
+ }
241
+
242
+ // HTML template for each tab on the Store Exporter screen
243
+ function woo_ce_tab_template( $tab = '' ) {
244
+
245
+ if( !$tab )
246
+ $tab = 'overview';
247
+
248
+ // Store Exporter Deluxe
249
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
250
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
251
+
252
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/';
253
+
254
+ switch( $tab ) {
255
+
256
+ case 'overview':
257
+ $skip_overview = woo_ce_get_option( 'skip_overview', false );
258
+ break;
259
+
260
+ case 'export':
261
+ $export_type = sanitize_text_field( ( isset( $_POST['dataset'] ) ? $_POST['dataset'] : woo_ce_get_option( 'last_export', 'product' ) ) );
262
+ $types = array_keys( woo_ce_get_export_types() );
263
+ // Check if the default export type exists
264
+ if( !in_array( $export_type, $types ) )
265
+ $export_type = 'product';
266
+
267
+ $products = woo_ce_return_count( 'product' );
268
+ $categories = woo_ce_return_count( 'category' );
269
+ $tags = woo_ce_return_count( 'tag' );
270
+ $brands = '999';
271
+ $orders = '999';
272
+ $customers = '999';
273
+ $users = woo_ce_return_count( 'user' );
274
+ $coupons = '999';
275
+ $attributes = '999';
276
+ $subscriptions = '999';
277
+ $product_vendors = '999';
278
+ $commissions = '999';
279
+ $shipping_classes = '999';
280
+
281
+ add_action( 'woo_ce_export_options', 'woo_ce_export_options_export_format' );
282
+ if( $product_fields = woo_ce_get_product_fields() ) {
283
+ foreach( $product_fields as $key => $product_field )
284
+ $product_fields[$key]['disabled'] = ( isset( $product_field['disabled'] ) ? $product_field['disabled'] : 0 );
285
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_category' );
286
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_tag' );
287
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_brand' );
288
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_vendor' );
289
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_status' );
290
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_type' );
291
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_stock_status' );
292
+ add_action( 'woo_ce_export_product_options_after_table', 'woo_ce_product_sorting' );
293
+ add_action( 'woo_ce_export_options', 'woo_ce_products_upsells_formatting' );
294
+ add_action( 'woo_ce_export_options', 'woo_ce_products_crosssells_formatting' );
295
+ add_action( 'woo_ce_export_options', 'woo_ce_export_options_gallery_format' );
296
+ add_action( 'woo_ce_export_after_form', 'woo_ce_products_custom_fields' );
297
+ }
298
+ if( $category_fields = woo_ce_get_category_fields() ) {
299
+ foreach( $category_fields as $key => $category_field )
300
+ $category_fields[$key]['disabled'] = ( isset( $category_field['disabled'] ) ? $category_field['disabled'] : 0 );
301
+ add_action( 'woo_ce_export_category_options_after_table', 'woo_ce_category_sorting' );
302
+ }
303
+ if( $tag_fields = woo_ce_get_tag_fields() ) {
304
+ foreach( $tag_fields as $key => $tag_field )
305
+ $tag_fields[$key]['disabled'] = ( isset( $tag_field['disabled'] ) ? $tag_field['disabled'] : 0 );
306
+ add_action( 'woo_ce_export_tag_options_after_table', 'woo_ce_tag_sorting' );
307
+ }
308
+ if( $brand_fields = woo_ce_get_brand_fields() ) {
309
+ foreach( $brand_fields as $key => $brand_field )
310
+ $brand_fields[$key]['disabled'] = ( isset( $brand_field['disabled'] ) ? $brand_field['disabled'] : 0 );
311
+ add_action( 'woo_ce_export_brand_options_before_table', 'woo_ce_brand_sorting' );
312
+ }
313
+ if( $order_fields = woo_ce_get_order_fields() ) {
314
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_date' );
315
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_status' );
316
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_customer' );
317
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_billing_country' );
318
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_shipping_country' );
319
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_user_role' );
320
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_coupon' );
321
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_product' );
322
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_product_category' );
323
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_product_tag' );
324
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_product_brand' );
325
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_order_id' );
326
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_payment_gateway' );
327
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_shipping_method' );
328
+ add_action( 'woo_ce_export_order_options_after_table', 'woo_ce_order_sorting' );
329
+ add_action( 'woo_ce_export_options', 'woo_ce_orders_items_formatting' );
330
+ add_action( 'woo_ce_export_options', 'woo_ce_orders_max_order_items' );
331
+ add_action( 'woo_ce_export_options', 'woo_ce_orders_items_types' );
332
+ add_action( 'woo_ce_export_after_form', 'woo_ce_orders_custom_fields' );
333
+ }
334
+ if( $customer_fields = woo_ce_get_customer_fields() ) {
335
+ add_action( 'woo_ce_export_customer_options_before_table', 'woo_ce_customers_filter_by_status' );
336
+ add_action( 'woo_ce_export_customer_options_before_table', 'woo_ce_customers_filter_by_user_role' );
337
+ add_action( 'woo_ce_export_after_form', 'woo_ce_customers_custom_fields' );
338
+ }
339
+ if( $user_fields = woo_ce_get_user_fields() ) {
340
+ foreach( $user_fields as $key => $user_field )
341
+ $user_fields[$key]['disabled'] = ( isset( $user_field['disabled'] ) ? $user_field['disabled'] : 0 );
342
+ add_action( 'woo_ce_export_user_options_after_table', 'woo_ce_user_sorting' );
343
+ add_action( 'woo_ce_export_after_form', 'woo_ce_users_custom_fields' );
344
+ }
345
+ if( $coupon_fields = woo_ce_get_coupon_fields() ) {
346
+ add_action( 'woo_ce_export_coupon_options_before_table', 'woo_ce_coupon_sorting' );
347
+ }
348
+ if( $subscription_fields = woo_ce_get_subscription_fields() ) {
349
+ add_action( 'woo_ce_export_subscription_options_before_table', 'woo_ce_subscriptions_filter_by_subscription_status' );
350
+ add_action( 'woo_ce_export_subscription_options_before_table', 'woo_ce_subscriptions_filter_by_subscription_product' );
351
+ }
352
+ $product_vendor_fields = woo_ce_get_product_vendor_fields();
353
+ if( $commission_fields = woo_ce_get_commission_fields() ) {
354
+ add_action( 'woo_ce_export_commission_options_before_table', 'woo_ce_commissions_filter_by_date' );
355
+ add_action( 'woo_ce_export_commission_options_before_table', 'woo_ce_commissions_filter_by_product_vendor' );
356
+ add_action( 'woo_ce_export_commission_options_before_table', 'woo_ce_commissions_filter_by_commission_status' );
357
+ add_action( 'woo_ce_export_commission_options_before_table', 'woo_ce_commission_sorting' );
358
+ }
359
+ if( $shipping_class_fields = woo_ce_get_shipping_class_fields() ) {
360
+ add_action( 'woo_ce_export_shipping_class_options_after_table', 'woo_ce_shipping_class_sorting' );
361
+ }
362
+ $attribute_fields = false;
363
+
364
+ // Export modules
365
+ $modules = woo_ce_modules_list();
366
+
367
+ // Export options
368
+ $limit_volume = woo_ce_get_option( 'limit_volume' );
369
+ $offset = woo_ce_get_option( 'offset' );
370
+ break;
371
+
372
+ case 'fields':
373
+ $export_type = ( isset( $_GET['type'] ) ? sanitize_text_field( $_GET['type'] ) : '' );
374
+ $types = array_keys( woo_ce_get_export_types() );
375
+ $fields = array();
376
+ if( in_array( $export_type, $types ) ) {
377
+ if( has_filter( 'woo_ce_' . $export_type . '_fields', 'woo_ce_override_' . $export_type . '_field_labels' ) )
378
+ remove_filter( 'woo_ce_' . $export_type . '_fields', 'woo_ce_override_' . $export_type . '_field_labels', 11 );
379
+ if( function_exists( sprintf( 'woo_ce_get_%s_fields', $export_type ) ) )
380
+ $fields = call_user_func( 'woo_ce_get_' . $export_type . '_fields' );
381
+ $labels = woo_ce_get_option( $export_type . '_labels', array() );
382
+ }
383
+ break;
384
+
385
+ case 'archive':
386
+ if( isset( $_GET['deleted'] ) ) {
387
+ $message = __( 'Archived export has been deleted.', 'woocommerce-exporter' );
388
+ woo_ce_admin_notice( $message );
389
+ }
390
+ if( $files = woo_ce_get_archive_files() ) {
391
+ foreach( $files as $key => $file )
392
+ $files[$key] = woo_ce_get_archive_file( $file );
393
+ }
394
+ break;
395
+
396
+ case 'settings':
397
+ $export_filename = woo_ce_get_option( 'export_filename', '' );
398
+ // Default export filename
399
+ if( empty( $export_filename ) )
400
+ $export_filename = 'woo-export_%dataset%-%date%.csv';
401
+ $delete_file = woo_ce_get_option( 'delete_file', 0 );
402
+ $timeout = woo_ce_get_option( 'timeout', 0 );
403
+ $encoding = woo_ce_get_option( 'encoding', 'UTF-8' );
404
+ $bom = woo_ce_get_option( 'bom', 1 );
405
+ $delimiter = woo_ce_get_option( 'delimiter', ',' );
406
+ $category_separator = woo_ce_get_option( 'category_separator', '|' );
407
+ $escape_formatting = woo_ce_get_option( 'escape_formatting', 'all' );
408
+ $date_format = woo_ce_get_option( 'date_format', 'd/m/Y' );
409
+ if( $date_format == 1 || $date_format == '' )
410
+ $date_format = 'd/m/Y';
411
+ $file_encodings = ( function_exists( 'mb_list_encodings' ) ? mb_list_encodings() : false );
412
+ add_action( 'woo_ce_export_settings_top', 'woo_ce_export_settings_quicklinks' );
413
+ add_action( 'woo_ce_export_settings_after', 'woo_ce_export_settings_csv' );
414
+ add_action( 'woo_ce_export_settings_after', 'woo_ce_export_settings_cron' );
415
+ break;
416
+
417
+ case 'tools':
418
+ // Product Importer Deluxe
419
+ $woo_pd_url = 'http://www.visser.com.au/woocommerce/plugins/product-importer-deluxe/';
420
+ $woo_pd_target = ' target="_blank"';
421
+ if( function_exists( 'woo_pd_init' ) ) {
422
+ $woo_pd_url = esc_url( add_query_arg( array( 'page' => 'woo_pd', 'tab' => null ) ) );
423
+ $woo_pd_target = false;
424
+ }
425
+
426
+ // Store Toolkit
427
+ $woo_st_url = 'http://www.visser.com.au/woocommerce/plugins/store-toolkit/';
428
+ $woo_st_target = ' target="_blank"';
429
+ if( function_exists( 'woo_st_admin_init' ) ) {
430
+ $woo_st_url = esc_url( add_query_arg( array( 'page' => 'woo_st', 'tab' => null ) ) );
431
+ $woo_st_target = false;
432
+ }
433
+ break;
434
+
435
+ }
436
+ if( $tab ) {
437
+ if( file_exists( WOO_CE_PATH . 'templates/admin/tabs-' . $tab . '.php' ) ) {
438
+ include_once( WOO_CE_PATH . 'templates/admin/tabs-' . $tab . '.php' );
439
+ } else {
440
+ $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/...' );
441
+ woo_ce_admin_notice_html( $message, 'error' );
442
+ ob_start(); ?>
443
+ <p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-exporter' ); ?>:</p>
444
+ <ul class="ul-disc">
445
+ <li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-exporter' ); ?></li>
446
+ <li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-exporter' ); ?></li>
447
+ <li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-exporter' ); ?></li>
448
+ </ul>
449
+ <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>
450
+ <?php
451
+ ob_end_flush();
452
+ }
453
+ }
454
+
455
+ }
456
+
457
+ // List of WordPress Plugins that Store Exporter Deluxe integrates with
458
+ function woo_ce_modules_list( $modules = array() ) {
459
+
460
+ $modules[] = array(
461
+ 'name' => 'aioseop',
462
+ 'title' => __( 'All in One SEO Pack', 'woocommerce-exporter' ),
463
+ 'description' => __( 'Optimize your WooCommerce Products for Search Engines. Requires Store Toolkit for All in One SEO Pack integration.', 'woocommerce-exporter' ),
464
+ 'url' => 'http://wordpress.org/extend/plugins/all-in-one-seo-pack/',
465
+ 'slug' => 'all-in-one-seo-pack',
466
+ 'function' => 'aioseop_activate'
467
+ );
468
+ $modules[] = array(
469
+ 'name' => 'store_toolkit',
470
+ 'title' => __( 'Store Toolkit', 'woocommerce-exporter' ),
471
+ 'description' => __( 'Store Toolkit includes a growing set of commonly-used WooCommerce administration tools aimed at web developers and store maintainers.', 'woocommerce-exporter' ),
472
+ 'url' => 'http://wordpress.org/extend/plugins/woocommerce-store-toolkit/',
473
+ 'slug' => 'woocommerce-store-toolkit',
474
+ 'function' => 'woo_st_admin_init'
475
+ );
476
+ $modules[] = array(
477
+ 'name' => 'ultimate_seo',
478
+ 'title' => __( 'SEO Ultimate', 'woocommerce-exporter' ),
479
+ 'description' => __( 'This all-in-one SEO plugin gives you control over Product details.', 'woocommerce-exporter' ),
480
+ 'url' => 'http://wordpress.org/extend/plugins/seo-ultimate/',
481
+ 'slug' => 'seo-ultimate',
482
+ 'function' => 'su_wp_incompat_notice'
483
+ );
484
+ $modules[] = array(
485
+ 'name' => 'gpf',
486
+ 'title' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' ),
487
+ 'description' => __( 'Easily configure data to be added to your Google Merchant Centre feed.', 'woocommerce-exporter' ),
488
+ 'url' => 'http://www.leewillis.co.uk/wordpress-plugins/',
489
+ 'function' => 'woocommerce_gpf_install'
490
+ );
491
+ $modules[] = array(
492
+ 'name' => 'wpseo',
493
+ 'title' => __( 'WordPress SEO by Yoast', 'woocommerce-exporter' ),
494
+ 'description' => __( 'The first true all-in-one SEO solution for WordPress.', 'woocommerce-exporter' ),
495
+ 'url' => 'http://yoast.com/wordpress/seo/#utm_source=wpadmin&utm_medium=plugin&utm_campaign=wpseoplugin',
496
+ 'slug' => 'wordpress-seo',
497
+ 'function' => 'wpseo_admin_init'
498
+ );
499
+ $modules[] = array(
500
+ 'name' => 'msrp',
501
+ 'title' => __( 'WooCommerce MSRP Pricing', 'woocommerce-exporter' ),
502
+ 'description' => __( 'Define and display MSRP prices (Manufacturer\'s suggested retail price) to your customers.', 'woocommerce-exporter' ),
503
+ 'url' => 'http://www.woothemes.com/products/msrp-pricing/',
504
+ 'function' => 'woocommerce_msrp_activate'
505
+ );
506
+ $modules[] = array(
507
+ 'name' => 'wc_brands',
508
+ 'title' => __( 'WooCommerce Brands Addon', 'woocommerce-exporter' ),
509
+ 'description' => __( 'Create, assign and list brands for products, and allow customers to filter by brand.', 'woocommerce-exporter' ),
510
+ 'url' => 'http://www.woothemes.com/products/brands/',
511
+ 'class' => 'WC_Brands'
512
+ );
513
+ $modules[] = array(
514
+ 'name' => 'wc_cog',
515
+ 'title' => __( 'Cost of Goods', 'woocommerce-exporter' ),
516
+ 'description' => __( 'Easily track total profit and cost of goods by adding a Cost of Good field to simple and variable products.', 'woocommerce-exporter' ),
517
+ 'url' => 'http://www.skyverge.com/product/woocommerce-cost-of-goods-tracking/',
518
+ 'class' => 'WC_COG'
519
+ );
520
+ $modules[] = array(
521
+ 'name' => 'per_product_shipping',
522
+ 'title' => __( 'Per-Product Shipping', 'woocommerce-exporter' ),
523
+ 'description' => __( 'Define separate shipping costs per product which are combined at checkout to provide a total shipping cost.', 'woocommerce-exporter' ),
524
+ 'url' => 'http://www.woothemes.com/products/per-product-shipping/',
525
+ 'function' => 'woocommerce_per_product_shipping_init'
526
+ );
527
+ $modules[] = array(
528
+ 'name' => 'vendors',
529
+ 'title' => __( 'Product Vendors', 'woocommerce-exporter' ),
530
+ 'description' => __( 'Turn your store into a multi-vendor marketplace (such as Etsy or Creative Market).', 'woocommerce-exporter' ),
531
+ 'url' => 'http://www.woothemes.com/products/product-vendors/',
532
+ 'class' => 'WooCommerce_Product_Vendors'
533
+ );
534
+ $modules[] = array(
535
+ 'name' => 'wc_vendors',
536
+ 'title' => __( 'WC Vendors', 'woocommerce-exporter' ),
537
+ 'description' => __( 'Allow vendors to sell their own products and receive a commission for each sale.', 'woocommerce-exporter' ),
538
+ 'url' => 'http://wcvendors.com',
539
+ 'class' => 'WC_Vendors'
540
+ );
541
+ $modules[] = array(
542
+ 'name' => 'acf',
543
+ 'title' => __( 'Advanced Custom Fields', 'woocommerce-exporter' ),
544
+ 'description' => __( 'Powerful fields for WordPress developers.', 'woocommerce-exporter' ),
545
+ 'url' => 'http://www.advancedcustomfields.com',
546
+ 'class' => 'acf'
547
+ );
548
+ $modules[] = array(
549
+ 'name' => 'product_addons',
550
+ 'title' => __( 'Product Add-ons', 'woocommerce-exporter' ),
551
+ 'description' => __( 'Allow your customers to customise your products by adding input boxes, dropdowns or a field set of checkboxes.', 'woocommerce-exporter' ),
552
+ 'url' => 'http://www.woothemes.com/products/product-add-ons/',
553
+ 'class' => 'Product_Addon_Admin'
554
+ );
555
+ $modules[] = array(
556
+ 'name' => 'seq',
557
+ 'title' => __( 'WooCommerce Sequential Order Numbers', 'woocommerce-exporter' ),
558
+ 'description' => __( 'This plugin extends the WooCommerce e-commerce plugin by setting sequential order numbers for new orders.', 'woocommerce-exporter' ),
559
+ 'url' => 'https://wordpress.org/plugins/woocommerce-sequential-order-numbers/',
560
+ 'slug' => 'woocommerce-sequential-order-numbers',
561
+ 'class' => 'WC_Seq_Order_Number'
562
+ );
563
+ $modules[] = array(
564
+ 'name' => 'seq_pro',
565
+ 'title' => __( 'WooCommerce Sequential Order Numbers Pro', 'woocommerce-exporter' ),
566
+ 'description' => __( 'Tame your WooCommerce Order Numbers.', 'woocommerce-exporter' ),
567
+ 'url' => 'http://www.woothemes.com/products/sequential-order-numbers-pro/',
568
+ 'class' => 'WC_Seq_Order_Number_Pro'
569
+ );
570
+ $modules[] = array(
571
+ 'name' => 'print_invoice_delivery_note',
572
+ 'title' => __( 'WooCommerce Print Invoice & Delivery Note', 'woocommerce-exporter' ),
573
+ 'description' => __( 'Print invoices and delivery notes for WooCommerce orders.', 'woocommerce-exporter' ),
574
+ 'url' => 'http://wordpress.org/plugins/woocommerce-delivery-notes/',
575
+ 'slug' => 'woocommerce-delivery-notes',
576
+ 'class' => 'WooCommerce_Delivery_Notes'
577
+ );
578
+ $modules[] = array(
579
+ 'name' => 'pdf_invoices_packing_slips',
580
+ 'title' => __( 'WooCommerce PDF Invoices & Packing Slips', 'woocommerce-exporter' ),
581
+ 'description' => __( 'Create, print & automatically email PDF invoices & packing slips for WooCommerce orders.', 'woocommerce-exporter' ),
582
+ 'url' => 'https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/',
583
+ 'slug' => 'woocommerce-pdf-invoices-packing-slips',
584
+ 'class' => 'WooCommerce_PDF_Invoices'
585
+ );
586
+ $modules[] = array(
587
+ 'name' => 'checkout_manager',
588
+ 'title' => __( 'WooCommerce Checkout Manager', 'woocommerce-exporter' ),
589
+ 'description' => __( 'Manages WooCommerce Checkout.', 'woocommerce-exporter' ),
590
+ 'url' => 'http://wordpress.org/plugins/woocommerce-checkout-manager/',
591
+ 'slug' => 'woocommerce-checkout-manager',
592
+ 'function' => 'wccs_install'
593
+ );
594
+ $modules[] = array(
595
+ 'name' => 'checkout_manager_pro',
596
+ 'title' => __( 'WooCommerce Checkout Manager Pro', 'woocommerce-exporter' ),
597
+ 'description' => __( 'Manages the WooCommerce Checkout page and WooCommerce Checkout processes.', 'woocommerce-exporter' ),
598
+ 'url' => 'http://www.trottyzone.com/product/woocommerce-checkout-manager-pro',
599
+ 'function' => array( 'wccs_install', 'wccs_install_pro' )
600
+ );
601
+ $modules[] = array(
602
+ 'name' => 'pgsk',
603
+ 'title' => __( 'Poor Guys Swiss Knife', 'woocommerce-exporter' ),
604
+ 'description' => __( 'A Swiss Knife for WooCommerce.', 'woocommerce-exporter' ),
605
+ 'url' => 'http://wordpress.org/plugins/woocommerce-poor-guys-swiss-knife/',
606
+ 'slug' => 'woocommerce-poor-guys-swiss-knife',
607
+ 'function' => 'wcpgsk_init'
608
+ );
609
+ $modules[] = array(
610
+ 'name' => 'checkout_field_editor',
611
+ 'title' => __( 'Checkout Field Editor', 'woocommerce-exporter' ),
612
+ 'description' => __( 'Add, edit and remove fields shown on your WooCommerce checkout page.', 'woocommerce-exporter' ),
613
+ 'url' => 'http://www.woothemes.com/products/woocommerce-checkout-field-editor/',
614
+ 'function' => 'woocommerce_init_checkout_field_editor'
615
+ );
616
+ $modules[] = array(
617
+ 'name' => 'checkout_field_manager',
618
+ 'title' => __( 'Checkout Field Manager', 'woocommerce-exporter' ),
619
+ 'description' => __( 'Quickly and effortlessly add, remove and re-orders fields in the checkout process.', 'woocommerce-exporter' ),
620
+ 'url' => 'http://61extensions.com/shop/woocommerce-checkout-field-manager/',
621
+ 'function' => 'sod_woocommerce_checkout_manager_settings'
622
+ );
623
+ $modules[] = array(
624
+ 'name' => 'checkout_addons',
625
+ 'title' => __( 'WooCommerce Checkout Add-Ons', 'woocommerce-exporter' ),
626
+ 'description' => __( 'Add fields at checkout for add-on products and services while optionally setting a cost for each add-on.', 'woocommerce-exporter' ),
627
+ 'url' => 'http://www.skyverge.com/product/woocommerce-checkout-add-ons/',
628
+ 'function' => 'init_woocommerce_checkout_add_ons'
629
+ );
630
+ $modules[] = array(
631
+ 'name' => 'local_pickup_plus',
632
+ 'title' => __( 'Local Pickup Plus', 'woocommerce-exporter' ),
633
+ 'description' => __( 'Let customers pick up products from specific locations.', 'woocommerce-exporter' ),
634
+ 'url' => 'http://www.woothemes.com/products/local-pickup-plus/',
635
+ 'class' => 'WC_Local_Pickup_Plus'
636
+ );
637
+ $modules[] = array(
638
+ 'name' => 'gravity_forms',
639
+ 'title' => __( 'Gravity Forms', 'woocommerce-exporter' ),
640
+ 'description' => __( 'Gravity Forms is hands down the best contact form plugin for WordPress powered websites.', 'woocommerce-exporter' ),
641
+ 'url' => 'http://woothemes.com/woocommerce',
642
+ 'class' => 'RGForms'
643
+ );
644
+ $modules[] = array(
645
+ 'name' => 'currency_switcher',
646
+ 'title' => __( 'WooCommerce Currency Switcher', 'woocommerce-exporter' ),
647
+ 'description' => __( 'Currency Switcher for WooCommerce allows your shop to display prices and accept payments in multiple currencies.', 'woocommerce-exporter' ),
648
+ 'url' => 'http://aelia.co/shop/currency-switcher-woocommerce/',
649
+ 'class' => 'WC_Aelia_CurrencySwitcher'
650
+ );
651
+ $modules[] = array(
652
+ 'name' => 'subscriptions',
653
+ 'title' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
654
+ 'description' => __( 'WC Subscriptions makes it easy to create and manage products with recurring payments.', 'woocommerce-exporter' ),
655
+ 'url' => 'http://www.woothemes.com/products/woocommerce-subscriptions/',
656
+ 'class' => 'WC_Subscriptions_Manager'
657
+ );
658
+ $modules[] = array(
659
+ 'name' => 'extra_product_options',
660
+ 'title' => __( 'Extra Product Options', 'woocommerce-exporter' ),
661
+ 'description' => __( 'Create extra price fields globally or per-Product', 'woocommerce-exporter' ),
662
+ 'url' => 'http://codecanyon.net/item/woocommerce-extra-product-options/7908619',
663
+ 'class' => 'TM_Extra_Product_Options'
664
+ );
665
+ $modules[] = array(
666
+ 'name' => 'woocommerce_jetpack',
667
+ 'title' => __( 'WooCommerce Jetpack', 'woocommerce-exporter' ),
668
+ 'description' => __( 'Supercharge your WooCommerce site with these awesome powerful features.', 'woocommerce-exporter' ),
669
+ 'url' => 'https://wordpress.org/plugins/woocommerce-jetpack/',
670
+ 'slug' => 'woocommerce-jetpack',
671
+ 'class' => 'WC_Jetpack'
672
+ );
673
+ $modules[] = array(
674
+ 'name' => 'woocommerce_jetpack_plus',
675
+ 'title' => __( 'WooCommerce Jetpack Plus', 'woocommerce-exporter' ),
676
+ 'description' => __( 'Unlock all WooCommerce Jetpack features and supercharge your WordPress WooCommerce site even more.', 'woocommerce-exporter' ),
677
+ 'url' => 'http://woojetpack.com/shop/wordpress-woocommerce-jetpack-plus/',
678
+ 'class' => 'WC_Jetpack_Plus'
679
+ );
680
+ $modules[] = array(
681
+ 'name' => 'woocommerce_brands',
682
+ 'title' => __( 'WooCommerce Brands', 'woocommerce-exporter' ),
683
+ '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' ),
684
+ 'url' => 'http://proword.net/Woocommerce_Brands/',
685
+ 'class' => 'woo_brands'
686
+ );
687
+ $modules[] = array(
688
+ 'name' => 'woocommerce_bookings',
689
+ 'title' => __( 'WooCommerce Bookings', 'woocommerce-exporter' ),
690
+ 'description' => __( 'Setup bookable products such as for reservations, services and hires.', 'woocommerce-exporter' ),
691
+ 'url' => 'http://www.woothemes.com/products/woocommerce-bookings/',
692
+ 'class' => 'WC_Bookings'
693
+ );
694
+ $modules[] = array(
695
+ 'name' => 'eu_vat',
696
+ 'title' => __( 'WooCommerce EU VAT Number', 'woocommerce-exporter' ),
697
+ 'description' => __( 'The EU VAT Number extension lets you collect and validate EU VAT numbers during checkout to identify B2B transactions verses B2C.', 'woocommerce-exporter' ),
698
+ 'url' => 'http://woothemes.com/',
699
+ 'function' => '__wc_eu_vat_number_init'
700
+ );
701
+ $modules[] = array(
702
+ 'name' => 'hear_about_us',
703
+ 'title' => __( 'WooCommerce Hear About Us', 'woocommerce-exporter' ),
704
+ 'description' => __( 'Ask where your new customers come from at Checkout.', 'woocommerce-exporter' ),
705
+ 'url' => 'https://wordpress.org/plugins/woocommerce-hear-about-us/',
706
+ 'slug' => 'woocommerce-hear-about-us', // Define this if the Plugin is hosted on the WordPress repo
707
+ 'class' => 'WooCommerce_HearAboutUs'
708
+ );
709
+ $modules[] = array(
710
+ 'name' => 'wholesale_pricing',
711
+ 'title' => __( 'WooCommerce Wholesale Pricing', 'woocommerce-exporter' ),
712
+ 'description' => __( 'Allows you to set wholesale prices for products and variations.', 'woocommerce-exporter' ),
713
+ 'url' => 'http://ignitewoo.com/woocommerce-extensions-plugins-themes/woocommerce-wholesale-pricing/',
714
+ 'class' => 'woocommerce_wholesale_pricing'
715
+ );
716
+ $modules[] = array(
717
+ 'name' => 'woocommerce_barcodes',
718
+ 'title' => __( 'Barcodes for WooCommerce', 'woocommerce-exporter' ),
719
+ 'description' => __( 'Allows you to add GTIN (former EAN) codes natively to your products.', 'woocommerce-exporter' ),
720
+ 'url' => 'http://www.wolkenkraft.com/produkte/barcodes-fuer-woocommerce/',
721
+ 'function' => 'wpps_requirements_met'
722
+ );
723
+ $modules[] = array(
724
+ 'name' => 'woocommerce_smart_coupons',
725
+ 'title' => __( 'WooCommerce Smart Coupons', 'woocommerce-exporter' ),
726
+ 'description' => __( 'WooCommerce Smart Coupons lets customers buy gift certificates, store credits or coupons easily.', 'woocommerce-exporter' ),
727
+ 'url' => 'http://www.woothemes.com/products/smart-coupons/',
728
+ 'class' => 'WC_Smart_Coupons'
729
+ );
730
+ $modules[] = array(
731
+ 'name' => 'woocommerce_preorders',
732
+ 'title' => __( 'WooCommerce Pre-Orders', 'woocommerce-exporter' ),
733
+ 'description' => __( 'Sell pre-orders for products in your WooCommerce store.', 'woocommerce-exporter' ),
734
+ 'url' => 'http://www.woothemes.com/products/woocommerce-pre-orders/',
735
+ 'class' => 'WC_Pre_Orders'
736
+ );
737
+ $modules[] = array(
738
+ 'name' => 'order_numbers_basic',
739
+ 'title' => __( 'WooCommerce Basic Ordernumbers', 'woocommerce-exporter' ),
740
+ 'description' => __( 'Lets the user freely configure the order numbers in WooCommerce.', 'woocommerce-exporter' ),
741
+ 'url' => 'http://open-tools.net/woocommerce/advanced-ordernumbers-for-woocommerce.html',
742
+ 'class' => 'OpenToolsOrdernumbersBasic'
743
+ );
744
+ $modules[] = array(
745
+ 'name' => 'admin_custom_order_fields',
746
+ 'title' => __( 'WooCommerce Admin Custom Order Fields', 'woocommerce-exporter' ),
747
+ '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' ),
748
+ 'url' => 'http://www.woothemes.com/products/woocommerce-admin-custom-order-fields/',
749
+ 'function' => 'init_woocommerce_admin_custom_order_fields'
750
+ );
751
+ $modules[] = array(
752
+ 'name' => 'table_rate_shipping_plus',
753
+ 'title' => __( 'WooCommerce Table Rate Shipping Plus', 'woocommerce-exporter' ),
754
+ 'description' => __( 'Calculate shipping costs based on destination, weight and price.', 'woocommerce-exporter' ),
755
+ 'url' => 'http://mangohour.com/plugins/woocommerce-table-rate-shipping',
756
+ 'function' => 'mh_wc_table_rate_plus_init'
757
+ );
758
+ $modules[] = array(
759
+ 'name' => 'barcode_isbn',
760
+ 'title' => __( 'WooCommerce Barcode & ISBN', 'woocommerce-exporter' ),
761
+ 'description' => __( 'A plugin to add a barcode & ISBN to WooCommerce.', 'woocommerce-exporter' ),
762
+ 'url' => 'https://wordpress.org/plugins/woocommerce-barcode-isbn/',
763
+ 'slug' => 'woocommerce-barcode-isbn',
764
+ 'function' => 'woo_add_barcode'
765
+ );
766
+ $modules[] = array(
767
+ 'name' => 'video_product_tab',
768
+ 'title' => __( 'WooCommerce Video Product Tab', 'woocommerce-exporter' ),
769
+ 'description' => __( 'Extends WooCommerce to allow you to add a Video to the Product page.', 'woocommerce-exporter' ),
770
+ 'url' => 'https://wordpress.org/plugins/woocommerce-video-product-tab/',
771
+ 'slug' => 'woocommerce-video-product-tab',
772
+ 'class' => 'WooCommerce_Video_Product_Tab'
773
+ );
774
+ $modules[] = array(
775
+ 'name' => 'external_featured_image',
776
+ 'title' => __( 'Nelio External Featured Image', 'woocommerce-exporter' ),
777
+ 'description' => __( 'Use external images from anywhere as the featured image of your pages and posts.', 'woocommerce-exporter' ),
778
+ 'url' => 'https://wordpress.org/plugins/external-featured-image/',
779
+ 'slug' => 'external-featured-image', // Define this if the Plugin is hosted on the WordPress repo
780
+ 'function' => '_nelioefi_url'
781
+ );
782
+
783
+ /*
784
+ $modules[] = array(
785
+ 'name' => '',
786
+ 'title' => __( '', 'woocommerce-exporter' ),
787
+ 'description' => __( '', 'woocommerce-exporter' ),
788
+ 'url' => '',
789
+ 'slug' => '', // Define this if the Plugin is hosted on the WordPress repo
790
+ 'function' => ''
791
+ );
792
+ */
793
+
794
+ $modules = apply_filters( 'woo_ce_modules_addons', $modules );
795
+
796
+ if( !empty( $modules ) ) {
797
+ foreach( $modules as $key => $module ) {
798
+ $modules[$key]['status'] = 'inactive';
799
+ // Check if each module is activated
800
+ if( isset( $module['function'] ) ) {
801
+ if( is_array( $module['function'] ) ) {
802
+ $size = count( $module['function'] );
803
+ for( $i = 0; $i < $size; $i++ ) {
804
+ if( function_exists( $module['function'][$i] ) ) {
805
+ $modules[$key]['status'] = 'active';
806
+ break;
807
+ }
808
+ }
809
+ } else {
810
+ if( function_exists( $module['function'] ) )
811
+ $modules[$key]['status'] = 'active';
812
+ }
813
+ } else if( isset( $module['class'] ) ) {
814
+ if( is_array( $module['class'] ) ) {
815
+ $size = count( $module['class'] );
816
+ for( $i = 0; $i < $size; $i++ ) {
817
+ if( function_exists( $module['class'][$i] ) ) {
818
+ $modules[$key]['status'] = 'active';
819
+ break;
820
+ }
821
+ }
822
+ } else {
823
+ if( class_exists( $module['class'] ) )
824
+ $modules[$key]['status'] = 'active';
825
+ }
826
+ }
827
+ // Check if the Plugin has a slug and if current user can install Plugins
828
+ if( current_user_can( 'install_plugins' ) && isset( $module['slug'] ) )
829
+ $modules[$key]['url'] = admin_url( sprintf( 'plugin-install.php?tab=search&type=tag&s=%s', $module['slug'] ) );
830
+ }
831
+ }
832
+ return $modules;
833
+
834
+ }
835
+
836
+ function woo_ce_modules_status_class( $status = 'inactive' ) {
837
+
838
+ $output = '';
839
+ switch( $status ) {
840
+
841
+ case 'active':
842
+ $output = 'green';
843
+ break;
844
+
845
+ case 'inactive':
846
+ $output = 'yellow';
847
+ break;
848
+
849
+ }
850
+ echo $output;
851
+
852
+ }
853
+
854
+ function woo_ce_modules_status_label( $status = 'inactive' ) {
855
+
856
+ $output = '';
857
+ switch( $status ) {
858
+
859
+ case 'active':
860
+ $output = __( 'OK', 'woocommerce-exporter' );
861
+ break;
862
+
863
+ case 'inactive':
864
+ $output = __( 'Install', 'woocommerce-exporter' );
865
+ break;
866
+
867
+ }
868
+ echo $output;
869
+
870
+ }
871
+
872
+ // HTML template for header prompt on Store Exporter screen
873
+ function woo_ce_support_donate() {
874
+
875
+ $output = '';
876
+ $show = true;
877
+ if( function_exists( 'woo_vl_we_love_your_plugins' ) ) {
878
+ if( in_array( WOO_CE_DIRNAME, woo_vl_we_love_your_plugins() ) )
879
+ $show = false;
880
+ }
881
+ if( $show ) {
882
+ $donate_url = 'http://www.visser.com.au/donate/';
883
+ $rate_url = 'http://wordpress.org/support/view/plugin-reviews/' . WOO_CE_DIRNAME;
884
+ $output = '
885
+ <div id="support-donate_rate" class="support-donate_rate">
886
+ <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>
887
+ </div>
888
+ ';
889
+ }
890
+ echo $output;
891
+
892
+ }
893
+ ?>
includes/brand.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
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', 'woocommerce-exporter' )
43
+ );
44
+ $fields[] = array(
45
+ 'name' => 'name',
46
+ 'label' => __( 'Brand Name', 'woocommerce-exporter' )
47
+ );
48
+ $fields[] = array(
49
+ 'name' => 'slug',
50
+ 'label' => __( 'Brand Slug', 'woocommerce-exporter' )
51
+ );
52
+ $fields[] = array(
53
+ 'name' => 'parent_id',
54
+ 'label' => __( 'Parent Term ID', 'woocommerce-exporter' )
55
+ );
56
+ $fields[] = array(
57
+ 'name' => 'description',
58
+ 'label' => __( 'Brand Description', 'woocommerce-exporter' )
59
+ );
60
+ $fields[] = array(
61
+ 'name' => 'image',
62
+ 'label' => __( 'Brand Image', 'woocommerce-exporter' )
63
+ );
64
+
65
+ /*
66
+ $fields[] = array(
67
+ 'name' => '',
68
+ 'label' => __( '', 'woocommerce-exporter' )
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]['reset'] = $i;
93
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
94
+ }
95
+ // Check if we are using PHP 5.3 and above
96
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
97
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
98
+ return $fields;
99
+ break;
100
+
101
+ }
102
+
103
+ }
104
+
105
+ function woo_ce_override_brand_field_labels( $fields = array() ) {
106
+
107
+ $labels = woo_ce_get_option( 'brand_labels', array() );
108
+ if( !empty( $labels ) ) {
109
+ foreach( $fields as $key => $field ) {
110
+ if( isset( $labels[$field['name']] ) )
111
+ $fields[$key]['label'] = $labels[$field['name']];
112
+ }
113
+ }
114
+ return $fields;
115
+
116
+ }
117
+ add_filter( 'woo_ce_brand_fields', 'woo_ce_override_brand_field_labels', 11 );
118
+
119
+ // Returns a list of WooCommerce Product Brands to export process
120
+ function woo_ce_get_product_brands( $args = array() ) {
121
+
122
+ $term_taxonomy = apply_filters( 'woo_ce_brand_term_taxonomy', 'product_brand' );
123
+ $defaults = array(
124
+ 'orderby' => 'name',
125
+ 'order' => 'ASC',
126
+ 'hide_empty' => 0
127
+ );
128
+ $args = wp_parse_args( $args, $defaults );
129
+ $brands = get_terms( $term_taxonomy, $args );
130
+ if( !empty( $brands ) && is_wp_error( $brands ) == false ) {
131
+ foreach( $brands as $key => $brand ) {
132
+ $brands[$key]->description = woo_ce_format_description_excerpt( $brand->description );
133
+ $brands[$key]->parent_name = '';
134
+ if( $brands[$key]->parent_id = $brand->parent ) {
135
+ if( $parent_brand = get_term( $brands[$key]->parent_id, $term_taxonomy ) ) {
136
+ $brands[$key]->parent_name = $parent_brand->name;
137
+ }
138
+ unset( $parent_brand );
139
+ } else {
140
+ $brands[$key]->parent_id = '';
141
+ }
142
+ $brands[$key]->image = ( function_exists( 'get_brand_thumbnail_url' ) ? get_brand_thumbnail_url( $brand->term_id ) : false );
143
+ }
144
+ return $brands;
145
+ }
146
+
147
+ }
148
+ ?>
includes/category.php ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
34
+ // Returns a list of Category export columns
35
+ function woo_ce_get_category_fields( $format = 'full' ) {
36
+
37
+ $export_type = 'category';
38
+
39
+ $fields = array();
40
+ $fields[] = array(
41
+ 'name' => 'term_id',
42
+ 'label' => __( 'Term ID', 'woocommerce-exporter' )
43
+ );
44
+ $fields[] = array(
45
+ 'name' => 'name',
46
+ 'label' => __( 'Category Name', 'woocommerce-exporter' )
47
+ );
48
+ $fields[] = array(
49
+ 'name' => 'slug',
50
+ 'label' => __( 'Category Slug', 'woocommerce-exporter' )
51
+ );
52
+ $fields[] = array(
53
+ 'name' => 'parent_id',
54
+ 'label' => __( 'Parent Term ID', 'woocommerce-exporter' )
55
+ );
56
+ $fields[] = array(
57
+ 'name' => 'description',
58
+ 'label' => __( 'Category Description', 'woocommerce-exporter' )
59
+ );
60
+ $fields[] = array(
61
+ 'name' => 'display_type',
62
+ 'label' => __( 'Display Type', 'woocommerce-exporter' )
63
+ );
64
+ $fields[] = array(
65
+ 'name' => 'image',
66
+ 'label' => __( 'Category Image', 'woocommerce-exporter' )
67
+ );
68
+
69
+ /*
70
+ $fields[] = array(
71
+ 'name' => '',
72
+ 'label' => __( '', 'woocommerce-exporter' )
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 );
82
+ for( $i = 0; $i < $size; $i++ ) {
83
+ $fields[$i]['disabled'] = ( isset( $fields[$i]['disabled'] ) ? $fields[$i]['disabled'] : 0 );
84
+ $fields[$i]['default'] = 1;
85
+ if( !array_key_exists( $fields[$i]['name'], $remember ) )
86
+ $fields[$i]['default'] = 0;
87
+ }
88
+ }
89
+
90
+ switch( $format ) {
91
+
92
+ case 'summary':
93
+ $output = array();
94
+ $size = count( $fields );
95
+ for( $i = 0; $i < $size; $i++ ) {
96
+ if( isset( $fields[$i] ) )
97
+ $output[$fields[$i]['name']] = 'on';
98
+ }
99
+ return $output;
100
+ break;
101
+
102
+ case '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]['reset'] = $i;
108
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
109
+ }
110
+ // Check if we are using PHP 5.3 and above
111
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
112
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
113
+ return $fields;
114
+ break;
115
+
116
+ }
117
+
118
+ }
119
+
120
+ function woo_ce_override_category_field_labels( $fields = array() ) {
121
+
122
+ $labels = woo_ce_get_option( 'category_labels', array() );
123
+ if( !empty( $labels ) ) {
124
+ foreach( $fields as $key => $field ) {
125
+ if( isset( $labels[$field['name']] ) )
126
+ $fields[$key]['label'] = $labels[$field['name']];
127
+ }
128
+ }
129
+ return $fields;
130
+
131
+ }
132
+ add_filter( 'woo_ce_category_fields', 'woo_ce_override_category_field_labels', 11 );
133
+
134
+ // Returns the export column header label based on an export column slug
135
+ function woo_ce_get_category_field( $name = null, $format = 'name' ) {
136
+
137
+ $output = '';
138
+ if( $name ) {
139
+ $fields = woo_ce_get_category_fields();
140
+ $size = count( $fields );
141
+ for( $i = 0; $i < $size; $i++ ) {
142
+ if( $fields[$i]['name'] == $name ) {
143
+ switch( $format ) {
144
+
145
+ case 'name':
146
+ $output = $fields[$i]['label'];
147
+ break;
148
+
149
+ case 'full':
150
+ $output = $fields[$i];
151
+ break;
152
+
153
+ }
154
+ $i = $size;
155
+ }
156
+ }
157
+ }
158
+ return $output;
159
+
160
+ }
161
+
162
+ // Returns a list of WooCommerce Product Categories to export process
163
+ function woo_ce_get_product_categories( $args = array() ) {
164
+
165
+ $term_taxonomy = 'product_cat';
166
+ $defaults = array(
167
+ 'orderby' => 'name',
168
+ 'order' => 'ASC',
169
+ 'hide_empty' => 0
170
+ );
171
+ $args = wp_parse_args( $args, $defaults );
172
+ $categories = get_terms( $term_taxonomy, $args );
173
+ if( !empty( $categories ) && is_wp_error( $categories ) == false ) {
174
+ foreach( $categories as $key => $category ) {
175
+ $categories[$key]->description = woo_ce_format_description_excerpt( $category->description );
176
+ $categories[$key]->parent_name = '';
177
+ if( $categories[$key]->parent_id = $category->parent ) {
178
+ if( $parent_category = get_term( $categories[$key]->parent_id, $term_taxonomy ) ) {
179
+ $categories[$key]->parent_name = $parent_category->name;
180
+ }
181
+ unset( $parent_category );
182
+ } else {
183
+ $categories[$key]->parent_id = '';
184
+ }
185
+ $categories[$key]->image = woo_ce_get_category_thumbnail_url( $category->term_id );
186
+ $categories[$key]->display_type = get_woocommerce_term_meta( $category->term_id, 'display_type', true );
187
+ }
188
+ return $categories;
189
+ }
190
+
191
+ }
192
+
193
+ function woo_ce_get_category_thumbnail_url( $category_id = 0, $size = 'full' ) {
194
+
195
+ if ( $thumbnail_id = get_woocommerce_term_meta( $category_id, 'thumbnail_id', true ) ) {
196
+ $image_attributes = wp_get_attachment_image_src( $thumbnail_id, $size );
197
+ if( is_array( $image_attributes ) )
198
+ return current( $image_attributes );
199
+ }
200
+
201
+ }
202
+ ?>
includes/commission.php ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for disabled Filter Commissions by Commission Date widget on Store Exporter screen
7
+ function woo_ce_commissions_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', '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
+ // Returns date of first Commission received, any status
81
+ function woo_ce_get_commission_first_date() {
82
+
83
+ $output = date( 'd/m/Y', mktime( 0, 0, 0, date( 'n' ), 1 ) );
84
+ $post_type = 'shop_commission';
85
+ $args = array(
86
+ 'post_type' => $post_type,
87
+ 'orderby' => 'post_date',
88
+ 'order' => 'ASC',
89
+ 'numberposts' => 1
90
+ );
91
+ $commissions = get_posts( $args );
92
+ if( $commissions ) {
93
+ $commission = strtotime( $commissions[0]->post_date );
94
+ $output = date( 'd/m/Y', $commission );
95
+ unset( $commissions, $commission );
96
+ }
97
+ return $output;
98
+
99
+ }
100
+
101
+ // HTML template for disabled Commission Sorting widget on Store Exporter screen
102
+ function woo_ce_commission_sorting() {
103
+
104
+ ob_start(); ?>
105
+ <p><label><?php _e( 'Commission Sorting', 'woocommerce-exporter' ); ?></label></p>
106
+ <div>
107
+ <select name="commission_orderby" disabled="disabled">
108
+ <option value="ID"><?php _e( 'Commission ID', 'woocommerce-exporter' ); ?></option>
109
+ <option value="title"><?php _e( 'Commission Title', 'woocommerce-exporter' ); ?></option>
110
+ <option value="date"><?php _e( 'Date Created', 'woocommerce-exporter' ); ?></option>
111
+ <option value="modified"><?php _e( 'Date Modified', 'woocommerce-exporter' ); ?></option>
112
+ <option value="rand"><?php _e( 'Random', 'woocommerce-exporter' ); ?></option>
113
+ </select>
114
+ <select name="commission_order" disabled="disabled">
115
+ <option value="ASC"><?php _e( 'Ascending', 'woocommerce-exporter' ); ?></option>
116
+ <option value="DESC"><?php _e( 'Descending', 'woocommerce-exporter' ); ?></option>
117
+ </select>
118
+ <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>
119
+ </div>
120
+ <?php
121
+ ob_end_flush();
122
+
123
+ }
124
+
125
+ // HTML template for disabled Filter Commissions by Product Vendor widget on Store Exporter screen
126
+ function woo_ce_commissions_filter_by_product_vendor() {
127
+
128
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
129
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
130
+
131
+ $product_vendors = woo_ce_get_product_vendors( array(), 'full' );
132
+
133
+ ob_start(); ?>
134
+ <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>
135
+ <div id="export-commissions-filters-product_vendor" class="separator">
136
+ <?php if( $product_vendors ) { ?>
137
+ <ul>
138
+ <?php foreach( $product_vendors as $product_vendor ) { ?>
139
+ <li>
140
+ <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>
141
+ <span class="description">(<?php echo $product_vendor->count; ?>)</span>
142
+ </li>
143
+ <?php } ?>
144
+ </ul>
145
+ <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>
146
+ <?php } else { ?>
147
+ <p><?php _e( 'No Product Vendors were found.', 'woocommerce-exporter' ); ?></p>
148
+ <?php } ?>
149
+ </div>
150
+ <!-- #export-commissions-filters-product_vendor -->
151
+ <?php
152
+ ob_end_flush();
153
+
154
+ }
155
+
156
+ // HTML template for disabled Filter Commissions by Commission Status widget on Store Exporter screen
157
+ function woo_ce_commissions_filter_by_commission_status() {
158
+
159
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
160
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
161
+
162
+ ob_start(); ?>
163
+ <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>
164
+ <div id="export-commissions-filters-commission_status" class="separator">
165
+ <ul>
166
+ <li>
167
+ <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>
168
+ <span class="description">(<?php echo woo_ce_commissions_stock_status_count( 'unpaid' ); ?>)</span>
169
+ </li>
170
+ <li>
171
+ <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>
172
+ <span class="description">(<?php echo woo_ce_commissions_stock_status_count( 'paid' ); ?>)</span>
173
+ </li>
174
+ </ul>
175
+ <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>
176
+ </div>
177
+ <!-- #export-commissions-filters-commission_status -->
178
+ <?php
179
+ ob_end_flush();
180
+
181
+ }
182
+
183
+ // HTML template for displaying the number of each export type filter on the Archives screen
184
+ function woo_ce_commissions_stock_status_count( $type = '' ) {
185
+
186
+ $output = 0;
187
+ $post_type = 'shop_commission';
188
+ $meta_key = '_paid_status';
189
+ $args = array(
190
+ 'post_type' => $post_type,
191
+ 'meta_key' => $meta_key,
192
+ 'meta_value' => null,
193
+ 'numberposts' => -1,
194
+ 'fields' => 'ids'
195
+ );
196
+ if( $type )
197
+ $args['meta_value'] = $type;
198
+ $commission_ids = new WP_Query( $args );
199
+ if( !empty( $commission_ids->posts ) )
200
+ $output = count( $commission_ids->posts );
201
+ return $output;
202
+
203
+ }
204
+
205
+ /* End of: WordPress Administration */
206
+
207
+ }
208
+
209
+ function woo_ce_get_commission_fields( $format = 'full' ) {
210
+
211
+ $export_type = 'commission';
212
+
213
+ $fields = array();
214
+ $fields[] = array(
215
+ 'name' => 'ID',
216
+ 'label' => __( 'Commission ID', 'woocommerce-exporter' )
217
+ );
218
+ $fields[] = array(
219
+ 'name' => 'post_date',
220
+ 'label' => __( 'Commission Date', 'woocommerce-exporter' )
221
+ );
222
+ $fields[] = array(
223
+ 'name' => 'title',
224
+ 'label' => __( 'Commission Title', 'woocommerce-exporter' )
225
+ );
226
+ $fields[] = array(
227
+ 'name' => 'product_id',
228
+ 'label' => __( 'Product ID', 'woocommerce-exporter' )
229
+ );
230
+ $fields[] = array(
231
+ 'name' => 'product_name',
232
+ 'label' => __( 'Product Name', 'woocommerce-exporter' )
233
+ );
234
+ $fields[] = array(
235
+ 'name' => 'product_sku',
236
+ 'label' => __( 'Product SKU', 'woocommerce-exporter' )
237
+ );
238
+ $fields[] = array(
239
+ 'name' => 'product_vendor_id',
240
+ 'label' => __( 'Product Vendor ID', 'woocommerce-exporter' )
241
+ );
242
+ $fields[] = array(
243
+ 'name' => 'product_vendor_name',
244
+ 'label' => __( 'Product Vendor Name', 'woocommerce-exporter' )
245
+ );
246
+ $fields[] = array(
247
+ 'name' => 'commission_amount',
248
+ 'label' => __( 'Commission Amount', 'woocommerce-exporter' )
249
+ );
250
+ $fields[] = array(
251
+ 'name' => 'paid_status',
252
+ 'label' => __( 'Commission Status', 'woocommerce-exporter' )
253
+ );
254
+ $fields[] = array(
255
+ 'name' => 'post_status',
256
+ 'label' => __( 'Post Status', 'woocommerce-exporter' )
257
+ );
258
+
259
+ /*
260
+ $fields[] = array(
261
+ 'name' => '',
262
+ 'label' => __( '', 'woocommerce-exporter' )
263
+ );
264
+ */
265
+
266
+ // Allow Plugin/Theme authors to add support for additional columns
267
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
268
+
269
+ switch( $format ) {
270
+
271
+ case 'summary':
272
+ $output = array();
273
+ $size = count( $fields );
274
+ for( $i = 0; $i < $size; $i++ ) {
275
+ if( isset( $fields[$i] ) )
276
+ $output[$fields[$i]['name']] = 'on';
277
+ }
278
+ return $output;
279
+ break;
280
+
281
+ case 'full':
282
+ default:
283
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
284
+ $size = count( $fields );
285
+ for( $i = 0; $i < $size; $i++ ) {
286
+ $fields[$i]['reset'] = $i;
287
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
288
+ }
289
+ // Check if we are using PHP 5.3 and above
290
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
291
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
292
+ return $fields;
293
+ break;
294
+
295
+ }
296
+
297
+ }
298
+ ?>
includes/common-dashboard_widgets.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
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.4
7
+
8
+ */
9
+
10
+ /* Start of: WooCommerce News - by Visser Labs */
11
+
12
+ if( !function_exists( 'woo_vl_dashboard_setup' ) ) {
13
+
14
+ function woo_vl_dashboard_setup() {
15
+
16
+ // Limit the Dashboard widget to Users with the Manage Options capability
17
+ if( current_user_can( 'manage_options' ) ) {
18
+ wp_add_dashboard_widget( 'woo_vl_news_widget', __( 'Plugin News - by Visser Labs', 'woocommerce-exporter' ), 'woo_vl_news_widget' );
19
+ }
20
+
21
+ }
22
+ add_action( 'wp_dashboard_setup', 'woo_vl_dashboard_setup' );
23
+
24
+ function woo_vl_news_widget() {
25
+
26
+ include_once( ABSPATH . WPINC . '/feed.php' );
27
+
28
+ // Get the RSS feed for WooCommerce Plugins
29
+ $rss = fetch_feed( 'http://www.visser.com.au/blog/category/woocommerce/feed/' );
30
+ $output = '<div class="rss-widget">';
31
+ if( !is_wp_error( $rss ) ) {
32
+ $maxitems = $rss->get_item_quantity( 5 );
33
+ $rss_items = $rss->get_items( 0, $maxitems );
34
+ $output .= '<ul>';
35
+ foreach ( $rss_items as $item ) :
36
+ $output .= '<li>';
37
+ $output .= '<a href="' . $item->get_permalink() . '" title="' . 'Posted ' . $item->get_date( 'j F Y | g:i a' ) . '" class="rsswidget">' . $item->get_title() . '</a>';
38
+ $output .= '<span class="rss-date">' . $item->get_date( 'j F, Y' ) . '</span>';
39
+ $output .= '<div class="rssSummary">' . $item->get_description() . '</div>';
40
+ $output .= '</li>';
41
+ endforeach;
42
+ $output .= '</ul>';
43
+ } else {
44
+ $message = __( 'Connection failed. Please check your network settings.', 'woocommerce-exporter' );
45
+ $output .= '<p>' . $message . '</p>';
46
+ }
47
+ $output .= '</div>';
48
+
49
+ echo $output;
50
+
51
+ }
52
+
53
+ }
54
+
55
+ /* End of: WooCommerce News - by Visser Labs */
56
+ ?>
includes/coupon.php ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
34
+ // Returns a list of Coupon export columns
35
+ function woo_ce_get_coupon_fields( $format = 'full' ) {
36
+
37
+ $export_type = 'coupon';
38
+
39
+ $fields = array();
40
+ $fields[] = array(
41
+ 'name' => 'coupon_code',
42
+ 'label' => __( 'Coupon Code', 'woocommerce-exporter' )
43
+ );
44
+ $fields[] = array(
45
+ 'name' => 'coupon_description',
46
+ 'label' => __( 'Coupon Description', 'woocommerce-exporter' )
47
+ );
48
+ $fields[] = array(
49
+ 'name' => 'discount_type',
50
+ 'label' => __( 'Discount Type', 'woocommerce-exporter' )
51
+ );
52
+ $fields[] = array(
53
+ 'name' => 'coupon_amount',
54
+ 'label' => __( 'Coupon Amount', 'woocommerce-exporter' )
55
+ );
56
+ $fields[] = array(
57
+ 'name' => 'individual_use',
58
+ 'label' => __( 'Individual Use', 'woocommerce-exporter' )
59
+ );
60
+ $fields[] = array(
61
+ 'name' => 'apply_before_tax',
62
+ 'label' => __( 'Apply before tax', 'woocommerce-exporter' )
63
+ );
64
+ $fields[] = array(
65
+ 'name' => 'exclude_sale_items',
66
+ 'label' => __( 'Exclude sale items', 'woocommerce-exporter' )
67
+ );
68
+ $fields[] = array(
69
+ 'name' => 'minimum_amount',
70
+ 'label' => __( 'Minimum Amount', 'woocommerce-exporter' )
71
+ );
72
+ $fields[] = array(
73
+ 'name' => 'product_ids',
74
+ 'label' => __( 'Products', 'woocommerce-exporter' )
75
+ );
76
+ $fields[] = array(
77
+ 'name' => 'exclude_product_ids',
78
+ 'label' => __( 'Exclude Products', 'woocommerce-exporter' )
79
+ );
80
+ $fields[] = array(
81
+ 'name' => 'product_categories',
82
+ 'label' => __( 'Product Categories', 'woocommerce-exporter' )
83
+ );
84
+ $fields[] = array(
85
+ 'name' => 'exclude_product_categories',
86
+ 'label' => __( 'Exclude Product Categories', 'woocommerce-exporter' )
87
+ );
88
+ $fields[] = array(
89
+ 'name' => 'customer_email',
90
+ 'label' => __( 'Customer e-mails', 'woocommerce-exporter' )
91
+ );
92
+ $fields[] = array(
93
+ 'name' => 'usage_limit',
94
+ 'label' => __( 'Usage Limit', 'woocommerce-exporter' )
95
+ );
96
+ $fields[] = array(
97
+ 'name' => 'expiry_date',
98
+ 'label' => __( 'Expiry Date', 'woocommerce-exporter' )
99
+ );
100
+
101
+ /*
102
+ $fields[] = array(
103
+ 'name' => '',
104
+ 'label' => __( '', 'woocommerce-exporter' )
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':
114
+ $output = array();
115
+ $size = count( $fields );
116
+ for( $i = 0; $i < $size; $i++ ) {
117
+ if( isset( $fields[$i] ) )
118
+ $output[$fields[$i]['name']] = 'on';
119
+ }
120
+ return $output;
121
+ break;
122
+
123
+ case '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]['reset'] = $i;
129
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
130
+ }
131
+ // Check if we are using PHP 5.3 and above
132
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
133
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
134
+ return $fields;
135
+ break;
136
+
137
+ }
138
+
139
+ }
140
+
141
+ function woo_ce_override_coupon_field_labels( $fields = array() ) {
142
+
143
+ $labels = woo_ce_get_option( 'coupon_labels', array() );
144
+ if( !empty( $labels ) ) {
145
+ foreach( $fields as $key => $field ) {
146
+ if( isset( $labels[$field['name']] ) )
147
+ $fields[$key]['label'] = $labels[$field['name']];
148
+ }
149
+ }
150
+ return $fields;
151
+
152
+ }
153
+ add_filter( 'woo_ce_coupon_fields', 'woo_ce_override_coupon_field_labels', 11 );
154
+
155
+ // Returns a list of Coupon IDs
156
+ function woo_ce_get_coupons( $args = array() ) {
157
+
158
+ global $export;
159
+
160
+ $limit_volume = -1;
161
+ $offset = 0;
162
+
163
+ if( $args ) {
164
+ $limit_volume = ( isset( $args['limit_volume'] ) ? $args['limit_volume'] : false );
165
+ $offset = ( isset( $args['offset'] ) ? $args['offset'] : false );
166
+ $orderby = ( isset( $args['coupon_orderby'] ) ? $args['coupon_orderby'] : 'ID' );
167
+ $order = ( isset( $args['coupon_order'] ) ? $args['coupon_order'] : 'ASC' );
168
+ }
169
+
170
+ $post_type = 'shop_coupon';
171
+ $args = array(
172
+ 'post_type' => $post_type,
173
+ 'orderby' => $orderby,
174
+ 'order' => $order,
175
+ 'offset' => $offset,
176
+ 'posts_per_page' => $limit_volume,
177
+ 'post_status' => woo_ce_post_statuses(),
178
+ 'fields' => 'ids',
179
+ 'suppress_filters' => false
180
+ );
181
+ $coupons = array();
182
+ $coupon_ids = new WP_Query( $args );
183
+ if( $coupon_ids->posts ) {
184
+ foreach( $coupon_ids->posts as $coupon_id )
185
+ $coupons[] = $coupon_id;
186
+ unset( $coupon_ids, $coupon_id );
187
+ }
188
+ return $coupons;
189
+
190
+ }
191
+
192
+ function woo_ce_get_coupon_code_usage( $coupon_code = '' ) {
193
+
194
+ global $wpdb;
195
+
196
+ $count = 0;
197
+ if( $coupon_code ) {
198
+ $order_item_type = 'coupon';
199
+ $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 );
200
+ $count = $wpdb->get_var( $count_sql );
201
+ }
202
+ return $count;
203
+
204
+ }
205
+ ?>
includes/customer.php ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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', '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 disabled Filter Customers by User Role widget on Store Exporter screen
39
+ function woo_ce_customers_filter_by_user_role() {
40
+
41
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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 = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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
+
125
+ // Returns a list of Customer export columns
126
+ function woo_ce_get_customer_fields( $format = 'full' ) {
127
+
128
+ $export_type = 'customer';
129
+
130
+ $fields = array();
131
+ $fields[] = array(
132
+ 'name' => 'user_id',
133
+ 'label' => __( 'User ID', 'woocommerce-exporter' )
134
+ );
135
+ $fields[] = array(
136
+ 'name' => 'user_name',
137
+ 'label' => __( 'Username', 'woocommerce-exporter' )
138
+ );
139
+ $fields[] = array(
140
+ 'name' => 'user_role',
141
+ 'label' => __( 'User Role', 'woocommerce-exporter' )
142
+ );
143
+ $fields[] = array(
144
+ 'name' => 'billing_full_name',
145
+ 'label' => __( 'Billing: Full Name', 'woocommerce-exporter' )
146
+ );
147
+ $fields[] = array(
148
+ 'name' => 'billing_first_name',
149
+ 'label' => __( 'Billing: First Name', 'woocommerce-exporter' )
150
+ );
151
+ $fields[] = array(
152
+ 'name' => 'billing_last_name',
153
+ 'label' => __( 'Billing: Last Name', 'woocommerce-exporter' )
154
+ );
155
+ $fields[] = array(
156
+ 'name' => 'billing_company',
157
+ 'label' => __( 'Billing: Company', 'woocommerce-exporter' )
158
+ );
159
+ $fields[] = array(
160
+ 'name' => 'billing_address',
161
+ 'label' => __( 'Billing: Street Address', 'woocommerce-exporter' )
162
+ );
163
+ $fields[] = array(
164
+ 'name' => 'billing_city',
165
+ 'label' => __( 'Billing: City', 'woocommerce-exporter' )
166
+ );
167
+ $fields[] = array(
168
+ 'name' => 'billing_postcode',
169
+ 'label' => __( 'Billing: ZIP Code', 'woocommerce-exporter' )
170
+ );
171
+ $fields[] = array(
172
+ 'name' => 'billing_state',
173
+ 'label' => __( 'Billing: State (prefix)', 'woocommerce-exporter' )
174
+ );
175
+ $fields[] = array(
176
+ 'name' => 'billing_state_full',
177
+ 'label' => __( 'Billing: State', 'woocommerce-exporter' )
178
+ );
179
+ $fields[] = array(
180
+ 'name' => 'billing_country',
181
+ 'label' => __( 'Billing: Country', 'woocommerce-exporter' )
182
+ );
183
+ $fields[] = array(
184
+ 'name' => 'billing_phone',
185
+ 'label' => __( 'Billing: Phone Number', 'woocommerce-exporter' )
186
+ );
187
+ $fields[] = array(
188
+ 'name' => 'billing_email',
189
+ 'label' => __( 'Billing: E-mail Address', 'woocommerce-exporter' )
190
+ );
191
+ $fields[] = array(
192
+ 'name' => 'shipping_full_name',
193
+ 'label' => __( 'Shipping: Full Name', 'woocommerce-exporter' )
194
+ );
195
+ $fields[] = array(
196
+ 'name' => 'shipping_first_name',
197
+ 'label' => __( 'Shipping: First Name', 'woocommerce-exporter' )
198
+ );
199
+ $fields[] = array(
200
+ 'name' => 'shipping_last_name',
201
+ 'label' => __( 'Shipping: Last Name', 'woocommerce-exporter' )
202
+ );
203
+ $fields[] = array(
204
+ 'name' => 'shipping_company',
205
+ 'label' => __( 'Shipping: Company', 'woocommerce-exporter' )
206
+ );
207
+ $fields[] = array(
208
+ 'name' => 'shipping_address',
209
+ 'label' => __( 'Shipping: Street Address', 'woocommerce-exporter' )
210
+ );
211
+ $fields[] = array(
212
+ 'name' => 'shipping_city',
213
+ 'label' => __( 'Shipping: City', 'woocommerce-exporter' )
214
+ );
215
+ $fields[] = array(
216
+ 'name' => 'shipping_postcode',
217
+ 'label' => __( 'Shipping: ZIP Code', 'woocommerce-exporter' )
218
+ );
219
+ $fields[] = array(
220
+ 'name' => 'shipping_state',
221
+ 'label' => __( 'Shipping: State (prefix)', 'woocommerce-exporter' )
222
+ );
223
+ $fields[] = array(
224
+ 'name' => 'shipping_state_full',
225
+ 'label' => __( 'Shipping: State', 'woocommerce-exporter' )
226
+ );
227
+ $fields[] = array(
228
+ 'name' => 'shipping_country',
229
+ 'label' => __( 'Shipping: Country (prefix)', 'woocommerce-exporter' )
230
+ );
231
+ $fields[] = array(
232
+ 'name' => 'shipping_country_full',
233
+ 'label' => __( 'Shipping: Country', 'woocommerce-exporter' )
234
+ );
235
+ $fields[] = array(
236
+ 'name' => 'total_spent',
237
+ 'label' => __( 'Total Spent', 'woocommerce-exporter' )
238
+ );
239
+ $fields[] = array(
240
+ 'name' => 'completed_orders',
241
+ 'label' => __( 'Completed Orders', 'woocommerce-exporter' )
242
+ );
243
+ $fields[] = array(
244
+ 'name' => 'total_orders',
245
+ 'label' => __( 'Total Orders', 'woocommerce-exporter' )
246
+ );
247
+
248
+ /*
249
+ $fields[] = array(
250
+ 'name' => '',
251
+ 'label' => __( '', 'woocommerce-exporter' )
252
+ );
253
+ */
254
+
255
+ // Allow Plugin/Theme authors to add support for additional columns
256
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
257
+
258
+ switch( $format ) {
259
+
260
+ case 'summary':
261
+ $output = array();
262
+ $size = count( $fields );
263
+ for( $i = 0; $i < $size; $i++ ) {
264
+ if( isset( $fields[$i] ) )
265
+ $output[$fields[$i]['name']] = 'on';
266
+ }
267
+ return $output;
268
+ break;
269
+
270
+ case 'full':
271
+ default:
272
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
273
+ $size = count( $fields );
274
+ for( $i = 0; $i < $size; $i++ ) {
275
+ $fields[$i]['reset'] = $i;
276
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
277
+ }
278
+ // Check if we are using PHP 5.3 and above
279
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
280
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
281
+ return $fields;
282
+ break;
283
+
284
+ }
285
+
286
+ }
287
+
288
+ function woo_ce_override_customer_field_labels( $fields = array() ) {
289
+
290
+ $labels = woo_ce_get_option( 'customer_labels', array() );
291
+ if( !empty( $labels ) ) {
292
+ foreach( $fields as $key => $field ) {
293
+ if( isset( $labels[$field['name']] ) )
294
+ $fields[$key]['label'] = $labels[$field['name']];
295
+ }
296
+ }
297
+ return $fields;
298
+
299
+ }
300
+ add_filter( 'woo_ce_customer_fields', 'woo_ce_override_customer_field_labels', 11 );
301
+ ?>
includes/export-csv.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Function to generate filename of CSV file based on the Export type
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 );
10
+ if( ( strpos( $filename, '.xml' ) !== false ) || ( strpos( $filename, '.xls' ) !== false ) )
11
+ $filename = str_replace( array( '.xml', '.xls' ), '.csv', $filename );
12
+
13
+ // Add file extension if it has been removed
14
+ if( strpos( $filename, '.csv' ) === false )
15
+ $filename .= '.csv';
16
+
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
29
+ return $filename;
30
+
31
+ }
32
+
33
+ // File output header for CSV file
34
+ function woo_ce_generate_csv_header( $export_type = '' ) {
35
+
36
+ global $export;
37
+
38
+ if( $filename = woo_ce_generate_csv_filename( $export_type ) ) {
39
+ $mime_type = 'text/csv';
40
+ header( sprintf( 'Content-Encoding: %s', esc_attr( $export->encoding ) ) );
41
+ header( sprintf( 'Content-Type: %s; charset=%s', $mime_type, esc_attr( $export->encoding ) ) );
42
+ header( 'Content-Transfer-Encoding: binary' );
43
+ header( sprintf( 'Content-Disposition: attachment; filename=%s', $filename ) );
44
+ header( 'Pragma: no-cache' );
45
+ header( 'Expires: 0' );
46
+ }
47
+
48
+ }
49
+ ?>
includes/formatting.php ADDED
@@ -0,0 +1,599 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function woo_ce_file_encoding( $content = '' ) {
3
+
4
+ global $export;
5
+
6
+ if( function_exists( 'mb_convert_encoding' ) ) {
7
+ $to_encoding = $export->encoding;
8
+ $from_encoding = 'auto';
9
+ if( !empty( $to_encoding ) )
10
+ $content = mb_convert_encoding( trim( $content ), $to_encoding, $from_encoding );
11
+ if( $to_encoding <> 'UTF-8' )
12
+ $content = utf8_encode( $content );
13
+ }
14
+ return $content;
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 );
56
+ $string = wp_specialchars_decode( $string );
57
+ $string = str_replace( PHP_EOL, "\r\n", $string );
58
+ switch( $format ) {
59
+
60
+ case 'all':
61
+ $string = '"' . $string . '"';
62
+ break;
63
+
64
+ case 'excel':
65
+ if( strpos( $string, '"' ) !== false or strpos( $string, ',' ) !== false or strpos( $string, "\r" ) !== false or strpos( $string, "\n" ) !== false )
66
+ $string = '"' . $string . '"';
67
+ break;
68
+
69
+ }
70
+ return $string;
71
+
72
+ }
73
+
74
+ function woo_ce_sanitize_key( $key ) {
75
+
76
+ // Limit length of key to 24 characters
77
+ $key = substr( $key, 0, 24 );
78
+ return $key;
79
+
80
+ }
81
+
82
+ // Return the element count of an object
83
+ function woo_ce_count_object( $object = 0, $exclude_post_types = array() ) {
84
+
85
+ $count = 0;
86
+ if( is_object( $object ) ) {
87
+ if( $exclude_post_types ) {
88
+ $size = count( $exclude_post_types );
89
+ for( $i = 0; $i < $size; $i++ ) {
90
+ if( isset( $object->$exclude_post_types[$i] ) )
91
+ unset( $object->$exclude_post_types[$i] );
92
+ }
93
+ }
94
+ if( !empty( $object ) ) {
95
+ foreach( $object as $key => $item )
96
+ $count = $item + $count;
97
+ }
98
+ } else {
99
+ $count = $object;
100
+ }
101
+ return $count;
102
+
103
+ }
104
+
105
+ // Takes an array or comma separated string and returns an export formatted string
106
+ function woo_ce_convert_product_ids( $product_ids = null ) {
107
+
108
+ global $export;
109
+
110
+ $output = '';
111
+ if( $product_ids !== null ) {
112
+ if( is_array( $product_ids ) ) {
113
+ $size = count( $product_ids );
114
+ for( $i = 0; $i < $size; $i++ )
115
+ $output .= $product_ids[$i] . $export->category_separator;
116
+ $output = substr( $output, 0, -1 );
117
+ } else if( strstr( $product_ids, ',' ) ) {
118
+ $output = str_replace( ',', $export->category_separator, $product_ids );
119
+ }
120
+ }
121
+ return $output;
122
+
123
+ }
124
+
125
+ function woo_ce_format_visibility( $visibility = '' ) {
126
+
127
+ $output = '';
128
+ if( $visibility ) {
129
+ switch( $visibility ) {
130
+
131
+ case 'visible':
132
+ $output = __( 'Catalog & Search', 'woocommerce-exporter' );
133
+ break;
134
+
135
+ case 'catalog':
136
+ $output = __( 'Catalog', 'woocommerce-exporter' );
137
+ break;
138
+
139
+ case 'search':
140
+ $output = __( 'Search', 'woocommerce-exporter' );
141
+ break;
142
+
143
+ case 'hidden':
144
+ $output = __( 'Hidden', 'woocommerce-exporter' );
145
+ break;
146
+
147
+ }
148
+ }
149
+ return $output;
150
+
151
+ }
152
+
153
+ function woo_ce_format_download_type( $download_type = '' ) {
154
+
155
+ $output = __( 'Standard', 'woocommerce-exporter' );
156
+ if( $download_type ) {
157
+ switch( $download_type ) {
158
+
159
+ case 'application':
160
+ $output = __( 'Application', 'woocommerce-exporter' );
161
+ break;
162
+
163
+ case 'music':
164
+ $output = __( 'Music', 'woocommerce-exporter' );
165
+ break;
166
+
167
+ }
168
+ }
169
+ return $output;
170
+
171
+ }
172
+
173
+ // Format the raw post_status
174
+ function woo_ce_format_product_status( $product_status = '' ) {
175
+
176
+ $output = $product_status;
177
+ switch( $product_status ) {
178
+
179
+ case 'publish':
180
+ $output = __( 'Publish', 'woocommerce-exporter' );
181
+ break;
182
+
183
+ case 'draft':
184
+ $output = __( 'Draft', 'woocommerce-exporter' );
185
+ break;
186
+
187
+ case 'trash':
188
+ $output = __( 'Trash', 'woocommerce-exporter' );
189
+ break;
190
+
191
+ }
192
+ return $output;
193
+
194
+ }
195
+
196
+ // Format the raw comment_status
197
+ function woo_ce_format_comment_status( $comment_status ) {
198
+
199
+ $output = $comment_status;
200
+ switch( $comment_status ) {
201
+
202
+ case 'open':
203
+ $output = __( 'Open', 'woocommerce-exporter' );
204
+ break;
205
+
206
+ case 'closed':
207
+ $output = __( 'Closed', 'woocommerce-exporter' );
208
+ break;
209
+
210
+ }
211
+ return $output;
212
+
213
+ }
214
+
215
+ function woo_ce_format_gpf_availability( $availability = null ) {
216
+
217
+ $output = '';
218
+ if( $availability ) {
219
+ switch( $availability ) {
220
+
221
+ case 'in stock':
222
+ $output = __( 'In Stock', 'woocommerce-exporter' );
223
+ break;
224
+
225
+ case 'available for order':
226
+ $output = __( 'Available For Order', 'woocommerce-exporter' );
227
+ break;
228
+
229
+ case 'preorder':
230
+ $output = __( 'Pre-order', 'woocommerce-exporter' );
231
+ break;
232
+
233
+ }
234
+ }
235
+ return $output;
236
+
237
+ }
238
+
239
+ function woo_ce_format_gpf_condition( $condition ) {
240
+
241
+ switch( $condition ) {
242
+
243
+ case 'new':
244
+ $output = __( 'New', 'woocommerce-exporter' );
245
+ break;
246
+
247
+ case 'refurbished':
248
+ $output = __( 'Refurbished', 'woocommerce-exporter' );
249
+ break;
250
+
251
+ case 'used':
252
+ $output = __( 'Used', 'woocommerce-exporter' );
253
+ break;
254
+
255
+ }
256
+ return $output;
257
+
258
+ }
259
+
260
+ function woo_ce_format_switch( $input = '', $output_format = 'answer' ) {
261
+
262
+ $input = strtolower( $input );
263
+ switch( $input ) {
264
+
265
+ case '1':
266
+ case 'yes':
267
+ case 'on':
268
+ case 'open':
269
+ case 'active':
270
+ $input = '1';
271
+ break;
272
+
273
+ case '0':
274
+ case 'no':
275
+ case 'off':
276
+ case 'closed':
277
+ case 'inactive':
278
+ default:
279
+ $input = '0';
280
+ break;
281
+
282
+ }
283
+ $output = '';
284
+ switch( $output_format ) {
285
+
286
+ case 'int':
287
+ $output = $input;
288
+ break;
289
+
290
+ case 'answer':
291
+ switch( $input ) {
292
+
293
+ case '1':
294
+ $output = __( 'Yes', 'woocommerce-exporter' );
295
+ break;
296
+
297
+ case '0':
298
+ $output = __( 'No', 'woocommerce-exporter' );
299
+ break;
300
+
301
+ }
302
+ break;
303
+
304
+ case 'boolean':
305
+ switch( $input ) {
306
+
307
+ case '1':
308
+ $output = 'on';
309
+ break;
310
+
311
+ case '0':
312
+ $output = 'off';
313
+ break;
314
+
315
+ }
316
+ break;
317
+
318
+ }
319
+ return $output;
320
+
321
+ }
322
+
323
+ function woo_ce_format_stock_status( $stock_status = '', $stock = '' ) {
324
+
325
+ $output = '';
326
+ if( empty( $stock_status ) && !empty( $stock ) ) {
327
+ if( $stock )
328
+ $stock_status = 'instock';
329
+ else
330
+ $stock_status = 'outofstock';
331
+ }
332
+ if( $stock_status ) {
333
+ switch( $stock_status ) {
334
+
335
+ case 'instock':
336
+ $output = __( 'In Stock', 'woocommerce-exporter' );
337
+ break;
338
+
339
+ case 'outofstock':
340
+ $output = __( 'Out of Stock', 'woocommerce-exporter' );
341
+ break;
342
+
343
+ }
344
+ }
345
+ return $output;
346
+
347
+ }
348
+
349
+ function woo_ce_format_tax_status( $tax_status = null ) {
350
+
351
+ $output = '';
352
+ if( $tax_status ) {
353
+ switch( $tax_status ) {
354
+
355
+ case 'taxable':
356
+ $output = __( 'Taxable', 'woocommerce-exporter' );
357
+ break;
358
+
359
+ case 'shipping':
360
+ $output = __( 'Shipping Only', 'woocommerce-exporter' );
361
+ break;
362
+
363
+ case 'none':
364
+ $output = __( 'None', 'woocommerce-exporter' );
365
+ break;
366
+
367
+ }
368
+ }
369
+ return $output;
370
+
371
+ }
372
+
373
+ function woo_ce_format_tax_class( $tax_class = '' ) {
374
+
375
+ global $export;
376
+
377
+ $output = '';
378
+ if( $tax_class ) {
379
+ switch( $tax_class ) {
380
+
381
+ case '*':
382
+ $tax_class = __( 'Standard', 'woocommerce-exporter' );
383
+ break;
384
+
385
+ case 'reduced-rate':
386
+ $tax_class = __( 'Reduced Rate', 'woocommerce-exporter' );
387
+ break;
388
+
389
+ case 'zero-rate':
390
+ $tax_class = __( 'Zero Rate', 'woocommerce-exporter' );
391
+ break;
392
+
393
+ }
394
+ $output = $tax_class;
395
+ }
396
+ return $output;
397
+
398
+ }
399
+
400
+ function woo_ce_format_product_filters( $product_filters = array() ) {
401
+
402
+ $output = array();
403
+ if( !empty( $product_filters ) ) {
404
+ foreach( $product_filters as $product_filter )
405
+ $output[] = $product_filter;
406
+ }
407
+ return $output;
408
+
409
+ }
410
+
411
+ function woo_ce_format_user_role_filters( $user_role_filters = array() ) {
412
+
413
+ $output = array();
414
+ if( !empty( $user_role_filters ) ) {
415
+ foreach( $user_role_filters as $user_role_filter )
416
+ $output[] = $user_role_filter;
417
+ }
418
+ return $output;
419
+
420
+ }
421
+
422
+ function woo_ce_format_user_role_label( $user_role = '' ) {
423
+
424
+ global $wp_roles;
425
+
426
+ $output = $user_role;
427
+ if( $user_role ) {
428
+ $user_roles = woo_ce_get_user_roles();
429
+ if( isset( $user_roles[$user_role] ) )
430
+ $output = ucfirst( $user_roles[$user_role]['name'] );
431
+ unset( $user_roles );
432
+ }
433
+ return $output;
434
+
435
+ }
436
+
437
+ function woo_ce_format_product_type( $type_id = '' ) {
438
+
439
+ $output = $type_id;
440
+ if( $output ) {
441
+ $product_types = apply_filters( 'woo_ce_format_product_types', array(
442
+ 'simple' => __( 'Simple Product', 'woocommerce' ),
443
+ 'downloadable' => __( 'Downloadable', 'woocommerce' ),
444
+ 'grouped' => __( 'Grouped Product', 'woocommerce' ),
445
+ 'virtual' => __( 'Virtual', 'woocommerce' ),
446
+ 'variable' => __( 'Variable', 'woocommerce' ),
447
+ 'external' => __( 'External/Affiliate Product', 'woocommerce' ),
448
+ 'variation' => __( 'Variation', 'woocommerce-exporter' )
449
+ ) );
450
+ if( isset( $product_types[$type_id] ) )
451
+ $output = $product_types[$type_id];
452
+ }
453
+ return $output;
454
+
455
+ }
456
+
457
+ function woo_ce_format_price( $price = '', $currency = '' ) {
458
+
459
+ // Check that a valid price has been provided and that wc_price() exists
460
+ if( $price !== false && function_exists( 'wc_price' ) ) {
461
+ // WooCommerce adds currency formatting to the price, let's not do that
462
+ add_filter( 'wc_price', 'woo_ce_filter_wc_price', 10, 3 );
463
+ add_filter( 'formatted_woocommerce_price', 'woo_ce_formatted_woocommerce_price', 10, 5 );
464
+ return wc_price( $price, array( 'currency' => $currency ) );
465
+ remove_filter( 'formatted_woocommerce_price', 'woo_ce_formatted_woocommerce_price' );
466
+ remove_filter( 'wc_price', 'woo_ce_filter_wc_price' );
467
+ } else {
468
+ return $price;
469
+ }
470
+
471
+ }
472
+
473
+ function woo_ce_filter_wc_price( $return, $price ) {
474
+
475
+ return $price;
476
+
477
+ }
478
+
479
+ function woo_ce_formatted_woocommerce_price( $return, $price, $num_decimals, $decimal_sep, $thousands_sep ) {
480
+
481
+ $decimal_sep = apply_filters( 'woo_ce_wc_price_decimal_sep', $decimal_sep );
482
+ $thousands_sep = apply_filters( 'woo_ce_wc_price_thousands_sep', '' );
483
+
484
+ $price = number_format( $price, $num_decimals, $decimal_sep, $thousands_sep );
485
+ return $price;
486
+
487
+ }
488
+
489
+ function woo_ce_format_sale_price_dates( $sale_date = '' ) {
490
+
491
+ $output = $sale_date;
492
+ if( $sale_date )
493
+ $output = woo_ce_format_date( date( 'Y-m-d H:i:s', $sale_date ) );
494
+ return $output;
495
+
496
+ }
497
+
498
+ function woo_ce_format_date( $date = '' ) {
499
+
500
+ $output = $date;
501
+ $date_format = woo_ce_get_option( 'date_format', 'd/m/Y' );
502
+ if( !empty( $date ) && $date_format != '' )
503
+ $output = mysql2date( $date_format, $date );
504
+ return $output;
505
+
506
+ }
507
+
508
+ function woo_ce_format_archive_date( $post_ID = 0, $time = false ) {
509
+
510
+ if( $time == false )
511
+ $time = get_post_time( 'G', true, $post_ID, false );
512
+ if( ( abs( $t_diff = time() - $time ) ) < 86400 )
513
+ $post_date = sprintf( __( '%s ago' ), human_time_diff( $time ) );
514
+ else
515
+ $post_date = mysql2date( get_option( 'date_format', 'd/m/Y' ), date( 'Y/m/d', $time ) );
516
+ unset( $time );
517
+ return $post_date;
518
+
519
+ }
520
+
521
+ function woo_ce_format_product_category_label( $product_category = '', $parent_category = '' ) {
522
+
523
+ $output = $product_category;
524
+ if( !empty( $parent_category ) )
525
+ $output .= ' &raquo; ' . $parent_category;
526
+ return $output;
527
+
528
+ }
529
+
530
+ function woo_ce_clean_export_label( $label = '' ) {
531
+
532
+ // If the first character is an underscore remove it
533
+ if( $label[0] === '_' )
534
+ $label = substr( $label, 1 );
535
+ // Replace any underscores with spaces
536
+ $label = str_replace( '_', ' ', $label );
537
+ // Auto-capitalise label
538
+ $label = ucfirst( $label );
539
+ return $label;
540
+
541
+ }
542
+
543
+ if( !function_exists( 'woo_ce_expand_state_name' ) ) {
544
+ function woo_ce_expand_state_name( $country_prefix = '', $state_prefix = '' ) {
545
+
546
+ global $woocommerce;
547
+
548
+ $output = $state_prefix;
549
+ if( $output ) {
550
+ if( isset( $woocommerce->countries ) ) {
551
+ if( $states = $woocommerce->countries->get_states( $country_prefix ) ) {
552
+ if( isset( $states[$state_prefix] ) )
553
+ $output = $states[$state_prefix];
554
+ }
555
+ unset( $states );
556
+ }
557
+ }
558
+ return $output;
559
+
560
+ }
561
+ }
562
+
563
+ if( !function_exists( 'woo_ce_expand_country_name' ) ) {
564
+ function woo_ce_expand_country_name( $country_prefix = '' ) {
565
+
566
+ $output = $country_prefix;
567
+ if( !empty( $output ) && class_exists( 'WC_Countries' ) ) {
568
+ if( $countries = woo_ce_allowed_countries() ) {
569
+ if( isset( $countries[$country_prefix] ) )
570
+ $output = $countries[$country_prefix];
571
+ }
572
+ unset( $countries );
573
+ }
574
+ return $output;
575
+
576
+ }
577
+ }
578
+
579
+ function woo_ce_allowed_countries() {
580
+
581
+ if( class_exists( 'WC_Countries' ) ) {
582
+ $countries = new WC_Countries();
583
+ if( method_exists( $countries, 'get_allowed_countries' ) ) {
584
+ $countries = $countries->get_allowed_countries();
585
+ return $countries;
586
+ }
587
+ }
588
+
589
+ }
590
+
591
+ function woo_ce_format_description_excerpt( $string = '' ) {
592
+
593
+ if( $description_excerpt_formatting = woo_ce_get_option( 'description_excerpt_formatting', 0 ) ) {
594
+ $string = wp_kses( $string );
595
+ }
596
+ return $string;
597
+
598
+ }
599
+ ?>
includes/functions.php ADDED
@@ -0,0 +1,1002 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ include_once( WOO_CE_PATH . 'includes/product.php' );
3
+ include_once( WOO_CE_PATH . 'includes/category.php' );
4
+ include_once( WOO_CE_PATH . 'includes/tag.php' );
5
+ include_once( WOO_CE_PATH . 'includes/brand.php' );
6
+ include_once( WOO_CE_PATH . 'includes/order.php' );
7
+ include_once( WOO_CE_PATH . 'includes/customer.php' );
8
+ include_once( WOO_CE_PATH . 'includes/user.php' );
9
+ include_once( WOO_CE_PATH . 'includes/coupon.php' );
10
+ include_once( WOO_CE_PATH . 'includes/subscription.php' );
11
+ include_once( WOO_CE_PATH . 'includes/product_vendor.php' );
12
+ include_once( WOO_CE_PATH . 'includes/commission.php' );
13
+ include_once( WOO_CE_PATH . 'includes/shipping_class.php' );
14
+
15
+ // Check if we are using PHP 5.3 and above
16
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
17
+ include_once( WOO_CE_PATH . 'includes/legacy.php' );
18
+ include_once( WOO_CE_PATH . 'includes/formatting.php' );
19
+
20
+ include_once( WOO_CE_PATH . 'includes/export-csv.php' );
21
+
22
+ if( is_admin() ) {
23
+
24
+ /* Start of: WordPress Administration */
25
+
26
+ include_once( WOO_CE_PATH . 'includes/admin.php' );
27
+ include_once( WOO_CE_PATH . 'includes/settings.php' );
28
+
29
+ function woo_ce_detect_non_woo_install() {
30
+
31
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter/usage/';
32
+ if( !woo_is_woo_activated() && ( woo_is_jigo_activated() || woo_is_wpsc_activated() ) ) {
33
+ $message = sprintf( __( 'We have detected another e-Commerce Plugin than WooCommerce activated, please check that you are using Store Exporter for the correct platform. <a href="%s" target="_blank">Need help?</a>', 'woocommerce-exporter' ), $troubleshooting_url );
34
+ woo_ce_admin_notice( $message, 'error', 'plugins.php' );
35
+ } else if( !woo_is_woo_activated() ) {
36
+ $message = sprintf( __( '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. <a href="%s" target="_blank">Need help?</a>', 'woocommerce-exporter' ), $troubleshooting_url );
37
+ woo_ce_admin_notice( $message, 'error', 'plugins.php' );
38
+ }
39
+ woo_ce_plugin_page_notices();
40
+
41
+ }
42
+
43
+ // Displays a HTML notice when a WordPress or Store Exporter error is encountered
44
+ function woo_ce_admin_fail_notices() {
45
+
46
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter/usage/';
47
+
48
+ // If the failed flag is set then prepare for an error notice
49
+ if( isset( $_GET['failed'] ) ) {
50
+ $message = '';
51
+ if( isset( $_GET['message'] ) )
52
+ $message = urldecode( $_GET['message'] );
53
+ if( $message )
54
+ $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>)';
55
+ else
56
+ $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>)';
57
+ woo_ce_admin_notice_html( $message, 'error' );
58
+ }
59
+
60
+ // Displays a HTML notice where the memory allocated to WordPress falls below 64MB
61
+ if( !woo_ce_get_option( 'dismiss_execution_time_prompt', 0 ) ) {
62
+ $max_execution_time = absint( ini_get( 'max_execution_time' ) );
63
+ $response = ini_set( 'max_execution_time', 120 );
64
+ if( $response == false || ( $response != $max_execution_time ) ) {
65
+ $dismiss_url = esc_url( add_query_arg( array( 'action' => 'dismiss_execution_time_prompt', '_wpnonce' => wp_create_nonce( 'woo_ce_dismiss_execution_time_prompt' ) ) ) );
66
+ $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 );
67
+ woo_ce_admin_notice_html( $message );
68
+ }
69
+ }
70
+
71
+ // Displays a HTML notice where the memory allocated to WordPress falls below 64MB
72
+ if( !woo_ce_get_option( 'dismiss_memory_prompt', 0 ) ) {
73
+ $memory_limit = absint( ini_get( 'memory_limit' ) );
74
+ $minimum_memory_limit = 64;
75
+ if( $memory_limit < $minimum_memory_limit ) {
76
+ $dismiss_url = esc_url( add_query_arg( array( 'action' => 'dismiss_memory_prompt', '_wpnonce' => wp_create_nonce( 'woo_ce_dismiss_memory_prompt' ) ) ) );
77
+ $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 );
78
+ woo_ce_admin_notice_html( $message, 'error' );
79
+ }
80
+ }
81
+
82
+ // Displays a HTML notice if PHP 5.2 or lower is installed
83
+ if( version_compare( phpversion(), '5.3', '<' ) && !woo_ce_get_option( 'dismiss_php_legacy', 0 ) ) {
84
+ $dismiss_url = esc_url( add_query_arg( array( 'action' => 'dismiss_php_legacy', '_wpnonce' => wp_create_nonce( 'woo_ce_dismiss_php_legacy' ) ) ) );
85
+ $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 );
86
+ woo_ce_admin_notice_html( $message, 'error' );
87
+ }
88
+
89
+ // Displays HTML notice if there are more than 2500 Subscriptions
90
+ if( !woo_ce_get_option( 'dismiss_subscription_prompt', 0 ) ) {
91
+ if( class_exists( 'WC_Subscriptions' ) ) {
92
+ if( method_exists( 'WC_Subscriptions', 'is_large_site' ) ) {
93
+ // Does this store have roughly more than 3000 Subscriptions
94
+ if( WC_Subscriptions::is_large_site() ) {
95
+ $dismiss_url = esc_url( add_query_arg( array( 'action' => 'dismiss_subscription_prompt', '_wpnonce' => wp_create_nonce( 'woo_ce_dismiss_subscription_prompt' ) ) ) );
96
+ $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>)';
97
+ woo_ce_admin_notice_html( $message, 'error' );
98
+ }
99
+ }
100
+ }
101
+ }
102
+
103
+ // If the export failed the WordPress Transient will still exist
104
+ if( get_transient( WOO_CE_PREFIX . '_running' ) ) {
105
+ $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>)';
106
+ woo_ce_admin_notice_html( $message, 'error' );
107
+ delete_transient( WOO_CE_PREFIX . '_running' );
108
+ }
109
+
110
+ }
111
+
112
+ // Saves the state of Export fields for next export
113
+ function woo_ce_save_fields( $export_type = '', $fields = array(), $sorting = array() ) {
114
+
115
+ // Default fields
116
+ if( $fields == false && !is_array( $fields ) )
117
+ $fields = array();
118
+ $export_types = array_keys( woo_ce_get_export_types() );
119
+ if( in_array( $export_type, $export_types ) && !empty( $fields ) ) {
120
+ woo_ce_update_option( $export_type . '_fields', array_map( 'sanitize_text_field', $fields ) );
121
+ woo_ce_update_option( $export_type . '_sorting', array_map( 'absint', $sorting ) );
122
+ }
123
+
124
+ }
125
+
126
+ // Returns number of an Export type prior to export, used on Store Exporter screen
127
+ function woo_ce_return_count( $export_type = '', $args = array() ) {
128
+
129
+ global $wpdb;
130
+
131
+ $count_sql = null;
132
+ $woocommerce_version = woo_get_woo_version();
133
+
134
+ switch( $export_type ) {
135
+
136
+ case 'product':
137
+ $post_type = array( 'product', 'product_variation' );
138
+ $args = array(
139
+ 'post_type' => $post_type,
140
+ 'posts_per_page' => 1,
141
+ 'fields' => 'ids'
142
+ );
143
+ $count_query = new WP_Query( $args );
144
+ $count = $count_query->found_posts;
145
+ break;
146
+
147
+ case 'category':
148
+ $term_taxonomy = 'product_cat';
149
+ if( taxonomy_exists( $term_taxonomy ) )
150
+ $count = wp_count_terms( $term_taxonomy );
151
+ break;
152
+
153
+ case 'tag':
154
+ $term_taxonomy = 'product_tag';
155
+ if( taxonomy_exists( $term_taxonomy ) )
156
+ $count = wp_count_terms( $term_taxonomy );
157
+ break;
158
+
159
+ case 'brand':
160
+ $term_taxonomy = apply_filters( 'woo_ce_brand_term_taxonomy', 'product_brand' );
161
+ if( taxonomy_exists( $term_taxonomy ) )
162
+ $count = wp_count_terms( $term_taxonomy );
163
+ break;
164
+
165
+ case 'order':
166
+ $post_type = 'shop_order';
167
+ // Check if this is a WooCommerce 2.2+ instance (new Post Status)
168
+ if( version_compare( $woocommerce_version, '2.2' ) >= 0 )
169
+ $post_status = ( function_exists( 'wc_get_order_statuses' ) ? apply_filters( 'woo_ce_order_post_status', array_keys( wc_get_order_statuses() ) ) : 'any' );
170
+ else
171
+ $post_status = apply_filters( 'woo_ce_order_post_status', woo_ce_post_statuses() );
172
+ $args = array(
173
+ 'post_type' => $post_type,
174
+ 'posts_per_page' => 1,
175
+ 'post_status' => $post_status,
176
+ 'fields' => 'ids'
177
+ );
178
+ $count_query = new WP_Query( $args );
179
+ $count = $count_query->found_posts;
180
+ break;
181
+
182
+ case 'customer':
183
+ if( $users = woo_ce_return_count( 'user' ) > 1000 ) {
184
+ $count = sprintf( '~%s+', 1000 );
185
+ } else {
186
+ $post_type = 'shop_order';
187
+ $args = array(
188
+ 'post_type' => $post_type,
189
+ 'posts_per_page' => -1,
190
+ 'fields' => 'ids'
191
+ );
192
+ // Check if this is a WooCommerce 2.2+ instance (new Post Status)
193
+ if( version_compare( $woocommerce_version, '2.2' ) >= 0 ) {
194
+ $args['post_status'] = apply_filters( 'woo_ce_customer_post_status', array( 'wc-pending', 'wc-on-hold', 'wc-processing', 'wc-completed' ) );
195
+ } else {
196
+ $args['post_status'] = apply_filters( 'woo_ce_customer_post_status', woo_ce_post_statuses() );
197
+ $args['tax_query'] = array(
198
+ array(
199
+ 'taxonomy' => 'shop_order_status',
200
+ 'field' => 'slug',
201
+ 'terms' => array( 'pending', 'on-hold', 'processing', 'completed' )
202
+ ),
203
+ );
204
+ }
205
+ $order_ids = new WP_Query( $args );
206
+ $count = $order_ids->found_posts;
207
+ if( $count > 100 ) {
208
+ $count = sprintf( '~%s', $count );
209
+ } else {
210
+ $customers = array();
211
+ if( $order_ids->posts ) {
212
+ foreach( $order_ids->posts as $order_id ) {
213
+ $email = get_post_meta( $order_id, '_billing_email', true );
214
+ if( !in_array( $email, $customers ) )
215
+ $customers[$order_id] = $email;
216
+ unset( $email );
217
+ }
218
+ $count = count( $customers );
219
+ }
220
+ }
221
+ }
222
+ /*
223
+ if( false ) {
224
+ $orders = get_posts( $args );
225
+ if( $orders ) {
226
+ $customers = array();
227
+ foreach( $orders as $order ) {
228
+ $order->email = get_post_meta( $order->ID, '_billing_email', true );
229
+ if( empty( $order->email ) ) {
230
+ if( $order->user_id = get_post_meta( $order->ID, '_customer_user', true ) ) {
231
+ $user = get_userdata( $order->user_id );
232
+ if( $user )
233
+ $order->email = $user->user_email;
234
+ unset( $user );
235
+ } else {
236
+ $order->email = '-';
237
+ }
238
+ }
239
+ if( !in_array( $order->email, $customers ) ) {
240
+ $customers[$order->ID] = $order->email;
241
+ $count++;
242
+ }
243
+ }
244
+ unset( $orders, $order );
245
+ }
246
+ }
247
+ */
248
+ break;
249
+
250
+ case 'user':
251
+ if( $users = count_users() )
252
+ $count = $users['total_users'];
253
+ break;
254
+
255
+ case 'coupon':
256
+ $post_type = 'shop_coupon';
257
+ if( post_type_exists( $post_type ) )
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' ) ) {
265
+ if( method_exists( 'WC_Subscriptions', 'is_large_site' ) ) {
266
+ // Does this store have roughly more than 3000 Subscriptions
267
+ if( false === WC_Subscriptions::is_large_site() ) {
268
+ if( class_exists( 'WC_Subscriptions_Manager' ) ) {
269
+ // Check that the get_all_users_subscriptions() function exists
270
+ if( method_exists( 'WC_Subscriptions_Manager', 'get_all_users_subscriptions' ) ) {
271
+ if( $subscriptions = WC_Subscriptions_Manager::get_all_users_subscriptions() ) {
272
+ foreach( $subscriptions as $key => $user_subscription ) {
273
+ if( !empty( $user_subscription ) ) {
274
+ foreach( $user_subscription as $subscription )
275
+ $count++;
276
+ }
277
+ }
278
+ unset( $subscriptions, $subscription, $user_subscription );
279
+ }
280
+ }
281
+ }
282
+ } else {
283
+ if( method_exists( 'WC_Subscriptions', 'get_total_subscription_count' ) )
284
+ $count = WC_Subscriptions::get_total_subscription_count();
285
+ else
286
+ $count = "~2500";
287
+ }
288
+ }
289
+ }
290
+ break;
291
+
292
+ case 'product_vendor':
293
+ $term_taxonomy = 'shop_vendor';
294
+ if( taxonomy_exists( $term_taxonomy ) )
295
+ $count = wp_count_terms( $term_taxonomy );
296
+ break;
297
+
298
+ case 'commission':
299
+ $post_type = 'shop_commission';
300
+ if( post_type_exists( $post_type ) )
301
+ $count = wp_count_posts( $post_type );
302
+ break;
303
+
304
+ case 'shipping_class':
305
+ $term_taxonomy = 'product_shipping_class';
306
+ if( taxonomy_exists( $term_taxonomy ) )
307
+ $count = wp_count_terms( $term_taxonomy );
308
+ break;
309
+
310
+ case 'attribute':
311
+ $attributes = ( function_exists( 'wc_get_attribute_taxonomies' ) ? wc_get_attribute_taxonomies() : array() );
312
+ $count = count( $attributes );
313
+ break;
314
+
315
+ }
316
+ if( isset( $count ) || $count_sql ) {
317
+ if( isset( $count ) ) {
318
+ if( is_object( $count ) ) {
319
+ $count = (array)$count;
320
+ $count = absint( array_sum( $count ) );
321
+ }
322
+ return $count;
323
+ } else {
324
+ if( $count_sql )
325
+ $count = $wpdb->get_var( $count_sql );
326
+ else
327
+ $count = 0;
328
+ }
329
+ return $count;
330
+ } else {
331
+ return 0;
332
+ }
333
+
334
+ }
335
+
336
+ // In-line display of export file and export details when viewed via WordPress Media screen
337
+ function woo_ce_read_export_file( $post = false ) {
338
+
339
+ if( empty( $post ) ) {
340
+ if( isset( $_GET['post'] ) )
341
+ $post = get_post( $_GET['post'] );
342
+ }
343
+
344
+ if( $post->post_type != 'attachment' )
345
+ return;
346
+
347
+ // Check if the Post matches one of our Post Mime Types
348
+ if( !in_array( $post->post_mime_type, array( 'text/csv', 'application/xml', 'application/vnd.ms-excel' ) ) )
349
+ return;
350
+
351
+ $filename = $post->post_name;
352
+ $filepath = get_attached_file( $post->ID );
353
+
354
+ $contents = __( 'No export entries were found, please try again with different export filters.', 'woocommerce-exporter' );
355
+ if( file_exists( $filepath ) ) {
356
+ $handle = fopen( $filepath, "r" );
357
+ $contents = stream_get_contents( $handle );
358
+ fclose( $handle );
359
+ } else {
360
+ // This resets the _wp_attached_file Post meta key to the correct value
361
+ update_attached_file( $post->ID, $post->guid );
362
+ // Try grabbing the file contents again
363
+ $filepath = get_attached_file( $post->ID );
364
+ if( file_exists( $filepath ) ) {
365
+ $handle = fopen( $filepath, "r" );
366
+ $contents = stream_get_contents( $handle );
367
+ fclose( $handle );
368
+ }
369
+ }
370
+ if( !empty( $contents ) )
371
+ include_once( WOO_CE_PATH . 'templates/admin/media-csv_file.php' );
372
+
373
+
374
+ // We can still show the Export Details for any supported Post Mime Type
375
+ $export_type = get_post_meta( $post->ID, '_woo_export_type', true );
376
+ $columns = get_post_meta( $post->ID, '_woo_columns', true );
377
+ $rows = get_post_meta( $post->ID, '_woo_rows', true );
378
+ $start_time = get_post_meta( $post->ID, '_woo_start_time', true );
379
+ $end_time = get_post_meta( $post->ID, '_woo_end_time', true );
380
+ $idle_memory_start = get_post_meta( $post->ID, '_woo_idle_memory_start', true );
381
+ $data_memory_start = get_post_meta( $post->ID, '_woo_data_memory_start', true );
382
+ $data_memory_end = get_post_meta( $post->ID, '_woo_data_memory_end', true );
383
+ $idle_memory_end = get_post_meta( $post->ID, '_woo_idle_memory_end', true );
384
+
385
+ include_once( WOO_CE_PATH . 'templates/admin/media-export_details.php' );
386
+
387
+ }
388
+ add_action( 'edit_form_after_editor', 'woo_ce_read_export_file' );
389
+
390
+ // Returns label of Export type slug used on Store Exporter screen
391
+ function woo_ce_export_type_label( $export_type = '', $echo = false ) {
392
+
393
+ $output = '';
394
+ if( !empty( $export_type ) ) {
395
+ $export_types = woo_ce_get_export_types();
396
+ if( array_key_exists( $export_type, $export_types ) )
397
+ $output = $export_types[$export_type];
398
+ }
399
+ if( $echo )
400
+ echo $output;
401
+ else
402
+ return $output;
403
+
404
+ }
405
+
406
+ // Returns a list of archived exports
407
+ function woo_ce_get_archive_files() {
408
+
409
+ $post_type = 'attachment';
410
+ $meta_key = '_woo_export_type';
411
+ $args = array(
412
+ 'post_type' => $post_type,
413
+ 'post_mime_type' => array( 'text/csv', 'application/xml', 'application/vnd.ms-excel' ),
414
+ 'meta_key' => $meta_key,
415
+ 'meta_value' => null,
416
+ 'post_status' => 'any',
417
+ 'posts_per_page' => -1
418
+ );
419
+ if( isset( $_GET['filter'] ) ) {
420
+ $filter = $_GET['filter'];
421
+ if( !empty( $filter ) )
422
+ $args['meta_value'] = $filter;
423
+ }
424
+ $files = get_posts( $args );
425
+ return $files;
426
+
427
+ }
428
+
429
+ function woo_ce_nuke_archive_files() {
430
+
431
+ $post_type = 'attachment';
432
+ $meta_key = '_woo_export_type';
433
+ $args = array(
434
+ 'post_type' => $post_type,
435
+ 'post_mime_type' => array( 'text/csv', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/xml', 'application/rss+xml' ),
436
+ 'meta_key' => $meta_key,
437
+ 'meta_value' => null,
438
+ 'post_status' => 'any',
439
+ 'posts_per_page' => -1,
440
+ 'fields' => 'ids'
441
+ );
442
+ $post_query = new WP_Query( $args );
443
+ if( !empty( $post_query->found_posts ) ) {
444
+ foreach( $post_query->posts as $post )
445
+ wp_delete_attachment( $post, true );
446
+ return true;
447
+ }
448
+
449
+ }
450
+
451
+ // Returns an archived export with additional details
452
+ function woo_ce_get_archive_file( $file = '' ) {
453
+
454
+ $wp_upload_dir = wp_upload_dir();
455
+ $file->export_type = get_post_meta( $file->ID, '_woo_export_type', true );
456
+ $file->export_type_label = woo_ce_export_type_label( $file->export_type );
457
+ if( empty( $file->export_type ) )
458
+ $file->export_type = __( 'Unassigned', 'woocommerce-exporter' );
459
+ if( empty( $file->guid ) )
460
+ $file->guid = $wp_upload_dir['url'] . '/' . basename( $file->post_title );
461
+ $file->post_mime_type = get_post_mime_type( $file->ID );
462
+ if( !$file->post_mime_type )
463
+ $file->post_mime_type = __( 'N/A', 'woocommerce-exporter' );
464
+ $file->media_icon = wp_get_attachment_image( $file->ID, array( 80, 60 ), true );
465
+ if( $author_name = get_user_by( 'id', $file->post_author ) )
466
+ $file->post_author_name = $author_name->display_name;
467
+ $file->post_date = woo_ce_format_archive_date( $file->ID );
468
+ unset( $author_name, $t_time, $time );
469
+ return $file;
470
+
471
+ }
472
+
473
+ // HTML template for displaying the current export type filter on the Archives screen
474
+ function woo_ce_archives_quicklink_current( $current = '' ) {
475
+
476
+ $output = '';
477
+ if( isset( $_GET['filter'] ) ) {
478
+ $filter = $_GET['filter'];
479
+ if( $filter == $current )
480
+ $output = ' class="current"';
481
+ } else if( $current == 'all' ) {
482
+ $output = ' class="current"';
483
+ }
484
+ echo $output;
485
+
486
+ }
487
+
488
+ // HTML template for displaying the number of each export type filter on the Archives screen
489
+ function woo_ce_archives_quicklink_count( $type = '' ) {
490
+
491
+ $post_type = 'attachment';
492
+ $meta_key = '_woo_export_type';
493
+ $args = array(
494
+ 'post_type' => $post_type,
495
+ 'meta_key' => $meta_key,
496
+ 'meta_value' => null,
497
+ 'numberposts' => -1,
498
+ 'post_status' => 'any',
499
+ 'fields' => 'ids'
500
+ );
501
+ if( !empty( $type ) )
502
+ $args['meta_value'] = $type;
503
+ $post_query = new WP_Query( $args );
504
+ return absint( $post_query->found_posts );
505
+
506
+ }
507
+
508
+ /* End of: WordPress Administration */
509
+
510
+ }
511
+
512
+ // Export process for CSV file
513
+ function woo_ce_export_dataset( $export_type = null, &$output = null ) {
514
+
515
+ global $export;
516
+
517
+ $separator = $export->delimiter;
518
+ $export->columns = array();
519
+ $export->total_rows = 0;
520
+ $export->total_columns = 0;
521
+
522
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/';
523
+
524
+ set_transient( WOO_CE_PREFIX . '_running', time(), woo_ce_get_option( 'timeout', MINUTE_IN_SECONDS ) );
525
+
526
+ // Load up the fatal error notice if we 500 Internal Server Error (memory), hit a server timeout or encounter a fatal PHP error
527
+ add_action( 'shutdown', 'woo_ce_fatal_error' );
528
+
529
+ // Drop in our content filters here
530
+ add_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
531
+
532
+ switch( $export_type ) {
533
+
534
+ // Products
535
+ case 'product':
536
+ $fields = woo_ce_get_product_fields( 'summary' );
537
+ if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
538
+ foreach( $export->fields as $key => $field )
539
+ $export->columns[] = woo_ce_get_product_field( $key );
540
+ }
541
+ $export->total_columns = $size = count( $export->columns );
542
+ $export->data_memory_start = woo_ce_current_memory_usage();
543
+ if( $products = woo_ce_get_products( $export->args ) ) {
544
+ $export->total_rows = count( $products );
545
+ // Generate the export headers
546
+ if( in_array( $export->export_format, array( 'csv' ) ) ) {
547
+ for( $i = 0; $i < $size; $i++ ) {
548
+ if( $i == ( $size - 1 ) )
549
+ $output .= woo_ce_escape_csv_value( $export->columns[$i], $export->delimiter, $export->escape_formatting ) . "\n";
550
+ else
551
+ $output .= woo_ce_escape_csv_value( $export->columns[$i], $export->delimiter, $export->escape_formatting ) . $separator;
552
+ }
553
+ }
554
+ $weight_unit = get_option( 'woocommerce_weight_unit' );
555
+ $dimension_unit = get_option( 'woocommerce_dimension_unit' );
556
+ $height_unit = $dimension_unit;
557
+ $width_unit = $dimension_unit;
558
+ $length_unit = $dimension_unit;
559
+ if( !empty( $export->fields ) ) {
560
+ foreach( $products as $product ) {
561
+
562
+ $product = woo_ce_get_product_data( $product, $export->args );
563
+ foreach( $export->fields as $key => $field ) {
564
+ if( isset( $product->$key ) ) {
565
+ if( is_array( $field ) ) {
566
+ foreach( $field as $array_key => $array_value ) {
567
+ if( !is_array( $array_value ) ) {
568
+ if( in_array( $export->export_format, array( 'csv' ) ) )
569
+ $output .= woo_ce_escape_csv_value( $array_value, $export->delimiter, $export->escape_formatting );
570
+ }
571
+ }
572
+ } else {
573
+ if( in_array( $export->export_format, array( 'csv' ) ) )
574
+ $output .= woo_ce_escape_csv_value( $product->$key, $export->delimiter, $export->escape_formatting );
575
+ }
576
+ }
577
+ if( in_array( $export->export_format, array( 'csv' ) ) )
578
+ $output .= $separator;
579
+ }
580
+
581
+ if( in_array( $export->export_format, array( 'csv' ) ) )
582
+ $output = substr( $output, 0, -1 ) . "\n";
583
+ }
584
+ }
585
+ unset( $products, $product );
586
+ }
587
+ $export->data_memory_end = woo_ce_current_memory_usage();
588
+ break;
589
+
590
+ // Categories
591
+ case 'category':
592
+ $fields = woo_ce_get_category_fields( 'summary' );
593
+ if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
594
+ foreach( $export->fields as $key => $field )
595
+ $export->columns[] = woo_ce_get_category_field( $key );
596
+ }
597
+ $export->total_columns = $size = count( $export->columns );
598
+ $export->data_memory_start = woo_ce_current_memory_usage();
599
+ $category_args = array(
600
+ 'orderby' => ( isset( $export->args['category_orderby'] ) ? $export->args['category_orderby'] : 'ID' ),
601
+ 'order' => ( isset( $export->args['category_order'] ) ? $export->args['category_order'] : 'ASC' ),
602
+ );
603
+ if( $categories = woo_ce_get_product_categories( $category_args ) ) {
604
+ $export->total_rows = count( $categories );
605
+ // Generate the export headers
606
+ if( in_array( $export->export_format, array( 'csv' ) ) ) {
607
+ for( $i = 0; $i < $size; $i++ ) {
608
+ if( $i == ( $size - 1 ) )
609
+ $output .= woo_ce_escape_csv_value( $export->columns[$i], $export->delimiter, $export->escape_formatting ) . "\n";
610
+ else
611
+ $output .= woo_ce_escape_csv_value( $export->columns[$i], $export->delimiter, $export->escape_formatting ) . $separator;
612
+ }
613
+ }
614
+ if( !empty( $export->fields ) ) {
615
+ foreach( $categories as $category ) {
616
+
617
+ foreach( $export->fields as $key => $field ) {
618
+ if( isset( $category->$key ) ) {
619
+ if( in_array( $export->export_format, array( 'csv' ) ) )
620
+ $output .= woo_ce_escape_csv_value( $category->$key, $export->delimiter, $export->escape_formatting );
621
+ }
622
+ if( in_array( $export->export_format, array( 'csv' ) ) )
623
+ $output .= $separator;
624
+ }
625
+ if( in_array( $export->export_format, array( 'csv' ) ) )
626
+ $output = substr( $output, 0, -1 ) . "\n";
627
+ }
628
+ }
629
+ unset( $categories, $category );
630
+ }
631
+ $export->data_memory_end = woo_ce_current_memory_usage();
632
+ break;
633
+
634
+ // Tags
635
+ case 'tag':
636
+ $fields = woo_ce_get_tag_fields( 'summary' );
637
+ if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
638
+ foreach( $export->fields as $key => $field )
639
+ $export->columns[] = woo_ce_get_tag_field( $key );
640
+ }
641
+ $export->total_columns = $size = count( $export->columns );
642
+ $export->data_memory_start = woo_ce_current_memory_usage();
643
+ $tag_args = array(
644
+ 'orderby' => ( isset( $export->args['tag_orderby'] ) ? $export->args['tag_orderby'] : 'ID' ),
645
+ 'order' => ( isset( $export->args['tag_order'] ) ? $export->args['tag_order'] : 'ASC' ),
646
+ );
647
+ if( $tags = woo_ce_get_product_tags( $tag_args ) ) {
648
+ $export->total_rows = count( $tags );
649
+ // Generate the export headers
650
+ if( in_array( $export->export_format, array( 'csv' ) ) ) {
651
+ for( $i = 0; $i < $size; $i++ ) {
652
+ if( $i == ( $size - 1 ) )
653
+ $output .= woo_ce_escape_csv_value( $export->columns[$i], $export->delimiter, $export->escape_formatting ) . "\n";
654
+ else
655
+ $output .= woo_ce_escape_csv_value( $export->columns[$i], $export->delimiter, $export->escape_formatting ) . $separator;
656
+ }
657
+ }
658
+ if( !empty( $export->fields ) ) {
659
+ foreach( $tags as $tag ) {
660
+
661
+ foreach( $export->fields as $key => $field ) {
662
+ if( isset( $tag->$key ) ) {
663
+ if( in_array( $export->export_format, array( 'csv' ) ) )
664
+ $output .= woo_ce_escape_csv_value( $tag->$key, $export->delimiter, $export->escape_formatting );
665
+ }
666
+ if( in_array( $export->export_format, array( 'csv' ) ) )
667
+ $output .= $separator;
668
+ }
669
+ if( in_array( $export->export_format, array( 'csv' ) ) )
670
+ $output = substr( $output, 0, -1 ) . "\n";
671
+ }
672
+ }
673
+ unset( $tags, $tag );
674
+ }
675
+ $export->data_memory_end = woo_ce_current_memory_usage();
676
+ break;
677
+
678
+ // Users
679
+ case 'user':
680
+ $fields = woo_ce_get_user_fields( 'summary' );
681
+ if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
682
+ foreach( $export->fields as $key => $field )
683
+ $export->columns[] = woo_ce_get_user_field( $key );
684
+ }
685
+ $export->total_columns = $size = count( $export->columns );
686
+ $export->data_memory_start = woo_ce_current_memory_usage();
687
+ if( $users = woo_ce_get_users( $export->args ) ) {
688
+ // Generate the export headers
689
+ if( in_array( $export->export_format, array( 'csv' ) ) ) {
690
+ $i = 0;
691
+ foreach( $export->columns as $column ) {
692
+ if( $i == ( $size - 1 ) )
693
+ $output .= woo_ce_escape_csv_value( $column, $export->delimiter, $export->escape_formatting ) . "\n";
694
+ else
695
+ $output .= woo_ce_escape_csv_value( $column, $export->delimiter, $export->escape_formatting ) . $separator;
696
+ $i++;
697
+ }
698
+ }
699
+ if( !empty( $export->fields ) ) {
700
+ foreach( $users as $user ) {
701
+
702
+ $user = woo_ce_get_user_data( $user, $export->args );
703
+
704
+ foreach( $export->fields as $key => $field ) {
705
+ if( isset( $user->$key ) ) {
706
+ if( in_array( $export->export_format, array( 'csv' ) ) )
707
+ $output .= woo_ce_escape_csv_value( $user->$key, $export->delimiter, $export->escape_formatting );
708
+ }
709
+ if( in_array( $export->export_format, array( 'csv' ) ) )
710
+ $output .= $separator;
711
+ }
712
+ if( in_array( $export->export_format, array( 'csv' ) ) )
713
+ $output = substr( $output, 0, -1 ) . "\n";
714
+
715
+ }
716
+ }
717
+ unset( $users, $user );
718
+ }
719
+ $export->data_memory_end = woo_ce_current_memory_usage();
720
+ break;
721
+
722
+ }
723
+
724
+ // Remove our content filters here to play nice with other Plugins
725
+ remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
726
+
727
+ // Remove our fatal error notice so not to conflict with the CRON or scheduled export engine
728
+ remove_action( 'shutdown', 'woo_ce_fatal_error' );
729
+
730
+ // Export completed successfully
731
+ delete_transient( WOO_CE_PREFIX . '_running' );
732
+
733
+ // Check that the export file is populated, export columns have been assigned and rows counted
734
+ if( $output && $export->total_rows && $export->total_columns ) {
735
+ if( in_array( $export->export_format, array( 'csv' ) ) ) {
736
+ $output = woo_ce_file_encoding( $output );
737
+ if( $export->export_format == 'csv' && $export->bom && ( WOO_CE_DEBUG == false ) )
738
+ $output = "\xEF\xBB\xBF" . $output;
739
+ }
740
+ if( WOO_CE_DEBUG && !$export->cron ) {
741
+ $response = set_transient( WOO_CE_PREFIX . '_debug_log', base64_encode( $output ), woo_ce_get_option( 'timeout', MINUTE_IN_SECONDS ) );
742
+ if( $response !== true ) {
743
+ $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>)';
744
+ if( function_exists( 'woo_ce_admin_notice' ) )
745
+ woo_ce_admin_notice( $message, 'error' );
746
+ else
747
+ error_log( sprintf( '[store-exporter] woo_ce_export_dataset() - %s', $message ) );
748
+ }
749
+ } else {
750
+ return $output;
751
+ }
752
+ }
753
+
754
+ }
755
+
756
+ function woo_ce_fatal_error() {
757
+
758
+ global $export;
759
+
760
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter/usage/';
761
+
762
+ $error = error_get_last();
763
+ if( $error !== null ) {
764
+ $message = '';
765
+ $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'] );
766
+ if ( substr( $error['message'], 0, 22 ) === 'Maximum execution time' ) {
767
+ $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>)';
768
+ } elseif ( substr( $error['message'], 0, 19 ) === 'Allowed memory size' ) {
769
+ $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>)';
770
+ } else if( $error['type'] === E_ERROR ) {
771
+ $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>)';
772
+ }
773
+ if( !empty( $message ) ) {
774
+
775
+ // Save a record to the PHP error log
776
+ error_log( sprintf( __( '[store-exporter] Fatal error: %s - PHP response: %s in %s on line %s', 'woocommerce-exporter' ), $message, $error['message'], $error['file'], $error['line'] ) );
777
+
778
+ // Only display the message if this is a manual export
779
+ if( ( !$export->cron && !$export->scheduled_export ) ) {
780
+ $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>';
781
+ echo $output;
782
+ }
783
+
784
+ }
785
+ }
786
+
787
+ }
788
+
789
+ // List of Export types used on Store Exporter screen
790
+ function woo_ce_get_export_types() {
791
+
792
+ $types = array(
793
+ 'product' => __( 'Products', 'woocommerce-exporter' ),
794
+ 'category' => __( 'Categories', 'woocommerce-exporter' ),
795
+ 'tag' => __( 'Tags', 'woocommerce-exporter' ),
796
+ 'user' => __( 'Users', 'woocommerce-exporter' )
797
+ );
798
+ $types = apply_filters( 'woo_ce_export_types', $types );
799
+ return $types;
800
+
801
+ }
802
+
803
+ // Returns the Post object of the export file saved as an attachment to the WordPress Media library
804
+ function woo_ce_save_file_attachment( $filename = '', $post_mime_type = 'text/csv' ) {
805
+
806
+ if( !empty( $filename ) ) {
807
+ $post_type = 'woo-export';
808
+ $args = array(
809
+ 'post_title' => $filename,
810
+ 'post_type' => $post_type,
811
+ 'post_mime_type' => $post_mime_type
812
+ );
813
+ $post_ID = wp_insert_attachment( $args, $filename );
814
+ if( is_wp_error( $post_ID ) )
815
+ woo_ce_error_log( sprintf( 'save_file_attachment() - $s: %s', $filename, $result->get_error_message() ) );
816
+ else
817
+ return $post_ID;
818
+ }
819
+
820
+ }
821
+
822
+ // Updates the GUID of the export file attachment to match the correct file URL
823
+ function woo_ce_save_file_guid( $post_ID, $export_type, $upload_url = '' ) {
824
+
825
+ add_post_meta( $post_ID, '_woo_export_type', $export_type );
826
+ if( !empty( $upload_url ) ) {
827
+ $args = array(
828
+ 'ID' => $post_ID,
829
+ 'guid' => $upload_url
830
+ );
831
+ wp_update_post( $args );
832
+ }
833
+
834
+ }
835
+
836
+ // Save critical export details against the archived export
837
+ function woo_ce_save_file_details( $post_ID ) {
838
+
839
+ global $export;
840
+
841
+ add_post_meta( $post_ID, '_woo_start_time', $export->start_time );
842
+ add_post_meta( $post_ID, '_woo_idle_memory_start', $export->idle_memory_start );
843
+ add_post_meta( $post_ID, '_woo_columns', $export->total_columns );
844
+ add_post_meta( $post_ID, '_woo_rows', $export->total_rows );
845
+ add_post_meta( $post_ID, '_woo_data_memory_start', $export->data_memory_start );
846
+ add_post_meta( $post_ID, '_woo_data_memory_end', $export->data_memory_end );
847
+
848
+ }
849
+
850
+ // Update detail of existing archived export
851
+ function woo_ce_update_file_detail( $post_ID, $detail, $value ) {
852
+
853
+ if( strstr( $detail, '_woo_' ) !== false )
854
+ update_post_meta( $post_ID, $detail, $value );
855
+
856
+ }
857
+
858
+ // Returns a list of allowed Export type statuses, can be overridden on a per-Export type basis
859
+ function woo_ce_post_statuses( $extra_status = array(), $override = false ) {
860
+
861
+ $output = array(
862
+ 'publish',
863
+ 'pending',
864
+ 'draft',
865
+ 'future',
866
+ 'private',
867
+ 'trash'
868
+ );
869
+ if( $override ) {
870
+ $output = $extra_status;
871
+ } else {
872
+ if( $extra_status )
873
+ $output = array_merge( $output, $extra_status );
874
+ }
875
+ return $output;
876
+
877
+ }
878
+
879
+ function woo_ce_return_mime_type_extension( $mime_type, $search_by = 'extension' ) {
880
+
881
+ $mime_types = array(
882
+ 'csv' => 'text/csv',
883
+ 'xls' => 'application/vnd.ms-excel',
884
+ 'xml' => 'application/xml'
885
+ );
886
+ if( $search_by == 'extension' ) {
887
+ if( isset( $mime_types[$mime_type] ) )
888
+ return $mime_types[$mime_type];
889
+ } else if( $search_by == 'mime_type' ) {
890
+ if( $key = array_search( $mime_type, $mime_types ) )
891
+ return strtoupper( $key );
892
+ }
893
+
894
+ }
895
+
896
+ function woo_ce_add_missing_mime_type( $mime_types = array() ) {
897
+
898
+ // Add CSV mime type if it has been removed
899
+ if( !isset( $mime_types['csv'] ) )
900
+ $mime_types['csv'] = 'text/csv';
901
+ return $mime_types;
902
+
903
+ }
904
+ add_filter( 'upload_mimes', 'woo_ce_add_missing_mime_type' );
905
+
906
+ if( !function_exists( 'woo_ce_sort_fields' ) ) {
907
+ function woo_ce_sort_fields( $key ) {
908
+
909
+ return $key;
910
+
911
+ }
912
+ }
913
+
914
+
915
+ // Add Store Export to filter types on the WordPress Media screen
916
+ function woo_ce_add_post_mime_type( $post_mime_types = array() ) {
917
+
918
+ $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>' ) );
919
+ return $post_mime_types;
920
+
921
+ }
922
+ add_filter( 'post_mime_types', 'woo_ce_add_post_mime_type' );
923
+
924
+ function woo_ce_current_memory_usage() {
925
+
926
+ $output = '';
927
+ if( function_exists( 'memory_get_usage' ) )
928
+ $output = round( memory_get_usage( true ) / 1024 / 1024, 2 );
929
+ return $output;
930
+
931
+ }
932
+
933
+ function woo_ce_get_start_of_week_day() {
934
+
935
+ global $wp_locale;
936
+
937
+ $output = 'Monday';
938
+ $start_of_week = get_option( 'start_of_week', 0 );
939
+ for( $day_index = 0; $day_index <= 6; $day_index++ ) {
940
+ if( $start_of_week == $day_index ) {
941
+ $output = $wp_locale->get_weekday( $day_index );
942
+ break;
943
+ }
944
+ }
945
+ return $output;
946
+
947
+ }
948
+
949
+ function woo_ce_error_log( $message = '' ) {
950
+
951
+ if( $message == '' )
952
+ return;
953
+
954
+ if( class_exists( 'WC_Logger' ) ) {
955
+ $logger = new WC_Logger();
956
+ $logger->add( WOO_CD_PREFIX, $message );
957
+ return true;
958
+ } else {
959
+ // Fallback where the WooCommerce logging engine is unavailable
960
+ error_log( sprintf( '[store-exporter] %s', $message ) );
961
+ }
962
+
963
+ }
964
+
965
+ function woo_ce_error_get_last_message() {
966
+
967
+ $output = '-';
968
+ if( function_exists( 'error_get_last' ) ) {
969
+ $last_error = error_get_last();
970
+ if( isset( $last_error ) && isset( $last_error['message'] ) ) {
971
+ $output = $last_error['message'];
972
+ }
973
+ unset( $last_error );
974
+ }
975
+ return $output;
976
+
977
+ }
978
+
979
+ function woo_ce_get_option( $option = null, $default = false, $allow_empty = false ) {
980
+
981
+ $output = false;
982
+ if( $option !== null ) {
983
+ $separator = '_';
984
+ $output = get_option( WOO_CE_PREFIX . $separator . $option, $default );
985
+ if( $allow_empty == false && $output != 0 && ( $output == false || $output == '' ) )
986
+ $output = $default;
987
+ }
988
+ return $output;
989
+
990
+ }
991
+
992
+ function woo_ce_update_option( $option = null, $value = null ) {
993
+
994
+ $output = false;
995
+ if( $option !== null && $value !== null ) {
996
+ $separator = '_';
997
+ $output = update_option( WOO_CE_PREFIX . $separator . $option, $value );
998
+ }
999
+ return $output;
1000
+
1001
+ }
1002
+ ?>
includes/install.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // De-activate Store Exporter to limit conflicts
3
+ function woo_ce_deactivate_ce() {
4
+
5
+ $plugins = array(
6
+ 'woocommerce-exporter/exporter.php',
7
+ 'woocommerce-store-exporter/exporter.php'
8
+ );
9
+ deactivate_plugins( $plugins, true );
10
+
11
+ }
12
+
13
+ function woo_ce_install() {
14
+
15
+ woo_ce_create_options();
16
+
17
+ }
18
+
19
+ // Trigger the creation of Admin options for this Plugin
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%.csv' );
26
+ if( !get_option( $prefix . '_delete_file' ) )
27
+ add_option( $prefix . '_delete_file', 0 );
28
+ if( !get_option( $prefix . '_delimiter' ) )
29
+ add_option( $prefix . '_delimiter', ',' );
30
+ if( !get_option( $prefix . '_category_separator' ) )
31
+ add_option( $prefix . '_category_separator', '|' );
32
+ if( !get_option( $prefix . '_bom' ) )
33
+ add_option( $prefix . '_bom', 1 );
34
+ if( !get_option( $prefix . '_encoding' ) )
35
+ add_option( $prefix . '_encoding', get_option( 'blog_charset', 'UTF-8' ) );
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/legacy.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Makes use of closure/anonymous functions available in PHP 5.3+
3
+ function woo_ce_sort_fields( $key ) {
4
+
5
+ return function( $a, $b ) use ( $key ) {
6
+ return strnatcmp( $a[$key], $b[$key] );
7
+ };
8
+
9
+ }
10
+ ?>
includes/order.php ADDED
@@ -0,0 +1,1636 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for disabled Filter Orders by Order 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', '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 disabled Filter Orders by Customer widget on Store Exporter screen
81
+ function woo_ce_orders_filter_by_customer() {
82
+
83
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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 disabled Filter Orders by Billing Country widget on Store Exporter screen
105
+ function woo_ce_orders_filter_by_billing_country() {
106
+
107
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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 disabled Filter Orders by Shipping Country widget on Store Exporter screen
140
+ function woo_ce_orders_filter_by_shipping_country() {
141
+
142
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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 disabled Filter Orders by User Role widget on Store Exporter screen
173
+ function woo_ce_orders_filter_by_user_role() {
174
+
175
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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 disabled Filter Orders by Order ID widget on Store Exporter screen
205
+ function woo_ce_orders_filter_by_order_id() {
206
+
207
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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 disabled Filter Orders by Coupon Code widget on Store Exporter screen
228
+ function woo_ce_orders_filter_by_coupon() {
229
+
230
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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 disabled Filter Orders by Payment Gateway widget on Store Exporter screen
264
+ function woo_ce_orders_filter_by_payment_gateway() {
265
+
266
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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 disabled Filter Orders by Payment Gateway widget on Store Exporter screen
288
+ function woo_ce_orders_filter_by_shipping_method() {
289
+
290
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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 disabled Order Items Formatting on Store Exporter screen
312
+ function woo_ce_orders_items_formatting() {
313
+
314
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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 disabled Max Order Items widget on Store Exporter screen
345
+ function woo_ce_orders_max_order_items() {
346
+
347
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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 disabled Order Items Types on Store Exporter screen
368
+ function woo_ce_orders_items_types() {
369
+
370
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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 disabled Filter Orders by Order Status widget on Store Exporter screen
397
+ function woo_ce_orders_filter_by_status() {
398
+
399
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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 disabled Filter Orders by Product widget on Store Exporter screen
429
+ function woo_ce_orders_filter_by_product() {
430
+
431
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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 disabled Filter Orders by Product Category widget on Store Exporter screen
464
+ function woo_ce_orders_filter_by_product_category() {
465
+
466
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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 disabled Filter Orders by Product Tag widget on Store Exporter screen
499
+ function woo_ce_orders_filter_by_product_tag() {
500
+
501
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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 disabled Filter Orders by Brand widget on Store Exporter screen
534
+ function woo_ce_orders_filter_by_product_brand() {
535
+
536
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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( class_exists( 'WC_Brands' ) || class_exists( 'woo_brands' ) || taxonomy_exists( apply_filters( 'woo_ce_brand_term_taxonomy', 'product_brand' ) ) )
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 disabled 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 disabled Custom Orders widget on Store Exporter screen
598
+ function woo_ce_orders_custom_fields() {
599
+
600
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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
+
664
+ // Returns a list of Order export columns
665
+ function woo_ce_get_order_fields( $format = 'full' ) {
666
+
667
+ $export_type = 'order';
668
+
669
+ $fields = array();
670
+ $fields[] = array(
671
+ 'name' => 'purchase_id',
672
+ 'label' => __( 'Order ID', 'woocommerce-exporter' )
673
+ );
674
+ $fields[] = array(
675
+ 'name' => 'post_id',
676
+ 'label' => __( 'Post ID', 'woocommerce-exporter' )
677
+ );
678
+ $fields[] = array(
679
+ 'name' => 'purchase_total',
680
+ 'label' => __( 'Order Total', 'woocommerce-exporter' )
681
+ );
682
+ $fields[] = array(
683
+ 'name' => 'purchase_subtotal',
684
+ 'label' => __( 'Order Subtotal', 'woocommerce-exporter' )
685
+ );
686
+ $fields[] = array(
687
+ 'name' => 'order_currency',
688
+ 'label' => __( 'Order Currency', 'woocommerce-exporter' )
689
+ );
690
+ $fields[] = array(
691
+ 'name' => 'order_discount',
692
+ 'label' => __( 'Order Discount', 'woocommerce-exporter' )
693
+ );
694
+ $fields[] = array(
695
+ 'name' => 'coupon_code',
696
+ 'label' => __( 'Coupon Code', 'woocommerce-exporter' )
697
+ );
698
+ $fields[] = array(
699
+ 'name' => 'purchase_total_tax',
700
+ 'label' => __( 'Order Total Tax', 'woocommerce-exporter' )
701
+ );
702
+ /*
703
+ $fields[] = array(
704
+ 'name' => 'order_incl_tax',
705
+ 'label' => __( 'Order Incl. Tax', 'woocommerce-exporter' )
706
+ );
707
+ */
708
+ $fields[] = array(
709
+ 'name' => 'order_excl_tax',
710
+ 'label' => __( 'Order Subtotal Excl. Tax', 'woocommerce-exporter' )
711
+ );
712
+ /*
713
+ $fields[] = array(
714
+ 'name' => 'order_tax_rate',
715
+ 'label' => __( 'Order Tax Rate', 'woocommerce-exporter' )
716
+ );
717
+ */
718
+ $fields[] = array(
719
+ 'name' => 'order_sales_tax',
720
+ 'label' => __( 'Sales Tax Total', 'woocommerce-exporter' )
721
+ );
722
+ $fields[] = array(
723
+ 'name' => 'order_shipping_tax',
724
+ 'label' => __( 'Shipping Tax Total', 'woocommerce-exporter' )
725
+ );
726
+ $fields[] = array(
727
+ 'name' => 'order_tax_percentage',
728
+ 'label' => __( 'Order Tax Percentage', 'woocommerce-exporter' )
729
+ );
730
+ $fields[] = array(
731
+ 'name' => 'payment_gateway_id',
732
+ 'label' => __( 'Payment Gateway ID', 'woocommerce-exporter' )
733
+ );
734
+ $fields[] = array(
735
+ 'name' => 'payment_gateway',
736
+ 'label' => __( 'Payment Gateway', 'woocommerce-exporter' )
737
+ );
738
+ $fields[] = array(
739
+ 'name' => 'shipping_method_id',
740
+ 'label' => __( 'Shipping Method ID', 'woocommerce-exporter' )
741
+ );
742
+ $fields[] = array(
743
+ 'name' => 'shipping_method',
744
+ 'label' => __( 'Shipping Method', 'woocommerce-exporter' )
745
+ );
746
+ $fields[] = array(
747
+ 'name' => 'shipping_cost',
748
+ 'label' => __( 'Shipping Cost', 'woocommerce-exporter' )
749
+ );
750
+ $fields[] = array(
751
+ 'name' => 'shipping_weight',
752
+ 'label' => __( 'Shipping Weight', 'woocommerce-exporter' )
753
+ );
754
+ $fields[] = array(
755
+ 'name' => 'payment_status',
756
+ 'label' => __( 'Order Status', 'woocommerce-exporter' )
757
+ );
758
+ $fields[] = array(
759
+ 'name' => 'post_status',
760
+ 'label' => __( 'Post Status', 'woocommerce-exporter' )
761
+ );
762
+ $fields[] = array(
763
+ 'name' => 'order_key',
764
+ 'label' => __( 'Order Key', 'woocommerce-exporter' )
765
+ );
766
+ $fields[] = array(
767
+ 'name' => 'purchase_date',
768
+ 'label' => __( 'Order Date', 'woocommerce-exporter' )
769
+ );
770
+ $fields[] = array(
771
+ 'name' => 'purchase_time',
772
+ 'label' => __( 'Order Time', 'woocommerce-exporter' )
773
+ );
774
+ $fields[] = array(
775
+ 'name' => 'customer_message',
776
+ 'label' => __( 'Customer Message', 'woocommerce-exporter' )
777
+ );
778
+ $fields[] = array(
779
+ 'name' => 'customer_note',
780
+ 'label' => __( 'Customer Note', 'woocommerce-exporter' )
781
+ );
782
+ $fields[] = array(
783
+ 'name' => 'order_notes',
784
+ 'label' => __( 'Order Notes', 'woocommerce-exporter' )
785
+ );
786
+ $fields[] = array(
787
+ 'name' => 'total_quantity',
788
+ 'label' => __( 'Total Quantity', 'woocommerce-exporter' )
789
+ );
790
+ $fields[] = array(
791
+ 'name' => 'total_order_items',
792
+ 'label' => __( 'Total Order Items', 'woocommerce-exporter' )
793
+ );
794
+ $fields[] = array(
795
+ 'name' => 'user_id',
796
+ 'label' => __( 'User ID', 'woocommerce-exporter' )
797
+ );
798
+ $fields[] = array(
799
+ 'name' => 'user_name',
800
+ 'label' => __( 'Username', 'woocommerce-exporter' )
801
+ );
802
+ $fields[] = array(
803
+ 'name' => 'user_role',
804
+ 'label' => __( 'User Role', 'woocommerce-exporter' )
805
+ );
806
+ $fields[] = array(
807
+ 'name' => 'ip_address',
808
+ 'label' => __( 'Checkout IP Address', 'woocommerce-exporter' )
809
+ );
810
+ $fields[] = array(
811
+ 'name' => 'browser_agent',
812
+ 'label' => __( 'Checkout Browser Agent', 'woocommerce-exporter' )
813
+ );
814
+ $fields[] = array(
815
+ 'name' => 'billing_full_name',
816
+ 'label' => __( 'Billing: Full Name', 'woocommerce-exporter' )
817
+ );
818
+ $fields[] = array(
819
+ 'name' => 'billing_first_name',
820
+ 'label' => __( 'Billing: First Name', 'woocommerce-exporter' )
821
+ );
822
+ $fields[] = array(
823
+ 'name' => 'billing_last_name',
824
+ 'label' => __( 'Billing: Last Name', 'woocommerce-exporter' )
825
+ );
826
+ $fields[] = array(
827
+ 'name' => 'billing_company',
828
+ 'label' => __( 'Billing: Company', 'woocommerce-exporter' )
829
+ );
830
+ $fields[] = array(
831
+ 'name' => 'billing_address',
832
+ 'label' => __( 'Billing: Street Address (Full)', 'woocommerce-exporter' )
833
+ );
834
+ $fields[] = array(
835
+ 'name' => 'billing_address_1',
836
+ 'label' => __( 'Billing: Street Address 1', 'woocommerce-exporter' )
837
+ );
838
+ $fields[] = array(
839
+ 'name' => 'billing_address_2',
840
+ 'label' => __( 'Billing: Street Address 2', 'woocommerce-exporter' )
841
+ );
842
+ $fields[] = array(
843
+ 'name' => 'billing_city',
844
+ 'label' => __( 'Billing: City', 'woocommerce-exporter' )
845
+ );
846
+ $fields[] = array(
847
+ 'name' => 'billing_postcode',
848
+ 'label' => __( 'Billing: ZIP Code', 'woocommerce-exporter' )
849
+ );
850
+ $fields[] = array(
851
+ 'name' => 'billing_state',
852
+ 'label' => __( 'Billing: State (prefix)', 'woocommerce-exporter' )
853
+ );
854
+ $fields[] = array(
855
+ 'name' => 'billing_state_full',
856
+ 'label' => __( 'Billing: State', 'woocommerce-exporter' )
857
+ );
858
+ $fields[] = array(
859
+ 'name' => 'billing_country',
860
+ 'label' => __( 'Billing: Country (prefix)', 'woocommerce-exporter' )
861
+ );
862
+ $fields[] = array(
863
+ 'name' => 'billing_country_full',
864
+ 'label' => __( 'Billing: Country', 'woocommerce-exporter' )
865
+ );
866
+ $fields[] = array(
867
+ 'name' => 'billing_phone',
868
+ 'label' => __( 'Billing: Phone Number', 'woocommerce-exporter' )
869
+ );
870
+ $fields[] = array(
871
+ 'name' => 'billing_email',
872
+ 'label' => __( 'Billing: E-mail Address', 'woocommerce-exporter' )
873
+ );
874
+ $fields[] = array(
875
+ 'name' => 'shipping_full_name',
876
+ 'label' => __( 'Shipping: Full Name', 'woocommerce-exporter' )
877
+ );
878
+ $fields[] = array(
879
+ 'name' => 'shipping_first_name',
880
+ 'label' => __( 'Shipping: First Name', 'woocommerce-exporter' )
881
+ );
882
+ $fields[] = array(
883
+ 'name' => 'shipping_last_name',
884
+ 'label' => __( 'Shipping: Last Name', 'woocommerce-exporter' )
885
+ );
886
+ $fields[] = array(
887
+ 'name' => 'shipping_company',
888
+ 'label' => __( 'Shipping: Company', 'woocommerce-exporter' )
889
+ );
890
+ $fields[] = array(
891
+ 'name' => 'shipping_address',
892
+ 'label' => __( 'Shipping: Street Address (Full)', 'woocommerce-exporter' )
893
+ );
894
+ $fields[] = array(
895
+ 'name' => 'shipping_address_1',
896
+ 'label' => __( 'Shipping: Street Address 1', 'woocommerce-exporter' )
897
+ );
898
+ $fields[] = array(
899
+ 'name' => 'shipping_address_2',
900
+ 'label' => __( 'Shipping: Street Address 2', 'woocommerce-exporter' )
901
+ );
902
+ $fields[] = array(
903
+ 'name' => 'shipping_city',
904
+ 'label' => __( 'Shipping: City', 'woocommerce-exporter' )
905
+ );
906
+ $fields[] = array(
907
+ 'name' => 'shipping_postcode',
908
+ 'label' => __( 'Shipping: ZIP Code', 'woocommerce-exporter' )
909
+ );
910
+ $fields[] = array(
911
+ 'name' => 'shipping_state',
912
+ 'label' => __( 'Shipping: State (prefix)', 'woocommerce-exporter' )
913
+ );
914
+ $fields[] = array(
915
+ 'name' => 'shipping_state_full',
916
+ 'label' => __( 'Shipping: State', 'woocommerce-exporter' )
917
+ );
918
+ $fields[] = array(
919
+ 'name' => 'shipping_country',
920
+ 'label' => __( 'Shipping: Country (prefix)', 'woocommerce-exporter' )
921
+ );
922
+ $fields[] = array(
923
+ 'name' => 'shipping_country_full',
924
+ 'label' => __( 'Shipping: Country', 'woocommerce-exporter' )
925
+ );
926
+ $fields[] = array(
927
+ 'name' => 'order_items_product_id',
928
+ 'label' => __( 'Order Items: Product ID', 'woocommerce-exporter' )
929
+ );
930
+ $fields[] = array(
931
+ 'name' => 'order_items_variation_id',
932
+ 'label' => __( 'Order Items: Variation ID', 'woocommerce-exporter' )
933
+ );
934
+ $fields[] = array(
935
+ 'name' => 'order_items_sku',
936
+ 'label' => __( 'Order Items: SKU', 'woocommerce-exporter' )
937
+ );
938
+ $fields[] = array(
939
+ 'name' => 'order_items_name',
940
+ 'label' => __( 'Order Items: Product Name', 'woocommerce-exporter' )
941
+ );
942
+ $fields[] = array(
943
+ 'name' => 'order_items_variation',
944
+ 'label' => __( 'Order Items: Product Variation', 'woocommerce-exporter' )
945
+ );
946
+ $fields[] = array(
947
+ 'name' => 'order_items_description',
948
+ 'label' => __( 'Order Items: Product Description', 'woocommerce-exporter' )
949
+ );
950
+ $fields[] = array(
951
+ 'name' => 'order_items_excerpt',
952
+ 'label' => __( 'Order Items: Product Excerpt', 'woocommerce-exporter' )
953
+ );
954
+ $fields[] = array(
955
+ 'name' => 'order_items_tax_class',
956
+ 'label' => __( 'Order Items: Tax Class', 'woocommerce-exporter' )
957
+ );
958
+ $fields[] = array(
959
+ 'name' => 'order_items_quantity',
960
+ 'label' => __( 'Order Items: Quantity', 'woocommerce-exporter' )
961
+ );
962
+ $fields[] = array(
963
+ 'name' => 'order_items_total',
964
+ 'label' => __( 'Order Items: Total', 'woocommerce-exporter' )
965
+ );
966
+ $fields[] = array(
967
+ 'name' => 'order_items_subtotal',
968
+ 'label' => __( 'Order Items: Subtotal', 'woocommerce-exporter' )
969
+ );
970
+ $fields[] = array(
971
+ 'name' => 'order_items_rrp',
972
+ 'label' => __( 'Order Items: RRP', 'woocommerce-exporter' )
973
+ );
974
+ $fields[] = array(
975
+ 'name' => 'order_items_stock',
976
+ 'label' => __( 'Order Items: Stock', 'woocommerce-exporter' )
977
+ );
978
+ $fields[] = array(
979
+ 'name' => 'order_items_tax',
980
+ 'label' => __( 'Order Items: Tax', 'woocommerce-exporter' )
981
+ );
982
+ $fields[] = array(
983
+ 'name' => 'order_items_tax_subtotal',
984
+ 'label' => __( 'Order Items: Tax Subtotal', 'woocommerce-exporter' )
985
+ );
986
+ $tax_rates = woo_ce_get_order_tax_rates();
987
+ if( !empty( $tax_rates ) ) {
988
+ foreach( $tax_rates as $tax_rate ) {
989
+ $fields[] = array(
990
+ 'name' => sprintf( 'order_items_tax_rate_%d', $tax_rate['rate_id'] ),
991
+ 'label' => sprintf( __( 'Order Items: Tax Rate - %s', 'woocommerce-exporter' ), $tax_rate['label'] )
992
+ );
993
+ }
994
+ }
995
+ unset( $tax_rates, $tax_rate );
996
+ $fields[] = array(
997
+ 'name' => 'order_items_type',
998
+ 'label' => __( 'Order Items: Type', 'woocommerce-exporter' )
999
+ );
1000
+ $fields[] = array(
1001
+ 'name' => 'order_items_category',
1002
+ 'label' => __( 'Order Items: Category', 'woocommerce-exporter' )
1003
+ );
1004
+ $fields[] = array(
1005
+ 'name' => 'order_items_tag',
1006
+ 'label' => __( 'Order Items: Tag', 'woocommerce-exporter' )
1007
+ );
1008
+ $fields[] = array(
1009
+ 'name' => 'order_items_total_sales',
1010
+ 'label' => __( 'Order Items: Total Sales', 'woocommerce-exporter' )
1011
+ );
1012
+ $fields[] = array(
1013
+ 'name' => 'order_items_weight',
1014
+ 'label' => __( 'Order Items: Weight', 'woocommerce-exporter' )
1015
+ );
1016
+ $fields[] = array(
1017
+ 'name' => 'order_items_total_weight',
1018
+ 'label' => __( 'Order Items: Total Weight', 'woocommerce-exporter' )
1019
+ );
1020
+
1021
+ /*
1022
+ $fields[] = array(
1023
+ 'name' => '',
1024
+ 'label' => __( '', 'woocommerce-exporter' )
1025
+ );
1026
+ */
1027
+
1028
+ // Allow Plugin/Theme authors to add support for additional columns
1029
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
1030
+
1031
+ switch( $format ) {
1032
+
1033
+ case 'summary':
1034
+ $output = array();
1035
+ $size = count( $fields );
1036
+ for( $i = 0; $i < $size; $i++ ) {
1037
+ if( isset( $fields[$i] ) )
1038
+ $output[$fields[$i]['name']] = 'on';
1039
+ }
1040
+ return $output;
1041
+ break;
1042
+
1043
+ case 'full':
1044
+ default:
1045
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
1046
+ $size = count( $fields );
1047
+ for( $i = 0; $i < $size; $i++ ) {
1048
+ $fields[$i]['reset'] = $i;
1049
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
1050
+ }
1051
+ // Check if we are using PHP 5.3 and above
1052
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
1053
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
1054
+ return $fields;
1055
+ break;
1056
+
1057
+ }
1058
+
1059
+ }
1060
+
1061
+ function woo_ce_override_order_field_labels( $fields = array() ) {
1062
+
1063
+ $labels = woo_ce_get_option( 'order_labels', array() );
1064
+ if( !empty( $labels ) ) {
1065
+ foreach( $fields as $key => $field ) {
1066
+ if( isset( $labels[$field['name']] ) )
1067
+ $fields[$key]['label'] = $labels[$field['name']];
1068
+ }
1069
+ }
1070
+ return $fields;
1071
+
1072
+ }
1073
+ add_filter( 'woo_ce_order_fields', 'woo_ce_override_order_field_labels', 11 );
1074
+
1075
+ // Adds custom Order and Order Item columns to the Order fields list
1076
+ function woo_ce_extend_order_fields( $fields = array() ) {
1077
+
1078
+ // Product Add-ons - http://www.woothemes.com/
1079
+ if( class_exists( 'Product_Addon_Admin' ) || class_exists( 'Product_Addon_Display' ) ) {
1080
+ $product_addons = woo_ce_get_product_addons();
1081
+ if( !empty( $product_addons ) ) {
1082
+ foreach( $product_addons as $product_addon ) {
1083
+ if( !empty( $product_addon ) ) {
1084
+ $fields[] = array(
1085
+ 'name' => sprintf( 'order_items_product_addon_%s', $product_addon->post_name ),
1086
+ 'label' => sprintf( __( 'Order Items: %s', 'woocommerce-exporter' ), ucfirst( $product_addon->post_title ) ),
1087
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_order_fields_product_addons', '%s: %s' ), __( 'Product Add-ons', 'woocommerce-exporter' ), $product_addon->form_title )
1088
+ );
1089
+ }
1090
+ }
1091
+ }
1092
+ unset( $product_addons, $product_addon );
1093
+ }
1094
+
1095
+ // WooCommerce Sequential Order Numbers - http://www.skyverge.com/blog/woocommerce-sequential-order-numbers/
1096
+ // Sequential Order Numbers Pro - http://www.woothemes.com/products/sequential-order-numbers-pro/
1097
+ if( class_exists( 'WC_Seq_Order_Number' ) || class_exists( 'WC_Seq_Order_Number_Pro' ) ) {
1098
+ $fields[] = array(
1099
+ 'name' => 'order_number',
1100
+ 'label' => __( 'Order Number', 'woocommerce-exporter' )
1101
+ );
1102
+ }
1103
+
1104
+ // WooCommerce Print Invoice & Delivery Note - https://wordpress.org/plugins/woocommerce-delivery-notes/
1105
+ if( class_exists( 'WooCommerce_Delivery_Notes' ) ) {
1106
+ $fields[] = array(
1107
+ 'name' => 'invoice_number',
1108
+ 'label' => __( 'Invoice Number', 'woocommerce-exporter' )
1109
+ );
1110
+ $fields[] = array(
1111
+ 'name' => 'invoice_date',
1112
+ 'label' => __( 'Invoice Date', 'woocommerce-exporter' )
1113
+ );
1114
+ }
1115
+
1116
+ // WooCommerce PDF Invoices & Packing Slips - http://www.wpovernight.com
1117
+ if( class_exists( 'WooCommerce_PDF_Invoices' ) ) {
1118
+ $fields[] = array(
1119
+ 'name' => 'pdf_invoice_number',
1120
+ 'label' => __( 'PDF Invoice Number', 'woocommerce-exporter' )
1121
+ );
1122
+ $fields[] = array(
1123
+ 'name' => 'pdf_invoice_date',
1124
+ 'label' => __( 'PDF Invoice Date', 'woocommerce-exporter' )
1125
+ );
1126
+ }
1127
+
1128
+ // WooCommerce Checkout Manager - http://wordpress.org/plugins/woocommerce-checkout-manager/
1129
+ // WooCommerce Checkout Manager Pro - http://www.trottyzone.com/product/woocommerce-checkout-manager-pro
1130
+ if( function_exists( 'wccs_install' ) || function_exists( 'wccs_install_pro' ) ) {
1131
+ $options = get_option( 'wccs_settings' );
1132
+ if( isset( $options['buttons'] ) ) {
1133
+ $buttons = $options['buttons'];
1134
+ if( !empty( $buttons ) ) {
1135
+ $header = ( $buttons[0]['type'] == 'heading' ? $buttons[0]['label'] : false );
1136
+ foreach( $buttons as $button ) {
1137
+ if( $button['type'] == 'heading' )
1138
+ continue;
1139
+ $fields[] = array(
1140
+ 'name' => $button['label'],
1141
+ 'label' => ( !empty( $header ) ? sprintf( apply_filters( 'woo_ce_extend_order_fields_wccs', '%s: %s' ), ucfirst( $header ), ucfirst( $button['label'] ) ) : ucfirst( $button['label'] ) )
1142
+ );
1143
+ }
1144
+ unset( $buttons, $button, $header );
1145
+ }
1146
+ }
1147
+ unset( $options );
1148
+ }
1149
+
1150
+ // Poor Guys Swiss Knife - http://wordpress.org/plugins/woocommerce-poor-guys-swiss-knife/
1151
+ if( function_exists( 'wcpgsk_init' ) ) {
1152
+
1153
+ $options = get_option( 'wcpgsk_settings' );
1154
+ $billing_fields = ( isset( $options['woofields']['billing'] ) ? $options['woofields']['billing'] : array() );
1155
+ $shipping_fields = ( isset( $options['woofields']['shipping'] ) ? $options['woofields']['shipping'] : array() );
1156
+
1157
+ // Custom billing fields
1158
+ if( !empty( $billing_fields ) ) {
1159
+ foreach( $billing_fields as $key => $billing_field ) {
1160
+ $fields[] = array(
1161
+ 'name' => $key,
1162
+ 'label' => $options['woofields']['label_' . $key]
1163
+ );
1164
+ }
1165
+ unset( $billing_fields, $billing_field );
1166
+ }
1167
+
1168
+ // Custom shipping fields
1169
+ if( !empty( $shipping_fields ) ) {
1170
+ foreach( $shipping_fields as $key => $shipping_field ) {
1171
+ $fields[] = array(
1172
+ 'name' => $key,
1173
+ 'label' => $options['woofields']['label_' . $key]
1174
+ );
1175
+ }
1176
+ unset( $shipping_fields, $shipping_field );
1177
+ }
1178
+
1179
+ unset( $options );
1180
+ }
1181
+
1182
+ // Checkout Field Editor - http://woothemes.com/woocommerce/
1183
+ if( function_exists( 'woocommerce_init_checkout_field_editor' ) ) {
1184
+ $billing_fields = get_option( 'wc_fields_billing', array() );
1185
+ $shipping_fields = get_option( 'wc_fields_shipping', array() );
1186
+ $custom_fields = get_option( 'wc_fields_additional', array() );
1187
+
1188
+ // Custom billing fields
1189
+ if( !empty( $billing_fields ) ) {
1190
+ foreach( $billing_fields as $key => $billing_field ) {
1191
+ // Only add non-default Checkout fields to export columns list
1192
+ if( isset( $billing_field['custom'] ) && $billing_field['custom'] == 1 ) {
1193
+ $fields[] = array(
1194
+ 'name' => sprintf( 'wc_billing_%s', $key ),
1195
+ 'label' => sprintf( __( 'Billing: %s', 'woocommerce-exporter' ), ucfirst( $billing_field['label'] ) )
1196
+ );
1197
+ }
1198
+ }
1199
+ }
1200
+ unset( $billing_fields, $billing_field );
1201
+
1202
+ // Custom shipping fields
1203
+ if( !empty( $shipping_fields ) ) {
1204
+ foreach( $shipping_fields as $key => $shipping_field ) {
1205
+ // Only add non-default Checkout fields to export columns list
1206
+ if( isset( $shipping_field['custom'] ) && $shipping_field['custom'] == 1 ) {
1207
+ $fields[] = array(
1208
+ 'name' => sprintf( 'wc_shipping_%s', $key ),
1209
+ 'label' => sprintf( __( 'Shipping: %s', 'woocommerce-exporter' ), ucfirst( $shipping_field['label'] ) )
1210
+ );
1211
+ }
1212
+ }
1213
+ }
1214
+ unset( $shipping_fields, $shipping_field );
1215
+
1216
+ // Custom fields
1217
+ if( !empty( $custom_fields ) ) {
1218
+ foreach( $custom_fields as $key => $custom_field ) {
1219
+ // Only add non-default Checkout fields to export columns list
1220
+ if( isset( $custom_field['custom'] ) && $custom_field['custom'] == 1 ) {
1221
+ $fields[] = array(
1222
+ 'name' => sprintf( 'wc_additional_%s', $key ),
1223
+ 'label' => sprintf( __( 'Additional: %s', 'woocommerce-exporter' ), ucfirst( $custom_field['label'] ) )
1224
+ );
1225
+ }
1226
+ }
1227
+ }
1228
+ unset( $custom_fields, $custom_field );
1229
+ }
1230
+
1231
+ // Checkout Field Manager - http://61extensions.com
1232
+ if( function_exists( 'sod_woocommerce_checkout_manager_settings' ) ) {
1233
+ $billing_fields = get_option( 'woocommerce_checkout_billing_fields', array() );
1234
+ $shipping_fields = get_option( 'woocommerce_checkout_shipping_fields', array() );
1235
+ $custom_fields = get_option( 'woocommerce_checkout_additional_fields', array() );
1236
+
1237
+ // Custom billing fields
1238
+ if( !empty( $billing_fields ) ) {
1239
+ foreach( $billing_fields as $key => $billing_field ) {
1240
+ // Only add non-default Checkout fields to export columns list
1241
+ if( strtolower( $billing_field['default_field'] ) != 'on' ) {
1242
+ $fields[] = array(
1243
+ 'name' => sprintf( 'sod_billing_%s', $billing_field['name'] ),
1244
+ 'label' => sprintf( __( 'Billing: %s', 'woocommerce-exporter' ), ucfirst( $billing_field['label'] ) )
1245
+ );
1246
+ }
1247
+ }
1248
+ }
1249
+ unset( $billing_fields, $billing_field );
1250
+
1251
+ // Custom shipping fields
1252
+ if( !empty( $shipping_fields ) ) {
1253
+ foreach( $shipping_fields as $key => $shipping_field ) {
1254
+ // Only add non-default Checkout fields to export columns list
1255
+ if( strtolower( $shipping_field['default_field'] ) != 'on' ) {
1256
+ $fields[] = array(
1257
+ 'name' => sprintf( 'sod_shipping_%s', $shipping_field['name'] ),
1258
+ 'label' => sprintf( __( 'Shipping: %s', 'woocommerce-exporter' ), ucfirst( $shipping_field['label'] ) )
1259
+ );
1260
+ }
1261
+ }
1262
+ }
1263
+ unset( $shipping_fields, $shipping_field );
1264
+
1265
+ // Custom fields
1266
+ if( !empty( $custom_fields ) ) {
1267
+ foreach( $custom_fields as $key => $custom_field ) {
1268
+ // Only add non-default Checkout fields to export columns list
1269
+ if( strtolower( $custom_field['default_field'] ) != 'on' ) {
1270
+ $fields[] = array(
1271
+ 'name' => sprintf( 'sod_additional_%s', $custom_field['name'] ),
1272
+ 'label' => sprintf( __( 'Additional: %s', 'woocommerce-exporter' ), ucfirst( $custom_field['label'] ) )
1273
+ );
1274
+ }
1275
+ }
1276
+ }
1277
+ unset( $custom_fields, $custom_field );
1278
+ }
1279
+
1280
+ // WooCommerce Checkout Add-Ons - http://www.skyverge.com/product/woocommerce-checkout-add-ons/
1281
+ if( function_exists( 'init_woocommerce_checkout_add_ons' ) ) {
1282
+ $fields[] = array(
1283
+ 'name' => 'order_items_checkout_addon_id',
1284
+ 'label' => __( 'Order Items: Checkout Add-ons ID', 'woocommerce-exporter' )
1285
+ );
1286
+ $fields[] = array(
1287
+ 'name' => 'order_items_checkout_addon_label',
1288
+ 'label' => __( 'Order Items: Checkout Add-ons Label', 'woocommerce-exporter' )
1289
+ );
1290
+ $fields[] = array(
1291
+ 'name' => 'order_items_checkout_addon_value',
1292
+ 'label' => __( 'Order Items: Checkout Add-ons Value', 'woocommerce-exporter' )
1293
+ );
1294
+ }
1295
+
1296
+ // WooCommerce Brands Addon - http://woothemes.com/woocommerce/
1297
+ // WooCommerce Brands - http://proword.net/Woocommerce_Brands/
1298
+ if( class_exists( 'WC_Brands' ) || class_exists( 'woo_brands' ) || taxonomy_exists( apply_filters( 'woo_ce_brand_term_taxonomy', 'product_brand' ) ) ) {
1299
+ $fields[] = array(
1300
+ 'name' => 'order_items_brand',
1301
+ 'label' => __( 'Order Items: Brand', 'woocommerce-exporter' )
1302
+ );
1303
+ }
1304
+
1305
+ // Product Vendors - http://www.woothemes.com/products/product-vendors/
1306
+ if( class_exists( 'WooCommerce_Product_Vendors' ) ) {
1307
+ $fields[] = array(
1308
+ 'name' => 'order_items_vendor',
1309
+ 'label' => __( 'Order Items: Product Vendor', 'woocommerce-exporter' )
1310
+ );
1311
+ }
1312
+
1313
+ // Cost of Goods - http://www.skyverge.com/product/woocommerce-cost-of-goods-tracking/
1314
+ if( class_exists( 'WC_COG' ) ) {
1315
+ $fields[] = array(
1316
+ 'name' => 'cost_of_goods',
1317
+ 'label' => __( 'Order Total Cost of Goods', 'woocommerce-exporter' )
1318
+ );
1319
+ $fields[] = array(
1320
+ 'name' => 'order_items_cost_of_goods',
1321
+ 'label' => __( 'Order Items: Cost of Goods', 'woocommerce-exporter' )
1322
+ );
1323
+ $fields[] = array(
1324
+ 'name' => 'order_items_total_cost_of_goods',
1325
+ 'label' => __( 'Order Items: Total Cost of Goods', 'woocommerce-exporter' )
1326
+ );
1327
+ }
1328
+
1329
+ // WooCommerce MSRP Pricing - http://woothemes.com/woocommerce/
1330
+ if( function_exists( 'woocommerce_msrp_activate' ) ) {
1331
+ $fields[] = array(
1332
+ 'name' => 'order_items_msrp',
1333
+ 'label' => __( 'Order Items: MSRP', 'woocommerce-exporter' )
1334
+ );
1335
+ }
1336
+
1337
+ // Local Pickup Plus - http://www.woothemes.com/products/local-pickup-plus/
1338
+ if( class_exists( 'WC_Local_Pickup_Plus' ) ) {
1339
+ $fields[] = array(
1340
+ 'name' => 'order_items_pickup_location',
1341
+ 'label' => __( 'Order Items: Pickup Location', 'woocommerce-exporter' )
1342
+ );
1343
+ }
1344
+
1345
+ // WooCommerce Bookings - http://www.woothemes.com/products/woocommerce-bookings/
1346
+ if( class_exists( 'WC_Bookings' ) ) {
1347
+ $fields[] = array(
1348
+ 'name' => 'order_items_booking_id',
1349
+ 'label' => __( 'Order Items: Booking ID', 'woocommerce-exporter' ),
1350
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' )
1351
+ );
1352
+ $fields[] = array(
1353
+ 'name' => 'order_items_booking_date',
1354
+ 'label' => __( 'Order Items: Booking Date', 'woocommerce-exporter' ),
1355
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' )
1356
+ );
1357
+ $fields[] = array(
1358
+ 'name' => 'order_items_booking_start_date',
1359
+ 'label' => __( 'Order Items: Start Date', 'woocommerce-exporter' ),
1360
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' )
1361
+ );
1362
+ $fields[] = array(
1363
+ 'name' => 'order_items_booking_end_date',
1364
+ 'label' => __( 'Order Items: End Date', 'woocommerce-exporter' ),
1365
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' )
1366
+ );
1367
+ }
1368
+
1369
+ // Gravity Forms - http://woothemes.com/woocommerce
1370
+ if( class_exists( 'RGForms' ) && class_exists( 'woocommerce_gravityforms' ) ) {
1371
+ // Check if there are any Products linked to Gravity Forms
1372
+ if( $gf_fields = woo_ce_get_gravity_form_fields() ) {
1373
+ $fields[] = array(
1374
+ 'name' => 'order_items_gf_form_id',
1375
+ 'label' => __( 'Order Items: Gravity Form ID', 'woocommerce-exporter' )
1376
+ );
1377
+ $fields[] = array(
1378
+ 'name' => 'order_items_gf_form_label',
1379
+ 'label' => __( 'Order Items: Gravity Form Label', 'woocommerce-exporter' )
1380
+ );
1381
+ foreach( $gf_fields as $gf_field ) {
1382
+ $gf_field_duplicate = false;
1383
+ // Check if this isn't a duplicate Gravity Forms field
1384
+ foreach( $fields as $field ) {
1385
+ if( isset( $field['name'] ) && $field['name'] == sprintf( 'order_items_gf_%d_%s', $gf_field['formId'], $gf_field['id'] ) ) {
1386
+ // Duplicate exists
1387
+ $gf_field_duplicate = true;
1388
+ break;
1389
+ }
1390
+ }
1391
+ // If it's not a duplicate go ahead and add it to the list
1392
+ if( $gf_field_duplicate !== true ) {
1393
+ $fields[] = array(
1394
+ 'name' => sprintf( 'order_items_gf_%d_%s', $gf_field['formId'], $gf_field['id'] ),
1395
+ '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'] ) ) ),
1396
+ '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'] )
1397
+ );
1398
+ }
1399
+ }
1400
+ unset( $gf_fields, $gf_field );
1401
+ }
1402
+ }
1403
+
1404
+ // WooCommerce Currency Switcher - http://dev.pathtoenlightenment.net/shop
1405
+ if( class_exists( 'WC_Aelia_CurrencySwitcher' ) ) {
1406
+ $fields[] = array(
1407
+ 'name' => 'order_currency',
1408
+ 'label' => __( 'Order Currency', 'woocommerce-exporter' )
1409
+ );
1410
+ }
1411
+
1412
+ // WooCommerce TM Extra Product Options - http://codecanyon.net/item/woocommerce-extra-product-options/7908619
1413
+ if( class_exists( 'TM_Extra_Product_Options' ) ) {
1414
+ if( $tm_fields = woo_ce_get_extra_product_option_fields() ) {
1415
+ foreach( $tm_fields as $tm_field ) {
1416
+ $fields[] = array(
1417
+ 'name' => sprintf( 'order_items_tm_%s', sanitize_key( $tm_field['name'] ) ),
1418
+ 'label' => sprintf( __( 'Order Items: %s', 'woocommerce-exporter' ), $tm_field['name'] )
1419
+ );
1420
+ }
1421
+ unset( $tm_fields, $tm_field );
1422
+ }
1423
+ }
1424
+
1425
+ // WooCommerce Ship to Multiple Addresses - http://woothemes.com/woocommerce
1426
+ if( class_exists( 'WC_Ship_Multiple' ) ) {
1427
+ $fields[] = array(
1428
+ 'name' => 'wcms_number_packages',
1429
+ 'label' => __( 'Number of Packages', 'woocommerce-exporter' ),
1430
+ 'hover' => __( 'Ship to Multiple Addresses', 'woocommerce-exporter' )
1431
+ );
1432
+ }
1433
+
1434
+ // Attributes
1435
+ if( $attributes = woo_ce_get_product_attributes() ) {
1436
+ foreach( $attributes as $attribute ) {
1437
+ $attribute->attribute_label = trim( $attribute->attribute_label );
1438
+ if( empty( $attribute->attribute_label ) )
1439
+ $attribute->attribute_label = $attribute->attribute_name;
1440
+ $fields[] = array(
1441
+ 'name' => sprintf( 'order_items_attribute_%s', $attribute->attribute_name ),
1442
+ 'label' => sprintf( __( 'Order Items: %s', 'woocommerce-exporter' ), ucwords( $attribute->attribute_label ) ),
1443
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_order_fields_attribute', '%s: %s (#%d)' ), __( 'Attribute', 'woocommerce-exporter' ), $attribute->attribute_name, $attribute->attribute_id )
1444
+ );
1445
+ }
1446
+ unset( $attributes, $attribute );
1447
+ }
1448
+
1449
+ // Custom Order fields
1450
+ $custom_orders = woo_ce_get_option( 'custom_orders', '' );
1451
+ if( !empty( $custom_orders ) ) {
1452
+ foreach( $custom_orders as $custom_order ) {
1453
+ if( !empty( $custom_order ) ) {
1454
+ $fields[] = array(
1455
+ 'name' => $custom_order,
1456
+ 'label' => woo_ce_clean_export_label( $custom_order ),
1457
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_order_fields_custom_order_hover', '%s: %s' ), __( 'Custom Order', 'woocommerce-exporter' ), $custom_order )
1458
+ );
1459
+ }
1460
+ }
1461
+ unset( $custom_orders, $custom_order );
1462
+ }
1463
+
1464
+ // Custom Order Items fields
1465
+ $custom_order_items = woo_ce_get_option( 'custom_order_items', '' );
1466
+ if( !empty( $custom_order_items ) ) {
1467
+ foreach( $custom_order_items as $custom_order_item ) {
1468
+ if( !empty( $custom_order_item ) ) {
1469
+ $fields[] = array(
1470
+ 'name' => sprintf( 'order_items_%s', $custom_order_item ),
1471
+ 'label' => sprintf( __( 'Order Items: %s', 'woocommerce-exporter' ), woo_ce_clean_export_label( $custom_order_item ) ),
1472
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_order_fields_custom_order_item_hover', '%s: %s' ), __( 'Custom Order Item', 'woocommerce-exporter' ), $custom_order_item )
1473
+ );
1474
+ }
1475
+ }
1476
+ }
1477
+
1478
+ // Custom Product fields
1479
+ $custom_product_fields = woo_ce_get_option( 'custom_products', '' );
1480
+ if( !empty( $custom_product_fields ) ) {
1481
+ foreach( $custom_product_fields as $custom_product_field ) {
1482
+ if( !empty( $custom_product_field ) ) {
1483
+ $fields[] = array(
1484
+ 'name' => sprintf( 'order_items_%s', $custom_product_field ),
1485
+ 'label' => sprintf( __( 'Order Items: %s', 'woocommerce-exporter' ), woo_ce_clean_export_label( $custom_product_field ) ),
1486
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_order_fields_custom_product_hover', '%s: %s' ), __( 'Custom Product', 'woocommerce-exporter' ), $custom_product_field )
1487
+ );
1488
+ }
1489
+ }
1490
+ }
1491
+
1492
+ return $fields;
1493
+
1494
+ }
1495
+ add_filter( 'woo_ce_order_fields', 'woo_ce_extend_order_fields' );
1496
+
1497
+ function woo_ce_get_order_tax_rates() {
1498
+
1499
+ global $wpdb;
1500
+
1501
+ $tax_rates_sql = "SELECT order_items.order_item_id as item_id, order_items.order_item_name FROM " . $wpdb->prefix . "woocommerce_order_items as order_items WHERE order_items.order_item_type = 'tax' GROUP BY order_item_name";
1502
+ $tax_rates = $wpdb->get_results( $tax_rates_sql, 'ARRAY_A' );
1503
+ if( !empty( $tax_rates ) ) {
1504
+ $meta_type = 'order_item';
1505
+ foreach( $tax_rates as $key => $tax_rate ) {
1506
+ $tax_rates[$key]['rate_id'] = get_metadata( $meta_type, $tax_rate['item_id'], 'rate_id', true );
1507
+ $tax_rates[$key]['label'] = get_metadata( $meta_type, $tax_rate['item_id'], 'label', true );
1508
+ }
1509
+ return $tax_rates;
1510
+ }
1511
+
1512
+ }
1513
+
1514
+ function woo_ce_get_gravity_forms_products() {
1515
+
1516
+ global $wpdb;
1517
+
1518
+ $meta_key = '_gravity_form_data';
1519
+ $post_ids_sql = $wpdb->prepare( "SELECT `post_id`, `meta_value` FROM `$wpdb->postmeta` WHERE `meta_key` = %s GROUP BY `meta_value`", $meta_key );
1520
+ return $wpdb->get_results( $post_ids_sql );
1521
+
1522
+ }
1523
+
1524
+ function woo_ce_get_gravity_form_fields() {
1525
+
1526
+ if( $gf_products = woo_ce_get_gravity_forms_products() ) {
1527
+ $fields = array();
1528
+ foreach( $gf_products as $gf_product ) {
1529
+ if( $gf_product_data = maybe_unserialize( get_post_meta( $gf_product->post_id, '_gravity_form_data', true ) ) ) {
1530
+ // Check the class and method for Gravity Forms exists
1531
+ if( class_exists( 'RGFormsModel' ) && method_exists( 'RGFormsModel', 'get_form_meta' ) ) {
1532
+ // Check the form exists
1533
+ $gf_form_meta = RGFormsModel::get_form_meta( $gf_product_data['id'] );
1534
+ if( !empty( $gf_form_meta ) ) {
1535
+ // Check that the form has fields assigned to it
1536
+ if( !empty( $gf_form_meta['fields'] ) ) {
1537
+ foreach( $gf_form_meta['fields'] as $gf_form_field ) {
1538
+ // Check for duplicate Gravity Form fields
1539
+ $gf_form_field['formTitle'] = $gf_form_meta['title'];
1540
+ // Do not include page and section breaks, hidden as exportable fields
1541
+ if( !in_array( $gf_form_field['type'], array( 'page', 'section', 'hidden' ) ) )
1542
+ $fields[] = $gf_form_field;
1543
+ }
1544
+ }
1545
+ }
1546
+ unset( $gf_form_meta );
1547
+ }
1548
+ }
1549
+ }
1550
+ return $fields;
1551
+ }
1552
+
1553
+ }
1554
+
1555
+ function woo_ce_get_extra_product_option_fields() {
1556
+
1557
+ global $wpdb;
1558
+
1559
+ $meta_key = '_tmcartepo_data';
1560
+ $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 );
1561
+ $tm_fields = $wpdb->get_col( $tm_fields_sql );
1562
+ if( !empty( $tm_fields ) ) {
1563
+ $fields = array();
1564
+ foreach( $tm_fields as $tm_field ) {
1565
+ $tm_field = maybe_unserialize( $tm_field );
1566
+ $size = count( $tm_field );
1567
+ for( $i = 0; $i < $size; $i++ ) {
1568
+ // Check that the name is set
1569
+ if( !empty( $tm_field[$i]['name'] ) ) {
1570
+ // Check if we haven't already set this
1571
+ if( !array_key_exists( sanitize_key( $tm_field[$i]['name'] ), $fields ) )
1572
+ $fields[sanitize_key( $tm_field[$i]['name'] )] = $tm_field[$i];
1573
+ }
1574
+ }
1575
+ }
1576
+ }
1577
+ return $fields;
1578
+
1579
+ }
1580
+
1581
+ function woo_ce_format_order_date( $date ) {
1582
+
1583
+ $output = $date;
1584
+ if( $date )
1585
+ $output = str_replace( '/', '-', $date );
1586
+ return $output;
1587
+
1588
+ }
1589
+
1590
+ // Returns a list of WooCommerce Order statuses
1591
+ function woo_ce_get_order_statuses() {
1592
+
1593
+ $terms = false;
1594
+ // Check if this is a WooCommerce 2.2+ instance (new Post Status)
1595
+ $woocommerce_version = woo_get_woo_version();
1596
+ if( version_compare( $woocommerce_version, '2.2' ) >= 0 ) {
1597
+ // Convert Order Status array into our magic sauce
1598
+ $order_statuses = ( function_exists( 'wc_get_order_statuses' ) ? wc_get_order_statuses() : false );
1599
+ if( !empty( $order_statuses ) ) {
1600
+ $terms = array();
1601
+ $post_type = 'shop_order';
1602
+ $posts_count = wp_count_posts( $post_type );
1603
+ foreach( $order_statuses as $key => $order_status ) {
1604
+ $terms[] = (object)array(
1605
+ 'name' => $order_status,
1606
+ 'slug' => $key,
1607
+ 'count' => ( isset( $posts_count->$key ) ? $posts_count->$key : 0 )
1608
+ );
1609
+ }
1610
+ }
1611
+ } else {
1612
+ $args = array(
1613
+ 'hide_empty' => false
1614
+ );
1615
+ $terms = get_terms( 'shop_order_status', $args );
1616
+ if( empty( $terms ) || ( is_wp_error( $terms ) == true ) )
1617
+ $terms = false;
1618
+ }
1619
+ return $terms;
1620
+
1621
+ }
1622
+
1623
+ function woo_ce_get_order_items_types() {
1624
+
1625
+ $types = array(
1626
+ 'line_item' => __( 'Line Item', 'woocommerce-exporter' ),
1627
+ 'coupon' => __( 'Coupon', 'woocommerce-exporter' ),
1628
+ 'fee' => __( 'Fee', 'woocommerce-exporter' ),
1629
+ 'tax' => __( 'Tax', 'woocommerce-exporter' ),
1630
+ 'shipping' => __( 'Shipping', 'woocommerce-exporter' )
1631
+ );
1632
+ $types = apply_filters( 'woo_ce_order_item_types', $types );
1633
+ return $types;
1634
+
1635
+ }
1636
+ ?>
includes/product.php ADDED
@@ -0,0 +1,1697 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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. 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. 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 disabled Filter Products by Product Brand widget on Store Exporter screen
71
+ function woo_ce_products_filter_by_product_brand() {
72
+
73
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
74
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
75
+
76
+ $args = array(
77
+ 'hide_empty' => 1
78
+ );
79
+ $product_brands = woo_ce_get_product_brands( $args );
80
+
81
+ ob_start(); ?>
82
+ <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>
83
+ <div id="export-products-filters-brands" class="separator">
84
+ <ul>
85
+ <li>
86
+ <?php if( !empty( $product_brands ) ) { ?>
87
+ <select data-placeholder="<?php _e( 'Choose a Product Brand...', 'woocommerce-exporter' ); ?>" name="product_filter_brand[]" multiple class="chzn-select" style="width:95%;">
88
+ <?php foreach( $product_brands as $product_brand ) { ?>
89
+ <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>
90
+ <?php } ?>
91
+ </select>
92
+ <?php } else { ?>
93
+ <?php _e( 'No Product Brands were found.', 'woocommerce-exporter' ); ?>
94
+ <?php } ?>
95
+ </li>
96
+ </ul>
97
+ <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>
98
+ </div>
99
+ <!-- #export-products-filters-brands -->
100
+ <?php
101
+ ob_end_flush();
102
+
103
+ }
104
+
105
+ // HTML template for disabled Filter Products by Product Vendor widget on Store Exporter screen
106
+ function woo_ce_products_filter_by_product_vendor() {
107
+
108
+ if( !class_exists( 'WooCommerce_Product_Vendors' ) )
109
+ return;
110
+
111
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
112
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
113
+
114
+ $args = array(
115
+ 'hide_empty' => 1
116
+ );
117
+ $product_vendors = woo_ce_get_product_vendors( $args, 'full' );
118
+
119
+ ob_start(); ?>
120
+ <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>
121
+ <div id="export-products-filters-vendors" class="separator">
122
+ <?php if( $product_vendors ) { ?>
123
+ <ul>
124
+ <?php foreach( $product_vendors as $product_vendor ) { ?>
125
+ <li>
126
+ <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>
127
+ <span class="description">(<?php echo $product_vendor->count; ?>)</span>
128
+ </li>
129
+ <?php } ?>
130
+ </ul>
131
+ <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>
132
+ <?php } else { ?>
133
+ <p><?php _e( 'No Product Vendors were found.', 'woocommerce-exporter' ); ?></p>
134
+ <?php } ?>
135
+ </div>
136
+ <!-- #export-products-filters-vendors -->
137
+ <?php
138
+ ob_end_flush();
139
+
140
+ }
141
+
142
+ // HTML template for Filter Products by Product Status widget on Store Exporter screen
143
+ function woo_ce_products_filter_by_product_status() {
144
+
145
+ $product_statuses = get_post_statuses();
146
+ if( !isset( $product_statuses['trash'] ) )
147
+ $product_statuses['trash'] = __( 'Trash', 'woocommerce-exporter' );
148
+
149
+ ob_start(); ?>
150
+ <p><label><input type="checkbox" id="products-filters-status" /> <?php _e( 'Filter Products by Product Status', 'woocommerce-exporter' ); ?></label></p>
151
+ <div id="export-products-filters-status" class="separator">
152
+ <ul>
153
+ <li>
154
+ <?php if( !empty( $product_statuses ) ) { ?>
155
+ <select data-placeholder="<?php _e( 'Choose a Product Status...', 'woocommerce-exporter' ); ?>" name="product_filter_status[]" multiple class="chzn-select" style="width:95%;">
156
+ <?php foreach( $product_statuses as $key => $product_status ) { ?>
157
+ <option value="<?php echo $key; ?>"><?php echo $product_status; ?></option>
158
+ <?php } ?>
159
+ </select>
160
+ <?php } else { ?>
161
+ <?php _e( 'No Product Status were found.', 'woocommerce-exporter' ); ?></li>
162
+ <?php } ?>
163
+ </li>
164
+ </ul>
165
+ <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>
166
+ </div>
167
+ <!-- #export-products-filters-status -->
168
+ <?php
169
+ ob_end_flush();
170
+
171
+ }
172
+
173
+ // HTML template for Filter Products by Product Type widget on Store Exporter screen
174
+ function woo_ce_products_filter_by_product_type() {
175
+
176
+ $product_types = woo_ce_get_product_types();
177
+
178
+ ob_start(); ?>
179
+ <p><label><input type="checkbox" id="products-filters-type" /> <?php _e( 'Filter Products by Product Type', 'woocommerce-exporter' ); ?></label></p>
180
+ <div id="export-products-filters-type" class="separator">
181
+ <ul>
182
+ <li>
183
+ <?php if( !empty( $product_types ) ) { ?>
184
+ <select data-placeholder="<?php _e( 'Choose a Product Type...', 'woocommerce-exporter' ); ?>" name="product_filter_type[]" multiple class="chzn-select" style="width:95%;">
185
+ <?php foreach( $product_types as $key => $product_type ) { ?>
186
+ <option value="<?php echo $key; ?>"><?php echo woo_ce_format_product_type( $product_type['name'] ); ?> (<?php echo $product_type['count']; ?>)</option>
187
+ <?php } ?>
188
+ </select>
189
+ <?php } else { ?>
190
+ <?php _e( 'No Product Types were found.', 'woocommerce-exporter' ); ?></li>
191
+ <?php } ?>
192
+ </li>
193
+ </ul>
194
+ <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>
195
+ </div>
196
+ <!-- #export-products-filters-type -->
197
+ <?php
198
+ ob_end_flush();
199
+
200
+ }
201
+
202
+ // HTML template for Filter Products by Product Type widget on Store Exporter screen
203
+ function woo_ce_products_filter_by_stock_status() {
204
+
205
+ // Store Exporter Deluxe
206
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
207
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
208
+
209
+ ob_start(); ?>
210
+ <p><label><input type="checkbox" id="products-filters-stock" /> <?php _e( 'Filter Products by Stock Status', 'woocommerce-exporter' ); ?></label></p>
211
+ <div id="export-products-filters-stock" class="separator">
212
+ <ul>
213
+ <li value=""><label><input type="radio" name="product_filter_stock" value="" checked="checked" /><?php _e( 'Include both', 'woocommerce-exporter' ); ?></label></li>
214
+ <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>
215
+ <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>
216
+ </ul>
217
+ <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>
218
+ </div>
219
+ <!-- #export-products-filters-stock -->
220
+ <?php
221
+ ob_end_flush();
222
+
223
+ }
224
+
225
+ // HTML template for Product Sorting widget on Store Exporter screen
226
+ function woo_ce_product_sorting() {
227
+
228
+ $product_orderby = woo_ce_get_option( 'product_orderby', 'ID' );
229
+ $product_order = woo_ce_get_option( 'product_order', 'DESC' );
230
+
231
+ ob_start(); ?>
232
+ <p><label><?php _e( 'Product Sorting', 'woocommerce-exporter' ); ?></label></p>
233
+ <div>
234
+ <select name="product_orderby">
235
+ <option value="ID"<?php selected( 'ID', $product_orderby ); ?>><?php _e( 'Product ID', 'woocommerce-exporter' ); ?></option>
236
+ <option value="title"<?php selected( 'title', $product_orderby ); ?>><?php _e( 'Product Name', 'woocommerce-exporter' ); ?></option>
237
+ <option value="date"<?php selected( 'date', $product_orderby ); ?>><?php _e( 'Date Created', 'woocommerce-exporter' ); ?></option>
238
+ <option value="modified"<?php selected( 'modified', $product_orderby ); ?>><?php _e( 'Date Modified', 'woocommerce-exporter' ); ?></option>
239
+ <option value="rand"<?php selected( 'rand', $product_orderby ); ?>><?php _e( 'Random', 'woocommerce-exporter' ); ?></option>
240
+ <option value="menu_order"<?php selected( 'menu_order', $product_orderby ); ?>><?php _e( 'Sort Order', 'woocommerce-exporter' ); ?></option>
241
+ </select>
242
+ <select name="product_order">
243
+ <option value="ASC"<?php selected( 'ASC', $product_order ); ?>><?php _e( 'Ascending', 'woocommerce-exporter' ); ?></option>
244
+ <option value="DESC"<?php selected( 'DESC', $product_order ); ?>><?php _e( 'Descending', 'woocommerce-exporter' ); ?></option>
245
+ </select>
246
+ <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>
247
+ </div>
248
+ <?php
249
+ ob_end_flush();
250
+
251
+ }
252
+
253
+ // HTML template for Up-sells formatting on Store Exporter screen
254
+ function woo_ce_products_upsells_formatting() {
255
+
256
+ $upsell_formatting = woo_ce_get_option( 'upsell_formatting', 1 );
257
+
258
+ ob_start(); ?>
259
+ <tr class="export-options product-options">
260
+ <th><label for=""><?php _e( 'Up-sells formatting', 'woocommerce-exporter' ); ?></label></th>
261
+ <td>
262
+ <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 />
263
+ <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>
264
+ <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>
265
+ </td>
266
+ </tr>
267
+
268
+ <?php
269
+ ob_end_flush();
270
+
271
+ }
272
+
273
+ // HTML template for Cross-sells formatting on Store Exporter screen
274
+ function woo_ce_products_crosssells_formatting() {
275
+
276
+ $crosssell_formatting = woo_ce_get_option( 'crosssell_formatting', 1 );
277
+
278
+ ob_start(); ?>
279
+ <tr class="export-options product-options">
280
+ <th><label for=""><?php _e( 'Cross-sells formatting', 'woocommerce-exporter' ); ?></label></th>
281
+ <td>
282
+ <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 />
283
+ <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>
284
+ <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>
285
+ </td>
286
+ </tr>
287
+
288
+ <?php
289
+ ob_end_flush();
290
+
291
+ }
292
+
293
+ // HTML template for Custom Products widget on Store Exporter screen
294
+ function woo_ce_products_custom_fields() {
295
+
296
+ // Store Exporter Deluxe
297
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
298
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
299
+
300
+ if( $custom_products = woo_ce_get_option( 'custom_products', '' ) )
301
+ $custom_products = implode( "\n", $custom_products );
302
+ $custom_attributes = '';
303
+
304
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/';
305
+
306
+ ob_start(); ?>
307
+ <form method="post" id="export-products-custom-fields" class="export-options product-options">
308
+ <div id="poststuff">
309
+
310
+ <div class="postbox" id="export-options product-options">
311
+ <h3 class="hndle"><?php _e( 'Custom Product Fields', 'woocommerce-exporter' ); ?></h3>
312
+ <div class="inside">
313
+ <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>
314
+ <table class="form-table">
315
+
316
+ <tr>
317
+ <th>
318
+ <label><?php _e( 'Product meta', 'woocommerce-exporter' ); ?></label>
319
+ </th>
320
+ <td>
321
+ <textarea name="custom_products" rows="5" cols="70"><?php echo esc_textarea( $custom_products ); ?></textarea>
322
+ <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>
323
+ </td>
324
+ </tr>
325
+
326
+ <tr>
327
+ <th>
328
+ <label><?php _e( 'Custom attribute', 'woocommerce-exporter' ); ?></label>
329
+ </th>
330
+ <td>
331
+ <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>
332
+ <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>
333
+ </td>
334
+ </tr>
335
+
336
+ </table>
337
+ <p class="submit">
338
+ <input type="submit" value="<?php _e( 'Save Custom Fields', 'woocommerce-exporter' ); ?>" class="button-primary" />
339
+ </p>
340
+ <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>
341
+ </div>
342
+ <!-- .inside -->
343
+ </div>
344
+ <!-- .postbox -->
345
+
346
+ </div>
347
+ <!-- #poststuff -->
348
+ <input type="hidden" name="action" value="update" />
349
+ </form>
350
+ <!-- #export-products-custom-fields -->
351
+ <?php
352
+ ob_end_flush();
353
+
354
+ }
355
+
356
+ function woo_ce_export_options_gallery_format() {
357
+
358
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
359
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
360
+
361
+ ob_start(); ?>
362
+ <tr class="export-options product-options">
363
+ <th><label for=""><?php _e( 'Product gallery formatting', 'woocommerce-exporter' ); ?></label></th>
364
+ <td>
365
+ <label><input type="radio" name="product_gallery_formatting" value="0"<?php checked( 0, 0 ); ?> />&nbsp;<?php _e( 'Export Product Gallery as Post ID', 'woocommerce-exporter' ); ?></label><br />
366
+ <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>
367
+ <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>
368
+ </td>
369
+ </tr>
370
+ <?php
371
+ ob_end_flush();
372
+
373
+ }
374
+
375
+ /* End of: WordPress Administration */
376
+
377
+ }
378
+
379
+ // Returns a list of WooCommerce Product IDs to export process
380
+ function woo_ce_get_products( $args = array() ) {
381
+
382
+ $limit_volume = -1;
383
+ $offset = 0;
384
+ $product_categories = false;
385
+ $product_tags = false;
386
+ $product_status = false;
387
+ $product_type = false;
388
+ $orderby = 'ID';
389
+ $order = 'ASC';
390
+ if( $args ) {
391
+ $limit_volume = ( isset( $args['limit_volume'] ) ? $args['limit_volume'] : false );
392
+ $offset = ( isset( $args['offset'] ) ? $args['offset'] : false );
393
+ if( !empty( $args['product_categories'] ) )
394
+ $product_categories = $args['product_categories'];
395
+ if( !empty( $args['product_tags'] ) )
396
+ $product_tags = $args['product_tags'];
397
+ if( !empty( $args['product_status'] ) )
398
+ $product_status = $args['product_status'];
399
+ if( !empty( $args['product_type'] ) )
400
+ $product_type = $args['product_type'];
401
+ if( isset( $args['product_orderby'] ) )
402
+ $orderby = $args['product_orderby'];
403
+ if( isset( $args['product_order'] ) )
404
+ $order = $args['product_order'];
405
+ }
406
+ $post_type = array( 'product', 'product_variation' );
407
+ $args = array(
408
+ 'post_type' => $post_type,
409
+ 'orderby' => $orderby,
410
+ 'order' => $order,
411
+ 'offset' => $offset,
412
+ 'posts_per_page' => $limit_volume,
413
+ 'post_status' => woo_ce_post_statuses(),
414
+ 'fields' => 'ids',
415
+ 'suppress_filters' => false
416
+ );
417
+ $args['tax_query'] = array();
418
+ // Filter Products by Product Category
419
+ if( $product_categories ) {
420
+ $term_taxonomy = 'product_cat';
421
+ $args['tax_query'][] = array(
422
+ array(
423
+ 'taxonomy' => $term_taxonomy,
424
+ 'field' => 'id',
425
+ 'terms' => $product_categories
426
+ )
427
+ );
428
+ }
429
+ // Filter Products by Product Tag
430
+ if( $product_tags ) {
431
+ $term_taxonomy = 'product_tag';
432
+ $args['tax_query'][] = array(
433
+ array(
434
+ 'taxonomy' => $term_taxonomy,
435
+ 'field' => 'id',
436
+ 'terms' => $product_tags
437
+ )
438
+ );
439
+ }
440
+ if( $product_status )
441
+ $args['post_status'] = woo_ce_post_statuses( $product_status, true );
442
+ if( $product_type ) {
443
+ if( in_array( 'variation', $product_type ) && count( $product_type ) == 1 )
444
+ $args['post_type'] = array( 'product_variation' );
445
+ if( !empty( $product_type ) ) {
446
+ $args['tax_query'] = array(
447
+ array(
448
+ 'taxonomy' => 'product_type',
449
+ 'field' => 'slug',
450
+ 'terms' => $product_type
451
+ )
452
+ );
453
+ } else {
454
+ unset( $args['meta_query'] );
455
+ }
456
+ }
457
+ $products = array();
458
+ $product_ids = new WP_Query( $args );
459
+ if( $product_ids->posts ) {
460
+ foreach( $product_ids->posts as $product_id ) {
461
+ $product = get_post( $product_id );
462
+ // Filter out variations that don't have a Parent Product that exists
463
+ if( $product->post_type == 'product_variation' ) {
464
+ // Check if Parent exists
465
+ if( $product->post_parent ) {
466
+ if( !get_post( $product->post_parent ) ) {
467
+ unset( $product_id, $product );
468
+ continue;
469
+ }
470
+ }
471
+ }
472
+ if( isset( $product_id ) )
473
+ $products[] = $product_id;
474
+ }
475
+ unset( $product_ids, $product_id );
476
+ }
477
+ return $products;
478
+
479
+ }
480
+
481
+ function woo_ce_get_product_data( $product_id = 0, $args = array() ) {
482
+
483
+ // Get Product defaults
484
+ $weight_unit = get_option( 'woocommerce_weight_unit' );
485
+ $dimension_unit = get_option( 'woocommerce_dimension_unit' );
486
+ $height_unit = $dimension_unit;
487
+ $width_unit = $dimension_unit;
488
+ $length_unit = $dimension_unit;
489
+
490
+ $product = get_post( $product_id );
491
+ $_product = ( function_exists( 'wc_get_product' ) ? wc_get_product( $product_id ) : false );
492
+
493
+ $product->parent_id = '';
494
+ $product->parent_sku = '';
495
+ if( $product->post_type == 'product_variation' ) {
496
+ // Assign Parent ID for Variants then check if Parent exists
497
+ if( $product->parent_id = $product->post_parent )
498
+ $product->parent_sku = get_post_meta( $product->post_parent, '_sku', true );
499
+ else
500
+ $product->parent_id = '';
501
+ }
502
+ $product->product_id = $product_id;
503
+ $product->sku = get_post_meta( $product_id, '_sku', true );
504
+ $product->name = get_the_title( $product_id );
505
+ $product->permalink = get_permalink( $product_id );
506
+ $product->product_url = ( method_exists( $_product, 'get_permalink' ) ? $_product->get_permalink() : get_permalink( $product_id ) );
507
+ $product->slug = $product->post_name;
508
+ $product->description = $product->post_content;
509
+ $product->excerpt = $product->post_excerpt;
510
+ $product->regular_price = get_post_meta( $product_id, '_regular_price', true );
511
+ // Check that a valid price has been provided and that wc_format_localized_price() exists
512
+ if( isset( $product->regular_price ) && $product->regular_price != '' && function_exists( 'wc_format_localized_price' ) )
513
+ $product->regular_price = wc_format_localized_price( $product->regular_price );
514
+ $product->price = get_post_meta( $product_id, '_price', true );
515
+ if( $product->regular_price != '' && ( $product->regular_price <> $product->price ) )
516
+ $product->price = $product->regular_price;
517
+ // Check that a valid price has been provided and that wc_format_localized_price() exists
518
+ if( isset( $product->price ) && $product->price != '' && function_exists( 'wc_format_localized_price' ) )
519
+ $product->price = wc_format_localized_price( $product->price );
520
+ $product->sale_price = get_post_meta( $product_id, '_sale_price', true );
521
+ // Check that a valid price has been provided and that wc_format_localized_price() exists
522
+ if( isset( $product->sale_price ) && $product->sale_price != '' && function_exists( 'wc_format_localized_price' ) )
523
+ $product->sale_price = wc_format_localized_price( $product->sale_price );
524
+ $product->sale_price_dates_from = woo_ce_format_sale_price_dates( get_post_meta( $product_id, '_sale_price_dates_from', true ) );
525
+ $product->sale_price_dates_to = woo_ce_format_sale_price_dates( get_post_meta( $product_id, '_sale_price_dates_to', true ) );
526
+ $product->post_date = woo_ce_format_date( $product->post_date );
527
+ $product->post_modified = woo_ce_format_date( $product->post_modified );
528
+ $product->type = woo_ce_get_product_assoc_type( $product_id );
529
+ if( $product->post_type == 'product_variation' )
530
+ $product->type = __( 'Variation', 'woocommerce-exporter' );
531
+ $product->visibility = woo_ce_format_visibility( get_post_meta( $product_id, '_visibility', true ) );
532
+ $product->featured = woo_ce_format_switch( get_post_meta( $product_id, '_featured', true ) );
533
+ $product->virtual = woo_ce_format_switch( get_post_meta( $product_id, '_virtual', true ) );
534
+ $product->downloadable = woo_ce_format_switch( get_post_meta( $product_id, '_downloadable', true ) );
535
+ $product->weight = get_post_meta( $product_id, '_weight', true );
536
+ $product->weight_unit = ( $product->weight != '' ? $weight_unit : '' );
537
+ $product->height = get_post_meta( $product_id, '_height', true );
538
+ $product->height_unit = ( $product->height != '' ? $height_unit : '' );
539
+ $product->width = get_post_meta( $product_id, '_width', true );
540
+ $product->width_unit = ( $product->width != '' ? $width_unit : '' );
541
+ $product->length = get_post_meta( $product_id, '_length', true );
542
+ $product->length_unit = ( $product->length != '' ? $length_unit : '' );
543
+ $product->category = woo_ce_get_product_assoc_categories( $product_id, $product->parent_id );
544
+ $product->tag = woo_ce_get_product_assoc_tags( $product_id );
545
+ $product->manage_stock = woo_ce_format_switch( get_post_meta( $product_id, '_manage_stock', true ) );
546
+ $product->allow_backorders = woo_ce_format_switch( get_post_meta( $product_id, '_backorders', true ) );
547
+ $product->sold_individually = woo_ce_format_switch( get_post_meta( $product_id, '_sold_individually', true ) );
548
+ $product->upsell_ids = woo_ce_get_product_assoc_upsell_ids( $product_id );
549
+ $product->crosssell_ids = woo_ce_get_product_assoc_crosssell_ids( $product_id );
550
+ $product->quantity = get_post_meta( $product_id, '_stock', true );
551
+ $product->stock_status = woo_ce_format_stock_status( get_post_meta( $product_id, '_stock_status', true ), $product->quantity );
552
+ $product->image = woo_ce_get_product_assoc_featured_image( $product_id );
553
+ $product->product_gallery = woo_ce_get_product_assoc_product_gallery( $product_id );
554
+ $product->tax_status = woo_ce_format_tax_status( get_post_meta( $product_id, '_tax_status', true ) );
555
+ $product->tax_class = woo_ce_format_tax_class( get_post_meta( $product_id, '_tax_class', true ) );
556
+ $product->external_url = get_post_meta( $product_id, '_product_url', true );
557
+ $product->button_text = get_post_meta( $product_id, '_button_text', true );
558
+ $product->file_download = woo_ce_get_product_assoc_file_downloads( $product_id );
559
+ $product->download_limit = get_post_meta( $product_id, '_download_limit', true );
560
+ $product->download_expiry = get_post_meta( $product_id, '_download_expiry', true );
561
+ $product->download_type = woo_ce_format_download_type( get_post_meta( $product_id, '_download_type', true ) );
562
+ $product->purchase_note = get_post_meta( $product_id, '_purchase_note', true );
563
+ $product->product_status = woo_ce_format_product_status( $product->post_status );
564
+ $product->enable_reviews = woo_ce_format_comment_status( $product->comment_status );
565
+ $product->menu_order = $product->menu_order;
566
+
567
+ // Attributes
568
+ // Scan for global Attributes first
569
+ if( $attributes = woo_ce_get_product_attributes() ) {
570
+ if( $product->post_type == 'product_variation' ) {
571
+ // We're dealing with a single Variation, strap yourself in.
572
+ foreach( $attributes as $attribute ) {
573
+ $attribute_value = get_post_meta( $product_id, sprintf( 'attribute_pa_%s', $attribute->attribute_name ), true );
574
+ if( !empty( $attribute_value ) ) {
575
+ $term_id = term_exists( $attribute_value, sprintf( 'pa_%s', $attribute->attribute_name ) );
576
+ if( $term_id !== 0 && $term_id !== null && !is_wp_error( $term_id ) ) {
577
+ $term = get_term( $term_id['term_id'], sprintf( 'pa_%s', $attribute->attribute_name ) );
578
+ $attribute_value = $term->name;
579
+ unset( $term );
580
+ }
581
+ unset( $term_id );
582
+ }
583
+ $product->{'attribute_' . $attribute->attribute_name} = $attribute_value;
584
+ unset( $attribute_value );
585
+ }
586
+ } else {
587
+ // Either the Variation Parent or a Simple Product, scan for global and custom Attributes
588
+ $product->attributes = maybe_unserialize( get_post_meta( $product_id, '_product_attributes', true ) );
589
+ if( !empty( $product->attributes ) ) {
590
+ // Check for taxonomy-based attributes
591
+ foreach( $attributes as $attribute ) {
592
+ if( isset( $product->attributes['pa_' . $attribute->attribute_name] ) )
593
+ $product->{'attribute_' . $attribute->attribute_name} = woo_ce_get_product_assoc_attributes( $product_id, $product->attributes['pa_' . $attribute->attribute_name], 'product' );
594
+ else
595
+ $product->{'attribute_' . $attribute->attribute_name} = woo_ce_get_product_assoc_attributes( $product_id, $attribute, 'global' );
596
+ }
597
+ // Check for per-Product attributes (custom)
598
+ foreach( $product->attributes as $key => $attribute ) {
599
+ if( $attribute['is_taxonomy'] == 0 ) {
600
+ if( !isset( $product->{'attribute_' . $key} ) )
601
+ $product->{'attribute_' . $key} = $attribute['value'];
602
+ }
603
+ }
604
+ }
605
+ }
606
+ }
607
+
608
+ // Advanced Google Product Feed - http://plugins.leewillis.co.uk/downloads/wp-e-commerce-product-feeds/
609
+ if( function_exists( 'woocommerce_gpf_install' ) ) {
610
+ $product->gpf_data = get_post_meta( $product_id, '_woocommerce_gpf_data', true );
611
+ $product->gpf_availability = ( isset( $product->gpf_data['availability'] ) ? woo_ce_format_gpf_availability( $product->gpf_data['availability'] ) : '' );
612
+ $product->gpf_condition = ( isset( $product->gpf_data['condition'] ) ? woo_ce_format_gpf_condition( $product->gpf_data['condition'] ) : '' );
613
+ $product->gpf_brand = ( isset( $product->gpf_data['brand'] ) ? $product->gpf_data['brand'] : '' );
614
+ $product->gpf_product_type = ( isset( $product->gpf_data['product_type'] ) ? $product->gpf_data['product_type'] : '' );
615
+ $product->gpf_google_product_category = ( isset( $product->gpf_data['google_product_category'] ) ? $product->gpf_data['google_product_category'] : '' );
616
+ $product->gpf_gtin = ( isset( $product->gpf_data['gtin'] ) ? $product->gpf_data['gtin'] : '' );
617
+ $product->gpf_mpn = ( isset( $product->gpf_data['mpn'] ) ? $product->gpf_data['mpn'] : '' );
618
+ $product->gpf_gender = ( isset( $product->gpf_data['gender'] ) ? $product->gpf_data['gender'] : '' );
619
+ $product->gpf_age_group = ( isset( $product->gpf_data['age_group'] ) ? $product->gpf_data['age_group'] : '' );
620
+ $product->gpf_color = ( isset( $product->gpf_data['color'] ) ? $product->gpf_data['color'] : '' );
621
+ $product->gpf_size = ( isset( $product->gpf_data['size'] ) ? $product->gpf_data['size'] : '' );
622
+ }
623
+
624
+ // All in One SEO Pack - http://wordpress.org/extend/plugins/all-in-one-seo-pack/
625
+ if( function_exists( 'aioseop_activate' ) ) {
626
+ $product->aioseop_keywords = get_post_meta( $product_id, '_aioseop_keywords', true );
627
+ $product->aioseop_description = get_post_meta( $product_id, '_aioseop_description', true );
628
+ $product->aioseop_title = get_post_meta( $product_id, '_aioseop_title', true );
629
+ $product->aioseop_titleatr = get_post_meta( $product_id, '_aioseop_titleatr', true );
630
+ $product->aioseop_menulabel = get_post_meta( $product_id, '_aioseop_menulabel', true );
631
+ }
632
+
633
+ // WordPress SEO - http://wordpress.org/plugins/wordpress-seo/
634
+ if( function_exists( 'wpseo_admin_init' ) ) {
635
+ $product->wpseo_focuskw = get_post_meta( $product_id, '_yoast_wpseo_focuskw', true );
636
+ $product->wpseo_metadesc = get_post_meta( $product_id, '_yoast_wpseo_metadesc', true );
637
+ $product->wpseo_title = get_post_meta( $product_id, '_yoast_wpseo_title', true );
638
+ $product->wpseo_googleplus_description = get_post_meta( $product_id, '_yoast_wpseo_google-plus-description', true );
639
+ $product->wpseo_opengraph_description = get_post_meta( $product_id, '_yoast_wpseo_opengraph-description', true );
640
+ }
641
+
642
+ // Ultimate SEO - http://wordpress.org/plugins/seo-ultimate/
643
+ if( function_exists( 'su_wp_incompat_notice' ) ) {
644
+ $product->useo_meta_title = get_post_meta( $product_id, '_su_title', true );
645
+ $product->useo_meta_description = get_post_meta( $product_id, '_su_description', true );
646
+ $product->useo_meta_keywords = get_post_meta( $product_id, '_su_keywords', true );
647
+ $product->useo_social_title = get_post_meta( $product_id, '_su_og_title', true );
648
+ $product->useo_social_description = get_post_meta( $product_id, '_su_og_description', true );
649
+ $product->useo_meta_noindex = get_post_meta( $product_id, '_su_meta_robots_noindex', true );
650
+ $product->useo_meta_noautolinks = get_post_meta( $product_id, '_su_disable_autolinks', true );
651
+ }
652
+
653
+ // WooCommerce MSRP Pricing - http://woothemes.com/woocommerce/
654
+ if( function_exists( 'woocommerce_msrp_activate' ) ) {
655
+ $product->msrp = get_post_meta( $product_id, '_msrp_price', true );
656
+ if( $product->msrp == false && $product->post_type == 'product_variation' )
657
+ $product->msrp = get_post_meta( $product_id, '_msrp', true );
658
+ // Check that a valid price has been provided and that wc_format_localized_price() exists
659
+ if( isset( $product->msrp ) && $product->msrp != '' && function_exists( 'wc_format_localized_price' ) )
660
+ $product->msrp = wc_format_localized_price( $product->msrp );
661
+ }
662
+
663
+ // Allow Plugin/Theme authors to add support for additional Product columns
664
+ $product = apply_filters( 'woo_ce_product_item', $product, $product_id );
665
+
666
+ return $product;
667
+
668
+ }
669
+
670
+ // Returns Product Categories associated to a specific Product
671
+ function woo_ce_get_product_assoc_categories( $product_id = 0, $parent_id = 0 ) {
672
+
673
+ global $export;
674
+
675
+ $output = '';
676
+ $term_taxonomy = 'product_cat';
677
+ // Return Product Categories of Parent if this is a Variation
678
+ if( $parent_id )
679
+ $product_id = $parent_id;
680
+ if( $product_id )
681
+ $categories = wp_get_object_terms( $product_id, $term_taxonomy );
682
+ if( !empty( $categories ) && !is_wp_error( $categories ) ) {
683
+ $size = count( $categories );
684
+ for( $i = 0; $i < $size; $i++ ) {
685
+ if( $categories[$i]->parent == '0' ) {
686
+ $output .= $categories[$i]->name . $export->category_separator;
687
+ } else {
688
+ // Check if Parent -> Child
689
+ $parent_category = get_term( $categories[$i]->parent, $term_taxonomy );
690
+ // Check if Parent -> Child -> Subchild
691
+ if( $parent_category->parent == '0' ) {
692
+ $output .= $parent_category->name . '>' . $categories[$i]->name . $export->category_separator;
693
+ $output = str_replace( $parent_category->name . $export->category_separator, '', $output );
694
+ } else {
695
+ $root_category = get_term( $parent_category->parent, $term_taxonomy );
696
+ $output .= $root_category->name . '>' . $parent_category->name . '>' . $categories[$i]->name . $export->category_separator;
697
+ $output = str_replace( array(
698
+ $root_category->name . '>' . $parent_category->name . $export->category_separator,
699
+ $parent_category->name . $export->category_separator
700
+ ), '', $output );
701
+ }
702
+ unset( $root_category, $parent_category );
703
+ }
704
+ }
705
+ $output = substr( $output, 0, -1 );
706
+ } else {
707
+ $output .= __( 'Uncategorized', 'woocommerce-exporter' );
708
+ }
709
+ return $output;
710
+
711
+ }
712
+
713
+ // Returns Product Tags associated to a specific Product
714
+ function woo_ce_get_product_assoc_tags( $product_id = 0 ) {
715
+
716
+ global $export;
717
+
718
+ $output = '';
719
+ $term_taxonomy = 'product_tag';
720
+ $tags = wp_get_object_terms( $product_id, $term_taxonomy );
721
+ if( !empty( $tags ) && is_wp_error( $tags ) == false ) {
722
+ $size = count( $tags );
723
+ for( $i = 0; $i < $size; $i++ ) {
724
+ if( $tag = get_term( $tags[$i]->term_id, $term_taxonomy ) )
725
+ $output .= $tag->name . $export->category_separator;
726
+ }
727
+ $output = substr( $output, 0, -1 );
728
+ }
729
+ return $output;
730
+
731
+ }
732
+
733
+ // Returns the Featured Image associated to a specific Product
734
+ function woo_ce_get_product_assoc_featured_image( $product_id = 0 ) {
735
+
736
+ $output = '';
737
+ if( $product_id ) {
738
+ if( $thumbnail_id = get_post_meta( $product_id, '_thumbnail_id', true ) )
739
+ $output = wp_get_attachment_url( $thumbnail_id );
740
+ }
741
+ return $output;
742
+
743
+ }
744
+
745
+ // Returns the Product Galleries associated to a specific Product
746
+ function woo_ce_get_product_assoc_product_gallery( $product_id = 0, $size = 'full' ) {
747
+
748
+ global $export;
749
+
750
+ if( !empty( $product_id ) ) {
751
+ $images = get_post_meta( $product_id, '_product_image_gallery', true );
752
+ if( !empty( $images ) ) {
753
+ $images = explode( ',', $images );
754
+ $size = count( $images );
755
+ for( $i = 0; $i < $size; $i++ ) {
756
+ // Post ID
757
+ if( $export->gallery_formatting == 0 ) {
758
+ continue;
759
+ // Media URL
760
+ } else {
761
+ if( $size == 'full' )
762
+ $images[$i] = wp_get_attachment_url( $images[$i] );
763
+ else if( $size == 'thumbnail' )
764
+ $images[$i] = wp_get_attachment_thumb_url( $images[$i] );
765
+ }
766
+ }
767
+ $output = implode( $export->category_separator, $images );
768
+ return $output;
769
+ }
770
+ }
771
+
772
+ }
773
+
774
+ // Returns the Product Type of a specific Product
775
+ function woo_ce_get_product_assoc_type( $product_id = 0 ) {
776
+
777
+ global $export;
778
+
779
+ $output = '';
780
+ $term_taxonomy = 'product_type';
781
+ $types = wp_get_object_terms( $product_id, $term_taxonomy );
782
+ if( empty( $types ) )
783
+ $types = array( get_term_by( 'name', 'simple', $term_taxonomy ) );
784
+ if( $types ) {
785
+ $size = count( $types );
786
+ for( $i = 0; $i < $size; $i++ ) {
787
+ $type = get_term( $types[$i]->term_id, $term_taxonomy );
788
+ $output .= woo_ce_format_product_type( $type->name ) . $export->category_separator;
789
+ }
790
+ $output = substr( $output, 0, -1 );
791
+ }
792
+ return $output;
793
+
794
+ }
795
+
796
+ // Returns the Up-Sell associated to a specific Product
797
+ function woo_ce_get_product_assoc_upsell_ids( $product_id = 0 ) {
798
+
799
+ global $export;
800
+
801
+ $output = '';
802
+ if( $product_id ) {
803
+ $upsell_ids = get_post_meta( $product_id, '_upsell_ids', true );
804
+ // Convert Product ID to Product SKU as per Up-Sells Formatting
805
+ if( $export->upsell_formatting == 1 && !empty( $upsell_ids ) ) {
806
+ $size = count( $upsell_ids );
807
+ for( $i = 0; $i < $size; $i++ ) {
808
+ $upsell_ids[$i] = get_post_meta( $upsell_ids[$i], '_sku', true );
809
+ if( empty( $upsell_ids[$i] ) )
810
+ unset( $upsell_ids[$i] );
811
+ }
812
+ // 'reindex' array
813
+ $upsell_ids = array_values( $upsell_ids );
814
+ }
815
+ $output = woo_ce_convert_product_ids( $upsell_ids );
816
+ }
817
+ return $output;
818
+
819
+ }
820
+
821
+ // Returns the Cross-Sell associated to a specific Product
822
+ function woo_ce_get_product_assoc_crosssell_ids( $product_id = 0 ) {
823
+
824
+ global $export;
825
+
826
+ $output = '';
827
+ if( $product_id ) {
828
+ $crosssell_ids = get_post_meta( $product_id, '_crosssell_ids', true );
829
+ // Convert Product ID to Product SKU as per Cross-Sells Formatting
830
+ if( $export->crosssell_formatting == 1 && !empty( $crosssell_ids ) ) {
831
+ $size = count( $crosssell_ids );
832
+ for( $i = 0; $i < $size; $i++ ) {
833
+ $crosssell_ids[$i] = get_post_meta( $crosssell_ids[$i], '_sku', true );
834
+ // Remove Cross-Sell if SKU is empty
835
+ if( empty( $crosssell_ids[$i] ) )
836
+ unset( $crosssell_ids[$i] );
837
+ }
838
+ // 'reindex' array
839
+ $crosssell_ids = array_values( $crosssell_ids );
840
+ }
841
+ $output = woo_ce_convert_product_ids( $crosssell_ids );
842
+ }
843
+ return $output;
844
+
845
+ }
846
+
847
+ // Returns Product Attributes associated to a specific Product
848
+ function woo_ce_get_product_assoc_attributes( $product_id = 0, $attribute = array(), $type = 'product' ) {
849
+
850
+ global $export;
851
+
852
+ $output = '';
853
+ if( $product_id ) {
854
+ $terms = array();
855
+ if( $type == 'product' ) {
856
+ if( $attribute['is_taxonomy'] == 1 )
857
+ $term_taxonomy = $attribute['name'];
858
+ } else if( $type == 'global' ) {
859
+ $term_taxonomy = 'pa_' . $attribute->attribute_name;
860
+ }
861
+ $terms = wp_get_object_terms( $product_id, $term_taxonomy );
862
+ if( !empty( $terms ) && is_wp_error( $terms ) == false ) {
863
+ $size = count( $terms );
864
+ for( $i = 0; $i < $size; $i++ )
865
+ $output .= $terms[$i]->name . $export->category_separator;
866
+ unset( $terms );
867
+ }
868
+ $output = substr( $output, 0, -1 );
869
+ }
870
+ return $output;
871
+
872
+ }
873
+
874
+ // Returns File Downloads associated to a specific Product
875
+ function woo_ce_get_product_assoc_file_downloads( $product_id = 0 ) {
876
+
877
+ global $export;
878
+
879
+ $output = '';
880
+ if( $product_id ) {
881
+ if( version_compare( WOOCOMMERCE_VERSION, '2.0', '>=' ) ) {
882
+ // If WooCommerce 2.0+ is installed then use new _downloadable_files Post meta key
883
+ if( $file_downloads = maybe_unserialize( get_post_meta( $product_id, '_downloadable_files', true ) ) ) {
884
+ foreach( $file_downloads as $file_download )
885
+ $output .= $file_download['file'] . $export->category_separator;
886
+ unset( $file_download, $file_downloads );
887
+ }
888
+ $output = substr( $output, 0, -1 );
889
+ } else {
890
+ // If WooCommerce -2.0 is installed then use legacy _file_paths Post meta key
891
+ if( $file_downloads = maybe_unserialize( get_post_meta( $product_id, '_file_paths', true ) ) ) {
892
+ foreach( $file_downloads as $file_download )
893
+ $output .= $file_download . $export->category_separator;
894
+ unset( $file_download, $file_downloads );
895
+ }
896
+ $output = substr( $output, 0, -1 );
897
+ }
898
+ }
899
+ return $output;
900
+
901
+ }
902
+
903
+ // Returns list of Product Addon columns
904
+ function woo_ce_get_product_addons() {
905
+
906
+ // Product Addons - http://www.woothemes.com/
907
+ if( class_exists( 'Product_Addon_Admin' ) || class_exists( 'Product_Addon_Display' ) ) {
908
+ $post_type = 'global_product_addon';
909
+ $args = array(
910
+ 'post_type' => $post_type,
911
+ 'numberposts' => -1
912
+ );
913
+ $output = array();
914
+ if( $product_addons = get_posts( $args ) ) {
915
+ foreach( $product_addons as $product_addon ) {
916
+ if( $meta = maybe_unserialize( get_post_meta( $product_addon->ID, '_product_addons', true ) ) ) {
917
+ $size = count( $meta );
918
+ for( $i = 0; $i < $size; $i++ ) {
919
+ $output[] = (object)array(
920
+ 'post_name' => $meta[$i]['name'],
921
+ 'post_title' => $meta[$i]['name'],
922
+ 'form_title' => $product_addon->post_title
923
+ );
924
+ }
925
+ }
926
+ }
927
+ }
928
+ }
929
+
930
+ // Custom Order Items
931
+ if( $custom_order_items = woo_ce_get_option( 'custom_order_items', '' ) ) {
932
+ foreach( $custom_order_items as $custom_order_item ) {
933
+ $output[] = (object)array(
934
+ 'post_name' => $custom_order_item,
935
+ 'post_title' => $custom_order_item
936
+ );
937
+ }
938
+ }
939
+
940
+ return $output;
941
+
942
+ }
943
+
944
+ // Returns a list of Product export columns
945
+ function woo_ce_get_product_fields( $format = 'full' ) {
946
+
947
+ $export_type = 'product';
948
+
949
+ $fields = array();
950
+ $fields[] = array(
951
+ 'name' => 'parent_id',
952
+ 'label' => __( 'Parent ID', 'woocommerce-exporter' )
953
+ );
954
+ $fields[] = array(
955
+ 'name' => 'parent_sku',
956
+ 'label' => __( 'Parent SKU', 'woocommerce-exporter' )
957
+ );
958
+ $fields[] = array(
959
+ 'name' => 'product_id',
960
+ 'label' => __( 'Product ID', 'woocommerce-exporter' )
961
+ );
962
+ $fields[] = array(
963
+ 'name' => 'sku',
964
+ 'label' => __( 'Product SKU', 'woocommerce-exporter' )
965
+ );
966
+ $fields[] = array(
967
+ 'name' => 'name',
968
+ 'label' => __( 'Product Name', 'woocommerce-exporter' )
969
+ );
970
+ $fields[] = array(
971
+ 'name' => 'slug',
972
+ 'label' => __( 'Slug', 'woocommerce-exporter' )
973
+ );
974
+ $fields[] = array(
975
+ 'name' => 'permalink',
976
+ 'label' => __( 'Permalink', 'woocommerce-exporter' )
977
+ );
978
+ $fields[] = array(
979
+ 'name' => 'product_url',
980
+ 'label' => __( 'Product URL', 'woocommerce-exporter' )
981
+ );
982
+ $fields[] = array(
983
+ 'name' => 'description',
984
+ 'label' => __( 'Description', 'woocommerce-exporter' )
985
+ );
986
+ $fields[] = array(
987
+ 'name' => 'excerpt',
988
+ 'label' => __( 'Excerpt', 'woocommerce-exporter' )
989
+ );
990
+ $fields[] = array(
991
+ 'name' => 'post_date',
992
+ 'label' => __( 'Product Published', 'woocommerce-exporter' )
993
+ );
994
+ $fields[] = array(
995
+ 'name' => 'post_modified',
996
+ 'label' => __( 'Product Modified', 'woocommerce-exporter' )
997
+ );
998
+ $fields[] = array(
999
+ 'name' => 'type',
1000
+ 'label' => __( 'Type', 'woocommerce-exporter' )
1001
+ );
1002
+ $fields[] = array(
1003
+ 'name' => 'visibility',
1004
+ 'label' => __( 'Visibility', 'woocommerce-exporter' )
1005
+ );
1006
+ $fields[] = array(
1007
+ 'name' => 'featured',
1008
+ 'label' => __( 'Featured', 'woocommerce-exporter' )
1009
+ );
1010
+ $fields[] = array(
1011
+ 'name' => 'virtual',
1012
+ 'label' => __( 'Virtual', 'woocommerce-exporter' )
1013
+ );
1014
+ $fields[] = array(
1015
+ 'name' => 'downloadable',
1016
+ 'label' => __( 'Downloadable', 'woocommerce-exporter' )
1017
+ );
1018
+ $fields[] = array(
1019
+ 'name' => 'price',
1020
+ 'label' => __( 'Price', 'woocommerce-exporter' )
1021
+ );
1022
+ $fields[] = array(
1023
+ 'name' => 'sale_price',
1024
+ 'label' => __( 'Sale Price', 'woocommerce-exporter' )
1025
+ );
1026
+ $fields[] = array(
1027
+ 'name' => 'sale_price_dates_from',
1028
+ 'label' => __( 'Sale Price Dates From', 'woocommerce-exporter' )
1029
+ );
1030
+ $fields[] = array(
1031
+ 'name' => 'sale_price_dates_to',
1032
+ 'label' => __( 'Sale Price Dates To', 'woocommerce-exporter' )
1033
+ );
1034
+ $fields[] = array(
1035
+ 'name' => 'weight',
1036
+ 'label' => __( 'Weight', 'woocommerce-exporter' )
1037
+ );
1038
+ $fields[] = array(
1039
+ 'name' => 'weight_unit',
1040
+ 'label' => __( 'Weight Unit', 'woocommerce-exporter' )
1041
+ );
1042
+ $fields[] = array(
1043
+ 'name' => 'height',
1044
+ 'label' => __( 'Height', 'woocommerce-exporter' )
1045
+ );
1046
+ $fields[] = array(
1047
+ 'name' => 'height_unit',
1048
+ 'label' => __( 'Height Unit', 'woocommerce-exporter' )
1049
+ );
1050
+ $fields[] = array(
1051
+ 'name' => 'width',
1052
+ 'label' => __( 'Width', 'woocommerce-exporter' )
1053
+ );
1054
+ $fields[] = array(
1055
+ 'name' => 'width_unit',
1056
+ 'label' => __( 'Width Unit', 'woocommerce-exporter' )
1057
+ );
1058
+ $fields[] = array(
1059
+ 'name' => 'length',
1060
+ 'label' => __( 'Length', 'woocommerce-exporter' )
1061
+ );
1062
+ $fields[] = array(
1063
+ 'name' => 'length_unit',
1064
+ 'label' => __( 'Length Unit', 'woocommerce-exporter' )
1065
+ );
1066
+ $fields[] = array(
1067
+ 'name' => 'category',
1068
+ 'label' => __( 'Category', 'woocommerce-exporter' )
1069
+ );
1070
+ $fields[] = array(
1071
+ 'name' => 'tag',
1072
+ 'label' => __( 'Tag', 'woocommerce-exporter' )
1073
+ );
1074
+ $fields[] = array(
1075
+ 'name' => 'image',
1076
+ 'label' => __( 'Featured Image', 'woocommerce-exporter' )
1077
+ );
1078
+ $fields[] = array(
1079
+ 'name' => 'image_thumbnail',
1080
+ 'label' => __( 'Featured Image Thumbnail', 'woocommerce-exporter' ),
1081
+ 'disabled' => 1
1082
+ );
1083
+ $fields[] = array(
1084
+ 'name' => 'product_gallery',
1085
+ 'label' => __( 'Product Gallery', 'woocommerce-exporter' )
1086
+ );
1087
+ $fields[] = array(
1088
+ 'name' => 'product_gallery_thumbnail',
1089
+ 'label' => __( 'Product Gallery Thumbnail', 'woocommerce-exporter' ),
1090
+ 'disabled' => 1
1091
+ );
1092
+ $fields[] = array(
1093
+ 'name' => 'tax_status',
1094
+ 'label' => __( 'Tax Status', 'woocommerce-exporter' )
1095
+ );
1096
+ $fields[] = array(
1097
+ 'name' => 'tax_class',
1098
+ 'label' => __( 'Tax Class', 'woocommerce-exporter' )
1099
+ );
1100
+ $fields[] = array(
1101
+ 'name' => 'shipping_class',
1102
+ 'label' => __( 'Shipping Class', 'woocommerce-exporter' )
1103
+ );
1104
+ $fields[] = array(
1105
+ 'name' => 'download_file_name',
1106
+ 'label' => __( 'Download File Name', 'woocommerce-exporter' )
1107
+ );
1108
+ $fields[] = array(
1109
+ 'name' => 'download_file_path',
1110
+ 'label' => __( 'Download File URL Path', 'woocommerce-exporter' )
1111
+ );
1112
+ $fields[] = array(
1113
+ 'name' => 'download_limit',
1114
+ 'label' => __( 'Download Limit', 'woocommerce-exporter' )
1115
+ );
1116
+ $fields[] = array(
1117
+ 'name' => 'download_expiry',
1118
+ 'label' => __( 'Download Expiry', 'woocommerce-exporter' )
1119
+ );
1120
+ $fields[] = array(
1121
+ 'name' => 'download_type',
1122
+ 'label' => __( 'Download Type', 'woocommerce-exporter' )
1123
+ );
1124
+ $fields[] = array(
1125
+ 'name' => 'manage_stock',
1126
+ 'label' => __( 'Manage Stock', 'woocommerce-exporter' )
1127
+ );
1128
+ $fields[] = array(
1129
+ 'name' => 'quantity',
1130
+ 'label' => __( 'Quantity', 'woocommerce-exporter' )
1131
+ );
1132
+ $fields[] = array(
1133
+ 'name' => 'stock_status',
1134
+ 'label' => __( 'Stock Status', 'woocommerce-exporter' )
1135
+ );
1136
+ $fields[] = array(
1137
+ 'name' => 'allow_backorders',
1138
+ 'label' => __( 'Allow Backorders', 'woocommerce-exporter' )
1139
+ );
1140
+ $fields[] = array(
1141
+ 'name' => 'sold_individually',
1142
+ 'label' => __( 'Sold Individually', 'woocommerce-exporter' )
1143
+ );
1144
+ $fields[] = array(
1145
+ 'name' => 'total_sales',
1146
+ 'label' => __( 'Total Sales', 'woocommerce-exporter' ),
1147
+ 'disabled' => 1
1148
+ );
1149
+ $fields[] = array(
1150
+ 'name' => 'upsell_ids',
1151
+ 'label' => __( 'Up-Sells', 'woocommerce-exporter' )
1152
+ );
1153
+ $fields[] = array(
1154
+ 'name' => 'crosssell_ids',
1155
+ 'label' => __( 'Cross-Sells', 'woocommerce-exporter' )
1156
+ );
1157
+ $fields[] = array(
1158
+ 'name' => 'external_url',
1159
+ 'label' => __( 'External URL', 'woocommerce-exporter' )
1160
+ );
1161
+ $fields[] = array(
1162
+ 'name' => 'button_text',
1163
+ 'label' => __( 'Button Text', 'woocommerce-exporter' )
1164
+ );
1165
+ $fields[] = array(
1166
+ 'name' => 'purchase_note',
1167
+ 'label' => __( 'Purchase Note', 'woocommerce-exporter' )
1168
+ );
1169
+ $fields[] = array(
1170
+ 'name' => 'product_status',
1171
+ 'label' => __( 'Product Status', 'woocommerce-exporter' )
1172
+ );
1173
+ $fields[] = array(
1174
+ 'name' => 'enable_reviews',
1175
+ 'label' => __( 'Enable Reviews', 'woocommerce-exporter' )
1176
+ );
1177
+ $fields[] = array(
1178
+ 'name' => 'menu_order',
1179
+ 'label' => __( 'Sort Order', 'woocommerce-exporter' )
1180
+ );
1181
+
1182
+ /*
1183
+ $fields[] = array(
1184
+ 'name' => '',
1185
+ 'label' => __( '', 'woocommerce-exporter' )
1186
+ );
1187
+ */
1188
+
1189
+ // Allow Plugin/Theme authors to add support for additional columns
1190
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
1191
+
1192
+ if( $remember = woo_ce_get_option( $export_type . '_fields', array() ) ) {
1193
+ $remember = maybe_unserialize( $remember );
1194
+ $size = count( $fields );
1195
+ for( $i = 0; $i < $size; $i++ ) {
1196
+ $fields[$i]['disabled'] = ( isset( $fields[$i]['disabled'] ) ? $fields[$i]['disabled'] : 0 );
1197
+ $fields[$i]['default'] = 1;
1198
+ if( !array_key_exists( $fields[$i]['name'], $remember ) )
1199
+ $fields[$i]['default'] = 0;
1200
+ }
1201
+ }
1202
+
1203
+ switch( $format ) {
1204
+
1205
+ case 'summary':
1206
+ $output = array();
1207
+ $size = count( $fields );
1208
+ for( $i = 0; $i < $size; $i++ ) {
1209
+ if( isset( $fields[$i] ) )
1210
+ $output[$fields[$i]['name']] = 'on';
1211
+ }
1212
+ return $output;
1213
+ break;
1214
+
1215
+ case 'full':
1216
+ default:
1217
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
1218
+ $size = count( $fields );
1219
+ for( $i = 0; $i < $size; $i++ ) {
1220
+ $fields[$i]['reset'] = $i;
1221
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
1222
+ }
1223
+ // Check if we are using PHP 5.3 and above
1224
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
1225
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
1226
+ return $fields;
1227
+ break;
1228
+
1229
+ }
1230
+
1231
+ }
1232
+
1233
+ function woo_ce_override_product_field_labels( $fields = array() ) {
1234
+
1235
+ $labels = woo_ce_get_option( 'product_labels', array() );
1236
+ if( !empty( $labels ) ) {
1237
+ foreach( $fields as $key => $field ) {
1238
+ if( isset( $labels[$field['name']] ) )
1239
+ $fields[$key]['label'] = $labels[$field['name']];
1240
+ }
1241
+ }
1242
+ return $fields;
1243
+
1244
+ }
1245
+ add_filter( 'woo_ce_product_fields', 'woo_ce_override_product_field_labels', 11 );
1246
+
1247
+ function woo_ce_extend_product_fields( $fields ) {
1248
+
1249
+ // Attributes
1250
+
1251
+ // Attributes
1252
+ /*
1253
+ if( $attributes = woo_ce_get_product_attributes() ) {
1254
+ foreach( $attributes as $attribute ) {
1255
+ if( empty( $attribute->attribute_label ) )
1256
+ $attribute->attribute_label = $attribute->attribute_name;
1257
+ $fields[] = array(
1258
+ 'name' => sprintf( 'attribute_%s', $attribute->attribute_name ),
1259
+ 'label' => sprintf( __( 'Attribute: %s', 'woocommerce-exporter' ), $attribute->attribute_label )
1260
+ );
1261
+ }
1262
+ }
1263
+ */
1264
+
1265
+ // Advanced Google Product Feed - http://www.leewillis.co.uk/wordpress-plugins/
1266
+ if( function_exists( 'woocommerce_gpf_install' ) ) {
1267
+ $fields[] = array(
1268
+ 'name' => 'gpf_availability',
1269
+ 'label' => __( 'Advanced Google Product Feed - Availability', 'woocommerce-exporter' )
1270
+ );
1271
+ $fields[] = array(
1272
+ 'name' => 'gpf_condition',
1273
+ 'label' => __( 'Advanced Google Product Feed - Condition', 'woocommerce-exporter' )
1274
+ );
1275
+ $fields[] = array(
1276
+ 'name' => 'gpf_brand',
1277
+ 'label' => __( 'Advanced Google Product Feed - Brand', 'woocommerce-exporter' )
1278
+ );
1279
+ $fields[] = array(
1280
+ 'name' => 'gpf_product_type',
1281
+ 'label' => __( 'Advanced Google Product Feed - Product Type', 'woocommerce-exporter' )
1282
+ );
1283
+ $fields[] = array(
1284
+ 'name' => 'gpf_google_product_category',
1285
+ 'label' => __( 'Advanced Google Product Feed - Google Product Category', 'woocommerce-exporter' )
1286
+ );
1287
+ $fields[] = array(
1288
+ 'name' => 'gpf_gtin',
1289
+ 'label' => __( 'Advanced Google Product Feed - Global Trade Item Number (GTIN)', 'woocommerce-exporter' )
1290
+ );
1291
+ $fields[] = array(
1292
+ 'name' => 'gpf_mpn',
1293
+ 'label' => __( 'Advanced Google Product Feed - Manufacturer Part Number (MPN)', 'woocommerce-exporter' )
1294
+ );
1295
+ $fields[] = array(
1296
+ 'name' => 'gpf_gender',
1297
+ 'label' => __( 'Advanced Google Product Feed - Gender', 'woocommerce-exporter' )
1298
+ );
1299
+ $fields[] = array(
1300
+ 'name' => 'gpf_agegroup',
1301
+ 'label' => __( 'Advanced Google Product Feed - Age Group', 'woocommerce-exporter' )
1302
+ );
1303
+ $fields[] = array(
1304
+ 'name' => 'gpf_colour',
1305
+ 'label' => __( 'Advanced Google Product Feed - Colour', 'woocommerce-exporter' )
1306
+ );
1307
+ $fields[] = array(
1308
+ 'name' => 'gpf_size',
1309
+ 'label' => __( 'Advanced Google Product Feed - Size', 'woocommerce-exporter' )
1310
+ );
1311
+ }
1312
+
1313
+ // All in One SEO Pack - http://wordpress.org/extend/plugins/all-in-one-seo-pack/
1314
+ if( function_exists( 'aioseop_activate' ) ) {
1315
+ $fields[] = array(
1316
+ 'name' => 'aioseop_keywords',
1317
+ 'label' => __( 'All in One SEO - Keywords', 'woocommerce-exporter' )
1318
+ );
1319
+ $fields[] = array(
1320
+ 'name' => 'aioseop_description',
1321
+ 'label' => __( 'All in One SEO - Description', 'woocommerce-exporter' )
1322
+ );
1323
+ $fields[] = array(
1324
+ 'name' => 'aioseop_title',
1325
+ 'label' => __( 'All in One SEO - Title', 'woocommerce-exporter' )
1326
+ );
1327
+ $fields[] = array(
1328
+ 'name' => 'aioseop_title_attributes',
1329
+ 'label' => __( 'All in One SEO - Title Attributes', 'woocommerce-exporter' )
1330
+ );
1331
+ $fields[] = array(
1332
+ 'name' => 'aioseop_menu_label',
1333
+ 'label' => __( 'All in One SEO - Menu Label', 'woocommerce-exporter' )
1334
+ );
1335
+ }
1336
+
1337
+ // WordPress SEO - http://wordpress.org/plugins/wordpress-seo/
1338
+ if( function_exists( 'wpseo_admin_init' ) ) {
1339
+ $fields[] = array(
1340
+ 'name' => 'wpseo_focuskw',
1341
+ 'label' => __( 'WordPress SEO - Focus Keyword', 'woocommerce-exporter' )
1342
+ );
1343
+ $fields[] = array(
1344
+ 'name' => 'wpseo_metadesc',
1345
+ 'label' => __( 'WordPress SEO - Meta Description', 'woocommerce-exporter' )
1346
+ );
1347
+ $fields[] = array(
1348
+ 'name' => 'wpseo_title',
1349
+ 'label' => __( 'WordPress SEO - SEO Title', 'woocommerce-exporter' )
1350
+ );
1351
+ $fields[] = array(
1352
+ 'name' => 'wpseo_googleplus_description',
1353
+ 'label' => __( 'WordPress SEO - Google+ Description', 'woocommerce-exporter' )
1354
+ );
1355
+ $fields[] = array(
1356
+ 'name' => 'wpseo_opengraph_description',
1357
+ 'label' => __( 'WordPress SEO - Facebook Description', 'woocommerce-exporter' )
1358
+ );
1359
+ }
1360
+
1361
+ // Ultimate SEO - http://wordpress.org/plugins/seo-ultimate/
1362
+ if( function_exists( 'su_wp_incompat_notice' ) ) {
1363
+ $fields[] = array(
1364
+ 'name' => 'useo_meta_title',
1365
+ 'label' => __( 'Ultimate SEO - Title Tag', 'woocommerce-exporter' ),
1366
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
1367
+ );
1368
+ $fields[] = array(
1369
+ 'name' => 'useo_meta_description',
1370
+ 'label' => __( 'Ultimate SEO - Meta Description', 'woocommerce-exporter' ),
1371
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
1372
+ );
1373
+ $fields[] = array(
1374
+ 'name' => 'useo_meta_keywords',
1375
+ 'label' => __( 'Ultimate SEO - Meta Keywords', 'woocommerce-exporter' ),
1376
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
1377
+ );
1378
+ $fields[] = array(
1379
+ 'name' => 'useo_social_title',
1380
+ 'label' => __( 'Ultimate SEO - Social Title', 'woocommerce-exporter' ),
1381
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
1382
+ );
1383
+ $fields[] = array(
1384
+ 'name' => 'useo_social_description',
1385
+ 'label' => __( 'Ultimate SEO - Social Description', 'woocommerce-exporter' ),
1386
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
1387
+ );
1388
+ $fields[] = array(
1389
+ 'name' => 'useo_meta_noindex',
1390
+ 'label' => __( 'Ultimate SEO - NoIndex', 'woocommerce-exporter' ),
1391
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
1392
+ );
1393
+ $fields[] = array(
1394
+ 'name' => 'useo_meta_noautolinks',
1395
+ 'label' => __( 'Ultimate SEO - Disable Autolinks', 'woocommerce-exporter' ),
1396
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
1397
+ );
1398
+ }
1399
+
1400
+ // WooCommerce MSRP Pricing - http://woothemes.com/woocommerce/
1401
+ if( function_exists( 'woocommerce_msrp_activate' ) ) {
1402
+ $fields[] = array(
1403
+ 'name' => 'msrp',
1404
+ 'label' => __( 'MSRP', 'woocommerce-exporter' ),
1405
+ 'hover' => __( 'Manufacturer Suggested Retail Price (MSRP)', 'woocommerce-exporter' ),
1406
+ 'disabled' => 1
1407
+ );
1408
+ }
1409
+
1410
+ // WooCommerce Brands Addon - http://woothemes.com/woocommerce/
1411
+ // WooCommerce Brands - http://proword.net/Woocommerce_Brands/
1412
+ if( class_exists( 'WC_Brands' ) || class_exists( 'woo_brands' ) ) {
1413
+ $fields[] = array(
1414
+ 'name' => 'brands',
1415
+ 'label' => __( 'Brands', 'woocommerce-exporter' ),
1416
+ 'disabled' => 1
1417
+ );
1418
+ }
1419
+
1420
+ // Cost of Goods - http://www.skyverge.com/product/woocommerce-cost-of-goods-tracking/
1421
+ if( class_exists( 'WC_COG' ) ) {
1422
+ $fields[] = array(
1423
+ 'name' => 'cost_of_goods',
1424
+ 'label' => __( 'Cost of Goods', 'woocommerce-exporter' ),
1425
+ 'disabled' => 1
1426
+ );
1427
+ }
1428
+
1429
+ // Per-Product Shipping - http://www.woothemes.com/products/per-product-shipping/
1430
+ if( function_exists( 'woocommerce_per_product_shipping_init' ) ) {
1431
+ $fields[] = array(
1432
+ 'name' => 'per_product_shipping',
1433
+ 'label' => __( 'Per-Product Shipping', 'woocommerce-exporter' ),
1434
+ 'disabled' => 1
1435
+ );
1436
+ }
1437
+
1438
+ // Product Vendors - http://www.woothemes.com/products/product-vendors/
1439
+ if( class_exists( 'WooCommerce_Product_Vendors' ) ) {
1440
+ $fields[] = array(
1441
+ 'name' => 'vendors',
1442
+ 'label' => __( 'Product Vendors', 'woocommerce-exporter' ),
1443
+ 'disabled' => 1
1444
+ );
1445
+ $fields[] = array(
1446
+ 'name' => 'vendor_ids',
1447
+ 'label' => __( 'Product Vendor ID\'s', 'woocommerce-exporter' ),
1448
+ 'disabled' => 1
1449
+ );
1450
+ $fields[] = array(
1451
+ 'name' => 'vendor_commission',
1452
+ 'label' => __( 'Vendor Commission', 'woocommerce-exporter' ),
1453
+ 'disabled' => 1
1454
+ );
1455
+ }
1456
+
1457
+ // Advanced Custom Fields - http://www.advancedcustomfields.com
1458
+ if( class_exists( 'acf' ) ) {
1459
+ if( $custom_fields = woo_ce_get_acf_product_fields() ) {
1460
+ foreach( $custom_fields as $custom_field ) {
1461
+ $fields[] = array(
1462
+ 'name' => $custom_field['name'],
1463
+ 'label' => $custom_field['label'],
1464
+ 'disabled' => 1
1465
+ );
1466
+ }
1467
+ unset( $custom_fields, $custom_field );
1468
+ }
1469
+ }
1470
+
1471
+ // WooCommerce Subscriptions -
1472
+ if( class_exists( 'WC_Subscriptions_Manager' ) ) {
1473
+ $fields[] = array(
1474
+ 'name' => 'subscription_price',
1475
+ 'label' => __( 'Subscription Price', 'woocommerce-exporter' ),
1476
+ 'disabled' => 1
1477
+ );
1478
+ $fields[] = array(
1479
+ 'name' => 'subscription_period_interval',
1480
+ 'label' => __( 'Subscription Period Interval', 'woocommerce-exporter' ),
1481
+ 'disabled' => 1
1482
+ );
1483
+ $fields[] = array(
1484
+ 'name' => 'subscription_period',
1485
+ 'label' => __( 'Subscription Period', 'woocommerce-exporter' ),
1486
+ 'disabled' => 1
1487
+ );
1488
+ $fields[] = array(
1489
+ 'name' => 'subscription_length',
1490
+ 'label' => __( 'Subscription Length', 'woocommerce-exporter' ),
1491
+ 'disabled' => 1
1492
+ );
1493
+ $fields[] = array(
1494
+ 'name' => 'subscription_sign_up_fee',
1495
+ 'label' => __( 'Subscription Sign-up Fee', 'woocommerce-exporter' ),
1496
+ 'disabled' => 1
1497
+ );
1498
+ $fields[] = array(
1499
+ 'name' => 'subscription_trial_length',
1500
+ 'label' => __( 'Subscription Trial Length', 'woocommerce-exporter' ),
1501
+ 'disabled' => 1
1502
+ );
1503
+ $fields[] = array(
1504
+ 'name' => 'subscription_trial_period',
1505
+ 'label' => __( 'Subscription Trial Period', 'woocommerce-exporter' ),
1506
+ 'disabled' => 1
1507
+ );
1508
+ $fields[] = array(
1509
+ 'name' => 'subscription_limit',
1510
+ 'label' => __( 'Limit Subscription', 'woocommerce-exporter' ),
1511
+ 'disabled' => 1
1512
+ );
1513
+ }
1514
+
1515
+ // Custom Product meta
1516
+ $custom_products = woo_ce_get_option( 'custom_products', '' );
1517
+ if( !empty( $custom_products ) ) {
1518
+ foreach( $custom_products as $custom_product ) {
1519
+ if( !empty( $custom_product ) ) {
1520
+ $fields[] = array(
1521
+ 'name' => $custom_product,
1522
+ 'label' => woo_ce_clean_export_label( $custom_product ),
1523
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_product_fields_custom_product_hover', '%s: %s' ), __( 'Custom Product', 'woocommerce-exporter' ), $custom_product )
1524
+ );
1525
+ }
1526
+ }
1527
+ unset( $custom_products, $custom_product );
1528
+ }
1529
+
1530
+ return $fields;
1531
+
1532
+ }
1533
+ add_filter( 'woo_ce_product_fields', 'woo_ce_extend_product_fields' );
1534
+
1535
+ // Returns the export column header label based on an export column slug
1536
+ function woo_ce_get_product_field( $name = null, $format = 'name' ) {
1537
+
1538
+ $output = '';
1539
+ if( $name ) {
1540
+ $fields = woo_ce_get_product_fields();
1541
+ $size = count( $fields );
1542
+ for( $i = 0; $i < $size; $i++ ) {
1543
+ if( $fields[$i]['name'] == $name ) {
1544
+ switch( $format ) {
1545
+
1546
+ case 'name':
1547
+ $output = $fields[$i]['label'];
1548
+ break;
1549
+
1550
+ case 'full':
1551
+ $output = $fields[$i];
1552
+ break;
1553
+
1554
+ }
1555
+ $i = $size;
1556
+ }
1557
+ }
1558
+ }
1559
+ return $output;
1560
+
1561
+ }
1562
+
1563
+ // Returns a list of WooCommerce Product Types to export process
1564
+ function woo_ce_get_product_types() {
1565
+
1566
+ $term_taxonomy = 'product_type';
1567
+ $args = array(
1568
+ 'hide_empty' => 0
1569
+ );
1570
+ $types = get_terms( $term_taxonomy, $args );
1571
+ if( !empty( $types ) && is_wp_error( $types ) == false ) {
1572
+ $output = array();
1573
+ $size = count( $types );
1574
+ for( $i = 0; $i < $size; $i++ ) {
1575
+ $output[$types[$i]->slug] = array(
1576
+ 'name' => ucfirst( $types[$i]->name ),
1577
+ 'count' => $types[$i]->count
1578
+ );
1579
+ // Override the Product Type count for Downloadable and Virtual
1580
+ if( in_array( $types[$i]->slug, array( 'downloadable', 'virtual' ) ) ) {
1581
+ if( $types[$i]->slug == 'downloadable' ) {
1582
+ $args = array(
1583
+ 'meta_key' => '_downloadable',
1584
+ 'meta_value' => 'yes'
1585
+ );
1586
+ } else if( $types[$i]->slug == 'virtual' ) {
1587
+ $args = array(
1588
+ 'meta_key' => '_virtual',
1589
+ 'meta_value' => 'yes'
1590
+ );
1591
+ }
1592
+ $output[$types[$i]->slug]['count'] = woo_ce_get_product_type_count( 'product', $args );
1593
+ }
1594
+ }
1595
+ $output['variation'] = array(
1596
+ 'name' => __( 'variation', 'woocommerce-exporter' ),
1597
+ 'count' => woo_ce_get_product_type_count( 'product_variation' )
1598
+ );
1599
+ asort( $output );
1600
+ return $output;
1601
+ }
1602
+
1603
+ }
1604
+
1605
+ function woo_ce_get_product_type_count( $post_type = 'product', $args = array() ) {
1606
+
1607
+ $defaults = array(
1608
+ 'post_type' => $post_type,
1609
+ 'posts_per_page' => 1,
1610
+ 'fields' => 'ids'
1611
+ );
1612
+ $args = wp_parse_args( $args, $defaults );
1613
+ $product_ids = new WP_Query( $args );
1614
+ $size = $product_ids->found_posts;
1615
+ return $size;
1616
+
1617
+ }
1618
+
1619
+ // Returns a list of WooCommerce Product Attributes to export process
1620
+ function woo_ce_get_product_attributes() {
1621
+
1622
+ global $wpdb;
1623
+
1624
+ $output = array();
1625
+ $attributes_sql = "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies";
1626
+ $attributes = $wpdb->get_results( $attributes_sql );
1627
+ $wpdb->flush();
1628
+ if( !empty( $attributes ) ) {
1629
+ $output = $attributes;
1630
+ unset( $attributes );
1631
+ } else {
1632
+ $output = ( function_exists( 'wc_get_attribute_taxonomies' ) ? wc_get_attribute_taxonomies() : array() );
1633
+ }
1634
+ return $output;
1635
+
1636
+ }
1637
+
1638
+ function woo_ce_get_acf_product_fields() {
1639
+
1640
+ global $wpdb;
1641
+
1642
+ $post_type = 'acf';
1643
+ $args = array(
1644
+ 'post_type' => $post_type,
1645
+ 'numberposts' => -1
1646
+ );
1647
+ if( $field_groups = get_posts( $args ) ) {
1648
+ $fields = array();
1649
+ $post_types = array( 'product', 'product_variation' );
1650
+ foreach( $field_groups as $field_group ) {
1651
+ $has_fields = false;
1652
+ if( $rules = get_post_meta( $field_group->ID, 'rule' ) ) {
1653
+ $size = count( $rules );
1654
+ for( $i = 0; $i < $size; $i++ ) {
1655
+ if( ( $rules[$i]['param'] == 'post_type' ) && ( $rules[$i]['operator'] == '==' ) && ( in_array( $rules[$i]['value'], $post_types ) ) ) {
1656
+ $has_fields = true;
1657
+ $i = $size;
1658
+ }
1659
+ }
1660
+ }
1661
+ unset( $rules );
1662
+ if( $has_fields ) {
1663
+ $custom_fields_sql = "SELECT `meta_value` FROM `" . $wpdb->postmeta . "` WHERE `post_id` = " . absint( $field_group->ID ) . " AND `meta_key` LIKE 'field_%'";
1664
+ if( $custom_fields = $wpdb->get_col( $custom_fields_sql ) ) {
1665
+ foreach( $custom_fields as $custom_field ) {
1666
+ $custom_field = maybe_unserialize( $custom_field );
1667
+ $fields[] = array(
1668
+ 'name' => $custom_field['name'],
1669
+ 'label' => $custom_field['label']
1670
+ );
1671
+ }
1672
+ }
1673
+ unset( $custom_fields, $custom_field );
1674
+ }
1675
+ }
1676
+ return $fields;
1677
+ }
1678
+
1679
+ }
1680
+
1681
+ function woo_ce_extend_product_item( $product, $product_id ) {
1682
+
1683
+ // Custom Product meta
1684
+ $custom_products = woo_ce_get_option( 'custom_products', '' );
1685
+ if( !empty( $custom_products ) ) {
1686
+ foreach( $custom_products as $custom_product ) {
1687
+ // Check that the custom Product name is filled and it hasn't previously been set
1688
+ if( !empty( $custom_product ) && !isset( $product->{$custom_product} ) )
1689
+ $product->{$custom_product} = get_post_meta( $product_id, $custom_product, true );
1690
+ }
1691
+ }
1692
+
1693
+ return $product;
1694
+
1695
+ }
1696
+ add_filter( 'woo_ce_product_item', 'woo_ce_extend_product_item', 10, 2 );
1697
+ ?>
includes/product_vendor.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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' => 'ID',
9
+ 'label' => __( 'Product Vendor ID', 'woocommerce-exporter' )
10
+ );
11
+ $fields[] = array(
12
+ 'name' => 'title',
13
+ 'label' => __( 'Name', 'woocommerce-exporter' )
14
+ );
15
+ $fields[] = array(
16
+ 'name' => 'slug',
17
+ 'label' => __( 'Slug', 'woocommerce-exporter' )
18
+ );
19
+ $fields[] = array(
20
+ 'name' => 'description',
21
+ 'label' => __( 'Description', 'woocommerce-exporter' )
22
+ );
23
+ $fields[] = array(
24
+ 'name' => 'url',
25
+ 'label' => __( 'Product Vendor URL', 'woocommerce-exporter' )
26
+ );
27
+ $fields[] = array(
28
+ 'name' => 'commission',
29
+ 'label' => __( 'Commission', 'woocommerce-exporter' )
30
+ );
31
+ $fields[] = array(
32
+ 'name' => 'paypal_email',
33
+ 'label' => __( 'PayPal E-mail Address', 'woocommerce-exporter' )
34
+ );
35
+ $fields[] = array(
36
+ 'name' => 'user_name',
37
+ 'label' => __( 'Vendor Username', 'woocommerce-exporter' )
38
+ );
39
+ $fields[] = array(
40
+ 'name' => 'user_id',
41
+ 'label' => __( 'Vendor User ID', 'woocommerce-exporter' )
42
+ );
43
+
44
+ /*
45
+ $fields[] = array(
46
+ 'name' => '',
47
+ 'label' => __( '', 'woocommerce-exporter' )
48
+ );
49
+ */
50
+
51
+ // Allow Plugin/Theme authors to add support for additional columns
52
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
53
+
54
+ switch( $format ) {
55
+
56
+ case 'summary':
57
+ $output = array();
58
+ $size = count( $fields );
59
+ for( $i = 0; $i < $size; $i++ ) {
60
+ if( isset( $fields[$i] ) )
61
+ $output[$fields[$i]['name']] = 'on';
62
+ }
63
+ return $output;
64
+ break;
65
+
66
+ case 'full':
67
+ default:
68
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
69
+ $size = count( $fields );
70
+ for( $i = 0; $i < $size; $i++ ) {
71
+ $fields[$i]['reset'] = $i;
72
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
73
+ }
74
+ // Check if we are using PHP 5.3 and above
75
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
76
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
77
+ return $fields;
78
+ break;
79
+
80
+ }
81
+
82
+ }
83
+
84
+ function woo_ce_override_product_vendor_field_labels( $fields = array() ) {
85
+
86
+ $labels = woo_ce_get_option( 'product_vendor_labels', array() );
87
+ if( !empty( $labels ) ) {
88
+ foreach( $fields as $key => $field ) {
89
+ if( isset( $labels[$field['name']] ) )
90
+ $fields[$key]['label'] = $labels[$field['name']];
91
+ }
92
+ }
93
+ return $fields;
94
+
95
+ }
96
+ add_filter( 'woo_ce_product_vendor_fields', 'woo_ce_override_product_vendor_field_labels', 11 );
97
+
98
+ // Returns a list of Product Vendor Term IDs
99
+ function woo_ce_get_product_vendors( $args = array(), $output = 'term_id' ) {
100
+
101
+ global $export;
102
+
103
+ $term_taxonomy = 'shop_vendor';
104
+ $defaults = array(
105
+ 'orderby' => 'name',
106
+ 'order' => 'ASC',
107
+ 'hide_empty' => 0
108
+ );
109
+ $args = wp_parse_args( $args, $defaults );
110
+ $product_vendors = get_terms( $term_taxonomy, $args );
111
+ if( !empty( $product_vendors ) && is_wp_error( $product_vendors ) == false ) {
112
+ if( $output == 'term_id' ) {
113
+ $vendor_ids = array();
114
+ foreach( $product_vendors as $key => $product_vendor )
115
+ $vendor_ids[] = $product_vendor->term_id;
116
+ $export->total_rows = count( $vendor_ids );
117
+ unset( $product_vendors, $product_vendor );
118
+ return $vendor_ids;
119
+ } else if( $output == 'full' ) {
120
+ return $product_vendors;
121
+ }
122
+ }
123
+
124
+ }
125
+ ?>
includes/settings.php ADDED
@@ -0,0 +1,565 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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 = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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_cron() {
40
+
41
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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
+
138
+ <tr id="rss-settings">
139
+ <td colspan="2" style="padding:0;">
140
+ <hr />
141
+ <h3><div class="dashicons dashicons-media-code"></div>&nbsp;<?php _e( 'RSS Settings', 'woocommerce-exporter' ); ?></h3>
142
+ </td>
143
+ </tr>
144
+ <tr>
145
+ <th>
146
+ <label for="rss_title"><?php _e( 'Title element', 'woocommerce-exporter' ); ?></label>
147
+ </th>
148
+ <td>
149
+ <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>
150
+ <p class="description"><?php _e( 'Defines the title of the data feed (e.g. Product export for WordPress Shop).', 'woocommerce-exporter' ); ?></p>
151
+ </td>
152
+ </tr>
153
+ <tr>
154
+ <th>
155
+ <label for="rss_link"><?php _e( 'Link element', 'woocommerce-exporter' ); ?></label>
156
+ </th>
157
+ <td>
158
+ <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>
159
+ <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>
160
+ </td>
161
+ </tr>
162
+ <tr>
163
+ <th>
164
+ <label for="rss_description"><?php _e( 'Description element', 'woocommerce-exporter' ); ?></label>
165
+ </th>
166
+ <td>
167
+ <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>
168
+ <p class="description"><?php _e( 'A description of your data feed.', 'woocommerce-exporter' ); ?></p>
169
+ </td>
170
+ </tr>
171
+
172
+ <tr id="scheduled-exports">
173
+ <td colspan="2" style="padding:0;">
174
+ <hr />
175
+ <h3>
176
+ <div class="dashicons dashicons-calendar"></div>&nbsp;<?php _e( 'Scheduled Exports', 'woocommerce-exporter' ); ?>
177
+ </h3>
178
+ <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>
179
+ </td>
180
+ </tr>
181
+ <tr>
182
+ <th>
183
+ <label for="enable_auto"><?php _e( 'Enable scheduled exports', 'woocommerce-exporter' ); ?></label>
184
+ </th>
185
+ <td>
186
+ <select id="enable_auto" name="enable_auto">
187
+ <option value="1" disabled="disabled"><?php _e( 'Yes', 'woocommerce-exporter' ); ?></option>
188
+ <option value="0" selected="selected"><?php _e( 'No', 'woocommerce-exporter' ); ?></option>
189
+ </select>
190
+ <p class="description"><?php _e( 'Enabling Scheduled Exports will trigger automated exports at the interval specified under Once every (minutes).', 'woocommerce-exporter' ); ?></p>
191
+ </td>
192
+ </tr>
193
+ <tr>
194
+ <th>
195
+ <label for="auto_type"><?php _e( 'Export type', 'woocommerce-exporter' ); ?></label>
196
+ </th>
197
+ <td>
198
+ <select id="auto_type" name="auto_type">
199
+ <?php if( !empty( $types ) ) { ?>
200
+ <?php foreach( $types as $key => $type ) { ?>
201
+ <option value="<?php echo $key; ?>"><?php echo $type; ?></option>
202
+ <?php } ?>
203
+ <?php } else { ?>
204
+ <option value=""><?php _e( 'No export types were found.', 'woocommerce-exporter' ); ?></option>
205
+ <?php } ?>
206
+ </select>
207
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
208
+ <p class="description"><?php _e( 'Select the data type you want to export.', 'woocommerce-exporter' ); ?></p>
209
+ </td>
210
+ </tr>
211
+ <tr class="auto_type_options">
212
+ <th>
213
+ <label><?php _e( 'Export filters', 'woocommerce-exporter' ); ?></label>
214
+ </th>
215
+ <td>
216
+ <ul>
217
+
218
+ <li class="export-options product-options">
219
+ <p class="label"><?php _e( 'Product category', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></p>
220
+ <?php if( !empty( $product_categories ) ) { ?>
221
+ <select data-placeholder="<?php _e( 'Choose a Product Category...', 'woocommerce-exporter' ); ?>" name="product_filter_category[]" multiple class="chzn-select" style="width:95%;">
222
+ <?php foreach( $product_categories as $product_category ) { ?>
223
+ <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>
224
+ <?php } ?>
225
+ </select>
226
+ <?php } else { ?>
227
+ <?php _e( 'No Product Categories were found.', 'woocommerce-exporter' ); ?>
228
+ <?php } ?>
229
+ <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>
230
+ <hr />
231
+ </li>
232
+
233
+ <li class="export-options product-options">
234
+ <p class="label"><?php _e( 'Product tag', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></p>
235
+ <?php if( !empty( $product_tags ) ) { ?>
236
+ <select data-placeholder="<?php _e( 'Choose a Product Tag...', 'woocommerce-exporter' ); ?>" name="product_filter_tag[]" multiple class="chzn-select" style="width:95%;">
237
+ <?php foreach( $product_tags as $product_tag ) { ?>
238
+ <option><?php echo $product_tag->name; ?> (<?php printf( __( 'Term ID: %d', 'woocommerce-exporter' ), $product_tag->term_id ); ?>)</option>
239
+ <?php } ?>
240
+ </select>
241
+ <?php } else { ?>
242
+ <?php _e( 'No Product Tags were found.', 'woocommerce-exporter' ); ?>
243
+ <?php } ?>
244
+ <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>
245
+ <hr />
246
+ </li>
247
+
248
+ <li class="export-options product-options">
249
+ <p class="label"><?php _e( 'Product type', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></p>
250
+ <?php if( !empty( $product_types ) ) { ?>
251
+ <select data-placeholder="<?php _e( 'Choose a Product Type...', 'woocommerce-exporter' ); ?>" name="product_filter_type[]" multiple class="chzn-select" style="width:95%;">
252
+ <?php foreach( $product_types as $key => $product_type ) { ?>
253
+ <option><?php echo woo_ce_format_product_type( $product_type['name'] ); ?> (<?php echo $product_type['count']; ?>)</option>
254
+ <?php } ?>
255
+ </select>
256
+ <?php } else { ?>
257
+ <?php _e( 'No Product Types were found.', 'woocommerce-exporter' ); ?>
258
+ <?php } ?>
259
+ <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>
260
+ <hr />
261
+ </li>
262
+
263
+ <li class="export-options product-options">
264
+ <p class="label"><?php _e( 'Stock status', 'woocommerce-exporter' ); ?></p>
265
+ <ul style="margin-top:0.2em;">
266
+ <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>
267
+ <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>
268
+ <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>
269
+ </ul>
270
+ <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>
271
+ </li>
272
+
273
+ <li class="export-options order-options">
274
+ <p class="label"><?php _e( 'Order date', 'woocommerce-exporter' ); ?></p>
275
+ <ul style="margin-top:0.2em;">
276
+ <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>
277
+ <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>
278
+ <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>
279
+ <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>
280
+ <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>
281
+ <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>
282
+ <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>
283
+ <li>
284
+ <label><input type="radio" name="order_dates_filter" value="variable" disabled="disabled" /><?php _e( 'Variable date', 'woocommerce-exporter' ); ?></label>
285
+ <div style="margin-top:0.2em;">
286
+ <?php _e( 'Last', 'woocommerce-exporter' ); ?>
287
+ <input type="text" name="order_dates_filter_variable" class="text" size="4" value="<?php echo $order_filter_date_variable; ?>" disabled="disabled" />
288
+ <select name="order_dates_filter_variable_length">
289
+ <option value="">&nbsp;</option>
290
+ <option value="second" disabled="disabled"><?php _e( 'second(s)', 'woocommerce-exporter' ); ?></option>
291
+ <option value="minute" disabled="disabled"><?php _e( 'minute(s)', 'woocommerce-exporter' ); ?></option>
292
+ <option value="hour" disabled="disabled"><?php _e( 'hour(s)', 'woocommerce-exporter' ); ?></option>
293
+ <option value="day" disabled="disabled"><?php _e( 'day(s)', 'woocommerce-exporter' ); ?></option>
294
+ <option value="week" disabled="disabled"><?php _e( 'week(s)', 'woocommerce-exporter' ); ?></option>
295
+ <option value="month" disabled="disabled"><?php _e( 'month(s)', 'woocommerce-exporter' ); ?></option>
296
+ <option value="year" disabled="disabled"><?php _e( 'year(s)', 'woocommerce-exporter' ); ?></option>
297
+ </select>
298
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
299
+ </div>
300
+ </li>
301
+ <li>
302
+ <label><input type="radio" name="order_dates_filter" value="manual" disabled="disabled" /><?php _e( 'Fixed date', 'woocommerce-exporter' ); ?></label>
303
+ <div style="margin-top:0.2em;">
304
+ <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>
305
+ </div>
306
+ </li>
307
+ </ul>
308
+ <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>
309
+ <hr />
310
+ </li>
311
+
312
+ <li class="export-options order-options">
313
+ <p class="label"><?php _e( 'Order status', 'woocommerce-exporter' ); ?></p>
314
+ <select data-placeholder="<?php _e( 'Choose a Order Status...', 'woocommerce-exporter' ); ?>" name="order_filter_status[]" multiple class="chzn-select" style="width:95%;">
315
+ <option value="" selected="selected"><?php _e( 'All', 'woocommerce-exporter' ); ?></option>
316
+ <?php if( !empty( $order_statuses ) ) { ?>
317
+ <?php foreach( $order_statuses as $order_status ) { ?>
318
+ <option value="<?php echo $order_status->name; ?>" disabled="disabled"><?php echo ucfirst( $order_status->name ); ?></option>
319
+ <?php } ?>
320
+ <?php } ?>
321
+ </select>
322
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
323
+ <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>
324
+ <hr />
325
+ </li>
326
+
327
+ <li class="export-options order-options">
328
+ <p class="label"><?php _e( 'Payment gateway', 'woocommerce-exporter' ); ?></p>
329
+ <select data-placeholder="<?php _e( 'Choose a Payment Gateway...', 'woocommerce-exporter' ); ?>" name="order_filter_payment[]" multiple class="chzn-select" style="width:95%;">
330
+ <option value="" selected="selected"><?php _e( 'All', 'woocommerce-exporter' ); ?></option>
331
+ </select>
332
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
333
+ <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>
334
+ <hr />
335
+ </li>
336
+
337
+ <li class="export-options order-options">
338
+ <p class="label"><?php _e( 'Shipping method', 'woocommerce-exporter' ); ?></p>
339
+ <select data-placeholder="<?php _e( 'Choose a Shipping Method...', 'woocommerce-exporter' ); ?>" name="order_filter_shipping[]" multiple class="chzn-select" style="width:95%;">
340
+ <option value="" selected="selected"><?php _e( 'All', 'woocommerce-exporter' ); ?></option>
341
+ </select>
342
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
343
+ <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>
344
+ <hr />
345
+ </li>
346
+
347
+ <li class="export-options order-options">
348
+ <p class="label"><?php _e( 'Billing country', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></p>
349
+ <select data-placeholder="<?php _e( 'Choose a Billing Country...', 'woocommerce-exporter' ); ?>" name="order_filter_billing_country[]" multiple class="chzn-select" style="width:95%;">
350
+ <option value="" selected="selected"><?php _e( 'All', 'woocommerce-exporter' ); ?></option>
351
+ </select>
352
+ <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>
353
+ <hr />
354
+ </li>
355
+
356
+ <li class="export-options order-options">
357
+ <p class="label"><?php _e( 'Shipping country', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></p>
358
+ <select data-placeholder="<?php _e( 'Choose a Shipping Country...', 'woocommerce-exporter' ); ?>" id="order_filter_shipping_country" name="order_filter_shipping_country" class="chzn-select">
359
+ <option value="" selected="selected"><?php _e( 'All', 'woocommerce-exporter' ); ?></option>
360
+ </select>
361
+ <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>
362
+ </li>
363
+
364
+ <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">
365
+ <p><?php _e( 'No export filter options are available for this export type.', 'woocommerce-exporter' ); ?></p>
366
+ </li>
367
+
368
+ </ul>
369
+ </td>
370
+ </tr>
371
+
372
+ <tr>
373
+ <th>
374
+ <label><?php _e( 'Scheduling', 'woocommerce-exporter' ); ?></label>
375
+ </th>
376
+ <td>
377
+ <p><?php _e( 'How often do you want the export to run?', 'woocommerce-exporter' ); ?></p>
378
+ <ul>
379
+ <li>
380
+ <label><input type="radio" name="auto_schedule" value="custom" disabled="disabled" /> <?php _e( 'Once every ', 'woocommerce-exporter' ); ?></label>
381
+ <input name="auto_interval" type="text" id="auto_interval" value="<?php echo esc_attr( $auto_interval ); ?>" size="6" maxlength="6" class="text" disabled="disabled" />
382
+ <?php _e( 'minutes', 'woocommerce-exporter' ); ?>
383
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
384
+ </li>
385
+ <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>
386
+ <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>
387
+ <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>
388
+ <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>
389
+ </ul>
390
+ <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>
391
+ <hr />
392
+ <p><?php _e( 'When do you want scheduled exports to start?', 'woocommerce-exporter' ); ?></p>
393
+ <ul>
394
+ <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>
395
+ <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>
396
+ </ul>
397
+ </td>
398
+ </tr>
399
+
400
+ <tr>
401
+ <th>
402
+ <label><?php _e( 'Export format', 'woocommerce-exporter' ); ?></label>
403
+ </th>
404
+ <td>
405
+ <ul style="margin-top:0.2em;">
406
+ <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>
407
+ <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>
408
+ <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>
409
+ <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>
410
+ </ul>
411
+ <p class="description"><?php _e( 'Adjust the export format to generate different export file formats. Default is CSV.', 'woocommerce-exporter' ); ?></p>
412
+ </td>
413
+ </tr>
414
+ <tr>
415
+ <th>
416
+ <label for="auto_method"><?php _e( 'Export method', 'woocommerce-exporter' ); ?></label>
417
+ </th>
418
+ <td>
419
+ <select id="auto_method" name="auto_method">
420
+ <option value="archive"><?php _e( 'Archive to WordPress Media', 'woocommerce-exporter' ); ?></option>
421
+ <option value="email"><?php _e( 'Send as e-mail', 'woocommerce-exporter' ); ?></option>
422
+ <option value="post"><?php _e( 'POST to remote URL', 'woocommerce-exporter' ); ?></option>
423
+ <option value="ftp"><?php _e( 'Upload to remote FTP', 'woocommerce-exporter' ); ?></option>
424
+ </select>
425
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
426
+ <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>
427
+ </td>
428
+ </tr>
429
+ <tr class="auto_method_options">
430
+ <th>
431
+ <label><?php _e( 'Export method options', 'woocommerce-exporter' ); ?></label>
432
+ </th>
433
+ <td>
434
+ <ul>
435
+
436
+ <li class="export-options email-options">
437
+ <p>
438
+ <label for="email_to"><?php _e( 'Default e-mail recipient', 'woocommerce-exporter' ); ?></label><br />
439
+ <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>
440
+ </p>
441
+ <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>
442
+
443
+ <p>
444
+ <label for="email_subject"><?php _e( 'Default e-mail subject', 'woocommerce-exporter' ); ?></label><br />
445
+ <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>
446
+ </p>
447
+ <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>
448
+ </li>
449
+
450
+ <li class="export-options post-options">
451
+ <p>
452
+ <label for="post_to"><?php _e( 'Default remote POST URL', 'woocommerce-exporter' ); ?></label><br />
453
+ <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>
454
+ </p>
455
+ <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>
456
+ </li>
457
+
458
+ <li class="export-options ftp-options">
459
+ <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;
460
+ <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 />
461
+ <label for="ftp_method_protocol"><?php _e( 'Protocol', 'woocommerce-exporter' ); ?></label>
462
+ <select name="ftp_method_protocol">
463
+ <option><?php _e( 'FTP - File Transfer Protocol', 'woocommerce-exporter' ); ?></option>
464
+ <option disabled="disabled"><?php _e( 'SFTP - SSH File Transfer Protocol', 'woocommerce-exporter' ); ?></option>
465
+ </select><br />
466
+ <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 />
467
+ <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 />
468
+ <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 />
469
+ <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 />
470
+ <label for="ftp_method_passive"><?php _e( 'Transfer mode', 'woocommerce-exporter' ); ?>:</label>
471
+ <select id="ftp_method_passive" name="ftp_method_passive">
472
+ <option value="auto"><?php _e( 'Auto', 'woocommerce-exporter' ); ?></option>
473
+ <option value="active" disabled="disabled"><?php _e( 'Active', 'woocommerce-exporter' ); ?></option>
474
+ <option value="passive" disabled="disabled"><?php _e( 'Passive', 'woocommerce-exporter' ); ?></option>
475
+ </select><br />
476
+ <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 />
477
+ <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>
478
+ </li>
479
+
480
+ <li class="export-options archive-options">
481
+ <p><?php _e( 'No export method options are available for this export method.', 'woocommerce-exporter' ); ?></p>
482
+ </li>
483
+
484
+ </ul>
485
+ </td>
486
+ </tr>
487
+ <tr>
488
+ <th>
489
+ <label for="scheduled_fields"><?php _e( 'Export fields', 'woocommerce-exporter' ); ?></label>
490
+ </th>
491
+ <td>
492
+ <ul style="margin-top:0.2em;">
493
+ <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>
494
+ <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>
495
+ </ul>
496
+ <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>
497
+ </td>
498
+ </tr>
499
+
500
+ <tr id="cron-exports">
501
+ <td colspan="2" style="padding:0;">
502
+ <hr />
503
+ <h3><div class="dashicons dashicons-clock"></div>&nbsp;<?php _e( 'CRON Exports', 'woocommerce-exporter' ); ?></h3>
504
+ <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>
505
+ </td>
506
+ </tr>
507
+ <tr>
508
+ <th>
509
+ <label for="enable_cron"><?php _e( 'Enable CRON', 'woocommerce-exporter' ); ?></label>
510
+ </th>
511
+ <td>
512
+ <select id="enable_cron" name="enable_cron">
513
+ <option value="1" disabled="disabled"><?php _e( 'Yes', 'woocommerce-exporter' ); ?></option>
514
+ <option value="0" selected="selected"><?php _e( 'No', 'woocommerce-exporter' ); ?></option>
515
+ </select>
516
+ <p class="description"><?php _e( 'Enabling CRON allows developers to schedule automated exports and connect with Store Exporter Deluxe remotely.', 'woocommerce-exporter' ); ?></p>
517
+ </td>
518
+ </tr>
519
+ <tr>
520
+ <th>
521
+ <label for="secret_key"><?php _e( 'Export secret key', 'woocommerce-exporter' ); ?></label>
522
+ </th>
523
+ <td>
524
+ <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>
525
+ <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>
526
+ </td>
527
+ </tr>
528
+ <tr>
529
+ <th>
530
+ <label for="cron_fields"><?php _e( 'Export fields', 'woocommerce-exporter' ); ?></label>
531
+ </th>
532
+ <td>
533
+ <ul style="margin-top:0.2em;">
534
+ <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>
535
+ <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>
536
+ </ul>
537
+ <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>
538
+ </td>
539
+ </tr>
540
+
541
+ <tr id="orders-screen">
542
+ <td colspan="2" style="padding:0;">
543
+ <hr />
544
+ <h3><div class="dashicons dashicons-admin-settings"></div>&nbsp;<?php _e( 'Orders Screen', 'woocommerce-exporter' ); ?></h3>
545
+ </td>
546
+ </tr>
547
+ <tr>
548
+ <th>
549
+ <label><?php _e( 'Actions display', 'woocommerce-exporter' ); ?></label>
550
+ </th>
551
+ <td>
552
+ <ul>
553
+ <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>
554
+ <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>
555
+ <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>
556
+ <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>
557
+ </ul>
558
+ <p class="description"><?php _e( 'Control the visibility of different Order actions on the WooCommerce &raquo; Orders screen.', 'woocommerce-exporter' ); ?></p>
559
+ </td>
560
+ </tr>
561
+ <?php
562
+ ob_end_flush();
563
+
564
+ }
565
+ ?>
includes/shipping_class.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
34
+ // Returns a list of Shipping Classes export columns
35
+ function woo_ce_get_shipping_class_fields( $format = 'full' ) {
36
+
37
+ $export_type = 'shipping_class';
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' => __( 'Shipping Class Name', 'woo_ce' )
47
+ );
48
+ $fields[] = array(
49
+ 'name' => 'slug',
50
+ 'label' => __( 'Shipping Class Slug', 'woo_ce' )
51
+ );
52
+ $fields[] = array(
53
+ 'name' => 'description',
54
+ 'label' => __( 'Shipping Class Description', 'woo_ce' )
55
+ );
56
+
57
+ /*
58
+ $fields[] = array(
59
+ 'name' => '',
60
+ 'label' => __( '', 'woo_ce' )
61
+ );
62
+ */
63
+
64
+ // Allow Plugin/Theme authors to add support for additional columns
65
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
66
+
67
+ switch( $format ) {
68
+
69
+ case 'summary':
70
+ $output = array();
71
+ $size = count( $fields );
72
+ for( $i = 0; $i < $size; $i++ ) {
73
+ if( isset( $fields[$i] ) )
74
+ $output[$fields[$i]['name']] = 'on';
75
+ }
76
+ return $output;
77
+ break;
78
+
79
+ case 'full':
80
+ default:
81
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
82
+ $size = count( $fields );
83
+ for( $i = 0; $i < $size; $i++ ) {
84
+ $fields[$i]['reset'] = $i;
85
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
86
+ }
87
+ // Check if we are using PHP 5.3 and above
88
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
89
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
90
+ return $fields;
91
+ break;
92
+
93
+ }
94
+
95
+ }
96
+ ?>
includes/subscription.php ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for disabled Filter Subscriptions by Subscription Status widget on Store Exporter screen
7
+ function woo_ce_subscriptions_filter_by_subscription_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', '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 disabled Filter Subscriptions by Subscription Product widget on Store Exporter screen
39
+ function woo_ce_subscriptions_filter_by_subscription_product() {
40
+
41
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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
+
71
+ /* End of: WordPress Administration */
72
+
73
+ }
74
+
75
+ function woo_ce_get_subscription_fields( $format = 'full' ) {
76
+
77
+ $export_type = 'subscription';
78
+
79
+ $fields = array();
80
+ $fields[] = array(
81
+ 'name' => 'key',
82
+ 'label' => __( 'Subscription Key', 'woocommerce-exporter' )
83
+ );
84
+ $fields[] = array(
85
+ 'name' => 'status',
86
+ 'label' => __( 'Subscription Status', 'woocommerce-exporter' )
87
+ );
88
+ $fields[] = array(
89
+ 'name' => 'name',
90
+ 'label' => __( 'Subscription Name', 'woocommerce-exporter' )
91
+ );
92
+ $fields[] = array(
93
+ 'name' => 'user',
94
+ 'label' => __( 'User', 'woocommerce-exporter' )
95
+ );
96
+ $fields[] = array(
97
+ 'name' => 'user_id',
98
+ 'label' => __( 'User ID', 'woocommerce-exporter' )
99
+ );
100
+ $fields[] = array(
101
+ 'name' => 'email',
102
+ 'label' => __( 'E-mail Address', 'woocommerce-exporter' )
103
+ );
104
+ $fields[] = array(
105
+ 'name' => 'order_id',
106
+ 'label' => __( 'Order ID', 'woocommerce-exporter' )
107
+ );
108
+ $fields[] = array(
109
+ 'name' => 'order_status',
110
+ 'label' => __( 'Order Status', 'woocommerce-exporter' )
111
+ );
112
+ // Check if this is a pre-WooCommerce 2.2 instance
113
+ $woocommerce_version = woo_get_woo_version();
114
+ if( version_compare( $woocommerce_version, '2.2', '<' ) ) {
115
+ $fields[] = array(
116
+ 'name' => 'post_status',
117
+ 'label' => __( 'Post Status', 'woocommerce-exporter' )
118
+ );
119
+ }
120
+ $fields[] = array(
121
+ 'name' => 'start_date',
122
+ 'label' => __( 'Start Date', 'woocommerce-exporter' )
123
+ );
124
+ $fields[] = array(
125
+ 'name' => 'expiration',
126
+ 'label' => __( 'Expiration', 'woocommerce-exporter' )
127
+ );
128
+ $fields[] = array(
129
+ 'name' => 'end_date',
130
+ 'label' => __( 'End Date', 'woocommerce-exporter' )
131
+ );
132
+ $fields[] = array(
133
+ 'name' => 'trial_end_date',
134
+ 'label' => __( 'Trial End Date', 'woocommerce-exporter' )
135
+ );
136
+ $fields[] = array(
137
+ 'name' => 'last_payment',
138
+ 'label' => __( 'Last Payment', 'woocommerce-exporter' )
139
+ );
140
+ $fields[] = array(
141
+ 'name' => 'next_payment',
142
+ 'label' => __( 'Next Payment', 'woocommerce-exporter' )
143
+ );
144
+ $fields[] = array(
145
+ 'name' => 'renewals',
146
+ 'label' => __( 'Renewals', 'woocommerce-exporter' )
147
+ );
148
+ $fields[] = array(
149
+ 'name' => 'product_id',
150
+ 'label' => __( 'Product ID', 'woocommerce-exporter' )
151
+ );
152
+ $fields[] = array(
153
+ 'name' => 'product_sku',
154
+ 'label' => __( 'Product SKU', 'woocommerce-exporter' )
155
+ );
156
+ $fields[] = array(
157
+ 'name' => 'variation_id',
158
+ 'label' => __( 'Variation ID', 'woocommerce-exporter' )
159
+ );
160
+ $fields[] = array(
161
+ 'name' => 'coupon',
162
+ 'label' => __( 'Coupon Code', 'woocommerce-exporter' )
163
+ );
164
+ /*
165
+ $fields[] = array(
166
+ 'name' => '',
167
+ 'label' => __( '', 'woocommerce-exporter' )
168
+ );
169
+ */
170
+
171
+ // Allow Plugin/Theme authors to add support for additional columns
172
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
173
+
174
+ switch( $format ) {
175
+
176
+ case 'summary':
177
+ $output = array();
178
+ $size = count( $fields );
179
+ for( $i = 0; $i < $size; $i++ ) {
180
+ if( isset( $fields[$i] ) )
181
+ $output[$fields[$i]['name']] = 'on';
182
+ }
183
+ return $output;
184
+ break;
185
+
186
+ case 'full':
187
+ default:
188
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
189
+ $size = count( $fields );
190
+ for( $i = 0; $i < $size; $i++ ) {
191
+ $fields[$i]['reset'] = $i;
192
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
193
+ }
194
+ // Check if we are using PHP 5.3 and above
195
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
196
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
197
+ return $fields;
198
+ break;
199
+
200
+ }
201
+
202
+ }
203
+
204
+ function woo_ce_get_subscription_statuses() {
205
+
206
+ $subscription_statuses = array(
207
+ 'active' => __( 'Active', 'woocommerce-subscriptions' ),
208
+ 'cancelled' => __( 'Cancelled', 'woocommerce-subscriptions' ),
209
+ 'expired' => __( 'Expired', 'woocommerce-subscriptions' ),
210
+ 'pending' => __( 'Pending', 'woocommerce-subscriptions' ),
211
+ 'failed' => __( 'Failed', 'woocommerce-subscriptions' ),
212
+ 'on-hold' => __( 'On-hold', 'woocommerce-subscriptions' ),
213
+ 'trash' => __( 'Deleted', 'woocommerce-exporter' ),
214
+ );
215
+ return apply_filters( 'woo_ce_subscription_statuses', $subscription_statuses );
216
+
217
+ }
218
+
219
+ function woo_ce_get_subscription_products() {
220
+
221
+ $term_taxonomy = 'product_type';
222
+ $args = array(
223
+ 'post_type' => array( 'product', 'product_variation' ),
224
+ 'posts_per_page' => -1,
225
+ 'fields' => 'ids',
226
+ 'suppress_filters' => false,
227
+ 'tax_query' => array(
228
+ array(
229
+ 'taxonomy' => $term_taxonomy,
230
+ 'field' => 'slug',
231
+ 'terms' => array( 'subscription', 'variable-subscription' )
232
+ )
233
+ )
234
+ );
235
+ $products = array();
236
+ $product_ids = new WP_Query( $args );
237
+ if( $product_ids->posts ) {
238
+ foreach( $product_ids->posts as $product_id )
239
+ $products[] = $product_id;
240
+ }
241
+ return $products;
242
+
243
+ }
244
+ ?>
includes/tag.php ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
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
+
60
+ $export_type = 'tag';
61
+
62
+ $fields = array();
63
+ $fields[] = array(
64
+ 'name' => 'term_id',
65
+ 'label' => __( 'Term ID', 'woocommerce-exporter' )
66
+ );
67
+ $fields[] = array(
68
+ 'name' => 'name',
69
+ 'label' => __( 'Tag Name', 'woocommerce-exporter' )
70
+ );
71
+ $fields[] = array(
72
+ 'name' => 'slug',
73
+ 'label' => __( 'Tag Slug', 'woocommerce-exporter' )
74
+ );
75
+
76
+ /*
77
+ $fields[] = array(
78
+ 'name' => '',
79
+ 'label' => __( '', 'woocommerce-exporter' )
80
+ );
81
+ */
82
+
83
+ // Allow Plugin/Theme authors to add support for additional columns
84
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
85
+
86
+ if( $remember = woo_ce_get_option( $export_type . '_fields', array() ) ) {
87
+ $remember = maybe_unserialize( $remember );
88
+ $size = count( $fields );
89
+ for( $i = 0; $i < $size; $i++ ) {
90
+ $fields[$i]['disabled'] = ( isset( $fields[$i]['disabled'] ) ? $fields[$i]['disabled'] : 0 );
91
+ $fields[$i]['default'] = 1;
92
+ if( !array_key_exists( $fields[$i]['name'], $remember ) )
93
+ $fields[$i]['default'] = 0;
94
+ }
95
+ }
96
+
97
+ switch( $format ) {
98
+
99
+ case 'summary':
100
+ $output = array();
101
+ $size = count( $fields );
102
+ for( $i = 0; $i < $size; $i++ ) {
103
+ if( isset( $fields[$i] ) )
104
+ $output[$fields[$i]['name']] = 'on';
105
+ }
106
+ return $output;
107
+ break;
108
+
109
+ case '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]['reset'] = $i;
115
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
116
+ }
117
+ // Check if we are using PHP 5.3 and above
118
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
119
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
120
+ return $fields;
121
+ break;
122
+
123
+ }
124
+
125
+ }
126
+
127
+ function woo_ce_override_tag_field_labels( $fields = array() ) {
128
+
129
+ $labels = woo_ce_get_option( 'tag_labels', array() );
130
+ if( !empty( $labels ) ) {
131
+ foreach( $fields as $key => $field ) {
132
+ if( isset( $labels[$field['name']] ) )
133
+ $fields[$key]['label'] = $labels[$field['name']];
134
+ }
135
+ }
136
+ return $fields;
137
+
138
+ }
139
+ add_filter( 'woo_ce_tag_fields', 'woo_ce_override_tag_field_labels', 11 );
140
+
141
+ // Returns the export column header label based on an export column slug
142
+ function woo_ce_get_tag_field( $name = null, $format = 'name' ) {
143
+
144
+ $output = '';
145
+ if( $name ) {
146
+ $fields = woo_ce_get_tag_fields();
147
+ $size = count( $fields );
148
+ for( $i = 0; $i < $size; $i++ ) {
149
+ if( $fields[$i]['name'] == $name ) {
150
+ switch( $format ) {
151
+
152
+ case 'name':
153
+ $output = $fields[$i]['label'];
154
+ break;
155
+
156
+ case 'full':
157
+ $output = $fields[$i];
158
+ break;
159
+
160
+ }
161
+ $i = $size;
162
+ }
163
+ }
164
+ }
165
+ return $output;
166
+
167
+ }
168
+ ?>
includes/user.php ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
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
+ <table class="form-table">
56
+
57
+ <tr>
58
+ <th>
59
+ <label><?php _e( 'User meta', 'woocommerce-exporter' ); ?></label>
60
+ </th>
61
+ <td>
62
+ <textarea name="custom_users" rows="5" cols="70"><?php echo esc_textarea( $custom_users ); ?></textarea>
63
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
64
+ <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>
65
+ </td>
66
+ </tr>
67
+
68
+ </table>
69
+ <p class="submit">
70
+ <input type="button" class="button button-disabled" value="<?php _e( 'Save Custom Fields', 'woocommerce-exporter' ); ?>" />
71
+ </p>
72
+ <p class="description"><?php printf( __( 'For more information on custom User meta consult our <a href="%s" target="_blank">online documentation</a>.', 'woocommerce-exporter' ), $troubleshooting_url ); ?></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
+
92
+ // Returns a list of User export columns
93
+ function woo_ce_get_user_fields( $format = 'full' ) {
94
+
95
+ $export_type = 'user';
96
+
97
+ $fields = array();
98
+ $fields[] = array(
99
+ 'name' => 'user_id',
100
+ 'label' => __( 'User ID', 'woocommerce-exporter' )
101
+ );
102
+ $fields[] = array(
103
+ 'name' => 'user_name',
104
+ 'label' => __( 'Username', 'woocommerce-exporter' )
105
+ );
106
+ $fields[] = array(
107
+ 'name' => 'user_role',
108
+ 'label' => __( 'User Role', 'woocommerce-exporter' )
109
+ );
110
+ $fields[] = array(
111
+ 'name' => 'first_name',
112
+ 'label' => __( 'First Name', 'woocommerce-exporter' )
113
+ );
114
+ $fields[] = array(
115
+ 'name' => 'last_name',
116
+ 'label' => __( 'Last Name', 'woocommerce-exporter' )
117
+ );
118
+ $fields[] = array(
119
+ 'name' => 'full_name',
120
+ 'label' => __( 'Full Name', 'woocommerce-exporter' )
121
+ );
122
+ $fields[] = array(
123
+ 'name' => 'nick_name',
124
+ 'label' => __( 'Nickname', 'woocommerce-exporter' )
125
+ );
126
+ $fields[] = array(
127
+ 'name' => 'email',
128
+ 'label' => __( 'E-mail', 'woocommerce-exporter' )
129
+ );
130
+ $fields[] = array(
131
+ 'name' => 'url',
132
+ 'label' => __( 'Website', 'woocommerce-exporter' )
133
+ );
134
+ $fields[] = array(
135
+ 'name' => 'date_registered',
136
+ 'label' => __( 'Date Registered', 'woocommerce-exporter' )
137
+ );
138
+
139
+ /*
140
+ $fields[] = array(
141
+ 'name' => '',
142
+ 'label' => __( '', 'woocommerce-exporter' )
143
+ );
144
+ */
145
+
146
+ // Allow Plugin/Theme authors to add support for additional columns
147
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
148
+
149
+ if( $remember = woo_ce_get_option( $export_type . '_fields', array() ) ) {
150
+ $remember = maybe_unserialize( $remember );
151
+ $size = count( $fields );
152
+ for( $i = 0; $i < $size; $i++ ) {
153
+ $fields[$i]['disabled'] = ( isset( $fields[$i]['disabled'] ) ? $fields[$i]['disabled'] : 0 );
154
+ $fields[$i]['default'] = 1;
155
+ if( !array_key_exists( $fields[$i]['name'], $remember ) )
156
+ $fields[$i]['default'] = 0;
157
+ }
158
+ }
159
+
160
+ switch( $format ) {
161
+
162
+ case 'summary':
163
+ $output = array();
164
+ $size = count( $fields );
165
+ for( $i = 0; $i < $size; $i++ ) {
166
+ if( isset( $fields[$i] ) )
167
+ $output[$fields[$i]['name']] = 'on';
168
+ }
169
+ return $output;
170
+ break;
171
+
172
+ case 'full':
173
+ default:
174
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
175
+ $size = count( $fields );
176
+ for( $i = 0; $i < $size; $i++ ) {
177
+ $fields[$i]['reset'] = $i;
178
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
179
+ }
180
+ // Check if we are using PHP 5.3 and above
181
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
182
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
183
+ return $fields;
184
+ break;
185
+
186
+ }
187
+
188
+ }
189
+
190
+ function woo_ce_override_user_field_labels( $fields = array() ) {
191
+
192
+ $labels = woo_ce_get_option( 'user_labels', array() );
193
+ if( !empty( $labels ) ) {
194
+ foreach( $fields as $key => $field ) {
195
+ if( isset( $labels[$field['name']] ) )
196
+ $fields[$key]['label'] = $labels[$field['name']];
197
+ }
198
+ }
199
+ return $fields;
200
+
201
+ }
202
+ add_filter( 'woo_ce_user_fields', 'woo_ce_override_user_field_labels', 11 );
203
+
204
+ // Returns the export column header label based on an export column slug
205
+ function woo_ce_get_user_field( $name = null, $format = 'name' ) {
206
+
207
+ $output = '';
208
+ if( $name ) {
209
+ $fields = woo_ce_get_user_fields();
210
+ $size = count( $fields );
211
+ for( $i = 0; $i < $size; $i++ ) {
212
+ if( $fields[$i]['name'] == $name ) {
213
+ switch( $format ) {
214
+
215
+ case 'name':
216
+ $output = $fields[$i]['label'];
217
+ break;
218
+
219
+ case 'full':
220
+ $output = $fields[$i];
221
+ break;
222
+
223
+ }
224
+ $i = $size;
225
+ }
226
+ }
227
+ }
228
+ return $output;
229
+
230
+ }
231
+
232
+ // Adds custom User columns to the User fields list
233
+ function woo_ce_extend_user_fields( $fields = array() ) {
234
+
235
+ // WooCommerce User fields
236
+ if( class_exists( 'WC_Admin_Profile' ) ) {
237
+ $admin_profile = new WC_Admin_Profile();
238
+ if( method_exists( 'WC_Admin_Profile', 'get_customer_meta_fields' ) ) {
239
+ $show_fields = $admin_profile->get_customer_meta_fields();
240
+ foreach( $show_fields as $fieldset ) {
241
+ foreach( $fieldset['fields'] as $key => $field ) {
242
+ $fields[] = array(
243
+ 'name' => $key,
244
+ 'label' => sprintf( apply_filters( 'woo_ce_extend_user_fields_wc', '%s: %s' ), $fieldset['title'], esc_html( $field['label'] ) ),
245
+ 'disabled' => 1
246
+ );
247
+ }
248
+ }
249
+ unset( $show_fields, $fieldset, $field );
250
+ }
251
+ }
252
+
253
+ // Custom User meta
254
+ $custom_users = woo_ce_get_option( 'custom_users', '' );
255
+ if( !empty( $custom_users ) ) {
256
+ foreach( $custom_users as $custom_user ) {
257
+ if( !empty( $custom_user ) ) {
258
+ $fields[] = array(
259
+ 'name' => $custom_user,
260
+ 'label' => $custom_user,
261
+ 'disabled' => 1
262
+ );
263
+ }
264
+ }
265
+ unset( $custom_users, $custom_user );
266
+ }
267
+
268
+ return $fields;
269
+
270
+ }
271
+ add_filter( 'woo_ce_user_fields', 'woo_ce_extend_user_fields' );
272
+
273
+ // Returns a list of User IDs
274
+ function woo_ce_get_users( $args = array() ) {
275
+
276
+ global $export;
277
+
278
+ $limit_volume = 0;
279
+ $offset = 0;
280
+ $orderby = 'login';
281
+ $order = 'ASC';
282
+
283
+ if( $args ) {
284
+ $limit_volume = ( isset( $args['limit_volume'] ) ? $args['limit_volume'] : 0 );
285
+ if( $limit_volume == -1 )
286
+ $limit_volume = 0;
287
+ $offset = ( isset( $args['offset'] ) ? $args['offset'] : 0 );
288
+ $orderby = ( isset( $args['user_orderby'] ) ? $args['user_orderby'] : 'login' );
289
+ $order = ( isset( $args['user_order'] ) ? $args['user_order'] : 'ASC' );
290
+ }
291
+ $args = array(
292
+ 'offset' => $offset,
293
+ 'number' => $limit_volume,
294
+ 'order' => $order,
295
+ 'offset' => $offset,
296
+ 'fields' => 'ids'
297
+ );
298
+ if( $user_ids = new WP_User_Query( $args ) ) {
299
+ $users = array();
300
+ $export->total_rows = $user_ids->total_users;
301
+ foreach( $user_ids->results as $user_id )
302
+ $users[] = $user_id;
303
+ return $users;
304
+ }
305
+
306
+ }
307
+
308
+ function woo_ce_get_user_data( $user_id = 0, $args = array() ) {
309
+
310
+ $defaults = array();
311
+ $args = wp_parse_args( $args, $defaults );
312
+
313
+ // Get User details
314
+ $user_data = get_userdata( $user_id );
315
+
316
+ $user = new stdClass;
317
+ if( $user_data !== false ) {
318
+ $user->ID = $user_data->ID;
319
+ $user->user_id = $user_data->ID;
320
+ $user->user_name = $user_data->user_login;
321
+ $user->user_role = $user_data->roles[0];
322
+ $user->first_name = $user_data->first_name;
323
+ $user->last_name = $user_data->last_name;
324
+ $user->full_name = sprintf( apply_filters( 'woo_ce_get_user_data_full_name', '%s %s' ), $user->first_name, $user->last_name );
325
+ $user->nick_name = $user_data->user_nicename;
326
+ $user->email = $user_data->user_email;
327
+ $user->url = $user_data->user_url;
328
+ $user->date_registered = $user_data->user_registered;
329
+ }
330
+ return apply_filters( 'woo_ce_user', $user );
331
+
332
+ }
333
+
334
+ // Returns a list of WordPress User Roles
335
+ function woo_ce_get_user_roles() {
336
+
337
+ global $wp_roles;
338
+
339
+ $user_roles = $wp_roles->roles;
340
+ return $user_roles;
341
+
342
+ }
343
+
344
+ ?>
js/jquery-ui.js ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery UI 1.8.16
3
+ */
4
+ (function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.16",
5
+ keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({propAttr:c.fn.prop||c.fn.attr,_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=
6
+ this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,
7
+ "overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":
8
+ "mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,
9
+ outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,
10
+ "tabindex"),d=isNaN(b);return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&
11
+ a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&
12
+ c.ui.isOverAxis(b,e,i)}})}})(jQuery);
13
+ ;
14
+
15
+ (function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)try{b(d).triggerHandler("remove")}catch(e){}k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(d){}});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=
16
+ function(h){return!!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):
17
+ d;if(e&&d.charAt(0)==="_")return h;e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=
18
+ b.extend(true,{},this.options,this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+
19
+ "-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",
20
+ c);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
21
+ ;
22
+
23
+ (function(b){var d=false;b(document).mouseup(function(){d=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===b.data(c.target,a.widgetName+".preventClickEvent")){b.removeData(c.target,a.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+
24
+ this.widgetName)},_mouseDown:function(a){if(!d){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,f=a.which==1,g=typeof this.options.cancel=="string"&&a.target.nodeName?b(a.target).closest(this.options.cancel).length:false;if(!f||g||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=
25
+ this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();return true}}true===b.data(a.target,this.widgetName+".preventClickEvent")&&b.removeData(a.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(e){return c._mouseMove(e)};this._mouseUpDelegate=function(e){return c._mouseUp(e)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return d=true}},_mouseMove:function(a){if(b.browser.msie&&
26
+ !(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=
27
+ false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
28
+ ;
29
+
30
+ (function(d){d.widget("ui.slider",d.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var a=this,b=this.options,c=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f=b.values&&b.values.length||1,e=[];this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+
31
+ this.orientation+" ui-widget ui-widget-content ui-corner-all"+(b.disabled?" ui-slider-disabled ui-disabled":""));this.range=d([]);if(b.range){if(b.range===true){if(!b.values)b.values=[this._valueMin(),this._valueMin()];if(b.values.length&&b.values.length!==2)b.values=[b.values[0],b.values[0]]}this.range=d("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(b.range==="min"||b.range==="max"?" ui-slider-range-"+b.range:""))}for(var j=c.length;j<f;j+=1)e.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>");
32
+ this.handles=c.add(d(e.join("")).appendTo(a.element));this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(g){g.preventDefault()}).hover(function(){b.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(b.disabled)d(this).blur();else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(g){d(this).data("index.ui-slider-handle",
33
+ g)});this.handles.keydown(function(g){var k=true,l=d(this).data("index.ui-slider-handle"),i,h,m;if(!a.options.disabled){switch(g.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:k=false;if(!a._keySliding){a._keySliding=true;d(this).addClass("ui-state-active");i=a._start(g,l);if(i===false)return}break}m=a.options.step;i=a.options.values&&a.options.values.length?
34
+ (h=a.values(l)):(h=a.value());switch(g.keyCode){case d.ui.keyCode.HOME:h=a._valueMin();break;case d.ui.keyCode.END:h=a._valueMax();break;case d.ui.keyCode.PAGE_UP:h=a._trimAlignValue(i+(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:h=a._trimAlignValue(i-(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(i===a._valueMax())return;h=a._trimAlignValue(i+m);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(i===a._valueMin())return;h=a._trimAlignValue(i-
35
+ m);break}a._slide(g,l,h);return k}}).keyup(function(g){var k=d(this).data("index.ui-slider-handle");if(a._keySliding){a._keySliding=false;a._stop(g,k);a._change(g,k);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy();
36
+ return this},_mouseCapture:function(a){var b=this.options,c,f,e,j,g;if(b.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:a.pageX,y:a.pageY});f=this._valueMax()-this._valueMin()+1;j=this;this.handles.each(function(k){var l=Math.abs(c-j.values(k));if(f>l){f=l;e=d(this);g=k}});if(b.range===true&&this.values(1)===b.min){g+=1;e=d(this.handles[g])}if(this._start(a,g)===false)return false;
37
+ this._mouseSliding=true;j._handleIndex=g;e.addClass("ui-state-active").focus();b=e.offset();this._clickOffset=!d(a.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:a.pageX-b.left-e.width()/2,top:a.pageY-b.top-e.height()/2-(parseInt(e.css("borderTopWidth"),10)||0)-(parseInt(e.css("borderBottomWidth"),10)||0)+(parseInt(e.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(a,g,c);return this._animateOff=true},_mouseStart:function(){return true},_mouseDrag:function(a){var b=
38
+ this._normValueFromMouse({x:a.pageX,y:a.pageY});this._slide(a,this._handleIndex,b);return false},_mouseStop:function(a){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(a,this._handleIndex);this._change(a,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b;if(this.orientation==="horizontal"){b=
39
+ this.elementSize.width;a=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{b=this.elementSize.height;a=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}b=a/b;if(b>1)b=1;if(b<0)b=0;if(this.orientation==="vertical")b=1-b;a=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+b*a)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);
40
+ c.values=this.values()}return this._trigger("start",a,c)},_slide:function(a,b,c){var f;if(this.options.values&&this.options.values.length){f=this.values(b?0:1);if(this.options.values.length===2&&this.options.range===true&&(b===0&&c>f||b===1&&c<f))c=f;if(c!==this.values(b)){f=this.values();f[b]=c;a=this._trigger("slide",a,{handle:this.handles[b],value:c,values:f});this.values(b?0:1);a!==false&&this.values(b,c,true)}}else if(c!==this.value()){a=this._trigger("slide",a,{handle:this.handles[b],value:c});
41
+ a!==false&&this.value(c)}},_stop:function(a,b){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);c.values=this.values()}this._trigger("stop",a,c)},_change:function(a,b){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);c.values=this.values()}this._trigger("change",a,c)}},value:function(a){if(arguments.length){this.options.value=
42
+ this._trimAlignValue(a);this._refreshValue();this._change(null,0)}else return this._value()},values:function(a,b){var c,f,e;if(arguments.length>1){this.options.values[a]=this._trimAlignValue(b);this._refreshValue();this._change(null,a)}else if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;f=arguments[0];for(e=0;e<c.length;e+=1){c[e]=this._trimAlignValue(f[e]);this._change(null,e)}this._refreshValue()}else return this.options.values&&this.options.values.length?this._values(a):
43
+ this.value();else return this._values()},_setOption:function(a,b){var c,f=0;if(d.isArray(this.options.values))f=this.options.values.length;d.Widget.prototype._setOption.apply(this,arguments);switch(a){case "disabled":if(b){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.propAttr("disabled",true);this.element.addClass("ui-disabled")}else{this.handles.propAttr("disabled",false);this.element.removeClass("ui-disabled")}break;case "orientation":this._detectOrientation();
44
+ this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case "value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case "values":this._animateOff=true;this._refreshValue();for(c=0;c<f;c+=1)this._change(null,c);this._animateOff=false;break}},_value:function(){var a=this.options.value;return a=this._trimAlignValue(a)},_values:function(a){var b,c;if(arguments.length){b=this.options.values[a];
45
+ return b=this._trimAlignValue(b)}else{b=this.options.values.slice();for(c=0;c<b.length;c+=1)b[c]=this._trimAlignValue(b[c]);return b}},_trimAlignValue:function(a){if(a<=this._valueMin())return this._valueMin();if(a>=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b;a=a-c;if(Math.abs(c)*2>=b)a+=c>0?b:-b;return parseFloat(a.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var a=
46
+ this.options.range,b=this.options,c=this,f=!this._animateOff?b.animate:false,e,j={},g,k,l,i;if(this.options.values&&this.options.values.length)this.handles.each(function(h){e=(c.values(h)-c._valueMin())/(c._valueMax()-c._valueMin())*100;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";d(this).stop(1,1)[f?"animate":"css"](j,b.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(h===0)c.range.stop(1,1)[f?"animate":"css"]({left:e+"%"},b.animate);if(h===1)c.range[f?"animate":"css"]({width:e-
47
+ g+"%"},{queue:false,duration:b.animate})}else{if(h===0)c.range.stop(1,1)[f?"animate":"css"]({bottom:e+"%"},b.animate);if(h===1)c.range[f?"animate":"css"]({height:e-g+"%"},{queue:false,duration:b.animate})}g=e});else{k=this.value();l=this._valueMin();i=this._valueMax();e=i!==l?(k-l)/(i-l)*100:0;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[f?"animate":"css"](j,b.animate);if(a==="min"&&this.orientation==="horizontal")this.range.stop(1,1)[f?"animate":"css"]({width:e+"%"},
48
+ b.animate);if(a==="max"&&this.orientation==="horizontal")this.range[f?"animate":"css"]({width:100-e+"%"},{queue:false,duration:b.animate});if(a==="min"&&this.orientation==="vertical")this.range.stop(1,1)[f?"animate":"css"]({height:e+"%"},b.animate);if(a==="max"&&this.orientation==="vertical")this.range[f?"animate":"css"]({height:100-e+"%"},{queue:false,duration:b.animate})}}});d.extend(d.ui.slider,{version:"1.8.16"})})(jQuery);
js/jquery.chosen.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.csvToTable.js ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * CSV to Table plugin
3
+ * http://code.google.com/p/jquerycsvtotable/
4
+ *
5
+ * Copyright (c) 2010 Steve Sobel
6
+ * http://honestbleeps.com/
7
+ *
8
+ * v0.9 - 2010-06-22 - First release.
9
+ *
10
+ * Example implementation:
11
+ * $('#divID').CSVToTable('test.csv');
12
+ *
13
+ * The above line would load 'test.csv' via AJAX and render a table. If
14
+ * headers are not specified, the plugin assumes the first line of the CSV
15
+ * file contains the header names.
16
+ *
17
+ * Configurable options:
18
+ * separator - separator to use when parsing CSV/TSV data
19
+ * - value will almost always be "," or "\t" (comma or tab)
20
+ * - if not specified, default value is ","
21
+ * headers - an array of headers for the CSV data
22
+ * - if not specified, plugin assumes that the first line of the CSV
23
+ * file contains the header names.
24
+ * - Example: headers: ['Album Title', 'Artist Name', 'Price ($USD)']
25
+ * tableClass - class name to apply to the <table> tag rendered by the plugin.
26
+ * theadClass - class name to apply to the <thead> tag rendered by the plugin.
27
+ * thClass - class name to apply to the <th> tag rendered by the plugin.
28
+ * tbodyClass - class name to apply to the <tbody> tag rendered by the plugin.
29
+ * trClass - class name to apply to the <tr> tag rendered by the plugin.
30
+ * tdClass - class name to apply to the <td> tag rendered by the plugin.
31
+ * loadingImage - path to an image to display while CSV/TSV data is loading
32
+ * loadingText - text to display while CSV/TSV is loading
33
+ * - if not specified, default value is "Loading CSV data..."
34
+ *
35
+ *
36
+ * Upon completion, the plugin triggers a "loadComplete" event so that you
37
+ * may perform other manipulation on the table after it has loaded. A
38
+ * common use of this would be to use the jQuery tablesorter plugin, found
39
+ * at http://tablesorter.com/
40
+ *
41
+ * An example of such a call would be as follows, assuming you have loaded
42
+ * the tablesorter plugin.
43
+ *
44
+ * $('#CSVTable').CSVToTable('test.csv',
45
+ * {
46
+ * loadingImage: 'images/loading.gif',
47
+ * startLine: 1,
48
+ * headers: ['Album Title', 'Artist Name', 'Price ($USD)']
49
+ * }
50
+ * ).bind("loadComplete",function() {
51
+ * $('#CSVTable').find('TABLE').tablesorter();
52
+ * });;
53
+
54
+ *
55
+ */
56
+
57
+
58
+ (function($){
59
+
60
+ /**
61
+ *
62
+ * CSV Parser credit goes to Brian Huisman, from his blog entry entitled "CSV String to Array in JavaScript":
63
+ * http://www.greywyvern.com/?post=258
64
+ *
65
+ */
66
+ String.prototype.splitCSV = function(sep) {
67
+ for (var thisCSV = this.split(sep = sep || ","), x = thisCSV.length - 1, tl; x >= 0; x--) {
68
+ if (thisCSV[x].replace(/"\s+$/, '"').charAt(thisCSV[x].length - 1) == '"') {
69
+ if ((tl = thisCSV[x].replace(/^\s+"/, '"')).length > 1 && tl.charAt(0) == '"') {
70
+ thisCSV[x] = thisCSV[x].replace(/^\s*"|"\s*$/g, '').replace(/""/g, '"');
71
+ } else if (x) {
72
+ thisCSV.splice(x - 1, 2, [thisCSV[x - 1], thisCSV[x]].join(sep));
73
+ } else thisCSV = thisCSV.shift().split(sep).concat(thisCSV);
74
+ } else thisCSV[x].replace(/""/g, '"');
75
+ } return thisCSV;
76
+ };
77
+
78
+ $.fn.CSVToTable = function(csvFile, options) {
79
+ var defaults = {
80
+ tableClass: "CSVTable",
81
+ theadClass: "",
82
+ thClass: "",
83
+ tbodyClass: "",
84
+ trClass: "",
85
+ tdClass: "",
86
+ loadingImage: "",
87
+ loadingText: "Loading CSV data...",
88
+ separator: ",",
89
+ startLine: 0
90
+ };
91
+ var options = $.extend(defaults, options);
92
+ return this.each(function() {
93
+ var obj = $(this);
94
+ var error = '';
95
+ var csv = obj.html(); // this is the string containing the CSV data
96
+ var data = csv;
97
+ (options.loadingImage) ? loading = '<div style="text-align: center"><img alt="' + options.loadingText + '" src="' + options.loadingImage + '" /><br>' + options.loadingText + '</div>' : loading = options.loadingText;
98
+ obj.html(loading);
99
+ var tableHTML = '<table class="' + options.tableClass + '">';
100
+ var lines = data.replace('\r','').split('\n');
101
+ var printedLines = 0;
102
+ var headerCount = 0;
103
+ var headers = new Array();
104
+ $.each(lines, function(lineCount, line) {
105
+ if ((lineCount == 0) && (typeof(options.headers) != 'undefined')) {
106
+ headers = options.headers;
107
+ headerCount = headers.length;
108
+ tableHTML += '<thead class="' + options.theadClass + '"><tr class="' + options.trClass + '">';
109
+ $.each(headers, function(headerCount, header) {
110
+ tableHTML += '<th class="' + options.thClass + '">' + header + '</th>';
111
+ });
112
+ tableHTML += '</tr></thead><tbody class="' + options.tbodyClass + '">';
113
+ }
114
+ if ((lineCount == options.startLine) && (typeof(options.headers) == 'undefined')) {
115
+ headers = line.splitCSV(options.separator);
116
+ headerCount = headers.length;
117
+ tableHTML += '<thead class="' + options.theadClass + '"><tr class="' + options.trClass + '">';
118
+ $.each(headers, function(headerCount, header) {
119
+ tableHTML += '<th class="' + options.thClass + '">' + header + '</th>';
120
+ });
121
+ tableHTML += '</tr></thead><tbody class="' + options.tbodyClass + '">';
122
+ } else if (lineCount >= options.startLine) {
123
+ var items = line.splitCSV(options.separator);
124
+ if (items.length > 1) {
125
+ printedLines++;
126
+ if (items.length != headerCount) {
127
+ error += 'error on line ' + lineCount + ': Item count (' + items.length + ') does not match header count (' + headerCount + ') \n';
128
+ }
129
+ (printedLines % 2) ? oddOrEven = 'odd' : oddOrEven = 'even';
130
+ tableHTML += '<tr class="' + options.trClass + ' ' + oddOrEven + '">';
131
+ $.each(items, function(itemCount, item) {
132
+ tableHTML += '<td class="' + options.tdClass + '">' + item + '</td>';
133
+ });
134
+ tableHTML += '</tr>';
135
+ }
136
+ }
137
+ });
138
+ tableHTML += '</tbody></table>';
139
+ if (error) {
140
+ obj.html(error);
141
+ } else {
142
+ obj.fadeOut(500, function() {
143
+ obj.html(tableHTML)
144
+ }).fadeIn(function() {
145
+ // trigger loadComplete
146
+ setTimeout(function() {
147
+ obj.trigger("loadComplete");
148
+ },0);
149
+ });
150
+ }
151
+ });
152
+ };
153
+
154
+ })(jQuery);
js/jquery.timepicker.js ADDED
@@ -0,0 +1,2244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! jQuery Timepicker Addon - v1.5.2 - 2015-03-15
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.2"
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] || 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
+ this._base_gotoToday(id);
1552
+ var tp_inst = this._get(inst, 'timepicker');
1553
+ selectLocalTimezone(tp_inst);
1554
+ var now = new Date();
1555
+ this._setTime(inst, now);
1556
+ this._setDate(inst, now);
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
+ if (date && tp_inst._parseTime($(target).val(), tp_inst.timeOnly)) {
1715
+ date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1716
+ date.setMicroseconds(tp_inst.microsec);
1717
+
1718
+ // This is important if you are using the timezone option, javascript's Date
1719
+ // object will only return the timezone offset for the current locale, so we
1720
+ // adjust it accordingly. If not using timezone option this won't matter..
1721
+ if (tp_inst.timezone != null) {
1722
+ // look out for DST if tz wasn't specified
1723
+ if (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) {
1724
+ tp_inst.timezone = date.getTimezoneOffset() * -1;
1725
+ }
1726
+ date = $.timepicker.timezoneAdjust(date, tp_inst.timezone);
1727
+ }
1728
+ }
1729
+ return date;
1730
+ }
1731
+ return this._base_getDateDatepicker(target, noDefault);
1732
+ };
1733
+
1734
+ /*
1735
+ * override parseDate() because UI 1.8.14 throws an error about "Extra characters"
1736
+ * An option in datapicker to ignore extra format characters would be nicer.
1737
+ */
1738
+ $.datepicker._base_parseDate = $.datepicker.parseDate;
1739
+ $.datepicker.parseDate = function (format, value, settings) {
1740
+ var date;
1741
+ try {
1742
+ date = this._base_parseDate(format, value, settings);
1743
+ } catch (err) {
1744
+ // Hack! The error message ends with a colon, a space, and
1745
+ // the "extra" characters. We rely on that instead of
1746
+ // attempting to perfectly reproduce the parsing algorithm.
1747
+ if (err.indexOf(":") >= 0) {
1748
+ date = this._base_parseDate(format, value.substring(0, value.length - (err.length - err.indexOf(':') - 2)), settings);
1749
+ $.timepicker.log("Error parsing the date string: " + err + "\ndate string = " + value + "\ndate format = " + format);
1750
+ } else {
1751
+ throw err;
1752
+ }
1753
+ }
1754
+ return date;
1755
+ };
1756
+
1757
+ /*
1758
+ * override formatDate to set date with time to the input
1759
+ */
1760
+ $.datepicker._base_formatDate = $.datepicker._formatDate;
1761
+ $.datepicker._formatDate = function (inst, day, month, year) {
1762
+ var tp_inst = this._get(inst, 'timepicker');
1763
+ if (tp_inst) {
1764
+ tp_inst._updateDateTime(inst);
1765
+ return tp_inst.$input.val();
1766
+ }
1767
+ return this._base_formatDate(inst);
1768
+ };
1769
+
1770
+ /*
1771
+ * override options setter to add time to maxDate(Time) and minDate(Time). MaxDate
1772
+ */
1773
+ $.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;
1774
+ $.datepicker._optionDatepicker = function (target, name, value) {
1775
+ var inst = this._getInst(target),
1776
+ name_clone;
1777
+ if (!inst) {
1778
+ return null;
1779
+ }
1780
+
1781
+ var tp_inst = this._get(inst, 'timepicker');
1782
+ if (tp_inst) {
1783
+ var min = null,
1784
+ max = null,
1785
+ onselect = null,
1786
+ overrides = tp_inst._defaults.evnts,
1787
+ fns = {},
1788
+ prop,
1789
+ ret,
1790
+ oldVal,
1791
+ $target;
1792
+ if (typeof name === 'string') { // if min/max was set with the string
1793
+ if (name === 'minDate' || name === 'minDateTime') {
1794
+ min = value;
1795
+ } else if (name === 'maxDate' || name === 'maxDateTime') {
1796
+ max = value;
1797
+ } else if (name === 'onSelect') {
1798
+ onselect = value;
1799
+ } else if (overrides.hasOwnProperty(name)) {
1800
+ if (typeof (value) === 'undefined') {
1801
+ return overrides[name];
1802
+ }
1803
+ fns[name] = value;
1804
+ name_clone = {}; //empty results in exiting function after overrides updated
1805
+ }
1806
+ } else if (typeof name === 'object') { //if min/max was set with the JSON
1807
+ if (name.minDate) {
1808
+ min = name.minDate;
1809
+ } else if (name.minDateTime) {
1810
+ min = name.minDateTime;
1811
+ } else if (name.maxDate) {
1812
+ max = name.maxDate;
1813
+ } else if (name.maxDateTime) {
1814
+ max = name.maxDateTime;
1815
+ }
1816
+ for (prop in overrides) {
1817
+ if (overrides.hasOwnProperty(prop) && name[prop]) {
1818
+ fns[prop] = name[prop];
1819
+ }
1820
+ }
1821
+ }
1822
+ for (prop in fns) {
1823
+ if (fns.hasOwnProperty(prop)) {
1824
+ overrides[prop] = fns[prop];
1825
+ if (!name_clone) { name_clone = $.extend({}, name); }
1826
+ delete name_clone[prop];
1827
+ }
1828
+ }
1829
+ if (name_clone && isEmptyObject(name_clone)) { return; }
1830
+ if (min) { //if min was set
1831
+ if (min === 0) {
1832
+ min = new Date();
1833
+ } else {
1834
+ min = new Date(min);
1835
+ }
1836
+ tp_inst._defaults.minDate = min;
1837
+ tp_inst._defaults.minDateTime = min;
1838
+ } else if (max) { //if max was set
1839
+ if (max === 0) {
1840
+ max = new Date();
1841
+ } else {
1842
+ max = new Date(max);
1843
+ }
1844
+ tp_inst._defaults.maxDate = max;
1845
+ tp_inst._defaults.maxDateTime = max;
1846
+ } else if (onselect) {
1847
+ tp_inst._defaults.onSelect = onselect;
1848
+ }
1849
+
1850
+ // Datepicker will override our date when we call _base_optionDatepicker when
1851
+ // calling minDate/maxDate, so we will first grab the value, call
1852
+ // _base_optionDatepicker, then set our value back.
1853
+ if(min || max){
1854
+ $target = $(target);
1855
+ oldVal = $target.datetimepicker('getDate');
1856
+ ret = this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
1857
+ $target.datetimepicker('setDate', oldVal);
1858
+ return ret;
1859
+ }
1860
+ }
1861
+ if (value === undefined) {
1862
+ return this._base_optionDatepicker.call($.datepicker, target, name);
1863
+ }
1864
+ return this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
1865
+ };
1866
+
1867
+ /*
1868
+ * jQuery isEmptyObject does not check hasOwnProperty - if someone has added to the object prototype,
1869
+ * it will return false for all objects
1870
+ */
1871
+ var isEmptyObject = function (obj) {
1872
+ var prop;
1873
+ for (prop in obj) {
1874
+ if (obj.hasOwnProperty(prop)) {
1875
+ return false;
1876
+ }
1877
+ }
1878
+ return true;
1879
+ };
1880
+
1881
+ /*
1882
+ * jQuery extend now ignores nulls!
1883
+ */
1884
+ var extendRemove = function (target, props) {
1885
+ $.extend(target, props);
1886
+ for (var name in props) {
1887
+ if (props[name] === null || props[name] === undefined) {
1888
+ target[name] = props[name];
1889
+ }
1890
+ }
1891
+ return target;
1892
+ };
1893
+
1894
+ /*
1895
+ * Determine by the time format which units are supported
1896
+ * Returns an object of booleans for each unit
1897
+ */
1898
+ var detectSupport = function (timeFormat) {
1899
+ var tf = timeFormat.replace(/'.*?'/g, '').toLowerCase(), // removes literals
1900
+ isIn = function (f, t) { // does the format contain the token?
1901
+ return f.indexOf(t) !== -1 ? true : false;
1902
+ };
1903
+ return {
1904
+ hour: isIn(tf, 'h'),
1905
+ minute: isIn(tf, 'm'),
1906
+ second: isIn(tf, 's'),
1907
+ millisec: isIn(tf, 'l'),
1908
+ microsec: isIn(tf, 'c'),
1909
+ timezone: isIn(tf, 'z'),
1910
+ ampm: isIn(tf, 't') && isIn(timeFormat, 'h'),
1911
+ iso8601: isIn(timeFormat, 'Z')
1912
+ };
1913
+ };
1914
+
1915
+ /*
1916
+ * Converts 24 hour format into 12 hour
1917
+ * Returns 12 hour without leading 0
1918
+ */
1919
+ var convert24to12 = function (hour) {
1920
+ hour %= 12;
1921
+
1922
+ if (hour === 0) {
1923
+ hour = 12;
1924
+ }
1925
+
1926
+ return String(hour);
1927
+ };
1928
+
1929
+ var computeEffectiveSetting = function (settings, property) {
1930
+ return settings && settings[property] ? settings[property] : $.timepicker._defaults[property];
1931
+ };
1932
+
1933
+ /*
1934
+ * Splits datetime string into date and time substrings.
1935
+ * Throws exception when date can't be parsed
1936
+ * Returns {dateString: dateString, timeString: timeString}
1937
+ */
1938
+ var splitDateTime = function (dateTimeString, timeSettings) {
1939
+ // The idea is to get the number separator occurrences in datetime and the time format requested (since time has
1940
+ // fewer unknowns, mostly numbers and am/pm). We will use the time pattern to split.
1941
+ var separator = computeEffectiveSetting(timeSettings, 'separator'),
1942
+ format = computeEffectiveSetting(timeSettings, 'timeFormat'),
1943
+ timeParts = format.split(separator), // how many occurrences of separator may be in our format?
1944
+ timePartsLen = timeParts.length,
1945
+ allParts = dateTimeString.split(separator),
1946
+ allPartsLen = allParts.length;
1947
+
1948
+ if (allPartsLen > 1) {
1949
+ return {
1950
+ dateString: allParts.splice(0, allPartsLen - timePartsLen).join(separator),
1951
+ timeString: allParts.splice(0, timePartsLen).join(separator)
1952
+ };
1953
+ }
1954
+
1955
+ return {
1956
+ dateString: dateTimeString,
1957
+ timeString: ''
1958
+ };
1959
+ };
1960
+
1961
+ /*
1962
+ * Internal function to parse datetime interval
1963
+ * Returns: {date: Date, timeObj: Object}, where
1964
+ * date - parsed date without time (type Date)
1965
+ * timeObj = {hour: , minute: , second: , millisec: , microsec: } - parsed time. Optional
1966
+ */
1967
+ var parseDateTimeInternal = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
1968
+ var date,
1969
+ parts,
1970
+ parsedTime;
1971
+
1972
+ parts = splitDateTime(dateTimeString, timeSettings);
1973
+ date = $.datepicker._base_parseDate(dateFormat, parts.dateString, dateSettings);
1974
+
1975
+ if (parts.timeString === '') {
1976
+ return {
1977
+ date: date
1978
+ };
1979
+ }
1980
+
1981
+ parsedTime = $.datepicker.parseTime(timeFormat, parts.timeString, timeSettings);
1982
+
1983
+ if (!parsedTime) {
1984
+ throw 'Wrong time format';
1985
+ }
1986
+
1987
+ return {
1988
+ date: date,
1989
+ timeObj: parsedTime
1990
+ };
1991
+ };
1992
+
1993
+ /*
1994
+ * Internal function to set timezone_select to the local timezone
1995
+ */
1996
+ var selectLocalTimezone = function (tp_inst, date) {
1997
+ if (tp_inst && tp_inst.timezone_select) {
1998
+ var now = date || new Date();
1999
+ tp_inst.timezone_select.val(-now.getTimezoneOffset());
2000
+ }
2001
+ };
2002
+
2003
+ /*
2004
+ * Create a Singleton Instance
2005
+ */
2006
+ $.timepicker = new Timepicker();
2007
+
2008
+ /**
2009
+ * Get the timezone offset as string from a date object (eg '+0530' for UTC+5.5)
2010
+ * @param {number} tzMinutes if not a number, less than -720 (-1200), or greater than 840 (+1400) this value is returned
2011
+ * @param {boolean} iso8601 if true formats in accordance to iso8601 "+12:45"
2012
+ * @return {string}
2013
+ */
2014
+ $.timepicker.timezoneOffsetString = function (tzMinutes, iso8601) {
2015
+ if (isNaN(tzMinutes) || tzMinutes > 840 || tzMinutes < -720) {
2016
+ return tzMinutes;
2017
+ }
2018
+
2019
+ var off = tzMinutes,
2020
+ minutes = off % 60,
2021
+ hours = (off - minutes) / 60,
2022
+ iso = iso8601 ? ':' : '',
2023
+ tz = (off >= 0 ? '+' : '-') + ('0' + Math.abs(hours)).slice(-2) + iso + ('0' + Math.abs(minutes)).slice(-2);
2024
+
2025
+ if (tz === '+00:00') {
2026
+ return 'Z';
2027
+ }
2028
+ return tz;
2029
+ };
2030
+
2031
+ /**
2032
+ * Get the number in minutes that represents a timezone string
2033
+ * @param {string} tzString formatted like "+0500", "-1245", "Z"
2034
+ * @return {number} the offset minutes or the original string if it doesn't match expectations
2035
+ */
2036
+ $.timepicker.timezoneOffsetNumber = function (tzString) {
2037
+ var normalized = tzString.toString().replace(':', ''); // excuse any iso8601, end up with "+1245"
2038
+
2039
+ if (normalized.toUpperCase() === 'Z') { // if iso8601 with Z, its 0 minute offset
2040
+ return 0;
2041
+ }
2042
+
2043
+ if (!/^(\-|\+)\d{4}$/.test(normalized)) { // possibly a user defined tz, so just give it back
2044
+ return tzString;
2045
+ }
2046
+
2047
+ return ((normalized.substr(0, 1) === '-' ? -1 : 1) * // plus or minus
2048
+ ((parseInt(normalized.substr(1, 2), 10) * 60) + // hours (converted to minutes)
2049
+ parseInt(normalized.substr(3, 2), 10))); // minutes
2050
+ };
2051
+
2052
+ /**
2053
+ * No way to set timezone in js Date, so we must adjust the minutes to compensate. (think setDate, getDate)
2054
+ * @param {Date} date
2055
+ * @param {string} toTimezone formatted like "+0500", "-1245"
2056
+ * @return {Date}
2057
+ */
2058
+ $.timepicker.timezoneAdjust = function (date, toTimezone) {
2059
+ var toTz = $.timepicker.timezoneOffsetNumber(toTimezone);
2060
+ if (!isNaN(toTz)) {
2061
+ date.setMinutes(date.getMinutes() + -date.getTimezoneOffset() - toTz);
2062
+ }
2063
+ return date;
2064
+ };
2065
+
2066
+ /**
2067
+ * Calls `timepicker()` on the `startTime` and `endTime` elements, and configures them to
2068
+ * enforce date range limits.
2069
+ * n.b. The input value must be correctly formatted (reformatting is not supported)
2070
+ * @param {Element} startTime
2071
+ * @param {Element} endTime
2072
+ * @param {Object} options Options for the timepicker() call
2073
+ * @return {jQuery}
2074
+ */
2075
+ $.timepicker.timeRange = function (startTime, endTime, options) {
2076
+ return $.timepicker.handleRange('timepicker', startTime, endTime, options);
2077
+ };
2078
+
2079
+ /**
2080
+ * Calls `datetimepicker` on the `startTime` and `endTime` elements, and configures them to
2081
+ * enforce date range limits.
2082
+ * @param {Element} startTime
2083
+ * @param {Element} endTime
2084
+ * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
2085
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
2086
+ * @param {string} method Can be used to specify the type of picker to be added
2087
+ * @return {jQuery}
2088
+ */
2089
+ $.timepicker.datetimeRange = function (startTime, endTime, options) {
2090
+ $.timepicker.handleRange('datetimepicker', startTime, endTime, options);
2091
+ };
2092
+
2093
+ /**
2094
+ * Calls `datepicker` on the `startTime` and `endTime` elements, and configures them to
2095
+ * enforce date range limits.
2096
+ * @param {Element} startTime
2097
+ * @param {Element} endTime
2098
+ * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
2099
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
2100
+ * @return {jQuery}
2101
+ */
2102
+ $.timepicker.dateRange = function (startTime, endTime, options) {
2103
+ $.timepicker.handleRange('datepicker', startTime, endTime, options);
2104
+ };
2105
+
2106
+ /**
2107
+ * Calls `method` on the `startTime` and `endTime` elements, and configures them to
2108
+ * enforce date range limits.
2109
+ * @param {string} method Can be used to specify the type of picker to be added
2110
+ * @param {Element} startTime
2111
+ * @param {Element} endTime
2112
+ * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
2113
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
2114
+ * @return {jQuery}
2115
+ */
2116
+ $.timepicker.handleRange = function (method, startTime, endTime, options) {
2117
+ options = $.extend({}, {
2118
+ minInterval: 0, // min allowed interval in milliseconds
2119
+ maxInterval: 0, // max allowed interval in milliseconds
2120
+ start: {}, // options for start picker
2121
+ end: {} // options for end picker
2122
+ }, options);
2123
+
2124
+ // for the mean time this fixes an issue with calling getDate with timepicker()
2125
+ var timeOnly = false;
2126
+ if(method === 'timepicker'){
2127
+ timeOnly = true;
2128
+ method = 'datetimepicker';
2129
+ }
2130
+
2131
+ function checkDates(changed, other) {
2132
+ var startdt = startTime[method]('getDate'),
2133
+ enddt = endTime[method]('getDate'),
2134
+ changeddt = changed[method]('getDate');
2135
+
2136
+ if (startdt !== null) {
2137
+ var minDate = new Date(startdt.getTime()),
2138
+ maxDate = new Date(startdt.getTime());
2139
+
2140
+ minDate.setMilliseconds(minDate.getMilliseconds() + options.minInterval);
2141
+ maxDate.setMilliseconds(maxDate.getMilliseconds() + options.maxInterval);
2142
+
2143
+ if (options.minInterval > 0 && minDate > enddt) { // minInterval check
2144
+ endTime[method]('setDate', minDate);
2145
+ }
2146
+ else if (options.maxInterval > 0 && maxDate < enddt) { // max interval check
2147
+ endTime[method]('setDate', maxDate);
2148
+ }
2149
+ else if (startdt > enddt) {
2150
+ other[method]('setDate', changeddt);
2151
+ }
2152
+ }
2153
+ }
2154
+
2155
+ function selected(changed, other, option) {
2156
+ if (!changed.val()) {
2157
+ return;
2158
+ }
2159
+ var date = changed[method].call(changed, 'getDate');
2160
+ if (date !== null && options.minInterval > 0) {
2161
+ if (option === 'minDate') {
2162
+ date.setMilliseconds(date.getMilliseconds() + options.minInterval);
2163
+ }
2164
+ if (option === 'maxDate') {
2165
+ date.setMilliseconds(date.getMilliseconds() - options.minInterval);
2166
+ }
2167
+ }
2168
+
2169
+ if (date.getTime) {
2170
+ other[method].call(other, 'option', option, date);
2171
+ }
2172
+ }
2173
+
2174
+ $.fn[method].call(startTime, $.extend({
2175
+ timeOnly: timeOnly,
2176
+ onClose: function (dateText, inst) {
2177
+ checkDates($(this), endTime);
2178
+ },
2179
+ onSelect: function (selectedDateTime) {
2180
+ selected($(this), endTime, 'minDate');
2181
+ }
2182
+ }, options, options.start));
2183
+ $.fn[method].call(endTime, $.extend({
2184
+ timeOnly: timeOnly,
2185
+ onClose: function (dateText, inst) {
2186
+ checkDates($(this), startTime);
2187
+ },
2188
+ onSelect: function (selectedDateTime) {
2189
+ selected($(this), startTime, 'maxDate');
2190
+ }
2191
+ }, options, options.end));
2192
+
2193
+ checkDates(startTime, endTime);
2194
+
2195
+ selected(startTime, endTime, 'minDate');
2196
+ selected(endTime, startTime, 'maxDate');
2197
+
2198
+ return $([startTime.get(0), endTime.get(0)]);
2199
+ };
2200
+
2201
+ /**
2202
+ * Log error or data to the console during error or debugging
2203
+ * @param {Object} err pass any type object to log to the console during error or debugging
2204
+ * @return {void}
2205
+ */
2206
+ $.timepicker.log = function () {
2207
+ if (window.console) {
2208
+ window.console.log.apply(window.console, Array.prototype.slice.call(arguments));
2209
+ }
2210
+ };
2211
+
2212
+ /*
2213
+ * Add util object to allow access to private methods for testability.
2214
+ */
2215
+ $.timepicker._util = {
2216
+ _extendRemove: extendRemove,
2217
+ _isEmptyObject: isEmptyObject,
2218
+ _convert24to12: convert24to12,
2219
+ _detectSupport: detectSupport,
2220
+ _selectLocalTimezone: selectLocalTimezone,
2221
+ _computeEffectiveSetting: computeEffectiveSetting,
2222
+ _splitDateTime: splitDateTime,
2223
+ _parseDateTimeInternal: parseDateTimeInternal
2224
+ };
2225
+
2226
+ /*
2227
+ * Microsecond support
2228
+ */
2229
+ if (!Date.prototype.getMicroseconds) {
2230
+ Date.prototype.microseconds = 0;
2231
+ Date.prototype.getMicroseconds = function () { return this.microseconds; };
2232
+ Date.prototype.setMicroseconds = function (m) {
2233
+ this.setMilliseconds(this.getMilliseconds() + Math.floor(m / 1000));
2234
+ this.microseconds = m % 1000;
2235
+ return this;
2236
+ };
2237
+ }
2238
+
2239
+ /*
2240
+ * Keep up with the version
2241
+ */
2242
+ $.timepicker.version = "1.5.2";
2243
+
2244
+ }));
js/ui-datepicker.js ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI Datepicker 1.8.16
3
+ *
4
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI/Datepicker
9
+ *
10
+ * Depends:
11
+ * jquery.ui.core.js
12
+ */
13
+ (function(d,C){function M(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=
14
+ "ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su",
15
+ "Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",
16
+ minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false,disabled:false};d.extend(this._defaults,this.regional[""]);this.dpDiv=N(d('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}function N(a){return a.bind("mouseout",
17
+ function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");b.length&&b.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");if(!(d.datepicker._isDisabledDatepicker(J.inline?a.parent()[0]:J.input[0])||!b.length)){b.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
18
+ b.addClass("ui-state-hover");b.hasClass("ui-datepicker-prev")&&b.addClass("ui-datepicker-prev-hover");b.hasClass("ui-datepicker-next")&&b.addClass("ui-datepicker-next-hover")}})}function H(a,b){d.extend(a,b);for(var c in b)if(b[c]==null||b[c]==C)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.16"}});var B=(new Date).getTime(),J;d.extend(M.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},
19
+ setDefaults:function(a){H(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=f}}}e=a.nodeName.toLowerCase();f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,
20
+ "\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:N(d('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",
21
+ function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b);b.settings.disabled&&this._disableDatepicker(a)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&&b.append.remove();if(c){b.append=d('<span class="'+this._appendClass+'">'+c+"</span>");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c==
22
+ "focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c=this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("<img/>").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('<button type="button"></button>').addClass(this._triggerClass).html(f==""?c:d("<img/>").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():
23
+ d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;g<f.length;g++)if(f[g].length>h){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,
24
+ b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b),true);this._updateDatepicker(b);this._updateAlternate(b);b.settings.disabled&&this._disableDatepicker(a);b.dpDiv.css("display","block")}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=
25
+ 1;this._dialogInput=d('<input type="text" id="'+("dp"+this.uuid)+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}H(a.settings,e||{});b=b&&b.constructor==Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/
26
+ 2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=
27
+ d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=
28
+ a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().removeClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=d(a),c=d.data(a,
29
+ "datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().addClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==
30
+ a?null:f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return true;return false},_getInst:function(a){try{return d.data(a,"datepicker")}catch(b){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(a,b,c){var e=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?d.extend({},d.datepicker._defaults):e?b=="all"?
31
+ d.extend({},e.settings):this._get(e,b):null;var f=b||{};if(typeof b=="string"){f={};f[b]=c}if(e){this._curInst==e&&this._hideDatepicker();var h=this._getDateDatepicker(a,true),i=this._getMinMaxDate(e,"min"),g=this._getMinMaxDate(e,"max");H(e.settings,f);if(i!==null&&f.dateFormat!==C&&f.minDate===C)e.settings.minDate=this._formatDate(e,i);if(g!==null&&f.dateFormat!==C&&f.maxDate===C)e.settings.maxDate=this._formatDate(e,g);this._attachments(d(a),e);this._autoSize(e);this._setDate(e,h);this._updateAlternate(e);
32
+ this._updateDatepicker(e)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){(a=this._getInst(a))&&this._updateDatepicker(a)},_setDateDatepicker:function(a,b){if(a=this._getInst(a)){this._setDate(a,b);this._updateDatepicker(a);this._updateAlternate(a)}},_getDateDatepicker:function(a,b){(a=this._getInst(a))&&!a.inline&&this._setDateFromField(a,b);return a?this._getDate(a):null},_doKeyDown:function(a){var b=d.datepicker._getInst(a.target),c=true,e=b.dpDiv.is(".ui-datepicker-rtl");
33
+ b._keyEvent=true;if(d.datepicker._datepickerShowing)switch(a.keyCode){case 9:d.datepicker._hideDatepicker();c=false;break;case 13:c=d("td."+d.datepicker._dayOverClass+":not(."+d.datepicker._currentClass+")",b.dpDiv);c[0]&&d.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,c[0]);if(a=d.datepicker._get(b,"onSelect")){c=d.datepicker._formatDate(b);a.apply(b.input?b.input[0]:null,[c,b])}else d.datepicker._hideDatepicker();return false;case 27:d.datepicker._hideDatepicker();break;case 33:d.datepicker._adjustDate(a.target,
34
+ a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 34:d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 35:if(a.ctrlKey||a.metaKey)d.datepicker._clearDate(a.target);c=a.ctrlKey||a.metaKey;break;case 36:if(a.ctrlKey||a.metaKey)d.datepicker._gotoToday(a.target);c=a.ctrlKey||a.metaKey;break;case 37:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?+1:-1,"D");c=
35
+ a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 38:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,-7,"D");c=a.ctrlKey||a.metaKey;break;case 39:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?-1:+1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,
36
+ "stepMonths"),"M");break;case 40:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,+7,"D");c=a.ctrlKey||a.metaKey;break;default:c=false}else if(a.keyCode==36&&a.ctrlKey)d.datepicker._showDatepicker(this);else c=false;if(c){a.preventDefault();a.stopPropagation()}},_doKeyPress:function(a){var b=d.datepicker._getInst(a.target);if(d.datepicker._get(b,"constrainInput")){b=d.datepicker._possibleChars(d.datepicker._get(b,"dateFormat"));var c=String.fromCharCode(a.charCode==C?a.keyCode:a.charCode);
37
+ return a.ctrlKey||a.metaKey||c<" "||!b||b.indexOf(c)>-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a);d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||a;if(a.nodeName.toLowerCase()!="input")a=d("input",
38
+ a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);if(d.datepicker._curInst&&d.datepicker._curInst!=b){d.datepicker._datepickerShowing&&d.datepicker._triggerOnClose(d.datepicker._curInst);d.datepicker._curInst.dpDiv.stop(true,true)}var c=d.datepicker._get(b,"beforeShow");c=c?c.apply(a,[a,b]):{};if(c!==false){H(b.settings,c);b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value=
39
+ "";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c={left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.empty();b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);
40
+ c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");var f=d.datepicker._get(b,"duration"),h=function(){var i=b.dpDiv.find("iframe.ui-datepicker-cover");if(i.length){var g=d.datepicker._getBorders(b.dpDiv);i.css({left:-g[0],top:-g[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex(d(a).zIndex()+1);d.datepicker._datepickerShowing=
41
+ true;d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=b}}}},_updateDatepicker:function(a){this.maxRows=4;var b=d.datepicker._getBorders(a.dpDiv);J=a;a.dpDiv.empty().append(this._generateHTML(a));var c=a.dpDiv.find("iframe.ui-datepicker-cover");c.length&&c.css({left:-b[0],top:-b[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()});
42
+ a.dpDiv.find("."+this._dayOverClass+" a").mouseover();b=this._getNumberOfMonths(a);c=b[1];a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");c>1&&a.dpDiv.addClass("ui-datepicker-multi-"+c).css("width",17*c+"em");a.dpDiv[(b[0]!=1||b[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&
43
+ !a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var e=a.yearshtml;setTimeout(function(){e===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);e=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]||c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),
44
+ h=a.input?a.input.outerWidth():0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),j=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>j&&j>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=
45
+ this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1||d.expr.filters.hidden(a));)a=a[b?"previousSibling":"nextSibling"];a=d(a).offset();return[a.left,a.top]},_triggerOnClose:function(a){var b=this._get(a,"onClose");if(b)b.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a])},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);
46
+ this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?c:null,e);a||e();d.datepicker._triggerOnClose(b);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},
47
+ _checkExternalClick:function(a){if(d.datepicker._curInst){a=d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):
48
+ 0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e["selected"+(c=="M"?
49
+ "Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth=b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=d(a);
50
+ this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a);a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker();this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField");
51
+ if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a));d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?
52
+ b.toString():b+"";if(b=="")return null;var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;e=typeof e!="string"?e:(new Date).getFullYear()%100+parseInt(e,10);for(var f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,j=c=-1,l=-1,u=-1,k=false,o=function(p){(p=A+1<a.length&&a.charAt(A+1)==p)&&A++;return p},m=function(p){var D=
53
+ o(p);p=new RegExp("^\\d{1,"+(p=="@"?14:p=="!"?20:p=="y"&&D?4:p=="o"?3:2)+"}");p=b.substring(q).match(p);if(!p)throw"Missing number at position "+q;q+=p[0].length;return parseInt(p[0],10)},n=function(p,D,K){p=d.map(o(p)?K:D,function(w,x){return[[x,w]]}).sort(function(w,x){return-(w[1].length-x[1].length)});var E=-1;d.each(p,function(w,x){w=x[1];if(b.substr(q,w.length).toLowerCase()==w.toLowerCase()){E=x[0];q+=w.length;return false}});if(E!=-1)return E+1;else throw"Unknown name at position "+q;},s=
54
+ function(){if(b.charAt(q)!=a.charAt(A))throw"Unexpected literal at position "+q;q++},q=0,A=0;A<a.length;A++)if(k)if(a.charAt(A)=="'"&&!o("'"))k=false;else s();else switch(a.charAt(A)){case "d":l=m("d");break;case "D":n("D",f,h);break;case "o":u=m("o");break;case "m":j=m("m");break;case "M":j=n("M",i,g);break;case "y":c=m("y");break;case "@":var v=new Date(m("@"));c=v.getFullYear();j=v.getMonth()+1;l=v.getDate();break;case "!":v=new Date((m("!")-this._ticksTo1970)/1E4);c=v.getFullYear();j=v.getMonth()+
55
+ 1;l=v.getDate();break;case "'":if(o("'"))s();else k=true;break;default:s()}if(q<b.length)throw"Extra/unparsed characters found in date: "+b.substring(q);if(c==-1)c=(new Date).getFullYear();else if(c<100)c+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c<=e?0:-100);if(u>-1){j=1;l=u;do{e=this._getDaysInMonth(c,j-1);if(l<=e)break;j++;l-=e}while(1)}v=this._daylightSavingAdjust(new Date(c,j-1,l));if(v.getFullYear()!=c||v.getMonth()+1!=j||v.getDate()!=l)throw"Invalid date";return v},ATOM:"yy-mm-dd",
56
+ COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:
57
+ null)||this._defaults.monthNames;var i=function(o){(o=k+1<a.length&&a.charAt(k+1)==o)&&k++;return o},g=function(o,m,n){m=""+m;if(i(o))for(;m.length<n;)m="0"+m;return m},j=function(o,m,n,s){return i(o)?s[m]:n[m]},l="",u=false;if(b)for(var k=0;k<a.length;k++)if(u)if(a.charAt(k)=="'"&&!i("'"))u=false;else l+=a.charAt(k);else switch(a.charAt(k)){case "d":l+=g("d",b.getDate(),2);break;case "D":l+=j("D",b.getDay(),e,f);break;case "o":l+=g("o",Math.round(((new Date(b.getFullYear(),b.getMonth(),b.getDate())).getTime()-
58
+ (new Date(b.getFullYear(),0,0)).getTime())/864E5),3);break;case "m":l+=g("m",b.getMonth()+1,2);break;case "M":l+=j("M",b.getMonth(),h,c);break;case "y":l+=i("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case "@":l+=b.getTime();break;case "!":l+=b.getTime()*1E4+this._ticksTo1970;break;case "'":if(i("'"))l+="'";else u=true;break;default:l+=a.charAt(k)}return l},_possibleChars:function(a){for(var b="",c=false,e=function(h){(h=f+1<a.length&&a.charAt(f+1)==h)&&f++;return h},f=
59
+ 0;f<a.length;f++)if(c)if(a.charAt(f)=="'"&&!e("'"))c=false;else b+=a.charAt(f);else switch(a.charAt(f)){case "d":case "m":case "y":case "@":b+="0123456789";break;case "D":case "M":return null;case "'":if(e("'"))b+="'";else c=true;break;default:b+=a.charAt(f)}return b},_get:function(a,b){return a.settings[b]!==C?a.settings[b]:this._defaults[b]},_setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var c=this._get(a,"dateFormat"),e=a.lastVal=a.input?a.input.val():null,f,h;f=h=this._getDefaultDate(a);
60
+ var i=this._getFormatConfig(a);try{f=this.parseDate(c,e,i)||h}catch(g){this.log(g);e=b?"":e}a.selectedDay=f.getDate();a.drawMonth=a.selectedMonth=f.getMonth();a.drawYear=a.selectedYear=f.getFullYear();a.currentDay=e?f.getDate():0;a.currentMonth=e?f.getMonth():0;a.currentYear=e?f.getFullYear():0;this._adjustInstDate(a)}},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,c){var e=function(h){var i=new Date;
61
+ i.setDate(i.getDate()+h);return i},f=function(h){try{return d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),h,d.datepicker._getFormatConfig(a))}catch(i){}var g=(h.toLowerCase().match(/^c/)?d.datepicker._getDate(a):null)||new Date,j=g.getFullYear(),l=g.getMonth();g=g.getDate();for(var u=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,k=u.exec(h);k;){switch(k[2]||"d"){case "d":case "D":g+=parseInt(k[1],10);break;case "w":case "W":g+=parseInt(k[1],10)*7;break;case "m":case "M":l+=parseInt(k[1],10);g=
62
+ Math.min(g,d.datepicker._getDaysInMonth(j,l));break;case "y":case "Y":j+=parseInt(k[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(j,l));break}k=u.exec(h)}return new Date(j,l,g)};if(b=(b=b==null||b===""?c:typeof b=="string"?f(b):typeof b=="number"?isNaN(b)?c:e(b):new Date(b.getTime()))&&b.toString()=="Invalid Date"?c:b){b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0)}return this._daylightSavingAdjust(b)},_daylightSavingAdjust:function(a){if(!a)return null;a.setHours(a.getHours()>
63
+ 12?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&
64
+ a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),j=this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?
65
+ new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),k=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n=this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=k&&n<k?k:n;this._daylightSavingAdjust(new Date(m,g,1))>n;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-j,1)),this._getFormatConfig(a));
66
+ n=this._canAdjustMonth(a,-1,m,g)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+B+".datepicker._adjustDate('#"+a.id+"', -"+j+", 'M');\" title=\""+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>":f?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>";var s=this._get(a,"nextText");s=!h?s:this.formatDate(s,this._daylightSavingAdjust(new Date(m,
67
+ g+j,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+B+".datepicker._adjustDate('#"+a.id+"', +"+j+", 'M');\" title=\""+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>":f?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>";j=this._get(a,"currentText");s=this._get(a,"gotoCurrent")&&
68
+ a.currentDay?u:b;j=!h?j:this.formatDate(j,s,this._getFormatConfig(a));h=!a.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+B+'.datepicker._hideDatepicker();">'+this._get(a,"closeText")+"</button>":"";e=e?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?h:"")+(this._isInRange(a,s)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+
69
+ B+".datepicker._gotoToday('#"+a.id+"');\">"+j+"</button>":"")+(c?"":h)+"</div>":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;j=this._get(a,"showWeek");s=this._get(a,"dayNames");this._get(a,"dayNamesShort");var q=this._get(a,"dayNamesMin"),A=this._get(a,"monthNames"),v=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),D=this._get(a,"showOtherMonths"),K=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var E=this._getDefaultDate(a),w="",x=0;x<i[0];x++){var O=
70
+ "";this.maxRows=4;for(var G=0;G<i[1];G++){var P=this._daylightSavingAdjust(new Date(m,g,a.selectedDay)),t=" ui-corner-all",y="";if(l){y+='<div class="ui-datepicker-group';if(i[1]>1)switch(G){case 0:y+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right":"left");break;case i[1]-1:y+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:y+=" ui-datepicker-group-middle";t="";break}y+='">'}y+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+t+'">'+(/all|left/.test(t)&&
71
+ x==0?c?f:n:"")+(/all|right/.test(t)&&x==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,k,o,x>0||G>0,A,v)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var z=j?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(t=0;t<7;t++){var r=(t+h)%7;z+="<th"+((t+h+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+s[r]+'">'+q[r]+"</span></th>"}y+=z+"</tr></thead><tbody>";z=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,
72
+ z);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;z=Math.ceil((t+z)/7);this.maxRows=z=l?this.maxRows>z?this.maxRows:z:z;r=this._daylightSavingAdjust(new Date(m,g,1-t));for(var Q=0;Q<z;Q++){y+="<tr>";var R=!j?"":'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(r)+"</td>";for(t=0;t<7;t++){var I=p?p.apply(a.input?a.input[0]:null,[r]):[true,""],F=r.getMonth()!=g,L=F&&!K||!I[0]||k&&r<k||o&&r>o;R+='<td class="'+((t+h+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(r.getTime()==
73
+ P.getTime()&&g==a.selectedMonth&&a._keyEvent||E.getTime()==r.getTime()&&E.getTime()==P.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!D?"":" "+I[1]+(r.getTime()==u.getTime()?" "+this._currentClass:"")+(r.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!F||D)&&I[2]?' title="'+I[2]+'"':"")+(L?"":' onclick="DP_jQuery_'+B+".datepicker._selectDay('#"+a.id+"',"+r.getMonth()+","+r.getFullYear()+', this);return false;"')+">"+(F&&!D?"&#xa0;":L?'<span class="ui-state-default">'+
74
+ r.getDate()+"</span>":'<a class="ui-state-default'+(r.getTime()==b.getTime()?" ui-state-highlight":"")+(r.getTime()==u.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+'" href="#">'+r.getDate()+"</a>")+"</td>";r.setDate(r.getDate()+1);r=this._daylightSavingAdjust(r)}y+=R+"</tr>"}g++;if(g>11){g=0;m++}y+="</tbody></table>"+(l?"</div>"+(i[0]>0&&G==i[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");O+=y}w+=O}w+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':
75
+ "");a._keyEvent=false;return w},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='<div class="ui-datepicker-title">',o="";if(h||!j)o+='<span class="ui-datepicker-month">'+i[b]+"</span>";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+B+".datepicker._selectMonthYear('#"+a.id+"', this, 'M');\" >";for(var n=0;n<12;n++)if((!i||n>=e.getMonth())&&
76
+ (!m||n<=f.getMonth()))o+='<option value="'+n+'"'+(n==b?' selected="selected"':"")+">"+g[n]+"</option>";o+="</select>"}u||(k+=o+(h||!(j&&l)?"&#xa0;":""));if(!a.yearshtml){a.yearshtml="";if(h||!l)k+='<span class="ui-datepicker-year">'+c+"</span>";else{g=this._get(a,"yearRange").split(":");var s=(new Date).getFullYear();i=function(q){q=q.match(/c[+-].*/)?c+parseInt(q.substring(1),10):q.match(/[+-].*/)?s+parseInt(q,10):parseInt(q,10);return isNaN(q)?s:q};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b,
77
+ e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(a.yearshtml+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+B+".datepicker._selectMonthYear('#"+a.id+"', this, 'Y');\" >";b<=g;b++)a.yearshtml+='<option value="'+b+'"'+(b==c?' selected="selected"':"")+">"+b+"</option>";a.yearshtml+="</select>";k+=a.yearshtml;a.yearshtml=null}}k+=this._get(a,"yearSuffix");if(u)k+=(h||!(j&&l)?"&#xa0;":"")+o;k+="</div>";return k},_adjustInstDate:function(a,b,c){var e=a.drawYear+(c=="Y"?b:0),f=a.drawMonth+
78
+ (c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&b<c?c:b;return b=a&&b>a?a:b},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");if(b)b.apply(a.input?
79
+ a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a);c=this._daylightSavingAdjust(new Date(c,
80
+ e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,
81
+ "dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker=function(a){if(!this.length)return this;
82
+ if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));return this.each(function(){typeof a==
83
+ "string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new M;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.16";window["DP_jQuery_"+B]=d})(jQuery);
84
+ ;
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
+
license.txt ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
+ 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
6
+
7
+ Everyone is permitted to copy and distribute verbatim copies
8
+ of this license document, but changing it is not allowed.
9
+
10
+ Preamble
11
+
12
+ The licenses for most software are designed to take away your
13
+ freedom to share and change it. By contrast, the GNU General Public
14
+ License is intended to guarantee your freedom to share and change free
15
+ software--to make sure the software is free for all its users. This
16
+ General Public License applies to most of the Free Software
17
+ Foundation's software and to any other program whose authors commit to
18
+ using it. (Some other Free Software Foundation software is covered by
19
+ the GNU Library General Public License instead.) You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ this service if you wish), that you receive source code or can get it
26
+ if you want it, that you can change the software or use pieces of it
27
+ in new free programs; and that you know you can do these things.
28
+
29
+ To protect your rights, we need to make restrictions that forbid
30
+ anyone to deny you these rights or to ask you to surrender the rights.
31
+ These restrictions translate to certain responsibilities for you if you
32
+ distribute copies of the software, or if you modify it.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must give the recipients all the rights that
36
+ you have. You must make sure that they, too, receive or can get the
37
+ source code. And you must show them these terms so they know their
38
+ rights.
39
+
40
+ We protect your rights with two steps: (1) copyright the software, and
41
+ (2) offer you this license which gives you legal permission to copy,
42
+ distribute and/or modify the software.
43
+
44
+ Also, for each author's protection and ours, we want to make certain
45
+ that everyone understands that there is no warranty for this free
46
+ software. If the software is modified by someone else and passed on, we
47
+ want its recipients to know that what they have is not the original, so
48
+ that any problems introduced by others will not reflect on the original
49
+ authors' reputations.
50
+
51
+ Finally, any free program is threatened constantly by software
52
+ patents. We wish to avoid the danger that redistributors of a free
53
+ program will individually obtain patent licenses, in effect making the
54
+ program proprietary. To prevent this, we have made it clear that any
55
+ patent must be licensed for everyone's free use or not licensed at all.
56
+
57
+ The precise terms and conditions for copying, distribution and
58
+ modification follow.
59
+
60
+ GNU GENERAL PUBLIC LICENSE
61
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
62
+
63
+ 0. This License applies to any program or other work which contains
64
+ a notice placed by the copyright holder saying it may be distributed
65
+ under the terms of this General Public License. The "Program", below,
66
+ refers to any such program or work, and a "work based on the Program"
67
+ means either the Program or any derivative work under copyright law:
68
+ that is to say, a work containing the Program or a portion of it,
69
+ either verbatim or with modifications and/or translated into another
70
+ language. (Hereinafter, translation is included without limitation in
71
+ the term "modification".) Each licensee is addressed as "you".
72
+
73
+ Activities other than copying, distribution and modification are not
74
+ covered by this License; they are outside its scope. The act of
75
+ running the Program is not restricted, and the output from the Program
76
+ is covered only if its contents constitute a work based on the
77
+ Program (independent of having been made by running the Program).
78
+ Whether that is true depends on what the Program does.
79
+
80
+ 1. You may copy and distribute verbatim copies of the Program's
81
+ source code as you receive it, in any medium, provided that you
82
+ conspicuously and appropriately publish on each copy an appropriate
83
+ copyright notice and disclaimer of warranty; keep intact all the
84
+ notices that refer to this License and to the absence of any warranty;
85
+ and give any other recipients of the Program a copy of this License
86
+ along with the Program.
87
+
88
+ You may charge a fee for the physical act of transferring a copy, and
89
+ you may at your option offer warranty protection in exchange for a fee.
90
+
91
+ 2. You may modify your copy or copies of the Program or any portion
92
+ of it, thus forming a work based on the Program, and copy and
93
+ distribute such modifications or work under the terms of Section 1
94
+ above, provided that you also meet all of these conditions:
95
+
96
+ a) You must cause the modified files to carry prominent notices
97
+ stating that you changed the files and the date of any change.
98
+
99
+ b) You must cause any work that you distribute or publish, that in
100
+ whole or in part contains or is derived from the Program or any
101
+ part thereof, to be licensed as a whole at no charge to all third
102
+ parties under the terms of this License.
103
+
104
+ c) If the modified program normally reads commands interactively
105
+ when run, you must cause it, when started running for such
106
+ interactive use in the most ordinary way, to print or display an
107
+ announcement including an appropriate copyright notice and a
108
+ notice that there is no warranty (or else, saying that you provide
109
+ a warranty) and that users may redistribute the program under
110
+ these conditions, and telling the user how to view a copy of this
111
+ License. (Exception: if the Program itself is interactive but
112
+ does not normally print such an announcement, your work based on
113
+ the Program is not required to print an announcement.)
114
+
115
+ These requirements apply to the modified work as a whole. If
116
+ identifiable sections of that work are not derived from the Program,
117
+ and can be reasonably considered independent and separate works in
118
+ themselves, then this License, and its terms, do not apply to those
119
+ sections when you distribute them as separate works. But when you
120
+ distribute the same sections as part of a whole which is a work based
121
+ on the Program, the distribution of the whole must be on the terms of
122
+ this License, whose permissions for other licensees extend to the
123
+ entire whole, and thus to each and every part regardless of who wrote it.
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
readme.txt ADDED
@@ -0,0 +1,607 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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, xlsx, excel, customers, products, sales, orders, coupons, users, attributes, subscriptions
6
+ Requires at least: 2.9.2
7
+ Tested up to: 4.4.2
8
+ Stable tag: 1.8.4
9
+
10
+ Export store details out of WooCommerce into simple formatted files (e.g. CSV, XML, Excel 2007 XLS, etc.).
11
+
12
+ == Description ==
13
+
14
+ 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.
15
+
16
+ Store Exporter maintains compatibility with the latest WooCommerce updates receiving regular feature updates trusted by 20,000+ active users. Happy exporting!
17
+
18
+ = Features =
19
+
20
+ Features include:
21
+
22
+ * Export Products (*)
23
+ * Export Products by Product Category
24
+ * Export Products by Product Status
25
+ * Export Products by Type including Variations
26
+ * Export Categories
27
+ * Export Tags
28
+ * Export Brands (*)
29
+ * Export Orders (*)
30
+ * Export Orders by Order Status (*)
31
+ * Export Orders by Order Date (*)
32
+ * Export Orders by Customers (*)
33
+ * Export Orders by Coupon Code (*)
34
+ * Export Customers (*)
35
+ * Export Customers by Order Status (*)
36
+ * Export Users
37
+ * Export Coupons (*)
38
+ * Export Subscriptions (*)
39
+ * Export Commissions (*)
40
+ * Export Product Vendors (*)
41
+ * Export Shipping Classes (*)
42
+ * Export Attributes (*)
43
+ * Toggle and save export fields
44
+ * Field label editor (*)
45
+ * Works with WordPress Multisite
46
+ * Export to CSV file
47
+ * Export to XML file (*)
48
+ * Export to Excel 2007 (XLS) file (*)
49
+ * Export to Excel 2013 (XLSX) file (*)
50
+ * Export to WordPress Media
51
+ * Export to e-mail addresses (*)
52
+ * Export to remote POST (*)
53
+ * Export to remote FTP (*)
54
+ * Supports external CRON commands (*)
55
+ * Supports scheduled exports (*)
56
+
57
+ (*) Requires the Pro upgrade to enable additional store export functionality.
58
+
59
+ > ** Go Pro **
60
+ >
61
+ > Unlock the business focused e-commerce features within Store Exporter such as scheduled exporting from [this link](http://www.visser.com.au/plugins/store-exporter-deluxe/).
62
+ >
63
+ > 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/).
64
+
65
+ = Native integration with 45+ WooCommerce Plugins =
66
+
67
+ Just a few of the features unlocked in the Pro upgrade of Store Exporter include:
68
+
69
+ - Export All in One SEO Pack
70
+ - Export Advanced Google Product Feed
71
+ - Export Product Addons
72
+ - Export Sequential Order Number Pro
73
+ - Export Checkout Manager
74
+ - Export Checkout Manager Pro
75
+ - Export Checkout Field Editor
76
+ - Export Cost of Goods
77
+ - Export Per-Product Shipping
78
+ - Export Print Invoice & Delivery Note
79
+ - Export Local Pickups Plus
80
+ - Export WooCommerce Subscriptions
81
+ - Export Checkout Field Manager
82
+ - Export Currency Switcher
83
+ - Export WooCommerce PDF Invoices & Packing Slips
84
+ - Export WooCommerce Checkout Add-ons
85
+ - Export Product Vendors
86
+ - Export WooCommerce Jetpack
87
+ - Import fields for Product Importer Deluxe
88
+
89
+ ... and more free and Premium extensions for WooCommerce.
90
+
91
+ For more information visit: http://www.visser.com.au/woocommerce/
92
+
93
+ == Installation ==
94
+
95
+ 1. Upload the folder 'woocommerce-exporter' to the '/wp-content/plugins/' directory
96
+ 2. Activate 'WooCommerce - Store Exporter' through the 'Plugins' menu in WordPress
97
+
98
+ See Usage section before for instructions on how to generate export files.
99
+
100
+ == Usage ==
101
+
102
+ 1. Open WooCommerce > Store Export from the WordPress Administration
103
+ 2. Select the Export tab on the Store Exporter screen
104
+ 3. Select which export type and WooCommerce details you would like to export
105
+ 4. Click Export
106
+ 5. Download archived copies of previous exports from the Archives tab
107
+
108
+ Done!
109
+
110
+ == Support ==
111
+
112
+ If you have any problems, questions or suggestions please join the members discussion on our WooCommerce dedicated forum.
113
+
114
+ http://www.visser.com.au/woocommerce/forums/
115
+
116
+ == Screenshots ==
117
+
118
+ 1. The overview screen for Store Exporter.
119
+ 2. Select the data fields to be included in the export, selections are remembered for next export.
120
+ 3. Each dataset (e.g. Products, Orders, etc.) include filter options to filter by date, status, type, customer and more.
121
+ 4. A range of export options can be adjusted to suit different languages and file formatting requirements.
122
+ 5. Export a list of WooCommerce Product Categories into a CSV file.
123
+ 6. Export a list of WooCommerce Product Tags into a CSV file.
124
+ 7. Download archived copies of previous exports
125
+ 8. Use the Field Editor to relabel export fields to your preferred names
126
+ 9. Drag-and-drop export fields to your preferred ordering, sorting is saved between screen refreshes.
127
+
128
+ == Changelog ==
129
+
130
+ = 1.8.4 =
131
+ * Fixed: Privilege escalation vulnerability (thanks jamesgol)
132
+
133
+ = 1.8.3 =
134
+ * Added: Notice when fatal error is encountered from memory/timeout
135
+ * Fixed: Default to Attribute Name if Label is empty
136
+ * Fixed: Export Product Attributes in Product export
137
+ * Added: Support for custom Attributes in Product export
138
+ * Added: Default Attributes to Product export
139
+ * Fixed: Attribute taxonomy missing from Order Items: Product Variation in WC 2.2+
140
+ * Added: Support for Ship to Multiple Address for Order export
141
+ * Fixed: Variables not being included in Product export when filtering by Categories/Tags/Brands/Vendors
142
+ * Added: Delete All archives button to Archives screen
143
+
144
+ = 1.8.2 =
145
+ * Added: Order support for Extra Product Options
146
+ * Fixed: Detect corrupted Date Format
147
+ * Added: Detection of corrupted WordPress options at export time
148
+ * Added: Total Sales to Products export
149
+ * Fixed: Advanced Google Product Feed not being included in Products export
150
+ * Added: Custom User meta to Customers export
151
+ * Added: Support for exporting Shipping Classes
152
+ * Changed: Product URL is now External URL
153
+ * Added: Product URL is the absolute URL to the Product
154
+ * Added: Support for custom User fields
155
+ * Fixed: Admin notice not showing for saving custom fields
156
+
157
+ = 1.8.1 =
158
+ * Adeded: Export modules to the Export screen
159
+
160
+ = 1.8 =
161
+ * Fixed: Up-sells formatting not saving between screen refreshes
162
+ * Fixed: Cross-sells formatting not saving between screen refreshes
163
+ * Fixed: PHP 5.2 compatibility for anonymous functions
164
+ * Added: Admin notice for PHP 5.2 users to update to supported releases of PHP
165
+
166
+ = 1.7.9 =
167
+ * Changed: Moved Up-sells formatting option to products.php
168
+ * Changed: Moved Cross-sells formatting option to products.php
169
+
170
+ = 1.7.8 =
171
+ * Added: Gravity Form ID to Orders export
172
+ * Added: Gravity Form Name to Orders export
173
+ * Added: Support for changing the export format of scheduled exports
174
+ * Fixed: Display of multiple queued Admin notices
175
+ * Fixed: PHP warning on Subscriptions export
176
+ * Fixed: Attributes showing Term Slug in Products export
177
+ * Fixed: Attributes not including Taxonomy based Terms in Products export
178
+ * Fixed: Empty export rows under certain environments in Products export
179
+ * Added: Support for filtering Orders by Order Dates for scheduled exports
180
+ * Fixed: Compatibility with WooCommerce 2.2+
181
+ * Changed: Moved Brands sorting to brands.php
182
+
183
+ = 1.7.7 =
184
+ * Added: Support for WooCommerce Checkout Add-ons in Orders export
185
+ * Fixed: Saving Export filename option over-sanitized
186
+
187
+ = 1.7.6 =
188
+ * Fixed: Limit volume for Users export
189
+ * Fixed: Offset for Users export
190
+ * Fixed: Sanitize form fields
191
+ * Fixed: Data validation on outputs
192
+ * Fixed: Saving of Order in Users export
193
+ * Fixed: Saving of Order By in Users export
194
+ * Fixed: Count of Customers for large store catalogues
195
+
196
+ = 1.7.5 =
197
+ * Fixed: Custom Product meta not working
198
+ * Changed: Moved Product Gallery support to Pro
199
+ * Changed: Moved Default e-mail recipient to General Settings
200
+ * Changed: Moved Default remote URL POST to General Settings
201
+ * Added: Export Users type in basic Store Exporter
202
+ * Fixed: Add missing WordPress options for Plugin if not present on activation
203
+
204
+ = 1.7.4 =
205
+ * Added: Subscriptions export type
206
+ * Added: Support for Subscription Key in Subscriptions export
207
+ * Added: Support for Subscription Status in Subscriptions export
208
+ * Added: Support for Subscription Name in Subscriptions export
209
+ * Added: Support for User in Subscriptions export
210
+ * Added: Support for User ID in Subscriptions export
211
+ * Added: Support for Order ID in Subscriptions export
212
+ * Added: Support for Order Status in Subscriptions export
213
+ * Added: Support for Post Status in Subscriptions export
214
+ * Added: Support for Start Date in Subscriptions export
215
+ * Added: Support for Expiration in Subscriptions export
216
+ * Added: Support for End Date in Subscriptions export
217
+ * Added: Support for Trial End Date in Subscriptions export
218
+ * Added: Support for Last Payment in Subscriptions export
219
+ * Added: Support for Next Payment in Subscriptions export
220
+ * Added: Support for Renewals in Subscriptions export
221
+ * Added: Support for Product ID in Subscriptions export
222
+ * Added: Support for Product SKU in Subscriptions export
223
+ * Added: Support for Variation ID in Subscriptions export
224
+ * Added: Support for Coupon Code in Subscription export
225
+ * Added: Support for Limit Volume in Subscription export
226
+
227
+ = 1.7.3 =
228
+ * Added: Export type is remembered between screen refreshes
229
+ * Changed: Moved Product Sorting widget to products.php
230
+ * Changed: Moved Filter Products by Product Category widget to products.php
231
+ * Changed: Moved Filter Products by Product Tag widget to products.php
232
+ * Changed: Moved Filter Products by Product Status widget to products.php
233
+
234
+ = 1.7.2 =
235
+ * Fixed: Check for wc_format_localized_price() in older releases of WooCommerce
236
+ * Added: Brands export type
237
+ * Added: Support for Brand Name in Brands export
238
+ * Added: Support for Brand Description in Brands export
239
+ * Added: Support for Brand Slug in Brands export
240
+ * Added: Support for Parent ID in Brands export
241
+ * Added: Support for Brand Image in Brands export
242
+ * Added: Support for sorting options in Brands export
243
+ * Fixed: Added checks for 3rd party classes and legacy WooCommerce functions for 2.0.20
244
+ * Added: Support for Category Description in Categories export
245
+ * Added: Support for Category Image in Categories export
246
+ * Added: Support for Display Type in Categories export
247
+
248
+ = 1.7.1 =
249
+ * Added: Brands support to Orders export
250
+ * Added: Brands support for Order Items in Orders export
251
+ * Fixed: PHP warning notice in Orders export
252
+ * Added: Option to filter different Order Items types from Orders export
253
+
254
+ = 1.7 =
255
+ * Added: Rename of export files across Plugin
256
+ * Added: Coupon Code to Orders export
257
+ * Added: Export Users
258
+ * Added: Support for User ID in Users export
259
+ * Added: Support for Username in Users export
260
+ * Added: Support for User Role in Users export
261
+ * Added: Support for First Name in Users export
262
+ * Added: Support for Last Name in Users export
263
+ * Added: Support for Full Name in Users export
264
+ * Added: Support for Nickname in Users export
265
+ * Added: Support for E-mail in Users export
266
+ * Added: Support for Website in Users export
267
+ * Added: Support for Date Registered in Users export
268
+ * Added: Support for WooCommerce User Profile fields in Users export
269
+ * Added: Product Gallery formatting support includes Media URL
270
+ * Added: Sorting support for Users export
271
+ * Added: Sorting options for Coupons
272
+ * Added: Filter Orders by Coupon Codes
273
+
274
+ = 1.6.2 =
275
+ * Added: MSRP Pricing support for Products
276
+ * Added: WooCommerce Print Invoice & Delivery Note Invoice Number support for Orders
277
+ * Added: WooCommerce Sequential Order Numbers (free) support for Orders
278
+ * Changed: Get 3rd Party Plugin support from woo_ce_product_fields filter
279
+ * Changed: Preparations for sortable export column
280
+ * Fixed: URL to Add New export button after empty export
281
+ * Added: jQuery checks for functions before running
282
+ * Fixed: Conflicts with other WooCommerce Plugins due to shared 'save' form action
283
+ * Fixed: Support for WooCommerce Checkout Manager (Free!)
284
+ * Added: Support for WooCommerce Checkout Manager Pro
285
+ * Added: Support for Currency Switcher in Orders export
286
+ * Added: Support for Checkout Field Editor
287
+
288
+ = 1.6.1 =
289
+ * Fixed: Empty exports
290
+ * Changed: Better detection of empty exports
291
+ * Changed: Better detection of empty data types
292
+ * Added: Customer Filter to Export screen
293
+ * Added: Filter Customers by Order Status option
294
+ * Added: Using is_wp_error() throughout CPT and Term requests
295
+
296
+ = 1.6 =
297
+ * Fixed: Coupon export as XML
298
+ * Fixed: Order export as XML
299
+ * Fixed: Customer export as XML
300
+ * Fixed: Compatibility with WordPress 3.9.1
301
+ * Added: Product export support for Advanced Google Product Feed
302
+ * Added: Product export support for All in One SEO Pack
303
+ * Added: Product export support for WordPress SEO
304
+ * Added: Product export support for Ultimate SEO
305
+ * Fixed: Fatal error affecting CRON export for XML export
306
+ * Fixed: Remember column options after exporting Orders
307
+
308
+ = 1.5.9 =
309
+ * Fixed: Clearing the Limit Volume or Offset values would not be saved
310
+ * Fixed: Force file extension if removed from the Filename option on Settings screen
311
+ * Changed: Reduced memory load by storing $args in $export global
312
+
313
+ = 1.5.8 =
314
+ * Fixed: Fatal error if Store Exporter is not activated
315
+
316
+ = 1.5.7 =
317
+ * Changed: Replaced woo_ce_save_csv_file_attachment() with generic woo_ce_save_file_attachment()
318
+ * Changed: Replaced woo_ce_save_csv_file_guid() with generic woo_ce_save_file_guid()
319
+ * Changed: Replaced woo_ce_save_csv_file_details() with generic woo_ce_save_file_details()
320
+ * Changed: Replaced woo_ce_update_csv_file_detail() with generic woo_ce_update_file_detail()
321
+ * Changed: Moved woo_ce_save_file_details() into common Plugin space
322
+ * Changed: Added third allow_empty property to custom get_option()
323
+
324
+ = 1.5.6 =
325
+ * Added: Disabled support for XML Export Format under Export Option
326
+ * Changed: Created new functions-csv.php file
327
+ * Changed: Moved woo_ce_generate_csv_filename() to functions-csv.php
328
+ * Changed: Moved woo_ce_generate_csv_header() to functions-csv.php
329
+
330
+ = 1.5.5 =
331
+ * Fixed: Export error prompt displaying due to WordPress transient
332
+
333
+ = 1.5.4 =
334
+ * Changed: Removed WooCommere Plugins dashboard widget
335
+ * Added: CSS class to Custom Product Fields
336
+ * Fixed: Broken export checks that may affect export options
337
+
338
+ = 1.5.3 =
339
+ * Added: Support for exporting Local Pickup Plus fields in Orders
340
+ * Fixed: Memory leak in woo_ce_expand_state_name
341
+ * Fixed: Memory leak in woo_ce_expand_country_name
342
+ * Changed: Removed duplicate Order Items: Type field
343
+ * Added: Disabled Custom Order Fields widget to Export screen
344
+ * Changed: Using WP_Query instead of get_posts for bulk export
345
+ * Changed: Cross-Sells and Up-Sells get their own formatting functions
346
+ * Changed: Moved export function into common space for CRON and scheduled exports
347
+ * Added: Toggle visibility of each export types fields within Export Options
348
+
349
+ = 1.5.2 =
350
+ * Added: Option for Up-Sells to export Product SKU instead of Product ID
351
+ * Added: Option for Cross-Sells to export Product SKU instead of Product ID
352
+ * Changed: Toggle visibility of dataset relevant export options
353
+ * Changed: Moved Field delimiter option to Settings tab
354
+ * Changed: Moved Category separator option to Settings tab
355
+ * Changed: Moved Add BOM character option to Settings tab
356
+ * Changed: Moved Character encoding option to Settings tab
357
+ * Changed: Moved Field escape formatting option to Settings tab
358
+ * Changed: Moved Order Item Formatting option to Export Options widget
359
+ * Changed: Combined Volume offset and Limit volume
360
+ * Added: Skip Overview screen option to Overview screen
361
+
362
+ = 1.5.1 =
363
+ * Fixed: CSV File not being displayed on Media screen
364
+ * Added: Download Type support to Products export
365
+ * Fixed: File Download support for WooCommerce 2.0+
366
+ * Changed: Legacy support for File Download export support in pre-WooCommerce 2.0
367
+ * Changed: An empty weight/height/width/length will make the dimension unit empty
368
+ * Added: Setttings tab for managing global export settings
369
+ * Added: Custom export filename support with variables: %store_name%, %dataset%, %date%, %time%
370
+ * Changed: Moved Date Format option to Settings tab
371
+ * Changed: Moved Max unique Order items option to Settings tab
372
+ * Changed: Moved Enable Archives options to Settings tab
373
+ * Changed: Removed Manage Custom Product Fields link from Export Options
374
+ * Changed: Moved Script Timeout option to Settings tab
375
+
376
+ = 1.5 =
377
+ * Added: Menu Order to Products export
378
+ * Changed: Comment Status to Enable Reviews in Products export
379
+
380
+ = 1.4.9 =
381
+ * Added: Order Items: Category and Order Items: Tag to Orders export
382
+ * Added: Clicking an export type from the opening screen will open that export tab
383
+
384
+ = 1.4.8 =
385
+ * Changed: Dropped $woo_ce global
386
+ * Added: Using Plugin constants
387
+ * Changed: Moved debug log to WordPress transient
388
+ * Added: Disabled Custom Product Fields dialog
389
+ * Changed: Removed duplicate Sale Price from Product export
390
+ * Fixed: Empty Parent SKU and Product SKU for Product Variations
391
+ * Fixed: Fill default Stock Status for Products
392
+ * Fixed: Set Product Type to Simple Product by default
393
+ * Added: Error notice after blank screen on export
394
+ * Fixed: Product Categories empty for Variations in Product export
395
+
396
+ = 1.4.7 =
397
+ * Fixed: Multi-site support resolved
398
+ * Changed: Permanently delete failed exports
399
+
400
+ = 1.4.6 =
401
+ * Fixed: Blank screen on export in some instances
402
+ * Changed: Removed legacy progress bar
403
+ * Changed: Removed legacy Javascript in export screen
404
+ * Added: Admin notice confirming deleted archive file
405
+ * Changed: Removed bold headings from admin notices
406
+ * Added: Error notice to explain blank CSV
407
+ * Changed: Renamed "Delete temporary CSV after download" to "Enable Archives"
408
+ * Changed: Removed woo_ce_unload_export_global()
409
+ * Fixed: Delete WordPress Media on failed export
410
+ * Added: Link to Usage document when an error is encountered "Need help?"
411
+ * Changed: Using 'export' capability check for Store Export menu
412
+ * Changed: Using 'update_plugins' capability check for Jigoshop Plugins Dashboard widget (thanks Marcus!)
413
+
414
+ = 1.4.5 =
415
+ * Added: Custom Product fields
416
+ * Added: Memory optimisations for get_posts()
417
+ * Changed: Standard admin notices
418
+
419
+ = 1.4.4 =
420
+ * Changed: Default Date Format to d/m/Y
421
+
422
+ = 1.4.3 =
423
+ * Fixed: Export Orders by User Role
424
+ * Added: Formatting of User Role
425
+
426
+ = 1.4.2 =
427
+ * Added: Product Published and Product Modified dates to Products export
428
+ * Added: Date formatting independant of WordPress > Settings > General
429
+
430
+ = 1.4.1 =
431
+ * Fixed: Default file encoding can trigger PHP warning
432
+ * Added: File encoding support for Categories and Tags
433
+ * Added: Product Tags sorting export support
434
+ * Added: Category sorting export support
435
+ * Added: Separate files for each dataset
436
+
437
+ = 1.4 =
438
+ * Added: File encoding for datasets
439
+ * Changed: Default file encoding to UTF-8
440
+ * Added: Product sorting and ordering
441
+ * Changed: Ordering of Export Options
442
+
443
+ = 1.3.9 =
444
+ * Added: Payment Gateway ID to Orders export
445
+ * Added: Shipping Method ID to Orders export
446
+ * Added: Shipping Cost to Orders export
447
+ * Added: Checkout IP Address to Orders export
448
+ * Added: User Role to Orders export
449
+ * Changed: Removed encoding changes to Description and Excerpt
450
+
451
+ = 1.3.8 =
452
+ * Fixed: PHP 4 notices for File Encoding dropdown
453
+ * Fixed: Translation string on Export screen
454
+ * Added: WordPress get_posts() optimisation
455
+ * Fixed: Ignore Variant Products without Base Products (ala 'phantom Posts')
456
+
457
+ = 1.3.7 =
458
+ * Added: Additional Category column support
459
+ * Added: Additional Tag column support
460
+ * Fixed: HTML entities now print in plain-text
461
+
462
+ = 1.3.6 =
463
+ * Fixed: PHP error for missing function within Store Exporter Deluxe
464
+
465
+ = 1.3.5 =
466
+ * Fixed: Admin icon on Store Exporter screen
467
+ * Fixed: PHP error on Store Exporter screen without Products
468
+ * Changed: Moved CSV File dialog on Media screen to template file
469
+
470
+ = 1.3.4 =
471
+ * Added: Total incl. GST
472
+ * Added: Total excl. GST
473
+ * Added: Purchase Time
474
+ * Changed: Moved woo_ce_count_object() to formatting.php
475
+ * Added: Commenting to each function
476
+ * Fixed: PHP 4 support for missing mb_list_encodings()
477
+
478
+ = 1.3.3 =
479
+ * Added: New Product filter 'woo_ce_product_item'
480
+
481
+ = 1.3.2 =
482
+ * Fixed: Order Notes on Orders export
483
+
484
+ = 1.3.1 =
485
+ * Added: Link to submit additional fields
486
+
487
+ = 1.3 =
488
+ * Changed: Using manage_woocommerce instead of manage_options for permission check
489
+ * Changed: Removed woo_is_admin_valid_icon
490
+ * Changed: Using default WooCommerce icons
491
+
492
+ = 1.2.9 =
493
+ * Fixed: Urgent fix for duplicate formatting function
494
+
495
+ = 1.2.8 =
496
+ * Added: Product ID support
497
+ * Added: Post Parent ID support
498
+ * Added: Export Product variation support
499
+ * Added: Product Attribute support
500
+ * Added: Filter Products export by Type
501
+ * Added: Sale Price Dates From/To support
502
+ * Added: Virtual and Downloadable Product support
503
+ * Added: Remove archived export
504
+ * Added: Count and filter of archived exports
505
+ * Fixed: Hide User ID 0 (guest) from Orders
506
+
507
+ = 1.2.7 =
508
+ * Added: jQuery Chosen support to Orders Customer dropdown
509
+ * Fixed: Incorrect counts on some Export types
510
+
511
+ = 1.2.6 =
512
+ * Added: Product Type support
513
+ * Added: Native jQuery UI support
514
+ * Fixed: Various small bugs
515
+
516
+ = 1.2.5 =
517
+ * Added: Featured Image support
518
+
519
+ = 1.2.3 =
520
+ * Fixed: Tags export
521
+ * Added: Export Products by Product Tag filter
522
+ * Added: Notice for empty export files
523
+ * Changed: UI changes to Filter dialogs
524
+
525
+ = 1.2.2 =
526
+ * Changed: Free version can see Order, Coupon and Customer export options
527
+ * Added: Plugin screenshots
528
+
529
+ = 1.2.1 =
530
+ * Added: Support for BOM
531
+ * Added: Escape field formatting option
532
+ * Added: New line support
533
+ * Added: Payment Status (number) option
534
+
535
+ = 1.2 =
536
+ * Fixed: Surplus cell separator at end of lines
537
+ * Added: Remember field selections
538
+
539
+ = 1.1.1 =
540
+ * Added: Expiry Date support to Coupons
541
+ * Added: Individual Use to Coupons
542
+ * Added: Apply before tax to Coupons
543
+ * Added: Exclude sale items to Coupons
544
+ * Added: Expiry Date to Coupons
545
+ * Added: Minimum Amount to Coupons
546
+ * Added: Exclude Product ID's to Coupons
547
+ * Added: Product Categories to Coupons
548
+ * Added: Exclude Product Categories to Coupons
549
+ * Added: Usage Limit to Coupons
550
+ * Fixed: Customers count causing memory error
551
+ * Added: Formatting of 'on' and 'off' values
552
+ * Changed: Memory overrides
553
+
554
+ = 1.1.0 =
555
+ * Added: Save option for delimiter
556
+ * Added: Save option for category separator
557
+ * Added: Save options for limit volume
558
+ * Added: Save options for offset
559
+ * Added: Save options for timeout
560
+
561
+ = 1.0.9 =
562
+ * Fixed: Export buttons not adjusting Export Dataset
563
+ * Added: Select All options to Export
564
+ * Added: Partial export support
565
+ * Changed: Integration with Exporter Deluxe
566
+
567
+ = 1.0.8 =
568
+ * Added: Integration with Exporter Deluxe
569
+
570
+ = 1.0.7 =
571
+ * Fixed: Excerpt/Product Short description
572
+
573
+ = 1.0.6 =
574
+ * Changed: Options engine
575
+ * Changed: Moved styles to admin_enqueue_scripts
576
+ * Added: Coupons support
577
+
578
+ = 1.0.5 =
579
+ * Fixed: Template header bug
580
+ * Added: Tabbed viewing on the Exporter screen
581
+ * Added: Export Orders
582
+ * Added: Product columns
583
+ * Added: Order columns
584
+ * Added: Category heirachy support (up to 3 levels deep)
585
+ * Fixed: Foreign character support
586
+ * Changed: More efficient Tag generation
587
+ * Fixed: Link error on Export within Plugin screen
588
+
589
+ = 1.0.4 =
590
+ * Added: Duplicate e-mail address filtering
591
+ * Changed: Updated readme.txt
592
+
593
+ = 1.0.3 =
594
+ * Added: Support for Customers
595
+
596
+ = 1.0.2 =
597
+ * Changed: Migrated to WordPress Extend
598
+
599
+ = 1.0.1 =
600
+ * Fixed: Dashboard widget not loading
601
+
602
+ = 1.0 =
603
+ * Added: First working release of the Plugin
604
+
605
+ == Disclaimer ==
606
+
607
+ It is not responsible for any harm or wrong doing this Plugin may cause. Users are fully responsible for their own use. This Plugin is to be used WITHOUT warranty.
templates/admin/chosen-sprite.png ADDED
Binary file
templates/admin/chosen.css ADDED
@@ -0,0 +1,397 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* @group Base */
2
+ .chzn-container {
3
+ font-size: 12px;
4
+ position: relative;
5
+ display: inline-block;
6
+ zoom: 1;
7
+ *display: inline;
8
+ }
9
+ .chzn-container .chzn-drop {
10
+ background: #fff;
11
+ border: 1px solid #aaa;
12
+ border-top: 0;
13
+ position: absolute;
14
+ top: 29px;
15
+ left: 0;
16
+ -webkit-box-shadow: 0 4px 5px rgba(0,0,0,.15);
17
+ -moz-box-shadow : 0 4px 5px rgba(0,0,0,.15);
18
+ box-shadow : 0 4px 5px rgba(0,0,0,.15);
19
+ z-index: 1010;
20
+ }
21
+ /* @end */
22
+
23
+ /* @group Single Chosen */
24
+ .chzn-container-single .chzn-single {
25
+ background-color: #ffffff;
26
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0 );
27
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
28
+ background-image: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
29
+ background-image: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
30
+ background-image: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
31
+ background-image: linear-gradient(#ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
32
+ -webkit-border-radius: 5px;
33
+ -moz-border-radius : 5px;
34
+ border-radius : 5px;
35
+ -moz-background-clip : padding;
36
+ -webkit-background-clip: padding-box;
37
+ background-clip : padding-box;
38
+ border: 1px solid #aaaaaa;
39
+ -webkit-box-shadow: 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
40
+ -moz-box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
41
+ box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
42
+ display: block;
43
+ overflow: hidden;
44
+ white-space: nowrap;
45
+ position: relative;
46
+ height: 23px;
47
+ line-height: 24px;
48
+ padding: 0 0 0 8px;
49
+ color: #444444;
50
+ text-decoration: none;
51
+ }
52
+ .chzn-container-single .chzn-default {
53
+ color: #999;
54
+ }
55
+ .chzn-container-single .chzn-single span {
56
+ margin-right: 26px;
57
+ display: block;
58
+ overflow: hidden;
59
+ white-space: nowrap;
60
+ -o-text-overflow: ellipsis;
61
+ -ms-text-overflow: ellipsis;
62
+ text-overflow: ellipsis;
63
+ }
64
+ .chzn-container-single .chzn-single abbr {
65
+ display: block;
66
+ position: absolute;
67
+ right: 26px;
68
+ top: 6px;
69
+ width: 12px;
70
+ height: 13px;
71
+ font-size: 1px;
72
+ background: url('chosen-sprite.png') right top no-repeat;
73
+ }
74
+ .chzn-container-single .chzn-single abbr:hover {
75
+ background-position: right -11px;
76
+ }
77
+ .chzn-container-single.chzn-disabled .chzn-single abbr:hover {
78
+ background-position: right top;
79
+ }
80
+ .chzn-container-single .chzn-single div {
81
+ position: absolute;
82
+ right: 0;
83
+ top: 0;
84
+ display: block;
85
+ height: 100%;
86
+ width: 18px;
87
+ }
88
+ .chzn-container-single .chzn-single div b {
89
+ background: url('chosen-sprite.png') no-repeat 0 0;
90
+ display: block;
91
+ width: 100%;
92
+ height: 100%;
93
+ }
94
+ .chzn-container-single .chzn-search {
95
+ padding: 3px 4px;
96
+ position: relative;
97
+ margin: 0;
98
+ white-space: nowrap;
99
+ z-index: 1010;
100
+ }
101
+ .chzn-container-single .chzn-search input {
102
+ background: #fff url('chosen-sprite.png') no-repeat 100% -22px;
103
+ background: url('chosen-sprite.png') no-repeat 100% -22px, -webkit-gradient(linear, 0 0, 0 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
104
+ background: url('chosen-sprite.png') no-repeat 100% -22px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
105
+ background: url('chosen-sprite.png') no-repeat 100% -22px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
106
+ background: url('chosen-sprite.png') no-repeat 100% -22px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
107
+ background: url('chosen-sprite.png') no-repeat 100% -22px, linear-gradient(#eeeeee 1%, #ffffff 15%);
108
+ margin: 1px 0;
109
+ padding: 4px 20px 4px 5px;
110
+ outline: 0;
111
+ border: 1px solid #aaa;
112
+ font-family: sans-serif;
113
+ font-size: 1em;
114
+ }
115
+ .chzn-container-single .chzn-drop {
116
+ -webkit-border-radius: 0 0 4px 4px;
117
+ -moz-border-radius : 0 0 4px 4px;
118
+ border-radius : 0 0 4px 4px;
119
+ -moz-background-clip : padding;
120
+ -webkit-background-clip: padding-box;
121
+ background-clip : padding-box;
122
+ }
123
+ /* @end */
124
+
125
+ .chzn-container-single-nosearch .chzn-search input {
126
+ position: absolute;
127
+ left: -9000px;
128
+ }
129
+
130
+ /* @group Multi Chosen */
131
+ .chzn-container-multi .chzn-choices {
132
+ background-color: #fff;
133
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
134
+ background-image: -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
135
+ background-image: -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
136
+ background-image: -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
137
+ background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);
138
+ border: 1px solid #aaa;
139
+ margin: 0;
140
+ padding: 0;
141
+ cursor: text;
142
+ overflow: hidden;
143
+ height: auto !important;
144
+ height: 1%;
145
+ position: relative;
146
+ }
147
+ .chzn-container-multi .chzn-choices li {
148
+ float: left;
149
+ list-style: none;
150
+ }
151
+ .chzn-container-multi .chzn-choices .search-field {
152
+ white-space: nowrap;
153
+ margin: 0;
154
+ padding: 0;
155
+ }
156
+ .chzn-container-multi .chzn-choices .search-field input {
157
+ color: #666;
158
+ background: transparent !important;
159
+ border: 0 !important;
160
+ font-family: sans-serif;
161
+ font-size: 100%;
162
+ height: 15px;
163
+ padding: 5px;
164
+ margin: 1px 0;
165
+ outline: 0;
166
+ -webkit-box-shadow: none;
167
+ -moz-box-shadow : none;
168
+ box-shadow : none;
169
+ }
170
+ .chzn-container-multi .chzn-choices .search-field .default {
171
+ color: #999;
172
+ }
173
+ .chzn-container-multi .chzn-choices .search-choice {
174
+ -webkit-border-radius: 3px;
175
+ -moz-border-radius : 3px;
176
+ border-radius : 3px;
177
+ -moz-background-clip : padding;
178
+ -webkit-background-clip: padding-box;
179
+ background-clip : padding-box;
180
+ background-color: #e4e4e4;
181
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0 );
182
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
183
+ background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
184
+ background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
185
+ background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
186
+ background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
187
+ -webkit-box-shadow: 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
188
+ -moz-box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
189
+ box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
190
+ color: #333;
191
+ border: 1px solid #aaaaaa;
192
+ line-height: 13px;
193
+ padding: 3px 20px 3px 5px;
194
+ margin: 3px 0 3px 5px;
195
+ position: relative;
196
+ cursor: default;
197
+ }
198
+ .chzn-container-multi .chzn-choices .search-choice.search-choice-disabled {
199
+ background-color: #e4e4e4;
200
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0 );
201
+ background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
202
+ background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
203
+ background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
204
+ background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
205
+ background-image: -ms-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
206
+ background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
207
+ color: #666;
208
+ border: 1px solid #cccccc;
209
+ padding-right: 5px;
210
+ }
211
+ .chzn-container-multi .chzn-choices .search-choice-focus {
212
+ background: #d4d4d4;
213
+ }
214
+ .chzn-container-multi .chzn-choices .search-choice .search-choice-close {
215
+ display: block;
216
+ position: absolute;
217
+ right: 3px;
218
+ top: 4px;
219
+ width: 12px;
220
+ height: 13px;
221
+ font-size: 1px;
222
+ background: url('chosen-sprite.png') right top no-repeat;
223
+ }
224
+ .chzn-container-multi .chzn-choices .search-choice .search-choice-close:hover {
225
+ background-position: right -11px;
226
+ }
227
+ .chzn-container-multi .chzn-choices .search-choice-focus .search-choice-close {
228
+ background-position: right -11px;
229
+ }
230
+ /* @end */
231
+
232
+ /* @group Results */
233
+ .chzn-container .chzn-results {
234
+ margin: 0 4px 4px 0;
235
+ max-height: 240px;
236
+ padding: 0 0 0 4px;
237
+ position: relative;
238
+ overflow-x: hidden;
239
+ overflow-y: auto;
240
+ -webkit-overflow-scrolling: touch;
241
+ }
242
+ .chzn-container-multi .chzn-results {
243
+ margin: -1px 0 0;
244
+ padding: 0;
245
+ }
246
+ .chzn-container .chzn-results li {
247
+ display: none;
248
+ line-height: 15px;
249
+ padding: 5px 6px;
250
+ margin: 0;
251
+ list-style: none;
252
+ }
253
+ .chzn-container .chzn-results .active-result {
254
+ cursor: pointer;
255
+ display: list-item;
256
+ }
257
+ .chzn-container .chzn-results .highlighted {
258
+ background-color: #3875d7;
259
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3875d7', endColorstr='#2a62bc', GradientType=0 );
260
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
261
+ background-image: -webkit-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
262
+ background-image: -moz-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
263
+ background-image: -o-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
264
+ background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
265
+ color: #fff;
266
+ }
267
+ .chzn-container .chzn-results li em {
268
+ background: #feffde;
269
+ font-style: normal;
270
+ }
271
+ .chzn-container .chzn-results .highlighted em {
272
+ background: transparent;
273
+ }
274
+ .chzn-container .chzn-results .no-results {
275
+ background: #f4f4f4;
276
+ display: list-item;
277
+ }
278
+ .chzn-container .chzn-results .group-result {
279
+ cursor: default;
280
+ color: #999;
281
+ font-weight: bold;
282
+ }
283
+ .chzn-container .chzn-results .group-option {
284
+ padding-left: 15px;
285
+ }
286
+ .chzn-container-multi .chzn-drop .result-selected {
287
+ display: none;
288
+ }
289
+ .chzn-container .chzn-results-scroll {
290
+ background: white;
291
+ margin: 0 4px;
292
+ position: absolute;
293
+ text-align: center;
294
+ width: 321px; /* This should by dynamic with js */
295
+ z-index: 1;
296
+ }
297
+ .chzn-container .chzn-results-scroll span {
298
+ display: inline-block;
299
+ height: 17px;
300
+ text-indent: -5000px;
301
+ width: 9px;
302
+ }
303
+ .chzn-container .chzn-results-scroll-down {
304
+ bottom: 0;
305
+ }
306
+ .chzn-container .chzn-results-scroll-down span {
307
+ background: url('chosen-sprite.png') no-repeat -4px -3px;
308
+ }
309
+ .chzn-container .chzn-results-scroll-up span {
310
+ background: url('chosen-sprite.png') no-repeat -22px -3px;
311
+ }
312
+ /* @end */
313
+
314
+ /* @group Active */
315
+ .chzn-container-active .chzn-single {
316
+ -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
317
+ -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
318
+ box-shadow : 0 0 5px rgba(0,0,0,.3);
319
+ border: 1px solid #5897fb;
320
+ }
321
+ .chzn-container-active .chzn-single-with-drop {
322
+ border: 1px solid #aaa;
323
+ -webkit-box-shadow: 0 1px 0 #fff inset;
324
+ -moz-box-shadow : 0 1px 0 #fff inset;
325
+ box-shadow : 0 1px 0 #fff inset;
326
+ background-color: #eee;
327
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0 );
328
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
329
+ background-image: -webkit-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
330
+ background-image: -moz-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
331
+ background-image: -o-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
332
+ background-image: linear-gradient(#eeeeee 20%, #ffffff 80%);
333
+ -webkit-border-bottom-left-radius : 0;
334
+ -webkit-border-bottom-right-radius: 0;
335
+ -moz-border-radius-bottomleft : 0;
336
+ -moz-border-radius-bottomright: 0;
337
+ border-bottom-left-radius : 0;
338
+ border-bottom-right-radius: 0;
339
+ }
340
+ .chzn-container-active .chzn-single-with-drop div {
341
+ background: transparent;
342
+ border-left: none;
343
+ }
344
+ .chzn-container-active .chzn-single-with-drop div b {
345
+ background-position: -18px 1px;
346
+ }
347
+ .chzn-container-active .chzn-choices {
348
+ -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
349
+ -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
350
+ box-shadow : 0 0 5px rgba(0,0,0,.3);
351
+ border: 1px solid #5897fb;
352
+ }
353
+ .chzn-container-active .chzn-choices .search-field input {
354
+ color: #111 !important;
355
+ }
356
+ /* @end */
357
+
358
+ /* @group Disabled Support */
359
+ .chzn-disabled {
360
+ cursor: default;
361
+ opacity:0.5 !important;
362
+ }
363
+ .chzn-disabled .chzn-single {
364
+ cursor: default;
365
+ }
366
+ .chzn-disabled .chzn-choices .search-choice .search-choice-close {
367
+ cursor: default;
368
+ }
369
+
370
+ /* @group Right to Left */
371
+ .chzn-rtl { text-align: right; }
372
+ .chzn-rtl .chzn-single { padding: 0 8px 0 0; overflow: visible; }
373
+ .chzn-rtl .chzn-single span { margin-left: 26px; margin-right: 0; direction: rtl; }
374
+
375
+ .chzn-rtl .chzn-single div { left: 3px; right: auto; }
376
+ .chzn-rtl .chzn-single abbr {
377
+ left: 26px;
378
+ right: auto;
379
+ }
380
+ .chzn-rtl .chzn-choices .search-field input { direction: rtl; }
381
+ .chzn-rtl .chzn-choices li { float: right; }
382
+ .chzn-rtl .chzn-choices .search-choice { padding: 3px 5px 3px 19px; margin: 3px 5px 3px 0; }
383
+ .chzn-rtl .chzn-choices .search-choice .search-choice-close { left: 4px; right: auto; background-position: right top;}
384
+ .chzn-rtl.chzn-container-single .chzn-results { margin: 0 0 4px 4px; padding: 0 4px 0 0; }
385
+ .chzn-rtl .chzn-results .group-option { padding-left: 0; padding-right: 15px; }
386
+ .chzn-rtl.chzn-container-active .chzn-single-with-drop div { border-right: none; }
387
+ .chzn-rtl .chzn-search input {
388
+ background: #fff url('chosen-sprite.png') no-repeat -38px -22px;
389
+ background: url('chosen-sprite.png') no-repeat -38px -22px, -webkit-gradient(linear, 0 0, 0 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
390
+ background: url('chosen-sprite.png') no-repeat -38px -22px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
391
+ background: url('chosen-sprite.png') no-repeat -38px -22px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
392
+ background: url('chosen-sprite.png') no-repeat -38px -22px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
393
+ background: url('chosen-sprite.png') no-repeat -38px -22px, linear-gradient(#eeeeee 1%, #ffffff 15%);
394
+ padding: 4px 5px 4px 20px;
395
+ direction: rtl;
396
+ }
397
+ /* @end */
templates/admin/export.css ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Tabbed navigation */
2
+
3
+ #woo-ce h2 .nav-tab {
4
+ font-size: 16px;
5
+ margin-right:0;
6
+ }
7
+ #woo-ce h2.nav-tab-wrapper {
8
+ padding-left:7px;
9
+ }
10
+
11
+ /* Overview */
12
+
13
+ #woo-ce .overview-left {
14
+ float:left;
15
+ width:73%;
16
+ }
17
+ #woo-ce .overview-right {
18
+ float:left;
19
+ width:24%;
20
+ }
21
+ #woo-ce .overview-right h3 {
22
+ font-size:16px;
23
+ }
24
+ #woo-ce .overview-right h3 span {
25
+ float:right;
26
+ font-size:11px;
27
+ font-weight:normal;
28
+ }
29
+ #woo-ce .overview-right p {
30
+ font-size:12px;
31
+ color:#333;
32
+ line-height:1.6em;
33
+ }
34
+ #woo-ce .overview-right ul {
35
+ font-size:12px;
36
+ line-height:1.2em;
37
+ }
38
+
39
+ /* Export */
40
+
41
+ #woo-ce #export-type th {
42
+ padding:0;
43
+ }
44
+ #woo-ce #export-type td {
45
+ padding:0;
46
+ }
47
+ #woo-ce .postbox .submit {
48
+ padding:0.3em 0;
49
+ }
50
+ #woo-ce textarea#export_log {
51
+ font:12px Consolas, Monaco, Courier, monospace;
52
+ width:100%;
53
+ height:200px;
54
+ }
55
+ #woo-ce #export_sheet {
56
+ overflow: scroll;
57
+ margin-bottom:1em;
58
+ }
59
+ #woo-ce #export_sheet table {
60
+ width:100%;
61
+ }
62
+
63
+ #woo-ce .separator {
64
+ border-bottom:1px solid #dfdfdf;
65
+ }
66
+ #woo-ce .woo_vm_version_table .export_module {
67
+ background-color:#fff;
68
+ padding:0.2em 0 0 0.5em;
69
+ }
70
+ #woo-ce .woo_vm_version_table .dashicons {
71
+ color:#666;
72
+ }
73
+ #woo-ce .woo_vm_version_table .status {
74
+ width:80px;
75
+ }
76
+
77
+ /* Settings */
78
+
79
+ #woo-ce .auto_method_options li.ftp-options label {
80
+ display:inline-block;
81
+ width:120px;
82
+ }
83
+ #woo-ce .auto_method_options li.ftp-options select {
84
+ width: 25em;
85
+ }
86
+
87
+ /* Support - Donate / Rate */
88
+
89
+ #woo-ce .support-donate_rate {
90
+ display:block;
91
+ float:right;
92
+ }
93
+ #woo-ce .support-donate_rate p {
94
+ margin-top:16px;
95
+ }
96
+ #woo-ce .support-donate_rate .star {
97
+ vertical-align:bottom;
98
+ display:inline-block;
99
+ width:17px;
100
+ height:17px;
101
+ background:url('images/star.png') no-repeat;
102
+ }
103
+ #woo-ce .support-donate_rate span {
104
+ display:none;
105
+ }
templates/admin/export.js ADDED
@@ -0,0 +1,514 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var $j = jQuery.noConflict();
2
+ $j(function() {
3
+
4
+ // This controls the Skip Overview link on the Overview screen
5
+ $j('#skip_overview').click(function(){
6
+ $j('#skip_overview_form').submit();
7
+ });
8
+
9
+ // Date Picker
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
19
+ if( $j.isFunction($j.fn.datetimepicker) ) {
20
+ $j('.datetimepicker').datetimepicker({
21
+ dateFormat: 'dd/mm/yy',
22
+ timeFormat: 'HH:mm',
23
+ controlType: 'select',
24
+ minDate:new Date(new Date().getTime())
25
+ });
26
+ }
27
+
28
+ // Order Dates
29
+ $j('input[name="order_dates_filter_variable"],select[name="order_dates_filter_variable_length"]').click(function () {
30
+ $j('input:radio[name="order_dates_filter"][value="variable"]').prop( 'checked', true );
31
+ });
32
+
33
+ // Chosen
34
+ if( $j.isFunction($j.fn.chosen) ) {
35
+ $j(".chzn-select").chosen({
36
+ search_contains: true
37
+ });
38
+ }
39
+
40
+ // Sortable export columns
41
+ if( $j.isFunction($j.fn.sortable) ) {
42
+ $j('table.ui-sortable').sortable({
43
+ items:'tr',
44
+ cursor:'move',
45
+ axis:'y',
46
+ handle: 'td',
47
+ scrollSensitivity:40,
48
+ helper:function(e,ui){
49
+ ui.children().each(function(){
50
+ jQuery(this).width(jQuery(this).width());
51
+ });
52
+ ui.css('left', '0');
53
+ return ui;
54
+ },
55
+ start:function(event,ui){
56
+ ui.item.css('background-color','#f6f6f6');
57
+ },
58
+ stop:function(event,ui){
59
+ ui.item.removeAttr('style');
60
+ field_row_indexes(this);
61
+ }
62
+ });
63
+
64
+ function field_row_indexes(obj) {
65
+ rows = $j(obj).find('tr');
66
+ $j(rows).each(function(index, el){
67
+ $j('input.field_order', el).val( parseInt( $j(el).index() ) );
68
+ });
69
+ };
70
+ }
71
+
72
+ // Select all field options for this export type
73
+ $j('.checkall').click(function () {
74
+ $j(this).closest('.postbox').find(':checkbox').attr('checked', true);
75
+ });
76
+ // Unselect all field options for this export type
77
+ $j('.uncheckall').click(function () {
78
+ $j(this).closest('.postbox').find(':checkbox').attr('checked', false);
79
+ });
80
+ // Reset sorting of fields for this export type
81
+ $j('.resetsorting').click(function () {
82
+ var type = $j(this).attr('id');
83
+ var type = type.replace('-resetsorting','');
84
+ for(i=0; i<$j('#' + type + '-fields tr').length; i++){
85
+ $j('#' + type + '-' + i).appendTo('#' + type + '-fields');
86
+ }
87
+ field_row_indexes($j('#' + type + '-fields'));
88
+ });
89
+
90
+ $j('.export-types').hide();
91
+ $j('.export-options').hide();
92
+
93
+ // Categories
94
+ $j('#export-products-filters-categories').hide();
95
+ if( $j('#products-filters-categories').attr('checked') ) {
96
+ $j('#export-products-filters-categories').show();
97
+ }
98
+ // Tags
99
+ $j('#export-products-filters-tags').hide();
100
+ if( $j('#products-filters-tags').attr('checked') ) {
101
+ $j('#export-products-filters-tags').show();
102
+ }
103
+ // Brands
104
+ $j('#export-products-filters-brands').hide();
105
+ if( $j('#products-filters-brands').attr('checked') ) {
106
+ $j('#export-products-filters-brands').show();
107
+ }
108
+ // Product Vendors
109
+ $j('#export-products-filters-vendors').hide();
110
+ if( $j('#products-filters-vendors').attr('checked') ) {
111
+ $j('#export-products-filters-vendors').show();
112
+ }
113
+ // Product Status
114
+ $j('#export-products-filters-status').hide();
115
+ if( $j('#products-filters-status').attr('checked') ) {
116
+ $j('#export-products-filters-status').show();
117
+ }
118
+ // Type
119
+ $j('#export-products-filters-type').hide();
120
+ if( $j('#products-filters-type').attr('checked') ) {
121
+ $j('#export-products-filters-type').show();
122
+ }
123
+ // Stock
124
+ $j('#export-products-filters-stock').hide();
125
+ if( $j('#products-filters-stock').attr('checked') ) {
126
+ $j('#export-products-filters-stock').show();
127
+ }
128
+
129
+ $j('#export-category').hide();
130
+
131
+ $j('#export-tag').hide();
132
+
133
+ $j('#export-brand').hide();
134
+
135
+ $j('#export-order').hide();
136
+ // Order Status
137
+ $j('#export-orders-filters-status').hide();
138
+ if( $j('#orders-filters-status').attr('checked') ) {
139
+ $j('#export-orders-filters-status').show();
140
+ }
141
+ // Order Date
142
+ $j('#export-orders-filters-date').hide();
143
+ if( $j('#orders-filters-date').attr('checked') ) {
144
+ $j('#export-orders-filters-date').show();
145
+ }
146
+ // Customer
147
+ $j('#export-orders-filters-customer').hide();
148
+ if( $j('#orders-filters-customer').attr('checked') ) {
149
+ $j('#export-orders-filters-customer').show();
150
+ }
151
+ // Billing Country
152
+ $j('#export-orders-filters-billing_country').hide();
153
+ if( $j('#orders-filters-billing_country').attr('checked') ) {
154
+ $j('#export-orders-filters-billing_country').show();
155
+ }
156
+ // Shipping Country
157
+ $j('#export-orders-filters-shipping_country').hide();
158
+ if( $j('#orders-filters-shipping_country').attr('checked') ) {
159
+ $j('#export-orders-filters-shipping_country').show();
160
+ }
161
+ // User Role
162
+ $j('#export-orders-filters-user_role').hide();
163
+ if( $j('#orders-filters-user_role').attr('checked') ) {
164
+ $j('#export-orders-filters-user_role').show();
165
+ }
166
+ // Coupon Code
167
+ $j('#export-orders-filters-coupon').hide();
168
+ if( $j('#orders-filters-coupon').attr('checked') ) {
169
+ $j('#export-orders-filters-coupon').show();
170
+ }
171
+ // Products
172
+ $j('#export-orders-filters-product').hide();
173
+ if( $j('#orders-filters-product').attr('checked') ) {
174
+ $j('#export-orders-filters-product').show();
175
+ }
176
+ // Categories
177
+ $j('#export-orders-filters-category').hide();
178
+ if( $j('#orders-filters-category').attr('checked') ) {
179
+ $j('#export-orders-filters-category').show();
180
+ }
181
+ // Tags
182
+ $j('#export-orders-filters-tag').hide();
183
+ if( $j('#orders-filters-tag').attr('checked') ) {
184
+ $j('#export-orders-filters-tag').show();
185
+ }
186
+ // Brands
187
+ $j('#export-orders-filters-brand').hide();
188
+ if( $j('#orders-filters-brand').attr('checked') ) {
189
+ $j('#export-orders-filters-brand').show();
190
+ }
191
+ // Order ID
192
+ $j('#export-orders-filters-id').hide();
193
+ if( $j('#orders-filters-id').attr('checked') ) {
194
+ $j('#export-orders-filters-id').show();
195
+ }
196
+ // Payment Gateway
197
+ $j('#export-orders-filters-payment_gateway').hide();
198
+ if( $j('#orders-filters-payment_gateway').attr('checked') ) {
199
+ $j('#export-orders-filters-payment_gateway').show();
200
+ }
201
+ // Payment Gateway
202
+ $j('#export-orders-filters-shipping_method').hide();
203
+ if( $j('#orders-filters-shipping_method').attr('checked') ) {
204
+ $j('#export-orders-filters-shipping_method').show();
205
+ }
206
+
207
+ // Order Status
208
+ $j('#export-customers-filters-status').hide();
209
+ if( $j('#customers-filters-status').attr('checked') ) {
210
+ $j('#export-customers-filters-status').show();
211
+ }
212
+ // User Role
213
+ $j('#export-customers-filters-user_role').hide();
214
+ if( $j('#customers-filters-user_role').attr('checked') ) {
215
+ $j('#export-customers-filters-user_role').show();
216
+ }
217
+
218
+ // Subscription Status
219
+ $j('#export-subscriptions-filters-status').hide();
220
+ if( $j('#subscriptions-filters-status').attr('checked') ) {
221
+ $j('#export-subscriptions-filters-status').show();
222
+ }
223
+ // Subscription Product
224
+ $j('#export-subscriptions-filters-product').hide();
225
+ if( $j('#subscriptions-filters-product').attr('checked') ) {
226
+ $j('#export-subscriptions-filters-product').show();
227
+ }
228
+
229
+ // Order Date
230
+ $j('#export-commissions-filters-date').hide();
231
+ if( $j('#commissions-filters-date').attr('checked') ) {
232
+ $j('#export-commissions-filters-date').show();
233
+ }
234
+ // Product Vendor
235
+ $j('#export-commissions-filters-product_vendor').hide();
236
+ if( $j('#commissions-filters-product_vendor').attr('checked') ) {
237
+ $j('#export-commissions-filters-product_vendor').show();
238
+ }
239
+ // Commission Status
240
+ $j('#export-commissions-filters-commission_status').hide();
241
+ if( $j('#commissions-filters-commission_status').attr('checked') ) {
242
+ $j('#export-commissions-filters-commission_status').show();
243
+ }
244
+
245
+ $j('#export-customer').hide();
246
+ $j('#export-user').hide();
247
+ $j('#export-coupon').hide();
248
+ $j('#export-subscription').hide();
249
+ $j('#export-product_vendor').hide();
250
+ $j('#export-commission').hide();
251
+ $j('#export-shipping_class').hide();
252
+ $j('#export-attribute').hide();
253
+
254
+ $j('#products-filters-categories').click(function(){
255
+ $j('#export-products-filters-categories').toggle();
256
+ });
257
+ $j('#products-filters-tags').click(function(){
258
+ $j('#export-products-filters-tags').toggle();
259
+ });
260
+ $j('#products-filters-brands').click(function(){
261
+ $j('#export-products-filters-brands').toggle();
262
+ });
263
+ $j('#products-filters-vendors').click(function(){
264
+ $j('#export-products-filters-vendors').toggle();
265
+ });
266
+ $j('#products-filters-status').click(function(){
267
+ $j('#export-products-filters-status').toggle();
268
+ });
269
+ $j('#products-filters-type').click(function(){
270
+ $j('#export-products-filters-type').toggle();
271
+ });
272
+ $j('#products-filters-stock').click(function(){
273
+ $j('#export-products-filters-stock').toggle();
274
+ });
275
+
276
+ $j('#orders-filters-date').click(function(){
277
+ $j('#export-orders-filters-date').toggle();
278
+ });
279
+ $j('#orders-filters-status').click(function(){
280
+ $j('#export-orders-filters-status').toggle();
281
+ });
282
+ $j('#orders-filters-customer').click(function(){
283
+ $j('#export-orders-filters-customer').toggle();
284
+ });
285
+ $j('#orders-filters-billing_country').click(function(){
286
+ $j('#export-orders-filters-billing_country').toggle();
287
+ });
288
+ $j('#orders-filters-shipping_country').click(function(){
289
+ $j('#export-orders-filters-shipping_country').toggle();
290
+ });
291
+ $j('#orders-filters-user_role').click(function(){
292
+ $j('#export-orders-filters-user_role').toggle();
293
+ });
294
+ $j('#orders-filters-coupon').click(function(){
295
+ $j('#export-orders-filters-coupon').toggle();
296
+ });
297
+ $j('#orders-filters-product').click(function(){
298
+ $j('#export-orders-filters-product').toggle();
299
+ });
300
+ $j('#orders-filters-category').click(function(){
301
+ $j('#export-orders-filters-category').toggle();
302
+ });
303
+ $j('#orders-filters-tag').click(function(){
304
+ $j('#export-orders-filters-tag').toggle();
305
+ });
306
+ $j('#orders-filters-brand').click(function(){
307
+ $j('#export-orders-filters-brand').toggle();
308
+ });
309
+ $j('#orders-filters-id').click(function(){
310
+ $j('#export-orders-filters-id').toggle();
311
+ });
312
+ $j('#orders-filters-payment_gateway').click(function(){
313
+ $j('#export-orders-filters-payment_gateway').toggle();
314
+ });
315
+ $j('#orders-filters-shipping_method').click(function(){
316
+ $j('#export-orders-filters-shipping_method').toggle();
317
+ });
318
+
319
+ $j('#customers-filters-status').click(function(){
320
+ $j('#export-customers-filters-status').toggle();
321
+ });
322
+ $j('#customers-filters-user_role').click(function(){
323
+ $j('#export-customers-filters-user_role').toggle();
324
+ });
325
+
326
+ $j('#subscriptions-filters-status').click(function(){
327
+ $j('#export-subscriptions-filters-status').toggle();
328
+ });
329
+ $j('#subscriptions-filters-product').click(function(){
330
+ $j('#export-subscriptions-filters-product').toggle();
331
+ });
332
+
333
+ $j('#commissions-filters-date').click(function(){
334
+ $j('#export-commissions-filters-date').toggle();
335
+ });
336
+ $j('#commissions-filters-product_vendor').click(function(){
337
+ $j('#export-commissions-filters-product_vendor').toggle();
338
+ });
339
+ $j('#commissions-filters-commission_status').click(function(){
340
+ $j('#export-commissions-filters-commission_status').toggle();
341
+ });
342
+
343
+ // Export types
344
+ $j('#product').click(function(){
345
+ $j('.export-types').hide();
346
+ $j('#export-product').show();
347
+
348
+ $j('.export-options').hide();
349
+ $j('.product-options').show();
350
+ });
351
+ $j('#category').click(function(){
352
+ $j('.export-types').hide();
353
+ $j('#export-category').show();
354
+
355
+ $j('.export-options').hide();
356
+ $j('.category-options').show();
357
+ });
358
+ $j('#tag').click(function(){
359
+ $j('.export-types').hide();
360
+ $j('#export-tag').show();
361
+
362
+ $j('.export-options').hide();
363
+ $j('.tag-options').show();
364
+ });
365
+ $j('#brand').click(function(){
366
+ $j('.export-types').hide();
367
+ $j('#export-brand').show();
368
+
369
+ $j('.export-options').hide();
370
+ $j('.brand-options').show();
371
+ });
372
+ $j('#order').click(function(){
373
+ $j('.export-types').hide();
374
+ $j('#export-order').show();
375
+
376
+ $j('.export-options').hide();
377
+ $j('.order-options').show();
378
+ });
379
+ $j('#customer').click(function(){
380
+ $j('.export-types').hide();
381
+ $j('#export-customer').show();
382
+
383
+ $j('.export-options').hide();
384
+ $j('.customer-options').show();
385
+ });
386
+ $j('#user').click(function(){
387
+ $j('.export-types').hide();
388
+ $j('#export-user').show();
389
+
390
+ $j('.export-options').hide();
391
+ $j('.user-options').show();
392
+ });
393
+ $j('#coupon').click(function(){
394
+ $j('.export-types').hide();
395
+ $j('#export-coupon').show();
396
+
397
+ $j('.export-options').hide();
398
+ $j('.coupon-options').show();
399
+ });
400
+ $j('#subscription').click(function(){
401
+ $j('.export-types').hide();
402
+ $j('#export-subscription').show();
403
+
404
+ $j('.export-options').hide();
405
+ $j('.subscription-options').show();
406
+ });
407
+ $j('#product_vendor').click(function(){
408
+ $j('.export-types').hide();
409
+ $j('#export-product_vendor').show();
410
+
411
+ $j('.export-options').hide();
412
+ $j('.product_vendor-options').show();
413
+ });
414
+ $j('#commission').click(function(){
415
+ $j('.export-types').hide();
416
+ $j('#export-commission').show();
417
+
418
+ $j('.export-options').hide();
419
+ $j('.commission-options').show();
420
+ });
421
+ $j('#shipping_class').click(function(){
422
+ $j('.export-types').hide();
423
+ $j('#export-shipping_class').show();
424
+
425
+ $j('.export-options').hide();
426
+ $j('.shipping_class-options').show();
427
+ });
428
+ $j('#attribute').click(function(){
429
+ $j('.export-types').hide();
430
+ $j('#export-attribute').show();
431
+
432
+ $j('.export-options').hide();
433
+ $j('.attribute-options').show();
434
+ });
435
+
436
+ // Export button
437
+ $j('#export_product').click(function(){
438
+ $j('input:radio[name=dataset]:nth(0)').attr('checked',true);
439
+ });
440
+ $j('#export_category').click(function(){
441
+ $j('input:radio[name=dataset]:nth(1)').attr('checked',true);
442
+ });
443
+ $j('#export_tag').click(function(){
444
+ $j('input:radio[name=dataset]:nth(2)').attr('checked',true);
445
+ });
446
+ $j('#export_brand').click(function(){
447
+ $j('input:radio[name=dataset]:nth(3)').attr('checked',true);
448
+ });
449
+ $j('#export_order').click(function(){
450
+ $j('input:radio[name=dataset]:nth(4)').attr('checked',true);
451
+ });
452
+ $j('#export_customer').click(function(){
453
+ $j('input:radio[name=dataset]:nth(5)').attr('checked',true);
454
+ });
455
+ $j('#export_user').click(function(){
456
+ $j('input:radio[name=dataset]:nth(6)').attr('checked',true);
457
+ });
458
+ $j('#export_coupon').click(function(){
459
+ $j('input:radio[name=dataset]:nth(7)').attr('checked',true);
460
+ });
461
+ $j('#export_subscription').click(function(){
462
+ $j('input:radio[name=dataset]:nth(8)').attr('checked',true);
463
+ });
464
+ $j('#export_product_vendor').click(function(){
465
+ $j('input:radio[name=dataset]:nth(9)').attr('checked',true);
466
+ });
467
+ $j('#export_commission').click(function(){
468
+ $j('input:radio[name=dataset]:nth(10)').attr('checked',true);
469
+ });
470
+ $j('#export_shipping_class').click(function(){
471
+ $j('input:radio[name=dataset]:nth(11)').attr('checked',true);
472
+ });
473
+ $j('#export_attribute').click(function(){
474
+ $j('input:radio[name=dataset]:nth(12)').attr('checked',true);
475
+ });
476
+
477
+ $j("#auto_type").change(function () {
478
+ var type = $j('select[name=auto_type]').val();
479
+ $j('.auto_type_options .export-options').hide();
480
+ $j('.auto_type_options .'+type+'-options').show();
481
+ });
482
+
483
+ $j("#auto_method").change(function () {
484
+ var type = $j('select[name=auto_method]').val();
485
+ $j('.auto_method_options .export-options').hide();
486
+ $j('.auto_method_options .'+type+'-options').show();
487
+ });
488
+
489
+ $j(document).ready(function() {
490
+ // This auto-selects the export type based on the link from the Overview screen
491
+ var href = jQuery(location).attr('href');
492
+ // If this is the Export tab
493
+ if (href.toLowerCase().indexOf('tab=export') >= 0) {
494
+ // If the URL includes an in-line link
495
+ if (href.toLowerCase().indexOf('#') >= 0 ) {
496
+ var type = href.substr(href.indexOf("#") + 1);
497
+ var type = type.replace('export-','');
498
+ $j('#'+type).trigger('click');
499
+ } else {
500
+ // This auto-selects the last known export type based on stored WordPress option, defaults to Products
501
+ var type = $j('input:radio[name=dataset]:checked').val();
502
+ $j('#'+type).trigger('click');
503
+ }
504
+ } else if (href.toLowerCase().indexOf('tab=settings') >= 0) {
505
+ $j("#auto_type").trigger("change");
506
+ $j("#auto_method").trigger("change");
507
+ } else {
508
+ // This auto-selects the last known export type based on stored WordPress option, defaults to Products
509
+ var type = $j('input:radio[name=dataset]:checked').val();
510
+ $j('#'+type).trigger('click');
511
+ }
512
+ });
513
+
514
+ });
templates/admin/images/animated-overlay.gif ADDED
Binary file
templates/admin/images/progress.gif ADDED
Binary file
templates/admin/images/ui-bg_flat_0_aaaaaa_40x100.png ADDED
Binary file
templates/admin/images/ui-bg_flat_75_ffffff_40x100.png ADDED
Binary file
templates/admin/images/ui-bg_glass_55_fbf9ee_1x400.png ADDED
Binary file
templates/admin/images/ui-bg_glass_65_ffffff_1x400.png ADDED
Binary file
templates/admin/images/ui-bg_glass_75_dadada_1x400.png ADDED
Binary file
templates/admin/images/ui-bg_glass_75_e6e6e6_1x400.png ADDED
Binary file
templates/admin/images/ui-bg_glass_95_fef1ec_1x400.png ADDED
Binary file
templates/admin/images/ui-bg_highlight-soft_75_cccccc_1x100.png ADDED
Binary file
templates/admin/images/ui-icons_222222_256x240.png ADDED
Binary file
templates/admin/images/ui-icons_2e83ff_256x240.png ADDED
Binary file
templates/admin/images/ui-icons_454545_256x240.png ADDED
Binary file
templates/admin/images/ui-icons_888888_256x240.png ADDED
Binary file
templates/admin/images/ui-icons_cd0a0a_256x240.png ADDED
Binary file
templates/admin/jquery-csvtable.css ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* CSV Table Classes */
2
+ TABLE.CSVTable {
3
+ font: 0.8em Verdana,Arial,Geneva,Helvetica,sans-serif;
4
+ border-collapse: collapse;
5
+ width: 450px;
6
+ }
7
+
8
+ /* Header */
9
+ TABLE.CSVTable THEAD TR {
10
+ background: #E8EDFF;
11
+ }
12
+ TABLE.CSVTable TH {
13
+ font-family: "Lucida Sans Unicode","Lucida Grande",Sans-Serif;
14
+ font-size: 1.2em;
15
+ }
16
+
17
+ /* Table Cells */
18
+ TABLE.CSVTable TD, TABLE.CSVTable TH {
19
+ padding: 8px;
20
+ text-align: left;
21
+ border-bottom: 1px solid #FFFFFF;
22
+ border-top: 1px solid transparent;
23
+ }
24
+ /* Default background color for rows */
25
+ TABLE.CSVTable TR {
26
+ background: #F0F0F0;
27
+ }
28
+ /* Background color for odd rows */
29
+ TABLE.CSVTable TR.odd {
30
+ background: #F9F9F9;
31
+ }
32
+ /* Hover color for all rows */
33
+ TABLE.CSVTable TR:hover {
34
+ background: #E8EDFF;
35
+ }
36
+
37
+ /* Source code */
38
+ .source {
39
+ background-color: #FAFAFA; border: 1px solid #999999
40
+ }
templates/admin/jquery-ui-datepicker.css ADDED
@@ -0,0 +1,347 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI CSS Framework
3
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
4
+ * Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
5
+ */
6
+
7
+ /* Layout helpers
8
+ ----------------------------------*/
9
+ .ui-helper-hidden { display: none; }
10
+ .ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
11
+ .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
12
+ .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
13
+ .ui-helper-clearfix { display: inline-block; }
14
+ /* required comment for clearfix to work in Opera \*/
15
+ * html .ui-helper-clearfix { height:1%; }
16
+ .ui-helper-clearfix { display:block; }
17
+ /* end clearfix */
18
+ .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
19
+
20
+
21
+ /* Interaction Cues
22
+ ----------------------------------*/
23
+ .ui-state-disabled { cursor: default !important; }
24
+
25
+
26
+ /* Icons
27
+ ----------------------------------*/
28
+
29
+ /* states and images */
30
+ .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
31
+
32
+
33
+ /* Misc visuals
34
+ ----------------------------------*/
35
+
36
+ /* Overlays */
37
+ .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
38
+
39
+
40
+
41
+ /*
42
+ * jQuery UI CSS Framework
43
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
44
+ * Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
45
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
46
+ */
47
+
48
+
49
+ /* Component containers
50
+ ----------------------------------*/
51
+ .ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
52
+ .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
53
+ .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
54
+ .ui-widget-content a { color: #222222; }
55
+ .ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
56
+ .ui-widget-header a { color: #222222; }
57
+
58
+ /* Interaction states
59
+ ----------------------------------*/
60
+ .ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; outline: none; }
61
+ .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; outline: none; }
62
+ .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; outline: none; }
63
+ .ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; outline: none; }
64
+ .ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; outline: none; }
65
+ .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; outline: none; text-decoration: none; }
66
+
67
+ /* Interaction Cues
68
+ ----------------------------------*/
69
+ .ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
70
+ .ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636; }
71
+ .ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
72
+ .ui-state-error a, .ui-widget-content .ui-state-error a { color: #cd0a0a; }
73
+ .ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #cd0a0a; }
74
+ .ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
75
+ .ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; }
76
+ .ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
77
+
78
+ /* Icons
79
+ ----------------------------------*/
80
+
81
+ /* states and images */
82
+ .ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
83
+ .ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
84
+ .ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
85
+ .ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
86
+ .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
87
+ .ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
88
+ .ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
89
+ .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
90
+
91
+ /* positioning */
92
+ .ui-icon-carat-1-n { background-position: 0 0; }
93
+ .ui-icon-carat-1-ne { background-position: -16px 0; }
94
+ .ui-icon-carat-1-e { background-position: -32px 0; }
95
+ .ui-icon-carat-1-se { background-position: -48px 0; }
96
+ .ui-icon-carat-1-s { background-position: -64px 0; }
97
+ .ui-icon-carat-1-sw { background-position: -80px 0; }
98
+ .ui-icon-carat-1-w { background-position: -96px 0; }
99
+ .ui-icon-carat-1-nw { background-position: -112px 0; }
100
+ .ui-icon-carat-2-n-s { background-position: -128px 0; }
101
+ .ui-icon-carat-2-e-w { background-position: -144px 0; }
102
+ .ui-icon-triangle-1-n { background-position: 0 -16px; }
103
+ .ui-icon-triangle-1-ne { background-position: -16px -16px; }
104
+ .ui-icon-triangle-1-e { background-position: -32px -16px; }
105
+ .ui-icon-triangle-1-se { background-position: -48px -16px; }
106
+ .ui-icon-triangle-1-s { background-position: -64px -16px; }
107
+ .ui-icon-triangle-1-sw { background-position: -80px -16px; }
108
+ .ui-icon-triangle-1-w { background-position: -96px -16px; }
109
+ .ui-icon-triangle-1-nw { background-position: -112px -16px; }
110
+ .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
111
+ .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
112
+ .ui-icon-arrow-1-n { background-position: 0 -32px; }
113
+ .ui-icon-arrow-1-ne { background-position: -16px -32px; }
114
+ .ui-icon-arrow-1-e { background-position: -32px -32px; }
115
+ .ui-icon-arrow-1-se { background-position: -48px -32px; }
116
+ .ui-icon-arrow-1-s { background-position: -64px -32px; }
117
+ .ui-icon-arrow-1-sw { background-position: -80px -32px; }
118
+ .ui-icon-arrow-1-w { background-position: -96px -32px; }
119
+ .ui-icon-arrow-1-nw { background-position: -112px -32px; }
120
+ .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
121
+ .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
122
+ .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
123
+ .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
124
+ .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
125
+ .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
126
+ .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
127
+ .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
128
+ .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
129
+ .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
130
+ .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
131
+ .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
132
+ .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
133
+ .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
134
+ .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
135
+ .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
136
+ .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
137
+ .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
138
+ .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
139
+ .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
140
+ .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
141
+ .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
142
+ .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
143
+ .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
144
+ .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
145
+ .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
146
+ .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
147
+ .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
148
+ .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
149
+ .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
150
+ .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
151
+ .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
152
+ .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
153
+ .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
154
+ .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
155
+ .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
156
+ .ui-icon-arrow-4 { background-position: 0 -80px; }
157
+ .ui-icon-arrow-4-diag { background-position: -16px -80px; }
158
+ .ui-icon-extlink { background-position: -32px -80px; }
159
+ .ui-icon-newwin { background-position: -48px -80px; }
160
+ .ui-icon-refresh { background-position: -64px -80px; }
161
+ .ui-icon-shuffle { background-position: -80px -80px; }
162
+ .ui-icon-transfer-e-w { background-position: -96px -80px; }
163
+ .ui-icon-transferthick-e-w { background-position: -112px -80px; }
164
+ .ui-icon-folder-collapsed { background-position: 0 -96px; }
165
+ .ui-icon-folder-open { background-position: -16px -96px; }
166
+ .ui-icon-document { background-position: -32px -96px; }
167
+ .ui-icon-document-b { background-position: -48px -96px; }
168
+ .ui-icon-note { background-position: -64px -96px; }
169
+ .ui-icon-mail-closed { background-position: -80px -96px; }
170
+ .ui-icon-mail-open { background-position: -96px -96px; }
171
+ .ui-icon-suitcase { background-position: -112px -96px; }
172
+ .ui-icon-comment { background-position: -128px -96px; }
173
+ .ui-icon-person { background-position: -144px -96px; }
174
+ .ui-icon-print { background-position: -160px -96px; }
175
+ .ui-icon-trash { background-position: -176px -96px; }
176
+ .ui-icon-locked { background-position: -192px -96px; }
177
+ .ui-icon-unlocked { background-position: -208px -96px; }
178
+ .ui-icon-bookmark { background-position: -224px -96px; }
179
+ .ui-icon-tag { background-position: -240px -96px; }
180
+ .ui-icon-home { background-position: 0 -112px; }
181
+ .ui-icon-flag { background-position: -16px -112px; }
182
+ .ui-icon-calendar { background-position: -32px -112px; }
183
+ .ui-icon-cart { background-position: -48px -112px; }
184
+ .ui-icon-pencil { background-position: -64px -112px; }
185
+ .ui-icon-clock { background-position: -80px -112px; }
186
+ .ui-icon-disk { background-position: -96px -112px; }
187
+ .ui-icon-calculator { background-position: -112px -112px; }
188
+ .ui-icon-zoomin { background-position: -128px -112px; }
189
+ .ui-icon-zoomout { background-position: -144px -112px; }
190
+ .ui-icon-search { background-position: -160px -112px; }
191
+ .ui-icon-wrench { background-position: -176px -112px; }
192
+ .ui-icon-gear { background-position: -192px -112px; }
193
+ .ui-icon-heart { background-position: -208px -112px; }
194
+ .ui-icon-star { background-position: -224px -112px; }
195
+ .ui-icon-link { background-position: -240px -112px; }
196
+ .ui-icon-cancel { background-position: 0 -128px; }
197
+ .ui-icon-plus { background-position: -16px -128px; }
198
+ .ui-icon-plusthick { background-position: -32px -128px; }
199
+ .ui-icon-minus { background-position: -48px -128px; }
200
+ .ui-icon-minusthick { background-position: -64px -128px; }
201
+ .ui-icon-close { background-position: -80px -128px; }
202
+ .ui-icon-closethick { background-position: -96px -128px; }
203
+ .ui-icon-key { background-position: -112px -128px; }
204
+ .ui-icon-lightbulb { background-position: -128px -128px; }
205
+ .ui-icon-scissors { background-position: -144px -128px; }
206
+ .ui-icon-clipboard { background-position: -160px -128px; }
207
+ .ui-icon-copy { background-position: -176px -128px; }
208
+ .ui-icon-contact { background-position: -192px -128px; }
209
+ .ui-icon-image { background-position: -208px -128px; }
210
+ .ui-icon-video { background-position: -224px -128px; }
211
+ .ui-icon-script { background-position: -240px -128px; }
212
+ .ui-icon-alert { background-position: 0 -144px; }
213
+ .ui-icon-info { background-position: -16px -144px; }
214
+ .ui-icon-notice { background-position: -32px -144px; }
215
+ .ui-icon-help { background-position: -48px -144px; }
216
+ .ui-icon-check { background-position: -64px -144px; }
217
+ .ui-icon-bullet { background-position: -80px -144px; }
218
+ .ui-icon-radio-off { background-position: -96px -144px; }
219
+ .ui-icon-radio-on { background-position: -112px -144px; }
220
+ .ui-icon-pin-w { background-position: -128px -144px; }
221
+ .ui-icon-pin-s { background-position: -144px -144px; }
222
+ .ui-icon-play { background-position: 0 -160px; }
223
+ .ui-icon-pause { background-position: -16px -160px; }
224
+ .ui-icon-seek-next { background-position: -32px -160px; }
225
+ .ui-icon-seek-prev { background-position: -48px -160px; }
226
+ .ui-icon-seek-end { background-position: -64px -160px; }
227
+ .ui-icon-seek-first { background-position: -80px -160px; }
228
+ .ui-icon-stop { background-position: -96px -160px; }
229
+ .ui-icon-eject { background-position: -112px -160px; }
230
+ .ui-icon-volume-off { background-position: -128px -160px; }
231
+ .ui-icon-volume-on { background-position: -144px -160px; }
232
+ .ui-icon-power { background-position: 0 -176px; }
233
+ .ui-icon-signal-diag { background-position: -16px -176px; }
234
+ .ui-icon-signal { background-position: -32px -176px; }
235
+ .ui-icon-battery-0 { background-position: -48px -176px; }
236
+ .ui-icon-battery-1 { background-position: -64px -176px; }
237
+ .ui-icon-battery-2 { background-position: -80px -176px; }
238
+ .ui-icon-battery-3 { background-position: -96px -176px; }
239
+ .ui-icon-circle-plus { background-position: 0 -192px; }
240
+ .ui-icon-circle-minus { background-position: -16px -192px; }
241
+ .ui-icon-circle-close { background-position: -32px -192px; }
242
+ .ui-icon-circle-triangle-e { background-position: -48px -192px; }
243
+ .ui-icon-circle-triangle-s { background-position: -64px -192px; }
244
+ .ui-icon-circle-triangle-w { background-position: -80px -192px; }
245
+ .ui-icon-circle-triangle-n { background-position: -96px -192px; }
246
+ .ui-icon-circle-arrow-e { background-position: -112px -192px; }
247
+ .ui-icon-circle-arrow-s { background-position: -128px -192px; }
248
+ .ui-icon-circle-arrow-w { background-position: -144px -192px; }
249
+ .ui-icon-circle-arrow-n { background-position: -160px -192px; }
250
+ .ui-icon-circle-zoomin { background-position: -176px -192px; }
251
+ .ui-icon-circle-zoomout { background-position: -192px -192px; }
252
+ .ui-icon-circle-check { background-position: -208px -192px; }
253
+ .ui-icon-circlesmall-plus { background-position: 0 -208px; }
254
+ .ui-icon-circlesmall-minus { background-position: -16px -208px; }
255
+ .ui-icon-circlesmall-close { background-position: -32px -208px; }
256
+ .ui-icon-squaresmall-plus { background-position: -48px -208px; }
257
+ .ui-icon-squaresmall-minus { background-position: -64px -208px; }
258
+ .ui-icon-squaresmall-close { background-position: -80px -208px; }
259
+ .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
260
+ .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
261
+ .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
262
+ .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
263
+ .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
264
+ .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
265
+
266
+
267
+ /* Misc visuals
268
+ ----------------------------------*/
269
+
270
+ /* Corner radius */
271
+ .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; }
272
+ .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; }
273
+ .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; }
274
+ .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
275
+ .ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; }
276
+ .ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
277
+ .ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
278
+ .ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; }
279
+ .ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; }
280
+
281
+ /* Overlays */
282
+ .ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
283
+ .ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; }/* Datepicker
284
+ ----------------------------------*/
285
+ .ui-datepicker { width: 17em; padding: .2em .2em 0; }
286
+ .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
287
+ .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
288
+ .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
289
+ .ui-datepicker .ui-datepicker-prev { left:2px; }
290
+ .ui-datepicker .ui-datepicker-next { right:2px; }
291
+ .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
292
+ .ui-datepicker .ui-datepicker-next-hover { right:1px; }
293
+ .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
294
+ .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
295
+ .ui-datepicker .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; }
296
+ .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
297
+ .ui-datepicker select.ui-datepicker-month,
298
+ .ui-datepicker select.ui-datepicker-year { width: 49%;}
299
+ .ui-datepicker .ui-datepicker-title select.ui-datepicker-year { float: right; }
300
+ .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
301
+ .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
302
+ .ui-datepicker td { border: 0; padding: 1px; }
303
+ .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
304
+ .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
305
+ .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
306
+ .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
307
+
308
+ /* with multiple calendars */
309
+ .ui-datepicker.ui-datepicker-multi { width:auto; }
310
+ .ui-datepicker-multi .ui-datepicker-group { float:left; }
311
+ .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
312
+ .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
313
+ .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
314
+ .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
315
+ .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
316
+ .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
317
+ .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
318
+ .ui-datepicker-row-break { clear:both; width:100%; }
319
+
320
+ /* RTL support */
321
+ .ui-datepicker-rtl { direction: rtl; }
322
+ .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
323
+ .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
324
+ .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
325
+ .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
326
+ .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
327
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
328
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
329
+ .ui-datepicker-rtl .ui-datepicker-group { float:right; }
330
+ .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
331
+ .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
332
+
333
+ /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
334
+ .ui-datepicker-cover {
335
+ display: none; /*sorry for IE5*/
336
+ display/**/: block; /*sorry for IE5*/
337
+ position: absolute; /*must have*/
338
+ z-index: -1; /*must have*/
339
+ filter: mask(); /*must have*/
340
+ top: -4px; /*must have*/
341
+ left: -4px; /*must have*/
342
+ width: 200px; /*must have*/
343
+ height: 200px; /*must have*/
344
+ }
345
+
346
+ /* Icon Cursor Mouseover */
347
+ img.ui-datepicker-trigger { cursor:pointer; }
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 ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <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 -->
templates/admin/media-export_details.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="postbox-container">
2
+ <div class="postbox">
3
+ <h3 class="hndle"><?php _e( 'Export Details', 'woocommerce-exporter' ); ?></h3>
4
+ <div class="inside">
5
+
6
+ <table class="widefat" style="font-family:monospace;">
7
+ <tbody>
8
+
9
+ <tr>
10
+ <th style="width:20%;"><?php _e( 'Export type', 'woocommerce-exporter' ); ?></th>
11
+ <td><?php echo woo_ce_export_type_label( $export_type ); ?></td>
12
+ </tr>
13
+ <tr>
14
+ <th><?php _e( 'Filepath', 'woocommerce-exporter' ); ?></th>
15
+ <td><?php echo $filepath; ?></td>
16
+ </tr>
17
+ <tr>
18
+ <th><?php _e( 'Total columns', 'woocommerce-exporter' ); ?></th>
19
+ <td><?php echo ( ( $columns != false ) ? $columns : '-' ); ?></td>
20
+ </tr>
21
+ <tr>
22
+ <th><?php _e( 'Total rows', 'woocommerce-exporter' ); ?></th>
23
+ <td><?php echo ( ( $rows != false ) ? $rows : '-' ); ?></td>
24
+ </tr>
25
+ <tr>
26
+ <th><?php _e( 'Process time', 'woocommerce-exporter' ); ?></th>
27
+ <td><?php echo ( ( ( $start_time != false ) && ( $end_time != false ) ) ? woo_ce_display_time_elapsed( $start_time, $end_time ) : '-' ); ?></td>
28
+ </tr>
29
+ <tr>
30
+ <th><?php _e( 'Idle memory usage (start)', 'woocommerce-exporter' ); ?></th>
31
+ <td><?php echo ( ( $idle_memory_start != false ) ? woo_ce_display_memory( $idle_memory_start ) : '-' ); ?></td>
32
+ </tr>
33
+ <tr>
34
+ <th><?php _e( 'Memory usage prior to loading export type', 'woocommerce-exporter' ); ?></th>
35
+ <td><?php echo ( ( $data_memory_start != false ) ? woo_ce_display_memory( $data_memory_start ) : '-' ); ?></td>
36
+ </tr>
37
+ <tr>
38
+ <th><?php _e( 'Memory usage after loading export type', 'woocommerce-exporter' ); ?></th>
39
+ <td><?php echo ( ( $data_memory_end != false ) ? woo_ce_display_memory( $data_memory_end ) : '-' ); ?></td>
40
+ </tr>
41
+ <tr>
42
+ <th><?php _e( 'Memory usage at render time', 'woocommerce-exporter' ); ?></th>
43
+ <td>-</td>
44
+ </tr>
45
+ <tr>
46
+ <th><?php _e( 'Idle memory usage (end)', 'woocommerce-exporter' ); ?></th>
47
+ <td><?php echo ( ( $idle_memory_end != false ) ? woo_ce_display_memory( $idle_memory_end ) : '-' ); ?></td>
48
+ </tr>
49
+
50
+ </tbody>
51
+ </table>
52
+
53
+ </div>
54
+ <!-- .inside -->
55
+ </div>
56
+ <!-- .postbox -->
57
+ </div>
58
+ <!-- .postbox-container -->
templates/admin/tabs-archive.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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" />
18
+ <form action="" method="GET">
19
+ <table class="widefat fixed media" cellspacing="0">
20
+ <thead>
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>
31
+ <tfoot>
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>
42
+ <tbody id="the-list">
43
+
44
+ <?php if( $files ) { ?>
45
+ <?php foreach( $files as $file ) { ?>
46
+ <tr id="post-<?php echo $file->ID; ?>" class="author-self status-<?php echo $file->post_status; ?>" valign="top">
47
+ <td class="column-icon media-icon">
48
+ <?php echo $file->media_icon; ?>
49
+ </td>
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>
62
+ </tr>
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
+
70
+ </tbody>
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">
78
+ </div>
79
+ <!-- .tablenav -->
80
+ </form>
templates/admin/tabs-export.php ADDED
@@ -0,0 +1,990 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <li><a href="#export-modules"><?php _e( 'Export Modules', 'woocommerce-exporter' ); ?></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.', 'woocommerce-exporter' ); ?></p>
11
+ <div id="poststuff">
12
+ <form method="post" action="<?php echo esc_url( 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', 'woocommerce-exporter' ); ?></h3>
16
+ <div class="inside">
17
+ <p class="description"><?php _e( 'Select the data type you want to export.', 'woocommerce-exporter' ); ?></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', 'woocommerce-exporter' ); ?></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', 'woocommerce-exporter' ); ?></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', 'woocommerce-exporter' ); ?></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', 'woocommerce-exporter' ); ?></label>
54
+ </th>
55
+ <td>
56
+ <span class="description">(<?php echo $brands; ?>)</span>
57
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $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', 'woocommerce-exporter' ); ?></label>
65
+ </th>
66
+ <td>
67
+ <span class="description">(<?php echo $orders; ?>)</span>
68
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $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', 'woocommerce-exporter' ); ?></label>
76
+ </th>
77
+ <td>
78
+ <span class="description">(<?php echo $customers; ?>)</span>
79
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $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', 'woocommerce-exporter' ); ?></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', 'woocommerce-exporter' ); ?></label>
97
+ </th>
98
+ <td>
99
+ <span class="description">(<?php echo $coupons; ?>)</span>
100
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $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', 'woocommerce-exporter' ); ?></label>
108
+ </th>
109
+ <td>
110
+ <span class="description">(<?php echo $subscriptions; ?>)</span>
111
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $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', 'woocommerce-exporter' ); ?></label>
119
+ </th>
120
+ <td>
121
+ <span class="description">(<?php echo $product_vendors; ?>)</span>
122
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
123
+ </td>
124
+ </tr>
125
+
126
+ <tr>
127
+ <th>
128
+ <input type="radio" id="commission" name="dataset" value="commission"<?php disabled( $commissions, 0 ); ?><?php checked( $export_type, 'commission' ); ?> />
129
+ <label for="commission"><?php _e( 'Commissions', 'woocommerce-exporter' ); ?></label>
130
+ </th>
131
+ <td>
132
+ <span class="description">(<?php echo $commissions; ?>)</span>
133
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
134
+ </td>
135
+ </tr>
136
+
137
+ <tr>
138
+ <th>
139
+ <input type="radio" id="shipping_class" name="dataset" value="shipping_class"<?php disabled( $shipping_classes, 0 ); ?><?php checked( $export_type, 'shipping_class' ); ?> />
140
+ <label for="shipping_class"><?php _e( 'Shipping Classes', 'woocommerce-exporter' ); ?></label>
141
+ </th>
142
+ <td>
143
+ <span class="description">(<?php echo $shipping_classes; ?>)</span>
144
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
145
+ </td>
146
+ </tr>
147
+
148
+ <!--
149
+ <tr>
150
+ <th>
151
+ <input type="radio" id="attribute" name="dataset" value="attribute"<?php disabled( $attributes, 0 ); ?><?php checked( $export_type, 'attribute' ); ?> />
152
+ <label for="attribute"><?php _e( 'Attributes', 'woocommerce-exporter' ); ?></label>
153
+ </th>
154
+ <td>
155
+ <span class="description">(<?php echo $attributes; ?>)</span>
156
+ </td>
157
+ </tr>
158
+ -->
159
+
160
+ </table>
161
+ <!-- .form-table -->
162
+ </div>
163
+ <!-- .inside -->
164
+ </div>
165
+ <!-- .postbox -->
166
+
167
+ <?php if( $product_fields ) { ?>
168
+ <div id="export-product" class="export-types">
169
+
170
+ <div class="postbox">
171
+ <h3 class="hndle">
172
+ <?php _e( 'Product Fields', 'woocommerce-exporter' ); ?>
173
+ <a href="<?php echo esc_url( add_query_arg( array( 'tab' => 'fields', 'type' => 'product' ) ) ); ?>" style="float:right;"><?php _e( 'Configure', 'woocommerce-exporter' ); ?></a>
174
+ </h3>
175
+ <div class="inside">
176
+ <?php if( $products ) { ?>
177
+ <p class="description"><?php _e( 'Select the Product fields you would like to export, your field selection is saved for future exports.', 'woocommerce-exporter' ); ?></p>
178
+ <p>
179
+ <a href="javascript:void(0)" id="product-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
180
+ <a href="javascript:void(0)" id="product-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
181
+ <a href="javascript:void(0)" id="product-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
182
+ </p>
183
+ <table id="product-fields" class="ui-sortable">
184
+
185
+ <?php foreach( $product_fields as $product_field ) { ?>
186
+ <tr id="product-<?php echo $product_field['reset']; ?>">
187
+ <td>
188
+ <label<?php if( isset( $product_field['hover'] ) ) { ?> title="<?php echo $product_field['hover']; ?>"<?php } ?>>
189
+ <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 ); ?> />
190
+ <?php echo $product_field['label']; ?>
191
+ <?php if( $product_field['disabled'] ) { ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span><?php } ?>
192
+ <input type="hidden" name="product_fields_order[<?php echo $product_field['name']; ?>]" class="field_order" value="<?php echo $product_field['order']; ?>" />
193
+ </label>
194
+ </td>
195
+ </tr>
196
+
197
+ <?php } ?>
198
+ </table>
199
+ <p class="submit">
200
+ <input type="submit" id="export_product" value="<?php _e( 'Export Products', 'woocommerce-exporter' ); ?> " class="button-primary" />
201
+ </p>
202
+ <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>
203
+ <?php } else { ?>
204
+ <p><?php _e( 'No Products were found.', 'woocommerce-exporter' ); ?></p>
205
+ <?php } ?>
206
+ </div>
207
+ </div>
208
+ <!-- .postbox -->
209
+
210
+ <div id="export-products-filters" class="postbox">
211
+ <h3 class="hndle"><?php _e( 'Product Filters', 'woocommerce-exporter' ); ?></h3>
212
+ <div class="inside">
213
+
214
+ <?php do_action( 'woo_ce_export_product_options_before_table' ); ?>
215
+
216
+ <table class="form-table">
217
+ <?php do_action( 'woo_ce_export_product_options_table' ); ?>
218
+ </table>
219
+
220
+ <?php do_action( 'woo_ce_export_product_options_after_table' ); ?>
221
+
222
+ </div>
223
+ <!-- .inside -->
224
+
225
+ </div>
226
+ <!-- .postbox -->
227
+
228
+ </div>
229
+ <!-- #export-product -->
230
+
231
+ <?php } ?>
232
+ <?php if( $category_fields ) { ?>
233
+ <div id="export-category" class="export-types">
234
+
235
+ <div class="postbox">
236
+ <h3 class="hndle">
237
+ <?php _e( 'Category Fields', 'woocommerce-exporter' ); ?>
238
+ <a href="<?php echo esc_url( add_query_arg( array( 'tab' => 'fields', 'type' => 'category' ) ) ); ?>" style="float:right;"><?php _e( 'Configure', 'woocommerce-exporter' ); ?></a>
239
+ </h3>
240
+ <div class="inside">
241
+ <p class="description"><?php _e( 'Select the Category fields you would like to export.', 'woocommerce-exporter' ); ?></p>
242
+ <p>
243
+ <a href="javascript:void(0)" id="category-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
244
+ <a href="javascript:void(0)" id="category-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
245
+ <a href="javascript:void(0)" id="category-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
246
+ </p>
247
+ <table id="category-fields" class="ui-sortable">
248
+
249
+ <?php foreach( $category_fields as $category_field ) { ?>
250
+ <tr id="category-<?php echo $category_field['reset']; ?>">
251
+ <td>
252
+ <label<?php if( isset( $category_field['hover'] ) ) { ?> title="<?php echo $category_field['hover']; ?>"<?php } ?>>
253
+ <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 ); ?> />
254
+ <?php echo $category_field['label']; ?>
255
+ <input type="hidden" name="category_fields_order[<?php echo $category_field['name']; ?>]" class="field_order" value="<?php echo $category_field['order']; ?>" />
256
+ </label>
257
+ </td>
258
+ </tr>
259
+
260
+ <?php } ?>
261
+ </table>
262
+ <p class="submit">
263
+ <input type="submit" id="export_category" value="<?php _e( 'Export Categories', 'woocommerce-exporter' ); ?> " class="button-primary" />
264
+ </p>
265
+ <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>
266
+ </div>
267
+ <!-- .inside -->
268
+ </div>
269
+ <!-- .postbox -->
270
+
271
+ <div id="export-categories-filters" class="postbox">
272
+ <h3 class="hndle"><?php _e( 'Category Filters', 'woocommerce-exporter' ); ?></h3>
273
+ <div class="inside">
274
+
275
+ <?php do_action( 'woo_ce_export_category_options_before_table' ); ?>
276
+
277
+ <table class="form-table">
278
+ <?php do_action( 'woo_ce_export_category_options_table' ); ?>
279
+ </table>
280
+
281
+ <?php do_action( 'woo_ce_export_category_options_after_table' ); ?>
282
+
283
+ </div>
284
+ <!-- .inside -->
285
+ </div>
286
+ <!-- #export-categories-filters -->
287
+
288
+ </div>
289
+ <!-- #export-category -->
290
+ <?php } ?>
291
+ <?php if( $tag_fields ) { ?>
292
+ <div id="export-tag" class="export-types">
293
+
294
+ <div class="postbox">
295
+ <h3 class="hndle">
296
+ <?php _e( 'Tag Fields', 'woocommerce-exporter' ); ?>
297
+ <a href="<?php echo esc_url( add_query_arg( array( 'tab' => 'fields', 'type' => 'tag' ) ) ); ?>" style="float:right;"><?php _e( 'Configure', 'woocommerce-exporter' ); ?></a>
298
+ </h3>
299
+ <div class="inside">
300
+ <p class="description"><?php _e( 'Select the Tag fields you would like to export.', 'woocommerce-exporter' ); ?></p>
301
+ <p>
302
+ <a href="javascript:void(0)" id="tag-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
303
+ <a href="javascript:void(0)" id="tag-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
304
+ <a href="javascript:void(0)" id="tag-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
305
+ </p>
306
+ <table id="tag-fields" class="ui-sortable">
307
+
308
+ <?php foreach( $tag_fields as $tag_field ) { ?>
309
+ <tr id="tag-<?php echo $tag_field['reset']; ?>">
310
+ <td>
311
+ <label<?php if( isset( $tag_field['hover'] ) ) { ?> title="<?php echo $tag_field['hover']; ?>"<?php } ?>>
312
+ <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 ); ?> />
313
+ <?php echo $tag_field['label']; ?>
314
+ <input type="hidden" name="tag_fields_order[<?php echo $tag_field['name']; ?>]" class="field_order" value="<?php echo $tag_field['order']; ?>" />
315
+ </label>
316
+ </td>
317
+ </tr>
318
+
319
+ <?php } ?>
320
+ </table>
321
+ <p class="submit">
322
+ <input type="submit" id="export_tag" value="<?php _e( 'Export Tags', 'woocommerce-exporter' ); ?> " class="button-primary" />
323
+ </p>
324
+ <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>
325
+ </div>
326
+ <!-- .inside -->
327
+ </div>
328
+ <!-- .postbox -->
329
+
330
+ <div id="export-tags-filters" class="postbox">
331
+ <h3 class="hndle"><?php _e( 'Product Tag Filters', 'woocommerce-exporter' ); ?></h3>
332
+ <div class="inside">
333
+
334
+ <?php do_action( 'woo_ce_export_tag_options_before_table' ); ?>
335
+
336
+ <table class="form-table">
337
+ <?php do_action( 'woo_ce_export_tag_options_table' ); ?>
338
+ </table>
339
+
340
+ <?php do_action( 'woo_ce_export_tag_options_after_table' ); ?>
341
+
342
+ </div>
343
+ <!-- .inside -->
344
+ </div>
345
+ <!-- #export-tags-filters -->
346
+
347
+ </div>
348
+ <!-- #export-tag -->
349
+ <?php } ?>
350
+
351
+ <?php if( $brand_fields ) { ?>
352
+ <div id="export-brand" class="export-types">
353
+
354
+ <div class="postbox">
355
+ <h3 class="hndle">
356
+ <?php _e( 'Brand Fields', 'woocommerce-exporter' ); ?>
357
+ </h3>
358
+ <div class="inside">
359
+ <?php if( $brands ) { ?>
360
+ <p class="description"><?php _e( 'Select the Brand fields you would like to export.', 'woocommerce-exporter' ); ?></p>
361
+ <p>
362
+ <a href="javascript:void(0)" id="brand-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
363
+ <a href="javascript:void(0)" id="brand-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
364
+ <a href="javascript:void(0)" id="brand-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
365
+ </p>
366
+ <table id="brand-fields" class="ui-sortable">
367
+
368
+ <?php foreach( $brand_fields as $brand_field ) { ?>
369
+ <tr id="brand-<?php echo $brand_field['reset']; ?>">
370
+ <td>
371
+ <label<?php if( isset( $brand_field['hover'] ) ) { ?> title="<?php echo $brand_field['hover']; ?>"<?php } ?>>
372
+ <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" />
373
+ <?php echo $brand_field['label']; ?>
374
+ <input type="hidden" name="brand_fields_order[<?php echo $brand_field['name']; ?>]" class="field_order" value="<?php echo $brand_field['order']; ?>" />
375
+ </label>
376
+ </td>
377
+ </tr>
378
+
379
+ <?php } ?>
380
+ </table>
381
+ <p class="submit">
382
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Brands', 'woocommerce-exporter' ); ?>" />
383
+ </p>
384
+ <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>
385
+ <?php } else { ?>
386
+ <p><?php _e( 'No Brands were found.', 'woocommerce-exporter' ); ?></p>
387
+ <?php } ?>
388
+ </div>
389
+ <!-- .inside -->
390
+ </div>
391
+ <!-- .postbox -->
392
+
393
+ <div id="export-brands-filters" class="postbox">
394
+ <h3 class="hndle"><?php _e( 'Brand Filters', 'woocommerce-exporter' ); ?></h3>
395
+ <div class="inside">
396
+
397
+ <?php do_action( 'woo_ce_export_brand_options_before_table' ); ?>
398
+
399
+ <table class="form-table">
400
+ <?php do_action( 'woo_ce_export_brand_options_table' ); ?>
401
+ </table>
402
+
403
+ <?php do_action( 'woo_ce_export_brand_options_after_table' ); ?>
404
+
405
+ </div>
406
+ <!-- .inside -->
407
+ </div>
408
+ <!-- .postbox -->
409
+
410
+ </div>
411
+ <!-- #export-brand -->
412
+
413
+ <?php } ?>
414
+ <?php if( $order_fields ) { ?>
415
+ <div id="export-order" class="export-types">
416
+
417
+ <div class="postbox">
418
+ <h3 class="hndle">
419
+ <?php _e( 'Order Fields', 'woocommerce-exporter' ); ?>
420
+ </h3>
421
+ <div class="inside">
422
+
423
+ <?php if( $orders ) { ?>
424
+ <p class="description"><?php _e( 'Select the Order fields you would like to export.', 'woocommerce-exporter' ); ?></p>
425
+ <p>
426
+ <a href="javascript:void(0)" id="order-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
427
+ <a href="javascript:void(0)" id="order-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
428
+ <a href="javascript:void(0)" id="order-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
429
+ </p>
430
+ <table id="order-fields" class="ui-sortable">
431
+
432
+ <?php foreach( $order_fields as $order_field ) { ?>
433
+ <tr id="order-<?php echo $order_field['reset']; ?>">
434
+ <td>
435
+ <label<?php if( isset( $order_field['hover'] ) ) { ?> title="<?php echo $order_field['hover']; ?>"<?php } ?>>
436
+ <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" />
437
+ <?php echo $order_field['label']; ?>
438
+ <input type="hidden" name="order_fields_order[<?php echo $order_field['name']; ?>]" class="field_order" value="<?php echo $order_field['order']; ?>" />
439
+ </label>
440
+ </td>
441
+ </tr>
442
+
443
+ <?php } ?>
444
+ </table>
445
+ <p class="submit">
446
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Orders', 'woocommerce-exporter' ); ?>" />
447
+ </p>
448
+ <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>
449
+ <?php } else { ?>
450
+ <p><?php _e( 'No Orders were found.', 'woocommerce-exporter' ); ?></p>
451
+ <?php } ?>
452
+
453
+ </div>
454
+ </div>
455
+ <!-- .postbox -->
456
+
457
+ <div id="export-orders-filters" class="postbox">
458
+ <h3 class="hndle"><?php _e( 'Order Filters', 'woocommerce-exporter' ); ?></h3>
459
+ <div class="inside">
460
+
461
+ <?php do_action( 'woo_ce_export_order_options_before_table' ); ?>
462
+
463
+ <table class="form-table">
464
+ <?php do_action( 'woo_ce_export_order_options_table' ); ?>
465
+ </table>
466
+
467
+ <?php do_action( 'woo_ce_export_order_options_after_table' ); ?>
468
+
469
+ </div>
470
+ <!-- .inside -->
471
+ </div>
472
+ <!-- .postbox -->
473
+
474
+ </div>
475
+ <!-- #export-order -->
476
+
477
+ <?php } ?>
478
+ <?php if( $customer_fields ) { ?>
479
+ <div id="export-customer" class="export-types">
480
+
481
+ <div class="postbox">
482
+ <h3 class="hndle">
483
+ <?php _e( 'Customer Fields', 'woocommerce-exporter' ); ?>
484
+ </h3>
485
+ <div class="inside">
486
+ <?php if( $customers ) { ?>
487
+ <p class="description"><?php _e( 'Select the Customer fields you would like to export.', 'woocommerce-exporter' ); ?></p>
488
+ <p>
489
+ <a href="javascript:void(0)" id="customer-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
490
+ <a href="javascript:void(0)" id="customer-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
491
+ <a href="javascript:void(0)" id="customer-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
492
+ </p>
493
+ <table id="customer-fields" class="ui-sortable">
494
+
495
+ <?php foreach( $customer_fields as $customer_field ) { ?>
496
+ <tr id="customer-<?php echo $customer_field['reset']; ?>">
497
+ <td>
498
+ <label<?php if( isset( $customer_field['hover'] ) ) { ?> title="<?php echo $customer_field['hover']; ?>"<?php } ?>>
499
+ <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" />
500
+ <?php echo $customer_field['label']; ?>
501
+ <input type="hidden" name="customer_fields_order[<?php echo $customer_field['name']; ?>]" class="field_order" value="<?php echo $customer_field['order']; ?>" />
502
+ </label>
503
+ </td>
504
+ </tr>
505
+
506
+ <?php } ?>
507
+ </table>
508
+ <p class="submit">
509
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Customers', 'woocommerce-exporter' ); ?>" />
510
+ </p>
511
+ <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>
512
+ <?php } else { ?>
513
+ <p><?php _e( 'No Customers were found.', 'woocommerce-exporter' ); ?></p>
514
+ <?php } ?>
515
+ </div>
516
+ <!-- .inside -->
517
+ </div>
518
+ <!-- .postbox -->
519
+
520
+ <div id="export-customers-filters" class="postbox">
521
+ <h3 class="hndle"><?php _e( 'Customer Filters', 'woocommerce-exporter' ); ?></h3>
522
+ <div class="inside">
523
+
524
+ <?php do_action( 'woo_ce_export_customer_options_before_table' ); ?>
525
+
526
+ <table class="form-table">
527
+ <?php do_action( 'woo_ce_export_customer_options_table' ); ?>
528
+ </table>
529
+
530
+ <?php do_action( 'woo_ce_export_customer_options_after_table' ); ?>
531
+
532
+ </div>
533
+ <!-- .inside -->
534
+ </div>
535
+ <!-- .postbox -->
536
+
537
+ </div>
538
+ <!-- #export-customer -->
539
+
540
+ <?php } ?>
541
+ <?php if( $user_fields ) { ?>
542
+ <div id="export-user" class="export-types">
543
+
544
+ <div class="postbox">
545
+ <h3 class="hndle">
546
+ <?php _e( 'User Fields', 'woocommerce-exporter' ); ?>
547
+ <a href="<?php echo esc_url( add_query_arg( array( 'tab' => 'fields', 'type' => 'user' ) ) ); ?>" style="float:right;"><?php _e( 'Configure', 'woocommerce-exporter' ); ?></a>
548
+ </h3>
549
+ <div class="inside">
550
+ <?php if( $users ) { ?>
551
+ <p class="description"><?php _e( 'Select the User fields you would like to export.', 'woocommerce-exporter' ); ?></p>
552
+ <p>
553
+ <a href="javascript:void(0)" id="user-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
554
+ <a href="javascript:void(0)" id="user-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
555
+ <a href="javascript:void(0)" id="user-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
556
+ </p>
557
+ <table id="user-fields" class="ui-sortable">
558
+
559
+ <?php foreach( $user_fields as $user_field ) { ?>
560
+ <tr id="user-<?php echo $user_field['reset']; ?>">
561
+ <td>
562
+ <label<?php if( isset( $user_field['hover'] ) ) { ?> title="<?php echo $user_field['hover']; ?>"<?php } ?>>
563
+ <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 ); ?> />
564
+ <?php echo $user_field['label']; ?>
565
+ <?php if( $user_field['disabled'] ) { ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span><?php } ?>
566
+ <input type="hidden" name="user_fields_order[<?php echo $user_field['name']; ?>]" class="field_order" value="<?php echo $user_field['order']; ?>" />
567
+ </label>
568
+ </td>
569
+ </tr>
570
+
571
+ <?php } ?>
572
+ </table>
573
+ <p class="submit">
574
+ <input type="submit" id="export_user" class="button-primary" value="<?php _e( 'Export Users', 'woocommerce-exporter' ); ?>" />
575
+ </p>
576
+ <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>
577
+ <?php } else { ?>
578
+ <p><?php _e( 'No Users were found.', 'woocommerce-exporter' ); ?></p>
579
+ <?php } ?>
580
+ </div>
581
+ <!-- .inside -->
582
+ </div>
583
+ <!-- .postbox -->
584
+
585
+ <div id="export-users-filters" class="postbox">
586
+ <h3 class="hndle"><?php _e( 'User Filters', 'woocommerce-exporter' ); ?></h3>
587
+ <div class="inside">
588
+
589
+ <?php do_action( 'woo_ce_export_user_options_before_table' ); ?>
590
+
591
+ <table class="form-table">
592
+ <?php do_action( 'woo_ce_export_user_options_table' ); ?>
593
+ </table>
594
+
595
+ <?php do_action( 'woo_ce_export_user_options_after_table' ); ?>
596
+
597
+ </div>
598
+ <!-- .inside -->
599
+ </div>
600
+ <!-- .postbox -->
601
+
602
+ </div>
603
+ <!-- #export-user -->
604
+
605
+ <?php } ?>
606
+ <?php if( $coupon_fields ) { ?>
607
+ <div id="export-coupon" class="export-types">
608
+
609
+ <div class="postbox">
610
+ <h3 class="hndle">
611
+ <?php _e( 'Coupon Fields', 'woocommerce-exporter' ); ?>
612
+ </h3>
613
+ <div class="inside">
614
+ <?php if( $coupons ) { ?>
615
+ <p class="description"><?php _e( 'Select the Coupon fields you would like to export.', 'woocommerce-exporter' ); ?></p>
616
+ <p>
617
+ <a href="javascript:void(0)" id="coupon-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
618
+ <a href="javascript:void(0)" id="coupon-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
619
+ <a href="javascript:void(0)" id="coupon-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
620
+ </p>
621
+ <table id="coupon-fields" class="ui-sortable">
622
+
623
+ <?php foreach( $coupon_fields as $coupon_field ) { ?>
624
+ <tr id="coupon-<?php echo $coupon_field['reset']; ?>">
625
+ <td>
626
+ <label<?php if( isset( $coupon_field['hover'] ) ) { ?> title="<?php echo $coupon_field['hover']; ?>"<?php } ?>>
627
+ <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" />
628
+ <?php echo $coupon_field['label']; ?>
629
+ <input type="hidden" name="coupon_fields_order[<?php echo $coupon_field['name']; ?>]" class="field_order" value="<?php echo $coupon_field['order']; ?>" />
630
+ </label>
631
+ </td>
632
+ </tr>
633
+
634
+ <?php } ?>
635
+ </table>
636
+ <p class="submit">
637
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Coupons', 'woocommerce-exporter' ); ?>" />
638
+ </p>
639
+ <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>
640
+ <?php } else { ?>
641
+ <p><?php _e( 'No Coupons were found.', 'woocommerce-exporter' ); ?></p>
642
+ <?php } ?>
643
+ </div>
644
+ <!-- .inside -->
645
+ </div>
646
+ <!-- .postbox -->
647
+
648
+ <div id="export-coupons-filters" class="postbox">
649
+ <h3 class="hndle"><?php _e( 'Coupon Filters', 'woocommerce-exporter' ); ?></h3>
650
+ <div class="inside">
651
+
652
+ <?php do_action( 'woo_ce_export_coupon_options_before_table' ); ?>
653
+
654
+ <table class="form-table">
655
+ <?php do_action( 'woo_ce_export_coupon_options_table' ); ?>
656
+ </table>
657
+
658
+ <?php do_action( 'woo_ce_export_coupon_options_after_table' ); ?>
659
+
660
+ </div>
661
+ <!-- .inside -->
662
+ </div>
663
+ <!-- .postbox -->
664
+
665
+ </div>
666
+ <!-- #export-coupon -->
667
+
668
+ <?php } ?>
669
+ <?php if( $subscription_fields ) { ?>
670
+ <div id="export-subscription" class="export-types">
671
+
672
+ <div class="postbox">
673
+ <h3 class="hndle">
674
+ <?php _e( 'Subscription Fields', 'woocommerce-exporter' ); ?>
675
+ </h3>
676
+ <div class="inside">
677
+ <?php if( $subscriptions ) { ?>
678
+ <p class="description"><?php _e( 'Select the Subscription fields you would like to export.', 'woocommerce-exporter' ); ?></p>
679
+ <p>
680
+ <a href="javascript:void(0)" id="subscription-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
681
+ <a href="javascript:void(0)" id="subscription-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
682
+ <a href="javascript:void(0)" id="subscription-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
683
+ </p>
684
+ <table id="subscription-fields" class="ui-sortable">
685
+
686
+ <?php foreach( $subscription_fields as $subscription_field ) { ?>
687
+ <tr id="subscription-<?php echo $subscription_field['reset']; ?>">
688
+ <td>
689
+ <label<?php if( isset( $subscription_field['hover'] ) ) { ?> title="<?php echo $subscription_field['hover']; ?>"<?php } ?>>
690
+ <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" />
691
+ <?php echo $subscription_field['label']; ?>
692
+ <input type="hidden" name="subscription_fields_order[<?php echo $subscription_field['name']; ?>]" class="field_order" value="<?php echo $subscription_field['order']; ?>" />
693
+ </label>
694
+ </td>
695
+ </tr>
696
+
697
+ <?php } ?>
698
+ </table>
699
+ <p class="submit">
700
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Subscriptions', 'woocommerce-exporter' ); ?>" />
701
+ </p>
702
+ <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>
703
+ <?php } else { ?>
704
+ <p><?php _e( 'No Subscriptions were found.', 'woocommerce-exporter' ); ?></p>
705
+ <?php } ?>
706
+ </div>
707
+ <!-- .inside -->
708
+ </div>
709
+ <!-- .postbox -->
710
+
711
+ <div id="export-subscriptions-filters" class="postbox">
712
+ <h3 class="hndle"><?php _e( 'Subscription Filters', 'woocommerce-exporter' ); ?></h3>
713
+ <div class="inside">
714
+
715
+ <?php do_action( 'woo_ce_export_subscription_options_before_table' ); ?>
716
+
717
+ <table class="form-table">
718
+ <?php do_action( 'woo_ce_export_subscription_options_table' ); ?>
719
+ </table>
720
+
721
+ <?php do_action( 'woo_ce_export_subscription_options_after_table' ); ?>
722
+
723
+ </div>
724
+ <!-- .inside -->
725
+ </div>
726
+ <!-- .postbox -->
727
+
728
+ </div>
729
+ <!-- #export-subscription -->
730
+
731
+ <?php } ?>
732
+ <?php if( $product_vendor_fields ) { ?>
733
+ <div id="export-product_vendor" class="export-types">
734
+
735
+ <div class="postbox">
736
+ <h3 class="hndle">
737
+ <?php _e( 'Product Vendor Fields', 'woocommerce-exporter' ); ?>
738
+ </h3>
739
+ <div class="inside">
740
+ <?php if( $product_vendors ) { ?>
741
+ <p class="description"><?php _e( 'Select the Product Vendor fields you would like to export.', 'woocommerce-exporter' ); ?></p>
742
+ <p>
743
+ <a href="javascript:void(0)" id="product_vendor-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
744
+ <a href="javascript:void(0)" id="product_vendor-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
745
+ <a href="javascript:void(0)" id="product_vendor-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
746
+ </p>
747
+ <table id="product_vendor-fields" class="ui-sortable">
748
+
749
+ <?php foreach( $product_vendor_fields as $product_vendor_field ) { ?>
750
+ <tr id="product_vendor-<?php echo $product_vendor_field['reset']; ?>">
751
+ <td>
752
+ <label<?php if( isset( $product_vendor_field['hover'] ) ) { ?> title="<?php echo $product_vendor_field['hover']; ?>"<?php } ?>>
753
+ <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" />
754
+ <?php echo $product_vendor_field['label']; ?>
755
+ <input type="hidden" name="product_vendor_fields_order[<?php echo $product_vendor_field['name']; ?>]" class="field_order" value="<?php echo $product_vendor_field['order']; ?>" />
756
+ </label>
757
+ </td>
758
+ </tr>
759
+
760
+ <?php } ?>
761
+ </table>
762
+ <p class="submit">
763
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Product Vendors', 'woocommerce-exporter' ); ?>" />
764
+ </p>
765
+ <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>
766
+ <?php } else { ?>
767
+ <p><?php _e( 'No Product Vendors were found.', 'woocommerce-exporter' ); ?></p>
768
+ <?php } ?>
769
+ </div>
770
+ <!-- .inside -->
771
+ </div>
772
+ <!-- .postbox -->
773
+
774
+ </div>
775
+ <!-- #export-product_vendor -->
776
+
777
+ <?php } ?>
778
+ <?php if( $commission_fields ) { ?>
779
+ <div id="export-commission" class="export-types">
780
+
781
+ <div class="postbox">
782
+ <h3 class="hndle">
783
+ <?php _e( 'Commission Fields', 'woocommerce-exporter' ); ?>
784
+ </h3>
785
+ <div class="inside">
786
+ <?php if( $commissions ) { ?>
787
+ <p class="description"><?php _e( 'Select the Commission fields you would like to export.', 'woocommerce-exporter' ); ?></p>
788
+ <p>
789
+ <a href="javascript:void(0)" id="commission-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
790
+ <a href="javascript:void(0)" id="commission-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
791
+ <a href="javascript:void(0)" id="commission-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
792
+ </p>
793
+ <table id="commission-fields" class="ui-sortable">
794
+
795
+ <?php foreach( $commission_fields as $commission_field ) { ?>
796
+ <tr id="commission-<?php echo $commission_field['reset']; ?>">
797
+ <td>
798
+ <label<?php if( isset( $commission_field['hover'] ) ) { ?> title="<?php echo $commission_field['hover']; ?>"<?php } ?>>
799
+ <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" />
800
+ <?php echo $commission_field['label']; ?>
801
+ <input type="hidden" name="commission_fields_order[<?php echo $commission_field['name']; ?>]" class="field_order" value="<?php echo $commission_field['order']; ?>" />
802
+ </label>
803
+ </td>
804
+ </tr>
805
+
806
+ <?php } ?>
807
+ </table>
808
+ <p class="submit">
809
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Commissions', 'woocommerce-exporter' ); ?>" />
810
+ </p>
811
+ <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>
812
+ <?php } else { ?>
813
+ <p><?php _e( 'No Commissions were found.', 'woocommerce-exporter' ); ?></p>
814
+ <?php } ?>
815
+ </div>
816
+ <!-- .inside -->
817
+ </div>
818
+ <!-- .postbox -->
819
+
820
+ <div id="export-commissions-filters" class="postbox">
821
+ <h3 class="hndle"><?php _e( 'Commission Filters', 'woocommerce-exporter' ); ?></h3>
822
+ <div class="inside">
823
+
824
+ <?php do_action( 'woo_ce_export_commission_options_before_table' ); ?>
825
+
826
+ <table class="form-table">
827
+ <?php do_action( 'woo_ce_export_commission_options_table' ); ?>
828
+ </table>
829
+
830
+ <?php do_action( 'woo_ce_export_commission_options_after_table' ); ?>
831
+
832
+ </div>
833
+ <!-- .inside -->
834
+ </div>
835
+ <!-- .postbox -->
836
+
837
+ </div>
838
+ <!-- #export-commission -->
839
+
840
+ <?php } ?>
841
+ <?php if( $shipping_class_fields ) { ?>
842
+ <div id="export-shipping_class" class="export-types">
843
+
844
+ <div class="postbox">
845
+ <h3 class="hndle">
846
+ <?php _e( 'Shipping Class Fields', 'woocommerce-exporter' ); ?>
847
+ </h3>
848
+ <div class="inside">
849
+ <?php if( $shipping_classes ) { ?>
850
+ <p class="description"><?php _e( 'Select the Shipping Class fields you would like to export.', 'woocommerce-exporter' ); ?></p>
851
+ <p>
852
+ <a href="javascript:void(0)" id="shipping_class-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
853
+ <a href="javascript:void(0)" id="shipping_class-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
854
+ <a href="javascript:void(0)" id="shipping_class-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
855
+ </p>
856
+ <table id="shipping_class-fields" class="ui-sortable">
857
+
858
+ <?php foreach( $shipping_class_fields as $shipping_class_field ) { ?>
859
+ <tr id="shipping_class-<?php echo $shipping_class_field['reset']; ?>">
860
+ <td>
861
+ <label<?php if( isset( $shipping_class_field['hover'] ) ) { ?> title="<?php echo $shipping_class_field['hover']; ?>"<?php } ?>>
862
+ <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" />
863
+ <?php echo $shipping_class_field['label']; ?>
864
+ <input type="hidden" name="shipping_class_fields_order[<?php echo $shipping_class_field['name']; ?>]" class="field_order" value="<?php echo $shipping_class_field['order']; ?>" />
865
+ </label>
866
+ </td>
867
+ </tr>
868
+
869
+ <?php } ?>
870
+ </table>
871
+ <p class="submit">
872
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Shipping Classes', 'woocommerce-exporter' ); ?>" />
873
+ </p>
874
+ <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>
875
+ <?php } else { ?>
876
+ <p><?php _e( 'No Shipping Classes were found.', 'woocommerce-exporter' ); ?></p>
877
+ <?php } ?>
878
+ </div>
879
+ <!-- .inside -->
880
+ </div>
881
+ <!-- .postbox -->
882
+
883
+ <div id="export-shipping-classes-filters" class="postbox">
884
+ <h3 class="hndle"><?php _e( 'Shipping Class Filters', 'woocommerce-exporter' ); ?></h3>
885
+ <div class="inside">
886
+
887
+ <?php do_action( 'woo_ce_export_shipping_class_options_before_table' ); ?>
888
+
889
+ <table class="form-table">
890
+ <?php do_action( 'woo_ce_export_shipping_class_options_table' ); ?>
891
+ </table>
892
+
893
+ <?php do_action( 'woo_ce_export_shipping_class_options_after_table' ); ?>
894
+
895
+ </div>
896
+ <!-- .inside -->
897
+ </div>
898
+ <!-- .postbox -->
899
+
900
+ </div>
901
+ <!-- #export-shipping_class -->
902
+
903
+ <?php } ?>
904
+ <?php do_action( 'woo_ce_before_options' ); ?>
905
+
906
+ <div class="postbox" id="export-options">
907
+ <h3 class="hndle"><?php _e( 'Export Options', 'woocommerce-exporter' ); ?></h3>
908
+ <div class="inside">
909
+ <p class="description"><?php _e( 'You can find additional export options under the Settings tab at the top of this screen. Click the Export button above to apply these changes and generate your export file.', 'woocommerce-exporter' ); ?></p>
910
+
911
+ <?php do_action( 'woo_ce_export_options_before' ); ?>
912
+
913
+ <table class="form-table">
914
+
915
+ <?php do_action( 'woo_ce_export_options' ); ?>
916
+
917
+ <tr>
918
+ <th>
919
+ <label for="offset"><?php _e( 'Volume offset', 'woocommerce-exporter' ); ?></label> / <label for="limit_volume"><?php _e( 'Limit volume', 'woocommerce-exporter' ); ?></label>
920
+ </th>
921
+ <td>
922
+ <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' ); ?>" />
923
+ <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.', 'woocommerce-exporter' ); ?></p>
924
+ </td>
925
+ </tr>
926
+
927
+ <?php do_action( 'woo_ce_export_options_table_after' ); ?>
928
+
929
+ </table>
930
+
931
+ <?php do_action( 'woo_ce_export_options_after' ); ?>
932
+
933
+ </div>
934
+ </div>
935
+ <!-- .postbox -->
936
+
937
+ <?php do_action( 'woo_ce_after_options' ); ?>
938
+
939
+ <input type="hidden" name="action" value="export" />
940
+ <?php wp_nonce_field( 'manual_export', 'woo_ce_export' ); ?>
941
+ </form>
942
+
943
+ <?php do_action( 'woo_ce_export_after_form' ); ?>
944
+
945
+ <?php do_action( 'woo_ce_before_modules' ); ?>
946
+
947
+ <div id="export-modules" class="postbox">
948
+ <h3 class="hndle"><?php _e( 'Export Modules', 'woocommerce-exporter' ); ?></h3>
949
+ <div class="inside">
950
+ <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>
951
+ <?php if( $modules ) { ?>
952
+ <div class="table table_content">
953
+ <table class="woo_vm_version_table">
954
+ <?php foreach( $modules as $module ) { ?>
955
+ <tr>
956
+ <td class="export_module">
957
+ <?php if( $module['description'] ) { ?>
958
+ <strong><?php echo $module['title']; ?></strong>: <span class="description"><?php echo $module['description']; ?></span>
959
+ <?php } else { ?>
960
+ <strong><?php echo $module['title']; ?></strong>
961
+ <?php } ?>
962
+ </td>
963
+ <td class="status">
964
+ <div class="<?php woo_ce_modules_status_class( $module['status'] ); ?>">
965
+ <?php if( $module['status'] == 'active' ) { ?>
966
+ <div class="dashicons dashicons-yes" style="color:#008000;"></div><?php woo_ce_modules_status_label( $module['status'] ); ?>
967
+ <?php } else { ?>
968
+ <?php if( $module['url'] ) { ?>
969
+ <?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', 'woocommerce-exporter' ) . '"'; } else { echo ' title="' . __( 'Visit the Plugin website', 'woocommerce-exporter' ) . '"'; } ?>><?php woo_ce_modules_status_label( $module['status'] ); ?></a>
970
+ <?php } ?>
971
+ <?php } ?>
972
+ </div>
973
+ </td>
974
+ </tr>
975
+ <?php } ?>
976
+ </table>
977
+ </div>
978
+ <!-- .table -->
979
+ <?php } else { ?>
980
+ <p><?php _e( 'No export modules are available at this time.', 'woocommerce-exporter' ); ?></p>
981
+ <?php } ?>
982
+ </div>
983
+ <!-- .inside -->
984
+ </div>
985
+ <!-- .postbox -->
986
+
987
+ <?php do_action( 'woo_ce_after_modules' ); ?>
988
+
989
+ </div>
990
+ <!-- #poststuff -->
templates/admin/tabs-fields.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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">
6
+ <tbody>
7
+ <?php foreach( $fields as $field ) { ?>
8
+ <?php if( isset( $field['name'] ) ) { ?>
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 } ?>
16
+ <?php } ?>
17
+ </tbody>
18
+ </table>
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>
29
+ <?php } ?>
templates/admin/tabs-overview.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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( '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-coupon"><?php _e( 'Export Coupons', '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-subscription"><?php _e( 'Export Subscriptions', '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-product_vendor"><?php _e( 'Export Product Vendors', '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-commission"><?php _e( 'Export Commissions', '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-shipping_class"><?php _e( 'Export Shipping Classes', 'woocommerce-exporter' ); ?></a>
48
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
49
+ </li>
50
+ <!--
51
+ <li>
52
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'export' ) ); ?>#export-attribute"><?php _e( 'Export Attributes', 'woocommerce-exporter' ); ?></a>
53
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
54
+ </li>
55
+ -->
56
+ </ul>
57
+
58
+ <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>
59
+ <p><?php _e( 'Download copies of prior store exports.', 'woocommerce-exporter' ); ?></p>
60
+
61
+ <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>
62
+ <p><?php _e( 'Manage export options from a single detailed screen.', 'woocommerce-exporter' ); ?></p>
63
+ <ul class="ul-disc">
64
+ <li>
65
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'settings' ) ); ?>#general-settings"><?php _e( 'General Settings', 'woocommerce-exporter' ); ?></a>
66
+ </li>
67
+ <li>
68
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'settings' ) ); ?>#csv-settings"><?php _e( 'CSV Settings', 'woocommerce-exporter' ); ?></a>
69
+ </li>
70
+ <li>
71
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'settings' ) ); ?>#xml-settings"><?php _e( 'XML Settings', 'woocommerce-exporter' ); ?></a>
72
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
73
+ </li>
74
+ <li>
75
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'settings' ) ); ?>#scheduled-exports"><?php _e( 'Scheduled Exports', 'woocommerce-exporter' ); ?></a>
76
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
77
+ </li>
78
+ <li>
79
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'settings' ) ); ?>#cron-exports"><?php _e( 'CRON Exports', 'woocommerce-exporter' ); ?></a>
80
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
81
+ </li>
82
+ <li>
83
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'settings' ) ); ?>#orders-screen"><?php _e( 'Orders Screen', 'woocommerce-exporter' ); ?></a>
84
+ <span class="description">(<?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?>)</span>
85
+ </li>
86
+ </ul>
87
+
88
+ <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>
89
+ <p><?php _e( 'Export tools for WooCommerce.', 'woocommerce-exporter' ); ?></p>
90
+
91
+ <hr />
92
+ <label class="description">
93
+ <input type="checkbox" disabled="disabled" /> <?php _e( 'Jump to Export screen in the future', 'woocommerce-exporter' ); ?>
94
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
95
+ </label>
96
+
97
+ </div>
98
+ <!-- .overview-left -->
99
+ <div class="welcome-panel overview-right">
100
+ <h3>
101
+ <!-- <span><a href="#"><attr title="<?php _e( 'Dismiss this message', 'woocommerce-exporter' ); ?>"><?php _e( 'Dismiss', 'woocommerce-exporter' ); ?></attr></a></span> -->
102
+ <?php _e( 'Upgrade to Pro', 'woocommerce-exporter' ); ?>
103
+ </h3>
104
+ <p class="clear"><?php _e( 'Upgrade to Store Exporter Deluxe to unlock business focused e-commerce features within Store Exporter, including:', 'woocommerce-exporter' ); ?></p>
105
+ <ul class="ul-disc">
106
+ <li><?php _e( 'Select export date ranges', 'woocommerce-exporter' ); ?></li>
107
+ <li><?php _e( 'Select export fields to export', 'woocommerce-exporter' ); ?></li>
108
+ <li><?php _e( 'Filter exports by multiple filter options', 'woocommerce-exporter' ); ?></li>
109
+ <li><?php _e( 'Export Orders', 'woocommerce-exporter' ); ?></li>
110
+ <li><?php _e( 'Export custom Order and Order Item meta', 'woocommerce-exporter' ); ?></li>
111
+ <li><?php _e( 'Export Customers', 'woocommerce-exporter' ); ?></li>
112
+ <li><?php _e( 'Export custom Customer meta', 'woocommerce-exporter' ); ?></li>
113
+ <li><?php _e( 'Export Coupons', 'woocommerce-exporter' ); ?></li>
114
+ <li><?php _e( 'Export custom User meta', 'woocommerce-exporter' ); ?></li>
115
+ <li><?php _e( 'Export Subscriptions', 'woocommerce-exporter' ); ?></li>
116
+ <li><?php _e( 'Export Product Vendors', 'woocommerce-exporter' ); ?></li>
117
+ <li><?php _e( 'Export Shipping Classes', 'woocommerce-exporter' ); ?></li>
118
+ <li><?php _e( 'CRON export engine', 'woocommerce-exporter' ); ?></li>
119
+ <li><?php _e( 'Schedule automatic exports with filtering options', 'woocommerce-exporter' ); ?></li>
120
+ <li><?php _e( 'Export to remote POST', 'woocommerce-exporter' ); ?></li>
121
+ <li><?php _e( 'Export to e-mail addresses', 'woocommerce-exporter' ); ?></li>
122
+ <li><?php _e( 'Export to remote FTP or SFTP', 'woocommerce-exporter' ); ?></li>
123
+ <li><?php _e( 'Export to XML file', 'woocommerce-exporter' ); ?></li>
124
+ <li><?php _e( 'Export to RSS file', 'woocommerce-exporter' ); ?></li>
125
+ <li><?php _e( 'Export to Excel 97-2003 (XLS) file', 'woocommerce-exporter' ); ?></li>
126
+ <li><?php _e( 'Export to Excel 2007-2013 (XLSX) file', 'woocommerce-exporter' ); ?></li>
127
+ <li><?php _e( 'Premium Support', 'woocommerce-exporter' ); ?></li>
128
+ <li><?php _e( '...and more.', 'woocommerce-exporter' ); ?></li>
129
+ </ul>
130
+ <p>
131
+ <a href="<?php echo $woo_cd_url; ?>" target="_blank" class="button"><?php _e( 'More Features', 'woocommerce-exporter' ); ?></a>&nbsp;
132
+ <a href="<?php echo $woo_cd_url; ?>" target="_blank" class="button button-primary"><?php _e( 'Buy Now', 'woocommerce-exporter' ); ?></a>
133
+ </p>
134
+ </div>
135
+ <!-- .overview-right -->
templates/admin/tabs-settings.php ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 -->
7
+ <br class="clear" />
8
+
9
+ <form method="post">
10
+ <table class="form-table">
11
+ <tbody>
12
+
13
+ <?php do_action( 'woo_ce_export_settings_before' ); ?>
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.', 'woocommerce-exporter' ); ?></p>
19
+ </td>
20
+ </tr>
21
+ <tr valign="top">
22
+ <th scope="row"><label for="export_filename"><?php _e( 'Export filename', 'woocommerce-exporter' ); ?></label></th>
23
+ <td>
24
+ <input type="text" name="export_filename" id="export_filename" value="<?php echo esc_attr( $export_filename ); ?>" class="large-text code" />
25
+ <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>%store_name%</code>.</p>
26
+ </td>
27
+ </tr>
28
+ <tr>
29
+ <th>
30
+ <label for="delete_file"><?php _e( 'Enable archives', 'woocommerce-exporter' ); ?></label>
31
+ </th>
32
+ <td>
33
+ <select id="delete_file" name="delete_file">
34
+ <option value="0"<?php selected( $delete_file, 0 ); ?>><?php _e( 'Yes', 'woocommerce-exporter' ); ?></option>
35
+ <option value="1"<?php selected( $delete_file, 1 ); ?>><?php _e( 'No', 'woocommerce-exporter' ); ?></option>
36
+ </select>
37
+ <p class="description"><?php _e( 'Save copies of exports to the WordPress Media for later downloading. By default this option is turned on.', 'woocommerce-exporter' ); ?></p>
38
+ </td>
39
+ </tr>
40
+ <tr>
41
+ <th>
42
+ <label for="encoding"><?php _e( 'Character encoding', 'woocommerce-exporter' ); ?></label>
43
+ </th>
44
+ <td>
45
+ <?php if( $file_encodings ) { ?>
46
+ <select id="encoding" name="encoding">
47
+ <option value=""><?php _e( 'System default', 'woocommerce-exporter' ); ?></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
+ <?php if( version_compare( phpversion(), '5', '<' ) ) { ?>
54
+ <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>
55
+ <?php } else { ?>
56
+ <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>
57
+ <?php } ?>
58
+ <?php } ?>
59
+ </td>
60
+ </tr>
61
+ <tr>
62
+ <th><?php _e( 'Date format', 'woocommerce-exporter' ); ?></th>
63
+ <td>
64
+ <ul style="margin-top:0.2em;">
65
+ <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>
66
+ <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>
67
+ <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>
68
+ <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>
69
+ <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>
70
+ <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>
71
+ </ul>
72
+ <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>
73
+ </td>
74
+ </tr>
75
+ <?php if( !ini_get( 'safe_mode' ) ) { ?>
76
+ <tr>
77
+ <th>
78
+ <label for="timeout"><?php _e( 'Script timeout', 'woocommerce-exporter' ); ?></label>
79
+ </th>
80
+ <td>
81
+ <select id="timeout" name="timeout">
82
+ <option value="600"<?php selected( $timeout, 600 ); ?>><?php printf( __( '%s minutes', 'woocommerce-exporter' ), 10 ); ?></option>
83
+ <option value="1800"<?php selected( $timeout, 1800 ); ?>><?php printf( __( '%s minutes', 'woocommerce-exporter' ), 30 ); ?></option>
84
+ <option value="3600"<?php selected( $timeout, 3600 ); ?>><?php printf( __( '%s hour', 'woocommerce-exporter' ), 1 ); ?></option>
85
+ <option value="0"<?php selected( $timeout, 0 ); ?>><?php _e( 'Unlimited', 'woocommerce-exporter' ); ?></option>
86
+ </select>
87
+ <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>
88
+ </td>
89
+ </tr>
90
+ <?php } ?>
91
+
92
+ <?php do_action( 'woo_ce_export_settings_general' ); ?>
93
+
94
+ <tr id="csv-settings">
95
+ <td colspan="2" style="padding:0;">
96
+ <hr />
97
+ <h3><div class="dashicons dashicons-media-spreadsheet"></div>&nbsp;<?php _e( 'CSV Settings', 'woocommerce-exporter' ); ?></h3>
98
+ </td>
99
+ </tr>
100
+ <tr>
101
+ <th>
102
+ <label for="delimiter"><?php _e( 'Field delimiter', 'woocommerce-exporter' ); ?></label>
103
+ </th>
104
+ <td>
105
+ <input type="text" size="3" id="delimiter" name="delimiter" value="<?php echo esc_attr( $delimiter ); ?>" maxlength="5" class="text" />
106
+ <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>
107
+ </td>
108
+ </tr>
109
+ <tr>
110
+ <th>
111
+ <label for="category_separator"><?php _e( 'Category separator', 'woocommerce-exporter' ); ?></label>
112
+ </th>
113
+ <td>
114
+ <input type="text" size="3" id="category_separator" name="category_separator" value="<?php echo esc_attr( $category_separator ); ?>" maxlength="5" 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 or \'LF\' for line breaks between each item. For instance: <code>Clothing|Mens|Shirts</code>.', 'woocommerce-exporter' ); ?></p>
116
+ </td>
117
+ </tr>
118
+ <tr>
119
+ <th>
120
+ <label for="line_ending"><?php _e( 'Line ending formatting', 'woocommerce-exporter' ); ?></label>
121
+ </th>
122
+ <td>
123
+ <select id="line_ending" name="line_ending">
124
+ <option value="windows" selected="selected"><?php _e( 'Windows', 'woocommerce-exporter' ); ?></option>
125
+ <option value="mac" disabled="disabled"><?php _e( 'Mac' ,'woocommerce-exporter' ); ?></option>
126
+ <option value="unix" disabled="disabled"><?php _e( 'Unix', 'woocommerce-exporter' ); ?></option>
127
+ </select>
128
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
129
+ <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>
130
+ </td>
131
+ </tr>
132
+ <tr>
133
+ <th>
134
+ <label for="bom"><?php _e( 'Add BOM character', 'woocommerce-exporter' ); ?></label>
135
+ </th>
136
+ <td>
137
+ <select id="bom" name="bom">
138
+ <option value="1"<?php selected( $bom, 1 ); ?>><?php _e( 'Yes', 'woocommerce-exporter' ); ?></option>
139
+ <option value="0"<?php selected( $bom, 0 ); ?>><?php _e( 'No', 'woocommerce-exporter' ); ?></option>
140
+ </select>
141
+ <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>
142
+ </td>
143
+ </tr>
144
+ <tr>
145
+ <th>
146
+ <label for="escape_formatting"><?php _e( 'Field escape formatting', 'woocommerce-exporter' ); ?></label>
147
+ </th>
148
+ <td>
149
+ <ul style="margin-top:0.2em;">
150
+ <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>
151
+ <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>
152
+ </ul>
153
+ <p class="description"><?php _e( 'Choose the field escape format that suits your spreadsheet software (e.g. Excel).', 'woocommerce-exporter' ); ?></p>
154
+ </td>
155
+ </tr>
156
+
157
+ <?php do_action( 'woo_ce_export_settings_after' ); ?>
158
+
159
+ </tbody>
160
+ </table>
161
+ <!-- .form-table -->
162
+ <p class="submit">
163
+ <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e( 'Save Changes', 'woocommerce-exporter' ); ?>" />
164
+ </p>
165
+ <input type="hidden" name="action" value="save-settings" />
166
+ <?php wp_nonce_field( 'save_settings', 'woo_ce_save_settings' ); ?>
167
+ </form>
168
+ <?php do_action( 'woo_ce_export_settings_bottom' ); ?>
templates/admin/tabs-tools.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h3><div class="dashicons dashicons-hammer"></div>&nbsp;<?php _e( 'WooCommerce Tools', 'woocommerce-exporter' ); ?></h3>
2
+ <p class="description"><?php _e( 'Extend your store with other WooCommerce extensions from us.', 'woocommerce-exporter' ); ?></p>
3
+ <div id="poststuff">
4
+
5
+ <div id="tools" class="postbox">
6
+ <h3 class="hndle"><?php _e( 'Tools', 'woocommerce-exporter' ); ?></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', 'woocommerce-exporter' ); ?></a>
13
+ <p class="description"><?php _e( 'Use Product Importer Deluxe to import Product changes back into your WooCommerce store.', 'woocommerce-exporter' ); ?></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', 'woocommerce-exporter' ); ?></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.', 'woocommerce-exporter' ); ?></p>
21
+ </td>
22
+ </tr>
23
+
24
+ </table>
25
+ </div>
26
+ </div>
27
+ <!-- .postbox -->
28
+
29
+ </div>
30
+ <!-- #poststuff -->
templates/admin/tabs.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 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( 'Export', 'woocommerce-exporter' ); ?></a>
6
+ <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>
7
+ <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>
8
+ <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>
9
+ </h2>
10
+ <?php woo_ce_tab_template( $tab ); ?>
11
+
12
+ </div>
13
+ <!-- #content -->
templates/admin/woocommerce-admin_dashboard_vm-plugins.css ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .woo_vm_version_table {
2
+ color:#333;
3
+ width:100%;
4
+ }
5
+ .woo_vm_version_table th {
6
+ border-bottom:1px solid #ddd;
7
+ padding-bottom:0.2em;
8
+ }
9
+ .woo_vm_version_table td {
10
+ border-bottom:1px solid #f9f9f9;
11
+ padding:0.3em 0;
12
+ }
13
+ .woo_vm_version_table td.version, .woo_vm_version_table td.status {
14
+ font-size:12px;
15
+ }
16
+ .woo_vm_version_table td.version {
17
+ color:#666;
18
+ }
19
+ .woo_vm_version_table td.version span {
20
+ font-size:13px;
21
+ color:#333;
22
+ }
23
+ .woo_vm_version_table td.status {
24
+ text-align:center;
25
+ border:1px dotted #ddd;
26
+ }
27
+ .woo_vm_version_table td.status .green {
28
+ color:#008000;
29
+ }
30
+ .woo_vm_version_table td.status .red {
31
+ color:#ff0000;
32
+ }
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;
42
+ margin-bottom:1em;
43
+ padding:9px 9px 8px 9px;
44
+ background-color:#ffffe0;
45
+ border-color:#e6db55;
46
+ border-width:1px;
47
+ border-style:solid;
48
+ -moz-border-radius:5px;
49
+ -khtml-border-radius:5px;
50
+ -webkit-border-radius:5px;
51
+ border-radius:5px;
52
+ }
53
+ #woo_vm_status_widget .link {
54
+ text-align:right;
55
+ }