Export WordPress data to XML/CSV - Version 1.1.0

Version Description

  • improvement: added ACF fields to 'migrate' & 'add all fields' features
  • improvement: added new filter 'wp_all_export_field_name'
  • improvement: changed default date export to Y/m/d
  • bug fix: export shipping class for product variations
  • bug fix: import template for ACF relationship fields
  • bug fix: export empty images metadata
  • bug fix: import template for ACF gallery
  • bug fix: import template for variation_description
  • bug fix: import template for default product attributes
  • bug fix: automatically adding parent_id column on products export
Download this release

Release Info

Developer soflyy
Plugin Icon 128x128 Export WordPress data to XML/CSV
Version 1.1.0
Comparing to
See all releases

Code changes from version 1.0.9 to 1.1.0

Files changed (50) hide show
  1. actions/wp_ajax_wpae_available_rules.php +14 -1
  2. actions/wp_ajax_wpae_filtering.php +1 -1
  3. actions/wp_ajax_wpae_filtering_count.php +68 -28
  4. actions/wp_ajax_wpae_preview.php +5 -7
  5. classes/XMLWriter.php +10 -0
  6. classes/download.php +9 -5
  7. classes/wpallimport.php +17 -1
  8. controllers/admin/export.php +50 -11
  9. controllers/admin/manage.php +14 -1
  10. controllers/controller.php +15 -0
  11. helpers/pmxe_functions.php +66 -0
  12. helpers/pmxe_render_xml_attributes.php +1 -1
  13. helpers/pmxe_render_xml_element.php +1 -1
  14. helpers/wp_all_export_get_cpt_name.php +11 -1
  15. helpers/wp_all_export_get_export_format.php +1 -1
  16. helpers/wp_all_export_parse_field_name.php +11 -0
  17. libraries/VariableProductTitle/OnlyExportParent.php +11 -0
  18. libraries/VariableProductTitle/TitleProcessor.php +12 -0
  19. libraries/VariableProductTitle/UseParentTitle.php +12 -0
  20. libraries/VariableProductTitle/UseVariationTitle.php +12 -0
  21. libraries/WpaePhpInterpreterErrorHandler.php +2 -2
  22. libraries/WpaeString.php +7 -3
  23. libraries/WpaeXmlProcessor.php +76 -31
  24. libraries/XmlCsvExport.php +65 -13
  25. libraries/XmlExportACF.php +69 -36
  26. libraries/XmlExportCpt.php +50 -75
  27. libraries/XmlExportEngine.php +64 -10
  28. libraries/XmlExportMediaGallery.php +21 -7
  29. libraries/XmlExportTaxonomy.php +194 -0
  30. libraries/XmlExportUser.php +3 -3
  31. libraries/XmlExportWooCommerce.php +60 -20
  32. libraries/XmlExportWooCommerceOrder.php +33 -7
  33. readme.txt +14 -2
  34. src/VariationOptions/VariationOptions.php +44 -0
  35. src/VariationOptions/VariationOptionsFactory.php +23 -0
  36. src/VariationOptions/VariationOptionsInterface.php +11 -0
  37. static/css/admin.css +72 -61
  38. static/img/bottom_arrow.png +0 -0
  39. static/js/admin.js +191 -49
  40. views/admin/export/index.php +77 -23
  41. views/admin/export/options.php +4 -6
  42. views/admin/export/template.php +89 -34
  43. views/admin/export/template/add_new_field.php +0 -2
  44. views/admin/export/template/advanced_field_options.php +2 -3
  45. views/admin/export/template/custom_xml_help.php +13 -4
  46. views/admin/export/variation_options.php +87 -0
  47. views/admin/export/variation_options_common.php +42 -0
  48. views/admin/manage/index.php +4 -2
  49. views/admin/manage/update.php +2 -0
  50. wp-all-export.php +59 -3
actions/wp_ajax_wpae_available_rules.php CHANGED
@@ -32,7 +32,7 @@ function pmxe_wp_ajax_wpae_available_rules(){
32
 
33
  <?php
34
  }
