public static function prepare_import_template($exportOptions, &$templateOptions, $element_name, $ID)
 {
     $options = $exportOptions;
     $is_xml_template = $options['export_to'] == 'xml';
     $implode_delimiter = $options['delimiter'] == ',' ? '|' : ',';
     $element_type = $options['cc_type'][$ID];
     if (is_null(self::$is_include_feature_meta) || is_null(self::$is_include_gallery_meta)) {
         self::$is_include_feature_meta = false;
         self::$is_include_gallery_meta = false;
         foreach ($options['ids'] as $elID => $value) {
             if ('image_url' == $options['cc_type'][$elID]) {
                 $field_options = json_decode($options['cc_options'][$elID], true);
                 if (!empty($field_options['is_export_featured'])) {
                     self::$is_include_feature_meta = true;
                 }
                 if (!empty($field_options['is_export_attached'])) {
                     self::$is_include_gallery_meta = true;
                 }
             }
         }
     }
     switch ($element_type) {
         case 'media':
         case 'image_url':
             $field_options = json_decode($options['cc_options'][$ID], true);
             $templateOptions['is_update_images'] = 1;
             $templateOptions['update_images_logic'] = 'add_new';
             $templateOptions['download_featured_delim'] = empty($field_options['image_separator']) ? "|" : $field_options['image_separator'];
             if (empty($templateOptions['download_featured_image'])) {
                 $templateOptions['download_featured_image'] = '{' . $element_name . '[1]}';
             } else {
                 $templateOptions['download_featured_image'] .= $templateOptions['download_featured_delim'] . '{' . $element_name . '[1]}';
             }
             break;
         case 'image_title':
             $field_options = json_decode($options['cc_options'][$ID], true);
             if ((int) $field_options['is_export_featured'] == (int) self::$is_include_feature_meta && (int) $field_options['is_export_attached'] == (int) self::$is_include_gallery_meta) {
                 $templateOptions['set_image_meta_title'] = 1;
                 $templateOptions['image_meta_title_delim'] = empty($field_options['image_separator']) ? "|" : $field_options['image_separator'];
                 if (empty($templateOptions['image_meta_title'])) {
                     $templateOptions['image_meta_title'] = '{' . $element_name . '[1]}';
                 } else {
                     $templateOptions['image_meta_title'] .= $templateOptions['image_meta_title_delim'] . '{' . $element_name . '[1]}';
                 }
             }
             break;
         case 'image_caption':
             $field_options = json_decode($options['cc_options'][$ID], true);
             if ((int) $field_options['is_export_featured'] == (int) self::$is_include_feature_meta && (int) $field_options['is_export_attached'] == (int) self::$is_include_gallery_meta) {
                 $templateOptions['set_image_meta_caption'] = 1;
                 $templateOptions['image_meta_caption_delim'] = empty($field_options['image_separator']) ? "|" : $field_options['image_separator'];
                 if (empty($templateOptions['image_meta_caption'])) {
                     $templateOptions['image_meta_caption'] = '{' . $element_name . '[1]}';
                 } else {
                     $templateOptions['image_meta_caption'] .= $templateOptions['image_meta_caption_delim'] . '{' . $element_name . '[1]}';
                 }
             }
             break;
         case 'image_description':
             $field_options = json_decode($options['cc_options'][$ID], true);
             if ((int) $field_options['is_export_featured'] == (int) self::$is_include_feature_meta && (int) $field_options['is_export_attached'] == (int) self::$is_include_gallery_meta) {
                 $templateOptions['set_image_meta_description'] = 1;
                 $templateOptions['image_meta_description_delim'] = empty($field_options['image_separator']) ? "|" : $field_options['image_separator'];
                 if (empty($templateOptions['image_meta_description'])) {
                     $templateOptions['image_meta_description'] = '{' . $element_name . '[1]}';
                 } else {
                     $templateOptions['image_meta_description'] .= $templateOptions['image_meta_description_delim'] . '{' . $element_name . '[1]}';
                 }
             }
             break;
         case 'image_alt':
             $field_options = json_decode($options['cc_options'][$ID], true);
             if ((int) $field_options['is_export_featured'] == (int) self::$is_include_feature_meta && (int) $field_options['is_export_attached'] == (int) self::$is_include_gallery_meta) {
                 $templateOptions['set_image_meta_alt'] = 1;
                 $templateOptions['image_meta_alt_delim'] = empty($field_options['image_separator']) ? "|" : $field_options['image_separator'];
                 if (empty($templateOptions['image_meta_alt'])) {
                     $templateOptions['image_meta_alt'] = '{' . $element_name . '[1]}';
                 } else {
                     $templateOptions['image_meta_alt'] .= $templateOptions['image_meta_alt_delim'] . '{' . $element_name . '[1]}';
                 }
             }
             break;
         case 'attachments':
         case 'attachment_url':
             $templateOptions['atch_delim'] = '|';
             $templateOptions['is_update_attachments'] = 1;
             if (empty($templateOptions['attachments'])) {
                 $templateOptions['attachments'] = '{' . $element_name . '[1]}';
             } else {
                 $templateOptions['attachments'] .= $templateOptions['atch_delim'] . '{' . $element_name . '[1]}';
             }
             break;
     }
 }
