Ultimate CSV Importer - Version 3.6.7

Version Description

Download this release

Release Info

Developer smackcoders
Plugin Icon 128x128 Ultimate CSV Importer
Version 3.6.7
Comparing to
See all releases

Code changes from version 3.6.75 to 3.6.7

Readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === WP Ultimate CSV Importer Plugin ===
2
  Contributors: smackcoders
3
  Donate link: http://www.smackcoders.com/donate.html
4
- Tags: batch, csv, excel, import, spreadsheet, autoblog, Autoblogger, csvimporter, data, dataimport, importer, wpcsvimporter, wpimporter, acf, auto blog, csv import, csv to post, data import, Easy CSV Importer, eci, import plugin, admin, user, users, Advanced CSV Import, Advanced CSV Importer, affiliate, amazon, author, automatic, blog, bulk, bulk edit, bulk editor, categories, comments, content, csv file, csv format, csv importer, custom post, e-commerce, free, images, language, manage, media, meta, multisite, News, page, photos, pictures, plugin, Post, seo, shop, shortcode, tags, Taxonomy, text, title, video, eshop, woocommerce, wordpress, xml, youtube, export
5
  Requires at least: 3.9
6
- Tested up to: 4.1
7
- Stable tag: 3.6.75
8
- Version: 3.6.75
9
  Author: smackcoders
10
  Author URI: http://profiles.wordpress.org/smackcoders/
11
 
@@ -15,9 +15,7 @@ Advanced CSV Importer plugin to import/export posts, pages, eshop products, cust
15
 
16
  == Description ==
17
 
18
- Wordpress Ultimate CSV Importer Pro V4.0 Beta is available as live demo for users to test drive all new features, improvements and changes from http://demo.smackcoders.com/csv4beta. Users can get product manual and sample csv files etc., from - https://www.smackcoders.com/blog/wordpress-ultimate-csv-importer-pro-v4-0-beta-demo-is-available.html
19
-
20
- ** Now stable version 3.6.75 available to download with hot security fix. Visit [www.wpultimatecsvimporter.com](http://www.wpultimatecsvimporter.com) for more news and future plans.
21
 
22
  WP Ultimate CSV Importer Plugin proven much effective advanced CSV File Importer With Ultimate User Friendly Features. It is much easy now even for newbies to import any csv file as any wordpress post type and associated fields by simple mapping feature. Now import any CSV file as thousands of post, page and custom post types. This is admin side free plugin helps you in bulk edit, create and import posts type for your blog or site.
23
 
@@ -26,7 +24,6 @@ WP Ultimate CSV Importer Plugin proven much effective advanced CSV File Importer
26
  <p>https://www.youtube.com/watch?v=Guv5zR7fgW0&list=PL2k3Ck1bFtbQqFhOK7g08kxENI4qQkmC</p>
27
 
28
  = Highlights =
29
- * New Terminate & Continue feature is added.
30
  * Complete export feature with improved filters
31
  * Import external/internal images in line to any posts
32
  * Upload images related to each csv
@@ -41,12 +38,12 @@ WP Ultimate CSV Importer Plugin proven much effective advanced CSV File Importer
41
  * Scheduled Publishing
42
  * Duplicate Title and content handling
43
  * Multi Lingual import (CSV format must be UTF-8 without BOM)
44
- * Mutisite also supported now
45
  * Compatible to wordpress themes
46
  * Better alternative for xml
47
  * Post Format option added
48
  * Page template attribute feature
49
- * EShop Products import (included from V3.6.3)
50
  = Power Import Features to Control your csv import =
51
  * Post title, content and even excerpt
52
  * Text, WYSIWYG/HTML, in line CSS in post content
@@ -180,31 +177,6 @@ This will solve your issue or get support from hosting if you dint have sufficie
180
 
181
  == Changelog ==
182
 
183
- = 3.6.75 =
184
- * Added: Terminate & Continue option in import section.
185
- * Improved: Log section. Issue fixed in Web View & Admin View.
186
- * Fixed: Secrity fix for export module.
187
-
188
- = 3.6.74 =
189
- * Added: Secrity fix.
190
-
191
- = 3.6.73 =
192
- * Added: WordPress 4.0 compatibility checked.
193
- * Added: https format support for all wp instances.
194
- * Added: Warning to guide user to create uploads directory with writeable permissions.
195
- * Fixed: Image handling issues in featured image.
196
- * Fixed: Multisite compatible issue.
197
- * Removed: Post Content field mandatory option.
198
- * Removed: All console warnings.
199
- * Improved: Details added in security and performance tab under settings module.
200
-
201
- = 3.6.72 =
202
- * Added: Debug mode enable/disable options.
203
- * Modified: Menu order changes.
204
-
205
- = 3.6.71 =
206
- * Minor bug fixed
207
-
208
  = 3.6.7 =
209
  * Added: Export features for all missing modules.
210
  * Fixed: All console warnings and reported logs.
@@ -399,21 +371,6 @@ This will solve your issue or get support from hosting if you dint have sufficie
399
 
400
  == Upgrade Notice ==
401
 
402
- = 3.6.75 =
403
- * Upgrade now for improved experience.
404
-
405
- = 3.6.74 =
406
- * Upgrade now for secrity fix.
407
-
408
- = 3.6.73 =
409
- * Upgrade now for WordPress 4.0 compatibility and minor bug fixes.
410
-
411
- = 3.6.72 =
412
- * Upgrade to enable/disable debug mode in settings.
413
-
414
- = 3.6.71 =
415
- * Upgrade now for complete export features as in Pro with bug fix.
416
-
417
  = 3.6.7 =
418
  * Upgrade now for complete export features as in Pro.
419
 
1
  === WP Ultimate CSV Importer Plugin ===
2
  Contributors: smackcoders
3
  Donate link: http://www.smackcoders.com/donate.html
4
+ Tags: batch, csv, excel, import, spreadsheet, autoblog, Autoblogger, csvimporter, data, dataimport, importer, wpcsvimporter, wpimporter, acf, auto blog, csv import, csv to post, data import, Easy CSV Importer, eci, import plugin, admin, user, users, Advanced CSV Import, Advanced CSV Importer, affiliate, amazon, author, automatic, blog, buddypress, bulk, bulk edit, bulk editor, categories, comments, content, csv file, csv format, csv importer, custom post, e-commerce, free, images, language, manage, media, meta, multisite, News, page, photos, pictures, plugin, Post, seo, shop, shortcode, tags, Taxonomy, text, title, video, eshop, woocommerce, wordpress, xml, youtube, export
5
  Requires at least: 3.9
6
+ Tested up to: 4.0
7
+ Stable tag: 3.6.7
8
+ Version: 3.6.7
9
  Author: smackcoders
10
  Author URI: http://profiles.wordpress.org/smackcoders/
11
 
15
 
16
  == Description ==
17
 
18
+ ** Now version 3.6.7 with complete export features with advanced filters was only available in pro edition. Visit [www.wpultimatecsvimporter.com](http://www.wpultimatecsvimporter.com) for more news and future plans.
 
 
19
 
20
  WP Ultimate CSV Importer Plugin proven much effective advanced CSV File Importer With Ultimate User Friendly Features. It is much easy now even for newbies to import any csv file as any wordpress post type and associated fields by simple mapping feature. Now import any CSV file as thousands of post, page and custom post types. This is admin side free plugin helps you in bulk edit, create and import posts type for your blog or site.
21
 
24
  <p>https://www.youtube.com/watch?v=Guv5zR7fgW0&list=PL2k3Ck1bFtbQqFhOK7g08kxENI4qQkmC</p>
25
 
26
  = Highlights =
 
27
  * Complete export feature with improved filters
28
  * Import external/internal images in line to any posts
29
  * Upload images related to each csv
38
  * Scheduled Publishing
39
  * Duplicate Title and content handling
40
  * Multi Lingual import (CSV format must be UTF-8 without BOM)
41
+ * Mutisite and Buddypress also supported now
42
  * Compatible to wordpress themes
43
  * Better alternative for xml
44
  * Post Format option added
45
  * Page template attribute feature
46
+ * EShop Proucts import (included from V3.6.3)
47
  = Power Import Features to Control your csv import =
48
  * Post title, content and even excerpt
49
  * Text, WYSIWYG/HTML, in line CSS in post content
177
 
178
  == Changelog ==
179
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  = 3.6.7 =
181
  * Added: Export features for all missing modules.
182
  * Fixed: All console warnings and reported logs.
371
 
372
  == Upgrade Notice ==
373
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
374
  = 3.6.7 =
375
  * Upgrade now for complete export features as in Pro.
376
 
css/main.css CHANGED
@@ -415,7 +415,7 @@ border: 2px solid red;
415
  border-radius:4px;
416
  -moz-border-radius: 4px;
417
  -webkit-border-radius: 4px;
418
- /* top:190px; */
419
  position:relative;
420
  }
421
 
415
  border-radius:4px;
416
  -moz-border-radius: 4px;
417
  -webkit-border-radius: 4px;
418
+ top:190px;
419
  position:relative;
420
  }
421
 
css/style.css CHANGED
@@ -251,10 +251,6 @@ position: absolute;
251
  padding: 15px 0;
252
  }
253
 
254
- .method1 img, .method2 img, .method3 img, .method4 img, #showmappingtemplate img, .databaseoptimization img {
255
- margin-top:-25px;
256
- }
257
-
258
  #boxmethod1, #boxmethod2, #boxmethod3, #boxmethod4 {
259
  padding: 10px;
260
  }
@@ -437,11 +433,11 @@ padding-bottom: 10px;
437
  margin-top: -33px;
438
  margin-right: 8px;
439
  }
440
- #wpusercheck,#allowimport,#schedulecheck,#dropon,#catenable,#postlabel,#debugmode_enable,
441
  #pagelabel,#userlabel,#commentslabel,#custaxlabel,#cplabel,#catlabel,#custrevlabel {
442
  border-radius:5px 0 0 5px;
443
  }
444
- #wpuseruncheck,#donallowimport,#scheduleuncheck,#dropoff,#catdisable,#nopostlabel, #debugmode_disable,
445
  #nopagelabel,#nouserlabel,#nocommentslabel,#nocustaxlabel,#nocplabel,#nocatlabel,#nocustrevlabel {
446
  border-radius:0 5px 5px 0;
447
  }
@@ -652,6 +648,4 @@ margin-top: 10px;
652
  height:315px !important;
653
  }
654
  /*End off summary*/
655
- #noPlugin {
656
- margin: 5% 12%;
657
- }
251
  padding: 15px 0;
252
  }
253
 
 
 
 
 
254
  #boxmethod1, #boxmethod2, #boxmethod3, #boxmethod4 {
255
  padding: 10px;
256
  }
433
  margin-top: -33px;
434
  margin-right: 8px;
435
  }
436
+ #wpusercheck,#allowimport,#schedulecheck,#dropon,#catenable,#postlabel,
437
  #pagelabel,#userlabel,#commentslabel,#custaxlabel,#cplabel,#catlabel,#custrevlabel {
438
  border-radius:5px 0 0 5px;
439
  }
440
+ #wpuseruncheck,#donallowimport,#scheduleuncheck,#dropoff,#catdisable,#nopostlabel,
441
  #nopagelabel,#nouserlabel,#nocommentslabel,#nocustaxlabel,#nocplabel,#nocatlabel,#nocustrevlabel {
442
  border-radius:0 5px 5px 0;
443
  }
648
  height:315px !important;
649
  }
650
  /*End off summary*/
651
+
 
 
images/pro_icon.gif DELETED
Binary file
includes/WPImporter_includes_helper.php CHANGED
@@ -818,7 +818,7 @@ class WPImporter_includes_helper {
818
  $skippedRecords[] = $_SESSION['SMACK_SKIPPED_RECORDS'];
819
  }
820
  }
821
- $this->detailedLog[$currentLimit]['verify_here'] = "<b>Verify Here -</b> <a href='" . get_permalink( $post_id ) . "' title='" . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $data_array['post_title'] ) ) . "' rel='permalink' target='_blank'>" . __( 'Web View' ) . "</a> | <a href='" . get_edit_post_link( $post_id, true ) . "' title='" . esc_attr( __( 'Edit this item' ) ) . "' target='_blank'>" . __( 'Admin View' ) . "</a>";
822
 
823
  unset($data_array);
824
  }
@@ -857,8 +857,6 @@ class WPImporter_includes_helper {
857
  $wpdb->query($sql4);
858
  }
859
  }
860
- $saveSettings = array('savesettings' => 'Save', 'post' => 'post', 'page' => 'page', 'custompost' => 'custompost', 'drop_table' => 'off', 'debug_mode' => 'disable_debug', 'export_delimiter' => ';',);
861
- update_option('wpcsvfreesettings', $saveSettings);
862
  }
863
 
864
  //Drop Database While Deactivate plugin
@@ -870,7 +868,7 @@ class WPImporter_includes_helper {
870
  $sql2 = "DROP TABLE smackcsv_line_log;";
871
  $wpdb->query($sql2);
872
 
873
- update_option('wpcsvfreesettings','');
874
  }
875
  public function addPieChartEntry($imported_as, $count) {
876
  //add total counts
@@ -934,11 +932,6 @@ class WPImporter_includes_helper {
934
  return $file_name;
935
  }
936
 
937
- // Function to show common notice for PRO Feature
938
- public function common_notice_for_pro_feature() {
939
- return "<p align='center'> <label style='color:red;'> This feature is only available in Pro! </label> <a href='http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html' target='_blank'>Go Pro Now</a> </p>";
940
- }
941
-
942
  // Function for common footer
943
  public function common_footer_for_other_plugin_promotions(){
944
  $content = '<div class="accordion-inner">
@@ -1051,13 +1044,13 @@ class WPImporter_includes_helper {
1051
  </div>
1052
  <div style = "opacity: 0.3;background-color: ghostwhite;">
1053
  <div id="boxmethod2" class="method2">
1054
- <label><span class="radio-icon"><input type="radio" name="importmethod" id="dwnldftpfile" /></span> <span class="header-text" id="importopt">' . __('From FTP') . '</span> </label> <img src="' . WP_CONTENT_URL . '/plugins/' . WP_CONST_ULTIMATE_CSV_IMP_SLUG . '/images/pro_icon.gif" title="PRO Feature" /> <br>
1055
  </div>
1056
  <div id="boxmethod3" class="method3">
1057
- <label> <span class="radio-icon"><input type="radio" name="importmethod" id="dwnldextrfile" /></span> <span class="header-text" id="importopt">' . __('From URL') . '</span></label> <img src="' . WP_CONTENT_URL . '/plugins/' . WP_CONST_ULTIMATE_CSV_IMP_SLUG . '/images/pro_icon.gif" title="PRO Feature" /> <br>
1058
  </div>
1059
  <div id="boxmethod4" class="method4">
1060
- <label><span class="radio-icon"><input type="radio" name="importmethod" id="useuploadedfile" /></span> <span class="header-text" id="importopt">' . __('From Already Uploaded') . '</span></label> <img src="' . WP_CONTENT_URL . '/plugins/' . WP_CONST_ULTIMATE_CSV_IMP_SLUG . '/images/pro_icon.gif" title="PRO Feature" /> <br>
1061
  </div>
1062
  </div>
1063
 
818
  $skippedRecords[] = $_SESSION['SMACK_SKIPPED_RECORDS'];
819
  }
820
  }
821
+ $this->detailedLog[$currentLimit]['verify_here'] = "<b>Verify Here -</b> <a href='" . get_permalink( $post_id ) . "' title='" . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $data_array['post_title'] ) ) . "' rel='permalink'>" . __( 'Web View' ) . "</a> | <a href='" . get_edit_post_link( $post_id, true ) . "' title='" . esc_attr( __( 'Edit this item' ) ) . "'>" . __( 'Admin View' ) . "</a>";
822
 
823
  unset($data_array);
824
  }
857
  $wpdb->query($sql4);
858
  }
859
  }
 
 
860
  }
861
 
862
  //Drop Database While Deactivate plugin
868
  $sql2 = "DROP TABLE smackcsv_line_log;";
869
  $wpdb->query($sql2);
870
 
871
+
872
  }
873
  public function addPieChartEntry($imported_as, $count) {
874
  //add total counts
932
  return $file_name;
933
  }
934
 
 
 
 
 
 
935
  // Function for common footer