35
- elseif( in_array($post['selected'], array('post_date', 'user_registered', 'comment_date')) )
36
  {
37
  ?>
38
  <option value="equals"><?php _e('equals', 'wp_all_export_plugin'); ?></option>
@@ -68,6 +68,19 @@ function pmxe_wp_ajax_wpae_available_rules(){
68
  <option value="is_not_empty"><?php _e('is not empty', 'wp_all_export_plugin'); ?></option>
69
  <?php
70
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  else
72
  {
73
  ?>
32
 
33
  <?php
34
  }
35
+ elseif( in_array($post['selected'], array('post_date', 'user_registered', 'comment_date', 'cf__completed_date')) )
36
  {
37
  ?>
38
  <option value="equals"><?php _e('equals', 'wp_all_export_plugin'); ?></option>
68
  <option value="is_not_empty"><?php _e('is not empty', 'wp_all_export_plugin'); ?></option>
69
  <?php
70
  }
71
+ elseif ( in_array($post['selected'], array('term_parent_slug') ) )
72
+ {
73
+ ?>
74
+ <option value="equals"><?php _e('equals', 'wp_all_export_plugin'); ?></option>
75
+ <option value="not_equals"><?php _e("doesn't equal", 'wp_all_export_plugin'); ?></option>
76
+ <option value="greater"><?php _e('greater than', 'wp_all_export_plugin');?></option>
77
+ <option value="equals_or_greater"><?php _e('equal to or greater than', 'wp_all_export_plugin'); ?></option>
78
+ <option value="less"><?php _e('less than', 'wp_all_export_plugin'); ?></option>
79
+ <option value="equals_or_less"><?php _e('equal to or less than', 'wp_all_export_plugin'); ?></option>
80
+ <option value="is_empty"><?php _e('is empty', 'wp_all_export_plugin'); ?></option>
81
+ <option value="is_not_empty"><?php _e('is not empty', 'wp_all_export_plugin'); ?></option>
82
+ <?php
83
+ }
84
  else
85
  {
86
  ?>
actions/wp_ajax_wpae_filtering.php CHANGED
@@ -45,7 +45,7 @@ function pmxe_wp_ajax_wpae_filtering(){
45
 
46
  $response['html'] = ob_get_clean();
47
 
48
- if ( XmlExportEngine::$is_user_export || XmlExportEngine::$is_comment_export )
49
  {
50
  $response['btns'] = '';
51
  exit(json_encode($response)); die;
45
 
46
  $response['html'] = ob_get_clean();
47
 
48
+ if ( XmlExportEngine::$is_user_export || XmlExportEngine::$is_comment_export || XmlExportEngine::$is_taxonomy_export )
49
  {
50
  $response['btns'] = '';
51
  exit(json_encode($response)); die;
actions/wp_ajax_wpae_filtering_count.php CHANGED
@@ -12,13 +12,16 @@ function pmxe_wp_ajax_wpae_filtering_count(){
12
 
13
  ob_start();
14
 
 
 
15
  $input = new PMXE_Input();
16
 
17
  $post = $input->post('data', array());
18
 
19
  $filter_args = array(
20
  'filter_rules_hierarhy' => empty($post['filter_rules_hierarhy']) ? array() : $post['filter_rules_hierarhy'],
21
- 'product_matching_mode' => empty($post['product_matching_mode']) ? 'strict' : $post['product_matching_mode']
 
22
  );
23
 
24
  $input = new PMXE_Input();
@@ -38,7 +41,9 @@ function pmxe_wp_ajax_wpae_filtering_count(){
38
 
39
  XmlExportEngine::$is_user_export = ( 'users' == $post['cpt'] or 'shop_customer' == $post['cpt'] ) ? true : false;
40
  XmlExportEngine::$is_comment_export = ( 'comments' == $post['cpt'] ) ? true : false;
 
41
  XmlExportEngine::$post_types = array($post['cpt']);
 
42
 
43
  $filters = new XmlExportFiltering($filter_args);
44
 
@@ -120,6 +125,29 @@ function pmxe_wp_ajax_wpae_filtering_count(){
120
  $found_records = $total_records = get_comments( array( 'orderby' => 'comment_ID', 'order' => 'ASC', 'number' => 10, 'count' => true));
121
  }
122
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  else
124
  {
125
  remove_all_actions('parse_query');
@@ -128,42 +156,59 @@ function pmxe_wp_ajax_wpae_filtering_count(){
128
 
129
  $cpt = ($is_products_export) ? array('product', 'product_variation') : array($post['cpt']);
130
 
131
- ob_start();
132
- // get custom post type records depends on filters
133
- add_filter('posts_where', 'wp_all_export_posts_where', 10, 1);
134
- add_filter('posts_join', 'wp_all_export_posts_join', 10, 1);
135
-
136
  // get total custom post type records
137
- $totalQuery = new WP_Query( array( 'post_type' => $cpt, 'post_status' => 'any', 'orderby' => 'ID', 'order' => 'ASC', 'posts_per_page' => 10 ));
138
  if ( ! empty($totalQuery->found_posts)){
139
- $found_records = $total_records = $totalQuery->found_posts;
140
  }
141
 
142
  wp_reset_postdata();
143
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  remove_filter('posts_join', 'wp_all_export_posts_join');
145
  remove_filter('posts_where', 'wp_all_export_posts_where');
146
- ob_end_clean();
147
  }
148
  }
 
 
 
149
 
150
  if ( $post['is_confirm_screen'] )
151
  {
152
  ?>
153
 
154
  <?php if ($found_records > 0) :?>
155
- <h3><?php _e('Your export is ready to run.', 'wp_all_export_plugin'); ?></h3>
156
- <h4><?php printf(__('WP All Export will export %d %s.', 'wp_all_export_plugin'), $found_records, wp_all_export_get_cpt_name($cpt, $found_records)); ?></h4>
157
  <?php else: ?>
158
  <?php if (! $export->isEmpty() and $export->options['export_only_new_stuff']): ?>
159
  <h3><?php _e('Nothing to export.', 'wp_all_export_plugin'); ?></h3>
160
- <h4><?php printf(__("All %s have already been exported.", "wp_all_export_plugin"), wp_all_export_get_cpt_name($cpt)); ?></h4>
161
  <?php elseif ($total_records > 0): ?>
162
  <h3><?php _e('Nothing to export.', 'wp_all_export_plugin'); ?></h3>
163
- <h4><?php printf(__("No matching %s found for selected filter rules.", "wp_all_export_plugin"), wp_all_export_get_cpt_name($cpt)); ?></h4>
164
  <?php else: ?>
165
  <h3><?php _e('Nothing to export.', 'wp_all_export_plugin'); ?></h3>
166
- <h4><?php printf(__("There aren't any %s to export.", "wp_all_export_plugin"), wp_all_export_get_cpt_name($cpt)); ?></h4>
167
  <?php endif; ?>
168
  <?php endif; ?>
169
 
@@ -174,18 +219,18 @@ function pmxe_wp_ajax_wpae_filtering_count(){
174
  ?>
175
 
176
  <?php if ($found_records > 0) :?>
177
- <h3><span class="matches_count"><?php echo $found_records; ?></span> <strong><?php echo wp_all_export_get_cpt_name($cpt, $found_records); ?></strong> will be exported</h3>
178
  <h4><?php _e("Choose data to include in the export file.", "wp_all_export_plugin"); ?></h4>
179
  <?php else: ?>
180
  <?php if (! $export->isEmpty() and $export->options['export_only_new_stuff']): ?>
181
  <h3><?php _e('Nothing to export.', 'wp_all_export_plugin'); ?></h3>
182
- <h4><?php printf(__("All %s have already been exported.", "wp_all_export_plugin"), wp_all_export_get_cpt_name($cpt)); ?></h4>
183
  <?php elseif ($total_records > 0): ?>
184
  <h3><?php _e('Nothing to export.', 'wp_all_export_plugin'); ?></h3>
185
- <h4><?php printf(__("No matching %s found for selected filter rules.", "wp_all_export_plugin"), wp_all_export_get_cpt_name($cpt)); ?></h4>
186
  <?php else: ?>
187
  <h3><?php _e('Nothing to export.', 'wp_all_export_plugin'); ?></h3>
188
- <h4><?php printf(__("There aren't any %s to export.", "wp_all_export_plugin"), wp_all_export_get_cpt_name($cpt)); ?></h4>
189
  <?php endif; ?>
190
  <?php endif; ?>
191
 
@@ -195,23 +240,18 @@ function pmxe_wp_ajax_wpae_filtering_count(){
195
  {
196
  ?>
197
  <div class="founded_records">
198
- <?php if ($found_records > 0) :?>
199
- <?php if (XmlExportEngine::$is_user_export || XmlExportEngine::$is_comment_export): ?>
200
- <h3><span class="matches_count"><?php echo $found_records; ?></span> <strong><?php echo wp_all_export_get_cpt_name($cpt, $found_records); ?></strong> can be exported</h3>
201
- <h4><?php printf(__('Upgrade to the Pro edition of WP All Export to Export %s', 'wp_all_export_plugin'), wp_all_export_get_cpt_name($cpt)); ?></h4>
202
- <?php else:?>
203
- <h3><span class="matches_count"><?php echo $found_records; ?></span> <strong><?php echo wp_all_export_get_cpt_name($cpt, $found_records); ?></strong> will be exported</h3>
204
  <h4><?php _e("Continue to configure and run your export.", "wp_all_export_plugin"); ?></h4>
205
- <?php endif; ?>
206
  <?php elseif ($total_records > 0): ?>
207
- <h4 style="line-height:60px;"><?php printf(__("No matching %s found for selected filter rules.", "wp_all_export_plugin"), wp_all_export_get_cpt_name($cpt)); ?></h4>
208
  <?php else: ?>
209
- <h4 style="line-height:60px;"><?php printf(__("There aren't any %s to export.", "wp_all_export_plugin"), wp_all_export_get_cpt_name($cpt)); ?></h4>
210
  <?php endif; ?>
211
  </div>
212
  <?php
213
  }
214
 
215
- exit(json_encode(array('html' => ob_get_clean(), 'found_records' => $found_records))); die;
216
 
217
  }
12
 
13
  ob_start();
14
 
15
+ $hasVariations = false;
16
+
17
  $input = new PMXE_Input();
18
 
19
  $post = $input->post('data', array());
20
 
21
  $filter_args = array(
22
  'filter_rules_hierarhy' => empty($post['filter_rules_hierarhy']) ? array() : $post['filter_rules_hierarhy'],
23
+ 'product_matching_mode' => empty($post['product_matching_mode']) ? 'strict' : $post['product_matching_mode'],
24
+ 'taxonomy_to_export' => empty($post['taxonomy_to_export']) ? '' : $post['taxonomy_to_export']
25
  );
26
 
27
  $input = new PMXE_Input();
41
 
42
  XmlExportEngine::$is_user_export = ( 'users' == $post['cpt'] or 'shop_customer' == $post['cpt'] ) ? true : false;
43
  XmlExportEngine::$is_comment_export = ( 'comments' == $post['cpt'] ) ? true : false;
44
+ XmlExportEngine::$is_taxonomy_export = ( 'taxonomies' == $post['cpt'] ) ? true : false;
45
  XmlExportEngine::$post_types = array($post['cpt']);
46
+ XmlExportEngine::$exportOptions['export_variations'] = empty($post['export_variations']) ? XmlExportEngine::VARIABLE_PRODUCTS_EXPORT_VARIATION : $post['export_variations'];
47
 
48
  $filters = new XmlExportFiltering($filter_args);
49
 
125
  $found_records = $total_records = get_comments( array( 'orderby' => 'comment_ID', 'order' => 'ASC', 'number' => 10, 'count' => true));
126
  }
127
  }
128
+ elseif( 'taxonomies' == $post['cpt'] )
129
+ {
130
+ global $wp_version;
131
+
132
+ if ( version_compare($wp_version, '4.6.0', '>=') ) {
133
+ $exportQuery = new WP_Term_Query(array(
134
+ 'taxonomy' => $post['taxonomy_to_export'],
135
+ 'orderby' => 'name',
136
+ 'order' => 'ASC',
137
+ 'hide_empty' => FALSE
138
+ ));
139
+ $found_records = $found_records = count($exportQuery->get_terms());
140
+ }
141
+ else{
142
+ ?>
143
+ <div class="founded_records">
144
+ <h3><?php _e('Unable to Export', 'wp_all_export_plugin'); ?></h3>
145
+ <h4><?php printf(__("Exporting taxonomies requires WordPress 4.6 or greater", "wp_all_export_plugin"), wp_all_export_get_cpt_name($cpt, 2, $post)); ?></h4>
146
+ </div>
147
+ <?php
148
+ exit(json_encode(array('html' => ob_get_clean(), 'found_records' => 0, 'hasVariations' => $hasVariations))); die;
149
+ }
150
+ }
151
  else
152
  {
153
  remove_all_actions('parse_query');
156
 
157
  $cpt = ($is_products_export) ? array('product', 'product_variation') : array($post['cpt']);
158
 
 
 
 
 
 
159
  // get total custom post type records
160
+ $totalQuery = new WP_Query( array( 'post_type' => $cpt, 'post_status' => 'any', 'orderby' => 'ID', 'order' => 'ASC', 'posts_per_page' => 10 ));
161
  if ( ! empty($totalQuery->found_posts)){
162
+ $total_records = $totalQuery->found_posts;
163
  }
164
 
165
  wp_reset_postdata();
166
 
167
+ ob_start();
168
+ // get custom post type records depends on filters
169
+ add_filter('posts_where', 'wp_all_export_posts_where', 10, 1);
170
+ add_filter('posts_join', 'wp_all_export_posts_join', 10, 1);
171
+
172
+ $exportQuery = new WP_Query( array( 'post_type' => $cpt, 'post_status' => 'any', 'orderby' => 'ID', 'order' => 'ASC', 'posts_per_page' => 10 ));
173
+ if ( ! empty($exportQuery->found_posts))
174
+ {
175
+ $found_records = $exportQuery->found_posts;
176
+ }
177
+
178
+ if($is_products_export) {
179
+ foreach($exportQuery->posts as $product) {
180
+ if($product->post_type = 'product_variation') {
181
+ $hasVariations = true;
182
+ }
183
+ }
184
+ }
185
+
186
  remove_filter('posts_join', 'wp_all_export_posts_join');
187
  remove_filter('posts_where', 'wp_all_export_posts_where');
188
+ ob_end_clean();
189
  }
190
  }
191
+
192
+ PMXE_Plugin::$session->set('exportQuery', $exportQuery);
193
+ PMXE_Plugin::$session->save_data();
194
 
195
  if ( $post['is_confirm_screen'] )
196
  {
197
  ?>
198
 
199
  <?php if ($found_records > 0) :?>
200
+ <h3><?php _e('Your export is ready to run.', 'wp_all_export_plugin'); ?></h3>
201
+ <h4><?php printf(__('WP All Export will export %d %s.', 'wp_all_export_plugin'), $found_records, wp_all_export_get_cpt_name($cpt, $found_records, $post)); ?></h4>
202
  <?php else: ?>
203
  <?php if (! $export->isEmpty() and $export->options['export_only_new_stuff']): ?>
204
  <h3><?php _e('Nothing to export.', 'wp_all_export_plugin'); ?></h3>
205
+ <h4><?php printf(__("All %s have already been exported.", "wp_all_export_plugin"), wp_all_export_get_cpt_name($cpt, 2, $post)); ?></h4>
206
  <?php elseif ($total_records > 0): ?>
207
  <h3><?php _e('Nothing to export.', 'wp_all_export_plugin'); ?></h3>
208
+ <h4><?php printf(__("No matching %s found for selected filter rules.", "wp_all_export_plugin"), wp_all_export_get_cpt_name($cpt, 2, $post)); ?></h4>
209
  <?php else: ?>
210
  <h3><?php _e('Nothing to export.', 'wp_all_export_plugin'); ?></h3>
211
+ <h4><?php printf(__("There aren't any %s to export.", "wp_all_export_plugin"), wp_all_export_get_cpt_name($cpt, 2, $post)); ?></h4>
212
  <?php endif; ?>
213
  <?php endif; ?>
214
 
219
  ?>
220
 
221
  <?php if ($found_records > 0) :?>
222
+ <h3><span class="matches_count"><?php echo $found_records; ?></span> <strong><?php echo wp_all_export_get_cpt_name($cpt, $found_records, $post); ?></strong> will be exported</h3>
223
  <h4><?php _e("Choose data to include in the export file.", "wp_all_export_plugin"); ?></h4>
224
  <?php else: ?>
225
  <?php if (! $export->isEmpty() and $export->options['export_only_new_stuff']): ?>
226
  <h3><?php _e('Nothing to export.', 'wp_all_export_plugin'); ?></h3>
227
+ <h4><?php printf(__("All %s have already been exported.", "wp_all_export_plugin"), wp_all_export_get_cpt_name($cpt, 2, $post)); ?></h4>
228
  <?php elseif ($total_records > 0): ?>
229
  <h3><?php _e('Nothing to export.', 'wp_all_export_plugin'); ?></h3>
230
+ <h4><?php printf(__("No matching %s found for selected filter rules.", "wp_all_export_plugin"), wp_all_export_get_cpt_name($cpt, 2, $post)); ?></h4>
231
  <?php else: ?>
232
  <h3><?php _e('Nothing to export.', 'wp_all_export_plugin'); ?></h3>
233
+ <h4><?php printf(__("There aren't any %s to export.", "wp_all_export_plugin"), wp_all_export_get_cpt_name($cpt, 2, $post)); ?></h4>
234
  <?php endif; ?>
235
  <?php endif; ?>
236
 
240
  {
241
  ?>
242
  <div class="founded_records">
243
+ <?php if ($found_records > 0) :?>
244
+ <h3><span class="matches_count"><?php echo $found_records; ?></span> <strong><?php echo wp_all_export_get_cpt_name($cpt, $found_records, $post); ?></strong> will be exported</h3>
 
 
 
 
245
  <h4><?php _e("Continue to configure and run your export.", "wp_all_export_plugin"); ?></h4>
 
246
  <?php elseif ($total_records > 0): ?>
247
+ <h4 style="line-height:60px;"><?php printf(__("No matching %s found for selected filter rules.", "wp_all_export_plugin"), wp_all_export_get_cpt_name($cpt, 2, $post)); ?></h4>
248
  <?php else: ?>
249
+ <h4 style="line-height:60px;"><?php printf(__("There aren't any %s to export.", "wp_all_export_plugin"), wp_all_export_get_cpt_name($cpt, 2, $post)); ?></h4>
250
  <?php endif; ?>
251
  </div>
252
  <?php
253
  }
254
 
255
+ exit(json_encode(array('html' => ob_get_clean(), 'found_records' => $found_records, 'hasVariations' => $hasVariations))); die;
256
 
257
  }
actions/wp_ajax_wpae_preview.php CHANGED
@@ -41,6 +41,7 @@ function pmxe_wp_ajax_wpae_preview(){
41
  XmlExportEngine::$exportOptions = $exportOptions;
42
  XmlExportEngine::$is_user_export = $exportOptions['is_user_export'];
43
  XmlExportEngine::$is_comment_export = $exportOptions['is_comment_export'];
 
44
  XmlExportEngine::$exportID = $export_id;
45
 
46
 
@@ -105,16 +106,13 @@ function pmxe_wp_ajax_wpae_preview(){
105
 
106
  if ( 'advanced' == $exportOptions['export_type'] )
107
  {
108
- if ( XmlExportEngine::$is_user_export )
109
- {
110
  $exportQuery = eval('return new WP_User_Query(array(' . $exportOptions['wp_query'] . ', \'offset\' => 0, \'number\' => 10));');
111
  }
112
- elseif ( XmlExportEngine::$is_comment_export )
113
- {
114
  $exportQuery = eval('return new WP_Comment_Query(array(' . $exportOptions['wp_query'] . ', \'offset\' => 0, \'number\' => 10));');
115
  }
116
- else
117
- {
118
  $exportQuery = eval('return new WP_Query(array(' . $exportOptions['wp_query'] . ', \'offset\' => 0, \'posts_per_page\' => 10));');
119
  }
120
  }
@@ -166,7 +164,7 @@ function pmxe_wp_ajax_wpae_preview(){
166
 
167
  <div id="post-preview" class="wpallexport-preview">
168
 
169
- <p class="wpallexport-preview-title"><?php echo sprintf("Preview first 10 %s", wp_all_export_get_cpt_name($exportOptions['cpt'], 10)); ?></p>
170
 
171
  <div class="wpallexport-preview-content">
172
 
41
  XmlExportEngine::$exportOptions = $exportOptions;
42
  XmlExportEngine::$is_user_export = $exportOptions['is_user_export'];
43
  XmlExportEngine::$is_comment_export = $exportOptions['is_comment_export'];
44
+ XmlExportEngine::$is_taxonomy_export = $exportOptions['is_taxonomy_export'];
45
  XmlExportEngine::$exportID = $export_id;
46
 
47
 
106
 
107
  if ( 'advanced' == $exportOptions['export_type'] )
108
  {
109
+ if ( XmlExportEngine::$is_user_export ) {
 
110
  $exportQuery = eval('return new WP_User_Query(array(' . $exportOptions['wp_query'] . ', \'offset\' => 0, \'number\' => 10));');
111
  }
112
+ elseif ( XmlExportEngine::$is_comment_export ) {
 
113
  $exportQuery = eval('return new WP_Comment_Query(array(' . $exportOptions['wp_query'] . ', \'offset\' => 0, \'number\' => 10));');
114
  }
115
+ else {
 
116
  $exportQuery = eval('return new WP_Query(array(' . $exportOptions['wp_query'] . ', \'offset\' => 0, \'posts_per_page\' => 10));');
117
  }
118
  }
164
 
165
  <div id="post-preview" class="wpallexport-preview">
166
 
167
+ <p class="wpallexport-preview-title"><?php echo sprintf("Preview first 10 %s", wp_all_export_get_cpt_name($exportOptions['cpt'], 10, $exportOptions)); ?></p>
168
 
169
  <div class="wpallexport-preview-content">
170
 
classes/XMLWriter.php CHANGED
@@ -33,8 +33,13 @@ class PMXE_XMLWriter extends XMLWriter
33
  if (!isset($article[$key])) {
34
  $article[$key] = array($value);
35
  } else {
 
 
 
 
36
  $article[$key] = array($article[$key], $value);
37
  }
 
38
 
39
  if (!in_array($key, $keys)) $keys[] = $key;
40
  }
@@ -167,6 +172,8 @@ class PMXE_XMLWriter extends XMLWriter
167
  $v = str_replace(']', 'CLOSEBRAKET', str_replace('[', 'OPENBRAKET', $value));
168
  // replace { and }
169
  $v = str_replace('}', 'CLOSECURVE', str_replace('{', 'OPENCURVE', $v));
 
 
170
 
171
  $originalValue = $v;
172
 
@@ -200,6 +207,7 @@ class PMXE_XMLWriter extends XMLWriter
200
  }
201
 
202
  $xml .= $node_tpl;
 
203
  }
204
 
205
  $this->articles = array();
@@ -264,6 +272,7 @@ class PMXE_XMLWriter extends XMLWriter
264
  $filtered = preg_replace("%[\{\}]%", "\"", $filtered);
265
  $filtered = str_replace('CLOSEBRAKET', ']', str_replace('OPENBRAKET', '[', $filtered));
266
  $filtered = str_replace('CLOSECURVE', '}', str_replace('OPENCURVE', '{', $filtered));
 
267
 
268
  $functionName = self::sanitizeFunctionName($filtered);
269
 
@@ -326,6 +335,7 @@ class PMXE_XMLWriter extends XMLWriter
326
 
327
  $filtered = str_replace('CLOSEBRAKET', ']', str_replace('OPENBRAKET', '[', $filtered));
328
  $filtered = str_replace('CLOSECURVE', '}', str_replace('OPENCURVE', '{', $filtered));
 
329
 
330
  if ($is_attribute) {
331
  $xml = str_replace($snipet, $filtered, $xml);
33
  if (!isset($article[$key])) {
34
  $article[$key] = array($value);
35
  } else {
36
+ if (is_array($article[$key])){
37
+ array_push($article[$key], $value);
38
+ }
39
+ else{
40
  $article[$key] = array($article[$key], $value);
41
  }
42
+ }
43
 
44
  if (!in_array($key, $keys)) $keys[] = $key;
45
  }
172
  $v = str_replace(']', 'CLOSEBRAKET', str_replace('[', 'OPENBRAKET', $value));
173
  // replace { and }
174
  $v = str_replace('}', 'CLOSECURVE', str_replace('{', 'OPENCURVE', $v));
175
+ // replace ( and )
176
+ $v = str_replace(')', 'CLOSECIRCLE', str_replace('(', 'OPENCIRCLE', $v));
177
 
178
  $originalValue = $v;
179
 
207
  }
208
 
209
  $xml .= $node_tpl;
210
+
211
  }
212
 
213
  $this->articles = array();
272
  $filtered = preg_replace("%[\{\}]%", "\"", $filtered);
273
  $filtered = str_replace('CLOSEBRAKET', ']', str_replace('OPENBRAKET', '[', $filtered));
274
  $filtered = str_replace('CLOSECURVE', '}', str_replace('OPENCURVE', '{', $filtered));
275
+ $filtered = str_replace('CLOSECIRCLE', ')', str_replace('OPENCIRCLE', '(', $filtered));
276
 
277
  $functionName = self::sanitizeFunctionName($filtered);
278
 
335
 
336
  $filtered = str_replace('CLOSEBRAKET', ']', str_replace('OPENBRAKET', '[', $filtered));
337
  $filtered = str_replace('CLOSECURVE', '}', str_replace('OPENCURVE', '{', $filtered));
338
+ $filtered = str_replace('CLOSECIRCLE', ')', str_replace('OPENCIRCLE', '(', $filtered));
339
 
340
  if ($is_attribute) {
341
  $xml = str_replace($snipet, $filtered, $xml);
classes/download.php CHANGED
@@ -7,12 +7,8 @@ class PMXE_Download
7
  {
8
  $uploads = wp_upload_dir();
9
  $bundle_url = $uploads['baseurl'] . str_replace($uploads['basedir'], '', $file_name);
 
10
  wp_redirect($bundle_url);
11
- die;
12
- header('Content-type: application/zip');
13
- header("Content-Disposition: attachment; filename=\"".basename($file_name)."\"");
14
- header('Content-Length: ' . filesize($file_name));
15
- readfile($file_name);
16
  die;
17
  }
18
 
@@ -24,6 +20,14 @@ class PMXE_Download
24
  die;
25
  }
26
 
 
 
 
 
 
 
 
 
27
  static public function csv($file_name)
28
  {
29
  header("Content-Type: text/plain; charset=UTF-8");
7
  {
8
  $uploads = wp_upload_dir();
9
  $bundle_url = $uploads['baseurl'] . str_replace($uploads['basedir'], '', $file_name);
10
+ $bundle_url = str_replace( "\\", "/", $bundle_url );
11
  wp_redirect($bundle_url);
 
 
 
 
 
12
  die;
13
  }
14
 
20
  die;
21
  }
22
 
23
+ static public function xlsx($file_name)
24
+ {
25
+ header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=UTF-8");
26
+ header("Content-Disposition: attachment; filename=\"".basename($file_name)."\"");
27
+ readfile($file_name);
28
+ die;
29
+ }
30
+
31
  static public function csv($file_name)
32
  {
33
  header("Content-Type: text/plain; charset=UTF-8");
classes/wpallimport.php CHANGED
@@ -243,10 +243,12 @@ final class PMXE_Wpallimport
243
  self::$templateOptions['pmwi_order']['is_update_taxes'] = 0;
244
  self::$templateOptions['pmwi_order']['is_update_refunds'] = 0;
245
  self::$templateOptions['pmwi_order']['is_update_total'] = 0;
 
246
  self::$templateOptions['pmwi_order']['status'] = 'wc-pending';
247
  self::$templateOptions['pmwi_order']['billing_source'] = 'existing';
248
  self::$templateOptions['pmwi_order']['billing_source_match_by'] = 'username';
249
- self::$templateOptions['pmwi_order']['shipping_source'] = 'copy';
 
250
  self::$templateOptions['pmwi_order']['products_repeater_mode'] = 'csv';
251
  self::$templateOptions['pmwi_order']['products_repeater_mode_separator'] = '|';
252
  self::$templateOptions['pmwi_order']['products_source'] = 'existing';
@@ -284,6 +286,20 @@ final class PMXE_Wpallimport
284
 
285
  self::prepare_import_template( $exportOptions );
286
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  $tpl_options = self::$templateOptions;
288
 
289
  if ( 'csv' == $exportOptions['export_to'] )
243
  self::$templateOptions['pmwi_order']['is_update_taxes'] = 0;
244
  self::$templateOptions['pmwi_order']['is_update_refunds'] = 0;
245
  self::$templateOptions['pmwi_order']['is_update_total'] = 0;
246
+ self::$templateOptions['pmwi_order']['is_guest_matching'] = 1;
247
  self::$templateOptions['pmwi_order']['status'] = 'wc-pending';
248
  self::$templateOptions['pmwi_order']['billing_source'] = 'existing';
249
  self::$templateOptions['pmwi_order']['billing_source_match_by'] = 'username';
250
+ self::$templateOptions['pmwi_order']['shipping_source'] = 'guest';
251
+ self::$templateOptions['pmwi_order']['copy_from_billing'] = 1;
252
  self::$templateOptions['pmwi_order']['products_repeater_mode'] = 'csv';
253
  self::$templateOptions['pmwi_order']['products_repeater_mode_separator'] = '|';
254
  self::$templateOptions['pmwi_order']['products_source'] = 'existing';
286
 
287
  self::prepare_import_template( $exportOptions );
288
 
289
+ if ( in_array('product', $exportOptions['cpt']) )
290
+ {
291
+ self::$templateOptions['single_page_parent'] = '';
292
+ if ( ! empty($exportOptions['export_variations']) && $exportOptions['export_variations'] == XmlExportEngine::VARIABLE_PRODUCTS_EXPORT_VARIATION ){
293
+ if ( $exportOptions['export_variations_title'] == XmlExportEngine::VARIATION_USE_PARENT_TITLE ){
294
+ self::$templateOptions['matching_parent'] = 'first_is_variation';
295
+ }
296
+ if ( $exportOptions['export_variations_title'] == XmlExportEngine::VARIATION_USE_DEFAULT_TITLE ) {
297
+ self::$templateOptions['matching_parent'] = 'first_is_parent_id';
298
+ //self::$templateOptions['single_product_id_first_is_parent_id'] = '{parent_id[1]}';
299
+ }
300
+ }
301
+ }
302
+
303
  $tpl_options = self::$templateOptions;
304
 
305
  if ( 'csv' == $exportOptions['export_to'] )
controllers/admin/export.php CHANGED
@@ -85,7 +85,9 @@ class PMXE_Admin_Export extends PMXE_Controller_Admin {
85
  'filter_rules_hierarhy' => '',
86
  'product_matching_mode' => 'strict',
87
  'wp_query_selector' => 'wp_query',
88
- 'auto_generate' => 0
 
 
89
  );
90
 
91
  if ( ! in_array($action, array('index')))
@@ -129,6 +131,8 @@ class PMXE_Admin_Export extends PMXE_Controller_Admin {
129
  PMXE_Plugin::$session->set('filter_rules_hierarhy', $post['filter_rules_hierarhy']);
130
  PMXE_Plugin::$session->set('product_matching_mode', $post['product_matching_mode']);
131
  PMXE_Plugin::$session->set('wp_query_selector', $post['wp_query_selector']);
 
 
132
 
133
  if ( ! empty($post['auto_generate']) )
134
  {
@@ -185,6 +189,12 @@ class PMXE_Admin_Export extends PMXE_Controller_Admin {
185
  }
186
  else{
187
  $DefaultOptions = $this->data['export']->options + $default;
 
 
 
 
 
 
188
  $post = $this->input->post($DefaultOptions);
189
  $post['scheduled'] = $this->data['export']->scheduled;
190
 
@@ -207,6 +217,10 @@ class PMXE_Admin_Export extends PMXE_Controller_Admin {
207
 
208
  PMXE_Plugin::$session->set('is_loaded_template', '');
209
 
 
 
 
 
210
  if (($load_template = $this->input->post('load_template'))) { // init form with template selected
211
  if ( ! $template->getById($load_template)->isEmpty()) {
212
  $template_options = $template->options;
@@ -226,7 +240,7 @@ class PMXE_Admin_Export extends PMXE_Controller_Admin {
226
 
227
  check_admin_referer('template', '_wpnonce_template');
228
 
229
- if ( empty($post['cc_type'][0]) ){
230
  $this->errors->add('form-validation', __('You haven\'t selected any columns for export.', 'wp_all_export_plugin'));
231
  }
232
 
@@ -234,7 +248,7 @@ class PMXE_Admin_Export extends PMXE_Controller_Admin {
234
  $this->errors->add('form-validation', __('CSV delimiter must be specified.', 'wp_all_export_plugin'));
235
  }
236
 
237
- if ( 'xml' == $post['export_to'] )
238
  {
239
  $post['main_xml_tag'] = preg_replace('/[^a-z0-9]/i', '', $post['main_xml_tag']);
240
  if ( empty($post['main_xml_tag']) ){
@@ -280,11 +294,14 @@ class PMXE_Admin_Export extends PMXE_Controller_Admin {
280
 
281
  }
282
 
283
- $this->data['engine'] = new XmlExportEngine($post, $this->errors);
 
 
284
 
285
- $this->data['engine']->init_additional_data();
286
 
287
- $this->data = array_merge($this->data, $this->data['engine']->init_available_data());
 
288
 
289
  $this->data['available_data_view'] = $this->data['engine']->render();
290
 
@@ -307,8 +324,15 @@ class PMXE_Admin_Export extends PMXE_Controller_Admin {
307
  }
308
  else{
309
  $DefaultOptions = $this->data['export']->options + $default;
 
 
 
 
 
 
310
  $post = $this->input->post($DefaultOptions);
311
  $post['scheduled'] = $this->data['export']->scheduled;
 
312
  foreach ($post as $key => $value) {
313
  PMXE_Plugin::$session->set($key, $value);
314
  }
@@ -330,13 +354,28 @@ class PMXE_Admin_Export extends PMXE_Controller_Admin {
330
  $post_types = PMXE_Plugin::$session->get('cpt');
331
  if ( ! empty($post_types) )
332
  {
333
- if ( ! in_array('users', $post_types)){
334
- $post_type_details = get_post_type_object( array_shift($post_types) );
335
- $friendly_name = $post_type_details->labels->name . ' Export - ' . date("Y F d H:i");
336
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
  else
338
  {
339
- $friendly_name = 'Users Export - ' . date("Y F d H:i");
 
340
  }
341
  }
342
  else
85
  'filter_rules_hierarhy' => '',
86
  'product_matching_mode' => 'strict',
87
  'wp_query_selector' => 'wp_query',
88
+ 'auto_generate' => 0,
89
+ 'taxonomy_to_export' => '',
90
+ 'created_at_version' => PMXE_VERSION
91
  );
92
 
93
  if ( ! in_array($action, array('index')))
131
  PMXE_Plugin::$session->set('filter_rules_hierarhy', $post['filter_rules_hierarhy']);
132
  PMXE_Plugin::$session->set('product_matching_mode', $post['product_matching_mode']);
133
  PMXE_Plugin::$session->set('wp_query_selector', $post['wp_query_selector']);
134
+ PMXE_Plugin::$session->set('taxonomy_to_export', $post['taxonomy_to_export']);
135
+ PMXE_Plugin::$session->set('created_at_version', $post['created_at_version']);
136
 
137
  if ( ! empty($post['auto_generate']) )
138
  {
189
  }
190
  else{
191
  $DefaultOptions = $this->data['export']->options + $default;
192
+ if (empty($this->data['export']->options['export_variations'])){
193
+ $DefaultOptions['export_variations'] = XmlExportEngine::VARIABLE_PRODUCTS_EXPORT_PARENT_AND_VARIATION;
194
+ }
195
+ if (empty($this->data['export']->options['export_variations_title'])){
196
+ $DefaultOptions['export_variations_title'] = XmlExportEngine::VARIATION_USE_DEFAULT_TITLE;
197
+ }
198
  $post = $this->input->post($DefaultOptions);
199
  $post['scheduled'] = $this->data['export']->scheduled;
200
 
217
 
218
  PMXE_Plugin::$session->set('is_loaded_template', '');
219
 
220
+ $this->data['engine'] = null;
221
+
222
+ XmlExportEngine::$exportQuery = PMXE_Plugin::$session->get('exportQuery');
223
+
224
  if (($load_template = $this->input->post('load_template'))) { // init form with template selected
225
  if ( ! $template->getById($load_template)->isEmpty()) {
226
  $template_options = $template->options;
240
 
241
  check_admin_referer('template', '_wpnonce_template');
242
 
243
+ if ( empty($post['cc_type'][0]) && ! in_array($post['xml_template_type'], array('custom', 'XmlGoogleMerchants')) ){
244
  $this->errors->add('form-validation', __('You haven\'t selected any columns for export.', 'wp_all_export_plugin'));
245
  }
246
 
248
  $this->errors->add('form-validation', __('CSV delimiter must be specified.', 'wp_all_export_plugin'));
249
  }
250
 
251
+ if ( 'xml' == $post['export_to'] && ! in_array($post['xml_template_type'], array('custom', 'XmlGoogleMerchants')) )
252
  {
253
  $post['main_xml_tag'] = preg_replace('/[^a-z0-9]/i', '', $post['main_xml_tag']);
254
  if ( empty($post['main_xml_tag']) ){
294
 
295
  }
296
 
297
+ if ( empty($this->data['engine']) ){
298
+
299
+ $this->data['engine'] = new XmlExportEngine($post, $this->errors);
300
 
301
+ $this->data['engine']->init_additional_data();
302
 
303
+ $this->data = array_merge($this->data, $this->data['engine']->init_available_data());
304
+ }
305
 
306
  $this->data['available_data_view'] = $this->data['engine']->render();
307
 
324
  }
325
  else{
326
  $DefaultOptions = $this->data['export']->options + $default;
327
+ if (empty($this->data['export']->options['export_variations'])){
328
+ $DefaultOptions['export_variations'] = XmlExportEngine::VARIABLE_PRODUCTS_EXPORT_PARENT_AND_VARIATION;
329
+ }
330
+ if (empty($this->data['export']->options['export_variations_title'])){
331
+ $DefaultOptions['export_variations_title'] = XmlExportEngine::VARIATION_USE_DEFAULT_TITLE;
332
+ }
333
  $post = $this->input->post($DefaultOptions);
334
  $post['scheduled'] = $this->data['export']->scheduled;
335
+
336
  foreach ($post as $key => $value) {
337
  PMXE_Plugin::$session->set($key, $value);
338
  }
354
  $post_types = PMXE_Plugin::$session->get('cpt');
355
  if ( ! empty($post_types) )
356
  {
357
+ if ( in_array('users', $post_types) ){
358
+ $friendly_name = 'Users Export - ' . date("Y F d H:i");
359
+ }
360
+ elseif ( in_array('shop_customer', $post_types)){
361
+ $friendly_name = 'Customers Export - ' . date("Y F d H:i");
362
+ }
363
+ elseif ( in_array('comments', $post_types) ){
364
+ $friendly_name = 'Comments Export - ' . date("Y F d H:i");
365
+ }
366
+ elseif ( in_array('taxonomies', $post_types) ){
367
+ $tx = get_taxonomy( $post['taxonomy_to_export'] );
368
+ if (!empty($tx->labels->name)){
369
+ $friendly_name = $tx->labels->name . ' Export - ' . date("Y F d H:i");
370
+ }
371
+ else{
372
+ $friendly_name = 'Taxonomy Terms Export - ' . date("Y F d H:i");
373
+ }
374
+ }
375
  else
376
  {
377
+ $post_type_details = get_post_type_object( array_shift($post_types) );
378
+ $friendly_name = $post_type_details->labels->name . ' Export - ' . date("Y F d H:i");
379
  }
380
  }
381
  else
controllers/admin/manage.php CHANGED
@@ -168,6 +168,12 @@ class PMXE_Admin_Manage extends PMXE_Controller_Admin {
168
 
169
  $default = PMXE_Plugin::get_default_import_options();
170
  $DefaultOptions = $item->options + $default;
 
 
 
 
 
 
171
  $this->data['post'] = $post = $this->input->post($DefaultOptions);
172
  $this->data['iteration'] = $item->iteration;
173
 
@@ -428,7 +434,14 @@ class PMXE_Admin_Manage extends PMXE_Controller_Admin {
428
  PMXE_download::xml($filepath);
429
  break;
430
  case 'csv':
431
- PMXE_download::csv($filepath);
 
 
 
 
 
 
 
432
  break;
433
 
434
  default:
168
 
169
  $default = PMXE_Plugin::get_default_import_options();
170
  $DefaultOptions = $item->options + $default;
171
+ if (empty($item->options['export_variations'])){
172
+ $DefaultOptions['export_variations'] = XmlExportEngine::VARIABLE_PRODUCTS_EXPORT_PARENT_AND_VARIATION;
173
+ }
174
+ if (empty($item->options['export_variations_title'])){
175
+ $DefaultOptions['export_variations_title'] = XmlExportEngine::VARIATION_USE_DEFAULT_TITLE;
176
+ }
177
  $this->data['post'] = $post = $this->input->post($DefaultOptions);
178
  $this->data['iteration'] = $item->iteration;
179
 
434
  PMXE_download::xml($filepath);
435
  break;
436
  case 'csv':
437
+ if (empty($export->options['export_to_sheet']) or $export->options['export_to_sheet'] == 'csv')
438
+ {
439
+ PMXE_download::csv($filepath);
440
+ }
441
+ else
442
+ {
443
+ PMXE_download::xls($filepath);
444
+ }
445
  break;
446
 
447
  default:
controllers/controller.php CHANGED
@@ -54,6 +54,7 @@ abstract class PMXE_Controller {
54
  * Method returning resolved template content
55
  *
56
  * @param string[optional] $viewPath Template path to render
 
57
  */
58
  protected function render($viewPath = null) {
59
 
@@ -144,7 +145,21 @@ abstract class PMXE_Controller {
144
  PMXE_download::xml($filepath);
145
  break;
146
  case 'csv':
 
 
147
  PMXE_download::csv($filepath);
 
 
 
 
 
 
 
 
 
 
 
 
148
  break;
149
 
150
  default:
54
  * Method returning resolved template content
55
  *
56
  * @param string[optional] $viewPath Template path to render
57
+ * @throws Exception
58
  */
59
  protected function render($viewPath = null) {
60
 
145
  PMXE_download::xml($filepath);
146
  break;
147
  case 'csv':
148
+ if (empty($export->options['export_to_sheet']) or $export->options['export_to_sheet'] == 'csv')
149
+ {
150
  PMXE_download::csv($filepath);
151
+ }
152
+ else
153
+ {
154
+ switch ($export->options['export_to_sheet']){
155
+ case 'xls':
156
+ PMXE_download::xls($filepath);
157
+ break;
158
+ case 'xlsx':
159
+ PMXE_download::xlsx($filepath);
160
+ break;
161
+ }
162
+ }
163
  break;
164
 
165
  default:
helpers/pmxe_functions.php CHANGED
@@ -96,3 +96,69 @@
96
  }
97
  }
98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  }
97
  }
98
 
99
+ if ( ! function_exists('wp_all_export_get_taxonomies')) {
100
+ function wp_all_export_get_taxonomies() {
101
+ // get all taxonomies
102
+ $taxonomies = get_taxonomies(FALSE, 'objects');
103
+ $ignore = array('nav_menu', 'link_category');
104
+ $r = array();
105
+ // populate $r
106
+ foreach ($taxonomies as $taxonomy) {
107
+ if (in_array($taxonomy->name, $ignore) || $taxonomy->show_in_nav_menus === false ) {
108
+ continue;
109
+ }
110
+ if ( ! empty($taxonomy->labels->name) && strpos($taxonomy->labels->name, "_") === false){
111
+ $r[$taxonomy->name] = $taxonomy->labels->name;
112
+ }
113
+ else{
114
+ $r[$taxonomy->name] = empty($taxonomy->labels->singular_name) ? $taxonomy->name : $taxonomy->labels->singular_name;
115
+ }
116
+ }
117
+ asort($r, SORT_FLAG_CASE | SORT_STRING);
118
+ // return
119
+ return $r;
120
+
121
+ }
122
+ }
123
+
124
+ if ( ! function_exists('wp_all_export_cmp_custom_types')){
125
+ function wp_all_export_cmp_custom_types($a, $b)
126
+ {
127
+ return strcmp($a->labels->name, $b->labels->name);
128
+ }
129
+ }
130
+
131
+ if ( ! function_exists('prepare_date_field_value')){
132
+ function prepare_date_field_value($fieldOptions, $timestamp, $defaultFormat = false){
133
+
134
+ if ( ! empty($fieldOptions))
135
+ {
136
+ switch ($fieldOptions)
137
+ {
138
+ case 'unix':
139
+ $post_date = $timestamp;
140
+ break;
141
+ default:
142
+ $post_date = date($fieldOptions, $timestamp);
143
+ break;
144
+ }
145
+ }
146
+ else
147
+ {
148
+ // Check if export was created before v1.4.2-beta-2.0
149
+ if ( PMXE_Plugin::isExistingExport("1.4.2-beta-2.0") ){
150
+ // Do not change date fields for exports created before v1.4.2-beta-2.0
151
+ $post_date = $defaultFormat ? date($defaultFormat, $timestamp) : $timestamp;
152
+ }
153
+ else
154
+ {
155
+ if ( in_array(XmlExportEngine::$exportOptions['xml_template_type'], array('custom', 'XmlGoogleMerchants')) ){
156
+ $post_date = date("Y-m-d H:i:s", $timestamp);
157
+ } else {
158
+ $post_date = date("Y-m-d", $timestamp);
159
+ }
160
+ }
161
+ }
162
+ return $post_date;
163
+ }
164
+ }
helpers/pmxe_render_xml_attributes.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- function pmxe_render_xml_attributes(DOMElement $el, $path = '/')
3
  {
4
  foreach ($el->attributes as $attr) {
5
  echo ' <span class="xml-attr" title="' . $path . '@' . $attr->nodeName . '"><span class="xml-attr-name">' . $attr->nodeName . '</span>=<span class="xml-attr-value">"' . esc_attr($attr->value) . '"</span></span>';
1
  <?php
2
+ function pmxe_render_xml_attributes($el, $path = '/')
3
  {
4
  foreach ($el->attributes as $attr) {
5
  echo ' <span class="xml-attr" title="' . $path . '@' . $attr->nodeName . '"><span class="xml-attr-name">' . $attr->nodeName . '</span>=<span class="xml-attr-value">"' . esc_attr($attr->value) . '"</span></span>';
helpers/pmxe_render_xml_element.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- function pmxe_render_xml_element(DOMElement $el, $shorten = false, $path = '/', $ind = 1, $lvl = 0)
3
  {
4
  $path .= $el->nodeName;
5
  $alternativePath = $path;
1
  <?php
2
+ function pmxe_render_xml_element($el, $shorten = false, $path = '/', $ind = 1, $lvl = 0)
3
  {
4
  $path .= $el->nodeName;
5
  $alternativePath = $path;
helpers/wp_all_export_get_cpt_name.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- function wp_all_export_get_cpt_name($cpt = array(), $count = 2)
4
  {
5
  $cptName = '';
6
  if ( ! empty($cpt))
@@ -17,6 +17,16 @@ function wp_all_export_get_cpt_name($cpt = array(), $count = 2)
17
  {
18
  $cptName = ($count > 1) ? __('Comments', 'wp_all_export_plugin') : __('Comment', 'wp_all_export_plugin');
19
  }
 
 
 
 
 
 
 
 
 
 
20
  else
21
  {
22
  if (count($cpt) === 1 and in_array('product_variation', $cpt) and class_exists('WooCommerce')){
1
  <?php
2
 
3
+ function wp_all_export_get_cpt_name($cpt = array(), $count = 2, $post = array())
4
  {
5
  $cptName = '';
6
  if ( ! empty($cpt))
17
  {
18
  $cptName = ($count > 1) ? __('Comments', 'wp_all_export_plugin') : __('Comment', 'wp_all_export_plugin');
19
  }
20
+ elseif (in_array('taxonomies', $cpt))
21
+ {
22
+ if (!empty($post['taxonomy_to_export'])){
23
+ $tx = get_taxonomy( $post['taxonomy_to_export'] );
24
+ $cptName = ($count > 1) ? $tx->labels->name : $tx->labels->singular_name;
25
+ }
26
+ else{
27
+ $cptName = ($count > 1) ? __('Taxonomy Terms', 'wp_all_export_plugin') : __('Taxonomy Term', 'wp_all_export_plugin');
28
+ }
29
+ }
30
  else
31
  {
32
  if (count($cpt) === 1 and in_array('product_variation', $cpt) and class_exists('WooCommerce')){
helpers/wp_all_export_get_export_format.php CHANGED
@@ -2,5 +2,5 @@
2
 
3
  function wp_all_export_get_export_format($options)
4
  {
5
- return ($options['export_to'] == 'xml') ? 'xml' : 'csv';
6
  }
2
 
3
  function wp_all_export_get_export_format($options)
4
  {
5
+ return ($options['export_to'] == 'xml') ? 'xml' : ( empty($options['export_to_sheet']) ? 'csv' : $options['export_to_sheet']);
6
  }
helpers/wp_all_export_parse_field_name.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function wp_all_export_parse_field_name($name){
4
+
5
+ if (strpos($name, "[") === 0 && strpos($name, "]") === strlen($name) - 1){
6
+ $snippet = str_replace(array("[", "]"), "", $name);
7
+ $name = eval("return " . $snippet . ";");
8
+ }
9
+
10
+ return $name;
11
+ }
libraries/VariableProductTitle/OnlyExportParent.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class VariableProductTitle_OnlyExportParent
4
+ {
5
+ /** @var string */
6
+ protected $value;
7
+
8
+ public function process(WP_Post $current, WP_Post $parent)
9
+ {
10
+ }
11
+ }
libraries/VariableProductTitle/TitleProcessor.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class VariableProductTitle_TitleProcessor
4
+ {
5
+ /** @var string */
6
+ protected $value;
7
+
8
+ public function process(WP_Post $current, WP_Post $parent)
9
+ {
10
+ return $current->post_title;
11
+ }
12
+ }
libraries/VariableProductTitle/UseParentTitle.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class VariableProductTitle_UseParentTitle
4
+ {
5
+ /** @var string */
6
+ protected $value;
7
+
8
+ public function getTitle(WP_Post $current, WP_Post $parent)
9
+ {
10
+ return false;
11
+ }
12
+ }
libraries/VariableProductTitle/UseVariationTitle.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class VariableProductTitle_UseVariationTitle
4
+ {
5
+ /** @var string */
6
+ protected $value;
7
+
8
+ public function getTitle(WP_Post $current, WP_Post $parent)
9
+ {
10
+ return $current->post_title;
11
+ }
12
+ }
libraries/WpaePhpInterpreterErrorHandler.php CHANGED
@@ -21,11 +21,11 @@ class WpaePhpInterpreterErrorHandler
21
  if($error['message'] == '') {
22
  $error['message'] = __('An unknown error occured', 'wp_all_import_plugin');
23
  }
24
- $this->terminate(json_encode(array('error' => '<span class="error">'.$error['message'].'</span>', 'line' => $error['line'], 'title' => __('An error occurred','wp_all_import_plugin'))));
25
  } else if(strpos($error['file'], 'XMLWriter.php') !== false ) {
26
  if(strpos($error['message'],'syntax error, unexpected') !== false) {
27
  echo "[[ERROR]]";
28
- $this->terminate(json_encode(array('error'=>__('You probably forgot to close a quote', 'wp_all_import_plugin'),'title' => __('An error occurred','wp_all_import_plugin'))));
29
  }
30
  }
31
  }
21
  if($error['message'] == '') {
22
  $error['message'] = __('An unknown error occured', 'wp_all_import_plugin');
23
  }
24
+ $this->terminate(json_encode(array('error' => '<span class="error">'.$error['message'].' of the Functions Editor'.'</span>', 'line' => $error['line'], 'title' => __('PHP Error','wp_all_import_plugin'))));
25
  } else if(strpos($error['file'], 'XMLWriter.php') !== false ) {
26
  if(strpos($error['message'],'syntax error, unexpected') !== false) {
27
  echo "[[ERROR]]";
28
+ $this->terminate(json_encode(array('error'=>__('You probably forgot to close a quote', 'wp_all_import_plugin'),'title' => __('PHP Error','wp_all_import_plugin'))));
29
  }
30
  }
31
  }
libraries/WpaeString.php CHANGED
@@ -3,6 +3,8 @@
3
 
4
  class WpaeString
5
  {
 
 
6
  public function isBetween($haystack, $search, $start, $end)
7
  {
8
  if($haystack == $search) {
@@ -53,13 +55,15 @@ class WpaeString
53
  return $sanitizedSnippet;
54
  }
55
 
56
- if(strpos($sanitizedSnippet, '"') === false && strpos($sanitizedSnippet, "'") === false ) {
57
  $sanitizedSnippet = str_replace("(","(\"",$sanitizedSnippet);
58
  $sanitizedSnippet = str_replace(")","\")",$sanitizedSnippet);
59
 
60
  return $sanitizedSnippet;
61
  }
62
 
 
 
63
  $sanitizedString = "";
64
 
65
  $isInString = false;
@@ -75,7 +79,7 @@ class WpaeString
75
  }
76
 
77
  if($sanitizedSnippet[$i] === "," && $isInString) {
78
- $sanitizedString.="*middlecomma*";
79
  } else {
80
  $sanitizedString .= $sanitizedSnippet[$i];
81
  }
@@ -113,7 +117,7 @@ class WpaeString
113
  $sanitizedSnippet = str_replace($originalParameterPart, $parameterPart, $sanitizedSnippet);
114
  }
115
 
116
- $sanitizedSnippet = str_replace('*middlecomma*', ',', $sanitizedSnippet);
117
 
118
  return $sanitizedSnippet;
119
  }
3
 
4
  class WpaeString
5
  {
6
+ const MIDDLE_COMMA = "*middlecomma*";
7
+
8
  public function isBetween($haystack, $search, $start, $end)
9
  {
10
  if($haystack == $search) {
55
  return $sanitizedSnippet;
56
  }
57
 
58
+ if(strpos($sanitizedSnippet, WpaeXmlProcessor::SNIPPET_DELIMITER) === false && strpos($sanitizedSnippet, '"') === false && strpos($sanitizedSnippet, "'") === false ) {
59
  $sanitizedSnippet = str_replace("(","(\"",$sanitizedSnippet);
60
  $sanitizedSnippet = str_replace(")","\")",$sanitizedSnippet);
61
 
62
  return $sanitizedSnippet;
63
  }
64
 
65
+ $sanitizedSnippet = str_replace(WpaeXmlProcessor::SNIPPET_DELIMITER, '"', $sanitizedSnippet);
66
+
67
  $sanitizedString = "";
68
 
69
  $isInString = false;
79
  }
80
 
81
  if($sanitizedSnippet[$i] === "," && $isInString) {
82
+ $sanitizedString.= self::MIDDLE_COMMA;
83
  } else {
84
  $sanitizedString .= $sanitizedSnippet[$i];
85
  }
117
  $sanitizedSnippet = str_replace($originalParameterPart, $parameterPart, $sanitizedSnippet);
118
  }
119
 
120
+ $sanitizedSnippet = str_replace(self::MIDDLE_COMMA, ',', $sanitizedSnippet);
121
 
122
  return $sanitizedSnippet;
123
  }
libraries/WpaeXmlProcessor.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  class WpaeXmlProcessor
4
  {
 
 
5
  /** @var array */
6
  protected $tags;
7
 
@@ -43,6 +45,7 @@ class WpaeXmlProcessor
43
 
44
  $root = $this->dom->getElementsByTagName("root");
45
  $this->dom->recover = true;
 
46
  $this->parseElement($root->item(0));
47
 
48
  $this->dom->preserveWhiteSpace = false;
@@ -84,26 +87,25 @@ class WpaeXmlProcessor
84
  $snippetValues = $this->processSnippet($snippet, $isInFunction);
85
 
86
  if (!is_array($snippetValues)) {
87
- $newValueNode = $element->parentNode->cloneNode(true);
88
- $newValueNode->nodeValue =
89
  str_replace(
90
  $snippet,
91
  $snippetValues,
92
- $newValueNode->nodeValue
93
  );
94
- // If the element has attributes, replace the values in them also
95
- $this->replaceSnippetInAttributes($newValueNode, $snippet, $snippetValues);
96
- $this->elementCdata($newValueNode);
97
- $element->parentNode->parentNode->replaceChild($newValueNode, $element->parentNode);
 
98
  } else {
99
  foreach ($snippetValues as $snippetValue) {
100
  $newValueNode = $element->parentNode->cloneNode(true);
101
  $newValueNode->nodeValue = str_replace($snippet, $snippetValue, $newValueNode->nodeValue);
102
  $this->replaceSnippetInAttributes($newValueNode, $snippet, $snippetValue);
103
  $this->elementCdata($newValueNode);
104
- $element->parentNode->parentNode->appendChild($newValueNode);
105
  }
106
-
107
  $element->parentNode->parentNode->removeChild($element->parentNode);
108
  }
109
  } else if (count($snippets) > 1) {
@@ -147,7 +149,7 @@ class WpaeXmlProcessor
147
  }
148
  $elementClone->nodeValue = $elementValue;
149
  $this->elementCdata($elementClone);
150
- $element->parentNode->parentNode->appendChild($elementClone);
151
  }
152
  $element->parentNode->parentNode->removeChild($element->parentNode);
153
  } else {
@@ -165,6 +167,35 @@ class WpaeXmlProcessor
165
  $this->elementCdata($element);
166
  } else {
167
  if ($element->hasChildNodes()) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  for ($i = 0; $i < $element->childNodes->length; $i++) {
169
  $this->parseElement($element->childNodes->item($i));
170
  }
@@ -178,22 +209,7 @@ class WpaeXmlProcessor
178
  */
179
  private function sanitizeFunctionName($filtered)
180
  {
181
- $functionName = preg_replace('/"[^"]+"/', '', $filtered);
182
- $functionName = preg_replace('/\'[^\']+\'/', '', $functionName);
183
- $functionName = str_replace('array','', $functionName);
184
-
185
- $firstSingleQuote = strpos($functionName, '\'');
186
- $firstDoubleQuote = strpos($functionName, '"');
187
-
188
- if ($firstDoubleQuote < $firstSingleQuote && $firstDoubleQuote != 0) {
189
- $functionName = explode('"', $functionName);
190
- $functionName = $functionName[0];
191
- } else if ($firstSingleQuote != 0) {
192
- $functionName = explode('\'', $functionName);
193
- $functionName = $functionName[0];
194
- }
195
- $functionName = str_replace(array('(', ')', ',', ' ', '\'', '"'), '', $functionName);
196
-
197
  return $functionName;
198
  }
199
 
@@ -277,6 +293,7 @@ class WpaeXmlProcessor
277
  $filtered = str_replace('"', '&quot;', $filtered);
278
  $filtered = str_replace('<', '&lt;', $filtered);
279
  $filtered = str_replace('>', '&gt;', $filtered);
 
280
  return $filtered;
281
  }
282
 
@@ -341,11 +358,9 @@ class WpaeXmlProcessor
341
  $xml = str_replace("'".$snippet."'", "\"".$attributeValue."\"", $xml);
342
  }
343
 
344
-
345
-
346
  $filteredEncoded = $this->encodeSpecialCharacters($filtered);
347
 
348
- $xml = str_replace($snippet, $filteredEncoded, $xml);
349
  }
350
  }
351
  return $xml;
@@ -404,11 +419,11 @@ class WpaeXmlProcessor
404
  {
405
 
406
  $sanitizedSnippet = $this->sanitizeSnippet($snippet);
407
- $sanitizedSnippet = $this->wpaeString->quoteParams($sanitizedSnippet);
 
408
  $functionName = $this->sanitizeFunctionName($sanitizedSnippet);
409
  $this->checkCorrectNumberOfQuotes($sanitizedSnippet, $functionName);
410
  $this->checkIfFunctionExists($functionName);
411
- $sanitizedSnippet = str_replace(',)', ',"")', $sanitizedSnippet);
412
 
413
  $snippetValue = eval('return ' . $sanitizedSnippet . ';');
414
 
@@ -503,6 +518,7 @@ class WpaeXmlProcessor
503
 
504
  $xml = str_replace('CLOSEBRAKET', ']', str_replace('OPENBRAKET', '[', $xml));
505
  $xml = str_replace('CLOSECURVE', '}', str_replace('OPENCURVE', '{', $xml));
 
506
 
507
  $xml = str_replace('##FILLER##', '', $xml);
508
  $xml = str_replace('<filler>c</filler>', '', $xml);
@@ -512,6 +528,8 @@ class WpaeXmlProcessor
512
  $xml = str_replace('<comment>', '<!--', $xml);
513
  $xml = str_replace('</comment>', '-->', $xml);
514
 
 
 
515
  $xml = "\n ".trim($xml);
516
  return $xml;
517
  }
@@ -546,4 +564,31 @@ class WpaeXmlProcessor
546
 
547
  return $xml;
548
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
549
  }
2
 
3
  class WpaeXmlProcessor
4
  {
5
+ const SNIPPET_DELIMITER = '*SNIPPET*';
6
+
7
  /** @var array */
8
  protected $tags;
9
 
45
 
46
  $root = $this->dom->getElementsByTagName("root");
47
  $this->dom->recover = true;
48
+
49
  $this->parseElement($root->item(0));
50
 
51
  $this->dom->preserveWhiteSpace = false;
87
  $snippetValues = $this->processSnippet($snippet, $isInFunction);
88
 
89
  if (!is_array($snippetValues)) {
90
+ $element->nodeValue =
 
91
  str_replace(
92
  $snippet,
93
  $snippetValues,
94
+ $element->nodeValue
95
  );
96
+ $nodeXML = $this->cloneNode($element->parentNode, $snippet, $snippetValues);
97
+ $f = $this->dom->createDocumentFragment();
98
+ $f->appendXML($nodeXML);
99
+ $element->parentNode->parentNode->replaceChild($f, $element->parentNode);
100
+
101
  } else {
102
  foreach ($snippetValues as $snippetValue) {
103
  $newValueNode = $element->parentNode->cloneNode(true);
104
  $newValueNode->nodeValue = str_replace($snippet, $snippetValue, $newValueNode->nodeValue);
105
  $this->replaceSnippetInAttributes($newValueNode, $snippet, $snippetValue);
106
  $this->elementCdata($newValueNode);
107
+ $element->parentNode->parentNode->insertBefore($newValueNode, $element->parentNode);
108
  }
 
109
  $element->parentNode->parentNode->removeChild($element->parentNode);
110
  }
111
  } else if (count($snippets) > 1) {
149
  }
150
  $elementClone->nodeValue = $elementValue;
151
  $this->elementCdata($elementClone);
152
+ $element->parentNode->parentNode->insertBefore($elementClone, $element->parentNode);
153
  }
154
  $element->parentNode->parentNode->removeChild($element->parentNode);
155
  } else {
167
  $this->elementCdata($element);
168
  } else {
169
  if ($element->hasChildNodes()) {
170
+ $has_text_elements = false;
171
+ for ($i = 0; $i < $element->childNodes->length; $i++) {
172
+ if ( $element->childNodes->item($i)->nodeType == XML_TEXT_NODE ){
173
+ $has_text_elements = true;
174
+ break;
175
+ }
176
+ }
177
+ if ( ! $has_text_elements ){
178
+ $nodeAttributes = $this->getNodeAttributes($element);
179
+ $snippets = $this->parseSnippetsInString($nodeAttributes);
180
+ if (!empty($snippets)){
181
+ $tagValues = array();
182
+ foreach ($snippets as $snippet) {
183
+ $wholeValue = str_replace("\n", '', $nodeAttributes);
184
+ $isInFunction = $this->wpaeString->isBetween($wholeValue, $snippet, '[',']');
185
+ $snippetValue = $this->processSnippet($snippet,$isInFunction);
186
+ $tagValues[$snippet] = $snippetValue;
187
+ }
188
+
189
+ // Doing this to replace multiple snippet in the same tag (not to treat them as array and
190
+ // replace the snippet with the first letter of the string
191
+ foreach ($snippets as $snippet) {
192
+ if(isset($tagValues[$snippet])){
193
+ //$element->nodeValue = str_replace($snippet, $tagValues[$snippet], $element->nodeValue);
194
+ $this->replaceSnippetInAttributes($element, $snippet, $tagValues[$snippet]);
195
+ }
196
+ }
197
+ }
198
+ }
199
  for ($i = 0; $i < $element->childNodes->length; $i++) {
200
  $this->parseElement($element->childNodes->item($i));
201
  }
209
  */
210
  private function sanitizeFunctionName($filtered)
211
  {
212
+ $functionName = str_replace('array','', preg_replace('%\(.*%', '', $filtered));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  return $functionName;
214
  }
215
 
293
  $filtered = str_replace('"', '&quot;', $filtered);
294
  $filtered = str_replace('<', '&lt;', $filtered);
295
  $filtered = str_replace('>', '&gt;', $filtered);
296
+
297
  return $filtered;
298
  }
299
 
358
  $xml = str_replace("'".$snippet."'", "\"".$attributeValue."\"", $xml);
359
  }
360
 
 
 
361
  $filteredEncoded = $this->encodeSpecialCharacters($filtered);
362
 
363
+ $xml = str_replace($snippet, self::SNIPPET_DELIMITER.$filteredEncoded.self::SNIPPET_DELIMITER, $xml);
364
  }
365
  }
366
  return $xml;
419
  {
420
 
421
  $sanitizedSnippet = $this->sanitizeSnippet($snippet);
422
+
423
+ $sanitizedSnippet = str_replace(WpaeXmlProcessor::SNIPPET_DELIMITER, '"', $sanitizedSnippet);
424
  $functionName = $this->sanitizeFunctionName($sanitizedSnippet);
425
  $this->checkCorrectNumberOfQuotes($sanitizedSnippet, $functionName);
426
  $this->checkIfFunctionExists($functionName);
 
427
 
428
  $snippetValue = eval('return ' . $sanitizedSnippet . ';');
429
 
518
 
519
  $xml = str_replace('CLOSEBRAKET', ']', str_replace('OPENBRAKET', '[', $xml));
520
  $xml = str_replace('CLOSECURVE', '}', str_replace('OPENCURVE', '{', $xml));
521
+ $xml = str_replace('CLOSECIRCLE', ')', str_replace('OPENCIRCLE', '(', $xml));
522
 
523
  $xml = str_replace('##FILLER##', '', $xml);
524
  $xml = str_replace('<filler>c</filler>', '', $xml);
528
  $xml = str_replace('<comment>', '<!--', $xml);
529
  $xml = str_replace('</comment>', '-->', $xml);
530
 
531
+ $xml = str_replace(self::SNIPPET_DELIMITER, '', $xml);
532
+
533
  $xml = "\n ".trim($xml);
534
  return $xml;
535
  }
564
 
565
  return $xml;
566
  }
567
+
568
+ /**
569
+ *
570
+ * Cloning DOMNode with including child DOMNode elements
571
+ *
572
+ * @param $node
573
+ * @return \DOMNode*
574
+ */
575
+ private function cloneNode(DOMNode $node, $snippet, $snippetValues){
576
+
577
+ $Document = new DOMDocument('1.0', 'UTF-8');
578
+ $Document->preserveWhiteSpace = false;
579
+ $Document->formatOutput = true;
580
+ $newElement = $Document->importNode($node, true);
581
+
582
+ $this->replaceSnippetInAttributes($newElement, $snippet, $snippetValues);
583
+
584
+ foreach ($newElement->childNodes as $child){
585
+ if ($child->nodeType === XML_TEXT_NODE) {
586
+ $this->elementCdata($child);
587
+ }
588
+ }
589
+
590
+ $Document->appendChild($newElement);
591
+ return trim(str_replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>","",$Document->saveXML()));
592
+
593
+ }
594
  }
libraries/XmlCsvExport.php CHANGED
@@ -68,7 +68,19 @@ final Class XmlCsvExport
68
  $articles = apply_filters('wp_all_export_csv_rows', $articles, XmlExportEngine::$exportOptions, XmlExportEngine::$exportID);
69
  if (!$preview) do_action('pmxe_exported_post', $comment->comment_ID, XmlExportEngine::$exportRecord);
70
  }
71
- } else { // exporting custom post types
 
 
 
 
 
 
 
 
 
 
 
 
72
  while ( XmlExportEngine::$exportQuery->have_posts() ) {
73
  XmlExportEngine::$exportQuery->the_post();
74
  $record = get_post(get_the_ID());
@@ -114,15 +126,16 @@ final Class XmlCsvExport
114
  }
115
  }
116
  // [ \Prepare CSV headers ]
117
-
118
- foreach ($articles as $article) {
119
- $line = array();
120
- foreach ($headers as $header) {
121
- $line[$header] = ( isset($article[$header]) ) ? $article[$header] : '';
122
- }
123
- fputcsv($stream, $line, XmlExportEngine::$exportOptions['delimiter']);
124
- apply_filters('wp_all_export_after_csv_line', $stream, XmlExportEngine::$exportID);
125
- }
 
126
 
127
  if ($preview) return ob_get_clean();
128
 
@@ -220,6 +233,42 @@ final Class XmlCsvExport
220
 
221
  endforeach;
222
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  }
224
  elseif ( XmlExportEngine::$is_comment_export ) // exporting comments
225
  {
@@ -442,6 +491,7 @@ final Class XmlCsvExport
442
  public static function prepare_csv_headers( & $headers, $ID, &$acfs )
443
  {
444
  $element_name = ( ! empty(XmlExportEngine::$exportOptions['cc_name'][$ID]) ) ? XmlExportEngine::$exportOptions['cc_name'][$ID] : 'untitled_' . $ID;
 
445
 
446
  if ( strpos(XmlExportEngine::$exportOptions['cc_label'][$ID], "item_data__") !== false ) {
447
  XmlExportEngine::$woo_order_export->get_element_header( $headers, XmlExportEngine::$exportOptions, $ID );
@@ -496,9 +546,9 @@ final Class XmlCsvExport
496
  while ( ! $is_added );
497
  }
498
 
499
- if ( XmlExportEngine::$exportOptions['cc_label'][$ID] == 'product_type' and ! in_array('parent_id', $headers)) {
500
- $headers[] = 'parent_id';
501
- }
502
 
503
  break;
504
  }
@@ -754,6 +804,8 @@ final Class XmlCsvExport
754
  }
755
  }
756
 
 
 
757
  return $auto_generate;
758
  }
759
 
68
  $articles = apply_filters('wp_all_export_csv_rows', $articles, XmlExportEngine::$exportOptions, XmlExportEngine::$exportID);
69
  if (!$preview) do_action('pmxe_exported_post', $comment->comment_ID, XmlExportEngine::$exportRecord);
70
  }
71
+ }
72
+ elseif ( XmlExportEngine::$is_taxonomy_export ) { // exporting WordPress taxonomy terms
73
+
74
+ add_filter('terms_clauses', 'wp_all_export_terms_clauses', 10, 3);
75
+ $terms = XmlExportEngine::$exportQuery->get_terms();
76
+ remove_filter('terms_clauses', 'wp_all_export_terms_clauses');
77
+ foreach ( $terms as $term ) {
78
+ $articles[] = XmlExportTaxonomy::prepare_data($term, false, $acfs, XmlExportEngine::$implode, $preview);
79
+ $articles = apply_filters('wp_all_export_csv_rows', $articles, XmlExportEngine::$exportOptions, XmlExportEngine::$exportID);
80
+ if (!$preview) do_action('pmxe_exported_post', $term->term_id, XmlExportEngine::$exportRecord);
81
+ }
82
+ }
83
+ else { // exporting custom post types
84
  while ( XmlExportEngine::$exportQuery->have_posts() ) {
85
  XmlExportEngine::$exportQuery->the_post();
86
  $record = get_post(get_the_ID());
126
  }
127
  }
128
  // [ \Prepare CSV headers ]
129
+ if (!empty($articles)) {
130
+ foreach ($articles as $article) { if (empty($article)) continue;
131
+ $line = array();
132
+ foreach ($headers as $header) {
133
+ $line[$header] = ( isset($article[$header]) ) ? $article[$header] : '';
134
+ }
135
+ fputcsv($stream, $line, XmlExportEngine::$exportOptions['delimiter']);
136
+ apply_filters('wp_all_export_after_csv_line', $stream, XmlExportEngine::$exportID);
137
+ }
138
+ }
139
 
140
  if ($preview) return ob_get_clean();
141
 
233
 
234
  endforeach;
235
 
236
+ }
237
+ elseif ( XmlExportEngine::$is_taxonomy_export ) // exporting WordPress taxonomy terms
238
+ {
239
+ add_filter('terms_clauses', 'wp_all_export_terms_clauses', 10, 3);
240
+ $terms = XmlExportEngine::$exportQuery->get_terms();
241
+ remove_filter('terms_clauses', 'wp_all_export_terms_clauses');
242
+ foreach ( $terms as $term ) {
243
+
244
+ $is_export_record = apply_filters('wp_all_export_xml_rows', true, $term, XmlExportEngine::$exportOptions, XmlExportEngine::$exportID);
245
+
246
+ if (!$is_export_record) continue;
247
+
248
+ if (!$is_custom_xml) {
249
+ // add additional information before each node
250
+ self::before_xml_node($xmlWriter, $term->term_id);
251
+
252
+ $xmlWriter->startElement(self::$node_xml_tag);
253
+
254
+ XmlExportTaxonomy::prepare_data($term, $xmlWriter, $acfs, XmlExportEngine::$implode, $preview);
255
+
256
+ $xmlWriter->closeElement(); // end post
257
+
258
+ // add additional information after each node
259
+ self::after_xml_node($xmlWriter, $term->term_id);
260
+ } else {
261
+ $articles = array();
262
+ $articles[] = XmlExportTaxonomy::prepare_data($term, $xmlWriter, $acfs, XmlExportEngine::$implode, $preview);
263
+ $articles = apply_filters('wp_all_export_csv_rows', $articles, XmlExportEngine::$exportOptions, XmlExportEngine::$exportID);
264
+
265
+ $xmlWriter->writeArticle($articles);
266
+ }
267
+
268
+ if (!$preview) do_action('pmxe_exported_post', $term->term_id, XmlExportEngine::$exportRecord);
269
+
270
+ }
271
+
272
  }
273
  elseif ( XmlExportEngine::$is_comment_export ) // exporting comments
274
  {
491
  public static function prepare_csv_headers( & $headers, $ID, &$acfs )
492
  {
493
  $element_name = ( ! empty(XmlExportEngine::$exportOptions['cc_name'][$ID]) ) ? XmlExportEngine::$exportOptions['cc_name'][$ID] : 'untitled_' . $ID;
494
+ $element_name = apply_filters('wp_all_export_field_name', wp_all_export_parse_field_name($element_name), XmlExportEngine::$exportID);
495
 
496
  if ( strpos(XmlExportEngine::$exportOptions['cc_label'][$ID], "item_data__") !== false ) {
497
  XmlExportEngine::$woo_order_export->get_element_header( $headers, XmlExportEngine::$exportOptions, $ID );
546
  while ( ! $is_added );
547
  }
548
 
549
+ // if ( XmlExportEngine::$exportOptions['cc_label'][$ID] == 'product_type' and ! in_array('parent_id', $headers)) {
550
+ // $headers[] = 'parent_id';
551
+ // }
552
 
553
  break;
554
  }
804
  }
805
  }
806
 
807
+ if ( ! XmlExportEngine::$is_comment_export ) XmlExportEngine::$acf_export->auto_generate_export_fields( $auto_generate );
808
+
809
  return $auto_generate;
810
  }
811
 
libraries/XmlExportACF.php CHANGED
@@ -215,7 +215,13 @@ if ( ! class_exists('XmlExportACF') )
215
  $is_xml_export = true;
216
  }
217
 
218
- if ( ! empty($field_value) )
 
 
 
 
 
 
219
  {
220
  $field_value = maybe_unserialize($field_value);
221
 
@@ -353,17 +359,22 @@ if ( ! class_exists('XmlExportACF') )
353
  {
354
  if ( ! $return_value )
355
  {
356
- $acfs[$element_name] = array($element_name . '_item_name', $element_name . '_item_description', $element_name . '_price');
357
-
358
- if ( is_array($field_value) )
359
- {
360
- foreach ($field_value as $key => $value)
361
- {
362
- $article[$element_name . '_' . $key] = $value;
363
- }
364
  }
365
- }
366
- }
 
 
 
 
 
 
 
 
 
 
 
367
 
368
  $put_to_csv = false;
369
 
@@ -389,14 +400,18 @@ if ( ! class_exists('XmlExportACF') )
389
  {
390
  if ( ! $return_value )
391
  {
392
- $acfs[$element_name] = array($element_name . '_address', $element_name . '_lat', $element_name . '_lng');
393
-
394
- $article[$element_name . '_address'] = $field_value['address'];
395
- $article[$element_name . '_lat'] = $field_value['lat'];
396
- $article[$element_name . '_lng'] = $field_value['lng'];
397
- }
398
- }
399
- $put_to_csv = false;
 
 
 
 
400
 
401
  break;
402
 
@@ -956,7 +971,7 @@ if ( ! class_exists('XmlExportACF') )
956
  $fields['cc_php'][] = '';
957
  $fields['cc_code'][] = '';
958
  $fields['cc_sql'][] = '';
959
- $fields['cc_options'][] = esc_html(serialize(array_merge($field, array('group_id' => ((!empty($group['ID'])) ? $group['ID'] : $group['id']) ))));
960
  $fields['cc_type'][] = 'acf';
961
  $fields['cc_value'][] = $field['name'];
962
  $fields['cc_name'][] = $field_key;
@@ -992,7 +1007,7 @@ if ( ! class_exists('XmlExportACF') )
992
  foreach ($group['fields'] as $field)
993
  {
994
  ?>
995
- <li class="pmxe_acf_<?php echo (!empty($group['ID'])) ? $group['ID'] : $group['id'];?>">
996
  <div class="custom_column" rel="<?php echo ($i + 1);?>">
997
  <label class="wpallexport-xml-element"><?php echo $field['label']; ?></label>
998
  <input type="hidden" name="ids[]" value="1"/>
@@ -1115,28 +1130,20 @@ if ( ! class_exists('XmlExportACF') )
1115
  break;
1116
  case 'gallery':
1117
 
1118
- if ($is_xml_template)
1119
- {
1120
- $field_template = array(
1121
- 'gallery' => '{' . $field_tpl_key . '}'
1122
- );
1123
- }
1124
- else
1125
- {
1126
  $field_template = array(
1127
  'search_in_media' => 1,
1128
  'delim' => $implode_delimiter,
1129
  'gallery' => '{' . $field_tpl_key . '}'
1130
  );
1131
- }
1132
  break;
1133
  case 'relationship':
1134
- if ($implode_delimiter == "|") {
1135
- $field_template = '[str_replace("|", ",",{' . $field_tpl_key . '})]';
1136
- }
1137
- else{
1138
- $field_template = '{' . $field_tpl_key . '}';
1139
- }
1140
  break;
1141
  case 'post_object':
1142
  case 'page_link':
@@ -1395,6 +1402,32 @@ if ( ! class_exists('XmlExportACF') )
1395
  return $field_template;
1396
  }
1397
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1398
  /**
1399
  * __get function.
1400
  *
215
  $is_xml_export = true;
216
  }
217
 
218
+ $is_custom_xml_export = false;
219
+
220
+ if ( XmlExportEngine::$exportOptions['export_to'] == 'xml' and in_array(XmlExportEngine::$exportOptions['xml_template_type'], array('custom')) ){
221
+ $is_custom_xml_export = true;
222
+ }
223
+
224
+ if ( ! empty($field_value) )
225
  {
226
  $field_value = maybe_unserialize($field_value);
227
 
359
  {
360
  if ( ! $return_value )
361
  {
362
+ if ( $is_custom_xml_export ){
363
+ $article[$element_name] = json_encode($field_value);
 
 
 
 
 
 
364
  }
365
+ else{
366
+ $acfs[$element_name] = array($element_name . '_item_name', $element_name . '_item_description', $element_name . '_price');
367
+
368
+ if ( is_array($field_value) )
369
+ {
370
+ foreach ($field_value as $key => $value)
371
+ {
372
+ $article[$element_name . '_' . $key] = $value;
373
+ }
374
+ }
375
+ }
376
+ }
377
+ }
378
 
379
  $put_to_csv = false;
380
 
400
  {
401
  if ( ! $return_value )
402
  {
403
+ if ( $is_custom_xml_export ){
404
+ $article[$element_name] = json_encode($field_value);
405
+ }
406
+ else{
407
+ $acfs[$element_name] = array($element_name . '_address', $element_name . '_lat', $element_name . '_lng');
408
+ $article[$element_name . '_address'] = $field_value['address'];
409
+ $article[$element_name . '_lat'] = $field_value['lat'];
410
+ $article[$element_name . '_lng'] = $field_value['lng'];
411
+ }
412
+ }
413
+ }
414
+ $put_to_csv = false;
415
 
416
  break;
417
 
971
  $fields['cc_php'][] = '';
972
  $fields['cc_code'][] = '';
973
  $fields['cc_sql'][] = '';
974
+ $fields['cc_options'][] = serialize(array_merge($field, array('group_id' => ((!empty($group['ID'])) ? $group['ID'] : $group['id']) )));
975
  $fields['cc_type'][] = 'acf';
976
  $fields['cc_value'][] = $field['name'];
977
  $fields['cc_name'][] = $field_key;
1007
  foreach ($group['fields'] as $field)
1008
  {
1009
  ?>
1010
+ <li class="pmxe_acf_<?php echo (!empty($group['ID'])) ? $group['ID'] : $group['id'];?> wp_all_export_auto_generate">
1011
  <div class="custom_column" rel="<?php echo ($i + 1);?>">
1012
  <label class="wpallexport-xml-element"><?php echo $field['label']; ?></label>
1013
  <input type="hidden" name="ids[]" value="1"/>
1130
  break;
1131
  case 'gallery':
1132
 
 
 
 
 
 
 
 
 
1133
  $field_template = array(
1134
  'search_in_media' => 1,
1135
  'delim' => $implode_delimiter,
1136
  'gallery' => '{' . $field_tpl_key . '}'
1137
  );
1138
+
1139
  break;
1140
  case 'relationship':
1141
+
1142
+ $field_template = array(
1143
+ 'delim' => $implode_delimiter,
1144
+ 'value' => '{' . $field_tpl_key . '}'
1145
+ );
1146
+
1147
  break;
1148
  case 'post_object':
1149
  case 'page_link':
1402
  return $field_template;
1403
  }
1404
 
1405
+ public function auto_generate_export_fields( & $fields ){
1406
+
1407
+ if ( ! empty($this->_acf_groups) )
1408
+ {
1409
+ foreach ($this->_acf_groups as $key => $group)
1410
+ {
1411
+ if ( ! empty($group['fields']))
1412
+ {
1413
+ foreach ($group['fields'] as $field)
1414
+ {
1415
+ $fields['ids'][] = 1;
1416
+ $fields['cc_label'][] = $field['name'];
1417
+ $fields['cc_php'][] = 0;
1418
+ $fields['cc_code'][] = '';
1419
+ $fields['cc_sql'][] = '';
1420
+ $fields['cc_settings'][] = '';
1421
+ $fields['cc_type'][] = 'acf';
1422
+ $fields['cc_options'][] = serialize(array_merge($field, array('group_id' => ((!empty($group['ID'])) ? $group['ID'] : $group['id']) )));
1423
+ $fields['cc_value'][] = $field['name'];
1424
+ $fields['cc_name'][] = $field['label'];
1425
+ }
1426
+ }
1427
+ }
1428
+ }
1429
+ }
1430
+
1431
  /**
1432
  * __get function.
1433
  *
libraries/XmlExportCpt.php CHANGED
@@ -24,7 +24,11 @@ final class XmlExportCpt
24
 
25
  public static function prepare_data( $entry, $xmlWriter = false, &$acfs, &$woo, &$woo_order, $implode_delimiter, $preview, $is_item_data = false, $subID = false )
26
  {
27
- $article = array();
 
 
 
 
28
 
29
  // associate exported post with import
30
  if ( ! $is_item_data and wp_all_export_is_compatible() and XmlExportEngine::$exportOptions['is_generate_import'] and XmlExportEngine::$exportOptions['import_id'])
@@ -62,7 +66,7 @@ final class XmlExportCpt
62
  // skip shop order items data
63
  if ( $pType == "shop_order" and strpos(XmlExportEngine::$exportOptions['cc_label'][$ID], "item_data__") !== false and ! $is_item_data ) continue;
64
 
65
- $fieldName = XmlExportEngine::$exportOptions['cc_name'][$ID];
66
  $fieldValue = str_replace("item_data__", "", XmlExportEngine::$exportOptions['cc_value'][$ID]);
67
  $fieldLabel = str_replace("item_data__", "", XmlExportEngine::$exportOptions['cc_label'][$ID]);
68
  $fieldSql = XmlExportEngine::$exportOptions['cc_sql'][$ID];
@@ -81,8 +85,7 @@ final class XmlExportCpt
81
  {
82
  $element_name = ( ! empty($fieldName) ) ? preg_replace('/[^a-z0-9_:-]/i', '', $fieldName) : 'untitled_' . $ID;
83
 
84
- if (strpos($element_name, ":") !== false)
85
- {
86
  $element_name_parts = explode(":", $element_name);
87
  $element_name_ns = (empty($element_name_parts[0])) ? '' : $element_name_parts[0];
88
  $element_name = (empty($element_name_parts[1])) ? 'untitled_' . $ID : preg_replace('/[^a-z0-9_-]/i', '', $element_name_parts[1]);
@@ -157,26 +160,10 @@ final class XmlExportCpt
157
 
158
  case 'date':
159
 
160
- if ( ! empty($fieldSettings))
161
- {
162
- switch ($fieldSettings)
163
- {
164
- case 'unix':
165
- $post_date = get_post_time('U', true, $entry->ID);
166
- break;
167
- default:
168
- $post_date = date($fieldSettings, get_post_time('U', true, $entry->ID));
169
- break;
170
- }
171
- }
172
- else
173
- {
174
- $post_date = date("Ymd", get_post_time('U', true, $entry->ID));
175
- }
176
 
177
  wp_all_export_write_article( $article, $element_name, apply_filters('pmxe_post_date', pmxe_filter($post_date, $fieldSnipped), $entry->ID) );
178
- break;
179
-
180
  case 'parent':
181
  wp_all_export_write_article( $article, $element_name, apply_filters('pmxe_post_parent', pmxe_filter($entry->post_parent, $fieldSnipped), $entry->ID) );
182
  break;
@@ -209,32 +196,25 @@ final class XmlExportCpt
209
  wp_all_export_write_article( $article, $element_name, ($preview) ? trim(preg_replace('~[\r\n]+~', ' ', htmlspecialchars($val))) : $val );
210
  break;
211
  case 'cf':
212
- if ( ! empty($fieldValue) )
213
- {
214
- $val = "";
215
 
 
216
  $cur_meta_values = get_post_meta($entry->ID, $fieldValue);
217
 
218
- if ( ! empty($cur_meta_values) and is_array($cur_meta_values))
219
- {
220
- foreach ($cur_meta_values as $key => $cur_meta_value)
221
- {
222
- if (empty($val))
223
- {
224
  $val = apply_filters('pmxe_custom_field', pmxe_filter(maybe_serialize($cur_meta_value), $fieldSnipped), $fieldValue, $entry->ID);
225
  }
226
- else
227
- {
228
  $val = apply_filters('pmxe_custom_field', pmxe_filter($val . $implode_delimiter . maybe_serialize($cur_meta_value), $fieldSnipped), $fieldValue, $entry->ID);
229
  }
230
  }
231
  wp_all_export_write_article( $article, $element_name, $val );
232
  }
233
 
234
- if ( empty($cur_meta_values))
235
- {
236
- if ( empty($article[$element_name]))
237
- {
238
  wp_all_export_write_article( $article, $element_name, apply_filters('pmxe_custom_field', pmxe_filter('', $fieldSnipped), $fieldValue, $entry->ID) );
239
  }
240
  }
@@ -270,8 +250,7 @@ final class XmlExportCpt
270
  break;
271
  }
272
  }
273
- else
274
- {
275
  $field_value = get_field($fieldLabel, $entry->ID);
276
  }
277
 
@@ -289,19 +268,16 @@ final class XmlExportCpt
289
  $field_options['group_id'],
290
  $preview
291
  );
292
-
293
  }
294
 
295
  break;
296
 
297
  case 'woo':
298
 
299
- if ( $is_xml_export )
300
- {
301
  XmlExportEngine::$woo_export->export_xml($xmlWriter, $entry, XmlExportEngine::$exportOptions, $ID);
302
  }
303
- else
304
- {
305
  XmlExportEngine::$woo_export->export_csv($article, $woo, $entry, XmlExportEngine::$exportOptions, $ID);
306
  }
307
 
@@ -309,12 +285,10 @@ final class XmlExportCpt
309
 
310
  case 'woo_order':
311
 
312
- if ( $is_xml_export )
313
- {
314
  XmlExportEngine::$woo_order_export->export_xml($xmlWriter, $entry, XmlExportEngine::$exportOptions, $ID, $preview);
315
  }
316
- else
317
- {
318
  XmlExportEngine::$woo_order_export->export_csv($article, $woo_order, $entry, XmlExportEngine::$exportOptions, $ID, $preview);
319
  }
320
 
@@ -322,27 +296,21 @@ final class XmlExportCpt
322
 
323
  case 'attr':
324
 
325
- if ( ! empty($fieldValue))
326
- {
327
- if ( $entry->post_parent == 0 )
328
- {
329
  $txes_list = get_the_terms($entry->ID, $fieldValue);
330
- if ( ! is_wp_error($txes_list) and ! empty($txes_list))
331
- {
332
  $attr_new = array();
333
- foreach ($txes_list as $t)
334
- {
335
  $attr_new[] = $t->name;
336
  }
337
  wp_all_export_write_article( $article, $element_name, apply_filters('pmxe_woo_attribute', pmxe_filter(implode($implode_delimiter, $attr_new), $fieldSnipped), $entry->ID, $fieldValue) );
338
  }
339
  }
340
- else
341
- {
342
  $attribute_pa = apply_filters('pmxe_woo_attribute', get_post_meta($entry->ID, 'attribute_' . $fieldValue, true), $entry->ID, $fieldValue);
343
 
344
  wp_all_export_write_article( $article, $element_name, $attribute_pa );
345
-
346
  }
347
 
348
  // if ( ! in_array($element_name, $attributes)) $attributes[] = $element_name;
@@ -355,7 +323,13 @@ final class XmlExportCpt
355
  {
356
 
357
  // get categories from parent product in case when variation exported
358
- $entry_id = ( $entry->post_type == 'product_variation' ) ? $entry->post_parent : $entry->ID;
 
 
 
 
 
 
359
 
360
  $txes_list = get_the_terms($entry_id, $fieldValue);
361
 
@@ -401,14 +375,6 @@ final class XmlExportCpt
401
 
402
  if ( $entry->post_type == 'product_variation' ) $article[$element_name] = 'variable';
403
 
404
- $article['parent_id'] = $entry->post_parent;
405
-
406
- if ( $is_xml_export )
407
- {
408
- $xmlWriter->beginElement($element_name_ns, 'parent_id', null);
409
- $xmlWriter->writeData($article['parent_id'], 'parent_id');
410
- $xmlWriter->closeElement();
411
- }
412
  }
413
  }
414
 
@@ -423,12 +389,10 @@ final class XmlExportCpt
423
  if ( ! empty($fieldPhp) and !empty($fieldCode) )
424
  {
425
  // if shortcode defined
426
- if (strpos($fieldCode, '[') === 0)
427
- {
428
  $val = do_shortcode(str_replace("%%VALUE%%", $val, $fieldCode));
429
  }
430
- else
431
- {
432
  $val = eval('return ' . stripcslashes(str_replace("%%VALUE%%", $val, $fieldCode)) . ';');
433
  }
434
  }
@@ -481,8 +445,7 @@ final class XmlExportCpt
481
  break;
482
  }
483
 
484
- if ( $is_xml_export and isset($article[$element_name]) )
485
- {
486
  $element_name_in_file = XmlCsvExport::_get_valid_header_name( $element_name );
487
 
488
  $xmlWriter = apply_filters('wp_all_export_add_before_element', $xmlWriter, $element_name_in_file, XmlExportEngine::$exportID, $entry->ID);
@@ -494,6 +457,7 @@ final class XmlExportCpt
494
  $xmlWriter = apply_filters('wp_all_export_add_after_element', $xmlWriter, $element_name_in_file, XmlExportEngine::$exportID, $entry->ID);
495
  }
496
  }
 
497
  return $article;
498
  }
499
 
@@ -516,6 +480,10 @@ final class XmlExportCpt
516
  $templateOptions['single_product_id'] = '{'. $element_name .'[1]}';
517
  break;
518
  case 'title':
 
 
 
 
519
  case 'content':
520
  case 'author':
521
  case 'slug':
@@ -526,7 +494,9 @@ final class XmlExportCpt
526
  $templateOptions['is_multiple_page_parent'] = 'no';
527
  $templateOptions['single_page_parent'] = '{' . $element_name . '[1]}';
528
  $templateOptions['is_update_' . $options['cc_type'][$ID]] = 1;
529
- break;
 
 
530
  case 'excerpt':
531
  $templateOptions['post_excerpt'] = '{'. $element_name .'[1]}';
532
  $templateOptions['is_update_' . $options['cc_type'][$ID]] = 1;
@@ -539,6 +509,11 @@ final class XmlExportCpt
539
  $templateOptions[$element_type] = '{'. $element_name .'[1]}';
540
  $templateOptions['is_update_dates'] = 1;
541
  break;
 
 
 
 
 
542
  case 'post_type':
543
 
544
  if ( empty($options['cpt']) )
24
 
25
  public static function prepare_data( $entry, $xmlWriter = false, &$acfs, &$woo, &$woo_order, $implode_delimiter, $preview, $is_item_data = false, $subID = false )
26
  {
27
+ $variationOptionsFactory = new \Wpae\VariationOptions\VariationOptionsFactory();
28
+ $variationOptions = $variationOptionsFactory->createVariationOptions(PMXE_EDITION);
29
+ $entry = $variationOptions->preprocessPost($entry);
30
+
31
+ $article = array();
32
 
33
  // associate exported post with import
34
  if ( ! $is_item_data and wp_all_export_is_compatible() and XmlExportEngine::$exportOptions['is_generate_import'] and XmlExportEngine::$exportOptions['import_id'])
66
  // skip shop order items data
67
  if ( $pType == "shop_order" and strpos(XmlExportEngine::$exportOptions['cc_label'][$ID], "item_data__") !== false and ! $is_item_data ) continue;
68
 
69
+ $fieldName = apply_filters('wp_all_export_field_name', wp_all_export_parse_field_name(XmlExportEngine::$exportOptions['cc_name'][$ID]), XmlExportEngine::$exportID);
70
  $fieldValue = str_replace("item_data__", "", XmlExportEngine::$exportOptions['cc_value'][$ID]);
71
  $fieldLabel = str_replace("item_data__", "", XmlExportEngine::$exportOptions['cc_label'][$ID]);
72
  $fieldSql = XmlExportEngine::$exportOptions['cc_sql'][$ID];
85
  {
86
  $element_name = ( ! empty($fieldName) ) ? preg_replace('/[^a-z0-9_:-]/i', '', $fieldName) : 'untitled_' . $ID;
87
 
88
+ if (strpos($element_name, ":") !== false) {
 
89
  $element_name_parts = explode(":", $element_name);
90
  $element_name_ns = (empty($element_name_parts[0])) ? '' : $element_name_parts[0];
91
  $element_name = (empty($element_name_parts[1])) ? 'untitled_' . $ID : preg_replace('/[^a-z0-9_-]/i', '', $element_name_parts[1]);
160
 
161
  case 'date':
162
 
163
+ $post_date = prepare_date_field_value($fieldSettings, get_post_time('U', true, $entry->ID), "Ymd");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
 
165
  wp_all_export_write_article( $article, $element_name, apply_filters('pmxe_post_date', pmxe_filter($post_date, $fieldSnipped), $entry->ID) );
166
+ break;
 
167
  case 'parent':
168
  wp_all_export_write_article( $article, $element_name, apply_filters('pmxe_post_parent', pmxe_filter($entry->post_parent, $fieldSnipped), $entry->ID) );
169
  break;
196
  wp_all_export_write_article( $article, $element_name, ($preview) ? trim(preg_replace('~[\r\n]+~', ' ', htmlspecialchars($val))) : $val );
197
  break;
198
  case 'cf':
199
+ if ( ! empty($fieldValue) ) {
 
 
200
 
201
+ $val = "";
202
  $cur_meta_values = get_post_meta($entry->ID, $fieldValue);
203
 
204
+ if ( ! empty($cur_meta_values) and is_array($cur_meta_values)) {
205
+ foreach ($cur_meta_values as $key => $cur_meta_value) {
206
+ if (empty($val)) {
 
 
 
207
  $val = apply_filters('pmxe_custom_field', pmxe_filter(maybe_serialize($cur_meta_value), $fieldSnipped), $fieldValue, $entry->ID);
208
  }
209
+ else {
 
210
  $val = apply_filters('pmxe_custom_field', pmxe_filter($val . $implode_delimiter . maybe_serialize($cur_meta_value), $fieldSnipped), $fieldValue, $entry->ID);
211
  }
212
  }
213
  wp_all_export_write_article( $article, $element_name, $val );
214
  }
215
 
216
+ if ( empty($cur_meta_values)) {
217
+ if ( empty($article[$element_name])) {
 
 
218
  wp_all_export_write_article( $article, $element_name, apply_filters('pmxe_custom_field', pmxe_filter('', $fieldSnipped), $fieldValue, $entry->ID) );
219
  }
220
  }
250
  break;
251
  }
252
  }
253
+ else {
 
254
  $field_value = get_field($fieldLabel, $entry->ID);
255
  }
256
 
268
  $field_options['group_id'],
269
  $preview
270
  );
 
271
  }
272
 
273
  break;
274
 
275
  case 'woo':
276
 
277
+ if ( $is_xml_export ) {
 
278
  XmlExportEngine::$woo_export->export_xml($xmlWriter, $entry, XmlExportEngine::$exportOptions, $ID);
279
  }
280
+ else {
 
281
  XmlExportEngine::$woo_export->export_csv($article, $woo, $entry, XmlExportEngine::$exportOptions, $ID);
282
  }
283
 
285
 
286
  case 'woo_order':
287
 
288
+ if ( $is_xml_export ) {
 
289
  XmlExportEngine::$woo_order_export->export_xml($xmlWriter, $entry, XmlExportEngine::$exportOptions, $ID, $preview);
290
  }
291
+ else {
 
292
  XmlExportEngine::$woo_order_export->export_csv($article, $woo_order, $entry, XmlExportEngine::$exportOptions, $ID, $preview);
293
  }
294
 
296
 
297
  case 'attr':
298
 
299
+ if ( ! empty($fieldValue)) {
300
+ if ( $entry->post_parent == 0 ) {
 
 
301
  $txes_list = get_the_terms($entry->ID, $fieldValue);
302
+ if ( ! is_wp_error($txes_list) and ! empty($txes_list)) {
 
303
  $attr_new = array();
304
+ foreach ($txes_list as $t) {
 
305
  $attr_new[] = $t->name;
306
  }
307
  wp_all_export_write_article( $article, $element_name, apply_filters('pmxe_woo_attribute', pmxe_filter(implode($implode_delimiter, $attr_new), $fieldSnipped), $entry->ID, $fieldValue) );
308
  }
309
  }
310
+ else {
 
311
  $attribute_pa = apply_filters('pmxe_woo_attribute', get_post_meta($entry->ID, 'attribute_' . $fieldValue, true), $entry->ID, $fieldValue);
312
 
313
  wp_all_export_write_article( $article, $element_name, $attribute_pa );
 
314
  }
315
 
316
  // if ( ! in_array($element_name, $attributes)) $attributes[] = $element_name;
323
  {
324
 
325
  // get categories from parent product in case when variation exported
326
+ if ($fieldLabel != 'product_shipping_class'){
327
+ // get categories from parent product in case when variation exported
328
+ $entry_id = ( $entry->post_type == 'product_variation' ) ? $entry->post_parent : $entry->ID;
329
+ }
330
+ else{
331
+ $entry_id = $entry->ID;
332
+ }
333
 
334
  $txes_list = get_the_terms($entry_id, $fieldValue);
335
 
375
 
376
  if ( $entry->post_type == 'product_variation' ) $article[$element_name] = 'variable';
377
 
 
 
 
 
 
 
 
 
378
  }
379
  }
380
 
389
  if ( ! empty($fieldPhp) and !empty($fieldCode) )
390
  {
391
  // if shortcode defined
392
+ if (strpos($fieldCode, '[') === 0) {
 
393
  $val = do_shortcode(str_replace("%%VALUE%%", $val, $fieldCode));
394
  }
395
+ else {
 
396
  $val = eval('return ' . stripcslashes(str_replace("%%VALUE%%", $val, $fieldCode)) . ';');
397
  }
398
  }
445
  break;
446
  }
447
 
448
+ if ( $is_xml_export and isset($article[$element_name]) ) {
 
449
  $element_name_in_file = XmlCsvExport::_get_valid_header_name( $element_name );
450
 
451
  $xmlWriter = apply_filters('wp_all_export_add_before_element', $xmlWriter, $element_name_in_file, XmlExportEngine::$exportID, $entry->ID);
457
  $xmlWriter = apply_filters('wp_all_export_add_after_element', $xmlWriter, $element_name_in_file, XmlExportEngine::$exportID, $entry->ID);
458
  }
459
  }
460
+
461
  return $article;
462
  }
463
 
480
  $templateOptions['single_product_id'] = '{'. $element_name .'[1]}';
481
  break;
482
  case 'title':
483
+ $templateOptions[$element_type] = '{'. $element_name .'[1]}';
484
+ $templateOptions['is_update_' . $options['cc_type'][$ID]] = 1;
485
+ $templateOptions['single_product_id_first_is_variation'] = '{'. $element_name .'[1]}';
486
+ break;
487
  case 'content':
488
  case 'author':
489
  case 'slug':
494
  $templateOptions['is_multiple_page_parent'] = 'no';
495
  $templateOptions['single_page_parent'] = '{' . $element_name . '[1]}';
496
  $templateOptions['is_update_' . $options['cc_type'][$ID]] = 1;
497
+ $templateOptions['single_product_parent_id'] = '{' . $element_name . '[1]}';
498
+ $templateOptions['single_product_id_first_is_parent_id'] = '{' . $element_name . '[1]}';
499
+ break;
500
  case 'excerpt':
501
  $templateOptions['post_excerpt'] = '{'. $element_name .'[1]}';
502
  $templateOptions['is_update_' . $options['cc_type'][$ID]] = 1;
509
  $templateOptions[$element_type] = '{'. $element_name .'[1]}';
510
  $templateOptions['is_update_dates'] = 1;
511
  break;
512
+ case 'order':
513
+ $templateOptions[$element_type] = '{'. $element_name .'[1]}';
514
+ $templateOptions['is_update_menu_order'] = 1;
515
+ $templateOptions['single_product_menu_order'] = '{'. $element_name .'[1]}';
516
+ break;
517
  case 'post_type':
518
 
519
  if ( empty($options['cpt']) )
libraries/XmlExportEngine.php CHANGED
@@ -7,11 +7,19 @@ if ( ! class_exists('XmlExportEngine') ){
7
  require_once dirname(__FILE__) . '/XmlExportWooCommerceOrder.php';
8
  require_once dirname(__FILE__) . '/XmlExportUser.php';
9
  require_once dirname(__FILE__) . '/XmlExportComment.php';
 
10
  require_once dirname(__FILE__) . '/XmlExportFiltering.php';
11
 
12
  final class XmlExportEngine
13
  {
14
 
 
 
 
 
 
 
 
15
  /**
16
  * Custom XML Loop begin statement
17
  * @var string
@@ -31,6 +39,7 @@ if ( ! class_exists('XmlExportEngine') ){
31
  public static $woo_refund_export;
32
  public static $user_export;
33
  public static $comment_export;
 
34
 
35
  public static $is_preview = false;
36
 
@@ -165,7 +174,8 @@ if ( ! class_exists('XmlExportEngine') ){
165
 
166
  public static $is_user_export = false;
167
  public static $is_comment_export = false;
168
- public static $post_types = array();
 
169
  public static $exportOptions = array();
170
  public static $exportQuery;
171
  public static $exportID = false;
@@ -329,14 +339,16 @@ if ( ! class_exists('XmlExportEngine') ){
329
 
330
  self::$is_comment_export = ( in_array('comments', self::$post_types) ) ? true : false;
331
 
332
- }
 
 
333
  else
334
  {
335
  self::$is_user_export = ( 'wp_user_query' == $this->post['wp_query_selector'] );
336
  self::$is_comment_export = ( 'wp_comment_query' == $this->post['wp_query_selector'] );
337
  }
338
 
339
- if ( ! self::$is_user_export && ! self::$is_comment_export)
340
  {
341
  add_filter("wp_all_export_filters", array( &$this, "filter_export_filters"), 10, 1);
342
 
@@ -363,7 +375,8 @@ if ( ! class_exists('XmlExportEngine') ){
363
  {
364
  $filter_args = array(
365
  'filter_rules_hierarhy' => $this->post['filter_rules_hierarhy'],
366
- 'product_matching_mode' => $this->post['product_matching_mode']
 
367
  );
368
 
369
  $this->filters = new XmlExportFiltering($filter_args);
@@ -381,7 +394,8 @@ if ( ! class_exists('XmlExportEngine') ){
381
  self::$woo_export = new XmlExportWooCommerce();
382
  self::$user_export = new XmlExportUser();
383
  self::$comment_export = new XmlExportComment();
384
- self::$woo_order_export = new XmlExportWooCommerceOrder();
 
385
  self::$woo_coupon_export = new XmlExportWooCommerceCoupon();
386
 
387
  }
@@ -403,7 +417,8 @@ if ( ! class_exists('XmlExportEngine') ){
403
 
404
  PMXE_Plugin::$session->set('is_user_export', self::$is_user_export);
405
  PMXE_Plugin::$session->set('is_comment_export', self::$is_comment_export);
406
- PMXE_Plugin::$session->save_data();
 
407
 
408
  if ('advanced' == $this->post['export_type']) {
409
 
@@ -447,13 +462,13 @@ if ( ! class_exists('XmlExportEngine') ){
447
  $table_prefix = $wpdb->prefix;
448
 
449
  // Prepare existing taxonomies
450
- if ( 'specific' == $this->post['export_type'] and ! self::$is_user_export and ! self::$is_comment_export )
451
  {
452
  $this->_existing_taxonomies = wp_all_export_get_existing_taxonomies_by_cpt( self::$post_types[0] );
453
 
454
  $this->_existing_meta_keys = wp_all_export_get_existing_meta_by_cpt( self::$post_types[0] );
455
  }
456
- if ( 'advanced' == $this->post['export_type'] and ! self::$is_user_export and ! self::$is_comment_export )
457
  {
458
  $meta_keys = $wpdb->get_results("SELECT DISTINCT meta_key FROM {$table_prefix}postmeta WHERE {$table_prefix}postmeta.meta_key NOT LIKE '_edit%' LIMIT 500");
459
  if ( ! empty($meta_keys)){
@@ -495,6 +510,9 @@ if ( ! class_exists('XmlExportEngine') ){
495
  // Prepare existing Comments data
496
  self::$comment_export->init($this->_existing_meta_keys);
497
 
 
 
 
498
  return $this->get_available_data();
499
  }
500
 
@@ -594,7 +612,26 @@ if ( ! class_exists('XmlExportEngine') ){
594
  self::$acf_export->get_fields_options( $fields, $field_keys );
595
  }
596
 
597
- return $fields;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
598
 
599
  }
600
 
@@ -991,7 +1028,6 @@ if ( ! class_exists('XmlExportEngine') ){
991
  $result['line_numbers'] = $line_numbers;
992
 
993
  $custom_xml_template = str_replace("\n", "", $this->post['custom_xml_template']);
994
-
995
  // retrieve XML header
996
  preg_match("%(.*)". self::XML_LOOP_START ."%", $custom_xml_template, $matches);
997
  $result['custom_xml_template_header'] = empty($matches[1]) ? '' : rtrim($matches[1]);
@@ -1075,5 +1111,23 @@ if ( ! class_exists('XmlExportEngine') ){
1075
  public function get( $key, $default = null ) {
1076
  return isset( $this->{$key} ) ? $this->{$key} : $default;
1077
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1078
  }
1079
  }
7
  require_once dirname(__FILE__) . '/XmlExportWooCommerceOrder.php';
8
  require_once dirname(__FILE__) . '/XmlExportUser.php';
9
  require_once dirname(__FILE__) . '/XmlExportComment.php';
10
+ require_once dirname(__FILE__) . '/XmlExportTaxonomy.php';
11
  require_once dirname(__FILE__) . '/XmlExportFiltering.php';
12
 
13
  final class XmlExportEngine
14
  {
15
 
16
+ const VARIABLE_PRODUCTS_EXPORT_PARENT_AND_VARIATION = 1;
17
+ const VARIABLE_PRODUCTS_EXPORT_VARIATION = 2;
18
+ const VARIABLE_PRODUCTS_EXPORT_PARENT = 3;
19
+
20
+ const VARIATION_USE_PARENT_TITLE = 1;
21
+ const VARIATION_USE_DEFAULT_TITLE = 2;
22
+
23
  /**
24
  * Custom XML Loop begin statement
25
  * @var string
39
  public static $woo_refund_export;
40
  public static $user_export;
41
  public static $comment_export;
42
+ public static $taxonomy_export;
43
 
44
  public static $is_preview = false;
45
 
174
 
175
  public static $is_user_export = false;
176
  public static $is_comment_export = false;
177
+ public static $is_taxonomy_export = false;
178
+ public static $post_types = array();
179
  public static $exportOptions = array();
180
  public static $exportQuery;
181
  public static $exportID = false;
339
 
340
  self::$is_comment_export = ( in_array('comments', self::$post_types) ) ? true : false;
341
 
342
+ self::$is_taxonomy_export = ( in_array('taxonomies', self::$post_types) ) ? true : false;
343
+
344
+ }
345
  else
346
  {
347
  self::$is_user_export = ( 'wp_user_query' == $this->post['wp_query_selector'] );
348
  self::$is_comment_export = ( 'wp_comment_query' == $this->post['wp_query_selector'] );
349
  }
350
 
351
+ if ( ! self::$is_user_export && ! self::$is_comment_export && ! self::$is_taxonomy_export)
352
  {
353
  add_filter("wp_all_export_filters", array( &$this, "filter_export_filters"), 10, 1);
354
 
375
  {
376
  $filter_args = array(
377
  'filter_rules_hierarhy' => $this->post['filter_rules_hierarhy'],
378
+ 'product_matching_mode' => $this->post['product_matching_mode'],
379
+ 'taxonomy_to_export' => empty($this->post['taxonomy_to_export']) ? '' : $this->post['taxonomy_to_export']
380
  );
381
 
382
  $this->filters = new XmlExportFiltering($filter_args);
394
  self::$woo_export = new XmlExportWooCommerce();
395
  self::$user_export = new XmlExportUser();
396
  self::$comment_export = new XmlExportComment();
397
+ self::$taxonomy_export = new XmlExportTaxonomy();
398
+ self::$woo_order_export = new XmlExportWooCommerceOrder();
399
  self::$woo_coupon_export = new XmlExportWooCommerceCoupon();
400
 
401
  }
417
 
418
  PMXE_Plugin::$session->set('is_user_export', self::$is_user_export);
419
  PMXE_Plugin::$session->set('is_comment_export', self::$is_comment_export);
420
+ PMXE_Plugin::$session->set('is_taxonomy_export', self::$is_taxonomy_export);
421
+ PMXE_Plugin::$session->save_data();
422
 
423
  if ('advanced' == $this->post['export_type']) {
424
 
462
  $table_prefix = $wpdb->prefix;
463
 
464
  // Prepare existing taxonomies
465
+ if ( 'specific' == $this->post['export_type'] and ! self::$is_user_export and ! self::$is_comment_export and ! self::$is_taxonomy_export )
466
  {
467
  $this->_existing_taxonomies = wp_all_export_get_existing_taxonomies_by_cpt( self::$post_types[0] );
468
 
469
  $this->_existing_meta_keys = wp_all_export_get_existing_meta_by_cpt( self::$post_types[0] );
470
  }
471
+ if ( 'advanced' == $this->post['export_type'] and ! self::$is_user_export and ! self::$is_comment_export and ! self::$is_taxonomy_export )
472
  {
473
  $meta_keys = $wpdb->get_results("SELECT DISTINCT meta_key FROM {$table_prefix}postmeta WHERE {$table_prefix}postmeta.meta_key NOT LIKE '_edit%' LIMIT 500");
474
  if ( ! empty($meta_keys)){
510
  // Prepare existing Comments data
511
  self::$comment_export->init($this->_existing_meta_keys);
512
 
513
+ // Prepare existing Taxonomy data
514
+ self::$taxonomy_export->init($this->_existing_meta_keys);
515
+
516
  return $this->get_available_data();
517
  }
518
 
612
  self::$acf_export->get_fields_options( $fields, $field_keys );
613
  }
614
 
615
+ $sort_fields = array();
616
+ foreach ($field_keys as $i => $field_key){
617
+ foreach ($fields['cc_name'] as $j => $cc_name){
618
+ if (!empty($cc_name) && $cc_name == $field_key){
619
+ $sort_fields['ids'][] = 1;
620
+ $sort_fields['cc_label'][] = $fields['cc_label'][$j];
621
+ $sort_fields['cc_php'][] = $fields['cc_php'][$j];
622
+ $sort_fields['cc_code'][] = $fields['cc_code'][$j];
623
+ $sort_fields['cc_sql'][] = $fields['cc_sql'][$j];
624
+ $sort_fields['cc_options'][] = $fields['cc_options'][$j];
625
+ $sort_fields['cc_type'][] = $fields['cc_type'][$j];
626
+ $sort_fields['cc_value'][] = $fields['cc_value'][$j];
627
+ $sort_fields['cc_name'][] = $fields['cc_name'][$j];
628
+ $sort_fields['cc_settings'][] = $fields['cc_settings'][$j];
629
+ break;
630
+ }
631
+ }
632
+ }
633
+
634
+ return $sort_fields;
635
 
636
  }
637
 
1028
  $result['line_numbers'] = $line_numbers;
1029
 
1030
  $custom_xml_template = str_replace("\n", "", $this->post['custom_xml_template']);
 
1031
  // retrieve XML header
1032
  preg_match("%(.*)". self::XML_LOOP_START ."%", $custom_xml_template, $matches);
1033
  $result['custom_xml_template_header'] = empty($matches[1]) ? '' : rtrim($matches[1]);
1111
  public function get( $key, $default = null ) {
1112
  return isset( $this->{$key} ) ? $this->{$key} : $default;
1113
  }
1114
+
1115
+ public static function getProductVariationMode()
1116
+ {
1117
+ if(!isset(self::$exportOptions['export_variations'])) {
1118
+ self::$exportOptions['export_variations'] = self::VARIABLE_PRODUCTS_EXPORT_PARENT_AND_VARIATION;
1119
+ }
1120
+
1121
+ return self::$exportOptions['export_variations'];
1122
+ }
1123
+
1124
+ public static function getProductVariationTitleMode()
1125
+ {
1126
+ if(!isset(self::$exportOptions['export_variations_title'])) {
1127
+ self::$exportOptions['export_variations_title'] = self::VARIATION_USE_DEFAULT_TITLE;
1128
+ }
1129
+
1130
+ return self::$exportOptions['export_variations_title'];
1131
+ }
1132
  }
1133
  }
libraries/XmlExportMediaGallery.php CHANGED
@@ -68,7 +68,11 @@ final class XmlExportMediaGallery
68
  // prepare featured image data
69
  if ( empty(self::$featured_image) )
70
  {
71
- $_featured_image_id = get_post_meta(self::$pid, '_thumbnail_id', true);
 
 
 
 
72
 
73
  if ( ! empty($_featured_image_id) )
74
  {
@@ -91,7 +95,7 @@ final class XmlExportMediaGallery
91
  if ( empty($options) or ! empty($options['is_export_attached']) )
92
  {
93
 
94
- $_gallery = get_post_meta(self::$pid, '_product_image_gallery', true);
95
 
96
  if ( ! empty($_gallery))
97
  {
@@ -154,11 +158,11 @@ final class XmlExportMediaGallery
154
  {
155
  $v = self::get_media( str_replace("attachment_", "", $field), $attachment );
156
 
157
- if ( $v and ! in_array($v, $data)) $data[] = $v;
158
  }
159
  }
160
 
161
- return array_unique($data);
162
  }
163
 
164
  public static function get_images( $field = 'image_url', $options = false )
@@ -173,11 +177,11 @@ final class XmlExportMediaGallery
173
  {
174
  $v = self::get_media( str_replace("image_", "", $field), $image );
175
 
176
- if ( $v and ! in_array($v, $data)) $data[] = $v;
177
  }
178
  }
179
 
180
- return array_unique($data);
181
  }
182
 
183
  private static function get_media( $field = 'url', $attachment = false )
@@ -210,7 +214,7 @@ final class XmlExportMediaGallery
210
  return $attachment->post_content;
211
  break;
212
  case 'alt':
213
- return get_post_meta($attachment->ID, '_wp_attachment_image_alt', true);
214
  break;
215
 
216
  default:
@@ -334,4 +338,14 @@ final class XmlExportMediaGallery
334
  }
335
 
336
  }
 
 
 
 
 
 
 
 
 
 
337
  }
68
  // prepare featured image data
69
  if ( empty(self::$featured_image) )
70
  {
71
+ $_featured_image_id = self::get_meta(self::$pid, '_thumbnail_id', true);
72
+
73
+ if (empty($_featured_image_id)){
74
+ $_featured_image_id = self::get_meta(self::$pid, 'thumbnail_id', true);
75
+ }
76
 
77
  if ( ! empty($_featured_image_id) )
78
  {
95
  if ( empty($options) or ! empty($options['is_export_attached']) )
96
  {
97
 
98
+ $_gallery = self::get_meta(self::$pid, '_product_image_gallery', true);
99
 
100
  if ( ! empty($_gallery))
101
  {
158
  {
159
  $v = self::get_media( str_replace("attachment_", "", $field), $attachment );
160
 
161
+ $data[] = $v;
162
  }
163
  }
164
 
165
+ return $data;
166
  }
167
 
168
  public static function get_images( $field = 'image_url', $options = false )
177
  {
178
  $v = self::get_media( str_replace("image_", "", $field), $image );
179
 
180
+ $data[] = $v;
181
  }
182
  }
183
 
184
+ return $data;
185
  }
186
 
187
  private static function get_media( $field = 'url', $attachment = false )
214
  return $attachment->post_content;
215
  break;
216
  case 'alt':
217
+ return self::get_meta($attachment->ID, '_wp_attachment_image_alt', true);
218
  break;
219
 
220
  default:
338
  }
339
 
340
  }
341
+
342
+ public static function get_meta($pid, $key){
343
+ if (XmlExportTaxonomy::$is_active){
344
+ return get_term_meta($pid, $key, true);
345
+ }
346
+ if (XmlExportUser::$is_active){
347
+ return get_user_meta($pid, $key, true);
348
+ }
349
+ return get_post_meta($pid, $key, true);
350
+ }
351
  }
libraries/XmlExportTaxonomy.php ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! class_exists('XmlExportTaxonomy') )
4
+ {
5
+ final class XmlExportTaxonomy
6
+ {
7
+ private $init_fields = array(
8
+ array(
9
+ 'label' => 'term_id',
10
+ 'name' => 'Term ID',
11
+ 'type' => 'term_id'
12
+ ),
13
+ array(
14
+ 'label' => 'term_name',
15
+ 'name' => 'Term Name',
16
+ 'type' => 'term_name'
17
+ ),
18
+ array(
19
+ 'label' => 'term_slug',
20
+ 'name' => 'Term Slug',
21
+ 'type' => 'term_slug'
22
+ )
23
+ );
24
+
25
+ private $default_fields = array(
26
+ array(
27
+ 'label' => 'term_id',
28
+ 'name' => 'Term ID',
29
+ 'type' => 'term_id'
30
+ ),
31
+ array(
32
+ 'label' => 'term_name',
33
+ 'name' => 'Term Name',
34
+ 'type' => 'term_name'
35
+ ),
36
+ array(
37
+ 'label' => 'term_slug',
38
+ 'name' => 'Term Slug',
39
+ 'type' => 'term_slug'
40
+ ),
41
+ array(
42
+ 'label' => 'term_description',
43
+ 'name' => 'Description',
44
+ 'type' => 'term_description'
45
+ ),
46
+ array(
47
+ 'label' => 'term_parent_id',
48
+ 'name' => 'Parent ID',
49
+ 'type' => 'term_parent_id'
50
+ ),
51
+ array(
52
+ 'label' => 'term_parent_name',
53
+ 'name' => 'Parent Name',
54
+ 'type' => 'term_parent_name'
55
+ ),
56
+ array(
57
+ 'label' => 'term_parent_slug',
58
+ 'name' => 'Parent Slug',
59
+ 'type' => 'term_parent_slug'
60
+ ),
61
+ array(
62
+ 'label' => 'term_posts_count',
63
+ 'name' => 'Count',
64
+ 'type' => 'term_posts_count'
65
+ ),
66
+ );
67
+
68
+ private $advanced_fields = array(
69
+
70
+ );
71
+
72
+ public static $is_active = true;
73
+
74
+ public function __construct()
75
+ {
76
+
77
+ if ( XmlExportEngine::$exportOptions['export_type'] == 'specific' and ! in_array('taxonomies', XmlExportEngine::$post_types) or XmlExportEngine::$exportOptions['export_type'] == 'advanced'){
78
+ self::$is_active = false;
79
+ return;
80
+ }
81
+
82
+ add_filter("wp_all_export_available_sections", array( &$this, "filter_available_sections" ), 10, 1);
83
+ add_filter("wp_all_export_init_fields", array( &$this, "filter_init_fields"), 10, 1);
84
+ add_filter("wp_all_export_default_fields", array( &$this, "filter_default_fields"), 10, 1);
85
+ add_filter("wp_all_export_other_fields", array( &$this, "filter_other_fields"), 10, 1);
86
+ }
87
+
88
+ // [FILTERS]
89
+
90
+ /**
91
+ *
92
+ * Filter Init Fields
93
+ *
94
+ */
95
+ public function filter_init_fields($init_fields){
96
+ return $this->init_fields;
97
+ }
98
+
99
+ /**
100
+ *
101
+ * Filter Default Fields
102
+ *
103
+ */
104
+ public function filter_default_fields($default_fields){
105
+ return $this->default_fields;
106
+ }
107
+
108
+ /**
109
+ *
110
+ * Filter Other Fields
111
+ *
112
+ */
113
+ public function filter_other_fields($other_fields){
114
+ return $this->advanced_fields;
115
+ }
116
+
117
+ /**
118
+ *
119
+ * Filter Sections in Available Data
120
+ *
121
+ */
122
+ public function filter_available_sections($sections){
123
+
124
+ unset($sections['media']['additional']['attachments']);
125
+ unset($sections['cats']);
126
+ unset($sections['other']);
127
+
128
+ $sections['cf']['title'] = __("Term Meta", "wp_all_export_plugin");
129
+
130
+ return $sections;
131
+ }
132
+
133
+ // [\FILTERS]
134
+
135
+ public function init( & $existing_meta_keys = array() )
136
+ {
137
+ if ( ! self::$is_active ) return;
138
+
139
+ if ( ! empty(XmlExportEngine::$exportQuery)){
140
+ $terms = XmlExportEngine::$exportQuery->get_terms();
141
+ }
142
+
143
+ if ( ! empty( $terms ) ) {
144
+ foreach ( $terms as $term ) {
145
+ $term_meta = get_term_meta($term->term_id, '');
146
+ if ( ! empty($term_meta)){
147
+ foreach ($term_meta as $record_meta_key => $record_meta_value) {
148
+ if ( ! in_array($record_meta_key, $existing_meta_keys) ){
149
+ $to_add = true;
150
+ foreach ($this->default_fields as $default_value) {
151
+ if ( $record_meta_key == $default_value['name'] || $record_meta_key == $default_value['type'] ){
152
+ $to_add = false;
153
+ break;
154
+ }
155
+ }
156
+ if ( $to_add ){
157
+ foreach ($this->advanced_fields as $advanced_value) {
158
+ if ( $record_meta_key == $advanced_value['name'] || $record_meta_key == $advanced_value['type']){
159
+ $to_add = false;
160
+ break;
161
+ }
162
+ }
163
+ }
164
+ if ( $to_add ) $existing_meta_keys[] = $record_meta_key;
165
+ }
166
+ }
167
+ }
168
+ }
169
+ }
170
+ }
171
+
172
+ /**
173
+ * __get function.
174
+ *
175
+ * @access public
176
+ * @param mixed $key
177
+ * @return mixed
178
+ */
179
+ public function __get( $key ) {
180
+ return $this->get( $key );
181
+ }
182
+
183
+ /**
184
+ * Get a session variable
185
+ *
186
+ * @param string $key
187
+ * @param mixed $default used if the session variable isn't set
188
+ * @return mixed value of session variable
189
+ */
190
+ public function get( $key, $default = null ) {
191
+ return isset( $this->{$key} ) ? $this->{$key} : $default;
192
+ }
193
+ }
194
+ }
libraries/XmlExportUser.php CHANGED
@@ -241,8 +241,8 @@ if ( ! class_exists('XmlExportUser') ){
241
  if ( ! self::$is_active ) return;
242
 
243
  global $wpdb;
244
- $table_prefix = $wpdb->prefix;
245
- self::$meta_keys = $wpdb->get_results("SELECT DISTINCT {$table_prefix}usermeta.meta_key FROM {$table_prefix}usermeta, {$table_prefix}users WHERE {$table_prefix}usermeta.user_id = {$table_prefix}users.ID LIMIT 500");
246
 
247
  $user_ids = array();
248
  if ( ! empty(XmlExportEngine::$exportQuery->results)) {
@@ -255,7 +255,7 @@ if ( ! class_exists('XmlExportUser') ){
255
 
256
  $address_fields = $this->available_customer_data();
257
 
258
- $customer_users = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta, $wpdb->users WHERE meta_key = %s AND meta_value != %s ", '_customer_user', '0'));
259
 
260
  // detect if at least one filtered user is a WooCommerce customer
261
  if ( ! empty($customer_users) ) {
241
  if ( ! self::$is_active ) return;
242
 
243
  global $wpdb;
244
+ //$table_prefix = $wpdb->prefix;
245
+ self::$meta_keys = $wpdb->get_results("SELECT DISTINCT ".$wpdb->usermeta .".meta_key FROM $wpdb->usermeta, $wpdb->users WHERE ".$wpdb->usermeta.".user_id = ".$wpdb->users.".ID LIMIT 500");
246
 
247
  $user_ids = array();
248
  if ( ! empty(XmlExportEngine::$exportQuery->results)) {
255
 
256
  $address_fields = $this->available_customer_data();
257
 
258
+ $customer_users = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = %s AND meta_value != %s ", '_customer_user', '0'));
259
 
260
  // detect if at least one filtered user is a WooCommerce customer
261
  if ( ! empty($customer_users) ) {
libraries/XmlExportWooCommerce.php CHANGED
@@ -16,7 +16,12 @@ if ( ! class_exists('XmlExportWooCommerce') )
16
  'name' => 'product_type',
17
  'type' => 'cats',
18
  'label' => 'product_type'
19
- )
 
 
 
 
 
20
  );
21
 
22
  private $_woo_data = array();
@@ -65,6 +70,37 @@ if ( ! class_exists('XmlExportWooCommerce') )
65
  }
66
  }
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  add_filter("wp_all_export_init_fields", array( &$this, "filter_init_fields"), 10, 1);
69
  add_filter("wp_all_export_default_fields", array( &$this, "filter_default_fields"), 10, 1);
70
  add_filter("wp_all_export_other_fields", array( &$this, "filter_other_fields"), 10, 1);
@@ -96,7 +132,12 @@ if ( ! class_exists('XmlExportWooCommerce') )
96
  foreach ($default_fields as $key => $field) {
97
  $default_fields[$key]['auto'] = true;
98
  }
99
- return array_map(array( &$this, 'fix_titles'), $default_fields);
 
 
 
 
 
100
  }
101
 
102
  /**
@@ -119,7 +160,12 @@ if ( ! class_exists('XmlExportWooCommerce') )
119
  if ( strpos($field['label'], '_min_') === 0 || strpos($field['label'], '_max_') === 0 )
120
  continue;
121
 
122
- if ( $field['type'] != 'attr' ) $other_fields[$key]['auto'] = true;
 
 
 
 
 
123
 
124
  $other_fields[$key] = $this->fix_titles($other_fields[$key]);
125
  }
@@ -652,22 +698,8 @@ if ( ! class_exists('XmlExportWooCommerce') )
652
  case '_sale_price_dates_from':
653
  case '_sale_price_dates_to':
654
 
655
- if ( ! empty($fieldSettings))
656
- {
657
- switch ($fieldSettings)
658
- {
659
- case 'unix':
660
- $post_date = $cur_meta_value;
661
- break;
662
- default:
663
- $post_date = date($fieldSettings, $cur_meta_value);
664
- break;
665
- }
666
- }
667
- else
668
- {
669
- $post_date = $cur_meta_value;
670
- }
671
  $data[$element_name] = apply_filters('pmxe_woo_field', pmxe_filter($post_date, $fieldSnipped), $element_value, $record->ID);
672
 
673
  // wp_all_export_write_article( $article, $element_name, apply_filters('pmxe_post_date', pmxe_filter($post_date, $fieldSnipped), $record->ID) );
@@ -886,7 +918,7 @@ if ( ! class_exists('XmlExportWooCommerce') )
886
  break;
887
  case '_sku':
888
  $templateOptions['single_product_sku'] = '{'. $element_name .'[1]}';
889
- $templateOptions['single_product_parent_id'] = '{parent_id[1]}';
890
  break;
891
  case '_sale_price_dates_from':
892
  $templateOptions['single_sale_price_dates_from'] = '{'. $element_name .'[1]}';
@@ -960,6 +992,14 @@ if ( ! class_exists('XmlExportWooCommerce') )
960
  $templateOptions['product_allow_backorders'] = 'xpath';
961
  $templateOptions['single_product_allow_backorders'] = '{'. $element_name .'[1]}';
962
  break;
 
 
 
 
 
 
 
 
963
  case 'attributes':
964
 
965
  global $wp_taxonomies;
16
  'name' => 'product_type',
17
  'type' => 'cats',
18
  'label' => 'product_type'
19
+ ),
20
+ array(
21
+ 'label' => 'parent',
22
+ 'name' => 'Parent Product ID',
23
+ 'type' => 'parent'
24
+ )
25
  );
26
 
27
  private $_woo_data = array();
70
  }
71
  }
72
 
73
+ global $wp_taxonomies;
74
+
75
+ $max_input_vars = @ini_get('max_input_vars');
76
+ if (empty($max_input_vars)) $max_input_vars = 100;
77
+ foreach ($wp_taxonomies as $key => $obj) { if (in_array($obj->name, array('nav_menu'))) continue;
78
+
79
+ if (strpos($obj->name, "pa_") === 0 and strlen($obj->name) > 3 ){
80
+
81
+ if ( count($this->init_fields) < $max_input_vars / 10 ){
82
+ $this->init_fields[] = array(
83
+ 'name' => $obj->label,
84
+ 'label' => $obj->name,
85
+ 'type' => 'attr'
86
+ );
87
+ }
88
+ }
89
+ }
90
+
91
+ if ( ! empty(self::$products_data['attributes']))
92
+ {
93
+ foreach (self::$products_data['attributes'] as $attribute) {
94
+ if ( count($this->init_fields) < $max_input_vars / 10 ) {
95
+ $this->init_fields[] = $this->fix_titles(array(
96
+ 'name' => str_replace('attribute_', '', $attribute->meta_key),
97
+ 'label' => $attribute->meta_key,
98
+ 'type' => 'cf'
99
+ ));
100
+ }
101
+ }
102
+ }
103
+
104
  add_filter("wp_all_export_init_fields", array( &$this, "filter_init_fields"), 10, 1);
105
  add_filter("wp_all_export_default_fields", array( &$this, "filter_default_fields"), 10, 1);
106
  add_filter("wp_all_export_other_fields", array( &$this, "filter_other_fields"), 10, 1);
132
  foreach ($default_fields as $key => $field) {
133
  $default_fields[$key]['auto'] = true;
134
  }
135
+ $default_fields[] = array(
136
+ 'label' => 'parent',
137
+ 'name' => 'Parent Product ID',
138
+ 'type' => 'parent'
139
+ );
140
+ return array_map(array( &$this, 'fix_titles'), $default_fields);
141
  }
142
 
143
  /**
160
  if ( strpos($field['label'], '_min_') === 0 || strpos($field['label'], '_max_') === 0 )
161
  continue;
162
 
163
+ if ($field['type'] == 'parent'){
164
+ unset($other_fields[$key]);
165
+ continue;
166
+ }
167
+
168
+ if ( $field['type'] != 'attr' ) $other_fields[$key]['auto'] = true;
169
 
170
  $other_fields[$key] = $this->fix_titles($other_fields[$key]);
171
  }
698
  case '_sale_price_dates_from':
699
  case '_sale_price_dates_to':
700
 
701
+ $post_date = $cur_meta_value ? prepare_date_field_value($fieldSettings, $cur_meta_value) : "";
702
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
703
  $data[$element_name] = apply_filters('pmxe_woo_field', pmxe_filter($post_date, $fieldSnipped), $element_value, $record->ID);
704
 
705
  // wp_all_export_write_article( $article, $element_name, apply_filters('pmxe_post_date', pmxe_filter($post_date, $fieldSnipped), $record->ID) );
918
  break;
919
  case '_sku':
920
  $templateOptions['single_product_sku'] = '{'. $element_name .'[1]}';
921
+ //$templateOptions['single_product_parent_id'] = '{parent_id[1]}';
922
  break;
923
  case '_sale_price_dates_from':
924
  $templateOptions['single_sale_price_dates_from'] = '{'. $element_name .'[1]}';
992
  $templateOptions['product_allow_backorders'] = 'xpath';
993
  $templateOptions['single_product_allow_backorders'] = '{'. $element_name .'[1]}';
994
  break;
995
+ case '_variation_description':
996
+ $templateOptions['single_product_variation_description'] = '{'. $element_name .'[1]}';
997
+ break;
998
+ case '_default_attributes':
999
+ $templateOptions['custom_name'][] = $element_key;
1000
+ $templateOptions['custom_value'][] = '{'. $element_name .'[1]}';
1001
+ $templateOptions['custom_format'][] = 0;
1002
+ break;
1003
  case 'attributes':
1004
 
1005
  global $wp_taxonomies;
libraries/XmlExportWooCommerceOrder.php CHANGED
@@ -1285,7 +1285,8 @@ if ( ! class_exists('XmlExportWooCommerceOrder') )
1285
  'tax_amount' => __('Amount (per tax)', 'wp_all_export_plugin'),
1286
  '_order_tax' => __('Total Tax Amount', 'wp_all_export_plugin'),
1287
  'shipping_order_item_name' => __('Shipping Method', 'wp_all_export_plugin'),
1288
- '_order_shipping' => __('Shipping Cost', 'wp_all_export_plugin')
 
1289
  );
1290
 
1291
  return apply_filters('wp_all_export_available_order_default_taxes_data_filter', $data);
@@ -1298,7 +1299,8 @@ if ( ! class_exists('XmlExportWooCommerceOrder') )
1298
  '__coupons_used' => __('Coupons Used', 'wp_all_export_plugin'),
1299
  '_cart_discount' => __('Total Discount Amount', 'wp_all_export_plugin'),
1300
  'fee_line_total' => __('Fee Amount (per surcharge)', 'wp_all_export_plugin'),
1301
- '__total_fee_amount' => __('Total Fee Amount', 'wp_all_export_plugin')
 
1302
  );
1303
 
1304
  return apply_filters('wp_all_export_available_order_fees_data_filter', $data);
@@ -1325,7 +1327,7 @@ if ( ! class_exists('XmlExportWooCommerceOrder') )
1325
  '_billing_first_name', '_billing_last_name', '_billing_company',
1326
  '_billing_address_1', '_billing_address_2', '_billing_city',
1327
  '_billing_postcode', '_billing_country', '_billing_state',
1328
- '_billing_email', '_billing_phone'
1329
  );
1330
 
1331
  $data = $this->generate_friendly_titles($keys, 'billing');
@@ -1362,7 +1364,10 @@ if ( ! class_exists('XmlExportWooCommerceOrder') )
1362
  $key2 = ' ('.__($keyword, 'wp_all_export_plugin').')';
1363
  }
1364
 
1365
- $data[$key] = __(trim($key1), 'woocommerce').$key2;
 
 
 
1366
 
1367
  }
1368
  return $data;
@@ -1381,7 +1386,20 @@ if ( ! class_exists('XmlExportWooCommerceOrder') )
1381
 
1382
  $implode_delimiter = XmlExportEngine::$implode;
1383
 
1384
- switch ($element_type)
 
 
 
 
 
 
 
 
 
 
 
 
 
1385
  {
1386
  case 'ID':
1387
  $templateOptions['unique_key'] = '{'. $element_name .'[1]}';
@@ -1404,11 +1422,12 @@ if ( ! class_exists('XmlExportWooCommerceOrder') )
1404
  $templateOptions['pmwi_order']['date'] = '{'. $element_name .'[1]}';
1405
  break;
1406
 
1407
- case '_billing_email':
1408
  $templateOptions['pmwi_order']['billing_source_match_by'] = 'email';
1409
  $templateOptions['pmwi_order']['billing_source_email'] = '{'. $element_name .'[1]}';
1410
  $templateOptions['pmwi_order']['is_update_billing_details'] = 1;
1411
  $templateOptions['pmwi_order']['is_update_shipping_details'] = 1;
 
1412
  break;
1413
 
1414
  case 'post_excerpt':
@@ -1601,7 +1620,14 @@ if ( ! class_exists('XmlExportWooCommerceOrder') )
1601
  $templateOptions['pmwi_order']['order_refund_issued_email'] = '{'. $element_name .'[1]}';
1602
  }
1603
  break;
1604
-
 
 
 
 
 
 
 
1605
  }
1606
 
1607
  }
1285
  'tax_amount' => __('Amount (per tax)', 'wp_all_export_plugin'),
1286
  '_order_tax' => __('Total Tax Amount', 'wp_all_export_plugin'),
1287
  'shipping_order_item_name' => __('Shipping Method', 'wp_all_export_plugin'),
1288
+ '_order_shipping' => __('Shipping Cost', 'wp_all_export_plugin'),
1289
+ '_order_shipping_taxes' => __('Shipping Taxes', 'wp_all_export_plugin')
1290
  );
1291
 
1292
  return apply_filters('wp_all_export_available_order_default_taxes_data_filter', $data);
1299
  '__coupons_used' => __('Coupons Used', 'wp_all_export_plugin'),
1300
  '_cart_discount' => __('Total Discount Amount', 'wp_all_export_plugin'),
1301
  'fee_line_total' => __('Fee Amount (per surcharge)', 'wp_all_export_plugin'),
1302
+ '__total_fee_amount' => __('Total Fee Amount', 'wp_all_export_plugin'),
1303
+ '__fee_tax_data' => __('Fee Taxes', 'wp_all_export_plugin'),
1304
  );
1305
 
1306
  return apply_filters('wp_all_export_available_order_fees_data_filter', $data);
1327
  '_billing_first_name', '_billing_last_name', '_billing_company',
1328
  '_billing_address_1', '_billing_address_2', '_billing_city',
1329
  '_billing_postcode', '_billing_country', '_billing_state',
1330
+ '_billing_email', '_customer_user_email', '_billing_phone'
1331
  );
1332
 
1333
  $data = $this->generate_friendly_titles($keys, 'billing');
1364
  $key2 = ' ('.__($keyword, 'wp_all_export_plugin').')';
1365
  }
1366
 
1367
+ $data[$key] = __(trim($key1), 'wp_all_export_plugin').$key2;
1368
+
1369
+ if ( '_billing_email' == $key ) $data[$key] = __('Billing Email Address', 'wp_all_export_plugin');
1370
+ if ( '_customer_user_email' == $key) $data[$key] = __('Customer Account Email Address', 'wp_all_export_plugin');
1371
 
1372
  }
1373
  return $data;
1386
 
1387
  $implode_delimiter = XmlExportEngine::$implode;
1388
 
1389
+ $billing_keys = array(
1390
+ '_billing_first_name', '_billing_last_name', '_billing_company',
1391
+ '_billing_address_1', '_billing_address_2', '_billing_city',
1392
+ '_billing_postcode', '_billing_country', '_billing_state',
1393
+ '_billing_email', '_billing_phone'
1394
+ );
1395
+
1396
+ $shipping_keys = array(
1397
+ '_shipping_first_name', '_shipping_last_name', '_shipping_company',
1398
+ '_shipping_address_1', '_shipping_address_2', '_shipping_city',
1399
+ '_shipping_postcode', '_shipping_country', '_shipping_state'
1400
+ );
1401
+
1402
+ switch ($element_type)
1403
  {
1404
  case 'ID':
1405
  $templateOptions['unique_key'] = '{'. $element_name .'[1]}';
1422
  $templateOptions['pmwi_order']['date'] = '{'. $element_name .'[1]}';
1423
  break;
1424
 
1425
+ case '_customer_user_email':
1426
  $templateOptions['pmwi_order']['billing_source_match_by'] = 'email';
1427
  $templateOptions['pmwi_order']['billing_source_email'] = '{'. $element_name .'[1]}';
1428
  $templateOptions['pmwi_order']['is_update_billing_details'] = 1;
1429
  $templateOptions['pmwi_order']['is_update_shipping_details'] = 1;
1430
+ //$templateOptions['pmwi_order']['guest' . $element_type] = '{'. $element_name .'[1]}';
1431
  break;
1432
 
1433
  case 'post_excerpt':
1620
  $templateOptions['pmwi_order']['order_refund_issued_email'] = '{'. $element_name .'[1]}';
1621
  }
1622
  break;
1623
+ default:
1624
+ if ( in_array($element_type, $billing_keys)){
1625
+ $templateOptions['pmwi_order']['guest' . $element_type] = '{'. $element_name .'[1]}';
1626
+ }
1627
+ if ( in_array($element_type, $shipping_keys)){
1628
+ $templateOptions['pmwi_order'][ltrim($element_type, '_')] = '{'. $element_name .'[1]}';
1629
+ }
1630
+ break;
1631
  }
1632
 
1633
  }
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === Export WordPress data to XML/CSV ===
2
  Contributors: soflyy, wpallimport
3
  Requires at least: 4.1
4
- Tested up to: 4.6.1
5
- Stable tag: 1.0.9
6
  Tags: wordpress csv export, wordpress xml export, xml, csv, datafeed, export, migrate, export csv from wordpress, export xml from wordpress, advanced xml export, advanced csv export, export data, bulk csv export, export custom post type, export woocommerce products, export woocommerce orders, migrate woocommerce, csv export, export csv, xml export, export xml, csv exporter, datafeed
7
 
8
  WP All Export is an extremely powerful exporter that makes it easy to export any XML or CSV file from WordPress.
@@ -78,6 +78,18 @@ Either: -
78
 
79
  == Changelog ==
80
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  = 1.0.9 =
82
  * bug fix: fixed compatibility with PHP 5.3
83
 
1
  === Export WordPress data to XML/CSV ===
2
  Contributors: soflyy, wpallimport
3
  Requires at least: 4.1
4
+ Tested up to: 4.7
5
+ Stable tag: 1.1.0
6
  Tags: wordpress csv export, wordpress xml export, xml, csv, datafeed, export, migrate, export csv from wordpress, export xml from wordpress, advanced xml export, advanced csv export, export data, bulk csv export, export custom post type, export woocommerce products, export woocommerce orders, migrate woocommerce, csv export, export csv, xml export, export xml, csv exporter, datafeed
7
 
8
  WP All Export is an extremely powerful exporter that makes it easy to export any XML or CSV file from WordPress.
78
 
79
  == Changelog ==
80
 
81
+ = 1.1.0 =
82
+ * improvement: added ACF fields to 'migrate' & 'add all fields' features
83
+ * improvement: added new filter 'wp_all_export_field_name'
84
+ * improvement: changed default date export to Y/m/d
85
+ * bug fix: export shipping class for product variations
86
+ * bug fix: import template for ACF relationship fields
87
+ * bug fix: export empty images metadata
88
+ * bug fix: import template for ACF gallery
89
+ * bug fix: import template for variation_description
90
+ * bug fix: import template for default product attributes
91
+ * bug fix: automatically adding parent_id column on products export
92
+
93
  = 1.0.9 =
94
  * bug fix: fixed compatibility with PHP 5.3
95
 
src/VariationOptions/VariationOptions.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Wpae\VariationOptions;
4
+
5
+
6
+ class VariationOptions implements VariationOptionsInterface
7
+ {
8
+ public function getQueryWhere($wpdb, $where, $join, $closeBracket = false)
9
+ {
10
+ return $this->defaultQuery($wpdb, $where, $join, $closeBracket);
11
+ }
12
+
13
+ public function preProcessPost(\WP_Post $entry)
14
+ {
15
+ return $entry;
16
+ }
17
+
18
+ /**
19
+ * @param $wpdb
20
+ * @param $where
21
+ * @param $join
22
+ * @param $closeBracket
23
+ * @return string
24
+ *
25
+ * TODO: Remove $closeBracket flag
26
+ */
27
+ protected function defaultQuery($wpdb, $where, $join, $closeBracket)
28
+ {
29
+ if($closeBracket) {
30
+ return " AND $wpdb->posts.post_type = 'product' ) OR ($wpdb->posts.post_type = 'product_variation' AND $wpdb->posts.post_parent IN (
31
+ SELECT DISTINCT $wpdb->posts.ID
32
+ FROM $wpdb->posts $join
33
+ WHERE $where
34
+ )) GROUP BY $wpdb->posts.ID";
35
+ } else {
36
+ return " AND $wpdb->posts.post_type = 'product' OR ($wpdb->posts.post_type = 'product_variation' AND $wpdb->posts.post_parent IN (
37
+ SELECT DISTINCT $wpdb->posts.ID
38
+ FROM $wpdb->posts $join
39
+ WHERE $where
40
+ )) GROUP BY $wpdb->posts.ID";
41
+ }
42
+
43
+ }
44
+ }
src/VariationOptions/VariationOptionsFactory.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Wpae\VariationOptions;
4
+
5
+
6
+ use Wpae\Pro\VariationOptions\VariationOptions as ProVariationOptions;
7
+
8
+ class VariationOptionsFactory
9
+ {
10
+ public function createVariationOptions($pmxeEdition)
11
+ {
12
+ switch ($pmxeEdition){
13
+ case 'free':
14
+ return new VariationOptions();
15
+ break;
16
+ case 'paid':
17
+ return new ProVariationOptions();
18
+ break;
19
+ default:
20
+ throw new \Exception('Unknown PMXE edition');
21
+ }
22
+ }
23
+ }
src/VariationOptions/VariationOptionsInterface.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Wpae\VariationOptions;
4
+
5
+
6
+ interface VariationOptionsInterface
7
+ {
8
+ public function preProcessPost(\WP_Post $entry);
9
+
10
+ public function getQueryWhere($wpdb, $where, $join, $closeBracket = false);
11
+ }
static/css/admin.css CHANGED
@@ -153,7 +153,8 @@
153
  }
