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; }
<!-- <h3> Content Mapping </h3>--> <form name='mappingConfig' action="<?php echo admin_url(); ?> admin.php?page=<?php echo WP_CONST_ADVANCED_XML_IMP_SLUG; ?> /index.php&__module=<?php echo $_REQUEST['__module']; ?> &step=media_handle" method="post" > <input type="hidden" id="module" name="module" value="content_mapping" /> <div class='msg' id = 'showMsg' style = 'display:none;'></div> <?php if (isset($_REQUEST['step']) && $_REQUEST['step'] == 'content_mapping') { $impCE = new WPAdvImporter_includes_helper(); $res = $impCE->save_user($_POST); ?> <div id='sec-three' <?php if ($_REQUEST['step'] != 'content_mapping') { ?> style='display:none;' <?php } ?> > <div style="margin-left:15px;margin-top:15px;"> <div> <label class="textalign" style="margin-bottom:12px">Content Mapping :</label> <!-- <div class="squarecheck"><input type ="checkbox" name = "all" id = "all" value = "all" onclick ="content_mapping(this.id);"><label for = "all"></label></div><label id="optiontext" style="margin-left:28px;margin-top:-32px"> Check All</label> --> <div class="squarecheck"><input type ="checkbox" name = "contentmap" id = "posts" value = "post" onclick ="content_mapping(this.id);"><label for = "posts"></label></div><label id="optiontext" style="margin-left:28px;margin-top:-32px">Post</label> <div class="squarecheck"><input type ="checkbox" name = "contentmap" id = "pages" value = "page" onclick ="content_mapping(this.id);" /><label for="pages"></label></div><label id="optiontext" style="margin-left:28px;margin-top:-32px">Page</label>
<?php global $wpdb; $post = $page = $custom = $file = ''; $get_details = $get_custom_info = $res = $eliminate = $default = array(); $eliminate = (array) 'attachmant'; $default[] = $_POST['postdata'][0]['post']; $default[] = $_POST['postdata'][0]['page']; $custom = $_POST['postdata'][0]['custom']; if (!empty($custom) && $custom == 'customposts') { $file = $_SESSION['xml_values']['uploadfilename']; $impCE = new WPAdvImporter_includes_helper(); $get_details = $impCE->get_xml_details($file); $get_custom_info = $impCE->get_custom_details($get_details); if (!empty($get_custom_info)) { $i = 0; foreach ($get_custom_info as $get_key => $get_val) { foreach ($get_val as $key => $val) { if ($key == 'post_type') { if (!in_array($val, $eliminate, TRUE) && !in_array($val, $res, TRUE)) { $res[] = $val; $i++; } } } } } } $res[] = $_POST['postdata'][0]['post']; $res[] = $_POST['postdata'][0]['page']; $res[] = $_POST['postdata'][0]['custom'];
<?php echo "<pre>"; echo ABSPATH; /* Module : Post Author : Fredrick Owner : smackcoders.com Date : Feb11,2014 */ $impCE = new WPAdvImporter_includes_helper(); ?> <div style="width:100%;"> <div id="accordion"> <table class="table-importer"> <tr> <td> <h3>Import CSV File</h3> <div id='sec-one' <?php if (isset($_REQUEST['step']) && $_REQUEST['step'] != 'uploadfile') { ?> style='display:none;' <?php } ?> > <?php if (is_dir($impCE->getUploadDirectory('default'))) { ?> <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='found' /> <?php } else { ?>
<?php if (!defined('ABSPATH')) { die('Exit if accessed directly'); } $res = $user_array = $postmeta_terms = array(); $post_count = $page_count = $custom_count = $total_rec = $tag_name = ''; $file_name = $_POST['postdata'][0]['xml_name']; $impCE = new WPAdvImporter_includes_helper(); $get_details = $impCE->get_xml_details($file_name); $get_post_info = $impCE->get_post_details($get_details); if (isset($get_post_info)) { $post_count = count($get_post_info); } $res['post'] = $post_count; $get_page_info = $impCE->get_page_details($get_details); if (isset($get_page_info)) { $page_count = count($get_page_info); } $res['page'] = $page_count; $get_custom_info = $impCE->get_custom_details($get_details); if (isset($get_custom_info)) { $custom_count = count($get_custom_info); } $res['custom'] = $custom_count; $get_author_info = $impCE->get_author_details($get_details); if (isset($get_author_info)) { $author_count = count($get_author_info); } $res['author'] = $author_count; $res['postcount'] = count($get_details['posts']);