936
  public function common_footer_for_other_plugin_promotions(){
937
  $content = '<div class="accordion-inner">
1044
  </div>
1045
  <div style = "opacity: 0.3;background-color: ghostwhite;">
1046
  <div id="boxmethod2" class="method2">
1047
+ <label><span class="radio-icon"><input type="radio" name="importmethod" id="dwnldftpfile" /></span> <span class="header-text" id="importopt">' . __('From FTP') . '</span> </label> <br>
1048
  </div>
1049
  <div id="boxmethod3" class="method3">
1050
+ <label> <span class="radio-icon"><input type="radio" name="importmethod" id="dwnldextrfile" /></span> <span class="header-text" id="importopt">' . __('From URL') . '</span></label> <br>
1051
  </div>
1052
  <div id="boxmethod4" class="method4">
1053
+ <label><span class="radio-icon"><input type="radio" name="importmethod" id="useuploadedfile" /></span> <span class="header-text" id="importopt">' . __('From Already Uploaded') . '</span></label> <br>
1054
  </div>
1055
  </div>
1056
 
index.php CHANGED
@@ -2,7 +2,7 @@
2
  /******************************
3
  * Plugin Name: WP Ultimate CSV Importer
4
  * Description: A plugin that helps to import the data's from a CSV file.
5
- * Version: 3.6.75
6
  * Author: smackcoders.com
7
  * Plugin URI: http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html
8
  * Author URI: http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html
@@ -43,39 +43,15 @@
43
  * Notices must display the words
44
  * "Copyright Smackcoders. 2014. All rights reserved".
45
  ********************************************************************************/
46
-
47
- $get_debug_mode = get_option('wpcsvfreesettings');
48
- if(isset($get_debug_mode['debug_mode']) && $get_debug_mode['debug_mode'] != 'enable_debug') {
49
- error_reporting(0);
50
- ini_set('display_errors', 'Off');
51
- }
52
-
53
- @ob_start();
54
- add_action('init', 'myStartSession', 1);
55
- add_action('wp_logout', 'myEndSession');
56
- add_action('wp_login', 'myEndSession');
57
- /**
58
- * To Start Session
59
- */
60
- function myStartSession() {
61
- if (!session_id()) {
62
- session_start();
63
- }
64
- }
65
- /**
66
- * To Destroy session
67
- */
68
- function myEndSession() {
69
- session_destroy();
70
- }
71
- if ( empty( $GLOBALS['wp_rewrite'] ) )
72
- $GLOBALS['wp_rewrite'] = new WP_Rewrite();
73
 
74
  define('WP_CONST_ULTIMATE_CSV_IMP_URL', 'http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html');
75
  define('WP_CONST_ULTIMATE_CSV_IMP_NAME', 'WP Ultimate CSV Importer');
76
  define('WP_CONST_ULTIMATE_CSV_IMP_SLUG', 'wp-ultimate-csv-importer');
77
  define('WP_CONST_ULTIMATE_CSV_IMP_SETTINGS', 'WP Ultimate CSV Importer');
78
- define('WP_CONST_ULTIMATE_CSV_IMP_VERSION', '3.6.75');
79
  define('WP_CONST_ULTIMATE_CSV_IMP_DIR', WP_PLUGIN_URL . '/' . WP_CONST_ULTIMATE_CSV_IMP_SLUG . '/');
80
  define('WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY', plugin_dir_path(__FILE__));
81
  define('WP_CSVIMP_PLUGIN_BASE', WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY);
@@ -84,7 +60,6 @@ if (!class_exists('SkinnyControllerWPCsvFree')) {
84
  require_once('lib/skinnymvc/controller/SkinnyController.php');
85
  }
86
 
87
-
88
  require_once('plugins/class.inlineimages.php');
89
  require_once('includes/WPImporter_includes_helper.php');
90
 
@@ -93,31 +68,26 @@ register_activation_hook(__FILE__, array('WPImporter_includes_helper', 'activate
93
  register_deactivation_hook(__FILE__, array('WPImporter_includes_helper', 'deactivate'));
94
 
95
  function action_csv_imp_admin_menu() {
96
- if(!function_exists('wp_get_current_user')) {
97
  include(ABSPATH . "wp-includes/pluggable.php");
98
  }
99
- if(is_multisite()) {
100
- if ( current_user_can( 'administrator' ) ) {
101
- add_menu_page(WP_CONST_ULTIMATE_CSV_IMP_SETTINGS, WP_CONST_ULTIMATE_CSV_IMP_NAME, 'manage_options', __FILE__, array('WPImporter_includes_helper', 'output_fd_page'), WP_CONST_ULTIMATE_CSV_IMP_DIR . "images/icon.png");
102
- } else if ( current_user_can( 'author' ) || current_user_can( 'editor' ) ) {
103
- $HelperObj = new WPImporter_includes_helper();
104
- $settings = $HelperObj->getSettings();
105
- if(isset($settings['enable_plugin_access_for_author']) && $settings['enable_plugin_access_for_author'] == 'enable_plugin_access_for_author') {
106
- add_menu_page(WP_CONST_ULTIMATE_CSV_IMP_SETTINGS, WP_CONST_ULTIMATE_CSV_IMP_NAME, '2', __FILE__, array('WPImporter_includes_helper', 'output_fd_page'), WP_CONST_ULTIMATE_CSV_IMP_DIR . "images/icon.png");
107
- }
108
- }
109
- }
110
- else {
111
- if ( current_user_can( 'author' ) || current_user_can( 'editor' ) ) {
112
- $HelperObj = new WPImporter_includes_helper();
113
- $settings = $HelperObj->getSettings();
114
- if(isset($settings['enable_plugin_access_for_author']) && $settings['enable_plugin_access_for_author'] == 'enable_plugin_access_for_author') {
115
- add_menu_page(WP_CONST_ULTIMATE_CSV_IMP_SETTINGS, WP_CONST_ULTIMATE_CSV_IMP_NAME, '2', __FILE__, array('WPImporter_includes_helper', 'output_fd_page'), WP_CONST_ULTIMATE_CSV_IMP_DIR . "images/icon.png");
116
- }
117
- } else if ( current_user_can( 'administrator' ) ) {
118
- add_menu_page(WP_CONST_ULTIMATE_CSV_IMP_SETTINGS, WP_CONST_ULTIMATE_CSV_IMP_NAME, 'manage_options', __FILE__, array('WPImporter_includes_helper', 'output_fd_page'), WP_CONST_ULTIMATE_CSV_IMP_DIR . "images/icon.png");
119
  }
 
 
120
  }
 
121
  }
122
  add_action("admin_menu" , "action_csv_imp_admin_menu");
123
 
@@ -154,20 +124,6 @@ function action_csv_imp_admin_init() {
154
  }
155
 
156
  add_action('admin_init', 'action_csv_imp_admin_init');
157
-
158
- // Move Pages above Media
159
- function smackcsvfree_change_menu_order( $menu_order ) {
160
- return array(
161
- 'index.php',
162
- 'edit.php',
163
- 'edit.php?post_type=page',
164
- 'upload.php',
165
- 'wp-ultimate-csv-importer/index.php',
166
- );
167
- }
168
- add_filter( 'custom_menu_order', '__return_true' );
169
- add_filter( 'menu_order', 'smackcsvfree_change_menu_order' );
170
-
171
  function firstchart() {
172
  require_once("modules/dashboard/actions/chartone.php");
173
  die();
@@ -227,7 +183,7 @@ function linetwoStats() {
227
 
228
  function wpcsvimporter_add_dashboard_widgets() {
229
 
230
- wp_enqueue_script('dashpiechart', plugins_url('js/dashchart-widget.js', __FILE__));
231
  wp_enqueue_script('high_chart', plugins_url('js/highcharts.js', __FILE__));
232
  wp_enqueue_script('export_module', plugins_url('js/exporting.js', __FILE__));
233
  wp_enqueue_script('pie_chart', plugins_url('js/highcharts-3d.js', __FILE__));
@@ -237,12 +193,24 @@ function wpcsvimporter_add_dashboard_widgets() {
237
 
238
  add_action('wp_dashboard_setup', 'wpcsvimporter_add_dashboard_widgets');
239
 
240
- /**
241
- * To Process the Import
242
- */
243
  function importByRequest() {
244
  require_once("templates/import.php");
245
  die;
246
  }
 
247
  add_action('wp_ajax_importByRequest', 'importByRequest');
248
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /******************************
3
  * Plugin Name: WP Ultimate CSV Importer
4
  * Description: A plugin that helps to import the data's from a CSV file.
5
+ * Version: 3.6.7
6
  * Author: smackcoders.com
7
  * Plugin URI: http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html
8
  * Author URI: http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html
43
  * Notices must display the words
44
  * "Copyright Smackcoders. 2014. All rights reserved".
45
  ********************************************************************************/
46
+ error_reporting(0);
47
+ ini_set('display_errors', 'Off');
48
+ ob_start();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
  define('WP_CONST_ULTIMATE_CSV_IMP_URL', 'http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html');
51
  define('WP_CONST_ULTIMATE_CSV_IMP_NAME', 'WP Ultimate CSV Importer');
52
  define('WP_CONST_ULTIMATE_CSV_IMP_SLUG', 'wp-ultimate-csv-importer');
53
  define('WP_CONST_ULTIMATE_CSV_IMP_SETTINGS', 'WP Ultimate CSV Importer');
54
+ define('WP_CONST_ULTIMATE_CSV_IMP_VERSION', '3.6.7');
55
  define('WP_CONST_ULTIMATE_CSV_IMP_DIR', WP_PLUGIN_URL . '/' . WP_CONST_ULTIMATE_CSV_IMP_SLUG . '/');
56
  define('WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY', plugin_dir_path(__FILE__));
57
  define('WP_CSVIMP_PLUGIN_BASE', WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY);
60
  require_once('lib/skinnymvc/controller/SkinnyController.php');
61
  }
62
 
 
63
  require_once('plugins/class.inlineimages.php');
64
  require_once('includes/WPImporter_includes_helper.php');
65
 
68
  register_deactivation_hook(__FILE__, array('WPImporter_includes_helper', 'deactivate'));
69
 
70
  function action_csv_imp_admin_menu() {
71
+ if(!function_exists('wp_get_current_user')) {
72
  include(ABSPATH . "wp-includes/pluggable.php");
73
  }
74
+ if(is_multisite()) {
75
+ if ( current_user_can( 'administrator' ) ) {
76
+ add_menu_page(WP_CONST_ULTIMATE_CSV_IMP_SETTINGS, WP_CONST_ULTIMATE_CSV_IMP_NAME, 'manage_options', __FILE__, array('WPImporter_includes_helper', 'output_fd_page'), WP_CONST_ULTIMATE_CSV_IMP_DIR . "images/icon.png");
77
+ }
78
+
79
+ }
80
+ else {
81
+ if ( current_user_can( 'author' ) ) {
82
+ $HelperObj = new WPImporter_includes_helper();
83
+ $settings = $HelperObj->getSettings();
84
+ if(isset($settings['enable_plugin_access_for_author']) && $settings['enable_plugin_access_for_author'] == 'enable_plugin_access_for_author') {
85
+ add_menu_page(WP_CONST_ULTIMATE_CSV_IMP_SETTINGS, WP_CONST_ULTIMATE_CSV_IMP_NAME, '2', __FILE__, array('WPImporter_includes_helper', 'output_fd_page'), WP_CONST_ULTIMATE_CSV_IMP_DIR . "images/icon.png");
 
 
 
 
 
 
 
 
86
  }
87
+ } else if ( current_user_can( 'administrator' ) ) {
88
+ add_menu_page(WP_CONST_ULTIMATE_CSV_IMP_SETTINGS, WP_CONST_ULTIMATE_CSV_IMP_NAME, 'manage_options', __FILE__, array('WPImporter_includes_helper', 'output_fd_page'), WP_CONST_ULTIMATE_CSV_IMP_DIR . "images/icon.png");
89
  }
90
+ }
91
  }
92
  add_action("admin_menu" , "action_csv_imp_admin_menu");
93
 
124
  }
125
 
126
  add_action('admin_init', 'action_csv_imp_admin_init');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  function firstchart() {
128
  require_once("modules/dashboard/actions/chartone.php");
129
  die();
183
 
184
  function wpcsvimporter_add_dashboard_widgets() {
185
 
186
+ wp_enqueue_script('dashpiechart', plugins_url('js/dashchart.js', __FILE__));
187
  wp_enqueue_script('high_chart', plugins_url('js/highcharts.js', __FILE__));
188
  wp_enqueue_script('export_module', plugins_url('js/exporting.js', __FILE__));
189
  wp_enqueue_script('pie_chart', plugins_url('js/highcharts-3d.js', __FILE__));
193
 
194
  add_action('wp_dashboard_setup', 'wpcsvimporter_add_dashboard_widgets');
195
 
196
+
 
 
197
  function importByRequest() {
198
  require_once("templates/import.php");
199
  die;
200
  }
201
+
202
  add_action('wp_ajax_importByRequest', 'importByRequest');
203
 
204
+ add_action('init', 'myStartSession', 1);
205
+ add_action('wp_logout', 'myEndSession');
206
+ add_action('wp_login', 'myEndSession');
207
+
208
+ function myStartSession() {
209
+ if (!session_id()) {
210
+ session_start();
211
+ }
212
+ }
213
+
214
+ function myEndSession() {
215
+ session_destroy();
216
+ }
js/dashchart-widget.js DELETED
@@ -1,109 +0,0 @@
1
- jQuery( document ).ready(function() {
2
- pieStats();
3
- lineStats();
4
- });
5
- function pieStats()
6
- {
7
- jQuery.ajax({
8
- type: 'POST',
9
- url: ajaxurl,
10
- data: {
11
- 'action' : 'firstchart',
12
- 'postdata' : 'firstchartdata',
13
- },
14
- dataType: 'json',
15
- cache: false,
16
- success: function(data) {
17
- var browser = JSON.parse(data);
18
- if (browser['label'] == 'No Imports Yet') {
19
- document.getElementById('pieStats').innerHTML = "<h2 style='color: red;text-align: center;padding-top: 100px;' >No Imports Yet</h2>";
20
- return false;
21
- }
22
-
23
- jQuery('#pieStats').highcharts({
24
- chart: {
25
- type: 'pie',
26
- options3d: {
27
- enabled: true,
28
- alpha: 45,
29
- beta: 0
30
- }
31
- },
32
- title: {
33
- text: ''
34
- },
35
- tooltip: {
36
- pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
37
- },
38
- plotOptions: {
39
- pie: {
40
- allowPointSelect: true,
41
- cursor: 'pointer',
42
- depth: 35,
43
- dataLabels: {
44
- enabled: true,
45
- format: '{point.name}'
46
- }
47
- }
48
- },
49
- series: [{
50
- type: 'pie',
51
- name: 'overall statistics',
52
- // data: JSON.parse(data),
53
- data: browser
54
- }]
55
- });
56
- }
57
- });
58
- }
59
- function lineStats()
60
- {
61
- jQuery.ajax({
62
- type: 'POST',
63
- url: ajaxurl,
64
- data: {
65
- 'action' : 'secondchart',
66
- 'postdata' : 'secondchartdata',
67
- },
68
- dataType: 'json',
69
- cache: false,
70
- success: function(data) {
71
- var val = JSON.parse(data);
72
- var line = [val[0],val[1],val[2],val[3],val[4],val[5]];
73
- jQuery('#lineStats').highcharts({
74
- title: {
75
- text: '',
76
- x: -5 //center
77
- },
78
- subtitle: {
79
- text: '',
80
- x: -5
81
- },
82
- xAxis: {
83
- categories:val.cat
84
- },
85
- yAxis: {
86
- title: {
87
- text: 'Import (Nos)'
88
- },
89
- plotLines: [{
90
- value: 0,
91
- width: 1,
92
- color: '#808080'
93
- }]
94
- },
95
- tooltip: {
96
- valueSuffix: ' Nos'
97
- },
98
- legend: {
99
- layout: 'vertical',
100
- align: 'right',
101
- verticalAlign: 'middle',
102
- borderWidth: 0
103
- },
104
- series:line });
105
- }
106
- });
107
- }
108
-
109
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/dashchart.js CHANGED
@@ -1,9 +1,6 @@
1
  jQuery( document ).ready(function() {
2
- var get_module = document.getElementById('checkmodule').value;
3
- if(get_module == 'dashboard') {
4
- pieStats();
5
- lineStats();
6
- }
7
  });
8
  function pieStats()
9
  {
1
  jQuery( document ).ready(function() {
2
+ pieStats();
3
+ lineStats();
 
 
 
4
  });
5
  function pieStats()
6
  {
js/ultimate-importer-free.js CHANGED
@@ -7,8 +7,8 @@ jQuery( document ).ready(function() {
7
  document.getElementById('log').innerHTML = '<p style="margin:15px;color:red;">NO LOGS YET NOW.</p>';
8
  }
9
 
10
- //pieStats();
11
- //lineStats();
12
 
13
 
14
  }
@@ -374,26 +374,26 @@ function import_csv()
374
  if (array[j] == 'post_title') {
375
  val1 = 'On';
376
  }
377
- /* if (array[j] == 'post_content') {
378
  val2 = 'On';
379
- } */
380
  if (post_status_msg == 'Off') {
381
  if (array[j] == 'post_status')
382
  post_status_msg = 'On';
383
  }
384
  }
385
- if (importer != 'custompost' && val1 == 'On' && post_status_msg == 'On') {
386
  return true;
387
  }
388
- else if (importer == 'custompost' && val1 == 'On' && post_status_msg == 'On' && post_type=='On') {
389
  return true;
390
  }
391
  else {
392
  error_msg = '';
393
  if (val1 == 'Off')
394
- error_msg += " post_title";
395
- /* if (val2 == 'Off')
396
- error_msg += " post_content,"; */
397
  if(importer == 'custompost') {
398
  if (SelectedIndex == 'select')
399
  error_msg += " post_type,";
@@ -566,13 +566,13 @@ function importRecordsbySettings(siteurl)
566
  return false;
567
  }
568
  if(get_log == '<p style="margin:15px;color:red;">NO LOGS YET NOW.</p>'){
569
- document.getElementById('log').innerHTML = '<p style="margin-left:10px;color:red;">Your Import Is In Progress...</p>';
570
  document.getElementById('startbutton').disabled = true;
571
  }
572
  document.getElementById('ajaxloader').style.display="";
573
  var tempCount = parseInt(tmpCnt);
574
  var totalCount = parseInt(tot_no_of_records);
575
- if(tempCount >= totalCount){
576
  document.getElementById('ajaxloader').style.display="none";
577
  document.getElementById('startbutton').style.display="none";
578
  document.getElementById('importagain').style.display="";
@@ -605,11 +605,7 @@ function importRecordsbySettings(siteurl)
605
  document.getElementById('tmpcount').value = parseInt(tmpCnt)+parseInt(importlimit);
606
  setTimeout(function(){importRecordsbySettings()},0);
607
  } else {
608
- document.getElementById('log').innerHTML += "<p style='margin-left:10px;color:red;'>Import process has been terminated.</p>";
609
- document.getElementById('ajaxloader').style.display="none";
610
- document.getElementById('startbutton').style.display = "none";
611
- document.getElementById('terminatenow').style.display = "none";
612
- document.getElementById('continuebutton').style.display = "";
613
  return false;
614
  }
615
  }else{
@@ -632,34 +628,6 @@ function terminateProcess(){
632
  document.getElementById('terminateaction').value = 'terminate';
633
  }
634
 
635
- function continueprocess() {
636
- var tot_no_of_records = document.getElementById('checktotal').value;
637
- var tmpCnt = document.getElementById('tmpcount').value;
638
- var currentlimit = document.getElementById('currentlimit').value;
639
- var importlimit = document.getElementById('importlimit').value;
640
- // var get_requested_count = importlimit;
641
- var tot_no_of_records = document.getElementById('checktotal').value;
642
-
643
- if (parseInt(tmpCnt) > parseInt(tot_no_of_records)) {
644
- document.getElementById('terminatenow').style.display = "none";
645
- } else {
646
- document.getElementById('terminatenow').style.display = "";
647
- }
648
- document.getElementById('log').innerHTML += "<div style='margin-left:10px;color:green;'> Import process has been continued.</div></br>";
649
- document.getElementById('ajaxloader').style.display = "";
650
- document.getElementById('startbutton').style.display = "";
651
- document.getElementById('continuebutton').style.display = "none";
652
- //document.getElementById('dwnld_log_link').style.display = "none";
653
- document.getElementById('terminateaction').value = 'continue';
654
- // document.getElementById('currentlimit').value = currentlimit;
655
- //currentlimit = parseInt(currentlimit)+parseInt(importlimit);
656
- // console.log('impLmt: '+importlimit+'totRecds: '+tot_no_of_records);
657
- // document.getElementById('tmpcount').value = parseInt(tmpCnt)+parseInt(importlimit);
658
-
659
- setTimeout(function () {
660
- importRecordsbySettings()
661
- }, 0);
662
- }
663
 
664
  // Enable/Disable WP-e-Commerce Custom Fields
665
  function enablewpcustomfield(val){
@@ -1000,9 +968,9 @@ function showsettingsoption(id) {
1000
  for(i=1;i<=9;i++) {
1001
  if(parseInt(id) == parseInt(i)) {
1002
  if(parseInt(i) == 8) {
1003
- document.getElementById('sidebar').style.height = '1189px';
1004
- document.getElementById('contentbar').style.height = '1189px';
1005
- document.getElementById('settingsholder').style.height = '1190px';
1006
  } else if(parseInt(i) == 9) {
1007
  document.getElementById('sidebar').style.height = '665px';
1008
  document.getElementById('contentbar').style.height = '665px';
@@ -1023,10 +991,6 @@ function showsettingsoption(id) {
1023
  document.getElementById('sidebar').style.height = '965px';
1024
  document.getElementById('contentbar').style.height = '965px';
1025
  document.getElementById('settingsholder').style.height = '966px';
1026
- } else if(parseInt(i) == 6) {
1027
- document.getElementById('sidebar').style.height = '565px';
1028
- document.getElementById('contentbar').style.height = '565px';
1029
- document.getElementById('settingsholder').style.height = '566px';
1030
  } else {
1031
  document.getElementById('sidebar').style.height = 'auto';
1032
  document.getElementById('contentbar').style.height = 'auto';
@@ -1051,7 +1015,7 @@ function showsettingsoption(id) {
1051
 
1052
  //seo setting enable and disable
1053
  function seosetting(id) {
1054
- if(id == 'nonerseooption') {
1055
  jQuery('#seosetting1').removeClass("disablesetting");
1056
  jQuery('#seosetting1').addClass("enablesetting");
1057
  document.getElementById("seosetting1text").innerHTML="Enabled";
@@ -1444,21 +1408,6 @@ function dropsetting(id) {
1444
  }
1445
  }
1446
 
1447
- // Enable / Disable the debug mode
1448
- function debugmode_check (id) {
1449
- if(id == 'enabled') {
1450
- jQuery('#debugmode_enable').removeClass("disablesetting");
1451
- jQuery('#debugmode_enable').addClass("enablesetting");
1452
- jQuery('#debugmode_disable').removeClass("enablesetting");
1453
- jQuery('#debugmode_disable').addClass("disablesetting");
1454
- } else {
1455
- jQuery('#debugmode_disable').removeClass("disablesetting");
1456
- jQuery('#debugmode_disable').addClass("enablesetting");
1457
- jQuery('#debugmode_enable').removeClass("enablesetting");
1458
- jQuery('#debugmode_enable').addClass("disablesetting");
1459
- }
1460
- }
1461
-
1462
  //Ecommerce setting
1463
  function ecommercesetting(id) {
1464
  if(id == 'nonerecommerce') {
7
  document.getElementById('log').innerHTML = '<p style="margin:15px;color:red;">NO LOGS YET NOW.</p>';
8
  }
9
 
10
+ pieStats();
11
+ lineStats();
12
 
13
 
14
  }
374
  if (array[j] == 'post_title') {
375
  val1 = 'On';
376
  }
377
+ if (array[j] == 'post_content') {
378
  val2 = 'On';
379
+ }
380
  if (post_status_msg == 'Off') {
381
  if (array[j] == 'post_status')
382
  post_status_msg = 'On';
383
  }
384
  }
385
+ if (importer != 'custompost' && val1 == 'On' && val2 == 'On' && post_status_msg == 'On') {
386
  return true;
387
  }
388
+ else if (importer == 'custompost' && val1 == 'On' && val2 == 'On' && post_status_msg == 'On' && post_type=='On') {
389
  return true;
390
  }
391
  else {
392
  error_msg = '';
393
  if (val1 == 'Off')
394
+ error_msg += " post_title,";
395
+ if (val2 == 'Off')
396
+ error_msg += " post_content,";
397
  if(importer == 'custompost') {
398
  if (SelectedIndex == 'select')
399
  error_msg += " post_type,";
566
  return false;
567
  }
568
  if(get_log == '<p style="margin:15px;color:red;">NO LOGS YET NOW.</p>'){
569
+ document.getElementById('log').innerHTML = '<p style="margin:15px;color:red;">Your Import Is In Progress...</p>';
570
  document.getElementById('startbutton').disabled = true;
571
  }
572
  document.getElementById('ajaxloader').style.display="";
573
  var tempCount = parseInt(tmpCnt);
574
  var totalCount = parseInt(tot_no_of_records);
575
+ if(tempCount>totalCount){
576
  document.getElementById('ajaxloader').style.display="none";
577
  document.getElementById('startbutton').style.display="none";
578
  document.getElementById('importagain').style.display="";
605
  document.getElementById('tmpcount').value = parseInt(tmpCnt)+parseInt(importlimit);
606
  setTimeout(function(){importRecordsbySettings()},0);
607
  } else {
608
+ document.getElementById('log').innerHTML += "Import process has been terminated.</br>";
 
 
 
 
609
  return false;
610
  }
611
  }else{
628
  document.getElementById('terminateaction').value = 'terminate';
629
  }
630
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
631
 
632
  // Enable/Disable WP-e-Commerce Custom Fields
633
  function enablewpcustomfield(val){
968
  for(i=1;i<=9;i++) {
969
  if(parseInt(id) == parseInt(i)) {
970
  if(parseInt(i) == 8) {
971
+ document.getElementById('sidebar').style.height = '1149px';
972
+ document.getElementById('contentbar').style.height = '1149px';
973
+ document.getElementById('settingsholder').style.height = '1150px';
974
  } else if(parseInt(i) == 9) {
975
  document.getElementById('sidebar').style.height = '665px';
976
  document.getElementById('contentbar').style.height = '665px';
991
  document.getElementById('sidebar').style.height = '965px';
992
  document.getElementById('contentbar').style.height = '965px';
993
  document.getElementById('settingsholder').style.height = '966px';
 
 
 
 
994
  } else {
995
  document.getElementById('sidebar').style.height = 'auto';
996
  document.getElementById('contentbar').style.height = 'auto';
1015
 
1016
  //seo setting enable and disable
1017
  function seosetting(id) {
1018
+ if(id == 'none') {
1019
  jQuery('#seosetting1').removeClass("disablesetting");
1020
  jQuery('#seosetting1').addClass("enablesetting");
1021
  document.getElementById("seosetting1text").innerHTML="Enabled";
1408
  }
1409
  }
1410
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1411
  //Ecommerce setting
1412
  function ecommercesetting(id) {
1413
  if(id == 'nonerecommerce') {
modules/comments/templates/index.php CHANGED
@@ -44,14 +44,8 @@
44
  <td>
45
  <h3>CSV Import Options</h3>
46
  <div id='sec-one' <?php if($_REQUEST['step']!= 'uploadfile') {?> style='display:none;' <?php } ?>>
47
- <?php if(is_dir($impCE->getUploadDirectory('default'))){
48
- if (!is_writable($impCE->getUploadDirectory('default'))) {
49
- if (!chmod($impCE->getUploadDirectory('default'), 0777)) { ?>
50
- <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='notfound' /> <?php
51
- }
52
- } else { ?>
53
- <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='found' />
54
- <?php }?>
55
  <?php } else { ?>
56
  <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='notfound' />
57
  <?php } ?>
@@ -81,7 +75,6 @@
81
  <select disabled>
82
  <option value ='select template' /> select template </option>
83
  </select>
84
- <img src="<?php echo WP_CONTENT_URL; ?>/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG; ?>/images/pro_icon.gif" title="PRO Feature" />
85
  </div>
86
 
87
  </div>
@@ -423,7 +416,6 @@ $mFieldsArr = substr($mFieldsArr, 0, -1);
423
  <input id="startbutton" class="btn btn-primary" type="button" value="Import Now" style="color: #ffffff;background:#2E9AFE;" onclick="importRecordsbySettings();" />
424
  <input id="terminatenow" class="btn btn-danger btn-sm" type="button" value="Terminate Now" style="display:none;" onclick="terminateProcess();" />
425
  <input class="btn btn-warning" type="button" value="Reload" id="importagain" style="display:none" onclick="import_again();" />
426
- <input id="continuebutton" class="btn btn-lg btn-success" type="button" value="Continue" style="display:none;color: #ffffff;" onclick="continueprocess();">
427
  <!-- <input id="continuebutton" class="button" type="button" value="Continue old search" style="color: #ffffff;background:#2E9AFE;">-->
428
  <div id="ajaxloader" style="display:none"><img src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/ajax-loader.gif"> Processing...</div>
429
  <div class="clear"></div>
44
  <td>
45
  <h3>CSV Import Options</h3>
46
  <div id='sec-one' <?php if($_REQUEST['step']!= 'uploadfile') {?> style='display:none;' <?php } ?>>
47
+ <?php if(is_dir($impCE->getUploadDirectory('default'))){ ?>
48
+ <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='found' />
 
 
 
 
 
 
49
  <?php } else { ?>
50
  <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='notfound' />
51
  <?php } ?>
75
  <select disabled>
76
  <option value ='select template' /> select template </option>
77
  </select>
 
78
  </div>
79
 
80
  </div>
416
  <input id="startbutton" class="btn btn-primary" type="button" value="Import Now" style="color: #ffffff;background:#2E9AFE;" onclick="importRecordsbySettings();" />
417
  <input id="terminatenow" class="btn btn-danger btn-sm" type="button" value="Terminate Now" style="display:none;" onclick="terminateProcess();" />
418
  <input class="btn btn-warning" type="button" value="Reload" id="importagain" style="display:none" onclick="import_again();" />
 
419
  <!-- <input id="continuebutton" class="button" type="button" value="Continue old search" style="color: #ffffff;background:#2E9AFE;">-->
420
  <div id="ajaxloader" style="display:none"><img src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/ajax-loader.gif"> Processing...</div>
421
  <div class="clear"></div>
modules/custompost/templates/index.php CHANGED
@@ -44,14 +44,8 @@ $impCE = new WPImporter_includes_helper();
44
  <td>
45
  <h3>CSV Import Options</h3>
46
  <div id='sec-one' <?php if($_REQUEST['step']!= 'uploadfile') {?> style='display:none;' <?php } ?>>
47
- <?php if(is_dir($impCE->getUploadDirectory('default'))){
48
- if (!is_writable($impCE->getUploadDirectory('default'))) {
49
- if (!chmod($impCE->getUploadDirectory('default'), 0777)) { ?>
50
- <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='notfound' /> <?php
51
- }
52
- } else { ?>
53
- <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='found' />
54
- <?php }?>
55
  <?php } else { ?>
56
  <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='notfound' />
57
  <?php } ?>
@@ -78,7 +72,6 @@ $impCE = new WPImporter_includes_helper();
78
  <select disabled>
79
  <option value ='select template' > select template </option>
80
  </select>
81
- <img src="<?php echo WP_CONTENT_URL; ?>/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG; ?>/images/pro_icon.gif" title="PRO Feature" />
82
  </div>
83
 
84
  </div>
@@ -554,7 +547,6 @@ $impCE = new WPImporter_includes_helper();
554
  <input id="startbutton" class="btn btn-primary" type="button" value="Import Now" style="color: #ffffff;background:#2E9AFE;" onclick="importRecordsbySettings();" >
555
  <input id="terminatenow" class="btn btn-danger btn-sm" type="button" value="Terminate Now" style="display:none;" onclick="terminateProcess();" />
556
  <input class="btn btn-warning" type="button" value="Reload" id="importagain" style="display:none" onclick="import_again();" />
557
- <input id="continuebutton" class="btn btn-lg btn-success" type="button" value="Continue" style="display:none;color: #ffffff;" onclick="continueprocess();">
558
  <!--<input id="continuebutton" class="button" type="button" value="Continue old search" style="color: #ffffff;background:#2E9AFE;">-->
559
  <div id="ajaxloader" style="display:none"><img src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/ajax-loader.gif"> Processing...</div>
560
  <div class="clear"></div>
44
  <td>
45
  <h3>CSV Import Options</h3>
46
  <div id='sec-one' <?php if($_REQUEST['step']!= 'uploadfile') {?> style='display:none;' <?php } ?>>
47
+ <?php if(is_dir($impCE->getUploadDirectory('default'))){ ?>
48
+ <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='found' />
 
 
 
 
 
 
49
  <?php } else { ?>
50
  <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='notfound' />
51
  <?php } ?>
72
  <select disabled>
73
  <option value ='select template' > select template </option>
74
  </select>
 
75
  </div>
76
 
77
  </div>
547
  <input id="startbutton" class="btn btn-primary" type="button" value="Import Now" style="color: #ffffff;background:#2E9AFE;" onclick="importRecordsbySettings();" >
548
  <input id="terminatenow" class="btn btn-danger btn-sm" type="button" value="Terminate Now" style="display:none;" onclick="terminateProcess();" />
549
  <input class="btn btn-warning" type="button" value="Reload" id="importagain" style="display:none" onclick="import_again();" />
 
550
  <!--<input id="continuebutton" class="button" type="button" value="Continue old search" style="color: #ffffff;background:#2E9AFE;">-->
551
  <div id="ajaxloader" style="display:none"><img src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/ajax-loader.gif"> Processing...</div>
552
  <div class="clear"></div>
modules/dashboard/templates/index.php CHANGED
@@ -79,8 +79,8 @@ if(isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'filenotfound'){
79
  <?php if(isset($_REQUEST['errormsg'])){
80
  ?>
81
  <script type="text/javascript">
82
- showMapMessages('error' , "<?php echo $_REQUEST['errormsg']; ?>");
83
  </script>
84
- <?php
85
  }
86
  ?>
79
  <?php if(isset($_REQUEST['errormsg'])){
80
  ?>
81
  <script type="text/javascript">
82
+ showMapMessages('error' , "<?php echo $_REQUEST['errormsg']; ?>")
83
  </script>
84
+ <?
85
  }
86
  ?>
modules/eshop/actions/actions.php CHANGED
@@ -707,7 +707,7 @@ class EshopActions extends SkinnyActions {
707
  $skippedRecords[] = $_SESSION['SMACK_SKIPPED_RECORDS'];
708
  }
709
  }
710
- $this->detailedLog[$currentLimit]['verify_here'] = "<b>Verify Here -</b> <a href='" . get_permalink( $post_id ) . "' title='" . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $data_array['post_title'] ) ) . "' rel='permalink' target='_blank'>" . __( 'Web View' ) . "</a> | <a href='" . get_edit_post_link( $post_id, true ) . "' title='" . esc_attr( __( 'Edit this item' ) ) . "' target='_blank'>" . __( 'Admin View' ) . "</a>";
711
 
712
  unset($data_array);
713
  }
707
  $skippedRecords[] = $_SESSION['SMACK_SKIPPED_RECORDS'];
708
  }
709
  }
710
+ $this->detailedLog[$currentLimit]['verify_here'] = "<b>Verify Here -</b> <a href='" . get_permalink( $post_id ) . "' title='" . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $data_array['post_title'] ) ) . "' rel='permalink'>" . __( 'Web View' ) . "</a> | <a href='" . get_edit_post_link( $post_id, true ) . "' title='" . esc_attr( __( 'Edit this item' ) ) . "'>" . __( 'Admin View' ) . "</a>";
711
 
712
  unset($data_array);
713
  }
modules/eshop/templates/index.php CHANGED
@@ -46,23 +46,17 @@ $eshopObj->isplugin();
46
  <td>
47
  <h3>CSV Import Options</h3>
48
  <div id='sec-one' <?php if($_REQUEST['step']!= 'uploadfile') {?> style='display:none;' <?php } ?>>
49
- <?php if(is_dir($impCE->getUploadDirectory('default'))){
50
- if (!is_writable($impCE->getUploadDirectory('default'))) {
51
- if (!chmod($impCE->getUploadDirectory('default'), 0777)) { ?>
52
- <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='notfound' /> <?php
53
- }
54
- } else { ?>
55
- <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='found' />
56
- <?php }?>
57
  <?php } else { ?>
58
  <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='notfound' />
59
  <?php } ?>
60
  <div class="warning" id="warning" name="warning" style="display:none;margin: 4% 0 4% 22%;"></div>
61
- <div align=center>
62
- <div id="noPlugin" class="warnings" style="display:none"></div>
63
- </div>
64
  <form action='<?php echo admin_url().'admin.php?page='.WP_CONST_ULTIMATE_CSV_IMP_SLUG.'/index.php&__module='.$_REQUEST['__module'].'&step=mapping_settings'?>' id='browsefile' method='post' name='browsefile' enctype="multipart/form-data">
65
  <div class="importfile" align='center'>
 
 
 
66
  <?php
67
  if ($_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['isplugin_avail'] == 'not_avail') {
68
  ?>
@@ -115,7 +109,6 @@ if ($_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['isplugin_avail'] != 'not_avail'
115
  <select disabled/>
116
  <option value ='select template' > select template </option>
117
  </select>
118
- <img src="<?php echo WP_CONTENT_URL; ?>/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG; ?>/images/pro_icon.gif" title="PRO Feature" />
119
  </div>
120
  <!-- code ends here -->
121
  </div>
@@ -539,7 +532,6 @@ if ($_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['isplugin_avail'] != 'not_avail'
539
  <input id="startbutton" class="btn btn-primary" type="button" value="Import Now" style="color: #ffffff;background:#2E9AFE;" onclick="importRecordsbySettings('<?php echo site_url(); ?>');" >
540
  <input id="terminatenow" class="btn btn-danger btn-sm" type="button" value="Terminate Now" style="display:none;" onclick="terminateProcess();" />
541
  <input class="btn btn-warning" type="button" value="Reload" id="importagain" style="display:none" onclick="import_again();" />
542
- <input id="continuebutton" class="btn btn-lg btn-success" type="button" value="Continue" style="display:none;color: #ffffff;" onclick="continueprocess();">
543
  <!--<input id="continuebutton" class="button" type="button" value="Continue old search" style="color: #ffffff;background:#2E9AFE;">-->
544
  <div id="ajaxloader" style="display:none"><img src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/ajax-loader.gif"> Processing...</div>
545
 
46
  <td>
47
  <h3>CSV Import Options</h3>
48
  <div id='sec-one' <?php if($_REQUEST['step']!= 'uploadfile') {?> style='display:none;' <?php } ?>>
49
+ <?php if(is_dir($impCE->getUploadDirectory('default'))){ ?>
50
+ <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='found' />
 
 
 
 
 
 
51
  <?php } else { ?>
52
  <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='notfound' />
53
  <?php } ?>
54
  <div class="warning" id="warning" name="warning" style="display:none;margin: 4% 0 4% 22%;"></div>
 
 
 
55
  <form action='<?php echo admin_url().'admin.php?page='.WP_CONST_ULTIMATE_CSV_IMP_SLUG.'/index.php&__module='.$_REQUEST['__module'].'&step=mapping_settings'?>' id='browsefile' method='post' name='browsefile' enctype="multipart/form-data">
56
  <div class="importfile" align='center'>
57
+ <div align=center>
58
+ <div id="noPlugin" class="warnings" style="display:none"></div>
59
+ </div>
60
  <?php
61
  if ($_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['isplugin_avail'] == 'not_avail') {
62
  ?>
109
  <select disabled/>
110
  <option value ='select template' > select template </option>
111
  </select>
 
112
  </div>
113
  <!-- code ends here -->
114
  </div>
532
  <input id="startbutton" class="btn btn-primary" type="button" value="Import Now" style="color: #ffffff;background:#2E9AFE;" onclick="importRecordsbySettings('<?php echo site_url(); ?>');" >
533
  <input id="terminatenow" class="btn btn-danger btn-sm" type="button" value="Terminate Now" style="display:none;" onclick="terminateProcess();" />
534
  <input class="btn btn-warning" type="button" value="Reload" id="importagain" style="display:none" onclick="import_again();" />
 
535
  <!--<input id="continuebutton" class="button" type="button" value="Continue old search" style="color: #ffffff;background:#2E9AFE;">-->
536
  <div id="ajaxloader" style="display:none"><img src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/ajax-loader.gif"> Processing...</div>
537
 
modules/export/actions/actions.php CHANGED
@@ -27,9 +27,9 @@ class ExportActions extends SkinnyActions {
27
  $helper->generateanddownloadcsv($type, $filename);
28
  }
29
  }
30
- $nonce = '';
31
- $nonce = wp_create_nonce('my-nonce');
32
- $data['wp_nonce'] = $nonce;
33
  return $data;
34
  }
35
 
27
  $helper->generateanddownloadcsv($type, $filename);
28
  }
29
  }
30
+ $nonce = '';
31
+ $nonce = wp_create_nonce('my-nonce');
32
+ $data['wp_nonce'] = $nonce;
33
  return $data;
34
  }
35
 
modules/export/templates/export.php CHANGED
@@ -6,21 +6,15 @@
6
  * You can contact Smackcoders at email address info@smackcoders.com.
7
  *******************************************************************************************/
8
 
9
- if(!isset($_SERVER['HTTP_REFERER'])) {
10
- die('Your requested url were wrong! Please contact your admin.');
11
- }
12
  require_once('../../../../../../wp-load.php');
13
-
14
  $nonce = $_POST['nonce'];
15
- //echo '<pre>'; print_r($sitedomain); echo '</pre>';
16
  if ( ! wp_verify_nonce( $nonce, 'my-nonce' ) ) {
17
- // This nonce is not valid.
18
- die( 'Security check: Your requested URL is wrong! Please, Contact your administrator.' );
19
  } else {
20
- // The nonce was valid.
21
- // Do stuff here.
22
- }
23
 
 
24
  $ExportObj = new WPCSVProExportData();
25
  #print('<pre>'); print_r($_POST); //die;
26
  $ExportObj->executeIndex($_POST);
6
  * You can contact Smackcoders at email address info@smackcoders.com.
7
  *******************************************************************************************/
8
 
 
 
 
9
  require_once('../../../../../../wp-load.php');
 
10
  $nonce = $_POST['nonce'];
11
+
12
  if ( ! wp_verify_nonce( $nonce, 'my-nonce' ) ) {
13
+
14
+ die( 'Security check: Your requested URL is wrong! Please, Contact your administrator.' );
15
  } else {
 
 
 
16
 
17
+ }
18
  $ExportObj = new WPCSVProExportData();
19
  #print('<pre>'); print_r($_POST); //die;
20
  $ExportObj->executeIndex($_POST);
modules/export/templates/export_old.php ADDED
@@ -0,0 +1,1400 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /******************************************************************************************
3
+ * Copyright (C) Smackcoders 2014 - All Rights Reserved
4
+ * Unauthorized copying of this file, via any medium is strictly prohibited
5
+ * Proprietary and confidential
6
+ * You can contact Smackcoders at email address info@smackcoders.com.
7
+ *******************************************************************************************/
8
+
9
+ require_once('../../../../../../wp-load.php');
10
+ $ExportObj = new WPCSVProExportData();
11
+ #print('<pre>'); print_r($_POST); //die;
12
+ $ExportObj->executeIndex($_POST);
13
+ class WPCSVProExportData {
14
+ public function __construct() {
15
+
16
+ }
17
+
18
+ /**
19
+ * The actions index method
20
+ * @param array $request
21
+ * @return array
22
+ */
23
+ public function executeIndex($request) {
24
+ #print('<pre>'); print_r($request); print('</pre>'); die;
25
+ if($request['export'] == 'category') {
26
+ $this->WPImpExportCategories($request);
27
+ }
28
+ else if($request['export'] == 'tags') {
29
+ $this->WPImpExportTags($request);
30
+ }
31
+ else if($request['export'] == 'customtaxonomy') {
32
+ $this->WPImpExportTaxonomies($request);
33
+ }
34
+ else if($request['export'] == 'customerreviews') {
35
+ $this->WPImpExportCustomerReviews($request);
36
+ }
37
+ else if($request['export'] == 'comments') {
38
+ $this->WPImpExportComments($request);
39
+ }
40
+ else if($request['export'] == 'users') {
41
+ $this->WPImpExportUsers($request);
42
+ }
43
+ else {
44
+ $this->WPImpPROExportData($request);#die;
45
+ }
46
+ }
47
+
48
+ /**
49
+ *
50
+ */
51
+ public function generateCSVHeaders($exporttype){
52
+ global $wpdb;
53
+ $post_type = $exporttype;
54
+ $unwantedHeader = array('_eshop_product', '_wp_attached_file', '_wp_page_template', '_wp_attachment_metadata', '_encloseme');
55
+ if($exporttype == 'woocommerce' || $exporttype == 'marketpress')
56
+ $post_type = 'product';
57
+ if($exporttype == 'wpcommerce')
58
+ $post_type = 'wpsc-product';
59
+ if($exporttype == 'eshop')
60
+ $post_type = 'post';
61
+ if($exporttype == 'custompost') {
62
+ $post_type = $_POST['export_post_type'];
63
+ }
64
+ $header_query1 = "SELECT wp.* FROM $wpdb->posts wp where post_type = '$post_type'";
65
+ $header_query2 = "SELECT post_id, meta_key, meta_value FROM $wpdb->posts wp JOIN $wpdb->postmeta wpm ON wpm.post_id = wp.ID where meta_key NOT IN ('_edit_lock','_edit_last') and meta_key NOT LIKE 'field_%' and meta_key NOT LIKE '_wp_types%'";
66
+ $result_header_query1 = $wpdb->get_results($header_query1);
67
+ $result_header_query2 = $wpdb->get_results($header_query2);
68
+
69
+ foreach ($result_header_query1 as $rhq1_key) {
70
+ foreach ($rhq1_key as $rhq1_headkey => $rhq1_headval) {
71
+ if (!in_array($rhq1_headkey, $Header))
72
+ $Header[] = $rhq1_headkey;
73
+ }
74
+ }
75
+ foreach($this->getACFvalues() as $acfKey => $acfVal) {
76
+ $unwantedHeader[] = '_' . $acfKey;
77
+ }
78
+ foreach($this->getACFvalues() as $acfKey => $acfVal) {
79
+ if(!in_array($acfKey, $unwantedHeader)) {
80
+ $Header[] = $acfKey;
81
+ $unwantedHeader[] = $acfKey;
82
+ }
83
+ }
84
+ foreach($this->getTypesFields() as $typeKey => $typeVal) {
85
+ if(!in_array($typeKey, $unwantedHeader)) {
86
+ $Header[] = $typeVal;
87
+ $unwantedHeader[] = $typeKey;
88
+ }
89
+ }
90
+ foreach($this->getAIOSEOfields() as $aioseokey => $aioseoval) {
91
+ $Header[] = $aioseoval;
92
+ $unwantedHeader[] = $aioseokey;
93
+ }
94
+ foreach($this->getYoastSEOfields() as $yoastseokey => $yoastseoval) {
95
+ $Header[] = $yoastseoval;
96
+ $unwantedHeader[] = $yoastseokey;
97
+ }
98
+ foreach ($result_header_query2 as $rhq2_headkey) {
99
+ if (!in_array($rhq2_headkey->meta_key, $Header)) {
100
+ if(!in_array($rhq2_headkey->meta_key, $unwantedHeader)) {
101
+ $Header[] = $rhq2_headkey->meta_key;
102
+ }
103
+ }
104
+ }
105
+
106
+ #print('<pre>'); print_r($Header); die;
107
+ if($exporttype == 'woocommerce' || $exporttype == 'marketpress' || $exporttype == 'wpcommerce' || $exporttype == 'eshop') {
108
+ if($exporttype == 'woocommerce') {
109
+ foreach($this->WoocommerceMetaHeaders() as $woo_hkey => $woo_hval) {
110
+ if(in_array($woo_hval, $Header))
111
+ $ProHeader[] = $woo_hkey;
112
+ else
113
+ $ProHeader[] = $woo_hkey;
114
+ }
115
+ }
116
+ else if($exporttype == 'marketpress') {
117
+ foreach($this->MarketPressHeaders() as $mp_hkey => $mp_hval) {
118
+ if(in_array($mp_hval, $Header))
119
+ $ProHeader[] = $mp_hkey;
120
+ else
121
+ $ProHeader[] = $mp_hkey;
122
+ }
123
+ }
124
+ else if($exporttype == 'wpcommerce') {
125
+ foreach($this->WpeCommerceHeaders() as $wpcom_hkey => $wpcom_hval) {
126
+ if(in_array($wpcom_hval, $Header))
127
+ $ProHeader[] = $wpcom_hkey;
128
+ else
129
+ $ProHeader[] = $wpcom_hkey;
130
+ }
131
+ }
132
+ else if($exporttype == 'eshop') {
133
+ foreach($this->EshopHeaders() as $eshop_hkey => $eshop_hval) {
134
+ if(in_array($eshop_hval, $Header))
135
+ $ProHeader[] = $eshop_hkey;
136
+ else
137
+ $ProHeader[] = $eshop_hkey;
138
+ }
139
+ }
140
+ foreach($this->getACFvalues() as $acfKey => $acfVal) {
141
+ if(!in_array($acfKey, $unwantedHeader)) {
142
+ $ProHeader[] = $acfKey;
143
+ }
144
+ }
145
+ foreach($this->getTypesFields() as $typeKey => $typeVal) {
146
+ if(!in_array($typeKey, $unwantedHeader)) {
147
+ $ProHeader[] = $typeVal;
148
+ }
149
+ }
150
+ foreach($this->getAIOSEOfields() as $aioseokey => $aioseoval) {
151
+ $ProHeader[] = $aioseoval;
152
+ }
153
+ foreach($this->getYoastSEOfields() as $yoastseokey => $yoastseoval) {
154
+ $ProHeader[] = $yoastseoval;
155
+ }
156
+ $ProHeader[] = 'featured_image';
157
+ return $ProHeader;
158
+ }
159
+ $Header[] = 'featured_image';
160
+ return $Header;
161
+ }
162
+
163
+ /**
164
+ *
165
+ */
166
+ public function get_all_record_ids($exporttype, $request) {
167
+ global $wpdb;
168
+ $post_type = $exporttype;
169
+ $get_post_ids = "select DISTINCT ID from $wpdb->posts p join $wpdb->postmeta pm on pm.post_id = p.ID";
170
+ if($post_type == 'woocommerce' || $post_type == 'marketpress')
171
+ $post_type = 'product';
172
+ if($post_type == 'wpcommerce')
173
+ $post_type = 'wpsc-product';
174
+ if($post_type == 'eshop')
175
+ $post_type = 'post';
176
+ if($post_type == 'custompost')
177
+ $post_type = $_POST['export_post_type'];
178
+
179
+ $get_post_ids .= " where p.post_type = '$post_type'";
180
+ if(isset($request['getdatawithspecificstatus'])) {
181
+ if(isset($request['postwithstatus']) && $request['postwithstatus'] == 'All') {
182
+ $get_post_ids .= " and p.post_status in ('publish','draft','future','private','pending')";
183
+ } else if(isset($request['postwithstatus']) && ($request['postwithstatus'] == 'Publish' || $request['postwithstatus'] == 'Sticky')) {
184
+ $get_post_ids .= " and p.post_status in ('publish')";
185
+ } else if(isset($request['postwithstatus']) && $request['postwithstatus'] == 'Draft') {
186
+ $get_post_ids .= " and p.post_status in ('draft')";
187
+ } else if(isset($request['postwithstatus']) && $request['postwithstatus'] == 'Scheduled') {
188
+ $get_post_ids .= " and p.post_status in ('future')";
189
+ } else if(isset($request['postwithstatus']) && $request['postwithstatus'] == 'Private') {
190
+ $get_post_ids .= " and p.post_status in ('private')";
191
+ } else if(isset($request['postwithstatus']) && $request['postwithstatus'] == 'Pending') {
192
+ $get_post_ids .= " and p.post_status in ('pending')";
193
+ } else if(isset($request['postwithstatus']) && $request['postwithstatus'] == 'Protected') {
194
+ $get_post_ids .= " and p.post_status in ('publish') and post_password != ''";
195
+ }
196
+ } else {
197
+ $get_post_ids .= " and p.post_status in ('publish','draft','future','private','pending')";
198
+ }
199
+ if(isset($request['getdataforspecificperiod'])) {
200
+ $get_post_ids .= " and p.post_date >= '" . $request['postdatefrom'] . "' and p.post_date <= '" . $request['postdateto'] . "'";
201
+ }
202
+ if($exporttype == 'eshop')
203
+ $get_post_ids .= " and pm.meta_key = 'sku'";
204
+ if($post_type == 'woocommerce')
205
+ $get_post_ids .= " and pm.meta_key = '_sku'";
206
+ if($post_type == 'marketpress')
207
+ $get_post_ids .= " and pm.meta_key = 'mp_sku'";
208
+ if($post_type == 'wpcommerce')
209
+ $get_post_ids .= " and pm.meta_key = '_wpsc_sku'";
210
+
211
+ /* if($exporttype == 'woocommerce') {
212
+ $post_type = 'product';
213
+ $get_post_ids = "select DISTINCT ID from $wpdb->posts p join $wpdb->postmeta pm on pm.post_id = p.ID where post_type = '$post_type' and post_status in ('publish','draft','future','private','pending') and pm.meta_key = '_sku'";
214
+ } */
215
+ if(isset($request['getdatabyspecificauthors'])) {
216
+ if(isset($request['postauthor']) && $request['postauthor'] != 0) {
217
+ $get_post_ids .= " and p.post_author = {$request['postauthor']}";
218
+ }
219
+ }
220
+ #print_r($get_post_ids); die;
221
+ $result = $wpdb->get_col($get_post_ids);
222
+ if(isset($request['getdatawithspecificstatus'])) {
223
+ if(isset($request['postwithstatus']) && $request['postwithstatus'] == 'Sticky') {
224
+ $get_sticky_posts = get_option('sticky_posts');
225
+ foreach($get_sticky_posts as $sticky_post_id) {
226
+ if(in_array($sticky_post_id, $result))
227
+ $sticky_posts[] = $sticky_post_id;
228
+ }
229
+ return $sticky_posts;
230
+ }
231
+ }
232
+ #print_r($get_sticky_posts);
233
+ #print_r($result);die;
234
+ return $result;
235
+ }
236
+
237
+ /**
238
+ *
239
+ */
240
+ public function getPostDatas($postID) {
241
+ global $wpdb;
242
+ $query1 = "SELECT wp.* FROM $wpdb->posts wp where ID=$postID";
243
+ $result_query1 = $wpdb->get_results($query1);
244
+ if (!empty($result_query1)) {
245
+ foreach ($result_query1 as $posts) {
246
+ foreach ($posts as $post_key => $post_value) {
247
+ if ($post_key == 'post_status') {
248
+ if (is_sticky($postID)) {
249
+ $PostData[$post_key] = 'Sticky';
250
+ $post_status = 'Sticky';
251
+ } else {
252
+ $PostData[$post_key] = $post_value;
253
+ $post_status = $post_value;
254
+ }
255
+ } else {
256
+ $PostData[$post_key] = $post_value;
257
+ }
258
+ if ($post_key == 'post_password') {
259
+ if ($post_value) {
260
+ $PostData['post_status'] = "{" . $post_value . "}";
261
+ } else {
262
+ $PostData['post_status'] = $post_status;
263
+ }
264
+ }
265
+ if ($post_key == 'comment_status') {
266
+ if ($post_value == 'closed') {
267
+ $PostData['comment_status'] = 0;
268
+ }
269
+ if ($post_value == 'open') {
270
+ $PostData['comment_status'] = 1;
271
+ }
272
+ }
273
+ }
274
+ }
275
+ }
276
+ return $PostData;
277
+ }
278
+
279
+ /**
280
+ *
281
+ */
282
+ public function getPostMetaDatas($postID) {
283
+ global $wpdb;
284
+ $query2 = "SELECT post_id, meta_key, meta_value FROM $wpdb->posts wp JOIN $wpdb->postmeta wpm ON wpm.post_id = wp.ID where meta_key NOT IN ('_edit_lock','_edit_last') AND ID=$postID";
285
+ #print($query2); print('<br>');
286
+ $result = $wpdb->get_results($query2);
287
+ return $result;
288
+ }
289
+
290
+ /**
291
+ *
292
+ */
293
+ public function getTypesFields() {
294
+ $wptypesfields = get_option('wpcf-fields');
295
+ #print('<pre>'); print_r($wptypesfields);
296
+ foreach($wptypesfields as $typeFkey){
297
+ $typesfields[$typeFkey['meta_key']] = $typeFkey['name'];
298
+ }
299
+ #print_r($typesfields);
300
+ return $typesfields;
301
+ }
302
+
303
+ /**
304
+ *
305
+ */
306
+ public function getACFvalues($getspecificfieldtype = null) {
307
+ global $wpdb;
308
+ // Code for ACF fields
309
+ $get_acf_fields = $wpdb->get_col ( "SELECT meta_value FROM $wpdb->postmeta
310
+ GROUP BY meta_key
311
+ HAVING meta_key LIKE 'field_%'
312
+ ORDER BY meta_key" );
313
+
314
+ foreach ( $get_acf_fields as $acf_value ){
315
+ $get_acf_field = unserialize($acf_value);
316
+ $acf_fields[$get_acf_field['name']] = "CF: ".$get_acf_field['name'];
317
+ $acf_fields_slug[$get_acf_field['name']] = "_".$get_acf_field['name'];
318
+
319
+ if($get_acf_field['type'] == 'checkbox'){
320
+ $checkbox_option_fields[] = $get_acf_field['name'];
321
+ }
322
+ } // Code ends here
323
+ if($getspecificfieldtype == 'checkbox')
324
+ return $checkbox_option_fields;
325
+ else
326
+ return $acf_fields;
327
+ }
328
+
329
+
330
+ /**
331
+ *
332
+ */
333
+ public function getAIOSEOfields() {
334
+ $aioseofields = array('_aioseop_keywords' => 'seo_keywords',
335
+ '_aioseop_description' => 'seo_description',
336
+ '_aioseop_title' => 'seo_title',
337
+ '_aioseop_noindex' => 'seo_noindex',
338
+ '_aioseop_nofollow' => 'seo_nofollow',
339
+ '_aioseop_disable' => 'seo_disable',
340
+ '_aioseop_disable_analytics' => 'seo_disable_analytics',
341
+ '_aioseop_noodp' => 'seo_noodp',
342
+ '_aioseop_noydir' => 'seo_noydir',);
343
+ return $aioseofields;
344
+ }
345
+
346
+ /**
347
+ *
348
+ */
349
+ public function getYoastSEOfields () {
350
+ $yoastseofields = array('_yoast_wpseo_focuskw' => 'focus_keyword',
351
+ '_yoast_wpseo_title' => 'title',
352
+ '_yoast_wpseo_metadesc' => 'meta_desc',
353
+ '_yoast_wpseo_meta-robots-noindex' => 'meta-robots-noindex',
354
+ '_yoast_wpseo_meta-robots-nofollow' => 'meta-robots-nofollow',
355
+ '_yoast_wpseo_meta-robots-adv' => 'meta-robots-adv',
356
+ '_yoast_wpseo_sitemap-include' => 'sitemap-include',
357
+ '_yoast_wpseo_sitemap-prio' => 'sitemap-prio',
358
+ '_yoast_wpseo_canonical' => 'canonical',
359
+ '_yoast_wpseo_redirect' => 'redirect',
360
+ '_yoast_wpseo_opengraph-description' => 'opengraph-description',
361
+ '_yoast_wpseo_google-plus-description' => 'google-plus-description',
362
+ );
363
+ return $yoastseofields;
364
+ }
365
+
366
+ /**
367
+ *
368
+ */
369
+ public function getAllTerms($postID, $type) {
370
+ // Tags & Categories
371
+ if($type == 'woocommerce' || $type == 'marketpress') {
372
+ $exporttype = 'product';
373
+ $postTags = $postCategory = '';
374
+ $taxonomies = get_object_taxonomies($exporttype);
375
+ $get_tags = get_the_terms( $postID, 'product_tag' );
376
+ if($get_tags){
377
+ foreach($get_tags as $tags){
378
+ $postTags .= $tags->name.',';
379
+ }
380
+ }
381
+ $postTags = substr($postTags,0,-1);
382
+ $TermsData['product_tag'] = $postTags;
383
+ foreach ($taxonomies as $taxonomy) {
384
+ if($taxonomy == 'product_cat' || $taxonomy == 'product_category'){
385
+ $get_categotries =wp_get_post_terms( $postID, $taxonomy );
386
+ if($get_categotries){
387
+ foreach($get_categotries as $category){
388
+ $postCategory .= $category->name.'|';
389
+ }
390
+ }
391
+ $postCategory = substr($postCategory, 0 , -1);
392
+ $TermsData['product_category'] = $postCategory;
393
+ }
394
+ }
395
+ } else if($type == 'wpcommerce') {
396
+ $exporttype = 'wpsc-product';
397
+ $postTags = $postCategory = '';
398
+ $taxonomies = get_object_taxonomies($exporttype);
399
+ $get_tags = get_the_terms( $postID, 'product_tag' );
400
+ if($get_tags){
401
+ foreach($get_tags as $tags){
402
+ $postTags .= $tags->name.',';
403
+ }
404
+ }
405
+ $postTags = substr($postTags,0,-1);
406
+ $TermsData['product_tag'] = $postTags;
407
+ foreach ($taxonomies as $taxonomy) {
408
+ if($taxonomy == 'wpsc_product_category'){
409
+ $get_categotries =wp_get_post_terms( $postID, $taxonomy );
410
+ if($get_categotries){
411
+ foreach($get_categotries as $category){
412
+ $postCategory .= $category->name.'|';
413
+ }
414
+ }
415
+ $postCategory = substr($postCategory, 0 , -1);
416
+ $TermsData['product_category'] = $postCategory;
417
+ }
418
+ }
419
+ } else {
420
+ $get_tags = wp_get_post_tags($postID, array('fields' => 'names'));
421
+ $postTags = $postCategory = '';
422
+ foreach ($get_tags as $tags) {
423
+ $postTags .= $tags . ',';
424
+ }
425
+ $postTags = substr($postTags, 0, -1);
426
+ $TermsData['post_tag'] = $postTags;
427
+ $get_categotries = wp_get_post_categories($postID, array('fields' => 'names'));
428
+ foreach ($get_categotries as $category) {
429
+ $postCategory .= $category . '|';
430
+ }
431
+ $postCategory = substr($postCategory, 0, -1);
432
+ $TermsData['post_category'] = $postCategory;
433
+ }
434
+ #print('<pre>'); print_r($TermsData); die;
435
+ return $TermsData;
436
+ }
437
+
438
+ /**
439
+ *
440
+ */
441
+ public function MarketPressHeaders() {
442
+ $marketpressHeaders = array('product_title' => 'post_title', 'product_content' => 'post_content', 'product_excerpt' => 'post_excerpt', 'product_publish_date' => 'post_date', 'product_slug' => 'post_name', 'product_status' => 'post_status', 'product_parent' => 'post_parent', 'comment_status' => 'open', 'ping_status' => 'open', 'variation' => 'mp_var_name', 'SKU' => 'mp_sku', 'regular_price' => 'mp_price', 'is_sale' => 'mp_is_sale', 'sale_price' => 'mp_sale_price', 'track_inventory' => 'mp_track_inventory', 'inventory' => 'mp_inventory', 'track_limit' => 'mp_track_limit', 'limit_per_order' => 'mp_limit', 'product_link' => 'mp_product_link', 'is_special_tax' => 'mp_is_special_tax', 'special_tax' => 'mp_special_tax', 'sales_count' => 'mp_sales_count', 'extra_shipping_cost' => 'mp_shipping', 'file_url' => 'mp_file', 'product_category' => 'post_category', 'product_tag' => 'post_tag', 'featured_image' => 'featured_image',);
443
+ return $marketpressHeaders;
444
+ }
445
+
446
+ /**
447
+ *
448
+ */
449
+ public function WpeCommerceHeaders() {
450
+ $wpecommerceHeaders = array('post_date' => 'post_date', 'post_content' => 'post_content', 'post_title' => 'post_title', 'post_excerpt' => 'post_excerpt', 'post_name' => 'post_name', 'stock' => '_wpsc_stock', 'price' => '_wpsc_price', 'sale_price' => '_wpsc_special_price', 'SKU' => '_wpsc_sku', 'product_tags' => 'product_tag', 'product_category' => null, 'featured_image' => 'featured_image', 'custom_meta' => null, 'wpsc_is_donation' => '_wpsc_is_donation', 'notify_when_none_left' => 'notify_when_none_left', 'unpublish_when_none_left' => 'unpublish_when_none_left', 'taxable_amount' => 'wpec_taxes_taxable_amount', 'is_taxable' => 'wpec_taxes_taxable', 'external_link' => 'external_link', 'external_link_text' => 'external_link_text', 'external_link_target' => 'external_link_target', 'no_shipping' => 'no_shipping', 'weight' => 'weight', 'weight_unit' => 'weight_unit', 'height' => 'height', 'height_unit' => 'height_unit', 'width' => 'width', 'width_unit' => 'width_unit', 'length' => 'length', 'length_unit' => 'length_unit', 'dimension_unit' => null, 'shipping' => 'shipping', 'merchant_notes' => 'merchant_notes', 'enable_comments' => 'enable_comments', 'quantity_limited' => 'quantity_limited', 'special' => 'special', 'display_weight_as' => 'display_weight_as', 'state' => 'state', 'quantity' => 'quantity', 'table_price' => 'table_price', 'google_prohibited' => 'google_prohibited',);
451
+ return $wpecommerceHeaders;
452
+ }
453
+
454
+ /**
455
+ *
456
+ */
457
+ public function WoocommerceMetaHeaders() {
458
+ $woocomHeaders = array('product_publish_date' => 'post_date', 'product_content' => 'post_content', 'product_name' => 'post_title', 'product_short_description' => 'post_excerpt', 'product_slug' => 'post_name', 'post_parent' => 0, 'product_category' => 'post_category', 'product_tag' => 'post_tag', 'post_type' => null, 'product_type' => '_product_type', 'product_shipping_class' => '_product_shipping_class', 'product_status' => 'post_status', 'visibility' => '_visibility', 'tax_status' => '_tax_status', 'product_attribute_name' => '_product_attribute_name', 'product_attribute_value' => '_product_attribute_value', 'product_attribute_visible' => '_product_attribute_visible', 'product_attribute_variation' => '_product_attribute_variation', 'featured_image' => null, 'product_attribute_taxonomy' => '_product_attribute_taxonomy', 'tax_class' => '_tax_class', 'file_paths' => '_file_paths', 'comment_count' => null, 'menu_order' => 0, 'comment_status'=> null, 'edit_last' => null, 'edit_lock' => null, 'thumbnail_id' => null, 'visibility' => '_visibility', 'stock_status' => '_stock_status', 'stock_qty' => '_stock', 'total_sales' => null, 'downloadable' => 'downloadable', 'downloadable_files' => '_downloadable_files', 'virtual' => '_virtual', 'regular_price' => '_regular_price', 'sale_price' => '_sale_price', 'purchase_note' => null, 'featured_product' => '_featured', 'weight' => null, 'length' => null, 'width' => null, 'height' => null, 'sku' => '_sku', 'upsell_ids' => '_upsell_ids', 'crosssell_ids' => '_crosssell_ids', 'sale_price_dates_from' => '_sale_price_dates_from', 'sale_price_dates_to' => '_sale_price_dates_to', 'price' => null,'sold_individually' => '_price', 'manage_stock' => '_manage_stock', 'backorders' => '_backorders', 'product_image_gallery' => '__product_image_gallery', 'product_url' => '_product_url', 'button_text' => '_button_text', 'downloadable_files' => null, 'download_limit' => '_download_limit', 'download_expiry' => '_download_expiry', 'download_type'=> null, 'min_variation_price' => null, 'max_variation_price'=> null, 'min_price_variation_id' => null, 'max_price_variation_id' => null, 'min_variation_regular_price' => null, 'max_variation_regular_price' => null, 'min_regular_price_variation_id' => null, 'max_regular_price_variation_id' => null, 'min_variation_sale_price' => null, 'max_variation_sale_price' => null, 'min_sale_price_variation_id' => null, 'max_sale_price_variation_id' => null, 'default_attributes' => null,);
459
+ return $woocomHeaders;
460
+ }
461
+
462
+ /**
463
+ *
464
+ */
465
+ public function EshopHeaders() {
466
+ $eshopHeaders = array('post_title' => 'post_title', 'post_content' => 'post_content', 'post_excerpt' => 'post_excerpt', 'post_date' => 'post_date', 'post_name' => 'post_name', 'post_status' => 'post_status', 'post_author' => 'post_author', 'post_parent' => 0, 'comment_status' => 'open', 'ping_status' => 'open', 'SKU' => 'sku', 'products_option' => 'products_option', 'sale_price' => 'sale_price', 'regular_price' => 'regular_price', 'description' => 'description', 'shiprate' => 'shiprate', 'optset' => null, 'featured_product' => 'featured', 'product_in_sale' => '_eshop_sale', 'stock_available' => '_eshop_stock', 'cart_option' => 'cart_radio', 'category' => 'post_category', 'tags' => 'post_tag', 'featured_image' => null,);
467
+ return $eshopHeaders;
468
+ }
469
+
470
+ /**
471
+ * @param $request
472
+ * @return array
473
+ */
474
+ public function WPImpPROExportData($request) {
475
+ #print('<pre>'); print_r($this->getACFvalues()); die;
476
+ global $wpdb;
477
+ $export_delimiter = ',';
478
+ $exporttype = $_POST['export'];
479
+ $wpcsvsettings=get_option('wpcsvprosettings');
480
+ if(isset($wpcsvsettings['export_delimiter'])){
481
+ $export_delimiter = $wpcsvsettings['export_delimiter'];
482
+ }
483
+ if($_POST['export_filename'])
484
+ $csv_file_name =$_POST['export_filename'].'.csv';
485
+ else
486
+ $csv_file_name='exportas_'.date("Y").'-'.date("m").'-'.date("d").'.csv';
487
+ $wptypesfields = get_option('wpcf-fields');
488
+ #print('<pre>'); print_r($wptypesfields); die;
489
+ #print('<pre>'); print_r($_POST); print('</pre>');
490
+ //if($exporttype=='post' || $exporttype=='page' || $exporttype=='custompost') {
491
+ if($exporttype == 'custompost') {
492
+ $exporttype = $_POST['export_post_type'];
493
+ }
494
+ $Header = $this->generateCSVHeaders($exporttype);
495
+ $result = $this->get_all_record_ids($exporttype, $request);
496
+ #print('<pre>'); print_r($Header); print_r($result); print('</pre>'); die;
497
+ $fieldsCount = count($result);
498
+ if ($result) {
499
+ foreach ($result as $postID) {
500
+ $pId = $pId . ',' . $postID;
501
+ $PostData[$postID] = $this->getPostDatas($postID);
502
+ #print('<pre>'); print_r($PostData); #die;
503
+ $result_query2 = $this->getPostMetaDatas($postID);
504
+ #print('<pre>'); print_r($result_query2); print('</pre>'); #die;
505
+
506
+ $possible_values = array('s:', 'a:', ':{');
507
+ if (!empty($result_query2)) {
508
+ foreach ($result_query2 as $postmeta) {
509
+ $typesFserialized = 0;
510
+ $isFound = explode('wpcf-',$postmeta->meta_key);
511
+ if(count($isFound) == 2){
512
+ foreach($wptypesfields as $typesKey => $typesVal){
513
+ if($postmeta->meta_key == 'wpcf-'.$typesKey){
514
+ foreach($possible_values as $posval){
515
+ if(strpos($postmeta->meta_value,$posval)){
516
+ $typesFserialized = 1;
517
+ } else {
518
+ $typesFserialized = 0;
519
+ }
520
+ }
521
+ if($typesFserialized == 1){
522
+ $getMetaData = get_post_meta($postID, $postmeta->meta_key);
523
+ if(!is_array($getMetaData[0])){
524
+ $get_all_values = unserialize($getMetaData[0]);
525
+ $get_values = $get_all_values[0];
526
+ } else {
527
+ $get_values = $getMetaData[0];
528
+ }
529
+ $typesFVal = null;
530
+ if($typesVal['type'] == 'checkboxes'){
531
+ foreach($get_values as $authorKey => $authorVal) {
532
+ foreach($typesVal['data']['options'] as $doKey => $doVal){
533
+ if($doKey == $authorKey)
534
+ $typesFVal .= $doVal['title'].',';
535
+ }
536
+ }
537
+ $typesFVal = substr($typesFVal, 0, -1);
538
+ } elseif($typesVal['type'] == 'skype') {
539
+ $typesFVal = $get_values['skypename'];
540
+ }
541
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $typesFVal;
542
+ } else {
543
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $postmeta->meta_value;
544
+ }
545
+ }
546
+ }
547
+ } else {
548
+ // ACF checkbox fields
549
+ $acfserialized = 0;
550
+ if(array_key_exists($postmeta->meta_key, $this->getACFvalues())) {
551
+ foreach($possible_values as $posval){
552
+ if(strpos($postmeta->meta_value,$posval)){
553
+ $acfserialized = 1;
554
+ } else {
555
+ $acfserialized = 0;
556
+ }
557
+ }
558
+ if($acfserialized == 0) {
559
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $postmeta->meta_value;
560
+ } else {
561
+ $acf_checkboxes = $this->getACFvalues('checkbox');
562
+ if(in_array($postmeta->meta_key, $acf_checkboxes)) {
563
+ $get_all_values = unserialize($postmeta->meta_value);
564
+ foreach($get_all_values as $optKey => $optVal) {
565
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] .= $optVal . ',';
566
+ }
567
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = substr($PostMetaData[$postmeta->post_id][$postmeta->meta_key], 0, -1);
568
+ }
569
+ }
570
+ }
571
+ // ACF checkbox fields ends here
572
+ // WooCommerce product meta datas
573
+ else if ($postmeta->meta_key == '_product_attributes') {
574
+ #print_r($postmeta->meta_value); #die;
575
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = '';
576
+ $product_attribute_name = $product_attribute_value = $product_attribute_visible = $product_attribute_variation = '';
577
+ $PostMetaData[$postmeta->post_id]['_product_attribute_name'] = '';
578
+ $PostMetaData[$postmeta->post_id]['_product_attribute_value'] = '';
579
+ $PostMetaData[$postmeta->post_id]['_product_attribute_visible'] = '';
580
+ $PostMetaData[$postmeta->post_id]['_product_attribute_variation'] = '';
581
+ $eshop_products_unser1 = unserialize($postmeta->meta_value);
582
+ $check_attr_count1 = count($eshop_products_unser1);
583
+ if($check_attr_count1 == 1){
584
+ $eshop_products_unser2 = unserialize($eshop_products_unser1);
585
+ $check_attr_count2 = count($eshop_products_unser2);
586
+ }
587
+ if($check_attr_count1 < $check_attr_count2){
588
+ $unserialized_attributes = $eshop_products_unser2;
589
+ }else{
590
+ $unserialized_attributes = $eshop_products_unser1;
591
+ }
592
+
593
+ foreach ($unserialized_attributes as $key) {
594
+ foreach($key as $attr_header => $attr_value){
595
+ if($attr_header == 'name')
596
+ $product_attribute_name .= $attr_value.'|';
597
+ if($attr_header == 'value')
598
+ $product_attribute_value .= $attr_value.'|';
599
+ if($attr_header == 'is_visible')
600
+ $product_attribute_visible .= $attr_value.'|';
601
+ if($attr_header == 'is_variation'){
602
+ if(isset($attr_value))
603
+ $product_attribute_variation .= $attr_value.'|';
604
+ }
605
+ }
606
+ }
607
+ $PostMetaData[$postmeta->post_id]['_product_attribute_name'] = substr($product_attribute_name, 0, -1);
608
+ $PostMetaData[$postmeta->post_id]['_product_attribute_value'] = substr($product_attribute_value, 0, -1);
609
+ $PostMetaData[$postmeta->post_id]['_product_attribute_visible'] = substr($product_attribute_visible, 0, -1);
610
+ $PostMetaData[$postmeta->post_id]['_product_attribute_variation'] = substr($product_attribute_variation, 0, -1);
611
+ #print('<pre>'); print_r($PostMetaData); die;
612
+ }
613
+ else if ($postmeta->meta_key == '_upsell_ids') {
614
+ $upsellids = array();
615
+ $crosssellids = array();
616
+ #print('<pre>'); print('VALUE for _upsell_ids: '); print_r($postmeta->meta_value); #print_r($PostMetaData); print('</pre>'); #die;
617
+ if($postmeta->meta_value != '' && $postmeta->meta_value != null) {
618
+ $upsellids = unserialize($postmeta->meta_value);
619
+ if(is_array($upsellids)){
620
+ foreach($upsellids as $upsellID){
621
+ $upsell_ids .= $upsellID.',';
622
+ }
623
+ $PostMetaData[$postmeta->post_id]['_upsell_ids'] = substr($upsell_ids, 0, -1);
624
+ }else{
625
+ $PostMetaData[$postmeta->post_id]['_upsell_ids'] = '';
626
+ }
627
+ #print('<pre>'); print('VALUE for _upsell_ids: '); print_r($postmeta->meta_value); print_r($PostMetaData);
628
+ }
629
+ }
630
+ #print('<pre>'); print('VALUE for _upsell_ids: '); print_r($postmeta->meta_value); print_r($PostMetaData); print('</pre>'); #die;
631
+ else if ($postmeta->meta_key == '_crosssell_ids') {
632
+ if($postmeta->meta_value != '' && $postmeta->meta_value != null) {
633
+ $crosssellids = unserialize($postmeta->meta_value);
634
+ if(is_array($crosssellids)){
635
+ foreach($crosssellids as $crosssellID){
636
+ $crosssell_ids .= $crosssellID.',';
637
+ }
638
+ $PostMetaData[$postmeta->post_id]['_crosssell_ids'] = substr($crosssell_ids, 0, -1);
639
+ }else{
640
+ $PostMetaData[$postmeta->post_id]['_crosssell_ids'] = '';
641
+ }
642
+ }
643
+ }
644
+ else if ($postmeta->meta_key == '_downloadable_files') {
645
+ if($postmeta->meta_value != '' && $postmeta->meta_value != null) {
646
+ $downloadable_files = unserialize($postmeta->meta_value);
647
+ if(is_array($downloadable_files)){
648
+ foreach($downloadable_files as $dkey => $dval){
649
+ $downloadable_key = $dkey;
650
+ foreach($dval as $down_key => $down_val) {
651
+ $downloadable_value .= $down_val . ',';
652
+ }
653
+ }
654
+ $downloadable_all .= $downloadable_key . ',' . $downloadable_value;
655
+ $PostMetaData[$postmeta->post_id]['_downloadable_files'] = substr($downloadable_all ,0, -1);
656
+ }else{
657
+ $PostMetaData[$postmeta->post_id]['_downloadable_files'] = '';
658
+ }
659
+ }
660
+ }
661
+ else if ($postmeta->meta_key == '_thumbnail_id') {
662
+ $attachment_file = '';
663
+ $get_attachement = "select guid from $wpdb->posts where ID = $postmeta->meta_value AND post_type = 'attachment'";
664
+ $attachment = $wpdb->get_results($get_attachement);
665
+ $attachment_file = $attachment[0]->guid;
666
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = '';
667
+ $postmeta->meta_key = 'featured_image';
668
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $attachment_file;
669
+ }
670
+ else if ($postmeta->meta_key == '_visibility') {
671
+ if($postmeta->meta_value == 'visible')
672
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 1;
673
+ if($postmeta->meta_value == 'catalog')
674
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 2;
675
+ if($postmeta->meta_value == 'search')
676
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 3;
677
+ if($postmeta->meta_value == 'hidden')
678
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 4;
679
+ }
680
+ else if ($postmeta->meta_key == '_stock_status') {
681
+ /*if($postmeta->meta_value == 'instock')
682
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 1;
683
+ if($postmeta->meta_value == 'outofstock')
684
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 2;*/
685
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $postmeta->meta_value;
686
+ }
687
+ else if ($postmeta->meta_key == '_tax_status') {
688
+ if($postmeta->meta_value == 'taxable')
689
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 1;
690
+ if($postmeta->meta_value == 'shipping')
691
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 2;
692
+ if($postmeta->meta_value == 'none')
693
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 3;
694
+ }
695
+ else if ($postmeta->meta_key == '_tax_class') {
696
+ if($postmeta->meta_value == '')
697
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 1;
698
+ if($postmeta->meta_value == 'reduced-rate')
699
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 2;
700
+ if($postmeta->meta_value == 'zero-rate')
701
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 3;
702
+ }
703
+ else if ($postmeta->meta_key == '_backorders') {
704
+ if($postmeta->meta_value == 'no')
705
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 1;
706
+ if($postmeta->meta_value == 'notify')
707
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 2;
708
+ if($postmeta->meta_value == 'yes')
709
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 3;
710
+ }
711
+ else if ($postmeta->meta_key == '_featured') {
712
+ if($postmeta->meta_value == 'no')
713
+ $PostMetaData[$postmeta->post_id]['featured_product'] = 1;
714
+ if($postmeta->meta_value == 'yes')
715
+ $PostMetaData[$postmeta->post_id]['featured_product'] = 2;
716
+ if($postmeta->meta_value == 'zero-rate')
717
+ $PostMetaData[$postmeta->post_id]['featured_product'] = 3;
718
+ }
719
+ else if ($postmeta->meta_key == '_product_type') {
720
+ if($postmeta->meta_value == 'simple')
721
+ $PostMetaData[$postmeta->post_id]['product_type'] = 1;
722
+ if($postmeta->meta_value == 'grouped')
723
+ $PostMetaData[$postmeta->post_id]['product_type'] = 2;
724
+ if($postmeta->meta_value == 'variable')
725
+ $PostMetaData[$postmeta->post_id]['product_type'] = 4;
726
+ }
727
+ /* else if($postmeta->meta_key != '_eshop_product' && $postmeta->meta_key != '_thumbnail_id') {
728
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $postmeta->meta_value;
729
+ } */
730
+ #$eshop_products = $postmeta->meta_value;
731
+ else if ($postmeta->meta_key == 'products') {
732
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = '';
733
+ $eshop_products = unserialize($eshop_products);
734
+ foreach ($eshop_products as $key) {
735
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] .= $key['option'] . '|' . $key['price'] . '|' . $key['saleprice'] . ',';
736
+ }
737
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = substr($PostMetaData[$postmeta->post_id][$postmeta->meta_key], 0, -1);
738
+ } // WooCommerce product meta datas end here
739
+ // MarketPress product meta datas starts here
740
+ else if ($postmeta->meta_key == 'mp_var_name') {
741
+ $mp_variations = null;
742
+ $all_variations = unserialize($postmeta->meta_value);
743
+ foreach($all_variations as $variation_name) {
744
+ $mp_variations .= $variation_name . ',';
745
+ }
746
+ $mp_variations = substr($mp_variations, 0, -1);
747
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $mp_variations;
748
+ }
749
+ else if ($postmeta->meta_key == 'mp_sale_price') {
750
+ $mp_sale_prices = null;
751
+ $all_sale_prices = unserialize($postmeta->meta_value);
752
+ foreach($all_sale_prices as $mp_sale_price_value) {
753
+ $mp_sale_prices .= $mp_sale_price_value . ',';
754
+ }
755
+ $mp_sale_prices = substr($mp_sale_prices, 0, -1);
756
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $mp_sale_prices;
757
+ }
758
+ else if ($postmeta->meta_key == 'mp_price') {
759
+ $mp_prod_prices = null;
760
+ $all_mp_prod_prices = unserialize($postmeta->meta_value);
761
+ foreach($all_mp_prod_prices as $mp_prod_price_value) {
762
+ $mp_prod_prices .= $mp_prod_price_value . ',';
763
+ }
764
+ $mp_prod_prices = substr($mp_prod_prices, 0, -1);
765
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $mp_prod_prices;
766
+ }
767
+ else if ($postmeta->meta_key == 'mp_sku') {
768
+ $mp_sku = null;
769
+ $all_mp_prod_sku = unserialize($postmeta->meta_value);
770
+ foreach($all_mp_prod_sku as $mp_prod_sku) {
771
+ $mp_sku .= $mp_prod_sku. ',';
772
+ }
773
+ $mp_sku = substr($mp_sku, 0, -1);
774
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $mp_sku;
775
+ }
776
+ else if ($postmeta->meta_key == 'mp_shipping') {
777
+ $mp_prod_shipping_value = unserialize($postmeta->meta_value);
778
+ $mp_shipping_value = $mp_prod_shipping_value['extra_cost'];
779
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $mp_shipping_value;
780
+ }
781
+ else if ($postmeta->meta_key == 'mp_inventory') {
782
+ $mp_inventory_value = null;
783
+ $mp_prod_inventory_values = unserialize($postmeta->meta_value);
784
+ foreach($mp_prod_inventory_values as $inventory_values) {
785
+ $mp_inventory_value .= $inventory_values. ',';
786
+ }
787
+ $mp_inventory_value = substr($mp_inventory_value, 0, -1);
788
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $mp_inventory_value;
789
+ } // MarketPress product meta datas ends here
790
+ // WP e-Commerce product meta datas starts here
791
+ else if ($postmeta->meta_key == '_wpsc_product_metadata') {
792
+ $wpecomm_product_metadata = unserialize($postmeta->meta_value);
793
+ #print('<pre>'); print_r($wpecomm_product_metadata); die;
794
+ foreach($wpecomm_product_metadata as $prod_md_key => $prod_md_val) {
795
+ if($prod_md_key == 'dimensions') { #die('summa');
796
+ foreach($prod_md_val as $prod_dimen_key => $prod_dimen_val) {
797
+ $PostMetaData[$postmeta->post_id][$prod_dimen_key] = $prod_dimen_val;
798
+ }
799
+ }
800
+ else if($prod_md_key == 'shipping') {
801
+ $shipping = null;
802
+ foreach($prod_md_val as $prod_ship_key => $prod_ship_val) {
803
+ $shipping .= $prod_ship_val . ',';
804
+ }
805
+ $shipping = substr($shipping, 0, -1);
806
+ $PostMetaData[$postmeta->post_id][$prod_md_key] = $shipping;
807
+ }
808
+ else if($prod_md_key == 'table_rate_price') {
809
+ foreach($prod_md_val as $table_rate_key => $table_rate_val) {
810
+ if($table_rate_key == 'quantity') {
811
+ $trq_val = null;
812
+ foreach($table_rate_val as $trq) {
813
+ $trq_val .= $trq . '|';
814
+ }
815
+ $trq_val = substr($trq_val, 0, -1);
816
+ $PostMetaData[$postmeta->post_id][$table_rate_key] = $trq_val;
817
+ } else if($table_rate_key == 'table_price') {
818
+ $tbl_price_amt = null;
819
+ foreach($table_rate_val as $tbl_price) {
820
+ $tbl_price_amt .= $tbl_price . '|';
821
+ }
822
+ $tbl_price_amt = substr($tbl_price_amt, 0, -1);
823
+ $PostMetaData[$postmeta->post_id][$table_rate_key] = $tbl_price_amt;
824
+ } else {
825
+ $PostMetaData[$postmeta->post_id][$table_rate_key] = $table_rate_val;
826
+ }
827
+ }
828
+ }
829
+ else {
830
+ $PostMetaData[$postmeta->post_id][$prod_md_key] = $prod_md_val;
831
+ }
832
+ }
833
+ }
834
+ // Wp e-Commerce product meta datas ends here
835
+ // Eshop product meta datas starts here
836
+ else if ($postmeta->meta_key == 'featured') {
837
+ $isFeatured = strtolower($postmeta->meta_value);
838
+ $PostMetaData[$postmeta->post_id]['featured_product'] = $isFeatured;
839
+ }
840
+ else if ($postmeta->meta_key == 'sale') {
841
+ $is_prod_sale = strtolower($postmeta->meta_value);
842
+ $PostMetaData[$postmeta->post_id]['product_in_sale'] = $is_prod_sale;
843
+ }
844
+ else if ($postmeta->meta_key == '_eshop_stock') {
845
+ if($postmeta->meta_value == 1) {
846
+ $stock_available = 'yes';
847
+ } else {
848
+ $stock_available = 'no';
849
+ }
850
+ $PostMetaData[$postmeta->post_id]['stock_available'] = $stock_available;
851
+ }
852
+ else if ($postmeta->meta_key == 'cart_radio') {
853
+ $PostMetaData[$postmeta->post_id]['cart_option'] = $postmeta->meta_value;
854
+ }
855
+ else if ($postmeta->meta_key == 'shiprate') {
856
+ $PostMetaData[$postmeta->post_id]['shiprate'] = $postmeta->meta_value;
857
+ }
858
+ else if ($postmeta->meta_key == '_eshop_product') {
859
+ $product_attr_details = unserialize($postmeta->meta_value);
860
+ $prod_option = $sale_price = $reg_price = null;
861
+ #print('<pre>');print_r($product_attr_details); #die;
862
+ foreach($product_attr_details as $prod_att_det_Key => $prod_att_det_Val) {
863
+ if($prod_att_det_Key == 'sku') {
864
+ $PostMetaData[$postmeta->post_id]['sku'] = $prod_att_det_Val;
865
+ }
866
+ else if($prod_att_det_Key == 'products') {
867
+ foreach($prod_att_det_Val as $all_prod_options) {
868
+ $prod_option .= $all_prod_options['option'] . ',';
869
+ $sale_price .= $all_prod_options['saleprice'] . ',';
870
+ $reg_price .= $all_prod_options['price'] . ',';
871
+ }
872
+ $prod_option = substr($prod_option, 0, -1);
873
+ $sale_price = substr($sale_price, 0, -1);
874
+ $reg_price = substr($reg_price, 0, -1);
875
+ $PostMetaData[$postmeta->post_id]['products_option'] = $prod_option;
876
+ $PostMetaData[$postmeta->post_id]['sale_price'] = $sale_price;
877
+ $PostMetaData[$postmeta->post_id]['regular_price'] = $reg_price;
878
+ }
879
+ }
880
+ #$PostMetaData[$postmeta->post_id]['cart_option'] = $postmeta->meta_value;
881
+ }
882
+ // Eshop product meta datas ends here
883
+ else if ($postmeta->meta_key == '_thumbnail_id') {
884
+ $attachment_file = '';
885
+ $get_attachement = "select guid from $wpdb->posts where ID = $postmeta->meta_value AND post_type = 'attachment'";
886
+ $attachment = $wpdb->get_results($get_attachement);
887
+ $attachment_file = $attachment[0]->guid;
888
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = '';
889
+ $postmeta->meta_key = 'featured_image';
890
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $attachment_file;
891
+ }
892
+ else if(is_array($checkbox_option_fields) && in_array($postmeta->meta_key,$checkbox_option_fields)){
893
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = '';
894
+ $eshop_products = unserialize($eshop_products); //print_r($eshop_products);
895
+ foreach ($eshop_products as $key) {
896
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] .= $key . ',';
897
+ }
898
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = substr($PostMetaData[$postmeta->post_id][$postmeta->meta_key], 0, -1);
899
+ }
900
+ else {
901
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $postmeta->meta_value;
902
+ }
903
+ }
904
+ }
905
+ }
906
+ # print('PostMetaData: '); print('<pre>'); print_r($Header); print_r($PostMetaData); #die;
907
+ $TermsData[$postID] = $this->getAllTerms($postID,$exporttype);
908
+ /*
909
+ // Tags & Categories
910
+ $get_tags = wp_get_post_tags($postID, array('fields' => 'names'));
911
+ $postTags = $postCategory = '';
912
+ foreach ($get_tags as $tags) {
913
+ $postTags .= $tags . ',';
914
+ }
915
+ $postTags = substr($postTags, 0, -1);
916
+ $TermsData[$postID]['post_tag'] = $postTags;
917
+ $get_categotries = wp_get_post_categories($postID, array('fields' => 'names'));
918
+ foreach ($get_categotries as $category) {
919
+ $postCategory .= $category . '|';
920
+ }
921
+ $postCategory = substr($postCategory, 0, -1);
922
+ $TermsData[$postID]['post_category'] = $postCategory;
923
+ */
924
+ }
925
+
926
+ #$ExportData = array();
927
+ // Merge all arrays
928
+ #echo '<pre>'; print_r($TermsData); die;
929
+ // echo '<pre>'; print_r($PostData); die('sds');
930
+ foreach ($PostData as $pd_key => $pd_val) {
931
+ if (array_key_exists($pd_key, $PostMetaData)) {
932
+ $ExportData[$pd_key] = array_merge($PostData[$pd_key], $PostMetaData[$pd_key]);
933
+ // echo '<pre>'; print_r($ExportData); die('exist');
934
+ } else {
935
+ $ExportData[$pd_key] = $PostData[$pd_key];
936
+ }
937
+ if (array_key_exists($pd_key, $TermsData)) {
938
+ if (empty($ExportData[$pd_key]))
939
+ $ExportData[$pd_key] = array();
940
+ $ExportData[$pd_key] = array_merge($ExportData[$pd_key], $TermsData[$pd_key]);
941
+ }
942
+ }
943
+ }
944
+ #print('<pre>'); print_r($Header); die;
945
+ #print('<pre>'); print_r($ExportData); die;
946
+ if($exporttype == 'woocommerce') {
947
+ foreach($Header as $hkey) {
948
+ foreach($ExportData as $edkey => $edval) {
949
+ /*if(array_key_exists($hkey, $this->getACFvalues())) {
950
+ $ExportData[$edkey][$hkey] = $edval[$hkey];
951
+ unset($ExportData[$edkey]['_'.$hkey]);
952
+ }
953
+ else if(in_array($hkey, $this->getAIOSEOfields())) {
954
+ foreach($this->getAIOSEOfields() as $aioseokey => $aioseoval) {
955
+ $ExportData[$edkey][$aioseoval] = $edval[$aioseokey];
956
+ unset($ExportData[$edkey][$hkey]);
957
+ }
958
+ }
959
+ else if(array_key_exists('_'.$hkey, $edval)) {
960
+ $ExportData[$edkey][$hkey] = $edval['_'.$hkey];
961
+ unset($ExportData[$edkey]['_'.$hkey]);
962
+ } */
963
+ foreach($this->WoocommerceMetaHeaders() as $woohkey => $woohval) {
964
+ if(array_key_exists($woohval, $ExportData[$edkey])) {
965
+ $ExportData[$edkey][$woohkey] = $edval[$woohval];
966
+ unset($ExportData[$edkey][$woohval]);
967
+ }
968
+ }
969
+ }
970
+ }
971
+ }
972
+ # MarketPressHeaders
973
+ if($exporttype == 'marketpress') {
974
+ foreach($Header as $hkey) {
975
+ foreach($ExportData as $edkey => $edval) {
976
+ foreach($this->MarketPressHeaders() as $mphkey => $mphval) {
977
+ if(array_key_exists($mphval, $ExportData[$edkey])) {
978
+ $ExportData[$edkey][$mphkey] = $edval[$mphval];
979
+ // unset($ExportData[$edkey][$mphval]);
980
+ }
981
+ }
982
+ }
983
+ }
984
+ }
985
+ if($exporttype == 'wpcommerce') {
986
+ foreach($Header as $hkey) {
987
+ foreach($ExportData as $edkey => $edval) {
988
+ foreach($this->WpeCommerceHeaders() as $wpcomhkey => $wpcomhval) {
989
+ if(array_key_exists($wpcomhval, $ExportData[$edkey])) {
990
+ $ExportData[$edkey][$wpcomhkey] = $edval[$wpcomhval];
991
+ // unset($ExportData[$edkey][$wpcomhval]);
992
+ }
993
+ }
994
+ }
995
+ }
996
+ }
997
+ if($exporttype == 'eshop') {
998
+ foreach($Header as $hkey) {
999
+ foreach($ExportData as $edkey => $edval) {
1000
+ foreach($this->EshopHeaders() as $eshophkey => $eshophval) {
1001
+ if(array_key_exists($eshophval, $ExportData[$edkey])) {
1002
+ $ExportData[$edkey][$eshophkey] = $edval[$eshophval];
1003
+ // unset($ExportData[$edkey][$wpcomhval]);
1004
+ }
1005
+ }
1006
+ }
1007
+ }
1008
+ }
1009
+ #print('<pre>'); print_r($Header); print('</pre>'); #die;
1010
+ # print('<pre>'); print_r($ExportData); die;
1011
+ foreach ($Header as $header_key) {
1012
+ if (is_array($ExportData)) {
1013
+ foreach ($ExportData as $ED_key => $ED_val) {
1014
+ if (in_array($header_key, $this->getAIOSEOfields())) { #die($header_key);
1015
+ foreach($this->getAIOSEOfields() as $aioseokey => $aioseoval) {
1016
+ $CSVContent[$ED_key][$aioseoval] = $ED_val[$aioseokey];
1017
+ #unset($CSVContent[$ED_key][$header_key]);
1018
+ }
1019
+ } else if (in_array($header_key, $this->getYoastSEOfields())) {
1020
+ foreach($this->getYoastSEOfields() as $yoastseokey => $yoastseoval) {
1021
+ $CSVContent[$ED_key][$yoastseoval] = $ED_val[$yoastseokey];
1022
+ #unset($CSVContent[$ED_key][$header_key]);
1023
+ }
1024
+ } else if (in_array($header_key, $this->getTypesFields())) {
1025
+ foreach($this->getTypesFields() as $typesFkey => $typesFval) {
1026
+ $CSVContent[$ED_key][$typesFval] = $ED_val[$typesFkey];
1027
+ #unset($CSVContent[$ED_key][$header_key]);
1028
+ }
1029
+ } else if (array_key_exists($header_key, $ED_val)) {
1030
+ $CSVContent[$ED_key][$header_key] = $ED_val[$header_key];
1031
+ } else {
1032
+ $CSVContent[$ED_key][$header_key] = null;
1033
+ }
1034
+ }
1035
+ }
1036
+ }
1037
+ #print(count($CSVContent[22]));print('<br>' . count($Header));
1038
+ #print('<pre>'); print_r($CSVContent) ;print('</pre>'); die;
1039
+ $csv = new WPImpCSVParserLib();
1040
+ $csv->output ($csv_file_name, $CSVContent, $Header, $export_delimiter);
1041
+ }
1042
+
1043
+ /**
1044
+ *
1045
+ */
1046
+ public function WPImpExportCategories($request) {
1047
+ global $wpdb;
1048
+ $export_delimiter = ',';
1049
+ $exporttype = $request['export'];
1050
+ $wpcsvsettings=get_option('wpcsvprosettings');
1051
+ if(isset($wpcsvsettings['export_delimiter'])){
1052
+ $export_delimiter = $wpcsvsettings['export_delimiter'];
1053
+ }
1054
+ if($_POST['export_filename'])
1055
+ $csv_file_name =$_POST['export_filename'].'.csv';
1056
+ else
1057
+ $csv_file_name='exportas_'.date("Y").'-'.date("m").'-'.date("d").'.csv';
1058
+
1059
+ $Header[] = 'name';
1060
+ $Header[] = 'slug';
1061
+ $Header[] = 'description';
1062
+ $get_all_categories = get_categories('hide_empty=0');
1063
+ $fieldsCount = count($get_all_categories);
1064
+ foreach( $get_all_categories as $cateKey => $cateValue ) {
1065
+ $categID = $cateValue->term_id;
1066
+ $categName = $cateValue->cat_name;
1067
+ $categSlug = $cateValue->slug;
1068
+ $categDesc = $cateValue->category_description;
1069
+ $categParent = $cateValue->parent;
1070
+ if($categParent == 0) {
1071
+ $TERM_DATA[$categID]['name'] = $categName;
1072
+ } else {
1073
+ $categParentName = get_cat_name( $categParent );
1074
+ $TERM_DATA[$categID]['name'] = $categParentName . '|' . $categName;
1075
+ }
1076
+ $TERM_DATA[$categID]['slug'] = $categSlug;
1077
+ $TERM_DATA[$categID]['description'] = $categDesc;
1078
+ }
1079
+ $csv = new WPImpCSVParserLib();
1080
+ $csv->output ($csv_file_name, $TERM_DATA, $Header, $export_delimiter);
1081
+ }
1082
+
1083
+ /**
1084
+ *
1085
+ */
1086
+ public function WPImpExportTags($request) {
1087
+ global $wpdb;
1088
+ $export_delimiter = ',';
1089
+ $exporttype = $request['export'];
1090
+ $wpcsvsettings=get_option('wpcsvprosettings');
1091
+ if(isset($wpcsvsettings['export_delimiter'])){
1092
+ $export_delimiter = $wpcsvsettings['export_delimiter'];
1093
+ }
1094
+ if($_POST['export_filename'])
1095
+ $csv_file_name =$_POST['export_filename'].'.csv';
1096
+ else
1097
+ $csv_file_name='exportas_'.date("Y").'-'.date("m").'-'.date("d").'.csv';
1098
+
1099
+ $Header[] = 'name';
1100
+ $Header[] = 'slug';
1101
+ $Header[] = 'description';
1102
+ $get_all_tags = get_tags('hide_empty=0');
1103
+ $fieldsCount = count($get_all_tags);
1104
+ foreach( $get_all_tags as $tagKey => $tagValue ) {
1105
+ $tagID = $tagValue->term_id;
1106
+ $tagName = $tagValue->name;
1107
+ $tagSlug = $tagValue->slug;
1108
+ $tagDesc = $tagValue->description;
1109
+ $TERM_DATA[$tagID]['name'] = $tagName;
1110
+ $TERM_DATA[$tagID]['slug'] = $tagSlug;
1111
+ $TERM_DATA[$tagID]['description'] = $tagDesc;
1112
+ }
1113
+ $csv = new WPImpCSVParserLib();
1114
+ $csv->output ($csv_file_name, $TERM_DATA, $Header, $export_delimiter);
1115
+ }
1116
+
1117
+ /**
1118
+ *
1119
+ */
1120
+ public function WPImpExportTaxonomies($request) {
1121
+ global $wpdb;
1122
+ $export_delimiter = ',';
1123
+ $exporttype = $request['export'];
1124
+ $wpcsvsettings=get_option('wpcsvprosettings');
1125
+ if(isset($wpcsvsettings['export_delimiter'])){
1126
+ $export_delimiter = $wpcsvsettings['export_delimiter'];
1127
+ }
1128
+ if($_POST['export_filename'])
1129
+ $csv_file_name =$_POST['export_filename'].'.csv';
1130
+ else
1131
+ $csv_file_name='exportas_'.date("Y").'-'.date("m").'-'.date("d").'.csv';
1132
+
1133
+ $taxonomy_name = $_POST['export_taxo_type'];
1134
+ $taxonomies = get_terms( $taxonomy_name, 'orderby=count&hide_empty=0' );
1135
+ $Header[] = 'name';
1136
+ $Header[] = 'slug';
1137
+ $Header[] = 'description';
1138
+ $fieldsCount = count($taxonomies);
1139
+ foreach( $taxonomies as $taxoKey => $taxoValue ) {
1140
+ $taxoID = $taxoValue->term_id;
1141
+ $taxoName = $taxoValue->name;
1142
+ $taxoSlug = $taxoValue->slug;
1143
+ $taxoDesc = $taxoValue->description;
1144
+ $taxoParent = $taxoValue->parent;
1145
+ if($taxoParent == 0) {
1146
+ $TERM_DATA[$taxoID]['name'] = $taxoName;
1147
+ } else {
1148
+ $taxoParentName = get_term( $taxoParent, $taxonomy_name );
1149
+ $TERM_DATA[$taxoID]['name'] = $taxoParentName->name . '|' . $taxoName;
1150
+ }
1151
+ $TERM_DATA[$taxoID]['slug'] = $taxoSlug;
1152
+ $TERM_DATA[$taxoID]['description'] = $taxoDesc;
1153
+ }
1154
+ $csv = new WPImpCSVParserLib();
1155
+ $csv->output ($csv_file_name, $TERM_DATA, $Header, $export_delimiter);
1156
+ }
1157
+
1158
+ /**
1159
+ *
1160
+ */
1161
+ public function WPImpExportCustomerReviews($request) {
1162
+ global $wpdb;
1163
+ $export_delimiter = ',';
1164
+ $exporttype = $request['export'];
1165
+ $wpcsvsettings=get_option('wpcsvprosettings');
1166
+ if(isset($wpcsvsettings['export_delimiter'])){
1167
+ $export_delimiter = $wpcsvsettings['export_delimiter'];
1168
+ }
1169
+ if($_POST['export_filename'])
1170
+ $csv_file_name =$_POST['export_filename'].'.csv';
1171
+ else
1172
+ $csv_file_name='exportas_'.date("Y").'-'.date("m").'-'.date("d").'.csv';
1173
+
1174
+ $header_query1 = "SELECT * FROM wp_wpcreviews";
1175
+ $header_query2 = "SELECT id FROM wp_wpcreviews";
1176
+
1177
+ $result_header_query1 = $wpdb->get_results($header_query1);
1178
+ foreach($result_header_query1 as $rhq1_key){
1179
+ foreach($rhq1_key as $rhq1_headkey => $rhq1_headval){
1180
+ if(!in_array($rhq1_headkey,$Header))
1181
+ $Header[] = $rhq1_headkey;
1182
+ }
1183
+ }
1184
+
1185
+ $result = $wpdb->get_results($header_query1);
1186
+ $result1 = $wpdb->get_results($header_query2);
1187
+ $fieldsCount = count($result);
1188
+ if ($result) {
1189
+ $i =0;
1190
+ foreach ($result as $postID) {
1191
+ foreach ($postID as $Key => $Val){
1192
+ $postData[$i][$Key] = $Val;
1193
+ }
1194
+ $i++;
1195
+ }
1196
+ $ExportData = $postData;
1197
+ $j=0;
1198
+ foreach($Header as $key)
1199
+ {
1200
+ $key=$j;
1201
+ $header[] = $key;
1202
+ $j++;
1203
+ }
1204
+
1205
+ $csv = new WPImpCSVParserLib();
1206
+ $csv->output ($csv_file_name, $ExportData, $Header, $export_delimiter);
1207
+ }
1208
+ }
1209
+
1210
+ /**
1211
+ *
1212
+ */
1213
+ public function WPImpExportComments($request) {
1214
+ global $wpdb;
1215
+ $export_delimiter = ',';
1216
+ $exporttype = $request['export'];
1217
+ $wpcsvsettings=get_option('wpcsvprosettings');
1218
+ if(isset($wpcsvsettings['export_delimiter'])){
1219
+ $export_delimiter = $wpcsvsettings['export_delimiter'];
1220
+ }
1221
+ if($_POST['export_filename'])
1222
+ $csv_file_name =$_POST['export_filename'].'.csv';
1223
+ else
1224
+ $csv_file_name='exportas_'.date("Y").'-'.date("m").'-'.date("d").'.csv';
1225
+
1226
+ $commentQuery = "SELECT * FROM $wpdb->comments " . $orderBy;
1227
+ $comments = $wpdb->get_results( $commentQuery);
1228
+ $mappedHeader = false;
1229
+ $i = 0;
1230
+ foreach($comments as $comment){
1231
+ foreach($comment as $key => $value){
1232
+ if(!$mappedHeader){
1233
+ $Header[] = $key; // ."$export_delimiter";
1234
+ }
1235
+ $ExportData[$i][$key] = $value; //'"'.$value.'"'."$export_delimiter";
1236
+ }
1237
+ $mappedHeader = true;
1238
+ $i++;
1239
+ }
1240
+ #print('<pre>'); print_r($header); print_r($singleCommentContent);die;
1241
+ $csv = new WPImpCSVParserLib();
1242
+ $csv->output ($csv_file_name, $ExportData, $Header, $export_delimiter);
1243
+ }
1244
+
1245
+ /**
1246
+ *
1247
+ */
1248
+ public function WPImpExportUsers($request) {
1249
+ global $wpdb;
1250
+ $export_delimiter = ',';
1251
+ $exporttype = $request['export'];
1252
+ $wpcsvsettings=get_option('wpcsvprosettings');
1253
+ if(isset($wpcsvsettings['export_delimiter'])){
1254
+ $export_delimiter = $wpcsvsettings['export_delimiter'];
1255
+ }
1256
+ if($_POST['export_filename'])
1257
+ $csv_file_name =$_POST['export_filename'].'.csv';
1258
+ else
1259
+ $csv_file_name='exportas_'.date("Y").'-'.date("m").'-'.date("d").'.csv';
1260
+
1261
+ $uId = '';
1262
+ $header_query1 = "SELECT *FROM $wpdb->users";
1263
+ $header_query2 = "SELECT user_id, meta_key, meta_value FROM $wpdb->users wp JOIN $wpdb->usermeta wpm ON wpm.user_id = wp.ID where meta_key NOT IN ('_edit_lock','_edit_last')";
1264
+ $result_header_query1 = $wpdb->get_results($header_query1);
1265
+ $result_header_query2 = $wpdb->get_results($header_query2);
1266
+ /* print('<pre>'); print_r($result_header_query1);
1267
+ print_r($result_header_query2);die; */
1268
+ foreach ($result_header_query1 as $rhq1_key) {
1269
+ foreach ($rhq1_key as $rhq1_headkey => $rhq1_headval) {
1270
+ if (!in_array($rhq1_headkey, $Header))
1271
+ $Header[] = $rhq1_headkey;
1272
+ }
1273
+ }
1274
+ foreach ($result_header_query2 as $rhq2_headkey) {
1275
+ if (!in_array($rhq2_headkey->meta_key, $Header)) {
1276
+ if($rhq2_headkey->meta_key == 'mp_shipping_info' )
1277
+ {
1278
+ $mp_ship_header= unserialize($rhq2_headkey->meta_value);
1279
+ foreach($mp_ship_header as $mp_ship_key => $mp_value) { $Header[] = "msi: ".$mp_ship_key; }
1280
+ }
1281
+ if($rhq2_headkey->meta_key == 'mp_billing_info' )
1282
+ {
1283
+ $mp_ship_header= unserialize($rhq2_headkey->meta_value);
1284
+ foreach($mp_ship_header as $mp_ship_key => $mp_value) { $Header[] = "mbi: ".$mp_ship_key; }
1285
+ }
1286
+
1287
+ if ($rhq2_headkey->meta_key != '_eshop_product' && $rhq2_headkey->meta_key != '_wp_attached_file' && $rhq2_headkey->meta_key != 'mp_shipping_info' && $rhq2_headkey->meta_key != 'mp_billing_info' )
1288
+ $Header[] = $rhq2_headkey->meta_key;
1289
+ }
1290
+ }
1291
+ #echo '<pre>'; print_r($Header); die('dsd');
1292
+ $get_user_ids = "select DISTINCT ID from $wpdb->users u join $wpdb->usermeta um on um.user_id = u.ID";
1293
+
1294
+ $result = $wpdb->get_col($get_user_ids);
1295
+ $fieldsCount = count($result);
1296
+ if ($result) {
1297
+ foreach ($result as $userID) {
1298
+ $uId = $uId . ',' . $userID;
1299
+ $query1 = "SELECT *FROM $wpdb->users where ID in ($userID);";
1300
+ $result_query1 = $wpdb->get_results($query1);
1301
+ if (!empty($result_query1)) {
1302
+ foreach ($result_query1 as $users) {
1303
+ foreach ($users as $user_key => $user_value) {
1304
+ $UserData[$userID][$user_key] = $user_value;
1305
+ }
1306
+ }
1307
+ }
1308
+ // echo '<pre>'; print_r($UserData); die ('dfdf');
1309
+ $query2 = "SELECT user_id, meta_key, meta_value FROM $wpdb->users wp JOIN $wpdb->usermeta wpm ON wpm.user_id = wp.ID where ID=$userID";
1310
+ $possible_values = array('s:', 'a:', ':{');
1311
+ $result_query2 = $wpdb->get_results($query2);
1312
+ if (!empty($result_query2)) {
1313
+ foreach ($result_query2 as $usermeta) {
1314
+ // echo '<pre>'; print_r($usermeta);
1315
+
1316
+ foreach($possible_values as $posval){
1317
+ if(strpos($usermeta->meta_value,$posval)){
1318
+ if($usermeta->meta_key == 'mp_shipping_info' || $usermeta->meta_key == 'mp_billing_info')
1319
+ $typesFserialized = 1;
1320
+ } else {
1321
+ $typesFserialized = 0;
1322
+ }
1323
+ }
1324
+ if($typesFserialized == 1)
1325
+ {
1326
+ if($usermeta->meta_key == 'mp_shipping_info')
1327
+ {
1328
+ $UserID = $usermeta->user_id;
1329
+ $mp_ship_data = unserialize($usermeta->meta_value);
1330
+ foreach($mp_ship_data as $mp_ship_key => $mp_ship_value)
1331
+ {
1332
+ $mp_ship_tempkey = "msi: ".$mp_ship_key;
1333
+ $UserData[$UserID][$mp_ship_tempkey]= $mp_ship_value;
1334
+ }
1335
+ }
1336
+
1337
+ if($usermeta->meta_key == 'mp_billing_info')
1338
+ {
1339
+ $UserID = $usermeta->user_id;
1340
+ $mp_ship_data = unserialize($usermeta->meta_value);
1341
+ foreach($mp_ship_data as $mp_ship_key => $mp_ship_value)
1342
+ {
1343
+ $mp_ship_tempkey = "mbi: ".$mp_ship_key;
1344
+ $UserData[$UserID][$mp_ship_tempkey]= $mp_ship_value;
1345
+ }
1346
+ }
1347
+
1348
+ if($usermeta->meta_key != 'wp_capabilities' && $usermeta->meta_key !='mp_shipping_info' && $usermeta->meta_key != 'mp_billing_info') {
1349
+ $UserData[$userID][$usermeta->meta_key] = $usermeta->meta_value;
1350
+ } else {
1351
+ if($usermeta->meta_key == 'wp_capabilities') {
1352
+ $getUserRole = unserialize($usermeta->meta_value);
1353
+ // echo '<pre>'; print_r($getUserRole); die('ddf');
1354
+ foreach($getUserRole as $urKey => $urVal) {
1355
+ $getUserRole = get_role($urKey);
1356
+ }
1357
+ $rolelevel = 0;
1358
+ $isfound = array();
1359
+ foreach($getUserRole->capabilities as $roleKey => $roleVal){
1360
+ $isfound = explode('level_', $roleKey);
1361
+ if(is_array($isfound) && count($isfound) == 2){
1362
+ $rolelevel = $rolelevel + 1;
1363
+ }
1364
+ } $rolelevel = $rolelevel - 1;
1365
+ #$UserData[$userID][$usermeta->meta_key] = $rolelevel;
1366
+ }
1367
+ }
1368
+ } else {
1369
+ foreach($possible_values as $posval){
1370
+ if(strpos($usermeta->meta_value,$posval)){
1371
+ $UserData[$userID][$usermeta->meta_key] = null;
1372
+ } else {
1373
+ $ifSerialized = 0;
1374
+ $UserData[$userID][$usermeta->meta_key] = $usermeta->meta_value;
1375
+ }
1376
+ }
1377
+
1378
+ }
1379
+ } #echo '<pre>'; print_r($UserData); die('dd');
1380
+ }
1381
+ }
1382
+ }
1383
+ $UserHeader = array();
1384
+ foreach ($Header as $header_key) {
1385
+ foreach ($UserData as $UD_key => $UD_val) {
1386
+ if(array_key_exists($header_key, $UD_val)) {
1387
+ $CSVContent[$UD_key][$header_key] = $UD_val[$header_key];
1388
+ if(!in_array($header_key, $UserHeader))
1389
+ $UserHeader[] = $header_key;
1390
+ }
1391
+ else {
1392
+ $CSVContent[$UD_key][$header_key] = null;
1393
+ }
1394
+ }
1395
+ }
1396
+
1397
+ $csv = new WPImpCSVParserLib();
1398
+ $csv->output ($csv_file_name, $CSVContent, $UserHeader, $export_delimiter);
1399
+ }
1400
+ }
modules/filemanager/actions/actions.php CHANGED
@@ -50,9 +50,7 @@ class FilemanagerActions extends SkinnyActions {
50
  {
51
  // return an array of name value pairs to send data to the template
52
  $data = array();
53
- $helperObj = new WPImporter_includes_helper();
54
- $data['common_notice'] = $helperObj->common_notice_for_pro_feature();
55
  return $data;
56
  }
57
 
58
- }
50
  {
51
  // return an array of name value pairs to send data to the template
52
  $data = array();
 
 
53
  return $data;
54
  }
55
 
56
+ }
modules/filemanager/templates/index.php CHANGED
@@ -34,6 +34,6 @@
34
  * Notices must display the words
35
  * "Copyright Smackcoders. 2014. All rights reserved".
36
  ********************************************************************************/
37
- ?>
38
- <div align='center' style='width:100%;'><?php echo $skinnyData['common_notice']; ?><img src='<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR ?>images/Filemanager.png' width=100%></div>
39
 
34
  * Notices must display the words
35
  * "Copyright Smackcoders. 2014. All rights reserved".
36
  ********************************************************************************/
37
+ ?><div align='center' style='width:100%;'><img src='<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR ?>images/Filemanager.png' width=100%>
38
+ </div>
39
 
modules/mappingtemplate/actions/actions.php CHANGED
@@ -50,9 +50,7 @@ class MappingtemplateActions extends SkinnyActions {
50
  {
51
  // return an array of name value pairs to send data to the template
52
  $data = array();
53
- $helperObj = new WPImporter_includes_helper();
54
- $data['common_notice'] = $helperObj->common_notice_for_pro_feature();
55
  return $data;
56
  }
57
 
58
- }
50
  {
51
  // return an array of name value pairs to send data to the template
52
  $data = array();
 
 
53
  return $data;
54
  }
55
 
56
+ }
modules/mappingtemplate/templates/index.php CHANGED
@@ -35,4 +35,4 @@
35
  * "Copyright Smackcoders. 2014. All rights reserved".
36
  ********************************************************************************/
37
  ?>
38
- <div align='center' style='width:100%;'> <?php echo $skinnyData['common_notice']; ?> <img src='<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR ?>images/templates.png' style='width:90%;'></div>
35
  * "Copyright Smackcoders. 2014. All rights reserved".
36
  ********************************************************************************/
37
  ?>
38
+ <div align='center' style='width:100%;'> <img src='<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR ?>images/templates.png' style='width:90%;'></div>
modules/old_export/actions/actions.php ADDED
@@ -0,0 +1,1428 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /******************************************************************************************
3
+ * Copyright (C) Smackcoders 2014 - All Rights Reserved
4
+ * Unauthorized copying of this file, via any medium is strictly prohibited
5
+ * Proprietary and confidential
6
+ * You can contact Smackcoders at email address info@smackcoders.com.
7
+ *******************************************************************************************/
8
+
9
+ class ExportActions extends SkinnyActions {
10
+ public function __construct() {
11
+
12
+ }
13
+
14
+ /**
15
+ * The actions index method
16
+ * @param array $request
17
+ * @return array
18
+ */
19
+ public function executeIndex($request) {
20
+ // return an array of name value pairs to send data to the template
21
+ $data = array();
22
+ if (!empty($request['POST'])) {
23
+ $type = $request['POST']['export'];
24
+ $filename = $request['POST']['export_filename'];
25
+ if (!empty($type) && !empty($filename)) {
26
+ $helper = new ultimatecsv_include_helper();
27
+ $helper->generateanddownloadcsv($type, $filename);
28
+ }
29
+ }
30
+ return $data;
31
+ }
32
+
33
+ /**
34
+ * @param $request
35
+ * @return array
36
+ */
37
+ public function executeExport($request) {
38
+ #TODO: Update phpdoc
39
+ $data = array();
40
+ #TODO: $data = array() not used in this function / overwritten immediately
41
+ ob_start();
42
+ global $wpdb;
43
+ $Header = $PostData = $PostMetaData = $TermsData = $ExportData = array();
44
+ $exporttype = $request['POST']['export'];
45
+ $export_filename = $request['POST']['export_filename'];
46
+ if ($export_filename) {
47
+ $csv_file_name = $export_filename . '.csv';
48
+ } else {
49
+ $csv_file_name = 'exportas_' . $exporttype . '_' . date("Y-m-d") . '.csv';
50
+ }
51
+ #TODO: $csv_file_name not used in this function / overwritten immediately
52
+
53
+ if ($exporttype == 'post' || $exporttype == 'page') {
54
+ $header_query1 = "SELECT wp.* FROM $wpdb->posts wp where post_type = '$exporttype'";
55
+ $header_query2 = "SELECT post_id, meta_key, meta_value FROM $wpdb->posts wp JOIN $wpdb->postmeta wpm ON wpm.post_id = wp.ID where meta_key NOT IN ('_edit_lock','_edit_last') and meta_key NOT LIKE 'field_%'";
56
+ $result_header_query1 = $wpdb->get_results($header_query1);
57
+ $result_header_query2 = $wpdb->get_results($header_query2);
58
+
59
+ foreach ($result_header_query1 as $rhq1_key) {
60
+ foreach ($rhq1_key as $rhq1_headkey => $rhq1_headval) {
61
+ if (!in_array($rhq1_headkey, $Header)) {
62
+ $Header[] = $rhq1_headkey;
63
+ }
64
+ }
65
+ }
66
+
67
+ foreach ($result_header_query2 as $rhq2_headkey) {
68
+ if (!in_array($rhq2_headkey->meta_key, $Header)) {
69
+ if ($rhq2_headkey->meta_key != '_eshop_product' && $rhq2_headkey->meta_key != '_wp_attached_file') {
70
+ $Header[] = $rhq2_headkey->meta_key;
71
+ }
72
+ }
73
+ }
74
+
75
+ $Header[] = 'post_tag';
76
+ $Header[] = 'featured_image';
77
+ $Header[] = 'post_category';
78
+ // Code for ACF fields
79
+ $limit = ( int )apply_filters('postmeta_form_limit', 30);
80
+ $get_acf_fields = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta
81
+ GROUP BY meta_key
82
+ HAVING meta_key LIKE 'field_%'
83
+ ORDER BY meta_key
84
+ LIMIT $limit");
85
+
86
+ foreach ($get_acf_fields as $acf_value) {
87
+ $get_acf_field = unserialize($acf_value);
88
+ $acf_fields[$get_acf_field['name']] = "CF: " . $get_acf_field['name'];
89
+ $acf_fields_slug[$get_acf_field['name']] = "_" . $get_acf_field['name'];
90
+ if (in_array("_" . $get_acf_field['name'], $Header)) {
91
+ $Header = array_diff($Header, $acf_fields_slug);
92
+ }
93
+ if ($get_acf_field['type'] == 'checkbox') {
94
+ $checkbox_option_fields[] = $get_acf_field['name'];
95
+ }
96
+ } // Code ends here
97
+ $get_post_ids = "select DISTINCT ID from $wpdb->posts where post_type = '$exporttype' and post_status in ('publish','draft','future','private','pending')";
98
+
99
+ $result = $wpdb->get_col($get_post_ids);
100
+ $fieldsCount = count($result);
101
+ if ($result) {
102
+ foreach ($result as $postID) {
103
+ $pId = $pId . ',' . $postID;
104
+ $query1 = "SELECT wp.* FROM $wpdb->posts wp where ID=$postID";
105
+ $result_query1 = $wpdb->get_results($query1);
106
+ if (!empty($result_query1)) {
107
+ foreach ($result_query1 as $posts) {
108
+ foreach ($posts as $post_key => $post_value) {
109
+ if ($post_key == 'post_status') {
110
+ if (is_sticky($postID)) {
111
+ $PostData[$postID][$post_key] = 'Sticky';
112
+ $post_status = 'Sticky';
113
+ } else {
114
+ $PostData[$postID][$post_key] = $post_value;
115
+ $post_status = $post_value;
116
+ }
117
+ } else {
118
+ $PostData[$postID][$post_key] = $post_value;
119
+ }
120
+ if ($post_key == 'post_password') {
121
+ if ($post_value) {
122
+ $PostData[$postID]['post_status'] = "{" . $post_value . "}";
123
+ } else {
124
+ $PostData[$postID]['post_status'] = $post_status;
125
+ }
126
+ }
127
+ }
128
+ }
129
+ }
130
+ $query2 = "SELECT post_id, meta_key, meta_value FROM $wpdb->posts wp JOIN $wpdb->postmeta wpm ON wpm.post_id = wp.ID where meta_key NOT IN ('_edit_lock','_edit_last') AND ID=$postID";
131
+ $result_query2 = $wpdb->get_results($query2);
132
+ if (!empty($result_query2)) {
133
+ foreach ($result_query2 as $postmeta) {
134
+ if ($postmeta->meta_key != '_eshop_product' && $postmeta->meta_key != '_thumbnail_id') {
135
+ if (is_array($acf_fields_slug) && !in_array($postmeta->meta_key, $acf_fields_slug)) {
136
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $postmeta->meta_value;
137
+ }
138
+ }
139
+ $eshop_products = $postmeta->meta_value;
140
+ if ($postmeta->meta_key == 'products') {
141
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = '';
142
+ $eshop_products = unserialize($eshop_products);
143
+ foreach ($eshop_products as $key) {
144
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] .= $key['option'] . '|' . $key['price'] . '|' . $key['saleprice'] . ',';
145
+ }
146
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = substr($PostMetaData[$postmeta->post_id][$postmeta->meta_key], 0, -1);
147
+ }
148
+ if ($postmeta->meta_key == '_thumbnail_id') {
149
+ $attachment_file = '';
150
+ $get_attachement = "select guid from $wpdb->posts where ID = $postmeta->meta_value AND post_type = 'attachment'";
151
+ $attachment = $wpdb->get_results($get_attachement);
152
+ $attachment_file = $attachment[0]->guid;
153
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = '';
154
+ $postmeta->meta_key = 'featured_image';
155
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $attachment_file;
156
+ }
157
+ if (is_array($checkbox_option_fields) && in_array($postmeta->meta_key, $checkbox_option_fields)) {
158
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = '';
159
+ $eshop_products = unserialize($eshop_products); //print_r($eshop_products);
160
+ foreach ($eshop_products as $key) {
161
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] .= $key . ',';
162
+ }
163
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = substr($PostMetaData[$postmeta->post_id][$postmeta->meta_key], 0, -1);
164
+ }
165
+ }
166
+
167
+ }
168
+ // Tags & Categories
169
+ $get_tags = wp_get_post_tags($postID, array('fields' => 'names'));
170
+ $postTags = $postCategory = '';
171
+ foreach ($get_tags as $tags) {
172
+ $postTags .= $tags . ',';
173
+ }
174
+ $postTags = substr($postTags, 0, -1);
175
+ $TermsData[$postID]['post_tag'] = $postTags;
176
+ $get_categotries = wp_get_post_categories($postID, array('fields' => 'names'));
177
+ foreach ($get_categotries as $category) {
178
+ $postCategory .= $category . '|';
179
+ }
180
+ $postCategory = substr($postCategory, 0, -1);
181
+ $TermsData[$postID]['post_category'] = $postCategory;
182
+ }
183
+ $ExportData = array();
184
+ // Merge all arrays
185
+ foreach ($PostData as $pd_key => $pd_val) {
186
+ if (array_key_exists($pd_key, $PostMetaData)) {
187
+ $ExportData[$pd_key] = array_merge($PostData[$pd_key], $PostMetaData[$pd_key]);
188
+ } else {
189
+ $ExportData[$pd_key] = $PostData[$pd_key];
190
+ }
191
+ if (array_key_exists($pd_key, $TermsData)) {
192
+ if (empty($ExportData[$pd_key])) {
193
+ $ExportData[$pd_key] = array();
194
+ }
195
+ $ExportData[$pd_key] = array_merge($ExportData[$pd_key], $TermsData[$pd_key]);
196
+ }
197
+ }
198
+
199
+ foreach ($Header as $header_key) {
200
+ foreach ($ExportData as $ED_key) {
201
+ if (array_key_exists($header_key, $ED_key)) {
202
+ $CSVContent[$header_key][] = $ED_key[$header_key];
203
+ } else {
204
+ $CSVContent[$header_key][] = '';
205
+ }
206
+ }
207
+ }
208
+ }
209
+
210
+ # GENERATE AS CSV
211
+ $CSVDATA = array();
212
+ for ($j = 0; $j < $fieldsCount; $j++) {
213
+ foreach ($Header as $value) {
214
+ $CSVDATA[$j] .= '"' . $CSVContent[$value][$j] . '",';
215
+ }
216
+ }
217
+ $CSV_FILE_CONTENT = array();
218
+ foreach ($Header as $csv_header) {
219
+ if ($csv_header == '_eshop_stock') {
220
+ $csv_header = 'stock_available';
221
+ }
222
+ if ($csv_header == 'cart_radio') {
223
+ $csv_header = 'cart_option';
224
+ }
225
+ if ($csv_header == 'sale') {
226
+ $csv_header = 'product_in_sale';
227
+ }
228
+ if ($csv_header == 'featured') {
229
+ $csv_header = 'featured_product';
230
+ }
231
+ if ($csv_header == 'sku' || $csv_header == '_wpsc_sku') {
232
+ $csv_header = 'SKU';
233
+ }
234
+ if ($csv_header == '_aioseop_keywords') {
235
+ $csv_header = 'seo_keywords';
236
+ }
237
+ if ($csv_header == '_aioseop_description') {
238
+ $csv_header = 'seo_description';
239
+ }
240
+ if ($csv_header == '_aioseop_title') {
241
+ $csv_header = 'seo_title';
242
+ }
243
+ if ($csv_header == '_aioseop_noindex') {
244
+ $csv_header = 'seo_noindex';
245
+ }
246
+ if ($csv_header == '_aioseop_nofollow') {
247
+ $csv_header = 'seo_nofollow';
248
+ }
249
+ if ($csv_header == '_aioseop_disable') {
250
+ $csv_header = 'seo_disable';
251
+ }
252
+ if ($csv_header == '_aioseop_disable_analytics') {
253
+ $csv_header = 'seo_disable_analytics';
254
+ }
255
+ if ($csv_header == '_yoast_wpseo_focuskw') {
256
+ $csv_header = 'focus_keyword';
257
+ }
258
+ if ($csv_header == '_yoast_wpseo_title') {
259
+ $csv_header = 'title';
260
+ }
261
+ if ($csv_header == '_yoast_wpseo_metadesc') {
262
+ $csv_header = 'meta_desc';
263
+ }
264
+ if ($csv_header == '_yoast_wpseo_meta-robots-noindex') {
265
+ $csv_header = 'meta-robots-noindex';
266
+ }
267
+ if ($csv_header == '_yoast_wpseo_meta-robots-nofollow') {
268
+ $csv_header = 'meta-robots-nofollow';
269
+ }
270
+ if ($csv_header == '_yoast_wpseo_meta-robots-adv') {
271
+ $csv_header = 'meta-robots-adv';
272
+ }
273
+ if ($csv_header == '_yoast_wpseo_sitemap-include') {
274
+ $csv_header = 'sitemap-include';
275
+ }
276
+ if ($csv_header == '_yoast_wpseo_sitemap-prio') {
277
+ $csv_header = 'sitemap-prio';
278
+ }
279
+ if ($csv_header == '_yoast_wpseo_canonical') {
280
+ $csv_header = 'canonical';
281
+ }
282
+ if ($csv_header == '_yoast_wpseo_redirect') {
283
+ $csv_header = 'redirect';
284
+ }
285
+ if ($csv_header == '_yoast_wpseo_opengraph-description') {
286
+ $csv_header = 'opengraph-description';
287
+ }
288
+ if ($csv_header == '_yoast_wpseo_google-plus-description') {
289
+ $csv_header = 'google-plus-description';
290
+ }
291
+ if (array_key_exists($csv_header, $acf_fields)) {
292
+ $csv_header = $acf_fields[$csv_header];
293
+ }
294
+
295
+ $CSV_FILE_CONTENT .= $csv_header . ",";
296
+ }
297
+
298
+ $CSV_FILE_CONTENT = substr($CSV_FILE_CONTENT, 0, -1);
299
+ $CSV_FILE_CONTENT .= "\n";
300
+ if ($CSVDATA) {
301
+ foreach ($CSVDATA as $csv_content) {
302
+ $csv_content = substr($csv_content, 0, -1);
303
+ $CSV_FILE_CONTENT .= $csv_content . "\n";
304
+ }
305
+ }
306
+ } elseif ($exporttype == 'customerreviews') {
307
+ $header_query1 = "SELECT * FROM wp_wpcreviews";
308
+ #TODO: Remove * from the SQL
309
+
310
+ $result_header_query1 = $wpdb->get_results($header_query1);
311
+ foreach ($result_header_query1 as $rhq1_key) {
312
+ foreach ($rhq1_key as $rhq1_headkey => $rhq1_headval) {
313
+ if (!in_array($rhq1_headkey, $Header)) {
314
+ $Header[] = $rhq1_headkey;
315
+ }
316
+ }
317
+ }
318
+
319
+ $Header[] = 'date_time';
320
+ $Header[] = 'reviewer_name';
321
+ $Header[] = 'reviewer_email';
322
+ $Header[] = 'reviewer_ip';
323
+ $Header[] = 'review_title';
324
+ $Header[] = 'review_text';
325
+ $Header[] = 'review_response';
326
+ $Header[] = 'status';
327
+ $Header[] = 'review_rating';
328
+ $Header[] = 'reviewer_url';
329
+ $Header[] = 'page_id';
330
+ $Header[] = 'custom_fields';
331
+
332
+ # GENERATE AS CSV
333
+ $CSVDATA = array();
334
+ for ($j = 0; $j < 11; $j++) {
335
+ foreach ($Header as $value) {
336
+ $CSVDATA[$j] .= '"' . $value[$j] . '",';
337
+ }
338
+ }
339
+ $CSV_FILE_CONTENT = array();
340
+ foreach ($Header as $csv_header) {
341
+ if ($csv_header == 'date_time') {
342
+ $csv_header = 'date_time';
343
+ }
344
+ if ($csv_header == 'reviewer_name') {
345
+ $csv_header = 'reviewer_name';
346
+ }
347
+ if ($csv_header == 'reviewer_email') {
348
+ $csv_header = 'reviewer_email';
349
+ }
350
+ if ($csv_header == 'reviewer_ip') {
351
+ $csv_header = 'reviewer_ip';
352
+ }
353
+ if ($csv_header == 'review_title') {
354
+ $csv_header = 'review_title';
355
+ }
356
+ if ($csv_header == 'review_text') {
357
+ $csv_header = 'review_text';
358
+ }
359
+ if ($csv_header == 'review_response') {
360
+ $csv_header = 'review_response';
361
+ }
362
+ if ($csv_header == 'status') {
363
+ $csv_header = 'status';
364
+ }
365
+ if ($csv_header == 'review_rating') {
366
+ $csv_header = 'review_rating';
367
+ }
368
+ if ($csv_header == 'reviewer_url') {
369
+ $csv_header = 'reviewer_url';
370
+ }
371
+ if ($csv_header == 'page_id') {
372
+ $csv_header = 'page_id';
373
+ }
374
+ if ($csv_header == 'custom_fields') {
375
+ $csv_header = 'custom_fields';
376
+ }
377
+
378
+ $isActive = false;
379
+ $active_plugins = get_option('active_plugins');
380
+ if (in_array('wp-customer-reviews/wp-customer-reviews.php', $active_plugins)) {
381
+ $isActive = true;
382
+ }
383
+ #TODO: $isActive not used in this function / overwritten immediately
384
+ $CSV_FILE_CONTENT .= $csv_header . ",";
385
+ }
386
+ $CSV_FILE_CONTENT = substr($CSV_FILE_CONTENT, 0, -1);
387
+ $CSV_FILE_CONTENT .= "\n";
388
+ if ($CSVDATA) {
389
+ foreach ($CSVDATA as $csv_content) {
390
+ $csv_content = substr($csv_content, 0, -1);
391
+ $CSV_FILE_CONTENT .= $csv_content . "\n";
392
+ }
393
+ }
394
+ } elseif ($exporttype == 'eshop') {
395
+ $exporttype = 'post';
396
+ $header_query1 = "SELECT wp.* FROM wp_posts wp where post_type = '$exporttype'";
397
+ $header_query2 = "SELECT post_id, meta_key, meta_value FROM wp_posts wp JOIN wp_postmeta wpm ON wpm.post_id = wp.ID where meta_key NOT IN ('_edit_lock','_edit_last')";
398
+ $result_header_query1 = $wpdb->get_results($header_query1);
399
+ $result_header_query2 = $wpdb->get_results($header_query2);
400
+ foreach ($result_header_query1 as $rhq1_key) {
401
+ foreach ($rhq1_key as $rhq1_headkey => $rhq1_headval) {
402
+ if (!in_array($rhq1_headkey, $Header)) {
403
+ if ($rhq1_headkey != 'to_ping' && $rhq1_headkey != 'pinged' && $rhq1_headkey != 'post_mime_type') {
404
+ $Header[] = $rhq1_headkey;
405
+ }
406
+ }
407
+ }
408
+ }
409
+ foreach ($result_header_query2 as $rhq2_headkey) {
410
+ if (!in_array($rhq2_headkey->meta_key, $Header)) {
411
+ if ($rhq2_headkey->meta_key != '_eshop_product' && $rhq2_headkey->meta_key != '_wp_attached_file' && $rhq2_headkey->meta_key != 'products' && $rhq2_headkey->meta_key != '_eshop_sale' && $rhq2_headkey->meta_key != 'post_mime_type' && $rhq2_headkey->meta_key != '_thumbnail_id' && $rhq2_headkey->meta_key != '_wp_attachment_metadata' && $rhq2_headkey->meta_key != '_eshop_featured') {
412
+ $Header[] = $rhq2_headkey->meta_key;
413
+ }
414
+ }
415
+ }
416
+ $Header[] = 'products_option';
417
+ $Header[] = 'regular_price';
418
+ $Header[] = 'sale_price';
419
+ $Header[] = 'featured_image';
420
+ $Header[] = 'post_tag';
421
+ $Header[] = 'post_category';
422
+ $get_post_ids = "select DISTINCT ID from wp_posts p join wp_postmeta pm on pm.post_id = p.ID where post_type = '$exporttype' and post_status in ('publish','draft','future','private','pending') and pm.meta_key = 'sku'";
423
+
424
+ $result = $wpdb->get_col($get_post_ids);
425
+ $fieldsCount = count($result);
426
+ if ($result) {
427
+ foreach ($result as $postID) {
428
+ $pId = $pId . ',' . $postID;
429
+ $query1 = "SELECT wp.* FROM wp_posts wp where ID=$postID";
430
+ $result_query1 = $wpdb->get_results($query1);
431
+ if (!empty($result_query1)) {
432
+ foreach ($result_query1 as $posts) {
433
+ foreach ($posts as $post_key => $post_value) {
434
+ if ($post_key == 'post_status') {
435
+ if (is_sticky($postID)) {
436
+ $PostData[$postID][$post_key] = 'Sticky';
437
+ $post_status = 'Sticky';
438
+ } else {
439
+ $PostData[$postID][$post_key] = $post_value;
440
+ $post_status = $post_value;
441
+ }
442
+ } else {
443
+ $PostData[$postID][$post_key] = $post_value;
444
+ }
445
+ if ($post_key == 'post_password') {
446
+ if ($post_value) {
447
+ $PostData[$postID]['post_status'] = "{" . $post_value . "}";
448
+ } else {
449
+ $PostData[$postID]['post_status'] = $post_status;
450
+ }
451
+ }
452
+ }
453
+ }
454
+ }
455
+ $query2 = "SELECT post_id, meta_key, meta_value FROM wp_posts wp JOIN wp_postmeta wpm ON wpm.post_id = wp.ID where meta_key NOT IN ('_edit_lock','_edit_last') AND ID=$postID";
456
+ $result_query2 = $wpdb->get_results($query2);
457
+ if (!empty($result_query2)) {
458
+ foreach ($result_query2 as $postmeta) {
459
+ if ($postmeta->meta_key != '_eshop_product' && $postmeta->meta_key != '_thumbnail_id') {
460
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $postmeta->meta_value;
461
+ }
462
+ $eshop_products = $postmeta->meta_value;
463
+ if ($postmeta->meta_key == 'products') {
464
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = '';
465
+ $eshop_products = unserialize($eshop_products);
466
+ foreach ($eshop_products as $key) {
467
+ $PostMetaData[$postmeta->post_id]['products_option'] .= $key['option'] . ',';
468
+ $PostMetaData[$postmeta->post_id]['sale_price'] .= $key['saleprice'] . ',';
469
+ $PostMetaData[$postmeta->post_id]['regular_price'] .= $key['price'] . ',';
470
+ }
471
+ $PostMetaData[$postmeta->post_id]['products_option'] = substr($PostMetaData[$postmeta->post_id]['products_option'], 0, -1);
472
+ $PostMetaData[$postmeta->post_id]['sale_price'] = substr($PostMetaData[$postmeta->post_id]['sale_price'], 0, -1);
473
+ $PostMetaData[$postmeta->post_id]['regular_price'] = substr($PostMetaData[$postmeta->post_id]['regular_price'], 0, -1);
474
+ }
475
+ if ($postmeta->meta_key == '_thumbnail_id') {
476
+ $attachment_file = '';
477
+ #TODO: $attachment_file not used in this function / overwritten immediately
478
+ $get_attachement = "select guid from wp_posts where ID = $postmeta->meta_value AND post_type = 'attachment'";
479
+ $attachment = $wpdb->get_results($get_attachement);
480
+ $attachment_file = $attachment[0]->guid;
481
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = '';
482
+ $postmeta->meta_key = 'featured_image';
483
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $attachment_file;
484
+ }
485
+ }
486
+
487
+ }
488
+ // Tags & Categories
489
+ $get_tags = wp_get_post_tags($postID, array('fields' => 'names'));
490
+ $postTags = $postCategory = '';
491
+ foreach ($get_tags as $tags) {
492
+ $postTags .= $tags . ',';
493
+ }
494
+ $postTags = substr($postTags, 0, -1);
495
+ $TermsData[$postID]['post_tag'] = $postTags;
496
+ $get_categotries = wp_get_post_categories($postID, array('fields' => 'names'));
497
+ foreach ($get_categotries as $category) {
498
+ $postCategory .= $category . '|';
499
+ }
500
+ $postCategory = substr($postCategory, 0, -1);
501
+ $TermsData[$postID]['post_category'] = $postCategory;
502
+ }
503
+
504
+ $ExportData = array();
505
+ // Merge all arrays
506
+ foreach ($PostData as $pd_key => $pd_val) {
507
+ if (array_key_exists($pd_key, $PostMetaData)) {
508
+ $ExportData[$pd_key] = array_merge($PostData[$pd_key], $PostMetaData[$pd_key]);
509
+ }
510
+ if (array_key_exists($pd_key, $TermsData)) {
511
+ $ExportData[$pd_key] = array_merge($ExportData[$pd_key], $TermsData[$pd_key]);
512
+ }
513
+ }
514
+ foreach ($Header as $header_key) {
515
+ foreach ($ExportData as $ED_key) {
516
+ if (array_key_exists($header_key, $ED_key)) {
517
+ $CSVContent[$header_key][] = $ED_key[$header_key];
518
+ } else {
519
+ $CSVContent[$header_key][] = '';
520
+ }
521
+ }
522
+ }
523
+ }
524
+ # GENERATE AS CSV
525
+ $CSVDATA = array();
526
+ for ($j = 0; $j < $fieldsCount; $j++) {
527
+ foreach ($Header as $value) {
528
+ $CSVDATA[$j] .= '"' . $CSVContent[$value][$j] . '",';
529
+ }
530
+ }
531
+ $CSV_FILE_CONTENT = array();
532
+ foreach ($Header as $csv_header) {
533
+ if ($csv_header == '_eshop_stock') {
534
+ $csv_header = 'stock_available';
535
+ }
536
+ if ($csv_header == 'cart_radio') {
537
+ $csv_header = 'cart_option';
538
+ }
539
+ if ($csv_header == 'sale') {
540
+ $csv_header = 'product_in_sale';
541
+ }
542
+ if ($csv_header == 'featured') {
543
+ $csv_header = 'featured_product';
544
+ }
545
+ if ($csv_header == 'sku') {
546
+ $csv_header = 'SKU';
547
+ }
548
+ if ($csv_header == '_aioseop_keywords') {
549
+ $csv_header = 'seo_keywords';
550
+ }
551
+ if ($csv_header == '_aioseop_description') {
552
+ $csv_header = 'seo_description';
553
+ }
554
+ if ($csv_header == '_aioseop_title') {
555
+ $csv_header = 'seo_title';
556
+ }
557
+ if ($csv_header == '_aioseop_noindex') {
558
+ $csv_header = 'seo_noindex';
559
+ }
560
+ if ($csv_header == '_aioseop_nofollow') {
561
+ $csv_header = 'seo_nofollow';
562
+ }
563
+ if ($csv_header == '_aioseop_disable') {
564
+ $csv_header = 'seo_disable';
565
+ }
566
+ if ($csv_header == '_aioseop_disable_analytics') {
567
+ $csv_header = 'seo_disable_analytics';
568
+ }
569
+ if ($csv_header == '_yoast_wpseo_focuskw') {
570
+ $csv_header = 'focus_keyword';
571
+ }
572
+ if ($csv_header == '_yoast_wpseo_title') {
573
+ $csv_header = 'title';
574
+ }
575
+ if ($csv_header == '_yoast_wpseo_metadesc') {
576
+ $csv_header = 'meta_desc';
577
+ }
578
+ if ($csv_header == '_yoast_wpseo_meta-robots-noindex') {
579
+ $csv_header = 'meta-robots-noindex';
580
+ }
581
+ if ($csv_header == '_yoast_wpseo_meta-robots-nofollow') {
582
+ $csv_header = 'meta-robots-nofollow';
583
+ }
584
+ if ($csv_header == '_yoast_wpseo_meta-robots-adv') {
585
+ $csv_header = 'meta-robots-adv';
586
+ }
587
+ if ($csv_header == '_yoast_wpseo_sitemap-include') {
588
+ $csv_header = 'sitemap-include';
589
+ }
590
+ if ($csv_header == '_yoast_wpseo_sitemap-prio') {
591
+ $csv_header = 'sitemap-prio';
592
+ }
593
+ if ($csv_header == '_yoast_wpseo_canonical') {
594
+ $csv_header = 'canonical';
595
+ }
596
+ if ($csv_header == '_yoast_wpseo_redirect') {
597
+ $csv_header = 'redirect';
598
+ }
599
+ if ($csv_header == '_yoast_wpseo_opengraph-description') {
600
+ $csv_header = 'opengraph-description';
601
+ }
602
+ if ($csv_header == '_yoast_wpseo_google-plus-description') {
603
+ $csv_header = 'google-plus-description';
604
+ }
605
+
606
+ if ($csv_header == 'post_tag') {
607
+ $csv_header = 'tags';
608
+ }
609
+ if ($csv_header == 'post_category') {
610
+ $csv_header = 'category';
611
+ }
612
+ $CSV_FILE_CONTENT .= $csv_header . ",";
613
+ }
614
+ $CSV_FILE_CONTENT = substr($CSV_FILE_CONTENT, 0, -1);
615
+ $CSV_FILE_CONTENT .= "\n";
616
+ if ($CSVDATA) {
617
+ foreach ($CSVDATA as $csv_content) {
618
+ $csv_content = substr($csv_content, 0, -1);
619
+ $CSV_FILE_CONTENT .= $csv_content . "\n";
620
+ }
621
+ }
622
+ } elseif ($exporttype == 'wpcommerce') {
623
+ $exporttype = 'wpsc-product';
624
+ $header_query1 = "SELECT wp.* FROM wp_posts wp where post_type = '$exporttype'";
625
+ $header_query2 = "SELECT post_id, meta_key, meta_value FROM wp_posts wp JOIN wp_postmeta wpm ON wpm.post_id = wp.ID where meta_key NOT IN ('_edit_lock','_edit_last')";
626
+ $result_header_query1 = $wpdb->get_results($header_query1);
627
+ $result_header_query2 = $wpdb->get_results($header_query2);
628
+ foreach ($result_header_query1 as $rhq1_key) {
629
+ foreach ($rhq1_key as $rhq1_headkey => $rhq1_headval) {
630
+ if (!in_array($rhq1_headkey, $Header)) {
631
+ $Header[] = $rhq1_headkey;
632
+ }
633
+ }
634
+ }
635
+ foreach ($result_header_query2 as $rhq2_headkey) {
636
+ if (!in_array($rhq2_headkey->meta_key, $Header)) {
637
+ if ($rhq2_headkey->meta_key != '_eshop_product' && $rhq2_headkey->meta_key != '_wp_attached_file' && $rhq2_headkey->meta_key != '_wpsc_product_metadata') {
638
+ $Header[] = $rhq2_headkey->meta_key;
639
+ }
640
+ }
641
+ }
642
+ $Header[] = 'featured_image';
643
+ $Header[] = 'product_tag';
644
+ $Header[] = 'wpsc_product_category';
645
+ $Header[] = 'notify_when_none_left';
646
+ $Header[] = 'unpublish_when_none_left';
647
+ $Header[] = 'wpec_taxes_taxable_amount';
648
+ $Header[] = 'wpec_taxes_taxable';
649
+ $Header[] = 'external_link';
650
+ $Header[] = 'external_link_text';
651
+ $Header[] = 'external_link_target';
652
+ $Header[] = 'no_shipping';
653
+ $Header[] = 'weight';
654
+ $Header[] = 'weight_unit';
655
+ $Header[] = 'height';
656
+ $Header[] = 'height_unit';
657
+ $Header[] = 'width';
658
+ $Header[] = 'width_unit';
659
+ $Header[] = 'length';
660
+ $Header[] = 'length_unit';
661
+ $Header[] = 'merchant_notes';
662
+ $Header[] = 'enable_comments';
663
+ $Header[] = 'quantity_limited';
664
+ $Header[] = 'special';
665
+ $Header[] = 'display_weight_as';
666
+ $Header[] = 'table_rate_price';
667
+ $Header[] = 'state';
668
+ $Header[] = 'quantity';
669
+ $Header[] = 'shipping';
670
+ $Header[] = 'table_price';
671
+ $Header[] = 'google_prohibited';
672
+
673
+ $get_post_ids = "select DISTINCT ID from wp_posts p join wp_postmeta pm on pm.post_id = p.ID where post_type = '$exporttype' and post_status in ('publish','draft','future','private','pending') and pm.meta_key = '_wpsc_sku'";
674
+ $result = $wpdb->get_col($get_post_ids);
675
+ $fieldsCount = count($result);
676
+ if ($result) {
677
+ foreach ($result as $postID) {
678
+ $pId = $pId . ',' . $postID;
679
+ $query1 = "SELECT wp.* FROM wp_posts wp where ID=$postID";
680
+ $result_query1 = $wpdb->get_results($query1);
681
+ if (!empty($result_query1)) {
682
+ foreach ($result_query1 as $posts) {
683
+ foreach ($posts as $post_key => $post_value) {
684
+ if ($post_key == 'post_status') {
685
+ if (is_sticky($postID)) {
686
+ $PostData[$postID][$post_key] = 'Sticky';
687
+ $post_status = 'Sticky';
688
+ } else {
689
+ $PostData[$postID][$post_key] = $post_value;
690
+ $post_status = $post_value;
691
+ }
692
+ } else {
693
+ $PostData[$postID][$post_key] = $post_value;
694
+ }
695
+ if ($post_key == 'post_password') {
696
+ if ($post_value) {
697
+ $PostData[$postID]['post_status'] = "{" . $post_value . "}";
698
+ } else {
699
+ $PostData[$postID]['post_status'] = $post_status;
700
+ }
701
+ }
702
+ }
703
+ }
704
+ }
705
+ $query2 = "SELECT post_id, meta_key, meta_value FROM wp_posts wp JOIN wp_postmeta wpm ON wpm.post_id = wp.ID where meta_key NOT IN ('_edit_lock','_edit_last') AND ID=$postID";
706
+ $result_query2 = $wpdb->get_results($query2);
707
+ if (!empty($result_query2)) {
708
+ foreach ($result_query2 as $postmeta) {
709
+ if ($postmeta->meta_key != '_eshop_product' && $postmeta->meta_key != '_thumbnail_id') {
710
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $postmeta->meta_value;
711
+ }
712
+ $eshop_products = $postmeta->meta_value;
713
+ if ($postmeta->meta_key == 'products') {
714
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = '';
715
+ $eshop_products = unserialize($eshop_products);
716
+ foreach ($eshop_products as $key) {
717
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] .= $key['option'] . '|' . $key['price'] . '|' . $key['saleprice'] . ',';
718
+ }
719
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = substr($PostMetaData[$postmeta->post_id][$postmeta->meta_key], 0, -1);
720
+ }
721
+ if ($postmeta->meta_key == '_thumbnail_id') {
722
+ $attachment_file = '';
723
+ $get_attachement = "select guid from wp_posts where ID = $postmeta->meta_value AND post_type = 'attachment'";
724
+ $attachment = $wpdb->get_results($get_attachement);
725
+ $attachment_file = $attachment[0]->guid;
726
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = '';
727
+ $postmeta->meta_key = 'featured_image';
728
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $attachment_file;
729
+ }
730
+ if ($postmeta->meta_key == '_wpsc_product_metadata') {
731
+ $productMeta = unserialize($postmeta->meta_value);
732
+ foreach ($productMeta as $metaKey => $metaValue) {
733
+ if ($metaKey == 'notify_when_none_left' || $metaKey == 'unpublish_when_none_left' || $metaKey == 'external_link' || $metaKey == 'external_link_text' || $metaKey == 'external_link_target' || $metaKey == 'no_shipping' || $metaKey == 'weight' || $metaKey == 'weight_unit' || $metaKey == 'merchant_notes' || $metaKey == 'enable_comments' || $metaKey == 'quantity_limited' || $metaKey == 'special' || $metaKey == 'display_weight_as' || $metaKey == 'google_prohibited') {
734
+ $PostMetaData[$postmeta->post_id][$metaKey] = $metaValue;
735
+ }
736
+ if ($metaKey == 'wpec_taxes_taxable_amount') {
737
+ $PostMetaData[$postmeta->post_id]['taxable_amount'] = $metaValue;
738
+ }
739
+ if ($metaKey == 'wpec_taxes_taxable') {
740
+ $PostMetaData[$postmeta->post_id]['is_taxable'] = $metaValue;
741
+ }
742
+ if ($metaKey == 'dimensions') {
743
+ foreach ($metaValue as $mk => $mv) {
744
+ $PostMetaData[$postmeta->post_id][$mk] = $mv;
745
+ }
746
+ }
747
+ if ($metaKey == 'shipping') {
748
+ $PostMetaData[$postmeta->post_id]['shipping'] = $metaKey['local'] . '|' . $metaKey['international'];
749
+ }
750
+ if ($metaKey == 'table_rate_price') {
751
+ $PostMetaData[$postmeta->post_id]['state'] = $metaKey['table_rate_price']['state'];
752
+ $PostMetaData[$postmeta->post_id]['quantity'] = $metaKey['table_rate_price']['quantity'][0];
753
+ $PostMetaData[$postmeta->post_id]['table_price'] = $metaKey['table_rate_price']['table_price'][0];
754
+ }
755
+ }
756
+ }
757
+ }
758
+
759
+ }
760
+ // Tags & Categories
761
+ $postTags = $postCategory = '';
762
+ $taxonomies = get_object_taxonomies($exporttype);
763
+ foreach ($taxonomies as $taxonomy) {
764
+ if ($taxonomy == 'product_tag') {
765
+ $get_tags = get_the_terms($postID, $taxonomy);
766
+ if ($get_tags) {
767
+ foreach ($get_tags as $tags) {
768
+ $postTags .= $tags->name . ',';
769
+ }
770
+ }
771
+ $postTags = substr($postTags, 0, -1);
772
+ $TermsData[$postID]['product_tag'] = $postTags;
773
+ }
774
+ if ($taxonomy == 'wpsc_product_category') {
775
+ $get_categotries = wp_get_post_terms($postID, $taxonomy);
776
+ if ($get_categotries) {
777
+ foreach ($get_categotries as $category) {
778
+ $postCategory .= $category->name . '|';
779
+ }
780
+ }
781
+ $postCategory = substr($postCategory, 0, -1);
782
+ $TermsData[$postID][$taxonomy] = $postCategory;
783
+ }
784
+ }
785
+ }
786
+
787
+ $ExportData = array();
788
+ // Merge all arrays
789
+ foreach ($PostData as $pd_key => $pd_val) {
790
+ if (array_key_exists($pd_key, $PostMetaData)) {
791
+ $ExportData[$pd_key] = array_merge($PostData[$pd_key], $PostMetaData[$pd_key]);
792
+ }
793
+ if (array_key_exists($pd_key, $TermsData)) {
794
+ $ExportData[$pd_key] = array_merge($ExportData[$pd_key], $TermsData[$pd_key]);
795
+ }
796
+ }
797
+ foreach ($Header as $header_key) {
798
+ foreach ($ExportData as $ED_key) {
799
+ if (array_key_exists($header_key, $ED_key)) {
800
+ $CSVContent[$header_key][] = $ED_key[$header_key];
801
+ } else {
802
+ $CSVContent[$header_key][] = '';
803
+ }
804
+ }
805
+ }
806
+ }
807
+ # GENERATE AS CSV
808
+ $CSVDATA = array();
809
+ for ($j = 0; $j < $fieldsCount; $j++) {
810
+ foreach ($Header as $value) {
811
+ $CSVDATA[$j] .= '"' . $CSVContent[$value][$j] . '",';
812
+ }
813
+ }
814
+
815
+ $CSV_FILE_CONTENT = array();
816
+ foreach ($Header as $csv_header) {
817
+ if ($csv_header == '_wpsc_stock') {
818
+ $csv_header = 'stock';
819
+ }
820
+ if ($csv_header == '_wpsc_price') {
821
+ $csv_header = 'price';
822
+ }
823
+ if ($csv_header == '_wpsc_special_price') {
824
+ $csv_header = 'sale_price';
825
+ }
826
+ if ($csv_header == '_wpsc_sku') {
827
+ $csv_header = 'SKU';
828
+ }
829
+ if ($csv_header == 'wpec_taxes_taxable_amount') {
830
+ $csv_header = 'taxable_amount';
831
+ }
832
+ if ($csv_header == 'wpec_taxes_taxable') {
833
+ $csv_header = 'is_taxable';
834
+ }
835
+ if ($csv_header == '_aioseop_keywords') {
836
+ $csv_header = 'seo_keywords';
837
+ }
838
+ if ($csv_header == '_aioseop_description') {
839
+ $csv_header = 'seo_description';
840
+ }
841
+ if ($csv_header == '_aioseop_title') {
842
+ $csv_header = 'seo_title';
843
+ }
844
+ if ($csv_header == '_aioseop_noindex') {
845
+ $csv_header = 'seo_noindex';
846
+ }
847
+ if ($csv_header == '_aioseop_nofollow') {
848
+ $csv_header = 'seo_nofollow';
849
+ }
850
+ if ($csv_header == '_aioseop_disable') {
851
+ $csv_header = 'seo_disable';
852
+ }
853
+ if ($csv_header == '_yoast_wpseo_focuskw') {
854
+ $csv_header = 'focus_keyword';
855
+ }
856
+ if ($csv_header == '_yoast_wpseo_title') {
857
+ $csv_header = 'title';
858
+ }
859
+ if ($csv_header == '_yoast_wpseo_metadesc') {
860
+ $csv_header = 'meta_desc';
861
+ }
862
+ if ($csv_header == '_yoast_wpseo_meta-robots-noindex') {
863
+ $csv_header = 'meta-robots-noindex';
864
+ }
865
+ if ($csv_header == '_yoast_wpseo_meta-robots-nofollow') {
866
+ $csv_header = 'meta-robots-nofollow';
867
+ }
868
+ if ($csv_header == '_yoast_wpseo_meta-robots-adv') {
869
+ $csv_header = 'meta-robots-adv';
870
+ }
871
+ if ($csv_header == '_yoast_wpseo_sitemap-include') {
872
+ $csv_header = 'sitemap-include';
873
+ }
874
+ if ($csv_header == '_yoast_wpseo_sitemap-prio') {
875
+ $csv_header = 'sitemap-prio';
876
+ }
877
+ if ($csv_header == '_yoast_wpseo_canonical') {
878
+ $csv_header = 'canonical';
879
+ }
880
+ if ($csv_header == '_yoast_wpseo_redirect') {
881
+ $csv_header = 'redirect';
882
+ }
883
+ if ($csv_header == '_yoast_wpseo_opengraph-description') {
884
+ $csv_header = 'opengraph-description';
885
+ }
886
+ if ($csv_header == '_yoast_wpseo_google-plus-description') {
887
+ $csv_header = 'google-plus-description';
888
+ }
889
+ if ($csv_header == '_aioseop_disable_analytics') {
890
+ $csv_header = 'seo_disable_analytics';
891
+ }
892
+ if ($csv_header == 'product_tag') {
893
+ $csv_header = 'product_tags';
894
+ }
895
+ if ($csv_header == 'wpsc_product_category') {
896
+ $csv_header = 'product_category';
897
+ }
898
+ // Code for wp-ecommerce-custom-fields support
899
+ $isActive = false;
900
+ $active_plugins = get_option('active_plugins');
901
+ if (in_array('wp-e-commerce-custom-fields/custom-fields.php', $active_plugins)) {
902
+ $isActive = true;
903
+ }
904
+ if ($isActive) {
905
+ $get_wpcf = unserialize(get_option('wpsc_cf_data'));
906
+ foreach ($get_wpcf as $wpcf_key => $wpcf_val) {
907
+ $key = '_wpsc_' . $wpcf_val['slug'];
908
+ if ($csv_header == $key) {
909
+ $csv_header = $wpcf_val['name'];
910
+ }
911
+ }
912
+ } // Code ends here
913
+
914
+ $CSV_FILE_CONTENT .= $csv_header . ",";
915
+ }
916
+ $CSV_FILE_CONTENT = substr($CSV_FILE_CONTENT, 0, -1);
917
+ $CSV_FILE_CONTENT .= "\n";
918
+ if ($CSVDATA) {
919
+ foreach ($CSVDATA as $csv_content) {
920
+ $csv_content = substr($csv_content, 0, -1);
921
+ $CSV_FILE_CONTENT .= $csv_content . "\n";
922
+ }
923
+ }
924
+ } elseif ($exporttype == 'woocommerce') {
925
+ $exporttype = 'product';
926
+ $header_query1 = "SELECT wp.* FROM wp_posts wp where post_type = '$exporttype'";
927
+ $header_query2 = "SELECT post_id, meta_key, meta_value FROM wp_posts wp JOIN wp_postmeta wpm ON wpm.post_id = wp.ID where meta_key NOT IN ('_edit_lock','_edit_last')";
928
+ $result_header_query1 = $wpdb->get_results($header_query1);
929
+ $result_header_query2 = $wpdb->get_results($header_query2);
930
+ foreach ($result_header_query1 as $rhq1_key) {
931
+ foreach ($rhq1_key as $rhq1_headkey => $rhq1_headval) {
932
+ if (!in_array($rhq1_headkey, $Header)) {
933
+ $Header[] = $rhq1_headkey;
934
+ }
935
+ }
936
+ }
937
+ foreach ($result_header_query2 as $rhq2_headkey) {
938
+ if (!in_array($rhq2_headkey->meta_key, $Header)) {
939
+ if ($rhq2_headkey->meta_key != '_eshop_product' && $rhq2_headkey->meta_key != '_wp_attached_file') {
940
+ $Header[] = $rhq2_headkey->meta_key;
941
+ }
942
+ }
943
+ }
944
+ $Header[] = 'featured_image';
945
+ $Header[] = 'product_tag';
946
+ $Header[] = 'product_category';
947
+ $Header[] = '_product_attribute_name';
948
+ $Header[] = '_product_attribute_value';
949
+ $Header[] = '_product_attribute_visible';
950
+ $Header[] = '_product_attribute_variation';
951
+
952
+ $get_post_ids = "select DISTINCT ID from wp_posts p join wp_postmeta pm on pm.post_id = p.ID where post_type = '$exporttype' and post_status in ('publish','draft','future','private','pending') and pm.meta_key = '_sku'";
953
+
954
+ $result = $wpdb->get_col($get_post_ids);
955
+ $fieldsCount = count($result);
956
+ if ($result) {
957
+ foreach ($result as $postID) {
958
+ $pId = $pId . ',' . $postID;
959
+ $query1 = "SELECT wp.* FROM wp_posts wp where ID=$postID";
960
+ $result_query1 = $wpdb->get_results($query1);
961
+ if (!empty($result_query1)) {
962
+ foreach ($result_query1 as $posts) {
963
+ foreach ($posts as $post_key => $post_value) {
964
+ if ($post_key == 'post_status') {
965
+ if (is_sticky($postID)) {
966
+ $PostData[$postID][$post_key] = 'Sticky';
967
+ $post_status = 'Sticky';
968
+ } else {
969
+ $PostData[$postID][$post_key] = $post_value;
970
+ $post_status = $post_value;
971
+ }
972
+ } else {
973
+ $PostData[$postID][$post_key] = $post_value;
974
+ }
975
+ if ($post_key == 'post_password') {
976
+ if ($post_value) {
977
+ $PostData[$postID]['post_status'] = "{" . $post_value . "}";
978
+ } else {
979
+ $PostData[$postID]['post_status'] = $post_status;
980
+ }
981
+ }
982
+ if ($post_key == 'comment_status') {
983
+ if ($post_value == 'closed') {
984
+ $PostData[$postID]['comment_status'] = 0;
985
+ }
986
+ if ($post_value == 'open') {
987
+ $PostData[$postID]['comment_status'] = 1;
988
+ }
989
+ }
990
+
991
+ }
992
+ }
993
+ }
994
+ $query2 = "SELECT post_id, meta_key, meta_value FROM wp_posts wp JOIN wp_postmeta wpm ON wpm.post_id = wp.ID where meta_key NOT IN ('_edit_lock','_edit_last') AND ID=$postID";
995
+ $result_query2 = $wpdb->get_results($query2);
996
+ if (!empty($result_query2)) {
997
+ foreach ($result_query2 as $postmeta) {
998
+ if ($postmeta->meta_key != '_eshop_product' && $postmeta->meta_key != '_thumbnail_id') {
999
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $postmeta->meta_value;
1000
+ }
1001
+ $eshop_products = $postmeta->meta_value;
1002
+ if ($postmeta->meta_key == '_product_attributes') {
1003
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = '';
1004
+ $product_attribute_name = $product_attribute_value = $product_attribute_visible = $product_attribute_variation = '';
1005
+ $PostMetaData[$postmeta->post_id]['_product_attribute_name'] = '';
1006
+ $PostMetaData[$postmeta->post_id]['_product_attribute_value'] = '';
1007
+ $PostMetaData[$postmeta->post_id]['_product_attribute_visible'] = '';
1008
+ $PostMetaData[$postmeta->post_id]['_product_attribute_variation'] = '';
1009
+ $eshop_products_unser1 = unserialize($eshop_products);
1010
+ $check_attr_count1 = count($eshop_products_unser1);
1011
+ if ($check_attr_count1 == 1) {
1012
+ $eshop_products_unser2 = unserialize($eshop_products_unser1);
1013
+ $check_attr_count2 = count($eshop_products_unser2);
1014
+ }
1015
+ if ($check_attr_count1 < $check_attr_count2) {
1016
+ $unserialized_attributes = $eshop_products_unser2;
1017
+ } else {
1018
+ $unserialized_attributes = $eshop_products_unser1;
1019
+ }
1020
+
1021
+ foreach ($unserialized_attributes as $key) {
1022
+ foreach ($key as $attr_header => $attr_value) {
1023
+ if ($attr_header == 'name') {
1024
+ $product_attribute_name .= $attr_value . '|';
1025
+ }
1026
+ if ($attr_header == 'value') {
1027
+ $product_attribute_value .= $attr_value . '|';
1028
+ }
1029
+ if ($attr_header == 'is_visible') {
1030
+ $product_attribute_visible .= $attr_value . '|';
1031
+ }
1032
+ if ($attr_header == 'is_variation') {
1033
+ if (isset($attr_value)) {
1034
+ $product_attribute_variation .= $attr_value . '|';
1035
+ }
1036
+ }
1037
+ }
1038
+ }
1039
+ $PostMetaData[$postmeta->post_id]['_product_attribute_name'] = substr($product_attribute_name, 0, -1);
1040
+ $PostMetaData[$postmeta->post_id]['_product_attribute_value'] = substr($product_attribute_value, 0, -1);
1041
+ $PostMetaData[$postmeta->post_id]['_product_attribute_visible'] = substr($product_attribute_visible, 0, -1);
1042
+ $PostMetaData[$postmeta->post_id]['_product_attribute_variation'] = substr($product_attribute_variation, 0, -1);
1043
+ }
1044
+ $upsellids = array();
1045
+ $crosssellids = array();
1046
+ #TODO: $upsellids, $crosssellids not used in this function / overwritten immediately
1047
+ if ($postmeta->meta_key == '_upsell_ids') {
1048
+ if ($postmeta->meta_value != '' && $postmeta->meta_value != null) {
1049
+ $upsellids = unserialize($postmeta->meta_value);
1050
+ if (is_array($upsellids)) {
1051
+ $upsell_ids = null;
1052
+ foreach ($upsellids as $upsellID) {
1053
+ $upsell_ids .= $upsellID . ',';
1054
+ }
1055
+ $PostMetaData[$postmeta->post_id]['_upsell_ids'] = substr($upsell_ids, 0, -1);
1056
+ } else {
1057
+ $PostMetaData[$postmeta->post_id]['_upsell_ids'] = '';
1058
+ }
1059
+ }
1060
+ }
1061
+ if ($postmeta->meta_key == '_crosssell_ids') {
1062
+ if ($postmeta->meta_value != '' && $postmeta->meta_value != null) {
1063
+ $crosssellids = unserialize($postmeta->meta_value);
1064
+ if (is_array($crosssellids)) {
1065
+ $crosssell_ids = null;
1066
+ foreach ($crosssellids as $crosssellID) {
1067
+ $crosssell_ids .= $crosssellID . ',';
1068
+ }
1069
+ $PostMetaData[$postmeta->post_id]['_crosssell_ids'] = substr($crosssell_ids, 0, -1);
1070
+ } else {
1071
+ $PostMetaData[$postmeta->post_id]['_crosssell_ids'] = '';
1072
+ }
1073
+ }
1074
+ }
1075
+ if ($postmeta->meta_key == '_thumbnail_id') {
1076
+ $attachment_file = '';
1077
+ $get_attachement = "select guid from wp_posts where ID = $postmeta->meta_value AND post_type = 'attachment'";
1078
+ $attachment = $wpdb->get_results($get_attachement);
1079
+ $attachment_file = $attachment[0]->guid;
1080
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = '';
1081
+ $postmeta->meta_key = 'featured_image';
1082
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $attachment_file;
1083
+ }
1084
+ if ($postmeta->meta_key == '_visibility') {
1085
+ if ($postmeta->meta_value == 'visible') {
1086
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 1;
1087
+ }
1088
+ if ($postmeta->meta_value == 'catalog') {
1089
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 2;
1090
+ }
1091
+ if ($postmeta->meta_value == 'search') {
1092
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 3;
1093
+ }
1094
+ if ($postmeta->meta_value == 'hidden') {
1095
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 4;
1096
+ }
1097
+ }
1098
+ if ($postmeta->meta_key == '_stock_status') {
1099
+ if ($postmeta->meta_value == 'instock') {
1100
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 1;
1101
+ }
1102
+ if ($postmeta->meta_value == 'outofstock') {
1103
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 2;
1104
+ }
1105
+ }
1106
+ if ($postmeta->meta_key == '_tax_status') {
1107
+ if ($postmeta->meta_value == 'taxable') {
1108
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 1;
1109
+ }
1110
+ if ($postmeta->meta_value == 'shipping') {
1111
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 2;
1112
+ }
1113
+ if ($postmeta->meta_value == 'none') {
1114
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 3;
1115
+ }
1116
+ }
1117
+ if ($postmeta->meta_key == '_tax_class') {
1118
+ if ($postmeta->meta_value == '') {
1119
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 1;
1120
+ }
1121
+ if ($postmeta->meta_value == 'reduced-rate') {
1122
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 2;
1123
+ }
1124
+ if ($postmeta->meta_value == 'zero-rate') {
1125
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 3;
1126
+ }
1127
+ }
1128
+ if ($postmeta->meta_key == '_backorders') {
1129
+ if ($postmeta->meta_value == 'no') {
1130
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 1;
1131
+ }
1132
+ if ($postmeta->meta_value == 'notify') {
1133
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 2;
1134
+ }
1135
+ if ($postmeta->meta_value == 'yes') {
1136
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = 3;
1137
+ }
1138
+ }
1139
+ if ($postmeta->meta_key == '_featured') {
1140
+ if ($postmeta->meta_value == 'no') {
1141
+ $PostMetaData[$postmeta->post_id]['featured_product'] = 1;
1142
+ }
1143
+ if ($postmeta->meta_value == 'yes') {
1144
+ $PostMetaData[$postmeta->post_id]['featured_product'] = 2;
1145
+ }
1146
+ if ($postmeta->meta_value == 'zero-rate') {
1147
+ $PostMetaData[$postmeta->post_id]['featured_product'] = 3;
1148
+ }
1149
+ }
1150
+ if ($postmeta->meta_key == '_product_type') {
1151
+ if ($postmeta->meta_value == 'simple') {
1152
+ $PostMetaData[$postmeta->post_id]['featured_product'] = 1;
1153
+ }
1154
+ if ($postmeta->meta_value == 'grouped') {
1155
+ $PostMetaData[$postmeta->post_id]['featured_product'] = 2;
1156
+ }
1157
+ if ($postmeta->meta_value == 'variable') {
1158
+ $PostMetaData[$postmeta->post_id]['featured_product'] = 4;
1159
+ }
1160
+ }
1161
+ }
1162
+
1163
+ }
1164
+ // Tags & Categories
1165
+ $postTags = $postCategory = '';
1166
+ $taxonomies = get_object_taxonomies($exporttype);
1167
+ $get_tags = get_the_terms($postID, 'product_tag');
1168
+ if ($get_tags) {
1169
+ foreach ($get_tags as $tags) {
1170
+ $postTags .= $tags->name . ',';
1171
+ }
1172
+ }
1173
+ $postTags = substr($postTags, 0, -1);
1174
+ $TermsData[$postID]['product_tag'] = $postTags;
1175
+ foreach ($taxonomies as $taxonomy) {
1176
+ if ($taxonomy == 'product_cat') {
1177
+ $get_categotries = wp_get_post_terms($postID, $taxonomy);
1178
+ if ($get_categotries) {
1179
+ foreach ($get_categotries as $category) {
1180
+ $postCategory .= $category->name . '|';
1181
+ }
1182
+ }
1183
+ $postCategory = substr($postCategory, 0, -1);
1184
+ $TermsData[$postID]['product_category'] = $postCategory;
1185
+ }
1186
+ }
1187
+ }
1188
+
1189
+ $ExportData = array();
1190
+ // Merge all arrays
1191
+ foreach ($PostData as $pd_key => $pd_val) {
1192
+ if (array_key_exists($pd_key, $PostMetaData)) {
1193
+ $ExportData[$pd_key] = array_merge($PostData[$pd_key], $PostMetaData[$pd_key]);
1194
+ }
1195
+ if (array_key_exists($pd_key, $TermsData)) {
1196
+ $ExportData[$pd_key] = array_merge($ExportData[$pd_key], $TermsData[$pd_key]);
1197
+ }
1198
+ }
1199
+ foreach ($Header as $header_key) {
1200
+ foreach ($ExportData as $ED_key) {
1201
+ if (array_key_exists($header_key, $ED_key)) {
1202
+ $CSVContent[$header_key][] = $ED_key[$header_key];
1203
+ } else {
1204
+ $CSVContent[$header_key][] = '';
1205
+ }
1206
+ }
1207
+ }
1208
+ }
1209
+ # GENERATE AS CSV
1210
+ $CSVDATA = array();
1211
+ for ($j = 0; $j < $fieldsCount; $j++) {
1212
+ foreach ($Header as $value) {
1213
+ $CSVDATA[$j] .= '"' . $CSVContent[$value][$j] . '",';
1214
+ }
1215
+ }
1216
+ $CSV_FILE_CONTENT = array();
1217
+ foreach ($Header as $csv_header) {
1218
+ if ($csv_header == 'post_title') {
1219
+ $csv_header = 'product_name';
1220
+ }
1221
+ if ($csv_header == 'post_content') {
1222
+ $csv_header = 'product_content';
1223
+ }
1224
+ if ($csv_header == 'post_name') {
1225
+ $csv_header = 'product_slug';
1226
+ }
1227
+ if ($csv_header == 'post_excerpt') {
1228
+ $csv_header = 'product_short_description';
1229
+ }
1230
+ if ($csv_header == 'post_status') {
1231
+ $csv_header = 'product_status';
1232
+ }
1233
+ if ($csv_header == 'post_date') {
1234
+ $csv_header = 'product_publish_date';
1235
+ }
1236
+ if ($csv_header == '_product_type') {
1237
+ $csv_header = 'product_type';
1238
+ }
1239
+ if ($csv_header == '_product_shipping_class') {
1240
+ $csv_header = 'product_shipping_class';
1241
+ }
1242
+ if ($csv_header == '_visibility') {
1243
+ $csv_header = 'visibility';
1244
+ }
1245
+ if ($csv_header == '_stock_status') {
1246
+ $csv_header = 'stock_status';
1247
+ }
1248
+ if ($csv_header == '_manage_stock') {
1249
+ $csv_header = 'manage_stock';
1250
+ }
1251
+ if ($csv_header == '_total_sales') {
1252
+ $csv_header = 'total_sales';
1253
+ }
1254
+ if ($csv_header == '_downloadable') {
1255
+ $csv_header = 'downloadable';
1256
+ }
1257
+ if ($csv_header == '_virtual') {
1258
+ $csv_header = 'virtual';
1259
+ }
1260
+ if ($csv_header == '_product_image_gallery') {
1261
+ $csv_header = 'product_image_gallery';
1262
+ }
1263
+ if ($csv_header == '_regular_price') {
1264
+ $csv_header = 'regular_price';
1265
+ }
1266
+ if ($csv_header == '_sale_price') {
1267
+ $csv_header = 'sale_price';
1268
+ }
1269
+ if ($csv_header == '_tax_status') {
1270
+ $csv_header = 'tax_status';
1271
+ }
1272
+ if ($csv_header == '_tax_class') {
1273
+ $csv_header = 'tax_class';
1274
+ }
1275
+ if ($csv_header == '_purchase_note') {
1276
+ $csv_header = 'purchase_note';
1277
+ }
1278
+ if ($csv_header == '_featured') {
1279
+ $csv_header = 'featured_product';
1280
+ }
1281
+ if ($csv_header == '_weight') {
1282
+ $csv_header = 'weight';
1283
+ }
1284
+ if ($csv_header == '_length') {
1285
+ $csv_header = 'length';
1286
+ }
1287
+ if ($csv_header == '_width') {
1288
+ $csv_header = 'width';
1289
+ }
1290
+ if ($csv_header == '_height') {
1291
+ $csv_header = 'height';
1292
+ }
1293
+ if ($csv_header == '_sku') {
1294
+ $csv_header = 'sku';
1295
+ }
1296
+ if ($csv_header == '_upsell_ids') {
1297
+ $csv_header = 'upsell_ids';
1298
+ }
1299
+ if ($csv_header == '_crosssell_ids') {
1300
+ $csv_header = 'crosssell_ids';
1301
+ }
1302
+ if ($csv_header == '_product_attribute_name') {
1303
+ $csv_header = 'product_attribute_name';
1304
+ }
1305
+ if ($csv_header == '_product_attribute_value') {
1306
+ $csv_header = 'product_attribute_value';
1307
+ }
1308
+ if ($csv_header == '_product_attribute_visible') {
1309
+ $csv_header = 'product_attribute_visible';
1310
+ }
1311
+ if ($csv_header == '_product_attribute_variation') {
1312
+ $csv_header = 'product_attribute_variation';
1313
+ }
1314
+ if ($csv_header == '_sale_price_dates_from') {
1315
+ $csv_header = 'sale_price_dates_from';
1316
+ }
1317
+ if ($csv_header == '_sale_price_dates_to') {
1318
+ $csv_header = 'sale_price_dates_to';
1319
+ }
1320
+ if ($csv_header == '_price') {
1321
+ $csv_header = 'price';
1322
+ }
1323
+ if ($csv_header == '_stock') {
1324
+ $csv_header = 'stock';
1325
+ }
1326
+ if ($csv_header == '_backorders') {
1327
+ $csv_header = 'backorders';
1328
+ }
1329
+ if ($csv_header == '_file_paths') {
1330
+ $csv_header = 'file_paths';
1331
+ }
1332
+ if ($csv_header == '_download_limit') {
1333
+ $csv_header = 'download_limit';
1334
+ }
1335
+ if ($csv_header == '_download_expiry') {
1336
+ $csv_header = 'download_expiry';
1337
+ }
1338
+ if ($csv_header == '_product_url') {
1339
+ $csv_header = 'product_url';
1340
+ }
1341
+ if ($csv_header == '_button_text') {
1342
+ $csv_header = 'button_text';
1343
+ }
1344
+ if ($csv_header == '_sold_individually') {
1345
+ $csv_header = 'sold_individually';
1346
+ }
1347
+ if ($csv_header == '_aioseop_keywords') {
1348
+ $csv_header = 'seo_keywords';
1349
+ }
1350
+ if ($csv_header == '_aioseop_description') {
1351
+ $csv_header = 'seo_description';
1352
+ }
1353
+ if ($csv_header == '_aioseop_title') {
1354
+ $csv_header = 'seo_title';
1355
+ }
1356
+ if ($csv_header == '_aioseop_noindex') {
1357
+ $csv_header = 'seo_noindex';
1358
+ }
1359
+ if ($csv_header == '_aioseop_nofollow') {
1360
+ $csv_header = 'seo_nofollow';
1361
+ }
1362
+ if ($csv_header == '_aioseop_disable') {
1363
+ $csv_header = 'seo_disable';
1364
+ }
1365
+ if ($csv_header == '_aioseop_disable_analytics') {
1366
+ $csv_header = 'seo_disable_analytics';
1367
+ }
1368
+ if ($csv_header == '_yoast_wpseo_focuskw') {
1369
+ $csv_header = 'focus_keyword';
1370
+ }
1371
+ if ($csv_header == '_yoast_wpseo_title') {
1372
+ $csv_header = 'title';
1373
+ }
1374
+ if ($csv_header == '_yoast_wpseo_metadesc') {
1375
+ $csv_header = 'meta_desc';
1376
+ }
1377
+ if ($csv_header == '_yoast_wpseo_meta-robots-noindex') {
1378
+ $csv_header = 'meta-robots-noindex';
1379
+ }
1380
+ if ($csv_header == '_yoast_wpseo_meta-robots-nofollow') {
1381
+ $csv_header = 'meta-robots-nofollow';
1382
+ }
1383
+ if ($csv_header == '_yoast_wpseo_meta-robots-adv') {
1384
+ $csv_header = 'meta-robots-adv';
1385
+ }
1386
+ if ($csv_header == '_yoast_wpseo_sitemap-include') {
1387
+ $csv_header = 'sitemap-include';
1388
+ }
1389
+ if ($csv_header == '_yoast_wpseo_sitemap-prio') {
1390
+ $csv_header = 'sitemap-prio';
1391
+ }
1392
+ if ($csv_header == '_yoast_wpseo_canonical') {
1393
+ $csv_header = 'canonical';
1394
+ }
1395
+ if ($csv_header == '_yoast_wpseo_redirect') {
1396
+ $csv_header = 'redirect';
1397
+ }
1398
+ if ($csv_header == '_yoast_wpseo_opengraph-description') {
1399
+ $csv_header = 'opengraph-description';
1400
+ }
1401
+ if ($csv_header == '_yoast_wpseo_google-plus-description') {
1402
+ $csv_header = 'google-plus-description';
1403
+ }
1404
+ $CSV_FILE_CONTENT .= $csv_header . ",";
1405
+ }
1406
+ $CSV_FILE_CONTENT = substr($CSV_FILE_CONTENT, 0, -1);
1407
+ $CSV_FILE_CONTENT .= "\n";
1408
+ if ($CSVDATA) {
1409
+ foreach ($CSVDATA as $csv_content) {
1410
+ $csv_content = substr($csv_content, 0, -1);
1411
+ $CSV_FILE_CONTENT .= $csv_content . "\n";
1412
+ }
1413
+ }
1414
+ }
1415
+ #TODO: What is this?
1416
+ echo '<pre>';
1417
+ print_r($CSV_FILE_CONTENT);
1418
+ die('it exiusrs');
1419
+ header("Content-type: text/x-csv"); # DECLARING FILE TYPE
1420
+ header("Content-Transfer-Encoding: binary");
1421
+ header("Content-Disposition: attachment; filename=" . $csv_file_name); # EXPORT GENERATED CSV FILE
1422
+ header("Pragma: no-cache");
1423
+ header("Expires: 0");
1424
+ print($CSV_FILE_CONTENT);
1425
+ die;
1426
+ return $data;
1427
+ }
1428
+ }
modules/old_export/templates/export.php ADDED
@@ -0,0 +1,663 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /******************************************************************************************
3
+ * Copyright (C) Smackcoders 2014 - All Rights Reserved
4
+ * Unauthorized copying of this file, via any medium is strictly prohibited
5
+ * Proprietary and confidential
6
+ * You can contact Smackcoders at email address info@smackcoders.com.
7
+ *******************************************************************************************/
8
+
9
+ require_once('../../../../../../wp-load.php');
10
+ require_once('../../../includes/Importer.php');
11
+
12
+ $ExportObj = new WPCSVProExportData();
13
+ #print('<pre>'); print_r($_POST); //die;
14
+ $ExportObj->executeIndex($_POST);
15
+ class WPCSVProExportData {
16
+ public function __construct() {
17
+
18
+ }
19
+
20
+ /**
21
+ * The actions index method
22
+ * @param array $request
23
+ * @return array
24
+ */
25
+ public function executeIndex($request) {
26
+ #print('<pre>'); print_r($request); print('</pre>'); die;
27
+ if($request['export'] == 'category') {
28
+ $this->WPImpExportCategories($request);
29
+ }
30
+ else if($request['export'] == 'tags') {
31
+ $this->WPImpExportTags($request);
32
+ }
33
+ else if($request['export'] == 'customtaxonomy') {
34
+ $this->WPImpExportTaxonomies($request);
35
+ }
36
+ else if($request['export'] == 'customerreviews') {
37
+ $this->WPImpExportCustomerReviews($request);
38
+ }
39
+ else if($request['export'] == 'comments') {
40
+ $this->WPImpExportComments($request);
41
+ }
42
+ else if($request['export'] == 'users') {
43
+ $this->WPImpExportUsers($request);
44
+ }
45
+ else {
46
+ $this->WPImpFreeExportData($request);#die;
47
+ }
48
+ }
49
+
50
+ /**
51
+ *
52
+ */
53
+ public function generateCSVHeaders($exporttype){
54
+ global $wpdb;
55
+ $post_type = $exporttype;
56
+ $unwantedHeader = array('_eshop_product', '_wp_attached_file', '_wp_page_template', '_wp_attachment_metadata', '_encloseme');
57
+ if($exporttype == 'eshop')
58
+ $post_type = 'post';
59
+ if($exporttype == 'custompost') {
60
+ $post_type = $_POST['export_post_type'];
61
+ }
62
+ $header_query1 = "SELECT wp.* FROM $wpdb->posts wp where post_type = '$post_type'";
63
+ $header_query2 = "SELECT post_id, meta_key, meta_value FROM $wpdb->posts wp JOIN $wpdb->postmeta wpm ON wpm.post_id = wp.ID where meta_key NOT IN ('_edit_lock','_edit_last') and meta_key NOT LIKE 'field_%' and meta_key NOT LIKE '_wp_types%'";
64
+ $result_header_query1 = $wpdb->get_results($header_query1);
65
+ $result_header_query2 = $wpdb->get_results($header_query2);
66
+
67
+ foreach ($result_header_query1 as $rhq1_key) {
68
+ foreach ($rhq1_key as $rhq1_headkey => $rhq1_headval) {
69
+ if (!in_array($rhq1_headkey, $Header))
70
+ $Header[] = $rhq1_headkey;
71
+ }
72
+ }
73
+ foreach($this->getAIOSEOfields() as $aioseokey => $aioseoval) {
74
+ $Header[] = $aioseoval;
75
+ $unwantedHeader[] = $aioseokey;
76
+ }
77
+ foreach ($result_header_query2 as $rhq2_headkey) {
78
+ if (!in_array($rhq2_headkey->meta_key, $Header)) {
79
+ if(!in_array($rhq2_headkey->meta_key, $unwantedHeader)) {
80
+ $Header[] = $rhq2_headkey->meta_key;
81
+ }
82
+ }
83
+ }
84
+
85
+ #print('<pre>'); print_r($Header); die;
86
+ if($exporttype == 'eshop') {
87
+ foreach($this->EshopHeaders() as $eshop_hkey => $eshop_hval) {
88
+ if(in_array($eshop_hval, $Header))
89
+ $ProHeader[] = $eshop_hkey;
90
+ else
91
+ $ProHeader[] = $eshop_hkey;
92
+ }
93
+
94
+ foreach($this->getAIOSEOfields() as $aioseokey => $aioseoval) {
95
+ $ProHeader[] = $aioseoval;
96
+ }
97
+ return $ProHeader;
98
+ }
99
+ if(!in_array('', $Header) && !in_array('', $Header)){
100
+ $Header[] = 'post_tag';
101
+ $Header[] = 'post_category';
102
+ }
103
+ return $Header;
104
+ }
105
+
106
+ /**
107
+ *
108
+ */
109
+ public function get_all_record_ids($exporttype, $request) {
110
+ global $wpdb;
111
+ $post_type = $exporttype;
112
+ $get_post_ids = "select DISTINCT ID from $wpdb->posts p join $wpdb->postmeta pm on pm.post_id = p.ID";
113
+ if($post_type == 'eshop')
114
+ $post_type = 'post';
115
+ if($post_type == 'custompost')
116
+ $post_type = $_POST['export_post_type'];
117
+
118
+ $get_post_ids .= " where p.post_type = '$post_type'";
119
+ if(isset($request['getdatawithspecificstatus'])) {
120
+ if(isset($request['postwithstatus']) && $request['postwithstatus'] == 'All') {
121
+ $get_post_ids .= " and p.post_status in ('publish','draft','future','private','pending')";
122
+ } else if(isset($request['postwithstatus']) && ($request['postwithstatus'] == 'Publish' || $request['postwithstatus'] == 'Sticky')) {
123
+ $get_post_ids .= " and p.post_status in ('publish')";
124
+ } else if(isset($request['postwithstatus']) && $request['postwithstatus'] == 'Draft') {
125
+ $get_post_ids .= " and p.post_status in ('draft')";
126
+ } else if(isset($request['postwithstatus']) && $request['postwithstatus'] == 'Scheduled') {
127
+ $get_post_ids .= " and p.post_status in ('future')";
128
+ } else if(isset($request['postwithstatus']) && $request['postwithstatus'] == 'Private') {
129
+ $get_post_ids .= " and p.post_status in ('private')";
130
+ } else if(isset($request['postwithstatus']) && $request['postwithstatus'] == 'Pending') {
131
+ $get_post_ids .= " and p.post_status in ('pending')";
132
+ } else if(isset($request['postwithstatus']) && $request['postwithstatus'] == 'Protected') {
133
+ $get_post_ids .= " and p.post_status in ('publish') and post_password != ''";
134
+ }
135
+ } else {
136
+ $get_post_ids .= " and p.post_status in ('publish','draft','future','private','pending')";
137
+ }
138
+ if(isset($request['getdataforspecificperiod'])) {
139
+ $get_post_ids .= " and p.post_date >= '" . $request['postdatefrom'] . "' and p.post_date <= '" . $request['postdateto'] . "'";
140
+ }
141
+ if($exporttype == 'eshop')
142
+ $get_post_ids .= " and pm.meta_key = 'sku'";
143
+
144
+ if(isset($request['getdatabyspecificauthors'])) {
145
+ if(isset($request['postauthor']) && $request['postauthor'] != 0) {
146
+ $get_post_ids .= " and p.post_author = {$request['postauthor']}";
147
+ }
148
+ }
149
+ #print_r($get_post_ids); die;
150
+ $result = $wpdb->get_col($get_post_ids);
151
+ if(isset($request['getdatawithspecificstatus'])) {
152
+ if(isset($request['postwithstatus']) && $request['postwithstatus'] == 'Sticky') {
153
+ $get_sticky_posts = get_option('sticky_posts');
154
+ foreach($get_sticky_posts as $sticky_post_id) {
155
+ if(in_array($sticky_post_id, $result))
156
+ $sticky_posts[] = $sticky_post_id;
157
+ }
158
+ return $sticky_posts;
159
+ }
160
+ }
161
+ #print_r($get_sticky_posts);
162
+ #print_r($result);die;
163
+ return $result;
164
+ }
165
+
166
+ /**
167
+ *
168
+ */
169
+ public function getPostDatas($postID) {
170
+ global $wpdb;
171
+ $query1 = "SELECT wp.* FROM $wpdb->posts wp where ID=$postID";
172
+ $result_query1 = $wpdb->get_results($query1);
173
+ if (!empty($result_query1)) {
174
+ foreach ($result_query1 as $posts) {
175
+ foreach ($posts as $post_key => $post_value) {
176
+ if ($post_key == 'post_status') {
177
+ if (is_sticky($postID)) {
178
+ $PostData[$post_key] = 'Sticky';
179
+ $post_status = 'Sticky';
180
+ } else {
181
+ $PostData[$post_key] = $post_value;
182
+ $post_status = $post_value;
183
+ }
184
+ } else {
185
+ $PostData[$post_key] = $post_value;
186
+ }
187
+ if ($post_key == 'post_password') {
188
+ if ($post_value) {
189
+ $PostData['post_status'] = "{" . $post_value . "}";
190
+ } else {
191
+ $PostData['post_status'] = $post_status;
192
+ }
193
+ }
194
+ if ($post_key == 'comment_status') {
195
+ if ($post_value == 'closed') {
196
+ $PostData['comment_status'] = 0;
197
+ }
198
+ if ($post_value == 'open') {
199
+ $PostData['comment_status'] = 1;
200
+ }
201
+ }
202
+ }
203
+ }
204
+ }
205
+ return $PostData;
206
+ }
207
+
208
+ /**
209
+ *
210
+ */
211
+ public function getPostMetaDatas($postID) {
212
+ global $wpdb;
213
+ $query2 = "SELECT post_id, meta_key, meta_value FROM $wpdb->posts wp JOIN $wpdb->postmeta wpm ON wpm.post_id = wp.ID where meta_key NOT IN ('_edit_lock','_edit_last') AND ID=$postID";
214
+ #print($query2); print('<br>');
215
+ $result = $wpdb->get_results($query2);
216
+ return $result;
217
+ }
218
+
219
+ /**
220
+ *
221
+ */
222
+ public function getAIOSEOfields() {
223
+ $aioseofields = array('_aioseop_keywords' => 'seo_keywords',
224
+ '_aioseop_description' => 'seo_description',
225
+ '_aioseop_title' => 'seo_title',
226
+ '_aioseop_noindex' => 'seo_noindex',
227
+ '_aioseop_nofollow' => 'seo_nofollow',
228
+ '_aioseop_disable' => 'seo_disable',
229
+ '_aioseop_disable_analytics' => 'seo_disable_analytics',
230
+ '_aioseop_noodp' => 'seo_noodp',
231
+ '_aioseop_noydir' => 'seo_noydir',);
232
+ return $aioseofields;
233
+ }
234
+
235
+ /**
236
+ *
237
+ */
238
+ public function getAllTerms($postID, $type) {
239
+ // Tags & Categories
240
+ $get_tags = wp_get_post_tags($postID, array('fields' => 'names'));
241
+ $postTags = $postCategory = '';
242
+ foreach ($get_tags as $tags) {
243
+ $postTags .= $tags . ',';
244
+ }
245
+ $postTags = substr($postTags, 0, -1);
246
+ $TermsData['post_tag'] = $postTags;
247
+ $get_categotries = wp_get_post_categories($postID, array('fields' => 'names'));
248
+ foreach ($get_categotries as $category) {
249
+ $postCategory .= $category . '|';
250
+ }
251
+ $postCategory = substr($postCategory, 0, -1);
252
+ $TermsData['post_category'] = $postCategory;
253
+ return $TermsData;
254
+ }
255
+
256
+ /**
257
+ *
258
+ */
259
+ public function EshopHeaders() {
260
+ $eshopHeaders = array('post_title' => 'post_title', 'post_content' => 'post_content', 'post_excerpt' => 'post_excerpt', 'post_date' => 'post_date', 'post_name' => 'post_name', 'post_status' => 'post_status', 'post_author' => 'post_author', 'post_parent' => 0, 'comment_status' => 'open', 'ping_status' => 'open', 'SKU' => 'sku', 'products_option' => 'products_option', 'sale_price' => 'sale_price', 'regular_price' => 'regular_price', 'description' => 'description', 'shiprate' => 'shiprate', 'optset' => null, 'featured_product' => 'featured', 'product_in_sale' => '_eshop_sale', 'stock_available' => '_eshop_stock', 'cart_option' => 'cart_radio', 'category' => 'post_category', 'tags' => 'post_tag', 'featured_image' => null,);
261
+ return $eshopHeaders;
262
+ }
263
+
264
+ /**
265
+ * @param $request
266
+ * @return array
267
+ */
268
+ public function WPImpFreeExportData($request) {
269
+ #print('<pre>'); print_r($this->getACFvalues()); die;
270
+ global $wpdb;
271
+ $export_delimiter = ',';
272
+ $exporttype = $_POST['export'];
273
+ $wpcsvsettings=get_option('wpcsvprosettings');
274
+ if(isset($wpcsvsettings['export_delimiter'])){
275
+ $export_delimiter = $wpcsvsettings['export_delimiter'];
276
+ }
277
+ if($_POST['export_filename'])
278
+ $csv_file_name =$_POST['export_filename'].'.csv';
279
+ else
280
+ $csv_file_name='exportas_'.date("Y").'-'.date("m").'-'.date("d").'.csv';
281
+ $wptypesfields = get_option('wpcf-fields');
282
+ #print('<pre>'); print_r($wptypesfields); die;
283
+ #print('<pre>'); print_r($_POST); print('</pre>');
284
+ //if($exporttype=='post' || $exporttype=='page' || $exporttype=='custompost') {
285
+ if($exporttype == 'custompost') {
286
+ $exporttype = $_POST['export_post_type'];
287
+ }
288
+ $Header = $this->generateCSVHeaders($exporttype);
289
+ $result = $this->get_all_record_ids($exporttype, $request);
290
+ #print('<pre>'); print_r($Header); print_r($result); print('</pre>'); die;
291
+ $fieldsCount = count($result);
292
+ if ($result) {
293
+ foreach ($result as $postID) {
294
+ $pId = $pId . ',' . $postID;
295
+ $PostData[$postID] = $this->getPostDatas($postID);
296
+ #print('<pre>'); print_r($PostData); #die;
297
+ $result_query2 = $this->getPostMetaDatas($postID);
298
+ #print('<pre>'); print_r($result_query2); print('</pre>'); #die;
299
+
300
+ $possible_values = array('s:', 'a:', ':{');
301
+ if (!empty($result_query2)) {
302
+ foreach ($result_query2 as $postmeta) {
303
+ $typesFserialized = 0;
304
+ $isFound = explode('wpcf-',$postmeta->meta_key);
305
+ if(count($isFound) == 2){
306
+ foreach($wptypesfields as $typesKey => $typesVal){
307
+ if($postmeta->meta_key == 'wpcf-'.$typesKey){
308
+ foreach($possible_values as $posval){
309
+ if(strpos($postmeta->meta_value,$posval)){
310
+ $typesFserialized = 1;
311
+ } else {
312
+ $typesFserialized = 0;
313
+ }
314
+ }
315
+ if($typesFserialized == 1){
316
+ $getMetaData = get_post_meta($postID, $postmeta->meta_key);
317
+ if(!is_array($getMetaData[0])){
318
+ $get_all_values = unserialize($getMetaData[0]);
319
+ $get_values = $get_all_values[0];
320
+ } else {
321
+ $get_values = $getMetaData[0];
322
+ }
323
+ $typesFVal = null;
324
+ if($typesVal['type'] == 'checkboxes'){
325
+ foreach($get_values as $authorKey => $authorVal) {
326
+ foreach($typesVal['data']['options'] as $doKey => $doVal){
327
+ if($doKey == $authorKey)
328
+ $typesFVal .= $doVal['title'].',';
329
+ }
330
+ }
331
+ $typesFVal = substr($typesFVal, 0, -1);
332
+ } elseif($typesVal['type'] == 'skype') {
333
+ $typesFVal = $get_values['skypename'];
334
+ }
335
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $typesFVal;
336
+ } else {
337
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $postmeta->meta_value;
338
+ }
339
+ }
340
+ }
341
+ } else {
342
+ // Eshop product meta datas starts here
343
+ if ($postmeta->meta_key == 'featured') {
344
+ $isFeatured = strtolower($postmeta->meta_value);
345
+ $PostMetaData[$postmeta->post_id]['featured_product'] = $isFeatured;
346
+ }
347
+ else if ($postmeta->meta_key == 'sale') {
348
+ $is_prod_sale = strtolower($postmeta->meta_value);
349
+ $PostMetaData[$postmeta->post_id]['product_in_sale'] = $is_prod_sale;
350
+ }
351
+ else if ($postmeta->meta_key == '_eshop_stock') {
352
+ if($postmeta->meta_value == 1) {
353
+ $stock_available = 'yes';
354
+ } else {
355
+ $stock_available = 'no';
356
+ }
357
+ $PostMetaData[$postmeta->post_id]['stock_available'] = $stock_available;
358
+ }
359
+ else if ($postmeta->meta_key == 'cart_radio') {
360
+ $PostMetaData[$postmeta->post_id]['cart_option'] = $postmeta->meta_value;
361
+ }
362
+ else if ($postmeta->meta_key == 'shiprate') {
363
+ $PostMetaData[$postmeta->post_id]['shiprate'] = $postmeta->meta_value;
364
+ }
365
+ else if ($postmeta->meta_key == '_eshop_product') {
366
+ $product_attr_details = unserialize($postmeta->meta_value);
367
+ $prod_option = $sale_price = $reg_price = null;
368
+ #print('<pre>');print_r($product_attr_details); #die;
369
+ foreach($product_attr_details as $prod_att_det_Key => $prod_att_det_Val) {
370
+ if($prod_att_det_Key == 'sku') {
371
+ $PostMetaData[$postmeta->post_id]['sku'] = $prod_att_det_Val;
372
+ }
373
+ else if($prod_att_det_Key == 'products') {
374
+ foreach($prod_att_det_Val as $all_prod_options) {
375
+ $prod_option .= $all_prod_options['option'] . ',';
376
+ $sale_price .= $all_prod_options['saleprice'] . ',';
377
+ $reg_price .= $all_prod_options['price'] . ',';
378
+ }
379
+ $prod_option = substr($prod_option, 0, -1);
380
+ $sale_price = substr($sale_price, 0, -1);
381
+ $reg_price = substr($reg_price, 0, -1);
382
+ $PostMetaData[$postmeta->post_id]['products_option'] = $prod_option;
383
+ $PostMetaData[$postmeta->post_id]['sale_price'] = $sale_price;
384
+ $PostMetaData[$postmeta->post_id]['regular_price'] = $reg_price;
385
+ }
386
+ }
387
+ #$PostMetaData[$postmeta->post_id]['cart_option'] = $postmeta->meta_value;
388
+ }
389
+ // Eshop product meta datas ends here
390
+ else if ($postmeta->meta_key == '_thumbnail_id') {
391
+ $attachment_file = '';
392
+ $get_attachement = "select guid from $wpdb->posts where ID = $postmeta->meta_value AND post_type = 'attachment'";
393
+ $attachment = $wpdb->get_results($get_attachement);
394
+ $attachment_file = $attachment[0]->guid;
395
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = '';
396
+ $postmeta->meta_key = 'featured_image';
397
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $attachment_file;
398
+ }
399
+ else if(is_array($checkbox_option_fields) && in_array($postmeta->meta_key,$checkbox_option_fields)){
400
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = '';
401
+ $eshop_products = unserialize($eshop_products); //print_r($eshop_products);
402
+ foreach ($eshop_products as $key) {
403
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] .= $key . ',';
404
+ }
405
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = substr($PostMetaData[$postmeta->post_id][$postmeta->meta_key], 0, -1);
406
+ }
407
+ else {
408
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $postmeta->meta_value;
409
+ }
410
+ }
411
+ }
412
+ }
413
+ # print('PostMetaData: '); print('<pre>'); print_r($Header); print_r($PostMetaData); #die;
414
+ $TermsData[$postID] = $this->getAllTerms($postID,$exporttype);
415
+ }
416
+
417
+ #$ExportData = array();
418
+ // Merge all arrays
419
+ #echo '<pre>'; print_r($TermsData); die;
420
+ // echo '<pre>'; print_r($PostData); die('sds');
421
+ foreach ($PostData as $pd_key => $pd_val) {
422
+ if (array_key_exists($pd_key, $PostMetaData)) {
423
+ $ExportData[$pd_key] = array_merge($PostData[$pd_key], $PostMetaData[$pd_key]);
424
+ // echo '<pre>'; print_r($ExportData); die('exist');
425
+ } else {
426
+ $ExportData[$pd_key] = $PostData[$pd_key];
427
+ }
428
+ if (array_key_exists($pd_key, $TermsData)) {
429
+ if (empty($ExportData[$pd_key]))
430
+ $ExportData[$pd_key] = array();
431
+ $ExportData[$pd_key] = array_merge($ExportData[$pd_key], $TermsData[$pd_key]);
432
+ }
433
+ }
434
+ }
435
+ #print('<pre>'); print_r($Header); die;
436
+ #print('<pre>'); print_r($ExportData); die;
437
+ if($exporttype == 'eshop') {
438
+ foreach($Header as $hkey) {
439
+ foreach($ExportData as $edkey => $edval) {
440
+ foreach($this->EshopHeaders() as $eshophkey => $eshophval) {
441
+ if(array_key_exists($eshophval, $ExportData[$edkey])) {
442
+ $ExportData[$edkey][$eshophkey] = $edval[$eshophval];
443
+ // unset($ExportData[$edkey][$wpcomhval]);
444
+ }
445
+ }
446
+ }
447
+ }
448
+ }
449
+ #print('<pre>'); print_r($Header); print('</pre>'); #die;
450
+ # print('<pre>'); print_r($ExportData); die;
451
+ foreach ($Header as $header_key) {
452
+ if (is_array($ExportData)) {
453
+ foreach ($ExportData as $ED_key => $ED_val) {
454
+ if (in_array($header_key, $this->getAIOSEOfields())) { #die($header_key);
455
+ foreach($this->getAIOSEOfields() as $aioseokey => $aioseoval) {
456
+ $CSVContent[$ED_key][$aioseoval] = $ED_val[$aioseokey];
457
+ #unset($CSVContent[$ED_key][$header_key]);
458
+ }
459
+ } else if (array_key_exists($header_key, $ED_val)) {
460
+ $CSVContent[$ED_key][$header_key] = $ED_val[$header_key];
461
+ } else {
462
+ $CSVContent[$ED_key][$header_key] = null;
463
+ }
464
+ }
465
+ }
466
+ }
467
+ #print(count($CSVContent[22]));print('<br>' . count($Header));
468
+ #print('<pre>'); print_r($CSVContent) ;print('</pre>'); die;
469
+ $csv = new ImporterLib();
470
+ $csv->wmyuyn_3 ($csv_file_name, $CSVContent, $Header, $export_delimiter);
471
+ }
472
+
473
+ /**
474
+ *
475
+ */
476
+ public function WPImpExportComments($request) {
477
+ global $wpdb;
478
+ $export_delimiter = ',';
479
+ $exporttype = $request['export'];
480
+ $wpcsvsettings=get_option('wpcsvprosettings');
481
+ if(isset($wpcsvsettings['export_delimiter'])){
482
+ $export_delimiter = $wpcsvsettings['export_delimiter'];
483
+ }
484
+ if($_POST['export_filename'])
485
+ $csv_file_name =$_POST['export_filename'].'.csv';
486
+ else
487
+ $csv_file_name='exportas_'.date("Y").'-'.date("m").'-'.date("d").'.csv';
488
+
489
+ $commentQuery = "SELECT * FROM $wpdb->comments " . $orderBy;
490
+ $comments = $wpdb->get_results( $commentQuery);
491
+ $mappedHeader = false;
492
+ $i = 0;
493
+ foreach($comments as $comment){
494
+ foreach($comment as $key => $value){
495
+ if(!$mappedHeader){
496
+ $Header[] = $key; // ."$export_delimiter";
497
+ }
498
+ $ExportData[$i][$key] = $value; //'"'.$value.'"'."$export_delimiter";
499
+ }
500
+ $mappedHeader = true;
501
+ $i++;
502
+ }
503
+ #print('<pre>'); print_r($header); print_r($singleCommentContent);die;
504
+ $csv = new ImporterLib();
505
+ $csv->wmyuyn_3 ($csv_file_name, $ExportData, $Header, $export_delimiter);
506
+ }
507
+
508
+ /**
509
+ *
510
+ */
511
+ public function WPImpExportUsers($request) {
512
+ global $wpdb;
513
+ $export_delimiter = ',';
514
+ $exporttype = $request['export'];
515
+ $wpcsvsettings=get_option('wpcsvprosettings');
516
+ if(isset($wpcsvsettings['export_delimiter'])){
517
+ $export_delimiter = $wpcsvsettings['export_delimiter'];
518
+ }
519
+ if($_POST['export_filename'])
520
+ $csv_file_name =$_POST['export_filename'].'.csv';
521
+ else
522
+ $csv_file_name='exportas_'.date("Y").'-'.date("m").'-'.date("d").'.csv';
523
+
524
+ $uId = '';
525
+ $header_query1 = "SELECT *FROM $wpdb->users";
526
+ $header_query2 = "SELECT user_id, meta_key, meta_value FROM $wpdb->users wp JOIN $wpdb->usermeta wpm ON wpm.user_id = wp.ID where meta_key NOT IN ('_edit_lock','_edit_last')";
527
+ $result_header_query1 = $wpdb->get_results($header_query1);
528
+ $result_header_query2 = $wpdb->get_results($header_query2);
529
+ /* print('<pre>'); print_r($result_header_query1);
530
+ print_r($result_header_query2);die; */
531
+ foreach ($result_header_query1 as $rhq1_key) {
532
+ foreach ($rhq1_key as $rhq1_headkey => $rhq1_headval) {
533
+ if (!in_array($rhq1_headkey, $Header))
534
+ $Header[] = $rhq1_headkey;
535
+ }
536
+ }
537
+ foreach ($result_header_query2 as $rhq2_headkey) {
538
+ if (!in_array($rhq2_headkey->meta_key, $Header)) {
539
+ if($rhq2_headkey->meta_key == 'mp_shipping_info' )
540
+ {
541
+ $mp_ship_header= unserialize($rhq2_headkey->meta_value);
542
+ foreach($mp_ship_header as $mp_ship_key => $mp_value) { $Header[] = "msi: ".$mp_ship_key; }
543
+ }
544
+ if($rhq2_headkey->meta_key == 'mp_billing_info' )
545
+ {
546
+ $mp_ship_header= unserialize($rhq2_headkey->meta_value);
547
+ foreach($mp_ship_header as $mp_ship_key => $mp_value) { $Header[] = "mbi: ".$mp_ship_key; }
548
+ }
549
+
550
+ if ($rhq2_headkey->meta_key != '_eshop_product' && $rhq2_headkey->meta_key != '_wp_attached_file' && $rhq2_headkey->meta_key != 'mp_shipping_info' && $rhq2_headkey->meta_key != 'mp_billing_info' )
551
+ $Header[] = $rhq2_headkey->meta_key;
552
+ }
553
+ }
554
+ #echo '<pre>'; print_r($Header); die('dsd');
555
+ $get_user_ids = "select DISTINCT ID from $wpdb->users u join $wpdb->usermeta um on um.user_id = u.ID";
556
+
557
+ $result = $wpdb->get_col($get_user_ids);
558
+ $fieldsCount = count($result);
559
+ if ($result) {
560
+ foreach ($result as $userID) {
561
+ $uId = $uId . ',' . $userID;
562
+ $query1 = "SELECT *FROM $wpdb->users where ID in ($userID);";
563
+ $result_query1 = $wpdb->get_results($query1);
564
+ if (!empty($result_query1)) {
565
+ foreach ($result_query1 as $users) {
566
+ foreach ($users as $user_key => $user_value) {
567
+ $UserData[$userID][$user_key] = $user_value;
568
+ }
569
+ }
570
+ }
571
+ // echo '<pre>'; print_r($UserData); die ('dfdf');
572
+ $query2 = "SELECT user_id, meta_key, meta_value FROM $wpdb->users wp JOIN $wpdb->usermeta wpm ON wpm.user_id = wp.ID where ID=$userID";
573
+ $possible_values = array('s:', 'a:', ':{');
574
+ $result_query2 = $wpdb->get_results($query2);
575
+ if (!empty($result_query2)) {
576
+ foreach ($result_query2 as $usermeta) {
577
+ // echo '<pre>'; print_r($usermeta);
578
+
579
+ foreach($possible_values as $posval){
580
+ if(strpos($usermeta->meta_value,$posval)){
581
+ if($usermeta->meta_key == 'mp_shipping_info' || $usermeta->meta_key == 'mp_billing_info')
582
+ $typesFserialized = 1;
583
+ } else {
584
+ $typesFserialized = 0;
585
+ }
586
+ }
587
+ if($typesFserialized == 1)
588
+ {
589
+ if($usermeta->meta_key == 'mp_shipping_info')
590
+ {
591
+ $UserID = $usermeta->user_id;
592
+ $mp_ship_data = unserialize($usermeta->meta_value);
593
+ foreach($mp_ship_data as $mp_ship_key => $mp_ship_value)
594
+ {
595
+ $mp_ship_tempkey = "msi: ".$mp_ship_key;
596
+ $UserData[$UserID][$mp_ship_tempkey]= $mp_ship_value;
597
+ }
598
+ }
599
+
600
+ if($usermeta->meta_key == 'mp_billing_info')
601
+ {
602
+ $UserID = $usermeta->user_id;
603
+ $mp_ship_data = unserialize($usermeta->meta_value);
604
+ foreach($mp_ship_data as $mp_ship_key => $mp_ship_value)
605
+ {
606
+ $mp_ship_tempkey = "mbi: ".$mp_ship_key;
607
+ $UserData[$UserID][$mp_ship_tempkey]= $mp_ship_value;
608
+ }
609
+ }
610
+
611
+ if($usermeta->meta_key != 'wp_capabilities' && $usermeta->meta_key !='mp_shipping_info' && $usermeta->meta_key != 'mp_billing_info') {
612
+ $UserData[$userID][$usermeta->meta_key] = $usermeta->meta_value;
613
+ } else {
614
+ if($usermeta->meta_key == 'wp_capabilities') {
615
+ $getUserRole = unserialize($usermeta->meta_value);
616
+ // echo '<pre>'; print_r($getUserRole); die('ddf');
617
+ foreach($getUserRole as $urKey => $urVal) {
618
+ $getUserRole = get_role($urKey);
619
+ }
620
+ $rolelevel = 0;
621
+ $isfound = array();
622
+ foreach($getUserRole->capabilities as $roleKey => $roleVal){
623
+ $isfound = explode('level_', $roleKey);
624
+ if(is_array($isfound) && count($isfound) == 2){
625
+ $rolelevel = $rolelevel + 1;
626
+ }
627
+ } $rolelevel = $rolelevel - 1;
628
+ #$UserData[$userID][$usermeta->meta_key] = $rolelevel;
629
+ }
630
+ }
631
+ } else {
632
+ foreach($possible_values as $posval){
633
+ if(strpos($usermeta->meta_value,$posval)){
634
+ $UserData[$userID][$usermeta->meta_key] = null;
635
+ } else {
636
+ $ifSerialized = 0;
637
+ $UserData[$userID][$usermeta->meta_key] = $usermeta->meta_value;
638
+ }
639
+ }
640
+
641
+ }
642
+ } #echo '<pre>'; print_r($UserData); die('dd');
643
+ }
644
+ }
645
+ }
646
+ $UserHeader = array();
647
+ foreach ($Header as $header_key) {
648
+ foreach ($UserData as $UD_key => $UD_val) {
649
+ if(array_key_exists($header_key, $UD_val)) {
650
+ $CSVContent[$UD_key][$header_key] = $UD_val[$header_key];
651
+ if(!in_array($header_key, $UserHeader))
652
+ $UserHeader[] = $header_key;
653
+ }
654
+ else {
655
+ $CSVContent[$UD_key][$header_key] = null;
656
+ }
657
+ }
658
+ }
659
+
660
+ $csv = new ImporterLib();
661
+ $csv->wmyuyn_3 ($csv_file_name, $CSVContent, $UserHeader, $export_delimiter);
662
+ }
663
+ }
modules/old_export/templates/index.php ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /******************************************************************************************
3
+ * Copyright (C) Smackcoders 2014 - All Rights Reserved
4
+ * Unauthorized copying of this file, via any medium is strictly prohibited
5
+ * Proprietary and confidential
6
+ * You can contact Smackcoders at email address info@smackcoders.com.
7
+ *******************************************************************************************/
8
+ ?>
9
+ <div class="accordion" id="accordion2" style = 'width:98%;'>
10
+ <div class="accordion-group">
11
+ <div id="collapseTwo" class="accordion-body in collapse">
12
+ <div class="accordion-inner">
13
+ <div class="title">
14
+ <span class="settings-icon"> <img src="<?php echo WP_CONTENT_URL;?>/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG;?>/images/export.png" width="24" height="24" /> </span>
15
+ <label><h3>Export Data With Advanced Filters</h3></label>
16
+ </div>
17
+
18
+ <div style="margin-top:20px;">
19
+ <div style="display:none;" id="ShowMsg"><p class="alert alert-warning" id="warning-msg"></p></div>
20
+ <form class="form-horizontal" method="post" name="exportmodule" action="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>modules/export/templates/export.php" onsubmit="return export_module();">
21
+ <!-- <form class="form-horizontal" method="post" name="exportmodule" action="" onsubmit="return export_module();"> -->
22
+ <div class="table-responsive">
23
+ <table style='width:100%;' class='table exportmodule'>
24
+ <th colspan='2'><label class='h-exportmodule'><h3 id="innertitle"> To export data based on the filters</h3> </label></th>
25
+ <tr>
26
+ <td><label><input type='checkbox' name='getdataforspecificperiod' id='getdataforspecificperiod' value='getdataforspecificperiod' onclick='addwpexportfilter(this.id);' /><span id="align"> Export data for the specific period</span></label>
27
+ <div id='specificperiodexport' style='padding:10px;display:none;'>
28
+ <label id='periodstartfrom'><b> Start From </b></label>
29
+ <input type='text' class='form-control' name='postdatefrom' style='cursor:default;width:25%;' readonly id='postdatefrom' value='' />
30
+ <label id='periodendto'><b> End To </b></label>
31
+ <input type='text' class='form-control' name='postdateto' style='cursor:default;width:25%;' readonly id='postdateto' value='' />
32
+ </div>
33
+ </td>
34
+ </tr>
35
+ <tr>
36
+ <td><label><input type='checkbox' name='getdatawithspecificstatus' id='getdatawithspecificstatus' value='getdatawithspecificstatus' onclick='addwpexportfilter(this.id);' /> <span id="align">Export data with the specific status</span></label>
37
+ <div id='specificstatusexport' style='padding:10px;display:none;'>
38
+ <label id='status'><b> Status </b></label>
39
+ <select name='postwithstatus' id='postwithstatus'>
40
+ <option>All</option>
41
+ <option>Publish</option>
42
+ <option>Sticky</option>
43
+ <option>Private</option>
44
+ <option>Protected</option>
45
+ <option>Draft</option>
46
+ <option>Pending</option>
47
+ </select>
48
+ </div>
49
+ </td>
50
+ </tr>
51
+ <tr>
52
+ <td><label><input type='checkbox' name='getdatabyspecificauthors' id='getdatabyspecificauthors' value='getdatabyspecificauthors' onclick='addwpexportfilter(this.id);' /><span id="align"> Export data by specific authors</span></label>
53
+ <div id='specificauthorexport' style='padding:10px;display:none;'>
54
+ <label id='authors'><b> Authors </b></label>
55
+ <?php $blogusers = get_users( 'blog_id=1&orderby=nicename' ); ?>
56
+ <select name='postauthor' id='postauthor' >
57
+ <option value='0'>All</option>
58
+ <?php foreach( $blogusers as $user ) { ?>
59
+ <option value='<?php echo esc_html( $user->ID ); ?>'> <?php echo esc_html( $user->display_name ); ?> </option>
60
+ <?php } ?>
61
+ </select>
62
+ </div>
63
+ </td>
64
+ </tr>
65
+ </table>
66
+ <script type = 'text/javascript'>
67
+ jQuery(document).ready(function() {
68
+ jQuery('#postdatefrom').datepicker({
69
+ dateFormat : 'yy-mm-dd'
70
+ });
71
+ jQuery('#postdateto').datepicker({
72
+ dateFormat : 'yy-mm-dd'
73
+ });
74
+ });
75
+ </script>
76
+ </div>
77
+ <div class="table-responsive" id="exporttable">
78
+ <table class='table exportmodule'>
79
+ <th colspan='2'><label class='h-exportmodule'><h3 id="innertitle"> Select your module to export the data</h3> </label></th>
80
+ <tr>
81
+ <td class='exportdatatype'><label> <input type="radio" name="export" value="post" id="post"><span id="align"> Post</span> </label></td>
82
+ <td class='exportdatatype'><label> <input type="radio" name="export" value="eshop" id="eshop"><span id="align"> Eshop</span> </label></td>
83
+ </tr>
84
+ <tr>
85
+ <td class='exportdatatype'><label> <input type="radio" name="export" value="page" id="page"><span id="align"> Page</span> </label></td>
86
+ <td class='exportdatatype'><label> <input type="radio" name="export" value="wpcommerce" id="wpcommerce" onclick="export_check(this.value);"><span id="align"> Wp-Commerce</span> <span class="mandatory">*</span></label></td>
87
+ </tr>
88
+ <tr>
89
+ <td class='exportdatatype'>
90
+ <label> <input type="radio" name="export" value="custompost" id="custompost" ><span id="align"> Custom Post</span> </label>
91
+ <select name="export_post_type" style="margin-left:10px">
92
+ <option>--Select--</option>
93
+ <?php
94
+ foreach (get_post_types() as $key => $value) {
95
+ 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') && ($value != 'product') && ($value != 'product_variation') && ($value != 'shop_order') && ($value != 'shop_coupon') && ($value != 'acf')) {
96
+ ?>
97
+ <option id="<?php echo($value); ?>"> <?php echo($value); ?> </option>
98
+ <?php
99
+ }
100
+ }
101
+ ?>
102
+ </select>
103
+ </td>
104
+ <td class='exportdatatype'><label> <input type="radio" name="export" value="woocommerce" id="woocommerce" onclick="export_check(this.value);"><span id="align"> Woo-Commerce</span> <span class="mandatory">*</span></label></td>
105
+ </tr>
106
+ <tr>
107
+ <td class='exportdatatype'><label> <input type="radio" name="export" value="category" id="category" onclick="export_check(this.value);"><span id="align"> Category</span><span class="mandatory">*</span></label></td>
108
+ <td class='exportdatatype'><label> <input type="radio" name="export" value="marketpress" id="marketpress" onclick="export_check(this.value);"><span id="align"> Marketpress</span> <span class="mandatory">*</span></label></td>
109
+ </tr>
110
+ <tr>
111
+ <td class='exportdatatype'><label> <input type="radio" name="export" value="tags" id="tags" onclick="export_check(this.value);"><span id="align"> Tags</span> <span class="mandatory">*</span></label></td>
112
+ <td class='exportdatatype'><label> <input type="radio" name="export" value="customerreviews" id="customerreviews" onclick="export_check(this.value);"><span id="align"> Customer Reviews</span><span class="mandatory">*</span></label></td>
113
+ </tr>
114
+ <tr>
115
+ <td class='exportdatatype'>
116
+ <label> <input type="radio" name="export" value="customtaxonomy" id="customtaxonomy" onclick="export_check(this.value);"><span id="align"> Custom Taxonomy</span> <span class="mandatory">*</span></label>
117
+ <select name="export_taxo_type" style="margin-left:10px;">
118
+ <option>--Select--</option>
119
+ <?php
120
+ foreach (get_taxonomies() as $key => $value) {
121
+ if (($value != 'category') && ($value != 'post_tag') && ($value != 'nav_menu') && ($value != 'link_category') && ($value != 'post_format') && ($value != 'product_tag') && ($value != 'wpsc_product_category') && ($value != 'wpsc-variation')) {
122
+ ?>
123
+ <option id="<?php echo($value); ?>"> <?php echo($value); ?> </option>
124
+ <?php
125
+ }
126
+ }
127
+ ?>
128
+ </select></td>
129
+ <td class='exportdatatype'><label> <input type="radio" name="export" value="comments" id="comments"><span id="align"> Comments</span> </label></td>
130
+ </tr>
131
+ <tr>
132
+ <td class='exportdatatype'><label> <input type="radio" name="export" value="users" id="users"><span id="align"> Users</span> </label></td>
133
+ <td class='exportdatatype'></td>
134
+ </tr>
135
+ </table>
136
+ </div>
137
+ <?php /*
138
+ <div class='form-group exportedas'>
139
+ <div class='col-sm-3 export_action'><label> <input type="radio" name="export" value="post"> Post </label>
140
+ </div>
141
+ </div>
142
+ <div class='form-group exportedas'>
143
+ <div class='col-sm-3 export_action'><label> <input type="radio" name="export" value="page"> Page </label>
144
+ </div>
145
+ </div>
146
+ <div class='form-group exportedas'>
147
+ <div class='col-sm-3 export_action'><label> <input type="radio" name="export" value="custompost"> Custom Post </label>
148
+ <select name="export_post_type">
149
+ <option>--Select--</option>
150
+ <?php
151
+ foreach (get_post_types() as $key => $value) {
152
+ 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') && ($value != 'product') && ($value != 'product_variation') && ($value != 'shop_order') && ($value != 'shop_coupon') && ($value != 'acf')) {
153
+ ?>
154
+ <option id="<?php echo($value); ?>"> <?php echo($value); ?> </option>
155
+ <?php
156
+ }
157
+ }
158
+ ?>
159
+ </select></div>
160
+ </div>
161
+ <div class='form-group exportedas'>
162
+ <div class='col-sm-3 export_action'><label> <input type="radio" name="export" value="users"> Users </label>
163
+ </div>
164
+ </div>
165
+ <div class='form-group exportedas'><div class='col-sm-3 export_action'><label><input type='radio' name='export' value='comments' id='comments' onclick="export_check(this.value)">Comments </label> </div> </div>
166
+ <div class='form-group exportedas'>
167
+ <div class='col-sm-3 export_action'><label> <input type="radio" name="export" value="category"> Category
168
+ </label></div>
169
+ </div>
170
+ <div class='form-group exportedas'>
171
+ <div class='col-sm-3 export_action'><label> <input type="radio" name="export" value="tags"> Tags </label>
172
+ </div>
173
+ </div>
174
+ <div class='form-group exportedas'>
175
+ <div class='col-sm-3 export_action'><label> <input type="radio" name="export" value="customtaxonomy"> Custom
176
+ Taxonomy </label>
177
+ <select name="export_taxo_type">
178
+ <option>--Select--</option>
179
+ <?php
180
+ foreach (get_taxonomies() as $key => $value) {
181
+ if (($value != 'category') && ($value != 'post_tag') && ($value != 'nav_menu') && ($value != 'link_category') && ($value != 'post_format') && ($value != 'product_tag') && ($value != 'wpsc_product_category') && ($value != 'wpsc-variation')) {
182
+ ?>
183
+ <option id="<?php echo($value); ?>"> <?php echo($value); ?> </option>
184
+ <?php
185
+ }
186
+ }
187
+ ?>
188
+ </select></div>
189
+ </div>
190
+ <div class='form-group exportedas'>
191
+ <div class='col-sm-3 export_action'><label> <input type="radio" name="export" value="eshop"> Eshop </label>
192
+ </div>
193
+ </div>
194
+ <div class='form-group exportedas'>
195
+ <div class='col-sm-3 export_action'><label> <input type="radio" name="export" value="wpcommerce">
196
+ Wp-Commerce </label></div>
197
+ </div>
198
+ <div class='form-group exportedas'>
199
+ <div class='col-sm-3 export_action'><label> <input type="radio" name="export" value="woocommerce">
200
+ Woo-Commerce </label></div>
201
+ </div>
202
+ <div class='form-group exportedas'>
203
+ <div class='col-sm-3 export_action'><label> <input type="radio" name="export" value="marketpress">
204
+ Marketpress </label></div>
205
+ </div>
206
+ <div class='form-group exportedas'>
207
+ <div class='col-sm-3 export_action'><label> <input type="radio" name="export" value="customerreviews">
208
+ Customer Reviews </label></div>
209
+ </div>
210
+ */ ?>
211
+ <div class='form-group exportedas'>
212
+ <label class='col-sm-2 control-label'><b> File Name: </b></label>
213
+
214
+ <div class='col-sm-6'>
215
+ <input class='form-control' type='text' name='export_filename' id='export_filename' value=''
216
+ placeholder="export_as_<?php echo(date("Y-m-d")); ?>" size="18">
217
+ </div>
218
+ <div class='col-sm-3'><input type="submit" name="exportbutton" value="Export" class='btn btn-primary'></div>
219
+
220
+ </form>
221
+ </div>
222
+ </div>
223
+ </div>
224
+ </div>
225
+ </div>
modules/page/templates/index.php CHANGED
@@ -44,14 +44,8 @@ $impCE = new WPImporter_includes_helper();
44
  <td>
45
  <h3>CSV Import Options</h3>
46
  <div id='sec-one' <?php if($_REQUEST['step']!= 'uploadfile') {?> style='display:none;' <?php } ?>>
47
- <?php if(is_dir($impCE->getUploadDirectory('default'))){
48
- if (!is_writable($impCE->getUploadDirectory('default'))) {
49
- if (!chmod($impCE->getUploadDirectory('default'), 0777)) { ?>
50
- <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='notfound' /> <?php
51
- }
52
- } else { ?>
53
- <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='found' />
54
- <?php }?>
55
  <?php } else { ?>
56
  <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='notfound' />
57
  <?php } ?>
@@ -78,7 +72,6 @@ $impCE = new WPImporter_includes_helper();
78
  <select disabled>
79
  <option value ='select template' /> select template </option>
80
  </select>
81
- <img src="<?php echo WP_CONTENT_URL; ?>/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG; ?>/images/pro_icon.gif" title="PRO Feature" />
82
  </div>
83
  </div>
84
  <div style="float:right;">
@@ -491,7 +484,6 @@ $impCE = new WPImporter_includes_helper();
491
  <input id="startbutton" class="btn btn-primary" type="button" value="Import Now" style="color: #ffffff;background:#2E9AFE;" onclick="importRecordsbySettings();" >
492
  <input id="terminatenow" class="btn btn-danger btn-sm" type="button" value="Terminate Now" style="display:none;" onclick="terminateProcess();" />
493
  <input class="btn btn-warning" type="button" value="Reload" id="importagain" style="display:none" onclick="import_again();">
494
- <input id="continuebutton" class="btn btn-lg btn-success" type="button" value="Continue" style="display:none;color: #ffffff;" onclick="continueprocess();">
495
  <!-- <input id="continuebutton" class="button" type="button" value="Continue old search" style="color: #ffffff;background:#2E9AFE;">-->
496
  <div id="ajaxloader" style="display:none"><img src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/ajax-loader.gif"> Processing...</div>
497
  <div class="clear"></div>
44
  <td>
45
  <h3>CSV Import Options</h3>
46
  <div id='sec-one' <?php if($_REQUEST['step']!= 'uploadfile') {?> style='display:none;' <?php } ?>>
47
+ <?php if(is_dir($impCE->getUploadDirectory('default'))){ ?>
48
+ <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='found' />
 
 
 
 
 
 
49
  <?php } else { ?>
50
  <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='notfound' />
51
  <?php } ?>
72
  <select disabled>
73
  <option value ='select template' /> select template </option>
74
  </select>
 
75
  </div>
76
  </div>
77
  <div style="float:right;">
484
  <input id="startbutton" class="btn btn-primary" type="button" value="Import Now" style="color: #ffffff;background:#2E9AFE;" onclick="importRecordsbySettings();" >
485
  <input id="terminatenow" class="btn btn-danger btn-sm" type="button" value="Terminate Now" style="display:none;" onclick="terminateProcess();" />
486
  <input class="btn btn-warning" type="button" value="Reload" id="importagain" style="display:none" onclick="import_again();">
 
487
  <!-- <input id="continuebutton" class="button" type="button" value="Continue old search" style="color: #ffffff;background:#2E9AFE;">-->
488
  <div id="ajaxloader" style="display:none"><img src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/ajax-loader.gif"> Processing...</div>
489
  <div class="clear"></div>
modules/post/templates/index.php CHANGED
@@ -44,14 +44,8 @@ $impCE = new WPImporter_includes_helper();
44
  <td>
45
  <h3>CSV Import Options</h3>
46
  <div id='sec-one' <?php if($_REQUEST['step']!= 'uploadfile') {?> style='display:none;' <?php } ?>>
47
- <?php if(is_dir($impCE->getUploadDirectory('default'))) {
48
- if (!is_writable($impCE->getUploadDirectory('default'))) {
49
- if (!chmod($impCE->getUploadDirectory('default'), 0777)) { ?>
50
- <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='notfound' /> <?php
51
- }
52
- } else { ?>
53
- <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='found' />
54
- <?php }?>
55
  <?php } else { ?>
56
  <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='notfound' />
57
  <?php } ?>
@@ -77,9 +71,8 @@ $impCE = new WPImporter_includes_helper();
77
  <tr>
78
  <div id='showmappingtemplate' style='float:left;padding-left:10px;'>
79
  <select disabled/>
80
- <option value ='select template' > select template </option>
81
  </select>
82
- <img src="<?php echo WP_CONTENT_URL; ?>/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG; ?>/images/pro_icon.gif" title="PRO Feature" />
83
  </div>
84
  <!-- code ends here -->
85
  </div>
@@ -501,7 +494,6 @@ $impCE = new WPImporter_includes_helper();
501
  <input id="startbutton" class="btn btn-primary" type="button" value="Import Now" style="color: #ffffff;background:#2E9AFE;" onclick="importRecordsbySettings('<?php echo site_url(); ?>');" >
502
  <input id="terminatenow" class="btn btn-danger btn-sm" type="button" value="Terminate Now" style="display:none;" onclick="terminateProcess();" />
503
  <input class="btn btn-warning" type="button" value="Reload" id="importagain" style="display:none" onclick="import_again();" />
504
- <input id="continuebutton" class="btn btn-lg btn-success" type="button" value="Continue" style="display:none;color: #ffffff;" onclick="continueprocess();">
505
  <!--<input id="continuebutton" class="button" type="button" value="Continue old search" style="color: #ffffff;background:#2E9AFE;">-->
506
  <div id="ajaxloader" style="display:none"><img src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/ajax-loader.gif"> Processing...</div>
507
 
44
  <td>
45
  <h3>CSV Import Options</h3>
46
  <div id='sec-one' <?php if($_REQUEST['step']!= 'uploadfile') {?> style='display:none;' <?php } ?>>
47
+ <?php if(is_dir($impCE->getUploadDirectory('default'))){ ?>
48
+ <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='found' />
 
 
 
 
 
 
49
  <?php } else { ?>
50
  <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='notfound' />
51
  <?php } ?>
71
  <tr>
72
  <div id='showmappingtemplate' style='float:left;padding-left:10px;'>
73
  <select disabled/>
74
+ <option value ='select template' > select template </option>
75
  </select>
 
76
  </div>
77
  <!-- code ends here -->
78
  </div>
494
  <input id="startbutton" class="btn btn-primary" type="button" value="Import Now" style="color: #ffffff;background:#2E9AFE;" onclick="importRecordsbySettings('<?php echo site_url(); ?>');" >
495
  <input id="terminatenow" class="btn btn-danger btn-sm" type="button" value="Terminate Now" style="display:none;" onclick="terminateProcess();" />
496
  <input class="btn btn-warning" type="button" value="Reload" id="importagain" style="display:none" onclick="import_again();" />
 
497
  <!--<input id="continuebutton" class="button" type="button" value="Continue old search" style="color: #ffffff;background:#2E9AFE;">-->
498
  <div id="ajaxloader" style="display:none"><img src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/ajax-loader.gif"> Processing...</div>
499
 
modules/schedulemapping/actions/actions.php CHANGED
@@ -50,9 +50,7 @@ class SchedulemappingActions extends SkinnyActions {
50
  {
51
  // return an array of name value pairs to send data to the template
52
  $data = array();
53
- $helperObj = new WPImporter_includes_helper();
54
- $data['common_notice'] = $helperObj->common_notice_for_pro_feature();
55
  return $data;
56
  }
57
 
58
- }
50
  {
51
  // return an array of name value pairs to send data to the template
52
  $data = array();
 
 
53
  return $data;
54
  }
55
 
56
+ }
modules/schedulemapping/templates/index.php CHANGED
@@ -36,4 +36,5 @@
36
  ********************************************************************************/
37
  ?>
38
 
39
- <div align='center' style='width:100%;'><?php echo $skinnyData['common_notice']; ?><img src='<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR ?>images/schedule.png' width=100%></div>
 
36
  ********************************************************************************/
37
  ?>
38
 
39
+ <div align='center' style='width:100%;'><img src='<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR ?>images/schedule.png' width=100%>
40
+ </div>
modules/settings/actions/actions.php CHANGED
@@ -57,7 +57,7 @@ class SettingsActions extends SkinnyActions
57
  update_option('wpcsvfreesettings',$_POST);
58
  $data['savesettings'] = 'done';
59
  }
60
- $setingsArr = array('post', 'page', 'custompost', 'comments', 'categories', 'customtaxonomy', 'users', 'eshop', 'wpcommerce', 'woocommerce', 'custompostuitype', 'cctm', 'acf', 'aioseo', 'yoastseo', 'enable', 'disable', 'nonerseooption', 'nonercustompost', 'nonerecommerce', 'recommerce','enable_plugin_access_for_author', 'send_log_email', 'enable_debug', 'disable_debug', 'debug_mode');
61
  foreach($setingsArr as $option)
62
  $data[$option] = "";
63
 
@@ -66,6 +66,7 @@ class SettingsActions extends SkinnyActions
66
  foreach($settings as $settings_key)
67
  $data[$settings_key] = 'checked';
68
 
 
69
  //Settings action
70
  //SEO option
71
  $tableseo = get_option('wpcsvfreesettings');
@@ -227,19 +228,9 @@ class SettingsActions extends SkinnyActions
227
  $data['customerreviews'] = 'disablesetting';
228
  }
229
 
230
- // Debug mode enable / disable
231
- if(isset($tableseo['debug_mode'])) {
232
- $debug_mode = $tableseo['debug_mode'];
233
- } else {
234
- $debug_mode = '';
235
- }
236
- if($debug_mode == 'enable_debug') {
237
- $data['debugmode_enable'] = 'checked enablesetting';
238
- $data['debugmode_disable'] = 'disablesetting';
239
- } else if($debug_mode == 'disable_debug') {
240
- $data['debugmode_enable'] = 'disablesetting';
241
- $data['debugmode_disable'] = 'checked enablesetting';
242
- }
243
 
244
  //Custom Fields
245
  #$wpmemberoption = $tableseo['rwpmembers'];
57
  update_option('wpcsvfreesettings',$_POST);
58
  $data['savesettings'] = 'done';
59
  }