154
  .wpallexport-plugin .wpallexport-user-export-notice,
155
  .wpallexport-plugin .wpallexport-shop_customer-export-notice,
156
- .wpallexport-plugin .wpallexport-comments-export-notice{
 
157
  padding: 20px;
158
  display: none;
159
  width: 558px;
@@ -473,7 +474,12 @@
473
  color: #000;
474
  font-weight: bold;
475
  }
476
-
 
 
 
 
 
477
  /*--------------------------------------------------------------------------
478
  *
479
  * Basic rules
@@ -1063,9 +1069,9 @@
1063
  padding: 10px 0;
1064
  width: 100px;
1065
  }
1066
- .wpallexport-plugin .wp-all-export-advanced-field-options-content{
1067
  display: none;
1068
- }
1069
  /*--------------------------------------------------------------------------
1070
  *
1071
  * Fixes & Other Stuff
@@ -1579,7 +1585,8 @@
1579
  }
1580
  .wpallexport-plugin #custom_type_selector,
1581
  .wpallexport-plugin #file_selector,
1582
- .wpallexport-plugin #wp_query_selector{
 
1583
  margin: 0 auto;
1584
  margin-bottom: 20px;
1585
  text-align: left;
@@ -1598,12 +1605,14 @@
1598
  }
1599
  .wpallexport-plugin #custom_type_selector .dd-options li,
1600
  .wpallexport-plugin #file_selector .dd-options li,
1601
- .wpallexport-plugin #wp_query_selector .dd-options li{
 
1602
  margin-bottom: 0;
1603
  }
1604
  .wpallexport-plugin #custom_type_selector .dd-options li .dd-option,
1605
  .wpallexport-plugin #file_selector .dd-options li .dd-option,
1606
- .wpallexport-plugin #wp_query_selector .dd-options li .dd-option{
 
1607
  font-size: 18px;
1608
  color: #555;
1609
  border: none;
@@ -1618,7 +1627,9 @@
1618
  .wpallexport-plugin #file_selector .dd-options li .dd-option:hover,
1619
  .wpallexport-plugin #file_selector .dd-options li .dd-option-selected,
1620
  .wpallexport-plugin #wp_query_selector .dd-options li .dd-option:hover,
1621
- .wpallexport-plugin #wp_query_selector .dd-options li .dd-option-selected{
 
 
1622
  background: #eee;
1623
  color: #555;
1624
  }
@@ -1629,14 +1640,16 @@
1629
  }*/
