PluginProbe ʕ •ᴥ•ʔ
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel / trunk
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel vtrunk
trunk 0.9.0 0.9.1 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.2.1 1.2.10 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.14 1.4.15 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0
wp-all-export / classes / wpallimport.php
wp-all-export / classes Last commit date
partner-discount-sdk 4 weeks ago CdataStrategy.php 4 weeks ago CdataStrategyAlways.php 4 weeks ago CdataStrategyFactory.php 4 weeks ago CdataStrategyIllegalCharacters.php 4 weeks ago CdataStrategyIllegalCharactersHtmlEntities.php 4 weeks ago CdataStrategyNever.php 4 weeks ago XMLWriter.php 4 weeks ago chunk.php 4 weeks ago config.php 3 years ago download.php 4 weeks ago handler.php 4 weeks ago helper.php 4 weeks ago input.php 4 weeks ago installer.php 4 weeks ago session.php 10 years ago wpallimport.php 4 weeks ago zip.php 4 years ago
wpallimport.php
613 lines
1 <?php
2
3 // phpcs:ignoreFile WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound,WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound,WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- legitimate plugin prefixes (pmxe/PMXE/wpae/Wpae/wp_all_export/wpallexport/XmlExport/CdataStrategy/VariableProductTitle/Soflyy/GF_Export); Plugin Check does not honor phpcs.xml prefix declaration
4 final class PMXE_Wpallimport
5 {
6 /**
7 * Singletone instance
8 * @var PMXE_Wpallimport
9 */
10 protected static $instance;
11
12 /**
13 * Return singletone instance
14 * @return PMXE_Wpallimport
15 */
16 static public function getInstance() {
17 if (self::$instance == NULL) {
18 self::$instance = new self();
19 }
20 return self::$instance;
21 }
22
23 private function __construct(){}
24
25 public static function create_an_import( & $export )
26 {
27
28 $custom_type = (empty($export->options['cpt'])) ? 'post' : $export->options['cpt'][0];
29
30 // Do not create an import for WooCommerce Orders & Refunds
31 // if ( in_array($custom_type, array('shop_order'))) return false;
32
33 if ( $export->options['is_generate_import'] and wp_all_export_is_compatible() ){
34
35 $import = new PMXI_Import_Record();
36
37 if ( ! empty($export->options['import_id']) ) $import->getById($export->options['import_id']);
38
39 if ($import->isEmpty())
40 {
41 $import->set(array(
42 'parent_import_id' => 99999,
43 'xpath' => '/',
44 'type' => 'upload',
45 'options' => array('empty'),
46 'root_element' => 'root',
47 'path' => 'path',
48 'imported' => 0,
49 'created' => 0,
50 'updated' => 0,
51 'skipped' => 0,
52 'deleted' => 0,
53 'iteration' => 1
54 ))->save();
55
56 if ( ! empty(PMXE_Plugin::$session) and PMXE_Plugin::$session->has_session() )
57 {
58 PMXE_Plugin::$session->set('import_id', $import->id);
59 }
60 $options = $export->options;
61 $options['import_id'] = $import->id;
62
63 $export->set(array(
64 'options' => $options
65 ))->save();
66 }
67 else
68 {
69 if ( $import->parent_import_id != 99999 )
70 {
71 $newImport = new PMXI_Import_Record();
72
73 $newImport->set(array(
74 'parent_import_id' => 99999,
75 'xpath' => '/',
76 'type' => 'upload',
77 'options' => array('empty'),
78 'root_element' => 'root',
79 'path' => 'path',
80 'imported' => 0,
81 'created' => 0,
82 'updated' => 0,
83 'skipped' => 0,
84 'deleted' => 0,
85 'iteration' => 1
86 ))->save();
87
88 if ( ! empty(PMXE_Plugin::$session) and PMXE_Plugin::$session->has_session() )
89 {
90 PMXE_Plugin::$session->set('import_id', $newImport->id);
91 }
92
93 $options = $export->options;
94 $options['import_id'] = $newImport->id;
95
96 $export->set(array(
97 'options' => $options
98 ))->save();
99 }
100 else
101 {
102 global $wpdb;
103 $post = new PMXI_Post_List();
104 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,PluginCheck.Security.DirectDB.UnescapedDBParameter -- table name from PMXI_Post_List::getTable() which uses $wpdb->prefix; value bound via prepare()
105 $wpdb->query($wpdb->prepare('DELETE FROM ' . $post->getTable() . ' WHERE import_id = %s', $import->id));
106 }
107 }
108 }
109 }
110
111 public static $templateOptions = array();
112 public static function generateImportTemplate( & $export, $file_path = '', $foundPosts = 0, $link_to_import = true )
113 {
114 $exportOptions = $export->options;
115
116 $custom_type = (empty($exportOptions['cpt'])) ? 'post' : $exportOptions['cpt'][0];
117
118 if(XmlExportEngine::$is_custom_addon_export) {
119 $custom_type = 'gf_entries';
120 }
121
122 // Do not create an import template for WooCommerce Refunds
123 if ( $export->options['export_to'] == 'xml' && in_array($export->options['xml_template_type'], array('custom', 'XmlGoogleMerchants')) ) return false;
124
125 // Generate template for WP All Import
126 if ($exportOptions['is_generate_templates'])
127 {
128 self::$templateOptions = array(
129 'type' => ( ! empty($exportOptions['cpt']) and $exportOptions['cpt'][0] == 'page') ? 'page' : 'post',
130 'wizard_type' => 'new',
131 'deligate' => 'wpallexport',
132 'custom_type' => (XmlExportEngine::$is_user_export) ? 'import_users' : $custom_type,
133 'status' => 'xpath',
134 'is_multiple_page_parent' => 'no',
135 'unique_key' => '',
136 'acf' => array(),
137 'fields' => array(),
138 'is_multiple_field_value' => array(),
139 'multiple_value' => array(),
140 'fields_delimiter' => array(),
141 'update_all_data' => 'no',
142 'is_update_status' => 0,
143 'is_update_title' => 0,
144 'is_update_author' => 0,
145 'is_update_slug' => 0,
146 'is_update_content' => 0,
147 'is_update_excerpt' => 0,
148 'is_update_dates' => 0,
149 'is_update_menu_order' => 0,
150 'is_update_parent' => 0,
151 'is_update_attachments' => 0,
152 'is_update_acf' => 0,
153 'is_update_comment_status' => 0,
154 'import_img_tags' => 1,
155 'update_acf_logic' => 'only',
156 'acf_list' => '',
157 'is_update_product_type' => 1,
158 'is_update_attributes' => 0,
159 'update_attributes_logic' => 'only',
160 'attributes_list' => '',
161 'is_update_images' => 0,
162 'is_update_custom_fields' => 0,
163 'update_custom_fields_logic' => 'only',
164 'custom_fields_list' => '',
165 'is_update_categories' => 0,
166 'update_categories_logic' => 'only',
167 'taxonomies_list' => '',
168 'export_id' => $export->id
169 );
170
171
172 if(XmlExportEngine::$is_custom_addon_export) {
173
174 $gf_addon = \GF_Export_Add_On::get_instance();
175 $sub_post_type = $gf_addon->add_on->get_sub_post_type();
176
177 if(class_exists('GFAPI')) {
178 $form = GFAPI::get_form($sub_post_type);
179 self::$templateOptions['gravity_form_title'] = $form['title'];
180 }
181 }
182
183 if ( in_array('product', $exportOptions['cpt']) )
184 {
185 $default = array(
186 'is_multiple_product_type' => 'yes',
187 'multiple_product_type' => 'simple',
188 'is_product_virtual' => 'no',
189 'is_product_downloadable' => 'no',
190 'is_product_enabled' => 'yes',
191 'is_variation_enabled' => 'yes',
192 'is_product_featured' => 'no',
193 'is_product_visibility' => 'visible',
194 'is_multiple_product_tax_status' => 'yes',
195 'multiple_product_tax_status' => 'none',
196 'is_multiple_product_tax_class' => 'yes',
197 'is_product_manage_stock' => 'no',
198 'product_stock_status' => 'auto',
199 'product_allow_backorders' => 'no',
200 'product_sold_individually' => 'no',
201 'is_multiple_product_shipping_class' => 'yes',
202 'is_multiple_grouping_product' => 'yes',
203 'is_product_enable_reviews' => 'no',
204 'single_sale_price_dates_from' => 'now',
205 'single_sale_price_dates_to' => 'now',
206 'product_files_delim' => ',',
207 'product_files_names_delim' => ',',
208 'matching_parent' => 'auto',
209 'parent_indicator' => 'custom field',
210 'missing_records_stock_status' => 0,
211 'is_variable_sale_price_shedule' => 0,
212 'is_variable_product_virtual' => 'no',
213 'is_variable_product_manage_stock' => 'no',
214 'is_multiple_variable_product_shipping_class' => 'yes',
215 'is_multiple_variable_product_tax_class' => 'yes',
216 'multiple_variable_product_tax_class' => 'parent',
217 'variable_stock_status' => 'instock',
218 'variable_allow_backorders' => 'no',
219 'is_variable_product_downloadable' => 'no',
220 'variable_product_files_delim' => ',',
221 'variable_product_files_names_delim' => ',',
222 'is_variable_product_enabled' => 'yes',
223 'first_is_parent' => 'yes',
224 'default_attributes_type' => 'first',
225 'disable_sku_matching' => 1,
226 'disable_prepare_price' => 1,
227 'convert_decimal_separator' => 1,
228 'grouping_indicator' => 'xpath',
229 'is_update_product_type' => 1,
230 'make_simple_product' => 1,
231 'single_product_regular_price_adjust_type' => '%',
232 'single_product_sale_price_adjust_type' => '%',
233 'is_variation_product_manage_stock' => 'no',
234 'variation_stock_status' => 'auto',
235 );
236
237 self::$templateOptions = array_replace_recursive(self::$templateOptions, $default);
238
239 self::$templateOptions['_virtual'] = 1;
240 self::$templateOptions['_downloadable'] = 1;
241 self::$templateOptions['put_variation_image_to_gallery'] = 1;
242 self::$templateOptions['disable_auto_sku_generation'] = 1;
243 }
244
245 if ( in_array('shop_order', $exportOptions['cpt']) )
246 {
247 self::$templateOptions['update_all_data'] = 'no';
248 self::$templateOptions['is_update_status'] = 0;
249 self::$templateOptions['is_update_dates'] = 0;
250 self::$templateOptions['is_update_excerpt'] = 0;
251
252 // $default = PMWI_Plugin::get_default_import_options();
253 // self::$templateOptions['pmwi_order'] = $default['pmwi_order'];
254 self::$templateOptions['pmwi_order'] = array();
255 self::$templateOptions['pmwi_order']['is_update_billing_details'] = 0;
256 self::$templateOptions['pmwi_order']['is_update_shipping_details'] = 0;
257 self::$templateOptions['pmwi_order']['is_update_payment'] = 0;
258 self::$templateOptions['pmwi_order']['is_update_notes'] = 0;
259 self::$templateOptions['pmwi_order']['is_update_products'] = 0;
260 self::$templateOptions['pmwi_order']['is_update_fees'] = 0;
261 self::$templateOptions['pmwi_order']['is_update_coupons'] = 0;
262 self::$templateOptions['pmwi_order']['is_update_shipping'] = 0;
263 self::$templateOptions['pmwi_order']['is_update_taxes'] = 0;
264 self::$templateOptions['pmwi_order']['is_update_refunds'] = 0;
265 self::$templateOptions['pmwi_order']['is_update_total'] = 0;
266 self::$templateOptions['pmwi_order']['is_guest_matching'] = 1;
267 self::$templateOptions['pmwi_order']['status'] = 'wc-pending';
268 self::$templateOptions['pmwi_order']['billing_source'] = 'existing';
269 self::$templateOptions['pmwi_order']['billing_source_match_by'] = 'username';
270 self::$templateOptions['pmwi_order']['shipping_source'] = 'guest';
271 self::$templateOptions['pmwi_order']['copy_from_billing'] = 1;
272 self::$templateOptions['pmwi_order']['products_repeater_mode'] = 'csv';
273 self::$templateOptions['pmwi_order']['products_repeater_mode_separator'] = '|';
274 self::$templateOptions['pmwi_order']['products_source'] = 'existing';
275 self::$templateOptions['pmwi_order']['fees_repeater_mode'] = 'csv';
276 self::$templateOptions['pmwi_order']['fees_repeater_mode_separator'] = '|';
277 self::$templateOptions['pmwi_order']['coupons_repeater_mode'] = 'csv';
278 self::$templateOptions['pmwi_order']['coupons_repeater_mode_separator'] = '|';
279 self::$templateOptions['pmwi_order']['shipping_repeater_mode'] = 'csv';
280 self::$templateOptions['pmwi_order']['shipping_repeater_mode_separator'] = '|';
281 self::$templateOptions['pmwi_order']['taxes_repeater_mode'] = 'csv';
282 self::$templateOptions['pmwi_order']['taxes_repeater_mode_separator'] = '|';
283 self::$templateOptions['pmwi_order']['order_total_logic'] = 'auto';
284 self::$templateOptions['pmwi_order']['order_refund_date'] = 'now';
285 self::$templateOptions['pmwi_order']['order_refund_issued_source'] = 'existing';
286 self::$templateOptions['pmwi_order']['order_refund_issued_match_by'] = 'username';
287 self::$templateOptions['pmwi_order']['notes_repeater_mode'] = 'csv';
288 self::$templateOptions['pmwi_order']['notes_repeater_mode_separator'] = '|';
289 }
290
291 if ( XmlExportEngine::$is_user_export )
292 {
293 self::$templateOptions['is_update_first_name'] = 0;
294 self::$templateOptions['is_update_last_name'] = 0;
295 self::$templateOptions['is_update_role'] = 0;
296 self::$templateOptions['is_update_nickname'] = 0;
297 self::$templateOptions['is_update_description'] = 0;
298 self::$templateOptions['is_update_login'] = 0;
299 self::$templateOptions['is_update_password'] = 0;
300 self::$templateOptions['is_update_nicename'] = 0;
301 self::$templateOptions['is_update_email'] = 0;
302 self::$templateOptions['is_update_registered'] = 0;
303 self::$templateOptions['is_update_display_name'] = 0;
304 self::$templateOptions['is_update_url'] = 0;
305 }
306
307 if (XmlExportEngine::$is_taxonomy_export){
308 self::$templateOptions['taxonomy_type'] = $exportOptions['taxonomy_to_export'];
309 }
310
311 self::prepare_import_template( $exportOptions );
312
313 if ( in_array('product', $exportOptions['cpt']) )
314 {
315 self::$templateOptions['single_page_parent'] = '';
316 if ( ! empty($exportOptions['export_variations']) && $exportOptions['export_variations'] == XmlExportEngine::VARIABLE_PRODUCTS_EXPORT_VARIATION ){
317 if ( $exportOptions['export_variations_title'] == XmlExportEngine::VARIATION_USE_PARENT_TITLE ){
318 self::$templateOptions['matching_parent'] = 'first_is_variation';
319 }
320 if ( $exportOptions['export_variations_title'] == XmlExportEngine::VARIATION_USE_DEFAULT_TITLE ) {
321 self::$templateOptions['matching_parent'] = 'first_is_parent_id';
322 }
323 self::$templateOptions['create_new_records'] = 0;
324 self::$templateOptions['is_update_product_type'] = 0;
325 }
326 }
327
328 $tpl_options = self::$templateOptions;
329
330 if ( 'csv' == $exportOptions['export_to'] )
331 {
332 $tpl_options['delimiter'] = $exportOptions['delimiter'];
333 $tpl_options['root_element'] = 'node';
334 }
335 else
336 {
337 $tpl_options['root_element'] = $exportOptions['record_xml_tag'];
338 }
339
340 $tpl_options['update_all_data'] = 'yes';
341 $tpl_options['is_update_status'] = 1;
342 $tpl_options['is_update_title'] = 1;
343 $tpl_options['is_update_author'] = 1;
344 $tpl_options['is_update_slug'] = 1;
345 $tpl_options['is_update_content'] = 1;
346 $tpl_options['is_update_excerpt'] = 1;
347 $tpl_options['is_update_dates'] = 1;
348 $tpl_options['is_update_menu_order'] = 1;
349 $tpl_options['is_update_parent'] = 1;
350 $tpl_options['is_update_attachments'] = 1;
351 $tpl_options['is_update_acf'] = 1;
352 $tpl_options['update_acf_logic'] = 'full_update';
353 $tpl_options['acf_list'] = '';
354 $tpl_options['is_update_product_type'] = 1;
355 $tpl_options['is_update_attributes'] = 1;
356 $tpl_options['update_attributes_logic'] = 'full_update';
357 $tpl_options['attributes_list'] = '';
358 $tpl_options['is_update_images'] = 1;
359 $tpl_options['is_update_custom_fields'] = 1;
360 $tpl_options['update_custom_fields_logic'] = 'full_update';
361 $tpl_options['custom_fields_list'] = '';
362 $tpl_options['is_update_categories'] = 1;
363 $tpl_options['update_categories_logic'] = 'full_update';
364 $tpl_options['taxonomies_list'] = '';
365
366 $tpl_data = array(
367 'name' => $exportOptions['template_name'],
368 'is_keep_linebreaks' => 1,
369 'is_leave_html' => 0,
370 'fix_characters' => 0,
371 'options' => $tpl_options,
372 );
373
374 $exportOptions['tpl_data'] = $tpl_data;
375
376 $export->set(array(
377 'options' => $exportOptions
378 ))->save();
379
380 }
381
382 $link_to_import and $export->options['is_generate_import'] and self::link_template_to_import( $export, $file_path, $foundPosts );
383 }
384
385 public static function link_template_to_import( & $export, $file_path, $foundPosts )
386 {
387
388 $exportOptions = $export->options;
389
390 // associate exported posts with new import
391 if ( wp_all_export_is_compatible() )
392 {
393 $options = self::$templateOptions + PMXI_Plugin::get_default_import_options();
394
395 $import = new PMXI_Import_Record();
396
397 $import->getById($exportOptions['import_id']);
398
399 if ( ! $import->isEmpty() and $import->parent_import_id == 99999 ){
400
401 $xmlPath = $file_path;
402
403 $root_element = '';
404
405 $historyPath = $file_path;
406
407 if ( 'csv' == $exportOptions['export_to'] )
408 {
409 $is_secure_import = PMXE_Plugin::getInstance()->getOption('secure');
410
411 $options['delimiter'] = $exportOptions['delimiter'];
412
413 include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportCsvParse.php' );
414
415 $path_info = pathinfo($xmlPath);
416
417 $path_parts = explode(DIRECTORY_SEPARATOR, $path_info['dirname']);
418
419 $security_folder = array_pop($path_parts);
420
421 $wp_uploads = wp_upload_dir();
422
423 $target = $is_secure_import ? $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXE_Plugin::UPLOADS_DIRECTORY . DIRECTORY_SEPARATOR . $security_folder : $wp_uploads['path'];
424
425 $csv = new PMXI_CsvParser( array( 'filename' => $xmlPath, 'targetDir' => $target ) );
426
427 if ( ! in_array($xmlPath, $exportOptions['attachment_list']) )
428 {
429 $exportOptions['attachment_list'][] = $csv->xml_path;
430 }
431
432 $historyPath = $csv->xml_path;
433
434 $root_element = 'node';
435
436 }
437 else
438 {
439 $root_element = apply_filters('wp_all_export_record_xml_tag', $exportOptions['record_xml_tag'], $export->id);
440 }
441
442 $import->set(array(
443 'xpath' => '/' . $root_element,
444 'type' => 'upload',
445 'options' => $options,
446 'root_element' => $root_element,
447 'path' => $xmlPath,
448 'name' => basename($xmlPath),
449 'imported' => 0,
450 'created' => 0,
451 'updated' => 0,
452 'skipped' => 0,
453 'deleted' => 0,
454 'iteration' => 1,
455 'count' => $foundPosts
456 ))->save();
457
458 $history_file = new PMXI_File_Record();
459 $history_file->set(array(
460 'name' => $import->name,
461 'import_id' => $import->id,
462 'path' => $historyPath,
463 'registered_on' => date('Y-m-d H:i:s') // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date -- DB timestamp must match local-timezone format used by Manage Exports UI readers (mysql2date / strtotime / human_time_diff)
464 ))->save();
465
466 $exportOptions['import_id'] = $import->id;
467
468 $export->set(array(
469 'options' => $exportOptions
470 ))->save();
471 }
472 }
473 }
474
475 public static function prepare_import_template( $exportOptions )
476 {
477 $options = $exportOptions;
478
479 $is_xml_template = $options['export_to'] == 'xml';
480
481 $required_add_ons = array();
482
483 $cf_list = array();
484 $attr_list = array();
485 $taxs_list = array();
486 $acf_list = array();
487
488 $implode_delimiter = ($options['delimiter'] == ',') ? '|' : ',';
489
490 $addons = new \Wpae\App\Service\Addons\AddonService();
491
492 if ( ! empty($options['is_user_export']) ) self::$templateOptions['pmui']['import_users'] = 1;
493
494 foreach ($options['ids'] as $ID => $value)
495 {
496 if (empty($options['cc_type'][$ID])) continue;
497
498 if ($is_xml_template)
499 {
500 $element_name = (!empty($options['cc_name'][$ID])) ? str_replace(':', '_', preg_replace('/[^a-z0-9_:-]/i', '', $options['cc_name'][$ID])) : 'untitled_' . $ID;
501 }
502 else
503 {
504 $element_name = strtolower((!empty($options['cc_name'][$ID])) ? preg_replace('/[^a-z0-9_]/i', '', $options['cc_name'][$ID]) : 'untitled_' . $ID);
505 }
506
507 if (empty($element_name)) $element_name = 'undefined' . $ID;
508
509 $element_type = $options['cc_type'][$ID];
510
511 switch ($element_type)
512 {
513 case 'woo':
514
515 if ( ! empty($options['cc_value'][$ID]) )
516 {
517 if (empty($required_add_ons['PMWI_Plugin']))
518 {
519 $required_add_ons['PMWI_Plugin'] = array(
520 'name' => 'WooCommerce Add-On Pro',
521 'paid' => true,
522 'url' => 'http://www.wpallimport.com/woocommerce-product-import/?utm_source=export-plugin-free&utm_medium=upgrade-notice&utm_campaign=import-wooco-products-template'
523 );
524 }
525
526 if($addons->isWooCommerceAddonActive() || $addons->isWooCommerceProductAddonActive()) {
527 XmlExportWooCommerce::prepare_import_template( $options, self::$templateOptions, $cf_list, $attr_list, $element_name, $options['cc_label'][$ID] );
528 }
529 }
530
531 break;
532
533 case 'acf':
534
535 if($addons->isAcfAddonActive()) {
536
537 if (empty($required_add_ons['PMAI_Plugin']))
538 {
539 $required_add_ons['PMAI_Plugin'] = array(
540 'name' => 'ACF Add-On Pro',
541 'paid' => true,
542 'url' => 'http://www.wpallimport.com/advanced-custom-fields/?utm_source=export-plugin-free&utm_medium=upgrade-notice&utm_campaign=import-acf-template'
543 );
544 }
545
546 $field_options = unserialize($options['cc_options'][$ID]);
547
548 // add ACF group ID to the template options
549 if( ! in_array($field_options['group_id'], self::$templateOptions['acf'])){
550 self::$templateOptions['acf'][$field_options['group_id']] = 1;
551 }
552
553 self::$templateOptions['fields'][$field_options['key']] = XmlExportACF::prepare_import_template( $options, self::$templateOptions, $acf_list, $element_name, $field_options);
554
555 }
556
557 break;
558
559 default:
560
561 XmlExportCpt::prepare_import_template( $options, self::$templateOptions, $cf_list, $attr_list, $taxs_list, $element_name, $ID);
562
563 XmlExportMediaGallery::prepare_import_template( $options, self::$templateOptions, $element_name, $ID);
564
565 if(XmlExportEngine::$is_custom_addon_export) {
566 XmlExportCustomRecord::prepare_import_template($options, self::$templateOptions, $element_name, $ID);
567 }
568
569 if($addons->isUserAddonActive()) {
570 XmlExportUser::prepare_import_template($options, self::$templateOptions, $element_name, $ID);
571 }
572
573 XmlExportTaxonomy::prepare_import_template( $options, self::$templateOptions, $element_name, $ID);
574
575 if($addons->isWooCommerceAddonActive() || $addons->isWooCommerceOrderAddonActive()) {
576 XmlExportWooCommerceOrder::prepare_import_template( $options, self::$templateOptions, $element_name, $ID);
577 }
578
579 break;
580 }
581 }
582
583 if ( ! empty($cf_list) )
584 {
585 self::$templateOptions['is_update_custom_fields'] = 1;
586 self::$templateOptions['custom_fields_list'] = $cf_list;
587 }
588 if ( ! empty($attr_list) )
589 {
590 self::$templateOptions['is_update_attributes'] = 1;
591 self::$templateOptions['update_attributes_logic'] = 'only';
592 self::$templateOptions['attributes_list'] = $attr_list;
593 self::$templateOptions['attributes_only_list'] = implode(',', $attr_list);
594 }
595 else{
596 self::$templateOptions['is_update_attributes'] = 0;
597 }
598 if ( ! empty($taxs_list) )
599 {
600 self::$templateOptions['is_update_categories'] = 1;
601 self::$templateOptions['taxonomies_list'] = $taxs_list;
602 }
603 if ( ! empty($acf_list) )
604 {
605 self::$templateOptions['is_update_acf'] = 1;
606 self::$templateOptions['acf_list'] = $acf_list;
607 }
608
609 self::$templateOptions['required_add_ons'] = $required_add_ons;
610 }
611 }
612
613 PMXE_Wpallimport::getInstance();