WooCommerce – Store Exporter - Version 1.9

Version Description

  • Changed: Moved export type filters to their own files
  • Fixed: Product file downloads not working (thanks @bulfa)
Download this release

Release Info

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

Version 1.9

Files changed (91) hide show
  1. common/common.php +95 -0
  2. exporter.php +574 -0
  3. includes/admin.php +569 -0
  4. includes/admin/brand.php +33 -0
  5. includes/admin/category.php +33 -0
  6. includes/admin/commission.php +83 -0
  7. includes/admin/coupon.php +33 -0
  8. includes/admin/customer.php +124 -0
  9. includes/admin/order.php +663 -0
  10. includes/admin/product.php +390 -0
  11. includes/admin/shipping_class.php +33 -0
  12. includes/admin/subscription.php +73 -0
  13. includes/admin/tag.php +33 -0
  14. includes/admin/user.php +91 -0
  15. includes/brand.php +153 -0
  16. includes/category.php +203 -0
  17. includes/commission.php +252 -0
  18. includes/common-dashboard_widgets.php +56 -0
  19. includes/common.php +77 -0
  20. includes/coupon.php +206 -0
  21. includes/customer.php +248 -0
  22. includes/export-csv.php +51 -0
  23. includes/formatting.php +445 -0
  24. includes/functions.php +2029 -0
  25. includes/install.php +42 -0
  26. includes/legacy.php +10 -0
  27. includes/order-extend.php +423 -0
  28. includes/order.php +675 -0
  29. includes/product-extend.php +1029 -0
  30. includes/product.php +1328 -0
  31. includes/product_vendor.php +173 -0
  32. includes/settings.php +588 -0
  33. includes/shipping_class.php +91 -0
  34. includes/subscription.php +264 -0
  35. includes/tag.php +163 -0
  36. includes/user-extend.php +102 -0
  37. includes/user.php +275 -0
  38. js/chosen.jquery.js +988 -0
  39. js/jquery-ui.js +48 -0
  40. js/jquery.chosen.js +988 -0
  41. js/jquery.csvToTable.js +154 -0
  42. js/jquery.timepicker.js +2245 -0
  43. js/ui-datepicker.js +84 -0
  44. languages/woo_ce-en_GB.mo +0 -0
  45. languages/woo_ce-en_GB.po +97 -0
  46. languages/woocommerce-exporter-en_GB.mo +0 -0
  47. languages/woocommerce-exporter-en_GB.po +97 -0
  48. license.txt +281 -0
  49. readme.txt +639 -0
  50. templates/admin/chosen-sprite.png +0 -0
  51. templates/admin/chosen.css +397 -0
  52. templates/admin/export.css +113 -0
  53. templates/admin/export.js +535 -0
  54. templates/admin/images/animated-overlay.gif +0 -0
  55. templates/admin/images/progress.gif +0 -0
  56. templates/admin/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  57. templates/admin/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  58. templates/admin/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  59. templates/admin/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  60. templates/admin/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  61. templates/admin/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  62. templates/admin/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  63. templates/admin/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  64. templates/admin/images/ui-icons_222222_256x240.png +0 -0
  65. templates/admin/images/ui-icons_2e83ff_256x240.png +0 -0
  66. templates/admin/images/ui-icons_454545_256x240.png +0 -0
  67. templates/admin/images/ui-icons_888888_256x240.png +0 -0
  68. templates/admin/images/ui-icons_cd0a0a_256x240.png +0 -0
  69. templates/admin/jquery-csvtable.css +40 -0
  70. templates/admin/jquery-ui-datepicker.css +347 -0
  71. templates/admin/jquery-ui-timepicker.css +12 -0
  72. templates/admin/media-csv_file.php +13 -0
  73. templates/admin/media-export_details.php +41 -0
  74. templates/admin/tabs-archive.php +80 -0
  75. templates/admin/tabs-export.php +964 -0
  76. templates/admin/tabs-fields.php +29 -0
  77. templates/admin/tabs-overview.php +135 -0
  78. templates/admin/tabs-settings.php +192 -0
  79. templates/admin/tabs-tools.php +96 -0
  80. templates/admin/tabs.php +15 -0
  81. templates/admin/woo-admin_ce-export.css +76 -0
  82. templates/admin/woo-admin_ce-export.js +179 -0
  83. templates/admin/woo-admin_ce-export.php +13 -0
  84. templates/admin/woo-admin_ce-export_archive.php +65 -0
  85. templates/admin/woo-admin_ce-export_export.php +511 -0
  86. templates/admin/woo-admin_ce-export_overview.php +85 -0
  87. templates/admin/woo-admin_ce-export_settings.php +153 -0
  88. templates/admin/woo-admin_ce-export_tools.php +22 -0
  89. templates/admin/woo-admin_ce-media_csv_file.php +12 -0
  90. templates/admin/woo-admin_ce-media_export_details.php +54 -0
  91. templates/admin/woocommerce-admin_dashboard_vm-plugins.css +52 -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,574 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.9
7
+ Author: Visser Labs
8
+ Author URI: http://www.visser.com.au/about/
9
+ Text Domain: woocommerce-exporter
10
+ License: GPL2
11
+
12
+ Text Domain: woocommerce-exporter
13
+ Domain Path: /languages/
14
+ */
15
+
16
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
17
+
18
+ define( 'WOO_CE_DIRNAME', basename( dirname( __FILE__ ) ) );
19
+ define( 'WOO_CE_RELPATH', basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ) );
20
+ define( 'WOO_CE_PATH', plugin_dir_path( __FILE__ ) );
21
+ define( 'WOO_CE_PREFIX', 'woo_ce' );
22
+
23
+ // Turn this on to enable additional debugging options at export time
24
+ if( !defined( 'WOO_CE_DEBUG' ) )
25
+ define( 'WOO_CE_DEBUG', false );
26
+
27
+ // Avoid conflicts if Store Exporter Deluxe is activated
28
+ include_once( WOO_CE_PATH . 'common/common.php' );
29
+ if( defined( 'WOO_CD_PREFIX' ) == false )
30
+ include_once( WOO_CE_PATH . 'includes/functions.php' );
31
+
32
+ // Plugin language support
33
+ function woo_ce_i18n() {
34
+
35
+ $locale = apply_filters( 'plugin_locale', get_locale(), 'woocommerce-exporter' );
36
+ load_textdomain( 'woocommerce-exporter', WP_LANG_DIR . '/woocommerce-exporter/woocommerce-exporter-' . $locale . '.mo' );
37
+ load_plugin_textdomain( 'woocommerce-exporter', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
38
+
39
+ }
40
+ add_action( 'init', 'woo_ce_i18n', 11 );
41
+
42
+ if( is_admin() ) {
43
+
44
+ /* Start of: WordPress Administration */
45
+
46
+ // Register our install script for first time install
47
+ include_once( WOO_CE_PATH . 'includes/install.php' );
48
+ register_activation_hook( __FILE__, 'woo_ce_install' );
49
+
50
+ // Initial scripts and export process
51
+ function woo_ce_admin_init() {
52
+
53
+ global $export, $wp_roles;
54
+
55
+ $action = ( function_exists( 'woo_get_action' ) ? woo_get_action() : false );
56
+
57
+ // Now is the time to de-activate Store Exporter if Store Exporter Deluxe is activated
58
+ if( defined( 'WOO_CD_PREFIX' ) ) {
59
+ include_once( WOO_CE_PATH . 'includes/install.php' );
60
+ woo_ce_deactivate_ce();
61
+ return;
62
+ }
63
+
64
+ // An effort to reduce the memory load at export time
65
+ if( $action <> 'export' ) {
66
+
67
+ $troubleshooting_url = 'https://www.visser.com.au/documentation/store-exporter-deluxe/troubleshooting/';
68
+
69
+ // Check the User has the activate_plugins capability
70
+ $user_capability = 'activate_plugins';
71
+ if( current_user_can( $user_capability ) ) {
72
+
73
+ // Detect if another e-Commerce platform is activated
74
+ if( !woo_is_woo_activated() && ( woo_is_jigo_activated() || woo_is_wpsc_activated() ) ) {
75
+ $message = __( 'We have detected another e-Commerce Plugin than WooCommerce activated, please check that you are using Store Exporter for the correct platform.', 'woocommerce-exporter' );
76
+ $message .= sprintf( ' <a href="%s" target="_blank">%s</a>', $troubleshooting_url, __( 'Need help?', 'woocommerce-exporter' ) );
77
+ woo_ce_admin_notice( $message, 'error', 'plugins.php' );
78
+ } else if( !woo_is_woo_activated() ) {
79
+ $message = __( 'We have been unable to detect the WooCommerce Plugin activated on this WordPress site, please check that you are using Store Exporter for the correct platform.', 'woocommerce-exporter' );
80
+ $message .= sprintf( ' <a href="%s" target="_blank">%s</a>', $troubleshooting_url, __( 'Need help?', 'woocommerce-exporter' ) );
81
+ woo_ce_admin_notice( $message, 'error', 'plugins.php' );
82
+ }
83
+
84
+ // Detect if any known conflict Plugins are activated
85
+
86
+ // WooCommerce Subscriptions Exporter - http://codecanyon.net/item/woocommerce-subscription-exporter/6569668
87
+ if( function_exists( 'wc_subs_exporter_admin_init' ) ) {
88
+ $message = __( 'We have detected an activated Plugin for WooCommerce that is known to conflict with Store Exporter, please de-activate WooCommerce Subscriptions Exporter to resolve export issues within Store Exporter.', 'woocommerce-exporter' );
89
+ $message .= sprintf( '<a href="%s" target="_blank">%s</a>', $troubleshooting_url, __( 'Need help?', 'woocommerce-exporter' ) );
90
+ woo_ce_admin_notice( $message, 'error', array( 'plugins.php', 'admin.php' ) );
91
+ }
92
+
93
+ // WP Easy Events Professional - https://emdplugins.com/plugins/wp-easy-events-professional/
94
+ if( class_exists( 'WP_Easy_Events_Professional' ) ) {
95
+ $message = __( 'We have detected an activated Plugin that is known to conflict with Store Exporter Deluxe, please de-activate WP Easy Events Professional to resolve export issues within Store Exporter Deluxe.', 'woocommerce-exporter' );
96
+ $message .= sprintf( '<a href="%s" target="_blank">%s</a>', $troubleshooting_url, __( 'Need help?', 'woocommerce-exporter' ) );
97
+ woo_ce_admin_notice( $message, 'error', array( 'plugins.php', 'admin.php' ) );
98
+ }
99
+
100
+ // Plugin row notices for the Plugins screen
101
+ add_action( 'after_plugin_row_' . WOO_CE_RELPATH, 'woo_ce_admin_plugin_row' );
102
+
103
+ }
104
+
105
+ // Check the User has the view_woocommerce_reports capability
106
+ $user_capability = apply_filters( 'woo_ce_admin_user_capability', 'view_woocommerce_reports' );
107
+ if( current_user_can( $user_capability ) == false )
108
+ return;
109
+
110
+ // Check that we are on the Store Exporter screen
111
+ $page = ( isset($_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : false );
112
+ if( $page != strtolower( WOO_CE_PREFIX ) )
113
+ return;
114
+
115
+ // Add memory usage to screen footer
116
+ add_filter( 'admin_footer_text', 'woo_ce_admin_footer_text' );
117
+
118
+ }
119
+
120
+ // Process any pre-export notice confirmations
121
+ switch( $action ) {
122
+
123
+ // This is where the magic happens
124
+ case 'export':
125
+
126
+ // Make sure we play nice with other WooCommerce and WordPress exporters
127
+ if( !isset( $_POST['woo_ce_export'] ) )
128
+ return;
129
+
130
+ check_admin_referer( 'manual_export', 'woo_ce_export' );
131
+
132
+ // Hide error logging during the export process
133
+ if( function_exists( 'ini_set' ) )
134
+ @ini_set( 'display_errors', 0 );
135
+
136
+ // Welcome in the age of GZIP compression and Object caching
137
+ if( !defined( 'DONOTCACHEPAGE' ) )
138
+ define( 'DONOTCACHEPAGE', true );
139
+ if( !defined( 'DONOTCACHCEOBJECT' ) )
140
+ define( 'DONOTCACHCEOBJECT', true );
141
+
142
+ // Set artificially high because we are building this export in memory
143
+ if( function_exists( 'wp_raise_memory_limit' ) ) {
144
+ add_filter( 'export_memory_limit', 'woo_ce_raise_export_memory_limit' );
145
+ wp_raise_memory_limit( 'export' );
146
+ }
147
+
148
+ $timeout = woo_ce_get_option( 'timeout', 0 );
149
+ $safe_mode = ( function_exists( 'safe_mode' ) ? ini_get( 'safe_mode' ) : false );
150
+ if( !$safe_mode ) {
151
+ if( function_exists( 'set_time_limit' ) )
152
+ @set_time_limit( $timeout );
153
+ if( function_exists( 'ini_set' ) )
154
+ @ini_set( 'max_execution_time', $timeout );
155
+ }
156
+ if( function_exists( 'ini_set' ) )
157
+ @ini_set( 'memory_limit', WP_MAX_MEMORY_LIMIT );
158
+
159
+ // Set up the basic export options
160
+ $export = new stdClass();
161
+ $export->cron = 0;
162
+ $export->scheduled_export = 0;
163
+ $export->start_time = time();
164
+ $export->idle_memory_start = woo_ce_current_memory_usage();
165
+ $export->encoding = woo_ce_get_option( 'encoding', get_option( 'blog_charset', 'UTF-8' ) );
166
+ // Reset the Encoding if corrupted
167
+ if( $export->encoding == '' || $export->encoding == false || $export->encoding == 'System default' ) {
168
+ woo_ce_error_log( sprintf( 'Warning: %s', __( 'Encoding export option was corrupted, defaulted to UTF-8', 'woocommerce-exporter' ) ) );
169
+ $export->encoding = 'UTF-8';
170
+ woo_ce_update_option( 'encoding', 'UTF-8' );
171
+ }
172
+ $export->delimiter = woo_ce_get_option( 'delimiter', ',' );
173
+ // Reset the Delimiter if corrupted
174
+ if( $export->delimiter == '' || $export->delimiter == false ) {
175
+ woo_ce_error_log( sprintf( 'Warning: %s', __( 'Delimiter export option was corrupted, defaulted to ,', 'woocommerce-exporter' ) ) );
176
+ $export->delimiter = ',';
177
+ woo_ce_update_option( 'delimiter', ',' );
178
+ }
179
+ $export->category_separator = woo_ce_get_option( 'category_separator', '|' );
180
+ // Reset the Category Separator if corrupted
181
+ if( $export->category_separator == '' || $export->category_separator == false ) {
182
+ woo_ce_error_log( sprintf( 'Warning: %s', __( 'Category Separator export option was corrupted, defaulted to |', 'woocommerce-exporter' ) ) );
183
+ $export->category_separator = '|';
184
+ woo_ce_update_option( 'category_separator', '|' );
185
+ }
186
+ $export->bom = woo_ce_get_option( 'bom', 1 );
187
+ $export->escape_formatting = woo_ce_get_option( 'escape_formatting', 'all' );
188
+ // Reset the Escape Formatting if corrupted
189
+ if( $export->escape_formatting == '' || $export->escape_formatting == false ) {
190
+ woo_ce_error_log( sprintf( 'Warning: %s', __( 'Escape Formatting export option was corrupted, defaulted to all.', 'woocommerce-exporter' ) ) );
191
+ $export->escape_formatting = 'all';
192
+ woo_ce_update_option( 'escape_formatting', 'all' );
193
+ }
194
+ $date_format = woo_ce_get_option( 'date_format', 'd/m/Y' );
195
+ // Reset the Date Format if corrupted
196
+ if( $date_format == '1' || $date_format == '' || $date_format == false ) {
197
+ woo_ce_error_log( sprintf( 'Warning: %s', __( 'Date Format export option was corrupted, defaulted to d/m/Y', 'woocommerce-exporter' ) ) );
198
+ $date_format = 'd/m/Y';
199
+ woo_ce_update_option( 'date_format', $date_format );
200
+ }
201
+
202
+ // Save export option changes made on the Export screen
203
+ $export->limit_volume = ( isset( $_POST['limit_volume'] ) ? sanitize_text_field( $_POST['limit_volume'] ) : '' );
204
+ woo_ce_update_option( 'limit_volume', $export->limit_volume );
205
+ if( in_array( $export->limit_volume, array( '', '0', '-1' ) ) ) {
206
+ woo_ce_update_option( 'limit_volume', '' );
207
+ $export->limit_volume = -1;
208
+ }
209
+ $export->offset = ( isset( $_POST['offset'] ) ? sanitize_text_field( $_POST['offset'] ) : '' );
210
+ woo_ce_update_option( 'offset', $export->offset );
211
+ if( in_array( $export->offset, array( '', '0' ) ) ) {
212
+ woo_ce_update_option( 'offset', '' );
213
+ $export->offset = 0;
214
+ }
215
+ $export->type = ( isset( $_POST['dataset'] ) ? sanitize_text_field( $_POST['dataset'] ) : false );
216
+
217
+ // Set default values for all export options to be later passed onto the export process
218
+ $export->fields = array();
219
+ $export->fields_order = false;
220
+ $export->export_format = 'csv';
221
+
222
+ // Product sorting
223
+ $export->product_categories = false;
224
+ $export->product_tags = false;
225
+ $export->product_status = false;
226
+ $export->product_type = false;
227
+ $export->product_orderby = false;
228
+ $export->product_order = false;
229
+ $export->gallery_formatting = false;
230
+ $export->upsell_formatting = false;
231
+ $export->crosssell_formatting = false;
232
+
233
+ // Category sorting
234
+ $export->category_orderby = false;
235
+ $export->category_order = false;
236
+
237
+ // Tag sorting
238
+ $export->tag_orderby = false;
239
+ $export->tag_order = false;
240
+
241
+ // User sorting
242
+ $export->user_orderby = false;
243
+ $export->user_order = false;
244
+
245
+ if( !empty( $export->type ) ) {
246
+ $export->fields = ( isset( $_POST[$export->type . '_fields'] ) ? array_map( 'sanitize_text_field', $_POST[$export->type . '_fields'] ) : false );
247
+ $export->fields_order = ( isset( $_POST[$export->type . '_fields_order'] ) ? array_map( 'absint', $_POST[$export->type . '_fields_order'] ) : false );
248
+ woo_ce_update_option( 'last_export', $export->type );
249
+ }
250
+
251
+ woo_ce_load_export_types();
252
+
253
+ switch( $export->type ) {
254
+
255
+ case 'product':
256
+ // Set up dataset specific options
257
+ $export->product_categories = ( isset( $_POST['product_filter_category'] ) ? woo_ce_format_product_filters( array_map( 'absint', $_POST['product_filter_category'] ) ) : false );
258
+ $export->product_tags = ( isset( $_POST['product_filter_tag'] ) ? woo_ce_format_product_filters( array_map( 'absint', $_POST['product_filter_tag'] ) ) : false );
259
+ $export->product_status = ( isset( $_POST['product_filter_status'] ) ? woo_ce_format_product_filters( array_map( 'sanitize_text_field', $_POST['product_filter_status'] ) ) : false );
260
+ $export->product_type = ( isset( $_POST['product_filter_type'] ) ? woo_ce_format_product_filters( array_map( 'sanitize_text_field', $_POST['product_filter_type'] ) ) : false );
261
+ $export->product_orderby = ( isset( $_POST['product_orderby'] ) ? sanitize_text_field( $_POST['product_orderby'] ) : false );
262
+ $export->product_order = ( isset( $_POST['product_order'] ) ? sanitize_text_field( $_POST['product_order'] ) : false );
263
+ $export->gallery_formatting = ( isset( $_POST['product_gallery_formatting'] ) ? absint( $_POST['product_gallery_formatting'] ) : false );
264
+ $export->upsell_formatting = ( isset( $_POST['product_upsell_formatting'] ) ? absint( $_POST['product_upsell_formatting'] ) : false );
265
+ $export->crosssell_formatting = ( isset( $_POST['product_crosssell_formatting'] ) ? absint( $_POST['product_crosssell_formatting'] ) : false );
266
+
267
+ // Save dataset export specific options
268
+ if( $export->product_orderby <> woo_ce_get_option( 'product_orderby' ) )
269
+ woo_ce_update_option( 'product_orderby', $export->product_orderby );
270
+ if( $export->product_order <> woo_ce_get_option( 'product_order' ) )
271
+ woo_ce_update_option( 'product_order', $export->product_order );
272
+ if( $export->upsell_formatting <> woo_ce_get_option( 'upsell_formatting' ) )
273
+ woo_ce_update_option( 'upsell_formatting', $export->upsell_formatting );
274
+ if( $export->crosssell_formatting <> woo_ce_get_option( 'crosssell_formatting' ) )
275
+ woo_ce_update_option( 'crosssell_formatting', $export->crosssell_formatting );
276
+ break;
277
+
278
+ case 'category':
279
+ // Set up dataset specific options
280
+ $export->category_orderby = ( isset( $_POST['category_orderby'] ) ? sanitize_text_field( $_POST['category_orderby'] ) : false );
281
+ $export->category_order = ( isset( $_POST['category_order'] ) ? sanitize_text_field( $_POST['category_order'] ) : false );
282
+
283
+ // Save dataset export specific options
284
+ if( $export->category_orderby <> woo_ce_get_option( 'category_orderby' ) )
285
+ woo_ce_update_option( 'category_orderby', $export->category_orderby );
286
+ if( $export->category_order <> woo_ce_get_option( 'category_order' ) )
287
+ woo_ce_update_option( 'category_order', $export->category_order );
288
+ break;
289
+
290
+ case 'tag':
291
+ // Set up dataset specific options
292
+ $export->tag_orderby = ( isset( $_POST['tag_orderby'] ) ? sanitize_text_field( $_POST['tag_orderby'] ) : false );
293
+ $export->tag_order = ( isset( $_POST['tag_order'] ) ? sanitize_text_field( $_POST['tag_order'] ) : false );
294
+
295
+ // Save dataset export specific options
296
+ if( $export->tag_orderby <> woo_ce_get_option( 'tag_orderby' ) )
297
+ woo_ce_update_option( 'tag_orderby', $export->tag_orderby );
298
+ if( $export->tag_order <> woo_ce_get_option( 'tag_order' ) )
299
+ woo_ce_update_option( 'tag_order', $export->tag_order );
300
+ break;
301
+
302
+ case 'user':
303
+ // Set up dataset specific options
304
+ $export->user_orderby = ( isset( $_POST['user_orderby'] ) ? sanitize_text_field( $_POST['user_orderby'] ) : false );
305
+ $export->user_order = ( isset( $_POST['user_order'] ) ? sanitize_text_field( $_POST['user_order'] ) : false );
306
+
307
+ // Save dataset export specific options
308
+ if( $export->user_orderby <> woo_ce_get_option( 'user_orderby' ) )
309
+ woo_ce_update_option( 'user_orderby', $export->user_orderby );
310
+ if( $export->user_order <> woo_ce_get_option( 'user_order' ) )
311
+ woo_ce_update_option( 'user_order', $export->user_order );
312
+ break;
313
+
314
+ }
315
+ if( $export->type ) {
316
+
317
+ $timeout = 600;
318
+ if( isset( $_POST['timeout'] ) ) {
319
+ $timeout = absint( $_POST['timeout'] );
320
+ if( $timeout <> woo_ce_get_option( 'timeout' ) )
321
+ woo_ce_update_option( 'timeout', $timeout );
322
+ }
323
+ if( !ini_get( 'safe_mode' ) ) {
324
+ @set_time_limit( $timeout );
325
+ @ini_set( 'max_execution_time', $timeout );
326
+ }
327
+
328
+ @ini_set( 'memory_limit', WP_MAX_MEMORY_LIMIT );
329
+
330
+ $export->args = array(
331
+ 'limit_volume' => $export->limit_volume,
332
+ 'offset' => $export->offset,
333
+ 'encoding' => $export->encoding,
334
+ 'date_format' => $date_format,
335
+ 'product_categories' => $export->product_categories,
336
+ 'product_tags' => $export->product_tags,
337
+ 'product_status' => $export->product_status,
338
+ 'product_type' => $export->product_type,
339
+ 'product_orderby' => $export->product_orderby,
340
+ 'product_order' => $export->product_order,
341
+ 'category_orderby' => $export->category_orderby,
342
+ 'category_order' => $export->category_order,
343
+ 'tag_orderby' => $export->tag_orderby,
344
+ 'tag_order' => $export->tag_order,
345
+ 'user_orderby' => $export->user_orderby,
346
+ 'user_order' => $export->user_order
347
+ );
348
+ if( empty( $export->fields ) ) {
349
+ $message = __( 'No export fields were selected, please try again with at least a single export field.', 'woocommerce-exporter' );
350
+ woo_ce_admin_notice( $message, 'error' );
351
+ return;
352
+ }
353
+ woo_ce_save_fields( $export->type, $export->fields, $export->fields_order );
354
+
355
+ if( $export->export_format == 'csv' ) {
356
+ $export->filename = woo_ce_generate_csv_filename( $export->type );
357
+ }
358
+
359
+ // Print file contents to debug export screen
360
+ if( WOO_CE_DEBUG ) {
361
+
362
+ if( in_array( $export->export_format, array( 'csv' ) ) ) {
363
+ woo_ce_export_dataset( $export->type );
364
+ }
365
+ $export->idle_memory_end = woo_ce_current_memory_usage();
366
+ $export->end_time = time();
367
+
368
+ // Print file contents to browser
369
+ } else {
370
+ if( in_array( $export->export_format, array( 'csv' ) ) ) {
371
+
372
+ // Generate CSV contents
373
+ $bits = woo_ce_export_dataset( $export->type );
374
+ unset( $export->fields );
375
+ if( empty( $bits ) ) {
376
+ $message = __( 'No export entries were found, please try again with different export filters.', 'woocommerce-exporter' );
377
+ woo_ce_admin_notice( $message, 'error' );
378
+ return;
379
+ }
380
+ if( woo_ce_get_option( 'delete_file', 1 ) ) {
381
+
382
+ // Print directly to browser
383
+ if( $export->export_format == 'csv' )
384
+ woo_ce_generate_csv_header( $export->type );
385
+ echo $bits;
386
+ exit();
387
+
388
+ } else {
389
+
390
+ // Save to file and insert to WordPress Media
391
+ if( $export->filename && $bits ) {
392
+ if( $export->export_format == 'csv' )
393
+ $post_ID = woo_ce_save_file_attachment( $export->filename, 'text/csv' );
394
+ $upload = wp_upload_bits( $export->filename, null, $bits );
395
+ if( ( $post_ID == false ) || $upload['error'] ) {
396
+ wp_delete_attachment( $post_ID, true );
397
+ if( isset( $upload['error'] ) )
398
+ wp_redirect( esc_url( add_query_arg( array( 'failed' => true, 'message' => urlencode( $upload['error'] ) ) ) ) );
399
+ else
400
+ wp_redirect( esc_url( add_query_arg( array( 'failed' => true ) ) ) );
401
+ return;
402
+ }
403
+ $attach_data = wp_generate_attachment_metadata( $post_ID, $upload['file'] );
404
+ wp_update_attachment_metadata( $post_ID, $attach_data );
405
+ update_attached_file( $post_ID, $upload['file'] );
406
+ if( $post_ID ) {
407
+ woo_ce_save_file_guid( $post_ID, $export->type, $upload['url'] );
408
+ woo_ce_save_file_details( $post_ID );
409
+ }
410
+ $export_type = $export->type;
411
+ unset( $export );
412
+
413
+ // The end memory usage and time is collected at the very last opportunity prior to the CSV header being rendered to the screen
414
+ woo_ce_update_file_detail( $post_ID, '_woo_idle_memory_end', woo_ce_current_memory_usage() );
415
+ woo_ce_update_file_detail( $post_ID, '_woo_end_time', time() );
416
+
417
+ // Generate CSV header
418
+ woo_ce_generate_csv_header( $export_type );
419
+ unset( $export_type );
420
+
421
+ // Print file contents to screen
422
+ if( $upload['file'] ) {
423
+ readfile( $upload['file'] );
424
+ } else {
425
+ $url = add_query_arg( 'failed', true );
426
+ wp_redirect( $url );
427
+ }
428
+ unset( $upload );
429
+ } else {
430
+ $url = add_query_arg( 'failed', true );
431
+ wp_redirect( $url );
432
+ }
433
+
434
+ }
435
+
436
+ }
437
+ exit();
438
+ }
439
+ }
440
+ break;
441
+
442
+ // Save changes on Settings screen
443
+ case 'save-settings':
444
+ // We need to verify the nonce.
445
+ if( !empty( $_POST ) && wp_verify_nonce( $_REQUEST['_wpnonce'], 'woo_ce_save_settings' ) ) {
446
+ if( check_admin_referer( 'woo_ce_save_settings' ) )
447
+ woo_ce_export_settings_save();
448
+ }
449
+ break;
450
+
451
+ // Save changes on Field Editor screen
452
+ case 'save-fields':
453
+ // We need to verify the nonce.
454
+ if( !empty( $_POST ) && check_admin_referer( 'save_fields', 'woo_ce_save_fields' ) ) {
455
+ $fields = ( isset( $_POST['fields'] ) ? array_filter( $_POST['fields'] ) : array() );
456
+ $export_type = ( isset( $_POST['type'] ) ? sanitize_text_field( $_POST['type'] ) : '' );
457
+ $export_types = array_keys( woo_ce_get_export_types() );
458
+ // Check we are saving against a valid export type
459
+ if( in_array( $export_type, $export_types ) ) {
460
+ woo_ce_update_option( $export_type . '_labels', $fields );
461
+ $message = __( 'Field labels have been saved.', 'woocommerce-exporter' );
462
+ woo_ce_admin_notice( $message );
463
+ } else {
464
+ $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' );
465
+ woo_ce_admin_notice( $message, 'error' );
466
+ }
467
+ }
468
+ break;
469
+
470
+ }
471
+
472
+ }
473
+ add_action( 'admin_init', 'woo_ce_admin_init', 11 );
474
+
475
+ // HTML templates and form processor for Store Exporter screen
476
+ function woo_ce_html_page() {
477
+
478
+ // Check the User has the view_woocommerce_reports capability
479
+ $user_capability = apply_filters( 'woo_ce_admin_user_capability', 'view_woocommerce_reports' );
480
+ if( current_user_can( $user_capability ) == false )
481
+ return;
482
+
483
+ global $wpdb, $export;
484
+
485
+ $title = apply_filters( 'woo_ce_template_header', __( 'Store Exporter', 'woocommerce-exporter' ) );
486
+ woo_ce_template_header( $title );
487
+ woo_ce_support_donate();
488
+ $action = ( function_exists( 'woo_get_action' ) ? woo_get_action() : false );
489
+ switch( $action ) {
490
+
491
+ case 'export':
492
+ if( WOO_CE_DEBUG ) {
493
+ if( false === ( $export_log = get_transient( WOO_CE_PREFIX . '_debug_log' ) ) ) {
494
+ $export_log = __( 'No export entries were found within the debug Transient, please try again with different export filters.', 'woocommerce-exporter' );
495
+ } else {
496
+ // We take the contents of our WordPress Transient and de-base64 it back to CSV format
497
+ $export_log = base64_decode( $export_log );
498
+ }
499
+ delete_transient( WOO_CE_PREFIX . '_debug_log' );
500
+ $output = '
501
+ <h3>' . sprintf( __( 'Export Details: %s', 'woocommerce-exporter' ), esc_attr( $export->filename ) ) . '</h3>
502
+ <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>
503
+ <textarea id="export_log">' . esc_textarea( print_r( $export, true ) ) . '</textarea>
504
+ <hr />';
505
+ if( in_array( $export->export_format, array( 'csv' ) ) ) {
506
+ $output .= '
507
+ <script type="text/javascript">
508
+ $j(function() {
509
+ $j(\'#export_sheet\').CSVToTable(\'\', {
510
+ startLine: 0
511
+ });
512
+ });
513
+ </script>
514
+ <h3>' . __( 'Export', 'woocommerce-exporter' ) . '</h3>
515
+ <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>
516
+ <div id="export_sheet">' . esc_textarea( $export_log ) . '</div>
517
+ <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>
518
+ <hr />';
519
+ }
520
+ $output .= '
521
+ <h3>' . __( 'Export Log', 'woocommerce-exporter' ) . '</h3>
522
+ <p>' . __( 'This prints the raw export contents and is helpful when the jQuery plugin above fails due to major formatting errors.', 'woocommerce-exporter' ) . '</p>
523
+ <textarea id="export_log" wrap="off">' . esc_textarea( $export_log ) . '</textarea>
524
+ <hr />
525
+ ';
526
+ echo $output;
527
+ }
528
+
529
+ woo_ce_manage_form();
530
+ break;
531
+
532
+ case 'update':
533
+ woo_ce_admin_custom_fields_save();
534
+
535
+ $message = __( 'Custom Fields saved. You can now select those additional fields from the Export Fields list.', 'woocommerce-exporter' );
536
+ woo_ce_admin_notice_html( $message );
537
+ woo_ce_manage_form();
538
+ break;
539
+
540
+ default:
541
+ woo_ce_manage_form();
542
+ break;
543
+
544
+ }
545
+ woo_ce_template_footer();
546
+
547
+ }
548
+
549
+ // HTML template for Export screen
550
+ function woo_ce_manage_form() {
551
+
552
+ $tab = ( isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : false );
553
+ // If Skip Overview is set then jump to Export screen
554
+ if( $tab == false && woo_ce_get_option( 'skip_overview', false ) )
555
+ $tab = 'export';
556
+
557
+ // Check that WC() is available
558
+ if( !function_exists( 'WC' ) ) {
559
+ $message = __( 'We couldn\'t load the WooCommerce resource WC(), check that WooCommerce is installed and active. If this persists get in touch with us.', 'woocommerce-exporter' );
560
+ woo_cd_admin_notice_html( $message, 'error' );
561
+ return;
562
+ }
563
+
564
+ woo_ce_load_export_types();
565
+ woo_ce_admin_fail_notices();
566
+
567
+ include_once( WOO_CE_PATH . 'templates/admin/tabs.php' );
568
+
569
+ }
570
+
571
+ /* End of: WordPress Administration */
572
+
573
+ }
574
+ ?>
includes/admin.php ADDED
@@ -0,0 +1,569 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ $response = set_transient( WOO_CE_PREFIX . '_notice', base64_encode( $output ), DAY_IN_SECONDS );
19
+ // Check if the Transient was saved
20
+ if( $response !== false )
21
+ add_action( 'admin_notices', 'woo_ce_admin_notice_print' );
22
+ }
23
+
24
+ }
25
+
26
+ // HTML template for admin notice
27
+ function woo_ce_admin_notice_html( $message = '', $priority = 'updated', $screen = '', $id = '' ) {
28
+
29
+ // Default priority to updated
30
+ if( empty( $priority ) )
31
+ $priority = 'updated';
32
+ // Display admin notice on specific screen
33
+ if( !empty( $screen ) ) {
34
+
35
+ global $pagenow;
36
+
37
+ if( is_array( $screen ) ) {
38
+ if( in_array( $pagenow, $screen ) == false )
39
+ return;
40
+ } else {
41
+ if( $pagenow <> $screen )
42
+ return;
43
+ }
44
+
45
+ }
46
+ // Override for WooCommerce notice styling
47
+ if( $priority == 'notice' )
48
+ $priority = 'updated woocommerce-message'; ?>
49
+ <div id="<?php echo ( !empty( $id ) ? sprintf( 'message-%s', $id ) : 'message' ); ?>" class="<?php echo $priority; ?>">
50
+ <p><?php echo $message; ?></p>
51
+ </div>
52
+ <?php
53
+
54
+ }
55
+
56
+ // Grabs the WordPress transient that holds the admin notice and prints it
57
+ function woo_ce_admin_notice_print() {
58
+
59
+ $output = get_transient( WOO_CE_PREFIX . '_notice' );
60
+ if( $output !== false ) {
61
+ delete_transient( WOO_CE_PREFIX . '_notice' );
62
+ $output = base64_decode( $output );
63
+ echo $output;
64
+ }
65
+
66
+ }
67
+
68
+ // HTML template header on Store Exporter screen
69
+ function woo_ce_template_header( $title = '', $icon = 'woocommerce' ) {
70
+
71
+ if( $title )
72
+ $output = $title;
73
+ else
74
+ $output = __( 'Store Export', 'woocommerce-exporter' ); ?>
75
+ <div id="woo-ce" class="wrap">
76
+ <div id="icon-<?php echo $icon; ?>" class="icon32 icon32-woocommerce-importer"><br /></div>
77
+ <h2>
78
+ <?php echo $output; ?>
79
+ </h2>
80
+ <?php
81
+
82
+ }
83
+
84
+ // HTML template footer on Store Exporter screen
85
+ function woo_ce_template_footer() { ?>
86
+ </div>
87
+ <!-- .wrap -->
88
+ <?php
89
+
90
+ }
91
+
92
+ function woo_ce_export_options_export_format() {
93
+
94
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
95
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
96
+
97
+ ob_start(); ?>
98
+ <tr>
99
+ <th>
100
+ <label><?php _e( 'Export format', 'woocommerce-exporter' ); ?></label>
101
+ </th>
102
+ <td>
103
+ <label><input type="radio" name="export_format" value="csv"<?php checked( 'csv', 'csv' ); ?> /> <?php _e( 'CSV', 'woocommerce-exporter' ); ?> <span class="description"><?php _e( '(Comma Separated Values)', 'woocommerce-exporter' ); ?></span></label><br />
104
+ <label><input type="radio" name="export_format" value="xls" disabled="disabled" /> <?php _e( 'Excel (XLS)', 'woocommerce-exporter' ); ?> <span class="description"><?php _e( '(Excel 97-2003)', 'woocommerce-exporter' ); ?> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label><br />
105
+ <label><input type="radio" name="export_format" value="xlsx" disabled="disabled" /> <?php _e( 'Excel (XLSX)', 'woocommerce-exporter' ); ?> <span class="description"><?php _e( '(Excel 2007-2013)', 'woocommerce-exporter' ); ?> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label><br />
106
+ <label><input type="radio" name="export_format" value="xml" disabled="disabled" /> <?php _e( 'XML', 'woocommerce-exporter' ); ?> <span class="description"><?php _e( '(EXtensible Markup Language)', 'woocommerce-exporter' ); ?> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label><br />
107
+ <div class="export-options product-options">
108
+ <label><input type="radio" name="export_format" value="rss" disabled="disabled" /> <?php _e( 'RSS', 'woocommerce-exporter' ); ?> <span class="description"><?php printf( __( '(<attr title="%s">XML</attr> feed in RSS 2.0 format)', 'woocommerce-exporter' ), __( 'EXtensible Markup Language', 'woocommerce-exporter' ) ); ?> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label>
109
+ </div>
110
+ <p class="description"><?php _e( 'Adjust the export format to generate different export file formats.', 'woocommerce-exporter' ); ?></p>
111
+ </td>
112
+ </tr>
113
+ <?php
114
+ ob_end_flush();
115
+
116
+ }
117
+
118
+ // Add Export and Docs links to the Plugins screen
119
+ function woo_ce_add_settings_link( $links, $file ) {
120
+
121
+ // Manually force slug
122
+ $this_plugin = WOO_CE_RELPATH;
123
+
124
+ if( $file == $this_plugin ) {
125
+ $docs_url = 'http://www.visser.com.au/docs/';
126
+ $docs_link = sprintf( '<a href="%s" target="_blank">' . __( 'Docs', 'woocommerce-exporter' ) . '</a>', $docs_url );
127
+ $export_link = sprintf( '<a href="%s">' . __( 'Export', 'woocommerce-exporter' ) . '</a>', esc_url( add_query_arg( 'page', 'woo_ce', 'admin.php' ) ) );
128
+ array_unshift( $links, $docs_link );
129
+ array_unshift( $links, $export_link );
130
+ }
131
+ return $links;
132
+
133
+ }
134
+ add_filter( 'plugin_action_links', 'woo_ce_add_settings_link', 10, 2 );
135
+
136
+ function woo_ce_admin_custom_fields_save() {
137
+
138
+ // Save Custom Product Meta
139
+ if( isset( $_POST['custom_products'] ) ) {
140
+ $custom_products = $_POST['custom_products'];
141
+ $custom_products = explode( "\n", trim( $custom_products ) );
142
+ if( !empty( $custom_products ) ) {
143
+ $size = count( $custom_products );
144
+ if( !empty( $size ) ) {
145
+ for( $i = 0; $i < $size; $i++ )
146
+ $custom_products[$i] = sanitize_text_field( trim( stripslashes( $custom_products[$i] ) ) );
147
+ woo_ce_update_option( 'custom_products', $custom_products );
148
+ }
149
+ } else {
150
+ woo_ce_update_option( 'custom_products', '' );
151
+ }
152
+ unset( $custom_products );
153
+ }
154
+
155
+ }
156
+
157
+ // Add Store Export page to WooCommerce screen IDs
158
+ function woo_ce_wc_screen_ids( $screen_ids = array() ) {
159
+
160
+ $screen_ids[] = 'woocommerce_page_woo_ce';
161
+ return $screen_ids;
162
+
163
+ }
164
+ add_filter( 'woocommerce_screen_ids', 'woo_ce_wc_screen_ids', 10, 1 );
165
+
166
+ // Add Store Export to WordPress Administration menu
167
+ function woo_ce_admin_menu() {
168
+
169
+ $page = add_submenu_page( 'woocommerce', __( 'Store Exporter', 'woocommerce-exporter' ), __( 'Store Export', 'woocommerce-exporter' ), 'view_woocommerce_reports', 'woo_ce', 'woo_ce_html_page' );
170
+ add_action( 'admin_print_styles-' . $page, 'woo_ce_enqueue_scripts' );
171
+ add_action( 'current_screen', 'woo_ce_add_help_tab' );
172
+
173
+ }
174
+ add_action( 'admin_menu', 'woo_ce_admin_menu', 11 );
175
+
176
+ // Load CSS and jQuery scripts for Store Exporter screen
177
+ function woo_ce_enqueue_scripts() {
178
+
179
+ // Simple check that WooCommerce is activated
180
+ if( class_exists( 'WooCommerce' ) ) {
181
+
182
+ global $woocommerce;
183
+
184
+ // Load WooCommerce default Admin styling
185
+ wp_enqueue_style( 'woocommerce_admin_styles', $woocommerce->plugin_url() . '/assets/css/admin.css' );
186
+
187
+ }
188
+
189
+ // Date Picker Addon
190
+ wp_enqueue_script( 'jquery-ui-datepicker' );
191
+ wp_enqueue_style( 'jquery-ui-datepicker', plugins_url( '/templates/admin/jquery-ui-datepicker.css', WOO_CE_RELPATH ) );
192
+
193
+ // Time Picker, Date Picker Addon
194
+ wp_enqueue_script( 'jquery-ui-timepicker', plugins_url( '/js/jquery.timepicker.js', WOO_CE_RELPATH ), array( 'jquery', 'jquery-ui-datepicker' ) );
195
+ wp_enqueue_style( 'jquery-ui-datepicker', plugins_url( '/templates/admin/jquery-ui-timepicker.css', WOO_CE_RELPATH ) );
196
+
197
+ // Chosen
198
+ wp_enqueue_style( 'jquery-chosen', plugins_url( '/templates/admin/chosen.css', WOO_CE_RELPATH ) );
199
+ wp_enqueue_script( 'jquery-chosen', plugins_url( '/js/jquery.chosen.js', WOO_CE_RELPATH ), array( 'jquery' ) );
200
+
201
+ // Common
202
+ wp_enqueue_style( 'woo_ce_styles', plugins_url( '/templates/admin/export.css', WOO_CE_RELPATH ) );
203
+ wp_enqueue_script( 'woo_ce_scripts', plugins_url( '/templates/admin/export.js', WOO_CE_RELPATH ), array( 'jquery', 'jquery-ui-sortable' ) );
204
+ wp_enqueue_style( 'dashicons' );
205
+
206
+ if( WOO_CE_DEBUG ) {
207
+ wp_enqueue_style( 'jquery-csvToTable', plugins_url( '/templates/admin/jquery-csvtable.css', WOO_CE_RELPATH ) );
208
+ wp_enqueue_script( 'jquery-csvToTable', plugins_url( '/js/jquery.csvToTable.js', WOO_CE_RELPATH ), array( 'jquery' ) );
209
+ }
210
+ wp_enqueue_style( 'woo_vm_styles', plugins_url( '/templates/admin/woocommerce-admin_dashboard_vm-plugins.css', WOO_CE_RELPATH ) );
211
+
212
+ }
213
+
214
+ function woo_ce_add_help_tab() {
215
+
216
+ $screen = get_current_screen();
217
+ if( $screen->id <> 'woocommerce_page_woo_ce' )
218
+ return;
219
+
220
+ $screen->add_help_tab( array(
221
+ 'id' => 'woo_ce',
222
+ 'title' => __( 'Store Exporter', 'woocommerce-exporter' ),
223
+ 'content' =>
224
+ '<p>' . __( 'Thank you for using Store Exporter :) Should you need help using this Plugin please read the documentation, if an issue persists get in touch with us on the WordPress.org Support tab for this Plugin.', 'woocommerce-exporter' ) . '</p>' .
225
+ '<p><a href="' . 'http://www.visser.com.au/documentation/store-exporter/usage/' . '" target="_blank" class="button button-primary">' . __( 'Documentation', 'woocommerce-exporter' ) . '</a> <a href="' . 'http://wordpress.org/support/plugin/woocommerce-exporter' . '" target="_blank" class="button">' . __( 'Forum Support', 'woocommerce-exporter' ) . '</a></p>'
226
+ ) );
227
+
228
+ }
229
+
230
+ function woo_ce_admin_plugin_row() {
231
+
232
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/';
233
+
234
+ // Detect if another e-Commerce platform is activated
235
+ if( !woo_is_woo_activated() && ( woo_is_jigo_activated() || woo_is_wpsc_activated() ) ) {
236
+ $message = __( 'We have detected another e-Commerce Plugin than WooCommerce activated, please check that you are using Store Exporter for the correct platform.', 'woocommerce-exporter' );
237
+ $message .= sprintf( ' <a href="%s" target="_blank">%s</a>', __( 'Need help?', 'woocommerce-exporter' ), $troubleshooting_url );
238
+ echo '</tr><tr class="plugin-update-tr"><td colspan="3" class="plugin-update colspanchange"><div class="update-message">' . $message . '</div></td></tr>';
239
+ } else if( !woo_is_woo_activated() ) {
240
+ $message = __( 'We have been unable to detect the WooCommerce Plugin activated on this WordPress site, please check that you are using Exporter Deluxe for the correct platform.', 'woocommerce-exporter' );
241
+ $message .= sprintf( ' <a href="%s" target="_blank">%s</a>', $troubleshooting_url, __( 'Need help?', 'woocommerce-exporter' ) );
242
+ echo '</tr><tr class="plugin-update-tr"><td colspan="3" class="plugin-update colspanchange"><div class="update-message">' . $message . '</div></td></tr>';
243
+ }
244
+
245
+ }
246
+
247
+ // HTML active class for the currently selected tab on the Store Exporter screen
248
+ function woo_ce_admin_active_tab( $tab_name = null, $tab = null ) {
249
+
250
+ if( isset( $_GET['tab'] ) && !$tab )
251
+ $tab = $_GET['tab'];
252
+ else if( !isset( $_GET['tab'] ) && woo_ce_get_option( 'skip_overview', false ) )
253
+ $tab = 'export';
254
+ else
255
+ $tab = 'overview';
256
+
257
+ $output = '';
258
+ if( isset( $tab_name ) && $tab_name ) {
259
+ if( $tab_name == $tab )
260
+ $output = ' nav-tab-active';
261
+ }
262
+ echo $output;
263
+
264
+ }
265
+
266
+ // HTML template for each tab on the Store Exporter screen
267
+ function woo_ce_tab_template( $tab = '' ) {
268
+
269
+ if( !$tab )
270
+ $tab = 'overview';
271
+
272
+ // Store Exporter Deluxe
273
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
274
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
275
+
276
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/';
277
+
278
+ switch( $tab ) {
279
+
280
+ case 'overview':
281
+ $skip_overview = woo_ce_get_option( 'skip_overview', false );
282
+ break;
283
+
284
+ case 'export':
285
+ $export_type = sanitize_text_field( ( isset( $_POST['dataset'] ) ? $_POST['dataset'] : woo_ce_get_option( 'last_export', 'product' ) ) );
286
+ $export_types = array_keys( woo_ce_get_export_types() );
287
+
288
+ // Check if the default export type exists
289
+ if( !in_array( $export_type, $export_types ) )
290
+ $export_type = 'product';
291
+
292
+ $product = woo_ce_get_export_type_count( 'product' );
293
+ $category = woo_ce_get_export_type_count( 'category' );
294
+ $tag = woo_ce_get_export_type_count( 'tag' );
295
+ $brand = '999';
296
+ $order = '999';
297
+ $customer = '999';
298
+ $user = woo_ce_get_export_type_count( 'user' );
299
+ $review = '999';
300
+ $coupon = '999';
301
+ $attribute = '999';
302
+ $subscription = '999';
303
+ $product_vendor = '999';
304
+ $commission = '999';
305
+ $shipping_class = '999';
306
+ $ticket = '999';
307
+
308
+ add_action( 'woo_ce_export_options', 'woo_ce_export_options_export_format' );
309
+ if( $product_fields = woo_ce_get_product_fields() ) {
310
+ foreach( $product_fields as $key => $product_field )
311
+ $product_fields[$key]['disabled'] = ( isset( $product_field['disabled'] ) ? $product_field['disabled'] : 0 );
312
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_category' );
313
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_tag' );
314
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_brand' );
315
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_vendor' );
316
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_status' );
317
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_type' );
318
+ add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_stock_status' );
319
+ add_action( 'woo_ce_export_product_options_after_table', 'woo_ce_product_sorting' );
320
+ add_action( 'woo_ce_export_options', 'woo_ce_products_upsells_formatting' );
321
+ add_action( 'woo_ce_export_options', 'woo_ce_products_crosssells_formatting' );
322
+ add_action( 'woo_ce_export_options', 'woo_ce_export_options_gallery_format' );
323
+ add_action( 'woo_ce_export_after_form', 'woo_ce_products_custom_fields' );
324
+ }
325
+ if( $category_fields = woo_ce_get_category_fields() ) {
326
+ foreach( $category_fields as $key => $category_field )
327
+ $category_fields[$key]['disabled'] = ( isset( $category_field['disabled'] ) ? $category_field['disabled'] : 0 );
328
+ add_action( 'woo_ce_export_category_options_after_table', 'woo_ce_category_sorting' );
329
+ }
330
+ if( $tag_fields = woo_ce_get_tag_fields() ) {
331
+ foreach( $tag_fields as $key => $tag_field )
332
+ $tag_fields[$key]['disabled'] = ( isset( $tag_field['disabled'] ) ? $tag_field['disabled'] : 0 );
333
+ add_action( 'woo_ce_export_tag_options_after_table', 'woo_ce_tag_sorting' );
334
+ }
335
+ if( $brand_fields = woo_ce_get_brand_fields() ) {
336
+ foreach( $brand_fields as $key => $brand_field )
337
+ $brand_fields[$key]['disabled'] = ( isset( $brand_field['disabled'] ) ? $brand_field['disabled'] : 0 );
338
+ add_action( 'woo_ce_export_brand_options_before_table', 'woo_ce_brand_sorting' );
339
+ }
340
+ if( $order_fields = woo_ce_get_order_fields() ) {
341
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_date' );
342
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_status' );
343
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_customer' );
344
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_billing_country' );
345
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_shipping_country' );
346
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_user_role' );
347
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_coupon' );
348
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_product' );
349
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_product_category' );
350
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_product_tag' );
351
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_product_brand' );
352
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_order_id' );
353
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_payment_gateway' );
354
+ add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_shipping_method' );
355
+ add_action( 'woo_ce_export_order_options_after_table', 'woo_ce_order_sorting' );
356
+ add_action( 'woo_ce_export_options', 'woo_ce_orders_items_formatting' );
357
+ add_action( 'woo_ce_export_options', 'woo_ce_orders_max_order_items' );
358
+ add_action( 'woo_ce_export_options', 'woo_ce_orders_items_types' );
359
+ add_action( 'woo_ce_export_after_form', 'woo_ce_orders_custom_fields' );
360
+ }
361
+ if( $customer_fields = woo_ce_get_customer_fields() ) {
362
+ add_action( 'woo_ce_export_customer_options_before_table', 'woo_ce_customers_filter_by_status' );
363
+ add_action( 'woo_ce_export_customer_options_before_table', 'woo_ce_customers_filter_by_user_role' );
364
+ add_action( 'woo_ce_export_after_form', 'woo_ce_customers_custom_fields' );
365
+ }
366
+ if( $user_fields = woo_ce_get_user_fields() ) {
367
+ foreach( $user_fields as $key => $user_field )
368
+ $user_fields[$key]['disabled'] = ( isset( $user_field['disabled'] ) ? $user_field['disabled'] : 0 );
369
+ add_action( 'woo_ce_export_user_options_after_table', 'woo_ce_user_sorting' );
370
+ add_action( 'woo_ce_export_after_form', 'woo_ce_users_custom_fields' );
371
+ }
372
+ if( $coupon_fields = woo_ce_get_coupon_fields() ) {
373
+ add_action( 'woo_ce_export_coupon_options_before_table', 'woo_ce_coupon_sorting' );
374
+ }
375
+ if( $subscription_fields = woo_ce_get_subscription_fields() ) {
376
+ add_action( 'woo_ce_export_subscription_options_before_table', 'woo_ce_subscriptions_filter_by_subscription_status' );
377
+ add_action( 'woo_ce_export_subscription_options_before_table', 'woo_ce_subscriptions_filter_by_subscription_product' );
378
+ }
379
+ $product_vendor_fields = woo_ce_get_product_vendor_fields();
380
+ if( $commission_fields = woo_ce_get_commission_fields() ) {
381
+ add_action( 'woo_ce_export_commission_options_before_table', 'woo_ce_commissions_filter_by_date' );
382
+ add_action( 'woo_ce_export_commission_options_before_table', 'woo_ce_commissions_filter_by_product_vendor' );
383
+ add_action( 'woo_ce_export_commission_options_before_table', 'woo_ce_commissions_filter_by_commission_status' );
384
+ add_action( 'woo_ce_export_commission_options_before_table', 'woo_ce_commission_sorting' );
385
+ }
386
+ if( $shipping_class_fields = woo_ce_get_shipping_class_fields() ) {
387
+ add_action( 'woo_ce_export_shipping_class_options_after_table', 'woo_ce_shipping_class_sorting' );
388
+ }
389
+ $attribute_fields = false;
390
+
391
+ // Export options
392
+ $limit_volume = woo_ce_get_option( 'limit_volume' );
393
+ $offset = woo_ce_get_option( 'offset' );
394
+ break;
395
+
396
+ case 'fields':
397
+ $export_type = ( isset( $_GET['type'] ) ? sanitize_text_field( $_GET['type'] ) : '' );
398
+ $export_types = array_keys( woo_ce_get_export_types() );
399
+ $fields = array();
400
+ if( in_array( $export_type, $export_types ) ) {
401
+ if( has_filter( 'woo_ce_' . $export_type . '_fields', 'woo_ce_override_' . $export_type . '_field_labels' ) )
402
+ remove_filter( 'woo_ce_' . $export_type . '_fields', 'woo_ce_override_' . $export_type . '_field_labels', 11 );
403
+ if( function_exists( sprintf( 'woo_ce_get_%s_fields', $export_type ) ) )
404
+ $fields = call_user_func( 'woo_ce_get_' . $export_type . '_fields' );
405
+ $labels = woo_ce_get_option( $export_type . '_labels', array() );
406
+ }
407
+ break;
408
+
409
+ case 'archive':
410
+ if( isset( $_GET['deleted'] ) ) {
411
+ $message = __( 'Archived export has been deleted.', 'woocommerce-exporter' );
412
+ woo_ce_admin_notice( $message );
413
+ }
414
+ if( $files = woo_ce_get_archive_files() ) {
415
+ foreach( $files as $key => $file )
416
+ $files[$key] = woo_ce_get_archive_file( $file );
417
+ }
418
+ break;
419
+
420
+ case 'settings':
421
+ $export_filename = woo_ce_get_option( 'export_filename', '' );
422
+ // Default export filename
423
+ if( $export_filename == false )
424
+ $export_filename = '%store_name%-export_%dataset%-%date%-%time%-%random%.csv';
425
+ $delete_file = woo_ce_get_option( 'delete_file', 1 );
426
+ $timeout = woo_ce_get_option( 'timeout', 0 );
427
+ $encoding = woo_ce_get_option( 'encoding', 'UTF-8' );
428
+ $bom = woo_ce_get_option( 'bom', 1 );
429
+ $delimiter = woo_ce_get_option( 'delimiter', ',' );
430
+ $category_separator = woo_ce_get_option( 'category_separator', '|' );
431
+ $escape_formatting = woo_ce_get_option( 'escape_formatting', 'all' );
432
+ $date_format = woo_ce_get_option( 'date_format', 'd/m/Y' );
433
+ // Reset the Date Format if corrupted
434
+ if( $date_format == '1' || $date_format == '' || $date_format == false )
435
+ $date_format = 'd/m/Y';
436
+ $file_encodings = ( function_exists( 'mb_list_encodings' ) ? mb_list_encodings() : false );
437
+ add_action( 'woo_ce_export_settings_top', 'woo_ce_export_settings_quicklinks' );
438
+ add_action( 'woo_ce_export_settings_after', 'woo_ce_export_settings_csv' );
439
+ add_action( 'woo_ce_export_settings_after', 'woo_ce_export_settings_extend' );
440
+ break;
441
+
442
+ case 'tools':
443
+ // Product Importer Deluxe
444
+ $woo_pd_url = 'http://www.visser.com.au/woocommerce/plugins/product-importer-deluxe/';
445
+ $woo_pd_target = ' target="_blank"';
446
+ if( function_exists( 'woo_pd_init' ) ) {
447
+ $woo_pd_url = esc_url( add_query_arg( array( 'page' => 'woo_pd', 'tab' => null ) ) );
448
+ $woo_pd_target = false;
449
+ }
450
+
451
+ // Store Toolkit
452
+ $woo_st_url = 'http://www.visser.com.au/woocommerce/plugins/store-toolkit/';
453
+ $woo_st_target = ' target="_blank"';
454
+ if( function_exists( 'woo_st_admin_init' ) ) {
455
+ $woo_st_url = esc_url( add_query_arg( array( 'page' => 'woo_st', 'tab' => null ) ) );
456
+ $woo_st_target = false;
457
+ }
458
+
459
+ // Export modules
460
+ $module_status = ( isset( $_GET['module_status'] ) ? sanitize_text_field( $_GET['module_status'] ) : false );
461
+ $modules = woo_ce_modules_list( $module_status );
462
+ $modules_all = get_transient( WOO_CE_PREFIX . '_modules_all_count' );
463
+ $modules_active = get_transient( WOO_CE_PREFIX . '_modules_active_count' );
464
+ $modules_inactive = get_transient( WOO_CE_PREFIX . '_modules_inactive_count' );
465
+ break;
466
+
467
+ }
468
+ if( $tab ) {
469
+ if( file_exists( WOO_CE_PATH . 'templates/admin/tabs-' . $tab . '.php' ) ) {
470
+ include_once( WOO_CE_PATH . 'templates/admin/tabs-' . $tab . '.php' );
471
+ } else {
472
+ $message = sprintf( __( 'We couldn\'t load the export template file <code>%s</code> within <code>%s</code>, this file should be present.', 'woocommerce-exporter' ), 'tabs-' . $tab . '.php', WOO_CE_PATH . 'templates/admin/...' );
473
+ woo_ce_admin_notice_html( $message, 'error' );
474
+ ob_start(); ?>
475
+ <p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-exporter' ); ?>:</p>
476
+ <ul class="ul-disc">
477
+ <li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-exporter' ); ?></li>
478
+ <li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-exporter' ); ?></li>
479
+ <li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-exporter' ); ?></li>
480
+ </ul>
481
+ <p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-exporter' ); ?></p>
482
+ <?php
483
+ ob_end_flush();
484
+ }
485
+ }
486
+
487
+ }
488
+
489
+ // Display the memory usage in the screen footer
490
+ function woo_ce_admin_footer_text( $footer_text = '' ) {
491
+
492
+ $current_screen = get_current_screen();
493
+ $pages = array(
494
+ 'woocommerce_page_woo_ce'
495
+ );
496
+ // Check to make sure we're on the Export screen
497
+ if ( isset( $current_screen->id ) && apply_filters( 'woo_ce_display_admin_footer_text', in_array( $current_screen->id, $pages ) ) ) {
498
+ $memory_usage = woo_ce_current_memory_usage( false );
499
+ $memory_limit = absint( ini_get( 'memory_limit' ) );
500
+ $memory_percent = absint( $memory_usage / $memory_limit * 100 );
501
+ $memory_color = 'font-weight:normal;';
502
+ if( $memory_percent > 75 )
503
+ $memory_color = 'font-weight:bold; color:orange;';
504
+ if( $memory_percent > 90 )
505
+ $memory_color = 'font-weight:bold; color:red;';
506
+ $footer_text .= ' | ' . sprintf( __( 'Memory: %s of %s MB (%s)', 'woocommerce-exporter' ), $memory_usage, $memory_limit, sprintf( '<span style="%s">%s</span>', $memory_color, $memory_percent . '%' ) );
507
+ }
508
+ return $footer_text;
509
+
510
+ }
511
+
512
+ function woo_ce_modules_status_class( $status = 'inactive' ) {
513
+
514
+ $output = '';
515
+ switch( $status ) {
516
+
517
+ case 'active':
518
+ $output = 'green';
519
+ break;
520
+
521
+ case 'inactive':
522
+ $output = 'yellow';
523
+ break;
524
+
525
+ }
526
+ echo $output;
527
+
528
+ }
529
+
530
+ function woo_ce_modules_status_label( $status = 'inactive' ) {
531
+
532
+ $output = '';
533
+ switch( $status ) {
534
+
535
+ case 'active':
536
+ $output = __( 'OK', 'woocommerce-exporter' );
537
+ break;
538
+
539
+ case 'inactive':
540
+ $output = __( 'Install', 'woocommerce-exporter' );
541
+ break;
542
+
543
+ }
544
+ echo $output;
545
+
546
+ }
547
+
548
+ // HTML template for header prompt on Store Exporter screen
549
+ function woo_ce_support_donate() {
550
+
551
+ $output = '';
552
+ $show = true;
553
+ if( function_exists( 'woo_vl_we_love_your_plugins' ) ) {
554
+ if( in_array( WOO_CE_DIRNAME, woo_vl_we_love_your_plugins() ) )
555
+ $show = false;
556
+ }
557
+ if( $show ) {
558
+ $donate_url = 'http://www.visser.com.au/donate/';
559
+ $rate_url = 'http://wordpress.org/support/view/plugin-reviews/' . WOO_CE_DIRNAME;
560
+ $output = '
561
+ <div id="support-donate_rate" class="support-donate_rate">
562
+ <p>' . sprintf( __( '<strong>Like this Plugin?</strong> %s and %s.', 'woocommerce-exporter' ), '<a href="' . $donate_url . '" target="_blank">' . __( 'Donate to support this Plugin', 'woocommerce-exporter' ) . '</a>', '<a href="' . esc_url( add_query_arg( array( 'rate' => '5' ), $rate_url ) ) . '#postform" target="_blank">rate / review us on WordPress.org</a>' ) . '</p>
563
+ </div>
564
+ ';
565
+ }
566
+ echo $output;
567
+
568
+ }
569
+ ?>
includes/admin/brand.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for Coupon Sorting widget on Store Exporter screen
7
+ function woo_ce_brand_sorting() {
8
+
9
+ $orderby = woo_ce_get_option( 'brand_orderby', 'ID' );
10
+ $order = woo_ce_get_option( 'brand_order', 'DESC' );
11
+
12
+ ob_start(); ?>
13
+ <p><label><?php _e( 'Brand Sorting', 'woocommerce-exporter' ); ?></label></p>
14
+ <div>
15
+ <select name="brand_orderby" disabled="disabled">
16
+ <option value="id"><?php _e( 'Term ID', 'woocommerce-exporter' ); ?></option>
17
+ <option value="name"><?php _e( 'Brand Name', 'woocommerce-exporter' ); ?></option>
18
+ </select>
19
+ <select name="brand_order" disabled="disabled">
20
+ <option value="ASC"><?php _e( 'Ascending', 'woocommerce-exporter' ); ?></option>
21
+ <option value="DESC"><?php _e( 'Descending', 'woocommerce-exporter' ); ?></option>
22
+ </select>
23
+ <p class="description"><?php _e( 'Select the sorting of Brands within the exported file. By default this is set to export Product Brands by Term ID in Desending order.', 'woocommerce-exporter' ); ?></p>
24
+ </div>
25
+ <?php
26
+ ob_end_flush();
27
+
28
+ }
29
+
30
+ /* End of: WordPress Administration */
31
+
32
+ }
33
+ ?>
includes/admin/category.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for Category Sorting widget on Store Exporter screen
7
+ function woo_ce_category_sorting() {
8
+
9
+ $category_orderby = woo_ce_get_option( 'category_orderby', 'ID' );
10
+ $category_order = woo_ce_get_option( 'category_order', 'DESC' );
11
+
12
+ ob_start(); ?>
13
+ <p><label><?php _e( 'Category Sorting', 'woocommerce-exporter' ); ?></label></p>
14
+ <div>
15
+ <select name="category_orderby">
16
+ <option value="id"<?php selected( 'id', $category_orderby ); ?>><?php _e( 'Term ID', 'woocommerce-exporter' ); ?></option>
17
+ <option value="name"<?php selected( 'name', $category_orderby ); ?>><?php _e( 'Category Name', 'woocommerce-exporter' ); ?></option>
18
+ </select>
19
+ <select name="category_order">
20
+ <option value="ASC"<?php selected( 'ASC', $category_order ); ?>><?php _e( 'Ascending', 'woocommerce-exporter' ); ?></option>
21
+ <option value="DESC"<?php selected( 'DESC', $category_order ); ?>><?php _e( 'Descending', 'woocommerce-exporter' ); ?></option>
22
+ </select>
23
+ <p class="description"><?php _e( 'Select the sorting of Categories within the exported file. By default this is set to export Categories by Term ID in Desending order.', 'woocommerce-exporter' ); ?></p>
24
+ </div>
25
+ <?php
26
+ ob_end_flush();
27
+
28
+ }
29
+
30
+ /* End of: WordPress Administration */
31
+
32
+ }
33
+ ?>
includes/admin/commission.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for Filter Commissions by Commission Date widget on Store Exporter screen
7
+ function woo_ce_commissions_filter_by_date() {
8
+
9
+ $woo_cd_url = '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
+ /* End of: WordPress Administration */
81
+
82
+ }
83
+ ?>
includes/admin/coupon.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for disabled Coupon Sorting widget on Store Exporter screen
7
+ function woo_ce_coupon_sorting() {
8
+
9
+ ob_start(); ?>
10
+ <p><label><?php _e( 'Coupon Sorting', 'woocommerce-exporter' ); ?></label></p>
11
+ <div>
12
+ <select name="coupon_orderby" disabled="disabled">
13
+ <option value="ID"><?php _e( 'Coupon ID', 'woocommerce-exporter' ); ?></option>
14
+ <option value="title"><?php _e( 'Coupon Code', 'woocommerce-exporter' ); ?></option>
15
+ <option value="date"><?php _e( 'Date Created', 'woocommerce-exporter' ); ?></option>
16
+ <option value="modified"><?php _e( 'Date Modified', 'woocommerce-exporter' ); ?></option>
17
+ <option value="rand"><?php _e( 'Random', 'woocommerce-exporter' ); ?></option>
18
+ </select>
19
+ <select name="coupon_order" disabled="disabled">
20
+ <option value="ASC"><?php _e( 'Ascending', 'woocommerce-exporter' ); ?></option>
21
+ <option value="DESC"><?php _e( 'Descending', 'woocommerce-exporter' ); ?></option>
22
+ </select>
23
+ <p class="description"><?php _e( 'Select the sorting of Coupons within the exported file. By default this is set to export Coupons by Coupon ID in Desending order.', 'woocommerce-exporter' ); ?></p>
24
+ </div>
25
+ <?php
26
+ ob_end_flush();
27
+
28
+ }
29
+
30
+ /* End of: WordPress Administration */
31
+
32
+ }
33
+ ?>
includes/admin/customer.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for Filter Customers by Order Status widget on Store Exporter screen
7
+ function woo_ce_customers_filter_by_status() {
8
+
9
+ $woo_cd_url = '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 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
+ ?>
includes/admin/order.php ADDED
@@ -0,0 +1,663 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for Filter Orders by Order Date widget on Store Exporter screen
7
+ function woo_ce_orders_filter_by_date() {
8
+
9
+ $woo_cd_url = '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 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 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 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 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 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 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 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 Filter Orders by Shipping 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 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 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 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 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 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 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 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 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( woo_ce_detect_product_brands() == false )
542
+ return;
543
+
544
+ $args = array(
545
+ 'hide_empty' => 1
546
+ );
547
+ $product_brands = woo_ce_get_product_brands( $args );
548
+
549
+ ob_start(); ?>
550
+ <p><label><input type="checkbox" id="orders-filters-brand" /> <?php _e( 'Filter Orders by Product Brand', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
551
+ <div id="export-orders-filters-brand" class="separator">
552
+ <ul>
553
+ <li>
554
+ <?php if( !empty( $product_brands ) ) { ?>
555
+ <select data-placeholder="<?php _e( 'Choose a Product Category...', 'woocommerce-exporter' ); ?>" name="order_filter_brand[]" multiple class="chzn-select" style="width:95%;">
556
+ <?php foreach( $product_brands as $product_brand ) { ?>
557
+ <option value="<?php echo $product_brand->term_id; ?>"><?php echo woo_ce_format_product_category_label( $product_brand->name, $product_brand->parent_name ); ?> (<?php printf( __( 'Term ID: %d', 'woocommerce-exporter' ), $product_brand->term_id ); ?>)</option>
558
+ <?php } ?>
559
+ </select>
560
+ <?php } else { ?>
561
+ <?php _e( 'No Product Brands were found.', 'woocommerce-exporter' ); ?>
562
+ <?php } ?>
563
+ </li>
564
+ </ul>
565
+ <p class="description"><?php _e( 'Select the Product Brands you want to filter exported Orders by. Default is to include all Product Brands.', 'woocommerce-exporter' ); ?></p>
566
+ </div>
567
+ <!-- #export-orders-filters-brand -->
568
+ <?php
569
+ ob_end_flush();
570
+
571
+ }
572
+
573
+ // HTML template for Order Sorting widget on Store Exporter screen
574
+ function woo_ce_order_sorting() {
575
+
576
+ ob_start(); ?>
577
+ <p><label><?php _e( 'Order Sorting', 'woocommerce-exporter' ); ?></label></p>
578
+ <div>
579
+ <select name="order_orderby" disabled="disabled">
580
+ <option value="ID"><?php _e( 'Order ID', 'woocommerce-exporter' ); ?></option>
581
+ <option value="title"><?php _e( 'Order Name', 'woocommerce-exporter' ); ?></option>
582
+ <option value="date"><?php _e( 'Date Created', 'woocommerce-exporter' ); ?></option>
583
+ <option value="modified"><?php _e( 'Date Modified', 'woocommerce-exporter' ); ?></option>
584
+ <option value="rand"><?php _e( 'Random', 'woocommerce-exporter' ); ?></option>
585
+ </select>
586
+ <select name="order_order" disabled="disabled">
587
+ <option value="ASC"><?php _e( 'Ascending', 'woocommerce-exporter' ); ?></option>
588
+ <option value="DESC"><?php _e( 'Descending', 'woocommerce-exporter' ); ?></option>
589
+ </select>
590
+ <p class="description"><?php _e( 'Select the sorting of Orders within the exported file. By default this is set to export Orders by Order ID in Desending order.', 'woocommerce-exporter' ); ?></p>
591
+ </div>
592
+ <?php
593
+ ob_end_flush();
594
+
595
+ }
596
+
597
+ // HTML template for Custom Orders widget on Store Exporter screen
598
+ function woo_ce_orders_custom_fields() {
599
+
600
+ $woo_cd_url = '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
+ ?>
includes/admin/product.php ADDED
@@ -0,0 +1,390 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for Filter Products by Product Category widget on Store Exporter screen
7
+ function woo_ce_products_filter_by_product_category() {
8
+
9
+ $args = array(
10
+ 'hide_empty' => 1
11
+ );
12
+ $product_categories = woo_ce_get_product_categories( $args );
13
+
14
+ ob_start(); ?>
15
+ <p><label><input type="checkbox" id="products-filters-categories" /> <?php _e( 'Filter Products by Product Category', 'woocommerce-exporter' ); ?></label></p>
16
+ <div id="export-products-filters-categories" class="separator">
17
+ <ul>
18
+ <li>
19
+ <?php if( !empty( $product_categories ) ) { ?>
20
+ <select data-placeholder="<?php _e( 'Choose a Product Category...', 'woocommerce-exporter' ); ?>" name="product_filter_category[]" multiple class="chzn-select" style="width:95%;">
21
+ <?php foreach( $product_categories as $product_category ) { ?>
22
+ <option value="<?php echo $product_category->term_id; ?>"<?php disabled( $product_category->count, 0 ); ?>><?php echo woo_ce_format_product_category_label( $product_category->name, $product_category->parent_name ); ?> (<?php printf( __( 'Term ID: %d', 'woocommerce-exporter' ), $product_category->term_id ); ?>)</option>
23
+ <?php } ?>
24
+ </select>
25
+ <?php } else { ?>
26
+ <?php _e( 'No Product Categories were found.', 'woocommerce-exporter' ); ?></li>
27
+ <?php } ?>
28
+ </li>
29
+ </ul>
30
+ <p class="description"><?php _e( 'Select the Product Categories you want to filter exported Products by. Product Categories not assigned to Products are hidden from view. Default is to include all Product Categories.', 'woocommerce-exporter' ); ?></p>
31
+ </div>
32
+ <!-- #export-products-filters-categories -->
33
+ <?php
34
+ ob_end_flush();
35
+
36
+ }
37
+
38
+ // HTML template for Filter Products by Product Tag widget on Store Exporter screen
39
+ function woo_ce_products_filter_by_product_tag() {
40
+
41
+ $args = array(
42
+ 'hide_empty' => 1
43
+ );
44
+ $product_tags = woo_ce_get_product_tags( $args );
45
+
46
+ ob_start(); ?>
47
+ <p><label><input type="checkbox" id="products-filters-tags" /> <?php _e( 'Filter Products by Product Tag', 'woocommerce-exporter' ); ?></label></p>
48
+ <div id="export-products-filters-tags" class="separator">
49
+ <ul>
50
+ <li>
51
+ <?php if( !empty( $product_tags ) ) { ?>
52
+ <select data-placeholder="<?php _e( 'Choose a Product Tag...', 'woocommerce-exporter' ); ?>" name="product_filter_tag[]" multiple class="chzn-select" style="width:95%;">
53
+ <?php foreach( $product_tags as $product_tag ) { ?>
54
+ <option value="<?php echo $product_tag->term_id; ?>"<?php disabled( $product_tag->count, 0 ); ?>><?php echo $product_tag->name; ?> (<?php printf( __( 'Term ID: %d', 'woocommerce-exporter' ), $product_tag->term_id ); ?>)</option>
55
+ <?php } ?>
56
+ </select>
57
+ <?php } else { ?>
58
+ <?php _e( 'No Product Tags were found.', 'woocommerce-exporter' ); ?></li>
59
+ <?php } ?>
60
+ </li>
61
+ </ul>
62
+ <p class="description"><?php _e( 'Select the Product Tags you want to filter exported Products by. Product Tags not assigned to Products are hidden from view. Default is to include all Product Tags.', 'woocommerce-exporter' ); ?></p>
63
+ </div>
64
+ <!-- #export-products-filters-tags -->
65
+ <?php
66
+ ob_end_flush();
67
+
68
+ }
69
+
70
+ // HTML template for Filter Products by Product Brand widget on Store Exporter screen
71
+ function woo_ce_products_filter_by_product_brand() {
72
+
73
+ // Check if Brands is available
74
+ if( woo_ce_detect_product_brands() == false )
75
+ return;
76
+
77
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
78
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
79
+
80
+ $args = array(
81
+ 'hide_empty' => 1,
82
+ 'orderby' => 'term_group'
83
+ );
84
+ $product_brands = woo_ce_get_product_brands( $args );
85
+
86
+ ob_start(); ?>
87
+ <p><label><input type="checkbox" id="products-filters-brands" /> <?php _e( 'Filter Products by Product Brands', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
88
+ <div id="export-products-filters-brands" class="separator">
89
+ <ul>
90
+ <li>
91
+ <?php if( !empty( $product_brands ) ) { ?>
92
+ <select data-placeholder="<?php _e( 'Choose a Product Brand...', 'woocommerce-exporter' ); ?>" name="product_filter_brand[]" multiple class="chzn-select" style="width:95%;">
93
+ <?php foreach( $product_brands as $product_brand ) { ?>
94
+ <option value="<?php echo $product_brand->term_id; ?>"<?php disabled( $product_brand->count, 0 ); ?>><?php echo woo_ce_format_product_category_label( $product_brand->name, $product_brand->parent_name ); ?> (<?php printf( __( 'Term ID: %d', 'woocommerce-exporter' ), $product_brand->term_id ); ?>)</option>
95
+ <?php } ?>
96
+ </select>
97
+ <?php } else { ?>
98
+ <?php _e( 'No Product Brands were found.', 'woocommerce-exporter' ); ?>
99
+ <?php } ?>
100
+ </li>
101
+ </ul>
102
+ <p class="description"><?php _e( 'Select the Product Brands you want to filter exported Products by. Default is to include all Product Brands.', 'woocommerce-exporter' ); ?></p>
103
+ </div>
104
+ <!-- #export-products-filters-brands -->
105
+ <?php
106
+ ob_end_flush();
107
+
108
+ }
109
+
110
+ // HTML template for Filter Products by Product Vendor widget on Store Exporter screen
111
+ function woo_ce_products_filter_by_product_vendor() {
112
+
113
+ if( class_exists( 'WooCommerce_Product_Vendors' ) == false )
114
+ return;
115
+
116
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
117
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
118
+
119
+ $args = array(
120
+ 'hide_empty' => 1
121
+ );
122
+ $product_vendors = woo_ce_get_product_vendors( $args, 'full' );
123
+
124
+ ob_start(); ?>
125
+ <p><label><input type="checkbox" id="products-filters-vendors" /> <?php _e( 'Filter Products by Product Vendors', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
126
+ <div id="export-products-filters-vendors" class="separator">
127
+ <?php if( $product_vendors ) { ?>
128
+ <ul>
129
+ <?php foreach( $product_vendors as $product_vendor ) { ?>
130
+ <li>
131
+ <label><input type="checkbox" name="product_filter_vendor[<?php echo $product_vendor->term_id; ?>]" value="<?php echo $product_vendor->term_id; ?>" title="<?php printf( __( 'Term ID: %d', 'woocommerce-exporter' ), $product_vendor->term_id ); ?>"<?php disabled( $product_vendor->count, 0 ); ?> disabled="disabled" /> <?php echo $product_vendor->name; ?></label>
132
+ <span class="description">(<?php echo $product_vendor->count; ?>)</span>
133
+ </li>
134
+ <?php } ?>
135
+ </ul>
136
+ <p class="description"><?php _e( 'Select the Product Vendors you want to filter exported Products by. Default is to include all Product Vendors.', 'woocommerce-exporter' ); ?></p>
137
+ <?php } else { ?>
138
+ <p><?php _e( 'No Product Vendors were found.', 'woocommerce-exporter' ); ?></p>
139
+ <?php } ?>
140
+ </div>
141
+ <!-- #export-products-filters-vendors -->
142
+ <?php
143
+ ob_end_flush();
144
+
145
+ }
146
+
147
+ // HTML template for Filter Products by Product Status widget on Store Exporter screen
148
+ function woo_ce_products_filter_by_product_status() {
149
+
150
+ $product_statuses = get_post_statuses();
151
+ if( !isset( $product_statuses['trash'] ) )
152
+ $product_statuses['trash'] = __( 'Trash', 'woocommerce-exporter' );
153
+
154
+ ob_start(); ?>
155
+ <p><label><input type="checkbox" id="products-filters-status" /> <?php _e( 'Filter Products by Product Status', 'woocommerce-exporter' ); ?></label></p>
156
+ <div id="export-products-filters-status" class="separator">
157
+ <ul>
158
+ <li>
159
+ <?php if( !empty( $product_statuses ) ) { ?>
160
+ <select data-placeholder="<?php _e( 'Choose a Product Status...', 'woocommerce-exporter' ); ?>" name="product_filter_status[]" multiple class="chzn-select" style="width:95%;">
161
+ <?php foreach( $product_statuses as $key => $product_status ) { ?>
162
+ <option value="<?php echo $key; ?>"><?php echo $product_status; ?></option>
163
+ <?php } ?>
164
+ </select>
165
+ <?php } else { ?>
166
+ <?php _e( 'No Product Status were found.', 'woocommerce-exporter' ); ?></li>
167
+ <?php } ?>
168
+ </li>
169
+ </ul>
170
+ <p class="description"><?php _e( 'Select the Product Status options you want to filter exported Products by. Default is to include all Product Status options.', 'woocommerce-exporter' ); ?></p>
171
+ </div>
172
+ <!-- #export-products-filters-status -->
173
+ <?php
174
+ ob_end_flush();
175
+
176
+ }
177
+
178
+ // HTML template for Filter Products by Product Type widget on Store Exporter screen
179
+ function woo_ce_products_filter_by_product_type() {
180
+
181
+ $product_types = woo_ce_get_product_types();
182
+
183
+ ob_start(); ?>
184
+ <p><label><input type="checkbox" id="products-filters-type" /> <?php _e( 'Filter Products by Product Type', 'woocommerce-exporter' ); ?></label></p>
185
+ <div id="export-products-filters-type" class="separator">
186
+ <ul>
187
+ <li>
188
+ <?php if( !empty( $product_types ) ) { ?>
189
+ <select data-placeholder="<?php _e( 'Choose a Product Type...', 'woocommerce-exporter' ); ?>" name="product_filter_type[]" multiple class="chzn-select" style="width:95%;">
190
+ <?php foreach( $product_types as $key => $product_type ) { ?>
191
+ <option value="<?php echo $key; ?>"><?php echo woo_ce_format_product_type( $product_type['name'] ); ?> (<?php echo $product_type['count']; ?>)</option>
192
+ <?php } ?>
193
+ </select>
194
+ <?php } else { ?>
195
+ <?php _e( 'No Product Types were found.', 'woocommerce-exporter' ); ?></li>
196
+ <?php } ?>
197
+ </li>
198
+ </ul>
199
+ <p class="description"><?php _e( 'Select the Product Type\'s you want to filter exported Products by. Default is to include all Product Types and Variations.', 'woocommerce-exporter' ); ?></p>
200
+ </div>
201
+ <!-- #export-products-filters-type -->
202
+ <?php
203
+ ob_end_flush();
204
+
205
+ }
206
+
207
+ // HTML template for Filter Products by Product Type widget on Store Exporter screen
208
+ function woo_ce_products_filter_by_stock_status() {
209
+
210
+ // Store Exporter Deluxe
211
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
212
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
213
+
214
+ ob_start(); ?>
215
+ <p><label><input type="checkbox" id="products-filters-stock" /> <?php _e( 'Filter Products by Stock Status', 'woocommerce-exporter' ); ?></label></p>
216
+ <div id="export-products-filters-stock" class="separator">
217
+ <ul>
218
+ <li value=""><label><input type="radio" name="product_filter_stock" value="" checked="checked" /><?php _e( 'Include both', 'woocommerce-exporter' ); ?></label></li>
219
+ <li value="instock"><label><input type="radio" name="product_filter_stock" value="instock" disabled="disabled" /><?php _e( 'In stock', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
220
+ <li value="outofstock"><label><input type="radio" name="product_filter_stock" value="outofstock" disabled="disabled" /><?php _e( 'Out of stock', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
221
+ </ul>
222
+ <p class="description"><?php _e( 'Select the Stock Status\'s you want to filter exported Products by. Default is to include all Stock Status\'s.', 'woocommerce-exporter' ); ?></p>
223
+ </div>
224
+ <!-- #export-products-filters-stock -->
225
+ <?php
226
+ ob_end_flush();
227
+
228
+ }
229
+
230
+ // HTML template for Product Sorting widget on Store Exporter screen
231
+ function woo_ce_product_sorting() {
232
+
233
+ $product_orderby = woo_ce_get_option( 'product_orderby', 'ID' );
234
+ $product_order = woo_ce_get_option( 'product_order', 'DESC' );
235
+
236
+ ob_start(); ?>
237
+ <p><label><?php _e( 'Product Sorting', 'woocommerce-exporter' ); ?></label></p>
238
+ <div>
239
+ <select name="product_orderby">
240
+ <option value="ID"<?php selected( 'ID', $product_orderby ); ?>><?php _e( 'Product ID', 'woocommerce-exporter' ); ?></option>
241
+ <option value="title"<?php selected( 'title', $product_orderby ); ?>><?php _e( 'Product Name', 'woocommerce-exporter' ); ?></option>
242
+ <option value="sku"<?php selected( 'sku', $product_orderby ); ?>><?php _e( 'Product SKU', 'woocommerce-exporter' ); ?></option>
243
+ <option value="date"<?php selected( 'date', $product_orderby ); ?>><?php _e( 'Date Created', 'woocommerce-exporter' ); ?></option>
244
+ <option value="modified"<?php selected( 'modified', $product_orderby ); ?>><?php _e( 'Date Modified', 'woocommerce-exporter' ); ?></option>
245
+ <option value="rand"<?php selected( 'rand', $product_orderby ); ?>><?php _e( 'Random', 'woocommerce-exporter' ); ?></option>
246
+ <option value="menu_order"<?php selected( 'menu_order', $product_orderby ); ?>><?php _e( 'Sort Order', 'woocommerce-exporter' ); ?></option>
247
+ </select>
248
+ <select name="product_order">
249
+ <option value="ASC"<?php selected( 'ASC', $product_order ); ?>><?php _e( 'Ascending', 'woocommerce-exporter' ); ?></option>
250
+ <option value="DESC"<?php selected( 'DESC', $product_order ); ?>><?php _e( 'Descending', 'woocommerce-exporter' ); ?></option>
251
+ </select>
252
+ <p class="description"><?php _e( 'Select the sorting of Products within the exported file. By default this is set to export Products by Product ID in Desending order.', 'woocommerce-exporter' ); ?></p>
253
+ </div>
254
+ <?php
255
+ ob_end_flush();
256
+
257
+ }
258
+
259
+ // HTML template for Up-sells formatting on Store Exporter screen
260
+ function woo_ce_products_upsells_formatting() {
261
+
262
+ $upsell_formatting = woo_ce_get_option( 'upsell_formatting', 1 );
263
+
264
+ ob_start(); ?>
265
+ <tr class="export-options product-options">
266
+ <th><label for=""><?php _e( 'Up-sells formatting', 'woocommerce-exporter' ); ?></label></th>
267
+ <td>
268
+ <label><input type="radio" name="product_upsell_formatting" value="0"<?php checked( $upsell_formatting, 0 ); ?> />&nbsp;<?php _e( 'Export Up-Sells as Product ID', 'woocommerce-exporter' ); ?></label><br />
269
+ <label><input type="radio" name="product_upsell_formatting" value="1"<?php checked( $upsell_formatting, 1 ); ?> />&nbsp;<?php _e( 'Export Up-Sells as Product SKU', 'woocommerce-exporter' ); ?></label>
270
+ <p class="description"><?php _e( 'Choose the up-sell formatting that is accepted by your WooCommerce import Plugin (e.g. Product Importer Deluxe, Product Import Suite, etc.).', 'woocommerce-exporter' ); ?></p>
271
+ </td>
272
+ </tr>
273
+
274
+ <?php
275
+ ob_end_flush();
276
+
277
+ }
278
+
279
+ // HTML template for Cross-sells formatting on Store Exporter screen
280
+ function woo_ce_products_crosssells_formatting() {
281
+
282
+ $crosssell_formatting = woo_ce_get_option( 'crosssell_formatting', 1 );
283
+
284
+ ob_start(); ?>
285
+ <tr class="export-options product-options">
286
+ <th><label for=""><?php _e( 'Cross-sells formatting', 'woocommerce-exporter' ); ?></label></th>
287
+ <td>
288
+ <label><input type="radio" name="product_crosssell_formatting" value="0"<?php checked( $crosssell_formatting, 0 ); ?> />&nbsp;<?php _e( 'Export Cross-Sells as Product ID', 'woocommerce-exporter' ); ?></label><br />
289
+ <label><input type="radio" name="product_crosssell_formatting" value="1"<?php checked( $crosssell_formatting, 1 ); ?> />&nbsp;<?php _e( 'Export Cross-Sells as Product SKU', 'woocommerce-exporter' ); ?></label>
290
+ <p class="description"><?php _e( 'Choose the cross-sell formatting that is accepted by your WooCommerce import Plugin (e.g. Product Importer Deluxe, Product Import Suite, etc.).', 'woocommerce-exporter' ); ?></p>
291
+ </td>
292
+ </tr>
293
+
294
+ <?php
295
+ ob_end_flush();
296
+
297
+ }
298
+
299
+ // HTML template for Custom Products widget on Store Exporter screen
300
+ function woo_ce_products_custom_fields() {
301
+
302
+ // Store Exporter Deluxe
303
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
304
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
305
+
306
+ if( $custom_products = woo_ce_get_option( 'custom_products', '' ) )
307
+ $custom_products = implode( "\n", $custom_products );
308
+ $custom_attributes = '';
309
+
310
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/';
311
+
312
+ ob_start(); ?>
313
+ <form method="post" id="export-products-custom-fields" class="export-options product-options">
314
+ <div id="poststuff">
315
+
316
+ <div class="postbox" id="export-options product-options">
317
+ <h3 class="hndle"><?php _e( 'Custom Product Fields', 'woocommerce-exporter' ); ?></h3>
318
+ <div class="inside">
319
+ <p class="description"><?php _e( 'To include additional custom Product meta or custom Attributes in the Export Products table above fill the meta text box then click Save Custom Fields.', 'woocommerce-exporter' ); ?></p>
320
+ <table class="form-table">
321
+
322
+ <tr>
323
+ <th>
324
+ <label><?php _e( 'Product meta', 'woocommerce-exporter' ); ?></label>
325
+ </th>
326
+ <td>
327
+ <textarea name="custom_products" rows="5" cols="70"><?php echo esc_textarea( $custom_products ); ?></textarea>
328
+ <p class="description"><?php _e( 'Include additional custom Product meta in your export file by adding each custom Product meta name to a new line above.<br />For example: <code>Customer UA</code> (new line) <code>Customer IP Address</code>', 'woocommerce-exporter' ); ?></p>
329
+ </td>
330
+ </tr>
331
+
332
+ <tr>
333
+ <th>
334
+ <label><?php _e( 'Custom attribute', 'woocommerce-exporter' ); ?></label>
335
+ </th>
336
+ <td>
337
+ <textarea name="custom_attributes" rows="5" cols="70" disabled="disabled"><?php echo esc_textarea( $custom_attributes ); ?></textarea><br /><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
338
+ <p class="description"><?php _e( 'Include custom Attributes in your export file by adding each custom Attribute name to a new line above.<br />For example: <code>condition</code> (new line) <code>colour</code>', 'woocommerce-exporter' ); ?></p>
339
+ </td>
340
+ </tr>
341
+
342
+ <?php do_action( 'woo_ce_products_custom_fields' ); ?>
343
+
344
+ </table>
345
+ <p class="submit">
346
+ <input type="submit" value="<?php _e( 'Save Custom Fields', 'woocommerce-exporter' ); ?>" class="button" />
347
+ </p>
348
+ <p class="description"><?php printf( __( 'For more information on custom Product meta and Attributes consult our <a href="%s" target="_blank">online documentation</a>.', 'woocommerce-exporter' ), $troubleshooting_url ); ?></p>
349
+ </div>
350
+ <!-- .inside -->
351
+ </div>
352
+ <!-- .postbox -->
353
+
354
+ </div>
355
+ <!-- #poststuff -->
356
+ <input type="hidden" name="action" value="update" />
357
+ </form>
358
+ <!-- #export-products-custom-fields -->
359
+ <?php
360
+ ob_end_flush();
361
+
362
+ }
363
+
364
+ function woo_ce_export_options_gallery_format() {
365
+
366
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
367
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
368
+
369
+ ob_start(); ?>
370
+ <tr class="export-options product-options">
371
+ <th><label for=""><?php _e( 'Product gallery formatting', 'woocommerce-exporter' ); ?></label></th>
372
+ <td>
373
+ <label><input type="radio" name="product_gallery_formatting" value="0"<?php checked( 0, 0 ); ?> />&nbsp;<?php _e( 'Export Product Gallery as Attachment ID', 'woocommerce-exporter' ); ?></label><br />
374
+ <label><input type="radio" name="product_gallery_formatting" value="1" disabled="disabled" />&nbsp;<?php _e( 'Export Product Gallery as Image URL', 'woocommerce-exporter' ); ?> <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label><br />
375
+ <label><input type="radio" name="product_gallery_formatting" value="2" disabled="disabled" />&nbsp;<?php _e( 'Export Product Gallery as Image filepath', 'woocommerce-exporter' ); ?> <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label>
376
+ <hr />
377
+ <label><input type="radio" name="product_gallery_unique" value="0"<?php checked( 0, 0 ); ?> />&nbsp;<?php _e( 'Export Product Gallery as a single combined image cell', 'woocommerce-exporter' ); ?></label><br />
378
+ <label><input type="radio" name="product_gallery_unique" value="1" disabled="disabled" />&nbsp;<?php _e( 'Export Product Gallery as individual image cells', 'woocommerce-exporter' ); ?> <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label>
379
+ <p class="description"><?php _e( 'Choose the product gallery formatting that is accepted by your WooCommerce import Plugin (e.g. Product Importer Deluxe, Product Import Suite, etc.).', 'woocommerce-exporter' ); ?></p>
380
+ </td>
381
+ </tr>
382
+ <?php
383
+ ob_end_flush();
384
+
385
+ }
386
+
387
+ /* End of: WordPress Administration */
388
+
389
+ }
390
+ ?>
includes/admin/shipping_class.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for disabled Shipping Class Sorting widget on Store Exporter screen
7
+ function woo_ce_shipping_class_sorting() {
8
+
9
+ $shipping_class_orderby = 'ID';
10
+ $shipping_class_order = 'DESC';
11
+
12
+ ob_start(); ?>
13
+ <p><label><?php _e( 'Shipping Class Sorting', 'woo_ce' ); ?></label></p>
14
+ <div>
15
+ <select name="shipping_class_orderby" disabled="disabled">
16
+ <option value="id"<?php selected( 'id', $shipping_class_orderby ); ?>><?php _e( 'Term ID', 'woo_ce' ); ?></option>
17
+ <option value="name"<?php selected( 'name', $shipping_class_orderby ); ?>><?php _e( 'Shipping Class Name', 'woo_ce' ); ?></option>
18
+ </select>
19
+ <select name="shipping_class_order" disabled="disabled">
20
+ <option value="ASC"<?php selected( 'ASC', $shipping_class_order ); ?>><?php _e( 'Ascending', 'woo_ce' ); ?></option>
21
+ <option value="DESC"<?php selected( 'DESC', $shipping_class_order ); ?>><?php _e( 'Descending', 'woo_ce' ); ?></option>
22
+ </select>
23
+ <p class="description"><?php _e( 'Select the sorting of Shipping Classes within the exported file. By default this is set to export Shipping Classes by Term ID in Desending order.', 'woo_ce' ); ?></p>
24
+ </div>
25
+ <?php
26
+ ob_end_flush();
27
+
28
+ }
29
+
30
+ /* End of: WordPress Administration */
31
+
32
+ }
33
+ ?>
includes/admin/subscription.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for Filter Subscriptions by Subscription Status widget on Store Exporter screen
7
+ function woo_ce_subscriptions_filter_by_subscription_status() {
8
+
9
+ $woo_cd_url = '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 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
+ /* End of: WordPress Administration */
71
+
72
+ }
73
+ ?>
includes/admin/tag.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for Tag Sorting widget on Store Exporter screen
7
+ function woo_ce_tag_sorting() {
8
+
9
+ $tag_orderby = woo_ce_get_option( 'tag_orderby', 'ID' );
10
+ $tag_order = woo_ce_get_option( 'tag_order', 'DESC' );
11
+
12
+ ob_start(); ?>
13
+ <p><label><?php _e( 'Product Tag Sorting', 'woocommerce-exporter' ); ?></label></p>
14
+ <div>
15
+ <select name="tag_orderby">
16
+ <option value="id"<?php selected( 'id', $tag_orderby ); ?>><?php _e( 'Term ID', 'woocommerce-exporter' ); ?></option>
17
+ <option value="name"<?php selected( 'name', $tag_orderby ); ?>><?php _e( 'Tag Name', 'woocommerce-exporter' ); ?></option>
18
+ </select>
19
+ <select name="tag_order">
20
+ <option value="ASC"<?php selected( 'ASC', $tag_order ); ?>><?php _e( 'Ascending', 'woocommerce-exporter' ); ?></option>
21
+ <option value="DESC"<?php selected( 'DESC', $tag_order ); ?>><?php _e( 'Descending', 'woocommerce-exporter' ); ?></option>
22
+ </select>
23
+ <p class="description"><?php _e( 'Select the sorting of Product Tags within the exported file. By default this is set to export Product Tags by Term ID in Desending order.', 'woocommerce-exporter' ); ?></p>
24
+ </div>
25
+ <?php
26
+ ob_end_flush();
27
+
28
+ }
29
+
30
+ /* End of: WordPress Administration */
31
+
32
+ }
33
+ ?>
includes/admin/user.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // HTML template for User Sorting widget on Store Exporter screen
7
+ function woo_ce_user_sorting() {
8
+
9
+ $orderby = woo_ce_get_option( 'user_orderby', 'ID' );
10
+ $order = woo_ce_get_option( 'user_order', 'ASC' );
11
+
12
+ ob_start(); ?>
13
+ <p><label><?php _e( 'User Sorting', 'woocommerce-exporter' ); ?></label></p>
14
+ <div>
15
+ <select name="user_orderby">
16
+ <option value="ID"<?php selected( 'ID', $orderby ); ?>><?php _e( 'User ID', 'woocommerce-exporter' ); ?></option>
17
+ <option value="display_name"<?php selected( 'display_name', $orderby ); ?>><?php _e( 'Display Name', 'woocommerce-exporter' ); ?></option>
18
+ <option value="user_name"<?php selected( 'user_name', $orderby ); ?>><?php _e( 'Name', 'woocommerce-exporter' ); ?></option>
19
+ <option value="user_login"<?php selected( 'user_login', $orderby ); ?>><?php _e( 'Username', 'woocommerce-exporter' ); ?></option>
20
+ <option value="nicename"<?php selected( 'nicename', $orderby ); ?>><?php _e( 'Nickname', 'woocommerce-exporter' ); ?></option>
21
+ <option value="email"<?php selected( 'email', $orderby ); ?>><?php _e( 'E-mail', 'woocommerce-exporter' ); ?></option>
22
+ <option value="url"<?php selected( 'url', $orderby ); ?>><?php _e( 'Website', 'woocommerce-exporter' ); ?></option>
23
+ <option value="registered"<?php selected( 'registered', $orderby ); ?>><?php _e( 'Date Registered', 'woocommerce-exporter' ); ?></option>
24
+ <option value="rand"<?php selected( 'rand', $orderby ); ?>><?php _e( 'Random', 'woocommerce-exporter' ); ?></option>
25
+ </select>
26
+ <select name="user_order">
27
+ <option value="ASC"<?php selected( 'ASC', $order ); ?>><?php _e( 'Ascending', 'woocommerce-exporter' ); ?></option>
28
+ <option value="DESC"<?php selected( 'DESC', $order ); ?>><?php _e( 'Descending', 'woocommerce-exporter' ); ?></option>
29
+ </select>
30
+ <p class="description"><?php _e( 'Select the sorting of Users within the exported file. By default this is set to export User by User ID in Desending order.', 'woocommerce-exporter' ); ?></p>
31
+ </div>
32
+ <?php
33
+ ob_end_flush();
34
+
35
+ }
36
+
37
+ // HTML template for disabled Custom Users widget on Store Exporter screen
38
+ function woo_ce_users_custom_fields() {
39
+
40
+ $woo_cd_url = '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
+ <p class="description"><?php printf( __( 'For more information on exporting custom User meta consult our <a href="%s" target="_blank">online documentation</a>.', 'woocommerce-exporter' ), $troubleshooting_url ); ?></p>
56
+ <table class="form-table">
57
+
58
+ <tr>
59
+ <th>
60
+ <label><?php _e( 'User meta', 'woocommerce-exporter' ); ?></label>
61
+ </th>
62
+ <td>
63
+ <textarea name="custom_users" rows="5" cols="70"><?php echo esc_textarea( $custom_users ); ?></textarea>
64
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
65
+ <p class="description"><?php _e( 'Include additional custom User meta in your export file by adding each custom User meta name to a new line above.<br />For example: <code>Customer UA, Customer IP Address</code>', 'woocommerce-exporter' ); ?></p>
66
+ </td>
67
+ </tr>
68
+
69
+ </table>
70
+ <p class="submit">
71
+ <input type="button" class="button button-disabled" value="<?php _e( 'Save Custom Fields', 'woocommerce-exporter' ); ?>" />
72
+ </p>
73
+ </div>
74
+ <!-- .inside -->
75
+ </div>
76
+ <!-- .postbox -->
77
+
78
+ </div>
79
+ <!-- #poststuff -->
80
+ <input type="hidden" name="action" value="update" />
81
+ </form>
82
+ <!-- #export-users-custom-fields -->
83
+ <?php
84
+ ob_end_flush();
85
+
86
+ }
87
+
88
+ /* End of: WordPress Administration */
89
+
90
+ }
91
+ ?>
includes/brand.php ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ if( !function_exists( 'woo_ce_get_export_type_brand_count' ) ) {
7
+ function woo_ce_get_export_type_brand_count( $count = 0, $export_type = '', $args ) {
8
+
9
+ if( $export_type <> 'brand' )
10
+ return $count;
11
+
12
+ $count = 0;
13
+ // Check if the existing Transient exists
14
+ $cached = get_transient( WOO_CE_PREFIX . '_brand_count' );
15
+ if( $cached == false ) {
16
+ $term_taxonomy = apply_filters( 'woo_ce_brand_term_taxonomy', 'product_brand' );
17
+ if( taxonomy_exists( $term_taxonomy ) )
18
+ $count = wp_count_terms( $term_taxonomy );
19
+ set_transient( WOO_CE_PREFIX . '_brand_count', $count, HOUR_IN_SECONDS );
20
+ } else {
21
+ $count = $cached;
22
+ }
23
+ return $count;
24
+
25
+ }
26
+ add_filter( 'woo_ce_get_export_type_count', 'woo_ce_get_export_type_brand_count', 10, 3 );
27
+ }
28
+
29
+ /* End of: WordPress Administration */
30
+
31
+ }
32
+
33
+ // Returns a list of Brand export columns
34
+ function woo_ce_get_brand_fields( $format = 'full' ) {
35
+
36
+ $export_type = 'brand';
37
+
38
+ $fields = array();
39
+ $fields[] = array(
40
+ 'name' => 'term_id',
41
+ 'label' => __( 'Term ID', 'woocommerce-exporter' )
42
+ );
43
+ $fields[] = array(
44
+ 'name' => 'name',
45
+ 'label' => __( 'Brand Name', 'woocommerce-exporter' )
46
+ );
47
+ $fields[] = array(
48
+ 'name' => 'slug',
49
+ 'label' => __( 'Brand Slug', 'woocommerce-exporter' )
50
+ );
51
+ $fields[] = array(
52
+ 'name' => 'parent_id',
53
+ 'label' => __( 'Parent Term ID', 'woocommerce-exporter' )
54
+ );
55
+ $fields[] = array(
56
+ 'name' => 'description',
57
+ 'label' => __( 'Brand Description', 'woocommerce-exporter' )
58
+ );
59
+ $fields[] = array(
60
+ 'name' => 'image',
61
+ 'label' => __( 'Brand Image', 'woocommerce-exporter' )
62
+ );
63
+
64
+ /*
65
+ $fields[] = array(
66
+ 'name' => '',
67
+ 'label' => __( '', 'woocommerce-exporter' )
68
+ );
69
+ */
70
+
71
+ // Drop in our content filters here
72
+ add_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
73
+
74
+ // Allow Plugin/Theme authors to add support for additional columns
75
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
76
+
77
+ // Remove our content filters here to play nice with other Plugins
78
+ remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
79
+
80
+ switch( $format ) {
81
+
82
+ case 'summary':
83
+ $output = array();
84
+ $size = count( $fields );
85
+ for( $i = 0; $i < $size; $i++ ) {
86
+ if( isset( $fields[$i] ) )
87
+ $output[$fields[$i]['name']] = 'on';
88
+ }
89
+ return $output;
90
+ break;
91
+
92
+ case 'full':
93
+ default:
94
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
95
+ $size = count( $fields );
96
+ for( $i = 0; $i < $size; $i++ ) {
97
+ $fields[$i]['reset'] = $i;
98
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
99
+ }
100
+ // Check if we are using PHP 5.3 and above
101
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
102
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
103
+ return $fields;
104
+ break;
105
+
106
+ }
107
+
108
+ }
109
+
110
+ function woo_ce_override_brand_field_labels( $fields = array() ) {
111
+
112
+ $labels = woo_ce_get_option( 'brand_labels', array() );
113
+ if( !empty( $labels ) ) {
114
+ foreach( $fields as $key => $field ) {
115
+ if( isset( $labels[$field['name']] ) )
116
+ $fields[$key]['label'] = $labels[$field['name']];
117
+ }
118
+ }
119
+ return $fields;
120
+
121
+ }
122
+ add_filter( 'woo_ce_brand_fields', 'woo_ce_override_brand_field_labels', 11 );
123
+
124
+ // Returns a list of WooCommerce Product Brands to export process
125
+ function woo_ce_get_product_brands( $args = array() ) {
126
+
127
+ $term_taxonomy = apply_filters( 'woo_ce_brand_term_taxonomy', 'product_brand' );
128
+ $defaults = array(
129
+ 'orderby' => 'name',
130
+ 'order' => 'ASC',
131
+ 'hide_empty' => 0
132
+ );
133
+ $args = wp_parse_args( $args, $defaults );
134
+ $brands = get_terms( $term_taxonomy, $args );
135
+ if( !empty( $brands ) && is_wp_error( $brands ) == false ) {
136
+ foreach( $brands as $key => $brand ) {
137
+ $brands[$key]->description = woo_ce_format_description_excerpt( $brand->description );
138
+ $brands[$key]->parent_name = '';
139
+ if( $brands[$key]->parent_id = $brand->parent ) {
140
+ if( $parent_brand = get_term( $brands[$key]->parent_id, $term_taxonomy ) ) {
141
+ $brands[$key]->parent_name = $parent_brand->name;
142
+ }
143
+ unset( $parent_brand );
144
+ } else {
145
+ $brands[$key]->parent_id = '';
146
+ }
147
+ $brands[$key]->image = ( function_exists( 'get_brand_thumbnail_url' ) ? get_brand_thumbnail_url( $brand->term_id ) : false );
148
+ }
149
+ return $brands;
150
+ }
151
+
152
+ }
153
+ ?>
includes/category.php ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ if( !function_exists( 'woo_ce_get_export_type_category_count' ) ) {
7
+ function woo_ce_get_export_type_category_count() {
8
+
9
+ $count = 0;
10
+ // Check if the existing Transient exists
11
+ $cached = get_transient( WOO_CE_PREFIX . '_category_count' );
12
+ if( $cached == false ) {
13
+ $term_taxonomy = 'product_cat';
14
+ if( taxonomy_exists( $term_taxonomy ) )
15
+ $count = wp_count_terms( $term_taxonomy );
16
+ set_transient( WOO_CE_PREFIX . '_category_count', $count, HOUR_IN_SECONDS );
17
+ } else {
18
+ $count = $cached;
19
+ }
20
+ return $count;
21
+
22
+ }
23
+ }
24
+
25
+ /* End of: WordPress Administration */
26
+
27
+ }
28
+
29
+ // Returns a list of Category export columns
30
+ function woo_ce_get_category_fields( $format = 'full' ) {
31
+
32
+ $export_type = 'category';
33
+
34
+ $fields = array();
35
+ $fields[] = array(
36
+ 'name' => 'term_id',
37
+ 'label' => __( 'Term ID', 'woocommerce-exporter' )
38
+ );
39
+ $fields[] = array(
40
+ 'name' => 'name',
41
+ 'label' => __( 'Category Name', 'woocommerce-exporter' )
42
+ );
43
+ $fields[] = array(
44
+ 'name' => 'slug',
45
+ 'label' => __( 'Category Slug', 'woocommerce-exporter' )
46
+ );
47
+ $fields[] = array(
48
+ 'name' => 'parent_id',
49
+ 'label' => __( 'Parent Term ID', 'woocommerce-exporter' )
50
+ );
51
+ $fields[] = array(
52
+ 'name' => 'description',
53
+ 'label' => __( 'Category Description', 'woocommerce-exporter' )
54
+ );
55
+ $fields[] = array(
56
+ 'name' => 'display_type',
57
+ 'label' => __( 'Display Type', 'woocommerce-exporter' )
58
+ );
59
+ $fields[] = array(
60
+ 'name' => 'image',
61
+ 'label' => __( 'Category Image', 'woocommerce-exporter' )
62
+ );
63
+
64
+ /*
65
+ $fields[] = array(
66
+ 'name' => '',
67
+ 'label' => __( '', 'woocommerce-exporter' )
68
+ );
69
+ */
70
+
71
+ // Drop in our content filters here
72
+ add_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
73
+
74
+ // Allow Plugin/Theme authors to add support for additional columns
75
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
76
+
77
+ // Remove our content filters here to play nice with other Plugins
78
+ remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
79
+
80
+ if( $remember = woo_ce_get_option( $export_type . '_fields', array() ) ) {
81
+ $remember = maybe_unserialize( $remember );
82
+ $size = count( $fields );
83
+ for( $i = 0; $i < $size; $i++ ) {
84
+ $fields[$i]['disabled'] = ( isset( $fields[$i]['disabled'] ) ? $fields[$i]['disabled'] : 0 );
85
+ $fields[$i]['default'] = 1;
86
+ if( !array_key_exists( $fields[$i]['name'], $remember ) )
87
+ $fields[$i]['default'] = 0;
88
+ }
89
+ }
90
+
91
+ switch( $format ) {
92
+
93
+ case 'summary':
94
+ $output = array();
95
+ $size = count( $fields );
96
+ for( $i = 0; $i < $size; $i++ ) {
97
+ if( isset( $fields[$i] ) )
98
+ $output[$fields[$i]['name']] = 'on';
99
+ }
100
+ return $output;
101
+ break;
102
+
103
+ case 'full':
104
+ default:
105
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
106
+ $size = count( $fields );
107
+ for( $i = 0; $i < $size; $i++ ) {
108
+ $fields[$i]['reset'] = $i;
109
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
110
+ }
111
+ // Check if we are using PHP 5.3 and above
112
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
113
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
114
+ return $fields;
115
+ break;
116
+
117
+ }
118
+
119
+ }
120
+
121
+ function woo_ce_override_category_field_labels( $fields = array() ) {
122
+
123
+ $labels = woo_ce_get_option( 'category_labels', array() );
124
+ if( !empty( $labels ) ) {
125
+ foreach( $fields as $key => $field ) {
126
+ if( isset( $labels[$field['name']] ) )
127
+ $fields[$key]['label'] = $labels[$field['name']];
128
+ }
129
+ }
130
+ return $fields;
131
+
132
+ }
133
+ add_filter( 'woo_ce_category_fields', 'woo_ce_override_category_field_labels', 11 );
134
+
135
+ // Returns the export column header label based on an export column slug
136
+ function woo_ce_get_category_field( $name = null, $format = 'name' ) {
137
+
138
+ $output = '';
139
+ if( $name ) {
140
+ $fields = woo_ce_get_category_fields();
141
+ $size = count( $fields );
142
+ for( $i = 0; $i < $size; $i++ ) {
143
+ if( $fields[$i]['name'] == $name ) {
144
+ switch( $format ) {
145
+
146
+ case 'name':
147
+ $output = $fields[$i]['label'];
148
+ break;
149
+
150
+ case 'full':
151
+ $output = $fields[$i];
152
+ break;
153
+
154
+ }
155
+ $i = $size;
156
+ }
157
+ }
158
+ }
159
+ return $output;
160
+
161
+ }
162
+
163
+ // Returns a list of WooCommerce Product Categories to export process
164
+ function woo_ce_get_product_categories( $args = array() ) {
165
+
166
+ $term_taxonomy = 'product_cat';
167
+ $defaults = array(
168
+ 'orderby' => 'name',
169
+ 'order' => 'ASC',
170
+ 'hide_empty' => 0
171
+ );
172
+ $args = wp_parse_args( $args, $defaults );
173
+ $categories = get_terms( $term_taxonomy, $args );
174
+ if( !empty( $categories ) && is_wp_error( $categories ) == false ) {
175
+ foreach( $categories as $key => $category ) {
176
+ $categories[$key]->description = woo_ce_format_description_excerpt( $category->description );
177
+ $categories[$key]->parent_name = '';
178
+ if( $categories[$key]->parent_id = $category->parent ) {
179
+ if( $parent_category = get_term( $categories[$key]->parent_id, $term_taxonomy ) ) {
180
+ $categories[$key]->parent_name = $parent_category->name;
181
+ }
182
+ unset( $parent_category );
183
+ } else {
184
+ $categories[$key]->parent_id = '';
185
+ }
186
+ $categories[$key]->image = woo_ce_get_category_thumbnail_url( $category->term_id );
187
+ $categories[$key]->display_type = get_woocommerce_term_meta( $category->term_id, 'display_type', true );
188
+ }
189
+ return $categories;
190
+ }
191
+
192
+ }
193
+
194
+ function woo_ce_get_category_thumbnail_url( $category_id = 0, $size = 'full' ) {
195
+
196
+ if ( $thumbnail_id = get_woocommerce_term_meta( $category_id, 'thumbnail_id', true ) ) {
197
+ $image_attributes = wp_get_attachment_image_src( $thumbnail_id, $size );
198
+ if( is_array( $image_attributes ) )
199
+ return current( $image_attributes );
200
+ }
201
+
202
+ }
203
+ ?>
includes/commission.php ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ if( !function_exists( 'woo_ce_get_export_type_commission_count' ) ) {
7
+ function woo_ce_get_export_type_commission_count( $count = 0, $export_type = '', $args ) {
8
+
9
+ if( $export_type <> 'commission' )
10
+ return $count;
11
+
12
+ $count = 0;
13
+ // Check if the existing Transient exists
14
+ $cached = get_transient( WOO_CE_PREFIX . '_commission_count' );
15
+ if( $cached == false ) {
16
+ $post_type = 'shop_commission';
17
+ if( post_type_exists( $post_type ) ) {
18
+ $count = wp_count_posts( $post_type );
19
+ } else if( class_exists( 'WC_Vendors' ) ) {
20
+ // Check for WC-Vendors
21
+ global $wpdb;
22
+ $count = $wpdb->get_var( 'SELECT COUNT(id) FROM `' . $wpdb->prefix . 'pv_commission`' );
23
+ }
24
+ set_transient( WOO_CE_PREFIX . '_commission_count', $count, HOUR_IN_SECONDS );
25
+ } else {
26
+ $count = $cached;
27
+ }
28
+ return $count;
29
+
30
+ }
31
+ add_filter( 'woo_ce_get_export_type_count', 'woo_ce_get_export_type_commission_count', 10, 3 );
32
+ }
33
+
34
+ // Returns date of first Commission received, any status
35
+ function woo_ce_get_commission_first_date() {
36
+
37
+ $output = date( 'd/m/Y', mktime( 0, 0, 0, date( 'n' ), 1 ) );
38
+ $post_type = 'shop_commission';
39
+ $args = array(
40
+ 'post_type' => $post_type,
41
+ 'orderby' => 'post_date',
42
+ 'order' => 'ASC',
43
+ 'numberposts' => 1
44
+ );
45
+ $commissions = get_posts( $args );
46
+ if( $commissions ) {
47
+ $commission = strtotime( $commissions[0]->post_date );
48
+ $output = date( 'd/m/Y', $commission );
49
+ unset( $commissions, $commission );
50
+ }
51
+ return $output;
52
+
53
+ }
54
+
55
+ // HTML template for disabled Commission Sorting widget on Store Exporter screen
56
+ function woo_ce_commission_sorting() {
57
+
58
+ ob_start(); ?>
59
+ <p><label><?php _e( 'Commission Sorting', 'woocommerce-exporter' ); ?></label></p>
60
+ <div>
61
+ <select name="commission_orderby" disabled="disabled">
62
+ <option value="ID"><?php _e( 'Commission ID', 'woocommerce-exporter' ); ?></option>
63
+ <option value="title"><?php _e( 'Commission Title', 'woocommerce-exporter' ); ?></option>
64
+ <option value="date"><?php _e( 'Date Created', 'woocommerce-exporter' ); ?></option>
65
+ <option value="modified"><?php _e( 'Date Modified', 'woocommerce-exporter' ); ?></option>
66
+ <option value="rand"><?php _e( 'Random', 'woocommerce-exporter' ); ?></option>
67
+ </select>
68
+ <select name="commission_order" disabled="disabled">
69
+ <option value="ASC"><?php _e( 'Ascending', 'woocommerce-exporter' ); ?></option>
70
+ <option value="DESC"><?php _e( 'Descending', 'woocommerce-exporter' ); ?></option>
71
+ </select>
72
+ <p class="description"><?php _e( 'Select the sorting of Commissions within the exported file. By default this is set to export Commissions by Commission ID in Desending order.', 'woocommerce-exporter' ); ?></p>
73
+ </div>
74
+ <?php
75
+ ob_end_flush();
76
+
77
+ }
78
+
79
+ // HTML template for disabled Filter Commissions by Product Vendor widget on Store Exporter screen
80
+ function woo_ce_commissions_filter_by_product_vendor() {
81
+
82
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
83
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
84
+
85
+ $product_vendors = woo_ce_get_product_vendors( array(), 'full' );
86
+
87
+ ob_start(); ?>
88
+ <p><label><input type="checkbox" id="commissions-filters-product_vendor" /> <?php _e( 'Filter Commissions by Product Vendors', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
89
+ <div id="export-commissions-filters-product_vendor" class="separator">
90
+ <?php if( $product_vendors ) { ?>
91
+ <ul>
92
+ <?php foreach( $product_vendors as $product_vendor ) { ?>
93
+ <li>
94
+ <label><input type="checkbox" name="commission_filter_product_vendor[<?php echo $product_vendor->term_id; ?>]" value="<?php echo $product_vendor->term_id; ?>" title="<?php printf( __( 'Term ID: %d', 'woocommerce-exporter' ), $product_vendor->term_id ); ?>"<?php disabled( $product_vendor->count, 0 ); ?> disabled="disabled" /> <?php echo $product_vendor->name; ?></label>
95
+ <span class="description">(<?php echo $product_vendor->count; ?>)</span>
96
+ </li>
97
+ <?php } ?>
98
+ </ul>
99
+ <p class="description"><?php _e( 'Select the Product Vendors you want to filter exported Commissions by. Default is to include all Product Vendors.', 'woocommerce-exporter' ); ?></p>
100
+ <?php } else { ?>
101
+ <p><?php _e( 'No Product Vendors were found.', 'woocommerce-exporter' ); ?></p>
102
+ <?php } ?>
103
+ </div>
104
+ <!-- #export-commissions-filters-product_vendor -->
105
+ <?php
106
+ ob_end_flush();
107
+
108
+ }
109
+
110
+ // HTML template for disabled Filter Commissions by Commission Status widget on Store Exporter screen
111
+ function woo_ce_commissions_filter_by_commission_status() {
112
+
113
+ $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
114
+ $woo_cd_link = sprintf( '<a href="%s" target="_blank">' . __( 'Store Exporter Deluxe', 'woocommerce-exporter' ) . '</a>', $woo_cd_url );
115
+
116
+ ob_start(); ?>
117
+ <p><label><input type="checkbox" id="commissions-filters-commission_status" /> <?php _e( 'Filter Commissions by Commission Status', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></p>
118
+ <div id="export-commissions-filters-commission_status" class="separator">
119
+ <ul>
120
+ <li>
121
+ <label><input type="checkbox" name="commission_filter_commission_status[]" value="unpaid"<?php disabled( woo_ce_commissions_stock_status_count( 'unpaid' ), 0 ); ?> disabled="disabled" /> <?php _e( 'Unpaid', 'woocommerce-exporter' ); ?></label>
122
+ <span class="description">(<?php echo woo_ce_commissions_stock_status_count( 'unpaid' ); ?>)</span>
123
+ </li>
124
+ <li>
125
+ <label><input type="checkbox" name="commission_filter_commission_status[]" value="paid"<?php disabled( woo_ce_commissions_stock_status_count( 'paid' ), 0 ); ?> disabled="disabled" /> <?php _e( 'Paid', 'woocommerce-exporter' ); ?></label>
126
+ <span class="description">(<?php echo woo_ce_commissions_stock_status_count( 'paid' ); ?>)</span>
127
+ </li>
128
+ </ul>
129
+ <p class="description"><?php _e( 'Select the Commission Status you want to filter exported Commissions by. Default is to include all Commission Statuses.', 'woocommerce-exporter' ); ?></p>
130
+ </div>
131
+ <!-- #export-commissions-filters-commission_status -->
132
+ <?php
133
+ ob_end_flush();
134
+
135
+ }
136
+
137
+ // HTML template for displaying the number of each export type filter on the Archives screen
138
+ function woo_ce_commissions_stock_status_count( $type = '' ) {
139
+
140
+ $output = 0;
141
+ $post_type = 'shop_commission';
142
+ $meta_key = '_paid_status';
143
+ $args = array(
144
+ 'post_type' => $post_type,
145
+ 'meta_key' => $meta_key,
146
+ 'meta_value' => null,
147
+ 'numberposts' => -1,
148
+ 'fields' => 'ids'
149
+ );
150
+ if( $type )
151
+ $args['meta_value'] = $type;
152
+ $commission_ids = new WP_Query( $args );
153
+ if( !empty( $commission_ids->posts ) )
154
+ $output = count( $commission_ids->posts );
155
+ return $output;
156
+
157
+ }
158
+
159
+ /* End of: WordPress Administration */
160
+
161
+ }
162
+
163
+ function woo_ce_get_commission_fields( $format = 'full' ) {
164
+
165
+ $export_type = 'commission';
166
+
167
+ $fields = array();
168
+ $fields[] = array(
169
+ 'name' => 'ID',
170
+ 'label' => __( 'Commission ID', 'woocommerce-exporter' )
171
+ );
172
+ $fields[] = array(
173
+ 'name' => 'post_date',
174
+ 'label' => __( 'Commission Date', 'woocommerce-exporter' )
175
+ );
176
+ $fields[] = array(
177
+ 'name' => 'title',
178
+ 'label' => __( 'Commission Title', 'woocommerce-exporter' )
179
+ );
180
+ $fields[] = array(
181
+ 'name' => 'product_id',
182
+ 'label' => __( 'Product ID', 'woocommerce-exporter' )
183
+ );
184
+ $fields[] = array(
185
+ 'name' => 'product_name',
186
+ 'label' => __( 'Product Name', 'woocommerce-exporter' )
187
+ );
188
+ $fields[] = array(
189
+ 'name' => 'product_sku',
190
+ 'label' => __( 'Product SKU', 'woocommerce-exporter' )
191
+ );
192
+ $fields[] = array(
193
+ 'name' => 'product_vendor_id',
194
+ 'label' => __( 'Product Vendor ID', 'woocommerce-exporter' )
195
+ );
196
+ $fields[] = array(
197
+ 'name' => 'product_vendor_name',
198
+ 'label' => __( 'Product Vendor Name', 'woocommerce-exporter' )
199
+ );
200
+ $fields[] = array(
201
+ 'name' => 'commission_amount',
202
+ 'label' => __( 'Commission Amount', 'woocommerce-exporter' )
203
+ );
204
+ $fields[] = array(
205
+ 'name' => 'paid_status',
206
+ 'label' => __( 'Commission Status', 'woocommerce-exporter' )
207
+ );
208
+ $fields[] = array(
209
+ 'name' => 'post_status',
210
+ 'label' => __( 'Post Status', 'woocommerce-exporter' )
211
+ );
212
+
213
+ /*
214
+ $fields[] = array(
215
+ 'name' => '',
216
+ 'label' => __( '', 'woocommerce-exporter' )
217
+ );
218
+ */
219
+
220
+ // Allow Plugin/Theme authors to add support for additional columns
221
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
222
+
223
+ switch( $format ) {
224
+
225
+ case 'summary':
226
+ $output = array();
227
+ $size = count( $fields );
228
+ for( $i = 0; $i < $size; $i++ ) {
229
+ if( isset( $fields[$i] ) )
230
+ $output[$fields[$i]['name']] = 'on';
231
+ }
232
+ return $output;
233
+ break;
234
+
235
+ case 'full':
236
+ default:
237
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
238
+ $size = count( $fields );
239
+ for( $i = 0; $i < $size; $i++ ) {
240
+ $fields[$i]['reset'] = $i;
241
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
242
+ }
243
+ // Check if we are using PHP 5.3 and above
244
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
245
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
246
+ return $fields;
247
+ break;
248
+
249
+ }
250
+
251
+ }
252
+ ?>
includes/common-dashboard_widgets.php 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/common.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * Filename: common.php
5
+ * Description: common.php loads commonly accessed functions across the Visser Labs suite.
6
+ *
7
+ * - woo_get_action
8
+ * - woo_is_wpsc_activated
9
+ * - woo_is_woo_activated
10
+ * - woo_is_jigo_activated
11
+ *
12
+ */
13
+
14
+ if( is_admin() ) {
15
+
16
+ /* Start of: WordPress Administration */
17
+
18
+ include_once( 'common-dashboard_widgets.php' );
19
+
20
+ /* End of: WordPress Administration */
21
+
22
+ }
23
+
24
+ if( !function_exists( 'woo_get_action' ) ) {
25
+ function woo_get_action( $switch = false ) {
26
+
27
+ if( $switch ) {
28
+
29
+ if( isset( $_GET['action'] ) )
30
+ $action = $_GET['action'];
31
+ else if( !isset( $action ) && isset( $_POST['action'] ) )
32
+ $action = $_POST['action'];
33
+ else
34
+ $action = false;
35
+
36
+ } else {
37
+
38
+ if( isset( $_POST['action'] ) )
39
+ $action = $_POST['action'];
40
+ else if( !isset( $action ) && isset( $_GET['action'] ) )
41
+ $action = $_GET['action'];
42
+ else
43
+ $action = false;
44
+
45
+ }
46
+ return $action;
47
+
48
+ }
49
+ }
50
+
51
+ if( !function_exists( 'woo_is_wpsc_activated' ) ) {
52
+ function woo_is_wpsc_activated() {
53
+
54
+ if( class_exists( 'WP_eCommerce' ) || defined( 'WPSC_VERSION' ) )
55
+ return true;
56
+
57
+ }
58
+ }
59
+
60
+ if( !function_exists( 'woo_is_woo_activated' ) ) {
61
+ function woo_is_woo_activated() {
62
+
63
+ if( class_exists( 'Woocommerce' ) )
64
+ return true;
65
+
66
+ }
67
+ }
68
+
69
+ if( !function_exists( 'woo_is_jigo_activated' ) ) {
70
+ function woo_is_jigo_activated() {
71
+
72
+ if( function_exists( 'jigoshop_init' ) )
73
+ return true;
74
+
75
+ }
76
+ }
77
+ ?>
includes/coupon.php ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ if( !function_exists( 'woo_ce_get_export_type_coupon_count' ) ) {
7
+ function woo_ce_get_export_type_coupon_count() {
8
+
9
+ $count = 0;
10
+ // Check if the existing Transient exists
11
+ $cached = get_transient( WOO_CE_PREFIX . '_coupon_count' );
12
+ if( $cached == false ) {
13
+ $post_type = 'shop_coupon';
14
+ if( post_type_exists( $post_type ) )
15
+ $count = wp_count_posts( $post_type );
16
+ set_transient( WOO_CE_PREFIX . '_coupon_count', $count, HOUR_IN_SECONDS );
17
+ } else {
18
+ $count = $cached;
19
+ }
20
+ return $count;
21
+
22
+ }
23
+ }
24
+
25
+ /* End of: WordPress Administration */
26
+
27
+ }
28
+
29
+ // Returns a list of Coupon export columns
30
+ function woo_ce_get_coupon_fields( $format = 'full' ) {
31
+
32
+ $export_type = 'coupon';
33
+
34
+ $fields = array();
35
+ $fields[] = array(
36
+ 'name' => 'coupon_code',
37
+ 'label' => __( 'Coupon Code', 'woocommerce-exporter' )
38
+ );
39
+ $fields[] = array(
40
+ 'name' => 'coupon_description',
41
+ 'label' => __( 'Coupon Description', 'woocommerce-exporter' )
42
+ );
43
+ $fields[] = array(
44
+ 'name' => 'discount_type',
45
+ 'label' => __( 'Discount Type', 'woocommerce-exporter' )
46
+ );
47
+ $fields[] = array(
48
+ 'name' => 'coupon_amount',
49
+ 'label' => __( 'Coupon Amount', 'woocommerce-exporter' )
50
+ );
51
+ $fields[] = array(
52
+ 'name' => 'individual_use',
53
+ 'label' => __( 'Individual Use', 'woocommerce-exporter' )
54
+ );
55
+ $fields[] = array(
56
+ 'name' => 'apply_before_tax',
57
+ 'label' => __( 'Apply before tax', 'woocommerce-exporter' )
58
+ );
59
+ $fields[] = array(
60
+ 'name' => 'exclude_sale_items',
61
+ 'label' => __( 'Exclude sale items', 'woocommerce-exporter' )
62
+ );
63
+ $fields[] = array(
64
+ 'name' => 'minimum_amount',
65
+ 'label' => __( 'Minimum Amount', 'woocommerce-exporter' )
66
+ );
67
+ $fields[] = array(
68
+ 'name' => 'product_ids',
69
+ 'label' => __( 'Products', 'woocommerce-exporter' )
70
+ );
71
+ $fields[] = array(
72
+ 'name' => 'exclude_product_ids',
73
+ 'label' => __( 'Exclude Products', 'woocommerce-exporter' )
74
+ );
75
+ $fields[] = array(
76
+ 'name' => 'product_categories',
77
+ 'label' => __( 'Product Categories', 'woocommerce-exporter' )
78
+ );
79
+ $fields[] = array(
80
+ 'name' => 'exclude_product_categories',
81
+ 'label' => __( 'Exclude Product Categories', 'woocommerce-exporter' )
82
+ );
83
+ $fields[] = array(
84
+ 'name' => 'customer_email',
85
+ 'label' => __( 'Customer e-mails', 'woocommerce-exporter' )
86
+ );
87
+ $fields[] = array(
88
+ 'name' => 'usage_limit',
89
+ 'label' => __( 'Usage Limit', 'woocommerce-exporter' )
90
+ );
91
+ $fields[] = array(
92
+ 'name' => 'expiry_date',
93
+ 'label' => __( 'Expiry Date', 'woocommerce-exporter' )
94
+ );
95
+
96
+ /*
97
+ $fields[] = array(
98
+ 'name' => '',
99
+ 'label' => __( '', 'woocommerce-exporter' )
100
+ );
101
+ */
102
+
103
+ // Drop in our content filters here
104
+ add_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
105
+
106
+ // Allow Plugin/Theme authors to add support for additional columns
107
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
108
+
109
+ // Remove our content filters here to play nice with other Plugins
110
+ remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
111
+
112
+ switch( $format ) {
113
+
114
+ case 'summary':
115
+ $output = array();
116
+ $size = count( $fields );
117
+ for( $i = 0; $i < $size; $i++ ) {
118
+ if( isset( $fields[$i] ) )
119
+ $output[$fields[$i]['name']] = 'on';
120
+ }
121
+ return $output;
122
+ break;
123
+
124
+ case 'full':
125
+ default:
126
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
127
+ $size = count( $fields );
128
+ for( $i = 0; $i < $size; $i++ ) {
129
+ $fields[$i]['reset'] = $i;
130
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
131
+ }
132
+ // Check if we are using PHP 5.3 and above
133
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
134
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
135
+ return $fields;
136
+ break;
137
+
138
+ }
139
+
140
+ }
141
+
142
+ function woo_ce_override_coupon_field_labels( $fields = array() ) {
143
+
144
+ $labels = woo_ce_get_option( 'coupon_labels', array() );
145
+ if( !empty( $labels ) ) {
146
+ foreach( $fields as $key => $field ) {
147
+ if( isset( $labels[$field['name']] ) )
148
+ $fields[$key]['label'] = $labels[$field['name']];
149
+ }
150
+ }
151
+ return $fields;
152
+
153
+ }
154
+ add_filter( 'woo_ce_coupon_fields', 'woo_ce_override_coupon_field_labels', 11 );
155
+
156
+ // Returns a list of Coupon IDs
157
+ function woo_ce_get_coupons( $args = array() ) {
158
+
159
+ global $export;
160
+
161
+ $limit_volume = -1;
162
+ $offset = 0;
163
+
164
+ if( $args ) {
165
+ $limit_volume = ( isset( $args['limit_volume'] ) ? $args['limit_volume'] : false );
166
+ $offset = ( isset( $args['offset'] ) ? $args['offset'] : false );
167
+ $orderby = ( isset( $args['coupon_orderby'] ) ? $args['coupon_orderby'] : 'ID' );
168
+ $order = ( isset( $args['coupon_order'] ) ? $args['coupon_order'] : 'ASC' );
169
+ }
170
+
171
+ $post_type = 'shop_coupon';
172
+ $args = array(
173
+ 'post_type' => $post_type,
174
+ 'orderby' => $orderby,
175
+ 'order' => $order,
176
+ 'offset' => $offset,
177
+ 'posts_per_page' => $limit_volume,
178
+ 'post_status' => woo_ce_post_statuses(),
179
+ 'fields' => 'ids',
180
+ 'suppress_filters' => false
181
+ );
182
+ $coupons = array();
183
+ $coupon_ids = new WP_Query( $args );
184
+ if( $coupon_ids->posts ) {
185
+ foreach( $coupon_ids->posts as $coupon_id )
186
+ $coupons[] = $coupon_id;
187
+ unset( $coupon_ids, $coupon_id );
188
+ }
189
+ return $coupons;
190
+
191
+ }
192
+
193
+ function woo_ce_get_coupon_code_usage( $coupon_code = '' ) {
194
+
195
+ global $wpdb;
196
+
197
+ $count = 0;
198
+ if( $coupon_code ) {
199
+ $order_item_type = 'coupon';
200
+ $count_sql = $wpdb->prepare( "SELECT COUNT('order_item_id') FROM `" . $wpdb->prefix . "woocommerce_order_items` WHERE `order_item_type` = %s AND `order_item_name` = %s", $order_item_type, $coupon_code );
201
+ $count = $wpdb->get_var( $count_sql );
202
+ }
203
+ return $count;
204
+
205
+ }
206
+ ?>
includes/customer.php ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ if( !function_exists( 'woo_ce_get_export_type_customer_count' ) ) {
7
+ function woo_ce_get_export_type_customer_count() {
8
+
9
+ $count = 0;
10
+ // Check if the existing Transient exists
11
+ $cached = get_transient( WOO_CE_PREFIX . '_customer_count' );
12
+ if( $cached == false ) {
13
+ if( $users = woo_ce_get_export_type_count( 'user' ) > 1000 ) {
14
+ $count = sprintf( '~%s+', 1000 );
15
+ } else {
16
+ $post_type = 'shop_order';
17
+ $args = array(
18
+ 'post_type' => $post_type,
19
+ 'posts_per_page' => -1,
20
+ 'fields' => 'ids'
21
+ );
22
+ $woocommerce_version = woo_get_woo_version();
23
+ // Check if this is a WooCommerce 2.2+ instance (new Post Status)
24
+ if( version_compare( $woocommerce_version, '2.2' ) >= 0 ) {
25
+ $args['post_status'] = apply_filters( 'woo_ce_customer_post_status', array( 'wc-pending', 'wc-on-hold', 'wc-processing', 'wc-completed' ) );
26
+ } else {
27
+ $args['post_status'] = apply_filters( 'woo_ce_customer_post_status', woo_ce_post_statuses() );
28
+ $args['tax_query'] = array(
29
+ array(
30
+ 'taxonomy' => 'shop_order_status',
31
+ 'field' => 'slug',
32
+ 'terms' => array( 'pending', 'on-hold', 'processing', 'completed' )
33
+ ),
34
+ );
35
+ }
36
+ $order_ids = new WP_Query( $args );
37
+ $count = $order_ids->found_posts;
38
+ if( $count > 100 ) {
39
+ $count = sprintf( '~%s', $count );
40
+ } else {
41
+ $customers = array();
42
+ if( $order_ids->posts ) {
43
+ foreach( $order_ids->posts as $order_id ) {
44
+ $email = get_post_meta( $order_id, '_billing_email', true );
45
+ if( !in_array( $email, $customers ) )
46
+ $customers[$order_id] = $email;
47
+ unset( $email );
48
+ }
49
+ $count = count( $customers );
50
+ }
51
+ }
52
+ }
53
+ set_transient( WOO_CE_PREFIX . '_customer_count', $count, HOUR_IN_SECONDS );
54
+ } else {
55
+ $count = $cached;
56
+ }
57
+ return $count;
58
+
59
+ }
60
+ }
61
+
62
+ /* End of: WordPress Administration */
63
+
64
+ }
65
+
66
+ // Returns a list of Customer export columns
67
+ function woo_ce_get_customer_fields( $format = 'full' ) {
68
+
69
+ $export_type = 'customer';
70
+
71
+ $fields = array();
72
+ $fields[] = array(
73
+ 'name' => 'user_id',
74
+ 'label' => __( 'User ID', 'woocommerce-exporter' )
75
+ );
76
+ $fields[] = array(
77
+ 'name' => 'user_name',
78
+ 'label' => __( 'Username', 'woocommerce-exporter' )
79
+ );
80
+ $fields[] = array(
81
+ 'name' => 'user_role',
82
+ 'label' => __( 'User Role', 'woocommerce-exporter' )
83
+ );
84
+ $fields[] = array(
85
+ 'name' => 'billing_full_name',
86
+ 'label' => __( 'Billing: Full Name', 'woocommerce-exporter' )
87
+ );
88
+ $fields[] = array(
89
+ 'name' => 'billing_first_name',
90
+ 'label' => __( 'Billing: First Name', 'woocommerce-exporter' )
91
+ );
92
+ $fields[] = array(
93
+ 'name' => 'billing_last_name',
94
+ 'label' => __( 'Billing: Last Name', 'woocommerce-exporter' )
95
+ );
96
+ $fields[] = array(
97
+ 'name' => 'billing_company',
98
+ 'label' => __( 'Billing: Company', 'woocommerce-exporter' )
99
+ );
100
+ $fields[] = array(
101
+ 'name' => 'billing_address',
102
+ 'label' => __( 'Billing: Street Address', 'woocommerce-exporter' )
103
+ );
104
+ $fields[] = array(
105
+ 'name' => 'billing_city',
106
+ 'label' => __( 'Billing: City', 'woocommerce-exporter' )
107
+ );
108
+ $fields[] = array(
109
+ 'name' => 'billing_postcode',
110
+ 'label' => __( 'Billing: ZIP Code', 'woocommerce-exporter' )
111
+ );
112
+ $fields[] = array(
113
+ 'name' => 'billing_state',
114
+ 'label' => __( 'Billing: State (prefix)', 'woocommerce-exporter' )
115
+ );
116
+ $fields[] = array(
117
+ 'name' => 'billing_state_full',
118
+ 'label' => __( 'Billing: State', 'woocommerce-exporter' )
119
+ );
120
+ $fields[] = array(
121
+ 'name' => 'billing_country',
122
+ 'label' => __( 'Billing: Country', 'woocommerce-exporter' )
123
+ );
124
+ $fields[] = array(
125
+ 'name' => 'billing_phone',
126
+ 'label' => __( 'Billing: Phone Number', 'woocommerce-exporter' )
127
+ );
128
+ $fields[] = array(
129
+ 'name' => 'billing_email',
130
+ 'label' => __( 'Billing: E-mail Address', 'woocommerce-exporter' )
131
+ );
132
+ $fields[] = array(
133
+ 'name' => 'shipping_full_name',
134
+ 'label' => __( 'Shipping: Full Name', 'woocommerce-exporter' )
135
+ );
136
+ $fields[] = array(
137
+ 'name' => 'shipping_first_name',
138
+ 'label' => __( 'Shipping: First Name', 'woocommerce-exporter' )
139
+ );
140
+ $fields[] = array(
141
+ 'name' => 'shipping_last_name',
142
+ 'label' => __( 'Shipping: Last Name', 'woocommerce-exporter' )
143
+ );
144
+ $fields[] = array(
145
+ 'name' => 'shipping_company',
146
+ 'label' => __( 'Shipping: Company', 'woocommerce-exporter' )
147
+ );
148
+ $fields[] = array(
149
+ 'name' => 'shipping_address',
150
+ 'label' => __( 'Shipping: Street Address', 'woocommerce-exporter' )
151
+ );
152
+ $fields[] = array(
153
+ 'name' => 'shipping_city',
154
+ 'label' => __( 'Shipping: City', 'woocommerce-exporter' )
155
+ );
156
+ $fields[] = array(
157
+ 'name' => 'shipping_postcode',
158
+ 'label' => __( 'Shipping: ZIP Code', 'woocommerce-exporter' )
159
+ );
160
+ $fields[] = array(
161
+ 'name' => 'shipping_state',
162
+ 'label' => __( 'Shipping: State (prefix)', 'woocommerce-exporter' )
163
+ );
164
+ $fields[] = array(
165
+ 'name' => 'shipping_state_full',
166
+ 'label' => __( 'Shipping: State', 'woocommerce-exporter' )
167
+ );
168
+ $fields[] = array(
169
+ 'name' => 'shipping_country',
170
+ 'label' => __( 'Shipping: Country (prefix)', 'woocommerce-exporter' )
171
+ );
172
+ $fields[] = array(
173
+ 'name' => 'shipping_country_full',
174
+ 'label' => __( 'Shipping: Country', 'woocommerce-exporter' )
175
+ );
176
+ $fields[] = array(
177
+ 'name' => 'total_spent',
178
+ 'label' => __( 'Total Spent', 'woocommerce-exporter' )
179
+ );
180
+ $fields[] = array(
181
+ 'name' => 'completed_orders',
182
+ 'label' => __( 'Completed Orders', 'woocommerce-exporter' )
183
+ );
184
+ $fields[] = array(
185
+ 'name' => 'total_orders',
186
+ 'label' => __( 'Total Orders', 'woocommerce-exporter' )
187
+ );
188
+
189
+ /*
190
+ $fields[] = array(
191
+ 'name' => '',
192
+ 'label' => __( '', 'woocommerce-exporter' )
193
+ );
194
+ */
195
+
196
+ // Drop in our content filters here
197
+ add_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
198
+
199
+ // Allow Plugin/Theme authors to add support for additional columns
200
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
201
+
202
+ // Remove our content filters here to play nice with other Plugins
203
+ remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
204
+
205
+ switch( $format ) {
206
+
207
+ case 'summary':
208
+ $output = array();
209
+ $size = count( $fields );
210
+ for( $i = 0; $i < $size; $i++ ) {
211
+ if( isset( $fields[$i] ) )
212
+ $output[$fields[$i]['name']] = 'on';
213
+ }
214
+ return $output;
215
+ break;
216
+
217
+ case 'full':
218
+ default:
219
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
220
+ $size = count( $fields );
221
+ for( $i = 0; $i < $size; $i++ ) {
222
+ $fields[$i]['reset'] = $i;
223
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
224
+ }
225
+ // Check if we are using PHP 5.3 and above
226
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
227
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
228
+ return $fields;
229
+ break;
230
+
231
+ }
232
+
233
+ }
234
+
235
+ function woo_ce_override_customer_field_labels( $fields = array() ) {
236
+
237
+ $labels = woo_ce_get_option( 'customer_labels', array() );
238
+ if( !empty( $labels ) ) {
239
+ foreach( $fields as $key => $field ) {
240
+ if( isset( $labels[$field['name']] ) )
241
+ $fields[$key]['label'] = $labels[$field['name']];
242
+ }
243
+ }
244
+ return $fields;
245
+
246
+ }
247
+ add_filter( 'woo_ce_customer_fields', 'woo_ce_override_customer_field_labels', 11 );
248
+ ?>
includes/export-csv.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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%-%random%.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
+ $random = mt_rand( 10000000, 99999999 );
21
+ $store_name = sanitize_title( get_bloginfo( 'name' ) );
22
+
23
+ // Switch out the tags for filled values
24
+ $filename = str_replace( '%dataset%', $export_type, $filename );
25
+ $filename = str_replace( '%date%', $date, $filename );
26
+ $filename = str_replace( '%time%', $time, $filename );
27
+ $filename = str_replace( '%random%', $random, $filename );
28
+ $filename = str_replace( '%store_name%', $store_name, $filename );
29
+
30
+ // Return the filename
31
+ return $filename;
32
+
33
+ }
34
+
35
+ // File output header for CSV file
36
+ function woo_ce_generate_csv_header( $export_type = '' ) {
37
+
38
+ global $export;
39
+
40
+ if( $filename = woo_ce_generate_csv_filename( $export_type ) ) {
41
+ $mime_type = 'text/csv';
42
+ header( sprintf( 'Content-Encoding: %s', esc_attr( $export->encoding ) ) );
43
+ header( sprintf( 'Content-Type: %s; charset=%s', $mime_type, esc_attr( $export->encoding ) ) );
44
+ header( 'Content-Transfer-Encoding: binary' );
45
+ header( sprintf( 'Content-Disposition: attachment; filename=%s', $filename ) );
46
+ header( 'Pragma: no-cache' );
47
+ header( 'Expires: 0' );
48
+ }
49
+
50
+ }
51
+ ?>
includes/formatting.php ADDED
@@ -0,0 +1,445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_attribute_escape( $safe_text = '', $text = '' ) {
75
+
76
+ if( substr( $safe_text, 0, 1 ) == '=' ) {
77
+ $safe_text = ltrim( $safe_text, '=' );
78
+ }
79
+ return $safe_text;
80
+
81
+ }
82
+
83
+ function woo_ce_sanitize_key( $key ) {
84
+
85
+ // Limit length of key to 48 characters
86
+ $key = substr( $key, 0, 48 );
87
+ return $key;
88
+
89
+ }
90
+
91
+ // Return the element count of an object
92
+ function woo_ce_count_object( $object = 0, $exclude_post_types = array() ) {
93
+
94
+ $count = 0;
95
+ if( is_object( $object ) ) {
96
+ if( !empty( $exclude_post_types ) ) {
97
+ $size = count( $exclude_post_types );
98
+ for( $i = 0; $i < $size; $i++ ) {
99
+ if( isset( $object->$exclude_post_types[$i] ) )
100
+ unset( $object->$exclude_post_types[$i] );
101
+ }
102
+ }
103
+ if( !empty( $object ) ) {
104
+ foreach( $object as $key => $item )
105
+ $count = $item + $count;
106
+ }
107
+ } else {
108
+ $count = $object;
109
+ }
110
+ return $count;
111
+
112
+ }
113
+
114
+ // Takes an array or comma separated string and returns an export formatted string
115
+ function woo_ce_convert_product_ids( $product_ids = null ) {
116
+
117
+ global $export;
118
+
119
+ $output = '';
120
+ if( $product_ids !== null ) {
121
+ if( is_array( $product_ids ) ) {
122
+ $size = count( $product_ids );
123
+ for( $i = 0; $i < $size; $i++ )
124
+ $output .= $product_ids[$i] . $export->category_separator;
125
+ $output = substr( $output, 0, -1 );
126
+ } else if( strstr( $product_ids, ',' ) ) {
127
+ $output = str_replace( ',', $export->category_separator, $product_ids );
128
+ }
129
+ }
130
+ return $output;
131
+
132
+ }
133
+
134
+ // Format the raw post_status
135
+ function woo_ce_format_post_status( $post_status = '' ) {
136
+
137
+ $output = $post_status;
138
+ switch( $post_status ) {
139
+
140
+ case 'publish':
141
+ $output = __( 'Publish', 'woocommerce-exporter' );
142
+ break;
143
+
144
+ case 'draft':
145
+ $output = __( 'Draft', 'woocommerce-exporter' );
146
+ break;
147
+
148
+ case 'pending':
149
+ $output = __( 'Pending', 'woocommerce-exporter' );
150
+ break;
151
+
152
+ case 'private':
153
+ $output = __( 'Private', 'woocommerce-exporter' );
154
+ break;
155
+
156
+ case 'trash':
157
+ $output = __( 'Trash', 'woocommerce-exporter' );
158
+ break;
159
+
160
+ }
161
+ $output = apply_filters( 'woo_ce_format_post_status', $output, $post_status );
162
+ return $output;
163
+
164
+ }
165
+
166
+ // Format the raw comment_status
167
+ function woo_ce_format_comment_status( $comment_status ) {
168
+
169
+ $output = $comment_status;
170
+ switch( $comment_status ) {
171
+
172
+ case 'open':
173
+ $output = __( 'Open', 'woocommerce-exporter' );
174
+ break;
175
+
176
+ case 'closed':
177
+ $output = __( 'Closed', 'woocommerce-exporter' );
178
+ break;
179
+
180
+ }
181
+ return $output;
182
+
183
+ }
184
+
185
+ function woo_ce_format_switch( $input = '', $output_format = 'answer' ) {
186
+
187
+ $input = strtolower( $input );
188
+ switch( $input ) {
189
+
190
+ case '1':
191
+ case 'yes':
192
+ case 'on':
193
+ case 'open':
194
+ case 'active':
195
+ $input = '1';
196
+ break;
197
+
198
+ case '0':
199
+ case 'no':
200
+ case 'off':
201
+ case 'closed':
202
+ case 'inactive':
203
+ default:
204
+ $input = '0';
205
+ break;
206
+
207
+ }
208
+ $output = '';
209
+ switch( $output_format ) {
210
+
211
+ case 'int':
212
+ $output = $input;
213
+ break;
214
+
215
+ case 'answer':
216
+ switch( $input ) {
217
+
218
+ case '1':
219
+ $output = __( 'Yes', 'woocommerce-exporter' );
220
+ break;
221
+
222
+ case '0':
223
+ $output = __( 'No', 'woocommerce-exporter' );
224
+ break;
225
+
226
+ }
227
+ break;
228
+
229
+ case 'boolean':
230
+ switch( $input ) {
231
+
232
+ case '1':
233
+ $output = 'on';
234
+ break;
235
+
236
+ case '0':
237
+ $output = 'off';
238
+ break;
239
+
240
+ }
241
+ break;
242
+
243
+ }
244
+ return $output;
245
+
246
+ }
247
+
248
+ function woo_ce_format_product_filters( $product_filters = array() ) {
249
+
250
+ $output = array();
251
+ if( !empty( $product_filters ) ) {
252
+ $size = count( $product_filters );
253
+ if( $size == 1 ) {
254
+ // Check if we are dealing with an empty array or zero key
255
+ if( isset( $product_filters[0] ) && $product_filters[0] == '' ) {
256
+ return;
257
+ // Check if we are dealing with Select2 Enhanced
258
+ } else if( isset( $product_filters[0] ) && strpos( $product_filters[0], ',' ) !== false ) {
259
+ $product_filters = explode( ',', $product_filters[0] );
260
+ }
261
+ }
262
+ foreach( $product_filters as $product_filter )
263
+ $output[] = $product_filter;
264
+ }
265
+ return $output;
266
+
267
+ }
268
+
269
+ function woo_ce_format_user_role_filters( $user_role_filters = array() ) {
270
+
271
+ $output = array();
272
+ if( !empty( $user_role_filters ) ) {
273
+ foreach( $user_role_filters as $user_role_filter )
274
+ $output[] = $user_role_filter;
275
+ }
276
+ return $output;
277
+
278
+ }
279
+
280
+ // Allow store owners to create their own woo_ce_format_price() as needed
281
+ if( !function_exists( 'woo_ce_format_price' ) ) {
282
+ function woo_ce_format_price( $price = '', $currency = '' ) {
283
+
284
+ // Check that a valid price has been provided and that wc_price() exists
285
+ if( $price !== false && function_exists( 'wc_price' ) ) {
286
+ // WooCommerce adds currency formatting to the price, let's not do that
287
+ add_filter( 'wc_price', 'woo_ce_filter_wc_price', 10, 3 );
288
+ add_filter( 'formatted_woocommerce_price', 'woo_ce_formatted_woocommerce_price', 10, 5 );
289
+ add_filter( 'woocommerce_currency_symbol', 'woo_ce_woocommerce_currency_symbol', 10, 2 );
290
+ $price = wc_price( $price, array( 'currency' => $currency ) );
291
+ remove_filter( 'formatted_woocommerce_price', 'woo_ce_formatted_woocommerce_price' );
292
+ remove_filter( 'wc_price', 'woo_ce_filter_wc_price' );
293
+ remove_filter( 'woocommerce_currency_symbol', 'woo_ce_woocommerce_currency_symbol' );
294
+ }
295
+ return $price;
296
+
297
+ }
298
+ }
299
+
300
+ function woo_ce_filter_wc_price( $return, $price ) {
301
+
302
+ // Check price for negative values; weird method but neccesary
303
+ if( strstr( $return, '<span class="woocommerce-Price-amount amount">-' ) )
304
+ $price = '-' . $price;
305
+
306
+ return $price;
307
+
308
+ }
309
+
310
+ function woo_ce_formatted_woocommerce_price( $return, $price, $num_decimals, $decimal_sep, $thousands_sep ) {
311
+
312
+ $decimal_sep = apply_filters( 'woo_ce_wc_price_decimal_sep', $decimal_sep );
313
+ $thousands_sep = apply_filters( 'woo_ce_wc_price_thousands_sep', $thousands_sep );
314
+
315
+ $price = number_format( $price, $num_decimals, $decimal_sep, $thousands_sep );
316
+ return $price;
317
+
318
+ }
319
+
320
+ // Strip the currency symbol from the price
321
+ function woo_ce_woocommerce_currency_symbol( $currency_symbol, $currency ) {
322
+
323
+ $currency_symbol = apply_filters( 'woo_ce_wc_price_currency_symbol', '', $currency_symbol, $currency );
324
+ return $currency_symbol;
325
+
326
+ }
327
+
328
+ function woo_ce_format_date( $date = '', $format = '' ) {
329
+
330
+ $output = $date;
331
+ $date_format = woo_ce_get_option( 'date_format', 'd/m/Y' );
332
+ if( !empty( $format ) )
333
+ $date_format = $format;
334
+ if( !empty( $date ) && $date_format != '' ) {
335
+ $output = mysql2date( $date_format, $date );
336
+ }
337
+ return $output;
338
+
339
+ }
340
+
341
+ // Take our pretty slashed date format and make it play nice with strtotime() and date()
342
+ function woo_ce_format_order_date( $date = '', $format = 'export' ) {
343
+
344
+ $output = $date;
345
+ if( !empty( $date ) ) {
346
+ $output = str_replace( '/', '-', $date );
347
+ }
348
+ return $output;
349
+
350
+ }
351
+
352
+ function woo_ce_format_archive_date( $post_ID = 0, $time = false ) {
353
+
354
+ if( $time == false )
355
+ $time = get_post_time( 'G', true, $post_ID, false );
356
+ if( ( abs( $t_diff = time() - $time ) ) < 86400 )
357
+ $post_date = sprintf( __( '%s ago' ), human_time_diff( $time ) );
358
+ else
359
+ $post_date = mysql2date( get_option( 'date_format', 'd/m/Y' ), date( 'Y/m/d', $time ) );
360
+ unset( $time );
361
+ return $post_date;
362
+
363
+ }
364
+
365
+ function woo_ce_format_product_category_label( $product_category = '', $parent_category = '' ) {
366
+
367
+ $output = $product_category;
368
+ if( !empty( $parent_category ) )
369
+ $output .= ' &raquo; ' . $parent_category;
370
+ return $output;
371
+
372
+ }
373
+
374
+ function woo_ce_clean_export_label( $label = '' ) {
375
+
376
+ // If the first character is an underscore remove it
377
+ if( $label[0] === '_' )
378
+ $label = substr( $label, 1 );
379
+ // Replace any underscores with spaces
380
+ $label = str_replace( '_', ' ', $label );
381
+ // Auto-capitalise label
382
+ $label = ucfirst( $label );
383
+ return $label;
384
+
385
+ }
386
+
387
+ if( !function_exists( 'woo_ce_expand_state_name' ) ) {
388
+ function woo_ce_expand_state_name( $country_prefix = '', $state_prefix = '' ) {
389
+
390
+ global $woocommerce;
391
+
392
+ $output = $state_prefix;
393
+ if( $output ) {
394
+ if( isset( $woocommerce->countries ) ) {
395
+ if( $states = $woocommerce->countries->get_states( $country_prefix ) ) {
396
+ if( isset( $states[$state_prefix] ) )
397
+ $output = $states[$state_prefix];
398
+ }
399
+ unset( $states );
400
+ }
401
+ }
402
+ return $output;
403
+
404
+ }
405
+ }
406
+
407
+ if( !function_exists( 'woo_ce_expand_country_name' ) ) {
408
+ function woo_ce_expand_country_name( $country_prefix = '' ) {
409
+
410
+ $output = $country_prefix;
411
+ if( !empty( $output ) && class_exists( 'WC_Countries' ) ) {
412
+ if( $countries = woo_ce_allowed_countries() ) {
413
+ if( isset( $countries[$country_prefix] ) )
414
+ $output = $countries[$country_prefix];
415
+ }
416
+ unset( $countries );
417
+ }
418
+ return $output;
419
+
420
+ }
421
+ }
422
+
423
+ function woo_ce_allowed_countries() {
424
+
425
+ if( apply_filters( 'woo_ce_override_wc_countries', true ) ) {
426
+ if( class_exists( 'WC_Countries' ) ) {
427
+ $countries = new WC_Countries();
428
+ if( method_exists( $countries, 'get_allowed_countries' ) ) {
429
+ $countries = $countries->get_allowed_countries();
430
+ return $countries;
431
+ }
432
+ }
433
+ }
434
+
435
+ }
436
+
437
+ function woo_ce_format_description_excerpt( $string = '' ) {
438
+
439
+ if( $description_excerpt_formatting = woo_ce_get_option( 'description_excerpt_formatting', 0 ) ) {
440
+ $string = wp_kses( $string, apply_filters( 'woo_ce_format_description_excerpt_allowed_html', array() ), apply_filters( 'woo_ce_format_description_excerpt_allowed_protocols', array() ) );
441
+ }
442
+ return apply_filters( 'woo_ce_format_description_excerpt', $string );
443
+
444
+ }
445
+ ?>
includes/functions.php ADDED
@@ -0,0 +1,2029 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Only load these resources if we are running an export
3
+ function woo_ce_load_export_types() {
4
+
5
+ include_once( WOO_CE_PATH . 'includes/product.php' );
6
+ include_once( WOO_CE_PATH . 'includes/product-extend.php' );
7
+ include_once( WOO_CE_PATH . 'includes/category.php' );
8
+ include_once( WOO_CE_PATH . 'includes/tag.php' );
9
+ include_once( WOO_CE_PATH . 'includes/brand.php' );
10
+ include_once( WOO_CE_PATH . 'includes/order.php' );
11
+ include_once( WOO_CE_PATH . 'includes/customer.php' );
12
+ include_once( WOO_CE_PATH . 'includes/user.php' );
13
+ include_once( WOO_CE_PATH . 'includes/user-extend.php' );
14
+ include_once( WOO_CE_PATH . 'includes/coupon.php' );
15
+ include_once( WOO_CE_PATH . 'includes/subscription.php' );
16
+ include_once( WOO_CE_PATH . 'includes/product_vendor.php' );
17
+ include_once( WOO_CE_PATH . 'includes/commission.php' );
18
+ include_once( WOO_CE_PATH . 'includes/shipping_class.php' );
19
+
20
+ // Load the export type resources first
21
+ include_once( WOO_CE_PATH . 'includes/admin/product.php' );
22
+ include_once( WOO_CE_PATH . 'includes/admin/category.php' );
23
+ include_once( WOO_CE_PATH . 'includes/admin/tag.php' );
24
+ include_once( WOO_CE_PATH . 'includes/admin/brand.php' );
25
+ include_once( WOO_CE_PATH . 'includes/admin/order.php' );
26
+ include_once( WOO_CE_PATH . 'includes/admin/customer.php' );
27
+ include_once( WOO_CE_PATH . 'includes/admin/user.php' );
28
+ include_once( WOO_CE_PATH . 'includes/admin/coupon.php' );
29
+ include_once( WOO_CE_PATH . 'includes/admin/subscription.php' );
30
+ include_once( WOO_CE_PATH . 'includes/admin/commission.php' );
31
+ include_once( WOO_CE_PATH . 'includes/admin/shipping_class.php' );
32
+
33
+ }
34
+
35
+
36
+ // Check if we are using PHP 5.3 and above
37
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
38
+ include_once( WOO_CE_PATH . 'includes/legacy.php' );
39
+ include_once( WOO_CE_PATH . 'includes/formatting.php' );
40
+
41
+ include_once( WOO_CE_PATH . 'includes/export-csv.php' );
42
+
43
+ if( is_admin() ) {
44
+
45
+ /* Start of: WordPress Administration */
46
+
47
+ include_once( WOO_CE_PATH . 'includes/admin.php' );
48
+ // WordPress Admin Pointers
49
+ include_once( WOO_CE_PATH . 'includes/settings.php' );
50
+
51
+ function woo_ce_export_init() {
52
+
53
+ // Process any pre-export notice confirmations
54
+ $action = ( function_exists( 'woo_get_action' ) ? woo_get_action() : false );
55
+ switch( $action ) {
56
+
57
+ // Reset all dismissed notices within Store Exporter Deluxe
58
+ case 'nuke_notices':
59
+ // We need to verify the nonce.
60
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_nuke_notices' ) ) {
61
+ // Remember that we've dismissed this notice
62
+ woo_ce_nuke_dismissed_notices();
63
+ $message = __( 'All dimissed notices within Store Exporter Deluxe have been restored.', 'woocommerce-exporter' );
64
+ woo_ce_admin_notice( $message );
65
+ }
66
+ break;
67
+
68
+ // Delete all WordPress Options associated with Store Exporter Deluxe
69
+ case 'nuke_options':
70
+ // We need to verify the nonce.
71
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_nuke_options' ) ) {
72
+ // Delete WordPress Options used by Store Exporter Deluxe (Uninstall)
73
+ if( woo_ce_nuke_options() ) {
74
+ $message = __( 'All Store Exporter Deluxe WordPress Options have been deleted from your WordPress site, you can now de-activate and delete Store Exporter Deluxe.', 'woocommerce-exporter' );
75
+ woo_ce_admin_notice( $message );
76
+ } else {
77
+ $message = __( 'Not all Store Exporter Deluxe WordPress Options could be deleted from your WordPress site, please see the WordPress Options table for Options prefixed by <code>woo_ce_</code>.', 'woocommerce-exporter' );
78
+ woo_ce_admin_notice( $message, 'error' );
79
+ }
80
+ }
81
+ break;
82
+
83
+ // Delete all Archives
84
+ case 'nuke_archives':
85
+ // We need to verify the nonce.
86
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_nuke_archives' ) ) {
87
+ // Delete saved exports
88
+ if( woo_ce_nuke_archive_files() ) {
89
+ $message = __( 'All existing Archives and their export files have been deleted from your WordPress site.', 'woocommerce-exporter' );
90
+ woo_ce_admin_notice( $message );
91
+ } else {
92
+ $message = __( 'There were no existing Archives to be deleted from your WordPress site.', 'woocommerce-exporter' );
93
+ woo_ce_admin_notice( $message, 'error' );
94
+ }
95
+ }
96
+ break;
97
+
98
+ // Prompt on Export screen when insufficient memory (less than 64M is allocated)
99
+ case 'dismiss_memory_prompt':
100
+ // We need to verify the nonce.
101
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_dismiss_memory_prompt' ) ) {
102
+ // Remember that we've dismissed this notice
103
+ woo_ce_update_option( 'dismiss_memory_prompt', 1 );
104
+ $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
105
+ wp_redirect( $url );
106
+ exit();
107
+ }
108
+ break;
109
+
110
+ // Prompt on Export screen when PHP configuration option max_execution_time cannot be increased
111
+ case 'dismiss_execution_time_prompt':
112
+ // We need to verify the nonce.
113
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_dismiss_execution_time_prompt' ) ) {
114
+ // Remember that we've dismissed this notice
115
+ woo_ce_update_option( 'dismiss_execution_time_prompt', 1 );
116
+ $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
117
+ wp_redirect( $url );
118
+ exit();
119
+ }
120
+ break;
121
+
122
+ // Prompt on Export screen when PHP 5.2 or lower is installed
123
+ case 'dismiss_php_legacy':
124
+ // We need to verify the nonce.
125
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_dismiss_php_legacy' ) ) {
126
+ // Remember that we've dismissed this notice
127
+ woo_ce_update_option( 'dismiss_php_legacy', 1 );
128
+ $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
129
+ wp_redirect( $url );
130
+ exit();
131
+ }
132
+ break;
133
+
134
+ case 'dismiss_subscription_prompt':
135
+ // We need to verify the nonce.
136
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_dismiss_subscription_prompt' ) ) {
137
+ // Remember that we've dismissed this notice
138
+ woo_ce_update_option( 'dismiss_subscription_prompt', 1 );
139
+ $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
140
+ wp_redirect( $url );
141
+ exit();
142
+ }
143
+ break;
144
+
145
+ case 'dismiss_archives_prompt':
146
+ // We need to verify the nonce.
147
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_dismiss_archives_prompt' ) ) {
148
+ // Remember that we've dismissed this notice
149
+ woo_ce_update_option( 'dismiss_archives_prompt', 1 );
150
+ $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
151
+ wp_redirect( $url );
152
+ exit();
153
+ }
154
+ break;
155
+
156
+ case 'hide_archives_tab':
157
+ // We need to verify the nonce.
158
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_hide_archives_tab' ) ) {
159
+ // Remember to hide the Archives tab
160
+ woo_ce_update_option( 'hide_archives_tab', 1 );
161
+ $url = add_query_arg( array( 'tab' => 'export', 'action' => null, '_wpnonce' => null ) );
162
+ wp_redirect( $url );
163
+ exit();
164
+ }
165
+ break;
166
+
167
+ case 'restore_archives_tab':
168
+ // We need to verify the nonce.
169
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_restore_archives_tab' ) ) {
170
+ // Remember to show the Archives tab
171
+ woo_ce_update_option( 'hide_archives_tab', 0 );
172
+ $url = add_query_arg( array( 'tab' => 'archive', 'action' => null, '_wpnonce' => null ) );
173
+ wp_redirect( $url );
174
+ exit();
175
+ }
176
+ break;
177
+
178
+ // Reset the Transient counters for all export types
179
+ case 'refresh_export_type_counts':
180
+ // We need to verify the nonce.
181
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_refresh_export_type_counts' ) ) {
182
+ woo_ce_load_export_types();
183
+ $transients = array(
184
+ 'product',
185
+ 'category',
186
+ 'tag',
187
+ 'user'
188
+ );
189
+ foreach( $transients as $transient ) {
190
+ // Delete the existing count Transients
191
+ delete_transient( WOO_CE_PREFIX . '_' . $transient . '_count' );
192
+ // Refresh the count Transients
193
+ woo_ce_get_export_type_count( $transient );
194
+ }
195
+ $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
196
+ wp_redirect( $url );
197
+ exit();
198
+ }
199
+ break;
200
+
201
+ case 'refresh_module_counts':
202
+ // We need to verify the nonce.
203
+ if( !empty( $_GET ) && check_admin_referer( 'woo_ce_refresh_module_counts' ) ) {
204
+
205
+ // Delete the existing count Transients
206
+ delete_transient( WOO_CE_PREFIX . '_modules_active' );
207
+ delete_transient( WOO_CE_PREFIX . '_modules_all_count' );
208
+ delete_transient( WOO_CE_PREFIX . '_modules_active_count' );
209
+ delete_transient( WOO_CE_PREFIX . '_modules_inactive_count' );
210
+
211
+ // Refresh the count Transients
212
+ woo_ce_modules_list();
213
+ woo_ce_refresh_active_export_plugins();
214
+
215
+ $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
216
+ wp_redirect( $url );
217
+ exit();
218
+ }
219
+ break;
220
+
221
+ // Save skip overview preference
222
+ case 'skip_overview':
223
+ // We need to verify the nonce.
224
+ if( !empty( $_POST ) && check_admin_referer( 'skip_overview', 'woo_ce_skip_overview' ) ) {
225
+ $skip_overview = false;
226
+ if( isset( $_POST['skip_overview'] ) )
227
+ $skip_overview = 1;
228
+ // Remember that we've dismissed this notice
229
+ woo_ce_update_option( 'skip_overview', $skip_overview );
230
+
231
+ if( $skip_overview == 1 ) {
232
+ $url = add_query_arg( array( 'tab' => 'export', '_wpnonce' => null ) );
233
+ wp_redirect( $url );
234
+ exit();
235
+ }
236
+ }
237
+ break;
238
+
239
+ }
240
+
241
+ }
242
+
243
+ // Displays a HTML notice when a WordPress or Store Exporter error is encountered
244
+ function woo_ce_admin_fail_notices() {
245
+
246
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter/usage/';
247
+
248
+ // If the failed flag is set then prepare for an error notice
249
+ if( isset( $_GET['failed'] ) ) {
250
+ $message = '';
251
+ if( isset( $_GET['message'] ) )
252
+ $message = urldecode( $_GET['message'] );
253
+ if( $message )
254
+ $message = sprintf( __( 'A WordPress or server error caused the exporter to fail, the exporter was provided with a reason: <em>%s</em>', 'woocommerce-exporter' ), $message ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woocommerce-exporter' ) . '</a>)';
255
+ else
256
+ $message = __( 'A WordPress or server error caused the exporter to fail, no reason was provided, if this persists please get in touch so we can reproduce and resolve this with you.', 'woocommerce-exporter' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woocommerce-exporter' ) . '</a>)';
257
+ woo_ce_admin_notice_html( $message, 'error' );
258
+ }
259
+
260
+ // Displays a HTML notice where the maximum execution time cannot be set
261
+ if( !woo_ce_get_option( 'dismiss_execution_time_prompt', 0 ) ) {
262
+ $max_execution_time = absint( ini_get( 'max_execution_time' ) );
263
+ $response = @ini_set( 'max_execution_time', 120 );
264
+ if( $response == false || ( $response != $max_execution_time ) ) {
265
+ $dismiss_url = esc_url( add_query_arg( array( 'action' => 'dismiss_execution_time_prompt', '_wpnonce' => wp_create_nonce( 'woo_ce_dismiss_execution_time_prompt' ) ) ) );
266
+ $message = '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woocommerce-exporter' ) . '</a></span>' . sprintf( __( 'We could not override the PHP configuration option <code>max_execution_time</code>, this will limit the size of possible exports. See: <a href="%s" target="_blank">Increasing PHP max_execution_time configuration option</a>', 'woocommerce-exporter' ), $troubleshooting_url );
267
+ woo_ce_admin_notice_html( $message );
268
+ }
269
+ }
270
+
271
+ // Displays a HTML notice where the memory allocated to WordPress falls below 64MB
272
+ if( !woo_ce_get_option( 'dismiss_memory_prompt', 0 ) ) {
273
+ $memory_limit = absint( ini_get( 'memory_limit' ) );
274
+ $minimum_memory_limit = 64;
275
+ if( $memory_limit < $minimum_memory_limit ) {
276
+ $dismiss_url = esc_url( add_query_arg( array( 'action' => 'dismiss_memory_prompt', '_wpnonce' => wp_create_nonce( 'woo_ce_dismiss_memory_prompt' ) ) ) );
277
+ $message = '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woocommerce-exporter' ) . '</a></span>' . sprintf( __( 'We recommend setting memory to at least %dMB, your site has only %dMB allocated to it. See: <a href="%s" target="_blank">Increasing memory allocated to PHP</a>', 'woocommerce-exporter' ), $minimum_memory_limit, $memory_limit, $troubleshooting_url );
278
+ woo_ce_admin_notice_html( $message, 'error' );
279
+ }
280
+ }
281
+
282
+ // Displays a HTML notice if PHP 5.2 or lower is installed
283
+ if( version_compare( phpversion(), '5.3', '<' ) && !woo_ce_get_option( 'dismiss_php_legacy', 0 ) ) {
284
+ $dismiss_url = esc_url( add_query_arg( array( 'action' => 'dismiss_php_legacy', '_wpnonce' => wp_create_nonce( 'woo_ce_dismiss_php_legacy' ) ) ) );
285
+ $message = '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woocommerce-exporter' ) . '</a></span>' . sprintf( __( 'Your PHP version (%s) is not supported and is very much out of date, since 2010 all users are strongly encouraged to upgrade to PHP 5.3+ and above. Contact your hosting provider to make this happen. See: <a href="%s" target="_blank">Migrating from PHP 5.2 to 5.3</a>', 'woocommerce-exporter' ), phpversion(), $troubleshooting_url );
286
+ woo_ce_admin_notice_html( $message, 'error' );
287
+ }
288
+
289
+ // Displays HTML notice if there are more than 2500 Subscriptions
290
+ if( !woo_ce_get_option( 'dismiss_subscription_prompt', 0 ) ) {
291
+ if( class_exists( 'WC_Subscriptions' ) ) {
292
+ $wcs_version = woo_ce_get_wc_subscriptions_version();
293
+ if( version_compare( $wcs_version, '2.0.1', '<' ) ) {
294
+ if( method_exists( 'WC_Subscriptions', 'is_large_site' ) ) {
295
+ // Does this store have roughly more than 3000 Subscriptions
296
+ if( WC_Subscriptions::is_large_site() ) {
297
+ $dismiss_url = esc_url( add_query_arg( array( 'action' => 'dismiss_subscription_prompt', '_wpnonce' => wp_create_nonce( 'woo_ce_dismiss_subscription_prompt' ) ) ) );
298
+ $message = '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woocommerce-exporter' ) . '</a></span>' . __( 'We\'ve detected the <em>is_large_site</em> flag has been set within WooCommerce Subscriptions. Please get in touch if exports are incomplete as we need to spin up an alternative export process to export Subscriptions from large stores.', 'woocommerce-exporter' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woocommerce-exporter' ) . '</a>)';
299
+ woo_ce_admin_notice_html( $message, 'error' );
300
+ }
301
+ }
302
+ }
303
+ }
304
+ }
305
+
306
+ // If the export failed the WordPress Transient will still exist
307
+ if( get_transient( WOO_CE_PREFIX . '_running' ) ) {
308
+ $message = __( 'A WordPress or server error caused the exporter to fail with a blank screen, this is either a memory or timeout issue, please get in touch so we can reproduce and resolve this.', 'woocommerce-exporter' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woocommerce-exporter' ) . '</a>)';
309
+ woo_ce_admin_notice_html( $message, 'error' );
310
+ delete_transient( WOO_CE_PREFIX . '_running' );
311
+ }
312
+ // Displays a HTML notice if Archives is disabled and the Archives tab is opened
313
+ if(
314
+ woo_ce_get_option( 'delete_file', '1' ) == 1
315
+ && ( isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : '' ) == 'archive'
316
+ && ( !woo_ce_get_option( 'dismiss_archives_prompt', 0 ) )
317
+ ) {
318
+ $dismiss_url = esc_url( add_query_arg( array( 'action' => 'dismiss_archives_prompt', '_wpnonce' => wp_create_nonce( 'woo_ce_dismiss_archives_prompt' ) ) ) );
319
+ $override_url = esc_url( add_query_arg( array( 'action' => 'hide_archives_tab', '_wpnonce' => wp_create_nonce( 'woo_ce_hide_archives_tab' ) ) ) );
320
+ $message = '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woocommerce-exporter' ) . '</a></span>' . __( 'It looks like the saving of export archives is disabled from the Enabled Archives option on the Settings tab, would you like to hide the Archives tab aswell?', 'woocommerce-exporter' ) . '<br /><br /><a href="' . $override_url . '" class="button-primary">' . __( 'Hide Archives tab', 'woocommerce-exporter' ) . '</a>';
321
+ woo_ce_admin_notice_html( $message );
322
+ }
323
+
324
+ // Displays a HTML notice if Archives are detected without a Post Status of private
325
+ if( woo_ce_get_unprotected_archives( array( 'count' => true ) ) && !woo_ce_get_option( 'dismiss_archives_privacy_prompt', 0 ) ) {
326
+ $dismiss_url = esc_url( add_query_arg( array( 'action' => 'dismiss_archives_privacy_prompt', '_wpnonce' => wp_create_nonce( 'woo_ce_dismiss_archives_privacy_prompt' ) ) ) );
327
+ $override_url = esc_url( add_query_arg( array( 'action' => 'override_archives_privacy', '_wpnonce' => wp_create_nonce( 'woo_ce_override_archives_privacy' ) ) ) );
328
+ $message = '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woocommerce-exporter' ) . '</a></span>' . __( 'It looks like some archived exports require updating, would you like to hide these archived exports now?', 'woocommerce-exporter' ) . '<br /><br /><a href="' . $override_url . '" class="button-primary">' . __( 'Update export archives', 'woocommerce-exporter' ) . '</a>';
329
+ woo_ce_admin_notice_html( $message );
330
+ }
331
+
332
+ }
333
+
334
+ // Saves the state of Export fields for next export
335
+ function woo_ce_save_fields( $export_type = '', $fields = array(), $sorting = array() ) {
336
+
337
+ // Default fields
338
+ if( $fields == false && !is_array( $fields ) )
339
+ $fields = array();
340
+ $export_types = array_keys( woo_ce_get_export_types() );
341
+ if( in_array( $export_type, $export_types ) && !empty( $fields ) ) {
342
+ woo_ce_update_option( $export_type . '_fields', array_map( 'sanitize_text_field', $fields ) );
343
+ woo_ce_update_option( $export_type . '_sorting', array_map( 'absint', $sorting ) );
344
+ }
345
+
346
+ }
347
+
348
+ // Returns number of an Export type prior to export, used on Store Exporter screen
349
+ function woo_ce_get_export_type_count( $export_type = '', $args = array() ) {
350
+
351
+ global $wpdb;
352
+
353
+ $count_sql = null;
354
+ $woocommerce_version = woo_get_woo_version();
355
+
356
+ switch( $export_type ) {
357
+
358
+ case 'product':
359
+ $count = woo_ce_get_export_type_product_count();
360
+ break;
361
+
362
+ case 'category':
363
+ $count = woo_ce_get_export_type_category_count();
364
+ break;
365
+
366
+ case 'tag':
367
+ $count = woo_ce_get_export_type_tag_count();
368
+ break;
369
+
370
+ case 'order':
371
+ $count = woo_ce_get_export_type_order_count();
372
+ break;
373
+
374
+ case 'customer':
375
+ $count = woo_ce_get_export_type_customer_count();
376
+ break;
377
+
378
+ case 'user':
379
+ $count = woo_ce_get_export_type_user_count();
380
+ break;
381
+
382
+ case 'review':
383
+ $count = woo_ce_get_export_type_review_count();
384
+ break;
385
+
386
+ case 'coupon':
387
+ $count = woo_ce_get_export_type_coupon_count();
388
+ break;
389
+
390
+ case 'shipping_class':
391
+ $count = woo_ce_get_export_type_shipping_class_count();
392
+ break;
393
+
394
+ case 'attribute':
395
+ $count = woo_ce_get_export_type_attribute_count();
396
+ break;
397
+
398
+ // Allow Plugin/Theme authors to populate their own custom export type counts
399
+ default:
400
+ $count = 0;
401
+ $count = apply_filters( 'woo_ce_get_export_type_count', $count, $export_type, $args );
402
+ break;
403
+
404
+ }
405
+ if( isset( $count ) || $count_sql ) {
406
+ if( isset( $count ) ) {
407
+ if( is_object( $count ) ) {
408
+ $count = (array)$count;
409
+ $count = absint( array_sum( $count ) );
410
+ }
411
+ return $count;
412
+ } else {
413
+ if( $count_sql )
414
+ $count = $wpdb->get_var( $count_sql );
415
+ else
416
+ $count = 0;
417
+ }
418
+ return $count;
419
+ } else {
420
+ return 0;
421
+ }
422
+
423
+ }
424
+
425
+ // In-line display of export file and export details when viewed via WordPress Media screen
426
+ function woo_ce_read_export_file( $post = false ) {
427
+
428
+ if( empty( $post ) ) {
429
+ if( isset( $_GET['post'] ) )
430
+ $post = get_post( $_GET['post'] );
431
+ }
432
+
433
+ if( $post->post_type != 'attachment' )
434
+ return;
435
+
436
+ // Check if the Post matches one of our Post Mime Types
437
+ if( !in_array( $post->post_mime_type, array_values( woo_ce_get_mime_types() ) ) )
438
+ return;
439
+
440
+ $filepath = get_attached_file( $post->ID );
441
+
442
+ // We can only read CSV, TSV and XML file types, the others are encoded
443
+ if( in_array( $post->post_mime_type, array( 'text/csv', 'text/tab-separated-values', 'application/xml', 'application/rss+xml' ) ) ) {
444
+
445
+ $contents = __( 'No export entries were found, please try again with different export filters.', 'woocommerce-exporter' );
446
+ if( file_exists( $filepath ) ) {
447
+ $contents = file_get_contents( $filepath );
448
+ } else {
449
+ // This resets the _wp_attached_file Post meta key to the correct value
450
+ update_attached_file( $post->ID, $post->guid );
451
+ // Try grabbing the file contents again
452
+ $filepath = get_attached_file( $post->ID );
453
+ if( file_exists( $filepath ) ) {
454
+ $handle = fopen( $filepath, "r" );
455
+ $contents = stream_get_contents( $handle );
456
+ fclose( $handle );
457
+ }
458
+ }
459
+ if( !empty( $contents ) )
460
+ include_once( WOO_CE_PATH . 'templates/admin/media-csv_file.php' );
461
+
462
+ }
463
+
464
+ // We can still show the Export Details for any supported Post Mime Type
465
+ $export_type = get_post_meta( $post->ID, '_woo_export_type', true );
466
+ $columns = get_post_meta( $post->ID, '_woo_columns', true );
467
+ $rows = get_post_meta( $post->ID, '_woo_rows', true );
468
+ $scheduled_id = get_post_meta( $post->ID, '_scheduled_id', true );
469
+ $start_time = get_post_meta( $post->ID, '_woo_start_time', true );
470
+ $end_time = get_post_meta( $post->ID, '_woo_end_time', true );
471
+ $idle_memory_start = get_post_meta( $post->ID, '_woo_idle_memory_start', true );
472
+ $data_memory_start = get_post_meta( $post->ID, '_woo_data_memory_start', true );
473
+ $data_memory_end = get_post_meta( $post->ID, '_woo_data_memory_end', true );
474
+ $idle_memory_end = get_post_meta( $post->ID, '_woo_idle_memory_end', true );
475
+
476
+ include_once( WOO_CE_PATH . 'templates/admin/media-export_details.php' );
477
+
478
+ }
479
+ add_action( 'edit_form_after_editor', 'woo_ce_read_export_file' );
480
+
481
+ // Returns label of Export type slug used on Store Exporter screen
482
+ function woo_ce_export_type_label( $export_type = '', $echo = false ) {
483
+
484
+ $output = '';
485
+ if( !empty( $export_type ) ) {
486
+ $export_types = woo_ce_get_export_types();
487
+ if( array_key_exists( $export_type, $export_types ) )
488
+ $output = $export_types[$export_type];
489
+ }
490
+ if( $echo )
491
+ echo $output;
492
+ else
493
+ return $output;
494
+
495
+ }
496
+
497
+ // Returns a list of archived exports
498
+ function woo_ce_get_archive_files() {
499
+
500
+ $post_type = 'attachment';
501
+ $meta_key = '_woo_export_type';
502
+ $args = array(
503
+ 'post_type' => $post_type,
504
+ 'post_mime_type' => array_values( woo_ce_get_mime_types() ),
505
+ 'meta_key' => $meta_key,
506
+ 'meta_value' => null,
507
+ 'post_status' => 'any',
508
+ 'posts_per_page' => -1
509
+ );
510
+ if( isset( $_GET['filter'] ) ) {
511
+ $filter = $_GET['filter'];
512
+ if( !empty( $filter ) )
513
+ $args['meta_value'] = $filter;
514
+ }
515
+ $files = get_posts( $args );
516
+ return $files;
517
+
518
+ }
519
+
520
+ function woo_ce_nuke_archive_files() {
521
+
522
+ $post_type = 'attachment';
523
+ $meta_key = '_woo_export_type';
524
+ $args = array(
525
+ 'post_type' => $post_type,
526
+ 'post_mime_type' => array_values( woo_ce_get_mime_types() ),
527
+ 'meta_key' => $meta_key,
528
+ 'meta_value' => null,
529
+ 'post_status' => 'any',
530
+ 'posts_per_page' => -1,
531
+ 'fields' => 'ids'
532
+ );
533
+ $post_query = new WP_Query( $args );
534
+ if( !empty( $post_query->found_posts ) ) {
535
+ foreach( $post_query->posts as $post_ID )
536
+ wp_delete_attachment( $post_ID, true );
537
+ return true;
538
+ }
539
+
540
+ }
541
+
542
+ // Delete all WordPress Options generated by Store Exporter
543
+ function woo_ce_nuke_options() {
544
+
545
+ global $wpdb;
546
+
547
+ $prefix = 'woo_ce_%';
548
+
549
+ // Get a list of WordPress Options prefixed by woo_ce_
550
+ $options_sql = $wpdb->prepare( "SELECT `option_name` FROM `" . $wpdb->prefix . "options` WHERE `option_name` LIKE %s", $prefix );
551
+ $options = $wpdb->get_col( $options_sql );
552
+ if( !empty( $options ) ) {
553
+ $count = 0;
554
+ // Get a count of WordPress Options to be deleted
555
+ $size = count( $options );
556
+ foreach( $options as $option ) {
557
+ // Get a count of deleted WordPress Options
558
+ if( delete_option( $option ) )
559
+ $count++;
560
+ }
561
+ // Compare the count of WordPress Options vs deleted WordPress Options
562
+ if( $count == $size )
563
+ return true;
564
+ }
565
+
566
+ }
567
+
568
+ // Reset all dismissed notices within Store Exporter
569
+ function woo_ce_nuke_dismissed_notices() {
570
+
571
+ global $wpdb;
572
+
573
+ $prefix = 'woo_ce_dismiss_%';
574
+
575
+ // Get a list of WordPress Options prefixed by woo_ce_dismiss_
576
+ $options_sql = $wpdb->prepare( "SELECT `option_name` FROM `" . $wpdb->prefix . "options` WHERE `option_name` LIKE %s", $prefix );
577
+ $options = $wpdb->get_col( $options_sql );
578
+ if( !empty( $options ) ) {
579
+ foreach( $options as $option )
580
+ delete_option( $option );
581
+ }
582
+
583
+ }
584
+
585
+ // Returns a list of Attachments which are exposed to the public
586
+ function woo_ce_get_unprotected_archives( $postarr = array() ) {
587
+
588
+ $post_type = 'attachment';
589
+ $meta_key = '_woo_export_type';
590
+ $args = array(
591
+ 'post_type' => $post_type,
592
+ 'post_mime_type' => array_values( woo_ce_get_mime_types() ),
593
+ 'meta_key' => $meta_key,
594
+ 'post_status' => 'inherit',
595
+ 'posts_per_page' => -1,
596
+ 'fields' => 'ids'
597
+ );
598
+ $args = wp_parse_args( $postarr, $args );
599
+ $post_query = new WP_Query( $args );
600
+ if( !empty( $post_query->found_posts ) ) {
601
+ // Check if we are returning a count or list
602
+ if( isset( $postarr['count'] ) ) {
603
+ return $post_query->found_posts;
604
+ }
605
+ return $post_query->posts;
606
+ }
607
+
608
+ }
609
+
610
+ function woo_ce_update_archives_privacy() {
611
+
612
+ $attachments = woo_ce_get_unprotected_archives();
613
+ if( !empty( $attachments ) ) {
614
+ foreach( $attachments as $post_ID ) {
615
+ $args = array(
616
+ 'ID' => $post_ID,
617
+ 'post_status' => 'private'
618
+ );
619
+ wp_update_post( $args );
620
+ }
621
+ return true;
622
+ }
623
+
624
+ }
625
+
626
+ // Returns an archived export with additional details
627
+ function woo_ce_get_archive_file( $file = '' ) {
628
+
629
+ $upload_dir = wp_upload_dir();
630
+ $file->export_type = get_post_meta( $file->ID, '_woo_export_type', true );
631
+ $file->export_type_label = woo_ce_export_type_label( $file->export_type );
632
+ if( empty( $file->export_type ) )
633
+ $file->export_type = __( 'Unassigned', 'woocommerce-exporter' );
634
+ if( empty( $file->guid ) )
635
+ $file->guid = $upload_dir['url'] . '/' . basename( $file->post_title );
636
+ $file->post_mime_type = get_post_mime_type( $file->ID );
637
+ if( !$file->post_mime_type )
638
+ $file->post_mime_type = __( 'N/A', 'woocommerce-exporter' );
639
+ $file->media_icon = wp_get_attachment_image( $file->ID, array( 80, 60 ), true );
640
+ if( $author_name = get_user_by( 'id', $file->post_author ) )
641
+ $file->post_author_name = $author_name->display_name;
642
+ $file->post_date = woo_ce_format_archive_date( $file->ID );
643
+ unset( $author_name, $t_time, $time );
644
+ return $file;
645
+
646
+ }
647
+
648
+ // HTML template for displaying the current export type filter on the Archives screen
649
+ function woo_ce_archives_quicklink_current( $current = '' ) {
650
+
651
+ $output = '';
652
+ if( isset( $_GET['filter'] ) ) {
653
+ $filter = $_GET['filter'];
654
+ if( $filter == $current )
655
+ $output = ' class="current"';
656
+ } else if( $current == 'all' ) {
657
+ $output = ' class="current"';
658
+ }
659
+ echo $output;
660
+
661
+ }
662
+
663
+ // HTML template for displaying the number of each export type filter on the Archives screen
664
+ function woo_ce_archives_quicklink_count( $type = '' ) {
665
+
666
+ $post_type = 'attachment';
667
+ $meta_key = '_woo_export_type';
668
+ $args = array(
669
+ 'post_type' => $post_type,
670
+ 'meta_key' => $meta_key,
671
+ 'meta_value' => null,
672
+ 'numberposts' => -1,
673
+ 'post_status' => 'any',
674
+ 'fields' => 'ids'
675
+ );
676
+ if( !empty( $type ) )
677
+ $args['meta_value'] = $type;
678
+ $post_query = new WP_Query( $args );
679
+ return absint( $post_query->found_posts );
680
+
681
+ }
682
+
683
+ /* End of: WordPress Administration */
684
+
685
+ }
686
+
687
+ function woo_ce_raise_export_memory_limit() {
688
+
689
+ // Check if WP_MAX_MEMORY_LIMIT is the same as the WP_MEMORY_LIMIT
690
+ if( wp_convert_hr_to_bytes( WP_MAX_MEMORY_LIMIT ) < wp_convert_hr_to_bytes( WP_MEMORY_LIMIT ) ) {
691
+ return WP_MEMORY_LIMIT;
692
+ }
693
+
694
+ }
695
+
696
+ // Export process for CSV file
697
+ function woo_ce_export_dataset( $export_type = null, &$output = null ) {
698
+
699
+ global $export;
700
+
701
+ $separator = $export->delimiter;
702
+ $export->columns = array();
703
+ $export->total_rows = 0;
704
+ $export->total_columns = 0;
705
+
706
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/';
707
+
708
+ set_transient( WOO_CE_PREFIX . '_running', time(), woo_ce_get_option( 'timeout', HOUR_IN_SECONDS ) );
709
+
710
+ // Load up the fatal error notice if we 500 Internal Server Error (memory), hit a server timeout or encounter a fatal PHP error
711
+ add_action( 'shutdown', 'woo_ce_fatal_error' );
712
+
713
+ // Drop in our content filters here
714
+ add_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
715
+ add_filter( 'attribute_escape', 'woo_ce_attribute_escape', 10, 2 );
716
+
717
+ switch( $export_type ) {
718
+
719
+ // Products
720
+ case 'product':
721
+ $fields = woo_ce_get_product_fields( 'summary' );
722
+ if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
723
+ foreach( $export->fields as $key => $field )
724
+ $export->columns[] = woo_ce_get_product_field( $key );
725
+ }
726
+ $export->total_columns = $size = count( $export->columns );
727
+ $export->data_memory_start = woo_ce_current_memory_usage();
728
+ if( $products = woo_ce_get_products( $export->args ) ) {
729
+ $export->total_rows = count( $products );
730
+ // Generate the export headers
731
+ if( in_array( $export->export_format, array( 'csv' ) ) ) {
732
+ for( $i = 0; $i < $size; $i++ ) {
733
+ if( $i == ( $size - 1 ) )
734
+ $output .= woo_ce_escape_csv_value( $export->columns[$i], $export->delimiter, $export->escape_formatting ) . "\n";
735
+ else
736
+ $output .= woo_ce_escape_csv_value( $export->columns[$i], $export->delimiter, $export->escape_formatting ) . $separator;
737
+ }
738
+ }
739
+ $weight_unit = get_option( 'woocommerce_weight_unit' );
740
+ $dimension_unit = get_option( 'woocommerce_dimension_unit' );
741
+ $height_unit = $dimension_unit;
742
+ $width_unit = $dimension_unit;
743
+ $length_unit = $dimension_unit;
744
+ if( !empty( $export->fields ) ) {
745
+ foreach( $products as $product ) {
746
+
747
+ $product = woo_ce_get_product_data( $product, $export->args );
748
+ foreach( $export->fields as $key => $field ) {
749
+ if( isset( $product->$key ) ) {
750
+ if( is_array( $field ) ) {
751
+ foreach( $field as $array_key => $array_value ) {
752
+ if( !is_array( $array_value ) ) {
753
+ if( in_array( $export->export_format, array( 'csv' ) ) )
754
+ $output .= woo_ce_escape_csv_value( $array_value, $export->delimiter, $export->escape_formatting );
755
+ }
756
+ }
757
+ } else {
758
+ if( in_array( $export->export_format, array( 'csv' ) ) )
759
+ $output .= woo_ce_escape_csv_value( $product->$key, $export->delimiter, $export->escape_formatting );
760
+ }
761
+ }
762
+ if( in_array( $export->export_format, array( 'csv' ) ) )
763
+ $output .= $separator;
764
+ }
765
+
766
+ if( in_array( $export->export_format, array( 'csv' ) ) )
767
+ $output = substr( $output, 0, -1 ) . "\n";
768
+ }
769
+ }
770
+ unset( $products, $product );
771
+ }
772
+ $export->data_memory_end = woo_ce_current_memory_usage();
773
+ break;
774
+
775
+ // Categories
776
+ case 'category':
777
+ $fields = woo_ce_get_category_fields( 'summary' );
778
+ if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
779
+ foreach( $export->fields as $key => $field )
780
+ $export->columns[] = woo_ce_get_category_field( $key );
781
+ }
782
+ $export->total_columns = $size = count( $export->columns );
783
+ $export->data_memory_start = woo_ce_current_memory_usage();
784
+ $category_args = array(
785
+ 'orderby' => ( isset( $export->args['category_orderby'] ) ? $export->args['category_orderby'] : 'ID' ),
786
+ 'order' => ( isset( $export->args['category_order'] ) ? $export->args['category_order'] : 'ASC' ),
787
+ );
788
+ if( $categories = woo_ce_get_product_categories( $category_args ) ) {
789
+ $export->total_rows = count( $categories );
790
+ // Generate the export headers
791
+ if( in_array( $export->export_format, array( 'csv' ) ) ) {
792
+ for( $i = 0; $i < $size; $i++ ) {
793
+ if( $i == ( $size - 1 ) )
794
+ $output .= woo_ce_escape_csv_value( $export->columns[$i], $export->delimiter, $export->escape_formatting ) . "\n";
795
+ else
796
+ $output .= woo_ce_escape_csv_value( $export->columns[$i], $export->delimiter, $export->escape_formatting ) . $separator;
797
+ }
798
+ }
799
+ if( !empty( $export->fields ) ) {
800
+ foreach( $categories as $category ) {
801
+
802
+ foreach( $export->fields as $key => $field ) {
803
+ if( isset( $category->$key ) ) {
804
+ if( in_array( $export->export_format, array( 'csv' ) ) )
805
+ $output .= woo_ce_escape_csv_value( $category->$key, $export->delimiter, $export->escape_formatting );
806
+ }
807
+ if( in_array( $export->export_format, array( 'csv' ) ) )
808
+ $output .= $separator;
809
+ }
810
+ if( in_array( $export->export_format, array( 'csv' ) ) )
811
+ $output = substr( $output, 0, -1 ) . "\n";
812
+ }
813
+ }
814
+ unset( $categories, $category );
815
+ }
816
+ $export->data_memory_end = woo_ce_current_memory_usage();
817
+ break;
818
+
819
+ // Tags
820
+ case 'tag':
821
+ $fields = woo_ce_get_tag_fields( 'summary' );
822
+ if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
823
+ foreach( $export->fields as $key => $field )
824
+ $export->columns[] = woo_ce_get_tag_field( $key );
825
+ }
826
+ $export->total_columns = $size = count( $export->columns );
827
+ $export->data_memory_start = woo_ce_current_memory_usage();
828
+ $tag_args = array(
829
+ 'orderby' => ( isset( $export->args['tag_orderby'] ) ? $export->args['tag_orderby'] : 'ID' ),
830
+ 'order' => ( isset( $export->args['tag_order'] ) ? $export->args['tag_order'] : 'ASC' ),
831
+ );
832
+ if( $tags = woo_ce_get_product_tags( $tag_args ) ) {
833
+ $export->total_rows = count( $tags );
834
+ // Generate the export headers
835
+ if( in_array( $export->export_format, array( 'csv' ) ) ) {
836
+ for( $i = 0; $i < $size; $i++ ) {
837
+ if( $i == ( $size - 1 ) )
838
+ $output .= woo_ce_escape_csv_value( $export->columns[$i], $export->delimiter, $export->escape_formatting ) . "\n";
839
+ else
840
+ $output .= woo_ce_escape_csv_value( $export->columns[$i], $export->delimiter, $export->escape_formatting ) . $separator;
841
+ }
842
+ }
843
+ if( !empty( $export->fields ) ) {
844
+ foreach( $tags as $tag ) {
845
+
846
+ foreach( $export->fields as $key => $field ) {
847
+ if( isset( $tag->$key ) ) {
848
+ if( in_array( $export->export_format, array( 'csv' ) ) )
849
+ $output .= woo_ce_escape_csv_value( $tag->$key, $export->delimiter, $export->escape_formatting );
850
+ }
851
+ if( in_array( $export->export_format, array( 'csv' ) ) )
852
+ $output .= $separator;
853
+ }
854
+ if( in_array( $export->export_format, array( 'csv' ) ) )
855
+ $output = substr( $output, 0, -1 ) . "\n";
856
+ }
857
+ }
858
+ unset( $tags, $tag );
859
+ }
860
+ $export->data_memory_end = woo_ce_current_memory_usage();
861
+ break;
862
+
863
+ // Users
864
+ case 'user':
865
+ $fields = woo_ce_get_user_fields( 'summary' );
866
+ if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
867
+ foreach( $export->fields as $key => $field )
868
+ $export->columns[] = woo_ce_get_user_field( $key );
869
+ }
870
+ $export->total_columns = $size = count( $export->columns );
871
+ $export->data_memory_start = woo_ce_current_memory_usage();
872
+ if( $users = woo_ce_get_users( $export->args ) ) {
873
+ // Generate the export headers
874
+ if( in_array( $export->export_format, array( 'csv' ) ) ) {
875
+ $i = 0;
876
+ foreach( $export->columns as $column ) {
877
+ if( $i == ( $size - 1 ) )
878
+ $output .= woo_ce_escape_csv_value( $column, $export->delimiter, $export->escape_formatting ) . "\n";
879
+ else
880
+ $output .= woo_ce_escape_csv_value( $column, $export->delimiter, $export->escape_formatting ) . $separator;
881
+ $i++;
882
+ }
883
+ }
884
+ if( !empty( $export->fields ) ) {
885
+ foreach( $users as $user ) {
886
+
887
+ $user = woo_ce_get_user_data( $user, $export->args );
888
+
889
+ foreach( $export->fields as $key => $field ) {
890
+ if( isset( $user->$key ) ) {
891
+ if( in_array( $export->export_format, array( 'csv' ) ) )
892
+ $output .= woo_ce_escape_csv_value( $user->$key, $export->delimiter, $export->escape_formatting );
893
+ }
894
+ if( in_array( $export->export_format, array( 'csv' ) ) )
895
+ $output .= $separator;
896
+ }
897
+ if( in_array( $export->export_format, array( 'csv' ) ) )
898
+ $output = substr( $output, 0, -1 ) . "\n";
899
+
900
+ }
901
+ }
902
+ unset( $users, $user );
903
+ }
904
+ $export->data_memory_end = woo_ce_current_memory_usage();
905
+ break;
906
+
907
+ }
908
+
909
+ // Remove our content filters here to play nice with other Plugins
910
+ remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
911
+ remove_filter( 'attribute_escape', 'woo_ce_attribute_escape' );
912
+
913
+ // Remove our fatal error notice so not to conflict with the CRON or scheduled export engine
914
+ remove_action( 'shutdown', 'woo_ce_fatal_error' );
915
+
916
+ // Export completed successfully
917
+ delete_transient( WOO_CE_PREFIX . '_running' );
918
+
919
+ // Check that the export file is populated, export columns have been assigned and rows counted
920
+ if( $output && $export->total_rows && $export->total_columns ) {
921
+ if( in_array( $export->export_format, array( 'csv' ) ) ) {
922
+ $output = woo_ce_file_encoding( $output );
923
+ if( $export->export_format == 'csv' && $export->bom && ( WOO_CE_DEBUG == false ) )
924
+ $output = "\xEF\xBB\xBF" . $output;
925
+ }
926
+ if( WOO_CE_DEBUG && !$export->cron ) {
927
+ $response = set_transient( WOO_CE_PREFIX . '_debug_log', base64_encode( $output ), woo_ce_get_option( 'timeout', MINUTE_IN_SECONDS ) );
928
+ if( $response !== true ) {
929
+ $message = __( 'The export contents were too large to store in a single WordPress transient, use the Volume offset / Limit volume options to reduce the size of your export and try again.', 'woocommerce-exporter' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woocommerce-exporter' ) . '</a>)';
930
+ if( function_exists( 'woo_ce_admin_notice' ) )
931
+ woo_ce_admin_notice( $message, 'error' );
932
+ else
933
+ error_log( sprintf( '[store-exporter] woo_ce_export_dataset() - %s', $message ) );
934
+ }
935
+ } else {
936
+ return $output;
937
+ }
938
+ }
939
+
940
+ }
941
+
942
+ function woo_ce_fatal_error() {
943
+
944
+ global $export;
945
+
946
+ $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter/usage/';
947
+
948
+ $error = error_get_last();
949
+ if( $error !== null ) {
950
+ $message = '';
951
+ $notice = sprintf( __( 'Refer to the following error and contact us on http://wordpress.org/plugins/woocommerce-exporter/ for further assistance. Error: <code>%s</code>', 'woocommerce-exporter' ), $error['message'] );
952
+ if ( substr( $error['message'], 0, 22 ) === 'Maximum execution time' ) {
953
+ $message = __( 'The server\'s maximum execution time is too low to complete this export. This is commonly due to a low timeout limit set by your hosting provider or PHP Safe Mode being enabled.', 'woocommerce-exporter' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woocommerce-exporter' ) . '</a>)';
954
+ } elseif ( substr( $error['message'], 0, 19 ) === 'Allowed memory size' ) {
955
+ $message = __( 'The server\'s maximum memory size is too low to complete this export. Consider increasing available memory to WordPress or reducing the size of your export.', 'woocommerce-exporter' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woocommerce-exporter' ) . '</a>)';
956
+ } else if( $error['type'] === E_ERROR ) {
957
+ // Test if it's WP All Import conflicting with the PHPExcel library
958
+ if( substr( $error['message'], 0, 33 ) == "Class 'PHPExcel_Writer_Excel2007'" && ( strstr( $error['file'], 'wp-all-import' ) !== false ) ) {
959
+ $message = __( 'A fatal PHP error was encountered during the export process, this was due to the Plugin WP All Import pre-loading the PHPExcel library. Contact the Plugin author Soflyy for more information.', 'woocommerce-exporter' );
960
+ } else {
961
+ $message = __( 'A fatal PHP error was encountered during the export process, we couldn\'t detect or diagnose it further.', 'woocommerce-exporter' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woocommerce-exporter' ) . '</a>)';
962
+ }
963
+ }
964
+ if( !empty( $message ) ) {
965
+
966
+ // Save a record to the PHP error log
967
+ woo_ce_error_log( sprintf( __( 'Fatal error: %s - PHP response: %s in %s on line %s', 'woocommerce-exporter' ), $message, $error['message'], $error['file'], $error['line'] ) );
968
+ error_log( sprintf( __( 'Fatal error: %s - PHP response: %s in %s on line %s', 'woocommerce-exporter' ), $message, $error['message'], $error['file'], $error['line'] ) );
969
+
970
+ // Only display the message if this is a manual export
971
+ if( ( !$export->cron && !$export->scheduled_export ) ) {
972
+ $output = '<div id="message" class="error"><p>' . sprintf( __( '<strong>[store-exporter]</strong> An unexpected error occurred. %s', 'woocommerce-exporter' ), $message ) . '</p><p>' . $notice . '</p></div>';
973
+ echo $output;
974
+ }
975
+
976
+ }
977
+ }
978
+
979
+ }
980
+
981
+ // List of Export types used on Store Exporter screen
982
+ function woo_ce_get_export_types() {
983
+
984
+ $types = array(
985
+ 'product' => __( 'Products', 'woocommerce-exporter' ),
986
+ 'category' => __( 'Categories', 'woocommerce-exporter' ),
987
+ 'tag' => __( 'Tags', 'woocommerce-exporter' ),
988
+ 'user' => __( 'Users', 'woocommerce-exporter' )
989
+ );
990
+ $types = apply_filters( 'woo_ce_export_types', $types );
991
+ return $types;
992
+
993
+ }
994
+
995
+ // Returns the Post object of the export file saved as an attachment to the WordPress Media library
996
+ function woo_ce_save_file_attachment( $filename = '', $post_mime_type = 'text/csv' ) {
997
+
998
+ if( !empty( $filename ) ) {
999
+ $post_type = 'woo-export';
1000
+ $args = array(
1001
+ 'post_status' => 'private',
1002
+ 'post_title' => $filename,
1003
+ 'post_type' => $post_type,
1004
+ 'post_mime_type' => $post_mime_type
1005
+ );
1006
+ $post_ID = wp_insert_attachment( $args, $filename );
1007
+ if( is_wp_error( $post_ID ) )
1008
+ woo_ce_error_log( sprintf( 'save_file_attachment() - $s: %s', $filename, $result->get_error_message() ) );
1009
+ else
1010
+ return $post_ID;
1011
+ }
1012
+
1013
+ }
1014
+
1015
+ // Updates the GUID of the export file attachment to match the correct file URL
1016
+ function woo_ce_save_file_guid( $post_ID, $export_type, $upload_url = '' ) {
1017
+
1018
+ add_post_meta( $post_ID, '_woo_export_type', $export_type );
1019
+ if( !empty( $upload_url ) ) {
1020
+ $args = array(
1021
+ 'ID' => $post_ID,
1022
+ 'guid' => $upload_url
1023
+ );
1024
+ wp_update_post( $args );
1025
+ }
1026
+
1027
+ }
1028
+
1029
+ // Save critical export details against the archived export
1030
+ function woo_ce_save_file_details( $post_ID ) {
1031
+
1032
+ global $export;
1033
+
1034
+ add_post_meta( $post_ID, '_woo_start_time', $export->start_time );
1035
+ add_post_meta( $post_ID, '_woo_idle_memory_start', $export->idle_memory_start );
1036
+ add_post_meta( $post_ID, '_woo_columns', $export->total_columns );
1037
+ add_post_meta( $post_ID, '_woo_rows', $export->total_rows );
1038
+ add_post_meta( $post_ID, '_woo_data_memory_start', $export->data_memory_start );
1039
+ add_post_meta( $post_ID, '_woo_data_memory_end', $export->data_memory_end );
1040
+
1041
+ }
1042
+
1043
+ // Update detail of existing archived export
1044
+ function woo_ce_update_file_detail( $post_ID, $detail, $value ) {
1045
+
1046
+ if( strstr( $detail, '_woo_' ) !== false )
1047
+ update_post_meta( $post_ID, $detail, $value );
1048
+
1049
+ }
1050
+
1051
+ // Returns a list of allowed Export type statuses, can be overridden on a per-Export type basis
1052
+ function woo_ce_post_statuses( $extra_status = array(), $override = false ) {
1053
+
1054
+ $output = array(
1055
+ 'publish',
1056
+ 'pending',
1057
+ 'draft',
1058
+ 'future',
1059
+ 'private',
1060
+ 'trash'
1061
+ );
1062
+ if( $override ) {
1063
+ $output = $extra_status;
1064
+ } else {
1065
+ if( $extra_status )
1066
+ $output = array_merge( $output, $extra_status );
1067
+ }
1068
+ return $output;
1069
+
1070
+ }
1071
+
1072
+ function woo_ce_get_mime_types() {
1073
+
1074
+ $mime_types = array(
1075
+ 'csv' => 'text/csv',
1076
+ 'tsv' => 'text/tab-separated-values',
1077
+ 'xls' => 'application/vnd.ms-excel',
1078
+ 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
1079
+ 'xml' => 'application/xml',
1080
+ 'rss' => 'application/rss+xml'
1081
+ );
1082
+ return $mime_types;
1083
+
1084
+ }
1085
+
1086
+ function woo_ce_get_mime_type_extension( $mime_type, $search_by = 'extension' ) {
1087
+
1088
+ $mime_types = woo_ce_get_mime_types();
1089
+ if( $search_by == 'extension' ) {
1090
+ if( isset( $mime_types[$mime_type] ) )
1091
+ return $mime_types[$mime_type];
1092
+ } else if( $search_by == 'mime_type' ) {
1093
+ if( $key = array_search( $mime_type, $mime_types ) )
1094
+ return strtoupper( $key );
1095
+ }
1096
+
1097
+ }
1098
+
1099
+ function woo_ce_add_missing_mime_type( $mime_types = array() ) {
1100
+
1101
+ // Add CSV mime type if it has been removed
1102
+ if( !isset( $mime_types['csv'] ) )
1103
+ $mime_types['csv'] = 'text/csv';
1104
+ // Add TSV mime type if it has been removed
1105
+ if( !isset( $mime_types['tsv'] ) )
1106
+ $mime_types['tsv'] = 'text/tab-separated-values';
1107
+ // Add XLS mime type if it has been removed
1108
+ if( !isset( $mime_types['xls'] ) )
1109
+ $mime_types['xls'] = 'application/vnd.ms-excel';
1110
+ // Add XLSX mime type if it has been removed
1111
+ if( !isset( $mime_types['xlsx'] ) )
1112
+ $mime_types['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1113
+ // Add XML mime type if it has been removed
1114
+ if( !isset( $mime_types['xml'] ) )
1115
+ $mime_types['xml'] = 'application/xml';
1116
+ // Add RSS mime type if it has been removed
1117
+ if( !isset( $mime_types['rss'] ) )
1118
+ $mime_types['rss'] = 'application/rss+xml';
1119
+ return $mime_types;
1120
+
1121
+ }
1122
+ add_filter( 'upload_mimes', 'woo_ce_add_missing_mime_type' );
1123
+
1124
+ if( !function_exists( 'woo_ce_sort_fields' ) ) {
1125
+ function woo_ce_sort_fields( $key ) {
1126
+
1127
+ return $key;
1128
+
1129
+ }
1130
+ }
1131
+
1132
+ // Add Store Export to filter types on the WordPress Media screen
1133
+ function woo_ce_add_post_mime_type( $post_mime_types = array() ) {
1134
+
1135
+ $post_mime_types['text/csv'] = array( __( 'Store Exports (CSV)', 'woocommerce-exporter' ), __( 'Manage Store Exports (CSV)', 'woocommerce-exporter' ), _n_noop( 'Store Export - CSV <span class="count">(%s)</span>', 'Store Exports - CSV <span class="count">(%s)</span>' ) );
1136
+ return $post_mime_types;
1137
+
1138
+ }
1139
+ add_filter( 'post_mime_types', 'woo_ce_add_post_mime_type' );
1140
+
1141
+ function woo_ce_current_memory_usage() {
1142
+
1143
+ $output = '';
1144
+ if( function_exists( 'memory_get_usage' ) )
1145
+ $output = round( memory_get_usage( true ) / 1024 / 1024, 2 );
1146
+ return $output;
1147
+
1148
+ }
1149
+
1150
+ function woo_ce_get_start_of_week_day() {
1151
+
1152
+ global $wp_locale;
1153
+
1154
+ $output = 'Monday';
1155
+ $start_of_week = get_option( 'start_of_week', 0 );
1156
+ for( $day_index = 0; $day_index <= 6; $day_index++ ) {
1157
+ if( $start_of_week == $day_index ) {
1158
+ $output = $wp_locale->get_weekday( $day_index );
1159
+ break;
1160
+ }
1161
+ }
1162
+ return $output;
1163
+
1164
+ }
1165
+
1166
+ function woo_ce_detect_product_brands() {
1167
+
1168
+ if( class_exists( 'WC_Brands' ) || class_exists( 'woo_brands' ) || taxonomy_exists( apply_filters( 'woo_ce_brand_term_taxonomy', 'product_brand' ) ) )
1169
+ return true;
1170
+
1171
+ }
1172
+
1173
+ // Return whether WPML exists
1174
+ function woo_ce_detect_wpml() {
1175
+
1176
+ if( defined( 'ICL_LANGUAGE_CODE' ) )
1177
+ return true;
1178
+
1179
+ }
1180
+
1181
+ // List of WordPress Plugins that Store Exporter integrates with
1182
+ function woo_ce_modules_list( $module_status = false ) {
1183
+
1184
+ $modules = array();
1185
+ $modules[] = array(
1186
+ 'name' => 'aioseop',
1187
+ 'title' => __( 'All in One SEO Pack', 'woocommerce-exporter' ),
1188
+ 'description' => __( 'Optimize your WooCommerce Products for Search Engines. Requires Store Toolkit for All in One SEO Pack integration.', 'woocommerce-exporter' ),
1189
+ 'url' => 'http://wordpress.org/extend/plugins/all-in-one-seo-pack/',
1190
+ 'slug' => 'all-in-one-seo-pack',
1191
+ 'function' => 'aioseop_activate'
1192
+ );
1193
+ $modules[] = array(
1194
+ 'name' => 'store_toolkit',
1195
+ 'title' => __( 'Store Toolkit', 'woocommerce-exporter' ),
1196
+ 'description' => __( 'Store Toolkit includes a growing set of commonly-used WooCommerce administration tools aimed at web developers and store maintainers.', 'woocommerce-exporter' ),
1197
+ 'url' => 'http://wordpress.org/extend/plugins/woocommerce-store-toolkit/',
1198
+ 'slug' => 'woocommerce-store-toolkit',
1199
+ 'function' => 'woo_st_admin_init'
1200
+ );
1201
+ $modules[] = array(
1202
+ 'name' => 'ultimate_seo',
1203
+ 'title' => __( 'SEO Ultimate', 'woocommerce-exporter' ),
1204
+ 'description' => __( 'This all-in-one SEO plugin gives you control over Product details.', 'woocommerce-exporter' ),
1205
+ 'url' => 'http://wordpress.org/extend/plugins/seo-ultimate/',
1206
+ 'slug' => 'seo-ultimate',
1207
+ 'function' => 'su_wp_incompat_notice'
1208
+ );
1209
+ $modules[] = array(
1210
+ 'name' => 'gpf',
1211
+ 'title' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' ),
1212
+ 'description' => __( 'Easily configure data to be added to your Google Merchant Centre feed.', 'woocommerce-exporter' ),
1213
+ 'url' => 'http://www.leewillis.co.uk/wordpress-plugins/',
1214
+ 'function' => 'woocommerce_gpf_install'
1215
+ );
1216
+ $modules[] = array(
1217
+ 'name' => 'wpseo',
1218
+ 'title' => __( 'Yoast SEO', 'woocommerce-exporter' ),
1219
+ 'description' => __( 'The first true all-in-one SEO solution for WordPress. Formally WordPress SEO.', 'woocommerce-exporter' ),
1220
+ 'url' => 'http://yoast.com/wordpress/seo/#utm_source=wpadmin&utm_medium=plugin&utm_campaign=wpseoplugin',
1221
+ 'slug' => 'wordpress-seo',
1222
+ 'function' => 'wpseo_admin_init'
1223
+ );
1224
+ $modules[] = array(
1225
+ 'name' => 'wpseo_wc',
1226
+ 'title' => __( 'Yoast SEO: WooCommerce', 'woocommerce-exporter' ),
1227
+ 'description' => __( 'This extension to WooCommerce and WordPress SEO by Yoast makes sure there\'s perfect communication between the two plugins.', 'woocommerce-exporter' ),
1228
+ 'url' => 'https://yoast.com/wordpress/plugins/yoast-woocommerce-seo/',
1229
+ 'function' => 'initialize_yoast_woocommerce_seo'
1230
+ );
1231
+ $modules[] = array(
1232
+ 'name' => 'wc_msrp',
1233
+ 'title' => __( 'WooCommerce MSRP Pricing', 'woocommerce-exporter' ),
1234
+ 'description' => __( 'Define and display MSRP prices (Manufacturer\'s suggested retail price) to your customers.', 'woocommerce-exporter' ),
1235
+ 'url' => 'http://www.woothemes.com/products/msrp-pricing/',
1236
+ 'function' => 'woocommerce_msrp_activate'
1237
+ );
1238
+ $modules[] = array(
1239
+ 'name' => 'wc_brands',
1240
+ 'title' => __( 'WooCommerce Brands Addon', 'woocommerce-exporter' ),
1241
+ 'description' => __( 'Create, assign and list brands for products, and allow customers to filter by brand.', 'woocommerce-exporter' ),
1242
+ 'url' => 'http://www.woothemes.com/products/brands/',
1243
+ 'class' => 'WC_Brands'
1244
+ );
1245
+ $modules[] = array(
1246
+ 'name' => 'wc_cog',
1247
+ 'title' => __( 'Cost of Goods', 'woocommerce-exporter' ),
1248
+ 'description' => __( 'Easily track total profit and cost of goods by adding a Cost of Good field to simple and variable products.', 'woocommerce-exporter' ),
1249
+ 'url' => 'http://www.skyverge.com/product/woocommerce-cost-of-goods-tracking/',
1250
+ 'class' => 'WC_COG'
1251
+ );
1252
+ $modules[] = array(
1253
+ 'name' => 'per_product_shipping',
1254
+ 'title' => __( 'Per Product Shipping', 'woocommerce-exporter' ),
1255
+ 'description' => __( 'Define separate shipping costs per product which are combined at checkout to provide a total shipping cost.', 'woocommerce-exporter' ),
1256
+ 'url' => 'http://www.woothemes.com/products/per-product-shipping/',
1257
+ 'class' => 'WC_Shipping_Per_Product_Init'
1258
+ );
1259
+ $modules[] = array(
1260
+ 'name' => 'vendors',
1261
+ 'title' => __( 'Product Vendors', 'woocommerce-exporter' ),
1262
+ 'description' => __( 'Turn your store into a multi-vendor marketplace (such as Etsy or Creative Market).', 'woocommerce-exporter' ),
1263
+ 'url' => 'http://www.woothemes.com/products/product-vendors/',
1264
+ 'class' => 'WC_Product_Vendors'
1265
+ );
1266
+ $modules[] = array(
1267
+ 'name' => 'wc_vendors',
1268
+ 'title' => __( 'WC Vendors', 'woocommerce-exporter' ),
1269
+ 'description' => __( 'Allow vendors to sell their own products and receive a commission for each sale.', 'woocommerce-exporter' ),
1270
+ 'url' => 'http://wcvendors.com',
1271
+ 'class' => 'WC_Vendors'
1272
+ );
1273
+ $modules[] = array(
1274
+ 'name' => 'acf',
1275
+ 'title' => __( 'Advanced Custom Fields', 'woocommerce-exporter' ),
1276
+ 'description' => __( 'Powerful fields for WordPress developers.', 'woocommerce-exporter' ),
1277
+ 'url' => 'http://www.advancedcustomfields.com',
1278
+ 'class' => 'acf'
1279
+ );
1280
+ $modules[] = array(
1281
+ 'name' => 'product_addons',
1282
+ 'title' => __( 'Product Add-ons', 'woocommerce-exporter' ),
1283
+ 'description' => __( 'Allow your customers to customise your products by adding input boxes, dropdowns or a field set of checkboxes.', 'woocommerce-exporter' ),
1284
+ 'url' => 'http://www.woothemes.com/products/product-add-ons/',
1285
+ 'class' => array( 'Product_Addon_Admin', 'Product_Addon_Display' )
1286
+ );
1287
+ $modules[] = array(
1288
+ 'name' => 'seq',
1289
+ 'title' => __( 'WooCommerce Sequential Order Numbers', 'woocommerce-exporter' ),
1290
+ 'description' => __( 'This plugin extends the WooCommerce e-commerce plugin by setting sequential order numbers for new orders.', 'woocommerce-exporter' ),
1291
+ 'url' => 'https://wordpress.org/plugins/woocommerce-sequential-order-numbers/',
1292
+ 'slug' => 'woocommerce-sequential-order-numbers',
1293
+ 'class' => 'WC_Seq_Order_Number'
1294
+ );
1295
+ $modules[] = array(
1296
+ 'name' => 'seq_pro',
1297
+ 'title' => __( 'WooCommerce Sequential Order Numbers Pro', 'woocommerce-exporter' ),
1298
+ 'description' => __( 'Tame your WooCommerce Order Numbers.', 'woocommerce-exporter' ),
1299
+ 'url' => 'http://www.woothemes.com/products/sequential-order-numbers-pro/',
1300
+ 'class' => 'WC_Seq_Order_Number_Pro'
1301
+ );
1302
+ $modules[] = array(
1303
+ 'name' => 'print_invoice_delivery_note',
1304
+ 'title' => __( 'WooCommerce Print Invoice & Delivery Note', 'woocommerce-exporter' ),
1305
+ 'description' => __( 'Print invoices and delivery notes for WooCommerce orders.', 'woocommerce-exporter' ),
1306
+ 'url' => 'http://wordpress.org/plugins/woocommerce-delivery-notes/',
1307
+ 'slug' => 'woocommerce-delivery-notes',
1308
+ 'class' => 'WooCommerce_Delivery_Notes'
1309
+ );
1310
+ $modules[] = array(
1311
+ 'name' => 'pdf_invoices_packing_slips',
1312
+ 'title' => __( 'WooCommerce PDF Invoices & Packing Slips', 'woocommerce-exporter' ),
1313
+ 'description' => __( 'Create, print & automatically email PDF invoices & packing slips for WooCommerce orders.', 'woocommerce-exporter' ),
1314
+ 'url' => 'https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/',
1315
+ 'slug' => 'woocommerce-pdf-invoices-packing-slips',
1316
+ 'class' => 'WooCommerce_PDF_Invoices'
1317
+ );
1318
+ $modules[] = array(
1319
+ 'name' => 'checkout_manager',
1320
+ 'title' => __( 'WooCommerce Checkout Manager & WooCommerce Checkout Manager Pro', 'woocommerce-exporter' ),
1321
+ 'description' => __( 'Manages the WooCommerce Checkout page and WooCommerce Checkout processes.', 'woocommerce-exporter' ),
1322
+ 'url' => 'http://wordpress.org/plugins/woocommerce-checkout-manager/',
1323
+ 'slug' => 'woocommerce-checkout-manager',
1324
+ 'function' => array( 'wccs_install', 'wooccm_install', 'wccs_install_pro' )
1325
+ );
1326
+ $modules[] = array(
1327
+ 'name' => 'wc_pgsk',
1328
+ 'title' => __( 'Poor Guys Swiss Knife', 'woocommerce-exporter' ),
1329
+ 'description' => __( 'A Swiss Knife for WooCommerce.', 'woocommerce-exporter' ),
1330
+ 'url' => 'http://wordpress.org/plugins/woocommerce-poor-guys-swiss-knife/',
1331
+ 'slug' => 'woocommerce-poor-guys-swiss-knife',
1332
+ 'function' => 'wcpgsk_init'
1333
+ );
1334
+ $modules[] = array(
1335
+ 'name' => 'checkout_field_editor',
1336
+ 'title' => __( 'Checkout Field Editor', 'woocommerce-exporter' ),
1337
+ 'description' => __( 'Add, edit and remove fields shown on your WooCommerce checkout page.', 'woocommerce-exporter' ),
1338
+ 'url' => 'http://www.woothemes.com/products/woocommerce-checkout-field-editor/',
1339
+ 'function' => 'woocommerce_init_checkout_field_editor'
1340
+ );
1341
+ $modules[] = array(
1342
+ 'name' => 'checkout_field_manager',
1343
+ 'title' => __( 'Checkout Field Manager', 'woocommerce-exporter' ),
1344
+ 'description' => __( 'Quickly and effortlessly add, remove and re-orders fields in the checkout process.', 'woocommerce-exporter' ),
1345
+ 'url' => 'http://61extensions.com/shop/woocommerce-checkout-field-manager/',
1346
+ 'function' => 'sod_woocommerce_checkout_manager_settings'
1347
+ );
1348
+ $modules[] = array(
1349
+ 'name' => 'checkout_addons',
1350
+ 'title' => __( 'WooCommerce Checkout Add-Ons', 'woocommerce-exporter' ),
1351
+ 'description' => __( 'Add fields at checkout for add-on products and services while optionally setting a cost for each add-on.', 'woocommerce-exporter' ),
1352
+ 'url' => 'http://www.skyverge.com/product/woocommerce-checkout-add-ons/',
1353
+ 'function' => 'init_woocommerce_checkout_add_ons'
1354
+ );
1355
+ $modules[] = array(
1356
+ 'name' => 'local_pickup_plus',
1357
+ 'title' => __( 'Local Pickup Plus', 'woocommerce-exporter' ),
1358
+ 'description' => __( 'Let customers pick up products from specific locations.', 'woocommerce-exporter' ),
1359
+ 'url' => 'http://www.woothemes.com/products/local-pickup-plus/',
1360
+ 'class' => 'WC_Local_Pickup_Plus'
1361
+ );
1362
+ $modules[] = array(
1363
+ 'name' => 'gravity_forms',
1364
+ 'title' => __( 'Gravity Forms', 'woocommerce-exporter' ),
1365
+ 'description' => __( 'Gravity Forms is hands down the best contact form plugin for WordPress powered websites.', 'woocommerce-exporter' ),
1366
+ 'url' => 'http://www.gravityforms.com/',
1367
+ 'class' => 'RGForms'
1368
+ );
1369
+ $modules[] = array(
1370
+ 'name' => 'woocommerce_gravity_forms',
1371
+ 'title' => __( 'WooCommerce Gravity Forms Product Add-Ons', 'woocommerce-exporter' ),
1372
+ 'description' => __( 'Allows you to use Gravity Forms on individual WooCommerce products.', 'woocommerce-exporter' ),
1373
+ 'url' => 'https://www.woothemes.com/products/gravity-forms-add-ons/',
1374
+ 'class' => array( 'woocommerce_gravityforms', 'WC_GFPA_Main' )
1375
+ );
1376
+ $modules[] = array(
1377
+ 'name' => 'currency_switcher',
1378
+ 'title' => __( 'WooCommerce Currency Switcher', 'woocommerce-exporter' ),
1379
+ 'description' => __( 'Currency Switcher for WooCommerce allows your shop to display prices and accept payments in multiple currencies.', 'woocommerce-exporter' ),
1380
+ 'url' => 'http://aelia.co/shop/currency-switcher-woocommerce/',
1381
+ 'class' => 'WC_Aelia_CurrencySwitcher'
1382
+ );
1383
+ $modules[] = array(
1384
+ 'name' => 'subscriptions',
1385
+ 'title' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
1386
+ 'description' => __( 'WC Subscriptions makes it easy to create and manage products with recurring payments.', 'woocommerce-exporter' ),
1387
+ 'url' => 'http://www.woothemes.com/products/woocommerce-subscriptions/',
1388
+ 'class' => array( 'WC_Subscriptions', 'WC_Subscriptions_Manager' )
1389
+ );
1390
+ $modules[] = array(
1391
+ 'name' => 'extra_product_options',
1392
+ 'title' => __( 'WooCommerce Extra Product Options', 'woocommerce-exporter' ),
1393
+ 'description' => __( 'Create extra price fields globally or per-Product', 'woocommerce-exporter' ),
1394
+ 'url' => 'http://codecanyon.net/item/woocommerce-extra-product-options/7908619',
1395
+ 'class' => 'TM_Extra_Product_Options'
1396
+ );
1397
+ $modules[] = array(
1398
+ 'name' => 'woocommerce_jetpack',
1399
+ 'title' => __( 'Booster for WooCommerce', 'woocommerce-exporter' ),
1400
+ 'description' => __( 'Supercharge your WooCommerce site with these awesome powerful features (formally WooCommerce Jetpack).', 'woocommerce-exporter' ),
1401
+ 'url' => 'https://wordpress.org/plugins/woocommerce-jetpack/',
1402
+ 'slug' => 'woocommerce-jetpack',
1403
+ 'class' => 'WC_Jetpack'
1404
+ );
1405
+ $modules[] = array(
1406
+ 'name' => 'woocommerce_jetpack_plus',
1407
+ 'title' => __( 'Booster Plus', 'woocommerce-exporter' ),
1408
+ 'description' => __( 'Unlock all WooCommerce Booster features and supercharge your WordPress WooCommerce site even more (formally WooCommerce Jetpack Plus).', 'woocommerce-exporter' ),
1409
+ 'url' => 'http://woojetpack.com/shop/wordpress-woocommerce-jetpack-plus/',
1410
+ 'class' => 'WC_Jetpack_Plus'
1411
+ );
1412
+ $modules[] = array(
1413
+ 'name' => 'woocommerce_brands',
1414
+ 'title' => __( 'WooCommerce Brands', 'woocommerce-exporter' ),
1415
+ 'description' => __( 'Woocommerce Brands Plugin. After Install and active this plugin you\'ll have some shortcode and some widget for display your brands in fornt-end website.', 'woocommerce-exporter' ),
1416
+ 'url' => 'http://proword.net/Woocommerce_Brands/',
1417
+ 'class' => 'woo_brands'
1418
+ );
1419
+ $modules[] = array(
1420
+ 'name' => 'woocommerce_bookings',
1421
+ 'title' => __( 'WooCommerce Bookings', 'woocommerce-exporter' ),
1422
+ 'description' => __( 'Setup bookable products such as for reservations, services and hires.', 'woocommerce-exporter' ),
1423
+ 'url' => 'http://www.woothemes.com/products/woocommerce-bookings/',
1424
+ 'class' => 'WC_Bookings'
1425
+ );
1426
+ $modules[] = array(
1427
+ 'name' => 'eu_vat',
1428
+ 'title' => __( 'WooCommerce EU VAT Number', 'woocommerce-exporter' ),
1429
+ 'description' => __( 'The EU VAT Number extension lets you collect and validate EU VAT numbers during checkout to identify B2B transactions verses B2C.', 'woocommerce-exporter' ),
1430
+ 'url' => 'https://www.woothemes.com/products/eu-vat-number/',
1431
+ 'function' => '__wc_eu_vat_number_init'
1432
+ );
1433
+ $modules[] = array(
1434
+ 'name' => 'aelia_eu_vat',
1435
+ 'title' => __( 'WooCommerce EU VAT Assistant', 'woocommerce-exporter' ),
1436
+ 'description' => __( 'Assists with EU VAT compliance, for the new VAT regime beginning 1st January 2015.', 'woocommerce-exporter' ),
1437
+ 'url' => 'https://wordpress.org/plugins/woocommerce-eu-vat-assistant/',
1438
+ 'slug' => 'woocommerce-eu-vat-assistant',
1439
+ 'class' => 'Aelia_WC_RequirementsChecks'
1440
+ );
1441
+ $modules[] = array(
1442
+ 'name' => 'hear_about_us',
1443
+ 'title' => __( 'WooCommerce Hear About Us', 'woocommerce-exporter' ),
1444
+ 'description' => __( 'Ask where your new customers come from at Checkout.', 'woocommerce-exporter' ),
1445
+ 'url' => 'https://wordpress.org/plugins/woocommerce-hear-about-us/',
1446
+ 'slug' => 'woocommerce-hear-about-us', // Define this if the Plugin is hosted on the WordPress repo
1447
+ 'class' => 'WooCommerce_HearAboutUs'
1448
+ );
1449
+ $modules[] = array(
1450
+ 'name' => 'wholesale_pricing',
1451
+ 'title' => __( 'WooCommerce Wholesale Pricing', 'woocommerce-exporter' ),
1452
+ 'description' => __( 'Allows you to set wholesale prices for products and variations.', 'woocommerce-exporter' ),
1453
+ 'url' => 'http://ignitewoo.com/woocommerce-extensions-plugins-themes/woocommerce-wholesale-pricing/',
1454
+ 'class' => 'woocommerce_wholesale_pricing'
1455
+ );
1456
+ $modules[] = array(
1457
+ 'name' => 'wc_barcodes',
1458
+ 'title' => __( 'Barcodes for WooCommerce', 'woocommerce-exporter' ),
1459
+ 'description' => __( 'Allows you to add GTIN (former EAN) codes natively to your products.', 'woocommerce-exporter' ),
1460
+ 'url' => 'http://www.wolkenkraft.com/produkte/barcodes-fuer-woocommerce/',
1461
+ 'function' => 'wpps_requirements_met'
1462
+ );
1463
+ $modules[] = array(
1464
+ 'name' => 'wc_smart_coupons',
1465
+ 'title' => __( 'WooCommerce Smart Coupons', 'woocommerce-exporter' ),
1466
+ 'description' => __( 'WooCommerce Smart Coupons lets customers buy gift certificates, store credits or coupons easily.', 'woocommerce-exporter' ),
1467
+ 'url' => 'http://www.woothemes.com/products/smart-coupons/',
1468
+ 'class' => 'WC_Smart_Coupons'
1469
+ );
1470
+ $modules[] = array(
1471
+ 'name' => 'wc_preorders',
1472
+ 'title' => __( 'WooCommerce Pre-Orders', 'woocommerce-exporter' ),
1473
+ 'description' => __( 'Sell pre-orders for products in your WooCommerce store.', 'woocommerce-exporter' ),
1474
+ 'url' => 'http://www.woothemes.com/products/woocommerce-pre-orders/',
1475
+ 'class' => 'WC_Pre_Orders'
1476
+ );
1477
+ $modules[] = array(
1478
+ 'name' => 'order_numbers_basic',
1479
+ 'title' => __( 'WooCommerce Basic Ordernumbers', 'woocommerce-exporter' ),
1480
+ 'description' => __( 'Lets the user freely configure the order numbers in WooCommerce.', 'woocommerce-exporter' ),
1481
+ 'url' => 'http://open-tools.net/woocommerce/advanced-ordernumbers-for-woocommerce.html',
1482
+ 'class' => 'OpenToolsOrdernumbersBasic'
1483
+ );
1484
+ $modules[] = array(
1485
+ 'name' => 'admin_custom_order_fields',
1486
+ 'title' => __( 'WooCommerce Admin Custom Order Fields', 'woocommerce-exporter' ),
1487
+ 'description' => __( 'Easily add custom fields to your WooCommerce orders and display them in the Orders admin, the My Orders section and order emails.', 'woocommerce-exporter' ),
1488
+ 'url' => 'http://www.woothemes.com/products/woocommerce-admin-custom-order-fields/',
1489
+ 'function' => 'init_woocommerce_admin_custom_order_fields'
1490
+ );
1491
+ $modules[] = array(
1492
+ 'name' => 'table_rate_shipping_plus',
1493
+ 'title' => __( 'WooCommerce Table Rate Shipping Plus', 'woocommerce-exporter' ),
1494
+ 'description' => __( 'Calculate shipping costs based on destination, weight and price.', 'woocommerce-exporter' ),
1495
+ 'url' => 'http://mangohour.com/plugins/woocommerce-table-rate-shipping',
1496
+ 'function' => 'mh_wc_table_rate_plus_init'
1497
+ );
1498
+ $modules[] = array(
1499
+ 'name' => 'wc_extra_checkout_fields_brazil',
1500
+ 'title' => __( 'WooCommerce Extra Checkout Fields for Brazil', 'woocommerce-exporter' ),
1501
+ 'description' => __( 'Adds Brazilian checkout fields in WooCommerce.', 'woocommerce-exporter' ),
1502
+ 'url' => 'https://wordpress.org/plugins/woocommerce-extra-checkout-fields-for-brazil/',
1503
+ 'slug' => 'woocommerce-extra-checkout-fields-for-brazil',
1504
+ 'class' => 'Extra_Checkout_Fields_For_Brazil'
1505
+ );
1506
+ $modules[] = array(
1507
+ 'name' => 'wc_quickdonation',
1508
+ 'title' => __( 'WooCommerce Quick Donation', 'woocommerce-exporter' ),
1509
+ 'description' => __( 'Turns WooCommerce into online donation.', 'woocommerce-exporter' ),
1510
+ 'url' => 'https://wordpress.org/plugins/woocommerce-quick-donation/',
1511
+ 'slug' => 'woocommerce-quick-donation',
1512
+ 'class' => 'WooCommerce_Quick_Donation'
1513
+ );
1514
+ $modules[] = array(
1515
+ 'name' => 'wc_easycheckout',
1516
+ 'title' => __( 'Easy Checkout Fields Editor', 'woocommerce-exporter' ),
1517
+ 'description' => __( 'WooCommerce Easy Checkout Fields Editor.', 'woocommerce-exporter' ),
1518
+ 'url' => 'http://codecanyon.net/item/woocommerce-easy-checkout-field-editor/9799777',
1519
+ 'function' => 'pcmfe_admin_form_field'
1520
+ );
1521
+ $modules[] = array(
1522
+ 'name' => 'wc_productfees',
1523
+ 'title' => __( 'Product Fees', 'woocommerce-exporter' ),
1524
+ 'description' => __( 'WooCommerce Product Fees allows you to add additional fees at checkout based on products that are in the cart.', 'woocommerce-exporter' ),
1525
+ 'url' => 'https://wordpress.org/plugins/woocommerce-product-fees/',
1526
+ 'slug' => 'woocommerce-product-fees',
1527
+ 'class' => 'WooCommerce_Product_Fees'
1528
+ );
1529
+ $modules[] = array(
1530
+ 'name' => 'wc_events',
1531
+ 'title' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
1532
+ 'description' => __( 'Adds event and ticketing features to WooCommerce.', 'woocommerce-exporter' ),
1533
+ 'url' => 'http://www.woocommerceevents.com/',
1534
+ 'class' => 'WooCommerce_Events'
1535
+ );
1536
+ $modules[] = array(
1537
+ 'name' => 'wc_tabmanager',
1538
+ 'title' => __( 'WooCommerce Tab Manager', 'woocommerce-exporter' ),
1539
+ 'description' => __( 'A product tab manager for WooCommerce.', 'woocommerce-exporter' ),
1540
+ 'url' => 'http://www.woothemes.com/products/woocommerce-tab-manager/',
1541
+ 'class' => 'WC_Tab_Manager'
1542
+ );
1543
+ $modules[] = array(
1544
+ 'name' => 'wc_customfields',
1545
+ 'title' => __( 'WooCommerce Custom Fields', 'woocommerce-exporter' ),
1546
+ 'description' => __( 'Create custom fields for WooCommerce product, checkout, order and customer pages.', 'woocommerce-exporter' ),
1547
+ 'url' => 'http://www.rightpress.net/woocommerce-custom-fields',
1548
+ 'class' => array( 'RP_WCCF', 'WCCF' )
1549
+ );
1550
+ $modules[] = array(
1551
+ 'name' => 'barcode_isbn',
1552
+ 'title' => __( 'WooCommerce Barcode & ISBN', 'woocommerce-exporter' ),
1553
+ 'description' => __( 'A plugin to add a barcode & ISBN to WooCommerce.', 'woocommerce-exporter' ),
1554
+ 'url' => 'https://wordpress.org/plugins/woocommerce-barcode-isbn/',
1555
+ 'slug' => 'woocommerce-barcode-isbn',
1556
+ 'function' => 'woo_add_barcode'
1557
+ );
1558
+ $modules[] = array(
1559
+ 'name' => 'video_product_tab',
1560
+ 'title' => __( 'WooCommerce Video Product Tab', 'woocommerce-exporter' ),
1561
+ 'description' => __( 'Extends WooCommerce to allow you to add a Video to the Product page.', 'woocommerce-exporter' ),
1562
+ 'url' => 'https://wordpress.org/plugins/woocommerce-video-product-tab/',
1563
+ 'slug' => 'woocommerce-video-product-tab',
1564
+ 'class' => 'WooCommerce_Video_Product_Tab'
1565
+ );
1566
+ $modules[] = array(
1567
+ 'name' => 'external_featured_image',
1568
+ 'title' => __( 'Nelio External Featured Image', 'woocommerce-exporter' ),
1569
+ 'description' => __( 'Use external images from anywhere as the featured image of your pages and posts.', 'woocommerce-exporter' ),
1570
+ 'url' => 'https://wordpress.org/plugins/external-featured-image/',
1571
+ 'slug' => 'external-featured-image', // Define this if the Plugin is hosted on the WordPress repo
1572
+ 'function' => '_nelioefi_url'
1573
+ );
1574
+ $modules[] = array(
1575
+ 'name' => 'variation_swatches_photos',
1576
+ 'title' => __( 'WooCommerce Variation Swatches and Photos', 'woocommerce-exporter' ),
1577
+ 'description' => __( 'Configure colors and photos for shoppers on your site to use when picking variations.', 'woocommerce-exporter' ),
1578
+ 'url' => 'https://www.woothemes.com/products/variation-swatches-and-photos/',
1579
+ 'class' => 'WC_SwatchesPlugin'
1580
+ );
1581
+ $modules[] = array(
1582
+ 'name' => 'wc_uploads',
1583
+ 'title' => __( 'WooCommerce Uploads', 'woocommerce-exporter' ),
1584
+ 'description' => __( 'Upload files in WooCommerce.', 'woocommerce-exporter' ),
1585
+ 'url' => 'https://wpfortune.com/shop/plugins/woocommerce-uploads/',
1586
+ 'class' => 'WPF_Uploads'
1587
+ );
1588
+ $modules[] = array(
1589
+ 'name' => 'wc_posr',
1590
+ 'title' => __( 'WooCommerce Profit of Sales Report', 'woocommerce-exporter' ),
1591
+ 'description' => __( 'This plugin provides Profit of Sales Report based on Cost of Goods.', 'woocommerce-exporter' ),
1592
+ 'url' => 'http://codecanyon.net/item/woocommerce-profit-of-sales-report/9190590',
1593
+ 'function' => 'POSRFront'
1594
+ );
1595
+ $modules[] = array(
1596
+ 'name' => 'orddd_free',
1597
+ 'title' => __( 'Order Delivery Date for WooCommerce', 'woocommerce-exporter' ),
1598
+ 'description' => __( 'Allow the customers to choose an order delivery date on the checkout page for WooCommerce store owners.', 'woocommerce-exporter' ),
1599
+ 'slug' => 'order-delivery-date-for-woocommerce',
1600
+ 'url' => 'https://wordpress.org/plugins/order-delivery-date-for-woocommerce/',
1601
+ 'class' => 'order_delivery_date_lite'
1602
+ );
1603
+ $modules[] = array(
1604
+ 'name' => 'orddd',
1605
+ 'title' => __( 'Order Delivery Date Pro for WooCommerce', 'woocommerce-exporter' ),
1606
+ 'description' => __( 'Allows customers to choose their preferred Order Delivery Date & Delivery Time during checkout.', 'woocommerce-exporter' ),
1607
+ 'url' => 'https://www.tychesoftwares.com/store/premium-plugins/order-delivery-date-for-woocommerce-pro-21/',
1608
+ 'class' => 'order_delivery_date'
1609
+ );
1610
+ $modules[] = array(
1611
+ 'name' => 'wc_eu_vat_compliance',
1612
+ 'title' => __( 'WooCommerce EU VAT Compliance', 'woocommerce-exporter' ),
1613
+ 'description' => __( 'Provides features to assist WooCommerce with EU VAT compliance.', 'woocommerce-exporter' ),
1614
+ 'url' => 'https://wordpress.org/plugins/woocommerce-eu-vat-compliance/',
1615
+ 'slug' => 'woocommerce-eu-vat-compliance',
1616
+ 'class' => 'WC_EU_VAT_Compliance'
1617
+ );
1618
+ $modules[] = array(
1619
+ 'name' => 'wc_eu_vat_compliance_pro',
1620
+ 'title' => __( 'WooCommerce EU VAT Compliance (Premium)', 'woocommerce-exporter' ),
1621
+ 'description' => __( 'Provides features to assist WooCommerce with EU VAT compliance.', 'woocommerce-exporter' ),
1622
+ 'url' => 'https://www.simbahosting.co.uk/s3/product/woocommerce-eu-vat-compliance/',
1623
+ 'slug' => 'woocommerce-eu-vat-compliance',
1624
+ 'class' => 'WC_EU_VAT_Compliance_Premium'
1625
+ );
1626
+ $modules[] = array(
1627
+ 'name' => 'yith_cm',
1628
+ 'title' => __( 'YITH WooCommerce Checkout Manager', 'woocommerce-exporter' ),
1629
+ 'description' => __( 'YITH WooCommerce Checkout Manager lets you add, edit or remove checkout fields.', 'woocommerce-exporter' ),
1630
+ 'url' => 'https://yithemes.com/themes/plugins/yith-woocommerce-checkout-manager/',
1631
+ 'function' => 'ywccp_init'
1632
+ );
1633
+ $modules[] = array(
1634
+ 'name' => 'vt_dp',
1635
+ 'title' => __( 'Discontinued Product for WooCommerce', 'woocommerce-exporter' ),
1636
+ 'description' => __( 'Adds the ability to flag a product as discontinued to WooCommerce.', 'woocommerce-exporter' ),
1637
+ 'url' => 'https://wordpress.org/plugins/discontinued-product-for-woocommerce/',
1638
+ 'slug' => 'discontinued-product-for-woocommerce',
1639
+ 'function' => 'discontinued_product_for_woocommerce_init'
1640
+ );
1641
+ $modules[] = array(
1642
+ 'name' => 'yith_vendor',
1643
+ 'title' => __( 'YITH WooCommerce Multi Vendor Premium', 'woocommerce-exporter' ),
1644
+ 'description' => __( 'Switch your website into a platform hosting more than one shop.', 'woocommerce-exporter' ),
1645
+ 'url' => 'http://yithemes.com/themes/plugins/yith-woocommerce-product-vendors/',
1646
+ 'function' => 'YITH_Vendors'
1647
+ );
1648
+
1649
+ $modules[] = array(
1650
+ 'name' => 'wc_memberships',
1651
+ 'title' => __( 'WooCommerce Memberships', 'woocommerce-exporter' ),
1652
+ 'description' => __( 'Sell memberships that provide access to restricted content, products, discounts, and more!', 'woocommerce-exporter' ),
1653
+ 'url' => 'http://www.woothemes.com/products/woocommerce-memberships/',
1654
+ 'function' => 'init_woocommerce_memberships'
1655
+ );
1656
+
1657
+ $modules[] = array(
1658
+ 'name' => 'wc_product_bundles',
1659
+ 'title' => __( 'WooCommerce Product Bundles', 'woocommerce-exporter' ),
1660
+ 'description' => __( 'WooCommerce extension for creating simple product bundles, kits and assemblies.', 'woocommerce-exporter' ),
1661
+ 'url' => 'http://www.woothemes.com/products/product-bundles/',
1662
+ 'class' => 'WC_Bundles'
1663
+ );
1664
+ $modules[] = array(
1665
+ 'name' => 'wc_min_max',
1666
+ 'title' => __( 'WooCommerce Min/Max Quantities', 'woocommerce-exporter' ),
1667
+ 'description' => __( 'Lets you define minimum/maximum allowed quantities for products, variations and orders.', 'woocommerce-exporter' ),
1668
+ 'url' => 'https://woocommerce.com/products/minmax-quantities/',
1669
+ 'class' => 'WC_Min_Max_Quantities'
1670
+ );
1671
+ $modules[] = array(
1672
+ 'name' => 'wc_followupemails',
1673
+ 'title' => __( 'WooCommerce Follow Ups', 'woocommerce-exporter' ),
1674
+ 'description' => __( 'Follow-Ups makes it easy to automate communications via email and Twitter to keep your customers engaged and spending money.', 'woocommerce-exporter' ),
1675
+ 'url' => 'https://woocommerce.com/products/follow-up-emails/',
1676
+ 'class' => 'FollowUpEmails'
1677
+ );
1678
+ $modules[] = array(
1679
+ 'name' => 'wc_ship_multiple',
1680
+ 'title' => __( 'Ship to Multiple Addresses', 'woocommerce-exporter' ),
1681
+ 'description' => __( 'Allow your customers to ship individual items in a single order to multiple addresses.', 'woocommerce-exporter' ),
1682
+ 'url' => 'https://woocommerce.com/products/shipping-multiple-addresses/',
1683
+ 'class' => 'WC_Ship_Multiple'
1684
+ );
1685
+ $modules[] = array(
1686
+ 'name' => 'awebooking',
1687
+ 'title' => __( 'AweBooking', 'woocommerce-exporter' ),
1688
+ 'description' => __( 'You can easily create a booking/reservation system into your WordPress website without any hassle', 'woocommerce-exporter' ),
1689
+ 'url' => 'https://codecanyon.net/item/awebooking-online-hotel-booking-for-wordpress/12323878',
1690
+ 'function' => 'awebooking_clean_room'
1691
+ );
1692
+ $modules[] = array(
1693
+ 'name' => 'yith_delivery_pro',
1694
+ 'title' => __( 'YITH WooCommerce Delivery Date Premium', 'woocommerce-exporter' ),
1695
+ 'description' => __( 'Let your customers choose a delivery date for their orders', 'woocommerce-exporter' ),
1696
+ 'url' => 'http://yithemes.com/themes/plugins/yith-woocommerce-delivery-date/',
1697
+ 'function' => 'yith_delivery_date_init_plugin'
1698
+ );
1699
+ $modules[] = array(
1700
+ 'name' => 'yith_brands_pro',
1701
+ 'title' => __( 'YITH WooCommerce Brands Add-On', 'woocommerce-exporter' ),
1702
+ 'description' => __( 'YITH WooCommerce Brands Add-on allows you to add brands functionality to the default WooCommerce Plugin.', 'woocommerce-exporter' ),
1703
+ 'url' => 'http://yithemes.com/themes/plugins/yith-woocommerce-brands-add-on/',
1704
+ 'function' => 'yith_brands_constructor'
1705
+ );
1706
+ $modules[] = array(
1707
+ 'name' => 'ign_tiered',
1708
+ 'title' => __( 'WooCommerce Tiered Pricing', 'woocommerce-exporter' ),
1709
+ 'description' => __( 'Allows you to set price tiers for products and variations based on user roles.', 'woocommerce-exporter' ),
1710
+ 'url' => 'http://ignitewoo.com/woocommerce-extensions-plugins-themes/woocommerce-tiered-pricing/',
1711
+ 'function' => 'ign_tiered_init'
1712
+ );
1713
+ $modules[] = array(
1714
+ 'name' => 'wc_books',
1715
+ 'title' => __( 'WooCommerce BookStore', 'woocommerce-exporter' ),
1716
+ 'description' => __( 'Convert your WooCommerce store to online book store. Sell books using WooCommerce.', 'woocommerce-exporter' ),
1717
+ 'url' => 'http://www.wpini.com/woocommerce-bookstore-plugin/',
1718
+ 'function' => 'woo_bookstore_init'
1719
+ );
1720
+ $modules[] = array(
1721
+ 'name' => 'wc_point_of_sales',
1722
+ 'title' => __( 'WooCommerce Point of Sale', 'woocommerce-exporter' ),
1723
+ 'description' => __( 'Extend your online WooCommerce store by adding a brick and mortar Point of Sale (POS) interface.', 'woocommerce-exporter' ),
1724
+ 'url' => 'https://codecanyon.net/item/woocommerce-point-of-sale-pos/7869665',
1725
+ 'function' => 'WC_POS'
1726
+ );
1727
+ $modules[] = array(
1728
+ 'name' => 'wc_pdf_product_vouchers',
1729
+ 'title' => __( 'WooCommerce PDF Product Vouchers', 'woocommerce-exporter' ),
1730
+ 'description' => __( 'Customize and sell PDF product vouchers with WooCommerce.', 'woocommerce-exporter' ),
1731
+ 'url' => 'http://www.woothemes.com/products/pdf-product-vouchers/',
1732
+ 'function' => 'init_woocommerce_pdf_product_vouchers'
1733
+ );
1734
+ $modules[] = array(
1735
+ 'name' => 'wpml',
1736
+ 'title' => __( 'WPML Multilingual CMS', 'woocommerce-exporter' ),
1737
+ 'description' => __( 'WPML Multilingual CMS.', 'woocommerce-exporter' ),
1738
+ 'url' => 'https://wpml.org/',
1739
+ 'function' => 'icl_sitepress_activate'
1740
+ );
1741
+ $modules[] = array(
1742
+ 'name' => 'wpml_wc',
1743
+ 'title' => __( 'WooCommerce Multilingual', 'woocommerce-exporter' ),
1744
+ 'description' => __( 'Allows running fully multilingual e-Commerce sites with WooCommerce and WPML.', 'woocommerce-exporter' ),
1745
+ 'url' => 'https://wordpress.org/plugins/woocommerce-multilingual/',
1746
+ 'slug' => 'woocommerce-multilingual',
1747
+ 'function' => 'wpml_wcml_startup'
1748
+ );
1749
+ $modules[] = array(
1750
+ 'name' => 'wootabs',
1751
+ 'title' => __( 'WooTabs', 'woocommerce-exporter' ),
1752
+ 'description' => __( 'WooTabs allows you to add extra tabs (as many as you want) to the WooCommerce Product Details page.', 'woocommerce-exporter' ),
1753
+ 'url' => 'https://codecanyon.net/item/wootabsadd-extra-tabs-to-woocommerce-product-page/7891253',
1754
+ 'function' => 'on_woocommerce_wootabs_loaded'
1755
+ );
1756
+ $modules[] = array(
1757
+ 'name' => 'wc_ean',
1758
+ 'title' => __( 'WooCommerce EAN Payment Gateway', 'woocommerce-exporter' ),
1759
+ 'description' => __( 'This plugin adds an EAN13 Payment Gateway for WooCommerce.', 'woocommerce-exporter' ),
1760
+ 'url' => 'http://plugins.yanco.dk/woocommerce-ean-payment-gateway',
1761
+ 'function' => 'WOOCMMERCE_EAN_PAYMENT_GATEWAY'
1762
+ );
1763
+ $modules[] = array(
1764
+ 'name' => 'wc_germanized',
1765
+ 'title' => __( 'WooCommerce Germanized', 'woocommerce-exporter' ),
1766
+ 'description' => __( 'Extends WooCommerce to become a legally compliant store for the German market.', 'woocommerce-exporter' ),
1767
+ 'url' => 'https://www.vendidero.de/woocommerce-germanized',
1768
+ 'function' => 'WC_germanized'
1769
+ );
1770
+ $modules[] = array(
1771
+ 'name' => 'wc_germanized_pro',
1772
+ 'title' => __( 'WooCommerce Germanized Pro', 'woocommerce-exporter' ),
1773
+ 'description' => __( 'Extends WooCommerce Germanized with professional features such as PDF invoices, legal text generators and many more.', 'woocommerce-exporter' ),
1774
+ 'url' => 'https://www.vendidero.de/woocommerce-germanized',
1775
+ 'function' => 'WC_germanized_pro'
1776
+ );
1777
+ $modules[] = array(
1778
+ 'name' => 'wc_umcs',
1779
+ 'title' => __( 'WooCommerce Ultimate Multi Currency Suite', 'woocommerce-exporter' ),
1780
+ 'description' => __( 'Multi currency e-commerce plugin for WordPress-WooCommerce systems.', 'woocommerce-exporter' ),
1781
+ 'url' => 'https://codecanyon.net/item/woocommerce-ultimate-multi-currency-suite/11997014',
1782
+ 'class' => 'WooCommerce_Ultimate_Multi_Currency_Suite_Main'
1783
+ );
1784
+ $modules[] = array(
1785
+ 'name' => 'wc_entrada',
1786
+ 'title' => __( 'Entrada', 'woocommerce-exporter' ),
1787
+ 'description' => __( 'Declares a plugin that will create custom taxonomy to WooCommerce Products.', 'woocommerce-exporter' ),
1788
+ 'url' => 'https://themeforest.net/item/tour-booking-adventure-tour-wordpress-theme-entrada/16867379',
1789
+ 'function' => 'entrada_create_product_taxnomy'
1790
+ );
1791
+ $modules[] = array(
1792
+ 'name' => 'wc_deliveryslots',
1793
+ 'title' => __( 'WooCommerce Delivery Slots', 'woocommerce-exporter' ),
1794
+ 'description' => __( 'Allow your customers to select a delivery slot for their order.', 'woocommerce-exporter' ),
1795
+ 'url' => 'https://iconicwp.com/products/woocommerce-delivery-slots/',
1796
+ 'class' => 'jckWooDeliverySlots'
1797
+ );
1798
+ $modules[] = array(
1799
+ 'name' => 'wc_products_purchase_price',
1800
+ 'title' => __( 'Products Purchase Price for WooCommerce', 'woocommerce-exporter' ),
1801
+ 'description' => __( 'Plug-in for WooCommerce that allows you to insert the cost (or purchase price) of your products!', 'woocommerce-exporter' ),
1802
+ 'url' => 'https://wordpress.org/plugins/products-purchase-price-for-woocommerce/',
1803
+ 'slug' => 'products-purchase-price-for-woocommerce',
1804
+ 'function' => 'product_purchase_price_admin_scripts'
1805
+ );
1806
+ $modules[] = array(
1807
+ 'name' => 'wc_product_custom_options',
1808
+ 'title' => __( 'WooCommerce Product Custom Options Lite', 'woocommerce-exporter' ),
1809
+ 'description' => __( 'Give your Ecommerce website the space to add customized options for your products.', 'woocommerce-exporter' ),
1810
+ 'url' => 'https://wordpress.org/plugins/woocommerce-custom-options-lite/',
1811
+ 'slug' => 'woocommerce-custom-options-lite',
1812
+ 'class' => 'Product_Custom_Options'
1813
+ );
1814
+ $modules[] = array(
1815
+ 'name' => 'wc_wholesale_prices',
1816
+ 'title' => __( 'WooCommerce Wholesale Prices', 'woocommerce-exporter' ),
1817
+ 'description' => __( 'WooCommerce Extension to provide Wholesale Prices functionality.', 'woocommerce-exporter' ),
1818
+ 'url' => 'https://wordpress.org/plugins/woocommerce-wholesale-prices/',
1819
+ 'slug' => 'woocommerce-wholesale-prices',
1820
+ 'function' => 'wwp_global_plugin_deactivate'
1821
+ );
1822
+
1823
+ /*
1824
+ $modules[] = array(
1825
+ 'name' => '',
1826
+ 'title' => __( '', 'woocommerce-exporter' ),
1827
+ 'description' => __( '', 'woocommerce-exporter' ),
1828
+ 'url' => '',
1829
+ 'slug' => '', // Define this if the Plugin is hosted on the WordPress repo
1830
+ 'function' => '' // Define this for function detection, if Class rename attribute to class
1831
+ );
1832
+ */
1833
+
1834
+ $modules = apply_filters( 'woo_ce_modules_addons', $modules );
1835
+
1836
+ // Check if the existing Transient exists
1837
+ $modules_all = count( $modules );
1838
+ $cached = get_transient( WOO_CE_PREFIX . '_modules_all_count' );
1839
+ if( $cached == false ) {
1840
+ set_transient( WOO_CE_PREFIX . '_modules_all_count', $modules_all, DAY_IN_SECONDS );
1841
+ }
1842
+
1843
+ $modules_active = 0;
1844
+ $modules_inactive = 0;
1845
+
1846
+ if( !empty( $modules ) ) {
1847
+ $user_capability = 'install_plugins';
1848
+ foreach( $modules as $key => $module ) {
1849
+ $modules[$key]['status'] = 'inactive';
1850
+ // Check if each module is activated
1851
+ if( isset( $module['function'] ) ) {
1852
+ if( is_array( $module['function'] ) ) {
1853
+ $size = count( $module['function'] );
1854
+ for( $i = 0; $i < $size; $i++ ) {
1855
+ if( function_exists( $module['function'][$i] ) ) {
1856
+ $modules[$key]['status'] = 'active';
1857
+ $modules_active++;
1858
+ break;
1859
+ }
1860
+ }
1861
+ } else {
1862
+ if( function_exists( $module['function'] ) ) {
1863
+ $modules[$key]['status'] = 'active';
1864
+ $modules_active++;
1865
+ }
1866
+ }
1867
+ } else if( isset( $module['class'] ) ) {
1868
+ if( is_array( $module['class'] ) ) {
1869
+ $size = count( $module['class'] );
1870
+ for( $i = 0; $i < $size; $i++ ) {
1871
+ if( class_exists( $module['class'][$i] ) ) {
1872
+ $modules[$key]['status'] = 'active';
1873
+ $modules_active++;
1874
+ break;
1875
+ }
1876
+ }
1877
+ } else {
1878
+ if( class_exists( $module['class'] ) ) {
1879
+ $modules[$key]['status'] = 'active';
1880
+ $modules_active++;
1881
+ }
1882
+ }
1883
+ }
1884
+ // Filter Modules by Module Status
1885
+ if( !empty( $module_status ) ) {
1886
+ switch( $module_status ) {
1887
+
1888
+ case 'active':
1889
+ if( $modules[$key]['status'] == 'inactive' )
1890
+ unset( $modules[$key] );
1891
+ break;
1892
+
1893
+ case 'inactive':
1894
+ if( $modules[$key]['status'] == 'active' )
1895
+ unset( $modules[$key] );
1896
+ break;
1897
+
1898
+ }
1899
+ }
1900
+ // Check that we've got these resources available
1901
+ if( isset( $modules[$key] ) && function_exists( 'current_user_can' ) && did_action( 'init' ) ) {
1902
+ // Check if the Plugin has a slug and if User can install Plugins
1903
+ if( current_user_can( $user_capability ) && isset( $module['slug'] ) )
1904
+ $modules[$key]['url'] = admin_url( sprintf( 'plugin-install.php?tab=search&type=term&s=%s', $module['slug'] ) );
1905
+ }
1906
+ }
1907
+ }
1908
+
1909
+ // Check if the existing Transient exists
1910
+ $cached = get_transient( WOO_CE_PREFIX . '_modules_active_count' );
1911
+ if( $cached == false ) {
1912
+ set_transient( WOO_CE_PREFIX . '_modules_active_count', $modules_active, DAY_IN_SECONDS );
1913
+ }
1914
+
1915
+ // Check if the existing Transient exists
1916
+ $cached = get_transient( WOO_CE_PREFIX . '_modules_inactive_count' );
1917
+ if( $cached == false ) {
1918
+ $modules_inactive = $modules_all - $modules_active;
1919
+ set_transient( WOO_CE_PREFIX . '_modules_inactive_count', $modules_inactive, DAY_IN_SECONDS );
1920
+ }
1921
+
1922
+ return $modules;
1923
+
1924
+ }
1925
+
1926
+ // Returns whether a supported export Plugin is activated
1927
+ function woo_ce_detect_export_plugin( $plugin_name = '' ) {
1928
+
1929
+ if( empty( $plugin_name ) )
1930
+ return;
1931
+
1932
+ // Check if a cached list of active modules is available
1933
+ if ( false === ( $active_modules = get_transient( WOO_CE_PREFIX . '_modules_active' ) ) ) {
1934
+ $active_modules = woo_ce_refresh_active_export_plugins();
1935
+ }
1936
+
1937
+ // Check if the requested Plugin is in the list of active export Plugins
1938
+ if( !empty( $active_modules ) ) {
1939
+ if( in_array( $plugin_name, $active_modules ) )
1940
+ return true;
1941
+ }
1942
+
1943
+ }
1944
+
1945
+ function woo_ce_refresh_active_export_plugins() {
1946
+
1947
+ // Delete the existing count Transients
1948
+ delete_transient( WOO_CE_PREFIX . '_modules_all_count' );
1949
+ delete_transient( WOO_CE_PREFIX . '_modules_active_count' );
1950
+ delete_transient( WOO_CE_PREFIX . '_modules_inactive_count' );
1951
+
1952
+ // Refresh the count Transients
1953
+ $modules = woo_ce_modules_list( 'active' );
1954
+
1955
+ // Create a list of active export Plugins
1956
+ $active_modules = false;
1957
+ if( !empty( $modules ) ) {
1958
+ $active_modules = array();
1959
+ foreach( $modules as $module )
1960
+ $active_modules[] = $module['name'];
1961
+ }
1962
+ unset( $modules );
1963
+
1964
+ // Save the list of active export Plugins
1965
+ set_transient( WOO_CE_PREFIX . '_modules_active', $active_modules, DAY_IN_SECONDS );
1966
+
1967
+ return $active_modules;
1968
+
1969
+ }
1970
+ function woo_ce_error_log( $message = '', $level = false ) {
1971
+
1972
+ if( $message == '' )
1973
+ return;
1974
+
1975
+ if( class_exists( 'WC_Logger' ) ) {
1976
+ $logger = new WC_Logger();
1977
+ if( version_compare( WOOCOMMERCE_VERSION, '2.7', '>=' ) ) {
1978
+ $notice_level = ( !empty( $level ) ? $level : apply_filters( 'woo_ce_error_log_default_level', 'notice' ) );
1979
+ // $logger->add( WOO_CE_PREFIX, $message, $notice_level );
1980
+ $logger->log( $notice_level, $message, WOO_CE_PREFIX );
1981
+ } else {
1982
+ $logger->add( WOO_CE_PREFIX, $message );
1983
+ }
1984
+ return true;
1985
+ } else {
1986
+ // Fallback where the WooCommerce logging engine is unavailable
1987
+ error_log( sprintf( '[store-exporter] %s', $message ) );
1988
+ }
1989
+
1990
+ }
1991
+
1992
+ function woo_ce_error_get_last_message() {
1993
+
1994
+ $output = '-';
1995
+ if( function_exists( 'error_get_last' ) ) {
1996
+ $last_error = error_get_last();
1997
+ if( isset( $last_error ) && isset( $last_error['message'] ) ) {
1998
+ $output = $last_error['message'];
1999
+ }
2000
+ unset( $last_error );
2001
+ }
2002
+ return $output;
2003
+
2004
+ }
2005
+
2006
+ function woo_ce_get_option( $option = null, $default = false, $allow_empty = false ) {
2007
+
2008
+ $output = false;
2009
+ if( $option !== null ) {
2010
+ $separator = '_';
2011
+ $output = get_option( WOO_CE_PREFIX . $separator . $option, $default );
2012
+ if( $allow_empty == false && $output != 0 && ( $output == false || $output == '' ) )
2013
+ $output = $default;
2014
+ }
2015
+ return $output;
2016
+
2017
+ }
2018
+
2019
+ function woo_ce_update_option( $option = null, $value = null ) {
2020
+
2021
+ $output = false;
2022
+ if( $option !== null && $value !== null ) {
2023
+ $separator = '_';
2024
+ $output = update_option( WOO_CE_PREFIX . $separator . $option, $value );
2025
+ }
2026
+ return $output;
2027
+
2028
+ }
2029
+ ?>
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%-%random%.csv' );
26
+ if( !get_option( $prefix . '_delete_file' ) )
27
+ add_option( $prefix . '_delete_file', 1 );
28
+ if( !get_option( $prefix . '_delimiter' ) )
29
+ add_option( $prefix . '_delimiter', ',' );
30
+ if( !get_option( $prefix . '_category_separator' ) )
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-extend.php ADDED
@@ -0,0 +1,423 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Adds custom Order and Order Item columns to the Order fields list
3
+ function woo_ce_extend_order_fields( $fields = array() ) {
4
+
5
+ // Product Add-ons - http://www.woothemes.com/
6
+ if( class_exists( 'Product_Addon_Admin' ) || class_exists( 'Product_Addon_Display' ) ) {
7
+ $product_addons = woo_ce_get_product_addons();
8
+ if( !empty( $product_addons ) ) {
9
+ foreach( $product_addons as $product_addon ) {
10
+ if( !empty( $product_addon ) ) {
11
+ $fields[] = array(
12
+ 'name' => sprintf( 'order_items_product_addon_%s', $product_addon->post_name ),
13
+ 'label' => sprintf( __( 'Order Items: %s', 'woocommerce-exporter' ), ucfirst( $product_addon->post_title ) ),
14
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_order_fields_product_addons', '%s: %s' ), __( 'Product Add-ons', 'woocommerce-exporter' ), $product_addon->form_title )
15
+ );
16
+ }
17
+ }
18
+ }
19
+ unset( $product_addons, $product_addon );
20
+ }
21
+
22
+ // WooCommerce Sequential Order Numbers - http://www.skyverge.com/blog/woocommerce-sequential-order-numbers/
23
+ // Sequential Order Numbers Pro - http://www.woothemes.com/products/sequential-order-numbers-pro/
24
+ if( class_exists( 'WC_Seq_Order_Number' ) || class_exists( 'WC_Seq_Order_Number_Pro' ) ) {
25
+ $fields[] = array(
26
+ 'name' => 'order_number',
27
+ 'label' => __( 'Order Number', 'woocommerce-exporter' )
28
+ );
29
+ }
30
+
31
+ // WooCommerce Print Invoice & Delivery Note - https://wordpress.org/plugins/woocommerce-delivery-notes/
32
+ if( class_exists( 'WooCommerce_Delivery_Notes' ) ) {
33
+ $fields[] = array(
34
+ 'name' => 'invoice_number',
35
+ 'label' => __( 'Invoice Number', 'woocommerce-exporter' )
36
+ );
37
+ $fields[] = array(
38
+ 'name' => 'invoice_date',
39
+ 'label' => __( 'Invoice Date', 'woocommerce-exporter' )
40
+ );
41
+ }
42
+
43
+ // WooCommerce PDF Invoices & Packing Slips - http://www.wpovernight.com
44
+ if( class_exists( 'WooCommerce_PDF_Invoices' ) ) {
45
+ $fields[] = array(
46
+ 'name' => 'pdf_invoice_number',
47
+ 'label' => __( 'PDF Invoice Number', 'woocommerce-exporter' )
48
+ );
49
+ $fields[] = array(
50
+ 'name' => 'pdf_invoice_date',
51
+ 'label' => __( 'PDF Invoice Date', 'woocommerce-exporter' )
52
+ );
53
+ }
54
+
55
+ // WooCommerce Checkout Manager - http://wordpress.org/plugins/woocommerce-checkout-manager/
56
+ // WooCommerce Checkout Manager Pro - http://www.trottyzone.com/product/woocommerce-checkout-manager-pro
57
+ if( function_exists( 'wccs_install' ) || function_exists( 'wccs_install_pro' ) ) {
58
+ $options = get_option( 'wccs_settings' );
59
+ if( isset( $options['buttons'] ) ) {
60
+ $buttons = $options['buttons'];
61
+ if( !empty( $buttons ) ) {
62
+ $header = ( $buttons[0]['type'] == 'heading' ? $buttons[0]['label'] : false );
63
+ foreach( $buttons as $button ) {
64
+ if( $button['type'] == 'heading' )
65
+ continue;
66
+ $fields[] = array(
67
+ 'name' => $button['label'],
68
+ 'label' => ( !empty( $header ) ? sprintf( apply_filters( 'woo_ce_extend_order_fields_wccs', '%s: %s' ), ucfirst( $header ), ucfirst( $button['label'] ) ) : ucfirst( $button['label'] ) )
69
+ );
70
+ }
71
+ unset( $buttons, $button, $header );
72
+ }
73
+ }
74
+ unset( $options );
75
+ }
76
+
77
+ // Poor Guys Swiss Knife - http://wordpress.org/plugins/woocommerce-poor-guys-swiss-knife/
78
+ if( function_exists( 'wcpgsk_init' ) ) {
79
+
80
+ $options = get_option( 'wcpgsk_settings' );
81
+ $billing_fields = ( isset( $options['woofields']['billing'] ) ? $options['woofields']['billing'] : array() );
82
+ $shipping_fields = ( isset( $options['woofields']['shipping'] ) ? $options['woofields']['shipping'] : array() );
83
+
84
+ // Custom billing fields
85
+ if( !empty( $billing_fields ) ) {
86
+ foreach( $billing_fields as $key => $billing_field ) {
87
+ $fields[] = array(
88
+ 'name' => $key,
89
+ 'label' => $options['woofields']['label_' . $key]
90
+ );
91
+ }
92
+ unset( $billing_fields, $billing_field );
93
+ }
94
+
95
+ // Custom shipping fields
96
+ if( !empty( $shipping_fields ) ) {
97
+ foreach( $shipping_fields as $key => $shipping_field ) {
98
+ $fields[] = array(
99
+ 'name' => $key,
100
+ 'label' => $options['woofields']['label_' . $key]
101
+ );
102
+ }
103
+ unset( $shipping_fields, $shipping_field );
104
+ }
105
+
106
+ unset( $options );
107
+ }
108
+
109
+ // Checkout Field Editor - http://woothemes.com/woocommerce/
110
+ if( function_exists( 'woocommerce_init_checkout_field_editor' ) ) {
111
+ $billing_fields = get_option( 'wc_fields_billing', array() );
112
+ $shipping_fields = get_option( 'wc_fields_shipping', array() );
113
+ $custom_fields = get_option( 'wc_fields_additional', array() );
114
+
115
+ // Custom billing fields
116
+ if( !empty( $billing_fields ) ) {
117
+ foreach( $billing_fields as $key => $billing_field ) {
118
+ // Only add non-default Checkout fields to export columns list
119
+ if( isset( $billing_field['custom'] ) && $billing_field['custom'] == 1 ) {
120
+ $fields[] = array(
121
+ 'name' => sprintf( 'wc_billing_%s', $key ),
122
+ 'label' => sprintf( __( 'Billing: %s', 'woocommerce-exporter' ), ucfirst( $billing_field['label'] ) )
123
+ );
124
+ }
125
+ }
126
+ }
127
+ unset( $billing_fields, $billing_field );
128
+
129
+ // Custom shipping fields
130
+ if( !empty( $shipping_fields ) ) {
131
+ foreach( $shipping_fields as $key => $shipping_field ) {
132
+ // Only add non-default Checkout fields to export columns list
133
+ if( isset( $shipping_field['custom'] ) && $shipping_field['custom'] == 1 ) {
134
+ $fields[] = array(
135
+ 'name' => sprintf( 'wc_shipping_%s', $key ),
136
+ 'label' => sprintf( __( 'Shipping: %s', 'woocommerce-exporter' ), ucfirst( $shipping_field['label'] ) )
137
+ );
138
+ }
139
+ }
140
+ }
141
+ unset( $shipping_fields, $shipping_field );
142
+
143
+ // Custom fields
144
+ if( !empty( $custom_fields ) ) {
145
+ foreach( $custom_fields as $key => $custom_field ) {
146
+ // Only add non-default Checkout fields to export columns list
147
+ if( isset( $custom_field['custom'] ) && $custom_field['custom'] == 1 ) {
148
+ $fields[] = array(
149
+ 'name' => sprintf( 'wc_additional_%s', $key ),
150
+ 'label' => sprintf( __( 'Additional: %s', 'woocommerce-exporter' ), ucfirst( $custom_field['label'] ) )
151
+ );
152
+ }
153
+ }
154
+ }
155
+ unset( $custom_fields, $custom_field );
156
+ }
157
+
158
+ // Checkout Field Manager - http://61extensions.com
159
+ if( function_exists( 'sod_woocommerce_checkout_manager_settings' ) ) {
160
+ $billing_fields = get_option( 'woocommerce_checkout_billing_fields', array() );
161
+ $shipping_fields = get_option( 'woocommerce_checkout_shipping_fields', array() );
162
+ $custom_fields = get_option( 'woocommerce_checkout_additional_fields', array() );
163
+
164
+ // Custom billing fields
165
+ if( !empty( $billing_fields ) ) {
166
+ foreach( $billing_fields as $key => $billing_field ) {
167
+ // Only add non-default Checkout fields to export columns list
168
+ if( strtolower( $billing_field['default_field'] ) != 'on' ) {
169
+ $fields[] = array(
170
+ 'name' => sprintf( 'sod_billing_%s', $billing_field['name'] ),
171
+ 'label' => sprintf( __( 'Billing: %s', 'woocommerce-exporter' ), ucfirst( $billing_field['label'] ) )
172
+ );
173
+ }
174
+ }
175
+ }
176
+ unset( $billing_fields, $billing_field );
177
+
178
+ // Custom shipping fields
179
+ if( !empty( $shipping_fields ) ) {
180
+ foreach( $shipping_fields as $key => $shipping_field ) {
181
+ // Only add non-default Checkout fields to export columns list
182
+ if( strtolower( $shipping_field['default_field'] ) != 'on' ) {
183
+ $fields[] = array(
184
+ 'name' => sprintf( 'sod_shipping_%s', $shipping_field['name'] ),
185
+ 'label' => sprintf( __( 'Shipping: %s', 'woocommerce-exporter' ), ucfirst( $shipping_field['label'] ) )
186
+ );
187
+ }
188
+ }
189
+ }
190
+ unset( $shipping_fields, $shipping_field );
191
+
192
+ // Custom fields
193
+ if( !empty( $custom_fields ) ) {
194
+ foreach( $custom_fields as $key => $custom_field ) {
195
+ // Only add non-default Checkout fields to export columns list
196
+ if( strtolower( $custom_field['default_field'] ) != 'on' ) {
197
+ $fields[] = array(
198
+ 'name' => sprintf( 'sod_additional_%s', $custom_field['name'] ),
199
+ 'label' => sprintf( __( 'Additional: %s', 'woocommerce-exporter' ), ucfirst( $custom_field['label'] ) )
200
+ );
201
+ }
202
+ }
203
+ }
204
+ unset( $custom_fields, $custom_field );
205
+ }
206
+
207
+ // WooCommerce Checkout Add-Ons - http://www.skyverge.com/product/woocommerce-checkout-add-ons/
208
+ if( function_exists( 'init_woocommerce_checkout_add_ons' ) ) {
209
+ $fields[] = array(
210
+ 'name' => 'order_items_checkout_addon_id',
211
+ 'label' => __( 'Order Items: Checkout Add-ons ID', 'woocommerce-exporter' )
212
+ );
213
+ $fields[] = array(
214
+ 'name' => 'order_items_checkout_addon_label',
215
+ 'label' => __( 'Order Items: Checkout Add-ons Label', 'woocommerce-exporter' )
216
+ );
217
+ $fields[] = array(
218
+ 'name' => 'order_items_checkout_addon_value',
219
+ 'label' => __( 'Order Items: Checkout Add-ons Value', 'woocommerce-exporter' )
220
+ );
221
+ }
222
+
223
+ // WooCommerce Brands Addon - http://woothemes.com/woocommerce/
224
+ // WooCommerce Brands - http://proword.net/Woocommerce_Brands/
225
+ if( woo_ce_detect_product_brands() ) {
226
+ $fields[] = array(
227
+ 'name' => 'order_items_brand',
228
+ 'label' => __( 'Order Items: Brand', 'woocommerce-exporter' )
229
+ );
230
+ }
231
+
232
+ // Product Vendors - http://www.woothemes.com/products/product-vendors/
233
+ if( class_exists( 'WooCommerce_Product_Vendors' ) ) {
234
+ $fields[] = array(
235
+ 'name' => 'order_items_vendor',
236
+ 'label' => __( 'Order Items: Product Vendor', 'woocommerce-exporter' )
237
+ );
238
+ }
239
+
240
+ // Cost of Goods - http://www.skyverge.com/product/woocommerce-cost-of-goods-tracking/
241
+ if( class_exists( 'WC_COG' ) ) {
242
+ $fields[] = array(
243
+ 'name' => 'cost_of_goods',
244
+ 'label' => __( 'Order Total Cost of Goods', 'woocommerce-exporter' )
245
+ );
246
+ $fields[] = array(
247
+ 'name' => 'order_items_cost_of_goods',
248
+ 'label' => __( 'Order Items: Cost of Goods', 'woocommerce-exporter' )
249
+ );
250
+ $fields[] = array(
251
+ 'name' => 'order_items_total_cost_of_goods',
252
+ 'label' => __( 'Order Items: Total Cost of Goods', 'woocommerce-exporter' )
253
+ );
254
+ }
255
+
256
+ // WooCommerce MSRP Pricing - http://woothemes.com/woocommerce/
257
+ if( function_exists( 'woocommerce_msrp_activate' ) ) {
258
+ $fields[] = array(
259
+ 'name' => 'order_items_msrp',
260
+ 'label' => __( 'Order Items: MSRP', 'woocommerce-exporter' )
261
+ );
262
+ }
263
+
264
+ // Local Pickup Plus - http://www.woothemes.com/products/local-pickup-plus/
265
+ if( class_exists( 'WC_Local_Pickup_Plus' ) ) {
266
+ $fields[] = array(
267
+ 'name' => 'order_items_pickup_location',
268
+ 'label' => __( 'Order Items: Pickup Location', 'woocommerce-exporter' )
269
+ );
270
+ }
271
+
272
+ // WooCommerce Bookings - http://www.woothemes.com/products/woocommerce-bookings/
273
+ if( class_exists( 'WC_Bookings' ) ) {
274
+ $fields[] = array(
275
+ 'name' => 'order_items_booking_id',
276
+ 'label' => __( 'Order Items: Booking ID', 'woocommerce-exporter' ),
277
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' )
278
+ );
279
+ $fields[] = array(
280
+ 'name' => 'order_items_booking_date',
281
+ 'label' => __( 'Order Items: Booking Date', 'woocommerce-exporter' ),
282
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' )
283
+ );
284
+ $fields[] = array(
285
+ 'name' => 'order_items_booking_start_date',
286
+ 'label' => __( 'Order Items: Start Date', 'woocommerce-exporter' ),
287
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' )
288
+ );
289
+ $fields[] = array(
290
+ 'name' => 'order_items_booking_end_date',
291
+ 'label' => __( 'Order Items: End Date', 'woocommerce-exporter' ),
292
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' )
293
+ );
294
+ }
295
+
296
+ // Gravity Forms - http://woothemes.com/woocommerce
297
+ if( class_exists( 'RGForms' ) && class_exists( 'woocommerce_gravityforms' ) ) {
298
+ // Check if there are any Products linked to Gravity Forms
299
+ if( $gf_fields = woo_ce_get_gravity_form_fields() ) {
300
+ $fields[] = array(
301
+ 'name' => 'order_items_gf_form_id',
302
+ 'label' => __( 'Order Items: Gravity Form ID', 'woocommerce-exporter' )
303
+ );
304
+ $fields[] = array(
305
+ 'name' => 'order_items_gf_form_label',
306
+ 'label' => __( 'Order Items: Gravity Form Label', 'woocommerce-exporter' )
307
+ );
308
+ foreach( $gf_fields as $gf_field ) {
309
+ $gf_field_duplicate = false;
310
+ // Check if this isn't a duplicate Gravity Forms field
311
+ foreach( $fields as $field ) {
312
+ if( isset( $field['name'] ) && $field['name'] == sprintf( 'order_items_gf_%d_%s', $gf_field['formId'], $gf_field['id'] ) ) {
313
+ // Duplicate exists
314
+ $gf_field_duplicate = true;
315
+ break;
316
+ }
317
+ }
318
+ // If it's not a duplicate go ahead and add it to the list
319
+ if( $gf_field_duplicate !== true ) {
320
+ $fields[] = array(
321
+ 'name' => sprintf( 'order_items_gf_%d_%s', $gf_field['formId'], $gf_field['id'] ),
322
+ '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'] ) ) ),
323
+ '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'] )
324
+ );
325
+ }
326
+ }
327
+ unset( $gf_fields, $gf_field );
328
+ }
329
+ }
330
+
331
+ // WooCommerce Currency Switcher - http://dev.pathtoenlightenment.net/shop
332
+ if( class_exists( 'WC_Aelia_CurrencySwitcher' ) ) {
333
+ $fields[] = array(
334
+ 'name' => 'order_currency',
335
+ 'label' => __( 'Order Currency', 'woocommerce-exporter' )
336
+ );
337
+ }
338
+
339
+ // WooCommerce TM Extra Product Options - http://codecanyon.net/item/woocommerce-extra-product-options/7908619
340
+ if( class_exists( 'TM_Extra_Product_Options' ) ) {
341
+ if( $tm_fields = woo_ce_get_extra_product_option_fields() ) {
342
+ foreach( $tm_fields as $tm_field ) {
343
+ $fields[] = array(
344
+ 'name' => sprintf( 'order_items_tm_%s', sanitize_key( $tm_field['name'] ) ),
345
+ 'label' => sprintf( __( 'Order Items: %s', 'woocommerce-exporter' ), $tm_field['name'] )
346
+ );
347
+ }
348
+ unset( $tm_fields, $tm_field );
349
+ }
350
+ }
351
+
352
+ // WooCommerce Ship to Multiple Addresses - http://woothemes.com/woocommerce
353
+ if( class_exists( 'WC_Ship_Multiple' ) ) {
354
+ $fields[] = array(
355
+ 'name' => 'wcms_number_packages',
356
+ 'label' => __( 'Number of Packages', 'woocommerce-exporter' ),
357
+ 'hover' => __( 'Ship to Multiple Addresses', 'woocommerce-exporter' )
358
+ );
359
+ }
360
+
361
+ // Attributes
362
+ if( $attributes = woo_ce_get_product_attributes() ) {
363
+ foreach( $attributes as $attribute ) {
364
+ $attribute->attribute_label = trim( $attribute->attribute_label );
365
+ if( empty( $attribute->attribute_label ) )
366
+ $attribute->attribute_label = $attribute->attribute_name;
367
+ $fields[] = array(
368
+ 'name' => sprintf( 'order_items_attribute_%s', $attribute->attribute_name ),
369
+ 'label' => sprintf( __( 'Order Items: %s', 'woocommerce-exporter' ), ucwords( $attribute->attribute_label ) ),
370
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_order_fields_attribute', '%s: %s (#%d)' ), __( 'Attribute', 'woocommerce-exporter' ), $attribute->attribute_name, $attribute->attribute_id )
371
+ );
372
+ }
373
+ unset( $attributes, $attribute );
374
+ }
375
+
376
+ // Custom Order fields
377
+ $custom_orders = woo_ce_get_option( 'custom_orders', '' );
378
+ if( !empty( $custom_orders ) ) {
379
+ foreach( $custom_orders as $custom_order ) {
380
+ if( !empty( $custom_order ) ) {
381
+ $fields[] = array(
382
+ 'name' => $custom_order,
383
+ 'label' => woo_ce_clean_export_label( $custom_order ),
384
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_order_fields_custom_order_hover', '%s: %s' ), __( 'Custom Order', 'woocommerce-exporter' ), $custom_order )
385
+ );
386
+ }
387
+ }
388
+ unset( $custom_orders, $custom_order );
389
+ }
390
+
391
+ // Custom Order Items fields
392
+ $custom_order_items = woo_ce_get_option( 'custom_order_items', '' );
393
+ if( !empty( $custom_order_items ) ) {
394
+ foreach( $custom_order_items as $custom_order_item ) {
395
+ if( !empty( $custom_order_item ) ) {
396
+ $fields[] = array(
397
+ 'name' => sprintf( 'order_items_%s', $custom_order_item ),
398
+ 'label' => sprintf( __( 'Order Items: %s', 'woocommerce-exporter' ), woo_ce_clean_export_label( $custom_order_item ) ),
399
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_order_fields_custom_order_item_hover', '%s: %s' ), __( 'Custom Order Item', 'woocommerce-exporter' ), $custom_order_item )
400
+ );
401
+ }
402
+ }
403
+ }
404
+
405
+ // Custom Product fields
406
+ $custom_product_fields = woo_ce_get_option( 'custom_products', '' );
407
+ if( !empty( $custom_product_fields ) ) {
408
+ foreach( $custom_product_fields as $custom_product_field ) {
409
+ if( !empty( $custom_product_field ) ) {
410
+ $fields[] = array(
411
+ 'name' => sprintf( 'order_items_%s', $custom_product_field ),
412
+ 'label' => sprintf( __( 'Order Items: %s', 'woocommerce-exporter' ), woo_ce_clean_export_label( $custom_product_field ) ),
413
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_order_fields_custom_product_hover', '%s: %s' ), __( 'Custom Product', 'woocommerce-exporter' ), $custom_product_field )
414
+ );
415
+ }
416
+ }
417
+ }
418
+
419
+ return $fields;
420
+
421
+ }
422
+ add_filter( 'woo_ce_order_fields', 'woo_ce_extend_order_fields' );
423
+ ?>
includes/order.php ADDED
@@ -0,0 +1,675 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ function woo_ce_get_export_type_order_count() {
7
+
8
+ $count = 0;
9
+ // Check if the existing Transient exists
10
+ $cached = get_transient( WOO_CE_PREFIX . '_order_count' );
11
+ if( $cached == false ) {
12
+ $post_type = 'shop_order';
13
+ $woocommerce_version = woo_get_woo_version();
14
+ // Check if this is a WooCommerce 2.2+ instance (new Post Status)
15
+ if( version_compare( $woocommerce_version, '2.2' ) >= 0 )
16
+ $post_status = ( function_exists( 'wc_get_order_statuses' ) ? apply_filters( 'woo_ce_order_post_status', array_keys( wc_get_order_statuses() ) ) : 'any' );
17
+ else
18
+ $post_status = apply_filters( 'woo_ce_order_post_status', woo_ce_post_statuses() );
19
+ $args = array(
20
+ 'post_type' => $post_type,
21
+ 'posts_per_page' => 1,
22
+ 'post_status' => $post_status,
23
+ 'fields' => 'ids'
24
+ );
25
+ $count_query = new WP_Query( $args );
26
+ $count = $count_query->found_posts;
27
+ set_transient( WOO_CE_PREFIX . '_order_count', $count, HOUR_IN_SECONDS );
28
+ } else {
29
+ $count = $cached;
30
+ }
31
+ return $count;
32
+
33
+ }
34
+
35
+
36
+ /* End of: WordPress Administration */
37
+
38
+ }
39
+
40
+ // Returns a list of Order export columns
41
+ function woo_ce_get_order_fields( $format = 'full', $post_ID = 0 ) {
42
+
43
+ $export_type = 'order';
44
+
45
+ $fields = array();
46
+ $fields[] = array(
47
+ 'name' => 'purchase_id',
48
+ 'label' => __( 'Order ID', 'woocommerce-exporter' )
49
+ );
50
+ $fields[] = array(
51
+ 'name' => 'post_id',
52
+ 'label' => __( 'Post ID', 'woocommerce-exporter' )
53
+ );
54
+ $fields[] = array(
55
+ 'name' => 'purchase_total',
56
+ 'label' => __( 'Order Total', 'woocommerce-exporter' )
57
+ );
58
+ $fields[] = array(
59
+ 'name' => 'purchase_subtotal',
60
+ 'label' => __( 'Order Subtotal', 'woocommerce-exporter' )
61
+ );
62
+ $fields[] = array(
63
+ 'name' => 'order_currency',
64
+ 'label' => __( 'Order Currency', 'woocommerce-exporter' )
65
+ );
66
+ $fields[] = array(
67
+ 'name' => 'order_discount',
68
+ 'label' => __( 'Order Discount', 'woocommerce-exporter' )
69
+ );
70
+ $fields[] = array(
71
+ 'name' => 'coupon_code',
72
+ 'label' => __( 'Coupon Code', 'woocommerce-exporter' )
73
+ );
74
+ $fields[] = array(
75
+ 'name' => 'coupon_expiry_date',
76
+ 'label' => __( 'Coupon Expiry Date', 'woocommerce-exporter' )
77
+ );
78
+ $fields[] = array(
79
+ 'name' => 'coupon_description',
80
+ 'label' => __( 'Coupon Description', 'woocommerce-exporter' )
81
+ );
82
+ $fields[] = array(
83
+ 'name' => 'purchase_total_tax',
84
+ 'label' => __( 'Order Total Tax', 'woocommerce-exporter' )
85
+ );
86
+ /*
87
+ $fields[] = array(
88
+ 'name' => 'order_incl_tax',
89
+ 'label' => __( 'Order Incl. Tax', 'woocommerce-exporter' )
90
+ );
91
+ */
92
+ $fields[] = array(
93
+ 'name' => 'order_subtotal_excl_tax',
94
+ 'label' => __( 'Order Subtotal Excl. Tax', 'woocommerce-exporter' )
95
+ );
96
+ /*
97
+ $fields[] = array(
98
+ 'name' => 'order_tax_rate',
99
+ 'label' => __( 'Order Tax Rate', 'woocommerce-exporter' )
100
+ );
101
+ */
102
+ $fields[] = array(
103
+ 'name' => 'order_sales_tax',
104
+ 'label' => __( 'Sales Tax Total', 'woocommerce-exporter' )
105
+ );
106
+ $fields[] = array(
107
+ 'name' => 'order_shipping_tax',
108
+ 'label' => __( 'Shipping Tax Total', 'woocommerce-exporter' )
109
+ );
110
+ $fields[] = array(
111
+ 'name' => 'shipping_incl_tax',
112
+ 'label' => __( 'Shipping Incl. Tax', 'woocommerce-exporter' )
113
+ );
114
+ $fields[] = array(
115
+ 'name' => 'shipping_excl_tax',
116
+ 'label' => __( 'Shipping Excl. Tax', 'woocommerce-exporter' )
117
+ );
118
+ $fields[] = array(
119
+ 'name' => 'refund_total',
120
+ 'label' => __( 'Refund Total', 'woocommerce-exporter' )
121
+ );
122
+ $fields[] = array(
123
+ 'name' => 'refund_date',
124
+ 'label' => __( 'Refund Date', 'woocommerce-exporter' )
125
+ );
126
+ $fields[] = array(
127
+ 'name' => 'order_tax_percentage',
128
+ 'label' => __( 'Order Tax Percentage', 'woocommerce-exporter' )
129
+ );
130
+ $fields[] = array(
131
+ 'name' => 'payment_gateway_id',
132
+ 'label' => __( 'Payment Gateway ID', 'woocommerce-exporter' )
133
+ );
134
+ $fields[] = array(
135
+ 'name' => 'payment_gateway',
136
+ 'label' => __( 'Payment Gateway', 'woocommerce-exporter' )
137
+ );
138
+ $fields[] = array(
139
+ 'name' => 'shipping_method_id',
140
+ 'label' => __( 'Shipping Method ID', 'woocommerce-exporter' )
141
+ );
142
+ $fields[] = array(
143
+ 'name' => 'shipping_method',
144
+ 'label' => __( 'Shipping Method', 'woocommerce-exporter' )
145
+ );
146
+ $fields[] = array(
147
+ 'name' => 'shipping_cost',
148
+ 'label' => __( 'Shipping Cost', 'woocommerce-exporter' )
149
+ );
150
+ $fields[] = array(
151
+ 'name' => 'shipping_weight',
152
+ 'label' => __( 'Shipping Weight', 'woocommerce-exporter' )
153
+ );
154
+ $fields[] = array(
155
+ 'name' => 'payment_status',
156
+ 'label' => __( 'Order Status', 'woocommerce-exporter' )
157
+ );
158
+ $fields[] = array(
159
+ 'name' => 'post_status',
160
+ 'label' => __( 'Post Status', 'woocommerce-exporter' )
161
+ );
162
+ $fields[] = array(
163
+ 'name' => 'order_key',
164
+ 'label' => __( 'Order Key', 'woocommerce-exporter' )
165
+ );
166
+ $fields[] = array(
167
+ 'name' => 'purchase_date',
168
+ 'label' => __( 'Order Date', 'woocommerce-exporter' )
169
+ );
170
+ $fields[] = array(
171
+ 'name' => 'purchase_time',
172
+ 'label' => __( 'Order Time', 'woocommerce-exporter' )
173
+ );
174
+ $fields[] = array(
175
+ 'name' => 'customer_message',
176
+ 'label' => __( 'Customer Message', 'woocommerce-exporter' )
177
+ );
178
+ $fields[] = array(
179
+ 'name' => 'customer_notes',
180
+ 'label' => __( 'Customer Notes', 'woocommerce-exporter' )
181
+ );
182
+ $fields[] = array(
183
+ 'name' => 'order_notes',
184
+ 'label' => __( 'Order Notes', 'woocommerce-exporter' )
185
+ );
186
+ $fields[] = array(
187
+ 'name' => 'total_quantity',
188
+ 'label' => __( 'Total Quantity', 'woocommerce-exporter' )
189
+ );
190
+ $fields[] = array(
191
+ 'name' => 'total_order_items',
192
+ 'label' => __( 'Total Order Items', 'woocommerce-exporter' )
193
+ );
194
+ $fields[] = array(
195
+ 'name' => 'user_id',
196
+ 'label' => __( 'User ID', 'woocommerce-exporter' )
197
+ );
198
+ $fields[] = array(
199
+ 'name' => 'user_name',
200
+ 'label' => __( 'Username', 'woocommerce-exporter' )
201
+ );
202
+ $fields[] = array(
203
+ 'name' => 'user_role',
204
+ 'label' => __( 'User Role', 'woocommerce-exporter' )
205
+ );
206
+ $fields[] = array(
207
+ 'name' => 'ip_address',
208
+ 'label' => __( 'Checkout IP Address', 'woocommerce-exporter' )
209
+ );
210
+ $fields[] = array(
211
+ 'name' => 'browser_agent',
212
+ 'label' => __( 'Checkout Browser Agent', 'woocommerce-exporter' )
213
+ );
214
+ $fields[] = array(
215
+ 'name' => 'has_downloads',
216
+ 'label' => __( 'Has Downloads', 'woocommerce-exporter' )
217
+ );
218
+ $fields[] = array(
219
+ 'name' => 'has_downloaded',
220
+ 'label' => __( 'Has Downloaded', 'woocommerce-exporter' )
221
+ );
222
+ $fields[] = array(
223
+ 'name' => 'billing_full_name',
224
+ 'label' => __( 'Billing: Full Name', 'woocommerce-exporter' )
225
+ );
226
+ $fields[] = array(
227
+ 'name' => 'billing_first_name',
228
+ 'label' => __( 'Billing: First Name', 'woocommerce-exporter' )
229
+ );
230
+ $fields[] = array(
231
+ 'name' => 'billing_last_name',
232
+ 'label' => __( 'Billing: Last Name', 'woocommerce-exporter' )
233
+ );
234
+ $fields[] = array(
235
+ 'name' => 'billing_company',
236
+ 'label' => __( 'Billing: Company', 'woocommerce-exporter' )
237
+ );
238
+ $fields[] = array(
239
+ 'name' => 'billing_address',
240
+ 'label' => __( 'Billing: Street Address (Full)', 'woocommerce-exporter' )
241
+ );
242
+ $fields[] = array(
243
+ 'name' => 'billing_address_1',
244
+ 'label' => __( 'Billing: Street Address 1', 'woocommerce-exporter' )
245
+ );
246
+ $fields[] = array(
247
+ 'name' => 'billing_address_2',
248
+ 'label' => __( 'Billing: Street Address 2', 'woocommerce-exporter' )
249
+ );
250
+ $fields[] = array(
251
+ 'name' => 'billing_city',
252
+ 'label' => __( 'Billing: City', 'woocommerce-exporter' )
253
+ );
254
+ $fields[] = array(
255
+ 'name' => 'billing_postcode',
256
+ 'label' => __( 'Billing: ZIP Code', 'woocommerce-exporter' )
257
+ );
258
+ $fields[] = array(
259
+ 'name' => 'billing_state',
260
+ 'label' => __( 'Billing: State (prefix)', 'woocommerce-exporter' )
261
+ );
262
+ $fields[] = array(
263
+ 'name' => 'billing_state_full',
264
+ 'label' => __( 'Billing: State', 'woocommerce-exporter' )
265
+ );
266
+ $fields[] = array(
267
+ 'name' => 'billing_country',
268
+ 'label' => __( 'Billing: Country (prefix)', 'woocommerce-exporter' )
269
+ );
270
+ $fields[] = array(
271
+ 'name' => 'billing_country_full',
272
+ 'label' => __( 'Billing: Country', 'woocommerce-exporter' )
273
+ );
274
+ $fields[] = array(
275
+ 'name' => 'billing_phone',
276
+ 'label' => __( 'Billing: Phone Number', 'woocommerce-exporter' )
277
+ );
278
+ $fields[] = array(
279
+ 'name' => 'billing_email',
280
+ 'label' => __( 'Billing: E-mail Address', 'woocommerce-exporter' )
281
+ );
282
+ $fields[] = array(
283
+ 'name' => 'shipping_full_name',
284
+ 'label' => __( 'Shipping: Full Name', 'woocommerce-exporter' )
285
+ );
286
+ $fields[] = array(
287
+ 'name' => 'shipping_first_name',
288
+ 'label' => __( 'Shipping: First Name', 'woocommerce-exporter' )
289
+ );
290
+ $fields[] = array(
291
+ 'name' => 'shipping_last_name',
292
+ 'label' => __( 'Shipping: Last Name', 'woocommerce-exporter' )
293
+ );
294
+ $fields[] = array(
295
+ 'name' => 'shipping_company',
296
+ 'label' => __( 'Shipping: Company', 'woocommerce-exporter' )
297
+ );
298
+ $fields[] = array(
299
+ 'name' => 'shipping_address',
300
+ 'label' => __( 'Shipping: Street Address (Full)', 'woocommerce-exporter' )
301
+ );
302
+ $fields[] = array(
303
+ 'name' => 'shipping_address_1',
304
+ 'label' => __( 'Shipping: Street Address 1', 'woocommerce-exporter' )
305
+ );
306
+ $fields[] = array(
307
+ 'name' => 'shipping_address_2',
308
+ 'label' => __( 'Shipping: Street Address 2', 'woocommerce-exporter' )
309
+ );
310
+ $fields[] = array(
311
+ 'name' => 'shipping_city',
312
+ 'label' => __( 'Shipping: City', 'woocommerce-exporter' )
313
+ );
314
+ $fields[] = array(
315
+ 'name' => 'shipping_postcode',
316
+ 'label' => __( 'Shipping: ZIP Code', 'woocommerce-exporter' )
317
+ );
318
+ $fields[] = array(
319
+ 'name' => 'shipping_state',
320
+ 'label' => __( 'Shipping: State (prefix)', 'woocommerce-exporter' )
321
+ );
322
+ $fields[] = array(
323
+ 'name' => 'shipping_state_full',
324
+ 'label' => __( 'Shipping: State', 'woocommerce-exporter' )
325
+ );
326
+ $fields[] = array(
327
+ 'name' => 'shipping_country',
328
+ 'label' => __( 'Shipping: Country (prefix)', 'woocommerce-exporter' )
329
+ );
330
+ $fields[] = array(
331
+ 'name' => 'shipping_country_full',
332
+ 'label' => __( 'Shipping: Country', 'woocommerce-exporter' )
333
+ );
334
+
335
+ /*
336
+ $fields[] = array(
337
+ 'name' => '',
338
+ 'label' => __( '', 'woocommerce-exporter' )
339
+ );
340
+ */
341
+
342
+ // Allow Plugin/Theme authors to add support for additional Order columns
343
+ $fields = apply_filters( sprintf( WOO_CE_PREFIX . '_%s_fields', $export_type ), $fields, $export_type );
344
+
345
+ $fields[] = array(
346
+ 'name' => 'order_items_id',
347
+ 'label' => __( 'Order Items: ID', 'woocommerce-exporter' )
348
+ );
349
+ $fields[] = array(
350
+ 'name' => 'order_items_product_id',
351
+ 'label' => __( 'Order Items: Product ID', 'woocommerce-exporter' )
352
+ );
353
+ $fields[] = array(
354
+ 'name' => 'order_items_variation_id',
355
+ 'label' => __( 'Order Items: Variation ID', 'woocommerce-exporter' )
356
+ );
357
+ $fields[] = array(
358
+ 'name' => 'order_items_sku',
359
+ 'label' => __( 'Order Items: SKU', 'woocommerce-exporter' )
360
+ );
361
+ $fields[] = array(
362
+ 'name' => 'order_items_name',
363
+ 'label' => __( 'Order Items: Product Name', 'woocommerce-exporter' )
364
+ );
365
+ $fields[] = array(
366
+ 'name' => 'order_items_variation',
367
+ 'label' => __( 'Order Items: Product Variation', 'woocommerce-exporter' )
368
+ );
369
+ $fields[] = array(
370
+ 'name' => 'order_items_image_embed',
371
+ 'label' => __( 'Order Items: Featured Image (Embed)', 'woocommerce-exporter' )
372
+ );
373
+ $fields[] = array(
374
+ 'name' => 'order_items_description',
375
+ 'label' => __( 'Order Items: Product Description', 'woocommerce-exporter' )
376
+ );
377
+ $fields[] = array(
378
+ 'name' => 'order_items_excerpt',
379
+ 'label' => __( 'Order Items: Product Excerpt', 'woocommerce-exporter' )
380
+ );
381
+ $fields[] = array(
382
+ 'name' => 'order_items_publish_date',
383
+ 'label' => __( 'Order Items: Publish Date', 'woocommerce-exporter' )
384
+ );
385
+ $fields[] = array(
386
+ 'name' => 'order_items_modified_date',
387
+ 'label' => __( 'Order Items: Modified Date', 'woocommerce-exporter' )
388
+ );
389
+ $fields[] = array(
390
+ 'name' => 'order_items_tax_class',
391
+ 'label' => __( 'Order Items: Tax Class', 'woocommerce-exporter' )
392
+ );
393
+ $fields[] = array(
394
+ 'name' => 'order_items_quantity',
395
+ 'label' => __( 'Order Items: Quantity', 'woocommerce-exporter' )
396
+ );
397
+ $fields[] = array(
398
+ 'name' => 'order_items_total',
399
+ 'label' => __( 'Order Items: Total', 'woocommerce-exporter' )
400
+ );
401
+ $fields[] = array(
402
+ 'name' => 'order_items_subtotal',
403
+ 'label' => __( 'Order Items: Subtotal', 'woocommerce-exporter' )
404
+ );
405
+ $fields[] = array(
406
+ 'name' => 'order_items_rrp',
407
+ 'label' => __( 'Order Items: RRP', 'woocommerce-exporter' )
408
+ );
409
+ $fields[] = array(
410
+ 'name' => 'order_items_stock',
411
+ 'label' => __( 'Order Items: Stock', 'woocommerce-exporter' )
412
+ );
413
+ $fields[] = array(
414
+ 'name' => 'order_items_tax',
415
+ 'label' => __( 'Order Items: Tax', 'woocommerce-exporter' )
416
+ );
417
+ $fields[] = array(
418
+ 'name' => 'order_items_tax_subtotal',
419
+ 'label' => __( 'Order Items: Tax Subtotal', 'woocommerce-exporter' )
420
+ );
421
+ // Order Item: Tax Rate - ...
422
+ $tax_rates = woo_ce_get_order_tax_rates();
423
+ if( !empty( $tax_rates ) ) {
424
+ foreach( $tax_rates as $tax_rate ) {
425
+ $fields[] = array(
426
+ 'name' => sprintf( 'order_items_tax_rate_%d', $tax_rate['rate_id'] ),
427
+ 'label' => sprintf( __( 'Order Items: Tax Rate - %s', 'woocommerce-exporter' ), $tax_rate['label'] )
428
+ );
429
+ }
430
+ }
431
+ unset( $tax_rates, $tax_rate );
432
+ $fields[] = array(
433
+ 'name' => 'order_items_refund_subtotal',
434
+ 'label' => __( 'Order Items: Refund Subtotal', 'woocommerce-exporter' )
435
+ );
436
+ $fields[] = array(
437
+ 'name' => 'order_items_refund_quantity',
438
+ 'label' => __( 'Order Items: Refund Quantity', 'woocommerce-exporter' )
439
+ );
440
+ $fields[] = array(
441
+ 'name' => 'order_items_type',
442
+ 'label' => __( 'Order Items: Type', 'woocommerce-exporter' )
443
+ );
444
+ $fields[] = array(
445
+ 'name' => 'order_items_type_id',
446
+ 'label' => __( 'Order Items: Type ID', 'woocommerce-exporter' )
447
+ );
448
+ $fields[] = array(
449
+ 'name' => 'order_items_category',
450
+ 'label' => __( 'Order Items: Category', 'woocommerce-exporter' )
451
+ );
452
+ $fields[] = array(
453
+ 'name' => 'order_items_tag',
454
+ 'label' => __( 'Order Items: Tag', 'woocommerce-exporter' )
455
+ );
456
+ $fields[] = array(
457
+ 'name' => 'order_items_total_sales',
458
+ 'label' => __( 'Order Items: Total Sales', 'woocommerce-exporter' )
459
+ );
460
+ $fields[] = array(
461
+ 'name' => 'order_items_weight',
462
+ 'label' => __( 'Order Items: Weight', 'woocommerce-exporter' )
463
+ );
464
+ $fields[] = array(
465
+ 'name' => 'order_items_height',
466
+ 'label' => __( 'Order Items: Height', 'woocommerce-exporter' )
467
+ );
468
+ $fields[] = array(
469
+ 'name' => 'order_items_width',
470
+ 'label' => __( 'Order Items: Width', 'woocommerce-exporter' )
471
+ );
472
+ $fields[] = array(
473
+ 'name' => 'order_items_length',
474
+ 'label' => __( 'Order Items: Length', 'woocommerce-exporter' )
475
+ );
476
+ $fields[] = array(
477
+ 'name' => 'order_items_total_weight',
478
+ 'label' => __( 'Order Items: Total Weight', 'woocommerce-exporter' )
479
+ );
480
+
481
+ // Allow Plugin/Theme authors to add support for additional Order Item columns
482
+ $fields = apply_filters( sprintf( WOO_CE_PREFIX . '_%s_fields', 'order_items' ), $fields, $export_type );
483
+
484
+ switch( $format ) {
485
+
486
+ case 'summary':
487
+ $output = array();
488
+ $size = count( $fields );
489
+ for( $i = 0; $i < $size; $i++ ) {
490
+ if( isset( $fields[$i] ) )
491
+ $output[$fields[$i]['name']] = 'on';
492
+ }
493
+ return $output;
494
+ break;
495
+
496
+ case 'full':
497
+ default:
498
+ // Load the default sorting
499
+ $sorting = woo_ce_get_option( sprintf( '%s_sorting', $export_type ), array() );
500
+ $size = count( $fields );
501
+ for( $i = 0; $i < $size; $i++ ) {
502
+ if( !isset( $fields[$i]['name'] ) ) {
503
+ unset( $fields[$i] );
504
+ continue;
505
+ }
506
+ $fields[$i]['reset'] = $i;
507
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
508
+ }
509
+ // Check if we are using PHP 5.3 and above
510
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
511
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
512
+ return $fields;
513
+ break;
514
+
515
+ }
516
+
517
+ }
518
+
519
+ // Check if we should override field labels from the Field Editor
520
+ function woo_ce_override_order_field_labels( $fields = array() ) {
521
+
522
+ $labels = woo_ce_get_option( 'order_labels', array() );
523
+ if( !empty( $labels ) ) {
524
+ foreach( $fields as $key => $field ) {
525
+ if( isset( $labels[$field['name']] ) )
526
+ $fields[$key]['label'] = $labels[$field['name']];
527
+ }
528
+ }
529
+ return $fields;
530
+
531
+ }
532
+ add_filter( 'woo_ce_order_fields', 'woo_ce_override_order_field_labels', 11 );
533
+ add_filter( 'woo_ce_order_items_fields', 'woo_ce_override_order_field_labels', 11 );
534
+
535
+ // Returns a list of WooCommerce Tax Rates based on existing Orders
536
+ function woo_ce_get_order_tax_rates( $order_id = 0 ) {
537
+
538
+ global $wpdb;
539
+
540
+ $order_item_type = 'tax';
541
+ $tax_rates_sql = $wpdb->prepare( "SELECT order_items.order_item_id as item_id FROM " . $wpdb->prefix . "woocommerce_order_items as order_items WHERE order_items.order_item_type = %s", $order_item_type );
542
+ if( !empty( $order_id ) ) {
543
+ $tax_rates_sql .= $wpdb->prepare( " AND order_items.order_id = %d", $order_id );
544
+ }
545
+ $tax_rates_sql .= " GROUP BY order_items.order_item_name";
546
+ $tax_rates = $wpdb->get_results( $tax_rates_sql, 'ARRAY_A' );
547
+ if( !empty( $tax_rates ) ) {
548
+ $meta_type = 'order_item';
549
+ foreach( $tax_rates as $key => $tax_rate ) {
550
+ $tax_rates[$key]['rate_id'] = get_metadata( $meta_type, $tax_rate['item_id'], 'rate_id', true );
551
+ $tax_rates[$key]['label'] = get_metadata( $meta_type, $tax_rate['item_id'], 'label', true );
552
+ }
553
+ return $tax_rates;
554
+ }
555
+
556
+ }
557
+
558
+ function woo_ce_get_gravity_forms_products() {
559
+
560
+ global $wpdb;
561
+
562
+ $meta_key = '_gravity_form_data';
563
+ $post_ids_sql = $wpdb->prepare( "SELECT `post_id`, `meta_value` FROM `$wpdb->postmeta` WHERE `meta_key` = %s GROUP BY `meta_value`", $meta_key );
564
+ return $wpdb->get_results( $post_ids_sql );
565
+
566
+ }
567
+
568
+ function woo_ce_get_gravity_form_fields() {
569
+
570
+ if( $gf_products = woo_ce_get_gravity_forms_products() ) {
571
+ $fields = array();
572
+ foreach( $gf_products as $gf_product ) {
573
+ if( $gf_product_data = maybe_unserialize( get_post_meta( $gf_product->post_id, '_gravity_form_data', true ) ) ) {
574
+ // Check the class and method for Gravity Forms exists
575
+ if( class_exists( 'RGFormsModel' ) && method_exists( 'RGFormsModel', 'get_form_meta' ) ) {
576
+ // Check the form exists
577
+ $gf_form_meta = RGFormsModel::get_form_meta( $gf_product_data['id'] );
578
+ if( !empty( $gf_form_meta ) ) {
579
+ // Check that the form has fields assigned to it
580
+ if( !empty( $gf_form_meta['fields'] ) ) {
581
+ foreach( $gf_form_meta['fields'] as $gf_form_field ) {
582
+ // Check for duplicate Gravity Form fields
583
+ $gf_form_field['formTitle'] = $gf_form_meta['title'];
584
+ // Do not include page and section breaks, hidden as exportable fields
585
+ if( !in_array( $gf_form_field['type'], array( 'page', 'section', 'hidden' ) ) )
586
+ $fields[] = $gf_form_field;
587
+ }
588
+ }
589
+ }
590
+ unset( $gf_form_meta );
591
+ }
592
+ }
593
+ }
594
+ return $fields;
595
+ }
596
+
597
+ }
598
+
599
+ function woo_ce_get_extra_product_option_fields() {
600
+
601
+ global $wpdb;
602
+
603
+ $meta_key = '_tmcartepo_data';
604
+ $tm_fields_sql = $wpdb->prepare( "SELECT order_itemmeta.`meta_value` FROM `" . $wpdb->prefix . "woocommerce_order_items` as order_items, `" . $wpdb->prefix . "woocommerce_order_itemmeta` as order_itemmeta WHERE order_items.`order_item_id` = order_itemmeta.`order_item_id` AND order_items.`order_item_type` = 'line_item' AND order_itemmeta.`meta_key` = %s", $meta_key );
605
+ $tm_fields = $wpdb->get_col( $tm_fields_sql );
606
+ if( !empty( $tm_fields ) ) {
607
+ $fields = array();
608
+ foreach( $tm_fields as $tm_field ) {
609
+ $tm_field = maybe_unserialize( $tm_field );
610
+ $size = count( $tm_field );
611
+ for( $i = 0; $i < $size; $i++ ) {
612
+ // Check that the name is set
613
+ if( !empty( $tm_field[$i]['name'] ) ) {
614
+ // Check if we haven't already set this
615
+ if( !array_key_exists( sanitize_key( $tm_field[$i]['name'] ), $fields ) )
616
+ $fields[sanitize_key( $tm_field[$i]['name'] )] = $tm_field[$i];
617
+ }
618
+ }
619
+ }
620
+ }
621
+ return $fields;
622
+
623
+ }
624
+
625
+ // Returns a list of WooCommerce Order statuses
626
+ function woo_ce_get_order_statuses() {
627
+
628
+ $terms = false;
629
+ // Check if this is a WooCommerce 2.2+ instance (new Post Status)
630
+ $woocommerce_version = woo_get_woo_version();
631
+ if( version_compare( $woocommerce_version, '2.2' ) >= 0 ) {
632
+ // Convert Order Status array into our magic sauce
633
+ $order_statuses = ( function_exists( 'wc_get_order_statuses' ) ? wc_get_order_statuses() : false );
634
+ if( !empty( $order_statuses ) ) {
635
+ $terms = array();
636
+ $post_type = 'shop_order';
637
+ $posts_count = wp_count_posts( $post_type );
638
+ foreach( $order_statuses as $key => $order_status ) {
639
+ $terms[] = (object)array(
640
+ 'name' => $order_status,
641
+ 'slug' => $key,
642
+ 'count' => ( isset( $posts_count->$key ) ? $posts_count->$key : 0 )
643
+ );
644
+ }
645
+ }
646
+ } else {
647
+ $args = array(
648
+ 'hide_empty' => false
649
+ );
650
+ $terms = get_terms( 'shop_order_status', $args );
651
+ if( empty( $terms ) || ( is_wp_error( $terms ) == true ) )
652
+ $terms = false;
653
+ }
654
+ return $terms;
655
+
656
+ }
657
+
658
+ // Returns a list of WooCommerce Order Item Types
659
+ function woo_ce_get_order_items_types() {
660
+
661
+ $order_item_types = array(
662
+ 'line_item' => __( 'Line Item', 'woocommerce-exporter' ),
663
+ 'coupon' => __( 'Coupon', 'woocommerce-exporter' ),
664
+ 'fee' => __( 'Fee', 'woocommerce-exporter' ),
665
+ 'tax' => __( 'Tax', 'woocommerce-exporter' ),
666
+ 'shipping' => __( 'Shipping', 'woocommerce-exporter' )
667
+ );
668
+
669
+ // Allow Plugin/Theme authors to add support for additional Order Item types
670
+ $order_item_types = apply_filters( 'woo_ce_order_item_types', $order_item_types );
671
+
672
+ return $order_item_types;
673
+
674
+ }
675
+ ?>
includes/product-extend.php ADDED
@@ -0,0 +1,1029 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function woo_ce_extend_product_fields( $fields = array() ) {
3
+
4
+ // WordPress MultiSite
5
+ if( is_multisite() ) {
6
+ $fields[] = array(
7
+ 'name' => 'blog_id',
8
+ 'label' => __( 'Blog ID', 'woocommerce-exporter' ),
9
+ 'hover' => __( 'WordPress Multisite', 'woocommerce-exporter' ),
10
+ 'disabled' => 1
11
+ );
12
+ }
13
+ /*
14
+ // Attributes
15
+ if( $attributes = woo_ce_get_product_attributes() ) {
16
+ foreach( $attributes as $attribute ) {
17
+ if( empty( $attribute->attribute_label ) )
18
+ $attribute->attribute_label = $attribute->attribute_name;
19
+ $fields[] = array(
20
+ 'name' => sprintf( 'attribute_%s', $attribute->attribute_name ),
21
+ 'label' => sprintf( __( 'Attribute: %s', 'woocommerce-exporter' ), $attribute->attribute_label )
22
+ );
23
+ }
24
+ }
25
+ */
26
+
27
+ // Advanced Google Product Feed - http://www.leewillis.co.uk/wordpress-plugins/
28
+ if( woo_ce_detect_export_plugin( 'gpf' ) ) {
29
+ $fields[] = array(
30
+ 'name' => 'gpf_availability',
31
+ 'label' => __( 'Advanced Google Product Feed - Availability', 'woocommerce-exporter' ),
32
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
33
+ );
34
+ $fields[] = array(
35
+ 'name' => 'gpf_condition',
36
+ 'label' => __( 'Advanced Google Product Feed - Condition', 'woocommerce-exporter' ),
37
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
38
+ );
39
+ $fields[] = array(
40
+ 'name' => 'gpf_brand',
41
+ 'label' => __( 'Advanced Google Product Feed - Brand', 'woocommerce-exporter' ),
42
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
43
+ );
44
+ $fields[] = array(
45
+ 'name' => 'gpf_product_type',
46
+ 'label' => __( 'Advanced Google Product Feed - Product Type', 'woocommerce-exporter' ),
47
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
48
+ );
49
+ $fields[] = array(
50
+ 'name' => 'gpf_google_product_category',
51
+ 'label' => __( 'Advanced Google Product Feed - Google Product Category', 'woocommerce-exporter' ),
52
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
53
+ );
54
+ $fields[] = array(
55
+ 'name' => 'gpf_gtin',
56
+ 'label' => __( 'Advanced Google Product Feed - Global Trade Item Number (GTIN)', 'woocommerce-exporter' ),
57
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
58
+ );
59
+ $fields[] = array(
60
+ 'name' => 'gpf_mpn',
61
+ 'label' => __( 'Advanced Google Product Feed - Manufacturer Part Number (MPN)', 'woocommerce-exporter' ),
62
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
63
+ );
64
+ $fields[] = array(
65
+ 'name' => 'gpf_gender',
66
+ 'label' => __( 'Advanced Google Product Feed - Gender', 'woocommerce-exporter' ),
67
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
68
+ );
69
+ $fields[] = array(
70
+ 'name' => 'gpf_agegroup',
71
+ 'label' => __( 'Advanced Google Product Feed - Age Group', 'woocommerce-exporter' ),
72
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
73
+ );
74
+ $fields[] = array(
75
+ 'name' => 'gpf_colour',
76
+ 'label' => __( 'Advanced Google Product Feed - Colour', 'woocommerce-exporter' ),
77
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
78
+ );
79
+ $fields[] = array(
80
+ 'name' => 'gpf_size',
81
+ 'label' => __( 'Advanced Google Product Feed - Size', 'woocommerce-exporter' ),
82
+ 'hover' => __( 'Advanced Google Product Feed', 'woocommerce-exporter' )
83
+ );
84
+ }
85
+
86
+ // All in One SEO Pack - http://wordpress.org/extend/plugins/all-in-one-seo-pack/
87
+ if( woo_ce_detect_export_plugin( 'aioseop' ) ) {
88
+ $fields[] = array(
89
+ 'name' => 'aioseop_keywords',
90
+ 'label' => __( 'All in One SEO - Keywords', 'woocommerce-exporter' ),
91
+ 'hover' => __( 'All in One SEO Pack', 'woocommerce-exporter' )
92
+ );
93
+ $fields[] = array(
94
+ 'name' => 'aioseop_description',
95
+ 'label' => __( 'All in One SEO - Description', 'woocommerce-exporter' ),
96
+ 'hover' => __( 'All in One SEO Pack', 'woocommerce-exporter' )
97
+ );
98
+ $fields[] = array(
99
+ 'name' => 'aioseop_title',
100
+ 'label' => __( 'All in One SEO - Title', 'woocommerce-exporter' ),
101
+ 'hover' => __( 'All in One SEO Pack', 'woocommerce-exporter' )
102
+ );
103
+ $fields[] = array(
104
+ 'name' => 'aioseop_title_attributes',
105
+ 'label' => __( 'All in One SEO - Title Attributes', 'woocommerce-exporter' ),
106
+ 'hover' => __( 'All in One SEO Pack', 'woocommerce-exporter' )
107
+ );
108
+ $fields[] = array(
109
+ 'name' => 'aioseop_menu_label',
110
+ 'label' => __( 'All in One SEO - Menu Label', 'woocommerce-exporter' ),
111
+ 'hover' => __( 'All in One SEO Pack', 'woocommerce-exporter' )
112
+ );
113
+ }
114
+
115
+ // WordPress SEO - http://wordpress.org/plugins/wordpress-seo/
116
+ if( woo_ce_detect_export_plugin( 'wpseo' ) ) {
117
+ $fields[] = array(
118
+ 'name' => 'wpseo_focuskw',
119
+ 'label' => __( 'WordPress SEO - Focus Keyword', 'woocommerce-exporter' ),
120
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
121
+ );
122
+ $fields[] = array(
123
+ 'name' => 'wpseo_metadesc',
124
+ 'label' => __( 'WordPress SEO - Meta Description', 'woocommerce-exporter' ),
125
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
126
+ );
127
+ $fields[] = array(
128
+ 'name' => 'wpseo_title',
129
+ 'label' => __( 'WordPress SEO - SEO Title', 'woocommerce-exporter' ),
130
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
131
+ );
132
+ $fields[] = array(
133
+ 'name' => 'wpseo_noindex',
134
+ 'label' => __( 'WordPress SEO - Noindex', 'woocommerce-exporter' ),
135
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
136
+ );
137
+ $fields[] = array(
138
+ 'name' => 'wpseo_follow',
139
+ 'label' => __( 'WordPress SEO - Follow', 'woocommerce-exporter' ),
140
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
141
+ );
142
+ $fields[] = array(
143
+ 'name' => 'wpseo_googleplus_description',
144
+ 'label' => __( 'WordPress SEO - Google+ Description', 'woocommerce-exporter' ),
145
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
146
+ );
147
+ $fields[] = array(
148
+ 'name' => 'wpseo_opengraph_title',
149
+ 'label' => __( 'WordPress SEO - Facebook Title', 'woocommerce-exporter' ),
150
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
151
+ );
152
+ $fields[] = array(
153
+ 'name' => 'wpseo_opengraph_description',
154
+ 'label' => __( 'WordPress SEO - Facebook Description', 'woocommerce-exporter' ),
155
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
156
+ );
157
+ $fields[] = array(
158
+ 'name' => 'wpseo_opengraph_image',
159
+ 'label' => __( 'WordPress SEO - Facebook Image', 'woocommerce-exporter' ),
160
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
161
+ );
162
+ $fields[] = array(
163
+ 'name' => 'wpseo_twitter_title',
164
+ 'label' => __( 'WordPress SEO - Twitter Title', 'woocommerce-exporter' ),
165
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
166
+ );
167
+ $fields[] = array(
168
+ 'name' => 'wpseo_twitter_description',
169
+ 'label' => __( 'WordPress SEO - Twitter Description', 'woocommerce-exporter' ),
170
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
171
+ );
172
+ $fields[] = array(
173
+ 'name' => 'wpseo_twitter_image',
174
+ 'label' => __( 'WordPress SEO - Twitter Image', 'woocommerce-exporter' ),
175
+ 'hover' => __( 'WordPress SEO', 'woocommerce-exporter' )
176
+ );
177
+ }
178
+
179
+ // Ultimate SEO - http://wordpress.org/plugins/seo-ultimate/
180
+ if( woo_ce_detect_export_plugin( 'ultimate_seo' ) ) {
181
+ $fields[] = array(
182
+ 'name' => 'useo_meta_title',
183
+ 'label' => __( 'Ultimate SEO - Title Tag', 'woocommerce-exporter' ),
184
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
185
+ );
186
+ $fields[] = array(
187
+ 'name' => 'useo_meta_description',
188
+ 'label' => __( 'Ultimate SEO - Meta Description', 'woocommerce-exporter' ),
189
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
190
+ );
191
+ $fields[] = array(
192
+ 'name' => 'useo_meta_keywords',
193
+ 'label' => __( 'Ultimate SEO - Meta Keywords', 'woocommerce-exporter' ),
194
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
195
+ );
196
+ $fields[] = array(
197
+ 'name' => 'useo_social_title',
198
+ 'label' => __( 'Ultimate SEO - Social Title', 'woocommerce-exporter' ),
199
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
200
+ );
201
+ $fields[] = array(
202
+ 'name' => 'useo_social_description',
203
+ 'label' => __( 'Ultimate SEO - Social Description', 'woocommerce-exporter' ),
204
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
205
+ );
206
+ $fields[] = array(
207
+ 'name' => 'useo_meta_noindex',
208
+ 'label' => __( 'Ultimate SEO - Noindex', 'woocommerce-exporter' ),
209
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
210
+ );
211
+ $fields[] = array(
212
+ 'name' => 'useo_meta_noautolinks',
213
+ 'label' => __( 'Ultimate SEO - Disable Autolinks', 'woocommerce-exporter' ),
214
+ 'hover' => __( 'Ultimate SEO', 'woocommerce-exporter' )
215
+ );
216
+ }
217
+
218
+ // WooCommerce Brands Addon - http://woothemes.com/woocommerce/
219
+ // WooCommerce Brands - http://proword.net/Woocommerce_Brands/
220
+ if( woo_ce_detect_product_brands() ) {
221
+ $fields[] = array(
222
+ 'name' => 'brands',
223
+ 'label' => __( 'Brands', 'woocommerce-exporter' ),
224
+ 'hover' => __( 'WooCommerce Brands', 'woocommerce-exporter' ),
225
+ 'disabled' => 1
226
+ );
227
+ }
228
+
229
+ // WooCommerce MSRP Pricing - http://woothemes.com/woocommerce/
230
+ if( woo_ce_detect_export_plugin( 'wc_msrp' ) ) {
231
+ $fields[] = array(
232
+ 'name' => 'msrp',
233
+ 'label' => __( 'MSRP', 'woocommerce-exporter' ),
234
+ 'hover' => __( 'Manufacturer Suggested Retail Price (MSRP)', 'woocommerce-exporter' ),
235
+ 'disabled' => 1
236
+ );
237
+ }
238
+
239
+ // Cost of Goods - http://www.skyverge.com/product/woocommerce-cost-of-goods-tracking/
240
+ if( woo_ce_detect_export_plugin( 'wc_cog' ) ) {
241
+ $fields[] = array(
242
+ 'name' => 'cost_of_goods',
243
+ 'label' => __( 'Cost of Goods', 'woocommerce-exporter' ),
244
+ 'hover' => __( 'Cost of Goods', 'woocommerce-exporter' ),
245
+ 'disabled' => 1
246
+ );
247
+ }
248
+
249
+ // Per Product Shipping - http://www.woothemes.com/products/per-product-shipping/
250
+ if( woo_ce_detect_export_plugin( 'per_product_shipping' ) ) {
251
+ $fields[] = array(
252
+ 'name' => 'per_product_shipping',
253
+ 'label' => __( 'Per-Product Shipping', 'woocommerce-exporter' ),
254
+ 'hover' => __( 'Per-Product Shipping', 'woocommerce-exporter' ),
255
+ 'disabled' => 1
256
+ );
257
+ $fields[] = array(
258
+ 'name' => 'per_product_shipping_country',
259
+ 'label' => __( 'Per-Product Shipping - Country', 'woocommerce-exporter' ),
260
+ 'hover' => __( 'Per-Product Shipping', 'woocommerce-exporter' ),
261
+ 'disabled' => 1
262
+ );
263
+ $fields[] = array(
264
+ 'name' => 'per_product_shipping_state',
265
+ 'label' => __( 'Per-Product Shipping - State', 'woocommerce-exporter' ),
266
+ 'hover' => __( 'Per-Product Shipping', 'woocommerce-exporter' ),
267
+ 'disabled' => 1
268
+ );
269
+ $fields[] = array(
270
+ 'name' => 'per_product_shipping_postcode',
271
+ 'label' => __( 'Per-Product Shipping - Postcode', 'woocommerce-exporter' ),
272
+ 'hover' => __( 'Per-Product Shipping', 'woocommerce-exporter' ),
273
+ 'disabled' => 1
274
+ );
275
+ $fields[] = array(
276
+ 'name' => 'per_product_shipping_cost',
277
+ 'label' => __( 'Per-Product Shipping - Cost', 'woocommerce-exporter' ),
278
+ 'hover' => __( 'Per-Product Shipping', 'woocommerce-exporter' ),
279
+ 'disabled' => 1
280
+ );
281
+ $fields[] = array(
282
+ 'name' => 'per_product_shipping_item_cost',
283
+ 'label' => __( 'Per-Product Shipping - Item Cost', 'woocommerce-exporter' ),
284
+ 'hover' => __( 'Per-Product Shipping', 'woocommerce-exporter' ),
285
+ 'disabled' => 1
286
+ );
287
+ $fields[] = array(
288
+ 'name' => 'per_product_shipping_order',
289
+ 'label' => __( 'Per-Product Shipping - Priority', 'woocommerce-exporter' ),
290
+ 'hover' => __( 'Per-Product Shipping', 'woocommerce-exporter' ),
291
+ 'disabled' => 1
292
+ );
293
+ }
294
+
295
+ // Product Vendors - http://www.woothemes.com/products/product-vendors/
296
+ if( woo_ce_detect_export_plugin( 'vendors' ) ) {
297
+ $fields[] = array(
298
+ 'name' => 'vendors',
299
+ 'label' => __( 'Product Vendors', 'woocommerce-exporter' ),
300
+ 'hover' => __( 'Product Vendors', 'woocommerce-exporter' ),
301
+ 'disabled' => 1
302
+ );
303
+ $fields[] = array(
304
+ 'name' => 'vendor_ids',
305
+ 'label' => __( 'Product Vendor ID\'s', 'woocommerce-exporter' ),
306
+ 'hover' => __( 'Product Vendors', 'woocommerce-exporter' ),
307
+ 'disabled' => 1
308
+ );
309
+ $fields[] = array(
310
+ 'name' => 'vendor_commission',
311
+ 'label' => __( 'Vendor Commission', 'woocommerce-exporter' ),
312
+ 'hover' => __( 'Product Vendors', 'woocommerce-exporter' ),
313
+ 'disabled' => 1
314
+ );
315
+ }
316
+
317
+ // WC Vendors - http://wcvendors.com
318
+ if( woo_ce_detect_export_plugin( 'wc_vendors' ) ) {
319
+ $fields[] = array(
320
+ 'name' => 'vendor',
321
+ 'label' => __( 'Vendor' ),
322
+ 'hover' => __( 'WC Vendors', 'woocommerce-exporter' ),
323
+ 'disabled' => 1
324
+ );
325
+ $fields[] = array(
326
+ 'name' => 'vendor_commission_rate',
327
+ 'label' => __( 'Commission (%)' ),
328
+ 'hover' => __( 'WC Vendors', 'woocommerce-exporter' ),
329
+ 'disabled' => 1
330
+ );
331
+ }
332
+
333
+ // YITH WooCommerce Multi Vendor Premium - http://yithemes.com/themes/plugins/yith-woocommerce-product-vendors/
334
+ if( woo_ce_detect_export_plugin( 'yith_vendor' ) ) {
335
+ $fields[] = array(
336
+ 'name' => 'vendor',
337
+ 'label' => __( 'Vendor' ),
338
+ 'hover' => __( 'YITH WooCommerce Multi Vendor Premium', 'woocommerce-exporter' ),
339
+ 'disabled' => 1
340
+ );
341
+ $fields[] = array(
342
+ 'name' => 'vendor_commission_rate',
343
+ 'label' => __( 'Commission (%)' ),
344
+ 'hover' => __( 'YITH WooCommerce Multi Vendor Premium', 'woocommerce-exporter' ),
345
+ 'disabled' => 1
346
+ );
347
+ }
348
+
349
+ // WooCommerce Wholesale Pricing - http://ignitewoo.com/woocommerce-extensions-plugins-themes/woocommerce-wholesale-pricing/
350
+ if( woo_ce_detect_export_plugin( 'wholesale_pricing' ) ) {
351
+ $fields[] = array(
352
+ 'name' => 'wholesale_price',
353
+ 'label' => __( 'Wholesale Price', 'woocommerce-exporter' ),
354
+ 'hover' => __( 'WooCommerce Wholesale Pricing', 'woocommerce-exporter' ),
355
+ 'disabled' => 1
356
+ );
357
+ $fields[] = array(
358
+ 'name' => 'wholesale_price_text',
359
+ 'label' => __( 'Wholesale Text', 'woocommerce-exporter' ),
360
+ 'hover' => __( 'WooCommerce Wholesale Pricing', 'woocommerce-exporter' ),
361
+ 'disabled' => 1
362
+ );
363
+ }
364
+
365
+ // Advanced Custom Fields - http://www.advancedcustomfields.com
366
+ if( woo_ce_detect_export_plugin( 'acf' ) ) {
367
+ $custom_fields = woo_ce_get_acf_product_fields();
368
+ if( !empty( $custom_fields ) ) {
369
+ foreach( $custom_fields as $custom_field ) {
370
+ $fields[] = array(
371
+ 'name' => $custom_field['name'],
372
+ 'label' => $custom_field['label'],
373
+ 'hover' => __( 'Advanced Custom Fields', 'woocommerce-exporter' ),
374
+ 'disabled' => 1
375
+ );
376
+ }
377
+ unset( $custom_fields, $custom_field );
378
+ }
379
+ }
380
+
381
+ // WooCommerce Custom Fields - http://www.rightpress.net/woocommerce-custom-fields
382
+ if( woo_ce_detect_export_plugin( 'wc_customfields' ) ) {
383
+ if( !get_option( 'wccf_migrated_to_20' ) ) {
384
+ // Legacy WooCommerce Custom Fields was stored in a single Option
385
+ $options = get_option( 'rp_wccf_options' );
386
+ if( !empty( $options ) ) {
387
+ $custom_fields = ( isset( $options[1]['product_admin_fb_config'] ) ? $options[1]['product_admin_fb_config'] : false );
388
+ if( !empty( $custom_fields ) ) {
389
+ foreach( $custom_fields as $custom_field ) {
390
+ $fields[] = array(
391
+ 'name' => sprintf( 'wccf_%s', sanitize_key( $custom_field['key'] ) ),
392
+ 'label' => ucfirst( $custom_field['label'] ),
393
+ 'hover' => __( 'WooCommerce Custom Fields', 'woocommerce-exporter' ),
394
+ 'disabled' => 1
395
+ );
396
+ }
397
+ }
398
+ }
399
+ unset( $options );
400
+ } else {
401
+ // WooCommerce Custom Fields uses CPT for Product properties
402
+ $custom_fields = woo_ce_get_wccf_product_properties();
403
+ if( !empty( $custom_fields ) ) {
404
+ foreach( $custom_fields as $custom_field ) {
405
+ $label = get_post_meta( $custom_field->ID, 'label', true );
406
+ $key = get_post_meta( $custom_field->ID, 'key', true );
407
+ $fields[] = array(
408
+ 'name' => sprintf( 'wccf_pp_%s', sanitize_key( $key ) ),
409
+ 'label' => ucfirst( $label ),
410
+ 'hover' => __( 'WooCommerce Custom Fields', 'woocommerce-exporter' ),
411
+ 'disabled' => 1
412
+ );
413
+ }
414
+ }
415
+ unset( $label, $key );
416
+ }
417
+ unset( $custom_fields, $custom_field );
418
+ }
419
+
420
+ // WooCommerce Subscriptions - http://www.woothemes.com/products/woocommerce-subscriptions/
421
+ if( woo_ce_detect_export_plugin( 'subscriptions' ) ) {
422
+ $fields[] = array(
423
+ 'name' => 'subscription_price',
424
+ 'label' => __( 'Subscription Price', 'woocommerce-exporter' ),
425
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
426
+ 'disabled' => 1
427
+ );
428
+ $fields[] = array(
429
+ 'name' => 'subscription_period_interval',
430
+ 'label' => __( 'Subscription Period Interval', 'woocommerce-exporter' ),
431
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
432
+ 'disabled' => 1
433
+ );
434
+ $fields[] = array(
435
+ 'name' => 'subscription_period',
436
+ 'label' => __( 'Subscription Period', 'woocommerce-exporter' ),
437
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
438
+ 'disabled' => 1
439
+ );
440
+ $fields[] = array(
441
+ 'name' => 'subscription_length',
442
+ 'label' => __( 'Subscription Length', 'woocommerce-exporter' ),
443
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
444
+ 'disabled' => 1
445
+ );
446
+ $fields[] = array(
447
+ 'name' => 'subscription_sign_up_fee',
448
+ 'label' => __( 'Subscription Sign-up Fee', 'woocommerce-exporter' ),
449
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
450
+ 'disabled' => 1
451
+ );
452
+ $fields[] = array(
453
+ 'name' => 'subscription_trial_length',
454
+ 'label' => __( 'Subscription Trial Length', 'woocommerce-exporter' ),
455
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
456
+ 'disabled' => 1
457
+ );
458
+ $fields[] = array(
459
+ 'name' => 'subscription_trial_period',
460
+ 'label' => __( 'Subscription Trial Period', 'woocommerce-exporter' ),
461
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
462
+ 'disabled' => 1
463
+ );
464
+ $fields[] = array(
465
+ 'name' => 'subscription_limit',
466
+ 'label' => __( 'Limit Subscription', 'woocommerce-exporter' ),
467
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
468
+ 'disabled' => 1
469
+ );
470
+ }
471
+
472
+ // WooCommerce Bookings - http://www.woothemes.com/products/woocommerce-bookings/
473
+ if( woo_ce_detect_export_plugin( 'woocommerce_bookings' ) ) {
474
+ $fields[] = array(
475
+ 'name' => 'booking_has_persons',
476
+ 'label' => __( 'Booking Has Persons', 'woocommerce-exporter' ),
477
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' ),
478
+ 'disabled' => 1
479
+ );
480
+ $fields[] = array(
481
+ 'name' => 'booking_has_resources',
482
+ 'label' => __( 'Booking Has Resources', 'woocommerce-exporter' ),
483
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' ),
484
+ 'disabled' => 1
485
+ );
486
+ $fields[] = array(
487
+ 'name' => 'booking_base_cost',
488
+ 'label' => __( 'Booking Base Cost', 'woocommerce-exporter' ),
489
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' ),
490
+ 'disabled' => 1
491
+ );
492
+ $fields[] = array(
493
+ 'name' => 'booking_block_cost',
494
+ 'label' => __( 'Booking Block Cost', 'woocommerce-exporter' ),
495
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' ),
496
+ 'disabled' => 1
497
+ );
498
+ $fields[] = array(
499
+ 'name' => 'booking_display_cost',
500
+ 'label' => __( 'Booking Display Cost', 'woocommerce-exporter' ),
501
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' ),
502
+ 'disabled' => 1
503
+ );
504
+ $fields[] = array(
505
+ 'name' => 'booking_requires_confirmation',
506
+ 'label' => __( 'Booking Requires Confirmation', 'woocommerce-exporter' ),
507
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' ),
508
+ 'disabled' => 1
509
+ );
510
+ $fields[] = array(
511
+ 'name' => 'booking_user_can_cancel',
512
+ 'label' => __( 'Booking Can Be Cancelled', 'woocommerce-exporter' ),
513
+ 'hover' => __( 'WooCommerce Bookings', 'woocommerce-exporter' ),
514
+ 'disabled' => 1
515
+ );
516
+ }
517
+
518
+ // Barcodes for WooCommerce - http://www.wolkenkraft.com/produkte/barcodes-fuer-woocommerce/
519
+ if( woo_ce_detect_export_plugin( 'wc_barcodes' ) ) {
520
+ $fields[] = array(
521
+ 'name' => 'barcode_type',
522
+ 'label' => __( 'Barcode Type', 'woocommerce-exporter' ),
523
+ 'hover' => __( 'Barcodes for WooCommerce', 'woocommerce-exporter' ),
524
+ 'disabled' => 1
525
+ );
526
+ $fields[] = array(
527
+ 'name' => 'barcode',
528
+ 'label' => __( 'Barcode', 'woocommerce-exporter' ),
529
+ 'hover' => __( 'Barcodes for WooCommerce', 'woocommerce-exporter' ),
530
+ 'disabled' => 1
531
+ );
532
+ }
533
+
534
+ // WooCommerce Pre-Orders - http://www.woothemes.com/products/woocommerce-pre-orders/
535
+ if( woo_ce_detect_export_plugin( 'wc_preorders' ) ) {
536
+ $fields[] = array(
537
+ 'name' => 'pre_orders_enabled',
538
+ 'label' => __( 'Pre-Order Enabled', 'woocommerce-exporter' ),
539
+ 'hover' => __( 'WooCommerce Pre-Orders', 'woocommerce-exporter' ),
540
+ 'disabled' => 1
541
+ );
542
+ $fields[] = array(
543
+ 'name' => 'pre_orders_availability_date',
544
+ 'label' => __( 'Pre-Order Availability Date', 'woocommerce-exporter' ),
545
+ 'hover' => __( 'WooCommerce Pre-Orders', 'woocommerce-exporter' ),
546
+ 'disabled' => 1
547
+ );
548
+ $fields[] = array(
549
+ 'name' => 'pre_orders_fee',
550
+ 'label' => __( 'Pre-Order Fee', 'woocommerce-exporter' ),
551
+ 'hover' => __( 'WooCommerce Pre-Orders', 'woocommerce-exporter' ),
552
+ 'disabled' => 1
553
+ );
554
+ $fields[] = array(
555
+ 'name' => 'pre_orders_charge',
556
+ 'label' => __( 'Pre-Order Charge', 'woocommerce-exporter' ),
557
+ 'hover' => __( 'WooCommerce Pre-Orders', 'woocommerce-exporter' ),
558
+ 'disabled' => 1
559
+ );
560
+ }
561
+
562
+ // WooCommerce Product Fees - https://wordpress.org/plugins/woocommerce-product-fees/
563
+ if( woo_ce_detect_export_plugin( 'wc_productfees' ) ) {
564
+ $fields[] = array(
565
+ 'name' => 'fee_name',
566
+ 'label' => __( 'Product Fee Name', 'woocommerce-exporter' ),
567
+ 'hover' => __( 'WooCommerce Product Fees', 'woocommerce-exporter' ),
568
+ 'disabled' => 1
569
+ );
570
+ $fields[] = array(
571
+ 'name' => 'fee_amount',
572
+ 'label' => __( 'Product Fee Amount', 'woocommerce-exporter' ),
573
+ 'hover' => __( 'WooCommerce Product Fees', 'woocommerce-exporter' ),
574
+ 'disabled' => 1
575
+ );
576
+ $fields[] = array(
577
+ 'name' => 'fee_multiplier',
578
+ 'label' => __( 'Product Fee Multiplier', 'woocommerce-exporter' ),
579
+ 'hover' => __( 'WooCommerce Product Fees', 'woocommerce-exporter' ),
580
+ 'disabled' => 1
581
+ );
582
+ }
583
+
584
+ // WooCommerce Events - http://www.woocommerceevents.com/
585
+ if( woo_ce_detect_export_plugin( 'wc_events' ) ) {
586
+ $fields[] = array(
587
+ 'name' => 'is_event',
588
+ 'label' => __( 'Is Event', 'woocommerce-exporter' ),
589
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
590
+ 'disabled' => 1
591
+ );
592
+ $fields[] = array(
593
+ 'name' => 'event_date',
594
+ 'label' => __( 'Event Date', 'woocommerce-exporter' ),
595
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
596
+ 'disabled' => 1
597
+ );
598
+ $fields[] = array(
599
+ 'name' => 'event_start_time',
600
+ 'label' => __( 'Event Start Time', 'woocommerce-exporter' ),
601
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
602
+ 'disabled' => 1
603
+ );
604
+ $fields[] = array(
605
+ 'name' => 'event_end_time',
606
+ 'label' => __( 'Event End Time', 'woocommerce-exporter' ),
607
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
608
+ 'disabled' => 1
609
+ );
610
+ $fields[] = array(
611
+ 'name' => 'event_venue',
612
+ 'label' => __( 'Event Venue', 'woocommerce-exporter' ),
613
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
614
+ 'disabled' => 1
615
+ );
616
+ $fields[] = array(
617
+ 'name' => 'event_gps',
618
+ 'label' => __( 'Event GPS Coordinates', 'woocommerce-exporter' ),
619
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
620
+ 'disabled' => 1
621
+ );
622
+ $fields[] = array(
623
+ 'name' => 'event_googlemaps',
624
+ 'label' => __( 'Event Google Maps Coordinates', 'woocommerce-exporter' ),
625
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
626
+ 'disabled' => 1
627
+ );
628
+ $fields[] = array(
629
+ 'name' => 'event_directions',
630
+ 'label' => __( 'Event Directions', 'woocommerce-exporter' ),
631
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
632
+ 'disabled' => 1
633
+ );
634
+ $fields[] = array(
635
+ 'name' => 'event_phone',
636
+ 'label' => __( 'Event Phone', 'woocommerce-exporter' ),
637
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
638
+ 'disabled' => 1
639
+ );
640
+ $fields[] = array(
641
+ 'name' => 'event_email',
642
+ 'label' => __( 'Event E-mail', 'woocommerce-exporter' ),
643
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
644
+ 'disabled' => 1
645
+ );
646
+ $fields[] = array(
647
+ 'name' => 'event_ticket_logo',
648
+ 'label' => __( 'Event Ticket Logo', 'woocommerce-exporter' ),
649
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
650
+ 'disabled' => 1
651
+ );
652
+ $fields[] = array(
653
+ 'name' => 'event_ticket_text',
654
+ 'label' => __( 'Event Ticket Text', 'woocommerce-exporter' ),
655
+ 'hover' => __( 'WooCommerce Events', 'woocommerce-exporter' ),
656
+ 'disabled' => 1
657
+ );
658
+ }
659
+
660
+ // WooCommerce Uploads - https://wpfortune.com/shop/plugins/woocommerce-uploads/
661
+ if( woo_ce_detect_export_plugin( 'wc_uploads' ) ) {
662
+ $fields[] = array(
663
+ 'name' => 'enable_uploads',
664
+ 'label' => __( 'Enable Uploads', 'woocommerce-exporter' ),
665
+ 'hover' => __( 'WooCommerce Uploads', 'woocommerce-exporter' ),
666
+ 'disabled' => 1
667
+ );
668
+ }
669
+
670
+ // WooCommerce Profit of Sales Report - http://codecanyon.net/item/woocommerce-profit-of-sales-report/9190590
671
+ if( woo_ce_detect_export_plugin( 'wc_posr' ) ) {
672
+ $fields[] = array(
673
+ 'name' => 'posr',
674
+ 'label' => __( 'Cost of Good', 'woocommerce-exporter' ),
675
+ 'hover' => __( 'WooCommerce Profit of Sales Report', 'woocommerce-exporter' ),
676
+ 'disabled' => 1
677
+ );
678
+ }
679
+
680
+ // WooCommerce Product Bundles - http://www.woothemes.com/products/product-bundles/
681
+ if( woo_ce_detect_export_plugin( 'wc_product_bundles' ) ) {
682
+ $fields[] = array(
683
+ 'name' => 'bundled_products',
684
+ 'label' => __( 'Bundled Products', 'woocommerce-exporter' ),
685
+ 'hover' => __( 'WooCommerce Product Bundles', 'woocommerce-exporter' ),
686
+ 'disabled' => 1
687
+ );
688
+ $fields[] = array(
689
+ 'name' => 'bundled_product_ids',
690
+ 'label' => __( 'Bundled Product ID\'s', 'woocommerce-exporter' ),
691
+ 'hover' => __( 'WooCommerce Product Bundles', 'woocommerce-exporter' ),
692
+ 'disabled' => 1
693
+ );
694
+ }
695
+
696
+ // WooCommerce Min/Max Quantities - https://woocommerce.com/products/minmax-quantities/
697
+ if( woo_ce_detect_export_plugin( 'wc_min_max' ) ) {
698
+ $fields[] = array(
699
+ 'name' => 'minimum_quantity',
700
+ 'label' => __( 'Minimum Quantity', 'woocommerce-exporter' ),
701
+ 'hover' => __( 'WooCommerce Min/Max Quantities', 'woocommerce-exporter' ),
702
+ 'disabled' => 1
703
+ );
704
+ $fields[] = array(
705
+ 'name' => 'maximum_quantity',
706
+ 'label' => __( 'Maximum Quantity', 'woocommerce-exporter' ),
707
+ 'hover' => __( 'WooCommerce Min/Max Quantities', 'woocommerce-exporter' ),
708
+ 'disabled' => 1
709
+ );
710
+ $fields[] = array(
711
+ 'name' => 'group_of',
712
+ 'label' => __( 'Group of', 'woocommerce-exporter' ),
713
+ 'hover' => __( 'WooCommerce Min/Max Quantities', 'woocommerce-exporter' ),
714
+ 'disabled' => 1
715
+ );
716
+ }
717
+
718
+ // WooCommerce Tab Manager - http://www.woothemes.com/products/woocommerce-tab-manager/
719
+ if( woo_ce_detect_export_plugin( 'wc_tabmanager' ) ) {
720
+ // Custom Product Tabs
721
+ $custom_product_tabs = woo_ce_get_option( 'custom_product_tabs', '' );
722
+ if( !empty( $custom_product_tabs ) ) {
723
+ foreach( $custom_product_tabs as $custom_product_tab ) {
724
+ if( !empty( $custom_product_tab ) ) {
725
+ $fields[] = array(
726
+ 'name' => sprintf( 'product_tab_%s', sanitize_key( $custom_product_tab ) ),
727
+ 'label' => sprintf( __( 'Product Tab: %s', 'woocommerce-exporter' ), woo_ce_clean_export_label( $custom_product_tab ) ),
728
+ 'hover' => sprintf( __( 'Custom Product Tab: %s', 'woocommerce-exporter' ), $custom_product_tab ),
729
+ 'disabled' => 1
730
+ );
731
+ }
732
+ }
733
+ }
734
+ unset( $custom_product_tabs, $custom_product_tab );
735
+ }
736
+
737
+ // WooTabs - https://codecanyon.net/item/wootabsadd-extra-tabs-to-woocommerce-product-page/7891253
738
+ if( woo_ce_detect_export_plugin( 'wootabs' ) ) {
739
+ // Custom WooTabs
740
+ $custom_wootabs = woo_ce_get_option( 'custom_wootabs', '' );
741
+ if( !empty( $custom_wootabs ) ) {
742
+ foreach( $custom_wootabs as $custom_wootab ) {
743
+ if( !empty( $custom_wootab ) ) {
744
+ $fields[] = array(
745
+ 'name' => sprintf( 'wootab_%s', sanitize_key( $custom_wootab ) ),
746
+ 'label' => sprintf( __( 'WooTab: %s', 'woocommerce-exporter' ), woo_ce_clean_export_label( $custom_wootab ) ),
747
+ 'hover' => sprintf( __( 'WooTab: %s', 'woocommerce-exporter' ), $custom_wootab ),
748
+ 'disabled' => 1
749
+ );
750
+ }
751
+ }
752
+ }
753
+ unset( $custom_wootabs, $custom_wootab );
754
+ }
755
+
756
+ // WooCommerce Tiered Pricing - http://ignitewoo.com/woocommerce-extensions-plugins-themes/woocommerce-tiered-pricing/
757
+ if( woo_ce_detect_export_plugin( 'ign_tiered' ) ) {
758
+
759
+ global $wp_roles;
760
+
761
+ // User Roles
762
+ if( isset( $wp_roles->roles ) ) {
763
+ asort( $wp_roles->roles );
764
+ foreach( $wp_roles->roles as $role => $role_data ) {
765
+ // Skip default User Roles
766
+ if( 'ignite_level_' != substr( $role, 0, 13 ) )
767
+ continue;
768
+ $fields[] = array(
769
+ 'name' => sanitize_key( $role ),
770
+ 'label' => sprintf( __( '%s ($)', 'woocommerce-exporter' ), woo_ce_clean_export_label( stripslashes( $role_data['name'] ) ) ),
771
+ 'hover' => __( 'WooCommerce Tiered Pricing', 'woocommerce-exporter' ),
772
+ 'disabled' => 1
773
+ );
774
+ }
775
+ unset( $role, $role_data );
776
+ }
777
+ }
778
+
779
+ // WooCommerce BookStore - http://www.wpini.com/woocommerce-bookstore-plugin/
780
+ if( woo_ce_detect_export_plugin( 'wc_books' ) ) {
781
+ $custom_books = ( function_exists( 'woo_book_get_custom_fields' ) ? woo_book_get_custom_fields() : false );
782
+ if( !empty( $custom_books ) ) {
783
+ foreach( $custom_books as $custom_book ) {
784
+ if( !empty( $custom_book ) ) {
785
+ $fields[] = array(
786
+ 'name' => sprintf( 'book_%s', sanitize_key( $custom_book['name'] ) ),
787
+ 'label' => $custom_book['name'],
788
+ 'hover' => __( 'WooCommerce BookStore', 'woocommerce-exporter' ),
789
+ 'disabled' => 1
790
+ );
791
+ }
792
+ }
793
+ }
794
+ unset( $custom_books, $custom_book );
795
+ $fields[] = array(
796
+ 'name' => 'book_category',
797
+ 'label' => __( 'Book Category', 'woocommerce-exporter' ),
798
+ 'hover' => __( 'WooCommerce BookStore', 'woocommerce-exporter' ),
799
+ 'disabled' => 1
800
+ );
801
+ $fields[] = array(
802
+ 'name' => 'book_author',
803
+ 'label' => __( 'Book Author', 'woocommerce-exporter' ),
804
+ 'hover' => __( 'WooCommerce BookStore', 'woocommerce-exporter' ),
805
+ 'disabled' => 1
806
+ );
807
+ $fields[] = array(
808
+ 'name' => 'book_publisher',
809
+ 'label' => __( 'Book Publisher', 'woocommerce-exporter' ),
810
+ 'hover' => __( 'WooCommerce BookStore', 'woocommerce-exporter' ),
811
+ 'disabled' => 1
812
+ );
813
+ }
814
+
815
+ // WooCommerce Multilingual - https://wordpress.org/plugins/woocommerce-multilingual/
816
+ if( woo_ce_detect_wpml() && woo_ce_detect_export_plugin( 'wpml_wc' ) ) {
817
+ $fields[] = array(
818
+ 'name' => 'language',
819
+ 'label' => __( 'Language', 'woocommerce-exporter' ),
820
+ 'hover' => __( 'WooCommerce Multilingual', 'woocommerce-exporter' ),
821
+ 'disabled' => 1
822
+ );
823
+ }
824
+
825
+ // Products Purchase Price for Woocommerce - https://wordpress.org/plugins/products-purchase-price-for-woocommerce/
826
+ if( woo_ce_detect_export_plugin( 'wc_products_purchase_price' ) ) {
827
+ $fields[] = array(
828
+ 'name' => 'purchase_price',
829
+ 'label' => __( 'Purchase Price', 'woocommerce-exporter' ),
830
+ 'hover' => __( 'Products Purchase Price for WooCommerce', 'woocommerce-exporter' ),
831
+ 'disabled' => 1
832
+ );
833
+ }
834
+
835
+ // WooCommerce Currency Switcher - http://dev.pathtoenlightenment.net/shop
836
+ if( woo_ce_detect_export_plugin( 'currency_switcher' ) ) {
837
+ $options = get_option( 'wc_aelia_currency_switcher' );
838
+ $currencies = ( isset( $options['enabled_currencies'] ) ? $options['enabled_currencies'] : false );
839
+ if( !empty( $currencies ) ) {
840
+ $woocommerce_currency = get_option( 'woocommerce_currency' );
841
+ foreach( $currencies as $currency ) {
842
+
843
+ // Skip the WooCommerce default currency
844
+ if( $woocommerce_currency == $currency )
845
+ continue;
846
+
847
+ $fields[] = array(
848
+ 'name' => sprintf( 'wcae_regular_price_%s', sanitize_key( $currency ) ),
849
+ 'label' => sprintf( __( 'Regular Price (%s)', 'woocommerce-exporter' ), $currency ),
850
+ 'hover' => __( 'WooCommerce Currency Switcher', 'woocommerce-exporter' ),
851
+ 'disabled' => 1
852
+ );
853
+ $fields[] = array(
854
+ 'name' => sprintf( 'wcae_sale_price_%s', sanitize_key( $currency ) ),
855
+ 'label' => sprintf( __( 'Sale Price (%s)', 'woocommerce-exporter' ), $currency ),
856
+ 'hover' => __( 'WooCommerce Currency Switcher', 'woocommerce-exporter' ),
857
+ 'disabled' => 1
858
+ );
859
+
860
+ }
861
+ unset( $woocommerce_currency, $currencies, $currency );
862
+ }
863
+ unset( $options );
864
+ }
865
+
866
+ // Custom Product meta
867
+ $custom_products = woo_ce_get_option( 'custom_products', '' );
868
+ if( !empty( $custom_products ) ) {
869
+ foreach( $custom_products as $custom_product ) {
870
+ if( !empty( $custom_product ) ) {
871
+ $fields[] = array(
872
+ 'name' => $custom_product,
873
+ 'label' => woo_ce_clean_export_label( $custom_product ),
874
+ 'hover' => sprintf( apply_filters( 'woo_ce_extend_product_fields_custom_product_hover', '%s: %s' ), __( 'Custom Product', 'woocommerce-exporter' ), $custom_product )
875
+ );
876
+ }
877
+ }
878
+ }
879
+ unset( $custom_products, $custom_product );
880
+
881
+ return $fields;
882
+
883
+ }
884
+ add_filter( 'woo_ce_product_fields', 'woo_ce_extend_product_fields' );
885
+
886
+ function woo_ce_extend_product_item( $product, $product_id ) {
887
+
888
+ // Advanced Google Product Feed - http://plugins.leewillis.co.uk/downloads/wp-e-commerce-product-feeds/
889
+ if( woo_ce_detect_export_plugin( 'gpf' ) ) {
890
+ $gpf_data = get_post_meta( $product_id, '_woocommerce_gpf_data', true );
891
+ $product->gpf_availability = ( isset( $gpf_data['availability'] ) ? woo_ce_format_gpf_availability( $gpf_data['availability'] ) : '' );
892
+ $product->gpf_condition = ( isset( $gpf_data['condition'] ) ? woo_ce_format_gpf_condition( $gpf_data['condition'] ) : '' );
893
+ $product->gpf_brand = ( isset( $gpf_data['brand'] ) ? $gpf_data['brand'] : '' );
894
+ $product->gpf_product_type = ( isset( $gpf_data['product_type'] ) ? $gpf_data['product_type'] : '' );
895
+ $product->gpf_google_product_category = ( isset( $gpf_data['google_product_category'] ) ? $gpf_data['google_product_category'] : '' );
896
+ $product->gpf_gtin = ( isset( $gpf_data['gtin'] ) ? $gpf_data['gtin'] : '' );
897
+ $product->gpf_mpn = ( isset( $gpf_data['mpn'] ) ? $gpf_data['mpn'] : '' );
898
+ $product->gpf_gender = ( isset( $gpf_data['gender'] ) ? $gpf_data['gender'] : '' );
899
+ $product->gpf_age_group = ( isset( $gpf_data['age_group'] ) ? $gpf_data['age_group'] : '' );
900
+ $product->gpf_color = ( isset( $gpf_data['color'] ) ? $gpf_data['color'] : '' );
901
+ $product->gpf_size = ( isset( $gpf_data['size'] ) ? $gpf_data['size'] : '' );
902
+ unset( $gpf_data );
903
+ }
904
+
905
+ // All in One SEO Pack - http://wordpress.org/extend/plugins/all-in-one-seo-pack/
906
+ if( woo_ce_detect_export_plugin( 'aioseop' ) ) {
907
+ $product->aioseop_keywords = get_post_meta( $product_id, '_aioseop_keywords', true );
908
+ $product->aioseop_description = get_post_meta( $product_id, '_aioseop_description', true );
909
+ $product->aioseop_title = get_post_meta( $product_id, '_aioseop_title', true );
910
+ $product->aioseop_title_attributes = get_post_meta( $product_id, '_aioseop_titleatr', true );
911
+ $product->aioseop_menu_label = get_post_meta( $product_id, '_aioseop_menulabel', true );
912
+ }
913
+
914
+ // WordPress SEO - http://wordpress.org/plugins/wordpress-seo/
915
+ if( woo_ce_detect_export_plugin( 'wpseo' ) ) {
916
+ $product->wpseo_focuskw = get_post_meta( $product_id, '_yoast_wpseo_focuskw', true );
917
+ $product->wpseo_metadesc = get_post_meta( $product_id, '_yoast_wpseo_metadesc', true );
918
+ $product->wpseo_title = get_post_meta( $product_id, '_yoast_wpseo_title', true );
919
+ $product->wpseo_noindex = woo_ce_format_wpseo_noindex( get_post_meta( $product_id, '_yoast_wpseo_meta-robots-noindex', true ) );
920
+ $product->wpseo_follow = woo_ce_format_wpseo_follow( get_post_meta( $product_id, '_yoast_wpseo_meta-robots-nofollow', true ) );
921
+ $product->wpseo_googleplus_description = get_post_meta( $product_id, '_yoast_wpseo_google-plus-description', true );
922
+ $product->wpseo_opengraph_title = get_post_meta( $product_id, '_yoast_wpseo_opengraph-title', true );
923
+ $product->wpseo_opengraph_description = get_post_meta( $product_id, '_yoast_wpseo_opengraph-description', true );
924
+ $product->wpseo_opengraph_image = get_post_meta( $product_id, '_yoast_wpseo_opengraph-image', true );
925
+ $product->wpseo_twitter_title = get_post_meta( $product_id, '_yoast_wpseo_twitter-title', true );
926
+ $product->wpseo_twitter_description = get_post_meta( $product_id, '_yoast_wpseo_twitter-description', true );
927
+ $product->wpseo_twitter_image = get_post_meta( $product_id, '_yoast_wpseo_twitter-image', true );
928
+ }
929
+
930
+ // Ultimate SEO - http://wordpress.org/plugins/seo-ultimate/
931
+ if( woo_ce_detect_export_plugin( 'ultimate_seo' ) ) {
932
+ $product->useo_meta_title = get_post_meta( $product_id, '_su_title', true );
933
+ $product->useo_meta_description = get_post_meta( $product_id, '_su_description', true );
934
+ $product->useo_meta_keywords = get_post_meta( $product_id, '_su_keywords', true );
935
+ $product->useo_social_title = get_post_meta( $product_id, '_su_og_title', true );
936
+ $product->useo_social_description = get_post_meta( $product_id, '_su_og_description', true );
937
+ $product->useo_meta_noindex = get_post_meta( $product_id, '_su_meta_robots_noindex', true );
938
+ $product->useo_meta_noautolinks = get_post_meta( $product_id, '_su_disable_autolinks', true );
939
+ }
940
+
941
+ // WooCommerce MSRP Pricing - http://woothemes.com/woocommerce/
942
+ if( woo_ce_detect_export_plugin( 'wc_msrp' ) ) {
943
+ $product->msrp = get_post_meta( $product_id, '_msrp_price', true );
944
+ if( $product->msrp == false && $product->post_type == 'product_variation' )
945
+ $product->msrp = get_post_meta( $product_id, '_msrp', true );
946
+ // Check that a valid price has been provided and that wc_format_localized_price() exists
947
+ if( isset( $product->msrp ) && $product->msrp != '' && function_exists( 'wc_format_localized_price' ) )
948
+ $product->msrp = wc_format_localized_price( $product->msrp );
949
+ }
950
+
951
+ // Custom Product meta
952
+ $custom_products = woo_ce_get_option( 'custom_products', '' );
953
+ if( !empty( $custom_products ) ) {
954
+ foreach( $custom_products as $custom_product ) {
955
+ // Check that the custom Product name is filled and it hasn't previously been set
956
+ if( !empty( $custom_product ) && !isset( $product->{$custom_product} ) )
957
+ $product->{$custom_product} = get_post_meta( $product_id, $custom_product, true );
958
+ }
959
+ }
960
+
961
+ return $product;
962
+
963
+ }
964
+ add_filter( 'woo_ce_product_item', 'woo_ce_extend_product_item', 10, 2 );
965
+
966
+ function woo_ce_get_wccf_product_properties() {
967
+
968
+ $post_type = 'wccf_product_prop';
969
+ $args = array(
970
+ 'post_type' => $post_type,
971
+ 'post_status' => 'publish',
972
+ 'posts_per_page' => -1
973
+ );
974
+ $product_fields = new WP_Query( $args );
975
+ if( !empty( $product_fields->posts ) ) {
976
+ return $product_fields->posts;
977
+ }
978
+
979
+ }
980
+
981
+ function woo_ce_format_wpseo_noindex( $noindex = '' ) {
982
+
983
+ $output = $noindex;
984
+ if( !empty( $noindex ) && $noindex !== '0' ) {
985
+ switch( $noindex ) {
986
+
987
+ case '0':
988
+ case 'default':
989
+ default:
990
+ $output = __( 'Default', 'woocommerce-exporter' );
991
+ break;
992
+
993
+ case '2':
994
+ case 'index':
995
+ $output = __( 'Always index', 'woocommerce-exporter' );
996
+ break;
997
+
998
+ case '1':
999
+ case 'noindex':
1000
+ $output = __( 'Always noindex', 'woocommerce-exporter' );
1001
+ break;
1002
+
1003
+ }
1004
+ }
1005
+ return $output;
1006
+
1007
+ }
1008
+
1009
+ function woo_ce_format_wpseo_follow( $follow = '' ) {
1010
+
1011
+ $output = $follow;
1012
+ if( !empty( $follow ) && $follow !== '0' ) {
1013
+ switch( $follow ) {
1014
+
1015
+ case '0':
1016
+ default:
1017
+ $output = __( 'follow', 'woocommerce-exporter' );
1018
+ break;
1019
+
1020
+ case '1':
1021
+ $output = __( 'nofollow', 'woocommerce-exporter' );
1022
+ break;
1023
+
1024
+ }
1025
+ }
1026
+ return $output;
1027
+
1028
+ }
1029
+ ?>
includes/product.php ADDED
@@ -0,0 +1,1328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ if( !function_exists( 'woo_ce_get_export_type_product_count' ) ) {
7
+ function woo_ce_get_export_type_product_count() {
8
+
9
+ $count = 0;
10
+ // Check if the existing Transient exists
11
+ $cached = get_transient( WOO_CE_PREFIX . '_product_count' );
12
+ if( $cached == false ) {
13
+ $post_type = apply_filters( 'woo_ce_get_export_type_product_count_post_types', array( 'product', 'product_variation' ) );
14
+ $args = array(
15
+ 'post_type' => $post_type,
16
+ 'posts_per_page' => 1,
17
+ 'fields' => 'ids',
18
+ 'suppress_filters' => true
19
+ );
20
+ $count_query = new WP_Query( $args );
21
+ $count = $count_query->found_posts;
22
+ set_transient( WOO_CE_PREFIX . '_product_count', $count, HOUR_IN_SECONDS );
23
+ } else {
24
+ $count = $cached;
25
+ }
26
+ return $count;
27
+
28
+ }
29
+ }
30
+
31
+ /* End of: WordPress Administration */
32
+
33
+ }
34
+
35
+ // Returns a list of Product export columns
36
+ function woo_ce_get_product_fields( $format = 'full' ) {
37
+
38
+ $export_type = 'product';
39
+
40
+ $fields = array();
41
+ $fields[] = array(
42
+ 'name' => 'parent_id',
43
+ 'label' => __( 'Parent ID', 'woocommerce-exporter' )
44
+ );
45
+ $fields[] = array(
46
+ 'name' => 'parent_sku',
47
+ 'label' => __( 'Parent SKU', 'woocommerce-exporter' )
48
+ );
49
+ $fields[] = array(
50
+ 'name' => 'product_id',
51
+ 'label' => __( 'Product ID', 'woocommerce-exporter' )
52
+ );
53
+ $fields[] = array(
54
+ 'name' => 'sku',
55
+ 'label' => __( 'Product SKU', 'woocommerce-exporter' )
56
+ );
57
+ $fields[] = array(
58
+ 'name' => 'name',
59
+ 'label' => __( 'Product Name', 'woocommerce-exporter' )
60
+ );
61
+ $fields[] = array(
62
+ 'name' => 'post_title',
63
+ 'label' => __( 'Post Title', 'woocommerce-exporter' )
64
+ );
65
+ $fields[] = array(
66
+ 'name' => 'slug',
67
+ 'label' => __( 'Slug', 'woocommerce-exporter' )
68
+ );
69
+ $fields[] = array(
70
+ 'name' => 'permalink',
71
+ 'label' => __( 'Permalink', 'woocommerce-exporter' )
72
+ );
73
+ $fields[] = array(
74
+ 'name' => 'product_url',
75
+ 'label' => __( 'Product URI', 'woocommerce-exporter' )
76
+ );
77
+ $fields[] = array(
78
+ 'name' => 'description',
79
+ 'label' => __( 'Description', 'woocommerce-exporter' )
80
+ );
81
+ $fields[] = array(
82
+ 'name' => 'excerpt',
83
+ 'label' => __( 'Excerpt', 'woocommerce-exporter' )
84
+ );
85
+ $fields[] = array(
86
+ 'name' => 'post_date',
87
+ 'label' => __( 'Product Published', 'woocommerce-exporter' )
88
+ );
89
+ $fields[] = array(
90
+ 'name' => 'post_modified',
91
+ 'label' => __( 'Product Modified', 'woocommerce-exporter' )
92
+ );
93
+ $fields[] = array(
94
+ 'name' => 'type',
95
+ 'label' => __( 'Type', 'woocommerce-exporter' )
96
+ );
97
+ $fields[] = array(
98
+ 'name' => 'visibility',
99
+ 'label' => __( 'Visibility', 'woocommerce-exporter' )
100
+ );
101
+ $fields[] = array(
102
+ 'name' => 'featured',
103
+ 'label' => __( 'Featured', 'woocommerce-exporter' )
104
+ );
105
+ $fields[] = array(
106
+ 'name' => 'virtual',
107
+ 'label' => __( 'Virtual', 'woocommerce-exporter' )
108
+ );
109
+ $fields[] = array(
110
+ 'name' => 'downloadable',
111
+ 'label' => __( 'Downloadable', 'woocommerce-exporter' )
112
+ );
113
+ $fields[] = array(
114
+ 'name' => 'price',
115
+ 'label' => __( 'Price', 'woocommerce-exporter' )
116
+ );
117
+ $fields[] = array(
118
+ 'name' => 'sale_price',
119
+ 'label' => __( 'Sale Price', 'woocommerce-exporter' )
120
+ );
121
+ $fields[] = array(
122
+ 'name' => 'sale_price_dates_from',
123
+ 'label' => __( 'Sale Price Dates From', 'woocommerce-exporter' )
124
+ );
125
+ $fields[] = array(
126
+ 'name' => 'sale_price_dates_to',
127
+ 'label' => __( 'Sale Price Dates To', 'woocommerce-exporter' )
128
+ );
129
+ $fields[] = array(
130
+ 'name' => 'weight',
131
+ 'label' => __( 'Weight', 'woocommerce-exporter' )
132
+ );
133
+ $fields[] = array(
134
+ 'name' => 'weight_unit',
135
+ 'label' => __( 'Weight Unit', 'woocommerce-exporter' )
136
+ );
137
+ $fields[] = array(
138
+ 'name' => 'height',
139
+ 'label' => __( 'Height', 'woocommerce-exporter' )
140
+ );
141
+ $fields[] = array(
142
+ 'name' => 'height_unit',
143
+ 'label' => __( 'Height Unit', 'woocommerce-exporter' )
144
+ );
145
+ $fields[] = array(
146
+ 'name' => 'width',
147
+ 'label' => __( 'Width', 'woocommerce-exporter' )
148
+ );
149
+ $fields[] = array(
150
+ 'name' => 'width_unit',
151
+ 'label' => __( 'Width Unit', 'woocommerce-exporter' )
152
+ );
153
+ $fields[] = array(
154
+ 'name' => 'length',
155
+ 'label' => __( 'Length', 'woocommerce-exporter' )
156
+ );
157
+ $fields[] = array(
158
+ 'name' => 'length_unit',
159
+ 'label' => __( 'Length Unit', 'woocommerce-exporter' )
160
+ );
161
+ $fields[] = array(
162
+ 'name' => 'category',
163
+ 'label' => __( 'Category', 'woocommerce-exporter' )
164
+ );
165
+ $fields[] = array(
166
+ 'name' => 'category_level_1',
167
+ 'label' => __( 'Category: Level 1', 'woocommerce-exporter' ),
168
+ 'disabled' => 1
169
+ );
170
+ $fields[] = array(
171
+ 'name' => 'category_level_2',
172
+ 'label' => __( 'Category: Level 2', 'woocommerce-exporter' ),
173
+ 'disabled' => 1
174
+ );
175
+ $fields[] = array(
176
+ 'name' => 'category_level_3',
177
+ 'label' => __( 'Category: Level 3', 'woocommerce-exporter' ),
178
+ 'disabled' => 1
179
+ );
180
+ $fields[] = array(
181
+ 'name' => 'tag',
182
+ 'label' => __( 'Tag', 'woocommerce-exporter' )
183
+ );
184
+ $fields[] = array(
185
+ 'name' => 'image',
186
+ 'label' => __( 'Featured Image', 'woocommerce-exporter' )
187
+ );
188
+ $fields[] = array(
189
+ 'name' => 'image_thumbnail',
190
+ 'label' => __( 'Featured Image Thumbnail', 'woocommerce-exporter' ),
191
+ 'disabled' => 1
192
+ );
193
+ $fields[] = array(
194
+ 'name' => 'image_embed',
195
+ 'label' => __( 'Featured Image (Embed)', 'woocommerce-exporter' ),
196
+ 'disabled' => 1
197
+ );
198
+ $fields[] = array(
199
+ 'name' => 'product_gallery',
200
+ 'label' => __( 'Product Gallery', 'woocommerce-exporter' )
201
+ );
202
+ $fields[] = array(
203
+ 'name' => 'product_gallery_thumbnail',
204
+ 'label' => __( 'Product Gallery Thumbnail', 'woocommerce-exporter' ),
205
+ 'disabled' => 1
206
+ );
207
+ $fields[] = array(
208
+ 'name' => 'product_gallery_embed',
209
+ 'label' => __( 'Product Gallery (Embed)', 'woocommerce-exporter' ),
210
+ 'disabled' => 1
211
+ );
212
+ $fields[] = array(
213
+ 'name' => 'tax_status',
214
+ 'label' => __( 'Tax Status', 'woocommerce-exporter' )
215
+ );
216
+ $fields[] = array(
217
+ 'name' => 'tax_class',
218
+ 'label' => __( 'Tax Class', 'woocommerce-exporter' )
219
+ );
220
+ $fields[] = array(
221
+ 'name' => 'shipping_class',
222
+ 'label' => __( 'Shipping Class', 'woocommerce-exporter' )
223
+ );
224
+ $fields[] = array(
225
+ 'name' => 'download_file_name',
226
+ 'label' => __( 'Download File Name', 'woocommerce-exporter' )
227
+ );
228
+ $fields[] = array(
229
+ 'name' => 'download_file_path',
230
+ 'label' => __( 'Download File URL Path', 'woocommerce-exporter' )
231
+ );
232
+ $fields[] = array(
233
+ 'name' => 'download_limit',
234
+ 'label' => __( 'Download Limit', 'woocommerce-exporter' )
235
+ );
236
+ $fields[] = array(
237
+ 'name' => 'download_expiry',
238
+ 'label' => __( 'Download Expiry', 'woocommerce-exporter' )
239
+ );
240
+ $fields[] = array(
241
+ 'name' => 'download_type',
242
+ 'label' => __( 'Download Type', 'woocommerce-exporter' )
243
+ );
244
+ $fields[] = array(
245
+ 'name' => 'manage_stock',
246
+ 'label' => __( 'Manage Stock', 'woocommerce-exporter' )
247
+ );
248
+ $fields[] = array(
249
+ 'name' => 'quantity',
250
+ 'label' => __( 'Quantity', 'woocommerce-exporter' )
251
+ );
252
+ $fields[] = array(
253
+ 'name' => 'stock_status',
254
+ 'label' => __( 'Stock Status', 'woocommerce-exporter' )
255
+ );
256
+ $fields[] = array(
257
+ 'name' => 'allow_backorders',
258
+ 'label' => __( 'Allow Backorders', 'woocommerce-exporter' )
259
+ );
260
+ $fields[] = array(
261
+ 'name' => 'sold_individually',
262
+ 'label' => __( 'Sold Individually', 'woocommerce-exporter' )
263
+ );
264
+ $fields[] = array(
265
+ 'name' => 'total_sales',
266
+ 'label' => __( 'Total Sales', 'woocommerce-exporter' ),
267
+ 'disabled' => 1
268
+ );
269
+ $fields[] = array(
270
+ 'name' => 'upsell_ids',
271
+ 'label' => __( 'Up-Sells', 'woocommerce-exporter' )
272
+ );
273
+ $fields[] = array(
274
+ 'name' => 'crosssell_ids',
275
+ 'label' => __( 'Cross-Sells', 'woocommerce-exporter' )
276
+ );
277
+ $fields[] = array(
278
+ 'name' => 'external_url',
279
+ 'label' => __( 'External URL', 'woocommerce-exporter' )
280
+ );
281
+ $fields[] = array(
282
+ 'name' => 'button_text',
283
+ 'label' => __( 'Button Text', 'woocommerce-exporter' )
284
+ );
285
+ $fields[] = array(
286
+ 'name' => 'purchase_note',
287
+ 'label' => __( 'Purchase Note', 'woocommerce-exporter' )
288
+ );
289
+ $fields[] = array(
290
+ 'name' => 'product_status',
291
+ 'label' => __( 'Product Status', 'woocommerce-exporter' )
292
+ );
293
+ $fields[] = array(
294
+ 'name' => 'enable_reviews',
295
+ 'label' => __( 'Enable Reviews', 'woocommerce-exporter' )
296
+ );
297
+ $fields[] = array(
298
+ 'name' => 'review_count',
299
+ 'label' => __( 'Review Count', 'woocommerce-exporter' ),
300
+ 'disabled' => 1
301
+ );
302
+ $fields[] = array(
303
+ 'name' => 'rating_count',
304
+ 'label' => __( 'Rating Count', 'woocommerce-exporter' ),
305
+ 'disabled' => 1
306
+ );
307
+ $fields[] = array(
308
+ 'name' => 'average_rating',
309
+ 'label' => __( 'Average Rating', 'woocommerce-exporter' ),
310
+ 'disabled' => 1
311
+ );
312
+ $fields[] = array(
313
+ 'name' => 'menu_order',
314
+ 'label' => __( 'Sort Order', 'woocommerce-exporter' )
315
+ );
316
+
317
+ /*
318
+ $fields[] = array(
319
+ 'name' => '',
320
+ 'label' => __( '', 'woocommerce-exporter' )
321
+ );
322
+ */
323
+
324
+ // Drop in our content filters here
325
+ add_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
326
+
327
+ // Allow Plugin/Theme authors to add support for additional columns
328
+ $fields = apply_filters( sprintf( WOO_CE_PREFIX . '_%s_fields', $export_type ), $fields, $export_type );
329
+
330
+ // Remove our content filters here to play nice with other Plugins
331
+ remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
332
+
333
+ $remember = woo_ce_get_option( $export_type . '_fields', array() );
334
+ if( !empty( $remember ) ) {
335
+ $remember = maybe_unserialize( $remember );
336
+ $size = count( $fields );
337
+ for( $i = 0; $i < $size; $i++ ) {
338
+ $fields[$i]['disabled'] = ( isset( $fields[$i]['disabled'] ) ? $fields[$i]['disabled'] : 0 );
339
+ $fields[$i]['default'] = 1;
340
+ if( !array_key_exists( $fields[$i]['name'], $remember ) )
341
+ $fields[$i]['default'] = 0;
342
+ }
343
+ }
344
+
345
+ switch( $format ) {
346
+
347
+ case 'summary':
348
+ $output = array();
349
+ $size = count( $fields );
350
+ for( $i = 0; $i < $size; $i++ ) {
351
+ if( isset( $fields[$i] ) )
352
+ $output[$fields[$i]['name']] = 'on';
353
+ }
354
+ return $output;
355
+ break;
356
+
357
+ case 'full':
358
+ default:
359
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
360
+ $size = count( $fields );
361
+ for( $i = 0; $i < $size; $i++ ) {
362
+ $fields[$i]['reset'] = $i;
363
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
364
+ }
365
+ // Check if we are using PHP 5.3 and above
366
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
367
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
368
+ return $fields;
369
+ break;
370
+
371
+ }
372
+
373
+ }
374
+
375
+ // Check if we should override field labels from the Field Editor
376
+ function woo_ce_override_product_field_labels( $fields = array() ) {
377
+
378
+ $labels = woo_ce_get_option( 'product_labels', array() );
379
+ if( !empty( $labels ) ) {
380
+ foreach( $fields as $key => $field ) {
381
+ if( isset( $labels[$field['name']] ) )
382
+ $fields[$key]['label'] = $labels[$field['name']];
383
+ }
384
+ }
385
+ return $fields;
386
+
387
+ }
388
+ add_filter( 'woo_ce_product_fields', 'woo_ce_override_product_field_labels', 11 );
389
+
390
+ // Returns the export column header label based on an export column slug
391
+ function woo_ce_get_product_field( $name = null, $format = 'name' ) {
392
+
393
+ $output = '';
394
+ if( $name ) {
395
+ $fields = woo_ce_get_product_fields();
396
+ $size = count( $fields );
397
+ for( $i = 0; $i < $size; $i++ ) {
398
+ if( $fields[$i]['name'] == $name ) {
399
+ switch( $format ) {
400
+
401
+ case 'name':
402
+ $output = $fields[$i]['label'];
403
+ break;
404
+
405
+ case 'full':
406
+ $output = $fields[$i];
407
+ break;
408
+
409
+ }
410
+ $i = $size;
411
+ }
412
+ }
413
+ }
414
+ return $output;
415
+
416
+ }
417
+
418
+ // Returns a list of WooCommerce Products
419
+ function woo_ce_get_products( $args = array() ) {
420
+
421
+ global $export;
422
+
423
+ $limit_volume = -1;
424
+ $offset = 0;
425
+ $product_categories = false;
426
+ $product_tags = false;
427
+ $product_status = false;
428
+ $product_type = false;
429
+ $orderby = 'ID';
430
+ $order = 'ASC';
431
+ if( $args ) {
432
+ $limit_volume = ( isset( $args['limit_volume'] ) ? $args['limit_volume'] : false );
433
+ $offset = ( isset( $args['offset'] ) ? $args['offset'] : false );
434
+ if( !empty( $args['product_categories'] ) )
435
+ $product_categories = $args['product_categories'];
436
+ if( !empty( $args['product_tags'] ) )
437
+ $product_tags = $args['product_tags'];
438
+ if( !empty( $args['product_status'] ) )
439
+ $product_status = $args['product_status'];
440
+ if( !empty( $args['product_type'] ) )
441
+ $product_type = $args['product_type'];
442
+ if( isset( $args['product_orderby'] ) )
443
+ $orderby = $args['product_orderby'];
444
+ if( isset( $args['product_order'] ) )
445
+ $order = $args['product_order'];
446
+ }
447
+ $post_type = array( 'product', 'product_variation' );
448
+ $args = array(
449
+ 'post_type' => $post_type,
450
+ 'orderby' => $orderby,
451
+ 'order' => $order,
452
+ 'offset' => $offset,
453
+ 'posts_per_page' => $limit_volume,
454
+ 'post_status' => woo_ce_post_statuses(),
455
+ 'fields' => 'ids',
456
+ 'suppress_filters' => false
457
+ );
458
+ // Filter Products by Product Category
459
+ if( $product_categories ) {
460
+ $term_taxonomy = 'product_cat';
461
+ // Check if tax_query has been created
462
+ if( !isset( $args['tax_query'] ) )
463
+ $args['tax_query'] = array();
464
+ $args['tax_query'][] = array(
465
+ array(
466
+ 'taxonomy' => $term_taxonomy,
467
+ 'field' => 'id',
468
+ 'terms' => $product_categories
469
+ )
470
+ );
471
+ }
472
+ // Filter Products by Product Tag
473
+ if( $product_tags ) {
474
+ $term_taxonomy = 'product_tag';
475
+ // Check if tax_query has been created
476
+ if( !isset( $args['tax_query'] ) )
477
+ $args['tax_query'] = array();
478
+ $args['tax_query'][] = array(
479
+ array(
480
+ 'taxonomy' => $term_taxonomy,
481
+ 'field' => 'id',
482
+ 'terms' => $product_tags
483
+ )
484
+ );
485
+ }
486
+ if( $product_status )
487
+ $args['post_status'] = woo_ce_post_statuses( $product_status, true );
488
+ if( $product_type ) {
489
+ if( in_array( 'variation', $product_type ) && count( $product_type ) == 1 )
490
+ $args['post_type'] = array( 'product_variation' );
491
+ if( !empty( $product_type ) ) {
492
+ $term_taxonomy = 'product_type';
493
+ $args['tax_query'] = array(
494
+ array(
495
+ 'taxonomy' => $term_taxonomy,
496
+ 'field' => 'slug',
497
+ 'terms' => $product_type
498
+ )
499
+ );
500
+ } else {
501
+ unset( $args['meta_query'] );
502
+ }
503
+ }
504
+ // Sort Products by SKU
505
+ if( $orderby == 'sku' ) {
506
+ $args['orderby'] = 'meta_value';
507
+ $args['meta_key'] = '_sku';
508
+ }
509
+ $products = array();
510
+ $product_ids = new WP_Query( $args );
511
+ if( $product_ids->posts ) {
512
+ foreach( $product_ids->posts as $product_id ) {
513
+
514
+ // Get Product details
515
+ $product = get_post( $product_id );
516
+
517
+ // Filter out Variations that don't have a Parent Product that exists
518
+ if( isset( $product->post_type ) && $product->post_type == 'product_variation' ) {
519
+ // Check if Parent exists
520
+ if( $product->post_parent ) {
521
+ if( get_post( $product->post_parent ) == false ) {
522
+ unset( $product_id, $product );
523
+ continue;
524
+ }
525
+ }
526
+ }
527
+ if( isset( $product_id ) )
528
+ $products[] = $product_id;
529
+ }
530
+ // Only populate the $export Global if it is an export
531
+ if( isset( $export ) )
532
+ $export->total_rows = count( $products );
533
+ unset( $product_ids, $product_id );
534
+ }
535
+ return $products;
536
+
537
+ }
538
+
539
+ function woo_ce_get_product_data( $product_id = 0, $args = array() ) {
540
+
541
+ // Get Product defaults
542
+ $weight_unit = get_option( 'woocommerce_weight_unit' );
543
+ $dimension_unit = get_option( 'woocommerce_dimension_unit' );
544
+ $height_unit = $dimension_unit;
545
+ $width_unit = $dimension_unit;
546
+ $length_unit = $dimension_unit;
547
+
548
+ $product = get_post( $product_id );
549
+ $_product = ( function_exists( 'wc_get_product' ) ? wc_get_product( $product_id ) : false );
550
+ // Check for corrupt Products
551
+ if( $_product == false )
552
+ return false;
553
+
554
+ $product->parent_id = '';
555
+ $product->parent_sku = '';
556
+ if( $product->post_type == 'product_variation' ) {
557
+ // Assign Parent ID for Variants then check if Parent exists
558
+ if( $product->parent_id = $product->post_parent )
559
+ $product->parent_sku = get_post_meta( $product->post_parent, '_sku', true );
560
+ else
561
+ $product->parent_id = '';
562
+ }
563
+ $product->product_id = $product_id;
564
+ $product->sku = get_post_meta( $product_id, '_sku', true );
565
+ $product->name = get_the_title( $product_id );
566
+ if( $product->post_type <> 'product_variation' )
567
+ $product->permalink = get_permalink( $product_id );
568
+ $product->product_url = ( method_exists( $_product, 'get_permalink' ) ? $_product->get_permalink() : get_permalink( $product_id ) );
569
+ $product->slug = $product->post_name;
570
+ $product->description = $product->post_content;
571
+ $product->excerpt = $product->post_excerpt;
572
+ $product->regular_price = get_post_meta( $product_id, '_regular_price', true );
573
+ // Check that a valid price has been provided and that wc_format_localized_price() exists
574
+ if( isset( $product->regular_price ) && $product->regular_price != '' && function_exists( 'wc_format_localized_price' ) )
575
+ $product->regular_price = wc_format_localized_price( $product->regular_price );
576
+ $product->price = get_post_meta( $product_id, '_price', true );
577
+ if( $product->regular_price != '' && ( $product->regular_price <> $product->price ) )
578
+ $product->price = $product->regular_price;
579
+ // Check that a valid price has been provided and that wc_format_localized_price() exists
580
+ if( isset( $product->price ) && $product->price != '' && function_exists( 'wc_format_localized_price' ) )
581
+ $product->price = wc_format_localized_price( $product->price );
582
+ $product->sale_price = get_post_meta( $product_id, '_sale_price', true );
583
+ // Check that a valid price has been provided and that wc_format_localized_price() exists
584
+ if( isset( $product->sale_price ) && $product->sale_price != '' && function_exists( 'wc_format_localized_price' ) )
585
+ $product->sale_price = wc_format_localized_price( $product->sale_price );
586
+ $product->sale_price_dates_from = woo_ce_format_product_sale_price_dates( get_post_meta( $product_id, '_sale_price_dates_from', true ) );
587
+ $product->sale_price_dates_to = woo_ce_format_product_sale_price_dates( get_post_meta( $product_id, '_sale_price_dates_to', true ) );
588
+ $product->post_date = woo_ce_format_date( $product->post_date );
589
+ $product->post_modified = woo_ce_format_date( $product->post_modified );
590
+ $product->type = woo_ce_get_product_assoc_type( $product_id );
591
+ if( $product->post_type == 'product_variation' ) {
592
+ $product->type = __( 'Variation', 'woocommerce-exporter' );
593
+ }
594
+ $product->visibility = woo_ce_format_product_visibility( get_post_meta( $product_id, '_visibility', true ) );
595
+ $product->featured = woo_ce_format_switch( get_post_meta( $product_id, '_featured', true ) );
596
+ $product->virtual = woo_ce_format_switch( get_post_meta( $product_id, '_virtual', true ) );
597
+ $product->downloadable = woo_ce_format_switch( get_post_meta( $product_id, '_downloadable', true ) );
598
+ $product->weight = get_post_meta( $product_id, '_weight', true );
599
+ $product->weight_unit = ( $product->weight != '' ? $weight_unit : '' );
600
+ $product->height = get_post_meta( $product_id, '_height', true );
601
+ $product->height_unit = ( $product->height != '' ? $height_unit : '' );
602
+ $product->width = get_post_meta( $product_id, '_width', true );
603
+ $product->width_unit = ( $product->width != '' ? $width_unit : '' );
604
+ $product->length = get_post_meta( $product_id, '_length', true );
605
+ $product->length_unit = ( $product->length != '' ? $length_unit : '' );
606
+ $product->category = woo_ce_get_product_assoc_categories( $product_id, $product->parent_id );
607
+ $product->tag = woo_ce_get_product_assoc_tags( $product_id );
608
+ $product->manage_stock = get_post_meta( $product_id, '_manage_stock', true );
609
+ $product->allow_backorders = woo_ce_format_product_allow_backorders( get_post_meta( $product_id, '_backorders', true ) );
610
+ $product->sold_individually = woo_ce_format_switch( get_post_meta( $product_id, '_sold_individually', true ) );
611
+ $product->upsell_ids = woo_ce_get_product_assoc_upsell_ids( $product_id );
612
+ $product->crosssell_ids = woo_ce_get_product_assoc_crosssell_ids( $product_id );
613
+ $product->quantity = get_post_meta( $product_id, '_stock', true );
614
+ $product->stock_status = woo_ce_format_product_stock_status( get_post_meta( $product_id, '_stock_status', true ), $product->quantity );
615
+ $product->image = woo_ce_get_product_assoc_featured_image( $product_id );
616
+ $product->product_gallery = woo_ce_get_product_assoc_product_gallery( $product_id );
617
+ $product->tax_status = woo_ce_format_product_tax_status( get_post_meta( $product_id, '_tax_status', true ) );
618
+ $product->tax_class = woo_ce_format_product_tax_class( get_post_meta( $product_id, '_tax_class', true ) );
619
+ $product->shipping_class = woo_ce_get_product_assoc_shipping_class( $product_id );
620
+ $product->external_url = get_post_meta( $product_id, '_product_url', true );
621
+ $product->button_text = get_post_meta( $product_id, '_button_text', true );
622
+ $product->download_file_path = woo_ce_get_product_assoc_download_files( $product_id, 'url' );
623
+ $product->download_file_name = woo_ce_get_product_assoc_download_files( $product_id, 'name' );
624
+ $product->download_limit = get_post_meta( $product_id, '_download_limit', true );
625
+ $product->download_expiry = get_post_meta( $product_id, '_download_expiry', true );
626
+ $product->download_type = woo_ce_format_product_download_type( get_post_meta( $product_id, '_download_type', true ) );
627
+ $product->purchase_note = get_post_meta( $product_id, '_purchase_note', true );
628
+ $product->product_status = woo_ce_format_post_status( $product->post_status );
629
+ $product->enable_reviews = woo_ce_format_comment_status( $product->comment_status );
630
+ $product->menu_order = $product->menu_order;
631
+ unset( $_product );
632
+
633
+ // Scan for global Attributes first
634
+ $attributes = woo_ce_get_product_attributes();
635
+ if( !empty( $attributes ) && $product->post_type == 'product_variation' ) {
636
+ // We're dealing with a single Variation, strap yourself in.
637
+ foreach( $attributes as $attribute ) {
638
+ $attribute_value = get_post_meta( $product_id, sprintf( 'attribute_pa_%s', $attribute->attribute_name ), true );
639
+ if( !empty( $attribute_value ) ) {
640
+ $term_id = term_exists( $attribute_value, sprintf( 'pa_%s', $attribute->attribute_name ) );
641
+ if( $term_id !== 0 && $term_id !== null && !is_wp_error( $term_id ) ) {
642
+ $term = get_term( $term_id['term_id'], sprintf( 'pa_%s', $attribute->attribute_name ) );
643
+ $attribute_value = $term->name;
644
+ unset( $term );
645
+ }
646
+ unset( $term_id );
647
+ }
648
+ $product->{'attribute_' . $attribute->attribute_name} = $attribute_value;
649
+ unset( $attribute_value );
650
+ }
651
+ } else {
652
+ // Either the Variation Parent or a Simple Product, scan for global and custom Attributes
653
+ $product->attributes = maybe_unserialize( get_post_meta( $product_id, '_product_attributes', true ) );
654
+ if( !empty( $product->attributes ) ) {
655
+ // Check for taxonomy-based attributes
656
+ foreach( $attributes as $attribute ) {
657
+ if( isset( $product->attributes['pa_' . $attribute->attribute_name] ) )
658
+ $product->{'attribute_' . $attribute->attribute_name} = woo_ce_get_product_assoc_attributes( $product_id, $product->attributes['pa_' . $attribute->attribute_name], 'product' );
659
+ else
660
+ $product->{'attribute_' . $attribute->attribute_name} = woo_ce_get_product_assoc_attributes( $product_id, $attribute, 'global' );
661
+ }
662
+ // Check for per-Product attributes (custom)
663
+ foreach( $product->attributes as $key => $attribute ) {
664
+ if( $attribute['is_taxonomy'] == 0 ) {
665
+ if( !isset( $product->{'attribute_' . $key} ) )
666
+ $product->{'attribute_' . $key} = $attribute['value'];
667
+ }
668
+ }
669
+ }
670
+ }
671
+
672
+ // Allow Plugin/Theme authors to add support for additional Product columns
673
+ $product = apply_filters( 'woo_ce_product_item', $product, $product_id );
674
+
675
+ return $product;
676
+
677
+ }
678
+
679
+ // Returns Product Categories associated to a specific Product
680
+ function woo_ce_get_product_assoc_categories( $product_id = 0, $parent_id = 0 ) {
681
+
682
+ global $export;
683
+
684
+ $output = '';
685
+ $term_taxonomy = 'product_cat';
686
+ // Return Product Categories of Parent if this is a Variation
687
+ $categories = array();
688
+ if( !empty( $parent_id ) )
689
+ $product_id = $parent_id;
690
+ if( !empty( $product_id ) )
691
+ $categories = wp_get_object_terms( $product_id, $term_taxonomy );
692
+ if( !empty( $categories ) && !is_wp_error( $categories ) ) {
693
+ $size = apply_filters( 'woo_ce_get_product_assoc_categories_size', count( $categories ) );
694
+ for( $i = 0; $i < $size; $i++ ) {
695
+ if( $categories[$i]->parent == '0' ) {
696
+ $output .= $categories[$i]->name . $export->category_separator;
697
+ } else {
698
+ // Check if Parent -> Child
699
+ $parent_category = get_term( $categories[$i]->parent, $term_taxonomy );
700
+ // Check if Parent -> Child -> Subchild
701
+ if( $parent_category->parent == '0' ) {
702
+ $output .= $parent_category->name . '>' . $categories[$i]->name . $export->category_separator;
703
+ $output = str_replace( $parent_category->name . $export->category_separator, '', $output );
704
+ } else {
705
+ $root_category = get_term( $parent_category->parent, $term_taxonomy );
706
+ $output .= $root_category->name . '>' . $parent_category->name . '>' . $categories[$i]->name . $export->category_separator;
707
+ $output = str_replace( array(
708
+ $root_category->name . '>' . $parent_category->name . $export->category_separator,
709
+ $parent_category->name . $export->category_separator
710
+ ), '', $output );
711
+ }
712
+ unset( $root_category, $parent_category );
713
+ }
714
+ }
715
+ $output = substr( $output, 0, -1 );
716
+ } else {
717
+ $output .= __( 'Uncategorized', 'woocommerce-exporter' );
718
+ }
719
+ return $output;
720
+
721
+ }
722
+
723
+ // Returns Product Tags associated to a specific Product
724
+ function woo_ce_get_product_assoc_tags( $product_id = 0 ) {
725
+
726
+ global $export;
727
+
728
+ $output = '';
729
+ $term_taxonomy = 'product_tag';
730
+ $tags = wp_get_object_terms( $product_id, $term_taxonomy );
731
+ if( !empty( $tags ) && is_wp_error( $tags ) == false ) {
732
+ $size = count( $tags );
733
+ for( $i = 0; $i < $size; $i++ ) {
734
+ if( $tag = get_term( $tags[$i]->term_id, $term_taxonomy ) )
735
+ $output .= $tag->name . $export->category_separator;
736
+ }
737
+ $output = substr( $output, 0, -1 );
738
+ }
739
+ return $output;
740
+
741
+ }
742
+
743
+ // Returns the Featured Image associated to a specific Product
744
+ function woo_ce_get_product_assoc_featured_image( $product_id = 0 ) {
745
+
746
+ $output = '';
747
+ if( !empty( $product_id ) ) {
748
+ $thumbnail_id = get_post_meta( $product_id, '_thumbnail_id', true );
749
+ if( !empty( $thumbnail_id ) ) {
750
+ $output = wp_get_attachment_url( $thumbnail_id );
751
+ }
752
+ }
753
+ return $output;
754
+
755
+ }
756
+
757
+ // Returns the Product Galleries associated to a specific Product
758
+ function woo_ce_get_product_assoc_product_gallery( $product_id = 0, $size = 'full' ) {
759
+
760
+ global $export;
761
+
762
+ if( !empty( $product_id ) ) {
763
+ $images = get_post_meta( $product_id, '_product_image_gallery', true );
764
+ if( !empty( $images ) ) {
765
+ $images = explode( ',', $images );
766
+ $size = count( $images );
767
+ for( $i = 0; $i < $size; $i++ ) {
768
+ // Post ID
769
+ if( $export->gallery_formatting == 0 ) {
770
+ continue;
771
+ // Media URL
772
+ } else {
773
+ if( $size == 'full' )
774
+ $images[$i] = wp_get_attachment_url( $images[$i] );
775
+ else if( $size == 'thumbnail' )
776
+ $images[$i] = wp_get_attachment_thumb_url( $images[$i] );
777
+ }
778
+ }
779
+ $output = implode( $export->category_separator, $images );
780
+ return $output;
781
+ }
782
+ }
783
+
784
+ }
785
+
786
+ // Returns the Product Type of a specific Product
787
+ function woo_ce_get_product_assoc_type( $product_id = 0 ) {
788
+
789
+ global $export;
790
+
791
+ $output = '';
792
+ $term_taxonomy = 'product_type';
793
+ $types = wp_get_object_terms( $product_id, $term_taxonomy );
794
+ if( empty( $types ) )
795
+ $types = array( get_term_by( 'name', 'simple', $term_taxonomy ) );
796
+ if( $types ) {
797
+ $size = count( $types );
798
+ for( $i = 0; $i < $size; $i++ ) {
799
+ $type = get_term( $types[$i]->term_id, $term_taxonomy );
800
+ $output .= woo_ce_format_product_type( $type->name ) . $export->category_separator;
801
+ }
802
+ $output = substr( $output, 0, -1 );
803
+ }
804
+ return $output;
805
+
806
+ }
807
+
808
+ // Returns the Shipping Class of a specific Product
809
+ function woo_ce_get_product_assoc_shipping_class( $product_id = 0 ) {
810
+
811
+ global $export;
812
+
813
+ $output = '';
814
+ $term_taxonomy = 'product_shipping_class';
815
+ $types = wp_get_object_terms( $product_id, $term_taxonomy );
816
+ if( empty( $types ) )
817
+ $types = get_term_by( 'name', 'simple', $term_taxonomy );
818
+ if( !empty( $types ) ) {
819
+ $size = count( $types );
820
+ for( $i = 0; $i < $size; $i++ ) {
821
+ $type = get_term( $types[$i]->term_id, $term_taxonomy );
822
+ if( is_wp_error( $type ) !== true )
823
+ $output .= $type->name . $export->category_separator;
824
+ }
825
+ $output = substr( $output, 0, -1 );
826
+ }
827
+ return $output;
828
+
829
+ }
830
+
831
+ // Returns the Up-Sell associated to a specific Product
832
+ function woo_ce_get_product_assoc_upsell_ids( $product_id = 0 ) {
833
+
834
+ global $export;
835
+
836
+ $output = '';
837
+ if( $product_id ) {
838
+ $upsell_ids = get_post_meta( $product_id, '_upsell_ids', true );
839
+ // Convert Product ID to Product SKU as per Up-Sells Formatting
840
+ if( $export->upsell_formatting == 1 && !empty( $upsell_ids ) ) {
841
+ $size = count( $upsell_ids );
842
+ for( $i = 0; $i < $size; $i++ ) {
843
+ $upsell_ids[$i] = get_post_meta( $upsell_ids[$i], '_sku', true );
844
+ if( empty( $upsell_ids[$i] ) )
845
+ unset( $upsell_ids[$i] );
846
+ }
847
+ // 'reindex' array
848
+ $upsell_ids = array_values( $upsell_ids );
849
+ }
850
+ $output = woo_ce_convert_product_ids( $upsell_ids );
851
+ }
852
+ return $output;
853
+
854
+ }
855
+
856
+ // Returns the Cross-Sell associated to a specific Product
857
+ function woo_ce_get_product_assoc_crosssell_ids( $product_id = 0 ) {
858
+
859
+ global $export;
860
+
861
+ $output = '';
862
+ if( $product_id ) {
863
+ $crosssell_ids = get_post_meta( $product_id, '_crosssell_ids', true );
864
+ // Convert Product ID to Product SKU as per Cross-Sells Formatting
865
+ if( $export->crosssell_formatting == 1 && !empty( $crosssell_ids ) ) {
866
+ $size = count( $crosssell_ids );
867
+ for( $i = 0; $i < $size; $i++ ) {
868
+ $crosssell_ids[$i] = get_post_meta( $crosssell_ids[$i], '_sku', true );
869
+ // Remove Cross-Sell if SKU is empty
870
+ if( empty( $crosssell_ids[$i] ) )
871
+ unset( $crosssell_ids[$i] );
872
+ }
873
+ // 'reindex' array
874
+ $crosssell_ids = array_values( $crosssell_ids );
875
+ }
876
+ $output = woo_ce_convert_product_ids( $crosssell_ids );
877
+ }
878
+ return $output;
879
+
880
+ }
881
+
882
+ // Returns Product Attributes associated to a specific Product
883
+ function woo_ce_get_product_assoc_attributes( $product_id = 0, $attribute = array(), $type = 'product' ) {
884
+
885
+ global $export;
886
+
887
+ $output = '';
888
+ if( $product_id ) {
889
+ $terms = array();
890
+ if( $type == 'product' ) {
891
+ if( $attribute['is_taxonomy'] == 1 )
892
+ $term_taxonomy = $attribute['name'];
893
+ } else if( $type == 'global' ) {
894
+ $term_taxonomy = 'pa_' . $attribute->attribute_name;
895
+ }
896
+ $terms = wp_get_object_terms( $product_id, $term_taxonomy );
897
+ if( !empty( $terms ) && is_wp_error( $terms ) == false ) {
898
+ $size = count( $terms );
899
+ for( $i = 0; $i < $size; $i++ )
900
+ $output .= $terms[$i]->name . $export->category_separator;
901
+ unset( $terms );
902
+ }
903
+ $output = substr( $output, 0, -1 );
904
+ }
905
+ return $output;
906
+
907
+ }
908
+
909
+ // Returns File Downloads associated to a specific Product
910
+ function woo_ce_get_product_assoc_download_files( $product_id = 0, $type = 'url' ) {
911
+
912
+ global $export;
913
+
914
+ $output = '';
915
+ if( $product_id ) {
916
+ if( version_compare( WOOCOMMERCE_VERSION, '2.0', '>=' ) ) {
917
+ // If WooCommerce 2.0+ is installed then use new _downloadable_files Post meta key
918
+ if( $file_downloads = maybe_unserialize( get_post_meta( $product_id, '_downloadable_files', true ) ) ) {
919
+ foreach( $file_downloads as $file_download ) {
920
+ if( $type == 'url' )
921
+ $output .= $file_download['file'] . $export->category_separator;
922
+ else if( $type == 'name' )
923
+ $output .= $file_download['name'] . $export->category_separator;
924
+ }
925
+ unset( $file_download, $file_downloads );
926
+ }
927
+ $output = substr( $output, 0, -1 );
928
+ } else {
929
+ // If WooCommerce -2.0 is installed then use legacy _file_paths Post meta key
930
+ if( $file_downloads = maybe_unserialize( get_post_meta( $product_id, '_file_paths', true ) ) ) {
931
+ foreach( $file_downloads as $file_download ) {
932
+ if( $type == 'url' )
933
+ $output .= $file_download . $export->category_separator;
934
+ }
935
+ unset( $file_download, $file_downloads );
936
+ }
937
+ $output = substr( $output, 0, -1 );
938
+ }
939
+ }
940
+ return $output;
941
+
942
+ }
943
+
944
+ // Returns list of Product Add-on columns
945
+ function woo_ce_get_product_addons() {
946
+
947
+ // Product Add-ons - http://www.woothemes.com/
948
+ if( class_exists( 'Product_Addon_Admin' ) || class_exists( 'Product_Addon_Display' ) ) {
949
+ $post_type = 'global_product_addon';
950
+ $args = array(
951
+ 'post_type' => $post_type,
952
+ 'numberposts' => -1
953
+ );
954
+ $output = array();
955
+
956
+ // First grab the Global Product Add-ons
957
+ if( $product_addons = get_posts( $args ) ) {
958
+ foreach( $product_addons as $product_addon ) {
959
+ if( $meta = maybe_unserialize( get_post_meta( $product_addon->ID, '_product_addons', true ) ) ) {
960
+ $size = count( $meta );
961
+ for( $i = 0; $i < $size; $i++ ) {
962
+ $output[] = (object)array(
963
+ 'post_name' => $meta[$i]['name'],
964
+ 'post_title' => $meta[$i]['name'],
965
+ 'form_title' => $product_addon->post_title
966
+ );
967
+ }
968
+ }
969
+ }
970
+ }
971
+ }
972
+
973
+ // Custom Order Items
974
+ if( $custom_order_items = woo_ce_get_option( 'custom_order_items', '' ) ) {
975
+ foreach( $custom_order_items as $custom_order_item ) {
976
+ $output[] = (object)array(
977
+ 'post_name' => $custom_order_item,
978
+ 'post_title' => $custom_order_item
979
+ );
980
+ }
981
+ }
982
+
983
+ return $output;
984
+
985
+ }
986
+
987
+ function woo_ce_format_product_visibility( $visibility = '' ) {
988
+
989
+ $output = '';
990
+ if( !empty( $visibility ) ) {
991
+ switch( $visibility ) {
992
+
993
+ case 'visible':
994
+ $output = __( 'Catalog & Search', 'woocommerce-exporter' );
995
+ break;
996
+
997
+ case 'catalog':
998
+ $output = __( 'Catalog', 'woocommerce-exporter' );
999
+ break;
1000
+
1001
+ case 'search':
1002
+ $output = __( 'Search', 'woocommerce-exporter' );
1003
+ break;
1004
+
1005
+ case 'hidden':
1006
+ $output = __( 'Hidden', 'woocommerce-exporter' );
1007
+ break;
1008
+
1009
+ }
1010
+ }
1011
+ return $output;
1012
+
1013
+ }
1014
+
1015
+ function woo_ce_format_product_allow_backorders( $allow_backorders = '' ) {
1016
+
1017
+ $output = '';
1018
+ if( !empty( $allow_backorders ) ) {
1019
+ switch( $allow_backorders ) {
1020
+
1021
+ case 'yes':
1022
+ case 'no':
1023
+ $output = woo_ce_format_switch( $allow_backorders );
1024
+ break;
1025
+
1026
+ case 'notify':
1027
+ $output = __( 'Notify', 'woocommerce-exporter' );
1028
+ break;
1029
+
1030
+ }
1031
+ }
1032
+ return $output;
1033
+
1034
+ }
1035
+
1036
+ function woo_ce_format_product_download_type( $download_type = '' ) {
1037
+
1038
+ $output = __( 'Standard', 'woocommerce-exporter' );
1039
+ if( !empty( $download_type ) ) {
1040
+ switch( $download_type ) {
1041
+
1042
+ case 'application':
1043
+ $output = __( 'Application', 'woocommerce-exporter' );
1044
+ break;
1045
+
1046
+ case 'music':
1047
+ $output = __( 'Music', 'woocommerce-exporter' );
1048
+ break;
1049
+
1050
+ }
1051
+ }
1052
+ return $output;
1053
+
1054
+ }
1055
+
1056
+ function woo_ce_format_gpf_availability( $availability = null ) {
1057
+
1058
+ $output = '';
1059
+ if( !empty( $availability ) ) {
1060
+ switch( $availability ) {
1061
+
1062
+ case 'in stock':
1063
+ $output = __( 'In Stock', 'woocommerce-exporter' );
1064
+ break;
1065
+
1066
+ case 'available for order':
1067
+ $output = __( 'Available For Order', 'woocommerce-exporter' );
1068
+ break;
1069
+
1070
+ case 'preorder':
1071
+ $output = __( 'Pre-order', 'woocommerce-exporter' );
1072
+ break;
1073
+
1074
+ }
1075
+ }
1076
+ return $output;
1077
+
1078
+ }
1079
+
1080
+ function woo_ce_format_gpf_condition( $condition ) {
1081
+
1082
+ $output = '';
1083
+ if( !empty( $condition ) ) {
1084
+ switch( $condition ) {
1085
+
1086
+ case 'new':
1087
+ $output = __( 'New', 'woocommerce-exporter' );
1088
+ break;
1089
+
1090
+ case 'refurbished':
1091
+ $output = __( 'Refurbished', 'woocommerce-exporter' );
1092
+ break;
1093
+
1094
+ case 'used':
1095
+ $output = __( 'Used', 'woocommerce-exporter' );
1096
+ break;
1097
+
1098
+ }
1099
+ }
1100
+ return $output;
1101
+
1102
+ }
1103
+
1104
+ function woo_ce_format_product_stock_status( $stock_status = '', $stock = '' ) {
1105
+
1106
+ $output = '';
1107
+ if( empty( $stock_status ) && !empty( $stock ) ) {
1108
+ if( $stock )
1109
+ $stock_status = 'instock';
1110
+ else
1111
+ $stock_status = 'outofstock';
1112
+ }
1113
+ if( $stock_status ) {
1114
+ switch( $stock_status ) {
1115
+
1116
+ case 'instock':
1117
+ $output = __( 'In Stock', 'woocommerce-exporter' );
1118
+ break;
1119
+
1120
+ case 'outofstock':
1121
+ $output = __( 'Out of Stock', 'woocommerce-exporter' );
1122
+ break;
1123
+
1124
+ }
1125
+ }
1126
+ return $output;
1127
+
1128
+ }
1129
+
1130
+ function woo_ce_format_product_tax_status( $tax_status = null ) {
1131
+
1132
+ $output = '';
1133
+ if( !empty( $tax_status ) ) {
1134
+ switch( $tax_status ) {
1135
+
1136
+ case 'taxable':
1137
+ $output = __( 'Taxable', 'woocommerce-exporter' );
1138
+ break;
1139
+
1140
+ case 'shipping':
1141
+ $output = __( 'Shipping Only', 'woocommerce-exporter' );
1142
+ break;
1143
+
1144
+ case 'none':
1145
+ $output = __( 'None', 'woocommerce-exporter' );
1146
+ break;
1147
+
1148
+ }
1149
+ }
1150
+ return $output;
1151
+
1152
+ }
1153
+
1154
+ function woo_ce_format_product_tax_class( $tax_class = '' ) {
1155
+
1156
+ global $export;
1157
+
1158
+ $output = '';
1159
+ if( $tax_class ) {
1160
+ switch( $tax_class ) {
1161
+
1162
+ case '*':
1163
+ $tax_class = __( 'Standard', 'woocommerce-exporter' );
1164
+ break;
1165
+
1166
+ case 'reduced-rate':
1167
+ $tax_class = __( 'Reduced Rate', 'woocommerce-exporter' );
1168
+ break;
1169
+
1170
+ case 'zero-rate':
1171
+ $tax_class = __( 'Zero Rate', 'woocommerce-exporter' );
1172
+ break;
1173
+
1174
+ }
1175
+ $output = $tax_class;
1176
+ }
1177
+ return $output;
1178
+
1179
+ }
1180
+
1181
+ function woo_ce_format_product_type( $type_id = '' ) {
1182
+
1183
+ $output = $type_id;
1184
+ if( $output ) {
1185
+ $product_types = apply_filters( 'woo_ce_format_product_types', array(
1186
+ 'simple' => __( 'Simple Product', 'woocommerce' ),
1187
+ 'downloadable' => __( 'Downloadable', 'woocommerce' ),
1188
+ 'grouped' => __( 'Grouped Product', 'woocommerce' ),
1189
+ 'virtual' => __( 'Virtual', 'woocommerce' ),
1190
+ 'variable' => __( 'Variable', 'woocommerce' ),
1191
+ 'external' => __( 'External/Affiliate Product', 'woocommerce' ),
1192
+ 'variation' => __( 'Variation', 'woocommerce-exporter' )
1193
+ ) );
1194
+ if( isset( $product_types[$type_id] ) )
1195
+ $output = $product_types[$type_id];
1196
+ }
1197
+ return $output;
1198
+
1199
+ }
1200
+
1201
+ // Returns a list of WooCommerce Product Types to export process
1202
+ function woo_ce_get_product_types() {
1203
+
1204
+ $term_taxonomy = 'product_type';
1205
+ $args = array(
1206
+ 'hide_empty' => 0
1207
+ );
1208
+ $types = get_terms( $term_taxonomy, $args );
1209
+ if( !empty( $types ) && is_wp_error( $types ) == false ) {
1210
+ $output = array();
1211
+ $size = count( $types );
1212
+ for( $i = 0; $i < $size; $i++ ) {
1213
+ $output[$types[$i]->slug] = array(
1214
+ 'name' => ucfirst( $types[$i]->name ),
1215
+ 'count' => $types[$i]->count
1216
+ );
1217
+ // Override the Product Type count for Downloadable and Virtual
1218
+ if( in_array( $types[$i]->slug, array( 'downloadable', 'virtual' ) ) ) {
1219
+ if( $types[$i]->slug == 'downloadable' ) {
1220
+ $args = array(
1221
+ 'meta_key' => '_downloadable',
1222
+ 'meta_value' => 'yes'
1223
+ );
1224
+ } else if( $types[$i]->slug == 'virtual' ) {
1225
+ $args = array(
1226
+ 'meta_key' => '_virtual',
1227
+ 'meta_value' => 'yes'
1228
+ );
1229
+ }
1230
+ $output[$types[$i]->slug]['count'] = woo_ce_get_product_type_count( 'product', $args );
1231
+ }
1232
+ }
1233
+ $output['variation'] = array(
1234
+ 'name' => __( 'variation', 'woocommerce-exporter' ),
1235
+ 'count' => woo_ce_get_product_type_count( 'product_variation' )
1236
+ );
1237
+ asort( $output );
1238
+ return $output;
1239
+ }
1240
+
1241
+ }
1242
+
1243
+ function woo_ce_get_product_type_count( $post_type = 'product', $args = array() ) {
1244
+
1245
+ $defaults = array(
1246
+ 'post_type' => $post_type,
1247
+ 'posts_per_page' => 1,
1248
+ 'fields' => 'ids'
1249
+ );
1250
+ $args = wp_parse_args( $args, $defaults );
1251
+ $product_ids = new WP_Query( $args );
1252
+ $size = $product_ids->found_posts;
1253
+ return $size;
1254
+
1255
+ }
1256
+
1257
+ // Returns a list of WooCommerce Product Attributes to export process
1258
+ function woo_ce_get_product_attributes() {
1259
+
1260
+ global $wpdb;
1261
+
1262
+ $output = array();
1263
+ $attributes_sql = "SELECT * FROM `" . $wpdb->prefix . "woocommerce_attribute_taxonomies`";
1264
+ $attributes = $wpdb->get_results( $attributes_sql );
1265
+ $wpdb->flush();
1266
+ if( !empty( $attributes ) ) {
1267
+ $output = $attributes;
1268
+ unset( $attributes );
1269
+ } else {
1270
+ $output = ( function_exists( 'wc_get_attribute_taxonomies' ) ? wc_get_attribute_taxonomies() : array() );
1271
+ }
1272
+ return $output;
1273
+
1274
+ }
1275
+
1276
+ function woo_ce_get_acf_product_fields() {
1277
+
1278
+ global $wpdb;
1279
+
1280
+ $post_type = 'acf';
1281
+ $args = array(
1282
+ 'post_type' => $post_type,
1283
+ 'numberposts' => -1
1284
+ );
1285
+ if( $field_groups = get_posts( $args ) ) {
1286
+ $fields = array();
1287
+ $post_types = array( 'product', 'product_variation' );
1288
+ foreach( $field_groups as $field_group ) {
1289
+ $has_fields = false;
1290
+ if( $rules = get_post_meta( $field_group->ID, 'rule' ) ) {
1291
+ $size = count( $rules );
1292
+ for( $i = 0; $i < $size; $i++ ) {
1293
+ if( ( $rules[$i]['param'] == 'post_type' ) && ( $rules[$i]['operator'] == '==' ) && ( in_array( $rules[$i]['value'], $post_types ) ) ) {
1294
+ $has_fields = true;
1295
+ $i = $size;
1296
+ }
1297
+ }
1298
+ }
1299
+ unset( $rules );
1300
+ if( $has_fields ) {
1301
+ $custom_fields_sql = "SELECT `meta_value` FROM `" . $wpdb->postmeta . "` WHERE `post_id` = " . absint( $field_group->ID ) . " AND `meta_key` LIKE 'field_%'";
1302
+ if( $custom_fields = $wpdb->get_col( $custom_fields_sql ) ) {
1303
+ foreach( $custom_fields as $custom_field ) {
1304
+ $custom_field = maybe_unserialize( $custom_field );
1305
+ $fields[] = array(
1306
+ 'name' => $custom_field['name'],
1307
+ 'label' => $custom_field['label']
1308
+ );
1309
+ }
1310
+ }
1311
+ unset( $custom_fields, $custom_field );
1312
+ }
1313
+ }
1314
+ return $fields;
1315
+ }
1316
+
1317
+ }
1318
+
1319
+ function woo_ce_format_product_sale_price_dates( $sale_date = '' ) {
1320
+
1321
+ $output = $sale_date;
1322
+ if( $sale_date )
1323
+ $output = woo_ce_format_date( date( 'Y-m-d H:i:s', $sale_date ) );
1324
+ return $output;
1325
+
1326
+ }
1327
+
1328
+ ?>
includes/product_vendor.php ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ // Product Vendors - http://www.woothemes.com/products/product-vendors/
7
+ // YITH WooCommerce Multi Vendor Premium - http://yithemes.com/themes/plugins/yith-woocommerce-product-vendors/
8
+ function woo_ce_get_export_type_product_vendor_count( $count = 0, $export_type = '', $args ) {
9
+
10
+ if( $export_type <> 'product_vendor' )
11
+ return $count;
12
+
13
+ $count = 0;
14
+ $term_taxonomy = apply_filters( 'woo_ce_product_vendor_term_taxonomy', 'wcpv_product_vendors' );
15
+ // Check if the existing Transient exists
16
+ $cached = get_transient( WOO_CE_PREFIX . '_product_vendor_count' );
17
+ if( $cached == false ) {
18
+ if( taxonomy_exists( $term_taxonomy ) )
19
+ $count = wp_count_terms( $term_taxonomy );
20
+ set_transient( WOO_CE_PREFIX . '_product_vendor_count', $count, HOUR_IN_SECONDS );
21
+ } else {
22
+ $count = $cached;
23
+ }
24
+ return $count;
25
+
26
+ }
27
+ add_filter( 'woo_ce_get_export_type_count', 'woo_ce_get_export_type_product_vendor_count', 10, 3 );
28
+
29
+ /* End of: WordPress Administration */
30
+
31
+ }
32
+
33
+ // Returns a list of Product Vendor export columns
34
+ function woo_ce_get_product_vendor_fields( $format = 'full', $post_ID = 0 ) {
35
+
36
+ $export_type = 'product_vendor';
37
+
38
+ $fields = array();
39
+ $fields[] = array(
40
+ 'name' => 'ID',
41
+ 'label' => __( 'Product Vendor ID', 'woocommerce-exporter' )
42
+ );
43
+ $fields[] = array(
44
+ 'name' => 'title',
45
+ 'label' => __( 'Name', 'woocommerce-exporter' )
46
+ );
47
+ $fields[] = array(
48
+ 'name' => 'slug',
49
+ 'label' => __( 'Slug', 'woocommerce-exporter' )
50
+ );
51
+ $fields[] = array(
52
+ 'name' => 'description',
53
+ 'label' => __( 'Description', 'woocommerce-exporter' )
54
+ );
55
+ $fields[] = array(
56
+ 'name' => 'url',
57
+ 'label' => __( 'Product Vendor URL', 'woocommerce-exporter' )
58
+ );
59
+ $fields[] = array(
60
+ 'name' => 'commission',
61
+ 'label' => __( 'Commission', 'woocommerce-exporter' )
62
+ );
63
+ $fields[] = array(
64
+ 'name' => 'paypal_email',
65
+ 'label' => __( 'PayPal E-mail Address', 'woocommerce-exporter' )
66
+ );
67
+ $fields[] = array(
68
+ 'name' => 'user_name',
69
+ 'label' => __( 'Vendor Username', 'woocommerce-exporter' )
70
+ );
71
+ $fields[] = array(
72
+ 'name' => 'user_id',
73
+ 'label' => __( 'Vendor User ID', 'woocommerce-exporter' )
74
+ );
75
+
76
+ /*
77
+ $fields[] = array(
78
+ 'name' => '',
79
+ 'label' => __( '', 'woocommerce-exporter' )
80
+ );
81
+ */
82
+
83
+ // Drop in our content filters here
84
+ add_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
85
+
86
+ // Allow Plugin/Theme authors to add support for additional columns
87
+ $fields = apply_filters( sprintf( WOO_CE_PREFIX . '_%s_fields', $export_type ), $fields, $export_type );
88
+
89
+ // Remove our content filters here to play nice with other Plugins
90
+ remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
91
+
92
+ switch( $format ) {
93
+
94
+ case 'summary':
95
+ $output = array();
96
+ $size = count( $fields );
97
+ for( $i = 0; $i < $size; $i++ ) {
98
+ if( isset( $fields[$i] ) )
99
+ $output[$fields[$i]['name']] = 'on';
100
+ }
101
+ return $output;
102
+ break;
103
+
104
+ case 'full':
105
+ default:
106
+ // Load the default sorting
107
+ $sorting = woo_ce_get_option( sprintf( '%s_sorting', $export_type ), array() );
108
+ $size = count( $fields );
109
+ for( $i = 0; $i < $size; $i++ ) {
110
+ $fields[$i]['reset'] = $i;
111
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
112
+ }
113
+ // Check if we are using PHP 5.3 and above
114
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
115
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
116
+ return $fields;
117
+ break;
118
+
119
+ }
120
+
121
+ }
122
+
123
+ // Check if we should override field labels from the Field Editor
124
+ function woo_ce_override_product_vendor_field_labels( $fields = array() ) {
125
+
126
+ $labels = woo_ce_get_option( 'product_vendor_labels', array() );
127
+ if( !empty( $labels ) ) {
128
+ foreach( $fields as $key => $field ) {
129
+ if( isset( $labels[$field['name']] ) )
130
+ $fields[$key]['label'] = $labels[$field['name']];
131
+ }
132
+ }
133
+ return $fields;
134
+
135
+ }
136
+ add_filter( 'woo_ce_product_vendor_fields', 'woo_ce_override_product_vendor_field_labels', 11 );
137
+
138
+ // Returns a list of Product Vendor Term IDs
139
+ function woo_ce_get_product_vendors( $args = array(), $output = 'term_id' ) {
140
+
141
+ global $export;
142
+
143
+ // Product Vendors - http://www.woothemes.com/products/product-vendors/
144
+ // YITH WooCommerce Multi Vendor Premium - http://yithemes.com/themes/plugins/yith-woocommerce-product-vendors/
145
+ $term_taxonomy = apply_filters( 'woo_ce_product_vendor_term_taxonomy', 'wcpv_product_vendors' );
146
+ $defaults = array(
147
+ 'orderby' => 'name',
148
+ 'order' => 'ASC',
149
+ 'hide_empty' => 0
150
+ );
151
+ $args = wp_parse_args( $args, $defaults );
152
+
153
+ // Allow other developers to bake in their own filters
154
+ $args = apply_filters( 'woo_ce_get_product_vendors_args', $args );
155
+
156
+ $product_vendors = get_terms( $term_taxonomy, $args );
157
+ if( !empty( $product_vendors ) && is_wp_error( $product_vendors ) == false ) {
158
+ if( $output == 'term_id' ) {
159
+ $vendor_ids = array();
160
+ foreach( $product_vendors as $key => $product_vendor )
161
+ $vendor_ids[] = $product_vendor->term_id;
162
+ // Only populate the $export Global if it is an export
163
+ if( isset( $export ) )
164
+ $export->total_rows = count( $vendor_ids );
165
+ unset( $product_vendors, $product_vendor );
166
+ return $vendor_ids;
167
+ } else if( $output == 'full' ) {
168
+ return $product_vendors;
169
+ }
170
+ }
171
+
172
+ }
173
+ ?>
includes/settings.php ADDED
@@ -0,0 +1,588 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_extend() {
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
+ <!-- #xml-settings -->
138
+
139
+ <tr id="rss-settings">
140
+ <td colspan="2" style="padding:0;">
141
+ <hr />
142
+ <h3><div class="dashicons dashicons-media-code"></div>&nbsp;<?php _e( 'RSS Settings', 'woocommerce-exporter' ); ?></h3>
143
+ </td>
144
+ </tr>
145
+ <tr>
146
+ <th>
147
+ <label for="rss_title"><?php _e( 'Title element', 'woocommerce-exporter' ); ?></label>
148
+ </th>
149
+ <td>
150
+ <input name="rss_title" type="text" id="rss_title" value="<?php echo esc_attr( $rss_title ); ?>" class="regular-text" disabled="disabled" /><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
151
+ <p class="description"><?php _e( 'Defines the title of the data feed (e.g. Product export for WordPress Shop).', 'woocommerce-exporter' ); ?></p>
152
+ </td>
153
+ </tr>
154
+ <tr>
155
+ <th>
156
+ <label for="rss_link"><?php _e( 'Link element', 'woocommerce-exporter' ); ?></label>
157
+ </th>
158
+ <td>
159
+ <input name="rss_link" type="text" id="rss_link" value="<?php echo esc_attr( $rss_link ); ?>" class="regular-text" disabled="disabled" /><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
160
+ <p class="description"><?php _e( 'A link to your website, this doesn\'t have to be the location of the RSS feed.', 'woocommerce-exporter' ); ?></p>
161
+ </td>
162
+ </tr>
163
+ <tr>
164
+ <th>
165
+ <label for="rss_description"><?php _e( 'Description element', 'woocommerce-exporter' ); ?></label>
166
+ </th>
167
+ <td>
168
+ <input name="rss_description" type="text" id="rss_description" value="<?php echo esc_attr( $rss_description ); ?>" class="large-text" disabled="disabled" /><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
169
+ <p class="description"><?php _e( 'A description of your data feed.', 'woocommerce-exporter' ); ?></p>
170
+ </td>
171
+ </tr>
172
+
173
+ <tr id="scheduled-exports">
174
+ <td colspan="2" style="padding:0;">
175
+ <hr />
176
+ <h3>
177
+ <div class="dashicons dashicons-calendar"></div>&nbsp;<?php _e( 'Scheduled Exports', 'woocommerce-exporter' ); ?>
178
+ </h3>
179
+ <p class="description"><?php _e( 'Configure Store Exporter Deluxe to automatically generate exports, apply filters to export just what you need.<br />Adjusting options within the Scheduling sub-section will after clicking Save Changes refresh the scheduled export engine, editing filters, formats, methods, etc. will not affect the scheduling of the current scheduled export.', 'woocommerce-exporter' ); ?></p>
180
+ </td>
181
+ </tr>
182
+ <tr>
183
+ <th>
184
+ <label for="enable_auto"><?php _e( 'Enable scheduled exports', 'woocommerce-exporter' ); ?></label>
185
+ </th>
186
+ <td>
187
+ <select id="enable_auto" name="enable_auto">
188
+ <option value="1" disabled="disabled"><?php _e( 'Yes', 'woocommerce-exporter' ); ?></option>
189
+ <option value="0" selected="selected"><?php _e( 'No', 'woocommerce-exporter' ); ?></option>
190
+ </select>
191
+ <p class="description"><?php _e( 'Enabling Scheduled Exports will trigger automated exports at the interval specified under Once every (minutes).', 'woocommerce-exporter' ); ?></p>
192
+ </td>
193
+ </tr>
194
+ <tr>
195
+ <th>
196
+ <label for="auto_type"><?php _e( 'Export type', 'woocommerce-exporter' ); ?></label>
197
+ </th>
198
+ <td>
199
+ <select id="auto_type" name="auto_type">
200
+ <?php if( !empty( $types ) ) { ?>
201
+ <?php foreach( $types as $key => $type ) { ?>
202
+ <option value="<?php echo $key; ?>"><?php echo $type; ?></option>
203
+ <?php } ?>
204
+ <?php } else { ?>
205
+ <option value=""><?php _e( 'No export types were found.', 'woocommerce-exporter' ); ?></option>
206
+ <?php } ?>
207
+ </select>
208
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
209
+ <p class="description"><?php _e( 'Select the data type you want to export.', 'woocommerce-exporter' ); ?></p>
210
+ </td>
211
+ </tr>
212
+ <tr class="auto_type_options">
213
+ <th>
214
+ <label><?php _e( 'Export filters', 'woocommerce-exporter' ); ?></label>
215
+ </th>
216
+ <td>
217
+ <ul>
218
+
219
+ <li class="export-options product-options">
220
+ <p class="label"><?php _e( 'Product category', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></p>
221
+ <?php if( !empty( $product_categories ) ) { ?>
222
+ <select data-placeholder="<?php _e( 'Choose a Product Category...', 'woocommerce-exporter' ); ?>" name="product_filter_category[]" multiple class="chzn-select" style="width:95%;">
223
+ <?php foreach( $product_categories as $product_category ) { ?>
224
+ <option><?php echo woo_ce_format_product_category_label( $product_category->name, $product_category->parent_name ); ?> (<?php printf( __( 'Term ID: %d', 'woocommerce-exporter' ), $product_category->term_id ); ?>)</option>
225
+ <?php } ?>
226
+ </select>
227
+ <?php } else { ?>
228
+ <?php _e( 'No Product Categories were found.', 'woocommerce-exporter' ); ?>
229
+ <?php } ?>
230
+ <p class="description"><?php _e( 'Select the Product Category\'s you want to filter exported Products by. Default is to include all Product Categories.', 'woocommerce-exporter' ); ?></p>
231
+ <hr />
232
+ </li>
233
+
234
+ <li class="export-options product-options">
235
+ <p class="label"><?php _e( 'Product tag', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></p>
236
+ <?php if( !empty( $product_tags ) ) { ?>
237
+ <select data-placeholder="<?php _e( 'Choose a Product Tag...', 'woocommerce-exporter' ); ?>" name="product_filter_tag[]" multiple class="chzn-select" style="width:95%;">
238
+ <?php foreach( $product_tags as $product_tag ) { ?>
239
+ <option><?php echo $product_tag->name; ?> (<?php printf( __( 'Term ID: %d', 'woocommerce-exporter' ), $product_tag->term_id ); ?>)</option>
240
+ <?php } ?>
241
+ </select>
242
+ <?php } else { ?>
243
+ <?php _e( 'No Product Tags were found.', 'woocommerce-exporter' ); ?>
244
+ <?php } ?>
245
+ <p class="description"><?php _e( 'Select the Product Tag\'s you want to filter exported Products by. Default is to include all Product Tags.', 'woocommerce-exporter' ); ?></p>
246
+ <hr />
247
+ </li>
248
+
249
+ <li class="export-options product-options">
250
+ <p class="label"><?php _e( 'Product type', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></p>
251
+ <?php if( !empty( $product_types ) ) { ?>
252
+ <select data-placeholder="<?php _e( 'Choose a Product Type...', 'woocommerce-exporter' ); ?>" name="product_filter_type[]" multiple class="chzn-select" style="width:95%;">
253
+ <?php foreach( $product_types as $key => $product_type ) { ?>
254
+ <option><?php echo woo_ce_format_product_type( $product_type['name'] ); ?> (<?php echo $product_type['count']; ?>)</option>
255
+ <?php } ?>
256
+ </select>
257
+ <?php } else { ?>
258
+ <?php _e( 'No Product Types were found.', 'woocommerce-exporter' ); ?>
259
+ <?php } ?>
260
+ <p class="description"><?php _e( 'Select the Product Type\'s you want to filter exported Products by. Default is to include all Product Types and Variations.', 'woocommerce-exporter' ); ?></p>
261
+ <hr />
262
+ </li>
263
+
264
+ <li class="export-options product-options">
265
+ <p class="label"><?php _e( 'Stock status', 'woocommerce-exporter' ); ?></p>
266
+ <ul style="margin-top:0.2em;">
267
+ <li><label><input type="radio" name="product_filter_stock" value="" disabled="disabled" /> <?php _e( 'Include both', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
268
+ <li><label><input type="radio" name="product_filter_stock" value="instock" disabled="disabled" /> <?php _e( 'In stock', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
269
+ <li><label><input type="radio" name="product_filter_stock" value="outofstock" disabled="disabled" /> <?php _e( 'Out of stock', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
270
+ </ul>
271
+ <p class="description"><?php _e( 'Select the Stock Status\'s you want to filter exported Products by. Default is to include all Stock Status\'s.', 'woocommerce-exporter' ); ?></p>
272
+ </li>
273
+
274
+ <li class="export-options order-options">
275
+ <p class="label"><?php _e( 'Order date', 'woocommerce-exporter' ); ?></p>
276
+ <ul style="margin-top:0.2em;">
277
+ <li><label><input type="radio" name="order_dates_filter" value="" disabled="disabled" /><?php _e( 'All', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
278
+ <li><label><input type="radio" name="order_dates_filter" value="today" disabled="disabled" /><?php _e( 'Today', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
279
+ <li><label><input type="radio" name="order_dates_filter" value="yesterday" disabled="disabled" /><?php _e( 'Yesterday', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
280
+ <li><label><input type="radio" name="order_dates_filter" value="current_week" disabled="disabled" /><?php _e( 'Current week', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
281
+ <li><label><input type="radio" name="order_dates_filter" value="last_week" disabled="disabled" /><?php _e( 'Last week', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
282
+ <li><label><input type="radio" name="order_dates_filter" value="current_month" disabled="disabled" /><?php _e( 'Current month', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
283
+ <li><label><input type="radio" name="order_dates_filter" value="last_month" disabled="disabled" /><?php _e( 'Last month', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
284
+ <li>
285
+ <label><input type="radio" name="order_dates_filter" value="variable" disabled="disabled" /><?php _e( 'Variable date', 'woocommerce-exporter' ); ?></label>
286
+ <div style="margin-top:0.2em;">
287
+ <?php _e( 'Last', 'woocommerce-exporter' ); ?>
288
+ <input type="text" name="order_dates_filter_variable" class="text" size="4" value="<?php echo $order_filter_date_variable; ?>" disabled="disabled" />
289
+ <select name="order_dates_filter_variable_length">
290
+ <option value="">&nbsp;</option>
291
+ <option value="second" disabled="disabled"><?php _e( 'second(s)', 'woocommerce-exporter' ); ?></option>
292
+ <option value="minute" disabled="disabled"><?php _e( 'minute(s)', 'woocommerce-exporter' ); ?></option>
293
+ <option value="hour" disabled="disabled"><?php _e( 'hour(s)', 'woocommerce-exporter' ); ?></option>
294
+ <option value="day" disabled="disabled"><?php _e( 'day(s)', 'woocommerce-exporter' ); ?></option>
295
+ <option value="week" disabled="disabled"><?php _e( 'week(s)', 'woocommerce-exporter' ); ?></option>
296
+ <option value="month" disabled="disabled"><?php _e( 'month(s)', 'woocommerce-exporter' ); ?></option>
297
+ <option value="year" disabled="disabled"><?php _e( 'year(s)', 'woocommerce-exporter' ); ?></option>
298
+ </select>
299
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
300
+ </div>
301
+ </li>
302
+ <li>
303
+ <label><input type="radio" name="order_dates_filter" value="manual" disabled="disabled" /><?php _e( 'Fixed date', 'woocommerce-exporter' ); ?></label>
304
+ <div style="margin-top:0.2em;">
305
+ <input type="text" size="10" maxlength="10" class="text datepicker" /> to <input type="text" size="10" maxlength="10" class="text datepicker" /><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
306
+ </div>
307
+ </li>
308
+ </ul>
309
+ <p class="description"><?php _e( 'Filter the dates of Orders to be included in the export. If manually selecting dates ensure the Fixed date radio field is checked, likewise for variable dates. Default is to include all Orders made.', 'woocommerce-exporter' ); ?></p>
310
+ <hr />
311
+ </li>
312
+
313
+ <li class="export-options order-options">
314
+ <p class="label"><?php _e( 'Order status', 'woocommerce-exporter' ); ?></p>
315
+ <select data-placeholder="<?php _e( 'Choose a Order Status...', 'woocommerce-exporter' ); ?>" name="order_filter_status[]" multiple class="chzn-select" style="width:95%;">
316
+ <option value="" selected="selected"><?php _e( 'All', 'woocommerce-exporter' ); ?></option>
317
+ <?php if( !empty( $order_statuses ) ) { ?>
318
+ <?php foreach( $order_statuses as $order_status ) { ?>
319
+ <option value="<?php echo $order_status->name; ?>" disabled="disabled"><?php echo ucfirst( $order_status->name ); ?></option>
320
+ <?php } ?>
321
+ <?php } ?>
322
+ </select>
323
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
324
+ <p class="description"><?php _e( 'Select the Order Status you want to filter exported Orders by. Default is to include all Order Status options.', 'woocommerce-exporter' ); ?></p>
325
+ <hr />
326
+ </li>
327
+
328
+ <li class="export-options order-options">
329
+ <p class="label"><?php _e( 'Payment gateway', 'woocommerce-exporter' ); ?></p>
330
+ <select data-placeholder="<?php _e( 'Choose a Payment Gateway...', 'woocommerce-exporter' ); ?>" name="order_filter_payment[]" multiple class="chzn-select" style="width:95%;">
331
+ <option value="" selected="selected"><?php _e( 'All', 'woocommerce-exporter' ); ?></option>
332
+ </select>
333
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
334
+ <p class="description"><?php _e( 'Select the Payment Gateways you want to filter exported Orders by. Default is to include all Payment Gateways.', 'woocommerce-exporter' ); ?></p>
335
+ <hr />
336
+ </li>
337
+
338
+ <li class="export-options order-options">
339
+ <p class="label"><?php _e( 'Shipping method', 'woocommerce-exporter' ); ?></p>
340
+ <select data-placeholder="<?php _e( 'Choose a Shipping Method...', 'woocommerce-exporter' ); ?>" name="order_filter_shipping[]" multiple class="chzn-select" style="width:95%;">
341
+ <option value="" selected="selected"><?php _e( 'All', 'woocommerce-exporter' ); ?></option>
342
+ </select>
343
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
344
+ <p class="description"><?php _e( 'Select the Shipping Methods you want to filter exported Orders by. Default is to include all Shipping Methods.', 'woocommerce-exporter' ); ?></p>
345
+ <hr />
346
+ </li>
347
+
348
+ <li class="export-options order-options">
349
+ <p class="label"><?php _e( 'Billing country', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></p>
350
+ <select data-placeholder="<?php _e( 'Choose a Billing Country...', 'woocommerce-exporter' ); ?>" name="order_filter_billing_country[]" multiple class="chzn-select" style="width:95%;">
351
+ <option value="" selected="selected"><?php _e( 'All', 'woocommerce-exporter' ); ?></option>
352
+ </select>
353
+ <p class="description"><?php _e( 'Filter Orders by Billing Country to be included in the export. Default is to include all Countries.', 'woocommerce-exporter' ); ?></p>
354
+ <hr />
355
+ </li>
356
+
357
+ <li class="export-options order-options">
358
+ <p class="label"><?php _e( 'Shipping country', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></p>
359
+ <select data-placeholder="<?php _e( 'Choose a Shipping Country...', 'woocommerce-exporter' ); ?>" id="order_filter_shipping_country" name="order_filter_shipping_country" class="chzn-select">
360
+ <option value="" selected="selected"><?php _e( 'All', 'woocommerce-exporter' ); ?></option>
361
+ </select>
362
+ <p class="description"><?php _e( 'Filter Orders by Shipping Country to be included in the export. Default is to include all Countries.', 'woocommerce-exporter' ); ?></p>
363
+ </li>
364
+
365
+ <li class="export-options category-options tag-options brand-options customer-options user-options coupon-options subscription-options product_vendor-options commission-options shipping_class-options">
366
+ <p><?php _e( 'No export filter options are available for this export type.', 'woocommerce-exporter' ); ?></p>
367
+ </li>
368
+
369
+ </ul>
370
+ </td>
371
+ </tr>
372
+
373
+ <tr>
374
+ <th>
375
+ <label><?php _e( 'Scheduling', 'woocommerce-exporter' ); ?></label>
376
+ </th>
377
+ <td>
378
+ <p><?php _e( 'How often do you want the export to run?', 'woocommerce-exporter' ); ?></p>
379
+ <ul>
380
+ <li>
381
+ <label><input type="radio" name="auto_schedule" value="custom" disabled="disabled" /> <?php _e( 'Once every ', 'woocommerce-exporter' ); ?></label>
382
+ <input name="auto_interval" type="text" id="auto_interval" value="<?php echo esc_attr( $auto_interval ); ?>" size="6" maxlength="6" class="text" disabled="disabled" />
383
+ <?php _e( 'minutes', 'woocommerce-exporter' ); ?>
384
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
385
+ </li>
386
+ <li><label><input type="radio" name="auto_schedule" value="daily" disabled="disabled" /> <?php _e( 'Daily', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
387
+ <li><label><input type="radio" name="auto_schedule" value="weekly" disabled="disabled" /> <?php _e( 'Weekly', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
388
+ <li><label><input type="radio" name="auto_schedule" value="monthly" disabled="disabled" /> <?php _e( 'Monthly', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
389
+ <li><label><input type="radio" name="auto_schedule" value="one-time" disabled="disabled" /> <?php _e( 'One time', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
390
+ </ul>
391
+ <p class="description"><?php _e( 'Choose how often Store Exporter Deluxe generates new exports. Default is every 1440 minutes (once every 24 hours).', 'woocommerce-exporter' ); ?></p>
392
+ <hr />
393
+ <p><?php _e( 'When do you want scheduled exports to start?', 'woocommerce-exporter' ); ?></p>
394
+ <ul>
395
+ <li><label><input type="radio" name="auto_commence" value="now" disabled="disabled" /><?php _e( 'From now', 'woocommerce-exporter' ); ?></label><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
396
+ <li><label><input type="radio" name="auto_commence" value="future" disabled="disabled" /><?php _e( 'From the following', 'woocommerce-exporter' ); ?></label>: <input type="text" name="auto_commence_date" size="20" maxlength="20" class="text datetimepicker" value="<?php echo $auto_commence_date; ?>" /><!--, <?php _e( 'at this time', 'woocommerce-exporter' ); ?>: <input type="text" name="auto_interval_time" size="10" maxlength="10" class="text timepicker" />--><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></li>
397
+ </ul>
398
+ </td>
399
+ </tr>
400
+
401
+ <tr>
402
+ <th>
403
+ <label><?php _e( 'Export format', 'woocommerce-exporter' ); ?></label>
404
+ </th>
405
+ <td>
406
+ <ul style="margin-top:0.2em;">
407
+ <li><label><input type="radio" name="auto_format" value="csv" disabled="disabled" /> <?php _e( 'CSV', 'woocommerce-exporter' ); ?> <span class="description"><?php _e( '(Comma Separated Values)', 'woocommerce-exporter' ); ?> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
408
+ <li><label><input type="radio" name="auto_format" value="xml" disabled="disabled" /> <?php _e( 'XML', 'woocommerce-exporter' ); ?> <span class="description"><?php _e( '(EXtensible Markup Language)', 'woocommerce-exporter' ); ?> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
409
+ <li><label><input type="radio" name="auto_format" value="xls" disabled="disabled" /> <?php _e( 'Excel (XLS)', 'woocommerce-exporter' ); ?> <span class="description"><?php _e( '(Excel 97-2003)', 'woocommerce-exporter' ); ?> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
410
+ <li><label><input type="radio" name="auto_format" value="xlsx" disabled="disabled" /> <?php _e( 'Excel (XLSX)', 'woocommerce-exporter' ); ?> <span class="description"><?php _e( '(Excel 2007-2013)', 'woocommerce-exporter' ); ?> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
411
+ </ul>
412
+ <p class="description"><?php _e( 'Adjust the export format to generate different export file formats. Default is CSV.', 'woocommerce-exporter' ); ?></p>
413
+ </td>
414
+ </tr>
415
+ <tr>
416
+ <th>
417
+ <label for="auto_method"><?php _e( 'Export method', 'woocommerce-exporter' ); ?></label>
418
+ </th>
419
+ <td>
420
+ <select id="auto_method" name="auto_method">
421
+ <option value="archive"><?php _e( 'Archive to WordPress Media', 'woocommerce-exporter' ); ?></option>
422
+ <option value="email"><?php _e( 'Send as e-mail', 'woocommerce-exporter' ); ?></option>
423
+ <option value="post"><?php _e( 'POST to remote URL', 'woocommerce-exporter' ); ?></option>
424
+ <option value="ftp"><?php _e( 'Upload to remote FTP', 'woocommerce-exporter' ); ?></option>
425
+ </select>
426
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
427
+ <p class="description"><?php _e( 'Choose what Store Exporter Deluxe does with the generated export. Default is to archive the export to the WordPress Media for archival purposes.', 'woocommerce-exporter' ); ?></p>
428
+ </td>
429
+ </tr>
430
+ <tr class="auto_method_options">
431
+ <th>
432
+ <label><?php _e( 'Export method options', 'woocommerce-exporter' ); ?></label>
433
+ </th>
434
+ <td>
435
+ <ul>
436
+
437
+ <li class="export-options email-options">
438
+ <p>
439
+ <label for="email_to"><?php _e( 'Default e-mail recipient', 'woocommerce-exporter' ); ?></label><br />
440
+ <input name="email_to" type="text" id="email_to" value="<?php echo esc_attr( $email_to ); ?>" class="regular-text code" disabled="disabled" /><br /><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
441
+ </p>
442
+ <p class="description"><?php _e( 'Set the default recipient of scheduled export e-mails, multiple recipients can be added using the <code><attr title="comma">,</attr></code> separator. This option can be overriden via CRON using the <code>to</code> argument.<br />Default is the Blog Administrator e-mail address set on the WordPress &raquo; Settings screen.', 'woocommerce-exporter' ); ?></p>
443
+
444
+ <p>
445
+ <label for="email_subject"><?php _e( 'Default e-mail subject', 'woocommerce-exporter' ); ?></label><br />
446
+ <input name="email_subject" type="text" id="email_subject" value="<?php echo esc_attr( $email_subject ); ?>" class="large-text code" disabled="disabled" /><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
447
+ </p>
448
+ <p class="description"><?php _e( 'Set the default subject of scheduled export e-mails, can be overriden via CRON using the <code>subject</code> argument. Tags can be used: <code>%store_name%</code>, <code>%export_type%</code>, <code>%export_filename%</code>.', 'woocommerce-exporter' ); ?></p>
449
+ </li>
450
+
451
+ <li class="export-options post-options">
452
+ <p>
453
+ <label for="post_to"><?php _e( 'Default remote POST URL', 'woocommerce-exporter' ); ?></label><br />
454
+ <input name="post_to" type="text" id="post_to" value="<?php echo esc_url( $post_to ); ?>" class="large-text code" disabled="disabled" /><br /><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
455
+ </p>
456
+ <p class="description"><?php printf( __( 'Set the default remote POST address for scheduled exports, can be overriden via CRON using the <code>to</code> argument. Default is empty. See our <a href="%s" target="_blank">Usage</a> document for more information on Default remote POST URL.', 'woocommerce-exporter' ), $troubleshooting_url ); ?></p>
457
+ </li>
458
+
459
+ <li class="export-options ftp-options">
460
+ <label for="ftp_method_host"><?php _e( 'Host', 'woocommerce-exporter' ); ?>:</label> <input type="text" id="ftp_method_host" name="ftp_method_host" size="15" class="regular-text code" value="<?php echo sanitize_text_field( $ftp_method_host ); ?>" disabled="disabled" />&nbsp;
461
+ <label for="ftp_method_port" style="width:auto;"><?php _e( 'Port', 'woocommerce-exporter' ); ?>:</label> <input type="text" id="ftp_method_port" name="ftp_method_port" size="5" class="short-text code" value="<?php echo sanitize_text_field( $ftp_method_port ); ?>" disabled="disabled" maxlength="5" /><br />
462
+ <label for="ftp_method_protocol"><?php _e( 'Protocol', 'woocommerce-exporter' ); ?></label>
463
+ <select name="ftp_method_protocol">
464
+ <option><?php _e( 'FTP - File Transfer Protocol', 'woocommerce-exporter' ); ?></option>
465
+ <option disabled="disabled"><?php _e( 'SFTP - SSH File Transfer Protocol', 'woocommerce-exporter' ); ?></option>
466
+ </select><br />
467
+ <label for="ftp_method_user"><?php _e( 'Username', 'woocommerce-exporter' ); ?>:</label> <input type="text" id="ftp_method_user" name="ftp_method_user" size="15" class="regular-text code" value="<?php echo sanitize_text_field( $ftp_method_user ); ?>" disabled="disabled" /><br />
468
+ <label for="ftp_method_pass"><?php _e( 'Password', 'woocommerce-exporter' ); ?>:</label> <input type="password" id="ftp_method_pass" name="ftp_method_pass" size="15" class="regular-text code" value="" disabled="disabled" /><?php if( !empty( $ftp_method_pass ) ) { echo ' ' . __( '(password is saved)', 'woocommerce-exporter' ); } ?><br />
469
+ <label for="ftp_method_file_path"><?php _e( 'File path', 'woocommerce-exporter' ); ?>:</label> <input type="text" id="ftp_method_file_path" name="ftp_method_path" size="25" class="regular-text code" value="<?php echo sanitize_text_field( $ftp_method_path ); ?>" disabled="disabled" /><br />
470
+ <label for="ftp_method_filename"><?php _e( 'Fixed filename', 'woocommerce-exporter' ); ?>:</label> <input type="text" id="ftp_method_filename" name="ftp_method_filename" size="25" class="regular-text code" value="<?php echo sanitize_text_field( $ftp_method_filename ); ?>" disabled="disabled" /><br />
471
+ <label for="ftp_method_passive"><?php _e( 'Transfer mode', 'woocommerce-exporter' ); ?>:</label>
472
+ <select id="ftp_method_passive" name="ftp_method_passive">
473
+ <option value="auto"><?php _e( 'Auto', 'woocommerce-exporter' ); ?></option>
474
+ <option value="active" disabled="disabled"><?php _e( 'Active', 'woocommerce-exporter' ); ?></option>
475
+ <option value="passive" disabled="disabled"><?php _e( 'Passive', 'woocommerce-exporter' ); ?></option>
476
+ </select><br />
477
+ <label for="ftp_method_timeout"><?php _e( 'Timeout', 'woocommerce-exporter' ); ?>:</label> <input type="text" id="ftp_method_timeout" name="ftp_method_timeout" size="5" class="short-text code" value="<?php echo sanitize_text_field( $ftp_method_timeout ); ?>" disabled="disabled" /><br />
478
+ <p class="description"><?php _e( 'Enter the FTP host (minus <code>ftp://</code>), login details and path of where to save the export file, do not provide the filename, the export filename can be set on General Settings above. For file path example: <code>wp-content/uploads/exports/</code>', 'woocommerce-exporter' ); ?></p>
479
+ </li>
480
+
481
+ <li class="export-options archive-options">
482
+ <p><?php _e( 'No export method options are available for this export method.', 'woocommerce-exporter' ); ?></p>
483
+ </li>
484
+
485
+ </ul>
486
+ </td>
487
+ </tr>
488
+ <tr>
489
+ <th>
490
+ <label for="scheduled_fields"><?php _e( 'Export fields', 'woocommerce-exporter' ); ?></label>
491
+ </th>
492
+ <td>
493
+ <ul style="margin-top:0.2em;">
494
+ <li><label><input type="radio" id="scheduled_fields" name="scheduled_fields" value="all"<?php checked( $scheduled_fields, 'all' ); ?> /> <?php _e( 'Include all Export Fields for the requested Export Type', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
495
+ <li><label><input type="radio" name="scheduled_fields" value="saved"<?php checked( $scheduled_fields, 'saved' ); ?> disabled="disabled" /> <?php _e( 'Use the saved Export Fields preference set on the Export screen for the requested Export Type', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
496
+ </ul>
497
+ <p class="description"><?php _e( 'Control whether all known export fields are included or only checked fields from the Export Fields section on the Export screen for each Export Type. Default is to include all export fields.', 'woocommerce-exporter' ); ?></p>
498
+ </td>
499
+ </tr>
500
+
501
+ <tr id="cron-exports">
502
+ <td colspan="2" style="padding:0;">
503
+ <hr />
504
+ <h3><div class="dashicons dashicons-clock"></div>&nbsp;<?php _e( 'CRON Exports', 'woocommerce-exporter' ); ?></h3>
505
+ <p class="description"><?php printf( __( 'Store Exporter Deluxe supports exporting via a command line request. For sample CRON requests and supported arguments consult our <a href="%s" target="_blank">online documentation</a>.', 'woocommerce-exporter' ), $troubleshooting_url ); ?></p>
506
+ </td>
507
+ </tr>
508
+ <tr>
509
+ <th>
510
+ <label for="enable_cron"><?php _e( 'Enable CRON', 'woocommerce-exporter' ); ?></label>
511
+ </th>
512
+ <td>
513
+ <select id="enable_cron" name="enable_cron">
514
+ <option value="1" disabled="disabled"><?php _e( 'Yes', 'woocommerce-exporter' ); ?></option>
515
+ <option value="0" selected="selected"><?php _e( 'No', 'woocommerce-exporter' ); ?></option>
516
+ </select>
517
+ <p class="description"><?php _e( 'Enabling CRON allows developers to schedule automated exports and connect with Store Exporter Deluxe remotely.', 'woocommerce-exporter' ); ?></p>
518
+ </td>
519
+ </tr>
520
+ <tr>
521
+ <th>
522
+ <label for="secret_key"><?php _e( 'Export secret key', 'woocommerce-exporter' ); ?></label>
523
+ </th>
524
+ <td>
525
+ <input name="secret_key" type="text" id="secret_key" value="<?php echo esc_attr( $secret_key ); ?>" class="large-text code" disabled="disabled" /><br /><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
526
+ <p class="description"><?php _e( 'This secret key (can be left empty to allow unrestricted access) limits access to authorised developers who provide a matching key when working with Store Exporter Deluxe.', 'woocommerce-exporter' ); ?></p>
527
+ </td>
528
+ </tr>
529
+ <tr>
530
+ <th>
531
+ <label for="cron_fields"><?php _e( 'Export fields', 'woocommerce-exporter' ); ?></label>
532
+ </th>
533
+ <td>
534
+ <ul style="margin-top:0.2em;">
535
+ <li><label><input type="radio" id="cron_fields" name="cron_fields" value="all"<?php checked( $cron_fields, 'all' ); ?> /> <?php _e( 'Include all Export Fields for the requested Export Type', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
536
+ <li><label><input type="radio" name="cron_fields" value="saved"<?php checked( $cron_fields, 'saved' ); ?> disabled="disabled" /> <?php _e( 'Use the saved Export Fields preference set on the Export screen for the requested Export Type', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
537
+ </ul>
538
+ <p class="description"><?php _e( 'Control whether all known export fields are included or only checked fields from the Export Fields section on the Export screen for each Export Type. Default is to include all export fields.', 'woocommerce-exporter' ); ?></p>
539
+ </td>
540
+ </tr>
541
+ <!-- #cron-exports -->
542
+
543
+ <tr id="orders-screen">
544
+ <td colspan="2" style="padding:0;">
545
+ <hr />
546
+ <h3><div class="dashicons dashicons-admin-settings"></div>&nbsp;<?php _e( 'Orders Screen', 'woocommerce-exporter' ); ?></h3>
547
+ </td>
548
+ </tr>
549
+ <tr>
550
+ <th>
551
+ <label><?php _e( 'Actions display', 'woocommerce-exporter' ); ?></label>
552
+ </th>
553
+ <td>
554
+ <ul>
555
+ <li><label><input type="checkbox" name="order_actions_csv" value="1"<?php checked( $order_actions_csv ); ?> /> <?php _e( 'Export to CSV', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
556
+ <li><label><input type="checkbox" name="order_actions_xml" value="1"<?php checked( $order_actions_xml ); ?> /> <?php _e( 'Export to XML', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
557
+ <li><label><input type="checkbox" name="order_actions_xls" value="1"<?php checked( $order_actions_xls ); ?> /> <?php _e( 'Export to XLS', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
558
+ <li><label><input type="checkbox" name="order_actions_xlsx" value="1"<?php checked( $order_actions_xlsx ); ?> /> <?php _e( 'Export to XLSX', 'woocommerce-exporter' ); ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span></label></li>
559
+ </ul>
560
+ <p class="description"><?php _e( 'Control the visibility of different Order actions on the WooCommerce &raquo; Orders screen.', 'woocommerce-exporter' ); ?></p>
561
+ </td>
562
+ </tr>
563
+ <?php
564
+ ob_end_flush();
565
+
566
+ }
567
+
568
+ function woo_ce_export_settings_save() {
569
+
570
+ // Strip file extension from export filename
571
+ $export_filename = strip_tags( (string)$_POST['export_filename'] );
572
+ woo_ce_update_option( 'export_filename', $export_filename );
573
+ woo_ce_update_option( 'delete_file', sanitize_text_field( absint( $_POST['delete_file'] ) ) );
574
+ woo_ce_update_option( 'encoding', sanitize_text_field( (string)$_POST['encoding'] ) );
575
+ woo_ce_update_option( 'delimiter', sanitize_text_field( (string)$_POST['delimiter'] ) );
576
+ woo_ce_update_option( 'category_separator', sanitize_text_field( (string)$_POST['category_separator'] ) );
577
+ woo_ce_update_option( 'bom', absint( $_POST['bom'] ) );
578
+ woo_ce_update_option( 'escape_formatting', sanitize_text_field( (string)$_POST['escape_formatting'] ) );
579
+ if( $_POST['date_format'] == 'custom' && !empty( $_POST['date_format_custom'] ) )
580
+ woo_ce_update_option( 'date_format', sanitize_text_field( (string)$_POST['date_format_custom'] ) );
581
+ else
582
+ woo_ce_update_option( 'date_format', sanitize_text_field( (string)$_POST['date_format'] ) );
583
+
584
+ $message = __( 'Changes have been saved.', 'woocommerce-exporter' );
585
+ woo_ce_admin_notice( $message );
586
+
587
+ }
588
+ ?>
includes/shipping_class.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ if( !function_exists( 'woo_ce_get_export_type_shipping_class_count' ) ) {
7
+ function woo_ce_get_export_type_shipping_class_count() {
8
+
9
+ $count = 0;
10
+ // Check if the existing Transient exists
11
+ $cached = get_transient( WOO_CE_PREFIX . '_shipping_class_count' );
12
+ if( $cached == false ) {
13
+ $term_taxonomy = 'product_shipping_class';
14
+ if( taxonomy_exists( $term_taxonomy ) )
15
+ $count = wp_count_terms( $term_taxonomy );
16
+ set_transient( WOO_CE_PREFIX . '_shipping_class_count', $count, HOUR_IN_SECONDS );
17
+ } else {
18
+ $count = $cached;
19
+ }
20
+ return $count;
21
+
22
+ }
23
+ }
24
+
25
+ /* End of: WordPress Administration */
26
+
27
+ }
28
+
29
+ // Returns a list of Shipping Classes export columns
30
+ function woo_ce_get_shipping_class_fields( $format = 'full' ) {
31
+
32
+ $export_type = 'shipping_class';
33
+
34
+ $fields = array();
35
+ $fields[] = array(
36
+ 'name' => 'term_id',
37
+ 'label' => __( 'Term ID', 'woo_ce' )
38
+ );
39
+ $fields[] = array(
40
+ 'name' => 'name',
41
+ 'label' => __( 'Shipping Class Name', 'woo_ce' )
42
+ );
43
+ $fields[] = array(
44
+ 'name' => 'slug',
45
+ 'label' => __( 'Shipping Class Slug', 'woo_ce' )
46
+ );
47
+ $fields[] = array(
48
+ 'name' => 'description',
49
+ 'label' => __( 'Shipping Class Description', 'woo_ce' )
50
+ );
51
+
52
+ /*
53
+ $fields[] = array(
54
+ 'name' => '',
55
+ 'label' => __( '', 'woo_ce' )
56
+ );
57
+ */
58
+
59
+ // Allow Plugin/Theme authors to add support for additional columns
60
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
61
+
62
+ switch( $format ) {
63
+
64
+ case 'summary':
65
+ $output = array();
66
+ $size = count( $fields );
67
+ for( $i = 0; $i < $size; $i++ ) {
68
+ if( isset( $fields[$i] ) )
69
+ $output[$fields[$i]['name']] = 'on';
70
+ }
71
+ return $output;
72
+ break;
73
+
74
+ case 'full':
75
+ default:
76
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
77
+ $size = count( $fields );
78
+ for( $i = 0; $i < $size; $i++ ) {
79
+ $fields[$i]['reset'] = $i;
80
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
81
+ }
82
+ // Check if we are using PHP 5.3 and above
83
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
84
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
85
+ return $fields;
86
+ break;
87
+
88
+ }
89
+
90
+ }
91
+ ?>
includes/subscription.php ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ if( !function_exists( 'woo_ce_get_export_type_subscription_count' ) ) {
7
+ function woo_ce_get_export_type_subscription_count( $count = 0, $export_type = '', $args ) {
8
+
9
+ if( $export_type <> 'subscription' )
10
+ return $count;
11
+
12
+ $count = 0;
13
+ // Check that WooCommerce Subscriptions exists
14
+ if( class_exists( 'WC_Subscriptions' ) ) {
15
+ $count = woo_ce_get_subscription_count();
16
+ }
17
+ return $count;
18
+
19
+ }
20
+ add_filter( 'woo_ce_get_export_type_count', 'woo_ce_get_export_type_subscription_count', 10, 3 );
21
+ }
22
+
23
+ function woo_ce_get_subscription_count() {
24
+
25
+ $count = 0;
26
+ // Check if the existing Transient exists
27
+ $cached = get_transient( WOO_CE_PREFIX . '_subscription_count' );
28
+ if( $cached == false ) {
29
+ // Allow store owners to force the Subscription count
30
+ $count = apply_filters( 'woo_ce_get_subscription_count', $count );
31
+ if( $count == 0 ) {
32
+ $wcs_version = woo_ce_get_wc_subscriptions_version();
33
+ if( version_compare( $wcs_version, '2.0.1', '<' ) ) {
34
+ if( method_exists( 'WC_Subscriptions', 'is_large_site' ) ) {
35
+ // Does this store have roughly more than 3000 Subscriptions
36
+ if( false === WC_Subscriptions::is_large_site() ) {
37
+ if( class_exists( 'WC_Subscriptions_Manager' ) ) {
38
+ // Check that the get_all_users_subscriptions() function exists
39
+ if( method_exists( 'WC_Subscriptions_Manager', 'get_all_users_subscriptions' ) ) {
40
+ if( $subscriptions = WC_Subscriptions_Manager::get_all_users_subscriptions() ) {
41
+ if( version_compare( $wcs_version, '2.0.1', '<' ) ) {
42
+ foreach( $subscriptions as $key => $user_subscription ) {
43
+ if( !empty( $user_subscription ) ) {
44
+ foreach( $user_subscription as $subscription )
45
+ $count++;
46
+ }
47
+ }
48
+ unset( $subscriptions, $subscription, $user_subscription );
49
+ }
50
+ }
51
+ }
52
+ }
53
+ } else {
54
+ if( method_exists( 'WC_Subscriptions', 'get_total_subscription_count' ) )
55
+ $count = WC_Subscriptions::get_total_subscription_count();
56
+ else
57
+ $count = "~2500";
58
+ }
59
+ } else {
60
+ if( method_exists( 'WC_Subscriptions', 'get_subscription_count' ) )
61
+ $count = WC_Subscriptions::get_subscription_count();
62
+ }
63
+ } else {
64
+ if( function_exists( 'wcs_get_subscriptions' ) ) {
65
+ $args = array(
66
+ 'subscriptions_per_page' => -1,
67
+ 'subscription_status' => 'trash'
68
+ );
69
+ $count += count( wcs_get_subscriptions( $args ) );
70
+ $args['subscription_status'] = 'any';
71
+ $count += count( wcs_get_subscriptions( $args ) );
72
+ }
73
+ }
74
+ }
75
+ set_transient( WOO_CE_PREFIX . '_subscription_count', $count, HOUR_IN_SECONDS );
76
+ } else {
77
+ $count = $cached;
78
+ }
79
+ return $count;
80
+
81
+ }
82
+
83
+ /* End of: WordPress Administration */
84
+
85
+ }
86
+
87
+ function woo_ce_get_subscription_fields( $format = 'full' ) {
88
+
89
+ $export_type = 'subscription';
90
+
91
+ $fields = array();
92
+ $fields[] = array(
93
+ 'name' => 'key',
94
+ 'label' => __( 'Subscription Key', 'woocommerce-exporter' )
95
+ );
96
+ $fields[] = array(
97
+ 'name' => 'status',
98
+ 'label' => __( 'Subscription Status', 'woocommerce-exporter' )
99
+ );
100
+ $fields[] = array(
101
+ 'name' => 'name',
102
+ 'label' => __( 'Subscription Name', 'woocommerce-exporter' )
103
+ );
104
+ $fields[] = array(
105
+ 'name' => 'user',
106
+ 'label' => __( 'User', 'woocommerce-exporter' )
107
+ );
108
+ $fields[] = array(
109
+ 'name' => 'user_id',
110
+ 'label' => __( 'User ID', 'woocommerce-exporter' )
111
+ );
112
+ $fields[] = array(
113
+ 'name' => 'email',
114
+ 'label' => __( 'E-mail Address', 'woocommerce-exporter' )
115
+ );
116
+ $fields[] = array(
117
+ 'name' => 'order_id',
118
+ 'label' => __( 'Order ID', 'woocommerce-exporter' )
119
+ );
120
+ $fields[] = array(
121
+ 'name' => 'order_status',
122
+ 'label' => __( 'Order Status', 'woocommerce-exporter' )
123
+ );
124
+ // Check if this is a pre-WooCommerce 2.2 instance
125
+ $woocommerce_version = woo_get_woo_version();
126
+ if( version_compare( $woocommerce_version, '2.2', '<' ) ) {
127
+ $fields[] = array(
128
+ 'name' => 'post_status',
129
+ 'label' => __( 'Post Status', 'woocommerce-exporter' )
130
+ );
131
+ }
132
+ $fields[] = array(
133
+ 'name' => 'start_date',
134
+ 'label' => __( 'Start Date', 'woocommerce-exporter' )
135
+ );
136
+ $fields[] = array(
137
+ 'name' => 'expiration',
138
+ 'label' => __( 'Expiration', 'woocommerce-exporter' )
139
+ );
140
+ $fields[] = array(
141
+ 'name' => 'end_date',
142
+ 'label' => __( 'End Date', 'woocommerce-exporter' )
143
+ );
144
+ $fields[] = array(
145
+ 'name' => 'trial_end_date',
146
+ 'label' => __( 'Trial End Date', 'woocommerce-exporter' )
147
+ );
148
+ $fields[] = array(
149
+ 'name' => 'last_payment',
150
+ 'label' => __( 'Last Payment', 'woocommerce-exporter' )
151
+ );
152
+ $fields[] = array(
153
+ 'name' => 'next_payment',
154
+ 'label' => __( 'Next Payment', 'woocommerce-exporter' )
155
+ );
156
+ $fields[] = array(
157
+ 'name' => 'renewals',
158
+ 'label' => __( 'Renewals', 'woocommerce-exporter' )
159
+ );
160
+ $fields[] = array(
161
+ 'name' => 'product_id',
162
+ 'label' => __( 'Product ID', 'woocommerce-exporter' )
163
+ );
164
+ $fields[] = array(
165
+ 'name' => 'product_sku',
166
+ 'label' => __( 'Product SKU', 'woocommerce-exporter' )
167
+ );
168
+ $fields[] = array(
169
+ 'name' => 'variation_id',
170
+ 'label' => __( 'Variation ID', 'woocommerce-exporter' )
171
+ );
172
+ $fields[] = array(
173
+ 'name' => 'coupon',
174
+ 'label' => __( 'Coupon Code', 'woocommerce-exporter' )
175
+ );
176
+ /*
177
+ $fields[] = array(
178
+ 'name' => '',
179
+ 'label' => __( '', 'woocommerce-exporter' )
180
+ );
181
+ */
182
+
183
+ // Allow Plugin/Theme authors to add support for additional columns
184
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
185
+
186
+ switch( $format ) {
187
+
188
+ case 'summary':
189
+ $output = array();
190
+ $size = count( $fields );
191
+ for( $i = 0; $i < $size; $i++ ) {
192
+ if( isset( $fields[$i] ) )
193
+ $output[$fields[$i]['name']] = 'on';
194
+ }
195
+ return $output;
196
+ break;
197
+
198
+ case 'full':
199
+ default:
200
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
201
+ $size = count( $fields );
202
+ for( $i = 0; $i < $size; $i++ ) {
203
+ $fields[$i]['reset'] = $i;
204
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
205
+ }
206
+ // Check if we are using PHP 5.3 and above
207
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
208
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
209
+ return $fields;
210
+ break;
211
+
212
+ }
213
+
214
+ }
215
+
216
+ function woo_ce_get_subscription_statuses() {
217
+
218
+ $subscription_statuses = array(
219
+ 'active' => __( 'Active', 'woocommerce-subscriptions' ),
220
+ 'cancelled' => __( 'Cancelled', 'woocommerce-subscriptions' ),
221
+ 'expired' => __( 'Expired', 'woocommerce-subscriptions' ),
222
+ 'pending' => __( 'Pending', 'woocommerce-subscriptions' ),
223
+ 'failed' => __( 'Failed', 'woocommerce-subscriptions' ),
224
+ 'on-hold' => __( 'On-hold', 'woocommerce-subscriptions' ),
225
+ 'trash' => __( 'Deleted', 'woocommerce-exporter' ),
226
+ );
227
+ return apply_filters( 'woo_ce_subscription_statuses', $subscription_statuses );
228
+
229
+ }
230
+
231
+ function woo_ce_get_wc_subscriptions_version() {
232
+
233
+ if( class_exists( 'WC_Subscriptions' ) ) {
234
+ return WC_Subscriptions::$version;
235
+ }
236
+
237
+ }
238
+
239
+ function woo_ce_get_subscription_products() {
240
+
241
+ $term_taxonomy = 'product_type';
242
+ $args = array(
243
+ 'post_type' => array( 'product', 'product_variation' ),
244
+ 'posts_per_page' => -1,
245
+ 'fields' => 'ids',
246
+ 'suppress_filters' => false,
247
+ 'tax_query' => array(
248
+ array(
249
+ 'taxonomy' => $term_taxonomy,
250
+ 'field' => 'slug',
251
+ 'terms' => array( 'subscription', 'variable-subscription' )
252
+ )
253
+ )
254
+ );
255
+ $products = array();
256
+ $product_ids = new WP_Query( $args );
257
+ if( $product_ids->posts ) {
258
+ foreach( $product_ids->posts as $product_id )
259
+ $products[] = $product_id;
260
+ }
261
+ return $products;
262
+
263
+ }
264
+ ?>
includes/tag.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ if( !function_exists( 'woo_ce_get_export_type_tag_count' ) ) {
7
+ function woo_ce_get_export_type_tag_count() {
8
+
9
+ $count = 0;
10
+ // Check if the existing Transient exists
11
+ $cached = get_transient( WOO_CE_PREFIX . '_tag_count' );
12
+ if( $cached == false ) {
13
+ $term_taxonomy = 'product_tag';
14
+ if( taxonomy_exists( $term_taxonomy ) )
15
+ $count = wp_count_terms( $term_taxonomy );
16
+ set_transient( WOO_CE_PREFIX . '_tag_count', $count, HOUR_IN_SECONDS );
17
+ } else {
18
+ $count = $cached;
19
+ }
20
+ return $count;
21
+
22
+ }
23
+ }
24
+
25
+ /* End of: WordPress Administration */
26
+
27
+ }
28
+
29
+ // Returns a list of Product Tag export columns
30
+ function woo_ce_get_tag_fields( $format = 'full' ) {
31
+
32
+ $export_type = 'tag';
33
+
34
+ $fields = array();
35
+ $fields[] = array(
36
+ 'name' => 'term_id',
37
+ 'label' => __( 'Term ID', 'woocommerce-exporter' )
38
+ );
39
+ $fields[] = array(
40
+ 'name' => 'name',
41
+ 'label' => __( 'Tag Name', 'woocommerce-exporter' )
42
+ );
43
+ $fields[] = array(
44
+ 'name' => 'slug',
45
+ 'label' => __( 'Tag Slug', 'woocommerce-exporter' )
46
+ );
47
+
48
+ /*
49
+ $fields[] = array(
50
+ 'name' => '',
51
+ 'label' => __( '', 'woocommerce-exporter' )
52
+ );
53
+ */
54
+
55
+ // Allow Plugin/Theme authors to add support for additional columns
56
+ $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type );
57
+
58
+ if( $remember = woo_ce_get_option( $export_type . '_fields', array() ) ) {
59
+ $remember = maybe_unserialize( $remember );
60
+ $size = count( $fields );
61
+ for( $i = 0; $i < $size; $i++ ) {
62
+ $fields[$i]['disabled'] = ( isset( $fields[$i]['disabled'] ) ? $fields[$i]['disabled'] : 0 );
63
+ $fields[$i]['default'] = 1;
64
+ if( !array_key_exists( $fields[$i]['name'], $remember ) )
65
+ $fields[$i]['default'] = 0;
66
+ }
67
+ }
68
+
69
+ switch( $format ) {
70
+
71
+ case 'summary':
72
+ $output = array();
73
+ $size = count( $fields );
74
+ for( $i = 0; $i < $size; $i++ ) {
75
+ if( isset( $fields[$i] ) )
76
+ $output[$fields[$i]['name']] = 'on';
77
+ }
78
+ return $output;
79
+ break;
80
+
81
+ case 'full':
82
+ default:
83
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
84
+ $size = count( $fields );
85
+ for( $i = 0; $i < $size; $i++ ) {
86
+ $fields[$i]['reset'] = $i;
87
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
88
+ }
89
+ // Check if we are using PHP 5.3 and above
90
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
91
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
92
+ return $fields;
93
+ break;
94
+
95
+ }
96
+
97
+ }
98
+
99
+ function woo_ce_override_tag_field_labels( $fields = array() ) {
100
+
101
+ $labels = woo_ce_get_option( 'tag_labels', array() );
102
+ if( !empty( $labels ) ) {
103
+ foreach( $fields as $key => $field ) {
104
+ if( isset( $labels[$field['name']] ) )
105
+ $fields[$key]['label'] = $labels[$field['name']];
106
+ }
107
+ }
108
+ return $fields;
109
+
110
+ }
111
+ add_filter( 'woo_ce_tag_fields', 'woo_ce_override_tag_field_labels', 11 );
112
+
113
+ // Returns a list of WooCommerce Product Tags to export process
114
+ function woo_ce_get_product_tags( $args = array() ) {
115
+
116
+ $term_taxonomy = 'product_tag';
117
+ $defaults = array(
118
+ 'orderby' => 'name',
119
+ 'order' => 'ASC',
120
+ 'hide_empty' => 0
121
+ );
122
+ $args = wp_parse_args( $args, $defaults );
123
+ $tags = get_terms( $term_taxonomy, $args );
124
+ if( !empty( $tags ) && is_wp_error( $tags ) == false ) {
125
+ $size = count( $tags );
126
+ for( $i = 0; $i < $size; $i++ ) {
127
+ $tags[$i]->disabled = 0;
128
+ if( $tags[$i]->count == 0 )
129
+ $tags[$i]->disabled = 1;
130
+ }
131
+ return $tags;
132
+ }
133
+
134
+ }
135
+
136
+ // Returns the export column header label based on an export column slug
137
+ function woo_ce_get_tag_field( $name = null, $format = 'name' ) {
138
+
139
+ $output = '';
140
+ if( $name ) {
141
+ $fields = woo_ce_get_tag_fields();
142
+ $size = count( $fields );
143
+ for( $i = 0; $i < $size; $i++ ) {
144
+ if( $fields[$i]['name'] == $name ) {
145
+ switch( $format ) {
146
+
147
+ case 'name':
148
+ $output = $fields[$i]['label'];
149
+ break;
150
+
151
+ case 'full':
152
+ $output = $fields[$i];
153
+ break;
154
+
155
+ }
156
+ $i = $size;
157
+ }
158
+ }
159
+ }
160
+ return $output;
161
+
162
+ }
163
+ ?>
includes/user-extend.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Adds custom User columns to the User fields list
3
+ function woo_ce_extend_user_fields( $fields = array() ) {
4
+
5
+ // WooCommerce Hear About Us - https://wordpress.org/plugins/woocommerce-hear-about-us/
6
+ if( class_exists( 'WooCommerce_HearAboutUs' ) ) {
7
+ $fields[] = array(
8
+ 'name' => 'hear_about_us',
9
+ 'label' => __( 'Source', 'woocommerce-exporter' ),
10
+ 'hover' => __( 'WooCommerce Hear About Us', 'woocommerce-exporter' ),
11
+ 'disabled' => 1
12
+ );
13
+ }
14
+
15
+ // WooCommerce User fields
16
+ if( class_exists( 'WC_Admin_Profile' ) ) {
17
+ $admin_profile = new WC_Admin_Profile();
18
+ if( method_exists( 'WC_Admin_Profile', 'get_customer_meta_fields' ) ) {
19
+ $show_fields = $admin_profile->get_customer_meta_fields();
20
+ foreach( $show_fields as $fieldset ) {
21
+ foreach( $fieldset['fields'] as $key => $field ) {
22
+ $fields[] = array(
23
+ 'name' => $key,
24
+ 'label' => sprintf( apply_filters( 'woo_ce_extend_user_fields_wc', '%s: %s' ), $fieldset['title'], esc_html( $field['label'] ) ),
25
+ 'disabled' => 1
26
+ );
27
+ }
28
+ }
29
+ unset( $show_fields, $fieldset, $field );
30
+ }
31
+ }
32
+
33
+ // WC Vendors - http://wcvendors.com
34
+ if( class_exists( 'WC_Vendors' ) ) {
35
+ $fields[] = array(
36
+ 'name' => 'shop_name',
37
+ 'label' => __( 'Shop Name' ),
38
+ 'hover' => __( 'WC Vendors', 'woocommerce-exporter' ),
39
+ 'disabled' => 1
40
+ );
41
+ $fields[] = array(
42
+ 'name' => 'shop_slug',
43
+ 'label' => __( 'Shop Slug' ),
44
+ 'hover' => __( 'WC Vendors', 'woocommerce-exporter' ),
45
+ 'disabled' => 1
46
+ );
47
+ $fields[] = array(
48
+ 'name' => 'paypal_email',
49
+ 'label' => __( 'PayPal E-mail' ),
50
+ 'hover' => __( 'WC Vendors', 'woocommerce-exporter' ),
51
+ 'disabled' => 1
52
+ );
53
+ $fields[] = array(
54
+ 'name' => 'commission_rate',
55
+ 'label' => __( 'Commission Rate (%)' ),
56
+ 'hover' => __( 'WC Vendors', 'woocommerce-exporter' ),
57
+ 'disabled' => 1
58
+ );
59
+ $fields[] = array(
60
+ 'name' => 'seller_info',
61
+ 'label' => __( 'Seller Info' ),
62
+ 'hover' => __( 'WC Vendors', 'woocommerce-exporter' ),
63
+ 'disabled' => 1
64
+ );
65
+ $fields[] = array(
66
+ 'name' => 'shop_description',
67
+ 'label' => __( 'Shop Description' ),
68
+ 'hover' => __( 'WC Vendors', 'woocommerce-exporter' ),
69
+ 'disabled' => 1
70
+ );
71
+ }
72
+
73
+ // WooCommerce Subscriptions - http://www.woothemes.com/products/woocommerce-subscriptions/
74
+ if( class_exists( 'WC_Subscriptions_Manager' ) ) {
75
+ $fields[] = array(
76
+ 'name' => 'active_subscriber',
77
+ 'label' => __( 'Active Subscriber' ),
78
+ 'hover' => __( 'WooCommerce Subscriptions', 'woocommerce-exporter' ),
79
+ 'disabled' => 1
80
+ );
81
+ }
82
+
83
+ // Custom User meta
84
+ $custom_users = woo_ce_get_option( 'custom_users', '' );
85
+ if( !empty( $custom_users ) ) {
86
+ foreach( $custom_users as $custom_user ) {
87
+ if( !empty( $custom_user ) ) {
88
+ $fields[] = array(
89
+ 'name' => $custom_user,
90
+ 'label' => $custom_user,
91
+ 'disabled' => 1
92
+ );
93
+ }
94
+ }
95
+ }
96
+ unset( $custom_users, $custom_user );
97
+
98
+ return $fields;
99
+
100
+ }
101
+ add_filter( 'woo_ce_user_fields', 'woo_ce_extend_user_fields' );
102
+ ?>
includes/user.php ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( is_admin() ) {
3
+
4
+ /* Start of: WordPress Administration */
5
+
6
+ if( !function_exists( 'woo_ce_get_export_type_user_count' ) ) {
7
+ function woo_ce_get_export_type_user_count() {
8
+
9
+ $count = 0;
10
+ // Check if the existing Transient exists
11
+ $cached = get_transient( WOO_CE_PREFIX . '_user_count' );
12
+ if( $cached == false ) {
13
+ if( $users = count_users() )
14
+ $count = ( isset( $users['total_users'] ) ? $users['total_users'] : 0 );
15
+ set_transient( WOO_CE_PREFIX . '_user_count', $count, HOUR_IN_SECONDS );
16
+ } else {
17
+ $count = $cached;
18
+ }
19
+ return $count;
20
+
21
+ }
22
+ }
23
+
24
+ /* End of: WordPress Administration */
25
+
26
+ }
27
+
28
+ // Returns a list of User export columns
29
+ function woo_ce_get_user_fields( $format = 'full' ) {
30
+
31
+ $export_type = 'user';
32
+
33
+ $fields = array();
34
+ $fields[] = array(
35
+ 'name' => 'user_id',
36
+ 'label' => __( 'User ID', 'woocommerce-exporter' )
37
+ );
38
+ $fields[] = array(
39
+ 'name' => 'user_name',
40
+ 'label' => __( 'Username', 'woocommerce-exporter' )
41
+ );
42
+ $fields[] = array(
43
+ 'name' => 'user_role',
44
+ 'label' => __( 'User Role', 'woocommerce-exporter' )
45
+ );
46
+ $fields[] = array(
47
+ 'name' => 'first_name',
48
+ 'label' => __( 'First Name', 'woocommerce-exporter' )
49
+ );
50
+ $fields[] = array(
51
+ 'name' => 'last_name',
52
+ 'label' => __( 'Last Name', 'woocommerce-exporter' )
53
+ );
54
+ $fields[] = array(
55
+ 'name' => 'full_name',
56
+ 'label' => __( 'Full Name', 'woocommerce-exporter' )
57
+ );
58
+ $fields[] = array(
59
+ 'name' => 'nick_name',
60
+ 'label' => __( 'Nickname', 'woocommerce-exporter' )
61
+ );
62
+ $fields[] = array(
63
+ 'name' => 'email',
64
+ 'label' => __( 'E-mail', 'woocommerce-exporter' )
65
+ );
66
+ $fields[] = array(
67
+ 'name' => 'orders',
68
+ 'label' => __( 'Orders', 'woocommerce-exporter' ),
69
+ 'disabled' => 1
70
+ );
71
+ $fields[] = array(
72
+ 'name' => 'money_spent',
73
+ 'label' => __( 'Money Spent', 'woocommerce-exporter' ),
74
+ 'disabled' => 1
75
+ );
76
+ $fields[] = array(
77
+ 'name' => 'url',
78
+ 'label' => __( 'Website', 'woocommerce-exporter' )
79
+ );
80
+ $fields[] = array(
81
+ 'name' => 'date_registered',
82
+ 'label' => __( 'Date Registered', 'woocommerce-exporter' )
83
+ );
84
+
85
+ /*
86
+ $fields[] = array(
87
+ 'name' => '',
88
+ 'label' => __( '', 'woocommerce-exporter' )
89
+ );
90
+ */
91
+
92
+ // Drop in our content filters here
93
+ add_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
94
+
95
+ // Allow Plugin/Theme authors to add support for additional columns
96
+ $fields = apply_filters( sprintf( WOO_CE_PREFIX . '_%s_fields', $export_type ), $fields, $export_type );
97
+
98
+ // Remove our content filters here to play nice with other Plugins
99
+ remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' );
100
+
101
+ $remember = woo_ce_get_option( $export_type . '_fields', array() );
102
+ if( !empty( $remember ) ) {
103
+ $remember = maybe_unserialize( $remember );
104
+ $size = count( $fields );
105
+ for( $i = 0; $i < $size; $i++ ) {
106
+ $fields[$i]['disabled'] = ( isset( $fields[$i]['disabled'] ) ? $fields[$i]['disabled'] : 0 );
107
+ $fields[$i]['default'] = 1;
108
+ // If not found turn off default
109
+ if( !array_key_exists( $fields[$i]['name'], $remember ) )
110
+ $fields[$i]['default'] = 0;
111
+ }
112
+ }
113
+
114
+ switch( $format ) {
115
+
116
+ case 'summary':
117
+ $output = array();
118
+ $size = count( $fields );
119
+ for( $i = 0; $i < $size; $i++ ) {
120
+ if( isset( $fields[$i] ) )
121
+ $output[$fields[$i]['name']] = 'on';
122
+ }
123
+ return $output;
124
+ break;
125
+
126
+ case 'full':
127
+ default:
128
+ $sorting = woo_ce_get_option( $export_type . '_sorting', array() );
129
+ $size = count( $fields );
130
+ for( $i = 0; $i < $size; $i++ ) {
131
+ $fields[$i]['reset'] = $i;
132
+ $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i );
133
+ }
134
+ // Check if we are using PHP 5.3 and above
135
+ if( version_compare( phpversion(), '5.3' ) >= 0 )
136
+ usort( $fields, woo_ce_sort_fields( 'order' ) );
137
+ return $fields;
138
+ break;
139
+
140
+ }
141
+
142
+ }
143
+
144
+ // Check if we should override field labels from the Field Editor
145
+ function woo_ce_override_user_field_labels( $fields = array() ) {
146
+
147
+ $labels = woo_ce_get_option( 'user_labels', array() );
148
+ if( !empty( $labels ) ) {
149
+ foreach( $fields as $key => $field ) {
150
+ if( isset( $labels[$field['name']] ) )
151
+ $fields[$key]['label'] = $labels[$field['name']];
152
+ }
153
+ }
154
+ return $fields;
155
+
156
+ }
157
+ add_filter( 'woo_ce_user_fields', 'woo_ce_override_user_field_labels', 11 );
158
+
159
+ // Returns the export column header label based on an export column slug
160
+ function woo_ce_get_user_field( $name = null, $format = 'name' ) {
161
+
162
+ $output = '';
163
+ if( $name ) {
164
+ $fields = woo_ce_get_user_fields();
165
+ $size = count( $fields );
166
+ for( $i = 0; $i < $size; $i++ ) {
167
+ if( $fields[$i]['name'] == $name ) {
168
+ switch( $format ) {
169
+
170
+ case 'name':
171
+ $output = $fields[$i]['label'];
172
+ break;
173
+
174
+ case 'full':
175
+ $output = $fields[$i];
176
+ break;
177
+
178
+ }
179
+ $i = $size;
180
+ }
181
+ }
182
+ }
183
+ return $output;
184
+
185
+ }
186
+
187
+ // Returns a list of User IDs
188
+ function woo_ce_get_users( $args = array() ) {
189
+
190
+ global $export;
191
+
192
+ $limit_volume = 0;
193
+ $offset = 0;
194
+ $orderby = 'login';
195
+ $order = 'ASC';
196
+
197
+ if( $args ) {
198
+ $limit_volume = ( isset( $args['limit_volume'] ) ? $args['limit_volume'] : 0 );
199
+ if( $limit_volume == -1 )
200
+ $limit_volume = 0;
201
+ $offset = ( isset( $args['offset'] ) ? $args['offset'] : 0 );
202
+ $orderby = ( isset( $args['user_orderby'] ) ? $args['user_orderby'] : 'login' );
203
+ $order = ( isset( $args['user_order'] ) ? $args['user_order'] : 'ASC' );
204
+ }
205
+ $args = array(
206
+ 'offset' => $offset,
207
+ 'number' => $limit_volume,
208
+ 'order' => $order,
209
+ 'offset' => $offset,
210
+ 'fields' => 'ids'
211
+ );
212
+ if( $user_ids = new WP_User_Query( $args ) ) {
213
+ $users = array();
214
+ $export->total_rows = $user_ids->total_users;
215
+ foreach( $user_ids->results as $user_id )
216
+ $users[] = $user_id;
217
+ return $users;
218
+ }
219
+
220
+ }
221
+
222
+ function woo_ce_get_user_data( $user_id = 0, $args = array() ) {
223
+
224
+ $defaults = array();
225
+ $args = wp_parse_args( $args, $defaults );
226
+
227
+ // Get User details
228
+ $user_data = get_userdata( $user_id );
229
+
230
+ $user = new stdClass;
231
+ if( $user_data !== false ) {
232
+ $user->ID = $user_data->ID;
233
+ $user->user_id = $user_data->ID;
234
+ $user->user_name = $user_data->user_login;
235
+ $user->user_role = $user_data->roles[0];
236
+ $user->first_name = $user_data->first_name;
237
+ $user->last_name = $user_data->last_name;
238
+ $user->full_name = sprintf( apply_filters( 'woo_ce_get_user_data_full_name', '%s %s' ), $user->first_name, $user->last_name );
239
+ $user->nick_name = $user_data->user_nicename;
240
+ $user->email = $user_data->user_email;
241
+ $user->url = $user_data->user_url;
242
+ $user->date_registered = $user_data->user_registered;
243
+ }
244
+
245
+ // Allow Plugin/Theme authors to add support for additional User columns
246
+ return apply_filters( 'woo_ce_user', $user );
247
+
248
+ }
249
+
250
+ // Returns a list of WordPress User Roles
251
+ function woo_ce_get_user_roles() {
252
+
253
+ global $wp_roles;
254
+
255
+ $user_roles = $wp_roles->roles;
256
+ return $user_roles;
257
+
258
+ }
259
+
260
+ function woo_ce_format_user_role_label( $user_role = '' ) {
261
+
262
+ global $wp_roles;
263
+
264
+ $output = $user_role;
265
+ if( $user_role ) {
266
+ $user_roles = woo_ce_get_user_roles();
267
+ if( isset( $user_roles[$user_role] ) )
268
+ $output = ucfirst( $user_roles[$user_role]['name'] );
269
+ unset( $user_roles );
270
+ }
271
+ return $output;
272
+
273
+ }
274
+
275
+ ?>
js/chosen.jquery.js ADDED
@@ -0,0 +1,988 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Chosen, a Select Box Enhancer for jQuery and Protoype
2
+ // by Patrick Filler for Harvest, http://getharvest.com
3
+ //
4
+ // Version 0.9.8
5
+ // Full source at https://github.com/harvesthq/chosen
6
+ // Copyright (c) 2011 Harvest http://getharvest.com
7
+
8
+ // MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
9
+ // This file is generated by `cake build`, do not edit it by hand.
10
+ (function() {
11
+ var SelectParser;
12
+
13
+ SelectParser = (function() {
14
+
15
+ function SelectParser() {
16
+ this.options_index = 0;
17
+ this.parsed = [];
18
+ }
19
+
20
+ SelectParser.prototype.add_node = function(child) {
21
+ if (child.nodeName === "OPTGROUP") {
22
+ return this.add_group(child);
23
+ } else {
24
+ return this.add_option(child);
25
+ }
26
+ };
27
+
28
+ SelectParser.prototype.add_group = function(group) {
29
+ var group_position, option, _i, _len, _ref, _results;
30
+ group_position = this.parsed.length;
31
+ this.parsed.push({
32
+ array_index: group_position,
33
+ group: true,
34
+ label: group.label,
35
+ children: 0,
36
+ disabled: group.disabled
37
+ });
38
+ _ref = group.childNodes;
39
+ _results = [];
40
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
41
+ option = _ref[_i];
42
+ _results.push(this.add_option(option, group_position, group.disabled));
43
+ }
44
+ return _results;
45
+ };
46
+
47
+ SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
48
+ if (option.nodeName === "OPTION") {
49
+ if (option.text !== "") {
50
+ if (group_position != null) this.parsed[group_position].children += 1;
51
+ this.parsed.push({
52
+ array_index: this.parsed.length,
53
+ options_index: this.options_index,
54
+ value: option.value,
55
+ text: option.text,
56
+ html: option.innerHTML,
57
+ selected: option.selected,
58
+ disabled: group_disabled === true ? group_disabled : option.disabled,
59
+ group_array_index: group_position,
60
+ classes: option.className,
61
+ style: option.style.cssText
62
+ });
63
+ } else {
64
+ this.parsed.push({
65
+ array_index: this.parsed.length,
66
+ options_index: this.options_index,
67
+ empty: true
68
+ });
69
+ }
70
+ return this.options_index += 1;
71
+ }
72
+ };
73
+
74
+ return SelectParser;
75
+
76
+ })();
77
+
78
+ SelectParser.select_to_array = function(select) {
79
+ var child, parser, _i, _len, _ref;
80
+ parser = new SelectParser();
81
+ _ref = select.childNodes;
82
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
83
+ child = _ref[_i];
84
+ parser.add_node(child);
85
+ }
86
+ return parser.parsed;
87
+ };
88
+
89
+ this.SelectParser = SelectParser;
90
+
91
+ }).call(this);
92
+
93
+ /*
94
+ Chosen source: generate output using 'cake build'
95
+ Copyright (c) 2011 by Harvest
96
+ */
97
+
98
+ (function() {
99
+ var AbstractChosen, root;
100
+
101
+ root = this;
102
+
103
+ AbstractChosen = (function() {
104
+
105
+ function AbstractChosen(form_field, options) {
106
+ this.form_field = form_field;
107
+ this.options = options != null ? options : {};
108
+ this.set_default_values();
109
+ this.is_multiple = this.form_field.multiple;
110
+ this.set_default_text();
111
+ this.setup();
112
+ this.set_up_html();
113
+ this.register_observers();
114
+ this.finish_setup();
115
+ }
116
+
117
+ AbstractChosen.prototype.set_default_values = function() {
118
+ var _this = this;
119
+ this.click_test_action = function(evt) {
120
+ return _this.test_active_click(evt);
121
+ };
122
+ this.activate_action = function(evt) {
123
+ return _this.activate_field(evt);
124
+ };
125
+ this.active_field = false;
126
+ this.mouse_on_container = false;
127
+ this.results_showing = false;
128
+ this.result_highlighted = null;
129
+ this.result_single_selected = null;
130
+ this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
131
+ this.disable_search_threshold = this.options.disable_search_threshold || 0;
132
+ this.search_contains = this.options.search_contains || false;
133
+ this.choices = 0;
134
+ return this.max_selected_options = this.options.max_selected_options || Infinity;
135
+ };
136
+
137
+ AbstractChosen.prototype.set_default_text = function() {
138
+ if (this.form_field.getAttribute("data-placeholder")) {
139
+ this.default_text = this.form_field.getAttribute("data-placeholder");
140
+ } else if (this.is_multiple) {
141
+ this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || "Select Some Options";
142
+ } else {
143
+ this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || "Select an Option";
144
+ }
145
+ return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || "No results match";
146
+ };
147
+
148
+ AbstractChosen.prototype.mouse_enter = function() {
149
+ return this.mouse_on_container = true;
150
+ };
151
+
152
+ AbstractChosen.prototype.mouse_leave = function() {
153
+ return this.mouse_on_container = false;
154
+ };
155
+
156
+ AbstractChosen.prototype.input_focus = function(evt) {
157
+ var _this = this;
158
+ if (!this.active_field) {
159
+ return setTimeout((function() {
160
+ return _this.container_mousedown();
161
+ }), 50);
162
+ }
163
+ };
164
+
165
+ AbstractChosen.prototype.input_blur = function(evt) {
166
+ var _this = this;
167
+ if (!this.mouse_on_container) {
168
+ this.active_field = false;
169
+ return setTimeout((function() {
170
+ return _this.blur_test();
171
+ }), 100);
172
+ }
173
+ };
174
+
175
+ AbstractChosen.prototype.result_add_option = function(option) {
176
+ var classes, style;
177
+ if (!option.disabled) {
178
+ option.dom_id = this.container_id + "_o_" + option.array_index;
179
+ classes = option.selected && this.is_multiple ? [] : ["active-result"];
180
+ if (option.selected) classes.push("result-selected");
181
+ if (option.group_array_index != null) classes.push("group-option");
182
+ if (option.classes !== "") classes.push(option.classes);
183
+ style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : "";
184
+ return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '"' + style + '>' + option.html + '</li>';
185
+ } else {
186
+ return "";
187
+ }
188
+ };
189
+
190
+ AbstractChosen.prototype.results_update_field = function() {
191
+ this.results_reset();
192
+ this.result_clear_highlight();
193
+ this.result_single_selected = null;
194
+ return this.results_build();
195
+ };
196
+
197
+ AbstractChosen.prototype.results_toggle = function() {
198
+ if (this.results_showing) {
199
+ return this.results_hide();
200
+ } else {
201
+ return this.results_show();
202
+ }
203
+ };
204
+
205
+ AbstractChosen.prototype.results_search = function(evt) {
206
+ if (this.results_showing) {
207
+ return this.winnow_results();
208
+ } else {
209
+ return this.results_show();
210
+ }
211
+ };
212
+
213
+ AbstractChosen.prototype.keyup_checker = function(evt) {
214
+ var stroke, _ref;
215
+ stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
216
+ this.search_field_scale();
217
+ switch (stroke) {
218
+ case 8:
219
+ if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) {
220
+ return this.keydown_backstroke();
221
+ } else if (!this.pending_backstroke) {
222
+ this.result_clear_highlight();
223
+ return this.results_search();
224
+ }
225
+ break;
226
+ case 13:
227
+ evt.preventDefault();
228
+ if (this.results_showing) return this.result_select(evt);
229
+ break;
230
+ case 27:
231
+ if (this.results_showing) this.results_hide();
232
+ return true;
233
+ case 9:
234
+ case 38:
235
+ case 40:
236
+ case 16:
237
+ case 91:
238
+ case 17:
239
+ break;
240
+ default:
241
+ return this.results_search();
242
+ }
243
+ };
244
+
245
+ AbstractChosen.prototype.generate_field_id = function() {
246
+ var new_id;
247
+ new_id = this.generate_random_id();
248
+ this.form_field.id = new_id;
249
+ return new_id;
250
+ };
251
+
252
+ AbstractChosen.prototype.generate_random_char = function() {
253
+ var chars, newchar, rand;
254
+ chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
255
+ rand = Math.floor(Math.random() * chars.length);
256
+ return newchar = chars.substring(rand, rand + 1);
257
+ };
258
+
259
+ return AbstractChosen;
260
+
261
+ })();
262
+
263
+ root.AbstractChosen = AbstractChosen;
264
+
265
+ }).call(this);
266
+
267
+ /*
268
+ Chosen source: generate output using 'cake build'
269
+ Copyright (c) 2011 by Harvest
270
+ */
271
+
272
+ (function() {
273
+ var $, Chosen, get_side_border_padding, root,
274
+ __hasProp = Object.prototype.hasOwnProperty,
275
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
276
+
277
+ root = this;
278
+
279
+ $ = jQuery;
280
+
281
+ $.fn.extend({
282
+ chosen: function(options) {
283
+ if ($.browser.msie && ($.browser.version === "6.0" || $.browser.version === "7.0")) {
284
+ return this;
285
+ }
286
+ return this.each(function(input_field) {
287
+ var $this;
288
+ $this = $(this);
289
+ if (!$this.hasClass("chzn-done")) {
290
+ return $this.data('chosen', new Chosen(this, options));
291
+ }
292
+ });
293
+ }
294
+ });
295
+
296
+ Chosen = (function(_super) {
297
+
298
+ __extends(Chosen, _super);
299
+
300
+ function Chosen() {
301
+ Chosen.__super__.constructor.apply(this, arguments);
302
+ }
303
+
304
+ Chosen.prototype.setup = function() {
305
+ this.form_field_jq = $(this.form_field);
306
+ return this.is_rtl = this.form_field_jq.hasClass("chzn-rtl");
307
+ };
308
+
309
+ Chosen.prototype.finish_setup = function() {
310
+ return this.form_field_jq.addClass("chzn-done");
311
+ };
312
+
313
+ Chosen.prototype.set_up_html = function() {
314
+ var container_div, dd_top, dd_width, sf_width;
315
+ this.container_id = this.form_field.id.length ? this.form_field.id.replace(/[^\w]/g, '_') : this.generate_field_id();
316
+ this.container_id += "_chzn";
317
+ this.f_width = this.form_field_jq.outerWidth();
318
+ container_div = $("<div />", {
319
+ id: this.container_id,
320
+ "class": "chzn-container" + (this.is_rtl ? ' chzn-rtl' : ''),
321
+ style: 'width: ' + this.f_width + 'px;'
322
+ });
323
+ if (this.is_multiple) {
324
+ container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
325
+ } else {
326
+ container_div.html('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
327
+ }
328
+ this.form_field_jq.hide().after(container_div);
329
+ this.container = $('#' + this.container_id);
330
+ this.container.addClass("chzn-container-" + (this.is_multiple ? "multi" : "single"));
331
+ this.dropdown = this.container.find('div.chzn-drop').first();
332
+ dd_top = this.container.height();
333
+ dd_width = this.f_width - get_side_border_padding(this.dropdown);
334
+ this.dropdown.css({
335
+ "width": dd_width + "px",
336
+ "top": dd_top + "px"
337
+ });
338
+ this.search_field = this.container.find('input').first();
339
+ this.search_results = this.container.find('ul.chzn-results').first();
340
+ this.search_field_scale();
341
+ this.search_no_results = this.container.find('li.no-results').first();
342
+ if (this.is_multiple) {
343
+ this.search_choices = this.container.find('ul.chzn-choices').first();
344
+ this.search_container = this.container.find('li.search-field').first();
345
+ } else {
346
+ this.search_container = this.container.find('div.chzn-search').first();
347
+ this.selected_item = this.container.find('.chzn-single').first();
348
+ sf_width = dd_width - get_side_border_padding(this.search_container) - get_side_border_padding(this.search_field);
349
+ this.search_field.css({
350
+ "width": sf_width + "px"
351
+ });
352
+ }
353
+ this.results_build();
354
+ this.set_tab_index();
355
+ return this.form_field_jq.trigger("liszt:ready", {
356
+ chosen: this
357
+ });
358
+ };
359
+
360
+ Chosen.prototype.register_observers = function() {
361
+ var _this = this;
362
+ this.container.mousedown(function(evt) {
363
+ return _this.container_mousedown(evt);
364
+ });
365
+ this.container.mouseup(function(evt) {
366
+ return _this.container_mouseup(evt);
367
+ });
368
+ this.container.mouseenter(function(evt) {
369
+ return _this.mouse_enter(evt);
370
+ });
371
+ this.container.mouseleave(function(evt) {
372
+ return _this.mouse_leave(evt);
373
+ });
374
+ this.search_results.mouseup(function(evt) {
375
+ return _this.search_results_mouseup(evt);
376
+ });
377
+ this.search_results.mouseover(function(evt) {
378
+ return _this.search_results_mouseover(evt);
379
+ });
380
+ this.search_results.mouseout(function(evt) {
381
+ return _this.search_results_mouseout(evt);
382
+ });
383
+ this.form_field_jq.bind("liszt:updated", function(evt) {
384
+ return _this.results_update_field(evt);
385
+ });
386
+ this.search_field.blur(function(evt) {
387
+ return _this.input_blur(evt);
388
+ });
389
+ this.search_field.keyup(function(evt) {
390
+ return _this.keyup_checker(evt);
391
+ });
392
+ this.search_field.keydown(function(evt) {
393
+ return _this.keydown_checker(evt);
394
+ });
395
+ if (this.is_multiple) {
396
+ this.search_choices.click(function(evt) {
397
+ return _this.choices_click(evt);
398
+ });
399
+ return this.search_field.focus(function(evt) {
400
+ return _this.input_focus(evt);
401
+ });
402
+ } else {
403
+ return this.container.click(function(evt) {
404
+ return evt.preventDefault();
405
+ });
406
+ }
407
+ };
408
+
409
+ Chosen.prototype.search_field_disabled = function() {
410
+ this.is_disabled = this.form_field_jq[0].disabled;
411
+ if (this.is_disabled) {
412
+ this.container.addClass('chzn-disabled');
413
+ this.search_field[0].disabled = true;
414
+ if (!this.is_multiple) {
415
+ this.selected_item.unbind("focus", this.activate_action);
416
+ }
417
+ return this.close_field();
418
+ } else {
419
+ this.container.removeClass('chzn-disabled');
420
+ this.search_field[0].disabled = false;
421
+ if (!this.is_multiple) {
422
+ return this.selected_item.bind("focus", this.activate_action);
423
+ }
424
+ }
425
+ };
426
+
427
+ Chosen.prototype.container_mousedown = function(evt) {
428
+ var target_closelink;
429
+ if (!this.is_disabled) {
430
+ target_closelink = evt != null ? ($(evt.target)).hasClass("search-choice-close") : false;
431
+ if (evt && evt.type === "mousedown" && !this.results_showing) {
432
+ evt.stopPropagation();
433
+ }
434
+ if (!this.pending_destroy_click && !target_closelink) {
435
+ if (!this.active_field) {
436
+ if (this.is_multiple) this.search_field.val("");
437
+ $(document).click(this.click_test_action);
438
+ this.results_show();
439
+ } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chzn-single").length)) {
440
+ evt.preventDefault();
441
+ this.results_toggle();
442
+ }
443
+ return this.activate_field();
444
+ } else {
445
+ return this.pending_destroy_click = false;
446
+ }
447
+ }
448
+ };
449
+
450
+ Chosen.prototype.container_mouseup = function(evt) {
451
+ if (evt.target.nodeName === "ABBR") return this.results_reset(evt);
452
+ };
453
+
454
+ Chosen.prototype.blur_test = function(evt) {
455
+ if (!this.active_field && this.container.hasClass("chzn-container-active")) {
456
+ return this.close_field();
457
+ }
458
+ };
459
+
460
+ Chosen.prototype.close_field = function() {
461
+ $(document).unbind("click", this.click_test_action);
462
+ if (!this.is_multiple) {
463
+ this.selected_item.attr("tabindex", this.search_field.attr("tabindex"));
464
+ this.search_field.attr("tabindex", -1);
465
+ }
466
+ this.active_field = false;
467
+ this.results_hide();
468
+ this.container.removeClass("chzn-container-active");
469
+ this.winnow_results_clear();
470
+ this.clear_backstroke();
471
+ this.show_search_field_default();
472
+ return this.search_field_scale();
473
+ };
474
+
475
+ Chosen.prototype.activate_field = function() {
476
+ if (!this.is_multiple && !this.active_field) {
477
+ this.search_field.attr("tabindex", this.selected_item.attr("tabindex"));
478
+ this.selected_item.attr("tabindex", -1);
479
+ }
480
+ this.container.addClass("chzn-container-active");
481
+ this.active_field = true;
482
+ this.search_field.val(this.search_field.val());
483
+ return this.search_field.focus();
484
+ };
485
+
486
+ Chosen.prototype.test_active_click = function(evt) {
487
+ if ($(evt.target).parents('#' + this.container_id).length) {
488
+ return this.active_field = true;
489
+ } else {
490
+ return this.close_field();
491
+ }
492
+ };
493
+
494
+ Chosen.prototype.results_build = function() {
495
+ var content, data, _i, _len, _ref;
496
+ this.parsing = true;
497
+ this.results_data = root.SelectParser.select_to_array(this.form_field);
498
+ if (this.is_multiple && this.choices > 0) {
499
+ this.search_choices.find("li.search-choice").remove();
500
+ this.choices = 0;
501
+ } else if (!this.is_multiple) {
502
+ this.selected_item.find("span").text(this.default_text);
503
+ if (this.form_field.options.length <= this.disable_search_threshold) {
504
+ this.container.addClass("chzn-container-single-nosearch");
505
+ } else {
506
+ this.container.removeClass("chzn-container-single-nosearch");
507
+ }
508
+ }
509
+ content = '';
510
+ _ref = this.results_data;
511
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
512
+ data = _ref[_i];
513
+ if (data.group) {
514
+ content += this.result_add_group(data);
515
+ } else if (!data.empty) {
516
+ content += this.result_add_option(data);
517
+ if (data.selected && this.is_multiple) {
518
+ this.choice_build(data);
519
+ } else if (data.selected && !this.is_multiple) {
520
+ this.selected_item.removeClass("chzn-default").find("span").text(data.text);
521
+ if (this.allow_single_deselect) this.single_deselect_control_build();
522
+ }
523
+ }
524
+ }
525
+ this.search_field_disabled();
526
+ this.show_search_field_default();
527
+ this.search_field_scale();
528
+ this.search_results.html(content);
529
+ return this.parsing = false;
530
+ };
531
+
532
+ Chosen.prototype.result_add_group = function(group) {
533
+ if (!group.disabled) {
534
+ group.dom_id = this.container_id + "_g_" + group.array_index;
535
+ return '<li id="' + group.dom_id + '" class="group-result">' + $("<div />").text(group.label).html() + '</li>';
536
+ } else {
537
+ return "";
538
+ }
539
+ };
540
+
541
+ Chosen.prototype.result_do_highlight = function(el) {
542
+ var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
543
+ if (el.length) {
544
+ this.result_clear_highlight();
545
+ this.result_highlight = el;
546
+ this.result_highlight.addClass("highlighted");
547
+ maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
548
+ visible_top = this.search_results.scrollTop();
549
+ visible_bottom = maxHeight + visible_top;
550
+ high_top = this.result_highlight.position().top + this.search_results.scrollTop();
551
+ high_bottom = high_top + this.result_highlight.outerHeight();
552
+ if (high_bottom >= visible_bottom) {
553
+ return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
554
+ } else if (high_top < visible_top) {
555
+ return this.search_results.scrollTop(high_top);
556
+ }
557
+ }
558
+ };
559
+
560
+ Chosen.prototype.result_clear_highlight = function() {
561
+ if (this.result_highlight) this.result_highlight.removeClass("highlighted");
562
+ return this.result_highlight = null;
563
+ };
564
+
565
+ Chosen.prototype.results_show = function() {
566
+ var dd_top;
567
+ if (!this.is_multiple) {
568
+ this.selected_item.addClass("chzn-single-with-drop");
569
+ if (this.result_single_selected) {
570
+ this.result_do_highlight(this.result_single_selected);
571
+ }
572
+ } else if (this.max_selected_options <= this.choices) {
573
+ this.form_field_jq.trigger("liszt:maxselected", {
574
+ chosen: this
575
+ });
576
+ return false;
577
+ }
578
+ dd_top = this.is_multiple ? this.container.height() : this.container.height() - 1;
579
+ this.form_field_jq.trigger("liszt:showing_dropdown", {
580
+ chosen: this
581
+ });
582
+ this.dropdown.css({
583
+ "top": dd_top + "px",
584
+ "left": 0
585
+ });
586
+ this.results_showing = true;
587
+ this.search_field.focus();
588
+ this.search_field.val(this.search_field.val());
589
+ return this.winnow_results();
590
+ };
591
+
592
+ Chosen.prototype.results_hide = function() {
593
+ if (!this.is_multiple) {
594
+ this.selected_item.removeClass("chzn-single-with-drop");
595
+ }
596
+ this.result_clear_highlight();
597
+ this.form_field_jq.trigger("liszt:hiding_dropdown", {
598
+ chosen: this
599
+ });
600
+ this.dropdown.css({
601
+ "left": "-9000px"
602
+ });
603
+ return this.results_showing = false;
604
+ };
605
+
606
+ Chosen.prototype.set_tab_index = function(el) {
607
+ var ti;
608
+ if (this.form_field_jq.attr("tabindex")) {
609
+ ti = this.form_field_jq.attr("tabindex");
610
+ this.form_field_jq.attr("tabindex", -1);
611
+ if (this.is_multiple) {
612
+ return this.search_field.attr("tabindex", ti);
613
+ } else {
614
+ this.selected_item.attr("tabindex", ti);
615
+ return this.search_field.attr("tabindex", -1);
616
+ }
617
+ }
618
+ };
619
+
620
+ Chosen.prototype.show_search_field_default = function() {
621
+ if (this.is_multiple && this.choices < 1 && !this.active_field) {
622
+ this.search_field.val(this.default_text);
623
+ return this.search_field.addClass("default");
624
+ } else {
625
+ this.search_field.val("");
626
+ return this.search_field.removeClass("default");
627
+ }
628
+ };
629
+
630
+ Chosen.prototype.search_results_mouseup = function(evt) {
631
+ var target;
632
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
633
+ if (target.length) {
634
+ this.result_highlight = target;
635
+ return this.result_select(evt);
636
+ }
637
+ };
638
+
639
+ Chosen.prototype.search_results_mouseover = function(evt) {
640
+ var target;
641
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
642
+ if (target) return this.result_do_highlight(target);
643
+ };
644
+
645
+ Chosen.prototype.search_results_mouseout = function(evt) {
646
+ if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
647
+ return this.result_clear_highlight();
648
+ }
649
+ };
650
+
651
+ Chosen.prototype.choices_click = function(evt) {
652
+ evt.preventDefault();
653
+ if (this.active_field && !($(evt.target).hasClass("search-choice" || $(evt.target).parents('.search-choice').first)) && !this.results_showing) {
654
+ return this.results_show();
655
+ }
656
+ };
657
+
658
+ Chosen.prototype.choice_build = function(item) {
659
+ var choice_id, link,
660
+ _this = this;
661
+ if (this.is_multiple && this.max_selected_options <= this.choices) {
662
+ this.form_field_jq.trigger("liszt:maxselected", {
663
+ chosen: this
664
+ });
665
+ return false;
666
+ }
667
+ choice_id = this.container_id + "_c_" + item.array_index;
668
+ this.choices += 1;
669
+ this.search_container.before('<li class="search-choice" id="' + choice_id + '"><span>' + item.html + '</span><a href="javascript:void(0)" class="search-choice-close" rel="' + item.array_index + '"></a></li>');
670
+ link = $('#' + choice_id).find("a").first();
671
+ return link.click(function(evt) {
672
+ return _this.choice_destroy_link_click(evt);
673
+ });
674
+ };
675
+
676
+ Chosen.prototype.choice_destroy_link_click = function(evt) {
677
+ evt.preventDefault();
678
+ if (!this.is_disabled) {
679
+ this.pending_destroy_click = true;
680
+ return this.choice_destroy($(evt.target));
681
+ } else {
682
+ return evt.stopPropagation;
683
+ }
684
+ };
685
+
686
+ Chosen.prototype.choice_destroy = function(link) {
687
+ this.choices -= 1;
688
+ this.show_search_field_default();
689
+ if (this.is_multiple && this.choices > 0 && this.search_field.val().length < 1) {
690
+ this.results_hide();
691
+ }
692
+ this.result_deselect(link.attr("rel"));
693
+ return link.parents('li').first().remove();
694
+ };
695
+
696
+ Chosen.prototype.results_reset = function() {
697
+ this.form_field.options[0].selected = true;
698
+ this.selected_item.find("span").text(this.default_text);
699
+ if (!this.is_multiple) this.selected_item.addClass("chzn-default");
700
+ this.show_search_field_default();
701
+ this.selected_item.find("abbr").remove();
702
+ this.form_field_jq.trigger("change");
703
+ if (this.active_field) return this.results_hide();
704
+ };
705
+
706
+ Chosen.prototype.result_select = function(evt) {
707
+ var high, high_id, item, position;
708
+ if (this.result_highlight) {
709
+ high = this.result_highlight;
710
+ high_id = high.attr("id");
711
+ this.result_clear_highlight();
712
+ if (this.is_multiple) {
713
+ this.result_deactivate(high);
714
+ } else {
715
+ this.search_results.find(".result-selected").removeClass("result-selected");
716
+ this.result_single_selected = high;
717
+ this.selected_item.removeClass("chzn-default");
718
+ }
719
+ high.addClass("result-selected");
720
+ position = high_id.substr(high_id.lastIndexOf("_") + 1);
721
+ item = this.results_data[position];
722
+ item.selected = true;
723
+ this.form_field.options[item.options_index].selected = true;
724
+ if (this.is_multiple) {
725
+ this.choice_build(item);
726
+ } else {
727
+ this.selected_item.find("span").first().text(item.text);
728
+ if (this.allow_single_deselect) this.single_deselect_control_build();
729
+ }
730
+ if (!(evt.metaKey && this.is_multiple)) this.results_hide();
731
+ this.search_field.val("");
732
+ this.form_field_jq.trigger("change", {
733
+ 'selected': this.form_field.options[item.options_index].value
734
+ });
735
+ return this.search_field_scale();
736
+ }
737
+ };
738
+
739
+ Chosen.prototype.result_activate = function(el) {
740
+ return el.addClass("active-result");
741
+ };
742
+
743
+ Chosen.prototype.result_deactivate = function(el) {
744
+ return el.removeClass("active-result");
745
+ };
746
+
747
+ Chosen.prototype.result_deselect = function(pos) {
748
+ var result, result_data;
749
+ result_data = this.results_data[pos];
750
+ result_data.selected = false;
751
+ this.form_field.options[result_data.options_index].selected = false;
752
+ result = $("#" + this.container_id + "_o_" + pos);
753
+ result.removeClass("result-selected").addClass("active-result").show();
754
+ this.result_clear_highlight();
755
+ this.winnow_results();
756
+ this.form_field_jq.trigger("change", {
757
+ deselected: this.form_field.options[result_data.options_index].value
758
+ });
759
+ return this.search_field_scale();
760
+ };
761
+
762
+ Chosen.prototype.single_deselect_control_build = function() {
763
+ if (this.allow_single_deselect && this.selected_item.find("abbr").length < 1) {
764
+ return this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
765
+ }
766
+ };
767
+
768
+ Chosen.prototype.winnow_results = function() {
769
+ var found, option, part, parts, regex, regexAnchor, result, result_id, results, searchText, startpos, text, zregex, _i, _j, _len, _len2, _ref;
770
+ this.no_results_clear();
771
+ results = 0;
772
+ searchText = this.search_field.val() === this.default_text ? "" : $('<div/>').text($.trim(this.search_field.val())).html();
773
+ regexAnchor = this.search_contains ? "" : "^";
774
+ regex = new RegExp(regexAnchor + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
775
+ zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
776
+ _ref = this.results_data;
777
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
778
+ option = _ref[_i];
779
+ if (!option.disabled && !option.empty) {
780
+ if (option.group) {
781
+ $('#' + option.dom_id).css('display', 'none');
782
+ } else if (!(this.is_multiple && option.selected)) {
783
+ found = false;
784
+ result_id = option.dom_id;
785
+ result = $("#" + result_id);
786
+ if (regex.test(option.html)) {
787
+ found = true;
788
+ results += 1;
789
+ } else if (option.html.indexOf(" ") >= 0 || option.html.indexOf("[") === 0) {
790
+ parts = option.html.replace(/\[|\]/g, "").split(" ");
791
+ if (parts.length) {
792
+ for (_j = 0, _len2 = parts.length; _j < _len2; _j++) {
793
+ part = parts[_j];
794
+ if (regex.test(part)) {
795
+ found = true;
796
+ results += 1;
797
+ }
798
+ }
799
+ }
800
+ }
801
+ if (found) {
802
+ if (searchText.length) {
803
+ startpos = option.html.search(zregex);
804
+ text = option.html.substr(0, startpos + searchText.length) + '</em>' + option.html.substr(startpos + searchText.length);
805
+ text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
806
+ } else {
807
+ text = option.html;
808
+ }
809
+ result.html(text);
810
+ this.result_activate(result);
811
+ if (option.group_array_index != null) {
812
+ $("#" + this.results_data[option.group_array_index].dom_id).css('display', 'list-item');
813
+ }
814
+ } else {
815
+ if (this.result_highlight && result_id === this.result_highlight.attr('id')) {
816
+ this.result_clear_highlight();
817
+ }
818
+ this.result_deactivate(result);
819
+ }
820
+ }
821
+ }
822
+ }
823
+ if (results < 1 && searchText.length) {
824
+ return this.no_results(searchText);
825
+ } else {
826
+ return this.winnow_results_set_highlight();
827
+ }
828
+ };
829
+
830
+ Chosen.prototype.winnow_results_clear = function() {
831
+ var li, lis, _i, _len, _results;
832
+ this.search_field.val("");
833
+ lis = this.search_results.find("li");
834
+ _results = [];
835
+ for (_i = 0, _len = lis.length; _i < _len; _i++) {
836
+ li = lis[_i];
837
+ li = $(li);
838
+ if (li.hasClass("group-result")) {
839
+ _results.push(li.css('display', 'auto'));
840
+ } else if (!this.is_multiple || !li.hasClass("result-selected")) {
841
+ _results.push(this.result_activate(li));
842
+ } else {
843
+ _results.push(void 0);
844
+ }
845
+ }
846
+ return _results;
847
+ };
848
+
849
+ Chosen.prototype.winnow_results_set_highlight = function() {
850
+ var do_high, selected_results;
851
+ if (!this.result_highlight) {
852
+ selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
853
+ do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
854
+ if (do_high != null) return this.result_do_highlight(do_high);
855
+ }
856
+ };
857
+
858
+ Chosen.prototype.no_results = function(terms) {
859
+ var no_results_html;
860
+ no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
861
+ no_results_html.find("span").first().html(terms);
862
+ return this.search_results.append(no_results_html);
863
+ };
864
+
865
+ Chosen.prototype.no_results_clear = function() {
866
+ return this.search_results.find(".no-results").remove();
867
+ };
868
+
869
+ Chosen.prototype.keydown_arrow = function() {
870
+ var first_active, next_sib;
871
+ if (!this.result_highlight) {
872
+ first_active = this.search_results.find("li.active-result").first();
873
+ if (first_active) this.result_do_highlight($(first_active));
874
+ } else if (this.results_showing) {
875
+ next_sib = this.result_highlight.nextAll("li.active-result").first();
876
+ if (next_sib) this.result_do_highlight(next_sib);
877
+ }
878
+ if (!this.results_showing) return this.results_show();
879
+ };
880
+
881
+ Chosen.prototype.keyup_arrow = function() {
882
+ var prev_sibs;
883
+ if (!this.results_showing && !this.is_multiple) {
884
+ return this.results_show();
885
+ } else if (this.result_highlight) {
886
+ prev_sibs = this.result_highlight.prevAll("li.active-result");
887
+ if (prev_sibs.length) {
888
+ return this.result_do_highlight(prev_sibs.first());
889
+ } else {
890
+ if (this.choices > 0) this.results_hide();
891
+ return this.result_clear_highlight();
892
+ }
893
+ }
894
+ };
895
+
896
+ Chosen.prototype.keydown_backstroke = function() {
897
+ if (this.pending_backstroke) {
898
+ this.choice_destroy(this.pending_backstroke.find("a").first());
899
+ return this.clear_backstroke();
900
+ } else {
901
+ this.pending_backstroke = this.search_container.siblings("li.search-choice").last();
902
+ return this.pending_backstroke.addClass("search-choice-focus");
903
+ }
904
+ };
905
+
906
+ Chosen.prototype.clear_backstroke = function() {
907
+ if (this.pending_backstroke) {
908
+ this.pending_backstroke.removeClass("search-choice-focus");
909
+ }
910
+ return this.pending_backstroke = null;
911
+ };
912
+
913
+ Chosen.prototype.keydown_checker = function(evt) {
914
+ var stroke, _ref;
915
+ stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
916
+ this.search_field_scale();
917
+ if (stroke !== 8 && this.pending_backstroke) this.clear_backstroke();
918
+ switch (stroke) {
919
+ case 8:
920
+ this.backstroke_length = this.search_field.val().length;
921
+ break;
922
+ case 9:
923
+ if (this.results_showing && !this.is_multiple) this.result_select(evt);
924
+ this.mouse_on_container = false;
925
+ break;
926
+ case 13:
927
+ evt.preventDefault();
928
+ break;
929
+ case 38:
930
+ evt.preventDefault();
931
+ this.keyup_arrow();
932
+ break;
933
+ case 40:
934
+ this.keydown_arrow();
935
+ break;
936
+ }
937
+ };
938
+
939
+ Chosen.prototype.search_field_scale = function() {
940
+ var dd_top, div, h, style, style_block, styles, w, _i, _len;
941
+ if (this.is_multiple) {
942
+ h = 0;
943
+ w = 0;
944
+ style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
945
+ styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
946
+ for (_i = 0, _len = styles.length; _i < _len; _i++) {
947
+ style = styles[_i];
948
+ style_block += style + ":" + this.search_field.css(style) + ";";
949
+ }
950
+ div = $('<div />', {
951
+ 'style': style_block
952
+ });
953
+ div.text(this.search_field.val());
954
+ $('body').append(div);
955
+ w = div.width() + 25;
956
+ div.remove();
957
+ if (w > this.f_width - 10) w = this.f_width - 10;
958
+ this.search_field.css({
959
+ 'width': w + 'px'
960
+ });
961
+ dd_top = this.container.height();
962
+ return this.dropdown.css({
963
+ "top": dd_top + "px"
964
+ });
965
+ }
966
+ };
967
+
968
+ Chosen.prototype.generate_random_id = function() {
969
+ var string;
970
+ string = "sel" + this.generate_random_char() + this.generate_random_char() + this.generate_random_char();
971
+ while ($("#" + string).length > 0) {
972
+ string += this.generate_random_char();
973
+ }
974
+ return string;
975
+ };
976
+
977
+ return Chosen;
978
+
979
+ })(AbstractChosen);
980
+
981
+ get_side_border_padding = function(elmt) {
982
+ var side_border_padding;
983
+ return side_border_padding = elmt.outerWidth() - elmt.width();
984
+ };
985
+
986
+ root.get_side_border_padding = get_side_border_padding;
987
+
988
+ }).call(this);
js/jquery-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,2245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! jQuery Timepicker Addon - v1.5.5 - 2015-05-24
2
+ * http://trentrichardson.com/examples/timepicker
3
+ * Copyright (c) 2015 Trent Richardson; Licensed MIT */
4
+ (function (factory) {
5
+ if (typeof define === 'function' && define.amd) {
6
+ define(['jquery', 'jquery.ui'], factory);
7
+ } else {
8
+ factory(jQuery);
9
+ }
10
+ }(function ($) {
11
+
12
+ /*
13
+ * Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded"
14
+ */
15
+ $.ui.timepicker = $.ui.timepicker || {};
16
+ if ($.ui.timepicker.version) {
17
+ return;
18
+ }
19
+
20
+ /*
21
+ * Extend jQueryUI, get it started with our version number
22
+ */
23
+ $.extend($.ui, {
24
+ timepicker: {
25
+ version: "1.5.5"
26
+ }
27
+ });
28
+
29
+ /*
30
+ * Timepicker manager.
31
+ * Use the singleton instance of this class, $.timepicker, to interact with the time picker.
32
+ * Settings for (groups of) time pickers are maintained in an instance object,
33
+ * allowing multiple different settings on the same page.
34
+ */
35
+ var Timepicker = function () {
36
+ this.regional = []; // Available regional settings, indexed by language code
37
+ this.regional[''] = { // Default regional settings
38
+ currentText: 'Now',
39
+ closeText: 'Done',
40
+ amNames: ['AM', 'A'],
41
+ pmNames: ['PM', 'P'],
42
+ timeFormat: 'HH:mm',
43
+ timeSuffix: '',
44
+ timeOnlyTitle: 'Choose Time',
45
+ timeText: 'Time',
46
+ hourText: 'Hour',
47
+ minuteText: 'Minute',
48
+ secondText: 'Second',
49
+ millisecText: 'Millisecond',
50
+ microsecText: 'Microsecond',
51
+ timezoneText: 'Time Zone',
52
+ isRTL: false
53
+ };
54
+ this._defaults = { // Global defaults for all the datetime picker instances
55
+ showButtonPanel: true,
56
+ timeOnly: false,
57
+ timeOnlyShowDate: false,
58
+ showHour: null,
59
+ showMinute: null,
60
+ showSecond: null,
61
+ showMillisec: null,
62
+ showMicrosec: null,
63
+ showTimezone: null,
64
+ showTime: true,
65
+ stepHour: 1,
66
+ stepMinute: 1,
67
+ stepSecond: 1,
68
+ stepMillisec: 1,
69
+ stepMicrosec: 1,
70
+ hour: 0,
71
+ minute: 0,
72
+ second: 0,
73
+ millisec: 0,
74
+ microsec: 0,
75
+ timezone: null,
76
+ hourMin: 0,
77
+ minuteMin: 0,
78
+ secondMin: 0,
79
+ millisecMin: 0,
80
+ microsecMin: 0,
81
+ hourMax: 23,
82
+ minuteMax: 59,
83
+ secondMax: 59,
84
+ millisecMax: 999,
85
+ microsecMax: 999,
86
+ minDateTime: null,
87
+ maxDateTime: null,
88
+ maxTime: null,
89
+ minTime: null,
90
+ onSelect: null,
91
+ hourGrid: 0,
92
+ minuteGrid: 0,
93
+ secondGrid: 0,
94
+ millisecGrid: 0,
95
+ microsecGrid: 0,
96
+ alwaysSetTime: true,
97
+ separator: ' ',
98
+ altFieldTimeOnly: true,
99
+ altTimeFormat: null,
100
+ altSeparator: null,
101
+ altTimeSuffix: null,
102
+ altRedirectFocus: true,
103
+ pickerTimeFormat: null,
104
+ pickerTimeSuffix: null,
105
+ showTimepicker: true,
106
+ timezoneList: null,
107
+ addSliderAccess: false,
108
+ sliderAccessArgs: null,
109
+ controlType: 'slider',
110
+ oneLine: false,
111
+ defaultValue: null,
112
+ parse: 'strict',
113
+ afterInject: null
114
+ };
115
+ $.extend(this._defaults, this.regional['']);
116
+ };
117
+
118
+ $.extend(Timepicker.prototype, {
119
+ $input: null,
120
+ $altInput: null,
121
+ $timeObj: null,
122
+ inst: null,
123
+ hour_slider: null,
124
+ minute_slider: null,
125
+ second_slider: null,
126
+ millisec_slider: null,
127
+ microsec_slider: null,
128
+ timezone_select: null,
129
+ maxTime: null,
130
+ minTime: null,
131
+ hour: 0,
132
+ minute: 0,
133
+ second: 0,
134
+ millisec: 0,
135
+ microsec: 0,
136
+ timezone: null,
137
+ hourMinOriginal: null,
138
+ minuteMinOriginal: null,
139
+ secondMinOriginal: null,
140
+ millisecMinOriginal: null,
141
+ microsecMinOriginal: null,
142
+ hourMaxOriginal: null,
143
+ minuteMaxOriginal: null,
144
+ secondMaxOriginal: null,
145
+ millisecMaxOriginal: null,
146
+ microsecMaxOriginal: null,
147
+ ampm: '',
148
+ formattedDate: '',
149
+ formattedTime: '',
150
+ formattedDateTime: '',
151
+ timezoneList: null,
152
+ units: ['hour', 'minute', 'second', 'millisec', 'microsec'],
153
+ support: {},
154
+ control: null,
155
+
156
+ /*
157
+ * Override the default settings for all instances of the time picker.
158
+ * @param {Object} settings object - the new settings to use as defaults (anonymous object)
159
+ * @return {Object} the manager object
160
+ */
161
+ setDefaults: function (settings) {
162
+ extendRemove(this._defaults, settings || {});
163
+ return this;
164
+ },
165
+
166
+ /*
167
+ * Create a new Timepicker instance
168
+ */
169
+ _newInst: function ($input, opts) {
170
+ var tp_inst = new Timepicker(),
171
+ inlineSettings = {},
172
+ fns = {},
173
+ overrides, i;
174
+
175
+ for (var attrName in this._defaults) {
176
+ if (this._defaults.hasOwnProperty(attrName)) {
177
+ var attrValue = $input.attr('time:' + attrName);
178
+ if (attrValue) {
179
+ try {
180
+ inlineSettings[attrName] = eval(attrValue);
181
+ } catch (err) {
182
+ inlineSettings[attrName] = attrValue;
183
+ }
184
+ }
185
+ }
186
+ }
187
+
188
+ overrides = {
189
+ beforeShow: function (input, dp_inst) {
190
+ if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) {
191
+ return tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst);
192
+ }
193
+ },
194
+ onChangeMonthYear: function (year, month, dp_inst) {
195
+ // Update the time as well : this prevents the time from disappearing from the $input field.
196
+ // tp_inst._updateDateTime(dp_inst);
197
+ if ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) {
198
+ tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
199
+ }
200
+ },
201
+ onClose: function (dateText, dp_inst) {
202
+ if (tp_inst.timeDefined === true && $input.val() !== '') {
203
+ tp_inst._updateDateTime(dp_inst);
204
+ }
205
+ if ($.isFunction(tp_inst._defaults.evnts.onClose)) {
206
+ tp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst);
207
+ }
208
+ }
209
+ };
210
+ for (i in overrides) {
211
+ if (overrides.hasOwnProperty(i)) {
212
+ fns[i] = opts[i] || this._defaults[i] || null;
213
+ }
214
+ }
215
+
216
+ tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, opts, overrides, {
217
+ evnts: fns,
218
+ timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
219
+ });
220
+ tp_inst.amNames = $.map(tp_inst._defaults.amNames, function (val) {
221
+ return val.toUpperCase();
222
+ });
223
+ tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function (val) {
224
+ return val.toUpperCase();
225
+ });
226
+
227
+ // detect which units are supported
228
+ tp_inst.support = detectSupport(
229
+ tp_inst._defaults.timeFormat +
230
+ (tp_inst._defaults.pickerTimeFormat ? tp_inst._defaults.pickerTimeFormat : '') +
231
+ (tp_inst._defaults.altTimeFormat ? tp_inst._defaults.altTimeFormat : ''));
232
+
233
+ // controlType is string - key to our this._controls
234
+ if (typeof(tp_inst._defaults.controlType) === 'string') {
235
+ if (tp_inst._defaults.controlType === 'slider' && typeof($.ui.slider) === 'undefined') {
236
+ tp_inst._defaults.controlType = 'select';
237
+ }
238
+ tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];
239
+ }
240
+ // controlType is an object and must implement create, options, value methods
241
+ else {
242
+ tp_inst.control = tp_inst._defaults.controlType;
243
+ }
244
+
245
+ // prep the timezone options
246
+ var timezoneList = [-720, -660, -600, -570, -540, -480, -420, -360, -300, -270, -240, -210, -180, -120, -60,
247
+ 0, 60, 120, 180, 210, 240, 270, 300, 330, 345, 360, 390, 420, 480, 525, 540, 570, 600, 630, 660, 690, 720, 765, 780, 840];
248
+ if (tp_inst._defaults.timezoneList !== null) {
249
+ timezoneList = tp_inst._defaults.timezoneList;
250
+ }
251
+ var tzl = timezoneList.length, tzi = 0, tzv = null;
252
+ if (tzl > 0 && typeof timezoneList[0] !== 'object') {
253
+ for (; tzi < tzl; tzi++) {
254
+ tzv = timezoneList[tzi];
255
+ timezoneList[tzi] = { value: tzv, label: $.timepicker.timezoneOffsetString(tzv, tp_inst.support.iso8601) };
256
+ }
257
+ }
258
+ tp_inst._defaults.timezoneList = timezoneList;
259
+
260
+ // set the default units
261
+ tp_inst.timezone = tp_inst._defaults.timezone !== null ? $.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone) :
262
+ ((new Date()).getTimezoneOffset() * -1);
263
+ tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin ? tp_inst._defaults.hourMin :
264
+ tp_inst._defaults.hour > tp_inst._defaults.hourMax ? tp_inst._defaults.hourMax : tp_inst._defaults.hour;
265
+ tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin ? tp_inst._defaults.minuteMin :
266
+ tp_inst._defaults.minute > tp_inst._defaults.minuteMax ? tp_inst._defaults.minuteMax : tp_inst._defaults.minute;
267
+ tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin ? tp_inst._defaults.secondMin :
268
+ tp_inst._defaults.second > tp_inst._defaults.secondMax ? tp_inst._defaults.secondMax : tp_inst._defaults.second;
269
+ tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin ? tp_inst._defaults.millisecMin :
270
+ tp_inst._defaults.millisec > tp_inst._defaults.millisecMax ? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec;
271
+ tp_inst.microsec = tp_inst._defaults.microsec < tp_inst._defaults.microsecMin ? tp_inst._defaults.microsecMin :
272
+ tp_inst._defaults.microsec > tp_inst._defaults.microsecMax ? tp_inst._defaults.microsecMax : tp_inst._defaults.microsec;
273
+ tp_inst.ampm = '';
274
+ tp_inst.$input = $input;
275
+
276
+ if (tp_inst._defaults.altField) {
277
+ tp_inst.$altInput = $(tp_inst._defaults.altField);
278
+ if (tp_inst._defaults.altRedirectFocus === true) {
279
+ tp_inst.$altInput.css({
280
+ cursor: 'pointer'
281
+ }).focus(function () {
282
+ $input.trigger("focus");
283
+ });
284
+ }
285
+ }
286
+
287
+ if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) {
288
+ tp_inst._defaults.minDate = new Date();
289
+ }
290
+ if (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) {
291
+ tp_inst._defaults.maxDate = new Date();
292
+ }
293
+
294
+ // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
295
+ if (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) {
296
+ tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
297
+ }
298
+ if (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) {
299
+ tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
300
+ }
301
+ if (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) {
302
+ tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
303
+ }
304
+ if (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) {
305
+ tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
306
+ }
307
+ tp_inst.$input.bind('focus', function () {
308
+ tp_inst._onFocus();
309
+ });
310
+
311
+ return tp_inst;
312
+ },
313
+
314
+ /*
315
+ * add our sliders to the calendar
316
+ */
317
+ _addTimePicker: function (dp_inst) {
318
+ var currDT = $.trim((this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val());
319
+
320
+ this.timeDefined = this._parseTime(currDT);
321
+ this._limitMinMaxDateTime(dp_inst, false);
322
+ this._injectTimePicker();
323
+ this._afterInject();
324
+ },
325
+
326
+ /*
327
+ * parse the time string from input value or _setTime
328
+ */
329
+ _parseTime: function (timeString, withDate) {
330
+ if (!this.inst) {
331
+ this.inst = $.datepicker._getInst(this.$input[0]);
332
+ }
333
+
334
+ if (withDate || !this._defaults.timeOnly) {
335
+ var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
336
+ try {
337
+ var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults);
338
+ if (!parseRes.timeObj) {
339
+ return false;
340
+ }
341
+ $.extend(this, parseRes.timeObj);
342
+ } catch (err) {
343
+ $.timepicker.log("Error parsing the date/time string: " + err +
344
+ "\ndate/time string = " + timeString +
345
+ "\ntimeFormat = " + this._defaults.timeFormat +
346
+ "\ndateFormat = " + dp_dateFormat);
347
+ return false;
348
+ }
349
+ return true;
350
+ } else {
351
+ var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults);
352
+ if (!timeObj) {
353
+ return false;
354
+ }
355
+ $.extend(this, timeObj);
356
+ return true;
357
+ }
358
+ },
359
+
360
+ /*
361
+ * Handle callback option after injecting timepicker
362
+ */
363
+ _afterInject: function() {
364
+ var o = this.inst.settings;
365
+ if ($.isFunction(o.afterInject)) {
366
+ o.afterInject.call(this);
367
+ }
368
+ },
369
+
370
+ /*
371
+ * generate and inject html for timepicker into ui datepicker
372
+ */
373
+ _injectTimePicker: function () {
374
+ var $dp = this.inst.dpDiv,
375
+ o = this.inst.settings,
376
+ tp_inst = this,
377
+ litem = '',
378
+ uitem = '',
379
+ show = null,
380
+ max = {},
381
+ gridSize = {},
382
+ size = null,
383
+ i = 0,
384
+ l = 0;
385
+
386
+ // Prevent displaying twice
387
+ if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
388
+ var noDisplay = ' ui_tpicker_unit_hide',
389
+ html = '<div class="ui-timepicker-div' + (o.isRTL ? ' ui-timepicker-rtl' : '') + (o.oneLine && o.controlType === 'select' ? ' ui-timepicker-oneLine' : '') + '"><dl>' + '<dt class="ui_tpicker_time_label' + ((o.showTime) ? '' : noDisplay) + '">' + o.timeText + '</dt>' +
390
+ '<dd class="ui_tpicker_time '+ ((o.showTime) ? '' : noDisplay) + '"></dd>';
391
+
392
+ // Create the markup
393
+ for (i = 0, l = this.units.length; i < l; i++) {
394
+ litem = this.units[i];
395
+ uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1);
396
+ show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem];
397
+
398
+ // Added by Peter Medeiros:
399
+ // - Figure out what the hour/minute/second max should be based on the step values.
400
+ // - Example: if stepMinute is 15, then minMax is 45.
401
+ max[litem] = parseInt((o[litem + 'Max'] - ((o[litem + 'Max'] - o[litem + 'Min']) % o['step' + uitem])), 10);
402
+ gridSize[litem] = 0;
403
+
404
+ html += '<dt class="ui_tpicker_' + litem + '_label' + (show ? '' : noDisplay) + '">' + o[litem + 'Text'] + '</dt>' +
405
+ '<dd class="ui_tpicker_' + litem + (show ? '' : noDisplay) + '"><div class="ui_tpicker_' + litem + '_slider' + (show ? '' : noDisplay) + '"></div>';
406
+
407
+ if (show && o[litem + 'Grid'] > 0) {
408
+ html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
409
+
410
+ if (litem === 'hour') {
411
+ for (var h = o[litem + 'Min']; h <= max[litem]; h += parseInt(o[litem + 'Grid'], 10)) {
412
+ gridSize[litem]++;
413
+ var tmph = $.datepicker.formatTime(this.support.ampm ? 'hht' : 'HH', {hour: h}, o);
414
+ html += '<td data-for="' + litem + '">' + tmph + '</td>';
415
+ }
416
+ }
417
+ else {
418
+ for (var m = o[litem + 'Min']; m <= max[litem]; m += parseInt(o[litem + 'Grid'], 10)) {
419
+ gridSize[litem]++;
420
+ html += '<td data-for="' + litem + '">' + ((m < 10) ? '0' : '') + m + '</td>';
421
+ }
422
+ }
423
+
424
+ html += '</tr></table></div>';
425
+ }
426
+ html += '</dd>';
427
+ }
428
+
429
+ // Timezone
430
+ var showTz = o.showTimezone !== null ? o.showTimezone : this.support.timezone;
431
+ html += '<dt class="ui_tpicker_timezone_label' + (showTz ? '' : noDisplay) + '">' + o.timezoneText + '</dt>';
432
+ html += '<dd class="ui_tpicker_timezone' + (showTz ? '' : noDisplay) + '"></dd>';
433
+
434
+ // Create the elements from string
435
+ html += '</dl></div>';
436
+ var $tp = $(html);
437
+
438
+ // if we only want time picker...
439
+ if (o.timeOnly === true) {
440
+ $tp.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all">' + '<div class="ui-datepicker-title">' + o.timeOnlyTitle + '</div>' + '</div>');
441
+ $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
442
+ }
443
+
444
+ // add sliders, adjust grids, add events
445
+ for (i = 0, l = tp_inst.units.length; i < l; i++) {
446
+ litem = tp_inst.units[i];
447
+ uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1);
448
+ show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem];
449
+
450
+ // add the slider
451
+ tp_inst[litem + '_slider'] = tp_inst.control.create(tp_inst, $tp.find('.ui_tpicker_' + litem + '_slider'), litem, tp_inst[litem], o[litem + 'Min'], max[litem], o['step' + uitem]);
452
+
453
+ // adjust the grid and add click event
454
+ if (show && o[litem + 'Grid'] > 0) {
455
+ size = 100 * gridSize[litem] * o[litem + 'Grid'] / (max[litem] - o[litem + 'Min']);
456
+ $tp.find('.ui_tpicker_' + litem + ' table').css({
457
+ width: size + "%",
458
+ marginLeft: o.isRTL ? '0' : ((size / (-2 * gridSize[litem])) + "%"),
459
+ marginRight: o.isRTL ? ((size / (-2 * gridSize[litem])) + "%") : '0',
460
+ borderCollapse: 'collapse'
461
+ }).find("td").click(function (e) {
462
+ var $t = $(this),
463
+ h = $t.html(),
464
+ n = parseInt(h.replace(/[^0-9]/g), 10),
465
+ ap = h.replace(/[^apm]/ig),
466
+ f = $t.data('for'); // loses scope, so we use data-for
467
+
468
+ if (f === 'hour') {
469
+ if (ap.indexOf('p') !== -1 && n < 12) {
470
+ n += 12;
471
+ }
472
+ else {
473
+ if (ap.indexOf('a') !== -1 && n === 12) {
474
+ n = 0;
475
+ }
476
+ }
477
+ }
478
+
479
+ tp_inst.control.value(tp_inst, tp_inst[f + '_slider'], litem, n);
480
+
481
+ tp_inst._onTimeChange();
482
+ tp_inst._onSelectHandler();
483
+ }).css({
484
+ cursor: 'pointer',
485
+ width: (100 / gridSize[litem]) + '%',
486
+ textAlign: 'center',
487
+ overflow: 'hidden'
488
+ });
489
+ } // end if grid > 0
490
+ } // end for loop
491
+
492
+ // Add timezone options
493
+ this.timezone_select = $tp.find('.ui_tpicker_timezone').append('<select></select>').find("select");
494
+ $.fn.append.apply(this.timezone_select,
495
+ $.map(o.timezoneList, function (val, idx) {
496
+ return $("<option />").val(typeof val === "object" ? val.value : val).text(typeof val === "object" ? val.label : val);
497
+ }));
498
+ if (typeof(this.timezone) !== "undefined" && this.timezone !== null && this.timezone !== "") {
499
+ var local_timezone = (new Date(this.inst.selectedYear, this.inst.selectedMonth, this.inst.selectedDay, 12)).getTimezoneOffset() * -1;
500
+ if (local_timezone === this.timezone) {
501
+ selectLocalTimezone(tp_inst);
502
+ } else {
503
+ this.timezone_select.val(this.timezone);
504
+ }
505
+ } else {
506
+ if (typeof(this.hour) !== "undefined" && this.hour !== null && this.hour !== "") {
507
+ this.timezone_select.val(o.timezone);
508
+ } else {
509
+ selectLocalTimezone(tp_inst);
510
+ }
511
+ }
512
+ this.timezone_select.change(function () {
513
+ tp_inst._onTimeChange();
514
+ tp_inst._onSelectHandler();
515
+ tp_inst._afterInject();
516
+ });
517
+ // End timezone options
518
+
519
+ // inject timepicker into datepicker
520
+ var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
521
+ if ($buttonPanel.length) {
522
+ $buttonPanel.before($tp);
523
+ } else {
524
+ $dp.append($tp);
525
+ }
526
+
527
+ this.$timeObj = $tp.find('.ui_tpicker_time');
528
+
529
+ if (this.inst !== null) {
530
+ var timeDefined = this.timeDefined;
531
+ this._onTimeChange();
532
+ this.timeDefined = timeDefined;
533
+ }
534
+
535
+ // slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
536
+ if (this._defaults.addSliderAccess) {
537
+ var sliderAccessArgs = this._defaults.sliderAccessArgs,
538
+ rtl = this._defaults.isRTL;
539
+ sliderAccessArgs.isRTL = rtl;
540
+
541
+ setTimeout(function () { // fix for inline mode
542
+ if ($tp.find('.ui-slider-access').length === 0) {
543
+ $tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
544
+
545
+ // fix any grids since sliders are shorter
546
+ var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
547
+ if (sliderAccessWidth) {
548
+ $tp.find('table:visible').each(function () {
549
+ var $g = $(this),
550
+ oldWidth = $g.outerWidth(),
551
+ oldMarginLeft = $g.css(rtl ? 'marginRight' : 'marginLeft').toString().replace('%', ''),
552
+ newWidth = oldWidth - sliderAccessWidth,
553
+ newMarginLeft = ((oldMarginLeft * newWidth) / oldWidth) + '%',
554
+ css = { width: newWidth, marginRight: 0, marginLeft: 0 };
555
+ css[rtl ? 'marginRight' : 'marginLeft'] = newMarginLeft;
556
+ $g.css(css);
557
+ });
558
+ }
559
+ }
560
+ }, 10);
561
+ }
562
+ // end slideAccess integration
563
+
564
+ tp_inst._limitMinMaxDateTime(this.inst, true);
565
+ }
566
+ },
567
+
568
+ /*
569
+ * This function tries to limit the ability to go outside the
570
+ * min/max date range
571
+ */
572
+ _limitMinMaxDateTime: function (dp_inst, adjustSliders) {
573
+ var o = this._defaults,
574
+ dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);
575
+
576
+ if (!this._defaults.showTimepicker) {
577
+ return;
578
+ } // No time so nothing to check here
579
+
580
+ if ($.datepicker._get(dp_inst, 'minDateTime') !== null && $.datepicker._get(dp_inst, 'minDateTime') !== undefined && dp_date) {
581
+ var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
582
+ minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
583
+
584
+ if (this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null || this.microsecMinOriginal === null) {
585
+ this.hourMinOriginal = o.hourMin;
586
+ this.minuteMinOriginal = o.minuteMin;
587
+ this.secondMinOriginal = o.secondMin;
588
+ this.millisecMinOriginal = o.millisecMin;
589
+ this.microsecMinOriginal = o.microsecMin;
590
+ }
591
+
592
+ if (dp_inst.settings.timeOnly || minDateTimeDate.getTime() === dp_date.getTime()) {
593
+ this._defaults.hourMin = minDateTime.getHours();
594
+ if (this.hour <= this._defaults.hourMin) {
595
+ this.hour = this._defaults.hourMin;
596
+ this._defaults.minuteMin = minDateTime.getMinutes();
597
+ if (this.minute <= this._defaults.minuteMin) {
598
+ this.minute = this._defaults.minuteMin;
599
+ this._defaults.secondMin = minDateTime.getSeconds();
600
+ if (this.second <= this._defaults.secondMin) {
601
+ this.second = this._defaults.secondMin;
602
+ this._defaults.millisecMin = minDateTime.getMilliseconds();
603
+ if (this.millisec <= this._defaults.millisecMin) {
604
+ this.millisec = this._defaults.millisecMin;
605
+ this._defaults.microsecMin = minDateTime.getMicroseconds();
606
+ } else {
607
+ if (this.microsec < this._defaults.microsecMin) {
608
+ this.microsec = this._defaults.microsecMin;
609
+ }
610
+ this._defaults.microsecMin = this.microsecMinOriginal;
611
+ }
612
+ } else {
613
+ this._defaults.millisecMin = this.millisecMinOriginal;
614
+ this._defaults.microsecMin = this.microsecMinOriginal;
615
+ }
616
+ } else {
617
+ this._defaults.secondMin = this.secondMinOriginal;
618
+ this._defaults.millisecMin = this.millisecMinOriginal;
619
+ this._defaults.microsecMin = this.microsecMinOriginal;
620
+ }
621
+ } else {
622
+ this._defaults.minuteMin = this.minuteMinOriginal;
623
+ this._defaults.secondMin = this.secondMinOriginal;
624
+ this._defaults.millisecMin = this.millisecMinOriginal;
625
+ this._defaults.microsecMin = this.microsecMinOriginal;
626
+ }
627
+ } else {
628
+ this._defaults.hourMin = this.hourMinOriginal;
629
+ this._defaults.minuteMin = this.minuteMinOriginal;
630
+ this._defaults.secondMin = this.secondMinOriginal;
631
+ this._defaults.millisecMin = this.millisecMinOriginal;
632
+ this._defaults.microsecMin = this.microsecMinOriginal;
633
+ }
634
+ }
635
+
636
+ if ($.datepicker._get(dp_inst, 'maxDateTime') !== null && $.datepicker._get(dp_inst, 'maxDateTime') !== undefined && dp_date) {
637
+ var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
638
+ maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
639
+
640
+ if (this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null || this.millisecMaxOriginal === null) {
641
+ this.hourMaxOriginal = o.hourMax;
642
+ this.minuteMaxOriginal = o.minuteMax;
643
+ this.secondMaxOriginal = o.secondMax;
644
+ this.millisecMaxOriginal = o.millisecMax;
645
+ this.microsecMaxOriginal = o.microsecMax;
646
+ }
647
+
648
+ if (dp_inst.settings.timeOnly || maxDateTimeDate.getTime() === dp_date.getTime()) {
649
+ this._defaults.hourMax = maxDateTime.getHours();
650
+ if (this.hour >= this._defaults.hourMax) {
651
+ this.hour = this._defaults.hourMax;
652
+ this._defaults.minuteMax = maxDateTime.getMinutes();
653
+ if (this.minute >= this._defaults.minuteMax) {
654
+ this.minute = this._defaults.minuteMax;
655
+ this._defaults.secondMax = maxDateTime.getSeconds();
656
+ if (this.second >= this._defaults.secondMax) {
657
+ this.second = this._defaults.secondMax;
658
+ this._defaults.millisecMax = maxDateTime.getMilliseconds();
659
+ if (this.millisec >= this._defaults.millisecMax) {
660
+ this.millisec = this._defaults.millisecMax;
661
+ this._defaults.microsecMax = maxDateTime.getMicroseconds();
662
+ } else {
663
+ if (this.microsec > this._defaults.microsecMax) {
664
+ this.microsec = this._defaults.microsecMax;
665
+ }
666
+ this._defaults.microsecMax = this.microsecMaxOriginal;
667
+ }
668
+ } else {
669
+ this._defaults.millisecMax = this.millisecMaxOriginal;
670
+ this._defaults.microsecMax = this.microsecMaxOriginal;
671
+ }
672
+ } else {
673
+ this._defaults.secondMax = this.secondMaxOriginal;
674
+ this._defaults.millisecMax = this.millisecMaxOriginal;
675
+ this._defaults.microsecMax = this.microsecMaxOriginal;
676
+ }
677
+ } else {
678
+ this._defaults.minuteMax = this.minuteMaxOriginal;
679
+ this._defaults.secondMax = this.secondMaxOriginal;
680
+ this._defaults.millisecMax = this.millisecMaxOriginal;
681
+ this._defaults.microsecMax = this.microsecMaxOriginal;
682
+ }
683
+ } else {
684
+ this._defaults.hourMax = this.hourMaxOriginal;
685
+ this._defaults.minuteMax = this.minuteMaxOriginal;
686
+ this._defaults.secondMax = this.secondMaxOriginal;
687
+ this._defaults.millisecMax = this.millisecMaxOriginal;
688
+ this._defaults.microsecMax = this.microsecMaxOriginal;
689
+ }
690
+ }
691
+
692
+ if (dp_inst.settings.minTime!==null) {
693
+ var tempMinTime=new Date("01/01/1970 " + dp_inst.settings.minTime);
694
+ if (this.hour<tempMinTime.getHours()) {
695
+ this.hour=this._defaults.hourMin=tempMinTime.getHours();
696
+ this.minute=this._defaults.minuteMin=tempMinTime.getMinutes();
697
+ } else if (this.hour===tempMinTime.getHours() && this.minute<tempMinTime.getMinutes()) {
698
+ this.minute=this._defaults.minuteMin=tempMinTime.getMinutes();
699
+ } else {
700
+ if (this._defaults.hourMin<tempMinTime.getHours()) {
701
+ this._defaults.hourMin=tempMinTime.getHours();
702
+ this._defaults.minuteMin=tempMinTime.getMinutes();
703
+ } else if (this._defaults.hourMin===tempMinTime.getHours()===this.hour && this._defaults.minuteMin<tempMinTime.getMinutes()) {
704
+ this._defaults.minuteMin=tempMinTime.getMinutes();
705
+ } else {
706
+ this._defaults.minuteMin=0;
707
+ }
708
+ }
709
+ }
710
+
711
+ if (dp_inst.settings.maxTime!==null) {
712
+ var tempMaxTime=new Date("01/01/1970 " + dp_inst.settings.maxTime);
713
+ if (this.hour>tempMaxTime.getHours()) {
714
+ this.hour=this._defaults.hourMax=tempMaxTime.getHours();
715
+ this.minute=this._defaults.minuteMax=tempMaxTime.getMinutes();
716
+ } else if (this.hour===tempMaxTime.getHours() && this.minute>tempMaxTime.getMinutes()) {
717
+ this.minute=this._defaults.minuteMax=tempMaxTime.getMinutes();
718
+ } else {
719
+ if (this._defaults.hourMax>tempMaxTime.getHours()) {
720
+ this._defaults.hourMax=tempMaxTime.getHours();
721
+ this._defaults.minuteMax=tempMaxTime.getMinutes();
722
+ } else if (this._defaults.hourMax===tempMaxTime.getHours()===this.hour && this._defaults.minuteMax>tempMaxTime.getMinutes()) {
723
+ this._defaults.minuteMax=tempMaxTime.getMinutes();
724
+ } else {
725
+ this._defaults.minuteMax=59;
726
+ }
727
+ }
728
+ }
729
+
730
+ if (adjustSliders !== undefined && adjustSliders === true) {
731
+ var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)), 10),
732
+ minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)), 10),
733
+ secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)), 10),
734
+ millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)), 10),
735
+ microsecMax = parseInt((this._defaults.microsecMax - ((this._defaults.microsecMax - this._defaults.microsecMin) % this._defaults.stepMicrosec)), 10);
736
+
737
+ if (this.hour_slider) {
738
+ this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax, step: this._defaults.stepHour });
739
+ this.control.value(this, this.hour_slider, 'hour', this.hour - (this.hour % this._defaults.stepHour));
740
+ }
741
+ if (this.minute_slider) {
742
+ this.control.options(this, this.minute_slider, 'minute', { min: this._defaults.minuteMin, max: minMax, step: this._defaults.stepMinute });
743
+ this.control.value(this, this.minute_slider, 'minute', this.minute - (this.minute % this._defaults.stepMinute));
744
+ }
745
+ if (this.second_slider) {
746
+ this.control.options(this, this.second_slider, 'second', { min: this._defaults.secondMin, max: secMax, step: this._defaults.stepSecond });
747
+ this.control.value(this, this.second_slider, 'second', this.second - (this.second % this._defaults.stepSecond));
748
+ }
749
+ if (this.millisec_slider) {
750
+ this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax, step: this._defaults.stepMillisec });
751
+ this.control.value(this, this.millisec_slider, 'millisec', this.millisec - (this.millisec % this._defaults.stepMillisec));
752
+ }
753
+ if (this.microsec_slider) {
754
+ this.control.options(this, this.microsec_slider, 'microsec', { min: this._defaults.microsecMin, max: microsecMax, step: this._defaults.stepMicrosec });
755
+ this.control.value(this, this.microsec_slider, 'microsec', this.microsec - (this.microsec % this._defaults.stepMicrosec));
756
+ }
757
+ }
758
+
759
+ },
760
+
761
+ /*
762
+ * when a slider moves, set the internal time...
763
+ * on time change is also called when the time is updated in the text field
764
+ */
765
+ _onTimeChange: function () {
766
+ if (!this._defaults.showTimepicker) {
767
+ return;
768
+ }
769
+ var hour = (this.hour_slider) ? this.control.value(this, this.hour_slider, 'hour') : false,
770
+ minute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false,
771
+ second = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false,
772
+ millisec = (this.millisec_slider) ? this.control.value(this, this.millisec_slider, 'millisec') : false,
773
+ microsec = (this.microsec_slider) ? this.control.value(this, this.microsec_slider, 'microsec') : false,
774
+ timezone = (this.timezone_select) ? this.timezone_select.val() : false,
775
+ o = this._defaults,
776
+ pickerTimeFormat = o.pickerTimeFormat || o.timeFormat,
777
+ pickerTimeSuffix = o.pickerTimeSuffix || o.timeSuffix;
778
+
779
+ if (typeof(hour) === 'object') {
780
+ hour = false;
781
+ }
782
+ if (typeof(minute) === 'object') {
783
+ minute = false;
784
+ }
785
+ if (typeof(second) === 'object') {
786
+ second = false;
787
+ }
788
+ if (typeof(millisec) === 'object') {
789
+ millisec = false;
790
+ }
791
+ if (typeof(microsec) === 'object') {
792
+ microsec = false;
793
+ }
794
+ if (typeof(timezone) === 'object') {
795
+ timezone = false;
796
+ }
797
+
798
+ if (hour !== false) {
799
+ hour = parseInt(hour, 10);
800
+ }
801
+ if (minute !== false) {
802
+ minute = parseInt(minute, 10);
803
+ }
804
+ if (second !== false) {
805
+ second = parseInt(second, 10);
806
+ }
807
+ if (millisec !== false) {
808
+ millisec = parseInt(millisec, 10);
809
+ }
810
+ if (microsec !== false) {
811
+ microsec = parseInt(microsec, 10);
812
+ }
813
+ if (timezone !== false) {
814
+ timezone = timezone.toString();
815
+ }
816
+
817
+ var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
818
+
819
+ // If the update was done in the input field, the input field should not be updated.
820
+ // If the update was done using the sliders, update the input field.
821
+ var hasChanged = (
822
+ hour !== parseInt(this.hour,10) || // sliders should all be numeric
823
+ minute !== parseInt(this.minute,10) ||
824
+ second !== parseInt(this.second,10) ||
825
+ millisec !== parseInt(this.millisec,10) ||
826
+ microsec !== parseInt(this.microsec,10) ||
827
+ (this.ampm.length > 0 && (hour < 12) !== ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1)) ||
828
+ (this.timezone !== null && timezone !== this.timezone.toString()) // could be numeric or "EST" format, so use toString()
829
+ );
830
+
831
+ if (hasChanged) {
832
+
833
+ if (hour !== false) {
834
+ this.hour = hour;
835
+ }
836
+ if (minute !== false) {
837
+ this.minute = minute;
838
+ }
839
+ if (second !== false) {
840
+ this.second = second;
841
+ }
842
+ if (millisec !== false) {
843
+ this.millisec = millisec;
844
+ }
845
+ if (microsec !== false) {
846
+ this.microsec = microsec;
847
+ }
848
+ if (timezone !== false) {
849
+ this.timezone = timezone;
850
+ }
851
+
852
+ if (!this.inst) {
853
+ this.inst = $.datepicker._getInst(this.$input[0]);
854
+ }
855
+
856
+ this._limitMinMaxDateTime(this.inst, true);
857
+ }
858
+ if (this.support.ampm) {
859
+ this.ampm = ampm;
860
+ }
861
+
862
+ // Updates the time within the timepicker
863
+ this.formattedTime = $.datepicker.formatTime(o.timeFormat, this, o);
864
+ if (this.$timeObj) {
865
+ if (pickerTimeFormat === o.timeFormat) {
866
+ this.$timeObj.text(this.formattedTime + pickerTimeSuffix);
867
+ }
868
+ else {
869
+ this.$timeObj.text($.datepicker.formatTime(pickerTimeFormat, this, o) + pickerTimeSuffix);
870
+ }
871
+ }
872
+
873
+ this.timeDefined = true;
874
+ if (hasChanged) {
875
+ this._updateDateTime();
876
+ //this.$input.focus(); // may automatically open the picker on setDate
877
+ }
878
+ },
879
+
880
+ /*
881
+ * call custom onSelect.
882
+ * bind to sliders slidestop, and grid click.
883
+ */
884
+ _onSelectHandler: function () {
885
+ var onSelect = this._defaults.onSelect || this.inst.settings.onSelect;
886
+ var inputEl = this.$input ? this.$input[0] : null;
887
+ if (onSelect && inputEl) {
888
+ onSelect.apply(inputEl, [this.formattedDateTime, this]);
889
+ }
890
+ },
891
+
892
+ /*
893
+ * update our input with the new date time..
894
+ */
895
+ _updateDateTime: function (dp_inst) {
896
+ dp_inst = this.inst || dp_inst;
897
+ var dtTmp = (dp_inst.currentYear > 0?
898
+ new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay) :
899
+ new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
900
+ dt = $.datepicker._daylightSavingAdjust(dtTmp),
901
+ //dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
902
+ //dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay)),
903
+ dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
904
+ formatCfg = $.datepicker._getFormatConfig(dp_inst),
905
+ timeAvailable = dt !== null && this.timeDefined;
906
+ this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
907
+ var formattedDateTime = this.formattedDate;
908
+
909
+ // if a slider was changed but datepicker doesn't have a value yet, set it
910
+ if (dp_inst.lastVal === "") {
911
+ dp_inst.currentYear = dp_inst.selectedYear;
912
+ dp_inst.currentMonth = dp_inst.selectedMonth;
913
+ dp_inst.currentDay = dp_inst.selectedDay;
914
+ }
915
+
916
+ /*
917
+ * remove following lines to force every changes in date picker to change the input value
918
+ * Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker.
919
+ * If the user manually empty the value in the input field, the date picker will never change selected value.
920
+ */
921
+ //if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) {
922
+ // return;
923
+ //}
924
+
925
+ if (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === false) {
926
+ formattedDateTime = this.formattedTime;
927
+ } else if ((this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) || (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === true)) {
928
+ formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
929
+ }
930
+
931
+ this.formattedDateTime = formattedDateTime;
932
+
933
+ if (!this._defaults.showTimepicker) {
934
+ this.$input.val(this.formattedDate);
935
+ } else if (this.$altInput && this._defaults.timeOnly === false && this._defaults.altFieldTimeOnly === true) {
936
+ this.$altInput.val(this.formattedTime);
937
+ this.$input.val(this.formattedDate);
938
+ } else if (this.$altInput) {
939
+ this.$input.val(formattedDateTime);
940
+ var altFormattedDateTime = '',
941
+ altSeparator = this._defaults.altSeparator !== null ? this._defaults.altSeparator : this._defaults.separator,
942
+ altTimeSuffix = this._defaults.altTimeSuffix !== null ? this._defaults.altTimeSuffix : this._defaults.timeSuffix;
943
+
944
+ if (!this._defaults.timeOnly) {
945
+ if (this._defaults.altFormat) {
946
+ altFormattedDateTime = $.datepicker.formatDate(this._defaults.altFormat, (dt === null ? new Date() : dt), formatCfg);
947
+ }
948
+ else {
949
+ altFormattedDateTime = this.formattedDate;
950
+ }
951
+
952
+ if (altFormattedDateTime) {
953
+ altFormattedDateTime += altSeparator;
954
+ }
955
+ }
956
+
957
+ if (this._defaults.altTimeFormat !== null) {
958
+ altFormattedDateTime += $.datepicker.formatTime(this._defaults.altTimeFormat, this, this._defaults) + altTimeSuffix;
959
+ }
960
+ else {
961
+ altFormattedDateTime += this.formattedTime + altTimeSuffix;
962
+ }
963
+ this.$altInput.val(altFormattedDateTime);
964
+ } else {
965
+ this.$input.val(formattedDateTime);
966
+ }
967
+
968
+ this.$input.trigger("change");
969
+ },
970
+
971
+ _onFocus: function () {
972
+ if (!this.$input.val() && this._defaults.defaultValue) {
973
+ this.$input.val(this._defaults.defaultValue);
974
+ var inst = $.datepicker._getInst(this.$input.get(0)),
975
+ tp_inst = $.datepicker._get(inst, 'timepicker');
976
+ if (tp_inst) {
977
+ if (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) {
978
+ try {
979
+ $.datepicker._updateDatepicker(inst);
980
+ } catch (err) {
981
+ $.timepicker.log(err);
982
+ }
983
+ }
984
+ }
985
+ }
986
+ },
987
+
988
+ /*
989
+ * Small abstraction to control types
990
+ * We can add more, just be sure to follow the pattern: create, options, value
991
+ */
992
+ _controls: {
993
+ // slider methods
994
+ slider: {
995
+ create: function (tp_inst, obj, unit, val, min, max, step) {
996
+ var rtl = tp_inst._defaults.isRTL; // if rtl go -60->0 instead of 0->60
997
+ return obj.prop('slide', null).slider({
998
+ orientation: "horizontal",
999
+ value: rtl ? val * -1 : val,
1000
+ min: rtl ? max * -1 : min,
1001
+ max: rtl ? min * -1 : max,
1002
+ step: step,
1003
+ slide: function (event, ui) {
1004
+ tp_inst.control.value(tp_inst, $(this), unit, rtl ? ui.value * -1 : ui.value);
1005
+ tp_inst._onTimeChange();
1006
+ },
1007
+ stop: function (event, ui) {
1008
+ tp_inst._onSelectHandler();
1009
+ }
1010
+ });
1011
+ },
1012
+ options: function (tp_inst, obj, unit, opts, val) {
1013
+ if (tp_inst._defaults.isRTL) {
1014
+ if (typeof(opts) === 'string') {
1015
+ if (opts === 'min' || opts === 'max') {
1016
+ if (val !== undefined) {
1017
+ return obj.slider(opts, val * -1);
1018
+ }
1019
+ return Math.abs(obj.slider(opts));
1020
+ }
1021
+ return obj.slider(opts);
1022
+ }
1023
+ var min = opts.min,
1024
+ max = opts.max;
1025
+ opts.min = opts.max = null;
1026
+ if (min !== undefined) {
1027
+ opts.max = min * -1;
1028
+ }
1029
+ if (max !== undefined) {
1030
+ opts.min = max * -1;
1031
+ }
1032
+ return obj.slider(opts);
1033
+ }
1034
+ if (typeof(opts) === 'string' && val !== undefined) {
1035
+ return obj.slider(opts, val);
1036
+ }
1037
+ return obj.slider(opts);
1038
+ },
1039
+ value: function (tp_inst, obj, unit, val) {
1040
+ if (tp_inst._defaults.isRTL) {
1041
+ if (val !== undefined) {
1042
+ return obj.slider('value', val * -1);
1043
+ }
1044
+ return Math.abs(obj.slider('value'));
1045
+ }
1046
+ if (val !== undefined) {
1047
+ return obj.slider('value', val);
1048
+ }
1049
+ return obj.slider('value');
1050
+ }
1051
+ },
1052
+ // select methods
1053
+ select: {
1054
+ create: function (tp_inst, obj, unit, val, min, max, step) {
1055
+ var sel = '<select class="ui-timepicker-select ui-state-default ui-corner-all" data-unit="' + unit + '" data-min="' + min + '" data-max="' + max + '" data-step="' + step + '">',
1056
+ format = tp_inst._defaults.pickerTimeFormat || tp_inst._defaults.timeFormat;
1057
+
1058
+ for (var i = min; i <= max; i += step) {
1059
+ sel += '<option value="' + i + '"' + (i === val ? ' selected' : '') + '>';
1060
+ if (unit === 'hour') {
1061
+ sel += $.datepicker.formatTime($.trim(format.replace(/[^ht ]/ig, '')), {hour: i}, tp_inst._defaults);
1062
+ }
1063
+ else if (unit === 'millisec' || unit === 'microsec' || i >= 10) { sel += i; }
1064
+ else {sel += '0' + i.toString(); }
1065
+ sel += '</option>';
1066
+ }
1067
+ sel += '</select>';
1068
+
1069
+ obj.children('select').remove();
1070
+
1071
+ $(sel).appendTo(obj).change(function (e) {
1072
+ tp_inst._onTimeChange();
1073
+ tp_inst._onSelectHandler();
1074
+ tp_inst._afterInject();
1075
+ });
1076
+
1077
+ return obj;
1078
+ },
1079
+ options: function (tp_inst, obj, unit, opts, val) {
1080
+ var o = {},
1081
+ $t = obj.children('select');
1082
+ if (typeof(opts) === 'string') {
1083
+ if (val === undefined) {
1084
+ return $t.data(opts);
1085
+ }
1086
+ o[opts] = val;
1087
+ }
1088
+ else { o = opts; }
1089
+ return tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min>=0 ? o.min : $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step'));
1090
+ },
1091
+ value: function (tp_inst, obj, unit, val) {
1092
+ var $t = obj.children('select');
1093
+ if (val !== undefined) {
1094
+ return $t.val(val);
1095
+ }
1096
+ return $t.val();
1097
+ }
1098
+ }
1099
+ } // end _controls
1100
+
1101
+ });
1102
+
1103
+ $.fn.extend({
1104
+ /*
1105
+ * shorthand just to use timepicker.
1106
+ */
1107
+ timepicker: function (o) {
1108
+ o = o || {};
1109
+ var tmp_args = Array.prototype.slice.call(arguments);
1110
+
1111
+ if (typeof o === 'object') {
1112
+ tmp_args[0] = $.extend(o, {
1113
+ timeOnly: true
1114
+ });
1115
+ }
1116
+
1117
+ return $(this).each(function () {
1118
+ $.fn.datetimepicker.apply($(this), tmp_args);
1119
+ });
1120
+ },
1121
+
1122
+ /*
1123
+ * extend timepicker to datepicker
1124
+ */
1125
+ datetimepicker: function (o) {
1126
+ o = o || {};
1127
+ var tmp_args = arguments;
1128
+
1129
+ if (typeof(o) === 'string') {
1130
+ if (o === 'getDate' || (o === 'option' && tmp_args.length === 2 && typeof (tmp_args[1]) === 'string')) {
1131
+ return $.fn.datepicker.apply($(this[0]), tmp_args);
1132
+ } else {
1133
+ return this.each(function () {
1134
+ var $t = $(this);
1135
+ $t.datepicker.apply($t, tmp_args);
1136
+ });
1137
+ }
1138
+ } else {
1139
+ return this.each(function () {
1140
+ var $t = $(this);
1141
+ $t.datepicker($.timepicker._newInst($t, o)._defaults);
1142
+ });
1143
+ }
1144
+ }
1145
+ });
1146
+
1147
+ /*
1148
+ * Public Utility to parse date and time
1149
+ */
1150
+ $.datepicker.parseDateTime = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
1151
+ var parseRes = parseDateTimeInternal(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings);
1152
+ if (parseRes.timeObj) {
1153
+ var t = parseRes.timeObj;
1154
+ parseRes.date.setHours(t.hour, t.minute, t.second, t.millisec);
1155
+ parseRes.date.setMicroseconds(t.microsec);
1156
+ }
1157
+
1158
+ return parseRes.date;
1159
+ };
1160
+
1161
+ /*
1162
+ * Public utility to parse time
1163
+ */
1164
+ $.datepicker.parseTime = function (timeFormat, timeString, options) {
1165
+ var o = extendRemove(extendRemove({}, $.timepicker._defaults), options || {}),
1166
+ iso8601 = (timeFormat.replace(/\'.*?\'/g, '').indexOf('Z') !== -1);
1167
+
1168
+ // Strict parse requires the timeString to match the timeFormat exactly
1169
+ var strictParse = function (f, s, o) {
1170
+
1171
+ // pattern for standard and localized AM/PM markers
1172
+ var getPatternAmpm = function (amNames, pmNames) {
1173
+ var markers = [];
1174
+ if (amNames) {
1175
+ $.merge(markers, amNames);
1176
+ }
1177
+ if (pmNames) {
1178
+ $.merge(markers, pmNames);
1179
+ }
1180
+ markers = $.map(markers, function (val) {
1181
+ return val.replace(/[.*+?|()\[\]{}\\]/g, '\\$&');
1182
+ });
1183
+ return '(' + markers.join('|') + ')?';
1184
+ };
1185
+
1186
+ // figure out position of time elements.. cause js cant do named captures
1187
+ var getFormatPositions = function (timeFormat) {
1188
+ var finds = timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),
1189
+ orders = {
1190
+ h: -1,
1191
+ m: -1,
1192
+ s: -1,
1193
+ l: -1,
1194
+ c: -1,
1195
+ t: -1,
1196
+ z: -1
1197
+ };
1198
+
1199
+ if (finds) {
1200
+ for (var i = 0; i < finds.length; i++) {
1201
+ if (orders[finds[i].toString().charAt(0)] === -1) {
1202
+ orders[finds[i].toString().charAt(0)] = i + 1;
1203
+ }
1204
+ }
1205
+ }
1206
+ return orders;
1207
+ };
1208
+
1209
+ var regstr = '^' + f.toString()
1210
+ .replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {
1211
+ var ml = match.length;
1212
+ switch (match.charAt(0).toLowerCase()) {
1213
+ case 'h':
1214
+ return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
1215
+ case 'm':
1216
+ return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
1217
+ case 's':
1218
+ return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
1219
+ case 'l':
1220
+ return '(\\d?\\d?\\d)';
1221
+ case 'c':
1222
+ return '(\\d?\\d?\\d)';
1223
+ case 'z':
1224
+ return '(z|[-+]\\d\\d:?\\d\\d|\\S+)?';
1225
+ case 't':
1226
+ return getPatternAmpm(o.amNames, o.pmNames);
1227
+ default: // literal escaped in quotes
1228
+ return '(' + match.replace(/\'/g, "").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g, function (m) { return "\\" + m; }) + ')?';
1229
+ }
1230
+ })
1231
+ .replace(/\s/g, '\\s?') +
1232
+ o.timeSuffix + '$',
1233
+ order = getFormatPositions(f),
1234
+ ampm = '',
1235
+ treg;
1236
+
1237
+ treg = s.match(new RegExp(regstr, 'i'));
1238
+
1239
+ var resTime = {
1240
+ hour: 0,
1241
+ minute: 0,
1242
+ second: 0,
1243
+ millisec: 0,
1244
+ microsec: 0
1245
+ };
1246
+
1247
+ if (treg) {
1248
+ if (order.t !== -1) {
1249
+ if (treg[order.t] === undefined || treg[order.t].length === 0) {
1250
+ ampm = '';
1251
+ resTime.ampm = '';
1252
+ } else {
1253
+ ampm = $.inArray(treg[order.t].toUpperCase(), $.map(o.amNames, function (x,i) { return x.toUpperCase(); })) !== -1 ? 'AM' : 'PM';
1254
+ resTime.ampm = o[ampm === 'AM' ? 'amNames' : 'pmNames'][0];
1255
+ }
1256
+ }
1257
+
1258
+ if (order.h !== -1) {
1259
+ if (ampm === 'AM' && treg[order.h] === '12') {
1260
+ resTime.hour = 0; // 12am = 0 hour
1261
+ } else {
1262
+ if (ampm === 'PM' && treg[order.h] !== '12') {
1263
+ resTime.hour = parseInt(treg[order.h], 10) + 12; // 12pm = 12 hour, any other pm = hour + 12
1264
+ } else {
1265
+ resTime.hour = Number(treg[order.h]);
1266
+ }
1267
+ }
1268
+ }
1269
+
1270
+ if (order.m !== -1) {
1271
+ resTime.minute = Number(treg[order.m]);
1272
+ }
1273
+ if (order.s !== -1) {
1274
+ resTime.second = Number(treg[order.s]);
1275
+ }
1276
+ if (order.l !== -1) {
1277
+ resTime.millisec = Number(treg[order.l]);
1278
+ }
1279
+ if (order.c !== -1) {
1280
+ resTime.microsec = Number(treg[order.c]);
1281
+ }
1282
+ if (order.z !== -1 && treg[order.z] !== undefined) {
1283
+ resTime.timezone = $.timepicker.timezoneOffsetNumber(treg[order.z]);
1284
+ }
1285
+
1286
+
1287
+ return resTime;
1288
+ }
1289
+ return false;
1290
+ };// end strictParse
1291
+
1292
+ // First try JS Date, if that fails, use strictParse
1293
+ var looseParse = function (f, s, o) {
1294
+ try {
1295
+ var d = new Date('2012-01-01 ' + s);
1296
+ if (isNaN(d.getTime())) {
1297
+ d = new Date('2012-01-01T' + s);
1298
+ if (isNaN(d.getTime())) {
1299
+ d = new Date('01/01/2012 ' + s);
1300
+ if (isNaN(d.getTime())) {
1301
+ throw "Unable to parse time with native Date: " + s;
1302
+ }
1303
+ }
1304
+ }
1305
+
1306
+ return {
1307
+ hour: d.getHours(),
1308
+ minute: d.getMinutes(),
1309
+ second: d.getSeconds(),
1310
+ millisec: d.getMilliseconds(),
1311
+ microsec: d.getMicroseconds(),
1312
+ timezone: d.getTimezoneOffset() * -1
1313
+ };
1314
+ }
1315
+ catch (err) {
1316
+ try {
1317
+ return strictParse(f, s, o);
1318
+ }
1319
+ catch (err2) {
1320
+ $.timepicker.log("Unable to parse \ntimeString: " + s + "\ntimeFormat: " + f);
1321
+ }
1322
+ }
1323
+ return false;
1324
+ }; // end looseParse
1325
+
1326
+ if (typeof o.parse === "function") {
1327
+ return o.parse(timeFormat, timeString, o);
1328
+ }
1329
+ if (o.parse === 'loose') {
1330
+ return looseParse(timeFormat, timeString, o);
1331
+ }
1332
+ return strictParse(timeFormat, timeString, o);
1333
+ };
1334
+
1335
+ /**
1336
+ * Public utility to format the time
1337
+ * @param {string} format format of the time
1338
+ * @param {Object} time Object not a Date for timezones
1339
+ * @param {Object} [options] essentially the regional[].. amNames, pmNames, ampm
1340
+ * @returns {string} the formatted time
1341
+ */
1342
+ $.datepicker.formatTime = function (format, time, options) {
1343
+ options = options || {};
1344
+ options = $.extend({}, $.timepicker._defaults, options);
1345
+ time = $.extend({
1346
+ hour: 0,
1347
+ minute: 0,
1348
+ second: 0,
1349
+ millisec: 0,
1350
+ microsec: 0,
1351
+ timezone: null
1352
+ }, time);
1353
+
1354
+ var tmptime = format,
1355
+ ampmName = options.amNames[0],
1356
+ hour = parseInt(time.hour, 10);
1357
+
1358
+ if (hour > 11) {
1359
+ ampmName = options.pmNames[0];
1360
+ }
1361
+
1362
+ tmptime = tmptime.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {
1363
+ switch (match) {
1364
+ case 'HH':
1365
+ return ('0' + hour).slice(-2);
1366
+ case 'H':
1367
+ return hour;
1368
+ case 'hh':
1369
+ return ('0' + convert24to12(hour)).slice(-2);
1370
+ case 'h':
1371
+ return convert24to12(hour);
1372
+ case 'mm':
1373
+ return ('0' + time.minute).slice(-2);
1374
+ case 'm':
1375
+ return time.minute;
1376
+ case 'ss':
1377
+ return ('0' + time.second).slice(-2);
1378
+ case 's':
1379
+ return time.second;
1380
+ case 'l':
1381
+ return ('00' + time.millisec).slice(-3);
1382
+ case 'c':
1383
+ return ('00' + time.microsec).slice(-3);
1384
+ case 'z':
1385
+ return $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, false);
1386
+ case 'Z':
1387
+ return $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, true);
1388
+ case 'T':
1389
+ return ampmName.charAt(0).toUpperCase();
1390
+ case 'TT':
1391
+ return ampmName.toUpperCase();
1392
+ case 't':
1393
+ return ampmName.charAt(0).toLowerCase();
1394
+ case 'tt':
1395
+ return ampmName.toLowerCase();
1396
+ default:
1397
+ return match.replace(/'/g, "");
1398
+ }
1399
+ });
1400
+
1401
+ return tmptime;
1402
+ };
1403
+
1404
+ /*
1405
+ * the bad hack :/ override datepicker so it doesn't close on select
1406
+ // inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378
1407
+ */
1408
+ $.datepicker._base_selectDate = $.datepicker._selectDate;
1409
+ $.datepicker._selectDate = function (id, dateStr) {
1410
+ var inst = this._getInst($(id)[0]),
1411
+ tp_inst = this._get(inst, 'timepicker'),
1412
+ was_inline;
1413
+
1414
+ if (tp_inst && inst.settings.showTimepicker) {
1415
+ tp_inst._limitMinMaxDateTime(inst, true);
1416
+ was_inline = inst.inline;
1417
+ inst.inline = inst.stay_open = true;
1418
+ //This way the onSelect handler called from calendarpicker get the full dateTime
1419
+ this._base_selectDate(id, dateStr);
1420
+ inst.inline = was_inline;
1421
+ inst.stay_open = false;
1422
+ this._notifyChange(inst);
1423
+ this._updateDatepicker(inst);
1424
+ } else {
1425
+ this._base_selectDate(id, dateStr);
1426
+ }
1427
+ };
1428
+
1429
+ /*
1430
+ * second bad hack :/ override datepicker so it triggers an event when changing the input field
1431
+ * and does not redraw the datepicker on every selectDate event
1432
+ */
1433
+ $.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;
1434
+ $.datepicker._updateDatepicker = function (inst) {
1435
+
1436
+ // don't popup the datepicker if there is another instance already opened
1437
+ var input = inst.input[0];
1438
+ if ($.datepicker._curInst && $.datepicker._curInst !== inst && $.datepicker._datepickerShowing && $.datepicker._lastInput !== input) {
1439
+ return;
1440
+ }
1441
+
1442
+ if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
1443
+
1444
+ this._base_updateDatepicker(inst);
1445
+
1446
+ // Reload the time control when changing something in the input text field.
1447
+ var tp_inst = this._get(inst, 'timepicker');
1448
+ if (tp_inst) {
1449
+ tp_inst._addTimePicker(inst);
1450
+ }
1451
+ }
1452
+ };
1453
+
1454
+ /*
1455
+ * third bad hack :/ override datepicker so it allows spaces and colon in the input field
1456
+ */
1457
+ $.datepicker._base_doKeyPress = $.datepicker._doKeyPress;
1458
+ $.datepicker._doKeyPress = function (event) {
1459
+ var inst = $.datepicker._getInst(event.target),
1460
+ tp_inst = $.datepicker._get(inst, 'timepicker');
1461
+
1462
+ if (tp_inst) {
1463
+ if ($.datepicker._get(inst, 'constrainInput')) {
1464
+ var ampm = tp_inst.support.ampm,
1465
+ tz = tp_inst._defaults.showTimezone !== null ? tp_inst._defaults.showTimezone : tp_inst.support.timezone,
1466
+ dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
1467
+ datetimeChars = tp_inst._defaults.timeFormat.toString()
1468
+ .replace(/[hms]/g, '')
1469
+ .replace(/TT/g, ampm ? 'APM' : '')
1470
+ .replace(/Tt/g, ampm ? 'AaPpMm' : '')
1471
+ .replace(/tT/g, ampm ? 'AaPpMm' : '')
1472
+ .replace(/T/g, ampm ? 'AP' : '')
1473
+ .replace(/tt/g, ampm ? 'apm' : '')
1474
+ .replace(/t/g, ampm ? 'ap' : '') +
1475
+ " " + tp_inst._defaults.separator +
1476
+ tp_inst._defaults.timeSuffix +
1477
+ (tz ? tp_inst._defaults.timezoneList.join('') : '') +
1478
+ (tp_inst._defaults.amNames.join('')) + (tp_inst._defaults.pmNames.join('')) +
1479
+ dateChars,
1480
+ chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
1481
+ return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
1482
+ }
1483
+ }
1484
+
1485
+ return $.datepicker._base_doKeyPress(event);
1486
+ };
1487
+
1488
+ /*
1489
+ * Fourth bad hack :/ override _updateAlternate function used in inline mode to init altField
1490
+ * Update any alternate field to synchronise with the main field.
1491
+ */
1492
+ $.datepicker._base_updateAlternate = $.datepicker._updateAlternate;
1493
+ $.datepicker._updateAlternate = function (inst) {
1494
+ var tp_inst = this._get(inst, 'timepicker');
1495
+ if (tp_inst) {
1496
+ var altField = tp_inst._defaults.altField;
1497
+ if (altField) { // update alternate field too
1498
+ var altFormat = tp_inst._defaults.altFormat || tp_inst._defaults.dateFormat,
1499
+ date = this._getDate(inst),
1500
+ formatCfg = $.datepicker._getFormatConfig(inst),
1501
+ altFormattedDateTime = '',
1502
+ altSeparator = tp_inst._defaults.altSeparator ? tp_inst._defaults.altSeparator : tp_inst._defaults.separator,
1503
+ altTimeSuffix = tp_inst._defaults.altTimeSuffix ? tp_inst._defaults.altTimeSuffix : tp_inst._defaults.timeSuffix,
1504
+ altTimeFormat = tp_inst._defaults.altTimeFormat !== null ? tp_inst._defaults.altTimeFormat : tp_inst._defaults.timeFormat;
1505
+
1506
+ altFormattedDateTime += $.datepicker.formatTime(altTimeFormat, tp_inst, tp_inst._defaults) + altTimeSuffix;
1507
+ if (!tp_inst._defaults.timeOnly && !tp_inst._defaults.altFieldTimeOnly && date !== null) {
1508
+ if (tp_inst._defaults.altFormat) {
1509
+ altFormattedDateTime = $.datepicker.formatDate(tp_inst._defaults.altFormat, date, formatCfg) + altSeparator + altFormattedDateTime;
1510
+ }
1511
+ else {
1512
+ altFormattedDateTime = tp_inst.formattedDate + altSeparator + altFormattedDateTime;
1513
+ }
1514
+ }
1515
+ $(altField).val( inst.input.val() ? altFormattedDateTime : "");
1516
+ }
1517
+ }
1518
+ else {
1519
+ $.datepicker._base_updateAlternate(inst);
1520
+ }
1521
+ };
1522
+
1523
+ /*
1524
+ * Override key up event to sync manual input changes.
1525
+ */
1526
+ $.datepicker._base_doKeyUp = $.datepicker._doKeyUp;
1527
+ $.datepicker._doKeyUp = function (event) {
1528
+ var inst = $.datepicker._getInst(event.target),
1529
+ tp_inst = $.datepicker._get(inst, 'timepicker');
1530
+
1531
+ if (tp_inst) {
1532
+ if (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) {
1533
+ try {
1534
+ $.datepicker._updateDatepicker(inst);
1535
+ } catch (err) {
1536
+ $.timepicker.log(err);
1537
+ }
1538
+ }
1539
+ }
1540
+
1541
+ return $.datepicker._base_doKeyUp(event);
1542
+ };
1543
+
1544
+ /*
1545
+ * override "Today" button to also grab the time.
1546
+ */
1547
+ $.datepicker._base_gotoToday = $.datepicker._gotoToday;
1548
+ $.datepicker._gotoToday = function (id) {
1549
+ var inst = this._getInst($(id)[0]),
1550
+ $dp = inst.dpDiv;
1551
+ var tp_inst = this._get(inst, 'timepicker');
1552
+ selectLocalTimezone(tp_inst);
1553
+ var now = new Date();
1554
+ this._setTime(inst, now);
1555
+ this._setDate(inst, now);
1556
+ this._base_gotoToday(id);
1557
+ };
1558
+
1559
+ /*
1560
+ * Disable & enable the Time in the datetimepicker
1561
+ */
1562
+ $.datepicker._disableTimepickerDatepicker = function (target) {
1563
+ var inst = this._getInst(target);
1564
+ if (!inst) {
1565
+ return;
1566
+ }
1567
+
1568
+ var tp_inst = this._get(inst, 'timepicker');
1569
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
1570
+ if (tp_inst) {
1571
+ inst.settings.showTimepicker = false;
1572
+ tp_inst._defaults.showTimepicker = false;
1573
+ tp_inst._updateDateTime(inst);
1574
+ }
1575
+ };
1576
+
1577
+ $.datepicker._enableTimepickerDatepicker = function (target) {
1578
+ var inst = this._getInst(target);
1579
+ if (!inst) {
1580
+ return;
1581
+ }
1582
+
1583
+ var tp_inst = this._get(inst, 'timepicker');
1584
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
1585
+ if (tp_inst) {
1586
+ inst.settings.showTimepicker = true;
1587
+ tp_inst._defaults.showTimepicker = true;
1588
+ tp_inst._addTimePicker(inst); // Could be disabled on page load
1589
+ tp_inst._updateDateTime(inst);
1590
+ }
1591
+ };
1592
+
1593
+ /*
1594
+ * Create our own set time function
1595
+ */
1596
+ $.datepicker._setTime = function (inst, date) {
1597
+ var tp_inst = this._get(inst, 'timepicker');
1598
+ if (tp_inst) {
1599
+ var defaults = tp_inst._defaults;
1600
+
1601
+ // calling _setTime with no date sets time to defaults
1602
+ tp_inst.hour = date ? date.getHours() : defaults.hour;
1603
+ tp_inst.minute = date ? date.getMinutes() : defaults.minute;
1604
+ tp_inst.second = date ? date.getSeconds() : defaults.second;
1605
+ tp_inst.millisec = date ? date.getMilliseconds() : defaults.millisec;
1606
+ tp_inst.microsec = date ? date.getMicroseconds() : defaults.microsec;
1607
+
1608
+ //check if within min/max times..
1609
+ tp_inst._limitMinMaxDateTime(inst, true);
1610
+
1611
+ tp_inst._onTimeChange();
1612
+ tp_inst._updateDateTime(inst);
1613
+ }
1614
+ };
1615
+
1616
+ /*
1617
+ * Create new public method to set only time, callable as $().datepicker('setTime', date)
1618
+ */
1619
+ $.datepicker._setTimeDatepicker = function (target, date, withDate) {
1620
+ var inst = this._getInst(target);
1621
+ if (!inst) {
1622
+ return;
1623
+ }
1624
+
1625
+ var tp_inst = this._get(inst, 'timepicker');
1626
+
1627
+ if (tp_inst) {
1628
+ this._setDateFromField(inst);
1629
+ var tp_date;
1630
+ if (date) {
1631
+ if (typeof date === "string") {
1632
+ tp_inst._parseTime(date, withDate);
1633
+ tp_date = new Date();
1634
+ tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1635
+ tp_date.setMicroseconds(tp_inst.microsec);
1636
+ } else {
1637
+ tp_date = new Date(date.getTime());
1638
+ tp_date.setMicroseconds(date.getMicroseconds());
1639
+ }
1640
+ if (tp_date.toString() === 'Invalid Date') {
1641
+ tp_date = undefined;
1642
+ }
1643
+ this._setTime(inst, tp_date);
1644
+ }
1645
+ }
1646
+
1647
+ };
1648
+
1649
+ /*
1650
+ * override setDate() to allow setting time too within Date object
1651
+ */
1652
+ $.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
1653
+ $.datepicker._setDateDatepicker = function (target, _date) {
1654
+ var inst = this._getInst(target);
1655
+ var date = _date;
1656
+ if (!inst) {
1657
+ return;
1658
+ }
1659
+
1660
+ if (typeof(_date) === 'string') {
1661
+ date = new Date(_date);
1662
+ if (!date.getTime()) {
1663
+ this._base_setDateDatepicker.apply(this, arguments);
1664
+ date = $(target).datepicker('getDate');
1665
+ }
1666
+ }
1667
+
1668
+ var tp_inst = this._get(inst, 'timepicker');
1669
+ var tp_date;
1670
+ if (date instanceof Date) {
1671
+ tp_date = new Date(date.getTime());
1672
+ tp_date.setMicroseconds(date.getMicroseconds());
1673
+ } else {
1674
+ tp_date = date;
1675
+ }
1676
+
1677
+ // This is important if you are using the timezone option, javascript's Date
1678
+ // object will only return the timezone offset for the current locale, so we
1679
+ // adjust it accordingly. If not using timezone option this won't matter..
1680
+ // If a timezone is different in tp, keep the timezone as is
1681
+ if (tp_inst && tp_date) {
1682
+ // look out for DST if tz wasn't specified
1683
+ if (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) {
1684
+ tp_inst.timezone = tp_date.getTimezoneOffset() * -1;
1685
+ }
1686
+ date = $.timepicker.timezoneAdjust(date, tp_inst.timezone);
1687
+ tp_date = $.timepicker.timezoneAdjust(tp_date, tp_inst.timezone);
1688
+ }
1689
+
1690
+ this._updateDatepicker(inst);
1691
+ this._base_setDateDatepicker.apply(this, arguments);
1692
+ this._setTimeDatepicker(target, tp_date, true);
1693
+ };
1694
+
1695
+ /*
1696
+ * override getDate() to allow getting time too within Date object
1697
+ */
1698
+ $.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;
1699
+ $.datepicker._getDateDatepicker = function (target, noDefault) {
1700
+ var inst = this._getInst(target);
1701
+ if (!inst) {
1702
+ return;
1703
+ }
1704
+
1705
+ var tp_inst = this._get(inst, 'timepicker');
1706
+
1707
+ if (tp_inst) {
1708
+ // if it hasn't yet been defined, grab from field
1709
+ if (inst.lastVal === undefined) {
1710
+ this._setDateFromField(inst, noDefault);
1711
+ }
1712
+
1713
+ var date = this._getDate(inst);
1714
+ var currDT = $.trim((tp_inst.$altInput && tp_inst._defaults.altFieldTimeOnly) ? tp_inst.$input.val() + ' ' + tp_inst.$altInput.val() : tp_inst.$input.val());
1715
+ if (date && tp_inst._parseTime(currDT, !inst.settings.timeOnly)) {
1716
+ date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1717
+ date.setMicroseconds(tp_inst.microsec);
1718
+
1719
+ // This is important if you are using the timezone option, javascript's Date
1720
+ // object will only return the timezone offset for the current locale, so we
1721
+ // adjust it accordingly. If not using timezone option this won't matter..
1722
+ if (tp_inst.timezone != null) {
1723
+ // look out for DST if tz wasn't specified
1724
+ if (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) {
1725
+ tp_inst.timezone = date.getTimezoneOffset() * -1;
1726
+ }
1727
+ date = $.timepicker.timezoneAdjust(date, tp_inst.timezone);
1728
+ }
1729
+ }
1730
+ return date;
1731
+ }
1732
+ return this._base_getDateDatepicker(target, noDefault);
1733
+ };
1734
+
1735
+ /*
1736
+ * override parseDate() because UI 1.8.14 throws an error about "Extra characters"
1737
+ * An option in datapicker to ignore extra format characters would be nicer.
1738
+ */
1739
+ $.datepicker._base_parseDate = $.datepicker.parseDate;
1740
+ $.datepicker.parseDate = function (format, value, settings) {
1741
+ var date;
1742
+ try {
1743
+ date = this._base_parseDate(format, value, settings);
1744
+ } catch (err) {
1745
+ // Hack! The error message ends with a colon, a space, and
1746
+ // the "extra" characters. We rely on that instead of
1747
+ // attempting to perfectly reproduce the parsing algorithm.
1748
+ if (err.indexOf(":") >= 0) {
1749
+ date = this._base_parseDate(format, value.substring(0, value.length - (err.length - err.indexOf(':') - 2)), settings);
1750
+ $.timepicker.log("Error parsing the date string: " + err + "\ndate string = " + value + "\ndate format = " + format);
1751
+ } else {
1752
+ throw err;
1753
+ }
1754
+ }
1755
+ return date;
1756
+ };
1757
+
1758
+ /*
1759
+ * override formatDate to set date with time to the input
1760
+ */
1761
+ $.datepicker._base_formatDate = $.datepicker._formatDate;
1762
+ $.datepicker._formatDate = function (inst, day, month, year) {
1763
+ var tp_inst = this._get(inst, 'timepicker');
1764
+ if (tp_inst) {
1765
+ tp_inst._updateDateTime(inst);
1766
+ return tp_inst.$input.val();
1767
+ }
1768
+ return this._base_formatDate(inst);
1769
+ };
1770
+
1771
+ /*
1772
+ * override options setter to add time to maxDate(Time) and minDate(Time). MaxDate
1773
+ */
1774
+ $.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;
1775
+ $.datepicker._optionDatepicker = function (target, name, value) {
1776
+ var inst = this._getInst(target),
1777
+ name_clone;
1778
+ if (!inst) {
1779
+ return null;
1780
+ }
1781
+
1782
+ var tp_inst = this._get(inst, 'timepicker');
1783
+ if (tp_inst) {
1784
+ var min = null,
1785
+ max = null,
1786
+ onselect = null,
1787
+ overrides = tp_inst._defaults.evnts,
1788
+ fns = {},
1789
+ prop,
1790
+ ret,
1791
+ oldVal,
1792
+ $target;
1793
+ if (typeof name === 'string') { // if min/max was set with the string
1794
+ if (name === 'minDate' || name === 'minDateTime') {
1795
+ min = value;
1796
+ } else if (name === 'maxDate' || name === 'maxDateTime') {
1797
+ max = value;
1798
+ } else if (name === 'onSelect') {
1799
+ onselect = value;
1800
+ } else if (overrides.hasOwnProperty(name)) {
1801
+ if (typeof (value) === 'undefined') {
1802
+ return overrides[name];
1803
+ }
1804
+ fns[name] = value;
1805
+ name_clone = {}; //empty results in exiting function after overrides updated
1806
+ }
1807
+ } else if (typeof name === 'object') { //if min/max was set with the JSON
1808
+ if (name.minDate) {
1809
+ min = name.minDate;
1810
+ } else if (name.minDateTime) {
1811
+ min = name.minDateTime;
1812
+ } else if (name.maxDate) {
1813
+ max = name.maxDate;
1814
+ } else if (name.maxDateTime) {
1815
+ max = name.maxDateTime;
1816
+ }
1817
+ for (prop in overrides) {
1818
+ if (overrides.hasOwnProperty(prop) && name[prop]) {
1819
+ fns[prop] = name[prop];
1820
+ }
1821
+ }
1822
+ }
1823
+ for (prop in fns) {
1824
+ if (fns.hasOwnProperty(prop)) {
1825
+ overrides[prop] = fns[prop];
1826
+ if (!name_clone) { name_clone = $.extend({}, name); }
1827
+ delete name_clone[prop];
1828
+ }
1829
+ }
1830
+ if (name_clone && isEmptyObject(name_clone)) { return; }
1831
+ if (min) { //if min was set
1832
+ if (min === 0) {
1833
+ min = new Date();
1834
+ } else {
1835
+ min = new Date(min);
1836
+ }
1837
+ tp_inst._defaults.minDate = min;
1838
+ tp_inst._defaults.minDateTime = min;
1839
+ } else if (max) { //if max was set
1840
+ if (max === 0) {
1841
+ max = new Date();
1842
+ } else {
1843
+ max = new Date(max);
1844
+ }
1845
+ tp_inst._defaults.maxDate = max;
1846
+ tp_inst._defaults.maxDateTime = max;
1847
+ } else if (onselect) {
1848
+ tp_inst._defaults.onSelect = onselect;
1849
+ }
1850
+
1851
+ // Datepicker will override our date when we call _base_optionDatepicker when
1852
+ // calling minDate/maxDate, so we will first grab the value, call
1853
+ // _base_optionDatepicker, then set our value back.
1854
+ if(min || max){
1855
+ $target = $(target);
1856
+ oldVal = $target.datetimepicker('getDate');
1857
+ ret = this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
1858
+ $target.datetimepicker('setDate', oldVal);
1859
+ return ret;
1860
+ }
1861
+ }
1862
+ if (value === undefined) {
1863
+ return this._base_optionDatepicker.call($.datepicker, target, name);
1864
+ }
1865
+ return this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
1866
+ };
1867
+
1868
+ /*
1869
+ * jQuery isEmptyObject does not check hasOwnProperty - if someone has added to the object prototype,
1870
+ * it will return false for all objects
1871
+ */
1872
+ var isEmptyObject = function (obj) {
1873
+ var prop;
1874
+ for (prop in obj) {
1875
+ if (obj.hasOwnProperty(prop)) {
1876
+ return false;
1877
+ }
1878
+ }
1879
+ return true;
1880
+ };
1881
+
1882
+ /*
1883
+ * jQuery extend now ignores nulls!
1884
+ */
1885
+ var extendRemove = function (target, props) {
1886
+ $.extend(target, props);
1887
+ for (var name in props) {
1888
+ if (props[name] === null || props[name] === undefined) {
1889
+ target[name] = props[name];
1890
+ }
1891
+ }
1892
+ return target;
1893
+ };
1894
+
1895
+ /*
1896
+ * Determine by the time format which units are supported
1897
+ * Returns an object of booleans for each unit
1898
+ */
1899
+ var detectSupport = function (timeFormat) {
1900
+ var tf = timeFormat.replace(/'.*?'/g, '').toLowerCase(), // removes literals
1901
+ isIn = function (f, t) { // does the format contain the token?
1902
+ return f.indexOf(t) !== -1 ? true : false;
1903
+ };
1904
+ return {
1905
+ hour: isIn(tf, 'h'),
1906
+ minute: isIn(tf, 'm'),
1907
+ second: isIn(tf, 's'),
1908
+ millisec: isIn(tf, 'l'),
1909
+ microsec: isIn(tf, 'c'),
1910
+ timezone: isIn(tf, 'z'),
1911
+ ampm: isIn(tf, 't') && isIn(timeFormat, 'h'),
1912
+ iso8601: isIn(timeFormat, 'Z')
1913
+ };
1914
+ };
1915
+
1916
+ /*
1917
+ * Converts 24 hour format into 12 hour
1918
+ * Returns 12 hour without leading 0
1919
+ */
1920
+ var convert24to12 = function (hour) {
1921
+ hour %= 12;
1922
+
1923
+ if (hour === 0) {
1924
+ hour = 12;
1925
+ }
1926
+
1927
+ return String(hour);
1928
+ };
1929
+
1930
+ var computeEffectiveSetting = function (settings, property) {
1931
+ return settings && settings[property] ? settings[property] : $.timepicker._defaults[property];
1932
+ };
1933
+
1934
+ /*
1935
+ * Splits datetime string into date and time substrings.
1936
+ * Throws exception when date can't be parsed
1937
+ * Returns {dateString: dateString, timeString: timeString}
1938
+ */
1939
+ var splitDateTime = function (dateTimeString, timeSettings) {
1940
+ // The idea is to get the number separator occurrences in datetime and the time format requested (since time has
1941
+ // fewer unknowns, mostly numbers and am/pm). We will use the time pattern to split.
1942
+ var separator = computeEffectiveSetting(timeSettings, 'separator'),
1943
+ format = computeEffectiveSetting(timeSettings, 'timeFormat'),
1944
+ timeParts = format.split(separator), // how many occurrences of separator may be in our format?
1945
+ timePartsLen = timeParts.length,
1946
+ allParts = dateTimeString.split(separator),
1947
+ allPartsLen = allParts.length;
1948
+
1949
+ if (allPartsLen > 1) {
1950
+ return {
1951
+ dateString: allParts.splice(0, allPartsLen - timePartsLen).join(separator),
1952
+ timeString: allParts.splice(0, timePartsLen).join(separator)
1953
+ };
1954
+ }
1955
+
1956
+ return {
1957
+ dateString: dateTimeString,
1958
+ timeString: ''
1959
+ };
1960
+ };
1961
+
1962
+ /*
1963
+ * Internal function to parse datetime interval
1964
+ * Returns: {date: Date, timeObj: Object}, where
1965
+ * date - parsed date without time (type Date)
1966
+ * timeObj = {hour: , minute: , second: , millisec: , microsec: } - parsed time. Optional
1967
+ */
1968
+ var parseDateTimeInternal = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
1969
+ var date,
1970
+ parts,
1971
+ parsedTime;
1972
+
1973
+ parts = splitDateTime(dateTimeString, timeSettings);
1974
+ date = $.datepicker._base_parseDate(dateFormat, parts.dateString, dateSettings);
1975
+
1976
+ if (parts.timeString === '') {
1977
+ return {
1978
+ date: date
1979
+ };
1980
+ }
1981
+
1982
+ parsedTime = $.datepicker.parseTime(timeFormat, parts.timeString, timeSettings);
1983
+
1984
+ if (!parsedTime) {
1985
+ throw 'Wrong time format';
1986
+ }
1987
+
1988
+ return {
1989
+ date: date,
1990
+ timeObj: parsedTime
1991
+ };
1992
+ };
1993
+
1994
+ /*
1995
+ * Internal function to set timezone_select to the local timezone
1996
+ */
1997
+ var selectLocalTimezone = function (tp_inst, date) {
1998
+ if (tp_inst && tp_inst.timezone_select) {
1999
+ var now = date || new Date();
2000
+ tp_inst.timezone_select.val(-now.getTimezoneOffset());
2001
+ }
2002
+ };
2003
+
2004
+ /*
2005
+ * Create a Singleton Instance
2006
+ */
2007
+ $.timepicker = new Timepicker();
2008
+
2009
+ /**
2010
+ * Get the timezone offset as string from a date object (eg '+0530' for UTC+5.5)
2011
+ * @param {number} tzMinutes if not a number, less than -720 (-1200), or greater than 840 (+1400) this value is returned
2012
+ * @param {boolean} iso8601 if true formats in accordance to iso8601 "+12:45"
2013
+ * @return {string}
2014
+ */
2015
+ $.timepicker.timezoneOffsetString = function (tzMinutes, iso8601) {
2016
+ if (isNaN(tzMinutes) || tzMinutes > 840 || tzMinutes < -720) {
2017
+ return tzMinutes;
2018
+ }
2019
+
2020
+ var off = tzMinutes,
2021
+ minutes = off % 60,
2022
+ hours = (off - minutes) / 60,
2023
+ iso = iso8601 ? ':' : '',
2024
+ tz = (off >= 0 ? '+' : '-') + ('0' + Math.abs(hours)).slice(-2) + iso + ('0' + Math.abs(minutes)).slice(-2);
2025
+
2026
+ if (tz === '+00:00') {
2027
+ return 'Z';
2028
+ }
2029
+ return tz;
2030
+ };
2031
+
2032
+ /**
2033
+ * Get the number in minutes that represents a timezone string
2034
+ * @param {string} tzString formatted like "+0500", "-1245", "Z"
2035
+ * @return {number} the offset minutes or the original string if it doesn't match expectations
2036
+ */
2037
+ $.timepicker.timezoneOffsetNumber = function (tzString) {
2038
+ var normalized = tzString.toString().replace(':', ''); // excuse any iso8601, end up with "+1245"
2039
+
2040
+ if (normalized.toUpperCase() === 'Z') { // if iso8601 with Z, its 0 minute offset
2041
+ return 0;
2042
+ }
2043
+
2044
+ if (!/^(\-|\+)\d{4}$/.test(normalized)) { // possibly a user defined tz, so just give it back
2045
+ return tzString;
2046
+ }
2047
+
2048
+ return ((normalized.substr(0, 1) === '-' ? -1 : 1) * // plus or minus
2049
+ ((parseInt(normalized.substr(1, 2), 10) * 60) + // hours (converted to minutes)
2050
+ parseInt(normalized.substr(3, 2), 10))); // minutes
2051
+ };
2052
+
2053
+ /**
2054
+ * No way to set timezone in js Date, so we must adjust the minutes to compensate. (think setDate, getDate)
2055
+ * @param {Date} date
2056
+ * @param {string} toTimezone formatted like "+0500", "-1245"
2057
+ * @return {Date}
2058
+ */
2059
+ $.timepicker.timezoneAdjust = function (date, toTimezone) {
2060
+ var toTz = $.timepicker.timezoneOffsetNumber(toTimezone);
2061
+ if (!isNaN(toTz)) {
2062
+ date.setMinutes(date.getMinutes() + -date.getTimezoneOffset() - toTz);
2063
+ }
2064
+ return date;
2065
+ };
2066
+
2067
+ /**
2068
+ * Calls `timepicker()` on the `startTime` and `endTime` elements, and configures them to
2069
+ * enforce date range limits.
2070
+ * n.b. The input value must be correctly formatted (reformatting is not supported)
2071
+ * @param {Element} startTime
2072
+ * @param {Element} endTime
2073
+ * @param {Object} options Options for the timepicker() call
2074
+ * @return {jQuery}
2075
+ */
2076
+ $.timepicker.timeRange = function (startTime, endTime, options) {
2077
+ return $.timepicker.handleRange('timepicker', startTime, endTime, options);
2078
+ };
2079
+
2080
+ /**
2081
+ * Calls `datetimepicker` on the `startTime` and `endTime` elements, and configures them to
2082
+ * enforce date range limits.
2083
+ * @param {Element} startTime
2084
+ * @param {Element} endTime
2085
+ * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
2086
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
2087
+ * @param {string} method Can be used to specify the type of picker to be added
2088
+ * @return {jQuery}
2089
+ */
2090
+ $.timepicker.datetimeRange = function (startTime, endTime, options) {
2091
+ $.timepicker.handleRange('datetimepicker', startTime, endTime, options);
2092
+ };
2093
+
2094
+ /**
2095
+ * Calls `datepicker` on the `startTime` and `endTime` elements, and configures them to
2096
+ * enforce date range limits.
2097
+ * @param {Element} startTime
2098
+ * @param {Element} endTime
2099
+ * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
2100
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
2101
+ * @return {jQuery}
2102
+ */
2103
+ $.timepicker.dateRange = function (startTime, endTime, options) {
2104
+ $.timepicker.handleRange('datepicker', startTime, endTime, options);
2105
+ };
2106
+
2107
+ /**
2108
+ * Calls `method` on the `startTime` and `endTime` elements, and configures them to
2109
+ * enforce date range limits.
2110
+ * @param {string} method Can be used to specify the type of picker to be added
2111
+ * @param {Element} startTime
2112
+ * @param {Element} endTime
2113
+ * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
2114
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
2115
+ * @return {jQuery}
2116
+ */
2117
+ $.timepicker.handleRange = function (method, startTime, endTime, options) {
2118
+ options = $.extend({}, {
2119
+ minInterval: 0, // min allowed interval in milliseconds
2120
+ maxInterval: 0, // max allowed interval in milliseconds
2121
+ start: {}, // options for start picker
2122
+ end: {} // options for end picker
2123
+ }, options);
2124
+
2125
+ // for the mean time this fixes an issue with calling getDate with timepicker()
2126
+ var timeOnly = false;
2127
+ if(method === 'timepicker'){
2128
+ timeOnly = true;
2129
+ method = 'datetimepicker';
2130
+ }
2131
+
2132
+ function checkDates(changed, other) {
2133
+ var startdt = startTime[method]('getDate'),
2134
+ enddt = endTime[method]('getDate'),
2135
+ changeddt = changed[method]('getDate');
2136
+
2137
+ if (startdt !== null) {
2138
+ var minDate = new Date(startdt.getTime()),
2139
+ maxDate = new Date(startdt.getTime());
2140
+
2141
+ minDate.setMilliseconds(minDate.getMilliseconds() + options.minInterval);
2142
+ maxDate.setMilliseconds(maxDate.getMilliseconds() + options.maxInterval);
2143
+
2144
+ if (options.minInterval > 0 && minDate > enddt) { // minInterval check
2145
+ endTime[method]('setDate', minDate);
2146
+ }
2147
+ else if (options.maxInterval > 0 && maxDate < enddt) { // max interval check
2148
+ endTime[method]('setDate', maxDate);
2149
+ }
2150
+ else if (startdt > enddt) {
2151
+ other[method]('setDate', changeddt);
2152
+ }
2153
+ }
2154
+ }
2155
+
2156
+ function selected(changed, other, option) {
2157
+ if (!changed.val()) {
2158
+ return;
2159
+ }
2160
+ var date = changed[method].call(changed, 'getDate');
2161
+ if (date !== null && options.minInterval > 0) {
2162
+ if (option === 'minDate') {
2163
+ date.setMilliseconds(date.getMilliseconds() + options.minInterval);
2164
+ }
2165
+ if (option === 'maxDate') {
2166
+ date.setMilliseconds(date.getMilliseconds() - options.minInterval);
2167
+ }
2168
+ }
2169
+
2170
+ if (date.getTime) {
2171
+ other[method].call(other, 'option', option, date);
2172
+ }
2173
+ }
2174
+
2175
+ $.fn[method].call(startTime, $.extend({
2176
+ timeOnly: timeOnly,
2177
+ onClose: function (dateText, inst) {
2178
+ checkDates($(this), endTime);
2179
+ },
2180
+ onSelect: function (selectedDateTime) {
2181
+ selected($(this), endTime, 'minDate');
2182
+ }
2183
+ }, options, options.start));
2184
+ $.fn[method].call(endTime, $.extend({
2185
+ timeOnly: timeOnly,
2186
+ onClose: function (dateText, inst) {
2187
+ checkDates($(this), startTime);
2188
+ },
2189
+ onSelect: function (selectedDateTime) {
2190
+ selected($(this), startTime, 'maxDate');
2191
+ }
2192
+ }, options, options.end));
2193
+
2194
+ checkDates(startTime, endTime);
2195
+
2196
+ selected(startTime, endTime, 'minDate');
2197
+ selected(endTime, startTime, 'maxDate');
2198
+
2199
+ return $([startTime.get(0), endTime.get(0)]);
2200
+ };
2201
+
2202
+ /**
2203
+ * Log error or data to the console during error or debugging
2204
+ * @param {Object} err pass any type object to log to the console during error or debugging
2205
+ * @return {void}
2206
+ */
2207
+ $.timepicker.log = function () {
2208
+ if (window.console) {
2209
+ window.console.log.apply(window.console, Array.prototype.slice.call(arguments));
2210
+ }
2211
+ };
2212
+
2213
+ /*
2214
+ * Add util object to allow access to private methods for testability.
2215
+ */
2216
+ $.timepicker._util = {
2217
+ _extendRemove: extendRemove,
2218
+ _isEmptyObject: isEmptyObject,
2219
+ _convert24to12: convert24to12,
2220
+ _detectSupport: detectSupport,
2221
+ _selectLocalTimezone: selectLocalTimezone,
2222
+ _computeEffectiveSetting: computeEffectiveSetting,
2223
+ _splitDateTime: splitDateTime,
2224
+ _parseDateTimeInternal: parseDateTimeInternal
2225
+ };
2226
+
2227
+ /*
2228
+ * Microsecond support
2229
+ */
2230
+ if (!Date.prototype.getMicroseconds) {
2231
+ Date.prototype.microseconds = 0;
2232
+ Date.prototype.getMicroseconds = function () { return this.microseconds; };
2233
+ Date.prototype.setMicroseconds = function (m) {
2234
+ this.setMilliseconds(this.getMilliseconds() + Math.floor(m / 1000));
2235
+ this.microseconds = m % 1000;
2236
+ return this;
2237
+ };
2238
+ }
2239
+
2240
+ /*
2241
+ * Keep up with the version
2242
+ */
2243
+ $.timepicker.version = "1.5.5";
2244
+
2245
+ }));
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/woo_ce-en_GB.mo ADDED
Binary file
languages/woo_ce-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
+
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,639 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === WooCommerce - Store Exporter ===
2
+
3
+ Contributors: visser, visser.labs
4
+ Donate link: https://www.visser.com.au/donations/
5
+ Tags: e-commerce, woocommerce, shop, cart, ecommerce, export, csv, xml, xls, xlsx, excel, customers, products, sales, orders, coupons, users, attributes, subscriptions
6
+ Requires at least: 2.9.2
7
+ Tested up to: 4.7.3
8
+ Stable tag: 1.9
9
+ License: GPLv2 or later
10
+
11
+ Export store details out of WooCommerce into simple formatted files (e.g. CSV, XML, Excel 2007, XLS, etc.).
12
+
13
+ == Description ==
14
+
15
+ Screen-loads of options and filters let you design advanced exports to suit your store requirements, or simply go with the default and click Export to produce concise, ready to use exports.
16
+
17
+ Store Exporter maintains compatibility with the latest WooCommerce updates receiving regular feature updates trusted by 20,000+ active users. Happy exporting!
18
+
19
+ = Features =
20
+
21
+ Features include:
22
+
23
+ * Export Products (*)
24
+ * Export Products by Product Category
25
+ * Export Products by Product Status
26
+ * Export Products by Type including Variations
27
+ * Export Categories
28
+ * Export Tags
29
+ * Export Brands (*)
30
+ * Export Orders (*)
31
+ * Export Orders by Order Status (*)
32
+ * Export Orders by Order Date (*)
33
+ * Export Orders by Customers (*)
34
+ * Export Orders by Coupon Code (*)
35
+ * Export Customers (*)
36
+ * Export Customers by Order Status (*)
37
+ * Export Users
38
+ * Export Coupons (*)
39
+ * Export Subscriptions (*)
40
+ * Export Commissions (*)
41
+ * Export Product Vendors (*)
42
+ * Export Shipping Classes (*)
43
+ * Export Attributes (*)
44
+ * Toggle and save export fields
45
+ * Field label editor (*)
46
+ * Works with WordPress Multisite
47
+ * Export to CSV file
48
+ * Export to TSV file (*)
49
+ * Export to XML file (*)
50
+ * Export to Excel 2007 (XLS) file (*)
51
+ * Export to Excel 2013 (XLSX) file (*)
52
+ * Export to WordPress Media
53
+ * Export to e-mail addresses (*)
54
+ * Export to remote POST (*)
55
+ * Export to remote FTP (*)
56
+ * Supports external CRON commands (*)
57
+ * Supports scheduled exports (*)
58
+
59
+ (*) Requires the Pro upgrade to enable additional store export functionality.
60
+
61
+ > ** Go Pro **
62
+ >
63
+ > 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/).
64
+ >
65
+ > 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/).
66
+
67
+ = Native integration with 50+ WooCommerce Plugins =
68
+
69
+ Just a few of the features unlocked in the Pro upgrade of Store Exporter include:
70
+
71
+ - Export All in One SEO Pack
72
+ - Export Advanced Google Product Feed
73
+ - Export Product Addons
74
+ - Export Sequential Order Number Pro
75
+ - Export Checkout Manager
76
+ - Export Checkout Manager Pro
77
+ - Export Checkout Field Editor
78
+ - Export Cost of Goods
79
+ - Export Per-Product Shipping
80
+ - Export Print Invoice & Delivery Note
81
+ - Export Local Pickups Plus
82
+ - Export WooCommerce Subscriptions
83
+ - Export Checkout Field Manager
84
+ - Export Currency Switcher
85
+ - Export WooCommerce PDF Invoices & Packing Slips
86
+ - Export WooCommerce Checkout Add-ons
87
+ - Export Product Vendors
88
+ - Export WooCommerce Jetpack
89
+ - Import fields for Product Importer Deluxe
90
+
91
+ ... and more free and Premium extensions for WooCommerce.
92
+
93
+ Want regular updates? Become a fan on Facebook!
94
+
95
+ http://www.facebook.com/visser.labs/
96
+
97
+ For more information visit: http://www.visser.com.au/woocommerce/
98
+
99
+ == Installation ==
100
+
101
+ 1. Upload the folder 'woocommerce-exporter' to the '/wp-content/plugins/' directory
102
+ 2. Activate 'WooCommerce - Store Exporter' through the 'Plugins' menu in WordPress
103
+
104
+ See Usage section before for instructions on how to generate export files.
105
+
106
+ == Usage ==
107
+
108
+ 1. Open WooCommerce > Store Export from the WordPress Administration
109
+ 2. Select the Export tab on the Store Exporter screen
110
+ 3. Select which export type and WooCommerce details you would like to export
111
+ 4. Click Export
112
+ 5. Download archived copies of previous exports from the Archives tab
113
+
114
+ Done!
115
+
116
+ == Support ==
117
+
118
+ If you have any problems, questions or suggestions please join the members discussion on our WooCommerce dedicated forum.
119
+
120
+ http://www.visser.com.au/woocommerce/forums/
121
+
122
+ == Screenshots ==
123
+
124
+ 1. The overview screen for Store Exporter.
125
+ 2. Select the data fields to be included in the export, selections are remembered for next export.
126
+ 3. Each dataset (e.g. Products, Orders, etc.) include filter options to filter by date, status, type, customer and more.
127
+ 4. A range of export options can be adjusted to suit different languages and file formatting requirements.
128
+ 5. Export a list of WooCommerce Product Categories into a CSV file.
129
+ 6. Export a list of WooCommerce Product Tags into a CSV file.
130
+ 7. Download archived copies of previous exports
131
+ 8. Use the Field Editor to relabel export fields to your preferred names
132
+ 9. Drag-and-drop export fields to your preferred ordering, sorting is saved between screen refreshes.
133
+
134
+ == Changelog ==
135
+
136
+ = 1.9 =
137
+ * Changed: Moved export type filters to their own files
138
+ * Fixed: Product file downloads not working (thanks @bulfa)
139
+
140
+ = 1.8.8 =
141
+ * Fixed: Missing WordPress SEO resource
142
+
143
+ = 1.8.7 =
144
+ * Fixed: Compatibility with WooCommerce 2.6.9
145
+
146
+ = 1.8.6 =
147
+ * Fixed: Product export failing due to incorrect token check
148
+ * Added: Modules filter support on Tools screen
149
+ * Fixed: Export of custom meta with an apostrophe in the meta name
150
+ * Fixed: Field type detection giving false positive for integers
151
+ * Changed: Button styling of Save Custom Fields
152
+ * Fixed: Update all export Attachments to Post Status private
153
+ * Added: Notice prompt when non-private export Attachments are detected
154
+ * Added: Dismiss option to override detection of non-private export Attachments
155
+ * Changed: Reduction in memory requirements for $export Global
156
+ * Changed: Translation set to woocommerce-exporter
157
+
158
+ = 1.8.5 =
159
+ * Changed: Enable Archives is disabled by default
160
+ * Added: %random% Tag to export filename for random number generation
161
+
162
+ = 1.8.4 =
163
+ * Fixed: Privilege escalation vulnerability (thanks jamesgol)
164
+
165
+ = 1.8.3 =
166
+ * Added: Notice when fatal error is encountered from memory/timeout
167
+ * Fixed: Default to Attribute Name if Label is empty
168
+ * Fixed: Export Product Attributes in Product export
169
+ * Added: Support for custom Attributes in Product export
170
+ * Added: Default Attributes to Product export
171
+ * Fixed: Attribute taxonomy missing from Order Items: Product Variation in WC 2.2+
172
+ * Added: Support for Ship to Multiple Address for Order export
173
+ * Fixed: Variables not being included in Product export when filtering by Categories/Tags/Brands/Vendors
174
+ * Added: Delete All archives button to Archives screen
175
+
176
+ = 1.8.2 =
177
+ * Added: Order support for Extra Product Options
178
+ * Fixed: Detect corrupted Date Format
179
+ * Added: Detection of corrupted WordPress options at export time
180
+ * Added: Total Sales to Products export
181
+ * Fixed: Advanced Google Product Feed not being included in Products export
182
+ * Added: Custom User meta to Customers export
183
+ * Added: Support for exporting Shipping Classes
184
+ * Changed: Product URL is now External URL
185
+ * Added: Product URL is the absolute URL to the Product
186
+ * Added: Support for custom User fields
187
+ * Fixed: Admin notice not showing for saving custom fields
188
+
189
+ = 1.8.1 =
190
+ * Adeded: Export modules to the Export screen
191
+
192
+ = 1.8 =
193
+ * Fixed: Up-sells formatting not saving between screen refreshes
194
+ * Fixed: Cross-sells formatting not saving between screen refreshes
195
+ * Fixed: PHP 5.2 compatibility for anonymous functions
196
+ * Added: Admin notice for PHP 5.2 users to update to supported releases of PHP
197
+
198
+ = 1.7.9 =
199
+ * Changed: Moved Up-sells formatting option to products.php
200
+ * Changed: Moved Cross-sells formatting option to products.php
201
+
202
+ = 1.7.8 =
203
+ * Added: Gravity Form ID to Orders export
204
+ * Added: Gravity Form Name to Orders export
205
+ * Added: Support for changing the export format of scheduled exports
206
+ * Fixed: Display of multiple queued Admin notices
207
+ * Fixed: PHP warning on Subscriptions export
208
+ * Fixed: Attributes showing Term Slug in Products export
209
+ * Fixed: Attributes not including Taxonomy based Terms in Products export
210
+ * Fixed: Empty export rows under certain environments in Products export
211
+ * Added: Support for filtering Orders by Order Dates for scheduled exports
212
+ * Fixed: Compatibility with WooCommerce 2.2+
213
+ * Changed: Moved Brands sorting to brands.php
214
+
215
+ = 1.7.7 =
216
+ * Added: Support for WooCommerce Checkout Add-ons in Orders export
217
+ * Fixed: Saving Export filename option over-sanitized
218
+
219
+ = 1.7.6 =
220
+ * Fixed: Limit volume for Users export
221
+ * Fixed: Offset for Users export
222
+ * Fixed: Sanitize form fields
223
+ * Fixed: Data validation on outputs
224
+ * Fixed: Saving of Order in Users export
225
+ * Fixed: Saving of Order By in Users export
226
+ * Fixed: Count of Customers for large store catalogues
227
+
228
+ = 1.7.5 =
229
+ * Fixed: Custom Product meta not working
230
+ * Changed: Moved Product Gallery support to Pro
231
+ * Changed: Moved Default e-mail recipient to General Settings
232
+ * Changed: Moved Default remote URL POST to General Settings
233
+ * Added: Export Users type in basic Store Exporter
234
+ * Fixed: Add missing WordPress options for Plugin if not present on activation
235
+
236
+ = 1.7.4 =
237
+ * Added: Subscriptions export type
238
+ * Added: Support for Subscription Key in Subscriptions export
239
+ * Added: Support for Subscription Status in Subscriptions export
240
+ * Added: Support for Subscription Name in Subscriptions export
241
+ * Added: Support for User in Subscriptions export
242
+ * Added: Support for User ID in Subscriptions export
243
+ * Added: Support for Order ID in Subscriptions export
244
+ * Added: Support for Order Status in Subscriptions export
245
+ * Added: Support for Post Status in Subscriptions export
246
+ * Added: Support for Start Date in Subscriptions export
247
+ * Added: Support for Expiration in Subscriptions export
248
+ * Added: Support for End Date in Subscriptions export
249
+ * Added: Support for Trial End Date in Subscriptions export
250
+ * Added: Support for Last Payment in Subscriptions export
251
+ * Added: Support for Next Payment in Subscriptions export
252
+ * Added: Support for Renewals in Subscriptions export
253
+ * Added: Support for Product ID in Subscriptions export
254
+ * Added: Support for Product SKU in Subscriptions export
255
+ * Added: Support for Variation ID in Subscriptions export
256
+ * Added: Support for Coupon Code in Subscription export
257
+ * Added: Support for Limit Volume in Subscription export
258
+
259
+ = 1.7.3 =
260
+ * Added: Export type is remembered between screen refreshes
261
+ * Changed: Moved Product Sorting widget to products.php
262
+ * Changed: Moved Filter Products by Product Category widget to products.php
263
+ * Changed: Moved Filter Products by Product Tag widget to products.php
264
+ * Changed: Moved Filter Products by Product Status widget to products.php
265
+
266
+ = 1.7.2 =
267
+ * Fixed: Check for wc_format_localized_price() in older releases of WooCommerce
268
+ * Added: Brands export type
269
+ * Added: Support for Brand Name in Brands export
270
+ * Added: Support for Brand Description in Brands export
271
+ * Added: Support for Brand Slug in Brands export
272
+ * Added: Support for Parent ID in Brands export
273
+ * Added: Support for Brand Image in Brands export
274
+ * Added: Support for sorting options in Brands export
275
+ * Fixed: Added checks for 3rd party classes and legacy WooCommerce functions for 2.0.20
276
+ * Added: Support for Category Description in Categories export
277
+ * Added: Support for Category Image in Categories export
278
+ * Added: Support for Display Type in Categories export
279
+
280
+ = 1.7.1 =
281
+ * Added: Brands support to Orders export
282
+ * Added: Brands support for Order Items in Orders export
283
+ * Fixed: PHP warning notice in Orders export
284
+ * Added: Option to filter different Order Items types from Orders export
285
+
286
+ = 1.7 =
287
+ * Added: Rename of export files across Plugin
288
+ * Added: Coupon Code to Orders export
289
+ * Added: Export Users
290
+ * Added: Support for User ID in Users export
291
+ * Added: Support for Username in Users export
292
+ * Added: Support for User Role in Users export
293
+ * Added: Support for First Name in Users export
294
+ * Added: Support for Last Name in Users export
295
+ * Added: Support for Full Name in Users export
296
+ * Added: Support for Nickname in Users export
297
+ * Added: Support for E-mail in Users export
298
+ * Added: Support for Website in Users export
299
+ * Added: Support for Date Registered in Users export
300
+ * Added: Support for WooCommerce User Profile fields in Users export
301
+ * Added: Product Gallery formatting support includes Media URL
302
+ * Added: Sorting support for Users export
303
+ * Added: Sorting options for Coupons
304
+ * Added: Filter Orders by Coupon Codes
305
+
306
+ = 1.6.2 =
307
+ * Added: MSRP Pricing support for Products
308
+ * Added: WooCommerce Print Invoice & Delivery Note Invoice Number support for Orders
309
+ * Added: WooCommerce Sequential Order Numbers (free) support for Orders
310
+ * Changed: Get 3rd Party Plugin support from woo_ce_product_fields filter
311
+ * Changed: Preparations for sortable export column
312
+ * Fixed: URL to Add New export button after empty export
313
+ * Added: jQuery checks for functions before running
314
+ * Fixed: Conflicts with other WooCommerce Plugins due to shared 'save' form action
315
+ * Fixed: Support for WooCommerce Checkout Manager (Free!)
316
+ * Added: Support for WooCommerce Checkout Manager Pro
317
+ * Added: Support for Currency Switcher in Orders export
318
+ * Added: Support for Checkout Field Editor
319
+
320
+ = 1.6.1 =
321
+ * Fixed: Empty exports
322
+ * Changed: Better detection of empty exports
323
+ * Changed: Better detection of empty data types
324
+ * Added: Customer Filter to Export screen
325
+ * Added: Filter Customers by Order Status option
326
+ * Added: Using is_wp_error() throughout CPT and Term requests
327
+
328
+ = 1.6 =
329
+ * Fixed: Coupon export as XML
330
+ * Fixed: Order export as XML
331
+ * Fixed: Customer export as XML
332
+ * Fixed: Compatibility with WordPress 3.9.1
333
+ * Added: Product export support for Advanced Google Product Feed
334
+ * Added: Product export support for All in One SEO Pack
335
+ * Added: Product export support for WordPress SEO
336
+ * Added: Product export support for Ultimate SEO
337
+ * Fixed: Fatal error affecting CRON export for XML export
338
+ * Fixed: Remember column options after exporting Orders
339
+
340
+ = 1.5.9 =
341
+ * Fixed: Clearing the Limit Volume or Offset values would not be saved
342
+ * Fixed: Force file extension if removed from the Filename option on Settings screen
343
+ * Changed: Reduced memory load by storing $args in $export global
344
+
345
+ = 1.5.8 =
346
+ * Fixed: Fatal error if Store Exporter is not activated
347
+
348
+ = 1.5.7 =
349
+ * Changed: Replaced woo_ce_save_csv_file_attachment() with generic woo_ce_save_file_attachment()
350
+ * Changed: Replaced woo_ce_save_csv_file_guid() with generic woo_ce_save_file_guid()
351
+ * Changed: Replaced woo_ce_save_csv_file_details() with generic woo_ce_save_file_details()
352
+ * Changed: Replaced woo_ce_update_csv_file_detail() with generic woo_ce_update_file_detail()
353
+ * Changed: Moved woo_ce_save_file_details() into common Plugin space
354
+ * Changed: Added third allow_empty property to custom get_option()
355
+
356
+ = 1.5.6 =
357
+ * Added: Disabled support for XML Export Format under Export Option
358
+ * Changed: Created new functions-csv.php file
359
+ * Changed: Moved woo_ce_generate_csv_filename() to functions-csv.php
360
+ * Changed: Moved woo_ce_generate_csv_header() to functions-csv.php
361
+
362
+ = 1.5.5 =
363
+ * Fixed: Export error prompt displaying due to WordPress transient
364
+
365
+ = 1.5.4 =
366
+ * Changed: Removed WooCommere Plugins dashboard widget
367
+ * Added: CSS class to Custom Product Fields
368
+ * Fixed: Broken export checks that may affect export options
369
+
370
+ = 1.5.3 =
371
+ * Added: Support for exporting Local Pickup Plus fields in Orders
372
+ * Fixed: Memory leak in woo_ce_expand_state_name
373
+ * Fixed: Memory leak in woo_ce_expand_country_name
374
+ * Changed: Removed duplicate Order Items: Type field
375
+ * Added: Disabled Custom Order Fields widget to Export screen
376
+ * Changed: Using WP_Query instead of get_posts for bulk export
377
+ * Changed: Cross-Sells and Up-Sells get their own formatting functions
378
+ * Changed: Moved export function into common space for CRON and scheduled exports
379
+ * Added: Toggle visibility of each export types fields within Export Options
380
+
381
+ = 1.5.2 =
382
+ * Added: Option for Up-Sells to export Product SKU instead of Product ID
383
+ * Added: Option for Cross-Sells to export Product SKU instead of Product ID
384
+ * Changed: Toggle visibility of dataset relevant export options
385
+ * Changed: Moved Field delimiter option to Settings tab
386
+ * Changed: Moved Category separator option to Settings tab
387
+ * Changed: Moved Add BOM character option to Settings tab
388
+ * Changed: Moved Character encoding option to Settings tab
389
+ * Changed: Moved Field escape formatting option to Settings tab
390
+ * Changed: Moved Order Item Formatting option to Export Options widget
391
+ * Changed: Combined Volume offset and Limit volume
392
+ * Added: Skip Overview screen option to Overview screen
393
+
394
+ = 1.5.1 =
395
+ * Fixed: CSV File not being displayed on Media screen
396
+ * Added: Download Type support to Products export
397
+ * Fixed: File Download support for WooCommerce 2.0+
398
+ * Changed: Legacy support for File Download export support in pre-WooCommerce 2.0
399
+ * Changed: An empty weight/height/width/length will make the dimension unit empty
400
+ * Added: Setttings tab for managing global export settings
401
+ * Added: Custom export filename support with variables: %store_name%, %dataset%, %date%, %time%
402
+ * Changed: Moved Date Format option to Settings tab
403
+ * Changed: Moved Max unique Order items option to Settings tab
404
+ * Changed: Moved Enable Archives options to Settings tab
405
+ * Changed: Removed Manage Custom Product Fields link from Export Options
406
+ * Changed: Moved Script Timeout option to Settings tab
407
+
408
+ = 1.5 =
409
+ * Added: Menu Order to Products export
410
+ * Changed: Comment Status to Enable Reviews in Products export
411
+
412
+ = 1.4.9 =
413
+ * Added: Order Items: Category and Order Items: Tag to Orders export
414
+ * Added: Clicking an export type from the opening screen will open that export tab
415
+
416
+ = 1.4.8 =
417
+ * Changed: Dropped $woo_ce global
418
+ * Added: Using Plugin constants
419
+ * Changed: Moved debug log to WordPress transient
420
+ * Added: Disabled Custom Product Fields dialog
421
+ * Changed: Removed duplicate Sale Price from Product export
422
+ * Fixed: Empty Parent SKU and Product SKU for Product Variations
423
+ * Fixed: Fill default Stock Status for Products
424
+ * Fixed: Set Product Type to Simple Product by default
425
+ * Added: Error notice after blank screen on export
426
+ * Fixed: Product Categories empty for Variations in Product export
427
+
428
+ = 1.4.7 =
429
+ * Fixed: Multi-site support resolved
430
+ * Changed: Permanently delete failed exports
431
+
432
+ = 1.4.6 =
433
+ * Fixed: Blank screen on export in some instances
434
+ * Changed: Removed legacy progress bar
435
+ * Changed: Removed legacy Javascript in export screen
436
+ * Added: Admin notice confirming deleted archive file
437
+ * Changed: Removed bold headings from admin notices
438
+ * Added: Error notice to explain blank CSV
439
+ * Changed: Renamed "Delete temporary CSV after download" to "Enable Archives"
440
+ * Changed: Removed woo_ce_unload_export_global()
441
+ * Fixed: Delete WordPress Media on failed export
442
+ * Added: Link to Usage document when an error is encountered "Need help?"
443
+ * Changed: Using 'export' capability check for Store Export menu
444
+ * Changed: Using 'update_plugins' capability check for Jigoshop Plugins Dashboard widget (thanks Marcus!)
445
+
446
+ = 1.4.5 =
447
+ * Added: Custom Product fields
448
+ * Added: Memory optimisations for get_posts()
449
+ * Changed: Standard admin notices
450
+
451
+ = 1.4.4 =
452
+ * Changed: Default Date Format to d/m/Y
453
+
454
+ = 1.4.3 =
455
+ * Fixed: Export Orders by User Role
456
+ * Added: Formatting of User Role
457
+
458
+ = 1.4.2 =
459
+ * Added: Product Published and Product Modified dates to Products export
460
+ * Added: Date formatting independant of WordPress > Settings > General
461
+
462
+ = 1.4.1 =
463
+ * Fixed: Default file encoding can trigger PHP warning
464
+ * Added: File encoding support for Categories and Tags
465
+ * Added: Product Tags sorting export support
466
+ * Added: Category sorting export support
467
+ * Added: Separate files for each dataset
468
+
469
+ = 1.4 =
470
+ * Added: File encoding for datasets
471
+ * Changed: Default file encoding to UTF-8
472
+ * Added: Product sorting and ordering
473
+ * Changed: Ordering of Export Options
474
+
475
+ = 1.3.9 =
476
+ * Added: Payment Gateway ID to Orders export
477
+ * Added: Shipping Method ID to Orders export
478
+ * Added: Shipping Cost to Orders export
479
+ * Added: Checkout IP Address to Orders export
480
+ * Added: User Role to Orders export
481
+ * Changed: Removed encoding changes to Description and Excerpt
482
+
483
+ = 1.3.8 =
484
+ * Fixed: PHP 4 notices for File Encoding dropdown
485
+ * Fixed: Translation string on Export screen
486
+ * Added: WordPress get_posts() optimisation
487
+ * Fixed: Ignore Variant Products without Base Products (ala 'phantom Posts')
488
+
489
+ = 1.3.7 =
490
+ * Added: Additional Category column support
491
+ * Added: Additional Tag column support
492
+ * Fixed: HTML entities now print in plain-text
493
+
494
+ = 1.3.6 =
495
+ * Fixed: PHP error for missing function within Store Exporter Deluxe
496
+
497
+ = 1.3.5 =
498
+ * Fixed: Admin icon on Store Exporter screen
499
+ * Fixed: PHP error on Store Exporter screen without Products
500
+ * Changed: Moved CSV File dialog on Media screen to template file
501
+
502
+ = 1.3.4 =
503
+ * Added: Total incl. GST
504
+ * Added: Total excl. GST
505
+ * Added: Purchase Time
506
+ * Changed: Moved woo_ce_count_object() to formatting.php
507
+ * Added: Commenting to each function
508
+ * Fixed: PHP 4 support for missing mb_list_encodings()
509
+
510
+ = 1.3.3 =
511
+ * Added: New Product filter 'woo_ce_product_item'
512
+
513
+ = 1.3.2 =
514
+ * Fixed: Order Notes on Orders export
515
+
516
+ = 1.3.1 =
517
+ * Added: Link to submit additional fields
518
+
519
+ = 1.3 =
520
+ * Changed: Using manage_woocommerce instead of manage_options for permission check
521
+ * Changed: Removed woo_is_admin_valid_icon
522
+ * Changed: Using default WooCommerce icons
523
+
524
+ = 1.2.9 =
525
+ * Fixed: Urgent fix for duplicate formatting function
526
+
527
+ = 1.2.8 =
528
+ * Added: Product ID support
529
+ * Added: Post Parent ID support
530
+ * Added: Export Product variation support
531
+ * Added: Product Attribute support
532
+ * Added: Filter Products export by Type
533
+ * Added: Sale Price Dates From/To support
534
+ * Added: Virtual and Downloadable Product support
535
+ * Added: Remove archived export
536
+ * Added: Count and filter of archived exports
537
+ * Fixed: Hide User ID 0 (guest) from Orders
538
+
539
+ = 1.2.7 =
540
+ * Added: jQuery Chosen support to Orders Customer dropdown
541
+ * Fixed: Incorrect counts on some Export types
542
+
543
+ = 1.2.6 =
544
+ * Added: Product Type support
545
+ * Added: Native jQuery UI support
546
+ * Fixed: Various small bugs
547
+
548
+ = 1.2.5 =
549
+ * Added: Featured Image support
550
+
551
+ = 1.2.3 =
552
+ * Fixed: Tags export
553
+ * Added: Export Products by Product Tag filter
554
+ * Added: Notice for empty export files
555
+ * Changed: UI changes to Filter dialogs
556
+
557
+ = 1.2.2 =
558
+ * Changed: Free version can see Order, Coupon and Customer export options
559
+ * Added: Plugin screenshots
560
+
561
+ = 1.2.1 =
562
+ * Added: Support for BOM
563
+ * Added: Escape field formatting option
564
+ * Added: New line support
565
+ * Added: Payment Status (number) option
566
+
567
+ = 1.2 =
568
+ * Fixed: Surplus cell separator at end of lines
569
+ * Added: Remember field selections
570
+
571
+ = 1.1.1 =
572
+ * Added: Expiry Date support to Coupons
573
+ * Added: Individual Use to Coupons
574
+ * Added: Apply before tax to Coupons
575
+ * Added: Exclude sale items to Coupons
576
+ * Added: Expiry Date to Coupons
577
+ * Added: Minimum Amount to Coupons
578
+ * Added: Exclude Product ID's to Coupons
579
+ * Added: Product Categories to Coupons
580
+ * Added: Exclude Product Categories to Coupons
581
+ * Added: Usage Limit to Coupons
582
+ * Fixed: Customers count causing memory error
583
+ * Added: Formatting of 'on' and 'off' values
584
+ * Changed: Memory overrides
585
+
586
+ = 1.1.0 =
587
+ * Added: Save option for delimiter
588
+ * Added: Save option for category separator
589
+ * Added: Save options for limit volume
590
+ * Added: Save options for offset
591
+ * Added: Save options for timeout
592
+
593
+ = 1.0.9 =
594
+ * Fixed: Export buttons not adjusting Export Dataset
595
+ * Added: Select All options to Export
596
+ * Added: Partial export support
597
+ * Changed: Integration with Exporter Deluxe
598
+
599
+ = 1.0.8 =
600
+ * Added: Integration with Exporter Deluxe
601
+
602
+ = 1.0.7 =
603
+ * Fixed: Excerpt/Product Short description
604
+
605
+ = 1.0.6 =
606
+ * Changed: Options engine
607
+ * Changed: Moved styles to admin_enqueue_scripts
608
+ * Added: Coupons support
609
+
610
+ = 1.0.5 =
611
+ * Fixed: Template header bug
612
+ * Added: Tabbed viewing on the Exporter screen
613
+ * Added: Export Orders
614
+ * Added: Product columns
615
+ * Added: Order columns
616
+ * Added: Category heirachy support (up to 3 levels deep)
617
+ * Fixed: Foreign character support
618
+ * Changed: More efficient Tag generation
619
+ * Fixed: Link error on Export within Plugin screen
620
+
621
+ = 1.0.4 =
622
+ * Added: Duplicate e-mail address filtering
623
+ * Changed: Updated readme.txt
624
+
625
+ = 1.0.3 =
626
+ * Added: Support for Customers
627
+
628
+ = 1.0.2 =
629
+ * Changed: Migrated to WordPress Extend
630
+
631
+ = 1.0.1 =
632
+ * Fixed: Dashboard widget not loading
633
+
634
+ = 1.0 =
635
+ * Added: First working release of the Plugin
636
+
637
+ == Disclaimer ==
638
+
639
+ 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,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 p.warning {
80
+ color:red;
81
+ }
82
+ #woo-ce .advanced-settings {
83
+ display:none;
84
+ }
85
+ #woo-ce .advanced-settings ul {
86
+ list-style-type:disc;
87
+ }
88
+ #woo-ce .export_method_options li.ftp-options label {
89
+ display:inline-block;
90
+ width:120px;
91
+ }
92
+ #woo-ce .export_method_options li.ftp-options select {
93
+ width: 25em;
94
+ }
95
+
96
+ /* Support - Donate / Rate */
97
+
98
+ #woo-ce .support-donate_rate {
99
+ display:block;
100
+ }
101
+ #woo-ce .support-donate_rate p {
102
+ margin-top:16px;
103
+ }
104
+ #woo-ce .support-donate_rate .star {
105
+ vertical-align:bottom;
106
+ display:inline-block;
107
+ width:17px;
108
+ height:17px;
109
+ background:url('images/star.png') no-repeat;
110
+ }
111
+ #woo-ce .support-donate_rate span {
112
+ display:none;
113
+ }
templates/admin/export.js ADDED
@@ -0,0 +1,535 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 element
19
+ if( $j.isFunction($j.fn.datetimepicker) ) {
20
+ var timezone = new Date(new Date().getTime());
21
+ $j('.datetimepicker').datetimepicker({
22
+ dateFormat: 'dd/mm/yy',
23
+ timeFormat: 'HH:mm',
24
+ controlType: 'select',
25
+ minDate: timezone,
26
+ showTimezone: false,
27
+ showSecond: false
28
+ });
29
+ }
30
+
31
+ // Order Dates
32
+ $j('input[name="order_dates_filter_variable"],select[name="order_dates_filter_variable_length"]').click(function () {
33
+ $j('input:radio[name="order_dates_filter"][value="variable"]').prop( 'checked', true );
34
+ });
35
+
36
+ // Chosen dropdown element
37
+ if( $j.isFunction($j.fn.chosen) ) {
38
+ $j(".chzn-select").chosen({
39
+ search_contains: true,
40
+ width: "95%"
41
+ });
42
+ }
43
+
44
+ // Sortable export columns
45
+ if( $j.isFunction($j.fn.sortable) ) {
46
+ $j('table.ui-sortable').sortable({
47
+ items:'tr',
48
+ cursor:'move',
49
+ axis:'y',
50
+ handle: 'td',
51
+ scrollSensitivity:40,
52
+ helper:function(e,ui){
53
+ ui.children().each(function(){
54
+ jQuery(this).width(jQuery(this).width());
55
+ });
56
+ ui.css('left', '0');
57
+ return ui;
58
+ },
59
+ start:function(event,ui){
60
+ ui.item.css('background-color','#f6f6f6');
61
+ },
62
+ stop:function(event,ui){
63
+ ui.item.removeAttr('style');
64
+ field_row_indexes(this);
65
+ }
66
+ });
67
+
68
+ function field_row_indexes(obj) {
69
+ rows = $j(obj).find('tr');
70
+ $j(rows).each(function(index, el){
71
+ $j('input.field_order', el).val( parseInt( $j(el).index() ) );
72
+ });
73
+ };
74
+ }
75
+
76
+ // Select all field options for this export type
77
+ $j('.checkall').click(function () {
78
+ $j(this).closest('.postbox').find(':checkbox').attr('checked', true);
79
+ });
80
+
81
+ // Unselect all field options for this export type
82
+ $j('.uncheckall').click(function () {
83
+ $j(this).closest('.postbox').find(':checkbox').attr('checked', false);
84
+ });
85
+
86
+ // Reset sorting of fields for this export type
87
+ $j('.resetsorting').click(function () {
88
+ var type = $j(this).attr('id');
89
+ var type = type.replace('-resetsorting','');
90
+ for(i=0; i<$j('#' + type + '-fields tr').length; i++){
91
+ $j('#' + type + '-' + i).appendTo('#' + type + '-fields');
92
+ }
93
+ field_row_indexes($j('#' + type + '-fields'));
94
+ });
95
+
96
+ $j('.export-types').hide();
97
+ $j('.export-options').hide();
98
+
99
+ // Categories
100
+ $j('#export-products-filters-categories').hide();
101
+ if( $j('#products-filters-categories').attr('checked') ) {
102
+ $j('#export-products-filters-categories').show();
103
+ }
104
+ // Tags
105
+ $j('#export-products-filters-tags').hide();
106
+ if( $j('#products-filters-tags').attr('checked') ) {
107
+ $j('#export-products-filters-tags').show();
108
+ }
109
+ // Brands
110
+ $j('#export-products-filters-brands').hide();
111
+ if( $j('#products-filters-brands').attr('checked') ) {
112
+ $j('#export-products-filters-brands').show();
113
+ }
114
+ // Product Vendors
115
+ $j('#export-products-filters-vendors').hide();
116
+ if( $j('#products-filters-vendors').attr('checked') ) {
117
+ $j('#export-products-filters-vendors').show();
118
+ }
119
+ // Product Status
120
+ $j('#export-products-filters-status').hide();
121
+ if( $j('#products-filters-status').attr('checked') ) {
122
+ $j('#export-products-filters-status').show();
123
+ }
124
+ // Type
125
+ $j('#export-products-filters-type').hide();
126
+ if( $j('#products-filters-type').attr('checked') ) {
127
+ $j('#export-products-filters-type').show();
128
+ }
129
+ // Stock
130
+ $j('#export-products-filters-stock').hide();
131
+ if( $j('#products-filters-stock').attr('checked') ) {
132
+ $j('#export-products-filters-stock').show();
133
+ }
134
+
135
+ $j('#export-category').hide();
136
+
137
+ $j('#export-tag').hide();
138
+
139
+ $j('#export-brand').hide();
140
+
141
+ $j('#export-order').hide();
142
+ // Order Status
143
+ $j('#export-orders-filters-status').hide();
144
+ if( $j('#orders-filters-status').attr('checked') ) {
145
+ $j('#export-orders-filters-status').show();
146
+ }
147
+ // Order Date
148
+ $j('#export-orders-filters-date').hide();
149
+ if( $j('#orders-filters-date').attr('checked') ) {
150
+ $j('#export-orders-filters-date').show();
151
+ }
152
+ // Customer
153
+ $j('#export-orders-filters-customer').hide();
154
+ if( $j('#orders-filters-customer').attr('checked') ) {
155
+ $j('#export-orders-filters-customer').show();
156
+ }
157
+ // Billing Country
158
+ $j('#export-orders-filters-billing_country').hide();
159
+ if( $j('#orders-filters-billing_country').attr('checked') ) {
160
+ $j('#export-orders-filters-billing_country').show();
161
+ }
162
+ // Shipping Country
163
+ $j('#export-orders-filters-shipping_country').hide();
164
+ if( $j('#orders-filters-shipping_country').attr('checked') ) {
165
+ $j('#export-orders-filters-shipping_country').show();
166
+ }
167
+ // User Role
168
+ $j('#export-orders-filters-user_role').hide();
169
+ if( $j('#orders-filters-user_role').attr('checked') ) {
170
+ $j('#export-orders-filters-user_role').show();
171
+ }
172
+ // Coupon Code
173
+ $j('#export-orders-filters-coupon').hide();
174
+ if( $j('#orders-filters-coupon').attr('checked') ) {
175
+ $j('#export-orders-filters-coupon').show();
176
+ }
177
+ // Products
178
+ $j('#export-orders-filters-product').hide();
179
+ if( $j('#orders-filters-product').attr('checked') ) {
180
+ $j('#export-orders-filters-product').show();
181
+ }
182
+ // Categories
183
+ $j('#export-orders-filters-category').hide();
184
+ if( $j('#orders-filters-category').attr('checked') ) {
185
+ $j('#export-orders-filters-category').show();
186
+ }
187
+ // Tags
188
+ $j('#export-orders-filters-tag').hide();
189
+ if( $j('#orders-filters-tag').attr('checked') ) {
190
+ $j('#export-orders-filters-tag').show();
191
+ }
192
+ // Brands
193
+ $j('#export-orders-filters-brand').hide();
194
+ if( $j('#orders-filters-brand').attr('checked') ) {
195
+ $j('#export-orders-filters-brand').show();
196
+ }
197
+ // Order ID
198
+ $j('#export-orders-filters-id').hide();
199
+ if( $j('#orders-filters-id').attr('checked') ) {
200
+ $j('#export-orders-filters-id').show();
201
+ }
202
+ // Payment Gateway
203
+ $j('#export-orders-filters-payment_gateway').hide();
204
+ if( $j('#orders-filters-payment_gateway').attr('checked') ) {
205
+ $j('#export-orders-filters-payment_gateway').show();
206
+ }
207
+ // Payment Gateway
208
+ $j('#export-orders-filters-shipping_method').hide();
209
+ if( $j('#orders-filters-shipping_method').attr('checked') ) {
210
+ $j('#export-orders-filters-shipping_method').show();
211
+ }
212
+
213
+ // Order Status
214
+ $j('#export-customers-filters-status').hide();
215
+ if( $j('#customers-filters-status').attr('checked') ) {
216
+ $j('#export-customers-filters-status').show();
217
+ }
218
+ // User Role
219
+ $j('#export-customers-filters-user_role').hide();
220
+ if( $j('#customers-filters-user_role').attr('checked') ) {
221
+ $j('#export-customers-filters-user_role').show();
222
+ }
223
+
224
+ // Subscription Status
225
+ $j('#export-subscriptions-filters-status').hide();
226
+ if( $j('#subscriptions-filters-status').attr('checked') ) {
227
+ $j('#export-subscriptions-filters-status').show();
228
+ }
229
+ // Subscription Product
230
+ $j('#export-subscriptions-filters-product').hide();
231
+ if( $j('#subscriptions-filters-product').attr('checked') ) {
232
+ $j('#export-subscriptions-filters-product').show();
233
+ }
234
+
235
+ // Order Date
236
+ $j('#export-commissions-filters-date').hide();
237
+ if( $j('#commissions-filters-date').attr('checked') ) {
238
+ $j('#export-commissions-filters-date').show();
239
+ }
240
+ // Product Vendor
241
+ $j('#export-commissions-filters-product_vendor').hide();
242
+ if( $j('#commissions-filters-product_vendor').attr('checked') ) {
243
+ $j('#export-commissions-filters-product_vendor').show();
244
+ }
245
+ // Commission Status
246
+ $j('#export-commissions-filters-commission_status').hide();
247
+ if( $j('#commissions-filters-commission_status').attr('checked') ) {
248
+ $j('#export-commissions-filters-commission_status').show();
249
+ }
250
+
251
+ $j('#export-customer').hide();
252
+ $j('#export-user').hide();
253
+ $j('#export-coupon').hide();
254
+ $j('#export-subscription').hide();
255
+ $j('#export-product_vendor').hide();
256
+ $j('#export-commission').hide();
257
+ $j('#export-shipping_class').hide();
258
+ $j('#export-attribute').hide();
259
+
260
+ $j('#products-filters-categories').click(function(){
261
+ $j('#export-products-filters-categories').toggle();
262
+ });
263
+ $j('#products-filters-tags').click(function(){
264
+ $j('#export-products-filters-tags').toggle();
265
+ });
266
+ $j('#products-filters-brands').click(function(){
267
+ $j('#export-products-filters-brands').toggle();
268
+ });
269
+ $j('#products-filters-vendors').click(function(){
270
+ $j('#export-products-filters-vendors').toggle();
271
+ });
272
+ $j('#products-filters-status').click(function(){
273
+ $j('#export-products-filters-status').toggle();
274
+ });
275
+ $j('#products-filters-type').click(function(){
276
+ $j('#export-products-filters-type').toggle();
277
+ });
278
+ $j('#products-filters-stock').click(function(){
279
+ $j('#export-products-filters-stock').toggle();
280
+ });
281
+
282
+ $j('#orders-filters-date').click(function(){
283
+ $j('#export-orders-filters-date').toggle();
284
+ });
285
+ $j('#orders-filters-status').click(function(){
286
+ $j('#export-orders-filters-status').toggle();
287
+ });
288
+ $j('#orders-filters-customer').click(function(){
289
+ $j('#export-orders-filters-customer').toggle();
290
+ });
291
+ $j('#orders-filters-billing_country').click(function(){
292
+ $j('#export-orders-filters-billing_country').toggle();
293
+ });
294
+ $j('#orders-filters-shipping_country').click(function(){
295
+ $j('#export-orders-filters-shipping_country').toggle();
296
+ });
297
+ $j('#orders-filters-user_role').click(function(){
298
+ $j('#export-orders-filters-user_role').toggle();
299
+ });
300
+ $j('#orders-filters-coupon').click(function(){
301
+ $j('#export-orders-filters-coupon').toggle();
302
+ });
303
+ $j('#orders-filters-product').click(function(){
304
+ $j('#export-orders-filters-product').toggle();
305
+ });
306
+ $j('#orders-filters-category').click(function(){
307
+ $j('#export-orders-filters-category').toggle();
308
+ });
309
+ $j('#orders-filters-tag').click(function(){
310
+ $j('#export-orders-filters-tag').toggle();
311
+ });
312
+ $j('#orders-filters-brand').click(function(){
313
+ $j('#export-orders-filters-brand').toggle();
314
+ });
315
+ $j('#orders-filters-id').click(function(){
316
+ $j('#export-orders-filters-id').toggle();
317
+ });
318
+ $j('#orders-filters-payment_gateway').click(function(){
319
+ $j('#export-orders-filters-payment_gateway').toggle();
320
+ });
321
+ $j('#orders-filters-shipping_method').click(function(){
322
+ $j('#export-orders-filters-shipping_method').toggle();
323
+ });
324
+
325
+ $j('#customers-filters-status').click(function(){
326
+ $j('#export-customers-filters-status').toggle();
327
+ });
328
+ $j('#customers-filters-user_role').click(function(){
329
+ $j('#export-customers-filters-user_role').toggle();
330
+ });
331
+
332
+ $j('#subscriptions-filters-status').click(function(){
333
+ $j('#export-subscriptions-filters-status').toggle();
334
+ });
335
+ $j('#subscriptions-filters-product').click(function(){
336
+ $j('#export-subscriptions-filters-product').toggle();
337
+ });
338
+
339
+ $j('#commissions-filters-date').click(function(){
340
+ $j('#export-commissions-filters-date').toggle();
341
+ });
342
+ $j('#commissions-filters-product_vendor').click(function(){
343
+ $j('#export-commissions-filters-product_vendor').toggle();
344
+ });
345
+ $j('#commissions-filters-commission_status').click(function(){
346
+ $j('#export-commissions-filters-commission_status').toggle();
347
+ });
348
+
349
+ // Export types
350
+ $j('#product').click(function(){
351
+ $j('.export-types').hide();
352
+ $j('#export-product').show();
353
+
354
+ $j('.export-options').hide();
355
+ $j('.product-options').show();
356
+ });
357
+ $j('#category').click(function(){
358
+ $j('.export-types').hide();
359
+ $j('#export-category').show();
360
+
361
+ $j('.export-options').hide();
362
+ $j('.category-options').show();
363
+ });
364
+ $j('#tag').click(function(){
365
+ $j('.export-types').hide();
366
+ $j('#export-tag').show();
367
+
368
+ $j('.export-options').hide();
369
+ $j('.tag-options').show();
370
+ });
371
+ $j('#brand').click(function(){
372
+ $j('.export-types').hide();
373
+ $j('#export-brand').show();
374
+
375
+ $j('.export-options').hide();
376
+ $j('.brand-options').show();
377
+ });
378
+ $j('#order').click(function(){
379
+ $j('.export-types').hide();
380
+ $j('#export-order').show();
381
+
382
+ $j('.export-options').hide();
383
+ $j('.order-options').show();
384
+ });
385
+ $j('#customer').click(function(){
386
+ $j('.export-types').hide();
387
+ $j('#export-customer').show();
388
+
389
+ $j('.export-options').hide();
390
+ $j('.customer-options').show();
391
+ });
392
+ $j('#user').click(function(){
393
+ $j('.export-types').hide();
394
+ $j('#export-user').show();
395
+
396
+ $j('.export-options').hide();
397
+ $j('.user-options').show();
398
+ });
399
+ $j('#coupon').click(function(){
400
+ $j('.export-types').hide();
401
+ $j('#export-coupon').show();
402
+
403
+ $j('.export-options').hide();
404
+ $j('.coupon-options').show();
405
+ });
406
+ $j('#subscription').click(function(){
407
+ $j('.export-types').hide();
408
+ $j('#export-subscription').show();
409
+
410
+ $j('.export-options').hide();
411
+ $j('.subscription-options').show();
412
+ });
413
+ $j('#product_vendor').click(function(){
414
+ $j('.export-types').hide();
415
+ $j('#export-product_vendor').show();
416
+
417
+ $j('.export-options').hide();
418
+ $j('.product_vendor-options').show();
419
+ });
420
+ $j('#commission').click(function(){
421
+ $j('.export-types').hide();
422
+ $j('#export-commission').show();
423
+
424
+ $j('.export-options').hide();
425
+ $j('.commission-options').show();
426
+ });
427
+ $j('#shipping_class').click(function(){
428
+ $j('.export-types').hide();
429
+ $j('#export-shipping_class').show();
430
+
431
+ $j('.export-options').hide();
432
+ $j('.shipping_class-options').show();
433
+ });
434
+ $j('#attribute').click(function(){
435
+ $j('.export-types').hide();
436
+ $j('#export-attribute').show();
437
+
438
+ $j('.export-options').hide();
439
+ $j('.attribute-options').show();
440
+ });
441
+
442
+ // Export button
443
+ $j('#export_product').click(function(){
444
+ $j('input:radio[name=dataset]:nth(0)').attr('checked',true);
445
+ });
446
+ $j('#export_category').click(function(){
447
+ $j('input:radio[name=dataset]:nth(1)').attr('checked',true);
448
+ });
449
+ $j('#export_tag').click(function(){
450
+ $j('input:radio[name=dataset]:nth(2)').attr('checked',true);
451
+ });
452
+ $j('#export_brand').click(function(){
453
+ $j('input:radio[name=dataset]:nth(3)').attr('checked',true);
454
+ });
455
+ $j('#export_order').click(function(){
456
+ $j('input:radio[name=dataset]:nth(4)').attr('checked',true);
457
+ });
458
+ $j('#export_customer').click(function(){
459
+ $j('input:radio[name=dataset]:nth(5)').attr('checked',true);
460
+ });
461
+ $j('#export_user').click(function(){
462
+ $j('input:radio[name=dataset]:nth(6)').attr('checked',true);
463
+ });
464
+ $j('#export_coupon').click(function(){
465
+ $j('input:radio[name=dataset]:nth(7)').attr('checked',true);
466
+ });
467
+ $j('#export_subscription').click(function(){
468
+ $j('input:radio[name=dataset]:nth(8)').attr('checked',true);
469
+ });
470
+ $j('#export_product_vendor').click(function(){
471
+ $j('input:radio[name=dataset]:nth(9)').attr('checked',true);
472
+ });
473
+ $j('#export_commission').click(function(){
474
+ $j('input:radio[name=dataset]:nth(10)').attr('checked',true);
475
+ });
476
+ $j('#export_shipping_class').click(function(){
477
+ $j('input:radio[name=dataset]:nth(11)').attr('checked',true);
478
+ });
479
+ $j('#export_attribute').click(function(){
480
+ $j('input:radio[name=dataset]:nth(12)').attr('checked',true);
481
+ });
482
+
483
+ $j("#auto_type").change(function () {
484
+ var type = $j('select[name=auto_type]').val();
485
+ $j('.auto_type_options .export-options').hide();
486
+ $j('.auto_type_options .'+type+'-options').show();
487
+ });
488
+
489
+ $j("#auto_method").change(function () {
490
+ var type = $j('select[name=auto_method]').val();
491
+ $j('.auto_method_options .export-options').hide();
492
+ $j('.auto_method_options .'+type+'-options').show();
493
+ });
494
+
495
+ // Display a list of advanced options on the Settings screen
496
+ $j('#advanced-settings').click(function(){
497
+ $j('.advanced-settings').toggle();
498
+ return false;
499
+ });
500
+
501
+ // Confirmation prompt on button actions
502
+ $j('.advanced-settings a.delete, .post-type-scheduled_export a.confirm-button').click(function(e){
503
+ e.preventDefault();
504
+ var choice = confirm($j(this).attr('data-confirm'));
505
+ if( choice ) {
506
+ window.location.href = $j(this).attr('href');
507
+ }
508
+ });
509
+
510
+ $j(document).ready(function() {
511
+ // This auto-selects the export type based on the link from the Overview screen
512
+ var href = jQuery(location).attr('href');
513
+ // If this is the Export tab
514
+ if (href.toLowerCase().indexOf('tab=export') >= 0) {
515
+ // If the URL includes an in-line link
516
+ if (href.toLowerCase().indexOf('#') >= 0 ) {
517
+ var type = href.substr(href.indexOf("#") + 1);
518
+ var type = type.replace('export-','');
519
+ $j('#'+type).trigger('click');
520
+ } else {
521
+ // This auto-selects the last known export type based on stored WordPress option, defaults to Products
522
+ var type = $j('input:radio[name=dataset]:checked').val();
523
+ $j('#'+type).trigger('click');
524
+ }
525
+ } else if ( href.toLowerCase().indexOf('tab=settings') >= 0 ) {
526
+ $j("#auto_type").trigger("change");
527
+ $j("#auto_method").trigger("change");
528
+ } else {
529
+ // This auto-selects the last known export type based on stored WordPress option, defaults to Products
530
+ var type = $j('input:radio[name=dataset]:checked').val();
531
+ $j('#'+type).trigger('click');
532
+ }
533
+ });
534
+
535
+ });
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,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="postbox-container">
2
+ <div class="postbox">
3
+ <h3 class="hndle"><?php _e( 'Export File', 'woocommerce-exporter' ); ?></h3>
4
+ <div class="inside">
5
+
6
+ <textarea style="font:12px Consolas, Monaco, Courier, monospace; width:100%; height:200px;"><?php echo esc_textarea( $contents ); ?></textarea>
7
+
8
+ </div>
9
+ <!-- .inside -->
10
+ </div>
11
+ <!-- .postbox -->
12
+ </div>
13
+ <!-- .postbox-container -->
templates/admin/media-export_details.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="postbox-container">
2
+ <div id="woo_ce-media-export_details" class="postbox">
3
+ <h3 class="hndle"><?php _e( 'Export Details', 'woocommerce-exporter' ); ?></h3>
4
+ <div class="inside">
5
+
6
+ <h4><?php _e( 'General', 'woocommerce-exporter' ); ?></h4>
7
+ <dl>
8
+ <dt><?php _e( 'Export type', 'woocommerce-exporter' ); ?></dt>
9
+ <dd><?php echo woo_ce_export_type_label( $export_type ); ?></dd>
10
+ <dt><?php _e( 'Filepath', 'woocommerce-exporter' ); ?></dt>
11
+ <dd><?php echo $filepath; ?></dd>
12
+ <dt><?php _e( 'Total columns', 'woocommerce-exporter' ); ?></dt>
13
+ <dd><?php echo ( ( $columns != false ) ? $columns : '-' ); ?></dd>
14
+ <dt><?php _e( 'Total rows', 'woocommerce-exporter' ); ?></dt>
15
+ <dd><?php echo ( ( $rows != false ) ? $rows : '-' ); ?></dd>
16
+ <?php if( $scheduled_id ) { ?>
17
+ <dt><?php _e( 'Scheduled export', 'woocommerce-exporter' ); ?></dt>
18
+ <dd><a href="<?php echo get_edit_post_link( $scheduled_id ); ?>" title="<?php _e( 'Edit scheduled export', 'woocommerce-exporter' ); ?>"><?php echo woo_ce_format_post_title( get_the_title( $scheduled_id ) ); ?></a></dd>
19
+ <?php } ?>
20
+ </dl>
21
+
22
+ <h4><?php _e( 'Memory', 'woocommerce-exporter' ); ?></h4>
23
+ <dl>
24
+ <dt><?php _e( 'Process time', 'woocommerce-exporter' ); ?></dt>
25
+ <dd><?php echo ( ( ( $start_time != false ) && ( $end_time != false ) ) ? woo_ce_display_time_elapsed( $start_time, $end_time ) : '-' ); ?></dd>
26
+ <dt><?php _e( 'Idle memory usage (start)', 'woocommerce-exporter' ); ?></dt>
27
+ <dd><?php echo ( ( $idle_memory_start != false ) ? woo_ce_display_memory( $idle_memory_start ) : '-' ); ?></dd>
28
+ <dt><?php _e( 'Memory usage prior to loading export type', 'woocommerce-exporter' ); ?></dt>
29
+ <dd><?php echo ( ( $data_memory_start != false ) ? woo_ce_display_memory( $data_memory_start ) : '-' ); ?></dd>
30
+ <dt><?php _e( 'Memory usage after loading export type', 'woocommerce-exporter' ); ?></dt>
31
+ <dd><?php echo ( ( $data_memory_end != false ) ? woo_ce_display_memory( $data_memory_end ) : '-' ); ?></dd>
32
+ <dt><?php _e( 'Idle memory usage (end)', 'woocommerce-exporter' ); ?></dt>
33
+ <dd><?php echo ( ( $idle_memory_end != false ) ? woo_ce_display_memory( $idle_memory_end ) : '-' ); ?></dd>
34
+ </dl>
35
+
36
+ </div>
37
+ <!-- .inside -->
38
+ </div>
39
+ <!-- .postbox -->
40
+ </div>
41
+ <!-- .postbox-container -->
templates/admin/tabs-archive.php 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,964 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <ul class="subsubsub">
2
+ <li><a href="#export-type"><?php _e( 'Export Type', 'woocommerce-exporter' ); ?></a> |</li>
3
+ <li><a href="#export-options"><?php _e( 'Export Options', 'woocommerce-exporter' ); ?></a></li>
4
+ <?php do_action( 'woo_ce_export_quicklinks' ); ?>
5
+ </ul>
6
+ <!-- .subsubsub -->
7
+ <br class="clear" />
8
+
9
+ <p><?php _e( 'Select an export type from the list below to export entries. Once you have selected an export type you may select the fields you would like to export and optional filters available for each export type. When you click the Export button below, Store Exporter will create an export file for you to save to your computer.', 'woocommerce-exporter' ); ?></p>
10
+ <div id="poststuff">
11
+ <form method="post" action="<?php echo esc_url( add_query_arg( array( 'failed' => null, 'empty' => null, 'message' => null ) ) ); ?>" id="postform">
12
+
13
+ <div id="export-type" class="postbox">
14
+ <h3 class="hndle">
15
+ <?php _e( 'Export Types', 'woocommerce-exporter' ); ?>
16
+ <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'refresh_export_type_counts', '_wpnonce' => wp_create_nonce( 'woo_ce_refresh_export_type_counts' ) ) ) ); ?>" style="float:right;"><?php _e( 'Refresh counts', 'woocommerce-exporter' ); ?></a>
17
+ </h3>
18
+ <div class="inside">
19
+ <p class="description"><?php _e( 'Select the data type you want to export. Export Type counts are refreshed hourly and can be manually refreshed by clicking the <em>Refresh counts</em> link to the right.', 'woocommerce-exporter' ); ?></p>
20
+ <table class="form-table">
21
+
22
+ <tr>
23
+ <th>
24
+ <input type="radio" id="product" name="dataset" value="product"<?php disabled( $product, 0 ); ?><?php checked( ( empty( $product ) ? '' : $export_type ), 'product' ); ?> />
25
+ <label for="product"><?php _e( 'Products', 'woocommerce-exporter' ); ?></label>
26
+ </th>
27
+ <td>
28
+ <span class="description">(<?php echo $product; ?>)</span>
29
+ </td>
30
+ </tr>
31
+
32
+ <tr>
33
+ <th>
34
+ <input type="radio" id="category" name="dataset" value="category"<?php disabled( $category, 0 ); ?><?php checked( ( empty( $category ) ? '' : $export_type ), 'category' ); ?> />
35
+ <label for="category"><?php _e( 'Categories', 'woocommerce-exporter' ); ?></label>
36
+ </th>
37
+ <td>
38
+ <span class="description">(<?php echo $category; ?>)</span>
39
+ </td>
40
+ </tr>
41
+
42
+ <tr>
43
+ <th>
44
+ <input type="radio" id="tag" name="dataset" value="tag"<?php disabled( $tag, 0 ); ?><?php checked( ( empty( $tag ) ? '' : $export_type ), 'tag' ); ?> />
45
+ <label for="tag"><?php _e( 'Tags', 'woocommerce-exporter' ); ?></label>
46
+ </th>
47
+ <td>
48
+ <span class="description">(<?php echo $tag; ?>)</span>
49
+ </td>
50
+ </tr>
51
+
52
+ <tr>
53
+ <th>
54
+ <input type="radio" id="brand" name="dataset" value="brand"<?php disabled( $brand, 0 ); ?><?php checked( ( empty( $brand ) ? '' : $export_type ), 'brand' ); ?> />
55
+ <label for="brand"><?php _e( 'Brands', 'woocommerce-exporter' ); ?></label>
56
+ </th>
57
+ <td>
58
+ <span class="description">(<?php echo $brand; ?>)</span>
59
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
60
+ </td>
61
+ </tr>
62
+
63
+ <tr>
64
+ <th>
65
+ <input type="radio" id="order" name="dataset" value="order"<?php disabled( $order, 0 ); ?><?php checked( ( empty( $order ) ? '' : $export_type ), 'order' ); ?>/>
66
+ <label for="order"><?php _e( 'Orders', 'woocommerce-exporter' ); ?></label>
67
+ </th>
68
+ <td>
69
+ <span class="description">(<?php echo $order; ?>)</span>
70
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
71
+ </td>
72
+ </tr>
73
+
74
+ <tr>
75
+ <th>
76
+ <input type="radio" id="customer" name="dataset" value="customer"<?php disabled( $customer, 0 ); ?><?php checked( ( empty( $customer ) ? '' : $export_type ), 'customer' ); ?>/>
77
+ <label for="customer"><?php _e( 'Customers', 'woocommerce-exporter' ); ?></label>
78
+ </th>
79
+ <td>
80
+ <span class="description">(<?php echo $customer; ?>)</span>
81
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
82
+ </td>
83
+ </tr>
84
+
85
+ <tr>
86
+ <th>
87
+ <input type="radio" id="user" name="dataset" value="user"<?php disabled( $user, 0 ); ?><?php checked( ( empty( $user ) ? '' : $export_type ), 'user' ); ?>/>
88
+ <label for="user"><?php _e( 'Users', 'woocommerce-exporter' ); ?></label>
89
+ </th>
90
+ <td>
91
+ <span class="description">(<?php echo $user; ?>)</span>
92
+ </td>
93
+ </tr>
94
+
95
+ <tr>
96
+ <th>
97
+ <input type="radio" id="coupon" name="dataset" value="coupon"<?php disabled( $coupon, 0 ); ?><?php checked( ( empty( $coupon ) ? '' : $export_type ), 'coupon' ); ?> />
98
+ <label for="coupon"><?php _e( 'Coupons', 'woocommerce-exporter' ); ?></label>
99
+ </th>
100
+ <td>
101
+ <span class="description">(<?php echo $coupon; ?>)</span>
102
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
103
+ </td>
104
+ </tr>
105
+
106
+ <tr>
107
+ <th>
108
+ <input type="radio" id="subscription" name="dataset" value="subscription"<?php disabled( $subscription, 0 ); ?><?php checked( ( empty( $subscription ) ? '' : $export_type ), 'subscription' ); ?> />
109
+ <label for="subscription"><?php _e( 'Subscriptions', 'woocommerce-exporter' ); ?></label>
110
+ </th>
111
+ <td>
112
+ <span class="description">(<?php echo $subscription; ?>)</span>
113
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
114
+ </td>
115
+ </tr>
116
+
117
+ <tr>
118
+ <th>
119
+ <input type="radio" id="product_vendor" name="dataset" value="product_vendor"<?php disabled( $product_vendor, 0 ); ?><?php checked( ( empty( $product_vendor ) ? '' : $export_type ), 'product_vendor' ); ?> />
120
+ <label for="product_vendor"><?php _e( 'Product Vendors', 'woocommerce-exporter' ); ?></label>
121
+ </th>
122
+ <td>
123
+ <span class="description">(<?php echo $product_vendor; ?>)</span>
124
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
125
+ </td>
126
+ </tr>
127
+
128
+ <tr>
129
+ <th>
130
+ <input type="radio" id="commission" name="dataset" value="commission"<?php disabled( $commission, 0 ); ?><?php checked( ( empty( $commission ) ? '' : $export_type ), 'commission' ); ?> />
131
+ <label for="commission"><?php _e( 'Commissions', 'woocommerce-exporter' ); ?></label>
132
+ </th>
133
+ <td>
134
+ <span class="description">(<?php echo $commission; ?>)</span>
135
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
136
+ </td>
137
+ </tr>
138
+
139
+ <tr>
140
+ <th>
141
+ <input type="radio" id="shipping_class" name="dataset" value="shipping_class"<?php disabled( $shipping_class, 0 ); ?><?php checked( ( empty( $shipping_class ) ? '' : $export_type ), 'shipping_class' ); ?> />
142
+ <label for="shipping_class"><?php _e( 'Shipping Classes', 'woocommerce-exporter' ); ?></label>
143
+ </th>
144
+ <td>
145
+ <span class="description">(<?php echo $shipping_class; ?>)</span>
146
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
147
+ </td>
148
+ </tr>
149
+
150
+ <!--
151
+ <tr>
152
+ <th>
153
+ <input type="radio" id="attribute" name="dataset" value="attribute"<?php disabled( $attribute, 0 ); ?><?php checked( ( empty( $attribute ) ? '' : $export_type ), 'attribute' ); ?> />
154
+ <label for="attribute"><?php _e( 'Attributes', 'woocommerce-exporter' ); ?></label>
155
+ </th>
156
+ <td>
157
+ <span class="description">(<?php echo $attribute; ?>)</span>
158
+ </td>
159
+ </tr>
160
+ -->
161
+
162
+ </table>
163
+ <!-- .form-table -->
164
+ </div>
165
+ <!-- .inside -->
166
+ </div>
167
+ <!-- .postbox -->
168
+
169
+ <div class="export-types">
170
+ <div class="postbox">
171
+ <h3 class="hndle"><?php _e( 'Loading...', 'woocommerce-exporter' ); ?></h3>
172
+ <div class="inside">
173
+ <p><strong><?php _e( 'The Export screen is loading elements in the background.', 'woocommerce-exporter' ); ?></strong></p>
174
+ <p><?php _e( 'If this notice does not dissapear once the browser has finished loading then something has gone wrong. This could be due to a <a href="http://www.visser.com.au/documentation/store-exporter-deluxe/usage/#The_Export_screen_loads_but_is_missing_fields_andor_elements_including_the_Export_button" target="_blank">JavaScript error</a> or <a href="http://www.visser.com.au/documentation/store-exporter-deluxe/usage/#Increasing_memory_allocated_to_PHP" target="_blank">memory/timeout limitation</a> whilst loading the Export screen, please open a <a href="http://www.visser.com.au/premium-support/" target="_blank">Support ticket</a> with us to look at this with you. :)', 'woocommerce-exporter' ); ?></p>
175
+ </div>
176
+ </div>
177
+ <!-- .postbox -->
178
+ </div>
179
+
180
+ <?php if( $product_fields ) { ?>
181
+ <div id="export-product" class="export-types">
182
+
183
+ <div class="postbox">
184
+ <h3 class="hndle">
185
+ <?php _e( 'Product Fields', 'woocommerce-exporter' ); ?>
186
+ <a href="<?php echo esc_url( add_query_arg( array( 'tab' => 'fields', 'type' => 'product' ) ) ); ?>" style="float:right;"><?php _e( 'Configure', 'woocommerce-exporter' ); ?></a>
187
+ </h3>
188
+ <div class="inside">
189
+ <?php if( $product ) { ?>
190
+ <p class="description"><?php _e( 'Select the Product fields you would like to export, you can also drag-and-drop to reorder export fields. To the right you can change the label of export fields from the Configure link. Your field selection - but not filters - are saved for future exports.', 'woocommerce-exporter' ); ?></p>
191
+ <p>
192
+ <a href="javascript:void(0)" id="product-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
193
+ <a href="javascript:void(0)" id="product-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
194
+ <a href="javascript:void(0)" id="product-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
195
+ </p>
196
+ <table id="product-fields" class="ui-sortable">
197
+
198
+ <?php foreach( $product_fields as $product_field ) { ?>
199
+ <tr id="product-<?php echo $product_field['reset']; ?>">
200
+ <td>
201
+ <label<?php if( isset( $product_field['hover'] ) ) { ?> title="<?php echo $product_field['hover']; ?>"<?php } ?>>
202
+ <input type="checkbox" name="product_fields[<?php echo $product_field['name']; ?>]" class="product_field"<?php ( isset( $product_field['default'] ) ? checked( $product_field['default'], 1 ) : '' ); ?><?php disabled( $product_field['disabled'], 1 ); ?> />
203
+ <?php echo $product_field['label']; ?>
204
+ <?php if( $product_field['disabled'] ) { ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span><?php } ?>
205
+ <input type="hidden" name="product_fields_order[<?php echo $product_field['name']; ?>]" class="field_order" value="<?php echo $product_field['order']; ?>" />
206
+ </label>
207
+ </td>
208
+ </tr>
209
+
210
+ <?php } ?>
211
+ </table>
212
+ <p class="submit">
213
+ <input type="submit" id="export_product" value="<?php _e( 'Export Products', 'woocommerce-exporter' ); ?> " class="button-primary" />
214
+ </p>
215
+ <p class="description"><?php _e( 'Can\'t find a particular Product field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
216
+ <?php } else { ?>
217
+ <p><?php _e( 'No Products were found.', 'woocommerce-exporter' ); ?></p>
218
+ <?php } ?>
219
+ </div>
220
+ </div>
221
+ <!-- .postbox -->
222
+
223
+ <div id="export-products-filters" class="postbox">
224
+ <h3 class="hndle"><?php _e( 'Product Filters', 'woocommerce-exporter' ); ?></h3>
225
+ <div class="inside">
226
+
227
+ <?php do_action( 'woo_ce_export_product_options_before_table' ); ?>
228
+
229
+ <table class="form-table">
230
+ <?php do_action( 'woo_ce_export_product_options_table' ); ?>
231
+ </table>
232
+
233
+ <?php do_action( 'woo_ce_export_product_options_after_table' ); ?>
234
+
235
+ </div>
236
+ <!-- .inside -->
237
+
238
+ </div>
239
+ <!-- .postbox -->
240
+
241
+ </div>
242
+ <!-- #export-product -->
243
+
244
+ <?php } ?>
245
+ <?php if( $category_fields ) { ?>
246
+ <div id="export-category" class="export-types">
247
+
248
+ <div class="postbox">
249
+ <h3 class="hndle">
250
+ <?php _e( 'Category Fields', 'woocommerce-exporter' ); ?>
251
+ <a href="<?php echo esc_url( add_query_arg( array( 'tab' => 'fields', 'type' => 'category' ) ) ); ?>" style="float:right;"><?php _e( 'Configure', 'woocommerce-exporter' ); ?></a>
252
+ </h3>
253
+ <div class="inside">
254
+ <p class="description"><?php _e( 'Select the Category fields you would like to export.', 'woocommerce-exporter' ); ?></p>
255
+ <p>
256
+ <a href="javascript:void(0)" id="category-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
257
+ <a href="javascript:void(0)" id="category-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
258
+ <a href="javascript:void(0)" id="category-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
259
+ </p>
260
+ <table id="category-fields" class="ui-sortable">
261
+
262
+ <?php foreach( $category_fields as $category_field ) { ?>
263
+ <tr id="category-<?php echo $category_field['reset']; ?>">
264
+ <td>
265
+ <label<?php if( isset( $category_field['hover'] ) ) { ?> title="<?php echo $category_field['hover']; ?>"<?php } ?>>
266
+ <input type="checkbox" name="category_fields[<?php echo $category_field['name']; ?>]" class="category_field"<?php ( isset( $category_field['default'] ) ? checked( $category_field['default'], 1 ) : '' ); ?><?php disabled( $category_field['disabled'], 1 ); ?> />
267
+ <?php echo $category_field['label']; ?>
268
+ <input type="hidden" name="category_fields_order[<?php echo $category_field['name']; ?>]" class="field_order" value="<?php echo $category_field['order']; ?>" />
269
+ </label>
270
+ </td>
271
+ </tr>
272
+
273
+ <?php } ?>
274
+ </table>
275
+ <p class="submit">
276
+ <input type="submit" id="export_category" value="<?php _e( 'Export Categories', 'woocommerce-exporter' ); ?> " class="button-primary" />
277
+ </p>
278
+ <p class="description"><?php _e( 'Can\'t find a particular Category field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
279
+ </div>
280
+ <!-- .inside -->
281
+ </div>
282
+ <!-- .postbox -->
283
+
284
+ <div id="export-categories-filters" class="postbox">
285
+ <h3 class="hndle"><?php _e( 'Category Filters', 'woocommerce-exporter' ); ?></h3>
286
+ <div class="inside">
287
+
288
+ <?php do_action( 'woo_ce_export_category_options_before_table' ); ?>
289
+
290
+ <table class="form-table">
291
+ <?php do_action( 'woo_ce_export_category_options_table' ); ?>
292
+ </table>
293
+
294
+ <?php do_action( 'woo_ce_export_category_options_after_table' ); ?>
295
+
296
+ </div>
297
+ <!-- .inside -->
298
+ </div>
299
+ <!-- #export-categories-filters -->
300
+
301
+ </div>
302
+ <!-- #export-category -->
303
+ <?php } ?>
304
+ <?php if( $tag_fields ) { ?>
305
+ <div id="export-tag" class="export-types">
306
+
307
+ <div class="postbox">
308
+ <h3 class="hndle">
309
+ <?php _e( 'Tag Fields', 'woocommerce-exporter' ); ?>
310
+ <a href="<?php echo esc_url( add_query_arg( array( 'tab' => 'fields', 'type' => 'tag' ) ) ); ?>" style="float:right;"><?php _e( 'Configure', 'woocommerce-exporter' ); ?></a>
311
+ </h3>
312
+ <div class="inside">
313
+ <p class="description"><?php _e( 'Select the Tag fields you would like to export.', 'woocommerce-exporter' ); ?></p>
314
+ <p>
315
+ <a href="javascript:void(0)" id="tag-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
316
+ <a href="javascript:void(0)" id="tag-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
317
+ <a href="javascript:void(0)" id="tag-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
318
+ </p>
319
+ <table id="tag-fields" class="ui-sortable">
320
+
321
+ <?php foreach( $tag_fields as $tag_field ) { ?>
322
+ <tr id="tag-<?php echo $tag_field['reset']; ?>">
323
+ <td>
324
+ <label<?php if( isset( $tag_field['hover'] ) ) { ?> title="<?php echo $tag_field['hover']; ?>"<?php } ?>>
325
+ <input type="checkbox" name="tag_fields[<?php echo $tag_field['name']; ?>]" class="tag_field"<?php ( isset( $tag_field['default'] ) ? checked( $tag_field['default'], 1 ) : '' ); ?><?php disabled( $tag_field['disabled'], 1 ); ?> />
326
+ <?php echo $tag_field['label']; ?>
327
+ <input type="hidden" name="tag_fields_order[<?php echo $tag_field['name']; ?>]" class="field_order" value="<?php echo $tag_field['order']; ?>" />
328
+ </label>
329
+ </td>
330
+ </tr>
331
+
332
+ <?php } ?>
333
+ </table>
334
+ <p class="submit">
335
+ <input type="submit" id="export_tag" value="<?php _e( 'Export Tags', 'woocommerce-exporter' ); ?> " class="button-primary" />
336
+ </p>
337
+ <p class="description"><?php _e( 'Can\'t find a particular Tag field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
338
+ </div>
339
+ <!-- .inside -->
340
+ </div>
341
+ <!-- .postbox -->
342
+
343
+ <div id="export-tags-filters" class="postbox">
344
+ <h3 class="hndle"><?php _e( 'Product Tag Filters', 'woocommerce-exporter' ); ?></h3>
345
+ <div class="inside">
346
+
347
+ <?php do_action( 'woo_ce_export_tag_options_before_table' ); ?>
348
+
349
+ <table class="form-table">
350
+ <?php do_action( 'woo_ce_export_tag_options_table' ); ?>
351
+ </table>
352
+
353
+ <?php do_action( 'woo_ce_export_tag_options_after_table' ); ?>
354
+
355
+ </div>
356
+ <!-- .inside -->
357
+ </div>
358
+ <!-- #export-tags-filters -->
359
+
360
+ </div>
361
+ <!-- #export-tag -->
362
+ <?php } ?>
363
+
364
+ <?php if( $brand_fields ) { ?>
365
+ <div id="export-brand" class="export-types">
366
+
367
+ <div class="postbox">
368
+ <h3 class="hndle">
369
+ <?php _e( 'Brand Fields', 'woocommerce-exporter' ); ?>
370
+ </h3>
371
+ <div class="inside">
372
+ <?php if( $brand ) { ?>
373
+ <p class="description"><?php _e( 'Select the Brand fields you would like to export.', 'woocommerce-exporter' ); ?></p>
374
+ <p>
375
+ <a href="javascript:void(0)" id="brand-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
376
+ <a href="javascript:void(0)" id="brand-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
377
+ <a href="javascript:void(0)" id="brand-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
378
+ </p>
379
+ <table id="brand-fields" class="ui-sortable">
380
+
381
+ <?php foreach( $brand_fields as $brand_field ) { ?>
382
+ <tr id="brand-<?php echo $brand_field['reset']; ?>">
383
+ <td>
384
+ <label<?php if( isset( $brand_field['hover'] ) ) { ?> title="<?php echo $brand_field['hover']; ?>"<?php } ?>>
385
+ <input type="checkbox" name="brand_fields[<?php echo $brand_field['name']; ?>]" class="brand_field"<?php ( isset( $brand_field['default'] ) ? checked( $brand_field['default'], 1 ) : '' ); ?> disabled="disabled" />
386
+ <?php echo $brand_field['label']; ?>
387
+ <input type="hidden" name="brand_fields_order[<?php echo $brand_field['name']; ?>]" class="field_order" value="<?php echo $brand_field['order']; ?>" />
388
+ </label>
389
+ </td>
390
+ </tr>
391
+
392
+ <?php } ?>
393
+ </table>
394
+ <p class="submit">
395
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Brands', 'woocommerce-exporter' ); ?>" />
396
+ </p>
397
+ <p class="description"><?php _e( 'Can\'t find a particular Brand field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
398
+ <?php } else { ?>
399
+ <p><?php _e( 'No Brands were found.', 'woocommerce-exporter' ); ?></p>
400
+ <?php } ?>
401
+ </div>
402
+ <!-- .inside -->
403
+ </div>
404
+ <!-- .postbox -->
405
+
406
+ <div id="export-brands-filters" class="postbox">
407
+ <h3 class="hndle"><?php _e( 'Brand Filters', 'woocommerce-exporter' ); ?></h3>
408
+ <div class="inside">
409
+
410
+ <?php do_action( 'woo_ce_export_brand_options_before_table' ); ?>
411
+
412
+ <table class="form-table">
413
+ <?php do_action( 'woo_ce_export_brand_options_table' ); ?>
414
+ </table>
415
+
416
+ <?php do_action( 'woo_ce_export_brand_options_after_table' ); ?>
417
+
418
+ </div>
419
+ <!-- .inside -->
420
+ </div>
421
+ <!-- .postbox -->
422
+
423
+ </div>
424
+ <!-- #export-brand -->
425
+
426
+ <?php } ?>
427
+ <?php if( $order_fields ) { ?>
428
+ <div id="export-order" class="export-types">
429
+
430
+ <div class="postbox">
431
+ <h3 class="hndle">
432
+ <?php _e( 'Order Fields', 'woocommerce-exporter' ); ?>
433
+ </h3>
434
+ <div class="inside">
435
+
436
+ <?php if( $order ) { ?>
437
+ <p class="description"><?php _e( 'Select the Order fields you would like to export.', 'woocommerce-exporter' ); ?></p>
438
+ <p>
439
+ <a href="javascript:void(0)" id="order-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
440
+ <a href="javascript:void(0)" id="order-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
441
+ <a href="javascript:void(0)" id="order-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
442
+ </p>
443
+ <table id="order-fields" class="ui-sortable">
444
+
445
+ <?php foreach( $order_fields as $order_field ) { ?>
446
+ <tr id="order-<?php echo $order_field['reset']; ?>">
447
+ <td>
448
+ <label<?php if( isset( $order_field['hover'] ) ) { ?> title="<?php echo $order_field['hover']; ?>"<?php } ?>>
449
+ <input type="checkbox" name="order_fields[<?php echo $order_field['name']; ?>]" class="order_field"<?php ( isset( $order_field['default'] ) ? checked( $order_field['default'], 1 ) : '' ); ?> disabled="disabled" />
450
+ <?php echo $order_field['label']; ?>
451
+ <input type="hidden" name="order_fields_order[<?php echo $order_field['name']; ?>]" class="field_order" value="<?php echo $order_field['order']; ?>" />
452
+ </label>
453
+ </td>
454
+ </tr>
455
+
456
+ <?php } ?>
457
+ </table>
458
+ <p class="submit">
459
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Orders', 'woocommerce-exporter' ); ?>" />
460
+ </p>
461
+ <p class="description"><?php _e( 'Can\'t find a particular Order field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
462
+ <?php } else { ?>
463
+ <p><?php _e( 'No Orders were found.', 'woocommerce-exporter' ); ?></p>
464
+ <?php } ?>
465
+
466
+ </div>
467
+ </div>
468
+ <!-- .postbox -->
469
+
470
+ <div id="export-orders-filters" class="postbox">
471
+ <h3 class="hndle"><?php _e( 'Order Filters', 'woocommerce-exporter' ); ?></h3>
472
+ <div class="inside">
473
+
474
+ <?php do_action( 'woo_ce_export_order_options_before_table' ); ?>
475
+
476
+ <table class="form-table">
477
+ <?php do_action( 'woo_ce_export_order_options_table' ); ?>
478
+ </table>
479
+
480
+ <?php do_action( 'woo_ce_export_order_options_after_table' ); ?>
481
+
482
+ </div>
483
+ <!-- .inside -->
484
+ </div>
485
+ <!-- .postbox -->
486
+
487
+ </div>
488
+ <!-- #export-order -->
489
+
490
+ <?php } ?>
491
+ <?php if( $customer_fields ) { ?>
492
+ <div id="export-customer" class="export-types">
493
+
494
+ <div class="postbox">
495
+ <h3 class="hndle">
496
+ <?php _e( 'Customer Fields', 'woocommerce-exporter' ); ?>
497
+ </h3>
498
+ <div class="inside">
499
+ <?php if( $customer ) { ?>
500
+ <p class="description"><?php _e( 'Select the Customer fields you would like to export.', 'woocommerce-exporter' ); ?></p>
501
+ <p>
502
+ <a href="javascript:void(0)" id="customer-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
503
+ <a href="javascript:void(0)" id="customer-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
504
+ <a href="javascript:void(0)" id="customer-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
505
+ </p>
506
+ <table id="customer-fields" class="ui-sortable">
507
+
508
+ <?php foreach( $customer_fields as $customer_field ) { ?>
509
+ <tr id="customer-<?php echo $customer_field['reset']; ?>">
510
+ <td>
511
+ <label<?php if( isset( $customer_field['hover'] ) ) { ?> title="<?php echo $customer_field['hover']; ?>"<?php } ?>>
512
+ <input type="checkbox" name="customer_fields[<?php echo $customer_field['name']; ?>]" class="customer_field"<?php ( isset( $customer_field['default'] ) ? checked( $customer_field['default'], 1 ) : '' ); ?> disabled="disabled" />
513
+ <?php echo $customer_field['label']; ?>
514
+ <input type="hidden" name="customer_fields_order[<?php echo $customer_field['name']; ?>]" class="field_order" value="<?php echo $customer_field['order']; ?>" />
515
+ </label>
516
+ </td>
517
+ </tr>
518
+
519
+ <?php } ?>
520
+ </table>
521
+ <p class="submit">
522
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Customers', 'woocommerce-exporter' ); ?>" />
523
+ </p>
524
+ <p class="description"><?php _e( 'Can\'t find a particular Customer field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
525
+ <?php } else { ?>
526
+ <p><?php _e( 'No Customers were found.', 'woocommerce-exporter' ); ?></p>
527
+ <?php } ?>
528
+ </div>
529
+ <!-- .inside -->
530
+ </div>
531
+ <!-- .postbox -->
532
+
533
+ <div id="export-customers-filters" class="postbox">
534
+ <h3 class="hndle"><?php _e( 'Customer Filters', 'woocommerce-exporter' ); ?></h3>
535
+ <div class="inside">
536
+
537
+ <?php do_action( 'woo_ce_export_customer_options_before_table' ); ?>
538
+
539
+ <table class="form-table">
540
+ <?php do_action( 'woo_ce_export_customer_options_table' ); ?>
541
+ </table>
542
+
543
+ <?php do_action( 'woo_ce_export_customer_options_after_table' ); ?>
544
+
545
+ </div>
546
+ <!-- .inside -->
547
+ </div>
548
+ <!-- .postbox -->
549
+
550
+ </div>
551
+ <!-- #export-customer -->
552
+
553
+ <?php } ?>
554
+ <?php if( $user_fields ) { ?>
555
+ <div id="export-user" class="export-types">
556
+
557
+ <div class="postbox">
558
+ <h3 class="hndle">
559
+ <?php _e( 'User Fields', 'woocommerce-exporter' ); ?>
560
+ <a href="<?php echo esc_url( add_query_arg( array( 'tab' => 'fields', 'type' => 'user' ) ) ); ?>" style="float:right;"><?php _e( 'Configure', 'woocommerce-exporter' ); ?></a>
561
+ </h3>
562
+ <div class="inside">
563
+ <?php if( $user ) { ?>
564
+ <p class="description"><?php _e( 'Select the User fields you would like to export.', 'woocommerce-exporter' ); ?></p>
565
+ <p>
566
+ <a href="javascript:void(0)" id="user-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
567
+ <a href="javascript:void(0)" id="user-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
568
+ <a href="javascript:void(0)" id="user-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
569
+ </p>
570
+ <table id="user-fields" class="ui-sortable">
571
+
572
+ <?php foreach( $user_fields as $user_field ) { ?>
573
+ <tr id="user-<?php echo $user_field['reset']; ?>">
574
+ <td>
575
+ <label<?php if( isset( $user_field['hover'] ) ) { ?> title="<?php echo $user_field['hover']; ?>"<?php } ?>>
576
+ <input type="checkbox" name="user_fields[<?php echo $user_field['name']; ?>]" class="user_field"<?php ( isset( $user_field['default'] ) ? checked( $user_field['default'], 1 ) : '' ); ?><?php disabled( $user_field['disabled'], 1 ); ?> />
577
+ <?php echo $user_field['label']; ?>
578
+ <?php if( $user_field['disabled'] ) { ?><span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span><?php } ?>
579
+ <input type="hidden" name="user_fields_order[<?php echo $user_field['name']; ?>]" class="field_order" value="<?php echo $user_field['order']; ?>" />
580
+ </label>
581
+ </td>
582
+ </tr>
583
+
584
+ <?php } ?>
585
+ </table>
586
+ <p class="submit">
587
+ <input type="submit" id="export_user" class="button-primary" value="<?php _e( 'Export Users', 'woocommerce-exporter' ); ?>" />
588
+ </p>
589
+ <p class="description"><?php _e( 'Can\'t find a particular User field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
590
+ <?php } else { ?>
591
+ <p><?php _e( 'No Users were found.', 'woocommerce-exporter' ); ?></p>
592
+ <?php } ?>
593
+ </div>
594
+ <!-- .inside -->
595
+ </div>
596
+ <!-- .postbox -->
597
+
598
+ <div id="export-users-filters" class="postbox">
599
+ <h3 class="hndle"><?php _e( 'User Filters', 'woocommerce-exporter' ); ?></h3>
600
+ <div class="inside">
601
+
602
+ <?php do_action( 'woo_ce_export_user_options_before_table' ); ?>
603
+
604
+ <table class="form-table">
605
+ <?php do_action( 'woo_ce_export_user_options_table' ); ?>
606
+ </table>
607
+
608
+ <?php do_action( 'woo_ce_export_user_options_after_table' ); ?>
609
+
610
+ </div>
611
+ <!-- .inside -->
612
+ </div>
613
+ <!-- .postbox -->
614
+
615
+ </div>
616
+ <!-- #export-user -->
617
+
618
+ <?php } ?>
619
+ <?php if( $coupon_fields ) { ?>
620
+ <div id="export-coupon" class="export-types">
621
+
622
+ <div class="postbox">
623
+ <h3 class="hndle">
624
+ <?php _e( 'Coupon Fields', 'woocommerce-exporter' ); ?>
625
+ </h3>
626
+ <div class="inside">
627
+ <?php if( $coupon ) { ?>
628
+ <p class="description"><?php _e( 'Select the Coupon fields you would like to export.', 'woocommerce-exporter' ); ?></p>
629
+ <p>
630
+ <a href="javascript:void(0)" id="coupon-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
631
+ <a href="javascript:void(0)" id="coupon-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
632
+ <a href="javascript:void(0)" id="coupon-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
633
+ </p>
634
+ <table id="coupon-fields" class="ui-sortable">
635
+
636
+ <?php foreach( $coupon_fields as $coupon_field ) { ?>
637
+ <tr id="coupon-<?php echo $coupon_field['reset']; ?>">
638
+ <td>
639
+ <label<?php if( isset( $coupon_field['hover'] ) ) { ?> title="<?php echo $coupon_field['hover']; ?>"<?php } ?>>
640
+ <input type="checkbox" name="coupon_fields[<?php echo $coupon_field['name']; ?>]" class="coupon_field"<?php ( isset( $coupon_field['default'] ) ? checked( $coupon_field['default'], 1 ) : '' ); ?> disabled="disabled" />
641
+ <?php echo $coupon_field['label']; ?>
642
+ <input type="hidden" name="coupon_fields_order[<?php echo $coupon_field['name']; ?>]" class="field_order" value="<?php echo $coupon_field['order']; ?>" />
643
+ </label>
644
+ </td>
645
+ </tr>
646
+
647
+ <?php } ?>
648
+ </table>
649
+ <p class="submit">
650
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Coupons', 'woocommerce-exporter' ); ?>" />
651
+ </p>
652
+ <p class="description"><?php _e( 'Can\'t find a particular Coupon field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
653
+ <?php } else { ?>
654
+ <p><?php _e( 'No Coupons were found.', 'woocommerce-exporter' ); ?></p>
655
+ <?php } ?>
656
+ </div>
657
+ <!-- .inside -->
658
+ </div>
659
+ <!-- .postbox -->
660
+
661
+ <div id="export-coupons-filters" class="postbox">
662
+ <h3 class="hndle"><?php _e( 'Coupon Filters', 'woocommerce-exporter' ); ?></h3>
663
+ <div class="inside">
664
+
665
+ <?php do_action( 'woo_ce_export_coupon_options_before_table' ); ?>
666
+
667
+ <table class="form-table">
668
+ <?php do_action( 'woo_ce_export_coupon_options_table' ); ?>
669
+ </table>
670
+
671
+ <?php do_action( 'woo_ce_export_coupon_options_after_table' ); ?>
672
+
673
+ </div>
674
+ <!-- .inside -->
675
+ </div>
676
+ <!-- .postbox -->
677
+
678
+ </div>
679
+ <!-- #export-coupon -->
680
+
681
+ <?php } ?>
682
+ <?php if( $subscription_fields ) { ?>
683
+ <div id="export-subscription" class="export-types">
684
+
685
+ <div class="postbox">
686
+ <h3 class="hndle">
687
+ <?php _e( 'Subscription Fields', 'woocommerce-exporter' ); ?>
688
+ </h3>
689
+ <div class="inside">
690
+ <?php if( $subscription ) { ?>
691
+ <p class="description"><?php _e( 'Select the Subscription fields you would like to export.', 'woocommerce-exporter' ); ?></p>
692
+ <p>
693
+ <a href="javascript:void(0)" id="subscription-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
694
+ <a href="javascript:void(0)" id="subscription-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
695
+ <a href="javascript:void(0)" id="subscription-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
696
+ </p>
697
+ <table id="subscription-fields" class="ui-sortable">
698
+
699
+ <?php foreach( $subscription_fields as $subscription_field ) { ?>
700
+ <tr id="subscription-<?php echo $subscription_field['reset']; ?>">
701
+ <td>
702
+ <label<?php if( isset( $subscription_field['hover'] ) ) { ?> title="<?php echo $subscription_field['hover']; ?>"<?php } ?>>
703
+ <input type="checkbox" name="subscription_fields[<?php echo $subscription_field['name']; ?>]" class="subscription_field"<?php ( isset( $subscription_field['default'] ) ? checked( $subscription_field['default'], 1 ) : '' ); ?> disabled="disabled" />
704
+ <?php echo $subscription_field['label']; ?>
705
+ <input type="hidden" name="subscription_fields_order[<?php echo $subscription_field['name']; ?>]" class="field_order" value="<?php echo $subscription_field['order']; ?>" />
706
+ </label>
707
+ </td>
708
+ </tr>
709
+
710
+ <?php } ?>
711
+ </table>
712
+ <p class="submit">
713
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Subscriptions', 'woocommerce-exporter' ); ?>" />
714
+ </p>
715
+ <p class="description"><?php _e( 'Can\'t find a particular Subscription field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
716
+ <?php } else { ?>
717
+ <p><?php _e( 'No Subscriptions were found.', 'woocommerce-exporter' ); ?></p>
718
+ <?php } ?>
719
+ </div>
720
+ <!-- .inside -->
721
+ </div>
722
+ <!-- .postbox -->
723
+
724
+ <div id="export-subscriptions-filters" class="postbox">
725
+ <h3 class="hndle"><?php _e( 'Subscription Filters', 'woocommerce-exporter' ); ?></h3>
726
+ <div class="inside">
727
+
728
+ <?php do_action( 'woo_ce_export_subscription_options_before_table' ); ?>
729
+
730
+ <table class="form-table">
731
+ <?php do_action( 'woo_ce_export_subscription_options_table' ); ?>
732
+ </table>
733
+
734
+ <?php do_action( 'woo_ce_export_subscription_options_after_table' ); ?>
735
+
736
+ </div>
737
+ <!-- .inside -->
738
+ </div>
739
+ <!-- .postbox -->
740
+
741
+ </div>
742
+ <!-- #export-subscription -->
743
+
744
+ <?php } ?>
745
+ <?php if( $product_vendor_fields ) { ?>
746
+ <div id="export-product_vendor" class="export-types">
747
+
748
+ <div class="postbox">
749
+ <h3 class="hndle">
750
+ <?php _e( 'Product Vendor Fields', 'woocommerce-exporter' ); ?>
751
+ </h3>
752
+ <div class="inside">
753
+ <?php if( $product_vendor ) { ?>
754
+ <p class="description"><?php _e( 'Select the Product Vendor fields you would like to export.', 'woocommerce-exporter' ); ?></p>
755
+ <p>
756
+ <a href="javascript:void(0)" id="product_vendor-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
757
+ <a href="javascript:void(0)" id="product_vendor-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
758
+ <a href="javascript:void(0)" id="product_vendor-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
759
+ </p>
760
+ <table id="product_vendor-fields" class="ui-sortable">
761
+
762
+ <?php foreach( $product_vendor_fields as $product_vendor_field ) { ?>
763
+ <tr id="product_vendor-<?php echo $product_vendor_field['reset']; ?>">
764
+ <td>
765
+ <label<?php if( isset( $product_vendor_field['hover'] ) ) { ?> title="<?php echo $product_vendor_field['hover']; ?>"<?php } ?>>
766
+ <input type="checkbox" name="product_vendor_fields[<?php echo $product_vendor_field['name']; ?>]" class="product_vendor_field"<?php ( isset( $product_vendor_field['default'] ) ? checked( $product_vendor_field['default'], 1 ) : '' ); ?> disabled="disabled" />
767
+ <?php echo $product_vendor_field['label']; ?>
768
+ <input type="hidden" name="product_vendor_fields_order[<?php echo $product_vendor_field['name']; ?>]" class="field_order" value="<?php echo $product_vendor_field['order']; ?>" />
769
+ </label>
770
+ </td>
771
+ </tr>
772
+
773
+ <?php } ?>
774
+ </table>
775
+ <p class="submit">
776
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Product Vendors', 'woocommerce-exporter' ); ?>" />
777
+ </p>
778
+ <p class="description"><?php _e( 'Can\'t find a particular Product Vendor field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
779
+ <?php } else { ?>
780
+ <p><?php _e( 'No Product Vendors were found.', 'woocommerce-exporter' ); ?></p>
781
+ <?php } ?>
782
+ </div>
783
+ <!-- .inside -->
784
+ </div>
785
+ <!-- .postbox -->
786
+
787
+ </div>
788
+ <!-- #export-product_vendor -->
789
+
790
+ <?php } ?>
791
+ <?php if( $commission_fields ) { ?>
792
+ <div id="export-commission" class="export-types">
793
+
794
+ <div class="postbox">
795
+ <h3 class="hndle">
796
+ <?php _e( 'Commission Fields', 'woocommerce-exporter' ); ?>
797
+ </h3>
798
+ <div class="inside">
799
+ <?php if( $commission ) { ?>
800
+ <p class="description"><?php _e( 'Select the Commission fields you would like to export.', 'woocommerce-exporter' ); ?></p>
801
+ <p>
802
+ <a href="javascript:void(0)" id="commission-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
803
+ <a href="javascript:void(0)" id="commission-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
804
+ <a href="javascript:void(0)" id="commission-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
805
+ </p>
806
+ <table id="commission-fields" class="ui-sortable">
807
+
808
+ <?php foreach( $commission_fields as $commission_field ) { ?>
809
+ <tr id="commission-<?php echo $commission_field['reset']; ?>">
810
+ <td>
811
+ <label<?php if( isset( $commission_field['hover'] ) ) { ?> title="<?php echo $commission_field['hover']; ?>"<?php } ?>>
812
+ <input type="checkbox" name="commission_fields[<?php echo $commission_field['name']; ?>]" class="commission_field"<?php ( isset( $commission_field['default'] ) ? checked( $commission_field['default'], 1 ) : '' ); ?> disabled="disabled" />
813
+ <?php echo $commission_field['label']; ?>
814
+ <input type="hidden" name="commission_fields_order[<?php echo $commission_field['name']; ?>]" class="field_order" value="<?php echo $commission_field['order']; ?>" />
815
+ </label>
816
+ </td>
817
+ </tr>
818
+
819
+ <?php } ?>
820
+ </table>
821
+ <p class="submit">
822
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Commissions', 'woocommerce-exporter' ); ?>" />
823
+ </p>
824
+ <p class="description"><?php _e( 'Can\'t find a particular Commission field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
825
+ <?php } else { ?>
826
+ <p><?php _e( 'No Commissions were found.', 'woocommerce-exporter' ); ?></p>
827
+ <?php } ?>
828
+ </div>
829
+ <!-- .inside -->
830
+ </div>
831
+ <!-- .postbox -->
832
+
833
+ <div id="export-commissions-filters" class="postbox">
834
+ <h3 class="hndle"><?php _e( 'Commission Filters', 'woocommerce-exporter' ); ?></h3>
835
+ <div class="inside">
836
+
837
+ <?php do_action( 'woo_ce_export_commission_options_before_table' ); ?>
838
+
839
+ <table class="form-table">
840
+ <?php do_action( 'woo_ce_export_commission_options_table' ); ?>
841
+ </table>
842
+
843
+ <?php do_action( 'woo_ce_export_commission_options_after_table' ); ?>
844
+
845
+ </div>
846
+ <!-- .inside -->
847
+ </div>
848
+ <!-- .postbox -->
849
+
850
+ </div>
851
+ <!-- #export-commission -->
852
+
853
+ <?php } ?>
854
+ <?php if( $shipping_class_fields ) { ?>
855
+ <div id="export-shipping_class" class="export-types">
856
+
857
+ <div class="postbox">
858
+ <h3 class="hndle">
859
+ <?php _e( 'Shipping Class Fields', 'woocommerce-exporter' ); ?>
860
+ </h3>
861
+ <div class="inside">
862
+ <?php if( $shipping_class ) { ?>
863
+ <p class="description"><?php _e( 'Select the Shipping Class fields you would like to export.', 'woocommerce-exporter' ); ?></p>
864
+ <p>
865
+ <a href="javascript:void(0)" id="shipping_class-checkall" class="checkall"><?php _e( 'Check All', 'woocommerce-exporter' ); ?></a> |
866
+ <a href="javascript:void(0)" id="shipping_class-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woocommerce-exporter' ); ?></a> |
867
+ <a href="javascript:void(0)" id="shipping_class-resetsorting" class="resetsorting"><?php _e( 'Reset Sorting', 'woocommerce-exporter' ); ?></a>
868
+ </p>
869
+ <table id="shipping_class-fields" class="ui-sortable">
870
+
871
+ <?php foreach( $shipping_class_fields as $shipping_class_field ) { ?>
872
+ <tr id="shipping_class-<?php echo $shipping_class_field['reset']; ?>">
873
+ <td>
874
+ <label<?php if( isset( $shipping_class_field['hover'] ) ) { ?> title="<?php echo $shipping_class_field['hover']; ?>"<?php } ?>>
875
+ <input type="checkbox" name="shipping_class_fields[<?php echo $shipping_class_field['name']; ?>]" class="shipping_class_field"<?php ( isset( $shipping_class_field['default'] ) ? checked( $shipping_class_field['default'], 1 ) : '' ); ?> disabled="disabled" />
876
+ <?php echo $shipping_class_field['label']; ?>
877
+ <input type="hidden" name="shipping_class_fields_order[<?php echo $shipping_class_field['name']; ?>]" class="field_order" value="<?php echo $shipping_class_field['order']; ?>" />
878
+ </label>
879
+ </td>
880
+ </tr>
881
+
882
+ <?php } ?>
883
+ </table>
884
+ <p class="submit">
885
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Shipping Classes', 'woocommerce-exporter' ); ?>" />
886
+ </p>
887
+ <p class="description"><?php _e( 'Can\'t find a particular Shipping Class field in the above export list?', 'woocommerce-exporter' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woocommerce-exporter' ); ?></a>.</p>
888
+ <?php } else { ?>
889
+ <p><?php _e( 'No Shipping Classes were found.', 'woocommerce-exporter' ); ?></p>
890
+ <?php } ?>
891
+ </div>
892
+ <!-- .inside -->
893
+ </div>
894
+ <!-- .postbox -->
895
+
896
+ <div id="export-shipping-classes-filters" class="postbox">
897
+ <h3 class="hndle"><?php _e( 'Shipping Class Filters', 'woocommerce-exporter' ); ?></h3>
898
+ <div class="inside">
899
+
900
+ <?php do_action( 'woo_ce_export_shipping_class_options_before_table' ); ?>
901
+
902
+ <table class="form-table">
903
+ <?php do_action( 'woo_ce_export_shipping_class_options_table' ); ?>
904
+ </table>
905
+
906
+ <?php do_action( 'woo_ce_export_shipping_class_options_after_table' ); ?>
907
+
908
+ </div>
909
+ <!-- .inside -->
910
+ </div>
911
+ <!-- .postbox -->
912
+
913
+ </div>
914
+ <!-- #export-shipping_class -->
915
+
916
+ <?php } ?>
917
+ <?php do_action( 'woo_ce_before_options' ); ?>
918
+
919
+ <div class="postbox" id="export-options">
920
+ <h3 class="hndle"><?php _e( 'Export Options', 'woocommerce-exporter' ); ?></h3>
921
+ <div class="inside">
922
+ <p class="description"><?php _e( 'You can find additional export options under the Settings tab at the top of this screen.', 'woocommerce-exporter' ); ?></p>
923
+
924
+ <?php do_action( 'woo_ce_export_options_before' ); ?>
925
+
926
+ <table class="form-table">
927
+
928
+ <?php do_action( 'woo_ce_export_options' ); ?>
929
+
930
+ <tr>
931
+ <th>
932
+ <label for="offset"><?php _e( 'Volume offset', 'woocommerce-exporter' ); ?></label> / <label for="limit_volume"><?php _e( 'Limit volume', 'woocommerce-exporter' ); ?></label>
933
+ </th>
934
+ <td>
935
+ <input type="text" size="3" id="offset" name="offset" value="<?php echo esc_attr( $offset ); ?>" size="5" class="text" title="<?php _e( 'Volume Offset', 'woocommerce-exporter' ); ?>" /> <?php _e( 'to', 'woocommerce-exporter' ); ?> <input type="text" size="3" id="limit_volume" name="limit_volume" value="<?php echo esc_attr( $limit_volume ); ?>" size="5" class="text" title="<?php _e( 'Limit Volume', 'woocommerce-exporter' ); ?>" />
936
+ <p class="description">
937
+ <?php _e( 'Volume offset and limit allows for partial exporting of an export type (e.g. records 0 to 500, etc.) by entering 0 and 500, incrementing the Limit Volume field to 500 will export the next 500 records.', 'woocommerce-exporter' ); ?><br />
938
+ <?php _e( 'This is useful when encountering timeout and/or memory errors during the a large or memory intensive export. By default this is not used and is left empty.', 'woocommerce-exporter' ); ?>
939
+ </p>
940
+ </td>
941
+ </tr>
942
+
943
+ <?php do_action( 'woo_ce_export_options_table_after' ); ?>
944
+
945
+ </table>
946
+ <p><?php _e( 'Click the Export button above to apply these changes and generate your export file.', 'woocommerce-exporter' ); ?></p>
947
+
948
+ <?php do_action( 'woo_ce_export_options_after' ); ?>
949
+
950
+ </div>
951
+ </div>
952
+ <!-- .postbox -->
953
+
954
+ <?php do_action( 'woo_ce_after_options' ); ?>
955
+
956
+ <input type="hidden" name="action" value="export" />
957
+ <?php wp_nonce_field( 'manual_export', 'woo_ce_export' ); ?>
958
+
959
+ </form>
960
+
961
+ <?php do_action( 'woo_ce_export_after_form' ); ?>
962
+
963
+ </div>
964
+ <!-- #poststuff -->
templates/admin/tabs-fields.php 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,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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. Options are broken into sections for different export formats and methods. Click Save Changes to apply changes.', 'woocommerce-exporter' ); ?></p>
19
+ </td>
20
+ </tr>
21
+
22
+ <tr valign="top">
23
+ <th scope="row"><label for="export_filename"><?php _e( 'Export filename', 'woocommerce-exporter' ); ?></label></th>
24
+ <td>
25
+ <input type="text" name="export_filename" id="export_filename" value="<?php echo esc_attr( $export_filename ); ?>" class="large-text code" />
26
+ <p class="description"><?php _e( 'The filename of the exported export type. Tags can be used: ', 'woocommerce-exporter' ); ?> <code>%dataset%</code>, <code>%date%</code>, <code>%time%</code>, <code>%random</code>, <code>%store_name%</code>.</p>
27
+ </td>
28
+ </tr>
29
+
30
+ <tr>
31
+ <th>
32
+ <label for="delete_file"><?php _e( 'Enable archives', 'woocommerce-exporter' ); ?></label>
33
+ </th>
34
+ <td>
35
+ <select id="delete_file" name="delete_file">
36
+ <option value="0"<?php selected( $delete_file, 0 ); ?>><?php _e( 'Yes', 'woocommerce-exporter' ); ?></option>
37
+ <option value="1"<?php selected( $delete_file, 1 ); ?>><?php _e( 'No', 'woocommerce-exporter' ); ?></option>
38
+ </select>
39
+ <?php if( $delete_file == 1 && woo_ce_get_option( 'hide_archives_tab', 0 ) == 1 ) { ?>
40
+ <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'restore_archives_tab', '_wpnonce' => wp_create_nonce( 'woo_ce_restore_archives_tab' ) ) ) ); ?>"><?php _e( 'Restore Archives tab', 'woocommerce-exporter' ); ?></a>
41
+ <?php } ?>
42
+ <?php if( $delete_file == 0 ) { ?>
43
+ <p class="warning"><?php _e( 'Warning: Saving sensitve export files (e.g. Customers, Orders, etc.) to the WordPress Media directory will make the export files accessible to the public without restriction.', 'woocommerce-exporter' ); ?></p>
44
+ <?php } ?>
45
+ <p class="description"><?php _e( 'Save copies of exports to the WordPress Media for later downloading. By default this option is turned off.', 'woocommerce-exporter' ); ?></p>
46
+ </td>
47
+ </tr>
48
+ <tr>
49
+ <th>
50
+ <label for="encoding"><?php _e( 'Character encoding', 'woocommerce-exporter' ); ?></label>
51
+ </th>
52
+ <td>
53
+ <?php if( $file_encodings ) { ?>
54
+ <select id="encoding" name="encoding">
55
+ <option value=""><?php _e( 'System default', 'woocommerce-exporter' ); ?></option>
56
+ <?php foreach( $file_encodings as $key => $chr ) { ?>
57
+ <option value="<?php echo $chr; ?>"<?php selected( $chr, $encoding ); ?>><?php echo $chr; ?></option>
58
+ <?php } ?>
59
+ </select>
60
+ <?php } else { ?>
61
+ <?php if( version_compare( phpversion(), '5', '<' ) ) { ?>
62
+ <p class="description"><?php _e( 'Character encoding options are unavailable in PHP 4, contact your hosting provider to update your site install to use PHP 5 or higher.', 'woocommerce-exporter' ); ?></p>
63
+ <?php } else { ?>
64
+ <p class="description"><?php _e( 'Character encoding options are unavailable as the required mb_list_encodings() function is missing, contact your hosting provider to have the mbstring extension installed.', 'woocommerce-exporter' ); ?></p>
65
+ <?php } ?>
66
+ <?php } ?>
67
+ </td>
68
+ </tr>
69
+ <tr>
70
+ <th><?php _e( 'Date format', 'woocommerce-exporter' ); ?></th>
71
+ <td>
72
+ <ul style="margin-top:0.2em;">
73
+ <li><label title="F j, Y"><input type="radio" name="date_format" value="F j, Y"<?php checked( $date_format, 'F j, Y' ); ?>> <span><?php echo date( 'F j, Y' ); ?></span></label></li>
74
+ <li><label title="Y/m/d"><input type="radio" name="date_format" value="Y/m/d"<?php checked( $date_format, 'Y/m/d' ); ?>> <span><?php echo date( 'Y/m/d' ); ?></span></label></li>
75
+ <li><label title="m/d/Y"><input type="radio" name="date_format" value="m/d/Y"<?php checked( $date_format, 'm/d/Y' ); ?>> <span><?php echo date( 'm/d/Y' ); ?></span></label></li>
76
+ <li><label title="d/m/Y"><input type="radio" name="date_format" value="d/m/Y"<?php checked( $date_format, 'd/m/Y' ); ?>> <span><?php echo date( 'd/m/Y' ); ?></span></label></li>
77
+ <li><label><input type="radio" name="date_format" value="custom"<?php checked( in_array( $date_format, array( 'F j, Y', 'Y/m/d', 'm/d/Y', 'd/m/Y' ) ), false ); ?>/> <?php _e( 'Custom', 'woocommerce-exporter' ); ?>: </label><input type="text" name="date_format_custom" value="<?php echo sanitize_text_field( $date_format ); ?>" class="text" /></li>
78
+ <li><a href="http://codex.wordpress.org/Formatting_Date_and_Time" target="_blank"><?php _e( 'Documentation on date and time formatting', 'woocommerce-exporter' ); ?></a>.</li>
79
+ </ul>
80
+ <p class="description"><?php _e( 'The date format option affects how date\'s are presented within your export file. Default is set to DD/MM/YYYY.', 'woocommerce-exporter' ); ?></p>
81
+ </td>
82
+ </tr>
83
+ <?php if( !ini_get( 'safe_mode' ) ) { ?>
84
+ <tr>
85
+ <th>
86
+ <label for="timeout"><?php _e( 'Script timeout', 'woocommerce-exporter' ); ?></label>
87
+ </th>
88
+ <td>
89
+ <select id="timeout" name="timeout">
90
+ <option value="600"<?php selected( $timeout, 600 ); ?>><?php printf( __( '%s minutes', 'woocommerce-exporter' ), 10 ); ?></option>
91
+ <option value="1800"<?php selected( $timeout, 1800 ); ?>><?php printf( __( '%s minutes', 'woocommerce-exporter' ), 30 ); ?></option>
92
+ <option value="3600"<?php selected( $timeout, 3600 ); ?>><?php printf( __( '%s hour', 'woocommerce-exporter' ), 1 ); ?></option>
93
+ <option value="0"<?php selected( $timeout, 0 ); ?>><?php _e( 'Unlimited', 'woocommerce-exporter' ); ?></option>
94
+ </select>
95
+ <p class="description"><?php _e( 'Script timeout defines how long Store Exporter is \'allowed\' to process your export file, once the time limit is reached the export process halts.', 'woocommerce-exporter' ); ?></p>
96
+ </td>
97
+ </tr>
98
+
99
+ <tr>
100
+ <th>&nbsp;</th>
101
+ <td style="vertical-align:top;">
102
+ <p><a href="#" id="advanced-settings"><?php _e( 'View advanced settings', 'woocommerce-exporter' ); ?></a></p>
103
+ <div class="advanced-settings">
104
+ <ul>
105
+ <li><a href="<?php echo esc_url( add_query_arg( array( 'action' => 'nuke_notices', '_wpnonce' => wp_create_nonce( 'woo_ce_nuke_notices' ) ) ) ); ?>" class="delete" data-confirm="<?php _e( 'This will restore all dismissed notices associated with Store Exporter Deluxe. Are you sure you want to proceed?', 'woocommerce-exporter' ); ?>"><?php _e( 'Reset dismissed Store Export Deluxe notices', 'woocommerce-exporter' ); ?></a></li>
106
+ <li><a href="<?php echo esc_url( add_query_arg( array( 'action' => 'nuke_options', '_wpnonce' => wp_create_nonce( 'woo_ce_nuke_options' ) ) ) ); ?>" class="delete" data-confirm="<?php _e( 'This will permanently delete all WordPress Options associated with Store Exporter Deluxe. Are you sure you want to proceed?', 'woocommerce-exporter' ); ?>"><?php _e( 'Delete Store Exporter Deluxe WordPress Options', 'woocommerce-exporter' ); ?></a></li>
107
+ <li><a href="<?php echo esc_url( add_query_arg( array( 'action' => 'nuke_archives', '_wpnonce' => wp_create_nonce( 'woo_ce_nuke_archives' ) ) ) ); ?>" class="delete" data-confirm="<?php _e( 'This will permanently delete all saved exports listed within the Archives screen of Store Exporter Deluxe. Are you sure you want to proceed?', 'woocommerce-exporter' ); ?>"><?php _e( 'Delete archived exports', 'woocommerce-exporter' ); ?></a></li>
108
+ </ul>
109
+ </div>
110
+ <!-- .advanced-settings -->
111
+ </td>
112
+ </tr>
113
+
114
+ <?php } ?>
115
+
116
+ <?php do_action( 'woo_ce_export_settings_general' ); ?>
117
+
118
+ <tr id="csv-settings">
119
+ <td colspan="2" style="padding:0;">
120
+ <hr />
121
+ <h3><div class="dashicons dashicons-media-spreadsheet"></div>&nbsp;<?php _e( 'CSV Settings', 'woocommerce-exporter' ); ?></h3>
122
+ </td>
123
+ </tr>
124
+ <tr>
125
+ <th>
126
+ <label for="delimiter"><?php _e( 'Field delimiter', 'woocommerce-exporter' ); ?></label>
127
+ </th>
128
+ <td>
129
+ <input type="text" size="3" id="delimiter" name="delimiter" value="<?php echo esc_attr( $delimiter ); ?>" maxlength="5" class="text" />
130
+ <p class="description"><?php _e( 'The field delimiter is the character separating each cell in your CSV. This is typically the \',\' (comma) character.', 'woocommerce-exporter' ); ?></p>
131
+ </td>
132
+ </tr>
133
+ <tr>
134
+ <th>
135
+ <label for="category_separator"><?php _e( 'Category separator', 'woocommerce-exporter' ); ?></label>
136
+ </th>
137
+ <td>
138
+ <input type="text" size="3" id="category_separator" name="category_separator" value="<?php echo esc_attr( $category_separator ); ?>" maxlength="5" class="text" />
139
+ <p class="description"><?php _e( 'The Product Category separator allows you to assign individual Products to multiple Product Categories/Tags/Images at a time. It is suggested to use the \'|\' (vertical pipe) character or \'LF\' for line breaks between each item. For instance: <code>Clothing|Mens|Shirts</code>.', 'woocommerce-exporter' ); ?></p>
140
+ </td>
141
+ </tr>
142
+ <tr>
143
+ <th>
144
+ <label for="line_ending"><?php _e( 'Line ending formatting', 'woocommerce-exporter' ); ?></label>
145
+ </th>
146
+ <td>
147
+ <select id="line_ending" name="line_ending">
148
+ <option value="windows" selected="selected"><?php _e( 'Windows', 'woocommerce-exporter' ); ?></option>
149
+ <option value="mac" disabled="disabled"><?php _e( 'Mac' ,'woocommerce-exporter' ); ?></option>
150
+ <option value="unix" disabled="disabled"><?php _e( 'Unix', 'woocommerce-exporter' ); ?></option>
151
+ </select>
152
+ <span class="description"> - <?php printf( __( 'available in %s', 'woocommerce-exporter' ), $woo_cd_link ); ?></span>
153
+ <p class="description"><?php _e( 'Choose the line ending formatting that suits the Operating System you plan to use the export file with (e.g. a Windows desktop, Mac laptop, etc.). Default is Windows.', 'woocommerce-exporter' ); ?></p>
154
+ </td>
155
+ </tr>
156
+ <tr>
157
+ <th>
158
+ <label for="bom"><?php _e( 'Add BOM character', 'woocommerce-exporter' ); ?></label>
159
+ </th>
160
+ <td>
161
+ <select id="bom" name="bom">
162
+ <option value="1"<?php selected( $bom, 1 ); ?>><?php _e( 'Yes', 'woocommerce-exporter' ); ?></option>
163
+ <option value="0"<?php selected( $bom, 0 ); ?>><?php _e( 'No', 'woocommerce-exporter' ); ?></option>
164
+ </select>
165
+ <p class="description"><?php _e( 'Mark the CSV file as UTF8 by adding a byte order mark (BOM) to the export, useful for non-English character sets.', 'woocommerce-exporter' ); ?></p>
166
+ </td>
167
+ </tr>
168
+ <tr>
169
+ <th>
170
+ <label for="escape_formatting"><?php _e( 'Field escape formatting', 'woocommerce-exporter' ); ?></label>
171
+ </th>
172
+ <td>
173
+ <ul style="margin-top:0.2em;">
174
+ <li><label><input type="radio" name="escape_formatting" value="all"<?php checked( $escape_formatting, 'all' ); ?> />&nbsp;<?php _e( 'Escape all fields', 'woocommerce-exporter' ); ?></label></li>
175
+ <li><label><input type="radio" name="escape_formatting" value="excel"<?php checked( $escape_formatting, 'excel' ); ?> />&nbsp;<?php _e( 'Escape fields as Excel would', 'woocommerce-exporter' ); ?></label></li>
176
+ </ul>
177
+ <p class="description"><?php _e( 'Choose the field escape format that suits your spreadsheet software (e.g. Excel).', 'woocommerce-exporter' ); ?></p>
178
+ </td>
179
+ </tr>
180
+
181
+ <?php do_action( 'woo_ce_export_settings_after' ); ?>
182
+
183
+ </tbody>
184
+ </table>
185
+ <!-- .form-table -->
186
+ <p class="submit">
187
+ <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e( 'Save Changes', 'woocommerce-exporter' ); ?>" />
188
+ </p>
189
+ <input type="hidden" name="action" value="save-settings" />
190
+ <?php wp_nonce_field( 'woo_ce_save_settings' ); ?>
191
+ </form>
192
+ <?php do_action( 'woo_ce_export_settings_bottom' ); ?>
templates/admin/tabs-tools.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <ul class="subsubsub">
2
+ <li><a href="#tools"><?php _e( 'Tools', 'woocommerce-exporter' ); ?></a> |</li>
3
+ <li><a href="#export-modules"><?php _e( 'Export Modules', 'woocommerce-exporter' ); ?></a></li>
4
+ </ul>
5
+ <!-- .subsubsub -->
6
+ <br class="clear" />
7
+
8
+ <div id="poststuff">
9
+
10
+ <?php do_action( 'woo_ce_before_tools' ); ?>
11
+
12
+ <div id="tools" class="postbox">
13
+ <h3 class="hndle"><?php _e( 'WooCommerce Tools', 'woocommerce-exporter' ); ?></h3>
14
+ <div class="inside">
15
+ <p><?php _e( 'Extend your store with other WooCommerce extensions from us.', 'woocommerce-exporter' ); ?></p>
16
+ <table class="form-table">
17
+
18
+ <tr>
19
+ <td>
20
+ <a href="<?php echo $woo_pd_url; ?>"<?php echo $woo_pd_target; ?>><?php _e( 'Import Products from CSV', 'woocommerce-exporter' ); ?></a>
21
+ <p class="description"><?php _e( 'Use Product Importer Deluxe to import Product changes back into your WooCommerce store.', 'woocommerce-exporter' ); ?></p>
22
+ </td>
23
+ </tr>
24
+
25
+ <tr>
26
+ <td>
27
+ <a href="<?php echo $woo_st_url; ?>"<?php echo $woo_st_target; ?>><?php _e( 'Store Toolkit', 'woocommerce-exporter' ); ?></a>
28
+ <p class="description"><?php _e( 'Store Toolkit includes a growing set of commonly-used WooCommerce administration tools aimed at web developers and store maintainers.', 'woocommerce-exporter' ); ?></p>
29
+ </td>
30
+ </tr>
31
+
32
+ </table>
33
+ </div>
34
+ </div>
35
+ <!-- .postbox -->
36
+
37
+ <?php do_action( 'woo_ce_after_tools' ); ?>
38
+
39
+ <?php do_action( 'woo_ce_before_modules' ); ?>
40
+
41
+ <div id="export-modules" class="postbox">
42
+ <h3 class="hndle">
43
+ <?php _e( 'Export Modules', 'woocommerce-exporter' ); ?>
44
+ <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'refresh_module_counts', '_wpnonce' => wp_create_nonce( 'woo_ce_refresh_module_counts' ) ) ) ); ?>" style="float:right;"><?php _e( 'Refresh counts', 'woocommerce-exporter' ); ?></a>
45
+ </h3>
46
+ <div class="inside">
47
+ <p><?php _e( 'Export store details from other WooCommerce and WordPress Plugins, simply install and activate one of the below Plugins to enable those additional export options.', 'woocommerce-exporter' ); ?></p>
48
+ <?php if( $modules ) { ?>
49
+ <ul class="subsubsub">
50
+ <li><a href="<?php echo esc_url( add_query_arg( 'module_status', 'all' ) ); ?>"<?php echo ( empty( $module_status ) ? 'class="current"' : '' ); ?>><?php _e( 'All', 'woocommerce-exporter' ); ?></a> <span class="count">(<?php echo $modules_all; ?>)</span> |</li>
51
+ <li><a href="<?php echo esc_url( add_query_arg( 'module_status', 'active' ) ); ?>"<?php echo ( $module_status == 'active' ? 'class="current"' : '' ); ?>><?php _e( 'Active', 'woocommerce-exporter' ); ?></a> <span class="count">(<?php echo $modules_active; ?>)</span> |</li>
52
+ <li><a href="<?php echo esc_url( add_query_arg( 'module_status', 'inactive' ) ); ?>"<?php echo ( $module_status == 'inactive' ? 'class="current"' : '' ); ?>><?php _e( 'Inactive', 'woocommerce-exporter' ); ?></a> <span class="count">(<?php echo $modules_inactive; ?>)</span></li>
53
+ </ul>
54
+ <!-- .subsubsub -->
55
+ <br class="clear" />
56
+ <hr />
57
+
58
+ <div class="table table_content">
59
+ <table class="woo_vm_version_table">
60
+ <?php foreach( $modules as $module ) { ?>
61
+ <tr>
62
+ <td class="export_module">
63
+ <?php if( $module['description'] ) { ?>
64
+ <strong><?php echo $module['title']; ?></strong>: <span class="description"><?php echo $module['description']; ?></span>
65
+ <?php } else { ?>
66
+ <strong><?php echo $module['title']; ?></strong>
67
+ <?php } ?>
68
+ </td>
69
+ <td class="status">
70
+ <div class="<?php woo_ce_modules_status_class( $module['status'] ); ?>">
71
+ <?php if( $module['status'] == 'active' ) { ?>
72
+ <div class="dashicons dashicons-yes" style="color:#008000;"></div><?php woo_ce_modules_status_label( $module['status'] ); ?>
73
+ <?php } else { ?>
74
+ <?php if( $module['url'] ) { ?>
75
+ <?php if( isset( $module['slug'] ) ) { echo '<div class="dashicons dashicons-download" style="color:#0074a2;"></div>'; } else { echo '<div class="dashicons dashicons-admin-links"></div>'; } ?>&nbsp;<a href="<?php echo ( isset( $module['slug'] ) ? $module['url'] : add_query_arg( 'ref', 'visserlabs', $module['url'] ) ); ?>" target="_blank"<?php if( isset( $module['slug'] ) ) { echo ' title="' . __( 'Install via WordPress Plugin Directory', 'woocommerce-exporter' ) . '"'; } else { echo ' title="' . __( 'Visit the Plugin website', 'woocommerce-exporter' ) . '"'; } ?>><?php woo_ce_modules_status_label( $module['status'] ); ?></a>
76
+ <?php } ?>
77
+ <?php } ?>
78
+ </div>
79
+ </td>
80
+ </tr>
81
+ <?php } ?>
82
+ </table>
83
+ </div>
84
+ <!-- .table -->
85
+ <?php } else { ?>
86
+ <p><?php _e( 'No export modules are available at this time.', 'woocommerce-exporter' ); ?></p>
87
+ <?php } ?>
88
+ </div>
89
+ <!-- .inside -->
90
+ </div>
91
+ <!-- .postbox -->
92
+
93
+ <?php do_action( 'woo_ce_after_modules' ); ?>
94
+
95
+ </div>
96
+ <!-- #poststuff -->
templates/admin/tabs.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <?php if( !woo_ce_get_option( 'hide_archives_tab', 0 ) ) { ?>
7
+ <a data-tab-id="archive" class="nav-tab<?php woo_ce_admin_active_tab( 'archive' ); ?>" href="<?php echo esc_url( add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'archive' ), 'admin.php' ) ); ?>"><?php _e( 'Archives', 'woocommerce-exporter' ); ?></a>
8
+ <?php } ?>
9
+ <a data-tab-id="settings" class="nav-tab<?php woo_ce_admin_active_tab( 'settings' ); ?>" href="<?php echo esc_url( add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'settings' ), 'admin.php' ) ); ?>"><?php _e( 'Settings', 'woocommerce-exporter' ); ?></a>
10
+ <a data-tab-id="tools" class="nav-tab<?php woo_ce_admin_active_tab( 'tools' ); ?>" href="<?php echo esc_url( add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'tools' ), 'admin.php' ) ); ?>"><?php _e( 'Tools', 'woocommerce-exporter' ); ?></a>
11
+ </h2>
12
+ <?php woo_ce_tab_template( $tab ); ?>
13
+
14
+ </div>
15
+ <!-- #content -->
templates/admin/woo-admin_ce-export.css ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Tabbed navigation */
2
+
3
+ .woocommerce_page_woo_ce h2 .nav-tab {
4
+ font-size: 16px;
5
+ margin-right:0;
6
+ }
7
+
8
+ .woocommerce_page_woo_ce h2.nav-tab-wrapper {
9
+ padding-left:7px;
10
+ }
11
+
12
+ /* Export */
13
+
14
+ .woocommerce_page_woo_ce #export-type th {
15
+ padding:0;
16
+ }
17
+ .woocommerce_page_woo_ce #export-type td {
18
+ padding:0;
19
+ }
20
+ .woocommerce_page_woo_ce .postbox .submit {
21
+ padding:0.3em 0;
22
+ }
23
+ .woocommerce_page_woo_ce textarea#export_log {
24
+ font:12px Consolas, Monaco, Courier, monospace;
25
+ width:100%;
26
+ height:200px;
27
+ }
28
+ .woocommerce_page_woo_ce .separator {
29
+ border-bottom:1px solid #dfdfdf;
30
+ }
31
+
32
+ .woocommerce_page_woo_ce .overview-left {
33
+ float:left;
34
+ width:73%;
35
+ }
36
+ .woocommerce_page_woo_ce .overview-right {
37
+ float:left;
38
+ width:24%;
39
+ }
40
+ .woocommerce_page_woo_ce .overview-right h3 {
41
+ font-size:16px;
42
+ }
43
+ .woocommerce_page_woo_ce .overview-right h3 span {
44
+ float:right;
45
+ font-size:11px;
46
+ font-weight:normal;
47
+ }
48
+ .woocommerce_page_woo_ce .overview-right p {
49
+ font-size:12px;
50
+ color:#333;
51
+ line-height:1.6em;
52
+ }
53
+ .woocommerce_page_woo_ce .overview-right ul {
54
+ font-size:12px;
55
+ line-height:1.2em;
56
+ }
57
+
58
+ /* Support - Donate / Rate */
59
+
60
+ .woocommerce_page_woo_ce .support-donate_rate {
61
+ display:block;
62
+ float:right;
63
+ }
64
+ .woocommerce_page_woo_ce .support-donate_rate p {
65
+ margin-top:16px;
66
+ }
67
+ .woocommerce_page_woo_ce .support-donate_rate .star {
68
+ vertical-align:bottom;
69
+ display:inline-block;
70
+ width:17px;
71
+ height:17px;
72
+ background:url('images/star.png') no-repeat;
73
+ }
74
+ .woocommerce_page_woo_ce .support-donate_rate span {
75
+ display:none;
76
+ }
templates/admin/woo-admin_ce-export.js ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var $j = jQuery.noConflict();
2
+ $j(function() {
3
+
4
+ $j('#skip_overview').click(function(){
5
+ $j('#skip_overview_form').submit();
6
+ });
7
+
8
+ // Date Picker
9
+ $j('.datepicker').datepicker({
10
+ dateFormat: 'dd/mm/yy'
11
+ });
12
+
13
+ // Chosen
14
+ $j(".chzn-select").chosen({
15
+ search_contains: true
16
+ });
17
+
18
+ $j('#export-products').show();
19
+ // Categories
20
+ $j('#export-products-filters-categories').hide();
21
+ if( $j('#products-filters-categories').attr('checked') ) {
22
+ $j('#export-products-filters-categories').show();
23
+ }
24
+ // Tags
25
+ $j('#export-products-filters-tags').hide();
26
+ if( $j('#products-filters-tags').attr('checked') ) {
27
+ $j('#export-products-filters-tags').show();
28
+ }
29
+ // Product Status
30
+ $j('#export-products-filters-status').hide();
31
+ if( $j('#products-filters-status').attr('checked') ) {
32
+ $j('#export-products-filters-status').show();
33
+ }
34
+ $j('#export-products-filters-type').hide();
35
+ if( $j('#products-filters-type').attr('checked') ) {
36
+ $j('#export-products-filters-type').show();
37
+ }
38
+ $j('#export-categories').hide();
39
+ $j('#export-tags').hide();
40
+ $j('#export-orders').hide();
41
+ $j('#export-orders-filters-status').hide();
42
+ if( $j('#orders-filters-status').attr('checked') ) {
43
+ $j('#export-orders-filters-status').show();
44
+ }
45
+ $j('#export-orders-filters-date').hide();
46
+ if( $j('#orders-filters-date').attr('checked') ) {
47
+ $j('#export-orders-filters-date').show();
48
+ }
49
+ $j('#export-orders-filters-user_role').hide();
50
+ if( $j('#orders-filters-user_role').attr('checked') ) {
51
+ $j('#export-orders-filters-user_role').show();
52
+ }
53
+ $j('#export-customers').hide();
54
+ $j('#export-coupons').hide();
55
+
56
+ $j('#products-filters-categories').click(function(){
57
+ $j('#export-products-filters-categories').toggle();
58
+ });
59
+ $j('#products-filters-tags').click(function(){
60
+ $j('#export-products-filters-tags').toggle();
61
+ });
62
+ $j('#products-filters-status').click(function(){
63
+ $j('#export-products-filters-status').toggle();
64
+ });
65
+ $j('#products-filters-type').click(function(){
66
+ $j('#export-products-filters-type').toggle();
67
+ });
68
+ $j('#orders-filters-status').click(function(){
69
+ $j('#export-orders-filters-status').toggle();
70
+ });
71
+ $j('#orders-filters-date').click(function(){
72
+ $j('#export-orders-filters-date').toggle();
73
+ });
74
+ $j('#orders-filters-user_role').click(function(){
75
+ $j('#export-orders-filters-user_role').toggle();
76
+ });
77
+
78
+ // Export types
79
+ $j('#products').click(function(){
80
+ $j('#export-products').show();
81
+ $j('#export-categories').hide();
82
+ $j('#export-tags').hide();
83
+ $j('#export-orders').hide();
84
+ $j('#export-customers').hide();
85
+ $j('#export-coupons').hide();
86
+
87
+ $j('.export-options').hide();
88
+ $j('.product-options').show();
89
+ });
90
+ $j('#categories').click(function(){
91
+ $j('#export-products').hide();
92
+ $j('#export-categories').show();
93
+ $j('#export-tags').hide();
94
+ $j('#export-orders').hide();
95
+ $j('#export-customers').hide();
96
+ $j('#export-coupons').hide();
97
+
98
+ $j('.export-options').hide();
99
+ $j('.category-options').show();
100
+ });
101
+ $j('#tags').click(function(){
102
+ $j('#export-products').hide();
103
+ $j('#export-categories').hide();
104
+ $j('#export-tags').show();
105
+ $j('#export-orders').hide();
106
+ $j('#export-customers').hide();
107
+ $j('#export-coupons').hide();
108
+
109
+ $j('.export-options').hide();
110
+ $j('.tag-options').show();
111
+ });
112
+ $j('#orders').click(function(){
113
+ $j('#export-products').hide();
114
+ $j('#export-categories').hide();
115
+ $j('#export-tags').hide();
116
+ $j('#export-orders').show();
117
+ $j('#export-customers').hide();
118
+ $j('#export-coupons').hide();
119
+
120
+ $j('.export-options').hide();
121
+ $j('.order-options').show();
122
+ });
123
+ $j('#customers').click(function(){
124
+ $j('#export-products').hide();
125
+ $j('#export-categories').hide();
126
+ $j('#export-tags').hide();
127
+ $j('#export-orders').hide();
128
+ $j('#export-customers').show();
129
+ $j('#export-coupons').hide();
130
+
131
+ $j('.export-options').hide();
132
+ $j('.customer-options').show();
133
+ });
134
+ $j('#coupons').click(function(){
135
+ $j('#export-products').hide();
136
+ $j('#export-categories').hide();
137
+ $j('#export-tags').hide();
138
+ $j('#export-orders').hide();
139
+ $j('#export-customers').hide();
140
+ $j('#export-coupons').show();
141
+
142
+ $j('.export-options').hide();
143
+ $j('.coupon-options').show();
144
+ });
145
+
146
+ // Export button
147
+ $j('#export_products').click(function(){
148
+ $j('input:radio[name=dataset]:nth(0)').attr('checked',true);
149
+ });
150
+ $j('#export_orders').click(function(){
151
+ $j('input:radio[name=dataset]:nth(3)').attr('checked',true);
152
+ });
153
+ $j('#export_customers').click(function(){
154
+ $j('input:radio[name=dataset]:nth(4)').attr('checked',true);
155
+ });
156
+ $j('#export_coupons').click(function(){
157
+ $j('input:radio[name=dataset]:nth(5)').attr('checked',true);
158
+ });
159
+
160
+ // Select all
161
+ $j('.checkall').click(function () {
162
+ $j(this).closest('.postbox').find(':checkbox').attr('checked', true);
163
+ });
164
+ $j('.uncheckall').click(function () {
165
+ $j(this).closest('.postbox').find(':checkbox').attr('checked', false);
166
+ });
167
+
168
+ $j(document).ready(function() {
169
+ var href = jQuery(location).attr('href');
170
+ if (href.toLowerCase().indexOf('tab=export') >= 0) {
171
+ if (href.toLowerCase().indexOf('#') >= 0 ) {
172
+ var type = href.substr(href.indexOf("#") + 1)
173
+ var type = type.replace('export-','');
174
+ $j('#'+type).trigger('click');
175
+ }
176
+ }
177
+ });
178
+
179
+ });
templates/admin/woo-admin_ce-export.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="content">
2
+
3
+ <h2 class="nav-tab-wrapper">
4
+ <a data-tab-id="overview" class="nav-tab<?php woo_ce_admin_active_tab( 'overview' ); ?>" href="<?php echo add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'overview' ), 'admin.php' ); ?>"><?php _e( 'Overview', 'woo_ce' ); ?></a>
5
+ <a data-tab-id="export" class="nav-tab<?php woo_ce_admin_active_tab( 'export' ); ?>" href="<?php echo add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'export' ), 'admin.php' ); ?>"><?php _e( 'Export', 'woo_ce' ); ?></a>
6
+ <a data-tab-id="archive" class="nav-tab<?php woo_ce_admin_active_tab( 'archive' ); ?>" href="<?php echo add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'archive' ), 'admin.php' ); ?>"><?php _e( 'Archives', 'woo_ce' ); ?></a>
7
+ <a data-tab-id="settings" class="nav-tab<?php woo_ce_admin_active_tab( 'settings' ); ?>" href="<?php echo add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'settings' ), 'admin.php' ); ?>"><?php _e( 'Settings', 'woo_ce' ); ?></a>
8
+ <a data-tab-id="tools" class="nav-tab<?php woo_ce_admin_active_tab( 'tools' ); ?>" href="<?php echo add_query_arg( array( 'page' => 'woo_ce', 'tab' => 'tools' ), 'admin.php' ); ?>"><?php _e( 'Tools', 'woo_ce' ); ?></a>
9
+ </h2>
10
+ <?php woo_ce_tab_template( $tab ); ?>
11
+
12
+ </div>
13
+ <!-- #content -->
templates/admin/woo-admin_ce-export_archive.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <ul class="subsubsub">
2
+ <li><a href="<?php echo add_query_arg( 'filter', null ); ?>"<?php woo_ce_archives_quicklink_current( 'all' ); ?>><?php _e( 'All', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count(); ?>)</span></a> |</li>
3
+ <li><a href="<?php echo add_query_arg( 'filter', 'products' ); ?>"<?php woo_ce_archives_quicklink_current( 'products' ); ?>><?php _e( 'Products', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'products' ); ?>)</span></a> |</li>
4
+ <li><a href="<?php echo add_query_arg( 'filter', 'categories' ); ?>"<?php woo_ce_archives_quicklink_current( 'categories' ); ?>><?php _e( 'Categories', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'categories' ); ?>)</span></a> |</li>
5
+ <li><a href="<?php echo add_query_arg( 'filter', 'tags' ); ?>"<?php woo_ce_archives_quicklink_current( 'tags' ); ?>><?php _e( 'Tags', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'tags' ); ?>)</span></a> |</li>
6
+ <li><a href="<?php echo add_query_arg( 'filter', 'orders' ); ?>"<?php woo_ce_archives_quicklink_current( 'orders' ); ?>><?php _e( 'Orders', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'orders' ); ?>)</span></a> |</li>
7
+ <li><a href="<?php echo add_query_arg( 'filter', 'customers' ); ?>"<?php woo_ce_archives_quicklink_current( 'customers' ); ?>><?php _e( 'Customers', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'customers' ); ?>)</span></a> |</li>
8
+ <li><a href="<?php echo add_query_arg( 'filter', 'coupons' ); ?>"<?php woo_ce_archives_quicklink_current( 'coupons' ); ?>><?php _e( 'Coupons', 'woo_ce' ); ?> <span class="count">(<?php woo_ce_archives_quicklink_count( 'coupons' ); ?>)</span></a></li>
9
+ </ul>
10
+ <br class="clear" />
11
+ <form action="" method="GET">
12
+ <table class="widefat fixed media" cellspacing="0">
13
+ <thead>
14
+
15
+ <tr>
16
+ <th scope="col" id="icon" class="manage-column column-icon"></th>
17
+ <th scope="col" id="title" class="manage-column column-title"><?php _e( 'Filename', 'woo_ce' ); ?></th>
18
+ <th scope="col" class="manage-column column-type"><?php _e( 'Type', 'woo_ce' ); ?></th>
19
+ <th scope="col" class="manage-column column-author"><?php _e( 'Author', 'woo_ce' ); ?></th>
20
+ <th scope="col" id="title" class="manage-column column-title"><?php _e( 'Date', 'woo_ce' ); ?></th>
21
+ </tr>
22
+
23
+ </thead>
24
+ <tfoot>
25
+
26
+ <tr>
27
+ <th scope="col" class="manage-column column-icon"></th>
28
+ <th scope="col" class="manage-column column-title"><?php _e( 'Filename', 'woo_ce' ); ?></th>
29
+ <th scope="col" class="manage-column column-type"><?php _e( 'Type', 'woo_ce' ); ?></th>
30
+ <th scope="col" class="manage-column column-author"><?php _e( 'Author', 'woo_ce' ); ?></th>
31
+ <th scope="col" class="manage-column column-title"><?php _e( 'Date', 'woo_ce' ); ?></th>
32
+ </tr>
33
+
34
+ </tfoot>
35
+ <tbody id="the-list">
36
+
37
+ <?php if( $files ) { ?>
38
+ <?php foreach( $files as $file ) { ?>
39
+ <tr id="post-<?php echo $file->ID; ?>" class="author-self status-<?php echo $file->post_status; ?>" valign="top">
40
+ <td class="column-icon media-icon">
41
+ <?php echo $file->media_icon; ?>
42
+ </td>
43
+ <td class="post-title page-title column-title">
44
+ <strong><a href="<?php echo $file->guid; ?>" class="row-title"><?php echo $file->post_title; ?></a></strong>
45
+ <div class="row-actions">
46
+ <span class="view"><a href="<?php echo get_edit_post_link( $file->ID ); ?>" title="<?php _e( 'Edit', 'woo_ce' ); ?>"><?php _e( 'Edit', 'woo_ce' ); ?></a></span> |
47
+ <span class="trash"><a href="<?php echo get_delete_post_link( $file->ID, '', true ); ?>" title="<?php _e( 'Delete Permanently', 'woo_ce' ); ?>"><?php _e( 'Delete', 'woo_ce' ); ?></a></span>
48
+ </div>
49
+ </td>
50
+ <td class="title">
51
+ <a href="<?php echo add_query_arg( 'filter', $file->export_type ); ?>"><?php echo $file->export_type_label; ?></a>
52
+ </td>
53
+ <td class="author column-author"><?php echo $file->post_author_name; ?></td>
54
+ <td class="date column-date"><?php echo $file->post_date; ?></td>
55
+ </tr>
56
+ <?php } ?>
57
+ <?php } else { ?>
58
+ <tr id="post-<?php echo $file->ID; ?>" class="author-self" valign="top">
59
+ <td colspan="3" class="colspanchange"><?php _e( 'No past exports found.', 'woo_ce' ); ?></td>
60
+ </tr>
61
+ <?php } ?>
62
+
63
+ </tbody>
64
+ </table>
65
+ </form>
templates/admin/woo-admin_ce-export_export.php ADDED
@@ -0,0 +1,511 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <ul class="subsubsub">
2
+ <li><a href="#export-type"><?php _e( 'Export Type', 'woo_ce' ); ?></a> |</li>
3
+ <li><a href="#export-options"><?php _e( 'Export Options', 'woo_ce' ); ?></a></li>
4
+ <?php do_action( 'woo_ce_export_quicklinks' ); ?>
5
+ </ul>
6
+ <br class="clear" />
7
+ <p><?php _e( 'Select an export type from the list below to export entries. Once you have selected an export type you may select the fields you would like to export and optional filters available for each export type. When you click the export button below, Store Exporter will create a CSV file for you to save to your computer.', 'woo_ce' ); ?></p>
8
+ <form method="post" action="<?php echo add_query_arg( array( 'failed' => null, 'empty' => null, 'message' => null ) ); ?>" id="postform">
9
+ <div id="poststuff">
10
+
11
+ <div class="postbox" id="export-type">
12
+ <h3 class="hndle"><?php _e( 'Export Type', 'woo_ce' ); ?></h3>
13
+ <div class="inside">
14
+ <p class="description"><?php _e( 'Select the data type you want to export.', 'woo_ce' ); ?></p>
15
+ <table class="form-table">
16
+
17
+ <tr>
18
+ <th>
19
+ <input type="radio" id="products" name="dataset" value="products"<?php disabled( $products, 0 ); ?><?php checked( $dataset, 'products' ); ?> />
20
+ <label for="products"><?php _e( 'Products', 'woo_ce' ); ?></label>
21
+ </th>
22
+ <td>
23
+ <span class="description">(<?php echo $products; ?>)</span>
24
+ </td>
25
+ </tr>
26
+
27
+ <tr>
28
+ <th>
29
+ <input type="radio" id="categories" name="dataset" value="categories"<?php disabled( $categories, 0 ); ?><?php checked( $dataset, 'categories' ); ?> />
30
+ <label for="categories"><?php _e( 'Categories', 'woo_ce' ); ?></label>
31
+ </th>
32
+ <td>
33
+ <span class="description">(<?php echo $categories; ?>)</span>
34
+ </td>
35
+ </tr>
36
+
37
+ <tr>
38
+ <th>
39
+ <input type="radio" id="tags" name="dataset" value="tags"<?php disabled( $tags, 0 ); ?><?php checked( $dataset, 'tags' ); ?> />
40
+ <label for="tags"><?php _e( 'Tags', 'woo_ce' ); ?></label>
41
+ </th>
42
+ <td>
43
+ <span class="description">(<?php echo $tags; ?>)</span>
44
+ </td>
45
+ </tr>
46
+
47
+ <tr>
48
+ <th>
49
+ <input type="radio" id="orders" name="dataset" value="orders"<?php disabled( $orders, 0 ); ?><?php checked( $dataset, 'orders' ); ?>/>
50
+ <label for="orders"><?php _e( 'Orders', 'woo_ce' ); ?></label>
51
+ </th>
52
+ <td>
53
+ <span class="description">(<?php echo $orders; ?>)</span>
54
+ <?php if( !function_exists( 'woo_cd_admin_init' ) ) { ?>
55
+ <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
56
+ <?php } ?>
57
+ </td>
58
+ </tr>
59
+
60
+ <tr>
61
+ <th>
62
+ <input type="radio" id="customers" name="dataset" value="customers"<?php disabled( $customers, 0 ); ?><?php checked( $dataset, 'customers' ); ?>/>
63
+ <label for="customers"><?php _e( 'Customers', 'woo_ce' ); ?></label>
64
+ </th>
65
+ <td>
66
+ <span class="description">(<?php echo $customers; ?>)</span>
67
+ <?php if( !function_exists( 'woo_cd_admin_init' ) ) { ?>
68
+ <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
69
+ <?php } ?>
70
+ </td>
71
+ </tr>
72
+
73
+ <tr>
74
+ <th>
75
+ <input type="radio" id="coupons" name="dataset" value="coupons"<?php disabled( $coupons, 0 ); ?><?php checked( $dataset, 'coupons' ); ?> />
76
+ <label for="coupons"><?php _e( 'Coupons', 'woo_ce' ); ?></label>
77
+ </th>
78
+ <td>
79
+ <span class="description">(<?php echo $coupons; ?>)</span>
80
+ <?php if( !function_exists( 'woo_cd_admin_init' ) ) { ?>
81
+ <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
82
+ <?php } ?>
83
+ </td>
84
+ </tr>
85
+
86
+ </table>
87
+ <!--
88
+ <p class="submit">
89
+ <input type="submit" value="<?php _e( 'Export', 'woo_ce' ); ?>" class="button-primary" />
90
+ </p>
91
+ -->
92
+ </div>
93
+ </div>
94
+ <!-- .postbox -->
95
+
96
+ <?php if( $product_fields ) { ?>
97
+ <div id="export-products">
98
+
99
+ <div class="postbox">
100
+ <h3 class="hndle"><?php _e( 'Product Fields', 'woo_ce' ); ?></h3>
101
+ <div class="inside">
102
+ <?php if( $products ) { ?>
103
+ <p class="description"><?php _e( 'Select the Product fields you would like to export, your field selection is saved for future exports.', 'woo_ce' ); ?></p>
104
+ <p><a href="javascript:void(0)" id="products-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="products-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
105
+ <table>
106
+
107
+ <?php foreach( $product_fields as $product_field ) { ?>
108
+ <tr>
109
+ <td>
110
+ <label>
111
+ <input type="checkbox" name="product_fields[<?php echo $product_field['name']; ?>]" class="product_field"<?php checked( $product_field['default'], 1 ); ?><?php disabled( $product_field['disabled'], 1 ); ?> />
112
+ <?php echo $product_field['label']; ?>
113
+ </label>
114
+ </td>
115
+ </tr>
116
+
117
+ <?php } ?>
118
+ </table>
119
+ <p class="submit">
120
+ <input type="submit" id="export_products" value="<?php _e( 'Export Products', 'woo_ce' ); ?> " class="button-primary" />
121
+ </p>
122
+ <p class="description"><?php _e( 'Can\'t find a particular Product field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
123
+ <?php } else { ?>
124
+ <p><?php _e( 'No Products have been found.', 'woo_ce' ); ?></p>
125
+ <?php } ?>
126
+ </div>
127
+ </div>
128
+ <!-- .postbox -->
129
+
130
+ <div id="export-products-filters" class="postbox">
131
+ <h3 class="hndle"><?php _e( 'Product Filters', 'woo_ce' ); ?></h3>
132
+ <div class="inside">
133
+
134
+ <p><label><input type="checkbox" id="products-filters-categories" /> <?php _e( 'Filter Products by Product Categories', 'woo_ce' ); ?></label></p>
135
+ <div id="export-products-filters-categories" class="separator">
136
+ <?php if( $product_categories ) { ?>
137
+ <ul>
138
+ <?php foreach( $product_categories as $product_category ) { ?>
139
+ <li><label><input type="checkbox" name="product_filter_categories[<?php echo $product_category->term_id; ?>]" value="<?php echo $product_category->term_id; ?>" title="<?php printf( __( 'Term ID: %d', 'woo_ce' ), $product_category->term_id ); ?>"<?php disabled( $product_category->count, 0 ); ?> /> <?php echo woo_ce_format_product_category_label( $product_category->name, $product_category->parent_name ); ?> (<?php echo $product_category->count; ?>)</label></li>
140
+ <?php } ?>
141
+ </ul>
142
+ <p class="description"><?php _e( 'Select the Product Categories you want to filter exported Products by. Default is to include all Product Categories.', 'woo_ce' ); ?></p>
143
+ <?php } else { ?>
144
+ <p><?php _e( 'No Product Categories have been found.', 'woo_ce' ); ?></p>
145
+ <?php } ?>
146
+ </div>
147
+ <!-- #export-products-filters-categories -->
148
+
149
+ <p><label><input type="checkbox" id="products-filters-tags" /> <?php _e( 'Filter Products by Product Tags', 'woo_ce' ); ?></label></p>
150
+ <div id="export-products-filters-tags" class="separator">
151
+ <?php if( $product_tags ) { ?>
152
+ <ul>
153
+ <?php foreach( $product_tags as $product_tag ) { ?>
154
+ <li><label><input type="checkbox" name="product_filter_tags[<?php echo $product_tag->term_id; ?>]" value="<?php echo $product_tag->term_id; ?>" title="<?php printf( __( 'Term ID: %d', 'woo_ce' ), $product_tag->term_id ); ?>"<?php disabled( $product_tag->count, 0 ); ?> /> <?php echo $product_tag->name; ?> (<?php echo $product_tag->count; ?>)</label></li>
155
+ <?php } ?>
156
+ </ul>
157
+ <p class="description"><?php _e( 'Select the Product Tags you want to filter exported Products by. Default is to include all Product Tags.', 'woo_ce' ); ?></p>
158
+ <?php } else { ?>
159
+ <p><?php _e( 'No Product Tags have been found.', 'woo_ce' ); ?></p>
160
+ <?php } ?>
161
+ </div>
162
+ <!-- #export-products-filters-tags -->
163
+
164
+ <p><label><input type="checkbox" id="products-filters-status" /> <?php _e( 'Filter Products by Product Status', 'woo_ce' ); ?></label></p>
165
+ <div id="export-products-filters-status" class="separator">
166
+ <ul>
167
+ <?php foreach( $product_statuses as $key => $product_status ) { ?>
168
+ <li><label><input type="checkbox" name="product_filter_status[<?php echo $key; ?>]" value="<?php echo $key; ?>" /> <?php echo $product_status; ?></label></li>
169
+ <?php } ?>
170
+ </ul>
171
+ <p class="description"><?php _e( 'Select the Product Status options you want to filter exported Products by. Default is to include all Product Status options.', 'woo_ce' ); ?></p>
172
+ </div>
173
+ <!-- #export-products-filters-status -->
174
+
175
+ <p><label><input type="checkbox" id="products-filters-type" /> <?php _e( 'Filter Products by Product Type', 'woo_ce' ); ?></label></p>
176
+ <div id="export-products-filters-type" class="separator">
177
+ <ul>
178
+ <?php foreach( $product_types as $key => $product_type ) { ?>
179
+ <li><label><input type="checkbox" name="product_filter_type[<?php echo $key; ?>]" value="<?php echo $key; ?>" /> <?php echo woo_ce_format_product_type( $product_type['name'] ); ?> (<?php echo $product_type['count']; ?>)</label></li>
180
+ <?php } ?>
181
+ </ul>
182
+ <p class="description"><?php _e( 'Select the Product Type\'s you want to filter exported Products by. Default is to include all Product Types and Variations.', 'woo_ce' ); ?></p>
183
+ </div>
184
+ <!-- #export-products-filters-type -->
185
+
186
+ <p><label><?php _e( 'Product Sorting', 'woo_ce' ); ?></label></p>
187
+ <div>
188
+ <select name="product_orderby">
189
+ <option value="ID"<?php selected( 'ID', $product_orderby ); ?>><?php _e( 'Product ID', 'woo_ce' ); ?></option>
190
+ <option value="title"<?php selected( 'title', $product_orderby ); ?>><?php _e( 'Product Name', 'woo_ce' ); ?></option>
191
+ <option value="date"<?php selected( 'date', $product_orderby ); ?>><?php _e( 'Date Created', 'woo_ce' ); ?></option>
192
+ <option value="modified"<?php selected( 'modified', $product_orderby ); ?>><?php _e( 'Date Modified', 'woo_ce' ); ?></option>
193
+ <option value="rand"<?php selected( 'rand', $product_orderby ); ?>><?php _e( 'Random', 'woo_ce' ); ?></option>
194
+ <option value="menu_order"<?php selected( 'menu_order', $product_orderby ); ?>><?php _e( 'Sort Order', 'woo_ce' ); ?></option>
195
+ </select>
196
+ <select name="product_order">
197
+ <option value="ASC"<?php selected( 'ASC', $product_order ); ?>><?php _e( 'Ascending', 'woo_ce' ); ?></option>
198
+ <option value="DESC"<?php selected( 'DESC', $product_order ); ?>><?php _e( 'Descending', 'woo_ce' ); ?></option>
199
+ </select>
200
+ <p class="description"><?php _e( 'Select the sorting of Products within the exported file. By default this is set to export Products by Product ID in Desending order.', 'woo_ce' ); ?></p>
201
+ </div>
202
+
203
+ </div>
204
+ <!-- .inside -->
205
+ </div>
206
+ <!-- .postbox -->
207
+
208
+ </div>
209
+ <!-- #export-products -->
210
+
211
+ <?php } ?>
212
+ <div id="export-categories">
213
+
214
+ <div class="postbox">
215
+ <h3 class="hndle"><?php _e( 'Category Fields', 'woo_ce' ); ?></h3>
216
+ <div class="inside">
217
+ <p class="description"><?php _e( 'Select the Category fields you would like to export.', 'woo_ce' ); ?></p>
218
+ <p><a href="javascript:void(0)" id="categories-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="categories-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
219
+ <table>
220
+
221
+ <?php foreach( $category_fields as $category_field ) { ?>
222
+ <tr>
223
+ <td>
224
+ <label>
225
+ <input type="checkbox" name="category_fields[<?php echo $category_field['name']; ?>]" class="category_field"<?php checked( $category_field['default'], 1 ); ?><?php disabled( $category_field['disabled'], 1 ); ?> />
226
+ <?php echo $category_field['label']; ?>
227
+ </label>
228
+ </td>
229
+ </tr>
230
+
231
+ <?php } ?>
232
+ </table>
233
+ <p class="submit">
234
+ <input type="submit" id="export_categories" value="<?php _e( 'Export Categories', 'woo_ce' ); ?> " class="button-primary" />
235
+ </p>
236
+ <p class="description"><?php _e( 'Can\'t find a particular Category field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
237
+ </div>
238
+ <!-- .inside -->
239
+ </div>
240
+ <!-- .postbox -->
241
+
242
+ <div id="export-categories-filters" class="postbox">
243
+ <h3 class="hndle"><?php _e( 'Category Filters', 'woo_ce' ); ?></h3>
244
+ <div class="inside">
245
+
246
+ <p><label><?php _e( 'Category Sorting', 'woo_ce' ); ?></label></p>
247
+ <div>
248
+ <select name="category_orderby">
249
+ <option value="id"<?php selected( 'id', $category_orderby ); ?>><?php _e( 'Term ID', 'woo_ce' ); ?></option>
250
+ <option value="name"<?php selected( 'name', $category_orderby ); ?>><?php _e( 'Category Name', 'woo_ce' ); ?></option>
251
+ </select>
252
+ <select name="category_order">
253
+ <option value="ASC"<?php selected( 'ASC', $category_order ); ?>><?php _e( 'Ascending', 'woo_ce' ); ?></option>
254
+ <option value="DESC"<?php selected( 'DESC', $category_order ); ?>><?php _e( 'Descending', 'woo_ce' ); ?></option>
255
+ </select>
256
+ <p class="description"><?php _e( 'Select the sorting of Categories within the exported file. By default this is set to export Categories by Term ID in Desending order.', 'woo_ce' ); ?></p>
257
+ </div>
258
+
259
+ </div>
260
+ <!-- .inside -->
261
+ </div>
262
+ <!-- #export-categories-filters -->
263
+
264
+ </div>
265
+ <!-- #export-categories -->
266
+
267
+ <div id="export-tags">
268
+
269
+ <div class="postbox">
270
+ <h3 class="hndle"><?php _e( 'Tag Fields', 'woo_ce' ); ?></h3>
271
+ <div class="inside">
272
+ <p class="description"><?php _e( 'Select the Tag fields you would like to export.', 'woo_ce' ); ?></p>
273
+ <p><a href="javascript:void(0)" id="tags-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="tags-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
274
+ <table>
275
+
276
+ <?php foreach( $tag_fields as $tag_field ) { ?>
277
+ <tr>
278
+ <td>
279
+ <label>
280
+ <input type="checkbox" name="tag_fields[<?php echo $tag_field['name']; ?>]" class="tag_field"<?php checked( $tag_field['default'], 1 ); ?><?php disabled( $tag_field['disabled'], 1 ); ?> />
281
+ <?php echo $tag_field['label']; ?>
282
+ </label>
283
+ </td>
284
+ </tr>
285
+
286
+ <?php } ?>
287
+ </table>
288
+ <p class="submit">
289
+ <input type="submit" id="export_tags" value="<?php _e( 'Export Tags', 'woo_ce' ); ?> " class="button-primary" />
290
+ </p>
291
+ <p class="description"><?php _e( 'Can\'t find a particular Tag field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
292
+ </div>
293
+ <!-- .inside -->
294
+ </div>
295
+ <!-- .postbox -->
296
+
297
+ <div id="export-tags-filters" class="postbox">
298
+ <h3 class="hndle"><?php _e( 'Product Tag Filters', 'woo_ce' ); ?></h3>
299
+ <div class="inside">
300
+
301
+ <p><label><?php _e( 'Product Tag Sorting', 'woo_ce' ); ?></label></p>
302
+ <div>
303
+ <select name="tag_orderby">
304
+ <option value="id"<?php selected( 'id', $tag_orderby ); ?>><?php _e( 'Term ID', 'woo_ce' ); ?></option>
305
+ <option value="name"<?php selected( 'name', $tag_orderby ); ?>><?php _e( 'Tag Name', 'woo_ce' ); ?></option>
306
+ </select>
307
+ <select name="tag_order">
308
+ <option value="ASC"<?php selected( 'ASC', $tag_order ); ?>><?php _e( 'Ascending', 'woo_ce' ); ?></option>
309
+ <option value="DESC"<?php selected( 'DESC', $tag_order ); ?>><?php _e( 'Descending', 'woo_ce' ); ?></option>
310
+ </select>
311
+ <p class="description"><?php _e( 'Select the sorting of Product Tags within the exported file. By default this is set to export Product Tags by Term ID in Desending order.', 'woo_ce' ); ?></p>
312
+ </div>
313
+
314
+ </div>
315
+ <!-- .inside -->
316
+ </div>
317
+ <!-- #export-tags-filters -->
318
+
319
+ </div>
320
+ <!-- #export-tags -->
321
+
322
+ <?php if( $order_fields ) { ?>
323
+ <div id="export-orders">
324
+
325
+ <div class="postbox">
326
+ <h3 class="hndle"><?php _e( 'Order Fields', 'woo_ce' ); ?></h3>
327
+ <div class="inside">
328
+
329
+ <?php if( $orders ) { ?>
330
+ <p class="description"><?php _e( 'Select the Order fields you would like to export.', 'woo_ce' ); ?></p>
331
+ <p><a href="javascript:void(0)" id="orders-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="orders-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
332
+ <table>
333
+
334
+ <?php foreach( $order_fields as $order_field ) { ?>
335
+ <tr>
336
+ <td>
337
+ <label>
338
+ <input type="checkbox" name="order_fields[<?php echo $order_field['name']; ?>]" class="order_field"<?php checked( $order_field['default'], 1 ); ?><?php disabled( $woo_cd_exists, false ); ?> />
339
+ <?php echo $order_field['label']; ?>
340
+ </label>
341
+ </td>
342
+ </tr>
343
+
344
+ <?php } ?>
345
+ </table>
346
+ <p class="submit">
347
+ <?php if( function_exists( 'woo_cd_admin_init' ) ) { ?>
348
+ <input type="submit" id="export_orders" value="<?php _e( 'Export Orders', 'woo_ce' ); ?> " class="button-primary" />
349
+ <?php } else { ?>
350
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Orders', 'woo_ce' ); ?>" />
351
+ <?php } ?>
352
+ </p>
353
+ <p class="description"><?php _e( 'Can\'t find a particular Order field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
354
+ <?php } else { ?>
355
+ <p><?php _e( 'No Orders have been found.', 'woo_ce' ); ?></p>
356
+ <?php } ?>
357
+
358
+ </div>
359
+ </div>
360
+ <!-- .postbox -->
361
+
362
+ <div id="export-orders-filters" class="postbox">
363
+ <h3 class="hndle"><?php _e( 'Order Filters', 'woo_ce' ); ?></h3>
364
+ <div class="inside">
365
+
366
+ <?php do_action( 'woo_ce_export_order_options_before_table' ); ?>
367
+
368
+ <table class="form-table">
369
+ <?php do_action( 'woo_ce_export_order_options_table' ); ?>
370
+ </table>
371
+
372
+ <?php do_action( 'woo_ce_export_order_options_after_table' ); ?>
373
+
374
+ </div>
375
+ <!-- .inside -->
376
+ </div>
377
+ <!-- .postbox -->
378
+
379
+ </div>
380
+ <!-- #export-orders -->
381
+
382
+ <?php } ?>
383
+ <?php if( $customer_fields ) { ?>
384
+ <div class="postbox" id="export-customers">
385
+ <h3 class="hndle"><?php _e( 'Customer Fields', 'woo_ce' ); ?></h3>
386
+ <div class="inside">
387
+ <?php if( $customers ) { ?>
388
+ <p class="description"><?php _e( 'Select the Customer fields you would like to export.', 'woo_ce' ); ?></p>
389
+ <p><a href="javascript:void(0)" id="customers-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="customers-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
390
+ <table>
391
+
392
+ <?php foreach( $customer_fields as $customer_field ) { ?>
393
+ <tr>
394
+ <td>
395
+ <label>
396
+ <input type="checkbox" name="customer_fields[<?php echo $customer_field['name']; ?>]" class="customer_field"<?php checked( $customer_field['default'], 1 ); ?><?php disabled( $woo_cd_exists, false ); ?> />
397
+ <?php echo $customer_field['label']; ?>
398
+ </label>
399
+ </td>
400
+ </tr>
401
+
402
+ <?php } ?>
403
+ </table>
404
+ <p class="submit">
405
+ <?php if( function_exists( 'woo_cd_admin_init' ) ) { ?>
406
+ <input type="submit" id="export_customers" value="<?php _e( 'Export Customers', 'woo_ce' ); ?>" class="button-primary" />
407
+ <?php } else { ?>
408
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Customers', 'woo_ce' ); ?>" />
409
+ <?php } ?>
410
+ </p>
411
+ <p class="description"><?php _e( 'Can\'t find a particular Customer field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
412
+ <?php } else { ?>
413
+ <p><?php _e( 'No Customers have been found.', 'woo_ce' ); ?></p>
414
+ <?php } ?>
415
+ </div>
416
+ </div>
417
+ <!-- .postbox -->
418
+
419
+ <?php } ?>
420
+ <?php if( $coupon_fields ) { ?>
421
+ <div class="postbox" id="export-coupons">
422
+ <h3 class="hndle"><?php _e( 'Coupon Fields', 'woo_ce' ); ?></h3>
423
+ <div class="inside">
424
+ <?php if( $coupons ) { ?>
425
+ <p class="description"><?php _e( 'Select the Coupon fields you would like to export.', 'woo_ce' ); ?></p>
426
+ <p><a href="javascript:void(0)" id="coupons-checkall" class="checkall"><?php _e( 'Check All', 'woo_ce' ); ?></a> | <a href="javascript:void(0)" id="coupons-uncheckall" class="uncheckall"><?php _e( 'Uncheck All', 'woo_ce' ); ?></a></p>
427
+ <table>
428
+
429
+ <?php foreach( $coupon_fields as $coupon_field ) { ?>
430
+ <tr>
431
+ <td>
432
+ <label>
433
+ <input type="checkbox" name="coupon_fields[<?php echo $coupon_field['name']; ?>]" class="coupon_field"<?php checked( $coupon_field['default'], 1 ); ?><?php disabled( $woo_cd_exists, false ); ?> />
434
+ <?php echo $coupon_field['label']; ?>
435
+ </label>
436
+ </td>
437
+ </tr>
438
+
439
+ <?php } ?>
440
+ </table>
441
+ <p class="submit">
442
+ <?php if( function_exists( 'woo_cd_admin_init' ) ) { ?>
443
+ <input type="submit" id="export_coupons" value="<?php _e( 'Export Coupons', 'woo_ce' ); ?>" class="button-primary" />
444
+ <?php } else { ?>
445
+ <input type="button" class="button button-disabled" value="<?php _e( 'Export Coupons', 'woo_ce' ); ?>" />
446
+ <?php } ?>
447
+ </p>
448
+ <p class="description"><?php _e( 'Can\'t find a particular Coupon field in the above export list?', 'woo_ce' ); ?> <a href="<?php echo $troubleshooting_url; ?>" target="_blank"><?php _e( 'Get in touch', 'woo_ce' ); ?></a>.</p>
449
+ <?php } else { ?>
450
+ <p><?php _e( 'No Coupons have been found.', 'woo_ce' ); ?></p>
451
+ <?php } ?>
452
+ </div>
453
+ </div>
454
+ <!-- .postbox -->
455
+
456
+ <?php } ?>
457
+ <div class="postbox" id="export-options">
458
+ <h3 class="hndle"><?php _e( 'Export Options', 'woo_ce' ); ?></h3>
459
+ <div class="inside">
460
+ <p class="description"><?php _e( 'You can find additional export options under the Settings tab at the top of this screen.', 'woo_ce' ); ?></p>
461
+
462
+ <?php do_action( 'woo_ce_export_options_before' ); ?>
463
+
464
+ <table class="form-table">
465
+
466
+ <?php do_action( 'woo_ce_export_options' ); ?>
467
+
468
+ <tr class="export-options product-options">
469
+ <th><label for=""><?php _e( 'Up-sells formatting', 'woo_ce' ); ?></label></th>
470
+ <td>
471
+ <label><input type="radio" name="product_upsell_formatting" value="0"<?php checked( $upsell_formatting, 0 ); ?> />&nbsp;<?php _e( 'Export Up-Sells as Product ID', 'woo_ce' ); ?></label><br />
472
+ <label><input type="radio" name="product_upsell_formatting" value="1"<?php checked( $upsell_formatting, 1 ); ?> />&nbsp;<?php _e( 'Export Up-Sells as Product SKU', 'woo_ce' ); ?></label>
473
+ <p class="description"><?php _e( 'Choose the up-sell formatting that is accepted by your WooCommerce import Plugin (e.g. Product Importer Deluxe, Product Import Suite, etc.).', 'woo_ce' ); ?></p>
474
+ </td>
475
+ </tr>
476
+
477
+ <tr class="export-options product-options">
478
+ <th><label for=""><?php _e( 'Cross-sells formatting', 'woo_ce' ); ?></label></th>
479
+ <td>
480
+ <label><input type="radio" name="product_crosssell_formatting" value="0"<?php checked( $crosssell_formatting, 0 ); ?> />&nbsp;<?php _e( 'Export Cross-Sells as Product ID', 'woo_ce' ); ?></label><br />
481
+ <label><input type="radio" name="product_crosssell_formatting" value="1"<?php checked( $crosssell_formatting, 1 ); ?> />&nbsp;<?php _e( 'Export Cross-Sells as Product SKU', 'woo_ce' ); ?></label>
482
+ <p class="description"><?php _e( 'Choose the cross-sell formatting that is accepted by your WooCommerce import Plugin (e.g. Product Importer Deluxe, Product Import Suite, etc.).', 'woo_ce' ); ?></p>
483
+ </td>
484
+ </tr>
485
+
486
+ <tr>
487
+ <th>
488
+ <label for="offset"><?php _e( 'Volume offset', 'woo_ce' ); ?></label> / <label for="limit_volume"><?php _e( 'Limit volume', 'woo_ce' ); ?></label>
489
+ </th>
490
+ <td>
491
+ <input type="text" size="3" id="offset" name="offset" value="<?php echo $offset; ?>" size="5" class="text" /> <?php _e( 'to', 'woo_ce' ); ?> <input type="text" size="3" id="limit_volume" name="limit_volume" value="<?php echo $limit_volume; ?>" size="5" class="text" />
492
+ <p class="description"><?php _e( 'Volume offset and limit allows for partial exporting of an export type (e.g. records 0 to 500, etc.). This is useful when encountering timeout and/or memory errors during the a large or memory intensive export. To be used effectively both fields must be filled. By default this is not used and is left empty.', 'woo_ce' ); ?></p>
493
+ </td>
494
+ </tr>
495
+
496
+ <?php do_action( 'woo_ce_export_options_table_after' ); ?>
497
+
498
+ </table>
499
+
500
+ <?php do_action( 'woo_ce_export_options_after' ); ?>
501
+
502
+ </div>
503
+ </div>
504
+ <!-- .postbox -->
505
+
506
+ </div>
507
+ <!-- #poststuff -->
508
+ <input type="hidden" name="action" value="export" />
509
+ </form>
510
+
511
+ <?php do_action( 'woo_ce_export_after_form' ); ?>
templates/admin/woo-admin_ce-export_overview.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="overview-left">
2
+
3
+ <h3><a href="<?php echo add_query_arg( 'tab', 'export' ); ?>"><?php _e( 'Export', 'woo_ce' ); ?></a></h3>
4
+ <p><?php _e( 'Export store details out of WooCommerce into a CSV-formatted file.', 'woo_ce' ); ?></p>
5
+ <ul class="ul-disc">
6
+ <li>
7
+ <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-products"><?php _e( 'Export Products', 'woo_ce' ); ?></a>
8
+ </li>
9
+ <li>
10
+ <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-categories"><?php _e( 'Export Categories', 'woo_ce' ); ?></a>
11
+ </li>
12
+ <li>
13
+ <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-tags"><?php _e( 'Export Tags', 'woo_ce' ); ?></a>
14
+ </li>
15
+ <li>
16
+ <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-orders"><?php _e( 'Export Orders', 'woo_ce' ); ?></a>
17
+ <?php if( !function_exists( 'woo_cd_admin_init' ) ) { ?>
18
+ <span class="description">(<?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?>)</span>
19
+ <?php } ?>
20
+ </li>
21
+ <li>
22
+ <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-customers"><?php _e( 'Export Customers', 'woo_ce' ); ?></a>
23
+ <?php if( !function_exists( 'woo_cd_admin_init' ) ) { ?>
24
+ <span class="description">(<?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?>)</span>
25
+ <?php } ?>
26
+ </li>
27
+ <li>
28
+ <a href="<?php echo add_query_arg( 'tab', 'export' ); ?>#export-coupons"><?php _e( 'Export Coupons', 'woo_ce' ); ?></a>
29
+ <?php if( !function_exists( 'woo_cd_admin_init' ) ) { ?>
30
+ <span class="description">(<?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?>)</span>
31
+ <?php } ?>
32
+ </li>
33
+ </ul>
34
+
35
+ <h3><a href="<?php echo add_query_arg( 'tab', 'archive' ); ?>"><?php _e( 'Archives', 'woo_ce' ); ?></a></h3>
36
+ <p><?php _e( 'Download copies of prior store exports.', 'woo_ce' ); ?></p>
37
+
38
+ <h3><a href="<?php echo add_query_arg( 'tab', 'settings' ); ?>"><?php _e( 'Settings', 'woo_ce' ); ?></a></h3>
39
+ <p><?php _e( 'Manage CSV export options from a single detailed screen.', 'woo_ce' ); ?></p>
40
+
41
+ <h3><a href="<?php echo add_query_arg( 'tab', 'tools' ); ?>"><?php _e( 'Tools', 'woo_ce' ); ?></a></h3>
42
+ <p><?php _e( 'Export tools for WooCommerce.', 'woo_ce' ); ?></p>
43
+
44
+ <hr />
45
+ <?php if( !function_exists( 'woo_cd_admin_init' ) ) { ?>
46
+ <label class="description">
47
+ <input type="checkbox" disabled="disabled" /> <?php _e( 'Jump to Export screen in the future', 'woo_ce' ); ?>
48
+ <span class="description"> - <?php printf( __( 'available in %s', 'woo_ce' ), $woo_cd_link ); ?></span>
49
+ </label>
50
+ <?php } else { ?>
51
+ <form id="skip_overview_form" method="post">
52
+ <label><input type="checkbox" id="skip_overview" name="skip_overview"<?php checked( $skip_overview ); ?> /> <?php _e( 'Jump to Export screen in the future', 'woo_ce' ); ?></label>
53
+ <input type="hidden" name="action" value="skip_overview" />
54
+ </form>
55
+ <?php } ?>
56
+
57
+ </div>
58
+ <!-- .overview-left -->
59
+ <?php if( !function_exists( 'woo_cd_admin_init' ) ) { ?>
60
+ <div class="welcome-panel overview-right">
61
+ <h3>
62
+ <!-- <span><a href="#"><attr title="<?php _e( 'Dismiss this message', 'woo_ce' ); ?>"><?php _e( 'Dismiss', 'woo_ce' ); ?></attr></a></span> -->
63
+ <?php _e( 'Upgrade to Pro', 'woo_ce' ); ?>
64
+ </h3>
65
+ <p class="clear"><?php _e( 'Upgrade to Store Exporter Deluxe to unlock business focused e-commerce features within Store Exporter, including:', 'woo_ce' ); ?></p>
66
+ <ul class="ul-disc">
67
+ <li><?php _e( 'Select export date ranges', 'woo_ce' ); ?></li>
68
+ <li><?php _e( 'Export Orders', 'woo_ce' ); ?></li>
69
+ <li><?php _e( 'Select Order fields to export', 'woo_ce' ); ?></li>
70
+ <li><?php _e( 'Export custom Order and Order Item meta', 'woo_ce' ); ?></li>
71
+ <li><?php _e( 'Export Customers', 'woo_ce' ); ?></li>
72
+ <li><?php _e( 'Select Customer fields to export', 'woo_ce' ); ?></li>
73
+ <li><?php _e( 'Export Coupons', 'woo_ce' ); ?></li>
74
+ <li><?php _e( 'Select Coupon fields to export', 'woo_ce' ); ?></li>
75
+ <li><?php _e( 'CRON / Scheduled Exports', 'woo_ce' ); ?></li>
76
+ <li><?php _e( 'Export to XML', 'woo_ce' ); ?></li>
77
+ <li><?php _e( 'Premium Support', 'woo_ce' ); ?></li>
78
+ </ul>
79
+ <p>
80
+ <a href="<?php echo $woo_cd_url; ?>" target="_blank" class="button"><?php _e( 'More Features', 'woo_ce' ); ?></a>&nbsp;
81
+ <a href="<?php echo $woo_cd_url; ?>" target="_blank" class="button button-primary"><?php _e( 'Buy Now', 'woo_ce' ); ?></a>
82
+ </p>
83
+ </div>
84
+ <!-- .overview-right -->
85
+ <?php } ?>
templates/admin/woo-admin_ce-export_settings.php ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <ul class="subsubsub">
2
+ <li><a href="#general-settings"><?php _e( 'General Settings', 'woo_ce' ); ?></a> |</li>
3
+ <li><a href="#csv-settings"><?php _e( 'CSV Settings', 'woo_ce' ); ?></a></li>
4
+ <?php do_action( 'woo_ce_export_settings_top' ); ?>
5
+ </ul>
6
+ <!-- .subsubsub -->
7
+ <form method="post">
8
+ <table class="form-table">
9
+ <tbody>
10
+
11
+ <?php do_action( 'woo_ce_export_settings_before' ); ?>
12
+
13
+ <tr id="general-settings">
14
+ <td colspan="2" style="padding:0;">
15
+ <h3><?php _e( 'General Settings', 'woo_ce' ); ?></h3>
16
+ </td>
17
+ </tr>
18
+
19
+ <tr valign="top">
20
+ <th scope="row"><label for="export_filename"><?php _e( 'Export filename', 'woo_ce' ); ?></label></th>
21
+ <td>
22
+ <input name="export_filename" type="text" id="export_filename" value="<?php echo $export_filename; ?>" class="regular-text code" />
23
+ <p class="description"><?php _e( 'The filename of the exported export type. Tags can be used: ', 'woo_ce' ); ?> <code>%dataset%</code>, <code>%date%</code>, <code>%time%</code>, <code>%store_name%</code>.</p>
24
+ </td>
25
+ </tr>
26
+
27
+ <tr>
28
+ <th>
29
+ <label for="delete_temporary_csv"><?php _e( 'Enable archives', 'woo_ce' ); ?></label>
30
+ </th>
31
+ <td>
32
+ <select id="delete_temporary_csv" name="delete_temporary_csv">
33
+ <option value="0"<?php selected( $delete_csv, 0 ); ?>><?php _e( 'Yes', 'woo_ce' ); ?></option>
34
+ <option value="1"<?php selected( $delete_csv, 1 ); ?>><?php _e( 'No', 'woo_ce' ); ?></option>
35
+ </select>
36
+ <p class="description"><?php _e( 'Save copies of CSV exports to the WordPress Media for downloading later. By default this option is turned on.', 'woo_ce' ); ?></p>
37
+ </td>
38
+ </tr>
39
+
40
+ <tr>
41
+ <th>
42
+ <label for="encoding"><?php _e( 'Character encoding', 'woo_ce' ); ?></label>
43
+ </th>
44
+ <td>
45
+ <?php if( $file_encodings ) { ?>
46
+ <select id="encoding" name="encoding">
47
+ <option value=""><?php _e( 'System default', 'woo_ce' ); ?></option>
48
+ <?php foreach( $file_encodings as $key => $chr ) { ?>
49
+ <option value="<?php echo $chr; ?>"<?php selected( $chr, $encoding ); ?>><?php echo $chr; ?></option>
50
+ <?php } ?>
51
+ </select>
52
+ <?php } else { ?>
53
+ <p class="description"><?php _e( 'Character encoding options are unavailable in PHP 4, contact your hosting provider to update your site install to use PHP 5 or higher.', 'woo_ce' ); ?></p>
54
+ <?php } ?>
55
+ </td>
56
+ </tr>
57
+
58
+ <tr>
59
+ <th><?php _e( 'Date format', 'woo_ce' ); ?></th>
60
+ <td>
61
+ <fieldset>
62
+ <label title="F j, Y"><input type="radio" name="date_format" value="F j, Y"<?php checked( $date_format, 'F j, Y' ); ?>> <span><?php echo date( 'F j, Y' ); ?></span></label><br>
63
+ <label title="Y/m/d"><input type="radio" name="date_format" value="Y/m/d"<?php checked( $date_format, 'Y/m/d' ); ?>> <span><?php echo date( 'Y/m/d' ); ?></span></label><br>
64
+ <label title="m/d/Y"><input type="radio" name="date_format" value="m/d/Y"<?php checked( $date_format, 'm/d/Y' ); ?>> <span><?php echo date( 'm/d/Y' ); ?></span></label><br>
65
+ <label title="d/m/Y"><input type="radio" name="date_format" value="d/m/Y"<?php checked( $date_format, 'd/m/Y' ); ?>> <span><?php echo date( 'd/m/Y' ); ?></span></label><br>
66
+ <!--
67
+ <label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"> Custom: </label><input type="text" name="date_format_custom" value="F j, Y" class="small-text"> <span class="example"> January 6, 2014</span> <span class="spinner"></span>
68
+ <p><a href="http://codex.wordpress.org/Formatting_Date_and_Time"><?php _e( 'Documentation on date and time formatting', 'woo_ce' ); ?></a>.</p>
69
+ -->
70
+ </fieldset>
71
+ <p class="description"><?php _e( 'The date format option affects how date\'s are presented within your CSV file. Default is set to DD/MM/YYYY.', 'woo_ce' ); ?></p>
72
+ </td>
73
+ </tr>
74
+
75
+ <?php if( !ini_get( 'safe_mode' ) ) { ?>
76
+ <tr>
77
+ <th>
78
+ <label for="timeout"><?php _e( 'Script timeout', 'woo_ce' ); ?></label>
79
+ </th>
80
+ <td>
81
+ <select id="timeout" name="timeout">
82
+ <option value="600"<?php selected( $timeout, 600 ); ?>><?php printf( __( '%s minutes', 'woo_ce' ), 10 ); ?></option>
83
+ <option value="1800"<?php selected( $timeout, 1800 ); ?>><?php printf( __( '%s minutes', 'woo_ce' ), 30 ); ?></option>
84
+ <option value="3600"<?php selected( $timeout, 3600 ); ?>><?php printf( __( '%s hour', 'woo_ce' ), 1 ); ?></option>
85
+ <option value="0"<?php selected( $timeout, 0 ); ?>><?php _e( 'Unlimited', 'woo_ce' ); ?></option>
86
+ </select>
87
+ <p class="description"><?php _e( 'Script timeout defines how long Store Exporter is \'allowed\' to process your CSV file, once the time limit is reached the export process halts.', 'woo_ce' ); ?></p>
88
+ </td>
89
+ </tr>
90
+ <?php } ?>
91
+
92
+ <tr id="csv-settings">
93
+ <td colspan="2" style="padding:0;">
94
+ <hr />
95
+ <h3><?php _e( 'CSV Settings', 'woo_ce' ); ?></h3>
96
+ </td>
97
+ </tr>
98
+
99
+ <tr>
100
+ <th>
101
+ <label for="delimiter"><?php _e( 'Field delimiter', 'woo_ce' ); ?></label>
102
+ </th>
103
+ <td>
104
+ <input type="text" size="3" id="delimiter" name="delimiter" value="<?php echo $delimiter; ?>" maxlength="1" class="text" />
105
+ <p class="description"><?php _e( 'The field delimiter is the character separating each cell in your CSV. This is typically the \',\' (comma) character.', 'woo_pc' ); ?></p>
106
+ </td>
107
+ </tr>
108
+
109
+ <tr>
110
+ <th>
111
+ <label for="category_separator"><?php _e( 'Category separator', 'woo_ce' ); ?></label>
112
+ </th>
113
+ <td>
114
+ <input type="text" size="3" id="category_separator" name="category_separator" value="<?php echo $category_separator; ?>" maxlength="1" class="text" />
115
+ <p class="description"><?php _e( 'The Product Category separator allows you to assign individual Products to multiple Product Categories/Tags/Images at a time. It is suggested to use the \'|\' (vertical pipe) character between each item. For instance: <code>Clothing|Mens|Shirts</code>.', 'woo_ce' ); ?></p>
116
+ </td>
117
+ </tr>
118
+
119
+ <tr>
120
+ <th>
121
+ <label for="bom"><?php _e( 'Add BOM character', 'woo_ce' ); ?></label>
122
+ </th>
123
+ <td>
124
+ <select id="bom" name="bom">
125
+ <option value="1"<?php selected( $bom, 1 ); ?>><?php _e( 'Yes', 'woo_ce' ); ?></option>
126
+ <option value="0"<?php selected( $bom, 0 ); ?>><?php _e( 'No', 'woo_ce' ); ?></option>
127
+ </select>
128
+ <p class="description"><?php _e( 'Mark the CSV file as UTF8 by adding a byte order mark (BOM) to the export, useful for non-English character sets.', 'woo_ce' ); ?></p>
129
+ </td>
130
+ </tr>
131
+
132
+ <tr>
133
+ <th>
134
+ <label for="escape_formatting"><?php _e( 'Field escape formatting', 'woo_ce' ); ?></label>
135
+ </th>
136
+ <td>
137
+ <label><input type="radio" name="escape_formatting" value="all"<?php checked( $escape_formatting, 'all' ); ?> />&nbsp;<?php _e( 'Escape all fields', 'woo_ce' ); ?></label><br />
138
+ <label><input type="radio" name="escape_formatting" value="excel"<?php checked( $escape_formatting, 'excel' ); ?> />&nbsp;<?php _e( 'Escape fields as Excel would', 'woo_ce' ); ?></label>
139
+ <p class="description"><?php _e( 'Choose the field escape format that suits your spreadsheet software (e.g. Excel).', 'woo_ce' ); ?></p>
140
+ </td>
141
+ </tr>
142
+
143
+ <?php do_action( 'woo_ce_export_settings_after' ); ?>
144
+
145
+ </tbody>
146
+ </table>
147
+ <p class="submit">
148
+ <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e( 'Save Changes', 'woo_ce' ); ?>" />
149
+ </p>
150
+
151
+ <input type="hidden" name="action" value="save" />
152
+ </form>
153
+ <?php do_action( 'woo_ce_export_settings_bottom' ); ?>
templates/admin/woo-admin_ce-export_tools.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h3><?php _e( 'WooCommerce Tools', 'woo_ce' ); ?></h3>
2
+ <div id="poststuff">
3
+
4
+ <div class="postbox">
5
+ <h3 class="hndle"><?php _e( 'Tools', 'woo_pd' ); ?></h3>
6
+ <div class="inside">
7
+ <table class="form-table">
8
+
9
+ <tr>
10
+ <td>
11
+ <a href="<?php echo $woo_pd_url; ?>"<?php echo $woo_pd_target; ?>><?php _e( 'Import Products from CSV', 'woo_ce' ); ?></a>
12
+ <p class="description"><?php _e( 'Use Product Importer Deluxe to import Product changes back into your store.', 'woo_ce' ); ?></p>
13
+ </td>
14
+ </tr>
15
+
16
+ </table>
17
+ </div>
18
+ </div>
19
+ <!-- .postbox -->
20
+
21
+ </div>
22
+ <!-- #poststuff -->
templates/admin/woo-admin_ce-media_csv_file.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="postbox-container">
2
+ <div class="postbox">
3
+ <h3 class="hndle"><?php _e( 'CSV File', 'woo_ce' ); ?></h3>
4
+ <div class="inside">
5
+ <textarea style="font:12px Consolas, Monaco, Courier, monospace; width:100%; height:200px;"><?php echo $contents; ?></textarea>
6
+ </div>
7
+ <!-- .inside -->
8
+ </div>
9
+ <!-- .postbox -->
10
+
11
+ </div>
12
+ <!-- .postbox-container -->
templates/admin/woo-admin_ce-media_export_details.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <table class="widefat" style="font-family:monospace;">
2
+ <thead>
3
+
4
+ <tr>
5
+ <th colspan="2"><?php _e( 'Export Details', 'woo_ce' ); ?></th>
6
+ </tr>
7
+
8
+ </thead>
9
+ <tbody>
10
+
11
+ <tr>
12
+ <th style="width:20%;"><?php _e( 'Export type', 'woo_ce' ); ?></th>
13
+ <td><?php echo woo_ce_export_type_label( $export_type ); ?></td>
14
+ </tr>
15
+ <tr>
16
+ <th><?php _e( 'Filepath', 'woo_ce' ); ?></th>
17
+ <td><?php echo $filepath; ?></td>
18
+ </tr>
19
+ <tr>
20
+ <th><?php _e( 'Total columns', 'woo_ce' ); ?></th>
21
+ <td><?php echo ( ( $columns != false ) ? $columns : '-' ); ?></td>
22
+ </tr>
23
+ <tr>
24
+ <th><?php _e( 'Total rows', 'woo_ce' ); ?></th>
25
+ <td><?php echo ( ( $rows != false ) ? $rows : '-' ); ?></td>
26
+ </tr>
27
+ <tr>
28
+ <th><?php _e( 'Process time', 'woo_ce' ); ?></th>
29
+ <td><?php echo ( ( ( $start_time != false ) && ( $end_time != false ) ) ? woo_ce_display_time_elapsed( $start_time, $end_time ) : '-' ); ?></td>
30
+ </tr>
31
+ <tr>
32
+ <th><?php _e( 'Idle memory usage (start)', 'woo_ce' ); ?></th>
33
+ <td><?php echo ( ( $idle_memory_start != false ) ? woo_ce_display_memory( $idle_memory_start ) : '-' ); ?></td>
34
+ </tr>
35
+ <tr>
36
+ <th><?php _e( 'Memory usage prior to loading export type', 'woo_ce' ); ?></th>
37
+ <td><?php echo ( ( $data_memory_start != false ) ? woo_ce_display_memory( $data_memory_start ) : '-' ); ?></td>
38
+ </tr>
39
+ <tr>
40
+ <th><?php _e( 'Memory usage after loading export type', 'woo_ce' ); ?></th>
41
+ <td><?php echo ( ( $data_memory_end != false ) ? woo_ce_display_memory( $data_memory_end ) : '-' ); ?></td>
42
+ </tr>
43
+ <tr>
44
+ <th><?php _e( 'Memory usage at render time', 'woo_ce' ); ?></th>
45
+ <td>-</td>
46
+ </tr>
47
+ <tr>
48
+ <th><?php _e( 'Idle memory usage (end)', 'woo_ce' ); ?></th>
49
+ <td><?php echo ( ( $idle_memory_end != false ) ? woo_ce_display_memory( $idle_memory_end ) : '-' ); ?></td>
50
+ </tr>
51
+
52
+ </tbody>
53
+ </table>
54
+ <br />
templates/admin/woocommerce-admin_dashboard_vm-plugins.css ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 .message {
37
+ color:#000;
38
+ font-size:12px;
39
+ margin-bottom:1em;
40
+ padding:9px 9px 8px 9px;
41
+ background-color:#ffffe0;
42
+ border-color:#e6db55;
43
+ border-width:1px;
44
+ border-style:solid;
45
+ -moz-border-radius:5px;
46
+ -khtml-border-radius:5px;
47
+ -webkit-border-radius:5px;
48
+ border-radius:5px;
49
+ }
50
+ #woo_vm_status_widget .link {
51
+ text-align:right;
52
+ }