1630
  .wpallexport-plugin #custom_type_selector .dd-select,
1631
  .wpallexport-plugin #file_selector .dd-select,
1632
- .wpallexport-plugin #wp_query_selector .dd-select{
 
1633
  background: #fff !important;
1634
  padding: 10px 0;
1635
  /*margin-left: -5px;*/
1636
  }
1637
  .wpallexport-plugin #custom_type_selector .dd-selected,
1638
  .wpallexport-plugin #file_selector .dd-selected,
1639
- .wpallexport-plugin #wp_query_selector .dd-selected{
 
1640
  color: #000;
1641
  font-weight: normal;
1642
  font-size: 18px;
@@ -1645,11 +1658,13 @@
1645
  line-height: 24px;
1646
  }
1647
  .wpallexport-plugin .change_file #file_selector .dd-select,
1648
- .wpallexport-plugin .change_file #wp_query_selector .dd-select{
 
1649
  padding: 5px 0 0;
1650
  }
1651
  .wpallexport-plugin .change_file #file_selector .dd-options .dd-option,
1652
- .wpallexport-plugin .change_file #wp_query_selector .dd-options .dd-option{
 
1653
  padding: 0 10px;
1654
  }
1655
  .wpallexport-plugin .dd-options{
@@ -1682,8 +1697,8 @@
1682
  }