60
+ $setingsArr = array('post', 'page', 'custompost', 'comments', 'categories', 'customtaxonomy', 'users', 'eshop', 'wpcommerce', 'woocommerce', 'custompostuitype', 'cctm', 'acf', 'aioseo', 'yoastseo', 'enable', 'disable', 'nonerseooption', 'nonercustompost', 'nonerecommerce', 'recommerce','enable_plugin_access_for_author');
61
  foreach($setingsArr as $option)
62
  $data[$option] = "";
63
 
66
  foreach($settings as $settings_key)
67
  $data[$settings_key] = 'checked';
68
 
69
+
70
  //Settings action
71
  //SEO option
72
  $tableseo = get_option('wpcsvfreesettings');
228
  $data['customerreviews'] = 'disablesetting';
229
  }
230
 
231
+
232
+
233
+
 
 
 
 
 
 
 
 
 
 
234
 
235
  //Custom Fields
236
  #$wpmemberoption = $tableseo['rwpmembers'];
modules/settings/templates/index.php CHANGED
@@ -348,12 +348,12 @@ global $wpdb; ?>
348
  <tr><td>
349
  <h3 id="innertitle">None</h3>
350
  <label>SEO Meta import is disabled.</label> </td><td>
351
- <label id="seosetting1" class="<?php echo $skinnyData['nonerseooption'];?>" ><input type = 'radio' name ='rseooption' id='nonerseooption' value='nonerseooption' <?php #echo $skinnyData['nonerseooption']; ?> class='ecommerce' onclick="seosetting(this.id);" style="display:none"><span id="seosetting1text"> <?php echo $skinnyData['none_status']; ?> </span> </label>
352
  </td></tr>
