Export WordPress data to XML/CSV - Version 1.0.4

Version Description

  • fixed export attachment meta alt
  • fixed export manually stored ACF
  • fixed export repeater field for users in csv format
  • fixed import export templates
  • fixed ajaxurl conflict with WPML
  • added French & Latvian translations
  • added 'Variation Description' field
Download this release

Release Info

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

Code changes from version 1.0.3 to 1.0.4

actions/admin_menu.php CHANGED
@@ -14,7 +14,7 @@ function pmxe_admin_menu() {
14
  add_submenu_page('pmxe-admin-home', __('Export to XML', 'wp_all_export_plugin') . ' ‹ ' . __('WP All Export', 'wp_all_export_plugin'), __('New Export', 'wp_all_export_plugin'), 'manage_options', 'pmxe-admin-export', array(PMXE_Plugin::getInstance(), 'adminDispatcher'));
15
  add_submenu_page('pmxe-admin-home', __('Manage Exports', 'wp_all_export_plugin') . ' ‹ ' . __('WP All Export', 'wp_all_export_plugin'), __('Manage Exports', 'wp_all_export_plugin'), 'manage_options', 'pmxe-admin-manage', array(PMXE_Plugin::getInstance(), 'adminDispatcher'));
16
  add_submenu_page('pmxe-admin-home', __('Settings', 'wp_all_export_plugin') . ' ‹ ' . __('WP All Export', 'wp_all_export_plugin'), __('Settings', 'wp_all_export_plugin'), 'manage_options', 'pmxe-admin-settings', array(PMXE_Plugin::getInstance(), 'adminDispatcher'));
17
- add_submenu_page('pmxe-admin-home', __('Feedback', 'wp_all_export_plugin') . ' ‹ ' . __('WP All Export', 'wp_all_export_plugin'), __('Feedback', 'wp_all_export_plugin'), 'manage_options', 'pmxe-admin-feedback', array(PMXE_Plugin::getInstance(), 'adminDispatcher'));
18
  add_submenu_page('pmxe-admin-home', __('Support', 'wp_all_export_plugin') . ' ‹ ' . __('WP All Export', 'wp_all_export_plugin'), __('Support', 'wp_all_export_plugin'), 'manage_options', 'pmxe-admin-help', array(PMXE_Plugin::getInstance(), 'adminDispatcher'));
19
 
20
  }
14
  add_submenu_page('pmxe-admin-home', __('Export to XML', 'wp_all_export_plugin') . ' ‹ ' . __('WP All Export', 'wp_all_export_plugin'), __('New Export', 'wp_all_export_plugin'), 'manage_options', 'pmxe-admin-export', array(PMXE_Plugin::getInstance(), 'adminDispatcher'));
15
  add_submenu_page('pmxe-admin-home', __('Manage Exports', 'wp_all_export_plugin') . ' ‹ ' . __('WP All Export', 'wp_all_export_plugin'), __('Manage Exports', 'wp_all_export_plugin'), 'manage_options', 'pmxe-admin-manage', array(PMXE_Plugin::getInstance(), 'adminDispatcher'));
16
  add_submenu_page('pmxe-admin-home', __('Settings', 'wp_all_export_plugin') . ' ‹ ' . __('WP All Export', 'wp_all_export_plugin'), __('Settings', 'wp_all_export_plugin'), 'manage_options', 'pmxe-admin-settings', array(PMXE_Plugin::getInstance(), 'adminDispatcher'));
17
+ // add_submenu_page('pmxe-admin-home', __('Feedback', 'wp_all_export_plugin') . ' ‹ ' . __('WP All Export', 'wp_all_export_plugin'), __('Feedback', 'wp_all_export_plugin'), 'manage_options', 'pmxe-admin-feedback', array(PMXE_Plugin::getInstance(), 'adminDispatcher'));
18
  add_submenu_page('pmxe-admin-home', __('Support', 'wp_all_export_plugin') . ' ‹ ' . __('WP All Export', 'wp_all_export_plugin'), __('Support', 'wp_all_export_plugin'), 'manage_options', 'pmxe-admin-help', array(PMXE_Plugin::getInstance(), 'adminDispatcher'));
19
 
20
  }