1683
  .wpallexport-plugin #file_selector .dd-option .dashicon-product:before,
1684
  .wpallexport-plugin #file_selector .dd-selected .dashicon-product:before{
1685
- font-family: "dashicons";
1686
- content: "\f174";
1687
  color: #555;
1688
  margin-top: 0;
1689
  }
@@ -1706,8 +1721,8 @@
1706
  content: "\f333";
1707
  color: #555;
1708
  }
1709
- .wpallexport-plugin #file_selector .dd-option .dashicon-import_users:before,
1710
- .wpallexport-plugin #file_selector .dd-selected .dashicon-import_users:before{
1711
  font-family: "dashicons";
1712
  content: "\f110";
1713
  color: #555;
@@ -1718,6 +1733,12 @@
1718
  content: "\f101";
1719
  color: #555;
1720
  }
 
 
 
 
 
 
1721
  .wpallexport-plugin #file_selector .dd-option:hover .dashicon:before,
1722
  .wpallexport-plugin #file_selector .dd-option-selected .dashicon:before{
1723
  color: #555;
@@ -2660,6 +2681,13 @@
2660
  /*margin-top: 15px; */
2661
  }
2662
 
 
 
 
 
 
 
 
2663
  /*--------------------------------------------------------------------------
2664
  *
2665
  * Step 4 - Import Options
@@ -2808,12 +2836,21 @@
2808
  }*/
2809
 
2810
  .wpallexport-plugin .wpallexport-ready-to-go{
2811
- background: url("../img/elements.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0) !important;
2812
- float: left;
 
 
 
 
 
 
 
 
2813
  margin-left: 40px;
2814
  margin-top: 25px;
2815
  padding-left: 80px;
2816
- text-align: left;
 
2817
  }
2818
  .wpallexport-plugin .wpallexport-ready-to-go h3{
2819
  color: #425f9a;
@@ -2825,7 +2862,7 @@
2825
  .wpallexport-plugin .wpallexport-ready-to-go h4{
2826
  color: #777;
2827
  margin-top: 5px;
2828
- font-size:20px;
2829
  }
2830
  .wpallexport-plugin .nothing_to_export{
2831
  background: url("../img/exclamation.png") no-repeat scroll 5px 5px rgba(0, 0, 0, 0) !important;
@@ -3301,6 +3338,9 @@
3301
  border-collapse:collapse;
3302
  border-spacing:0;
3303
  }
 
 
 
3304
  /*@*/
3305
 
3306
  /*--------------------------------------------------------------------------
@@ -3515,12 +3555,6 @@
3515
  .wpallexport-plugin .wpallexport-wrapper{
3516
  width: 1020px;
3517
  }
3518
- /*.wpallexport-plugin a.wpallexport-import-from{
3519
- width: 300px;
3520
- }*/
3521
- .wpallexport-plugin .wpallexport-ready-to-go h4{
3522
- font-size: 18px;
3523
- }
3524
  .wpallexport-plugin .change_file .wpallexport-import-types h3{
3525
  font-size: 22px;
3526
  }
@@ -3544,9 +3578,6 @@
3544
  .wpallexport-plugin .wpallexport-is-continue{
3545
  margin: 12px 10px 12px 0;
3546
  }
3547
- .wpallexport-plugin .wpallexport-ready-to-go h3{
3548
- font-size: 18px;
3549
- }
3550
  .wpallexport-plugin .wpallexport-choose-import-direction[rel="new"]{
3551
  margin-left: -17%;
3552
  }
@@ -3571,15 +3602,13 @@
3571
  .wpallexport-plugin .wpallexport-upload-type-container{
3572
  padding: 0 40px;
3573
  }
 
3574
  .wpallexport-plugin .ajax-console .founded_records h4{
3575
  font-size: 18px;
3576
  }
3577
- .wpallexport-plugin #pmxi_add_rule{
3578
  padding: 13px 25px 10px 50px;
3579
  }
3580
- .wpallexport-plugin .wpallexport-ready-to-go h4{
3581
- font-size: 15px;
3582
- }
3583
  .wpallexport-plugin #process_notice,
3584
  .wpallexport-plugin #export_finished h3{
3585
  font-size: 16px;
@@ -3614,12 +3643,6 @@
3614
  .wpallexport-plugin .wpallexport-is-continue{
3615
  margin: 12px 10px 12px 0;
3616
  }
3617
- .wpallexport-plugin .wpallexport-ready-to-go h3{
3618
- font-size: 14px;
3619
- }
3620
- .wpallexport-plugin .wpallexport-ready-to-go h4{
3621
- font-size: 14px;
3622
- }
3623
  .wpallexport-plugin .wpallexport-choose-import-direction[rel="new"]{
3624
  margin-left: -17%;
3625
  }
@@ -3647,12 +3670,10 @@
3647
  .wpallexport-plugin .wpallexport-upload-type-container{
3648
  padding: 0 40px;
3649
  }
 
3650
  .wpallexport-plugin .ajax-console .founded_records h4{
3651
  font-size: 14px;
3652
- }
3653
- .wpallexport-plugin .wpallexport-ready-to-go h4{
3654
- font-size: 12px;
3655
- }
3656
  .wpallexport-plugin form.confirm input[type="submit"]{
3657
  padding: 20px 10px 20px 10px;
3658
  }
@@ -3696,14 +3717,10 @@
3696
  .wpallexport-plugin .wpallexport-is-continue{
3697
  margin: 12px 10px 12px 0;
3698
  }
3699
- .wpallexport-plugin .wpallexport-ready-to-go h3{
3700
- font-size: 11px;
3701
  line-height: 20px;
3702
  margin-top: 10px;
3703
- }
3704
- .wpallexport-plugin .wpallexport-ready-to-go h4{
3705
- font-size: 11px;
3706
- }
3707
  .wpallexport-plugin .wpallexport-choose-import-direction[rel="new"]{
3708
  margin-left: -17%;
3709
  }
@@ -3728,12 +3745,10 @@
3728
  .wpallexport-plugin .wpallexport-import-to{
3729
  width: 330px;
3730
  }
 
3731
  .wpallexport-plugin .ajax-console .founded_records h4{
3732
  font-size: 13px;
3733
- }
3734
- .wpallexport-plugin .wpallexport-ready-to-go h4{
3735
- font-size: 12px;
3736
- }
3737
  .wpallexport-plugin form.confirm input[type="submit"]{
3738
  padding: 20px 10px 20px 10px;
3739
  }
@@ -3784,20 +3799,16 @@
3784
  .wpallexport-plugin .wpallexport-existing-records{
3785
  font-size: 11px;
3786
  }
3787
- .wpallexport-plugin .wpallexport-ready-to-go{
3788
  padding-left: 70px;
3789
- }
3790
  .wpallexport-plugin .wpallexport-is-continue{
3791
  margin: 12px 10px 12px 0;
3792
  }
3793
- .wpallexport-plugin .wpallexport-ready-to-go h3{
3794
- font-size: 11px;
3795
  line-height: 20px;
3796
  margin-top: 10px;
3797
- }
3798
- .wpallexport-plugin .wpallexport-ready-to-go h4{
3799
- font-size: 11px;
3800
- }
3801
  .wpallexport-plugin .wpallexport-choose-import-direction[rel="new"]{
3802
  margin-left: -17%;
3803
  }
153
  }
154
  .wpallexport-plugin .wpallexport-user-export-notice,
155
  .wpallexport-plugin .wpallexport-shop_customer-export-notice,
156
+ .wpallexport-plugin .wpallexport-comments-export-notice,
157
+ .wpallexport-plugin .wpallexport-taxonomies-export-notice{
158
  padding: 20px;
159
  display: none;
160
  width: 558px;
474
  color: #000;
475
  font-weight: bold;
476
  }
477
+ .wpallexport-plugin .taxonomy_to_export_wrapper{
478
+ display: none;
479
+ }
480
+ .wpallexport-plugin .wp-all-export-advanced-field-options-content{
481
+ padding: 14px 0;
482
+ }
483
  /*--------------------------------------------------------------------------
484
  *
485
  * Basic rules
1069
  padding: 10px 0;
1070
  width: 100px;
1071
  }
1072
+ /*.wpallexport-plugin .wp-all-export-advanced-field-options-content{
1073
  display: none;
1074
+ }*/
1075
  /*--------------------------------------------------------------------------
1076
  *
1077
  * Fixes & Other Stuff
1585
  }
1586
  .wpallexport-plugin #custom_type_selector,
1587
  .wpallexport-plugin #file_selector,
1588
+ .wpallexport-plugin #wp_query_selector,
1589
+ .wpallexport-plugin #taxonomy_to_export{
1590
  margin: 0 auto;
1591
  margin-bottom: 20px;
1592
  text-align: left;
1605
  }
1606
  .wpallexport-plugin #custom_type_selector .dd-options li,
1607
  .wpallexport-plugin #file_selector .dd-options li,
1608
+ .wpallexport-plugin #wp_query_selector .dd-options li,
1609
+ .wpallexport-plugin #taxonomy_to_export .dd-options li{
1610
  margin-bottom: 0;
1611
  }
1612
  .wpallexport-plugin #custom_type_selector .dd-options li .dd-option,
1613
  .wpallexport-plugin #file_selector .dd-options li .dd-option,
1614
+ .wpallexport-plugin #wp_query_selector .dd-options li .dd-option,
1615
+ .wpallexport-plugin #taxonomy_to_export .dd-options li .dd-option{
1616
  font-size: 18px;
1617
  color: #555;
1618
  border: none;
1627
  .wpallexport-plugin #file_selector .dd-options li .dd-option:hover,
1628
  .wpallexport-plugin #file_selector .dd-options li .dd-option-selected,
1629
  .wpallexport-plugin #wp_query_selector .dd-options li .dd-option:hover,
1630
+ .wpallexport-plugin #wp_query_selector .dd-options li .dd-option-selected,
1631
+ .wpallexport-plugin #taxonomy_to_export .dd-options li .dd-option:hover,
1632
+ .wpallexport-plugin #taxonomy_to_export .dd-options li .dd-option-selected{
1633
  background: #eee;
1634
  color: #555;
1635
  }
1640
  }*/
1641
  .wpallexport-plugin #custom_type_selector .dd-select,
1642
  .wpallexport-plugin #file_selector .dd-select,
1643
+ .wpallexport-plugin #wp_query_selector .dd-select,
1644
+ .wpallexport-plugin #taxonomy_to_export .dd-select{
1645
  background: #fff !important;
1646
  padding: 10px 0;
1647
  /*margin-left: -5px;*/
1648
  }
1649
  .wpallexport-plugin #custom_type_selector .dd-selected,
1650
  .wpallexport-plugin #file_selector .dd-selected,
1651
+ .wpallexport-plugin #wp_query_selector .dd-selected,
1652
+ .wpallexport-plugin #taxonomy_to_export .dd-selected{
1653
  color: #000;
1654
  font-weight: normal;
1655
  font-size: 18px;
1658
  line-height: 24px;
1659
  }
1660
  .wpallexport-plugin .change_file #file_selector .dd-select,
1661
+ .wpallexport-plugin .change_file #wp_query_selector .dd-select,
1662
+ .wpallexport-plugin .change_file #taxonomy_to_export .dd-select{
1663
  padding: 5px 0 0;
1664
  }
1665
  .wpallexport-plugin .change_file #file_selector .dd-options .dd-option,
1666
+ .wpallexport-plugin .change_file #wp_query_selector .dd-options .dd-option,
1667
+ .wpallexport-plugin .change_file #taxonomy_to_export .dd-options .dd-option{
1668
  padding: 0 10px;
1669
  }
1670
  .wpallexport-plugin .dd-options{
1697
  }
1698
  .wpallexport-plugin #file_selector .dd-option .dashicon-product:before,
1699
  .wpallexport-plugin #file_selector .dd-selected .dashicon-product:before{
1700
+ font-family: "WooCommerce";
1701
+ content: "\e006";
1702
  color: #555;
1703
  margin-top: 0;
1704
  }
1721
  content: "\f333";
1722
  color: #555;
1723
  }
1724
+ .wpallexport-plugin #file_selector .dd-option .dashicon-users:before,
1725
+ .wpallexport-plugin #file_selector .dd-selected .dashicon-users:before{
1726
  font-family: "dashicons";
1727
  content: "\f110";
1728
  color: #555;
1733
  content: "\f101";
1734
  color: #555;
1735
  }
1736
+ .wpallexport-plugin #file_selector .dd-option .dashicon-taxonomies:before,
1737
+ .wpallexport-plugin #file_selector .dd-selected .dashicon-taxonomies:before{
1738
+ font-family: "dashicons";
1739
+ content: "\f318";
1740
+ color: #555;
1741
+ }
1742
  .wpallexport-plugin #file_selector .dd-option:hover .dashicon:before,
1743
  .wpallexport-plugin #file_selector .dd-option-selected .dashicon:before{
1744
  color: #555;
2681
  /*margin-top: 15px; */
2682
  }
2683
 
2684
+ .wpallexport-plugin .product_variations .sub-options {
2685
+ margin-left: 20px;
2686
+ }
2687
+
2688
+ .sub-options {
2689
+ display: none;
2690
+ }
2691
  /*--------------------------------------------------------------------------
2692
  *
2693
  * Step 4 - Import Options
2836
  }*/
2837
 
2838
  .wpallexport-plugin .wpallexport-ready-to-go{
2839
+ /*background: url("../img/elements.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0) !important;*/
2840
+ /*float: left;*/
2841
+ /*margin-left: 40px;*/
2842
+ /*margin-top: 25px;*/
2843
+ /*padding-left: 80px;*/
2844
+ /*text-align: left;*/
2845
+
2846
+ background: rgba(0, 0, 0, 0) url("../img/elements.png") no-repeat scroll 0 0 !important;
2847
+ height: 63px;
2848
+ margin-bottom: 20px;
2849
  margin-left: 40px;
2850
  margin-top: 25px;
2851
  padding-left: 80px;
2852
+ position: relative;
2853
+
2854
  }