353
  <tr><td>
354
  <h3 id="innertitle">All-in-one SEO </h3>
355
  <label>Enable All-in-one SEO import.</label> </td><td>
356
- <label id="seosetting2" class="<?php echo $skinnyData['aioseo']; ?>" ><input type ='radio' name = 'rseooption' id='aioseo' value='aioseo' <?php echo $skinnyData['aioseo']; ?> onclick="seosetting(this.id);" style="display:none"><span id="seosetting2text"> <?php echo $skinnyData['aioseo_status']; ?> </span></label>
357
  <div id="pluginavail" class="<?php echo $skinnyData['aioseotd'] ?>"> </div>
358
  </td></tr>
359
  <tr><td>
@@ -390,12 +390,6 @@ global $wpdb; ?>
390
  </select>
391
  </label>
392
  </td></tr>
393
- <tr class="databorder"><td>
394
- <h3 id="innertitle">Debug Mode</h3>
395
- <label>You can enable/disable the debug mode.</label> </td><td>
396
- <label id="debugmode_enable" class="<?php echo $skinnyData['debugmode_enable']; ?>"><input type='radio' name='debug_mode' value='enable_debug' <?php echo $skinnyData['debugmode_enable']; ?> id="enabled" style="display:none" onclick="debugmode_check(this.id);" > On </label>
397
- <label id="debugmode_disable" class="<?php echo $skinnyData['debugmode_disable']; ?>"><input type='radio' name='debug_mode' value='disable_debug' <?php echo $skinnyData['debugmode_disable']; ?> id="disabled" style="display:none" onclick="debugmode_check(this.id);" > Off </label>
398
- </td></tr>
399
  <tr class="databorder"><td>