Beispiel #2
0
 public static function prepare_data($entry, $xmlWriter = false, &$acfs, &$woo, &$woo_order, $implode_delimiter, $preview, $is_item_data = false, $subID = false)
 {
     $article = array();
     // associate exported post with import
     if (!$is_item_data and wp_all_export_is_compatible() and XmlExportEngine::$exportOptions['is_generate_import'] and XmlExportEngine::$exportOptions['import_id']) {
         $postRecord = new PMXI_Post_Record();
         $postRecord->clear();
         $postRecord->getBy(array('post_id' => $entry->ID, 'import_id' => XmlExportEngine::$exportOptions['import_id']));
         if ($postRecord->isEmpty()) {
             $postRecord->set(array('post_id' => $entry->ID, 'import_id' => XmlExportEngine::$exportOptions['import_id'], 'unique_key' => $entry->ID, 'product_key' => $entry->ID))->save();
         }
         unset($postRecord);
     }
     $is_xml_export = false;
     if (!empty($xmlWriter) and XmlExportEngine::$exportOptions['export_to'] == 'xml' and !in_array(XmlExportEngine::$exportOptions['xml_template_type'], array('custom', 'XmlGoogleMerchants'))) {
         $is_xml_export = true;
     }
     foreach (XmlExportEngine::$exportOptions['ids'] as $ID => $value) {
         $pType = $entry->post_type;
         if ($is_item_data and $subID != $ID) {
             continue;
         }
         // skip shop order items data
         if ($pType == "shop_order" and strpos(XmlExportEngine::$exportOptions['cc_label'][$ID], "item_data__") !== false and !$is_item_data) {
             continue;
         }
         $fieldName = XmlExportEngine::$exportOptions['cc_name'][$ID];
         $fieldValue = str_replace("item_data__", "", XmlExportEngine::$exportOptions['cc_value'][$ID]);
         $fieldLabel = str_replace("item_data__", "", XmlExportEngine::$exportOptions['cc_label'][$ID]);
         $fieldSql = XmlExportEngine::$exportOptions['cc_sql'][$ID];
         $fieldPhp = XmlExportEngine::$exportOptions['cc_php'][$ID];
         $fieldCode = XmlExportEngine::$exportOptions['cc_code'][$ID];
         $fieldType = XmlExportEngine::$exportOptions['cc_type'][$ID];
         $fieldOptions = XmlExportEngine::$exportOptions['cc_options'][$ID];
         $fieldSettings = empty(XmlExportEngine::$exportOptions['cc_settings'][$ID]) ? $fieldOptions : XmlExportEngine::$exportOptions['cc_settings'][$ID];
         if (empty($fieldName) or empty($fieldType) or !is_numeric($ID)) {
             continue;
         }
         $element_name = !empty($fieldName) ? $fieldName : 'untitled_' . $ID;
         $element_name_ns = '';
         if ($is_xml_export) {
             $element_name = !empty($fieldName) ? preg_replace('/[^a-z0-9_:-]/i', '', $fieldName) : 'untitled_' . $ID;
             if (strpos($element_name, ":") !== false) {
                 $element_name_parts = explode(":", $element_name);
                 $element_name_ns = empty($element_name_parts[0]) ? '' : $element_name_parts[0];
                 $element_name = empty($element_name_parts[1]) ? 'untitled_' . $ID : preg_replace('/[^a-z0-9_-]/i', '', $element_name_parts[1]);
             }
         }
         $fieldSnipped = (!empty($fieldPhp) and !empty($fieldCode)) ? $fieldCode : false;
         switch ($fieldType) {
             case 'id':
                 if ($element_name == 'ID') {
                     $element_name = 'id';
                 }
                 wp_all_export_write_article($article, $element_name, apply_filters('pmxe_post_id', pmxe_filter($entry->ID, $fieldSnipped), $entry->ID));
                 break;
             case 'permalink':
                 wp_all_export_write_article($article, $element_name, apply_filters('pmxe_post_guid', pmxe_filter(get_permalink(), $fieldSnipped), $entry->ID));
                 break;
             case 'post_type':
                 if ($entry->post_type == 'product_variation') {
                     $pType = 'product';
                 }
                 wp_all_export_write_article($article, $element_name, apply_filters('pmxe_post_type', pmxe_filter($pType, $fieldSnipped), $entry->ID));
                 break;
             case 'title':
                 $val = apply_filters('pmxe_post_title', pmxe_filter($entry->post_title, $fieldSnipped));
                 wp_all_export_write_article($article, $element_name, $preview ? trim(preg_replace('~[\\r\\n]+~', ' ', htmlspecialchars($val))) : $val, $entry->ID);
                 break;
             case 'content':
                 $val = apply_filters('pmxe_post_content', pmxe_filter($entry->post_content, $fieldSnipped), $entry->ID);
                 wp_all_export_write_article($article, $element_name, $preview ? trim(preg_replace('~[\\r\\n]+~', ' ', htmlspecialchars($val))) : $val);
                 break;
                 // Media Attachments
             // Media Attachments
             case 'attachments':
             case 'attachment_id':
             case 'attachment_url':
             case 'attachment_filename':
             case 'attachment_path':
             case 'attachment_title':
             case 'attachment_caption':
             case 'attachment_description':
             case 'attachment_alt':
                 XmlExportMediaGallery::getInstance($entry->ID);
                 $attachment_data = XmlExportMediaGallery::get_attachments($fieldType);
                 wp_all_export_write_article($article, $element_name, apply_filters('pmxe_' . $fieldType, pmxe_filter(implode($implode_delimiter, $attachment_data), $fieldSnipped), $entry->ID));
                 break;
                 // Media Images
             // Media Images
             case 'media':
             case 'image_id':
             case 'image_url':
             case 'image_filename':
             case 'image_path':
             case 'image_title':
             case 'image_caption':
             case 'image_description':
             case 'image_alt':
                 $field_options = json_decode($fieldOptions, true);
                 XmlExportMediaGallery::getInstance($entry->ID);
                 $images_data = XmlExportMediaGallery::get_images($fieldType, $field_options);
                 $images_separator = empty($field_options['image_separator']) ? $implode_delimiter : $field_options['image_separator'];
                 wp_all_export_write_article($article, $element_name, apply_filters('pmxe_' . $fieldType, pmxe_filter(implode($images_separator, $images_data), $fieldSnipped), $entry->ID));
                 break;
             case 'date':
                 if (!empty($fieldSettings)) {
                     switch ($fieldSettings) {
                         case 'unix':
                             $post_date = get_post_time('U', true, $entry->ID);
                             break;
                         default:
                             $post_date = date($fieldSettings, get_post_time('U', true, $entry->ID));
                             break;
                     }
                 } else {
                     $post_date = date("Ymd", get_post_time('U', true, $entry->ID));
                 }
                 wp_all_export_write_article($article, $element_name, apply_filters('pmxe_post_date', pmxe_filter($post_date, $fieldSnipped), $entry->ID));
                 break;
             case 'parent':
                 wp_all_export_write_article($article, $element_name, apply_filters('pmxe_post_parent', pmxe_filter($entry->post_parent, $fieldSnipped), $entry->ID));
                 break;
             case 'comment_status':
                 wp_all_export_write_article($article, $element_name, apply_filters('pmxe_comment_status', pmxe_filter($entry->comment_status, $fieldSnipped), $entry->ID));
                 break;
             case 'ping_status':
                 wp_all_export_write_article($article, $element_name, apply_filters('pmxe_ping_status', pmxe_filter($entry->ping_status, $fieldSnipped), $entry->ID));
                 break;
             case 'template':
                 wp_all_export_write_article($article, $element_name, apply_filters('pmxe_post_template', pmxe_filter(get_post_meta($entry->ID, '_wp_page_template', true), $fieldSnipped), $entry->ID));
                 break;
             case 'order':
                 wp_all_export_write_article($article, $element_name, apply_filters('pmxe_menu_order', pmxe_filter($entry->menu_order, $fieldSnipped), $entry->ID));
                 break;
             case 'status':
                 wp_all_export_write_article($article, $element_name, apply_filters('pmxe_post_status', pmxe_filter($entry->post_status, $fieldSnipped), $entry->ID));
                 break;
             case 'format':
                 wp_all_export_write_article($article, $element_name, apply_filters('pmxe_post_format', pmxe_filter(get_post_format($entry->ID), $fieldSnipped), $entry->ID));
                 break;
             case 'author':
                 wp_all_export_write_article($article, $element_name, apply_filters('pmxe_post_author', pmxe_filter($entry->post_author, $fieldSnipped), $entry->ID));
                 break;
             case 'slug':
                 wp_all_export_write_article($article, $element_name, apply_filters('pmxe_post_slug', pmxe_filter($entry->post_name, $fieldSnipped), $entry->ID));
                 break;
             case 'excerpt':
                 $val = apply_filters('pmxe_post_excerpt', pmxe_filter($entry->post_excerpt, $fieldSnipped), $entry->ID);
                 wp_all_export_write_article($article, $element_name, $preview ? trim(preg_replace('~[\\r\\n]+~', ' ', htmlspecialchars($val))) : $val);
                 break;
             case 'cf':
                 if (!empty($fieldValue)) {
                     $val = "";
                     $cur_meta_values = get_post_meta($entry->ID, $fieldValue);
                     if (!empty($cur_meta_values) and is_array($cur_meta_values)) {
                         foreach ($cur_meta_values as $key => $cur_meta_value) {
                             if (empty($val)) {
                                 $val = apply_filters('pmxe_custom_field', pmxe_filter(maybe_serialize($cur_meta_value), $fieldSnipped), $fieldValue, $entry->ID);
                             } else {
                                 $val = apply_filters('pmxe_custom_field', pmxe_filter($val . $implode_delimiter . maybe_serialize($cur_meta_value), $fieldSnipped), $fieldValue, $entry->ID);
                             }
                         }
                         wp_all_export_write_article($article, $element_name, $val);
                     }
                     if (empty($cur_meta_values)) {
                         if (empty($article[$element_name])) {
                             wp_all_export_write_article($article, $element_name, apply_filters('pmxe_custom_field', pmxe_filter('', $fieldSnipped), $fieldValue, $entry->ID));
                         }
                     }
                 }
                 break;
             case 'acf':
                 if (!empty($fieldLabel) and class_exists('acf')) {
                     global $acf;
                     $field_options = unserialize($fieldOptions);
                     if (!$is_xml_export) {
                         switch ($field_options['type']) {
                             case 'textarea':
                             case 'oembed':
                             case 'wysiwyg':
                             case 'wp_wysiwyg':
                             case 'date_time_picker':
                             case 'date_picker':
                                 $field_value = get_field($fieldLabel, $entry->ID, false);
                                 break;
                             default:
                                 $field_value = get_field($fieldLabel, $entry->ID);
                                 break;
                         }
                     } else {
                         $field_value = get_field($fieldLabel, $entry->ID);
                     }
                     XmlExportACF::export_acf_field($field_value, XmlExportEngine::$exportOptions, $ID, $entry->ID, $article, $xmlWriter, $acfs, $element_name, $element_name_ns, $fieldSnipped, $field_options['group_id'], $preview);
                 }
                 break;
             case 'woo':
                 if ($is_xml_export) {
                     XmlExportEngine::$woo_export->export_xml($xmlWriter, $entry, XmlExportEngine::$exportOptions, $ID);
                 } else {
                     XmlExportEngine::$woo_export->export_csv($article, $woo, $entry, XmlExportEngine::$exportOptions, $ID);
                 }
                 break;
             case 'woo_order':
                 if ($is_xml_export) {
                     XmlExportEngine::$woo_order_export->export_xml($xmlWriter, $entry, XmlExportEngine::$exportOptions, $ID, $preview);
                 } else {
                     XmlExportEngine::$woo_order_export->export_csv($article, $woo_order, $entry, XmlExportEngine::$exportOptions, $ID, $preview);
                 }
                 break;
             case 'attr':
                 if (!empty($fieldValue)) {
                     if ($entry->post_parent == 0) {
                         $txes_list = get_the_terms($entry->ID, $fieldValue);
                         if (!is_wp_error($txes_list) and !empty($txes_list)) {
                             $attr_new = array();
                             foreach ($txes_list as $t) {
                                 $attr_new[] = $t->name;
                             }
                             wp_all_export_write_article($article, $element_name, apply_filters('pmxe_woo_attribute', pmxe_filter(implode($implode_delimiter, $attr_new), $fieldSnipped), $entry->ID, $fieldValue));
                         }
                     } else {
                         $attribute_pa = apply_filters('pmxe_woo_attribute', get_post_meta($entry->ID, 'attribute_' . $fieldValue, true), $entry->ID, $fieldValue);
                         wp_all_export_write_article($article, $element_name, $attribute_pa);
                     }
                     // if ( ! in_array($element_name, $attributes)) $attributes[] = $element_name;
                 }
                 break;
             case 'cats':
                 if (!empty($fieldValue)) {
                     // get categories from parent product in case when variation exported
                     $entry_id = $entry->post_type == 'product_variation' ? $entry->post_parent : $entry->ID;
                     $txes_list = get_the_terms($entry_id, $fieldValue);
                     $hierarchy_groups = array();
                     if (!is_wp_error($txes_list) and !empty($txes_list)) {
                         $txes_ids = array();
                         foreach ($txes_list as $t) {
                             $txes_ids[] = $t->term_id;
                         }
                         foreach ($txes_list as $t) {
                             if (wp_all_export_check_children_assign($t->term_id, $fieldValue, $txes_ids)) {
                                 $ancestors = get_ancestors($t->term_id, $fieldValue);
                                 if (count($ancestors) > 0) {
                                     $hierarchy_group = array();
                                     for ($i = count($ancestors) - 1; $i >= 0; $i--) {
                                         $term = get_term_by('id', $ancestors[$i], $fieldValue);
                                         if ($term) {
                                             $hierarchy_group[] = $term->name;
                                         }
                                     }
                                     $hierarchy_group[] = $t->name;
                                     $hierarchy_groups[] = implode('>', $hierarchy_group);
                                 } else {
                                     $hierarchy_groups[] = $t->name;
                                 }
                             }
                         }
                         // if ( empty($hierarchy_groups) ) $hierarchy_groups = '';
                     }
                     wp_all_export_write_article($article, $element_name, apply_filters('pmxe_post_taxonomy', pmxe_filter(implode($implode_delimiter, $hierarchy_groups), $fieldSnipped), $entry->ID));
                     // if ( ! in_array($element_name, $taxes)) $taxes[] = $element_name;
                     if ($fieldLabel == 'product_type') {
                         if ($entry->post_type == 'product_variation') {
                             $article[$element_name] = 'variable';
                         }
                         $article['parent_id'] = $entry->post_parent;
                         if ($is_xml_export) {
                             $xmlWriter->beginElement($element_name_ns, 'parent_id', null);
                             $xmlWriter->writeData($article['parent_id'], 'parent_id');
                             $xmlWriter->closeElement();
                         }
                     }
                 }
                 break;
             case 'sql':
                 if (!empty($fieldSql)) {
                     global $wpdb;
                     $val = $wpdb->get_var($wpdb->prepare(stripcslashes(str_replace("%%ID%%", "%d", $fieldSql)), $entry->ID));
                     if (!empty($fieldPhp) and !empty($fieldCode)) {
                         // if shortcode defined
                         if (strpos($fieldCode, '[') === 0) {
                             $val = do_shortcode(str_replace("%%VALUE%%", $val, $fieldCode));
                         } else {
                             $val = eval('return ' . stripcslashes(str_replace("%%VALUE%%", $val, $fieldCode)) . ';');
                         }
                     }
                     wp_all_export_write_article($article, $element_name, apply_filters('pmxe_sql_field', $val, $element_name, $entry->ID));
                 }
                 break;
             case 'wpml_trid':
                 $post_type = get_post_type($entry->ID);
                 $post_type = apply_filters('wpml_element_type', $post_type);
                 $post_language_details = apply_filters('wpml_element_language_details', null, array('element_id' => $entry->ID, 'element_type' => $post_type));
                 $trid = empty($post_language_details->trid) ? '' : $post_language_details->trid;
                 wp_all_export_write_article($article, $element_name, apply_filters('pmxe_trid_field', $trid, $element_name, $entry->ID));
                 break;
             case 'wpml_lang':
                 $post_type = get_post_type($entry->ID);
                 $post_type = apply_filters('wpml_element_type', $post_type);
                 $post_language_details = apply_filters('wpml_element_language_details', null, array('element_id' => $entry->ID, 'element_type' => $post_type));
                 $language_code = empty($post_language_details->language_code) ? '' : $post_language_details->language_code;
                 wp_all_export_write_article($article, $element_name, apply_filters('pmxe_trid_field', $language_code, $element_name, $entry->ID));
                 break;
             default:
                 # code...
                 break;
         }
         if ($is_xml_export and isset($article[$element_name])) {
             $element_name_in_file = XmlCsvExport::_get_valid_header_name($element_name);
             $xmlWriter = apply_filters('wp_all_export_add_before_element', $xmlWriter, $element_name_in_file, XmlExportEngine::$exportID, $entry->ID);
             $xmlWriter->beginElement($element_name_ns, $element_name_in_file, null);
             $xmlWriter->writeData($article[$element_name], $element_name_in_file);
             $xmlWriter->closeElement();
             $xmlWriter = apply_filters('wp_all_export_add_after_element', $xmlWriter, $element_name_in_file, XmlExportEngine::$exportID, $entry->ID);
         }
     }
     return $article;
 }