2855
  .wpallexport-plugin .wpallexport-ready-to-go h3{
2856
  color: #425f9a;
2862
  .wpallexport-plugin .wpallexport-ready-to-go h4{
2863
  color: #777;
2864
  margin-top: 5px;
2865
+ font-size:18px;
2866
  }
2867
  .wpallexport-plugin .nothing_to_export{
2868
  background: url("../img/exclamation.png") no-repeat scroll 5px 5px rgba(0, 0, 0, 0) !important;
3338
  border-collapse:collapse;
3339
  border-spacing:0;
3340
  }
3341
+ .product_variations {
3342
+ display: none;
3343
+ }
3344
  /*@*/
3345
 
3346
  /*--------------------------------------------------------------------------
3555
  .wpallexport-plugin .wpallexport-wrapper{
3556
  width: 1020px;
3557
  }
 
 
 
 
 
 
3558
  .wpallexport-plugin .change_file .wpallexport-import-types h3{
3559
  font-size: 22px;
3560
  }
3578
  .wpallexport-plugin .wpallexport-is-continue{
3579
  margin: 12px 10px 12px 0;
3580
  }
 
 
 
3581
  .wpallexport-plugin .wpallexport-choose-import-direction[rel="new"]{
3582
  margin-left: -17%;
3583
  }
3602
  .wpallexport-plugin .wpallexport-upload-type-container{
3603
  padding: 0 40px;
3604
  }
3605
+ /* .wpallexport-plugin .wpallexport-ready-to-go h4,
3606
  .wpallexport-plugin .ajax-console .founded_records h4{
3607
  font-size: 18px;
3608
  }
3609
+ */ .wpallexport-plugin #pmxi_add_rule{
3610
  padding: 13px 25px 10px 50px;
3611
  }
 
 
 
3612
  .wpallexport-plugin #process_notice,
3613
  .wpallexport-plugin #export_finished h3{
3614
  font-size: 16px;
3643
  .wpallexport-plugin .wpallexport-is-continue{
3644
  margin: 12px 10px 12px 0;
3645
  }
 
 
 
 
 
 
3646
  .wpallexport-plugin .wpallexport-choose-import-direction[rel="new"]{
3647
  margin-left: -17%;
3648
  }
3670
  .wpallexport-plugin .wpallexport-upload-type-container{
3671
  padding: 0 40px;
3672
  }
3673
+ /* .wpallexport-plugin .wpallexport-ready-to-go h4,
3674
  .wpallexport-plugin .ajax-console .founded_records h4{
3675
  font-size: 14px;
3676
+ }*/
 
 
 
3677
  .wpallexport-plugin form.confirm input[type="submit"]{
3678
  padding: 20px 10px 20px 10px;
3679
  }
3717
  .wpallexport-plugin .wpallexport-is-continue{
3718
  margin: 12px 10px 12px 0;
3719
  }
3720
+ /* .wpallexport-plugin .wpallexport-ready-to-go h3{
 
3721
  line-height: 20px;
3722
  margin-top: 10px;
3723
+ }*/
 
 
 
3724
  .wpallexport-plugin .wpallexport-choose-import-direction[rel="new"]{
3725
  margin-left: -17%;
3726
  }
3745
  .wpallexport-plugin .wpallexport-import-to{
3746
  width: 330px;
3747
  }
3748
+ /* .wpallexport-plugin .wpallexport-ready-to-go h4,
3749
  .wpallexport-plugin .ajax-console .founded_records h4{
3750
  font-size: 13px;
3751
+ }*/
 
 
 
3752
  .wpallexport-plugin form.confirm input[type="submit"]{
3753
  padding: 20px 10px 20px 10px;
3754
  }
3799
  .wpallexport-plugin .wpallexport-existing-records{
3800
  font-size: 11px;
3801
  }
3802
+ /* .wpallexport-plugin .wpallexport-ready-to-go{
3803
  padding-left: 70px;
3804
+ }*/
3805
  .wpallexport-plugin .wpallexport-is-continue{
3806
  margin: 12px 10px 12px 0;
3807
  }
3808
+ /* .wpallexport-plugin .wpallexport-ready-to-go h3{
 
3809
  line-height: 20px;
3810
  margin-top: 10px;
3811
+ }*/
 
 
 
3812
  .wpallexport-plugin .wpallexport-choose-import-direction[rel="new"]{
3813
  margin-left: -17%;
3814
  }
static/img/bottom_arrow.png ADDED
Binary file
static/js/admin.js CHANGED
@@ -4,11 +4,29 @@
4
  (function($){$(function () {
5
 
6
  var vm = {
 
7
  'isWoocommerceOrderExport' : function(){
8
  return $('#woo_commerce_order').length;
9
- }
 
 
 
 
 
 
 
10
  };
11
 
 
 
 
 
 
 
 
 
 
 
12
  var helpers = {
13
  'sanitizeElementName' : function($elementName) {
14
  if($elementName.indexOf('(per tax)') !== false ){
@@ -119,6 +137,7 @@
119
  $(this).parents('form').find('input.switcher:radio[name="' + $(this).attr('name') + '"]').not(this).change();
120
  }
121
  var $switcherID = $(this).attr('id');
 
122
  var $targets = $('.switcher-target-' + $switcherID);
123
 
124
  var is_show = $(this).is(':checked'); if ($(this).is('.switcher-reversed')) is_show = ! is_show;
@@ -179,7 +198,9 @@
179
  $parent.find('hr').show();
180
  $parent.removeClass('closed');
181
  $parent.find('.wpallexport-collapsed-content:first').slideDown(400, function(){
182
- if ($('#wp_all_export_main_code').length) main_editor.setCursor(1);
 
 
183
  if ($('#wp_all_export_custom_xml_template').length){
184
  xml_editor.setCursor(1);
185
  }
@@ -217,7 +238,7 @@
217
 
218
  var missing_fields = ['id'];
219
 
220
- if ( $('#is_product_export').length ) missing_fields = missing_fields.concat(['_sku', 'product_type']);
221
  if ( $('#is_wp_query').length ) missing_fields.push('post_type');
222
 
223
  $('#columns').find('li:not(.placeholder)').each(function(i, e){
@@ -241,6 +262,12 @@
241
  missing_fields.splice(index, 1);
242
  }
243
  }
 
 
 
 
 
 
244
  if ($(this).find('input[name^=cc_label]').val() == 'post_type'){
245
  var index = missing_fields.indexOf('post_type');
246
  if (index > -1) {
@@ -279,7 +306,6 @@
279
  {
280
  $('.wp-all-export-warning').hide();
281
  }
282
-
283
  }
284
 
285
  // Get a valid filtering rules for selected field type
@@ -360,7 +386,7 @@
360
 
361
  var request = {
362
  action: 'wpae_filtering',
363
- data: {'cpt' : postType, 'export_type' : 'specific', 'filter_rules_hierarhy' : filter_rules_hierarhy, 'product_matching_mode' : 'strict'},
364
  security: wp_all_export_security
365
  };
366
 
@@ -435,7 +461,9 @@
435
  'is_confirm_screen' : $('.wpallexport-step-4').length,
436
  'is_template_screen' : $('.wpallexport-step-3').length,
437
  'export_only_new_stuff' : $('#export_only_new_stuff').is(':checked') ? 1 : 0,
438
- 'export_type' : $('input[name=export_type]').val()
 
 
439
  },
440
  security: wp_all_export_security
441
  };
@@ -449,6 +477,20 @@
449
  data: request,
450
  success: function(response) {
451
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
452
  $('.wp_all_export_filter_preloader').hide();
453
 
454
  $('#filtering_result').html(response.html);
@@ -458,7 +500,7 @@
458
  {
459
  $('.wpallexport-choose-file').find('.wpallexport-upload-resource-step-two').slideDown();
460
  $('.wpallexport-choose-file').find('.wpallexport-upload-resource-step-two').addClass('closed');
461
- $('.wpallexport-choose-file').find('.wpallexport-submit-buttons').show();
462
  }
463
  });
464
 
@@ -504,13 +546,14 @@
504
  if (response.found_records)
505
  {
506
  $('.founded_records').removeClass('nothing_to_export');
 
507
  }
508
  else
509
  {
510
  $('.founded_records').addClass('nothing_to_export');
 
511
  }
512
  }
513
-
514
  },
515
  error: function( jqXHR, textStatus ) {
516
 
@@ -567,6 +610,11 @@
567
  showImportType = false;
568
  $('.wpallexport-choose-file').find('.wpallexport-upload-resource-step-two').slideDown();
569
  }
 
 
 
 
 
570
  else
571
  {
572
  showImportType = true;
@@ -629,6 +677,7 @@
629
  $('.wpallexport-user-export-notice').hide();
630
  $('.wpallexport-comments-export-notice').hide();
631
  $('.wpallexport-shop_customer-export-notice').hide();
 
632
 
633
  if (selectedData.selectedData.value != ""){
634
 
@@ -641,33 +690,48 @@
641
  i++;
642
  });
643
 
644
- $('.wpallexport-choose-file').find('input[name=cpt]').val(postType);
645
 
646
- if (postType == 'users')
647
- {
648
- $('.wpallexport-user-export-notice').show();
649
- $('.wpallexport-choose-file').find('.wpallexport-submit-buttons').hide();
650
- }
651
- else if (postType == 'comments')
652
- {
653
- $('.wpallexport-comments-export-notice').show();
654
- $('.wpallexport-choose-file').find('.wpallexport-submit-buttons').hide();
655
- }
656
- else if (postType == 'shop_customer')
657
- {
658
- $('.wpallexport-shop_customer-export-notice').show();
659
- $('.wpallexport-choose-file').find('.wpallexport-submit-buttons').hide();
660
  }
661
- else
662
- {
663
- $('.wpallexport-choose-file').find('.wpallexport-submit-buttons').show();
664
- }
665
 
666
- filtering(postType);
667
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
668
  }
669
  else
670
  {
 
671
  $('.wpallexport-choose-file').find('input[name=cpt]').val('');
672
  $('#file_selector').find('.dd-selected').css({'color':'#cfceca'});
673
  $('.wpallexport-choose-file').find('.wpallexport-upload-resource-step-two').slideUp();
@@ -718,6 +782,7 @@
718
  $('.wpallexport-user-export-notice').hide();
719
  $('.wpallexport-comments-export-notice').hide();
720
  $('.wpallexport-shop_customer-export-notice').hide();
 
721
 
722
  $('.wpallexport-choose-file').find('.wpallexport-submit-buttons').hide();
723
 
@@ -751,7 +816,27 @@
751
  }
752
  }
753
  });
754
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
755
  });
756
  // [ \Step 1 ( chose & filter export data ) ]
757
 
@@ -1127,6 +1212,8 @@
1127
  {
1128
  // save post date field format
1129
  case 'date':
 
 
1130
  var $dateType = $addAnotherForm.find('select.date_field_export_data').val();
1131
  if ($dateType == 'unix')
1132
  $clone.find('input[name^=cc_settings]').val('unix');
@@ -1155,6 +1242,19 @@
1155
  break;
1156
  }
1157
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
1158
  default:
1159
  // save option for media images field types
1160
  if ( $clone.find('input[name^=cc_type]').val().indexOf('image_') !== -1 )
@@ -1269,8 +1369,35 @@
1269
  $addAnotherForm.find('.linked_field_type').show();
1270
  break;
1271
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1272
  break;
1273
  case 'date':
 
 
1274
  $addAnotherForm.find('select.date_field_export_data').find('option').each(function(){
1275
  if ($(this).val() == $settings || $settings != 'unix' && $(this).val() == 'php')
1276
  $(this).attr({'selected':'selected'}).click();
@@ -1388,6 +1515,8 @@
1388
  error: function( jqXHR, textStatus ) {
1389
  // Handle an eval error
1390
  if(jqXHR.responseText.indexOf('[[ERROR]]') !== -1) {
 
 
1391
  var json = jqXHR.responseText.split('[[ERROR]]')[1];
1392
  json = $.parseJSON(json);
1393
  ths.pointer({'content' : '<div id="post-preview" class="wpallexport-preview">' +
@@ -1661,13 +1790,15 @@
1661
  });
1662
  }
1663
 
1664
- if ( $('input[name=export_to]').val() == 'csv' && $('#export_to_sheet').val() == 'xls'){
1665
  $('.export_to_xls_upgrade_notice').show();
1666
  $('.wpallexport-submit-template').attr('disabled', 'disabled');
 
1667
  }
1668
  else{
1669
  $('.export_to_xls_upgrade_notice').hide();
1670
  $('.wpallexport-submit-template').removeAttr('disabled');
 
1671
  }
1672
 
1673
  $('.wpallexport-import-to-format').click(function(){
@@ -1689,25 +1820,27 @@
1689
 
1690
  $('input[name=export_to]').val('csv');
1691
 
1692
- if($('#export_to_sheet').val() === 'csv') {
1693
- if(!isWooCommerceOrder){
1694
- $('.export_to_csv').show();
1695
- $('.csv_delimiter').show();
1696
- } else {
1697
- $('.export_to_csv').show();
1698
- }
1699
- $('.export_to_xls_upgrade_notice').hide();
1700
- $('.wpallexport-submit-template').removeAttr('disabled');
1701
- } else {
1702
- if(isWooCommerceOrder){
1703
  $('.csv_delimiter').hide();
1704
  $('.export_to_csv').show();
1705
  } else {
1706
  $('.export_to_csv').hide();
1707
  }
1708
- $('.export_to_xls_upgrade_notice').show();
1709
  $('.wpallexport-submit-template').attr('disabled', 'disabled');
1710
- }
 
 
 
 
 
 
 
 
 
 
 
 
1711
  $('.custom_xml_upgrade_notice').hide();
1712
  }
1713
  else
@@ -1723,6 +1856,10 @@
1723
  if ( $xml_export_format == 'custom' || $xml_export_format == 'XmlGoogleMerchants'){
1724
  $('.wpallexport-submit-template').attr('disabled', 'disabled');
1725
  $('.custom_xml_upgrade_notice').show();
 
 
 
 
1726
  }
1727
  }
1728
  });
@@ -1945,9 +2082,11 @@
1945
  $('.pmxe_product_data').find(".wpallexport-xml-element:contains('Attributes')").parents('li:first').show();
1946
  $('.wpallexport-submit-template').removeAttr('disabled');
1947
  $('.custom_xml_upgrade_notice').hide();
 
1948
  break;
1949
  case 'custom':
1950
  case 'XmlGoogleMerchants':
 
1951
  $('.simple_xml_template_options').slideUp();
1952
  $('.wpallexport-simple-xml-template').slideUp();
1953
  if ( ! $('.wpallexport-file-options').hasClass('closed')) $('.wpallexport-file-options').find('.wpallexport-collapsed-header').click();
@@ -2048,25 +2187,28 @@
2048
 
2049
  // Logic to show CSV advanced options
2050
  $('#export_to_sheet').change(function(){
2051
-
2052
- //Todo: Cache this value in vm
2053
  var isWooCommerceOrder = vm.isWoocommerceOrderExport();
 
 
2054
  var value = $(this).val();
2055
- if(value === 'xls') {
2056
- if(isWooCommerceOrder) {
2057
  $('.csv_delimiter').hide();
2058
  } else {
2059
  $('.export_to_csv').slideUp();
2060
  }
2061
  $('.export_to_xls_upgrade_notice').show();
 
2062
  $('.wpallexport-submit-template').attr('disabled', 'disabled');
2063
  } else {
2064
- if(isWooCommerceOrder) {
2065
  $('.csv_delimiter').show();
2066
  } else {
2067
  $('.export_to_csv').slideDown();
2068
  }
2069
  $('.export_to_xls_upgrade_notice').hide();
 
2070
  $('.wpallexport-submit-template').removeAttr('disabled');
2071
  }
2072
  });
4
  (function($){$(function () {
5
 
6
  var vm = {
7
+ 'preiviewText' :'',
8
  'isWoocommerceOrderExport' : function(){
9
  return $('#woo_commerce_order').length;
10
+ },
11
+ 'isCSVExport': function(){
12
+ return $('input[name=export_to]').val() === 'csv';
13
+ },
14
+ 'isProductVariationsExport' : function() {
15
+ return this.hasVariations;
16
+ },
17
+ 'hasVariations' : false
18
  };
19
 
20
+ $('.export_variations').change(function(){
21
+ setTimeout(liveFiltering, 200);
22
+ });
23
+
24
+ $('.variations_disabled').click(function(){
25
+ $('#updateNotice').show();
26
+ $('html, body').animate({scrollTop: $("#updateNotice").offset().top - 50});
27
+ return false;
28
+ });
29
+
30
  var helpers = {
31
  'sanitizeElementName' : function($elementName) {
32
  if($elementName.indexOf('(per tax)') !== false ){
137
  $(this).parents('form').find('input.switcher:radio[name="' + $(this).attr('name') + '"]').not(this).change();
138
  }
139
  var $switcherID = $(this).attr('id');
140
+
141
  var $targets = $('.switcher-target-' + $switcherID);
142
 
143
  var is_show = $(this).is(':checked'); if ($(this).is('.switcher-reversed')) is_show = ! is_show;
198
  $parent.find('hr').show();
199
  $parent.removeClass('closed');
200
  $parent.find('.wpallexport-collapsed-content:first').slideDown(400, function(){
201
+ if ($('#wp_all_export_main_code').length) {
202
+ main_editor.setCursor(1);
203
+ }
204
  if ($('#wp_all_export_custom_xml_template').length){
205
  xml_editor.setCursor(1);
206
  }
238
 
239
  var missing_fields = ['id'];
240
 
241
+ if ( $('#is_product_export').length ) missing_fields = missing_fields.concat(['_sku', 'product_type', 'parent']);
242
  if ( $('#is_wp_query').length ) missing_fields.push('post_type');
243
 
244
  $('#columns').find('li:not(.placeholder)').each(function(i, e){
262
  missing_fields.splice(index, 1);
263
  }
264
  }
265
+ if ($(this).find('input[name^=cc_label]').val() == 'parent'){
266
+ var index = missing_fields.indexOf('parent');
267
+ if (index > -1) {
268
+ missing_fields.splice(index, 1);
269
+ }
270
+ }
271
  if ($(this).find('input[name^=cc_label]').val() == 'post_type'){
272
  var index = missing_fields.indexOf('post_type');
273
  if (index > -1) {
306
  {
307
  $('.wp-all-export-warning').hide();
308
  }
 
309
  }
310
 
311
  // Get a valid filtering rules for selected field type
386
 
387
  var request = {
388
  action: 'wpae_filtering',
389
+ data: {'cpt' : postType, 'export_type' : 'specific', 'filter_rules_hierarhy' : filter_rules_hierarhy, 'product_matching_mode' : 'strict', 'taxonomy_to_export' : $('input[name=taxonomy_to_export]').val()},
390
  security: wp_all_export_security
391
  };
392
 
461
  'is_confirm_screen' : $('.wpallexport-step-4').length,
462
  'is_template_screen' : $('.wpallexport-step-3').length,
463
  'export_only_new_stuff' : $('#export_only_new_stuff').is(':checked') ? 1 : 0,
464
+ 'export_type' : $('input[name=export_type]').val(),
465
+ 'taxonomy_to_export' : $('input[name=taxonomy_to_export]').val(),
466
+ 'export_variations' : $('#export_variations').val()
467
  },
468
  security: wp_all_export_security
469
  };
477
  data: request,
478
  success: function(response) {
479
 
480
+ vm.hasVariations = response.hasVariations;
481
+ if(vm.hasVariations) {
482
+
483
+ if($('#export_to_sheet').val() == 'xls' || $('#export_to_sheet').val() == 'xlsx') {
484
+ $('.csv_delimiter').hide();
485
+ $('.export_to_csv').slideDown();
486
+ }
487
+
488
+ $('.product_variations').show();
489
+
490
+ } else {
491
+ $('.product_variations').hide();
492
+ }
493
+
494
  $('.wp_all_export_filter_preloader').hide();
495
 
496
  $('#filtering_result').html(response.html);
500
  {
501
  $('.wpallexport-choose-file').find('.wpallexport-upload-resource-step-two').slideDown();
502
  $('.wpallexport-choose-file').find('.wpallexport-upload-resource-step-two').addClass('closed');
503
+ if (response.found_records) $('.wpallexport-choose-file').find('.wpallexport-submit-buttons').show();
504
  }
505
  });
506
 
546
  if (response.found_records)
547
  {
548
  $('.founded_records').removeClass('nothing_to_export');
549
+ $('.wpallexport-choose-file').find('.wpallexport-submit-buttons').show();
550
  }
551
  else
552
  {
553
  $('.founded_records').addClass('nothing_to_export');
554
+ $('.wpallexport-choose-file').find('.wpallexport-submit-buttons').hide();
555
  }
556
  }
 
557
  },
558
  error: function( jqXHR, textStatus ) {
559
 
610
  showImportType = false;
611
  $('.wpallexport-choose-file').find('.wpallexport-upload-resource-step-two').slideDown();
612
  }
613
+ else if (postType == 'taxonomies'){
614
+ showImportType = false;
615
+ $('.taxonomy_to_export_wrapper').slideDown();
616
+ $('.wpallexport-choose-file').find('.wpallexport-upload-resource-step-two').slideDown();
617
+ }
618
  else
619
  {
620
  showImportType = true;
677
  $('.wpallexport-user-export-notice').hide();
678
  $('.wpallexport-comments-export-notice').hide();
679
  $('.wpallexport-shop_customer-export-notice').hide();
680
+ $('.wpallexport-taxonomies-export-notice').hide();
681
 
682
  if (selectedData.selectedData.value != ""){
683
 
690
  i++;
691
  });
692
 
693
+ $('.wpallexport-choose-file').find('input[name=cpt]').val(postType);
694
 
695
+ if (postType == 'taxonomies'){
696
+ $('.taxonomy_to_export_wrapper').slideDown();
697
+ if ($('input[name=taxonomy_to_export]').val() != ''){
698
+ filtering(postType);
699
+ }
700
+ else{
701
+ $('.wpallexport-choose-file').find('.wpallexport-filtering-wrapper').slideUp();
702
+ $('.wpallexport-choose-file').find('.wpallexport-upload-resource-step-two').slideUp();
703
+ }
704
+ $('.wpallexport-choose-file').find('.wpallexport-submit-buttons').hide();
 
 
 
 
705
  }
706
+ else{
707
+ $('.taxonomy_to_export_wrapper').slideUp();
 
 
708
 
709
+ if (postType == 'users')
710
+ {
711
+ $('.wpallexport-user-export-notice').show();
712
+ $('.wpallexport-choose-file').find('.wpallexport-submit-buttons').hide();
713
+ }
714
+ else if (postType == 'comments')
715
+ {
716
+ $('.wpallexport-comments-export-notice').show();
717
+ $('.wpallexport-choose-file').find('.wpallexport-submit-buttons').hide();
718
+ }
719
+ else if (postType == 'shop_customer')
720
+ {
721
+ $('.wpallexport-shop_customer-export-notice').show();
722
+ $('.wpallexport-choose-file').find('.wpallexport-submit-buttons').hide();
723
+ }
724
+ else
725
+ {
726
+ $('.wpallexport-choose-file').find('.wpallexport-submit-buttons').show();
727
+ }
728
+
729
+ filtering(postType);
730
+ }
731
  }
732
  else
733
  {
734
+ $('.taxonomy_to_export_wrapper').slideUp();
735
  $('.wpallexport-choose-file').find('input[name=cpt]').val('');
736
  $('#file_selector').find('.dd-selected').css({'color':'#cfceca'});
737
  $('.wpallexport-choose-file').find('.wpallexport-upload-resource-step-two').slideUp();
782
  $('.wpallexport-user-export-notice').hide();
783
  $('.wpallexport-comments-export-notice').hide();
784
  $('.wpallexport-shop_customer-export-notice').hide();
785
+ $('.wpallexport-taxonomies-export-notice').hide();
786
 
787
  $('.wpallexport-choose-file').find('.wpallexport-submit-buttons').hide();
788
 
816
  }
817
  }
818
  });
819
+ // Taxonomies Export
820
+ $('#taxonomy_to_export').ddslick({
821
+ width: 600,
822
+ onSelected: function(selectedData){
823
+
824
+ if (selectedData.selectedData.value != ""){
825
+
826
+ $('#taxonomy_to_export').find('.dd-selected').css({'color':'#555'});
827
+ $('input[name=taxonomy_to_export]').val(selectedData.selectedData.value);
828
+ filtering($('input[name=cpt]').val());
829
+ $('.wpallexport-taxonomies-export-notice').show();
830
+ $('.wpallexport-choose-file').find('.wpallexport-submit-buttons').hide();
831
+ }
832
+ else{
833
+ $('#taxonomy_to_export').find('.dd-selected').css({'color':'#cfceca'});
834
+ $('.wpallexport-choose-file').find('.wpallexport-filtering-wrapper').slideUp();
835
+ $('.wpallexport-choose-file').find('.wpallexport-upload-resource-step-two').slideUp();
836
+ $('.wpallexport-choose-file').find('.wpallexport-submit-buttons').hide();
837
+ }
838
+ }
839
+ });
840
  });
841
  // [ \Step 1 ( chose & filter export data ) ]
842
 
1212
  {
1213
  // save post date field format
1214
  case 'date':
1215
+ case 'comment_date':
1216
+ case 'user_registered':
1217
  var $dateType = $addAnotherForm.find('select.date_field_export_data').val();
1218
  if ($dateType == 'unix')
1219
  $clone.find('input[name^=cc_settings]').val('unix');
1242
  break;
1243
  }
1244
  break;
1245
+ case 'woo_order':
1246
+ $woo_type = $clone.find('input[name^=cc_value]');
1247
+ switch ($woo_type.val()) {
1248
+ case 'post_date':
1249
+ case '_completed_date':
1250
+ var $dateType = $addAnotherForm.find('select.date_field_export_data').val();
1251
+ if ($dateType == 'unix')
1252
+ $clone.find('input[name^=cc_settings]').val('unix');
1253
+ else
1254
+ $clone.find('input[name^=cc_settings]').val($('.pmxe_date_format').val());
1255
+ break;
1256
+ }
1257
+ break;
1258
  default:
1259
  // save option for media images field types
1260
  if ( $clone.find('input[name^=cc_type]').val().indexOf('image_') !== -1 )
1369
  $addAnotherForm.find('.linked_field_type').show();
1370
  break;
1371
  }
1372
+ break;
1373
+ case 'woo_order':
1374
+ $woo_type = $(this).find('input[name^=cc_value]');
1375
+ switch ($woo_type.val())
1376
+ {
1377
+ case 'post_date':
1378
+ case '_completed_date':
1379
+
1380
+ $addAnotherForm.find('select.date_field_export_data').find('option').each(function(){
1381
+ if ($(this).val() == $settings || $settings != 'unix' && $(this).val() == 'php')
1382
+ $(this).attr({'selected':'selected'}).click();
1383
+ else
1384
+ $(this).removeAttr('selected');
1385
+ });
1386
+
1387
+ if ($settings != 'php' && $settings != 'unix'){
1388
+ if ($settings != '0') $('.pmxe_date_format').val($settings); else $('.pmxe_date_format').val('');
1389
+ $('.pmxe_date_format_wrapper').show();
1390
+ }
1391
+ else{
1392
+ $('.pmxe_date_format').val('');
1393
+ }
1394
+ $addAnotherForm.find('.date_field_type').show();
1395
+ break;
1396
+ }
1397
  break;
1398
  case 'date':
1399
+ case 'comment_date':
1400
+ case 'user_registered':
1401
  $addAnotherForm.find('select.date_field_export_data').find('option').each(function(){
1402
  if ($(this).val() == $settings || $settings != 'unix' && $(this).val() == 'php')
1403
  $(this).attr({'selected':'selected'}).click();
1515
  error: function( jqXHR, textStatus ) {
1516
  // Handle an eval error
1517
  if(jqXHR.responseText.indexOf('[[ERROR]]') !== -1) {
1518
+ vm.preiviewText = $('.wpallexport-preview-title').text();
1519
+ console.log(vm.preiviewText);
1520
  var json = jqXHR.responseText.split('[[ERROR]]')[1];
1521
  json = $.parseJSON(json);
1522
  ths.pointer({'content' : '<div id="post-preview" class="wpallexport-preview">' +
1790
  });
1791
  }
1792
 
1793
+ if ( $('input[name=export_to]').val() == 'csv' && $('#export_to_sheet').val() == 'xls' && $('#export_to_sheet').val() == 'xlsx'){
1794
  $('.export_to_xls_upgrade_notice').show();
1795
  $('.wpallexport-submit-template').attr('disabled', 'disabled');
1796
+ $('.wpallexport-submit-buttons').hide();
1797
  }
1798
  else{
1799
  $('.export_to_xls_upgrade_notice').hide();
1800
  $('.wpallexport-submit-template').removeAttr('disabled');
1801
+ $('.wpallexport-submit-buttons').show();
1802
  }
1803
 
1804
  $('.wpallexport-import-to-format').click(function(){
1820
 
1821
  $('input[name=export_to]').val('csv');
1822
 
1823
+ if ($('#export_to_sheet').val() !== 'csv') {
1824
+ if (isWooCommerceOrder || vm.isProductVariationsExport()) {
 
 
 
 
 
 
 
 
 
1825
  $('.csv_delimiter').hide();
1826
  $('.export_to_csv').show();
1827
  } else {
1828
  $('.export_to_csv').hide();
1829
  }
 
1830
  $('.wpallexport-submit-template').attr('disabled', 'disabled');
1831
+ $('.wpallexport-submit-buttons').hide();
1832
+ } else {
1833
+ /** isProductVariationsExport */
1834
+ if (isWooCommerceOrder) {
1835
+ $('.export_to_csv').show();
1836
+ } else {
1837
+ $('.export_to_csv').show();
1838
+ $('.csv_delimiter').show();
1839
+ }
1840
+ $('.wpallexport-submit-template').removeAttr('disabled');
1841
+ $('.wpallexport-submit-buttons').show();
1842
+ }
1843
+
1844
  $('.custom_xml_upgrade_notice').hide();
1845
  }
1846
  else
1856
  if ( $xml_export_format == 'custom' || $xml_export_format == 'XmlGoogleMerchants'){
1857
  $('.wpallexport-submit-template').attr('disabled', 'disabled');
1858
  $('.custom_xml_upgrade_notice').show();
1859
+ $('.wpallexport-submit-buttons').hide();
1860
+ }
1861
+ else{
1862
+ $('.wpallexport-submit-buttons').show();
1863
  }
1864
  }
1865
  });
2082
  $('.pmxe_product_data').find(".wpallexport-xml-element:contains('Attributes')").parents('li:first').show();
2083
  $('.wpallexport-submit-template').removeAttr('disabled');
2084
  $('.custom_xml_upgrade_notice').hide();
2085
+ $('.wpallexport-submit-buttons').show();
2086
  break;
2087
  case 'custom':
2088
  case 'XmlGoogleMerchants':
2089
+ $('.wpallexport-submit-buttons').hide();
2090
  $('.simple_xml_template_options').slideUp();
2091
  $('.wpallexport-simple-xml-template').slideUp();
2092
  if ( ! $('.wpallexport-file-options').hasClass('closed')) $('.wpallexport-file-options').find('.wpallexport-collapsed-header').click();
2187
 
2188
  // Logic to show CSV advanced options
2189
  $('#export_to_sheet').change(function(){
2190
+
 
2191
  var isWooCommerceOrder = vm.isWoocommerceOrderExport();
2192
+ var isVariationsExport = vm.isProductVariationsExport();
2193
+
2194
  var value = $(this).val();
2195
+ if(value === 'xls' || value === 'xlsx') {
2196
+ if(isWooCommerceOrder || isVariationsExport) {
2197
  $('.csv_delimiter').hide();
2198
  } else {
2199
  $('.export_to_csv').slideUp();
2200
  }
2201
  $('.export_to_xls_upgrade_notice').show();
2202
+ $('.wpallexport-submit-buttons').hide();
2203
  $('.wpallexport-submit-template').attr('disabled', 'disabled');
2204
  } else {
2205
+ if(isWooCommerceOrder || isVariationsExport) {
2206
  $('.csv_delimiter').show();
2207
  } else {
2208
  $('.export_to_csv').slideDown();
2209
  }
2210
  $('.export_to_xls_upgrade_notice').hide();
2211
+ $('.wpallexport-submit-buttons').show();
2212
  $('.wpallexport-submit-template').removeAttr('disabled');
2213
  }
2214
  });
views/admin/export/index.php CHANGED
@@ -50,17 +50,53 @@
50
  if (in_array($key, array('attachment', 'revision', 'nav_menu_item', 'import_users', 'shop_webhook', 'acf-field', 'acf-field-group'))) unset($custom_types[$key]);
51
  }
52
  $custom_types = apply_filters( 'wpallexport_custom_types', $custom_types );
53
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  <select id="file_selector">
56
  <option value=""><?php _e('Choose a post type...', 'wp_all_export_plugin'); ?></option>
57
- <?php if (count($custom_types)): $unknown_cpt = array();?>
58
- <?php foreach ($custom_types as $key => $ct):?>
59
  <?php
60
  $image_src = 'dashicon-cpt';
61
  $cpt_label = $ct->labels->name;
62
 
63
- if ( in_array($key, array('post', 'page', 'product', 'import_users', 'shop_order', 'shop_coupon', 'shop_customer') ) )
64
  {
65
  $image_src = 'dashicon-' . $key;
66
  }
@@ -69,12 +105,11 @@
69
  $unknown_cpt[$key] = $ct;
70
  continue;
71
  }
 
72
  ?>
73
  <option value="<?php echo $key;?>" data-imagesrc="dashicon <?php echo $image_src; ?>" <?php if ($key == $post['cpt']) echo 'selected="selected"'; ?>><?php echo $cpt_label; ?></option>
74
  <?php endforeach ?>
75
- <?php endif ?>
76
- <option value="users" data-imagesrc="dashicon dashicon-import_users" <?php if ('users' == $post['cpt']) echo 'selected="selected"'; ?>><?php _e("Users", "wp_all_export_plugin"); ?></option>
77
- <option value="comments" data-imagesrc="dashicon dashicon-comments" <?php if ('comments' == $post['cpt']) echo 'selected="selected"'; ?>><?php _e("Comments", "wp_all_export_plugin"); ?></option>
78
  <?php if ( ! empty($unknown_cpt)): ?>
79
  <?php foreach ($unknown_cpt as $key => $ct):?>
80
  <?php