400
  <h3 id="innertitle">Scheduled log mails</h3>
401
  <label>Enable to get scheduled log mails.</label> </td><td>
@@ -423,7 +417,7 @@ global $wpdb; ?>
423
  <!--div-7-->
424
  <div id="section7" class="databaseoptimization" style="display:none;">
425
  <div class="title">
426
- <h3>Database Optimization <img src="<?php echo WP_CONTENT_URL;?>/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG;?>/images/pro_icon.gif" title='PRO Feature' /></h3>
427
  <span style="float:right;margin-right:168px;margin-top:-35px;">
428
  <a id="checkOpt" onclick="check_if_avail(this.id);" href="#"> Check All </a>
429
  </span>
@@ -482,8 +476,8 @@ global $wpdb; ?>
482
  <div id="data" class="databorder security-perfoemance" >
483
  <table class="securityfeatures">
484
  <tr><td>
485
- <h3 id="innertitle">Allow authors/editors to import</h3>
486
- <label><div>It helps authors/editors can import using importer.</div>
487
  <div>It does not support users.</div></label></td><td>
488
 
489
  <!--<label><input type='checkbox' name='enable_plugin_access_for_author' value='enable_plugin_access_for_author' <?php echo $skinnyData['enable_plugin_access_for_author']; ?> /> Allow authors to import </label>-->