Beispiel #3
0
 public static function prepare_import_template($exportOptions)
 {
     $options = $exportOptions;
     $is_xml_template = $options['export_to'] == 'xml';
     $required_add_ons = array();
     $cf_list = array();
     $attr_list = array();
     $taxs_list = array();
     $acf_list = array();
     $implode_delimiter = $options['delimiter'] == ',' ? '|' : ',';
     if (!empty($options['is_user_export'])) {
         self::$templateOptions['pmui']['import_users'] = 1;
     }
     foreach ($options['ids'] as $ID => $value) {
         if (empty($options['cc_type'][$ID])) {
             continue;
         }
         if ($is_xml_template) {
             $element_name = !empty($options['cc_name'][$ID]) ? str_replace(':', '_', preg_replace('/[^a-z0-9_:-]/i', '', $options['cc_name'][$ID])) : 'untitled_' . $ID;
         } else {
             $element_name = strtolower(!empty($options['cc_name'][$ID]) ? preg_replace('/[^a-z0-9_]/i', '', $options['cc_name'][$ID]) : 'untitled_' . $ID);
         }
         $element_type = $options['cc_type'][$ID];
         switch ($element_type) {
             case 'woo':
                 if (!empty($options['cc_value'][$ID])) {
                     if (empty($required_add_ons['PMWI_Plugin'])) {
                         $required_add_ons['PMWI_Plugin'] = array('name' => 'WooCommerce Add-On Pro', 'paid' => true, 'url' => 'http://www.wpallimport.com/woocommerce-product-import/');
                     }
                     XmlExportWooCommerce::prepare_import_template($options, self::$templateOptions, $cf_list, $attr_list, $element_name, $options['cc_label'][$ID]);
                 }
                 break;
             case 'acf':
                 if (empty($required_add_ons['PMAI_Plugin'])) {
                     $required_add_ons['PMAI_Plugin'] = array('name' => 'ACF Add-On Pro', 'paid' => true, 'url' => 'http://www.wpallimport.com/advanced-custom-fields/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin');
                 }
                 $field_options = unserialize($options['cc_options'][$ID]);
                 // add ACF group ID to the template options
                 if (!in_array($field_options['group_id'], self::$templateOptions['acf'])) {
                     self::$templateOptions['acf'][$field_options['group_id']] = 1;
                 }
                 self::$templateOptions['fields'][$field_options['key']] = XmlExportACF::prepare_import_template($options, self::$templateOptions, $acf_list, $element_name, $field_options);
                 break;
             default:
                 XmlExportCpt::prepare_import_template($options, self::$templateOptions, $cf_list, $attr_list, $taxs_list, $element_name, $ID);
                 XmlExportMediaGallery::prepare_import_template($options, self::$templateOptions, $element_name, $ID);
                 XmlExportWooCommerceOrder::prepare_import_template($options, self::$templateOptions, $element_name, $ID);
                 break;
         }
     }
     if (!empty($cf_list)) {
         self::$templateOptions['is_update_custom_fields'] = 1;
         self::$templateOptions['custom_fields_list'] = $cf_list;
     }
     if (!empty($attr_list)) {
         self::$templateOptions['is_update_attributes'] = 1;
         self::$templateOptions['update_attributes_logic'] = 'only';
         self::$templateOptions['attributes_list'] = $attr_list;
         self::$templateOptions['attributes_only_list'] = implode(',', $attr_list);
     } else {
         self::$templateOptions['is_update_attributes'] = 0;
     }
     if (!empty($taxs_list)) {
         self::$templateOptions['is_update_categories'] = 1;
         self::$templateOptions['taxonomies_list'] = $taxs_list;
     }
     if (!empty($acf_list)) {
         self::$templateOptions['is_update_acf'] = 1;
         self::$templateOptions['acf_list'] = $acf_list;
     }
     self::$templateOptions['required_add_ons'] = $required_add_ons;
 }