backward.php
2 months ago
get_taxonomies_by_object_type.php
2 months ago
pmxe_filter.php
2 months ago
pmxe_functions.php
2 months ago
pmxe_prepare_price.php
2 months ago
pmxe_render_xml_attributes.php
2 months ago
pmxe_render_xml_element.php
2 months ago
pmxe_render_xml_text.php
2 months ago
str_getcsv.php
2 months ago
wp_all_export_check_children_assign.php
2 months ago
wp_all_export_clear_xss.php
2 months ago
wp_all_export_comments_clauses.php
2 months ago
wp_all_export_generate_export_file.php
2 months ago
wp_all_export_get_cpt_name.php
2 months ago
wp_all_export_get_export_format.php
2 months ago
wp_all_export_is_compatible.php
2 months ago
wp_all_export_parse_field_name.php
2 months ago
wp_all_export_posts_join.php
2 months ago
wp_all_export_posts_where.php
2 months ago
wp_all_export_pre_user_query.php
2 months ago
wp_all_export_prepare_template_csv.php
2 months ago
wp_all_export_prepare_template_xml.php
2 months ago
wp_all_export_rand_char.php
2 months ago
wp_all_export_remove_colons.php
2 months ago
wp_all_export_remove_source.php
2 months ago
wp_all_export_reverse_rules_html.php
2 months ago
wp_all_export_rmdir.php
2 months ago
wp_all_export_secure_file.php
2 months ago
wp_all_export_terms_clauses.php
2 months ago
wp_all_export_url_title.php
2 months ago
wp_all_export_write_article.php
2 months ago
wp_redirect_or_javascript.php
2 months ago
wp_all_export_prepare_template_xml.php
541 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 | defined( 'ABSPATH' ) || exit; |
| 5 | |
| 6 | |
| 7 | function wp_all_export_prepare_template_xml($exportOptions, &$templateOptions) |
| 8 | { |
| 9 | if ($exportOptions['ids']){ |
| 10 | |
| 11 | $required_add_ons = array(); |
| 12 | |
| 13 | $cf_list = array(); |
| 14 | $attr_list = array(); |
| 15 | $taxs_list = array(); |
| 16 | $acf_list = array(); |
| 17 | |
| 18 | if ( ! empty($exportOptions['is_user_export']) ) $templateOptions['pmui']['import_users'] = 1; |
| 19 | |
| 20 | foreach ($exportOptions['ids'] as $ID => $value) { |
| 21 | if (empty($exportOptions['cc_type'][$ID])) continue; |
| 22 | $element_name = (!empty($exportOptions['cc_name'][$ID])) ? str_replace(':', '_', preg_replace('/[^a-z0-9_:-]/i', '', $exportOptions['cc_name'][$ID])) : 'untitled_' . $ID; |
| 23 | switch ($exportOptions['cc_type'][$ID]) { |
| 24 | case 'id': |
| 25 | $templateOptions['unique_key'] = '{'. $element_name .'[1]}'; |
| 26 | $templateOptions['tmp_unique_key'] = '{'. $element_name .'[1]}'; |
| 27 | $templateOptions['single_product_id'] = '{'. $element_name .'[1]}'; |
| 28 | break; |
| 29 | case 'title': |
| 30 | case 'content': |
| 31 | case 'author': |
| 32 | case 'parent': |
| 33 | case 'slug': |
| 34 | $templateOptions[$exportOptions['cc_type'][$ID]] = '{'. $element_name .'[1]}'; |
| 35 | $templateOptions['is_update_' . $exportOptions['cc_type'][$ID]] = 1; |
| 36 | break; |
| 37 | case 'excerpt': |
| 38 | $templateOptions['post_excerpt'] = '{'. $element_name .'[1]}'; |
| 39 | $templateOptions['is_update_' . $exportOptions['cc_type'][$ID]] = 1; |
| 40 | break; |
| 41 | case 'status': |
| 42 | $templateOptions['status_xpath'] = '{'. $element_name .'[1]}'; |
| 43 | $templateOptions['is_update_status'] = 1; |
| 44 | break; |
| 45 | case 'date': |
| 46 | $templateOptions[$exportOptions['cc_type'][$ID]] = '{'. $element_name .'[1]}'; |
| 47 | $templateOptions['is_update_dates'] = 1; |
| 48 | break; |
| 49 | |
| 50 | case 'post_type': |
| 51 | if ( empty($exportOptions['cpt']) ){ |
| 52 | $templateOptions['is_override_post_type'] = 1; |
| 53 | $templateOptions['post_type_xpath'] = '{'. $element_name .'[1]}'; |
| 54 | } |
| 55 | break; |
| 56 | case 'cf': |
| 57 | if ( ! empty($exportOptions['cc_value'][$ID]) ){ |
| 58 | if ( ! in_array($exportOptions['cc_value'][$ID], $cf_list)) $cf_list[] = $exportOptions['cc_value'][$ID]; |
| 59 | $templateOptions['custom_name'][] = $exportOptions['cc_value'][$ID]; |
| 60 | $templateOptions['custom_value'][] = '{'. $element_name .'[1]}'; |
| 61 | $templateOptions['custom_format'][] = 0; |
| 62 | } |
| 63 | break; |
| 64 | case 'woo': |
| 65 | |
| 66 | if ( ! empty($exportOptions['cc_value'][$ID]) ) |
| 67 | { |
| 68 | if (empty($required_add_ons['PMWI_Plugin'])) |
| 69 | { |
| 70 | $required_add_ons['PMWI_Plugin'] = array( |
| 71 | 'name' => 'WooCommerce Add-On Pro', |
| 72 | 'paid' => true, |
| 73 | 'url' => 'http://www.wpallimport.com/woocommerce-product-import/' |
| 74 | ); |
| 75 | } |
| 76 | |
| 77 | if ( ! in_array($exportOptions['cc_label'][$ID], $cf_list)) $cf_list[] = $exportOptions['cc_label'][$ID]; |
| 78 | |
| 79 | switch ($exportOptions['cc_label'][$ID]) { |
| 80 | case '_visibility': |
| 81 | $templateOptions['is_product_visibility'] = 'xpath'; |
| 82 | $templateOptions['single_product_visibility'] = '{'. $element_name .'[1]}'; |
| 83 | break; |
| 84 | case '_stock_status': |
| 85 | $templateOptions['product_stock_status'] = 'xpath'; |
| 86 | $templateOptions['single_product_stock_status'] = '{'. $element_name .'[1]}'; |
| 87 | break; |
| 88 | case '_downloadable': |
| 89 | $templateOptions['is_product_downloadable'] = 'xpath'; |
| 90 | $templateOptions['single_product_downloadable'] = '{'. $element_name .'[1]}'; |
| 91 | break; |
| 92 | case '_virtual': |
| 93 | $templateOptions['is_product_virtual'] = 'xpath'; |
| 94 | $templateOptions['single_product_virtual'] = '{'. $element_name .'[1]}'; |
| 95 | break; |
| 96 | case '_price': |
| 97 | $templateOptions['single_product_regular_price'] = '{'. $element_name .'[1]}'; |
| 98 | break; |
| 99 | case '_regular_price': |
| 100 | $templateOptions['single_product_regular_price'] = '{'. $element_name .'[1]}'; |
| 101 | if ( ! in_array('_price', $cf_list)) $cf_list[] = '_price'; |
| 102 | break; |
| 103 | case '_sale_price': |
| 104 | $templateOptions['single_product_sale_price'] = '{'. $element_name .'[1]}'; |
| 105 | if ( ! in_array('_price', $cf_list)) $cf_list[] = '_price'; |
| 106 | break; |
| 107 | case '_purchase_note': |
| 108 | $templateOptions['single_product_purchase_note'] = '{'. $element_name .'[1]}'; |
| 109 | break; |
| 110 | case '_featured': |
| 111 | $templateOptions['is_product_featured'] = 'xpath'; |
| 112 | $templateOptions['single_product_featured'] = '{'. $element_name .'[1]}'; |
| 113 | break; |
| 114 | case '_weight': |
| 115 | $templateOptions['single_product_weight'] = '{'. $element_name .'[1]}'; |
| 116 | break; |
| 117 | case '_length': |
| 118 | $templateOptions['single_product_length'] = '{'. $element_name .'[1]}'; |
| 119 | break; |
| 120 | case '_width': |
| 121 | $templateOptions['single_product_width'] = '{'. $element_name .'[1]}'; |
| 122 | break; |
| 123 | case '_height': |
| 124 | $templateOptions['single_product_height'] = '{'. $element_name .'[1]}'; |
| 125 | break; |
| 126 | case '_sku': |
| 127 | $templateOptions['single_product_sku'] = '{'. $element_name .'[1]}'; |
| 128 | $templateOptions['single_product_parent_id'] = '{parent_id[1]}'; |
| 129 | break; |
| 130 | case '_sale_price_dates_from': |
| 131 | $templateOptions['single_sale_price_dates_from'] = '{'. $element_name .'[1]}'; |
| 132 | break; |
| 133 | case '_sale_price_dates_to': |
| 134 | $templateOptions['single_sale_price_dates_to'] = '{'. $element_name .'[1]}'; |
| 135 | break; |
| 136 | case '_sold_individually': |
| 137 | $templateOptions['product_sold_individually'] = 'xpath'; |
| 138 | $templateOptions['single_product_sold_individually'] = '{'. $element_name .'[1]}'; |
| 139 | break; |
| 140 | case '_manage_stock': |
| 141 | $templateOptions['is_product_manage_stock'] = 'xpath'; |
| 142 | $templateOptions['single_product_manage_stock'] = '{'. $element_name .'[1]}'; |
| 143 | break; |
| 144 | case '_stock': |
| 145 | $templateOptions['single_product_stock_qty'] = '{'. $element_name .'[1]}'; |
| 146 | break; |
| 147 | case '_upsell_ids': |
| 148 | $templateOptions['single_product_up_sells'] = '{'. $element_name .'[1]}'; |
| 149 | break; |
| 150 | case '_crosssell_ids': |
| 151 | $templateOptions['single_product_cross_sells'] = '{'. $element_name .'[1]}'; |
| 152 | break; |
| 153 | case '_downloadable_files': |
| 154 | $templateOptions['single_product_files'] = '{'. $element_name .'_paths[1]}'; |
| 155 | $templateOptions['single_product_files_names'] = '{'. $element_name .'_names[1]}'; |
| 156 | break; |
| 157 | case '_download_limit': |
| 158 | $templateOptions['single_product_download_limit'] = '{'. $element_name .'[1]}'; |
| 159 | break; |
| 160 | case '_download_expiry': |
| 161 | $templateOptions['single_product_download_expiry'] = '{'. $element_name .'[1]}'; |
| 162 | break; |
| 163 | case '_download_type': |
| 164 | $templateOptions['single_product_download_type'] = '{'. $element_name .'[1]}'; |
| 165 | break; |
| 166 | case '_product_url': |
| 167 | $templateOptions['single_product_url'] = '{'. $element_name .'[1]}'; |
| 168 | break; |
| 169 | case '_button_text': |
| 170 | $templateOptions['single_product_button_text'] = '{'. $element_name .'[1]}'; |
| 171 | break; |
| 172 | case '_tax_status': |
| 173 | $templateOptions['is_multiple_product_tax_status'] = 'no'; |
| 174 | $templateOptions['single_product_tax_status'] = '{'. $element_name .'[1]}'; |
| 175 | break; |
| 176 | case '_tax_class': |
| 177 | $templateOptions['is_multiple_product_tax_class'] = 'no'; |
| 178 | $templateOptions['single_product_tax_class'] = '{'. $element_name .'[1]}'; |
| 179 | break; |
| 180 | case '_backorders': |
| 181 | $templateOptions['product_allow_backorders'] = 'xpath'; |
| 182 | $templateOptions['single_product_allow_backorders'] = '{'. $element_name .'[1]}'; |
| 183 | break; |
| 184 | case 'attributes': |
| 185 | |
| 186 | global $wp_taxonomies; |
| 187 | |
| 188 | foreach ($wp_taxonomies as $key => $obj) { if (in_array($obj->name, array('nav_menu'))) continue; |
| 189 | |
| 190 | if (strpos($obj->name, "pa_") === 0 and strlen($obj->name) > 3) |
| 191 | { |
| 192 | $templateOptions['attribute_name'][] = '{AttributeName' . $obj->name .'[1]}'; |
| 193 | $templateOptions['attribute_value'][] = '{AttributeValue' . $obj->name .'[1]}'; |
| 194 | $templateOptions['in_variations'][] = "1"; |
| 195 | $templateOptions['is_visible'][] = "1"; |
| 196 | $templateOptions['is_taxonomy'][] = "1"; |
| 197 | $templateOptions['create_taxonomy_in_not_exists'][] = "1"; |
| 198 | |
| 199 | $templateOptions['is_advanced'][] = "1"; |
| 200 | $templateOptions['advanced_is_create_terms'][] = "yes"; |
| 201 | $templateOptions['advanced_in_variations'][] = "xpath"; |
| 202 | $templateOptions['advanced_is_visible'][] = "xpath"; |
| 203 | $templateOptions['advanced_is_taxonomy'][] = "xpath"; |
| 204 | $templateOptions['advanced_in_variations_xpath'][] = '{AttributeInVariations' . $obj->name .'[1]}'; |
| 205 | $templateOptions['advanced_is_visible_xpath'][] = '{AttributeIsVisible' . $obj->name .'[1]}'; |
| 206 | $templateOptions['advanced_is_taxonomy_xpath'][] = '{AttributeIsTaxonomy' . $obj->name .'[1]}'; |
| 207 | |
| 208 | $attr_list[] = $obj->name; |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | global $wpdb; |
| 213 | |
| 214 | $table_prefix = $wpdb->prefix; |
| 215 | |
| 216 | // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,PluginCheck.Security.DirectDB.UnescapedDBParameter -- $table_prefix from $wpdb->prefix; LIKE values bound via prepare() |
| 217 | $attributes = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT meta_key FROM {$table_prefix}postmeta |
| 218 | WHERE {$table_prefix}postmeta.meta_key LIKE %s AND {$table_prefix}postmeta.meta_key NOT LIKE %s", 'attribute_%', 'attribute_pa_%')); |
| 219 | |
| 220 | if ( ! empty($attributes)) |
| 221 | { |
| 222 | foreach ($attributes as $attribute) |
| 223 | { |
| 224 | $attribute_name = ucfirst(str_replace('attribute_', '', $attribute->meta_key)); |
| 225 | $templateOptions['attribute_name'][] = '{AttributeName' . $attribute_name .'[1]}'; |
| 226 | $templateOptions['attribute_value'][] = '{AttributeValue' . $attribute_name .'[1]}'; |
| 227 | $templateOptions['in_variations'][] = "1"; |
| 228 | $templateOptions['is_visible'][] = "1"; |
| 229 | $templateOptions['is_taxonomy'][] = "1"; |
| 230 | $templateOptions['create_taxonomy_in_not_exists'][] = "1"; |
| 231 | |
| 232 | $templateOptions['is_advanced'][] = "1"; |
| 233 | $templateOptions['advanced_is_create_terms'][] = "yes"; |
| 234 | $templateOptions['advanced_in_variations'][] = "xpath"; |
| 235 | $templateOptions['advanced_is_visible'][] = "xpath"; |
| 236 | $templateOptions['advanced_is_taxonomy'][] = "xpath"; |
| 237 | $templateOptions['advanced_in_variations_xpath'][] = '{AttributeInVariations' . $attribute_name .'[1]}'; |
| 238 | $templateOptions['advanced_is_visible_xpath'][] = '{AttributeIsVisible' . $attribute_name .'[1]}'; |
| 239 | $templateOptions['advanced_is_taxonomy_xpath'][] = '{AttributeIsTaxonomy' . $attribute_name .'[1]}'; |
| 240 | |
| 241 | $attr_list[] = str_replace('attribute_', '', $attribute->meta_key); |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | break; |
| 246 | default: |
| 247 | # code... |
| 248 | break; |
| 249 | } |
| 250 | } |
| 251 | break; |
| 252 | case 'acf': |
| 253 | |
| 254 | if (empty($required_add_ons['PMAI_Plugin'])) |
| 255 | { |
| 256 | $required_add_ons['PMAI_Plugin'] = array( |
| 257 | 'name' => 'ACF Add-On Pro', |
| 258 | 'paid' => true, |
| 259 | 'url' => 'http://www.wpallimport.com/advanced-custom-fields/?utm_source=export-plugin-free&utm_medium=required-addons&utm_campaign=acf' |
| 260 | ); |
| 261 | } |
| 262 | |
| 263 | $field_options = unserialize($exportOptions['cc_options'][$ID]); |
| 264 | |
| 265 | // add ACF group ID to the template options |
| 266 | if( ! in_array($field_options['group_id'], $templateOptions['acf'])){ |
| 267 | $templateOptions['acf'][$field_options['group_id']] = 1; |
| 268 | } |
| 269 | |
| 270 | $field_tpl_key = $element_name . '[1]'; |
| 271 | |
| 272 | $acf_list[] = '[' . $field_options['name'] . '] ' . $field_options['label']; |
| 273 | |
| 274 | switch ($field_options['type']) { |
| 275 | |
| 276 | case 'text': |
| 277 | case 'textarea': |
| 278 | case 'number': |
| 279 | case 'email': |
| 280 | case 'password': |
| 281 | case 'url': |
| 282 | case 'oembed': |
| 283 | case 'wysiwyg': |
| 284 | case 'image': |
| 285 | case 'file': |
| 286 | case 'gallery': |
| 287 | case 'date_picker': |
| 288 | case 'color_picker': |
| 289 | case 'acf_cf7': |
| 290 | case 'gravity_forms_field': |
| 291 | case 'limiter': |
| 292 | case 'wp_wysiwyg': |
| 293 | case 'date_time_picker': |
| 294 | case 'post_object': |
| 295 | case 'page_link': |
| 296 | case 'relationship': |
| 297 | case 'user': |
| 298 | |
| 299 | $templateOptions['fields'][$field_options['key']] = '{' . $field_tpl_key . '}'; |
| 300 | |
| 301 | break; |
| 302 | case 'select': |
| 303 | case 'checkbox': |
| 304 | case 'radio': |
| 305 | case 'true_false': |
| 306 | |
| 307 | $templateOptions['is_multiple_field_value'][$field_options['key']] = 'no'; |
| 308 | |
| 309 | $templateOptions['fields'][$field_options['key']] = '{' . $field_tpl_key . '}'; |
| 310 | |
| 311 | break; |
| 312 | case 'location-field': |
| 313 | case 'google_map': |
| 314 | |
| 315 | $templateOptions['fields'][$field_options['key']]['address'] = '{' . $field_tpl_key . '/address[1]}'; |
| 316 | $templateOptions['fields'][$field_options['key']]['lat'] = '{' . $field_tpl_key . '/lat[1]}'; |
| 317 | $templateOptions['fields'][$field_options['key']]['lng'] = '{' . $field_tpl_key . '/lng[1]}'; |
| 318 | |
| 319 | break; |
| 320 | case 'paypal_item': |
| 321 | |
| 322 | $templateOptions['fields'][$field_options['key']]['item_name'] = '{' . $field_tpl_key . '/item_name[1]}'; |
| 323 | $templateOptions['fields'][$field_options['key']]['item_description'] = '{' . $field_tpl_key . '/item_description[1]}'; |
| 324 | $templateOptions['fields'][$field_options['key']]['price'] = '{' . $field_tpl_key . '/price[1]}'; |
| 325 | |
| 326 | break; |
| 327 | case 'taxonomy': |
| 328 | |
| 329 | $taxonomy_options = array(); |
| 330 | |
| 331 | $single_term = new stdClass; |
| 332 | $single_term->item_id = 1; |
| 333 | $single_term->parent_id = NULL; |
| 334 | $single_term->xpath = '{' . $field_tpl_key . '/term[1]}'; |
| 335 | $single_term->assign = false; |
| 336 | |
| 337 | $taxonomy_options[] = $single_term; |
| 338 | |
| 339 | $templateOptions['is_multiple_field_value'][$field_options['key']] = 'no'; |
| 340 | |
| 341 | $templateOptions['fields'][$field_options['key']] = json_encode($taxonomy_options); |
| 342 | |
| 343 | break; |
| 344 | |
| 345 | case 'repeater': |
| 346 | |
| 347 | $templateOptions['fields'][$field_options['key']]['is_variable'] = 'yes'; |
| 348 | |
| 349 | $templateOptions['fields'][$field_options['key']]['foreach'] = '{' . $field_tpl_key . '/row}'; |
| 350 | |
| 351 | if (class_exists('acf')){ |
| 352 | |
| 353 | global $acf; |
| 354 | |
| 355 | if ($acf and version_compare($acf->settings['version'], '5.0.0') >= 0){ |
| 356 | |
| 357 | $sub_fields = get_posts(array('posts_per_page' => -1, 'post_type' => 'acf-field', 'post_parent' => (( ! empty($field_options['id'])) ? $field_options['id'] : $field_options['ID']), 'post_status' => 'publish')); |
| 358 | |
| 359 | if ( ! empty($sub_fields) ){ |
| 360 | |
| 361 | foreach ($sub_fields as $n => $sub_field){ |
| 362 | |
| 363 | $templateOptions['fields'][$field_options['key']]['rows']['1'][$sub_field->post_name] = '{acf_' . $sub_field->post_excerpt . '[1]}'; |
| 364 | |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | } else{ |
| 369 | |
| 370 | if ( ! empty($field['sub_fields'])) |
| 371 | { |
| 372 | foreach ($field['sub_fields'] as $n => $sub_field){ |
| 373 | |
| 374 | $templateOptions['fields'][$field_options['key']]['rows']['1'][$sub_field['key']] = '{acf_' . $sub_field['name'] . '[1]}'; |
| 375 | |
| 376 | } |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | } |
| 381 | |
| 382 | break; |
| 383 | |
| 384 | case 'flexible_content': |
| 385 | |
| 386 | break; |
| 387 | |
| 388 | default: |
| 389 | |
| 390 | $templateOptions['fields'][$field_options['key']] = '{' . $field_tpl_key . '}'; |
| 391 | |
| 392 | break; |
| 393 | |
| 394 | } |
| 395 | |
| 396 | break; |
| 397 | case 'attr': |
| 398 | //$element_name = 'woo_' . $element_name; |
| 399 | |
| 400 | if ( ! empty($exportOptions['cc_value'][$ID]) and ! in_array($exportOptions['cc_value'][$ID], $attr_list) ) { |
| 401 | $templateOptions['attribute_name'][] = str_replace('pa_', '', $exportOptions['cc_value'][$ID]); |
| 402 | $templateOptions['attribute_value'][] = '{attribute_'. $element_name .'[1]}'; |
| 403 | $templateOptions['in_variations'][] = "1"; |
| 404 | $templateOptions['is_visible'][] = "1"; |
| 405 | $templateOptions['is_taxonomy'][] = "1"; |
| 406 | $templateOptions['create_taxonomy_in_not_exists'][] = "1"; |
| 407 | $attr_list[] = $exportOptions['cc_value'][$ID]; |
| 408 | } |
| 409 | |
| 410 | break; |
| 411 | case 'cats': |
| 412 | if ( ! empty($exportOptions['cc_value'][$ID]) ){ |
| 413 | switch ($exportOptions['cc_label'][$ID]) { |
| 414 | case 'product_type': |
| 415 | $templateOptions['is_multiple_product_type'] = 'no'; |
| 416 | $templateOptions['single_product_type'] = '{'. $element_name .'[1]}'; |
| 417 | break; |
| 418 | case 'product_shipping_class': |
| 419 | $templateOptions['is_multiple_product_shipping_class'] = 'no'; |
| 420 | $templateOptions['single_product_shipping_class'] = '{'. $element_name .'[1]}'; |
| 421 | break; |
| 422 | default: |
| 423 | $taxonomy = $exportOptions['cc_value'][$ID]; |
| 424 | $templateOptions['tax_assing'][$taxonomy] = 1; |
| 425 | |
| 426 | if (is_taxonomy_hierarchical($taxonomy)){ |
| 427 | $templateOptions['tax_logic'][$taxonomy] = 'hierarchical'; |
| 428 | $templateOptions['tax_hierarchical_logic_entire'][$taxonomy] = 1; |
| 429 | $templateOptions['multiple_term_assing'][$taxonomy] = 1; |
| 430 | $templateOptions['tax_hierarchical_delim'][$taxonomy] = '>'; |
| 431 | $templateOptions['is_tax_hierarchical_group_delim'][$taxonomy] = 1; |
| 432 | $templateOptions['tax_hierarchical_group_delim'][$taxonomy] = '|'; |
| 433 | $templateOptions['tax_hierarchical_xpath'][$taxonomy] = array('{'. $element_name .'[1]}'); |
| 434 | } |
| 435 | else{ |
| 436 | $templateOptions['tax_logic'][$taxonomy] = 'multiple'; |
| 437 | $templateOptions['multiple_term_assing'][$taxonomy] = 1; |
| 438 | $templateOptions['tax_multiple_xpath'][$taxonomy] = '{'. $element_name .'[1]}'; |
| 439 | $templateOptions['tax_multiple_delim'][$taxonomy] = '|'; |
| 440 | } |
| 441 | $taxs_list[] = $taxonomy; |
| 442 | break; |
| 443 | } |
| 444 | } |
| 445 | break; |
| 446 | case 'media': |
| 447 | $templateOptions['download_featured_image'] = '{' . $element_name . '[1]/image/file[1]}'; |
| 448 | $templateOptions['set_image_meta_title'] = 1; |
| 449 | $templateOptions['set_image_meta_caption'] = 1; |
| 450 | $templateOptions['set_image_meta_alt'] = 1; |
| 451 | $templateOptions['set_image_meta_description'] = 1; |
| 452 | $templateOptions['image_meta_title'] = '{' . $element_name . '[1]/image/title[1]}'; |
| 453 | $templateOptions['image_meta_caption'] = '{' . $element_name . '[1]/image/caption[1]}'; |
| 454 | $templateOptions['image_meta_alt'] = '{' . $element_name . '[1]/image/alt[1]}'; |
| 455 | $templateOptions['image_meta_description'] = '{' . $element_name . '[1]/image/description[1]}'; |
| 456 | $templateOptions['is_update_images'] = 1; |
| 457 | $templateOptions['update_images_logic'] = 'add_new'; |
| 458 | break; |
| 459 | case 'attachments': |
| 460 | $templateOptions['attachments'] = '{' . $element_name . '[1]/attach/url[1]}'; |
| 461 | $templateOptions['is_update_attachments'] = 1; |
| 462 | break; |
| 463 | |
| 464 | // Export Users |
| 465 | case 'user_login': |
| 466 | $templateOptions['pmui']['login'] = '{'. $element_name .'[1]}'; |
| 467 | $templateOptions['is_update_login'] = 1; |
| 468 | break; |
| 469 | case 'user_pass': |
| 470 | $templateOptions['pmui']['pass'] = '{'. $element_name .'[1]}'; |
| 471 | $templateOptions['is_update_password'] = 1; |
| 472 | break; |
| 473 | case 'user_nicename': |
| 474 | $templateOptions['pmui']['nicename'] = '{'. $element_name .'[1]}'; |
| 475 | $templateOptions['is_update_nicename'] = 1; |
| 476 | break; |
| 477 | case 'user_email': |
| 478 | $templateOptions['pmui']['email'] = '{'. $element_name .'[1]}'; |
| 479 | $templateOptions['is_update_email'] = 1; |
| 480 | break; |
| 481 | case 'user_registered': |
| 482 | $templateOptions['pmui']['registered'] = '{'. $element_name .'[1]}'; |
| 483 | $templateOptions['is_update_registered'] = 1; |
| 484 | break; |
| 485 | case 'display_name': |
| 486 | $templateOptions['pmui']['display_name'] = '{'. $element_name .'[1]}'; |
| 487 | $templateOptions['is_update_display_name'] = 1; |
| 488 | break; |
| 489 | case 'user_url': |
| 490 | $templateOptions['pmui']['url'] = '{'. $element_name .'[1]}'; |
| 491 | $templateOptions['is_update_url'] = 1; |
| 492 | break; |
| 493 | |
| 494 | case 'first_name': |
| 495 | $templateOptions['pmui']['first_name'] = '{'. $element_name .'[1]}'; |
| 496 | $templateOptions['is_update_first_name'] = 1; |
| 497 | break; |
| 498 | case 'last_name': |
| 499 | $templateOptions['pmui']['last_name'] = '{'. $element_name .'[1]}'; |
| 500 | $templateOptions['is_update_last_name'] = 1; |
| 501 | break; |
| 502 | case 'wp_capabilities': |
| 503 | $templateOptions['pmui']['role'] = '{'. $element_name .'[1]}'; |
| 504 | $templateOptions['is_update_role'] = 1; |
| 505 | break; |
| 506 | case 'nickname': |
| 507 | $templateOptions['pmui']['nickname'] = '{'. $element_name .'[1]}'; |
| 508 | $templateOptions['is_update_nickname'] = 1; |
| 509 | break; |
| 510 | case 'description': |
| 511 | $templateOptions['pmui']['description'] = '{'. $element_name .'[1]}'; |
| 512 | $templateOptions['is_update_description'] = 1; |
| 513 | break; |
| 514 | |
| 515 | default: |
| 516 | |
| 517 | break; |
| 518 | } |
| 519 | } |
| 520 | if ( ! empty($cf_list) ){ |
| 521 | $templateOptions['is_update_custom_fields'] = 1; |
| 522 | $templateOptions['custom_fields_list'] = $cf_list; |
| 523 | } |
| 524 | if ( ! empty($attr_list) ){ |
| 525 | $templateOptions['is_update_attributes'] = 1; |
| 526 | $templateOptions['attributes_list'] = $attr_list; |
| 527 | $templateOptions['attributes_only_list'] = implode(',', $attr_list); |
| 528 | } |
| 529 | if ( ! empty($taxs_list) ){ |
| 530 | $templateOptions['is_update_categories'] = 1; |
| 531 | $templateOptions['taxonomies_list'] = $taxs_list; |
| 532 | } |
| 533 | if ( ! empty($acf_list) ){ |
| 534 | $templateOptions['is_update_acf'] = 1; |
| 535 | $templateOptions['acf_list'] = $acf_list; |
| 536 | } |
| 537 | |
| 538 | $templateOptions['required_add_ons'] = $required_add_ons; |
| 539 | |
| 540 | } |
| 541 | } |