@@ -517,9 +511,7 @@ global $wpdb; ?>
517
  </table>
518
  <h3 id="innertitle" colspan="2" >Required Loaders and Extentions:</h3>
519
  <table class="table table-striped">
520
- <?php $loaders_extensions = get_loaded_extensions();
521
- $mod_security = apache_get_modules();
522
- ?>
523
  <tr><td>IonCube Loader </td><td><?php if(in_array('ionCube Loader', $loaders_extensions)) {
524
  echo '<label style="color:green;">Yes</label>';
525
  } else {
@@ -535,25 +527,6 @@ global $wpdb; ?>
535
  } else {
536
  echo '<label style="color:red;">No</label>';
537
  } ?></td><td></td></tr>
538
- <tr><td>Mod Security </td><td><?php if(in_array('mod_security.c', $mod_security)) {
539
- echo '<label style="color:green;">Yes</label>';
540
- } else {
541
- echo '<label style="color:red;">No</label>';
542
- } ?></td><td>
543
- <div style='float:left'>
544
- <a href="#" class="tooltip">
545
- <img src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/help.png" style="margin-left:-74px;"/>
546
- <span style="margin-left:20px;margin-top:-10px;width:150px;">
547
- <img class="callout" src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/callout.gif"/>
548
- <strong>htaccess settings:</strong>
549
- <p>Locate the .htaccess file in Apache web root,if not create a new file named .htaccess and add the following:</p>
550
- <b><?php echo '<IfModule mod_security.c>';?> SecFilterEngine Off SecFilterScanPOST Off <?php echo ' </IfModule>';?></b>
551
-
552
- </span>
553
- </a>
554
- </div>
555
- </td></tr>
556
-
557
  </table>