actions/wp_ajax_export_filtering.php CHANGED
@@ -122,8 +122,9 @@ function pmxe_wp_ajax_export_filtering(){
122
  <select name="product_matching_mode">
123
  <option value="strict" <?php echo ( $product_matching_mode == 'strict' ) ? 'selected="selected"' : ''; ?>><?php _e("Strict", "wp_all_export_plugin"); ?></option>
124
  <option value="permissive" <?php echo ( $product_matching_mode == 'permissive' ) ? 'selected="selected"' : ''; ?>><?php _e("Permissive", "wp_all_export_plugin"); ?></option>
 
125
  </select>
126
- <a href="#help" class="wpallexport-help" style="position: relative; top: 0px;" title="<?php _e('Strict matching requires all variations to pass in order for the product to be exported. Permissive matching allows the product to be exported if any of the variations pass.', 'wp_all_export_plugin'); ?>">?</a>
127
  </div>
128
 
129
  <?php endif; ?>
122
  <select name="product_matching_mode">
123
  <option value="strict" <?php echo ( $product_matching_mode == 'strict' ) ? 'selected="selected"' : ''; ?>><?php _e("Strict", "wp_all_export_plugin"); ?></option>
124
  <option value="permissive" <?php echo ( $product_matching_mode == 'permissive' ) ? 'selected="selected"' : ''; ?>><?php _e("Permissive", "wp_all_export_plugin"); ?></option>
125
+ <option value="parent" <?php echo ( $product_matching_mode == 'parent' ) ? 'selected="selected"' : ''; ?>><?php _e("Parent", "wp_all_export_plugin"); ?></option>
126
  </select>
127
+ <a href="#help" class="wpallexport-help" style="position: relative; top: 0px;" title="<?php _e('Strict matching requires all variations to pass in order for the product to be exported. Permissive matching allows the product to be exported if any of the variations pass. Parent matching applies filters to parent products only.', 'wp_all_export_plugin'); ?>">?</a>
128
  </div>
129
 
130
  <?php endif; ?>
actions/wp_ajax_export_filtering_count.php CHANGED
@@ -47,12 +47,19 @@ function pmxe_wp_ajax_export_filtering_count(){
47
  PMXE_Plugin::$session->save_data();
48
 
49
  $found_records = 0;
 
50
 
51
  if ( 'users' == $post['cpt'] )
52
  {
 
 
 
 
 
 
 
53
  add_action('pre_user_query', 'wp_all_export_pre_user_query', 10, 1);
54
  $exportQuery = new WP_User_Query( array( 'orderby' => 'ID', 'order' => 'ASC', 'number' => 10 ));
55
-
56
  if ( ! empty($exportQuery->results)){
57
  $found_records = $exportQuery->get_total();
58
  }
@@ -60,13 +67,19 @@ function pmxe_wp_ajax_export_filtering_count(){
60
  }
61
  else
62
  {
63
- add_filter('posts_where', 'wp_all_export_posts_where', 10, 1);
64
- add_filter('posts_join', 'wp_all_export_posts_join', 10, 1);
65
-
66
  $cpt = ($post['cpt'] == 'product') ? array('product', 'product_variation') : $post['cpt'];
67
 
68
- $exportQuery = new WP_Query( array( 'post_type' => $cpt, 'post_status' => 'any', 'orderby' => 'ID', 'order' => 'ASC', 'posts_per_page' => 10 ));
 
 
 
 
69
 
 
 
 
 
 
70
  if ( ! empty($exportQuery->found_posts)){
71
  $found_records = $exportQuery->found_posts;
72
  }
@@ -86,9 +99,12 @@ function pmxe_wp_ajax_export_filtering_count(){
86
  <?php if (! $export->isEmpty() and $export->options['export_only_new_stuff']): ?>
87
  <h3><?php _e('Nothing to export.', 'wp_all_export_plugin'); ?></h3>
88
  <h4><?php printf(__("All %s have already been exported.", "wp_all_export_plugin"), wp_all_export_get_cpt_name(array($post['cpt']))); ?></h4>
89
- <?php else: ?>
90
  <h3><?php _e('Nothing to export.', 'wp_all_export_plugin'); ?></h3>
91
  <h4><?php printf(__("No matching %s found for selected filter rules.", "wp_all_export_plugin"), wp_all_export_get_cpt_name(array($post['cpt']))); ?></h4>
 
 
 
92
  <?php endif; ?>
93
  <?php endif; ?>
94
 
@@ -101,8 +117,10 @@ function pmxe_wp_ajax_export_filtering_count(){
101
  <?php if ($found_records > 0) :?>
102
  <h3><span class="matches_count"><?php echo $found_records; ?></span> <strong><?php echo wp_all_export_get_cpt_name(array($post['cpt']), $found_records); ?></strong> will be exported</h3>
103
  <h4><?php _e("Continue to Step 2 to choose data to include in the export file.", "wp_all_export_plugin"); ?></h4>
104
- <?php else: ?>
105
  <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(array($post['cpt']))); ?></h4>
 
 
106
  <?php endif; ?>
107
  </div>
108
  <?php
47
  PMXE_Plugin::$session->save_data();
48
 
49
  $found_records = 0;
50
+ $total_records = 0;
51
 
52
  if ( 'users' == $post['cpt'] )
53
  {
54
+ // get total users
55
+ $totalQuery = new WP_User_Query( array( 'orderby' => 'ID', 'order' => 'ASC', 'number' => 10 ));
56
+ if ( ! empty($totalQuery->results)){
57
+ $total_records = $totalQuery->get_total();
58
+ }
59
+
60
+ // get users depends on filters
61
  add_action('pre_user_query', 'wp_all_export_pre_user_query', 10, 1);
62
  $exportQuery = new WP_User_Query( array( 'orderby' => 'ID', 'order' => 'ASC', 'number' => 10 ));
 
63
  if ( ! empty($exportQuery->results)){
64
  $found_records = $exportQuery->get_total();
65
  }
67
  }
68
  else
69
  {
 
 
 
70
  $cpt = ($post['cpt'] == 'product') ? array('product', 'product_variation') : $post['cpt'];
71
 
72
+ // get total custom post type records
73
+ $totalQuery = new WP_Query( array( 'post_type' => $cpt, 'post_status' => 'any', 'orderby' => 'ID', 'order' => 'ASC', 'posts_per_page' => 10 ));
74
+ if ( ! empty($totalQuery->found_posts)){
75
+ $total_records = $totalQuery->found_posts;
76
+ }
77
 
78
+ // get custom post type records depends on filters
79
+ add_filter('posts_where', 'wp_all_export_posts_where', 10, 1);
80
+ add_filter('posts_join', 'wp_all_export_posts_join', 10, 1);
81
+
82
+ $exportQuery = new WP_Query( array( 'post_type' => $cpt, 'post_status' => 'any', 'orderby' => 'ID', 'order' => 'ASC', 'posts_per_page' => 10 ));
83
  if ( ! empty($exportQuery->found_posts)){
84
  $found_records = $exportQuery->found_posts;
85
  }
99
  <?php if (! $export->isEmpty() and $export->options['export_only_new_stuff']): ?>
100
  <h3><?php _e('Nothing to export.', 'wp_all_export_plugin'); ?></h3>
101
  <h4><?php printf(__("All %s have already been exported.", "wp_all_export_plugin"), wp_all_export_get_cpt_name(array($post['cpt']))); ?></h4>
102
+ <?php elseif ($total_records > 0): ?>
103
  <h3><?php _e('Nothing to export.', 'wp_all_export_plugin'); ?></h3>
104
  <h4><?php printf(__("No matching %s found for selected filter rules.", "wp_all_export_plugin"), wp_all_export_get_cpt_name(array($post['cpt']))); ?></h4>
105
+ <?php else: ?>
106
+ <h3><?php _e('Nothing to export.', 'wp_all_export_plugin'); ?></h3>
107
+ <h4><?php printf(__("There aren't any %s to export.", "wp_all_export_plugin"), wp_all_export_get_cpt_name(array($post['cpt']))); ?></h4>
108
  <?php endif; ?>
109
  <?php endif; ?>
110
 
117
  <?php if ($found_records > 0) :?>
118
  <h3><span class="matches_count"><?php echo $found_records; ?></span> <strong><?php echo wp_all_export_get_cpt_name(array($post['cpt']), $found_records); ?></strong> will be exported</h3>
119
  <h4><?php _e("Continue to Step 2 to choose data to include in the export file.", "wp_all_export_plugin"); ?></h4>
120
+ <?php elseif ($total_records > 0): ?>
121
  <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(array($post['cpt']))); ?></h4>
122
+ <?php else: ?>
123
+ <h4 style="line-height:60px;"><?php printf(__("There aren't any %s to export.", "wp_all_export_plugin"), wp_all_export_get_cpt_name(array($post['cpt']))); ?></h4>
124
  <?php endif; ?>
125
  </div>
126
  <?php
classes/XMLWriter.php CHANGED
@@ -27,4 +27,9 @@ class PMXE_XMLWriter extends XMLWriter
27
  }
28
  }
29
 
 
 
 
 
 
30
  }
27
  }
28
  }
29
 
30
+ public function writeData( $value )
31
+ {
32
+ if (empty($value) or is_numeric($value)) $this->text($value); else $this->writeCData($value);
33
+ }
34
+
35
  }