@@ -86,20 +121,32 @@
86
  <?php endif;?>
87
  </select>
88
  <input type="hidden" name="cpt" value="<?php echo $post['cpt']; ?>"/>
89
-
90
- </div>
91
-
92
- <div class="wpallexport-free-edition-notice wpallexport-user-export-notice">
93
- <a class="upgrade_link" target="_blank" href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=118611&edd_options%5Bprice_id%5D=1&utm_source=wordpress.org&utm_medium=export-users&utm_campaign=free+wp+all+export+plugin"><?php _e('Upgrade to the Pro edition of WP All Export to Export Users','wp_all_export_plugin');?></a>
94
- <p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_export_plugin'); ?></p>
95
- </div>
96
- <div class="wpallexport-free-edition-notice wpallexport-shop_customer-export-notice">
97
- <a class="upgrade_link" target="_blank" href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=118611&edd_options%5Bprice_id%5D=1&utm_source=wordpress.org&utm_medium=export-users&utm_campaign=free+wp+all+export+plugin"><?php _e('Upgrade to the Pro edition of WP All Export to Export Customers','wp_all_export_plugin');?></a>
98
- <p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_export_plugin'); ?></p>
99
- </div>
100
- <div class="wpallexport-free-edition-notice wpallexport-comments-export-notice">
101
- <a class="upgrade_link" target="_blank" href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=118611&edd_options%5Bprice_id%5D=1&utm_source=wordpress.org&utm_medium=export-users&utm_campaign=free+wp+all+export+plugin"><?php _e('Upgrade to the Pro edition of WP All Export to Export Comments','wp_all_export_plugin');?></a>
102
- <p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_export_plugin'); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
103
  </div>
104
  </div>
105
 
@@ -109,7 +156,14 @@
109
  <select id="wp_query_selector">
110
  <option value="wp_query" <?php if ('wp_query' == $post['wp_query_selector']) echo 'selected="selected"'; ?>><?php _e('Post Type Query', 'wp_all_export_plugin'); ?></option>
111
  <option value="wp_user_query" <?php if ('wp_user_query' == $post['wp_query_selector']) echo 'selected="selected"'; ?>><?php _e('User Query', 'wp_all_export_plugin'); ?></option>
 
 
 
 
112
  <option value="wp_comment_query" <?php if ('wp_comment_query' == $post['wp_query_selector']) echo 'selected="selected"'; ?>><?php _e('Comment Query', 'wp_all_export_plugin'); ?></option>
 
 
 
113
  </select>
114
 
115
  <div class="wpallexport-free-edition-notice wpallexport-user-export-notice" style="margin-bottom: 20px;">
@@ -158,9 +212,9 @@
158
 
159
  <table><tr><td class="wpallexport-note"></td></tr></table>
160
  </form>
161
-
162
  <a href="http://soflyy.com/" target="_blank" class="wpallexport-created-by"><?php _e('Created by', 'wp_all_export_plugin'); ?> <span></span></a>
163
-
164
  </div>
165
  </td>
166
  </tr>
50
  if (in_array($key, array('attachment', 'revision', 'nav_menu_item', 'import_users', 'shop_webhook', 'acf-field', 'acf-field-group'))) unset($custom_types[$key]);
51
  }
52
  $custom_types = apply_filters( 'wpallexport_custom_types', $custom_types );
53
+ global $wp_version;
54
+ $sorted_cpt = array();
55
+ foreach ($custom_types as $key => $cpt){
56
+
57
+ $sorted_cpt[$key] = $cpt;
58
+
59
+ // Put users & comments & taxonomies after Pages
60
+ if ( ! empty($custom_types['page']) && $key == 'page' || empty($custom_types['page']) && $key == 'post' ){
61
+
62
+ $sorted_cpt['taxonomies'] = new stdClass();
63
+ $sorted_cpt['taxonomies']->labels = new stdClass();
64
+ $sorted_cpt['taxonomies']->labels->name = __('Taxonomies','wp_all_export_plugin');
65
+
66
+ $sorted_cpt['comments'] = new stdClass();
67
+ $sorted_cpt['comments']->labels = new stdClass();
68
+ $sorted_cpt['comments']->labels->name = __('Comments','wp_all_export_plugin');
69
+
70
+ $sorted_cpt['users'] = new stdClass();
71
+ $sorted_cpt['users']->labels = new stdClass();
72
+ $sorted_cpt['users']->labels->name = __('Users','wp_all_export_plugin');
73
+ break;
74
+ }
75
+ }
76
+ $order = array('shop_order', 'shop_coupon', 'shop_customer', 'product');
77
+ foreach ($order as $cpt){
78
+ if (!empty($custom_types[$cpt])) $sorted_cpt[$cpt] = $custom_types[$cpt];
79
+ }
80
+
81
+ uasort($custom_types, "wp_all_export_cmp_custom_types");
82
+
83
+ foreach ($custom_types as $key => $cpt) {
84
+ if (empty($sorted_cpt[$key])){
85
+ $sorted_cpt[$key] = $cpt;
86
+ }
87
+ }
88
+
89
+ ?>
90
 
91
  <select id="file_selector">
92
  <option value=""><?php _e('Choose a post type...', 'wp_all_export_plugin'); ?></option>
93
+ <?php if (count($sorted_cpt)): $unknown_cpt = array(); ?>
94
+ <?php foreach ($sorted_cpt as $key => $ct):?>
95
  <?php
96
  $image_src = 'dashicon-cpt';
97
  $cpt_label = $ct->labels->name;
98
 
99
+ if ( in_array($key, array('post', 'page', 'product', 'import_users', 'shop_order', 'shop_coupon', 'shop_customer', 'users', 'comments', 'taxonomies') ) )
100
  {
101
  $image_src = 'dashicon-' . $key;
102
  }
105
  $unknown_cpt[$key] = $ct;
106
  continue;
107
  }
108
+
109
  ?>
110
  <option value="<?php echo $key;?>" data-imagesrc="dashicon <?php echo $image_src; ?>" <?php if ($key == $post['cpt']) echo 'selected="selected"'; ?>><?php echo $cpt_label; ?></option>
111
  <?php endforeach ?>
112
+ <?php endif ?>
 
 
113
  <?php if ( ! empty($unknown_cpt)): ?>
114
  <?php foreach ($unknown_cpt as $key => $ct):?>
115
  <?php
121
  <?php endif;?>
122
  </select>
123
  <input type="hidden" name="cpt" value="<?php echo $post['cpt']; ?>"/>
124
+ <div class="taxonomy_to_export_wrapper">
125
+ <input type="hidden" name="taxonomy_to_export" value="<?php echo $post['taxonomy_to_export'];?>">
126
+ <select id="taxonomy_to_export">
127
+ <option value=""><?php _e('Select taxonomy', 'wp_all_export_plugin'); ?></option>
128
+ <?php $options = wp_all_export_get_taxonomies(); ?>
129
+ <?php foreach ($options as $slug => $name):?>
130
+ <option value="<?php echo $slug;?>" <?php if ($post['taxonomy_to_export'] == $slug):?>selected="selected"<?php endif;?>><?php echo $name;?></option>
131
+ <?php endforeach;?>
132
+ </select>
133
+ </div>
134
+ <div class="wpallexport-free-edition-notice wpallexport-user-export-notice">
135
+ <a class="upgrade_link" target="_blank" href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=118611&edd_options%5Bprice_id%5D=1&utm_source=wordpress.org&utm_medium=export-users&utm_campaign=free+wp+all+export+plugin"><?php _e('Upgrade to the Pro edition of WP All Export to Export Users','wp_all_export_plugin');?></a>
136
+ <p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_export_plugin'); ?></p>
137
+ </div>
138
+ <div class="wpallexport-free-edition-notice wpallexport-shop_customer-export-notice">
139
+ <a class="upgrade_link" target="_blank" href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=118611&edd_options%5Bprice_id%5D=1&utm_source=wordpress.org&utm_medium=export-users&utm_campaign=free+wp+all+export+plugin"><?php _e('Upgrade to the Pro edition of WP All Export to Export Customers','wp_all_export_plugin');?></a>
140
+ <p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_export_plugin'); ?></p>
141
+ </div>
142
+ <div class="wpallexport-free-edition-notice wpallexport-comments-export-notice">
143
+ <a class="upgrade_link" target="_blank" href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=118611&edd_options%5Bprice_id%5D=1&utm_source=wordpress.org&utm_medium=export-users&utm_campaign=free+wp+all+export+plugin"><?php _e('Upgrade to the Pro edition of WP All Export to Export Comments','wp_all_export_plugin');?></a>
144
+ <p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_export_plugin'); ?></p>
145
+ </div>
146
+ <div class="wpallexport-free-edition-notice wpallexport-taxonomies-export-notice">
147
+ <a class="upgrade_link" target="_blank" href="http://www.wpallimport.com/order-now/export/?utm_source=wordpress.org&utm_campaign=free%2Bwp%2Ball%2Bexport%2Bplugin&utm_medium=taxonomies"><?php _e('Upgrade to the Pro edition of WP All Export to Export Taxonomies','wp_all_export_plugin');?></a>
148
+ <p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_export_plugin'); ?></p>
149
+ </div>
150
  </div>
151
  </div>
152
 
156
  <select id="wp_query_selector">
157
  <option value="wp_query" <?php if ('wp_query' == $post['wp_query_selector']) echo 'selected="selected"'; ?>><?php _e('Post Type Query', 'wp_all_export_plugin'); ?></option>
158
  <option value="wp_user_query" <?php if ('wp_user_query' == $post['wp_query_selector']) echo 'selected="selected"'; ?>><?php _e('User Query', 'wp_all_export_plugin'); ?></option>
159
+ <?php
160
+ global $wp_version;
161
+ if ( version_compare($wp_version, '4.2.0', '>=') ):
162
+ ?>
163
  <option value="wp_comment_query" <?php if ('wp_comment_query' == $post['wp_query_selector']) echo 'selected="selected"'; ?>><?php _e('Comment Query', 'wp_all_export_plugin'); ?></option>
164
+ <?php
165
+ endif;
166
+ ?>
167
  </select>
168
 
169
  <div class="wpallexport-free-edition-notice wpallexport-user-export-notice" style="margin-bottom: 20px;">
212
 
213
  <table><tr><td class="wpallexport-note"></td></tr></table>
214
  </form>
215
+
216
  <a href="http://soflyy.com/" target="_blank" class="wpallexport-created-by"><?php _e('Created by', 'wp_all_export_plugin'); ?> <span></span></a>
217
+
218
  </div>
219
  </td>
220
  </tr>
views/admin/export/options.php CHANGED
@@ -41,12 +41,8 @@
41
 
42
  <div class="wpallexport-content-section" style="padding: 0 30px 0 0; overflow: hidden; margin-bottom: 0;">
43
 
44
- <div id="filtering_result" class="wpallexport-ready-to-go <?php if (empty(PMXE_Plugin::$session->found_posts)):?>nothing_to_export<?php endif;?>">
45
- <?php if (empty(PMXE_Plugin::$session->found_posts)):?>
46
- <h3><?php _e('Nothing to export.', 'wp_all_export_plugin'); ?></h3>
47
- <?php else: ?>
48
- <h3><?php _e('Your export is ready to run.', 'wp_all_export_plugin'); ?></h3>
49
- <?php endif; ?>
50
  <div class="wp_all_export_preloader"></div>
51
  </div>
52
  <?php if ($this->isWizard): ?>
@@ -80,6 +76,8 @@
80
 
81
  <input type="hidden" name="selected_post_type" value="<?php echo $selected_post_type; ?>"/>
82
  <input type="hidden" name="export_type" value="<?php echo $post['export_type']; ?>"/>
 
 
83
 
84
  <?php XmlExportFiltering::render_filtering_block( $engine, $this->isWizard, $post ); ?>
85
 
41
 
42
  <div class="wpallexport-content-section" style="padding: 0 30px 0 0; overflow: hidden; margin-bottom: 0;">
43
 
44
+ <div id="filtering_result" class="wpallexport-ready-to-go">
45
+ <h3> &nbsp; </h3>
 
 
 
 
46
  <div class="wp_all_export_preloader"></div>
47
  </div>
48
  <?php if ($this->isWizard): ?>
76
 
77
  <input type="hidden" name="selected_post_type" value="<?php echo $selected_post_type; ?>"/>
78
  <input type="hidden" name="export_type" value="<?php echo $post['export_type']; ?>"/>
79
+ <input type="hidden" name="taxonomy_to_export" value="<?php echo $post['taxonomy_to_export'];?>">
80
+ <input type="hidden" id="export_variations" name="export_variations" value="<?php echo XmlExportEngine::getProductVariationMode();?>" />
81
 
82
  <?php XmlExportFiltering::render_filtering_block( $engine, $this->isWizard, $post ); ?>
83
 
views/admin/export/template.php CHANGED
@@ -8,7 +8,10 @@
8
  <h2><?php _e('Export to XML / CSV', 'wp_all_export_plugin'); ?></h2>
9
  </div>
10
  <div class="wpallexport-links">
