function edit_mapping($post_type) { global $wpdb; $module = ''; $impCE = new WPAdvImporter_includes_helper(); $headers = array(); $module = $post_type; $sample = array('guid', 'is_normal_post', 'is_page', 'is_custom_post', 'post_content_filtered', 'postmeta', 'is_sticky', 'post_date_gmt', 'ping_status', 'post_name', 'post_type', 'product_type'); $file = $_SESSION['xml_values']['uploadfilename']; $filename = $impCE->convert_string2hash_key($file); $extension = 'xml'; $headers = $impCE->xml_file_data($filename, $extension, $module); $html = ''; $html .= '<h4 class="textalign">' . $module . ' mapping </h4>'; $html .= '<a href="#" id = "checkall" onclick = "check_mapping(this.id);"> Check All </a>/'; $html .= '<a href="#" id = "uncheckall" onclick = "uncheck_mapping(this.id);">Uncheck All </a>'; $html .= '<div id="SaveMsg" class="alert" style="display:none;"><p id="warningmsg" class="alert-success" style="font-size:130%">Mapping Saved</p></div>'; $html .= '<form action ="" id = "mapping_fields" />'; $html .= '<input type = "hidden" name = "save_type" id = "save_type" value =' . $module . '>'; $html .= '<table style="width:80%;margin:15px 0px 25px 52px;"> <tr style="height:38px"><td class="left_align textalign" style="width:161px"> Check/Uncheck </td><td class="textalign" style="width:161px;"> XML FIELDS </td><td class="textalign"> WP FIELDS </td></tr>'; $headers['post_tag'] = 'post_tag'; $headers['post_category'] = 'post_category'; $i = 0; foreach ($headers as $hkey => $hval) { if (!in_array($hval, $sample, TRUE)) { $html .= '<tr style="height:38px;"><td style="width:50px"> <input type = "checkbox" name = "map_arr[]" id ="' . $hval . '" value = "' . $hval . '" checked /> </td> <td> ' . $hval . ' </td>'; $html .= '<td> <select style="width:155px;" id = "mapping' . $i . '">'; foreach ($impCE->defCols as $wp_key => $wp_val) { $html .= '<option value = ' . $wp_key; if ($hval == $wp_key) { $html .= ' selected = "selected" > ' . $wp_key . ' </option>'; } } $i++; $html .= '</td></tr>'; } } $html .= '<tr><td></td><td></td><td><input type = "button" value = "save mapping" class = "btn btn-primary" onclick= "save_mapping();" style="float:right;"></td></tr>'; $html .= '</table>'; $html .= '</form>'; return $html; }
protected function get_upload_path($file_name = null, $version = null) { $HelperObj = new WPAdvImporter_includes_helper(); //$uploadDir = 'ultimate_importer'; $uploadDir = $HelperObj->uploadDir; $file_name = $file_name ? $file_name : ''; if (empty($version)) { $version_path = ''; } else { $version_dir = @$this->options['image_versions'][$version]['upload_dir']; if ($version_dir) { return $version_dir . $this->get_user_path() . $file_name; } $version_path = $version . '/'; } $uploadpath = $_REQUEST['uploadPath']; $file_name = $HelperObj->convert_string2hash_key($file_name); // Code added by Fredrick Marks return $uploadpath . '/' . $uploadDir . '/' . $this->get_user_path() . $version_path . $file_name; }
?> <?php echo $impCE->getImportDataConfiguration(); ?> </div> <div id='mappingheader' class='mappingheader' > <?php // $impCE = CallSkinnyObj::getInstance(); $allcustomposts = ''; $mFieldsArr = ''; $delimeter = ''; $mappingFields_arr = array(); $filename = ''; if (isset($_POST['uploadfilename']) && $_POST['uploadfilename'] != '') { $file_name = $_POST['uploadfilename']; $filename = $impCE->convert_string2hash_key($file_name); } if (isset($_POST['mydelimeter'])) { $delimeter = $_POST['mydelimeter']; } if (isset($_POST['upload_csv_realname']) && $_POST['upload_csv_realname'] != '') { $uploaded_csv_name = $_POST['upload_csv_realname']; } $getrecords = $impCE->xml_file_data($filename, $delimeter, 'xml'); $getcustomposts = get_post_types(); foreach ($getcustomposts as $keys => $value) { if ($value != 'featured_image' && $value != 'attachment' && $value != 'wpsc-product' && $value != 'wpsc-product-file' && $value != 'revision' && $value != 'nav_menu_item' && $value != 'post' && $value != 'page' && $value != 'wp-types-group' && $value != 'wp-types-user-group') { $allcustomposts .= $value . ','; } } ?>