classes/chunk.php CHANGED
@@ -90,12 +90,11 @@ class PMXE_Chunk {
90
 
91
  if (empty($this->options['element']) or $this->options['get_cloud'])
92
  {
93
- // if (function_exists('stream_filter_register') and $this->options['filter']){
94
- // stream_filter_register('preprocessxml', 'preprocessXml_filter');
95
- // $path = 'php://filter/read=preprocessxml/resource=' . $this->file;
96
- // }
97
- // else
98
- $path = $this->file;
99
 
100
  $reader = new XMLReader();
101
  $reader->open($path);
@@ -103,10 +102,11 @@ class PMXE_Chunk {
103
  while ( @$reader->read()) {
104
  switch ($reader->nodeType) {
105
  case (XMLREADER::ELEMENT):
106
- if (array_key_exists(str_replace(":", "_", $reader->localName), $this->cloud))
107
- $this->cloud[str_replace(":", "_", $reader->localName)]++;
 
108
  else
109
- $this->cloud[str_replace(":", "_", $reader->localName)] = 1;
110
  break;
111
  default:
112
 
@@ -137,12 +137,11 @@ class PMXE_Chunk {
137
  }
138
  }
139
 
140
- // if (function_exists('stream_filter_register') and $this->options['filter']){
141
- // stream_filter_register('preprocessxml', 'preprocessXml_filter');
142
- // $path = 'php://filter/read=preprocessxml/resource=' . $this->file;
143
- // }
144
- // else
145
- $path = $this->file;
146
 
147
  $this->reader = new XMLReader();
148
  @$this->reader->open($path);
@@ -185,10 +184,12 @@ class PMXE_Chunk {
185
  while ( @$this->reader->read() ) {
186
  switch ($this->reader->nodeType) {
187
  case (XMLREADER::ELEMENT):
188
- if ( strtolower(str_replace(":", "_", $this->reader->localName)) == strtolower($element) ) {
 
 
189
 
190
  if ($this->loop < $this->options['pointer']){
191
- $this->loop++;
192
  continue;
193
  }
194
 
@@ -212,15 +213,17 @@ class PMXE_Chunk {
212
 
213
  function removeColonsFromRSS($feed) {
214
 
 
 
215
  // pull out colons from start tags
216
  // (<\w+):(\w+>)
217
- $pattern = '/(<\w+):(\w+[ |>]{1})/i';
218
- $replacement = '<$2';
219
  $feed = preg_replace($pattern, $replacement, $feed);
220
  // pull out colons from end tags
221
  // (<\/\w+):(\w+>)
222
- $pattern = '/(<\/\w+):(\w+>)/i';
223
- $replacement = '</$2';
224
  $feed = preg_replace($pattern, $replacement, $feed);
225
  // pull out colons from attributes
226
  $pattern = '/(\s+\w+):(\w+[=]{1})/i';
@@ -228,12 +231,44 @@ class PMXE_Chunk {
228
  $feed = preg_replace($pattern, $replacement, $feed);
229
  // pull colons from single element
230
  // (<\w+):(\w+\/>)
231
- $pattern = '/(<\w+):(\w+\/>)/i';
232
- $replacement = '<$2';
233
- $feed = preg_replace($pattern, $replacement, $feed);
234
-
 
 
 
 
 
 
 
235
  return $feed;
236
 
237
  }
238
 
239
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
  if (empty($this->options['element']) or $this->options['get_cloud'])
92
  {
93
+ if (function_exists('stream_filter_register') and $this->options['filter']){
94
+ stream_filter_register('preprocessxml', 'wpae_preprocessXml_filter');
95
+ $path = 'php://filter/read=preprocessxml/resource=' . $this->file;
96
+ }
97
+ else $path = $this->file;
 
98
 
99
  $reader = new XMLReader();
100
  $reader->open($path);
102
  while ( @$reader->read()) {
103
  switch ($reader->nodeType) {
104
  case (XMLREADER::ELEMENT):
105
+ $localName = str_replace("_colon_", ":", $reader->localName);
106
+ if (array_key_exists(str_replace(":", "_", $localName), $this->cloud))
107
+ $this->cloud[str_replace(":", "_", $localName)]++;
108
  else
109
+ $this->cloud[str_replace(":", "_", $localName)] = 1;
110
  break;
111
  default:
112
 
137
  }
138
  }
139
 
140
+ if (function_exists('stream_filter_register') and $this->options['filter']){
141
+ stream_filter_register('preprocessxml', 'wpae_preprocessXml_filter');
142
+ $path = 'php://filter/read=preprocessxml/resource=' . $this->file;
143
+ }
144
+ else $path = $this->file;
 
145
 
146
  $this->reader = new XMLReader();
147
  @$this->reader->open($path);
184
  while ( @$this->reader->read() ) {
185
  switch ($this->reader->nodeType) {
186
  case (XMLREADER::ELEMENT):
187
+ $localName = str_replace("_colon_", ":", $this->reader->localName);
188
+
189
+ if ( strtolower(str_replace(":", "_", $localName)) == strtolower($element) ) {
190
 
191
  if ($this->loop < $this->options['pointer']){
192
+ $this->loop++;
193
  continue;
194
  }
195
 
213
 
214
  function removeColonsFromRSS($feed) {
215
 
216
+ $feed = str_replace("_colon_", ":", $feed);
217
+
218
  // pull out colons from start tags
219
  // (<\w+):(\w+>)
220
+ $pattern = '/(<\w+):([\w+|\.|-]+[ |>]{1})/i';
221
+ $replacement = '$1_$2';
222
  $feed = preg_replace($pattern, $replacement, $feed);
223
  // pull out colons from end tags
224
  // (<\/\w+):(\w+>)
225
+ $pattern = '/(<\/\w+):([\w+|\.|-]+>)/i';
226
+ $replacement = '$1_$2';
227
  $feed = preg_replace($pattern, $replacement, $feed);
228
  // pull out colons from attributes
229
  $pattern = '/(\s+\w+):(\w+[=]{1})/i';
231
  $feed = preg_replace($pattern, $replacement, $feed);
232
  // pull colons from single element
233
  // (<\w+):(\w+\/>)
234
+ $pattern = '/(<\w+):([\w+|\.|-]+\/>)/i';
235
+ $replacement = '$1_$2';
236
+ $feed = preg_replace($pattern, $replacement, $feed);
237
+
238
+ $is_preprocess_enabled = apply_filters('is_xml_preprocess_enabled', true);
239
+ if ($is_preprocess_enabled)
240
+ {
241
+ // replace temporary word _ampersand_ back to & symbol
242
+ $feed = str_replace("_ampersand_", "&", $feed);
243
+ }
244
+
245
  return $feed;
246
 
247
  }
248
 
249
  }
250
+
251
+ class wpae_preprocessXml_filter extends php_user_filter {
252
+
253
+ function filter($in, $out, &$consumed, $closing)
254
+ {
255
+ while ($bucket = stream_bucket_make_writeable($in)) {
256
+ $is_preprocess_enabled = apply_filters('is_xml_preprocess_enabled', true);
257
+ if ($is_preprocess_enabled)
258
+ {
259
+ // the & symbol is not valid in XML, so replace it with temporary word _ampersand_
260
+ $bucket->data = str_replace("&", "_ampersand_", $bucket->data);
261
+ $bucket->data = preg_replace('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', ' ', $this->replace_colons($bucket->data));
262
+ }
263
+ $consumed += $bucket->datalen;
264
+ stream_bucket_append($out, $bucket);
265
+ }
266
+ return PSFS_PASS_ON;
267
+ }
268
+
269
+ function replace_colons($data)
270
+ {
271
+ return str_replace(":", "_colon_", $data);
272
+ }
273
+
274
+ }
classes/download.php CHANGED
@@ -5,11 +5,14 @@ class PMXE_Download
5
 
6
  static public function zip($file_name)
7
  {
8
-
 
 
 
9
  header('Content-type: application/zip');
10
  header("Content-Disposition: attachment; filename=\"".basename($file_name)."\"");
11
  header('Content-Length: ' . filesize($file_name));
12
- readfile($file_name);
13
  die;
14
  }
15
 
5
 
6
  static public function zip($file_name)
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
 
controllers/admin/settings.php CHANGED
@@ -37,7 +37,7 @@ class PMXE_Admin_Settings extends PMXE_Controller_Admin {
37
  {
38
 
39
  $filename = stripslashes($file_name);
40
- $extension = strtolower(pmxi_getExtension($filename));
41
 
42
  if (($extension != "txt"))
43
  {
@@ -54,7 +54,7 @@ class PMXE_Admin_Settings extends PMXE_Controller_Admin {
54
  unset($template_data['id']);
55
  $template->clear()->set($template_data)->insert();
56
  }
57
- wp_redirect(add_query_arg('pmxi_nt', urlencode(sprintf(_n('%d template imported', '%d templates imported', count($templates_data), 'wp_all_export_plugin'), count($templates_data))), $this->baseUrl)); die();
58
  }
59
  else $this->errors->add('form-validation', __('Wrong imported data format', 'wp_all_export_plugin'));
60
  }
@@ -78,7 +78,7 @@ class PMXE_Admin_Settings extends PMXE_Controller_Admin {
78
  foreach ($templates_ids as $template_id) {
79
  $template->clear()->set('id', $template_id)->delete();
80
  }
81
- wp_redirect(add_query_arg('pmxi_nt', urlencode(sprintf(_n('%d template deleted', '%d templates deleted', count($templates_ids), 'wp_all_export_plugin'), count($templates_ids))), $this->baseUrl)); die();
82
  }
83
  if ($this->input->post('export_templates')){
84
  $export_data = array();
37
  {
38
 
39
  $filename = stripslashes($file_name);
40
+ $extension = strtolower(pmxe_getExtension($filename));
41
 
42
  if (($extension != "txt"))
43
  {
54
  unset($template_data['id']);
55
  $template->clear()->set($template_data)->insert();
56
  }
57
+ wp_redirect(add_query_arg('pmxe_nt', urlencode(sprintf(_n('%d template imported', '%d templates imported', count($templates_data), 'wp_all_export_plugin'), count($templates_data))), $this->baseUrl)); die();
58
  }
59
  else $this->errors->add('form-validation', __('Wrong imported data format', 'wp_all_export_plugin'));
60
  }
78
  foreach ($templates_ids as $template_id) {
79
  $template->clear()->set('id', $template_id)->delete();
80
  }
81
+ wp_redirect(add_query_arg('pmxe_nt', urlencode(sprintf(_n('%d template deleted', '%d templates deleted', count($templates_ids), 'wp_all_export_plugin'), count($templates_ids))), $this->baseUrl)); die();
82
  }
83
  if ($this->input->post('export_templates')){
84
  $export_data = array();
helpers/pmxe_export_acf_field_csv.php CHANGED
@@ -6,7 +6,7 @@ function pmxe_export_acf_field_csv($field_value, $exportOptions, $ID, $recordID,
6
 
7
  $field_name = ($ID) ? $exportOptions['cc_label'][$ID] : $exportOptions['name'];
8
 
9
- $field_options = ($ID) ? unserialize($exportOptions['cc_options'][$ID]) : $exportOptions;
10
 
11
  if ( ! empty($field_value) ) {
12
 
@@ -22,7 +22,7 @@ function pmxe_export_acf_field_csv($field_value, $exportOptions, $ID, $recordID,
22
  case 'date_time_picker':
23
  case 'date_picker':
24
 
25
- $field_value = date('Ymd', strtotime($field_value));
26
 
27
  break;
28
 
@@ -71,11 +71,9 @@ function pmxe_export_acf_field_csv($field_value, $exportOptions, $ID, $recordID,
71
  $put_to_csv = false;
72
 
73
  break;
74
- case 'paypal_item':
75
 
76
- $acfs[] = $element_name . '_item_name';
77
- $acfs[] = $element_name . '_item_description';
78
- $acfs[] = $element_name . '_price';
79
 
80
  if ( is_array($field_value) ){
81
  foreach ($field_value as $key => $value) {
@@ -88,14 +86,11 @@ function pmxe_export_acf_field_csv($field_value, $exportOptions, $ID, $recordID,
88
  break;
89
  case 'google_map':
90
 
91
- $article[$element_name . '_address'] = $field_value['address'];
92
- $acfs[] = $element_name . '_address';
93
-
94
- $article[$element_name . '_lat'] = $field_value['lat'];
95
- $acfs[] = $element_name . '_lat';
96
 
97
- $article[$element_name . '_lng'] = $field_value['lng'];
98
- $acfs[] = $element_name . '_lng';
 
99
 
100
  $put_to_csv = false;
101
 
@@ -232,12 +227,14 @@ function pmxe_export_acf_field_csv($field_value, $exportOptions, $ID, $recordID,
232
 
233
  if( have_rows($field_name, $recordID) ){
234
 
235
- $repeater_element_name = empty($ID) ? $parent_field_name : $element_name;
236
 
237
- if ( ! empty($ID))
238
- $acfs[$repeater_element_name] = array();
239
 
240
  $rowValues = array();
 
 
241
 
242
  while( have_rows($field_name, $recordID) ): the_row();
243
 
@@ -291,9 +288,11 @@ function pmxe_export_acf_field_csv($field_value, $exportOptions, $ID, $recordID,
291
 
292
  foreach ($rowValues as $key => $values) {
293
  $article[$element_name . '_' . $key] = ($preview) ? trim(preg_replace('~[\r\n]+~', ' ', htmlspecialchars(implode($exportOptions['delimiter'], $values)))) : implode($exportOptions['delimiter'], $values);
294
- if ( ! in_array($element_name . '_' . $key, $acfs[$repeater_element_name])) $acfs[$repeater_element_name][] = $element_name . '_' . $key;
295
  }
296
-
 
 
297
  }
298
 
299
  $put_to_csv = false;
@@ -353,8 +352,7 @@ function pmxe_export_acf_field_csv($field_value, $exportOptions, $ID, $recordID,
353
 
354
  if ($put_to_csv){
355
 
356
-
357
- switch ($field_options['type']) {
358
 
359
  case 'repeater':
360
 
@@ -362,37 +360,74 @@ function pmxe_export_acf_field_csv($field_value, $exportOptions, $ID, $recordID,
362
 
363
  if ($acf->settings['version'] and version_compare($acf->settings['version'], '5.0.0') >= 0){
364
 
365
- $acf_fields = get_posts(array('posts_per_page' => -1, 'post_type' => 'acf-field', 'post_parent' => $field_options['ID'], 'post_status' => 'publish', 'orderby' => 'menu_order', 'order' => 'ASC'));
 
 
366
 
367
- if ( ! empty($acf_fields) ){
 
 
368
 
369
- foreach ($acf_fields as $field) {
370
 
371
- $sub_name = $element_name . '_' . $field->post_excerpt;
372
 
373
- if ( ! in_array($sub_name, $acfs)) $acfs[] = $sub_name;
374
 
375
- }
376
 
377
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
378
 
 
 
 
 
 
 
 
379
  }
 
 
 
 
 
 
 
 
 
380
 
 
 
 
 
 
 
381
  break;
382
 
383
  case 'google_map':
384
  case 'location-field':
385
 
386
- $acfs[] = $element_name . '_address';
387
- $acfs[] = $element_name . '_lat';
388
- $acfs[] = $element_name . '_lng';
389
 
390
  break;
391
  case 'paypal_item':
392
 
393
- $acfs[] = $element_name . '_item_name';
394
- $acfs[] = $element_name . '_item_description';
395
- $acfs[] = $element_name . '_price';
396
 
397
  break;
398
 
@@ -400,7 +435,7 @@ function pmxe_export_acf_field_csv($field_value, $exportOptions, $ID, $recordID,
400
 
401
  $val = apply_filters('pmxe_acf_field', pmxe_filter( ( ! empty($field_value) ) ? maybe_serialize($field_value) : '', $fieldSnipped), $field_name, $recordID);
402
  $article[$element_name] = ($preview) ? trim(preg_replace('~[\r\n]+~', ' ', htmlspecialchars($val))) : $val;
403
- $acfs[] = $element_name;
404
 
405
  break;
406
 
6
 
7
  $field_name = ($ID) ? $exportOptions['cc_label'][$ID] : $exportOptions['name'];
8
 
9
+ $field_options = ($ID) ? unserialize($exportOptions['cc_options'][$ID]) : $exportOptions;
10
 
11
  if ( ! empty($field_value) ) {
12
 
22
  case 'date_time_picker':
23
  case 'date_picker':
24
 
25
+ $field_value = date('Ymd', strtotime($field_value));
26
 
27
  break;
28
 
71
  $put_to_csv = false;
72
 
73
  break;
74
+ case 'paypal_item':
75
 
76
+ $acfs[] = array($element_name . '_item_name', $element_name . '_item_description', $element_name . '_price');
 
 
77
 
78
  if ( is_array($field_value) ){
79
  foreach ($field_value as $key => $value) {
86
  break;
87
  case 'google_map':
88
 
89
+ $acfs[] = array($element_name . '_address', $element_name . '_lat', $element_name . '_lng');
 
 
 
 
90
 
91
+ $article[$element_name . '_address'] = $field_value['address'];
92
+ $article[$element_name . '_lat'] = $field_value['lat'];
93
+ $article[$element_name . '_lng'] = $field_value['lng'];
94
 
95
  $put_to_csv = false;
96
 
227
 
228
  if( have_rows($field_name, $recordID) ){
229
 
230
+ // $repeater_element_name = empty($ID) ? $parent_field_name : $element_name;
231
 
232
+ // if ( ! empty($ID))
233
+ // $acfs[$repeater_element_name] = array();
234
 
235
  $rowValues = array();
236
+
237
+ $repeater_sub_field_names = array();
238
 
239
  while( have_rows($field_name, $recordID) ): the_row();
240
 
288
 
289
  foreach ($rowValues as $key => $values) {
290
  $article[$element_name . '_' . $key] = ($preview) ? trim(preg_replace('~[\r\n]+~', ' ', htmlspecialchars(implode($exportOptions['delimiter'], $values)))) : implode($exportOptions['delimiter'], $values);
291
+ if ( ! in_array($element_name . '_' . $key, $repeater_sub_field_names)) $repeater_sub_field_names[] = $element_name . '_' . $key;
292
  }
293
+
294
+ if ( ! empty($repeater_sub_field_names)) $acfs[] = $repeater_sub_field_names;
295
+
296
  }
297
 
298
  $put_to_csv = false;
352
 
353
  if ($put_to_csv){
354
 
355
+ switch ($field_options['type']) {
 
356
 
357
  case 'repeater':
358
 
360
 
361
  if ($acf->settings['version'] and version_compare($acf->settings['version'], '5.0.0') >= 0){
362
 
363
+ if ( is_numeric($field_options['ID']))
364
+ {
365
+ $acf_fields = get_posts(array('posts_per_page' => -1, 'post_type' => 'acf-field', 'post_parent' => $field_options['ID'], 'post_status' => 'publish', 'orderby' => 'menu_order', 'order' => 'ASC'));
366
 
367
+ if ( ! empty($acf_fields) )
368
+ {
369
+ $repeater_sub_field_names = array();
370
 
371
+ foreach ($acf_fields as $field) {
372
 
373
+ $sub_name = $element_name . '_' . $field->post_excerpt;
374
 
375
+ if ( ! in_array($sub_name, $acfs) and ! in_array($sub_name, $repeater_sub_field_names)) $repeater_sub_field_names[] = $sub_name;
376
 
377
+ }
378
 
379
+ if ( ! empty($repeater_sub_field_names)) $acfs[] = $repeater_sub_field_names;
380
+ }
381
+ }
382
+ else
383
+ {
384
+ $acf_fields = acf_local()->fields;
385
+
386
+ if ( ! empty($acf_fields) )
387
+ {
388
+ $repeater_sub_field_names = array();
389
+
390
+ foreach ($acf_fields as $field_key => $field)
391
+ {
392
+ if ($field['parent'] == $field_options['key'])
393
+ {
394
+ $sub_name = $element_name . '_' . $field['name'];
395
 
396
+ if ( ! in_array($sub_name, $acfs) and ! in_array($sub_name, $repeater_sub_field_names)) $repeater_sub_field_names[] = $sub_name;
397
+ }
398
+ }
399
+
400
+ if ( ! empty($repeater_sub_field_names)) $acfs[] = $repeater_sub_field_names;
401
+ }
402
+ }
403
  }
404
+ else
405
+ {
406
+ if ( ! empty($field_options['sub_fields']))
407
+ {
408
+ $repeater_sub_field_names = array();
409
+
410
+ foreach ($field_options['sub_fields'] as $n => $sub_field)
411
+ {
412
+ $sub_name = $element_name . '_' . $sub_field['name'];
413
 
414
+ if ( ! in_array($sub_name, $acfs) and ! in_array($sub_name, $repeater_sub_field_names)) $repeater_sub_field_names[] = $sub_name;
415
+ }
416
+ if ( ! empty($repeater_sub_field_names)) $acfs[] = $repeater_sub_field_names;
417
+ }
418
+ }
419
+
420
  break;
421
 
422
  case 'google_map':
423
  case 'location-field':
424
 
425
+ $acfs[] = array($element_name . '_address', $element_name . '_lat', $element_name . '_lng');
 
 
426
 
427
  break;
428
  case 'paypal_item':
429
 
430
+ $acfs[] = array($element_name . '_item_name', $element_name . '_item_description', $element_name . '_price');
 
 
431
 
432
  break;
433
 
435
 
436
  $val = apply_filters('pmxe_acf_field', pmxe_filter( ( ! empty($field_value) ) ? maybe_serialize($field_value) : '', $fieldSnipped), $field_name, $recordID);
437
  $article[$element_name] = ($preview) ? trim(preg_replace('~[\r\n]+~', ' ', htmlspecialchars($val))) : $val;
438
+ $acfs[] = $element_name;
439
 
440
  break;
441
 
helpers/pmxe_export_acf_field_xml.php CHANGED
@@ -55,17 +55,17 @@ function pmxe_export_acf_field_xml($field_value, $exportOptions, $ID, $recordID,
55
 
56
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
57
  $xmlWriter->startElement('address');
58
- $xmlWriter->writeCData($localion_parts[0]);
59
  $xmlWriter->endElement();
60
 
61
  if (!empty($localion_parts[1])){
62
  $coordinates = explode(",", $localion_parts[1]);
63
  if (!empty($coordinates)){
64
  $xmlWriter->startElement('lat');
65
- $xmlWriter->writeCData($coordinates[0]);
66
  $xmlWriter->endElement();
67
  $xmlWriter->startElement('lng');
68
- $xmlWriter->writeCData($coordinates[1]);
69
  $xmlWriter->endElement();
70
  }
71
  }
@@ -82,7 +82,7 @@ function pmxe_export_acf_field_xml($field_value, $exportOptions, $ID, $recordID,
82
  if ( is_array($field_value) ){
83
  foreach ($field_value as $key => $value) {
84
  $xmlWriter->beginElement($element_name_ns, $key, null);
85
- $xmlWriter->writeCData($value);
86
  $xmlWriter->endElement();
87
  }
88
  }
@@ -95,13 +95,13 @@ function pmxe_export_acf_field_xml($field_value, $exportOptions, $ID, $recordID,
95
 
96
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
97
  $xmlWriter->startElement('address');
98
- $xmlWriter->writeCData($field_value['address']);
99
  $xmlWriter->endElement();
100
  $xmlWriter->startElement('lat');
101
- $xmlWriter->writeCData($field_value['lat']);
102
  $xmlWriter->endElement();
103
  $xmlWriter->startElement('lng');
104
- $xmlWriter->writeCData($field_value['lng']);
105
  $xmlWriter->endElement();
106
  $xmlWriter->endElement();
107
 
@@ -211,7 +211,7 @@ function pmxe_export_acf_field_xml($field_value, $exportOptions, $ID, $recordID,
211
  if ($entry and !is_wp_error($entry))
212
  {
213
  $xmlWriter->startElement('term');
214
- $xmlWriter->writeCData($entry->name);
215
  $xmlWriter->endElement();
216
  }
217
  }
@@ -221,7 +221,7 @@ function pmxe_export_acf_field_xml($field_value, $exportOptions, $ID, $recordID,
221
  if ($entry)
222
  {
223
  $xmlWriter->startElement('term');
224
- $xmlWriter->writeCData($entry->name);
225
  $xmlWriter->endElement();
226
  }
227
  }
@@ -344,7 +344,7 @@ function pmxe_export_acf_field_xml($field_value, $exportOptions, $ID, $recordID,
344
  if ($put_to_xml){
345
 
346
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
347
- $xmlWriter->writeCData(apply_filters('pmxe_acf_field', pmxe_filter( maybe_serialize($field_value), $fieldSnipped), $field_name, $recordID));
348
  $xmlWriter->endElement();
349
 
350
  }
55
 
56
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
57
  $xmlWriter->startElement('address');
58
+ $xmlWriter->writeData($localion_parts[0]);
59
  $xmlWriter->endElement();
60
 
61
  if (!empty($localion_parts[1])){
62
  $coordinates = explode(",", $localion_parts[1]);
63
  if (!empty($coordinates)){
64
  $xmlWriter->startElement('lat');
65
+ $xmlWriter->writeData($coordinates[0]);
66
  $xmlWriter->endElement();
67
  $xmlWriter->startElement('lng');
68
+ $xmlWriter->writeData($coordinates[1]);
69
  $xmlWriter->endElement();
70
  }
71
  }
82
  if ( is_array($field_value) ){
83
  foreach ($field_value as $key => $value) {
84
  $xmlWriter->beginElement($element_name_ns, $key, null);
85
+ $xmlWriter->writeData($value);
86
  $xmlWriter->endElement();
87
  }
88
  }
95
 
96
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
97
  $xmlWriter->startElement('address');
98
+ $xmlWriter->writeData($field_value['address']);
99
  $xmlWriter->endElement();
100
  $xmlWriter->startElement('lat');
101
+ $xmlWriter->writeData($field_value['lat']);
102
  $xmlWriter->endElement();
103
  $xmlWriter->startElement('lng');
104
+ $xmlWriter->writeData($field_value['lng']);
105
  $xmlWriter->endElement();
106
  $xmlWriter->endElement();
107
 
211
  if ($entry and !is_wp_error($entry))
212
  {
213
  $xmlWriter->startElement('term');
214
+ $xmlWriter->writeData($entry->name);
215
  $xmlWriter->endElement();
216
  }
217
  }
221
  if ($entry)
222
  {
223
  $xmlWriter->startElement('term');
224
+ $xmlWriter->writeData($entry->name);
225
  $xmlWriter->endElement();
226
  }
227
  }
344
  if ($put_to_xml){
345
 
346
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
347
+ $xmlWriter->writeData(apply_filters('pmxe_acf_field', pmxe_filter( maybe_serialize($field_value), $fieldSnipped), $field_name, $recordID));
348
  $xmlWriter->endElement();
349
 
350
  }
helpers/pmxe_export_csv.php CHANGED
@@ -160,14 +160,14 @@ function pmxe_export_csv($exportQuery, $exportOptions, $preview = false, $is_cro
160
  $img_titles[] = apply_filters('pmxe_attachment_title', $attach->post_title, get_the_ID(), $attach->ID);
161
  $img_captions[] = apply_filters('pmxe_attachment_caption', $attach->post_excerpt, get_the_ID(), $attach->ID);
162
  $img_descriptions[] = apply_filters('pmxe_attachment_content', $attach->post_content, get_the_ID(), $attach->ID);
163
- $img_alts[] = apply_filters('pmxe_attachment_alt', get_post_meta($record->ID, '_wp_attachment_image_alt', true), get_the_ID(), $attach->ID);
164
 
165
  $images_count++;
166
  }
167
  }
168
  if (! empty($img_urls))
169
  $article[$element_name . '_images'] = implode($implode_delimiter, $img_urls);
170
-
171
  if (!empty($img_titles)) $article[$element_name. '_titles'] = implode($implode_delimiter, $img_titles);
172
  if (!empty($img_captions)) $article[$element_name . '_captions'] = implode($implode_delimiter, $img_captions);
173
  if (!empty($img_alts)) $article[$element_name . '_alts'] = implode($implode_delimiter, $img_alts);
@@ -367,12 +367,13 @@ function pmxe_export_csv($exportQuery, $exportOptions, $preview = false, $is_cro
367
  foreach ($txes_list as $t) {
368
  $attr_new[] = $t->name;
369
  }
370
- $article[$element_name] = apply_filters('pmxe_woo_attribute', pmxe_filter(implode($implode_delimiter, $attr_new), $fieldSnipped), get_the_ID());
371
  }
372
  if ( ! in_array($element_name, $attributes)) $attributes[] = $element_name;
373
  }
374
- else{
375
- $attribute_pa = get_post_meta($record->ID, 'attribute_' . $exportOptions['cc_value'][$ID], true);
 
376
  $article['attribute_' . $element_name] = $attribute_pa;
377
  if ( ! in_array('attribute_' . $element_name, $attributes)) $attributes[] = 'attribute_' . $element_name;
378
  }
160
  $img_titles[] = apply_filters('pmxe_attachment_title', $attach->post_title, get_the_ID(), $attach->ID);
161
  $img_captions[] = apply_filters('pmxe_attachment_caption', $attach->post_excerpt, get_the_ID(), $attach->ID);
162
  $img_descriptions[] = apply_filters('pmxe_attachment_content', $attach->post_content, get_the_ID(), $attach->ID);
163
+ $img_alts[] = apply_filters('pmxe_attachment_alt', get_post_meta($attach->ID, '_wp_attachment_image_alt', true), get_the_ID(), $attach->ID);
164
 
165
  $images_count++;
166
  }
167
  }
168
  if (! empty($img_urls))
169
  $article[$element_name . '_images'] = implode($implode_delimiter, $img_urls);
170
+
171
  if (!empty($img_titles)) $article[$element_name. '_titles'] = implode($implode_delimiter, $img_titles);
172
  if (!empty($img_captions)) $article[$element_name . '_captions'] = implode($implode_delimiter, $img_captions);
173
  if (!empty($img_alts)) $article[$element_name . '_alts'] = implode($implode_delimiter, $img_alts);
367
  foreach ($txes_list as $t) {
368
  $attr_new[] = $t->name;
369
  }
370
+ $article[$element_name] = apply_filters('pmxe_woo_attribute', pmxe_filter(implode($implode_delimiter, $attr_new), $fieldSnipped), get_the_ID(), $exportOptions['cc_value'][$ID]);
371
  }
372
  if ( ! in_array($element_name, $attributes)) $attributes[] = $element_name;
373
  }
374
+ else
375
+ {
376
+ $attribute_pa = apply_filters('pmxe_woo_attribute', get_post_meta($record->ID, 'attribute_' . $exportOptions['cc_value'][$ID], true), get_the_ID(), $exportOptions['cc_value'][$ID]);
377
  $article['attribute_' . $element_name] = $attribute_pa;
378
  if ( ! in_array('attribute_' . $element_name, $attributes)) $attributes[] = 'attribute_' . $element_name;
379
  }
helpers/pmxe_export_xml.php CHANGED
@@ -22,7 +22,7 @@ function pmxe_export_xml($exportQuery, $exportOptions, $preview = false, $is_cro
22
  foreach ($additional_data as $key => $value)
23
  {
24
  $xmlWriter->startElement(preg_replace('/[^a-z0-9_-]/i', '', $key));
25
- $xmlWriter->writeCData($value);
26
  $xmlWriter->endElement();
27
  }
28
  }
@@ -40,7 +40,7 @@ function pmxe_export_xml($exportQuery, $exportOptions, $preview = false, $is_cro
40
  foreach ($additional_data as $key => $value)
41
  {
42
  $xmlWriter->startElement(preg_replace('/[^a-z0-9_-]/i', '', $key));
43
- $xmlWriter->writeCData($value);
44
  $xmlWriter->endElement();
45
  }
46
  }
@@ -51,7 +51,11 @@ function pmxe_export_xml($exportQuery, $exportOptions, $preview = false, $is_cro
51
 
52
  while ( $exportQuery->have_posts() ) :
53
 
54
- $exportQuery->the_post(); $record = get_post( get_the_ID() );
 
 
 
 
55
 
56
  $xmlWriter->startElement($exportOptions['record_xml_tag']);
57
 
@@ -70,7 +74,7 @@ function pmxe_export_xml($exportQuery, $exportOptions, $preview = false, $is_cro
70
  'post_id' => $record->ID,
71
  'import_id' => $exportOptions['import_id'],
72
  'unique_key' => $record->ID,
73
- 'product_key' => $record->ID
74
  ))->save();
75
  }
76
  unset($postRecord);
@@ -107,12 +111,12 @@ function pmxe_export_xml($exportQuery, $exportOptions, $preview = false, $is_cro
107
  break;
108
  case 'title':
109
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
110
- $xmlWriter->writeCData(apply_filters('pmxe_post_title', pmxe_filter($record->post_title, $fieldSnipped) , get_the_ID()));
111
  $xmlWriter->endElement();
112
  break;
113
  case 'content':
114
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
115
- $xmlWriter->writeCData(apply_filters('pmxe_post_content', pmxe_filter($record->post_content, $fieldSnipped), get_the_ID()));
116
  $xmlWriter->endElement();
117
  break;
118
  case 'media':
@@ -182,7 +186,7 @@ function pmxe_export_xml($exportQuery, $exportOptions, $preview = false, $is_cro
182
  $xmlWriter->writeElement('title', apply_filters('pmxe_attachment_title', $attach->post_title, get_the_ID(), $attach->ID));
183
  $xmlWriter->writeElement('caption', apply_filters('pmxe_attachment_caption', $attach->post_excerpt, get_the_ID(), $attach->ID));
184
  $xmlWriter->writeElement('description', apply_filters('pmxe_attachment_content', $attach->post_content, get_the_ID(), $attach->ID));
185
- $xmlWriter->writeElement('alt', apply_filters('pmxe_attachment_alt', get_post_meta($record->ID, '_wp_attachment_image_alt', true), get_the_ID(), $attach->ID));
186
 
187
  $xmlWriter->endElement();
188
  }
@@ -269,7 +273,7 @@ function pmxe_export_xml($exportQuery, $exportOptions, $preview = false, $is_cro
269
 
270
  case 'excerpt':
271
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
272
- $xmlWriter->writeCData(apply_filters('pmxe_post_excerpt', pmxe_filter($record->post_excerpt, $fieldSnipped) , get_the_ID()));
273
  $xmlWriter->endElement();
274
  break;
275
 
@@ -279,14 +283,14 @@ function pmxe_export_xml($exportQuery, $exportOptions, $preview = false, $is_cro
279
  if (!empty($cur_meta_values) and is_array($cur_meta_values)){
280
  foreach ($cur_meta_values as $key => $cur_meta_value) {
281
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
282
- $xmlWriter->writeCData(apply_filters('pmxe_custom_field', pmxe_filter(maybe_serialize($cur_meta_value), $fieldSnipped), $exportOptions['cc_value'][$ID], get_the_ID()));
283
  $xmlWriter->endElement();
284
  }
285
  }
286
 
287
  if (empty($cur_meta_values)){
288
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
289
- $xmlWriter->writeCData(apply_filters('pmxe_custom_field', pmxe_filter('', $fieldSnipped), $exportOptions['cc_value'][$ID], get_the_ID()));
290
  $xmlWriter->endElement();
291
  }
292
  }
@@ -339,16 +343,16 @@ function pmxe_export_xml($exportQuery, $exportOptions, $preview = false, $is_cro
339
  $attr_new[] = $t->name;
340
  }
341
  $xmlWriter->beginElement($element_name_ns, $is_variable_product ? $element_name : 'attribute_' . $element_name, null);
342
- $xmlWriter->writeCData(apply_filters('pmxe_woo_attribute', pmxe_filter(implode('|', $attr_new), $fieldSnipped), get_the_ID()));
343
  $xmlWriter->endElement();
344
  endif;
345
  }
346
  }
347
  else{
348
- $attribute_pa = get_post_meta($record->ID, 'attribute_' . $exportOptions['cc_value'][$ID], true);
349
  if ( ! empty($attribute_pa)){
350
  $xmlWriter->beginElement($element_name_ns, 'attribute_' . $element_name, null);
351
- $xmlWriter->writeCData(apply_filters('woo_field', $attribute_pa));
352
  $xmlWriter->endElement();
353
  }
354
  }
@@ -398,7 +402,7 @@ function pmxe_export_xml($exportQuery, $exportOptions, $preview = false, $is_cro
398
  if ( ! empty($hierarchy_groups) ){
399
 
400
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
401
- $xmlWriter->writeCData(apply_filters('pmxe_post_taxonomy', pmxe_filter(implode('|', $hierarchy_groups), $fieldSnipped), get_the_ID()));
402
  $xmlWriter->endElement();
403
 
404
  }
@@ -424,7 +428,7 @@ function pmxe_export_xml($exportQuery, $exportOptions, $preview = false, $is_cro
424
  }
425
  }
426
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
427
- $xmlWriter->writeCData(apply_filters('pmxe_sql_field', $val, $element_name, get_the_ID()));
428
  $xmlWriter->endElement();
429
  }
430
  break;
22
  foreach ($additional_data as $key => $value)
23
  {
24
  $xmlWriter->startElement(preg_replace('/[^a-z0-9_-]/i', '', $key));
25
+ $xmlWriter->writeData($value);
26
  $xmlWriter->endElement();
27
  }
28
  }
40
  foreach ($additional_data as $key => $value)
41
  {
42
  $xmlWriter->startElement(preg_replace('/[^a-z0-9_-]/i', '', $key));
43
+ $xmlWriter->writeData($value);
44
  $xmlWriter->endElement();
45
  }
46
  }
51
 
52
  while ( $exportQuery->have_posts() ) :
53
 
54
+ $exportQuery->the_post(); $record = get_post( get_the_ID() );
55
+
56
+ $is_export_record = apply_filters('wp_all_export_xml_rows', true, $record, $exportOptions);
57
+
58
+ if ( ! $is_export_record ) continue;
59
 
60
  $xmlWriter->startElement($exportOptions['record_xml_tag']);
61
 
74
  'post_id' => $record->ID,
75
  'import_id' => $exportOptions['import_id'],
76
  'unique_key' => $record->ID,
77
+ 'product_key' => $record->ID
78
  ))->save();
79
  }
80
  unset($postRecord);
111
  break;
112
  case 'title':
113
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
114
+ $xmlWriter->writeData(apply_filters('pmxe_post_title', pmxe_filter($record->post_title, $fieldSnipped) , get_the_ID()));
115
  $xmlWriter->endElement();
116
  break;
117
  case 'content':
118
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
119
+ $xmlWriter->writeData(apply_filters('pmxe_post_content', pmxe_filter($record->post_content, $fieldSnipped), get_the_ID()));
120
  $xmlWriter->endElement();
121
  break;
122
  case 'media':
186
  $xmlWriter->writeElement('title', apply_filters('pmxe_attachment_title', $attach->post_title, get_the_ID(), $attach->ID));
187
  $xmlWriter->writeElement('caption', apply_filters('pmxe_attachment_caption', $attach->post_excerpt, get_the_ID(), $attach->ID));
188
  $xmlWriter->writeElement('description', apply_filters('pmxe_attachment_content', $attach->post_content, get_the_ID(), $attach->ID));
189
+ $xmlWriter->writeElement('alt', apply_filters('pmxe_attachment_alt', get_post_meta($attach->ID, '_wp_attachment_image_alt', true), get_the_ID(), $attach->ID));
190
 
191
  $xmlWriter->endElement();
192
  }
273
 
274
  case 'excerpt':
275
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
276
+ $xmlWriter->writeData(apply_filters('pmxe_post_excerpt', pmxe_filter($record->post_excerpt, $fieldSnipped) , get_the_ID()));
277
  $xmlWriter->endElement();
278
  break;
279
 
283
  if (!empty($cur_meta_values) and is_array($cur_meta_values)){
284
  foreach ($cur_meta_values as $key => $cur_meta_value) {
285
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
286
+ $xmlWriter->writeData(apply_filters('pmxe_custom_field', pmxe_filter(maybe_serialize($cur_meta_value), $fieldSnipped), $exportOptions['cc_value'][$ID], get_the_ID()));
287
  $xmlWriter->endElement();
288
  }
289
  }
290
 
291
  if (empty($cur_meta_values)){
292
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
293
+ $xmlWriter->writeData(apply_filters('pmxe_custom_field', pmxe_filter('', $fieldSnipped), $exportOptions['cc_value'][$ID], get_the_ID()));
294
  $xmlWriter->endElement();
295
  }
296
  }
343
  $attr_new[] = $t->name;
344
  }
345
  $xmlWriter->beginElement($element_name_ns, $is_variable_product ? $element_name : 'attribute_' . $element_name, null);
346
+ $xmlWriter->writeData(apply_filters('pmxe_woo_attribute', pmxe_filter(implode('|', $attr_new), $fieldSnipped), get_the_ID(), $exportOptions['cc_value'][$ID]));
347
  $xmlWriter->endElement();
348
  endif;
349
  }
350
  }
351
  else{
352
+ $attribute_pa = apply_filters('pmxe_woo_attribute', get_post_meta($record->ID, 'attribute_' . $exportOptions['cc_value'][$ID], true), get_the_ID(), $exportOptions['cc_value'][$ID]);
353
  if ( ! empty($attribute_pa)){
354
  $xmlWriter->beginElement($element_name_ns, 'attribute_' . $element_name, null);
355
+ $xmlWriter->writeData(apply_filters('woo_field', $attribute_pa));
356
  $xmlWriter->endElement();
357
  }
358
  }
402
  if ( ! empty($hierarchy_groups) ){
403
 
404
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
405
+ $xmlWriter->writeData(apply_filters('pmxe_post_taxonomy', pmxe_filter(implode('|', $hierarchy_groups), $fieldSnipped), get_the_ID()));
406
  $xmlWriter->endElement();
407
 
408
  }
428
  }
429
  }
430
  $xmlWriter->beginElement($element_name_ns, $element_name, null);
431
+ $xmlWriter->writeData(apply_filters('pmxe_sql_field', $val, $element_name, get_the_ID()));
432
  $xmlWriter->endElement();
433
  }
434
  break;
helpers/pmxe_functions.php CHANGED
@@ -37,4 +37,15 @@
37
  rmdir($dir);
38
  }
39
  }
 
 
 
 
 
 
 
 
 
 
 
40
  }
37
  rmdir($dir);
38
  }
39
  }
40
+ }
41
+
42
+ if ( ! function_exists('pmxe_getExtension')){
43
+ function pmxe_getExtension($str)
44
+ {
45
+ $i = strrpos($str,".");
46
+ if (!$i) return "";
47
+ $l = strlen($str) - $i;
48
+ $ext = substr($str,$i+1,$l);
49
+ return (strlen($ext) <= 4) ? $ext : "";
50
+ }
51
  }
helpers/wp_all_export_generate_export_file.php CHANGED
@@ -13,15 +13,18 @@ if ( ! function_exists('wp_all_export_generate_export_file') )
13
 
14
  $export->getById( $export_id );
15
 
16
- if ( ! $export->isEmpty() and $export->options['creata_a_new_export_file'] )
17
  {
18
- $export_file_name = sanitize_file_name($export->options['friendly_name']) . ' - ' . ($export->iteration + 1) . '.' . $export->options['export_to'];
19
- }
20
- else
21
- {
22
- $export_file_name = sanitize_file_name($export->options['friendly_name']) . '.' . $export->options['export_to'];
23
- }
 
 
 
24
 
25
- return $target . DIRECTORY_SEPARATOR . $export_file_name;
26
  }
27
  }
13
 
14
  $export->getById( $export_id );
15
 
16
+ if ( ! $export->isEmpty())
17
  {
18
+ if ($export->options['creata_a_new_export_file'] )
19
+ {
20
+ $export_file_name = sanitize_file_name($export->options['friendly_name']) . ' - ' . ($export->iteration + 1) . '.' . $export->options['export_to'];
21
+ }
22
+ else
23
+ {
24
+ $export_file_name = sanitize_file_name($export->options['friendly_name']) . '.' . $export->options['export_to'];
25
+ }
26
+ }
27
 
28
+ return apply_filters('wp_all_export_export_file_name', $target . DIRECTORY_SEPARATOR . $export_file_name, $export_id );
29
  }
30
  }
helpers/wp_all_export_prepare_template_csv.php CHANGED
@@ -11,6 +11,9 @@ function wp_all_export_prepare_template_csv($exportOptions, &$templateOptions)
11
  $taxs_list = array();
12
  $acf_list = array();
13
  $implode_delimiter = ($exportOptions['delimiter'] == ',') ? '|' : ',';
 
 
 
14
  foreach ($exportOptions['ids'] as $ID => $value) {
15
  if (empty($exportOptions['cc_type'][$ID])) continue;
16
  $element_name = strtolower((!empty($exportOptions['cc_name'][$ID])) ? preg_replace('/[^a-z0-9_]/i', '', $exportOptions['cc_name'][$ID]) : 'untitled_' . $ID);
@@ -23,12 +26,15 @@ function wp_all_export_prepare_template_csv($exportOptions, &$templateOptions)
23
  case 'title':
24
  case 'content':
25
  case 'author':
26
- case 'parent':
27
- case 'excerpt':
28
  case 'slug':
29
  $templateOptions[$exportOptions['cc_type'][$ID]] = '{'. $element_name .'[1]}';
30
  $templateOptions['is_update_' . $exportOptions['cc_type'][$ID]] = 1;
31
  break;
 
 
 
 
32
  case 'status':
33
  $templateOptions['status_xpath'] = '{'. $element_name .'[1]}';
34
  $templateOptions['is_update_status'] = 1;
11
  $taxs_list = array();
12
  $acf_list = array();
13
  $implode_delimiter = ($exportOptions['delimiter'] == ',') ? '|' : ',';
14
+
15
+ if ( ! empty($exportOptions['is_user_export']) ) $templateOptions['pmui']['import_users'] = 1;
16
+
17
  foreach ($exportOptions['ids'] as $ID => $value) {
18
  if (empty($exportOptions['cc_type'][$ID])) continue;
19
  $element_name = strtolower((!empty($exportOptions['cc_name'][$ID])) ? preg_replace('/[^a-z0-9_]/i', '', $exportOptions['cc_name'][$ID]) : 'untitled_' . $ID);
26
  case 'title':
27
  case 'content':
28
  case 'author':
29
+ case 'parent':
 
30
  case 'slug':
31
  $templateOptions[$exportOptions['cc_type'][$ID]] = '{'. $element_name .'[1]}';
32
  $templateOptions['is_update_' . $exportOptions['cc_type'][$ID]] = 1;
33
  break;
34
+ case 'excerpt':
35
+ $templateOptions['post_excerpt'] = '{'. $element_name .'[1]}';
36
+ $templateOptions['is_update_' . $exportOptions['cc_type'][$ID]] = 1;
37
+ break;
38
  case 'status':
39
  $templateOptions['status_xpath'] = '{'. $element_name .'[1]}';
40
  $templateOptions['is_update_status'] = 1;
helpers/wp_all_export_prepare_template_xml.php CHANGED
@@ -10,6 +10,9 @@ function wp_all_export_prepare_template_xml($exportOptions, &$templateOptions)
10
  $attr_list = array();
11
  $taxs_list = array();
12
  $acf_list = array();
 
 
 
13
  foreach ($exportOptions['ids'] as $ID => $value) {
14
  if (empty($exportOptions['cc_type'][$ID])) continue;
15
  $element_name = (!empty($exportOptions['cc_name'][$ID])) ? str_replace(':', '_', preg_replace('/[^a-z0-9_:-]/i', '', $exportOptions['cc_name'][$ID])) : 'untitled_' . $ID;
@@ -22,12 +25,15 @@ function wp_all_export_prepare_template_xml($exportOptions, &$templateOptions)
22
  case 'title':
23
  case 'content':
24
  case 'author':
25
- case 'parent':
26
- case 'excerpt':
27
  case 'slug':
28
  $templateOptions[$exportOptions['cc_type'][$ID]] = '{'. $element_name .'[1]}';
29
  $templateOptions['is_update_' . $exportOptions['cc_type'][$ID]] = 1;
30
  break;
 
 
 
 
31
  case 'status':
32
  $templateOptions['status_xpath'] = '{'. $element_name .'[1]}';
33
  $templateOptions['is_update_status'] = 1;
@@ -63,7 +69,7 @@ function wp_all_export_prepare_template_xml($exportOptions, &$templateOptions)
63
  'url' => 'http://www.wpallimport.com/woocommerce-product-import/'
64
  );
65
  }
66
-
67
  if ( ! in_array($exportOptions['cc_label'][$ID], $cf_list)) $cf_list[] = $exportOptions['cc_label'][$ID];
68
 
69
  switch ($exportOptions['cc_label'][$ID]) {
@@ -256,7 +262,7 @@ function wp_all_export_prepare_template_xml($exportOptions, &$templateOptions)
256
  $templateOptions['acf'][$field_options['group_id']] = 1;
257
  }
258
 
259
- $field_tpl_key = 'acf_' . $element_name . '[1]';
260
 
261
  $acf_list[] = '[' . $field_options['name'] . '] ' . $field_options['label'];
262
 
@@ -416,7 +422,7 @@ function wp_all_export_prepare_template_xml($exportOptions, &$templateOptions)
416
  $templateOptions['tax_logic'][$taxonomy] = 'hierarchical';
417
  $templateOptions['tax_hierarchical_logic_entire'][$taxonomy] = 1;
418
  $templateOptions['multiple_term_assing'][$taxonomy] = 1;
419
- $templateOptions['tax_hierarchical_delim'][$taxonomy] = '&gt;';
420
  $templateOptions['is_tax_hierarchical_group_delim'][$taxonomy] = 1;
421
  $templateOptions['tax_hierarchical_group_delim'][$taxonomy] = '|';
422
  $templateOptions['tax_hierarchical_xpath'][$taxonomy] = array('{'. $element_name .'[1]}');
10
  $attr_list = array();
11
  $taxs_list = array();
12
  $acf_list = array();
13
+
14
+ if ( ! empty($exportOptions['is_user_export']) ) $templateOptions['pmui']['import_users'] = 1;
15
+
16
  foreach ($exportOptions['ids'] as $ID => $value) {
17
  if (empty($exportOptions['cc_type'][$ID])) continue;
18
  $element_name = (!empty($exportOptions['cc_name'][$ID])) ? str_replace(':', '_', preg_replace('/[^a-z0-9_:-]/i', '', $exportOptions['cc_name'][$ID])) : 'untitled_' . $ID;
25
  case 'title':
26
  case 'content':
27
  case 'author':
28
+ case 'parent':
 
29
  case 'slug':
30
  $templateOptions[$exportOptions['cc_type'][$ID]] = '{'. $element_name .'[1]}';
31
  $templateOptions['is_update_' . $exportOptions['cc_type'][$ID]] = 1;
32
  break;
33
+ case 'excerpt':
34
+ $templateOptions['post_excerpt'] = '{'. $element_name .'[1]}';
35
+ $templateOptions['is_update_' . $exportOptions['cc_type'][$ID]] = 1;
36
+ break;
37
  case 'status':
38
  $templateOptions['status_xpath'] = '{'. $element_name .'[1]}';
39
  $templateOptions['is_update_status'] = 1;
69
  'url' => 'http://www.wpallimport.com/woocommerce-product-import/'
70
  );
71
  }
72
+
73
  if ( ! in_array($exportOptions['cc_label'][$ID], $cf_list)) $cf_list[] = $exportOptions['cc_label'][$ID];
74
 
75
  switch ($exportOptions['cc_label'][$ID]) {
262
  $templateOptions['acf'][$field_options['group_id']] = 1;
263
  }
264
 
265
+ $field_tpl_key = $element_name . '[1]';
266
 
267
  $acf_list[] = '[' . $field_options['name'] . '] ' . $field_options['label'];
268
 
422
  $templateOptions['tax_logic'][$taxonomy] = 'hierarchical';
423
  $templateOptions['tax_hierarchical_logic_entire'][$taxonomy] = 1;
424
  $templateOptions['multiple_term_assing'][$taxonomy] = 1;
425
+ $templateOptions['tax_hierarchical_delim'][$taxonomy] = '>';
426
  $templateOptions['is_tax_hierarchical_group_delim'][$taxonomy] = 1;
427
  $templateOptions['tax_hierarchical_group_delim'][$taxonomy] = '|';
428
  $templateOptions['tax_hierarchical_xpath'][$taxonomy] = array('{'. $element_name .'[1]}');
i18n/languages/wp_all_export_plugin-fr_FR.mo ADDED
Binary file
i18n/languages/wp_all_export_plugin-fr_FR.po ADDED
@@ -0,0 +1,1454 @@