11
- <a href="http://www.wpallimport.com/support/" target="_blank"><?php _e('Support', 'wp_all_export_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/" target="_blank"><?php _e('Documentation', 'wp_all_export_plugin'); ?></a>
 
 
 
12
  </div>
13
  </div>
14
  <div class="clear"></div>
@@ -40,6 +43,7 @@
40
  <form class="wpallexport-template <?php echo ! $this->isWizard ? 'edit' : '' ?> wpallexport-step-3" method="post" style="display:none;">
41
 
42
  <input type="hidden" class="hierarhy-output" name="filter_rules_hierarhy" value="<?php echo esc_html($post['filter_rules_hierarhy']);?>"/>
 
43
 
44
  <?php
45
  $selected_post_type = '';
@@ -57,7 +61,13 @@
57
 
58
  <input type="hidden" name="selected_post_type" value="<?php echo $selected_post_type; ?>"/>
59
  <input type="hidden" name="export_type" value="<?php echo $post['export_type']; ?>"/>
60
-
 
 
 
 
 
 
61
  <div class="wpallexport-collapsed wpallexport-section wpallexport-simple-xml-template">
62
  <div class="wpallexport-content-section" style="margin-bottom: 10px;">
63
  <div class="wpallexport-collapsed-content">
@@ -91,7 +101,7 @@
91
  <input type="hidden" name="cc_type[]" value="<?php echo $field_type; ?>"/>
92
  <input type="hidden" name="cc_options[]" value="<?php echo (!empty($field_options)) ? $field_options : 0; ?>"/>
93
  <input type="hidden" name="cc_value[]" value="<?php echo esc_attr($post['cc_value'][$ID]); ?>"/>
94
- <input type="hidden" name="cc_name[]" value="<?php echo (strtoupper($field_name) == "ID") ? "id" : $field_name; ?>"/>
95
  <input type="hidden" name="cc_settings[]" value="<?php echo (!empty($post['cc_settings'][$ID])) ? esc_attr($post['cc_settings'][$ID]) : 0; ?>"/>
96
  </div>
97
  </li>
@@ -155,7 +165,7 @@
155
  </div>
156
 
157
  <!-- Warning Messages -->
158
- <?php if ( ! XmlExportWooCommerceOrder::$is_active && ! XmlExportComment::$is_active ) : ?>
159
  <div class="wp-all-export-warning" <?php if ( empty($post['ids']) or count($post['ids']) > 1 ) echo 'style="display:none;"'; ?>>
160
  <p></p>
161
  <input type="hidden" id="warning_template" value="<?php _e("Warning: without %s you won't be able to re-import this data back to this site using WP All Import.", "wp_all_export_plugin"); ?>"/>
@@ -167,7 +177,7 @@
167
  <input type="hidden" id="is_product_export" value="1"/>
168
  <?php endif; ?>
169
 
170
- <?php if ( empty($post['cpt']) and ! XmlExportWooCommerceOrder::$is_active and ! XmlExportUser::$is_active and ! XmlExportComment::$is_active ) : ?>
171
  <input type="hidden" id="is_wp_query" value="1"/>
172
  <?php endif; ?>
173
 
@@ -175,16 +185,23 @@
175
 
176
  <!-- Add New Field Button -->
177
  <div class="input" style="display:inline-block; margin: 20px 0 10px 20px;">
178
- <input type="button" value="<?php _e('Add Field', 'wp_all_export_plugin');?>" class="add_column" style="float:left;">
179
- <input type="button" value="<?php _e('Add All', 'wp_all_export_plugin'); ?>" class="wp_all_export_auto_generate_data">
180
- <input type="button" value="<?php _e('Clear All', 'wp_all_export_plugin'); ?>" class="wp_all_export_clear_all_data">
 
 
 
181
  </div>
182
 
183
  <!-- Preview a Row Button -->
184
  <div class="input" style="float:right; margin: 20px 20px 10px 0;">
185
- <input type="button" value="<?php _e('Preview', 'wp_all_export_plugin');?>" class="preview_a_row">
 
186
  </div>
187
  </div>
 
 
 
188
  <div class="wpallexport-collapsed closed wpallexport-section wpallexport-xml-advanced-options" <?php if ($post['export_to'] !== 'xml') { ?> style="display: none;" <?php }?> >
189
  <div class="wpallexport-content-section rad0" style="margin:0; border-top:1px solid #ddd; border-bottom: none; border-right: none; border-left: none; background: #f1f2f2; padding-bottom: 15px; margin-top: 5px;">
190
  <div class="wpallexport-collapsed-header">
@@ -212,6 +229,7 @@
212
  </div>
213
  <input type="hidden" id="custom_xml_cdata_logic" value="<?php echo $post['custom_xml_cdata_logic']; ?>" name="custom_xml_cdata_logic" />
214
  <input type="hidden" id="show_cdata_in_preview" value="<?php echo $post['show_cdata_in_preview']; ?>" name="show_cdata_in_preview" />
 
215
  <div class="input">
216
  <h4>CDATA</h4>
217
  <p style="font-style: italic;"><?php echo sprintf(__("There are certain characters that cannot be included in an XML file unless they are wrapped in CDATA tags.<br/><a target='_blank' href='%s'>Click here to read more about CDATA tags.</a>", 'wp_all_export_plugin'), 'https://en.wikipedia.org/wiki/CDATA'); ?></p>
@@ -256,6 +274,11 @@
256
  <input type="text" name="delimiter" value="<?php echo esc_attr($post['delimiter']) ?>" style="width: 40px; height: 30px; top: 0px; text-align: center;"/>
257
  </div>
258
  </div>
 
 
 
 
 
259
  <!-- Display each product in its own row -->
260
  <?php if ( XmlExportWooCommerceOrder::$is_active ): ?>
261
  <div class="input" style="float: left; margin-top: 15px; margin-left:20px;" id="woo_commerce_order">
@@ -310,7 +333,8 @@
310
  <div class="input" style="width:83%; margin: 0 auto 5px;">
311
  <select name="export_to_sheet" id="export_to_sheet">
312
  <option value="csv" <?php if ($post['export_to_sheet'] == 'csv') echo 'selected="selected"';?>><?php _e('CSV File', 'wp_all_export_plugin'); ?></option>
313
- <option value="xls" <?php if ($post['export_to_sheet'] == 'xls') echo 'selected="selected"';?>><?php _e('Excel File', 'wp_all_export_plugin'); ?></option>
 
314
  </select>
315
  </div>
316
  <div class="clear"></div>
@@ -328,9 +352,6 @@
328
  <div class="input" style="width:83%; margin: 0 auto 5px;">
329
  <select name="xml_template_type" class="xml_template_type">
330
  <option value="simple" <?php if ($post['xml_template_type'] == 'simple') echo 'selected="selected"';?>><?php _e('Simple XML Feed', 'wp_all_export_plugin'); ?></option>
331
- <?php if ( XmlExportWooCommerce::$is_active ): ?>
332
- <option value="XmlGoogleMerchants" <?php if ($post['xml_template_type'] == 'XmlGoogleMerchants') echo 'selected="selected"';?>><?php _e('Google Merchants Feed', 'wp_all_export_plugin'); ?></option>
333
- <?php endif; ?>
334
  <option value="custom" <?php if ($post['xml_template_type'] == 'custom') echo 'selected="selected"';?>><?php _e('Custom XML Feed', 'wp_all_export_plugin'); ?></option>
335
  </select>
336
  </div>
@@ -363,16 +384,19 @@
363
  <div class="input" style="overflow: hidden; margin-top: 10px; margin-bottom: -20px;">
364
  <!-- Help Button -->
365
  <div class="input" style="float: left;">
366
- <input type="button" value="<?php _e('Help', 'wp_all_export_plugin');?>" class="help_custom_xml">
 
367
  </div>
368
  <!-- Preview a Row Button -->
369
  <div class="input" style="float: right;">
370
- <input type="button" value="<?php _e('Preview', 'wp_all_export_plugin');?>" class="preview_a_custom_xml_row">
 
371
  </div>
372
  </div>
373
  </div>
374
  <div class="wpallexport-collapsed closed wpallexport-section">
375
- <div class="wpallexport-content-section rad0" style="margin:0; border-top:1px solid #ddd; border-bottom: none; border-right: none; border-left: none; background: #f1f2f2; padding-bottom: 15px; margin-top: 5px;">
 
376
  <div class="wpallexport-collapsed-header">
377
  <h3 style="color:#40acad;"><?php _e('Advanced Options','wp_all_export_plugin');?></h3>
378
  <hr style="display: none; margin-right: 25px;"/>
@@ -383,23 +407,39 @@
383
  <h4>CDATA</h4>
384
  <p style="font-style: italic;"><?php echo sprintf(__("There are certain characters that cannot be included in an XML file unless they are wrapped in CDATA tags.<br/><a target='_blank' href='%s'>Click here to read more about CDATA tags.</a>", 'wp_all_export_plugin'), 'https://en.wikipedia.org/wiki/CDATA'); ?></p>
385
  <div class="input" style="margin: 3px 0;">
386
- <input type="radio" id="custom_xml_cdata_logic_auto" name="custom_custom_xml_cdata_logic" value="auto" <?php echo ( "auto" == $post['custom_xml_cdata_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
387
- <label for="custom_xml_cdata_logic_auto"><?php _e('Automatically wrap data in CDATA tags when it contains illegal characters', 'wp_all_export_plugin') ?></label>
 
 
 
 
388
  </div>
389
  <div class="input" style="margin: 3px 0;">
390
- <input type="radio" id="custom_custom_xml_cdata_logic_all" name="custom_custom_xml_cdata_logic" value="all" <?php echo ( "all" == $post['custom_xml_cdata_logic'] ) ? 'checked="checked"': '' ?> class="switcher cdata"/>
391
- <label for="custom_custom_xml_cdata_logic_all"><?php _e('Always wrap data in CDATA tags', 'wp_all_export_plugin') ?></label>
 
 
 
 
392
  </div>
393
  <div class="input" style="margin: 3px 0;">
394
- <input type="radio" id="custom_custom_xml_cdata_logic_never" name="custom_custom_xml_cdata_logic" value="never" <?php echo ( "never" == $post['custom_xml_cdata_logic'] ) ? 'checked="checked"': '' ?> class="switcher cdata"/>
395
- <label for="custom_custom_xml_cdata_logic_never"><?php _e('Never wrap data in CDATA tags', 'wp_all_export_plugin') ?></label>
396
- <div class="switcher-target-simple_custom_xml_cdata_logic_never" style="padding-left:17px;">
 
 
 
 
 
397
  <p style="font-style: italic;"><?php _e('Warning: This may result in an invalid XML file', 'wp_all_export_plugin');?></p>
398
  </div>
399
  </div>
400
  <div class="input" style="margin: 10px 3px;">
401
- <input type="checkbox" value="1" name="custom_show_cdata_in_preview" id="custom_show_cdata_in_preview" <?php echo ( 1 == $post['show_cdata_in_preview'] ) ? 'checked="checked"': '' ?> class="show_cdata_in_preview" />
402
- <label for="custom_show_cdata_in_preview">Show CDATA tags in XML preview</label>
 
 
 
403
  </div>
404
  </div>
405
  </div>
@@ -450,11 +490,17 @@
450
 
451
  <p style="margin: 11px; float: left;">
452
  <input type="hidden" name="save_template_as" value="0" />
453
- <input type="checkbox" id="save_template_as" name="save_template_as" class="switcher-horizontal fix_checkbox" value="1" <?php echo ( ! empty($post['save_template_as'])) ? 'checked="checked"' : '' ?> />
454
- <label for="save_template_as"><?php _e('Save settings as a template','wp_all_export_plugin');?></label>
 
 
 
455
  </p>
456
  <div class="switcher-target-save_template_as" style="float: left; overflow: hidden;">
457
- <input type="text" name="name" placeholder="<?php _e('Template name...', 'wp_all_export_plugin') ?>" style="vertical-align:middle; line-height: 26px;" value="<?php echo esc_attr($post['name']) ?>" />
 
 
 
458
  </div>
459
  <?php $templates = new PMXE_Template_List(); ?>
460
  <div class="load-template">
@@ -488,16 +534,21 @@
488
  <input type="hidden" name="is_submitted" value="1" />
489
  <input type="hidden" id="dismiss_warnings" value="<?php echo esc_attr($dismiss_warnings); ?>"/>
490
  <?php if ( ! $this->isWizard ): ?>
491
- <a href="<?php echo remove_query_arg('id', remove_query_arg('action', $this->baseUrl)); ?>" class="back rad3" style="float:none;"><?php _e('Back to Manage Exports', 'wp_all_export_plugin') ?></a>
 
 
492
  <?php else: ?>
493
- <a href="<?php echo add_query_arg('action', 'index', $this->baseUrl); ?>" class="back rad3"><?php _e('Back', 'wp_all_export_plugin') ?></a>
 
494
  <?php endif; ?>
495
- <input type="submit" class="button button-primary button-hero wpallexport-large-button wpallexport-submit-template" value="<?php _e( ($this->isWizard) ? 'Continue' : 'Update Template', 'wp_all_export_plugin') ?>" />
 
496
  </div>
497
 
498
  </div>
499
 
500
- <a href="http://soflyy.com/" target="_blank" class="wpallexport-created-by"><?php _e('Created by', 'wp_all_export_plugin'); ?> <span></span></a>
 
501
 
502
  </form>
503
 
@@ -527,7 +578,9 @@
527
 
528
  <fieldset class="optionsset column rad4 wp-all-export-edit-column">
529
 
530
- <div class="title"><span class="wpallexport-add-row-title"><?php _e('Add Field To Export','wp_all_export_plugin');?></span><span class="wpallexport-edit-row-title"><?php _e('Edit Export Field','wp_all_export_plugin');?></span></div>
 
 
531
 
532
  <?php include_once 'template/add_new_field.php'; ?>
533
 
@@ -535,7 +588,9 @@
535
 
536
  <fieldset class="optionsset column rad4 wp-all-export-custom-xml-help">
537
 
538
- <div class="title"><span style="font-size:1.5em;" class="wpallexport-add-row-title"><?php _e('Custom XML Feeds','wp_all_export_plugin');?></span><span class="wpallexport-edit-row-title"><?php _e('Edit Export Field','wp_all_export_plugin');?></span></div>
 
 
539
 
540
  <?php include_once 'template/custom_xml_help.php'; ?>
541
 
8
  <h2><?php _e('Export to XML / CSV', 'wp_all_export_plugin'); ?></h2>
9
  </div>
10
  <div class="wpallexport-links">
11
+ <a href="http://www.wpallimport.com/support/"
12
+ target="_blank"><?php _e('Support', 'wp_all_export_plugin'); ?></a> | <a
13
+ href="http://www.wpallimport.com/documentation/"
14
+ target="_blank"><?php _e('Documentation', 'wp_all_export_plugin'); ?></a>
15
  </div>
16
  </div>
17
  <div class="clear"></div>
43
  <form class="wpallexport-template <?php echo ! $this->isWizard ? 'edit' : '' ?> wpallexport-step-3" method="post" style="display:none;">
44
 
45
  <input type="hidden" class="hierarhy-output" name="filter_rules_hierarhy" value="<?php echo esc_html($post['filter_rules_hierarhy']);?>"/>
46
+ <input type="hidden" name="taxonomy_to_export" value="<?php echo $post['taxonomy_to_export'];?>">
47
 
48
  <?php
49
  $selected_post_type = '';
61
 
62
  <input type="hidden" name="selected_post_type" value="<?php echo $selected_post_type; ?>"/>
63
  <input type="hidden" name="export_type" value="<?php echo $post['export_type']; ?>"/>
64
+ <div class="error inline" id="updateNotice" style="display:none; margin-top: 0;">
65
+ <p>
66
+ <a target="_blank" href='https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=118611&edd_options%5Bprice_id%5D=1&utm_source=wordpress.org&utm_medium=variations&utm_campaign=free+wp+all+export+plugin'>
67
+ <?php _e("Upgrade to the Pro edition of WP All Export to Select Product Variation Options", 'wp_all_export_plugin'); ?>
68
+ </a>
69
+ </p>
70
+ </div>
71
  <div class="wpallexport-collapsed wpallexport-section wpallexport-simple-xml-template">
72
  <div class="wpallexport-content-section" style="margin-bottom: 10px;">
73
  <div class="wpallexport-collapsed-content">
101
  <input type="hidden" name="cc_type[]" value="<?php echo $field_type; ?>"/>
102
  <input type="hidden" name="cc_options[]" value="<?php echo (!empty($field_options)) ? $field_options : 0; ?>"/>
103
  <input type="hidden" name="cc_value[]" value="<?php echo esc_attr($post['cc_value'][$ID]); ?>"/>
104
+ <input type="hidden" name="cc_name[]" value="<?php echo (strtoupper($field_name) == "ID") ? "id" : esc_attr($field_name); ?>"/>
105
  <input type="hidden" name="cc_settings[]" value="<?php echo (!empty($post['cc_settings'][$ID])) ? esc_attr($post['cc_settings'][$ID]) : 0; ?>"/>
106
  </div>
107
  </li>
165
  </div>
166
 
167
  <!-- Warning Messages -->
168
+ <?php if ( ! XmlExportWooCommerceOrder::$is_active && ! XmlExportComment::$is_active && ! XmlExportTaxonomy::$is_active ) : ?>
169
  <div class="wp-all-export-warning" <?php if ( empty($post['ids']) or count($post['ids']) > 1 ) echo 'style="display:none;"'; ?>>
170
  <p></p>
171
  <input type="hidden" id="warning_template" value="<?php _e("Warning: without %s you won't be able to re-import this data back to this site using WP All Import.", "wp_all_export_plugin"); ?>"/>
177
  <input type="hidden" id="is_product_export" value="1"/>
178
  <?php endif; ?>
179
 
180
+ <?php if ( empty($post['cpt']) and ! XmlExportWooCommerceOrder::$is_active and ! XmlExportUser::$is_active and ! XmlExportComment::$is_active and ! XmlExportTaxonomy::$is_active ) : ?>
181
  <input type="hidden" id="is_wp_query" value="1"/>
182
  <?php endif; ?>
183
 
185
 
186
  <!-- Add New Field Button -->
187
  <div class="input" style="display:inline-block; margin: 20px 0 10px 20px;">
188
+ <input type="button" value="<?php _e('Add Field', 'wp_all_export_plugin'); ?>"
189
+ class="add_column" style="float:left;">
190
+ <input type="button" value="<?php _e('Add All', 'wp_all_export_plugin'); ?>"
191
+ class="wp_all_export_auto_generate_data">
192
+ <input type="button" value="<?php _e('Clear All', 'wp_all_export_plugin'); ?>"
193
+ class="wp_all_export_clear_all_data">
194
  </div>
195
 
196
  <!-- Preview a Row Button -->
197
  <div class="input" style="float:right; margin: 20px 20px 10px 0;">
198
+ <input type="button" value="<?php _e('Preview', 'wp_all_export_plugin'); ?>"
199
+ class="preview_a_row">
200
  </div>
201
  </div>
202
+
203
+ <?php include('variation_options_common.php');?>
204
+
205
  <div class="wpallexport-collapsed closed wpallexport-section wpallexport-xml-advanced-options" <?php if ($post['export_to'] !== 'xml') { ?> style="display: none;" <?php }?> >
206
  <div class="wpallexport-content-section rad0" style="margin:0; border-top:1px solid #ddd; border-bottom: none; border-right: none; border-left: none; background: #f1f2f2; padding-bottom: 15px; margin-top: 5px;">
207
  <div class="wpallexport-collapsed-header">
229
  </div>
230
  <input type="hidden" id="custom_xml_cdata_logic" value="<?php echo $post['custom_xml_cdata_logic']; ?>" name="custom_xml_cdata_logic" />
231
  <input type="hidden" id="show_cdata_in_preview" value="<?php echo $post['show_cdata_in_preview']; ?>" name="show_cdata_in_preview" />
232
+ <div><?php include('variation_options.php'); ?></div>
233
  <div class="input">
234
  <h4>CDATA</h4>
235
  <p style="font-style: italic;"><?php echo sprintf(__("There are certain characters that cannot be included in an XML file unless they are wrapped in CDATA tags.<br/><a target='_blank' href='%s'>Click here to read more about CDATA tags.</a>", 'wp_all_export_plugin'), 'https://en.wikipedia.org/wiki/CDATA'); ?></p>
274
  <input type="text" name="delimiter" value="<?php echo esc_attr($post['delimiter']) ?>" style="width: 40px; height: 30px; top: 0px; text-align: center;"/>
275
  </div>
276
  </div>
277
+ <div style="margin-left:20px;">
278
+ <?php
279
+ include('variation_options.php');
280
+ ?>
281
+ </div>
282
  <!-- Display each product in its own row -->
283
  <?php if ( XmlExportWooCommerceOrder::$is_active ): ?>
284
  <div class="input" style="float: left; margin-top: 15px; margin-left:20px;" id="woo_commerce_order">
333
  <div class="input" style="width:83%; margin: 0 auto 5px;">
334
  <select name="export_to_sheet" id="export_to_sheet">
335
  <option value="csv" <?php if ($post['export_to_sheet'] == 'csv') echo 'selected="selected"';?>><?php _e('CSV File', 'wp_all_export_plugin'); ?></option>
336
+ <option value="xls" <?php if ($post['export_to_sheet'] == 'xls') echo 'selected="selected"';?>><?php _e('Excel File (XLS)', 'wp_all_export_plugin'); ?></option>
337
+ <option value="xlsx" <?php if ($post['export_to_sheet'] == 'xlsx') echo 'selected="selected"';?>><?php _e('Excel File (XLSX)', 'wp_all_export_plugin'); ?></option>
338
  </select>
339
  </div>
340
  <div class="clear"></div>
352
  <div class="input" style="width:83%; margin: 0 auto 5px;">
353
  <select name="xml_template_type" class="xml_template_type">
354
  <option value="simple" <?php if ($post['xml_template_type'] == 'simple') echo 'selected="selected"';?>><?php _e('Simple XML Feed', 'wp_all_export_plugin'); ?></option>
 
 
 
355
  <option value="custom" <?php if ($post['xml_template_type'] == 'custom') echo 'selected="selected"';?>><?php _e('Custom XML Feed', 'wp_all_export_plugin'); ?></option>
356
  </select>
357
  </div>
384
  <div class="input" style="overflow: hidden; margin-top: 10px; margin-bottom: -20px;">
385
  <!-- Help Button -->
386
  <div class="input" style="float: left;">
387
+ <input type="button" value="<?php _e('Help', 'wp_all_export_plugin'); ?>"
388
+ class="help_custom_xml">
389
  </div>
390
  <!-- Preview a Row Button -->
391
  <div class="input" style="float: right;">
392
+ <input type="button" value="<?php _e('Preview', 'wp_all_export_plugin'); ?>"
393
+ class="preview_a_custom_xml_row">
394
  </div>
395
  </div>
396
  </div>
397
  <div class="wpallexport-collapsed closed wpallexport-section">
398
+ <div class="wpallexport-content-section rad0"
399
+ style="margin:0; border-top:1px solid #ddd; border-bottom: none; border-right: none; border-left: none; background: #f1f2f2; padding-bottom: 15px; margin-top: 5px;">
400
  <div class="wpallexport-collapsed-header">
401
  <h3 style="color:#40acad;"><?php _e('Advanced Options','wp_all_export_plugin');?></h3>
402
  <hr style="display: none; margin-right: 25px;"/>
407
  <h4>CDATA</h4>
408
  <p style="font-style: italic;"><?php echo sprintf(__("There are certain characters that cannot be included in an XML file unless they are wrapped in CDATA tags.<br/><a target='_blank' href='%s'>Click here to read more about CDATA tags.</a>", 'wp_all_export_plugin'), 'https://en.wikipedia.org/wiki/CDATA'); ?></p>
409
  <div class="input" style="margin: 3px 0;">
410
+ <input type="radio" id="custom_xml_cdata_logic_auto"
411
+ name="custom_custom_xml_cdata_logic"
412
+ value="auto" <?php echo ("auto" == $post['custom_xml_cdata_logic']) ? 'checked="checked"' : '' ?>
413
+ class="switcher"/>
414
+ <label
415
+ for="custom_xml_cdata_logic_auto"><?php _e('Automatically wrap data in CDATA tags when it contains illegal characters', 'wp_all_export_plugin') ?></label>
416
  </div>
417
  <div class="input" style="margin: 3px 0;">
418
+ <input type="radio" id="custom_custom_xml_cdata_logic_all"
419
+ name="custom_custom_xml_cdata_logic"
420
+ value="all" <?php echo ("all" == $post['custom_xml_cdata_logic']) ? 'checked="checked"' : '' ?>
421
+ class="switcher cdata"/>
422
+ <label
423
+ for="custom_custom_xml_cdata_logic_all"><?php _e('Always wrap data in CDATA tags', 'wp_all_export_plugin') ?></label>
424
  </div>
425
  <div class="input" style="margin: 3px 0;">
426
+ <input type="radio" id="custom_custom_xml_cdata_logic_never"
427
+ name="custom_custom_xml_cdata_logic"
428
+ value="never" <?php echo ("never" == $post['custom_xml_cdata_logic']) ? 'checked="checked"' : '' ?>
429
+ class="switcher cdata"/>
430
+ <label
431
+ for="custom_custom_xml_cdata_logic_never"><?php _e('Never wrap data in CDATA tags', 'wp_all_export_plugin') ?></label>
432
+ <div class="switcher-target-simple_custom_xml_cdata_logic_never"
433
+ style="padding-left:17px;">
434
  <p style="font-style: italic;"><?php _e('Warning: This may result in an invalid XML file', 'wp_all_export_plugin');?></p>
435
  </div>
436
  </div>
437
  <div class="input" style="margin: 10px 3px;">
438
+ <input type="checkbox" value="1" name="custom_show_cdata_in_preview"
439
+ id="custom_show_cdata_in_preview" <?php echo (1 == $post['show_cdata_in_preview']) ? 'checked="checked"' : '' ?>
440
+ class="show_cdata_in_preview"/>
441
+ <label for="custom_show_cdata_in_preview">Show CDATA tags in XML
442
+ preview</label>
443
  </div>
444
  </div>
445
  </div>
490
 
491
  <p style="margin: 11px; float: left;">
492
  <input type="hidden" name="save_template_as" value="0" />
493
+ <input type="checkbox" id="save_template_as" name="save_template_as"
494
+ class="switcher-horizontal fix_checkbox"
495
+ value="1" <?php echo (!empty($post['save_template_as'])) ? 'checked="checked"' : '' ?> />
496
+ <label
497
+ for="save_template_as"><?php _e('Save settings as a template', 'wp_all_export_plugin'); ?></label>
498
  </p>
499
  <div class="switcher-target-save_template_as" style="float: left; overflow: hidden;">
500
+ <input type="text" name="name"
501
+ placeholder="<?php _e('Template name...', 'wp_all_export_plugin') ?>"
502
+ style="vertical-align:middle; line-height: 26px;"
503
+ value="<?php echo esc_attr($post['name']) ?>"/>
504
  </div>
505
  <?php $templates = new PMXE_Template_List(); ?>
506
  <div class="load-template">
534
  <input type="hidden" name="is_submitted" value="1" />
535
  <input type="hidden" id="dismiss_warnings" value="<?php echo esc_attr($dismiss_warnings); ?>"/>
536
  <?php if ( ! $this->isWizard ): ?>
537
+ <a href="<?php echo remove_query_arg('id', remove_query_arg('action', $this->baseUrl)); ?>"
538
+ class="back rad3"
539
+ style="float:none;"><?php _e('Back to Manage Exports', 'wp_all_export_plugin') ?></a>
540
  <?php else: ?>
541
+ <a href="<?php echo add_query_arg('action', 'index', $this->baseUrl); ?>"
542
+ class="back rad3"><?php _e('Back', 'wp_all_export_plugin') ?></a>
543
  <?php endif; ?>
544
+ <input type="submit" class="button button-primary button-hero wpallexport-large-button"
545
+ value="<?php _e(($this->isWizard) ? 'Continue' : 'Update Template', 'wp_all_export_plugin') ?>"/>
546
  </div>
547
 
548
  </div>
549
 
550
+ <a href="http://soflyy.com/" target="_blank"
551
+ class="wpallexport-created-by"><?php _e('Created by', 'wp_all_export_plugin'); ?> <span></span></a>
552
 
553
  </form>
554
 
578
 
579
  <fieldset class="optionsset column rad4 wp-all-export-edit-column">
580
 
581
+ <div class="title"><span
582
+ class="wpallexport-add-row-title"><?php _e('Add Field To Export', 'wp_all_export_plugin'); ?></span><span
583
+ class="wpallexport-edit-row-title"><?php _e('Edit Export Field', 'wp_all_export_plugin'); ?></span></div>
584
 
585
  <?php include_once 'template/add_new_field.php'; ?>
586
 
588
 
589
  <fieldset class="optionsset column rad4 wp-all-export-custom-xml-help">
590
 
591
+ <div class="title"><span style="font-size:1.5em;"
592
+ class="wpallexport-add-row-title"><?php _e('Custom XML Feeds', 'wp_all_export_plugin'); ?></span><span
593
+ class="wpallexport-edit-row-title"><?php _e('Edit Export Field', 'wp_all_export_plugin'); ?></span></div>
594
 
595
  <?php include_once 'template/custom_xml_help.php'; ?>
596
 
views/admin/export/template/add_new_field.php CHANGED
@@ -12,8 +12,6 @@
12
  <input type="text" class="column_name" value="" style="width:50%"/>
13
  </div>
14
 
15
- <a href="javascript:void(0);" class="wp-all-export-advanced-field-options"><span>+</span> <?php _e("Advanced", 'wp_all_export_plugin'); ?></a>
16
-
17
  <!-- Advanced Field Options -->
18
 
19
  <?php include_once 'advanced_field_options.php'; ?>
12
  <input type="text" class="column_name" value="" style="width:50%"/>
13
  </div>
14
 
 
 
15
  <!-- Advanced Field Options -->
16
 
17
  <?php include_once 'advanced_field_options.php'; ?>
views/admin/export/template/advanced_field_options.php CHANGED
@@ -40,9 +40,8 @@
40
  <option value="php"><?php _e("Natural Language PHP date()", "wp_all_export_plugin");?></option>
41
  </select>
42
  <div class="input pmxe_date_format_wrapper">
43
- <label><?php _e("date() Format", "wp_all_export_plugin"); ?></label>
44
- <br>
45
- <input type="text" class="pmxe_date_format" value="" placeholder="Y-m-d H:i:s" style="width: 100%;"/>
46
  </div>
47
  </div>
48
  <!-- Options for Up/Cross sells products -->
40
  <option value="php"><?php _e("Natural Language PHP date()", "wp_all_export_plugin");?></option>
41
  </select>
42
  <div class="input pmxe_date_format_wrapper">
43
+ <label style="padding:4px; display: block;"><?php _e("date() Format", "wp_all_export_plugin"); ?></label>
44
+ <input type="text" class="pmxe_date_format" value="" placeholder="Y-m-d" style="width: 100%;"/>
 
45
  </div>
46
  </div>
47
  <!-- Options for Up/Cross sells products -->
views/admin/export/template/custom_xml_help.php CHANGED
@@ -13,14 +13,15 @@
13
  <h3 id="wpae_help_php_functions_tab"><span>+</span>&nbsp;<?php _e('PHP Functions', 'wp_all_export_plugin'); ?></h3>
14
 
15
  <div rel="wpae_help_php_functions_tab" class="wp_all_export_help_tab">
16
- <p><?php _e('To add a PHP function to your XML template wrap it in brackets: <span class="wp_all_export_code"><span class="wp_all_export_code_text">[my_function({Content})]','wp_all_export_plugin');?></span></span></p>
 
17
  <p><?php _e('Whatever your function returns will appear in your exported XML file. You can pass as many elements as you like to your function so that they can be combined and processed in any way.','wp_all_export_plugin');?></p>
18
  </div>
19
 
20
  <h3 id="wpae_help_repeating_fields_tab"><span>+</span>&nbsp;<?php _e('Repeating Fields and Arrays', 'wp_all_export_plugin'); ?></h3>
21
 
22
  <div rel="wpae_help_repeating_fields_tab" class="wp_all_export_help_tab">
23
- <p><?php _e('Some fields, like images, may have multiple values per post. When WP All Export encounters an indexed array in the content of an XML element it will repeat that element once for every value in the array.', 'wp_all_export_plugin');?></p>
24
  <p><?php _e('For example, let\'s assume a post as two images attached to it - image1.jpg and image2.jpg - and we want to have one XML element for every image URL. Here\'s what our XML template will look like:', 'wp_all_export_plugin');?></p>
25
 
26
  <div class="wp_all_export_code code-block">
@@ -37,6 +38,14 @@
37
  <p class="wp_all_export_code_tag lv2">&lt;image_url&gt;<span class="wp_all_export_code_text">http://example.com/image2.jpg</span>&lt;/image_url&gt;</p>
38
  <p class="wp_all_export_code_tag">&lt;/images&gt;</p>
39
  </div>
 
 
 
 
 
 
 
 
40
  </div>
41
 
42
  <h3 id="wpae_help_example_template_tab"><span>+</span>&nbsp;<?php _e('Example Template', 'wp_all_export_plugin');?></h3>
@@ -56,7 +65,7 @@
56
  <p class="wp_all_export_code_tag cm-s-default"><span class="cm-meta">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</span></p>
57
  <p class="wp_all_export_code_tag">&lt;site_name&gt;<span class="wp_all_export_code_text">My Soda Store</span>&lt;/site_name&gt;</p>
58
  <p class="wp_all_export_code_tag">&lt;products&gt;</p>
59
- <p class="wp_all_export_code_comment lv1">&lt;!-- BEGIN POST LOOP --&gt;</p>
60
  <p class="wp_all_export_code_tag lv1">&lt;product&gt;</p>
61
  <p class="wp_all_export_code_tag lv2">&lt;sku&gt;<span class="wp_all_export_code_text">{SKU}</span>&lt;/sku&gt;</p>
62
  <p class="wp_all_export_code_tag lv2">&lt;title&gt;<span class="wp_all_export_code_text">{Title}</span>&lt;/title&gt;</p>
@@ -65,7 +74,7 @@
65
  <p class="wp_all_export_code_tag lv3">&lt;image_url&gt;<span class="wp_all_export_code_text">{Image URL}</span>&lt;/image_url&gt;</p>
66
  <p class="wp_all_export_code_tag lv2">&lt;/images&gt;</p>
67
  <p class="wp_all_export_code_tag lv1">&lt;/product&gt;</p>
68
- <p class="wp_all_export_code_comment lv1">&lt;!-- END POST LOOP --&gt;</p>
69
  <p class="wp_all_export_code_tag">&lt;/products&gt;</p>
70
  </div>
71
 
13
  <h3 id="wpae_help_php_functions_tab"><span>+</span>&nbsp;<?php _e('PHP Functions', 'wp_all_export_plugin'); ?></h3>
14
 
15
  <div rel="wpae_help_php_functions_tab" class="wp_all_export_help_tab">
16
+ <p><?php _e('To add a custom PHP function to your XML template wrap it in brackets: <span class="wp_all_export_code"><span class="wp_all_export_code_text">[my_function({Content})]','wp_all_export_plugin');?></span></span></p>
17
+ <p><?php _e('You can also use native PHP functions: <span class="wp_all_export_code"><span class="wp_all_export_code_text">[str_replace(",","",{Price})]','wp_all_export_plugin');?></span></span></p>
18
  <p><?php _e('Whatever your function returns will appear in your exported XML file. You can pass as many elements as you like to your function so that they can be combined and processed in any way.','wp_all_export_plugin');?></p>
19
  </div>
20
 
21
  <h3 id="wpae_help_repeating_fields_tab"><span>+</span>&nbsp;<?php _e('Repeating Fields and Arrays', 'wp_all_export_plugin'); ?></h3>
22
 
23
  <div rel="wpae_help_repeating_fields_tab" class="wp_all_export_help_tab">
24
+ <p><?php _e('Some fields, like images, have multiple values per post. WP All Export turns these fields into indexed arrays. Whenever WP All Export encounters an indexed array in an XML element it will repeat that element once for every value in the array.', 'wp_all_export_plugin');?></p>
25
  <p><?php _e('For example, let\'s assume a post as two images attached to it - image1.jpg and image2.jpg - and we want to have one XML element for every image URL. Here\'s what our XML template will look like:', 'wp_all_export_plugin');?></p>
26
 
27
  <div class="wp_all_export_code code-block">
38
  <p class="wp_all_export_code_tag lv2">&lt;image_url&gt;<span class="wp_all_export_code_text">http://example.com/image2.jpg</span>&lt;/image_url&gt;</p>
39
  <p class="wp_all_export_code_tag">&lt;/images&gt;</p>
40
  </div>
41
+ <p><?php _e('WP All Export will do this with all indexed arrays that it comes across. So if you have a function that returns an indexed array, that XML element will be repeated for each value. Likewise, you can take a field like {Image URL} and turn it into a string, like this:', 'wp_all_export_plugin');?></p>
42
+ <div class="wp_all_export_code code-block">
43
+ <p class="wp_all_export_code_tag">&lt;images&gt;[implode(&quot;|&quot;,{Image Title})]&lt;/images&gt;</p>
44
+ </div>
45
+ <p><?php _e("And you'll just get one XML element with all of the values, like this:", 'wp_all_export_plugin');?></p>
46
+ <div class="wp_all_export_code code-block">
47
+ <p class="wp_all_export_code_tag">&lt;images&gt;Image 1|Image 2&lt;/images&gt;</p>
48
+ </div>
49
  </div>
50
 
51
  <h3 id="wpae_help_example_template_tab"><span>+</span>&nbsp;<?php _e('Example Template', 'wp_all_export_plugin');?></h3>
65
  <p class="wp_all_export_code_tag cm-s-default"><span class="cm-meta">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</span></p>
66
  <p class="wp_all_export_code_tag">&lt;site_name&gt;<span class="wp_all_export_code_text">My Soda Store</span>&lt;/site_name&gt;</p>
67
  <p class="wp_all_export_code_tag">&lt;products&gt;</p>
68
+ <p class="wp_all_export_code_comment lv1">&lt;!-- BEGIN LOOP --&gt;</p>
69
  <p class="wp_all_export_code_tag lv1">&lt;product&gt;</p>
70
  <p class="wp_all_export_code_tag lv2">&lt;sku&gt;<span class="wp_all_export_code_text">{SKU}</span>&lt;/sku&gt;</p>
71
  <p class="wp_all_export_code_tag lv2">&lt;title&gt;<span class="wp_all_export_code_text">{Title}</span>&lt;/title&gt;</p>
74
  <p class="wp_all_export_code_tag lv3">&lt;image_url&gt;<span class="wp_all_export_code_text">{Image URL}</span>&lt;/image_url&gt;</p>
75
  <p class="wp_all_export_code_tag lv2">&lt;/images&gt;</p>
76
  <p class="wp_all_export_code_tag lv1">&lt;/product&gt;</p>
77
+ <p class="wp_all_export_code_comment lv1">&lt;!-- END LOOP --&gt;</p>
78
  <p class="wp_all_export_code_tag">&lt;/products&gt;</p>
79
  </div>
80
 
views/admin/export/variation_options.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /** @var $post */
3
+ /** @var string $random */
4
+ $random = uniqid();
5
+ ?>
6
+ <div class="product_variations">
7
+ <h4><?php _e('Product Variations', 'wp_all_export_plugin'); ?>
8
+ <a href="#help" class="wpallexport-help"
9
+ style="position: relative; top: 0px;"
10
+ title="<?php _e('WooCommerce stores each product variation as a separate product in the database, along with a parent product to tie all of the variations together.<br/><br/>If the product title is \'T-Shirt\', then the parent product will be titled \'T-Shirt\', and in the database each size/color combination will be a separate product with a title like \'Variation #23 of T-Shirt\'.', 'wp_all_export_plugin'); ?>">?</a></h4>
11
+ <div class="input" style="display: inline-block; width: 100%;">
12
+ <div>
13
+ <label>
14
+ <input type="radio" class="export_variations"
15
+ value="<?php echo XmlExportEngine::VARIABLE_PRODUCTS_EXPORT_VARIATION; ?>" <?php if ($post['export_variations'] == XmlExportEngine::VARIABLE_PRODUCTS_EXPORT_VARIATION || PMXE_EDITION == 'free') { ?> checked="checked" <?php } ?>
16
+ name="<?php echo $random; ?>_export_variations"/><?php _e("Only export product variations", 'wp_all_export_plugin'); ?>
17
+ </label>
18
+ <div class="sub-options sub-options-<?php echo XmlExportEngine::VARIABLE_PRODUCTS_EXPORT_VARIATION; ?>">
19
+ <label>
20
+ <input type="radio"
21
+ name="<?php echo $random; ?>_export_variations_title_2"
22
+ value="<?php echo XmlExportEngine::VARIATION_USE_PARENT_TITLE; ?>"
23
+ <?php if($post['export_variations_title'] == XmlExportEngine::VARIATION_USE_PARENT_TITLE) {?>
24
+ checked="checked"
25
+ <?php }?>
26
+ class="export_variations_title">
27
+ <?php _e("Product variations use the parent product title", 'wp_all_export_plugin'); ?>
28
+ </label>
29
+ <div class="clear"></div>
30
+ <label>
31
+ <input type="radio"
32
+ name="<?php echo $random; ?>_export_variations_title_2"
33
+ value="<?php echo XmlExportEngine::VARIATION_USE_DEFAULT_TITLE; ?>"
34
+ <?php if($post['export_variations_title'] == XmlExportEngine::VARIATION_USE_DEFAULT_TITLE) {?>
35
+ checked="checked"
36
+ <?php } ?>
37
+ class="export_variations_title">
38
+ <?php _e("Product variations use the default variation product title", 'wp_all_export_plugin'); ?>
39
+ </label>
40
+ </div>
41
+ </div>
42
+ <div class="clear"></div>
43
+ <div class="clear"></div>
44
+ <div>
45
+ <label>
46
+ <input type="radio" class="export_variations <?php if (PMXE_EDITION != 'paid') {
47
+ echo "variations_disabled";
48
+ } ?>"
49
+ value="<?php echo XmlExportEngine::VARIABLE_PRODUCTS_EXPORT_PARENT_AND_VARIATION; ?>" <?php if ($post['export_variations'] == XmlExportEngine::VARIABLE_PRODUCTS_EXPORT_PARENT_AND_VARIATION && PMXE_EDITION == 'paid') { ?> checked="checked" <?php } ?>
50
+ name="<?php echo $random?>_export_variations"/><?php _e("Export product variations and their parent products", 'wp_all_export_plugin'); ?>
51
+ </label>
52
+ <div class="sub-options sub-options-<?php echo XmlExportEngine::VARIABLE_PRODUCTS_EXPORT_PARENT_AND_VARIATION;?>">
53
+ <label>
54
+ <input type="radio"
55
+ name="<?php echo $random; ?>_export_variations_title_1"
56
+ value="<?php echo XmlExportEngine::VARIATION_USE_PARENT_TITLE; ?>"
57
+ <?php if($post['export_variations_title'] == XmlExportEngine::VARIATION_USE_PARENT_TITLE) {?>
58
+ checked="checked"
59
+ <?php }?>
60
+ class="export_variations_title">
61
+ <?php _e("Product variations use the parent product title", 'wp_all_export_plugin');?>
62
+ </label>
63
+ <div class="clear"></div>
64
+ <label>
65
+ <input type="radio"
66
+ name="<?php echo $random; ?>_export_variations_title_1"
67
+ value="<?php echo XmlExportEngine::VARIATION_USE_DEFAULT_TITLE; ?>"
68
+ <?php if($post['export_variations_title'] == XmlExportEngine::VARIATION_USE_DEFAULT_TITLE) { ?>
69
+ checked="checked"
70
+ <?php } ?>
71
+ class="export_variations_title">
72
+ <?php _e("Product variations use the default variation product title", 'wp_all_export_plugin'); ?>
73
+ </label>
74
+ </div>
75
+ </div>
76
+ <div>
77
+ <label>
78
+ <input type="radio" class="export_variations <?php if (PMXE_EDITION != 'paid') {
79
+ echo "variations_disabled";
80
+ } ?>"
81
+ value="<?php echo XmlExportEngine::VARIABLE_PRODUCTS_EXPORT_PARENT; ?>" <?php if ($post['export_variations'] == XmlExportEngine::VARIABLE_PRODUCTS_EXPORT_PARENT && PMXE_EDITION == 'paid') { ?> checked="checked" <?php } ?>
82
+ name="<?php echo $random?>_export_variations"/><?php _e("Only export parent products", 'wp_all_export_plugin'); ?>
83
+ </label>
84
+ </div>
85
+
86
+ </div>
87
+ </div>
views/admin/export/variation_options_common.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ (function ($) {
3
+ $(function () {
4
+
5
+ function updateCheckSelect() {
6
+ var exportVariations = $('#export_variations').val();
7
+ var exportVariationsTitle = $('#export_variations_title').val();
8
+
9
+ $('.sub-options-' + exportVariations).css('display', 'block');
10
+ }
11
+
12
+ $('.export_variations').change(function () {
13
+
14
+ var inputName = $(this).attr('name');
15
+ $('.sub-options').slideUp('fast');
16
+ var value = $('input[name='+inputName+']:checked').val();
17
+ var $thisInput = $('input.export_variations[value='+value +']');
18
+ $thisInput.prop('checked', 'checked');
19
+ $('#export_variations').val(value);
20
+ if (value <= 2) {
21
+ $thisInput.parent().parent().find('.sub-options').slideDown('fast');
22
+ $thisInput.parent().parent().find('.sub-options').find('input').eq(0).attr('checked', 'checked');
23
+ }
24
+ });
25
+
26
+ $('.export_variations_title').change(function(event){
27
+
28
+ var inputName = $(this).attr('name');
29
+ var value = $('input[name='+inputName +']:checked').val();
30
+ var $thisInput = $('.export_variations_title[value='+value +']');
31
+ $thisInput.prop('checked', 'checked');
32
+
33
+ $('#export_variations_title').val(value);
34
+ });
35
+
36
+ updateCheckSelect();
37
+ });
38
+ })(jQuery);
39
+ </script>
40
+
41
+ <input type="hidden" id="export_variations" name="export_variations" value="<?php echo XmlExportEngine::getProductVariationMode();?>" />
42
+ <input type="hidden" id="export_variations_title" name="export_variations_title" value="<?php echo XmlExportEngine::getProductVariationTitleMode();?>" />
views/admin/manage/index.php CHANGED
@@ -175,6 +175,7 @@ $columns = apply_filters('pmxe_manage_imports_columns', $columns);
175
  if ((in_array('product', $item['options']['cpt']) or $item['options']['export_type'] == 'advanced') and class_exists('WooCommerce') and (empty($item['options']['wp_query_selector']) or $item['options']['wp_query_selector'] == 'wp_query')) {
176
  $required_fields['woo'] = '_sku';
177
  $required_fields['cats'] = 'product_type';
 
178
  }
179
  if ((in_array('users', $item['options']['cpt']) or $item['options']['export_type'] == 'advanced') and (!empty($item['options']['wp_query_selector']) and $item['options']['wp_query_selector'] == 'wp_user_query')) {
180
  $required_fields['user_email'] = 'user_email';
@@ -241,7 +242,7 @@ $columns = apply_filters('pmxe_manage_imports_columns', $columns);
241
  case 'format':
242
  ?>
243
  <td>
244
- <strong><?php echo $item['options']['export_to']; ?></strong>
245
  </td>
246
  <?php
247
  break;
@@ -310,7 +311,8 @@ $columns = apply_filters('pmxe_manage_imports_columns', $columns);
310
  else{
311
  printf(__('Last run: %s', 'wp_all_export_plugin'), ($item['registered_on'] == '0000-00-00 00:00:00') ? __('never', 'wp_all_export_plugin') : get_date_from_gmt($item['registered_on'], "m/d/Y g:i a")); echo '<br/>';
312
  printf(__('%d Records Exported', 'wp_all_export_plugin'), $item['exported']); echo '<br/>';
313
- printf(__('Format: %s', 'wp_all_export_plugin'), $item['options']['export_to']); echo '<br/>';
 
314
  //printf(__('%d records', 'wp_all_export_plugin'), $item['post_count']);
315
  }
316
 
175
  if ((in_array('product', $item['options']['cpt']) or $item['options']['export_type'] == 'advanced') and class_exists('WooCommerce') and (empty($item['options']['wp_query_selector']) or $item['options']['wp_query_selector'] == 'wp_query')) {
176
  $required_fields['woo'] = '_sku';
177
  $required_fields['cats'] = 'product_type';
178
+ $required_fields['parent'] = 'parent';
179
  }
180
  if ((in_array('users', $item['options']['cpt']) or $item['options']['export_type'] == 'advanced') and (!empty($item['options']['wp_query_selector']) and $item['options']['wp_query_selector'] == 'wp_user_query')) {
181
  $required_fields['user_email'] = 'user_email';
242
  case 'format':
243
  ?>
244
  <td>
245
+ <strong><?php echo ($item['options']['export_to'] == 'csv' && ! empty($item['options']['export_to_sheet'])) ? $item['options']['export_to_sheet'] : $item['options']['export_to']; ?></strong>
246
  </td>
247
  <?php
248
  break;
311
  else{
312
  printf(__('Last run: %s', 'wp_all_export_plugin'), ($item['registered_on'] == '0000-00-00 00:00:00') ? __('never', 'wp_all_export_plugin') : get_date_from_gmt($item['registered_on'], "m/d/Y g:i a")); echo '<br/>';
313
  printf(__('%d Records Exported', 'wp_all_export_plugin'), $item['exported']); echo '<br/>';
314
+ $export_to = ($item['options']['export_to'] == 'csv' && ! empty($item['options']['export_to_sheet'])) ? $item['options']['export_to_sheet'] : $item['options']['export_to'];
315
+ printf(__('Format: %s', 'wp_all_export_plugin'), $export_to); echo '<br/>';
316
  //printf(__('%d records', 'wp_all_export_plugin'), $item['post_count']);
317
  }
318
 
views/admin/manage/update.php CHANGED
@@ -77,6 +77,8 @@
77
 
78
  <input type="hidden" name="selected_post_type" value="<?php echo $selected_post_type; ?>"/>
79
  <input type="hidden" name="export_type" value="<?php echo $post['export_type']; ?>"/>
 
 
80
 
81
  <?php XmlExportFiltering::render_filtering_block( $engine, $isWizard, $post ); ?>
82
 
77
 
78
  <input type="hidden" name="selected_post_type" value="<?php echo $selected_post_type; ?>"/>
79
  <input type="hidden" name="export_type" value="<?php echo $post['export_type']; ?>"/>
80
+ <input type="hidden" name="taxonomy_to_export" value="<?php echo $post['taxonomy_to_export'];?>">
81
+ <input type="hidden" id="export_variations" name="export_variations" value="<?php echo XmlExportEngine::getProductVariationMode();?>" />
82
 
83
  <?php XmlExportFiltering::render_filtering_block( $engine, $isWizard, $post ); ?>
84
 
wp-all-export.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP All Export
4
  Plugin URI: http://www.wpallimport.com/export/
5
  Description: Export any post type to a CSV or XML file. Edit the exported data, and then re-import it later using WP All Import.
6
- Version: 1.0.9
7
  Author: Soflyy
8
  */
9
 
@@ -52,7 +52,7 @@ else {
52
  */
53
  define('PMXE_PREFIX', 'pmxe_');
54
 
55
- define('PMXE_VERSION', '1.0.9');
56
 
57
  define('PMXE_EDITION', 'free');
58
 
@@ -473,6 +473,34 @@ else {
473
  }
474
  }
475
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
476
 
477
  return FALSE;
478
  }
@@ -611,6 +639,30 @@ else {
611
  }
612
  }
613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
614
  /**
615
  * Method returns default import options, main utility of the method is to avoid warnings when new
616
  * option is introduced but already registered imports don't have it
@@ -683,7 +735,11 @@ else {
683
  'custom_xml_template_footer' => '',
684
  'custom_xml_template_options' => array(),
685
  'custom_xml_cdata_logic' => 'auto',
686
- 'show_cdata_in_preview' => 0
 
 
 
 
687
  );
688
  }
689
 
3
  Plugin Name: WP All Export
4
  Plugin URI: http://www.wpallimport.com/export/
5
  Description: Export any post type to a CSV or XML file. Edit the exported data, and then re-import it later using WP All Import.
6
+ Version: 1.1.0
7
  Author: Soflyy
8
  */
9
 
52
  */
53
  define('PMXE_PREFIX', 'pmxe_');
54
 
55
+ define('PMXE_VERSION', '1.1.0');
56
 
57
  define('PMXE_EDITION', 'free');
58
 
473
  }
474
  }
475
  }
476
+
477
+ if(strpos($className, '\\') !== false){
478
+ // project-specific namespace prefix
479
+ $prefix = 'Wpae\\';
480
+
481
+ // base directory for the namespace prefix
482
+ $base_dir = __DIR__ . '/src/';
483
+
484
+ // does the class use the namespace prefix?
485
+ $len = strlen($prefix);
486
+ if (strncmp($prefix, $className, $len) !== 0) {
487
+ // no, move to the next registered autoloader
488
+ return;
489
+ }
490
+
491
+ // get the relative class name
492
+ $relative_class = substr($className, $len);
493
+
494
+ // replace the namespace prefix with the base directory, replace namespace
495
+ // separators with directory separators in the relative class name, append
496
+ // with .php
497
+ $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
498
+
499
+ // if the file exists, require it
500
+ if (file_exists($file)) {
501
+ require $file;
502
+ }
503
+ }
504
 
505
  return FALSE;
506
  }
639
  }
640
  }
641
 
642
+ /**
643
+ * Determine is current export was created before current version
644
+ */
645
+ public static function isExistingExport( $checkVersion = false ){
646
+
647
+ $input = new PMXE_Input();
648
+ $export_id = $input->get('id', 0);
649
+
650
+ if (empty($export_id)) $export_id = $input->get('export_id', 0);
651
+
652
+ // ID not found means this is new export
653
+ if (empty($export_id)) return false;
654
+
655
+ if ( ! $checkVersion ) $checkVersion = PMXE_VERSION;
656
+
657
+ $export = new PMXE_Export_Record();
658
+ $export->getById($export_id);
659
+ if ( ! $export->isEmpty() && (empty($export->options['created_at_version']) || version_compare($export->options['created_at_version'], $checkVersion) < 0 )){
660
+ return true;
661
+ }
662
+
663
+ return false;
664
+ }
665
+
666
  /**
667
  * Method returns default import options, main utility of the method is to avoid warnings when new
668
  * option is introduced but already registered imports don't have it
735
  'custom_xml_template_footer' => '',
736
  'custom_xml_template_options' => array(),
737
  'custom_xml_cdata_logic' => 'auto',
738
+ 'taxonomy_to_export' => '',
739
+ 'created_at_version' => '',
740
+ 'export_variations' => XmlExportEngine::VARIABLE_PRODUCTS_EXPORT_VARIATION,
741
+ 'export_variations_title' => XmlExportEngine::VARIATION_USE_PARENT_TITLE,
742
+ 'show_cdata_in_preview' => 0
743
  );
744
  }
745