558
  <h3 id="innertitle" colspan="2" >Debug Information:</h3>
559
  <table class="table table-striped">
348
  <tr><td>
349
  <h3 id="innertitle">None</h3>
350
  <label>SEO Meta import is disabled.</label> </td><td>
351
+ <label id="seosetting1" class="<?php echo $skinnyData['nonerseooption'];?>" ><input type = 'radio' name ='rseooption' id='nonerseooption' value='nonerseooption' <?php echo $skinnyData['nonerseooption']; ?> class='ecommerce' onclick="check_if_avail(this.id);" style="display:none"><span id="seosetting1text"> <?php echo $skinnyData['none_status']; ?> </span> </label>
352
  </td></tr>
353
  <tr><td>
354
  <h3 id="innertitle">All-in-one SEO </h3>
355
  <label>Enable All-in-one SEO import.</label> </td><td>
356
+ <label id="seosetting2" class="<?php echo $skinnyData['aioseo']; ?>" ><input type ='radio' name = 'rseooption' id='aioseo' value='aioseo' <?php echo $skinnyData['aioseo']; ?> style="display:none"><span id="seosetting2text"> <?php echo $skinnyData['aioseo_status']; ?> </span></label>
357
  <div id="pluginavail" class="<?php echo $skinnyData['aioseotd'] ?>"> </div>
358
  </td></tr>
359
  <tr><td>
390
  </select>
391
  </label>
392
  </td></tr>
 
 
 
 
 
 
393
  <tr class="databorder"><td>
394
  <h3 id="innertitle">Scheduled log mails</h3>
395
  <label>Enable to get scheduled log mails.</label> </td><td>
417
  <!--div-7-->
418
  <div id="section7" class="databaseoptimization" style="display:none;">
419
  <div class="title">
420
+ <h3>Database Optimization </h3>
421
  <span style="float:right;margin-right:168px;margin-top:-35px;">
422
  <a id="checkOpt" onclick="check_if_avail(this.id);" href="#"> Check All </a>
423
  </span>
476
  <div id="data" class="databorder security-perfoemance" >
477
  <table class="securityfeatures">
478
  <tr><td>
479
+ <h3 id="innertitle">Allow authors to import</h3>
480
+ <label><div>This enables authors to import.</div>
481
  <div>It does not support users.</div></label></td><td>
482
 
483
  <!--<label><input type='checkbox' name='enable_plugin_access_for_author' value='enable_plugin_access_for_author' <?php echo $skinnyData['enable_plugin_access_for_author']; ?> /> Allow authors to import </label>-->
511
  </table>
512
  <h3 id="innertitle" colspan="2" >Required Loaders and Extentions:</h3>
513
  <table class="table table-striped">
514
+ <?php $loaders_extensions = get_loaded_extensions();?>
 
 
515
  <tr><td>IonCube Loader </td><td><?php if(in_array('ionCube Loader', $loaders_extensions)) {
516
  echo '<label style="color:green;">Yes</label>';
517
  } else {
527
  } else {
528
  echo '<label style="color:red;">No</label>';
529
  } ?></td><td></td></tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
530
  </table>
531
  <h3 id="innertitle" colspan="2" >Debug Information:</h3>
532
  <table class="table table-striped">
modules/users/actions/actions.php CHANGED
@@ -174,14 +174,12 @@ class UsersActions extends SkinnyActions {
174
  if(!empty($getUserId)){
175
  $user_id = $getUserId[0]->ID;
176
  }
177
- if(is_array($getUserId) && !empty($getUserId)){
178
  $this->dupPostCount = $this->dupPostCount+1;
179
  $this->detailedLog[$currentLimit][] = "<b>Username</b> - " . $UserLogin . " - already exists(skipped), <b>E-mail</b> - " . $UserEmail . " - found as duplicate.";
180
  }
181
  else{
182
  $user_id = wp_insert_user( $data_array );
183
- if(is_wp_error($user_id))
184
- return false;
185
  $user = new WP_User( $user_id );
186
  if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
187
  foreach ( $user->roles as $role )
174
  if(!empty($getUserId)){
175
  $user_id = $getUserId[0]->ID;
176
  }
177
+ if($user_id){
178
  $this->dupPostCount = $this->dupPostCount+1;
179
  $this->detailedLog[$currentLimit][] = "<b>Username</b> - " . $UserLogin . " - already exists(skipped), <b>E-mail</b> - " . $UserEmail . " - found as duplicate.";
180
  }
181
  else{
182
  $user_id = wp_insert_user( $data_array );
 
 
183
  $user = new WP_User( $user_id );
184
  if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
185
  foreach ( $user->roles as $role )
modules/users/templates/index.php CHANGED
@@ -48,14 +48,8 @@ $impCE = new WPImporter_includes_helper();
48
  <td>
49
  <h3>CSV Import Options</h3>
50
  <div id='sec-one' <?php if($_REQUEST['step']!= 'uploadfile') {?> style='display:none;' <?php } ?>>
51
- <?php if(is_dir($impCE->getUploadDirectory('default'))){
52
- if (!is_writable($impCE->getUploadDirectory('default'))) {
53
- if (!chmod($impCE->getUploadDirectory('default'), 0777)) { ?>
54
- <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='notfound' /> <?php
55
- }
56
- } else { ?>
57
- <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='found' />
58
- <?php }?>
59
  <?php } else { ?>
60
  <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='notfound' />
61
  <?php } ?>
@@ -82,7 +76,6 @@ $impCE = new WPImporter_includes_helper();
82
  <select disabled/>
83
  <option value ='select template' /> select template </option>
84
  </select>
85
- <img src="<?php echo WP_CONTENT_URL; ?>/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG; ?>/images/pro_icon.gif" title="PRO Feature" />
86
  </div>
87
 
88
  </div>
@@ -420,7 +413,6 @@ $mFieldsArr = substr($mFieldsArr, 0, -1);
420
  <input id="startbutton" class="btn btn-primary" type="button" value="Import Now" style="color: #ffffff;background:#2E9AFE;" onclick="importRecordsbySettings();" />
421
  <input id="terminatenow" class="btn btn-danger btn-sm" type="button" value="Terminate Now" style="display:none;" onclick="terminateProcess();" />
422
  <input class="btn btn-warning" type="button" value="Reload" id="importagain" style="display:none;" onclick="import_again();" />
423
- <input id="continuebutton" class="btn btn-lg btn-success" type="button" value="Continue" style="display:none;color: #ffffff;" onclick="continueprocess();">
424
  <!--<input id="continuebutton" class="button" type="button" value="Continue old search" style="color: #ffffff;background:#2E9AFE;">-->
425
  <div id="ajaxloader" style="display:none"><img src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/ajax-loader.gif"> Processing...</div>
426
  <div class="clear"></div>
48
  <td>
49
  <h3>CSV Import Options</h3>
50
  <div id='sec-one' <?php if($_REQUEST['step']!= 'uploadfile') {?> style='display:none;' <?php } ?>>
51
+ <?php if(is_dir($impCE->getUploadDirectory('default'))){ ?>
52
+ <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='found' />
 
 
 
 
 
 
53
  <?php } else { ?>
54
  <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='notfound' />
55
  <?php } ?>
76
  <select disabled/>
77
  <option value ='select template' /> select template </option>
78
  </select>
 
79
  </div>
80
 
81
  </div>
413
  <input id="startbutton" class="btn btn-primary" type="button" value="Import Now" style="color: #ffffff;background:#2E9AFE;" onclick="importRecordsbySettings();" />
414
  <input id="terminatenow" class="btn btn-danger btn-sm" type="button" value="Terminate Now" style="display:none;" onclick="terminateProcess();" />
415
  <input class="btn btn-warning" type="button" value="Reload" id="importagain" style="display:none;" onclick="import_again();" />
 
416
  <!--<input id="continuebutton" class="button" type="button" value="Continue old search" style="color: #ffffff;background:#2E9AFE;">-->
417
  <div id="ajaxloader" style="display:none"><img src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/ajax-loader.gif"> Processing...</div>
418
  <div class="clear"></div>
templates/import.php CHANGED
@@ -34,8 +34,7 @@
34
  * Notices must display the words
35
  * "Copyright Smackcoders. 2014. All rights reserved".
36
  ********************************************************************************/
37
- if(!defined('ABSPATH'))
38
- die('Your requested url were wrong! Please contact your admin.');
39
  require_once(WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY . 'lib/skinnymvc/core/base/SkinnyBaseActions.php');
40
  require_once(WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY . 'lib/skinnymvc/core/SkinnyActions.php');
41
  $skinnyObj = new CallWPImporterObj();
@@ -221,7 +220,7 @@ if ($totRecords <= ($_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['insPostCount'] +
221
  unset($_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['captureId']);
222
  }
223
  if ($limit == $totRecords) {
224
- echo "<br><div style='margin-left:10px; color:green;'>Import successfully completed!.</div>";
225
  }
226
  /*if ($curr_action == 'users') {
227
  echo "<div style='margin-left:7px;'>";
34
  * Notices must display the words
35
  * "Copyright Smackcoders. 2014. All rights reserved".
36
  ********************************************************************************/
37
+
 
38
  require_once(WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY . 'lib/skinnymvc/core/base/SkinnyBaseActions.php');
39
  require_once(WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY . 'lib/skinnymvc/core/SkinnyActions.php');
40
  $skinnyObj = new CallWPImporterObj();
220
  unset($_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['captureId']);
221
  }
222
  if ($limit == $totRecords) {
223
+ echo "<br><div style='margin-left:3px;'>Import successfully completed!.</div>";
224
  }
225
  /*if ($curr_action == 'users') {
226
  echo "<div style='margin-left:7px;'>";
templates/layout.php CHANGED
@@ -46,18 +46,7 @@
46
  }
47
  else if(isset($_REQUEST['__module']))
48
  {
49
- # print_r($skinny_content);
50
- if (isset($_REQUEST['__module'])) {
51
- if ( current_user_can( 'administrator' ) ) { //uthor' ) && current_user_can( 'editor' ) ) {
52
- print_r($skinny_content);
53
- } else {
54
- if($_REQUEST['__module'] == 'users' || $_REQUEST['__module'] == 'settings') {
55
- die('<p id="warning-msg" class="alert alert-warning" style="margin-top:50px;">You are not having the permission to access this page. Please, Contact your administrator.</p>');
56
- } else {
57
- print_r($skinny_content);
58
- }
59
- }
60
- }
61
  }
62
  else
63
  {
46
  }
47
  else if(isset($_REQUEST['__module']))
48
  {
49
+ print_r($skinny_content);
 
 
 
 
 
 
 
 
 
 
 
50
  }
51
  else
52
  {
templates/menu.php CHANGED
@@ -5,18 +5,12 @@
5
  * Proprietary and confidential
6
  * You can contact Smackcoders at email address info@smackcoders.com.
7
  *******************************************************************************************/
8
- if(!defined('ABSPATH'))
9
- die('Your requested url were wrong! Please contact your admin.');
10
  $post = $page = $custompost = $categories = $users = $customtaxonomy = $comments = $eshop = $wpcommerce = $woocommerce = $settings = $support = $dashboard = $export = $mappingtemplate = $filemanager = $schedulemapping = $marketpress = $customerreviews = '';
11
  $impCEM = CallWPImporterObj::getInstance();
12
  $get_settings = array();
13
  $get_settings = $impCEM->getSettings();
14
  $mod = isset($_REQUEST['__module']) ? $_REQUEST['__module'] : '';
15
- if( is_array($get_settings) && !empty($get_settings) ) {
16
- foreach ($get_settings as $key) {
17
- $$key = true;
18
- }
19
- }
20
  if (isset($_POST['post_csv']) && $_POST['post_csv'] == 'Import') {
21
  $dashboard = 'activate';
22
  } else {
5
  * Proprietary and confidential
6
  * You can contact Smackcoders at email address info@smackcoders.com.
7
  *******************************************************************************************/
8
+
 
9
  $post = $page = $custompost = $categories = $users = $customtaxonomy = $comments = $eshop = $wpcommerce = $woocommerce = $settings = $support = $dashboard = $export = $mappingtemplate = $filemanager = $schedulemapping = $marketpress = $customerreviews = '';
10
  $impCEM = CallWPImporterObj::getInstance();
11
  $get_settings = array();
12
  $get_settings = $impCEM->getSettings();
13
  $mod = isset($_REQUEST['__module']) ? $_REQUEST['__module'] : '';
 
 
 
 
 
14
  if (isset($_POST['post_csv']) && $_POST['post_csv'] == 'Import') {
15
  $dashboard = 'activate';
16
  } else {
templates/savetemplate.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*********************************************************************************
3
+ * WP Ultimate CSV Importer is a Tool for importing CSV for the Wordpress
4
+ * plugin developed by Smackcoder. Copyright (C) 2014 Smackcoders.
5
+ *
6
+ * WP Ultimate CSV Importer is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Affero General Public License version 3
8
+ * as published by the Free Software Foundation with the addition of the
9
+ * following permission added to Section 15 as permitted in Section 7(a): FOR
10
+ * ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY WP Ultimate
11
+ * CSV Importer, WP Ultimate CSV Importer DISCLAIMS THE WARRANTY OF NON
12
+ * INFRINGEMENT OF THIRD PARTY RIGHTS.
13
+ *
14
+ * WP Ultimate CSV Importer is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
17
+ * License for more details.
18
+ *
19
+ * You should have received a copy of the GNU Affero General Public License
20
+ * along with this program; if not, see http://www.gnu.org/licenses or write
21
+ * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22
+ * Boston, MA 02110-1301 USA.
23
+ *
24
+ * You can contact Smackcoders at email address info@smackcoders.com.
25
+ *
26
+ * The interactive user interfaces in original and modified versions
27
+ * of this program must display Appropriate Legal Notices, as required under
28
+ * Section 5 of the GNU Affero General Public License version 3.
29
+ *
30
+ * In accordance with Section 7(b) of the GNU Affero General Public License
31
+ * version 3, these Appropriate Legal Notices must retain the display of the
32
+ * WP Ultimate CSV Importer copyright notice. If the display of the logo is
33
+ * not reasonably feasible for technical reasons, the Appropriate Legal
34
+ * Notices must display the words
35
+ * "Copyright Smackcoders. 2014. All rights reserved".
36
+ ********************************************************************************/
37
+
38
+ require_once('../config/settings.php');
39
+ require_once('../lib/skinnymvc/controller/SkinnyController.php');
40
+ require_once('../../../../wp-load.php');
41
+ if($_REQUEST['stepstatus']){
42
+ foreach($_REQUEST as $reqKey => $reqVal){
43
+ if($reqKey == 'h2'){
44
+ $getArr = explode(',',$reqVal);
45
+ foreach($getArr as $v){
46
+ $mapArr[] = $v;
47
+ }
48
+ $_SESSION['SMACK_IMP_OPTIONS']['mapArr'] = $mapArr;
49
+ }elseif($reqKey != 'h2'){
50
+ $_SESSION['SMACK_IMP_OPTIONS'][$reqKey] = $reqVal;
51
+ }
52
+ }
53
+ print_r(json_encode($_REQUEST));
54
+ }
55
+ die;
templates/versioncheck.php CHANGED
@@ -34,8 +34,7 @@
34
  * Notices must display the words
35
  * "Copyright Smackcoders. 2014. All rights reserved".
36
  ********************************************************************************/
37
- if(!defined('ABSPATH'))
38
- die('Your requested url were wrong! Please contact your admin.');
39
  global $wpdb;
40
  $all_arr = array();
41
  $all_arr = $_REQUEST['postdata'];
34
  * Notices must display the words
35
  * "Copyright Smackcoders. 2014. All rights reserved".
36
  ********************************************************************************/
37
+
 
38
  global $wpdb;
39
  $all_arr = array();
40
  $all_arr = $_REQUEST['postdata'];