Ultimate CSV Importer - Version 5.3.2

Version Description

Download this release

Release Info

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

Code changes from version 5.3.1 to 5.3.2

Readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: https://www.paypal.me/smackcoders
4
  Tags: csv, wordpress csv import, csv importer, import, import csv, import seo, import woocommerce, acf, excel, export, spreadsheet
5
  Requires at least: 4.1
6
  Tested up to: 4.8.1
7
- Stable tag: 5.3.1
8
- Version: 5.3.1
9
  Author: smackcoders
10
  Author URI: http://profiles.wordpress.org/smackcoders/
11
  License: GPLv2 or later
@@ -101,7 +101,6 @@ Read our [blog](http://www.smackcoders.com/blog/category/wordpress-products?utm_
101
  5. Detailed real-time log.
102
  6. Settings with php.ini details.
103
  7. Downloadable log manager for all imported events.
104
- 8. Export module with filters.
105
 
106
  == Frequently Asked Questions ==
107
  = Common Issues =
@@ -129,6 +128,10 @@ The importer supports [default WordPress Text and Text area fields](http://www.s
129
  For more FAQ, you can refer [here](http://www.smackcoders.com/wordpress-products-faq.html?utm_source=wp_org&utm_campaign=readme&utm_medium=faq).
130
 
131
  == Changelog ==
 
 
 
 
132
  = 5.3.1 =
133
  * Modified: Hide the filter based on Condition.
134
  * Fixed: data loss when page refresh (export).
@@ -480,7 +483,9 @@ For more FAQ, you can refer [here](http://www.smackcoders.com/wordpress-products
480
  * Initial release version. Tested and found works well without any issues.
481
 
482
  == Upgrade Notice ==
483
- = 5.4 =
 
 
484
  * Upgrade now to get the fix for Export,CFS and WordPress 4.8.1 compatibility.
485
  = 5.3 =
486
  * Major improvements and fix updates, verify change log for upgrade.
4
  Tags: csv, wordpress csv import, csv importer, import, import csv, import seo, import woocommerce, acf, excel, export, spreadsheet
5
  Requires at least: 4.1
6
  Tested up to: 4.8.1
7
+ Stable tag: 5.3.2
8
+ Version: 5.3.2
9
  Author: smackcoders
10
  Author URI: http://profiles.wordpress.org/smackcoders/
11
  License: GPLv2 or later
101
  5. Detailed real-time log.
102
  6. Settings with php.ini details.
103
  7. Downloadable log manager for all imported events.
 
104
 
105
  == Frequently Asked Questions ==
106
  = Common Issues =
128
  For more FAQ, you can refer [here](http://www.smackcoders.com/wordpress-products-faq.html?utm_source=wp_org&utm_campaign=readme&utm_medium=faq).
129
 
130
  == Changelog ==
131
+
132
+ = 5.3.2 =
133
+ * Addons support
134
+
135
  = 5.3.1 =
136
  * Modified: Hide the filter based on Condition.
137
  * Fixed: data loss when page refresh (export).
483
  * Initial release version. Tested and found works well without any issues.
484
 
485
  == Upgrade Notice ==
486
+ = 5.3.2 =
487
+ * Upgrade now for getting addons support
488
+ = 5.3.1 =
489
  * Upgrade now to get the fix for Export,CFS and WordPress 4.8.1 compatibility.
490
  = 5.3 =
491
  * Major improvements and fix updates, verify change log for upgrade.
admin/class-uci-admin.php CHANGED
@@ -68,6 +68,7 @@ class SmackUCIAdmin extends SmackUCIHelper {
68
  add_submenu_page(SM_UCI_SLUG, SM_UCI_NAME, esc_html__('Managers','wp-ultimate-csv-importer'), 'manage_options', 'sm-uci-managers', array(__CLASS__, 'sm_uci_screens'));
69
  add_submenu_page(SM_UCI_SLUG, SM_UCI_NAME, esc_html__('Export','wp-ultimate-csv-importer'), 'manage_options', 'sm-uci-export', array(__CLASS__, 'sm_uci_screens'));
70
  add_submenu_page(SM_UCI_SLUG, SM_UCI_NAME, esc_html__('Settings','wp-ultimate-csv-importer'), 'manage_options', 'sm-uci-settings', array(__CLASS__, 'sm_uci_screens'));
 
71
  add_submenu_page(SM_UCI_SLUG, SM_UCI_NAME, esc_html__('Support','wp-ultimate-csv-importer'), 'manage_options', 'sm-uci-support', array(__CLASS__, 'sm_uci_screens'));
72
  unset($submenu[SM_UCI_SLUG][0]);
73
  }
@@ -79,6 +80,7 @@ class SmackUCIAdmin extends SmackUCIHelper {
79
  add_submenu_page(SM_UCI_SLUG, SM_UCI_NAME, 'Import / Update', '2', 'sm-uci-import', array(__CLASS__, 'sm_uci_screens'));
80
  add_submenu_page(SM_UCI_SLUG, SM_UCI_NAME, 'Managers', '2', 'sm-uci-managers', array(__CLASS__, 'sm_uci_screens'));
81
  add_submenu_page(SM_UCI_SLUG, SM_UCI_NAME, 'Export', '2', 'sm-uci-export', array(__CLASS__, 'sm_uci_screens'));
 
82
  add_submenu_page(SM_UCI_SLUG, SM_UCI_NAME, 'Support', '2', 'sm-uci-support', array(__CLASS__, 'sm_uci_screens'));
83
  unset($submenu[SM_UCI_SLUG][0]);
84
  }
@@ -105,6 +107,9 @@ class SmackUCIAdmin extends SmackUCIHelper {
105
  case 'sm-uci-support':
106
  $uci_admin->show_support_screen();
107
  break;
 
 
 
108
  default:
109
  break;
110
  }
@@ -112,17 +117,22 @@ class SmackUCIAdmin extends SmackUCIHelper {
112
  }
113
 
114
  public function show_top_navigation_menus() {
115
- echo '<div class="menu_bar wp_ultimate_csv_importer_pro">
 
 
116
  <h2 class="nav-tab-wrapper">
117
  <a href="'. esc_url (admin_url() .'admin.php?page=sm-uci-dashboard') .'" class="nav-tab nav-tab-active" id = "menu1">'.esc_html__('Dashboard','wp-ultimate-csv-importer').'</a>
118
  <a href="'. esc_url (admin_url() .'admin.php?page=sm-uci-import') . '" class="nav-tab" id = "menu2">'.esc_html__('Import / Update','wp-ultimate-csv-importer').'</a>
119
- <a href="'. esc_url (admin_url() .'admin.php?page=sm-uci-managers') . '" class="nav-tab" id = "menu3">'.esc_html__('Manager','wp-ultimate-csv-importer').'</a>
120
- <a href="'. esc_url (admin_url() .'admin.php?page=sm-uci-export') . '" class="nav-tab" id = "menu4">'.esc_html__('Export','wp-ultimate-csv-importer').'</a>
121
- <a href="'. esc_url (admin_url() .'admin.php?page=sm-uci-settings') . '" class="nav-tab" id = "menu5">'.esc_html__('Settings','wp-ultimate-csv-importer').'</a>
122
- <a href="'. esc_url (admin_url() .'admin.php?page=sm-uci-support') . '" class="nav-tab" id = "menu6">'.esc_html__('Support','wp-ultimate-csv-importer').'</a>
 
 
123
  </h2>
124
  </div>
125
  <div id="notification_wp_csv"></div>';
 
126
  $myDir = SM_UCI_DEFAULT_UPLOADS_DIR;
127
  if(is_dir($myDir)) {
128
  echo "<input type='hidden' id='is_found' name='is_found' value='dir found'/>";
@@ -202,7 +212,15 @@ class SmackUCIAdmin extends SmackUCIHelper {
202
  }
203
 
204
  public function show_export_screen() {
205
- include ( 'views/form-export-data.php' );
 
 
 
 
 
 
 
 
206
  }
207
 
208
  public function show_settings_screen() {
@@ -215,6 +233,12 @@ class SmackUCIAdmin extends SmackUCIHelper {
215
  return true;
216
  }
217
 
 
 
 
 
 
 
218
 
219
  public function show_notices($parseObj) {
220
 
@@ -467,7 +491,11 @@ class SmackUCIAdmin extends SmackUCIHelper {
467
  $fields = $this->CFSFields();
468
  break;
469
  case 'Billing And Shipping Information':
470
- $fields = $this->billing_information_for_users();
 
 
 
 
471
  break;
472
  case 'WP e-Commerce Custom Fields':
473
  $fields = $this->WPeCommerceCustomFields();
68
  add_submenu_page(SM_UCI_SLUG, SM_UCI_NAME, esc_html__('Managers','wp-ultimate-csv-importer'), 'manage_options', 'sm-uci-managers', array(__CLASS__, 'sm_uci_screens'));
69
  add_submenu_page(SM_UCI_SLUG, SM_UCI_NAME, esc_html__('Export','wp-ultimate-csv-importer'), 'manage_options', 'sm-uci-export', array(__CLASS__, 'sm_uci_screens'));
70
  add_submenu_page(SM_UCI_SLUG, SM_UCI_NAME, esc_html__('Settings','wp-ultimate-csv-importer'), 'manage_options', 'sm-uci-settings', array(__CLASS__, 'sm_uci_screens'));
71
+ add_submenu_page(SM_UCI_SLUG, SM_UCI_NAME, esc_html__('Addons','wp-ultimate-csv-importer'), 'manage_options', 'sm-uci-addons', array(__CLASS__, 'sm_uci_screens'));
72
  add_submenu_page(SM_UCI_SLUG, SM_UCI_NAME, esc_html__('Support','wp-ultimate-csv-importer'), 'manage_options', 'sm-uci-support', array(__CLASS__, 'sm_uci_screens'));
73
  unset($submenu[SM_UCI_SLUG][0]);
74
  }
80
  add_submenu_page(SM_UCI_SLUG, SM_UCI_NAME, 'Import / Update', '2', 'sm-uci-import', array(__CLASS__, 'sm_uci_screens'));
81
  add_submenu_page(SM_UCI_SLUG, SM_UCI_NAME, 'Managers', '2', 'sm-uci-managers', array(__CLASS__, 'sm_uci_screens'));
82
  add_submenu_page(SM_UCI_SLUG, SM_UCI_NAME, 'Export', '2', 'sm-uci-export', array(__CLASS__, 'sm_uci_screens'));
83
+ add_submenu_page(SM_UCI_SLUG, SM_UCI_NAME, 'Addons', '2', 'sm-uci-addons', array(__CLASS__, 'sm_uci_screens'));
84
  add_submenu_page(SM_UCI_SLUG, SM_UCI_NAME, 'Support', '2', 'sm-uci-support', array(__CLASS__, 'sm_uci_screens'));
85
  unset($submenu[SM_UCI_SLUG][0]);
86
  }
107
  case 'sm-uci-support':
108
  $uci_admin->show_support_screen();
109
  break;
110
+ case 'sm-uci-addons':
111
+ $uci_admin->show_addon_screen();
112
+ break;
113
  default:
114
  break;
115
  }
117
  }
118
 
119
  public function show_top_navigation_menus() {
120
+ $active_plugins = get_option( "active_plugins" );
121
+
122
+ $menu = '<div class="menu_bar wp_ultimate_csv_importer_pro">
123
  <h2 class="nav-tab-wrapper">
124
  <a href="'. esc_url (admin_url() .'admin.php?page=sm-uci-dashboard') .'" class="nav-tab nav-tab-active" id = "menu1">'.esc_html__('Dashboard','wp-ultimate-csv-importer').'</a>
125
  <a href="'. esc_url (admin_url() .'admin.php?page=sm-uci-import') . '" class="nav-tab" id = "menu2">'.esc_html__('Import / Update','wp-ultimate-csv-importer').'</a>
126
+ <a href="'. esc_url (admin_url() .'admin.php?page=sm-uci-managers') . '" class="nav-tab" id = "menu3">'.esc_html__('Manager','wp-ultimate-csv-importer').'</a>';
127
+ if(in_array('wp-ultimate-exporter/index.php', $active_plugins))
128
+ $menu .= '<a href="'. esc_url (admin_url() .'admin.php?page=sm-uci-export') . '" class="nav-tab" id = "menu4">'.esc_html__('Export','wp-ultimate-csv-importer').'</a>';
129
+ $menu .= '<a href="'. esc_url (admin_url() .'admin.php?page=sm-uci-settings') . '" class="nav-tab" id = "menu5">'.esc_html__('Settings','wp-ultimate-csv-importer').'</a>
130
+ <a href="'. esc_url (admin_url() .'admin.php?page=sm-uci-addons') . '" class="nav-tab" id = "menu6">'.esc_html__('Addons','wp-ultimate-csv-importer').'</a>
131
+ <a href="'. esc_url (admin_url() .'admin.php?page=sm-uci-support') . '" class="nav-tab" id = "menu7">'.esc_html__('Support','wp-ultimate-csv-importer').'</a>
132
  </h2>
133
  </div>
134
  <div id="notification_wp_csv"></div>';
135
+ echo $menu;
136
  $myDir = SM_UCI_DEFAULT_UPLOADS_DIR;
137
  if(is_dir($myDir)) {
138
  echo "<input type='hidden' id='is_found' name='is_found' value='dir found'/>";
212
  }
213
 
214
  public function show_export_screen() {
215
+ $active_plugins = get_option( "active_plugins" );
216
+ if(in_array('wp-ultimate-exporter/index.php', $active_plugins)){
217
+ global $expUci_admin;
218
+ $expUci_admin->show_export_screen();
219
+ }
220
+ else{
221
+ wp_redirect('admin.php?page=sm-uci-import'); die();
222
+ }
223
+
224
  }
225
 
226
  public function show_settings_screen() {
233
  return true;
234
  }
235
 
236
+ public function show_addon_screen()
237
+ {
238
+ include ('views/form-addons-view.php');
239
+ return true;
240
+ }
241
+
242
 
243
  public function show_notices($parseObj) {
244
 
491
  $fields = $this->CFSFields();
492
  break;
493
  case 'Billing And Shipping Information':
494
+ $active_plugins = get_option("active_plugins");
495
+ if(in_array('import-users/index.php', $active_plugins)){
496
+ global $userUci_admin;
497
+ $fields = $userUci_admin->billing_information_for_users();
498
+ }
499
  break;
500
  case 'WP e-Commerce Custom Fields':
501
  $fields = $this->WPeCommerceCustomFields();
admin/views/form-addons-view.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wp_ultimate_csv_importer_pro panel" style="margin-left: 5%;margin-right:7%;margin-top: 50px">
2
+ <h3 style="text-align: center;color: #ec3429;padding-bottom: 10px !important;"> MORE FREE ADDONS </h3>
3
+ </div>
4
+ <div class="card" style="float: left;width: 20%;margin-left: 5%;margin-right: 5%">
5
+ <h2 class="title6" style="font-size:medium;">Import Woocommerce</h2>
6
+ <hr class="divider3"/>
7
+ <b style="font-size: small;font-style: italic;">+ Few minutes import</b>
8
+ <p style="padding-left: 11%;">Import all Woocommerce products</p>
9
+ <b style="font-size: small;font-style: italic;">+ Custom Fields</b>
10
+ <div style="padding-left: 11%;"><p>Woocommerce Product Add-ons, Chained Products, Product Retailers, Returns and Warranty Request, Pre Order</div>
11
+ <b style="font-size: small;font-style: italic;">+ Supports</b>
12
+ <div style="padding-left: 11%;"><p>Easy import using CSV</p></div>
13
+ <b style="font-size: small;font-style: italic;">+ Drag & Drop</b>
14
+ <div style="padding-left: 11%;"><p>Ease Drag & drop import</p></div>
15
+
16
+ <a class="cus-button-3" href="https://wordpress.org/plugins/import-woocommerce/" target="blank">Install Now</a>
17
+
18
+ </div>
19
+ <div class="card" style="float: left;width: 20%;margin-left: 5%;margin-right: 5%">
20
+ <h2 class="title4" style="font-size:medium;">Import Users</h2>
21
+ <hr class="divider1"/>
22
+ <b style="font-size: small;font-style: italic;">+ Few minutes import</b>
23
+ <p style="padding-left: 11%;">Import all Users details</p>
24
+ <b style="font-size: small;font-style: italic;">+ Custom Fields</b>
25
+ <div style="padding-left: 11%;"><p>WP Members, Billing and Shipping Information</p></div>
26
+ <b style="font-size: small;font-style: italic;">+ Supports</b>
27
+ <div style="padding-left: 11%;"><p>Easy import using CSV</p></div>
28
+
29
+ <b style="font-size: small;font-style: italic;">+ Random password</b>
30
+ <div style="padding-left: 11%;"><p>If user password column is empty we will create random password and send it through email</p></div>
31
+ <a class="cus-button-1" href="https://wordpress.org/plugins/import-users/" target="blank">Install Now</a>
32
+
33
+ </div>
34
+ <div class="card" style="float: left;width: 20%;margin-left: 5%;">
35
+ <h2 class="title5" style="font-size:medium;">WP Ultimate Exporter</h2>
36
+ <hr class="divider2"/>
37
+ <b style="font-size: small;font-style: italic;">+ Few minutes Export</b>
38
+ <p style="padding-left: 11%;">Export all your data from wordpress </p>
39
+ <b style="font-size: small;font-style: italic;">+ Export Fields</b>
40
+ <div style="padding-left: 11%;"><p>Posts, Pages, Users, All Custom Fields, Woocommerce, Marketpress, Wpecommerce, Comments, Reviews</p></div>
41
+ <b style="font-size: small;font-style: italic;">+ Export Formats</b>
42
+ <div style="padding-left: 11%;"><p>Easy export as CSV</p></div>
43
+ <b style="font-size: small;font-style: italic;">+ Filters</b>
44
+ <div style="padding-left: 11%;"><p>Ease filters to export</p></div>
45
+
46
+ <a class="cus-button-2" href="https://wordpress.org/plugins/wp-ultimate-exporter/" target="blank">Install Now</a>
47
+
48
+ </div>
admin/views/form-advanced-mapping-configuration.php CHANGED
@@ -450,8 +450,12 @@ $ecommerce_module = array('WooCommerce', 'MarketPress', 'WPeCommerce', 'eShop');
450
  marketpress_lite_meta_api($template_mapping);
451
  }
452
  } else {
453
- require_once ('form-woocommerce-meta.php');
454
- woocommerce_meta_api($template_mapping);
 
 
 
 
455
  }
456
  ?>
457
  </div>
450
  marketpress_lite_meta_api($template_mapping);
451
  }
452
  } else {
453
+ if (in_array('import-woocommerce/index.php', $uci_admin->getActivePlugins() )) {
454
+ global $wcomUci_admin;
455
+ $wcomUci_admin->getWoocomDataHtml($template_mapping);
456
+ }
457
+ // require_once ('form-woocommerce-meta.php');
458
+ // woocommerce_meta_api($template_mapping);
459
  }
460
  ?>
461
  </div>
admin/views/form-export-data.php DELETED
@@ -1,448 +0,0 @@
1
- <?php
2
- /*********************************************************************************
3
- * WP Ultimate CSV Importer is a Tool for importing CSV for the Wordpress
4
- * plugin developed by Smackcoders. Copyright (C) 2016 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. 2016. All rights reserved".
36
- ********************************************************************************/
37
-
38
- if ( ! defined( 'ABSPATH' ) )
39
- exit; // Exit if accessed directly
40
- global $uci_admin;
41
- require_once SM_UCI_PRO_DIR . "includes/class-uci-exporter.php";
42
- $exporterObj = new SmackUCIExporter();
43
- $module = isset($_POST['export_type']) ? sanitize_text_field($_POST['export_type']) : 'Posts';
44
- $exportAs = '';
45
- if($module === 'CustomPosts') :
46
- $exportAs = isset($_POST['export_post_type']) ? sanitize_text_field($_POST['export_post_type']) : '';
47
- elseif($module === 'Taxonomies') :
48
- $exportAs = isset($_POST['export_taxo_type']) ? sanitize_text_field($_POST['export_taxo_type']) : '';
49
- endif;
50
- if (isset($_POST) && sizeof($_POST) != 0 ) {
51
- $exp_type = isset($_POST['export_type']) ? sanitize_text_field($_POST['export_type']) : '';
52
- $exp_post_type = isset($_POST['export_post_type']) ? sanitize_text_field($_POST['export_post_type']) : '';
53
- $mode = array(); $mode['exp_type'] = $exp_type;
54
- $mode['exp_post_type'] = $exp_post_type;
55
- update_option('csv_free_exporter_option', $mode);
56
- }
57
- else{
58
- $exp_option = get_option('csv_free_exporter_option');
59
- $module = $exp_option['exp_type'];
60
- if($module == 'CustomPosts')
61
- $exportAs = $exp_option['exp_post_type'];
62
- else
63
- $exportAs = '';
64
- }
65
- $exportAs = $uci_admin->import_post_types($module, $exportAs);
66
- if(is_array( $exportAs )) {
67
- $exportAs = $exportAs[$module];
68
- }
69
- $exportType = 'csv';
70
- $active_plugins = get_option('active_plugins');
71
- if( in_array( "woocommerce/woocommerce.php", $active_plugins) ) {
72
- $woo_dis = "";
73
- $woo_text = "";
74
- }
75
- else{
76
- $woo_dis = "disabled='disabled'";
77
- $woo_text = "title='WooCommerce is not activated'";
78
- }
79
- if( in_array( "eshop/eshop.php", $active_plugins) ) {
80
- $eshop_dis = "";
81
- $eshop_text = "";
82
- }
83
- else{
84
- $eshop_dis = "disabled='disabled'";
85
- $eshop_text = "title='Eshop is not activated'";
86
- }
87
- if( in_array( "wp-e-commerce/wp-shopping-cart.php", $active_plugins) ) {
88
- $wpcom_dis = "";
89
- $wpcom_text = "";
90
- }
91
- else{
92
- $wpcom_dis = "disabled='disabled'";
93
- $wpcom_text = "title='Wp-Commerce is not activated'";
94
- }
95
- if( in_array( "wordpress-ecommerce/marketpress.php", $active_plugins) || in_array( "marketpress/marketpress.php", $active_plugins) ) {
96
- $market_dis = "";
97
- $market_text = "";
98
- }
99
- else{
100
- $market_dis = "disabled='disabled'";
101
- $market_text = "title='MarketPress is not activated'";
102
- }
103
- if( in_array("wp-customer-reviews/wp-customer-reviews-3.php", $active_plugins) || in_array("wp-customer-reviews/wp-customer-reviews.php", $active_plugins) ) {
104
- $cusre_dis = "";
105
- $cusre_text = "";
106
- }
107
- else{
108
- $cusre_dis = "disabled='disabled'";
109
- $cusre_text = "title='CustomerReviews is not activated'";
110
- }
111
- ?>
112
- <div id='wp_warning' style = 'display:none;' class = 'error'></div>
113
- <?php if(!isset($_REQUEST['exportType'])) { ?>
114
- <div class="list-inline pull-right mb10 wp_ultimate_csv_importer_pro">
115
- <div class="col-md-6 mt10"><a href="https://goo.gl/jdPMW8" target="_blank"><?php echo esc_html__('Documentation','wp-ultimate-csv-importer');?></a></div>
116
- <div class="col-md-6 mt10"><a href="https://goo.gl/fKvDxH" target="_blank"><?php echo esc_html__('Sample CSV','wp-ultimate-csv-importer');?></a></div>
117
- </div>
118
- <form class="form-horizontal" method="post" name="exportmodule" id="exportmodule" action='<?php echo esc_url(add_query_arg(array('page'=> 'sm-uci-export', 'exportType'=>'export-with-filters'), admin_url() . "admin.php"))?>' onsubmit="return export_module();" >
119
- <div class="template_body whole_body wp_ultimate_csv_importer_pro" xmlns="http://www.w3.org/1999/html" style="margin-top: 40px;">
120
- <div id="exportaspecificmodule">
121
- <!-- <form class="form-horizontal" method="post" name="exportmodule" action="" onsubmit="return export_module();"> -->
122
- <div class="table-responsive" id="exporttable">
123
- <table class='table exportmodule'>
124
- <th colspan='2'><label class='h-exportmodule csv-importer-heading'><h3 id="innertitle"><?php echo esc_html__('Select your module to export the data','wp-ultimate-csv-importer')?> </h3></label></th>
125
- <tr>
126
- <td class='exportdatatype'><label> <input type="radio" name="export_type" value="Posts"><span id="align"><?php echo esc_html__('Post','wp-ultimate-csv-importer'); ?></span> </label></td>
127
- <td class='exportdatatype' <?php echo $eshop_text; ?> ><label> <input type="radio" name="export_type" <?php echo $eshop_dis; ?> value="eShop"><span id="align"><?php echo esc_html__('Eshop','wp-ultimate-csv-importer'); ?></span> </label></td>
128
- </tr>
129
- <tr>
130
- <td class='exportdatatype'><label> <input type="radio" name="export_type" value="Pages"><span id="align"> <?php echo esc_html__('Page','wp-ultimate-csv-importer'); ?></span> </label></td>
131
- <td class='exportdatatype' <?php echo $wpcom_text; ?> ><label> <input type="radio" name="export_type" <?php echo $wpcom_dis; ?> value="WPeCommerce"><span id="align"> <?php echo esc_html__('Wp-Commerce','wp-ultimate-csv-importer'); ?></span></label></td>
132
- </tr>
133
- <tr>
134
- <td class='exportdatatype' style="">
135
- <label> <input type="radio" name="export_type" value="CustomPosts"><span id="align"> <?php echo esc_html__('Custom Post','wp-ultimate-csv-importer'); ?></span></label>
136
- <select class="search_dropdown_mapping selectpicker" name="export_post_type" id="export_post_type" style="margin-left:10px;">
137
- <option><?php echo esc_html__('--Select--', 'wp-ultimate-csv-importer'); ?></option>
138
- <?php
139
- foreach (get_post_types() as $key => $value) {
140
- 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') && ($value !== 'acf-field') && ($value !== 'acf-field-group') && ($value !== '_pods_pod') && ($value !== '_pods_field') && ($value !== 'shop_order_refund') && ($value !== 'shop_webhook')) {
141
- ?>
142
- <option id="<?php echo($value); ?>"> <?php echo($value); ?> </option>
143
- <?php
144
- }
145
- }
146
- ?>
147
- </select>
148
- </td>
149
- <td class='exportdatatype' <?php echo $woo_text; ?> ><label><input type="radio" name="export_type" <?php echo $woo_dis; ?> value="WooCommerce"><span id="align"> <?php echo esc_html__('Woo-Commerce','wp-ultimate-csv-importer'); ?></span></label></td>
150
- </tr>
151
- <tr>
152
- <td class='exportdatatype'><label><input type="radio" name="export_type" value="Categories"><span id="align"> <?php echo esc_html__('Category','wp-ultimate-csv-importer'); ?></span></label></td>
153
- <td class='exportdatatype' <?php echo $market_text; ?> ><label><input type="radio" name="export_type" <?php echo $market_dis; ?> value="MarketPress"><span id="align"> <?php echo esc_html__('Marketpress','wp-ultimate-csv-importer'); ?></span></label></td>
154
- </tr>
155
- <tr>
156
- <td class='exportdatatype'><label><input type="radio" id="tags_id" name="export_type" value="Tags"><span id="align"> <?php echo esc_html__('Tags','wp-ultimate-csv-importer'); ?> </label></span></td>
157
- <td class='exportdatatype' <?php echo $cusre_text; ?> ><label> <input type="radio" name="export_type" <?php echo $cusre_dis; ?> value="CustomerReviews"><span id="align"> <?php echo esc_html__('Customer Reviews','wp-ultimate-csv-importer'); ?></span></label></td>
158
- </tr>
159
- <tr>
160
- <td class='exportdatatype' style="">
161
- <label> <input type="radio" name="export_type" value="Taxonomies"><span id="align"> <?php echo esc_html__('Taxonomies','wp-ultimate-csv-importer'); ?></span></label>
162
- <select class="search_dropdown_mapping selectpicker" name="export_taxo_type" id="export_taxo_type" style="margin-left:10px;">
163
- <option><?php echo esc_html__('--Select--','wp-ultimate-csv-importer'); ?></option>
164
- <?php
165
- foreach (get_taxonomies() as $key => $value) {
166
- 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')) {
167
- ?>
168
- <option id="<?php echo($value); ?>"> <?php echo($value); ?> </option>
169
- <?php
170
- }
171
- }
172
- ?>
173
- </select></td>
174
- <td class='exportdatatype'><label> <input type="radio" name="export_type" value="Comments"><span id="align"> <?php echo esc_html__('Comments','wp-ultimate-csv-importer'); ?></span></label></td>
175
- </tr>
176
- <tr>
177
- <td class='exportdatatype'><label> <input type="radio" name="export_type" value="Users"><span id="align"> <?php echo esc_html__('Users','wp-ultimate-csv-importer'); ?></span></label></td>
178
- <td class='exportdatatype'></td>
179
- </tr>
180
- </table>
181
- <div class='' style="padding: 15px;float: right;"><input type="submit" name="proceedtoexclusion" value="<?php echo esc_html__('Proceed','wp-ultimate-csv-importer');?>" class='smack-btn smack-btn-primary btn-radius'></div>
182
- </div>
183
- </div>
184
- <!--<div class='col-sm-3'><input type="submit" name="exportbutton" value="Export" class='smack-btn smack-btn-primary btn-radius'></div> -->
185
- </form>
186
- </div>
187
- <?php } ?>
188
-
189
- <?php $exportType = isset($_REQUEST['exportType']) ? sanitize_text_field($_REQUEST['exportType']) : '' ;
190
- if($exportType) :
191
- ?>
192
- <div style="width: 98%;" class="template_body whole_body wp_ultimate_csv_importer_pro">
193
- <form name="export_filters" id="export_filters" method="post" action="<?php #echo admin_url('admin-ajax.php'); ?>" >
194
- <?php wp_nonce_field('export_file','my-nonce'); ?>
195
- <input name="action" value="export_file" type="hidden">
196
- <input type="hidden" name="moduletobeexport" id="moduletobeexport" value="<?php echo $module; ?>" >
197
- <input type="hidden" name="optional_type" id="optional_type" value="<?php echo $exportAs; ?>" >
198
- <input type="hidden" name="offset" id="offset" value="0" >
199
- <input type="hidden" name="limit" id="limit" value="1000" >
200
- <input type="hidden" name="total_row_count" id="total_row_count" value="" >
201
- <p>
202
- <div class="csv-importer-heading"><h4 class="media_styles"><?php echo esc_html__('To export data based on the filters','wp-ultimate-csv-importer'); ?></h4></div>
203
- <p>
204
- <label class="media_styles"><?php echo esc_html__('Export File Name:','wp-ultimate-csv-importer');?></label>
205
- <input class='form-control' type='text' name='export_filename' id='export_filename' value='' placeholder="export_as_<?php echo(date("Y-m-d")); ?>" size="18" style="width:50% !important;">
206
- <a id="download_file_link" href="" target="_blank" class="col-sm-4" style="margin-top: -35px; float: right; display: none;"> <input type="button" name="download_file" id="download_file" class="smack-btn smack-btn-primary btn-radius" style="display: none;" value="Download"></a>
207
- </p>
208
- <label class="media_styles">
209
- <input type='checkbox' name='getdatawithdelimiter' id='getdatawithdelimiter' value='getdatawithdelimiter' onclick='addexportfilter(this.id);' /><span id="align"> <?php echo esc_html__('Export data with auto delimiters');?></span></label>
210
-
211
- <div id='delimiterstatus' class="col-md-12" style='padding:15px;display:none;'>
212
- <div class="col-md-5 col-md-offset-1">
213
- <label class="export_label"> <?php echo esc_html__('Delimiters','wp-ultimate-csv-importer');?> </label><br>
214
- <select class="selectpicker" name='postwithdelimiter' id='postwithdelimiter' class="search_dropdown_mapping selectpicker">
215
- <option>Select</option>
216
- <option>,</option>
217
- <option>:</option>
218
- <option>;</option>
219
- <option>{Tab}</option>
220
- <option>{Space}</option>
221
- </select></div>
222
- <div class="col-md-5"><label class="export_label"><?php echo esc_html__('Other Delimiters','wp-ultimate-csv-importer');?></label> <input type = 'text' class="form-control" name='other_delimiter' id ='other_delimiter' style="width:75% !important;" size=6>
223
- </div>
224
- </div>
225
-
226
- </p>
227
- <?php
228
- $disable_export_option = isset($module) ? sanitize_text_field($module) : '';
229
- if($disable_export_option == 'Tags' || $disable_export_option == 'Categories' || $disable_export_option == 'Taxonomies' || $disable_export_option == 'CustomerReviews' || $disable_export_option == 'Comments' || $disable_export_option == 'Users'){
230
- $disabled = 'hidden';
231
- }
232
- else {
233
- $disabled = '';
234
- }
235
- ?>
236
- <p>
237
- <label class="media_styles" <?php echo $disabled ?> ><input type='checkbox' name='getdataforspecificperiod' id='getdataforspecificperiod' value='getdataforspecificperiod' onclick='addexportfilter(this.id);' /><span id="align"> <?php echo esc_html__('Export data for the specific period','wp-ultimate-csv-importer');?></span></label>
238
- <div id='specificperiodexport' class="col-md-12" style='padding:10px;display:none;'>
239
- <div class="col-md-5 col-md-offset-1"><b><label class="export_label"> <?php echo esc_html__('Start From','wp-ultimate-csv-importer');?></label> </b> <input type='text' class='form-control' readonly="readonly" name='postdatefrom' style='cursor:default;width:75% !important;' id='postdatefrom' value='' onchange='validateDateIntervals();' /></div>
240
- <div class="col-md-5"><b><label class="export_label"><?php echo esc_html__('End To','wp-ultimate-csv-importer');?> </label></b> <input type='text' class='form-control' name='postdateto' readonly="readonly" style='cursor:default;width:75% !important;' id='postdateto' value='' onchange='validateDateIntervals();'/>
241
- <input type='hidden' name='nonce' id='nonce' value='<?php if(isset($noncedata)) { echo $noncedata; } ?>'></div>
242
- </div>
243
- </p>
244
- <?php if($exportType !== 'users' && $exportType !== 'categories' && $exportType !== 'tags' && $exportType !== 'customtaxonomy' && $exportType !== 'customerreviews' && $exportType !== 'comments') { ?>
245
- <p>
246
- <label class="media_styles" <?php echo $disabled ?> >
247
-
248
- <input type='checkbox' name='getdatawithspecificstatus' id='getdatawithspecificstatus' value='getdatawithspecificstatus' onclick='addexportfilter(this.id);'/><span id="align"> <?php echo esc_html__('Export data with the specific status','wp-ultimate-csv-importer');?></span></label>
249
- <div id='specificstatusexport' class="col-md-12" style='padding:15px;display:none;'>
250
- <div class="col-md-2 col-md-offset-1">
251
- <label class="export_label"> <?php echo esc_html__('Status','wp-ultimate-csv-importer'); ?> </label></div>
252
- <div class=""><select name='specific_status' id='specific_status' class="search_dropdown_mapping selectpicker">
253
- <option><?php echo esc_html__('All','wp-ultimate-csv-importer'); ?></option>
254
- <option><?php echo esc_html__('Publish','wp-ultimate-csv-importer'); ?></option>
255
- <option><?php echo esc_html__('Sticky','wp-ultimate-csv-importer'); ?></option>
256
- <option><?php echo esc_html__('Private','wp-ultimate-csv-importer'); ?></option>
257
- <option><?php echo esc_html__('Protected','wp-ultimate-csv-importer'); ?></option>
258
- <option><?php echo esc_html__('Draft','wp-ultimate-csv-importer'); ?></option>
259
- <option><?php echo esc_html__('Pending','wp-ultimate-csv-importer'); ?></option>
260
- </select>
261
- </div>
262
- </div>
263
- </p>
264
- <?php } ?>
265
- <?php if($exportType !== 'users' && $exportType !== 'categories' && $exportType !== 'tags' && $exportType !== 'customtaxonomy' && $exportType !== 'customerreviews') { ?>
266
- <p>
267
- <label class="media_styles" <?php echo $disabled ?> ><input type='checkbox' name='getdatabyspecificauthors' id='getdatabyspecificauthors' value='getdatabyspecificauthors' onclick='addexportfilter(this.id);' /><span id="align"> <?php echo esc_html__('Export data by specific authors','wp-ultimate-csv-importer');?></span></label>
268
- <div id='specificauthorexport' class="col-md-12" style='padding:15px;display:none;'>
269
- <div class="col-md-2 col-md-offset-1">
270
- <label class="export_label"> <?php echo esc_html__('Authors','wp-ultimate-csv-importer'); ?> </label></div>
271
- <div><?php $blogusers = get_users( 'blog_id=1&orderby=nicename' ); #TODO: Need to change the blog id based on the blog. ?>
272
- <select name='specific_authors' id='specific_authors' class="search_dropdown_mapping selectpicker">
273
- <option value='0'><?php echo esc_html__('All','wp-ultimate-csv-importer'); ?></option>
274
- <?php foreach( $blogusers as $user ) { ?>
275
- <option value='<?php echo esc_html( $user->ID ); ?>'> <?php echo esc_html( $user->display_name ); ?> </option>
276
- <?php } ?>
277
- </select>
278
- </div>
279
- </div>
280
- </p>
281
- <?php } ?>
282
- <p>
283
- <label class="media_styles"><input type='checkbox' name='getdatabasedonexclusions' id='getdatabasedonexclusions' value='getdatabasedonexclusions' onclick='addexportfilter(this.id);' /><span id="align"> <?php echo esc_html__('Export data based on specific inclusions','wp-ultimate-csv-importer');?> </span></label>
284
- <div id="exclusiongrouplist" style="display:none;">
285
- <?php
286
- $shortLabel = $shortName = '';
287
- $node = 1;
288
- $exportData = $exporterObj->exportData( $module, $exportType, $exportAs, '', array(), '', '' );
289
- // Get the headers for the export feature
290
- $integrations = $uci_admin->available_widgets( $module, $exportAs );
291
- if ( ! empty( $integrations ) ) :
292
- foreach ( $integrations as $widget_name => $plugin_file ) {
293
- $widget_slug = strtolower(str_replace(' ', '_', $widget_name));
294
- $fields = $uci_admin->get_widget_fields( $widget_name, $module, $exportAs ); ?>
295
- <?php
296
- ?>
297
- <div class="panel-group" id='accordion' style = "width:98.3%;margin-top:-5px;padding-bottom: 20px;">
298
- <div class='panel panel-default' data-target="#<?php echo $widget_slug;?>" data-parent="#accordion">
299
- <div class='panel-heading' style='width:100%' onclick="toggle_func('<?php echo $widget_slug;?>');">
300
- <div id= "corehead" class="panel-title"> <b style=""> <?php echo $widget_name ?> </b>
301
- <span class = 'glyphicon glyphicon-plus' id = '<?php echo $widget_slug ?>' style="float:right;"> </span>
302
- </div>
303
- </div>
304
- <div id='<?php echo $widget_slug;?>toggle' style="height:auto;">
305
- <div class="grouptitlecontent " id="corefields_content">
306
- <?php
307
- foreach ($fields as $groupName => $fieldInfo) {
308
- if(is_array($fieldInfo) && !empty($fieldInfo)) {
309
- $fields_count = count($fieldInfo);
310
- $set_row_count = ceil( $fields_count / 4 );
311
- $i=1; $j=1;
312
- echo "<div style='padding: 10px 10px 60px 10px;'>";
313
- foreach ( $fieldInfo as $fKey => $fVal ) {
314
- if ( strlen( $fVal['label'] ) > 26 ) {
315
- $shortLabel = substr( $fVal['label'], 0, 25 ) . '..';
316
- } else {
317
- $shortLabel = $fVal['label'];
318
- }
319
- if ( strlen( $fVal['name'] ) > 20 ) {
320
- $shortName = substr( $fVal['name'], 0, 19 ) . '..';
321
- } else {
322
- $shortName = $fVal['name'];
323
- }
324
- echo "<span class='col-sm-3 exclusion-list'><label title = '{$fVal['label']}'><input type='checkbox' class='TYPES_class' name='".$fVal['name']."' id='column".$node."' onclick='exportexclusion(this.name, this.id);' />" . $shortLabel . "</label><label title = '{$fVal['name']}' class = 'samptxt'>[ " . $shortName . " ]</label></span>";
325
- if(ceil($i % 4) == 0) {
326
- if($j <= $set_row_count) {
327
- echo "</div><div style='padding: 10px 10px 60px 10px;'>";
328
- } else {
329
- echo "</div>";
330
- }
331
- $j++;
332
- }
333
- $i++;
334
- $node++;
335
- }
336
- #die;
337
- if($j >= $set_row_count)
338
- echo "</div>";
339
- if($exportType === 'users'){
340
- $set_group_height = $set_row_count * 45;
341
- $set_group_height = "$set_group_height" +"100"."px";
342
- }
343
- else {
344
- $set_group_height = $set_row_count * 35;
345
- #$set_group_height = "$set_group_height" +"100"."px";
346
- }
347
- } else {
348
- echo "<p style='color:red;text-align:center;padding:20px;'>"; echo esc_html__('No fields Found!','wp-ultimate-csv-importer'); echo "</p>";
349
- $set_group_height = 'auto';
350
- }
351
- }
352
- ?>
353
- </div>
354
- </div>
355
- <script type="text/javascript">
356
- document.getElementById('<?php echo $widget_slug;?>toggle').style.height = '<?php echo $set_group_height; ?>';
357
- </script>
358
- </div>
359
- </div>
360
- <?php }
361
- endif;
362
- #print '</pre>';
363
- ?>
364
- </div>
365
- </p>
366
- <script type = 'text/javascript'>
367
- jQuery(document).ready(function() {
368
- jQuery('#postdatefrom').datepicker({
369
- dateFormat : 'yy-mm-dd'
370
- });
371
- jQuery('#postdateto').datepicker({
372
- dateFormat : 'yy-mm-dd'
373
- });
374
- });
375
- </script>
376
- <div class="col-md-12 mt15">
377
- <div class="pull-left"><input name="backtomodulechooser" id="backtomodulechooser" value="<?php echo esc_attr__('Back','wp-ultimate-csv-importer');?>" class="smack-btn btn-default btn-radius" style="" onclick="window.location.href = '<?php echo esc_url(admin_url() . 'admin.php?page=sm-uci-export'); ?>'" type="button"></div>
378
- <div class="pull-right mb15"><input name="proceed_to_export" id="proceed_to_export" value="<?php echo esc_attr__('Export','wp-ultimate-csv-importer');?>" class="smack-btn smack-btn-primary btn-radius export_continuebtn" onclick="igniteExport();" type="button"></div></div><div class="clearfix"></div>
379
- </form>
380
- </div>
381
- <?php endif; ?>
382
- <script>
383
- jQuery(function(){
384
- var current_effect = jQuery('#waitMe_ex_effect').val();
385
- jQuery('#proceed_to_export').click(function(){
386
- var fileName = jQuery('#export_filename').val();
387
- if( fileName == '')
388
- return false;
389
- run_waitMe(current_effect);
390
- });
391
- jQuery('#waitMe_ex_close').click(function(){
392
- jQuery('#wpwrap').waitMe('hide');
393
- });
394
- jQuery('#waitMe_ex_effect').change(function(){
395
- current_effect = jQuery(this).val();
396
- run_waitMe(current_effect);
397
- });
398
- jQuery('#waitMe_ex_effect').click(function(){
399
- current_effect = jQuery(this).val();
400
- });
401
- function run_waitMe(effect){
402
- jQuery('#wpwrap').waitMe({
403
- effect: effect,
404
- text: 'Please wait, Your export is in progress...',
405
- bg: 'rgba(255,255,255,0.7)',
406
- color: '#47A447',
407
- maxSize: '',
408
- source: 'img.svg',
409
- onClose: function() {}
410
- });
411
- }
412
- var current_body_effect = jQuery('#waitMe_ex_body_effect').val();
413
- jQuery('#waitMe_ex_body').click(function(){
414
- run_waitMe_body(current_body_effect);
415
- });
416
- jQuery('#waitMe_ex_body_effect').change(function(){
417
- current_body_effect = jQuery(this).val();
418
- run_waitMe_body(current_body_effect);
419
- });
420
- function run_waitMe_body(effect){
421
- jQuery('body').addClass('waitMe_body');
422
- var img = '';
423
- var text = '';
424
- if(effect == 'img'){
425
- img = 'background:url(\'img.svg\')';
426
- } else if(effect == 'text'){
427
- text = 'Loading...';
428
- }
429
- var elem = jQuery('<div class="waitMe_container ' + effect + '"><div style="' + img + '">' + text + '</div></div>');
430
- jQuery('body').prepend(elem);
431
- setTimeout(function(){
432
- jQuery('body.waitMe_body').addClass('hideMe');
433
- setTimeout(function(){
434
- jQuery('body.waitMe_body').find('.waitMe_container:not([data-waitme_id])').remove();
435
- jQuery('body.waitMe_body').removeClass('waitMe_body hideMe');
436
- },200);
437
- },4000);
438
- }
439
- });
440
- jQuery('#postdatefrom').datepicker({
441
- format: 'yyyy-mm-dd',
442
- });
443
- jQuery('#postdateto').datepicker({
444
- format: 'yyyy-mm-dd',
445
- });
446
- </script>
447
-
448
- <div style="font-size: 15px;text-align: center;padding-top: 20px">Powered by <a href="https://www.smackcoders.com?utm_source=wordpress&utm_medium=plugin&utm_campaign=free_csv_importer" target="blank">Smackcoders</a>.</div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/form-file-import-method.php CHANGED
@@ -39,6 +39,13 @@ if ( ! defined( 'ABSPATH' ) )
39
  exit; // Exit if accessed directly
40
  $ucisettings = get_option('sm_uci_pro_settings');
41
  $main_mode = isset($ucisettings['enable_main_mode']) ? $ucisettings['enable_main_mode'] : '';
 
 
 
 
 
 
 
42
  ?>
43
  <div class="whole_body wp_ultimate_csv_importer_pro">
44
  <form class="form-horizontal" id="form_import_file" method="post" action= "<?php echo esc_url(admin_url() . 'admin.php?page=sm-uci-import&step=suggested_template');?>" enctype="multipart/form-data">
@@ -49,6 +56,11 @@ $main_mode = isset($ucisettings['enable_main_mode']) ? $ucisettings['enable_main
49
  <?php if($main_mode == 'on') { ?>
50
  <div id='wp_warning_main' style = 'margin-top: 10px;font-size: 15px;color: red;' class = 'error' > Maintenance mode is enabled. <a style="cursor: pointer;" onclick="saveoptions('main_check_import_off', 'off')"> Disable </a> </div>
51
  <?php } ?>
 
 
 
 
 
52
  <div id='wp_warning' style = 'display:none;' class = 'error'></div>
53
  <input type='hidden' id="siteurl" value="<?php echo site_url(); ?>" />
54
  <!-- Code Added For POP UP Starts here -->
@@ -96,14 +108,17 @@ $main_mode = isset($ucisettings['enable_main_mode']) ? $ucisettings['enable_main
96
  <a id="2" href="#" class="list-group-item text-left" disabled="disabled">
97
  <h4 class="glyphicon glyphicon-upload icon-upload"></h4>
98
  <?php echo esc_html__('Upload from FTP/SFTP','wp-ultimate-csv-importer');?>
 
99
  </a>
100
  <a id="3" href="#" class="list-group-item text-left" disabled="disabled">
101
  <h4 class="glyphicon glyphicon-upload icon-link2"></h4>
102
  <?php echo esc_html__('Upload from URL','wp-ultimate-csv-importer');?>
 
103
  </a>
104
  <a id="4" href="#" class="list-group-item text-left" disabled="disabled">
105
  <h4 class="glyphicon glyphicon-upload icon-tree"></h4>
106
  <?php echo esc_html__('Choose File in the Server','wp-ultimate-csv-importer');?>
 
107
  </a>
108
  </div>
109
  </div>
39
  exit; // Exit if accessed directly
40
  $ucisettings = get_option('sm_uci_pro_settings');
41
  $main_mode = isset($ucisettings['enable_main_mode']) ? $ucisettings['enable_main_mode'] : '';
42
+ $active_plugins = get_option( "active_plugins" );
43
+ if (!in_array('import-users/index.php', $active_plugins)) {
44
+ $user_import = 'no';
45
+ }
46
+ else{
47
+ $user_import = 'yes';
48
+ }
49
  ?>
50
  <div class="whole_body wp_ultimate_csv_importer_pro">
51
  <form class="form-horizontal" id="form_import_file" method="post" action= "<?php echo esc_url(admin_url() . 'admin.php?page=sm-uci-import&step=suggested_template');?>" enctype="multipart/form-data">
56
  <?php if($main_mode == 'on') { ?>
57
  <div id='wp_warning_main' style = 'margin-top: 10px;font-size: 15px;color: red;' class = 'error' > Maintenance mode is enabled. <a style="cursor: pointer;" onclick="saveoptions('main_check_import_off', 'off')"> Disable </a> </div>
58
  <?php } ?>
59
+ <input type="hidden" id="check_user_import" value="<?php echo $user_import; ?>">
60
+ <div id='user_import_warning' class = 'notice notice-warning is-dismissible' style="display: none;">
61
+ <p> Importing User feature in Ultimate CSV Importer FREE moved to a separate add-on. To continue import users, kindly install <a href="https://wordpress.org/plugins/import-users/" target="blank">Import Users</a> addon.
62
+ </p></div>
63
+
64
  <div id='wp_warning' style = 'display:none;' class = 'error'></div>
65
  <input type='hidden' id="siteurl" value="<?php echo site_url(); ?>" />
66
  <!-- Code Added For POP UP Starts here -->
108
  <a id="2" href="#" class="list-group-item text-left" disabled="disabled">
109
  <h4 class="glyphicon glyphicon-upload icon-upload"></h4>
110
  <?php echo esc_html__('Upload from FTP/SFTP','wp-ultimate-csv-importer');?>
111
+ <span style="background-color: #ec3939 !important" class="new badge">Pro</span>
112
  </a>
113
  <a id="3" href="#" class="list-group-item text-left" disabled="disabled">
114
  <h4 class="glyphicon glyphicon-upload icon-link2"></h4>
115
  <?php echo esc_html__('Upload from URL','wp-ultimate-csv-importer');?>
116
+ <span style="background-color: #ec3939 !important" class="new badge">Pro</span>
117
  </a>
118
  <a id="4" href="#" class="list-group-item text-left" disabled="disabled">
119
  <h4 class="glyphicon glyphicon-upload icon-tree"></h4>
120
  <?php echo esc_html__('Choose File in the Server','wp-ultimate-csv-importer');?>
121
+ <span style="background-color: #ec3939 !important" class="new badge">Pro</span>
122
  </a>
123
  </div>
124
  </div>
admin/views/form-manager-view.php CHANGED
@@ -38,6 +38,7 @@
38
  if ( ! defined( 'ABSPATH' ) )
39
  exit; // Exit if accessed directly
40
  #Removed: Helper class inclusion for managers.
 
41
  ?>
42
  <div class="list-inline pull-right mb10 wp_ultimate_csv_importer_pro">
43
  <div class="col-md-6 mt10"><a href="https://goo.gl/jdPMW8" target="_blank"><?php echo esc_html__('Documentation','wp-ultimste-csv-importer');?></a></div>
@@ -53,9 +54,11 @@ if ( ! defined( 'ABSPATH' ) )
53
  <li id='1' class="bg-leftside selected">
54
  <a style="font-size: 17px;" href="<?php echo esc_url(add_query_arg(array('page' => 'sm-uci-managers','step' => 'filemanager')));?>"><span class="icon-copy-file"></span><?php echo esc_html__('File Manager','wp-ultimate-csv-importer');?></a>
55
  </li>
 
56
  <li id='2' class="bg-leftside">
57
  <a style="font-size: 17px;" href="<?php echo esc_url(add_query_arg(array('page' => 'sm-uci-managers','step' => 'schedulemanager')));?>"><span class="icon-calendar3"></span><?php echo esc_html__('Smart Schedule','wp-ultimate-csv-importer');?></a>
58
  </li>
 
59
  <li id='3' class="bg-leftside">
60
  <a style="font-size: 17px;" href="<?php echo esc_url(add_query_arg(array('page' => 'sm-uci-managers','step' => 'templatemanager')));?>"><span class="icon-insert-template"></span><?php echo esc_html__('Templates','wp-ultimate-csv-importer');?></a></li>
61
  <!--<li id='4' class="bg-leftside notselect">
38
  if ( ! defined( 'ABSPATH' ) )
39
  exit; // Exit if accessed directly
40
  #Removed: Helper class inclusion for managers.
41
+ $active_plugins = get_option( "active_plugins" );
42
  ?>
43
  <div class="list-inline pull-right mb10 wp_ultimate_csv_importer_pro">
44
  <div class="col-md-6 mt10"><a href="https://goo.gl/jdPMW8" target="_blank"><?php echo esc_html__('Documentation','wp-ultimste-csv-importer');?></a></div>
54
  <li id='1' class="bg-leftside selected">
55
  <a style="font-size: 17px;" href="<?php echo esc_url(add_query_arg(array('page' => 'sm-uci-managers','step' => 'filemanager')));?>"><span class="icon-copy-file"></span><?php echo esc_html__('File Manager','wp-ultimate-csv-importer');?></a>
56
  </li>
57
+ <?php if(in_array('wp-ultimate-exporter/index.php', $active_plugins)) { ?>
58
  <li id='2' class="bg-leftside">
59
  <a style="font-size: 17px;" href="<?php echo esc_url(add_query_arg(array('page' => 'sm-uci-managers','step' => 'schedulemanager')));?>"><span class="icon-calendar3"></span><?php echo esc_html__('Smart Schedule','wp-ultimate-csv-importer');?></a>
60
  </li>
61
+ <?php } ?>
62
  <li id='3' class="bg-leftside">
63
  <a style="font-size: 17px;" href="<?php echo esc_url(add_query_arg(array('page' => 'sm-uci-managers','step' => 'templatemanager')));?>"><span class="icon-insert-template"></span><?php echo esc_html__('Templates','wp-ultimate-csv-importer');?></a></li>
64
  <!--<li id='4' class="bg-leftside notselect">
admin/views/form-settings-view.php CHANGED
@@ -62,6 +62,9 @@ if(!empty($droptable)){
62
  $drop_table_status = "";
63
  }
64
  }
 
 
 
65
  if(!empty($schedule_mail)){
66
  if($schedule_mail == 'on'){
67
  $data['mail_on'] = 'enablesetting';
62
  $drop_table_status = "";
63
  }
64
  }
65
+ else
66
+ $drop_table_status = "";
67
+
68
  if(!empty($schedule_mail)){
69
  if($schedule_mail == 'on'){
70
  $data['mail_on'] = 'enablesetting';
assets/css/ultimate-importer.css CHANGED
@@ -905,9 +905,105 @@ font-family: "open sans";
905
  text-align: center;
906
  font-weight: 300;
907
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
908
  .divider {
909
  border-bottom: 1px solid #febbbb;
910
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
911
  .button {background-color: #c635ea;border: none;color: white;padding: 15px 32px;text-align: center;text-decoration: none;display: inline-block;font-size: 16px;margin: 4px 2px;cursor: pointer;color: #fff!important;
912
  border-color: #c635ea!important;background: #c635ea!important;-webkit-box-shadow: 0 1px 0 #c635ea!important;box-shadow: 0 1px 0 #c635ea!important;vertical-align: top;width: 100%;}
913
  .cus-button {background-color: #fc7e0a;border: none!important;color: white;padding: 2px 32px!important;text-align: center;text-decoration: none;display: inline-block;font-size: 16px;margin: 4px 2px;cursor: pointer;color: #fff!important;
905
  text-align: center;
906
  font-weight: 300;
907
  }
908
+ .title4 {
909
+
910
+ color: #137e13;
911
+ text-align: center;
912
+ font-weight: 300;
913
+ }
914
+ .title5 {
915
+
916
+ color: #2f64ab;
917
+ text-align: center;
918
+ font-weight: 300;
919
+ }
920
+ .title6 {
921
+
922
+ color: #860a51;
923
+ text-align: center;
924
+ font-weight: 300;
925
+ }
926
+
927
+ .cus-button-1 {
928
+ background-color: #137e13;
929
+ border: none!important;
930
+ color: white;
931
+ padding: 2px 32px!important;
932
+ text-align: center;
933
+ text-decoration: none;
934
+ display: inline-block;
935
+ font-size: 16px;
936
+ margin: 4px 2px;
937
+ cursor: pointer;
938
+ color: #fff!important;
939
+ border-color:#137e13!important;
940
+ background: #137e13!important;
941
+ -webkit-box-shadow: 0 1px 0 #137e13!important;
942
+ box-shadow: 0 1px 0 #137e13!important;
943
+ vertical-align: top;
944
+ width: 100%;
945
+ text-decoration: none!important;
946
+ }
947
+
948
+ .cus-button-2 {
949
+ text-decoration: none!important;
950
+ background-color: #2f64ab;
951
+ border: none!important;
952
+ color: white;
953
+ padding: 2px 32px!important;
954
+ text-align: center;
955
+ text-decoration: none;
956
+ display: inline-block;
957
+ font-size: 16px;
958
+ margin: 4px 2px;
959
+ cursor: pointer;
960
+ color: #fff!important;
961
+ border-color:#2f64ab!important;
962
+ background: #2f64ab!important;
963
+ -webkit-box-shadow: 0 1px 0 #2f64ab!important;
964
+ box-shadow: 0 1px 0 #2f64ab!important;
965
+ vertical-align: top;
966
+ width: 100%;
967
+ }
968
+
969
+ .cus-button-3 {
970
+ text-decoration: none!important;
971
+ background-color: #860a51;
972
+ border: none!important;
973
+ color: white;
974
+ padding: 2px 32px!important;
975
+ text-align: center;
976
+ text-decoration: none;
977
+ display: inline-block;
978
+ font-size: 16px;
979
+ margin: 4px 2px;
980
+ cursor: pointer;
981
+ color: #fff!important;
982
+ border-color:#860a51!important;
983
+ background: #860a51!important;
984
+ -webkit-box-shadow: 0 1px 0 #860a51!important;
985
+ box-shadow: 0 1px 0 #860a51!important;
986
+ vertical-align: top;
987
+ width: 100%;
988
+ }
989
+
990
+
991
  .divider {
992
  border-bottom: 1px solid #febbbb;
993
  }
994
+
995
+ .divider1 {
996
+ border-bottom: 1px solid #2fab51;
997
+ }
998
+
999
+ .divider2 {
1000
+ border-bottom: 1px solid #2f64ab;
1001
+ }
1002
+
1003
+ .divider3 {
1004
+ border-bottom: 1px solid #860a51;
1005
+ }
1006
+
1007
  .button {background-color: #c635ea;border: none;color: white;padding: 15px 32px;text-align: center;text-decoration: none;display: inline-block;font-size: 16px;margin: 4px 2px;cursor: pointer;color: #fff!important;
1008
  border-color: #c635ea!important;background: #c635ea!important;-webkit-box-shadow: 0 1px 0 #c635ea!important;box-shadow: 0 1px 0 #c635ea!important;vertical-align: top;width: 100%;}
1009
  .cus-button {background-color: #fc7e0a;border: none!important;color: white;padding: 2px 32px!important;text-align: center;text-decoration: none;display: inline-block;font-size: 16px;margin: 4px 2px;cursor: pointer;color: #fff!important;
assets/js/ultimate-importer.js CHANGED
@@ -331,7 +331,15 @@ function upload_method(){
331
  var splitaction = get_current_action.split("&");
332
  var action = splitaction[0] + '&step=mapping_config&istemplate=no&eventkey=' + file.eventkey;
333
  }
334
- jQuery('.selectpicker').selectpicker('val', priority_result['type']);
 
 
 
 
 
 
 
 
335
  } else {
336
  var splitaction = get_current_action.split("&");
337
  var action = splitaction[0] + '&step=mapping_config&istemplate=no&eventkey=' + file.eventkey;
@@ -676,9 +684,10 @@ jQuery(document).ready(function () {
676
  pages[3] = 'sm-uci-managers';
677
  pages[4] = 'sm-uci-export';
678
  pages[5] = 'sm-uci-settings';
679
- pages[6] = 'sm-uci-support';
 
680
 
681
- for(var i=1; i<=6; i++){
682
  if(activeModule == pages[i]) {
683
  jQuery('#menu'+i).addClass("nav-tab-active");
684
  }
@@ -1609,6 +1618,7 @@ function igniteExport() {
1609
  jQuery('#offset').val(response.new_offset);
1610
  if (parseInt(response.total_row_count) < parseInt(response.new_offset)) {
1611
  jQuery('#wpwrap').waitMe('hide');
 
1612
  return false;
1613
  }
1614
  igniteExport();
331
  var splitaction = get_current_action.split("&");
332
  var action = splitaction[0] + '&step=mapping_config&istemplate=no&eventkey=' + file.eventkey;
333
  }
334
+ jQuery('.selectpicker').selectpicker('val', priority_result['type']);
335
+ var checkvalue = jQuery('.selectpicker').val();
336
+ if(checkvalue == null)
337
+ jQuery('.selectpicker').selectpicker('val', 'Posts');
338
+ if(priority_result['type'] == 'Users'){
339
+ if(document.getElementById('check_user_import').value == 'no'){
340
+ document.getElementById('user_import_warning').style.display = 'block';
341
+ }
342
+ }
343
  } else {
344
  var splitaction = get_current_action.split("&");
345
  var action = splitaction[0] + '&step=mapping_config&istemplate=no&eventkey=' + file.eventkey;
684
  pages[3] = 'sm-uci-managers';
685
  pages[4] = 'sm-uci-export';
686
  pages[5] = 'sm-uci-settings';
687
+ pages[6] = 'sm-uci-addons';
688
+ pages[7] = 'sm-uci-support';
689
 
690
+ for(var i=1; i<=7; i++){
691
  if(activeModule == pages[i]) {
692
  jQuery('#menu'+i).addClass("nav-tab-active");
693
  }
1618
  jQuery('#offset').val(response.new_offset);
1619
  if (parseInt(response.total_row_count) < parseInt(response.new_offset)) {
1620
  jQuery('#wpwrap').waitMe('hide');
1621
+ jQuery("html, body").animate({ scrollTop: 0 }, "slow");
1622
  return false;
1623
  }
1624
  igniteExport();
includes/class-uci-admin-ajax.php CHANGED
@@ -402,8 +402,8 @@ class SmackUCIAdminAjax {
402
  }
403
 
404
  public static function parseDataToExport() {
405
- global $wpdb, $uci_admin;
406
- require_once ('class-uci-exporter.php');
407
  die();
408
  }
409
 
@@ -619,6 +619,9 @@ class SmackUCIAdminAjax {
619
  } elseif(in_array('comment_author', $Headers) || in_array('comment_content', $Headers) || in_array('comment_approved', $Headers) ){
620
  $type = 'Comments';
621
  }
 
 
 
622
 
623
  /*
624
  * Note: Removed auto detect type of module for the below lists
402
  }
403
 
404
  public static function parseDataToExport() {
405
+ global $expUci_admin;
406
+ $expUci_admin->includeExp();
407
  die();
408
  }
409
 
619
  } elseif(in_array('comment_author', $Headers) || in_array('comment_content', $Headers) || in_array('comment_approved', $Headers) ){
620
  $type = 'Comments';
621
  }
622
+ elseif (in_array('sku', $Headers)) {
623
+ $type = 'WooCommerce';
624
+ }
625
 
626
  /*
627
  * Note: Removed auto detect type of module for the below lists
includes/class-uci-email-scheduler.php DELETED
@@ -1,66 +0,0 @@
1
- <?php
2
- /*********************************************************************************
3
- * WP Ultimate CSV Importer is a Tool for importing CSV for the Wordpress
4
- * plugin developed by Smackcoders. Copyright (C) 2016 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. 2016. All rights reserved".
36
- ********************************************************************************/
37
-
38
- if ( ! defined( 'ABSPATH' ) )
39
- exit; // Exit if accessed directly
40
-
41
- class SmackUCIEmailScheduler {
42
-
43
- public static function send_login_credentials_to_users() {
44
-
45
- global $wpdb;
46
- $ucisettings = get_option('sm_uci_pro_settings');
47
- if($ucisettings['send_log_email'] == "on") {
48
- $get_user_meta_info = $wpdb->get_results( $wpdb->prepare( "select *from {$wpdb->prefix}usermeta where meta_key like %s", '%' . 'smack_uci_import' . '%' ) );
49
- if ( ! empty( $get_user_meta_info ) ) {
50
- foreach ( $get_user_meta_info as $key => $value ) {
51
- $data_array = maybe_unserialize( $value->meta_value );
52
- $currentUser = wp_get_current_user();
53
- $admin_email = $currentUser->user_email;
54
- $em_headers = "From: Administrator <$admin_email>"; # . "\r\n";
55
- $message = "Hi,You've been invited with the role of " . $data_array['role'] . ". Here, your login details." . "\n" . "username: " . $data_array['user_login'] . "\n" . "userpass: " . $data_array['user_pass'] . "\n" . "Please click here to login " . wp_login_url();
56
- $emailaddress = $data_array['user_email'];
57
- $subject = 'Login Details';
58
- if ( wp_mail( $emailaddress, $subject, $message, $em_headers ) ) {
59
- #delete_user_meta($value->umeta_id);
60
- delete_user_meta( $value->user_id, 'smack_uci_import' );
61
- }
62
- }
63
- }
64
- }
65
- }
66
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/class-uci-exporter.php DELETED
@@ -1,921 +0,0 @@
1
- <?php
2
- /*********************************************************************************
3
- * WP Ultimate CSV Importer is a Tool for importing CSV for the Wordpress
4
- * plugin developed by Smackcoders. Copyright (C) 2016 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. 2016. All rights reserved".
36
- ********************************************************************************/
37
-
38
- if ( ! defined( 'ABSPATH' ) )
39
- exit; // Exit if accessed directly
40
-
41
-
42
- class SmackUCIExporter {
43
-
44
- var $headers = array();
45
-
46
- var $module; // Ex: post (or) page (or) product
47
-
48
- var $exportType = 'csv'; // Ex: csv (or) xml
49
-
50
- var $optionalType = null; // Can specify the Taxonomy (or) Custom Posts name to be export
51
-
52
- var $conditions = array(); // Conditional based export
53
-
54
- var $eventExclusions = array(); // Export with specific columns, Can exclude the unwanted headers.
55
-
56
- var $fileName; // Export the data with the specific filename.
57
-
58
- var $offset = 0;
59
-
60
- var $limit = 1000;
61
-
62
- var $totalRowCount;
63
-
64
- var $data = array();
65
-
66
- # use first line/entry as field names
67
- var $heading = true;
68
-
69
- # delimiter (comma) and enclosure (double quote)
70
- var $delimiter = ',';
71
- var $enclosure = '"';
72
-
73
- # preferred delimiter characters, only used when all filtering method
74
- # returns multiple possible delimiters (happens very rarely)
75
- var $auto_preferred = ",;\t.:|";
76
-
77
- # only used by output() function
78
- var $output_delimiter = ',';
79
-
80
- var $linefeed = "\r\n";
81
-
82
- /**
83
- * SmackUCIExporter constructor.
84
- *
85
- * Set values into global variables based on post value
86
- */
87
- public function __construct() {
88
- $this->module = isset($_POST['module']) ? sanitize_text_field($_POST['module']) : '';
89
- $this->exportType = 'csv';
90
- $this->conditions = isset($_POST['conditions']) && !empty($_POST['conditions']) ? $_POST['conditions'] : array();
91
- $this->optionalType = isset($_POST['optionalType']) ? sanitize_text_field($_POST['optionalType']) : '';
92
- $this->eventExclusions = isset($_POST['eventExclusions']) && !empty($_POST['eventExclusions']) ? $_POST['eventExclusions'] : array();
93
- $this->fileName = isset($_POST['fileName']) ? sanitize_text_field($_POST['fileName']) : ''; //'Post.csv';
94
- $this->offset = isset($_POST['offset']) ? sanitize_text_field($_POST['offset']) : 0;
95
- $this->limit = isset($_POST['limit']) ? sanitize_text_field($_POST['limit']) : 1000;
96
- $this->delimiter = isset($_POST['conditions']['delimiter']) ? $this->setDelimiter( $_POST['conditions']['delimiter'] ) : ',';
97
- $this->exportData();
98
- }
99
-
100
- /**
101
- * set the delimiter
102
- */
103
- public function setDelimiter($conditions)
104
- {
105
- if(isset($conditions['delimiter']) && $conditions['delimiter'] != 'Select'){
106
- if($conditions['delimiter'] == '{Tab}')
107
- return "\t";
108
- elseif ($conditions['delimiter'] == '{Space}')
109
- return " ";
110
- else
111
- return $conditions['delimiter'];
112
- }
113
- elseif (isset($conditions['optional_delimiter']) && $conditions['optional_delimiter'] != '') {
114
- return $conditions['optional_delimiter'];
115
- }
116
- else{
117
- return ',';
118
- }
119
- }
120
-
121
- /**
122
- *
123
- */
124
- public function exportData( ) {
125
- global $uci_admin;
126
- switch ($this->module) {
127
- case 'Posts':
128
- case 'Pages':
129
- case 'CustomPosts':
130
- case 'WooCommerce':
131
- case 'MarketPress':
132
- case 'WooCommerceVariations':
133
- case 'WooCommerceOrders':
134
- case 'WooCommerceCoupons':
135
- case 'WooCommerceRefunds':
136
- case 'WPeCommerce':
137
- case 'eShop':
138
- $this->FetchDataByPostTypes();
139
- break;
140
- case 'Users':
141
- $this->FetchUsers();
142
- break;
143
- case 'Comments':
144
- $this->FetchComments();
145
- break;
146
- case 'Taxonomies':
147
- $this->FetchTaxonomies();
148
- break;
149
- case 'CustomerReviews':
150
- $this->FetchCustomerReviews();
151
- break;
152
- case 'Categories':
153
- $this->FetchCategories();
154
- break;
155
- case 'Tags':
156
- $this->FetchTags();
157
- break;
158
- }
159
- }
160
-
161
- public function generateHeaders ($module, $optionalType) {
162
- global $uci_admin;
163
- $integrations = $uci_admin->available_widgets($module, $optionalType);
164
- $headers = array();
165
- if(!empty($integrations)) :
166
- foreach($integrations as $widget_name => $group_name) {
167
- $fields = $uci_admin->get_widget_fields($widget_name, $module, $optionalType, 'export');
168
- if(!empty($fields)) {
169
- foreach($fields as $groupKey => $fieldArray) {
170
- if(!empty($fieldArray)) {
171
- foreach ( $fieldArray as $fKey => $fVal ) {
172
- if(!in_array($fVal['name'], $headers))
173
- $headers[] = $fVal['name'];
174
- }
175
- }
176
- }
177
- }
178
- }
179
- endif;
180
- if(isset($this->eventExclusions['is_check']) && $this->eventExclusions['is_check'] == 'true') :
181
- $headers_with_exclusion = $this->applyEventExclusion($headers);
182
- $this->headers = $headers_with_exclusion;
183
- else:
184
- $this->headers = $headers;
185
- endif;
186
- }
187
-
188
- public function FetchDataByPostTypes () {
189
- if(empty($this->headers))
190
- $this->generateHeaders($this->module, $this->optionalType);
191
- $recordsToBeExport = $this->get_records_based_on_post_types($this->module, $this->optionalType, $this->conditions);
192
- if(!empty($recordsToBeExport)) :
193
- foreach($recordsToBeExport as $postId) {
194
- $this->data[$postId] = $this->getPostsDataBasedOnRecordId($postId);
195
- $this->getPostsMetaDataBasedOnRecordId($postId, $this->module, $this->optionalType);
196
- $this->getTermsAndTaxonomies($postId, $this->module, $this->optionalType);
197
- #$this->getTypesFields();
198
- }
199
- endif;
200
- $result = $this->finalDataToExport($this->data);
201
- $this->proceedExport($result);
202
- }
203
-
204
- public function getUserRole ($capability = null) {
205
- if($capability != null) {
206
- $getRole = unserialize($capability);
207
- foreach($getRole as $roleName => $roleStatus) {
208
- $role = $roleName;
209
- }
210
- return $role;
211
- } else {
212
- return 'subscriber';
213
- }
214
- }
215
-
216
- public function FetchUsers() {
217
- global $wpdb;
218
- $this->generateHeaders($this->module, $this->optionalType);
219
- $get_available_user_ids = "select DISTINCT ID from $wpdb->users u join $wpdb->usermeta um on um.user_id = u.ID";
220
- $get_available_user_ids .= " order by ID asc limit $this->offset, $this->limit";
221
- $availableUsers = $wpdb->get_col($get_available_user_ids);
222
- $this->totalRowCount = count($availableUsers);
223
- if(!empty($availableUsers)) {
224
- $whereCondition = '';
225
- foreach($availableUsers as $userId) {
226
- if($whereCondition != ''):
227
- $whereCondition = $whereCondition . ',' . $userId;
228
- else:
229
- $whereCondition = $userId;
230
- endif;
231
- // Prepare the user details to be export
232
- $query_to_fetch_users = "SELECT * FROM $wpdb->users where ID in ($whereCondition);";
233
- $users = $wpdb->get_results($query_to_fetch_users);
234
- if(!empty($users)) {
235
- foreach($users as $userInfo) {
236
- foreach($userInfo as $userKey => $userVal) {
237
- $this->data[$userId][$userKey] = $userVal;
238
- }
239
- }
240
- }
241
- // Prepare the user meta details to be export
242
- $query_to_fetch_users_meta = $wpdb->prepare("SELECT user_id, meta_key, meta_value FROM $wpdb->users wp JOIN $wpdb->usermeta wpm ON wpm.user_id = wp.ID where ID= %d", $userId);
243
- $userMeta = $wpdb->get_results($query_to_fetch_users_meta);
244
- if(!empty($userMeta)) {
245
- foreach($userMeta as $userMetaInfo) {
246
- if($userMetaInfo->meta_key == 'wp_capabilities') {
247
- $userRole = $this->getUserRole($userMetaInfo->meta_value);
248
- $this->data[ $userId ][ 'role' ] = $userRole;
249
- } else {
250
- $this->data[ $userId ][ $userMetaInfo->meta_key ] = $userMetaInfo->meta_value;
251
- }
252
- }
253
- }
254
- }
255
- }
256
- $result = $this->finalDataToExport($this->data);
257
- $this->proceedExport($result);
258
- }
259
-
260
- public function FetchTaxonomies() {
261
- global $uci_admin;
262
- $this->generateHeaders($this->module, $this->optionalType);
263
- $get_all_taxonomies = get_terms( $this->optionalType, 'orderby=count&hide_empty=0' );
264
- $this->totalRowCount = count($get_all_taxonomies);
265
- if(!empty($get_all_taxonomies)) {
266
- foreach( $get_all_taxonomies as $termKey => $termValue ) {
267
- $termID = $termValue->term_id;
268
- $termName = $termValue->name;
269
- $termSlug = $termValue->slug;
270
- $termDesc = $termValue->description;
271
- $termParent = $termValue->parent;
272
- if($termParent == 0) {
273
- $this->data[$termID]['name'] = $termName;
274
- } else {
275
- $termParentName = get_cat_name( $termParent );
276
- $this->data[$termID]['name'] = $termParentName . '|' . $termName;
277
- }
278
- $this->data[$termID]['slug'] = $termSlug;
279
- $this->data[$termID]['description'] = $termDesc;
280
- }
281
- }
282
- if(in_array('wordpress-seo/wp-seo.php', $uci_admin->get_active_plugins())) {
283
- $seo_yoast_taxonomies = get_option( 'wpseo_taxonomy_meta' );
284
- if ( isset( $seo_yoast_taxonomies['category'] ) ) {
285
- foreach ( $seo_yoast_taxonomies['category'] as $taxoKey => $taxoValue ) {
286
- $taxoID = $taxoKey;
287
- $this->data[ $taxoID ]['wpseo_title'] = $taxoValue['wpseo_title'];
288
- $this->data[ $taxoID ]['wpseo_desc'] = $taxoValue['wpseo_desc'];
289
- $this->data[ $taxoID ]['wpseo_canonical'] = $taxoValue['wpseo_canonical'];
290
- $this->data[ $taxoID ]['wpseo_noindex'] = $taxoValue['wpseo_noindex'];
291
- $this->data[ $taxoID ]['wpseo_sitemap_include'] = $taxoValue['wpseo_sitemap_include'];
292
- }
293
- }
294
- }
295
- $result = $this->finalDataToExport($this->data);
296
- $this->proceedExport($result);
297
- }
298
-
299
- public function FetchCategories() {
300
- global $uci_admin;
301
- $this->generateHeaders($this->module, $this->optionalType);
302
- $get_all_terms = get_categories('hide_empty=0');
303
- $this->totalRowCount = count($get_all_terms);
304
- if(!empty($get_all_terms)) {
305
- foreach( $get_all_terms as $termKey => $termValue ) {
306
- $termID = $termValue->term_id;
307
- $termName = $termValue->cat_name;
308
- $termSlug = $termValue->slug;
309
- $termDesc = $termValue->category_description;
310
- $termParent = $termValue->parent;
311
- if($termParent == 0) {
312
- $this->data[$termID]['name'] = $termName;
313
- } else {
314
- $termParentName = get_cat_name( $termParent );
315
- $this->data[$termID]['name'] = $termParentName . '|' . $termName;
316
- }
317
- $this->data[$termID]['slug'] = $termSlug;
318
- $this->data[$termID]['description'] = $termDesc;
319
- }
320
- }
321
- if(in_array('wordpress-seo/wp-seo.php', $uci_admin->get_active_plugins())) {
322
- $seo_yoast_taxonomies = get_option( 'wpseo_taxonomy_meta' );
323
- if ( isset( $seo_yoast_taxonomies['category'] ) ) {
324
- foreach ( $seo_yoast_taxonomies['category'] as $taxoKey => $taxoValue ) {
325
- $taxoID = $taxoKey;
326
- $this->data[ $taxoID ]['wpseo_title'] = $taxoValue['wpseo_title'];
327
- $this->data[ $taxoID ]['wpseo_desc'] = $taxoValue['wpseo_desc'];
328
- $this->data[ $taxoID ]['wpseo_canonical'] = $taxoValue['wpseo_canonical'];
329
- $this->data[ $taxoID ]['wpseo_noindex'] = $taxoValue['wpseo_noindex'];
330
- $this->data[ $taxoID ]['wpseo_sitemap_include'] = $taxoValue['wpseo_sitemap_include'];
331
- }
332
- }
333
- }
334
- $result = $this->finalDataToExport($this->data);
335
- $this->proceedExport($result);
336
- }
337
-
338
- public function FetchTags() {
339
- global $uci_admin;
340
- $this->generateHeaders($this->module, $this->optionalType);
341
- $get_all_terms = get_tags('hide_empty=0');
342
- $this->totalRowCount = count($get_all_terms);
343
- if(!empty($get_all_terms)) {
344
- foreach( $get_all_terms as $termKey => $termValue ) {
345
- $termID = $termValue->term_id;
346
- $termName = $termValue->name;
347
- $termSlug = $termValue->slug;
348
- $termDesc = $termValue->description;
349
- $this->data[$termID]['name'] = $termName;
350
- $this->data[$termID]['slug'] = $termSlug;
351
- $this->data[$termID]['description'] = $termDesc;
352
- }
353
- }
354
- if(in_array('wordpress-seo/wp-seo.php', $uci_admin->get_active_plugins())) {
355
- $seo_yoast_taxonomies = get_option( 'wpseo_taxonomy_meta' );
356
- if ( isset( $seo_yoast_taxonomies['post_tag'] ) ) {
357
- foreach ( $seo_yoast_taxonomies['post_tag'] as $taxoKey => $taxoValue ) {
358
- $taxoID = $taxoKey;
359
- $this->data[ $taxoID ]['wpseo_title'] = $taxoValue['wpseo_title'];
360
- $this->data[ $taxoID ]['wpseo_desc'] = $taxoValue['wpseo_desc'];
361
- $this->data[ $taxoID ]['wpseo_canonical'] = $taxoValue['wpseo_canonical'];
362
- $this->data[ $taxoID ]['wpseo_noindex'] = $taxoValue['wpseo_noindex'];
363
- $this->data[ $taxoID ]['wpseo_sitemap_include'] = $taxoValue['wpseo_sitemap_include'];
364
- }
365
- }
366
- }
367
- $result = $this->finalDataToExport($this->data);
368
- $this->proceedExport($result);
369
- }
370
-
371
- public function FetchCustomerReviews() {
372
- global $wpdb;
373
- $headers = array();
374
- $get_customer_reviews = "select DISTINCT ID from $wpdb->posts p join $wpdb->postmeta pm ";
375
- $get_customer_reviews .= " where p.post_type = '$this->optionalType'";
376
-
377
- #$this->headers = array('date_time', 'reviewer_name', 'reviewer_email', 'reviewer_ip', 'review_title', 'review_text', 'review_response', 'status', 'review_rating', 'reviewer_url', 'page_id');
378
-
379
- // Check for specific status
380
- if($this->conditions['specific_status']['status'] == 'true') {
381
- if(isset($this->conditions['specific_status']['status']) && sanitize_text_field($this->conditions['specific_status']['status']) == 'All') {
382
- $get_customer_reviews .= " and p.post_status in ('publish','draft','future','private','pending')";
383
- } else if(isset($this->conditions['specific_status']['status']) && (sanitize_text_field($this->conditions['specific_status']['status']) == 'Publish' || sanitize_text_field($this->conditions['specific_status']['status']) == 'Sticky')) {
384
- $get_customer_reviews .= " and p.post_status in ('publish')";
385
- } else if(isset($this->conditions['specific_status']['status']) && sanitize_text_field($this->conditions['specific_status']['status']) == 'Draft') {
386
- $get_customer_reviews .= " and p.post_status in ('draft')";
387
- } else if(isset($this->conditions['specific_status']['status']) && sanitize_text_field($this->conditions['specific_status']['status']) == 'Scheduled') {
388
- $get_customer_reviews .= " and p.post_status in ('future')";
389
- } else if(isset($this->conditions['specific_status']['status']) && sanitize_text_field($this->conditions['specific_status']['status']) == 'Private') {
390
- $get_customer_reviews .= " and p.post_status in ('private')";
391
- } else if(isset($this->conditions['specific_status']['status']) && sanitize_text_field($this->conditions['specific_status']['status']) == 'Pending') {
392
- $get_customer_reviews .= " and p.post_status in ('pending')";
393
- } else if(isset($this->conditions['specific_status']['status']) && sanitize_text_field($this->conditions['specific_status']['status']) == 'Protected') {
394
- $get_customer_reviews .= " and p.post_status in ('publish') and post_password != ''";
395
- }
396
- } else {
397
- $get_customer_reviews .= " and p.post_status in ('publish','draft','future','private','pending')";
398
- }
399
- // Check for specific period
400
- if($this->conditions['specific_period']['is_check'] == 'true') {
401
- $get_customer_reviews .= " and c.comment_date >= '" . $this->conditions['specific_period']['from'] . "' and c.comment_date <= '" . $this->conditions['specific_period']['to'] . "'";
402
- }
403
- // Check for specific authors
404
- if($this->conditions['specific_authors']['is_check'] == 'true') {
405
- if(isset($this->conditions['specific_authors']['author']) && $this->conditions['specific_authors']['author'] != 0) {
406
- $get_customer_reviews .= " and c.comment_author_email = {$this->conditions['specific_authors']['author']}";
407
- }
408
- }
409
- $get_total_row_count = $wpdb->get_col($get_customer_reviews);
410
- $this->totalRowCount = count($get_total_row_count);
411
- $offset_limit = " order by ID asc limit $this->offset, $this->limit";
412
- $query_with_offset_limit = $get_customer_reviews . $offset_limit;
413
- $result = $wpdb->get_col($query_with_offset_limit);
414
-
415
- if(!empty($result)) {
416
- foreach($result as $reviewId) {
417
- // Review Information
418
- $query_for_reviews = $wpdb->prepare("SELECT wp.* FROM $wpdb->posts wp where ID=%d", $reviewId);
419
- $reviewDetails = $wpdb->get_results($query_for_reviews);
420
- if (!empty($reviewDetails)) {
421
- foreach ($reviewDetails as $posts) {
422
- foreach ($posts as $post_key => $post_value) {
423
- if ($post_key == 'post_status') {
424
- if (is_sticky($reviewId)) {
425
- $headers[] = $post_key;
426
- $this->data[$reviewId][$post_key] = 'Sticky';
427
- $post_status = 'Sticky';
428
- } else {
429
- $headers[] = $post_key;
430
- $this->data[$reviewId][$post_key] = $post_value;
431
- $post_status = $post_value;
432
- }
433
- } else {
434
- $headers[] = $post_key;
435
- $this->data[$reviewId][$post_key] = $post_value;
436
- }
437
- if ($post_key == 'post_password') {
438
- if ($post_value) {
439
- $headers[] = $post_key;
440
- $this->data[$reviewId]['post_status'] = "{" . $post_value . "}";
441
- } else {
442
- $headers[] = $post_key;
443
- $this->data[$reviewId]['post_status'] = $post_status;
444
- }
445
- }
446
- if ($post_key == 'comment_status') {
447
- if ($post_value == 'closed') {
448
- $headers[] = $post_key;
449
- $this->data[$reviewId]['comment_status'] = 0;
450
- }
451
- if ($post_value == 'open') {
452
- $headers[] = $post_key;
453
- $this->data[$reviewId]['comment_status'] = 1;
454
- }
455
- }
456
- }
457
- }
458
- }
459
- // Review Meta Information
460
- $query_for_review_meta = $wpdb->prepare("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 (%s,%s) AND ID=%d", '_edit_lock', '_edit_last', $reviewId);
461
- $reviewMetaDetails = $wpdb->get_results($query_for_review_meta);
462
-
463
- if(!empty($reviewMetaDetails)) :
464
- foreach($reviewMetaDetails as $key => $value) :
465
- if ($value->meta_key == '_thumbnail_id') {
466
- $attachment_file = null;
467
- $get_attachment = $wpdb->prepare("select guid from $wpdb->posts where ID = %d AND post_type = %s", $value->meta_value, 'attachment');
468
- $attachment = $wpdb->get_results($get_attachment);
469
- $attachment_file = $attachment[0]->guid;
470
- $this->data[$reviewId][$value->meta_key] = '';
471
- $value->meta_key = 'featured_image';
472
- $this->data[$reviewId][$value->meta_key] = $attachment_file;
473
- } else {
474
- $this->data[$reviewId][$value->meta_key] = $value->meta_value;
475
- $headers[] = $value->meta_key;
476
- }
477
- endforeach;
478
- endif;
479
-
480
- // Prepare the headers
481
- if(!empty($headers)) {
482
- foreach($headers as $hKey) {
483
- if(!in_array($hKey, $this->headers)) {
484
- $this->headers[] = $hKey;
485
- }
486
- }
487
- }
488
- }
489
- }
490
- $result = $this->finalDataToExport($this->data);
491
- $this->proceedExport($result);
492
- }
493
-
494
- public function FetchComments() {
495
- global $wpdb;
496
- $this->generateHeaders($this->module, $this->optionalType);
497
- $get_comments = "select *from $wpdb->comments";
498
- $get_comments .= " where comment_approved in (0,1)";
499
- // Check for specific period
500
- if($this->conditions['specific_period']['is_check'] == 'true') {
501
- $get_comments .= " and c.comment_date >= '" . $this->conditions['specific_period']['from'] . "' and c.comment_date <= '" . $this->conditions['specific_period']['to'] . "'";
502
- }
503
- // Check for specific authors
504
- if($this->conditions['specific_authors']['is_check'] == 'true') {
505
- if(isset($this->conditions['specific_authors']['author']) && $this->conditions['specific_authors']['author'] != 0) {
506
- $get_user_info = get_userdata($this->conditions['specific_authors']['author']);
507
- $user_email = $get_user_info->data->user_email;
508
- $get_comments .= " and c.comment_author_email = $user_email"; //{$this->conditions['specific_authors']['author']}";
509
- }
510
- }
511
- $get_comments .= " order by comment_ID asc limit $this->offset, $this->limit";
512
- $comments = $wpdb->get_results( $get_comments );
513
- $this->totalRowCount = count($comments);
514
- if(!empty($comments)) {
515
- foreach($comments as $commentInfo) {
516
- foreach($commentInfo as $commentKey => $commentVal) {
517
- //if(!in_array($commentKey, $this->headers)) {
518
- // $this->headers[] = $commentKey;
519
- //}
520
- $this->data[$commentInfo->comment_ID][$commentKey] = $commentVal;
521
- }
522
- }
523
- }
524
- $result = $this->finalDataToExport($this->data);
525
- $this->proceedExport($result);
526
- }
527
-
528
- public function proceedExport ($data) {
529
- $loggerObj = new SmackCSVLogger();
530
- $csvData = $this->unParse($data, $this->headers);
531
- if(!is_dir(SM_UCI_EXPORT_DIR)) {
532
- wp_mkdir_p(SM_UCI_EXPORT_DIR);
533
- chmod(SM_UCI_EXPORT_DIR, 0777);
534
- }
535
- $file = SM_UCI_EXPORT_DIR . $this->fileName . '.' . $this->exportType;
536
- if ($this->offset == 0) :
537
- if(file_exists($file))
538
- unlink($file);
539
- endif;
540
- try {
541
- file_put_contents( $file, $csvData, FILE_APPEND | LOCK_EX );
542
- } catch (Exception $e) {
543
- $loggerObj->logW('', $e);
544
- }
545
- $this->offset = $this->offset + $this->limit;
546
- $fileURL = SM_UCI_EXPORT_URL . $this->fileName . '.' . $this->exportType;
547
- $responseTojQuery = array('new_offset' => $this->offset, 'limit' => $this->limit, 'total_row_count' => $this->totalRowCount, 'exported_file' => $fileURL);
548
- echo json_encode($responseTojQuery);
549
- }
550
-
551
- public function FetchACFData ($recordId) {
552
-
553
- }
554
-
555
- public function get_records_based_on_post_types ($module, $optionalType, $conditions) {
556
- global $wpdb, $uci_admin;
557
- if($module == 'CustomPosts') {
558
- $module = $optionalType;
559
- } else {
560
- $module = $uci_admin->import_post_types($module);
561
- }
562
- $get_post_ids = "select DISTINCT ID from $wpdb->posts p join $wpdb->postmeta pm ";
563
- $get_post_ids .= " where p.post_type = '$module'";
564
-
565
- // Check for specific status
566
- if(isset($conditions['specific_status']['status'])) {
567
- if(sanitize_text_field($conditions['specific_status']['status']) == 'All') {
568
- $get_post_ids .= " and p.post_status in ('publish','draft','future','private','pending')";
569
- } elseif(sanitize_text_field($conditions['specific_status']['status'] == 'Publish' || sanitize_text_field($conditions['specific_status']['status']) == 'Sticky')) {
570
- $get_post_ids .= " and p.post_status in ('publish')";
571
- } elseif(sanitize_text_field($conditions['specific_status']['status']) == 'Draft') {
572
- $get_post_ids .= " and p.post_status in ('draft')";
573
- } elseif(sanitize_text_field($conditions['specific_status']['status']) == 'Scheduled') {
574
- $get_post_ids .= " and p.post_status in ('future')";
575
- } elseif(sanitize_text_field($conditions['specific_status']['status']) == 'Private') {
576
- $get_post_ids .= " and p.post_status in ('private')";
577
- } elseif(sanitize_text_field($conditions['specific_status']['status']) == 'Pending') {
578
- $get_post_ids .= " and p.post_status in ('pending')";
579
- } elseif(sanitize_text_field($conditions['specific_status']['status']) == 'Protected') {
580
- $get_post_ids .= " and p.post_status in ('publish') and post_password != ''";
581
- }
582
- } else {
583
- $get_post_ids .= " and p.post_status in ('publish','draft','future','private','pending')";
584
- }
585
-
586
- // Check for specific period
587
- if(isset($conditions['specific_period']['is_check']) && $conditions['specific_period']['is_check'] == 'true') {
588
- $get_post_ids .= " and p.post_date >= '" . $conditions['specific_period']['from'] . "' and p.post_date <= '" . $conditions['specific_period']['to'] . "'";
589
- }
590
- if($module == 'eshop')
591
- $get_post_ids .= " and pm.meta_key = '_eshop_product'";
592
- if($module == 'woocommerce')
593
- $get_post_ids .= " and pm.meta_key = '_sku'";
594
- if($module == 'marketpress')
595
- $get_post_ids .= " and pm.meta_key = 'mp_sku'";
596
- if($module == 'wpcommerce')
597
- $get_post_ids .= " and pm.meta_key = '_wpsc_sku'";
598
-
599
- // Check for specific authors
600
- if(isset($conditions['specific_period']['is_check']) && $conditions['specific_authors']['is_check'] == 'true') {
601
- if(isset($conditions['specific_authors']['author']) && $conditions['specific_authors']['author'] != 0) {
602
- $get_post_ids .= " and p.post_author = {$conditions['specific_authors']['author']}";
603
- }
604
- }
605
-
606
- $get_total_row_count = $wpdb->get_col($get_post_ids);
607
- $this->totalRowCount = count($get_total_row_count);
608
- $offset_limit = " order by ID asc limit $this->offset, $this->limit";
609
- $query_with_offset_limit = $get_post_ids . $offset_limit;
610
- $result = $wpdb->get_col($query_with_offset_limit);
611
-
612
- // Get sticky post alone on the specific post status
613
- if(isset($conditions['specific_period']['is_check']) && $conditions['specific_status']['is_check'] == 'true') {
614
- if(isset($conditions['specific_status']['status']) && sanitize_text_field($conditions['specific_status']['status']) == 'Sticky') {
615
- $get_sticky_posts = get_option('sticky_posts');
616
- foreach($get_sticky_posts as $sticky_post_id) {
617
- if(in_array($sticky_post_id, $result))
618
- $sticky_posts[] = $sticky_post_id;
619
- }
620
- return $sticky_posts;
621
- }
622
- }
623
- return $result;
624
- }
625
-
626
- public function getPostsDataBasedOnRecordId ($id) {
627
- global $wpdb;
628
- $PostData = array();
629
- $query1 = $wpdb->prepare("SELECT wp.* FROM $wpdb->posts wp where ID=%d", $id);
630
- $result_query1 = $wpdb->get_results($query1);
631
- if (!empty($result_query1)) {
632
- foreach ($result_query1 as $posts) {
633
- foreach ($posts as $post_key => $post_value) {
634
- if ($post_key == 'post_status') {
635
- if (is_sticky($id)) {
636
- $PostData[$post_key] = 'Sticky';
637
- $post_status = 'Sticky';
638
- } else {
639
- $PostData[$post_key] = $post_value;
640
- $post_status = $post_value;
641
- }
642
- } else {
643
- $PostData[$post_key] = $post_value;
644
- }
645
- if ($post_key == 'post_password') {
646
- if ($post_value) {
647
- $PostData['post_status'] = "{" . $post_value . "}";
648
- } else {
649
- $PostData['post_status'] = $post_status;
650
- }
651
- }
652
- if ($post_key == 'comment_status') {
653
- if ($post_value == 'closed') {
654
- $PostData['comment_status'] = 0;
655
- }
656
- if ($post_value == 'open') {
657
- $PostData['comment_status'] = 1;
658
- }
659
- }
660
- }
661
- }
662
- }
663
- #$this->data[$id] = $PostData;
664
- return $PostData;
665
- }
666
-
667
- public function getPostsMetaDataBasedOnRecordId ($id) {
668
- global $wpdb;
669
- $query = $wpdb->prepare("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 (%s,%s) AND ID=%d", '_edit_lock', '_edit_last', $id);
670
- $result = $wpdb->get_results($query);
671
-
672
- if(!empty($result)) :
673
- foreach($result as $key => $value) :
674
- if ($value->meta_key == '_thumbnail_id') {
675
- $attachment_file = null;
676
- $get_attachment = $wpdb->prepare("select guid from $wpdb->posts where ID = %d AND post_type = %s", $value->meta_value, 'attachment');
677
- $attachment = $wpdb->get_results($get_attachment);
678
- $attachment_file = $attachment[0]->guid;
679
- $this->data[$id][$value->meta_key] = '';
680
- $value->meta_key = 'featured_image';
681
- $this->data[$id][$value->meta_key] = $attachment_file;
682
- } else {
683
- $this->data[$id][ $value->meta_key ] = $value->meta_value;
684
- }
685
- endforeach;
686
- endif;
687
- }
688
-
689
- /**
690
- * Function used to fetch the Terms & Taxonomies for the specific posts
691
- *
692
- * @param $id
693
- * @param $type
694
- * @param $optionalType
695
- */
696
- public function getTermsAndTaxonomies ($id, $type, $optionalType) {
697
- $TermsData = array();
698
- if($type == 'WooCommerce' || $type == 'MarketPress') {
699
- $type = 'product';
700
- $postTags = $postCategory = '';
701
- $taxonomies = get_object_taxonomies($type);
702
- $get_tags = get_the_terms( $id, 'product_tag' );
703
- if($get_tags){
704
- foreach($get_tags as $tags){
705
- $postTags .= $tags->name . ',';
706
- }
707
- }
708
- $postTags = substr($postTags, 0, -1);
709
- $this->data[$id]['product_tag'] = $postTags;
710
- foreach ($taxonomies as $taxonomy) {
711
- if($taxonomy == 'product_cat' || $taxonomy == 'product_category'){
712
- $get_categories = get_the_terms( $id, $taxonomy );
713
- if($get_categories){
714
- foreach($get_categories as $category){
715
- $postCategory .= $category->name . '|';
716
- }
717
- }
718
- $postCategory = substr($postCategory, 0 , -1);
719
- $this->data[$id]['product_category'] = $postCategory;
720
- }
721
- }
722
- } else if($type == 'WPeCommerce') {
723
- $type = 'wpsc-product';
724
- $postTags = $postCategory = '';
725
- $taxonomies = get_object_taxonomies($type);
726
- $get_tags = get_the_terms( $id, 'product_tag' );
727
- if($get_tags){
728
- foreach($get_tags as $tags){
729
- $postTags .= $tags->name.',';
730
- }
731
- }
732
- $postTags = substr($postTags,0,-1);
733
- $this->data[$id]['product_tag'] = $postTags;
734
- foreach ($taxonomies as $taxonomy) {
735
- if($taxonomy == 'wpsc_product_category'){
736
- $get_categories = wp_get_post_terms( $id, $taxonomy );
737
- if($get_categories){
738
- foreach($get_categories as $category){
739
- $postCategory .= $category->name.'|';
740
- }
741
- }
742
- $postCategory = substr($postCategory, 0 , -1);
743
- $this->data[$id]['product_category'] = $postCategory;
744
- }
745
- }
746
- } else {
747
- global $wpdb;
748
- $postTags = $postCategory = '';
749
- $taxonomyId = $wpdb->get_col($wpdb->prepare("select term_taxonomy_id from $wpdb->term_relationships where object_id = %d", $id));
750
- if(!empty($taxonomyId)) {
751
- foreach($taxonomyId as $taxonomy) {
752
- $taxonomyType = $wpdb->get_col($wpdb->prepare("select taxonomy from $wpdb->term_taxonomy where term_taxonomy_id = %d",$taxonomy));
753
- if(!empty($taxonomyType)) {
754
- foreach($taxonomyType as $termName) {
755
- if($termName == 'category')
756
- $termName = 'post_category';
757
- if(in_array($termName, $this->headers)) {
758
- if($termName != 'post_tag') {
759
- $taxonomyData = $wpdb->get_col($wpdb->prepare("select name from $wpdb->terms where term_id = %d",$taxonomy));
760
- if(!empty($taxonomyData)) {
761
- if(isset($TermsData[$termName]))
762
- $this->data[$id][$termName] = $TermsData[$termName] . ',' . $taxonomyData[0];
763
- else
764
- $get_exist_data = $this->data[$id][$termName];
765
- if( $get_exist_data == '' ){
766
- $this->data[$id][$termName] = $taxonomyData[0];
767
- }
768
- else {
769
- $this->data[$id][$termName] = $get_exist_data . '|' . $taxonomyData[0];
770
- }
771
- }
772
- }
773
- else {
774
- if(!isset($TermsData['post_tag'])) {
775
- $get_tags = wp_get_post_tags($id, array('fields' => 'names'));
776
- foreach ($get_tags as $tags) {
777
- $postTags .= $tags . ',';
778
- }
779
- $postTags = substr($postTags, 0, -1);
780
- if( $this->data[$id][$termName] == '' ) {
781
- $this->data[$id][$termName] = $postTags;
782
- }
783
- }
784
- }
785
- if(!isset($TermsData['category'])){
786
- $get_categories = wp_get_post_categories($id, array('fields' => 'names'));
787
- foreach ($get_categories as $category) {
788
- $postCategory .= $category . '|';
789
- }
790
- $postCategory = substr($postCategory, 0, -1);
791
- $this->data[$id]['category'] = $postCategory;
792
- }
793
-
794
- }
795
- else{
796
- $this->data[$id][$termName] = '';
797
- }
798
- }
799
- }
800
- }
801
- }
802
- }
803
- }
804
-
805
- public function getTypesFields() {
806
- $getWPTypesFields = get_option('wpcf-fields');
807
- $typesFields = array();
808
- if(!empty($getWPTypesFields) && is_array($getWPTypesFields)) {
809
- foreach($getWPTypesFields as $fKey){
810
- $typesFields[$fKey['meta_key']] = $fKey['name'];
811
- }
812
- }
813
- return $typesFields;
814
- }
815
-
816
- public function finalDataToExport ($data) {
817
- $result = array();
818
- foreach ($this->headers as $hKey) {
819
- foreach ( $data as $recordId => $rowValue ) {
820
- foreach($rowValue as $key => $value){
821
- if(array_key_exists($hKey, $rowValue)):
822
- $result[$recordId][$hKey] = $rowValue[$hKey];
823
- else:
824
- if(preg_match('/_aioseop_/', $key)):
825
- $key = preg_replace('/_aioseop_/','',$key);
826
- endif;
827
- if(preg_match('/wpcf-/', $key)):
828
- $key = preg_replace('/wpcf-/','',$key);
829
- endif;
830
- $rowValue[$key] = $value;
831
- if(array_key_exists($hKey, $rowValue)):
832
- $result[$recordId][$hKey] = $rowValue[$hKey];
833
- else:
834
- $result[$recordId][$hKey] = '';
835
- endif;
836
- endif;
837
- }
838
- }
839
-
840
- }
841
- return $result;
842
- }
843
-
844
- /**
845
- * Create CSV data from array
846
- * @param array $data 2D array with data
847
- * @param array $fields field names
848
- * @param bool $append if true, field names will not be output
849
- * @param bool $is_php if a php die() call should be put on the first
850
- * line of the file, this is later ignored when read.
851
- * @param null $delimiter field delimiter to use
852
- *
853
- * @return string CSV data (text string)
854
- */
855
- public function unParse ( $data = array(), $fields = array(), $append = false , $is_php = false, $delimiter = null) {
856
- if ( !is_array($data) || empty($data) ) $data = &$this->data;
857
- if ( !is_array($fields) || empty($fields) ) $fields = &$this->titles;
858
- if ( $delimiter === null ) $delimiter = $this->delimiter;
859
-
860
- $string = ( $is_php ) ? "<?php header('Status: 403'); die(' '); ?>".$this->linefeed : '' ;
861
- $entry = array();
862
-
863
- // create heading
864
- if ($this->offset == 0) :
865
- if ( $this->heading && !$append && !empty($fields) ) {
866
- foreach( $fields as $key => $value ) {
867
- $entry[] = $this->_enclose_value($value);
868
- }
869
- $string .= implode($delimiter, $entry).$this->linefeed;
870
- $entry = array();
871
- }
872
- endif;
873
-
874
- // create data
875
- foreach( $data as $key => $row ) {
876
- foreach( $row as $field => $value ) {
877
- $entry[] = $this->_enclose_value($value);
878
- }
879
- $string .= implode($delimiter, $entry).$this->linefeed;
880
- $entry = array();
881
- }
882
-
883
- return $string;
884
- }
885
-
886
- /**
887
- * Enclose values if needed
888
- * - only used by unParse()
889
- * @param null $value
890
- *
891
- * @return mixed|null|string
892
- */
893
- public function _enclose_value ($value = null) {
894
- if ( $value !== null && $value != '' ) {
895
- $delimiter = preg_quote($this->delimiter, '/');
896
- $enclosure = preg_quote($this->enclosure, '/');
897
- if($value[0]=='=') $value="'".$value; # Fix for the Comma separated vulnerabilities.
898
- if ( preg_match("/".$delimiter."|".$enclosure."|\n|\r/i", $value) || ($value{0} == ' ' || substr($value, -1) == ' ') ) {
899
- $value = str_replace($this->enclosure, $this->enclosure.$this->enclosure, $value);
900
- $value = $this->enclosure.$value.$this->enclosure;
901
- } else
902
- $value = $this->enclosure.$value.$this->enclosure;
903
- }
904
- return $value;
905
- }
906
-
907
- public function applyEventExclusion ($headers) {
908
- $header_exclusion = array();
909
- foreach ($headers as $hVal) {
910
- #if($this->eventExclusions['is_check'] === true && array_key_exists($hKey, $this->eventExclusions['exclusion_headers'])) :
911
- if(array_key_exists($hVal, $this->eventExclusions['exclusion_headers'])) :
912
- #unset($this->headers[$hKey]);
913
- #else:
914
- $header_exclusion[] = $hVal;
915
- endif;
916
- }
917
- return $header_exclusion;
918
- }
919
- }
920
-
921
- return new SmackUCIExporter();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/class-uci-helper.php CHANGED
@@ -293,53 +293,53 @@ class SmackUCIHelper {
293
 
294
  public $detailed_log = array();
295
 
296
- public $def_mpCols = array('Shipping Email' => 'msi_email',
297
- 'Shipping Name' => 'msi_name',
298
- 'Shipping Address1' => 'msi_address1',
299
- 'Shipping Address2' => 'msi_address2',
300
- 'Shipping City' => 'msi_city',
301
- 'Shipping State' => 'msi_state',
302
- 'Shipping Zip' => 'msi_zip',
303
- 'Shipping Country' => 'msi_country',
304
- 'Shipping Phone' => 'msi_phone',
305
- 'Billing Email' => 'mbi_email',
306
- 'Billing Name' => 'mbi_name',
307
- 'Billing Address1' => 'mbi_address1',
308
- 'Billing Address2' => 'mbi_address2',
309
- 'Billing City' => 'mbi_city',
310
- 'Billing State' => 'mbi_state',
311
- 'Billing Zip' => 'mbi_zip',
312
- 'Billing Country' => 'mbi_country',
313
- 'Billing Phone' => 'mbi_phone'
314
- );
315
-
316
- public $def_wcCols = array('Billing First Name' => 'billing_first_name',
317
- 'Billing Last Name' => 'billing_last_name',
318
- 'Billing Company' => 'billing_company',
319
- 'Billing Address1' => 'billing_address_1',
320
- 'Billing Address2' => 'billing_address_2',
321
- 'Billing City' => 'billing_city',
322
- 'Billing PostCode' => 'billing_postcode',
323
- 'Billing State' => 'billing_state',
324
- 'Billing Country' => 'billing_country',
325
- 'Billing Phone' => 'billing_phone',
326
- 'Billing Email' => 'billing_email',
327
- 'Shipping First Name' => 'shipping_first_name',
328
- 'Shipping Last Name' => 'shipping_last_name',
329
- 'Shipping Company' => 'shipping_company',
330
- 'Shipping Address1' => 'shipping_address_1',
331
- 'Shipping Address2' => 'shipping_address_2',
332
- 'Shipping City' => 'shipping_city',
333
- 'Shipping PostCode' => 'shipping_postcode',
334
- 'Shipping State' => 'shipping_state',
335
- 'Shipping Country' => 'shipping_country',
336
- 'API Consumer Key' => 'woocommerce_api_consumer_key',
337
- 'API Consumer Secret' => 'woocommerce_api_consumer_secret',
338
- 'API Key Permissions' => 'woocommerce_api_key_permissions',
339
- 'Shipping Region' => '_wpsc_shipping_region' ,
340
- 'Billing Region' => '_wpsc_billing_region',
341
- 'Cart' => '_wpsc_cart'
342
- );
343
 
344
  public function get_active_plugins() {
345
  $active_plugins = get_option('active_plugins');
@@ -398,27 +398,12 @@ class SmackUCIHelper {
398
  }
399
  // Core fields for Users
400
  if($type === 'Users') {
401
- $defCols = array(
402
- 'User Login' => 'user_login',
403
- 'User Pass' => 'user_pass',
404
- 'First Name' => 'first_name',
405
- 'Last Name' => 'last_name',
406
- 'Nick Name' => 'nickname',
407
- 'User Email' => 'user_email',
408
- 'User URL' => 'user_url',
409
- 'User Nicename' => 'user_nicename',
410
- 'User Registered' => 'user_registered',
411
- 'User Activation Key' => 'user_activation_key',
412
- 'User Status' => 'user_status',
413
- 'Display Name' => 'display_name',
414
- 'User Role' => 'role',
415
- 'Biographical Info' => 'biographical_info',
416
- 'Disable Visual Editor' => 'disable_visual_editor',
417
- 'Admin Color Scheme' => 'admin_color',
418
- 'Enable Keyboard Shortcuts' => 'enable_keyboard_shortcuts',
419
- 'Show Toolbar' => 'show_toolbar'
420
- //'Capabilities' => 'wp_capabilities',
421
- );
422
  }
423
  if(in_array('events-manager/events-manager.php', $this->get_active_plugins()) && $type === 'event' || $type === 'event-recurring' || $type === 'location' ){
424
  $customarray = array(
@@ -653,14 +638,24 @@ class SmackUCIHelper {
653
  }
654
 
655
  public function get_import_post_types(){
 
656
  $custom_array = array('post', 'page');
657
  $other_posttypes = array('attachment','revision','nav_menu_item','wpsc-product-file','mp_order','shop_webhook');
658
  $importas = array(
659
  'Posts' => 'Posts',
660
  'Pages' => 'Pages',
661
- 'Users' =>'Users',
662
  'Comments' => 'Comments'
663
  );
 
 
 
 
 
 
 
 
 
 
664
  $all_post_types = get_post_types();
665
  foreach($other_posttypes as $ptkey => $ptvalue) {
666
  if (in_array($ptvalue, $all_post_types)) {
@@ -672,6 +667,8 @@ class SmackUCIHelper {
672
  $importas[$value] = $value;
673
  }
674
  }
 
 
675
  # Added support for Customer Reviews plugin
676
  if(in_array('wp-customer-reviews/wp-customer-reviews-3.php', $this->get_active_plugins()) || in_array('wp-customer-reviews/wp-customer-reviews.php', $this->get_active_plugins())) {
677
  $importas['Customer Reviews'] = 'CustomerReviews';
@@ -811,68 +808,9 @@ class SmackUCIHelper {
811
  'Conditions' => 'conditions'
812
  );
813
  }
814
- if($module === 'WooCommerce') {
815
- $MetaFields = array(
816
- 'Product Shipping Class' => 'product_shipping_class',
817
- 'Visibility' => 'visibility',
818
- 'Tax Status' => 'tax_status',
819
- 'Product Type' => 'product_type',
820
- 'Product Attribute Name' => 'product_attribute_name',
821
- 'Product Attribute Value' => 'product_attribute_value',
822
- 'Product Attribute Visible' => 'product_attribute_visible',
823
- 'Product Attribute Variation' => 'product_attribute_variation',
824
- 'Product Attribute Position' => 'product_attribute_position',
825
- 'Featured Product' => 'featured_product',
826
- 'Product Attribute Taxonomy' => 'product_attribute_taxonomy',
827
- 'Tax Class' => 'tax_class',
828
- 'File Paths' => 'file_paths',
829
- 'Edit Last' => 'edit_last',
830
- 'Edit Lock' => 'edit_lock',
831
- 'Thumbnail Id' => 'thumbnail_id',
832
- // 'Visibility' => 'visibility',
833
- 'Stock Status' => 'stock_status',
834
- 'Stock Quantity' => 'stock_qty',
835
- 'Total Sales' => 'total_sales',
836
- 'Downloadable' => 'downloadable',
837
- 'Virtual' => 'virtual',
838
- 'Regular Price' => 'regular_price',
839
- 'Sale Price' => 'sale_price',
840
- 'Purchase Note' => 'purchase_note',
841
- 'Weight' => 'weight',
842
- 'Length' => 'length',
843
- 'Width' => 'width',
844
- 'Height' => 'height',
845
- 'SKU' => 'sku',
846
- 'UpSells Id' => 'upsell_ids',
847
- 'CrossSells Id' => 'crosssell_ids',
848
- 'Sales Price Date From' => 'sale_price_dates_from',
849
- 'Sales Price Date To' => 'sale_price_dates_to',
850
- 'Price' => 'price',
851
- 'Sold Individually' => 'sold_individually',
852
- 'Manage Stock' => 'manage_stock',
853
- 'Backorders' => 'backorders',
854
- 'Stock' => 'stock',
855
- 'Product Image Gallery' => 'product_image_gallery',
856
- 'Product URL' => 'product_url',
857
- 'Button Text' => 'button_text',
858
- 'Downloadable Files' => 'downloadable_files',
859
- 'Download Limit' => 'download_limit',
860
- 'Download Expiry' => 'download_expiry',
861
- 'Download Type' => 'download_type',
862
- /* 'Min Variation Price' => 'min_variation_price',
863
- 'Max Variation Price' => 'max_variation_price',
864
- 'Min Price Variation Id' => 'min_price_variation_id',
865
- 'Max Price Variation Id' => 'max_price_variation_id',
866
- 'Min Variation Regular Price' => 'min_variation_regular_price',
867
- 'Max Variation Regular Price' => 'max_variation_regular_price',
868
- 'Min Regular Price Variation Id' => 'min_regular_price_variation_id',
869
- 'Max Regular Price Variation Id' => 'max_regular_price_variation_id',
870
- 'Min Variation Sale Price' => 'min_variation_sale_price',
871
- 'Max Variation Sale Price' => 'max_variation_sale_price',
872
- 'Min Sale Price Variation Id' => 'min_sale_price_variation_id',
873
- 'Max Sale Price Variation Id' => 'max_sale_price_variation_id', */
874
- 'Default Attributes' => 'default_attributes',
875
- );
876
  }
877
  if($module === 'WooCommerceVariations'){
878
  $MetaFields = array(
@@ -1512,22 +1450,22 @@ class SmackUCIHelper {
1512
  return $WPMemberFields;
1513
  }
1514
 
1515
- public function billing_information_for_users () {
1516
- $billing_and_shipping_info = array();
1517
- if(in_array( 'marketpress/marketpress.php', $this->get_active_plugins() ) || in_array( 'wordpress-ecommerce/marketpress.php', $this->get_active_plugins() )) {
1518
- foreach($this->def_mpCols as $mp_key => $mp_val) {
1519
- $billing_and_shipping_info['BSI'][$mp_val]['label'] = $mp_key;
1520
- $billing_and_shipping_info['BSI'][$mp_val]['name'] = $mp_val;
1521
- }
1522
- }
1523
- if(in_array( 'woocommerce/woocommerce.php', $this->get_active_plugins() )) {
1524
- foreach($this->def_wcCols as $woo_key => $woo_val) {
1525
- $billing_and_shipping_info['BSI'][$woo_val]['label'] = $woo_key;
1526
- $billing_and_shipping_info['BSI'][$woo_val]['name'] = $woo_val;
1527
- }
1528
- }
1529
- return $billing_and_shipping_info;
1530
- }
1531
 
1532
  public function terms_and_taxonomies($type, $optionalType = null, $mode = null) {
1533
  $term_taxonomies = array();
@@ -1702,7 +1640,9 @@ $currentMapping = $this->generateDataArrayBasedOnGroups( $available_groups_type,
1702
  'action' => isset($screen_data['import_config']['handle_duplicate']) ? $screen_data['import_config']['handle_duplicate'] : '',
1703
  'media_handling' => isset($mediaConfig) ? $mediaConfig : ''
1704
  );
1705
-
 
 
1706
  foreach ($uci_admin->getRowMapping() as $groupName => $groupValue) {
1707
  #$this->groupName = $groupName;
1708
  //$this->groupMapping = $groupMapping;
@@ -1750,7 +1690,10 @@ $currentMapping = $this->generateDataArrayBasedOnGroups( $available_groups_type,
1750
  }
1751
  break;
1752
  case 'ECOMMETA':
1753
- # Note: Removed data import for eCommerce meta fields
 
 
 
1754
  break;
1755
  case 'CORECUSTFIELDS':
1756
  $this->importDataForWPMetaFields($groupValue, $this->getLastImportId(), $importType);
@@ -1795,12 +1738,16 @@ $currentMapping = $this->generateDataArrayBasedOnGroups( $available_groups_type,
1795
  $this->importTermsAndTaxonomies($groupValue, $this->getLastImportId(), $importType);
1796
  break;
1797
  case 'WPMEMBERS':
1798
- # Note: Removed data import for WPMembers fields on Users
 
 
 
1799
  break;
1800
  case 'BSI':
1801
- require_once "class-uci-user-data-import.php";
1802
- $userObj = new SmackUCIUserDataImport();
1803
- $userObj->importDataForUsers_BillingShipping($groupValue, $this->getLastImportId());
 
1804
  break;
1805
  }
1806
  }
@@ -1810,6 +1757,7 @@ $currentMapping = $this->generateDataArrayBasedOnGroups( $available_groups_type,
1810
  $returnArr = array();
1811
  global $wpdb, $uci_admin;
1812
  $mode_of_affect = 'Inserted';
 
1813
  if(!$data_array['post_format'])
1814
  {
1815
  if($data_array['post_format_option'])
@@ -1822,9 +1770,11 @@ $currentMapping = $this->generateDataArrayBasedOnGroups( $available_groups_type,
1822
  if($importType != 'ticket') {
1823
  switch ($importType) {
1824
  case 'Users':
1825
- require_once "class-uci-user-data-import.php";
1826
- $userObj = new SmackUCIUserDataImport();
1827
- $returnArr = $userObj->importUserInformation($data_array, $mode, $eventKey, $duplicateHandling);
 
 
1828
  break;
1829
  case 'CustomerReviews':
1830
  require_once "class-uci-customer-reviews-data-import.php";
@@ -1865,6 +1815,11 @@ $currentMapping = $this->generateDataArrayBasedOnGroups( $available_groups_type,
1865
  return $returnArr;
1866
  break;
1867
  case 'WooCommerce':
 
 
 
 
 
1868
  case 'WooCommerceVariations':
1869
  case 'WooCommerceOrders':
1870
  case 'WooCommerceCoupons':
@@ -2588,7 +2543,7 @@ $currentMapping = $this->generateDataArrayBasedOnGroups( $available_groups_type,
2588
 
2589
  public function get_mapping_screendata($module,$post_values){
2590
  global $uci_admin;
2591
- $available_group = $uci_admin->available_widgets($module, $importAs);
2592
  foreach ($available_group as $groupname => $groupvalue) {
2593
  foreach ($post_values as $mapping_key => $mapping_value) {
2594
  $current_mapped_group_mapkey = explode($groupvalue . '__mapping', $mapping_key);
293
 
294
  public $detailed_log = array();
295
 
296
+ // public $def_mpCols = array('Shipping Email' => 'msi_email',
297
+ // 'Shipping Name' => 'msi_name',
298
+ // 'Shipping Address1' => 'msi_address1',
299
+ // 'Shipping Address2' => 'msi_address2',
300
+ // 'Shipping City' => 'msi_city',
301
+ // 'Shipping State' => 'msi_state',
302
+ // 'Shipping Zip' => 'msi_zip',
303
+ // 'Shipping Country' => 'msi_country',
304
+ // 'Shipping Phone' => 'msi_phone',
305
+ // 'Billing Email' => 'mbi_email',
306
+ // 'Billing Name' => 'mbi_name',
307
+ // 'Billing Address1' => 'mbi_address1',
308
+ // 'Billing Address2' => 'mbi_address2',
309
+ // 'Billing City' => 'mbi_city',
310
+ // 'Billing State' => 'mbi_state',
311
+ // 'Billing Zip' => 'mbi_zip',
312
+ // 'Billing Country' => 'mbi_country',
313
+ // 'Billing Phone' => 'mbi_phone'
314
+ // );
315
+
316
+ // public $def_wcCols = array('Billing First Name' => 'billing_first_name',
317
+ // 'Billing Last Name' => 'billing_last_name',
318
+ // 'Billing Company' => 'billing_company',
319
+ // 'Billing Address1' => 'billing_address_1',
320
+ // 'Billing Address2' => 'billing_address_2',
321
+ // 'Billing City' => 'billing_city',
322
+ // 'Billing PostCode' => 'billing_postcode',
323
+ // 'Billing State' => 'billing_state',
324
+ // 'Billing Country' => 'billing_country',
325
+ // 'Billing Phone' => 'billing_phone',
326
+ // 'Billing Email' => 'billing_email',
327
+ // 'Shipping First Name' => 'shipping_first_name',
328
+ // 'Shipping Last Name' => 'shipping_last_name',
329
+ // 'Shipping Company' => 'shipping_company',
330
+ // 'Shipping Address1' => 'shipping_address_1',
331
+ // 'Shipping Address2' => 'shipping_address_2',
332
+ // 'Shipping City' => 'shipping_city',
333
+ // 'Shipping PostCode' => 'shipping_postcode',
334
+ // 'Shipping State' => 'shipping_state',
335
+ // 'Shipping Country' => 'shipping_country',
336
+ // 'API Consumer Key' => 'woocommerce_api_consumer_key',
337
+ // 'API Consumer Secret' => 'woocommerce_api_consumer_secret',
338
+ // 'API Key Permissions' => 'woocommerce_api_key_permissions',
339
+ // 'Shipping Region' => '_wpsc_shipping_region' ,
340
+ // 'Billing Region' => '_wpsc_billing_region',
341
+ // 'Cart' => '_wpsc_cart'
342
+ // );
343
 
344
  public function get_active_plugins() {
345
  $active_plugins = get_option('active_plugins');
398
  }
399
  // Core fields for Users
400
  if($type === 'Users') {
401
+ $active_plugins = get_option( "active_plugins" );
402
+ if(in_array('import-users/index.php', $active_plugins)){
403
+ global $userUci_admin;
404
+ $defCols = $userUci_admin->getUserWidgets();
405
+
406
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
407
  }
408
  if(in_array('events-manager/events-manager.php', $this->get_active_plugins()) && $type === 'event' || $type === 'event-recurring' || $type === 'location' ){
409
  $customarray = array(
638
  }
639
 
640
  public function get_import_post_types(){
641
+
642
  $custom_array = array('post', 'page');
643
  $other_posttypes = array('attachment','revision','nav_menu_item','wpsc-product-file','mp_order','shop_webhook');
644
  $importas = array(
645
  'Posts' => 'Posts',
646
  'Pages' => 'Pages',
 
647
  'Comments' => 'Comments'
648
  );
649
+
650
+ $active_plugins = get_option( "active_plugins" );
651
+ if(in_array('import-users/index.php', $active_plugins)){
652
+ $importas['Users'] = 'Users';
653
+ }
654
+
655
+ if(in_array('woocommerce/woocommerce.php', $active_plugins) && in_array('import-woocommerce/index.php', $active_plugins)){
656
+ $importas['WooCommerce'] = 'WooCommerce';
657
+ }
658
+
659
  $all_post_types = get_post_types();
660
  foreach($other_posttypes as $ptkey => $ptvalue) {
661
  if (in_array($ptvalue, $all_post_types)) {
667
  $importas[$value] = $value;
668
  }
669
  }
670
+
671
+
672
  # Added support for Customer Reviews plugin
673
  if(in_array('wp-customer-reviews/wp-customer-reviews-3.php', $this->get_active_plugins()) || in_array('wp-customer-reviews/wp-customer-reviews.php', $this->get_active_plugins())) {
674
  $importas['Customer Reviews'] = 'CustomerReviews';
808
  'Conditions' => 'conditions'
809
  );
810
  }
811
+ if($module === 'WooCommerce' && in_array('import-woocommerce/index.php', $this->getActivePlugins())) {
812
+ global $wcomUci_admin;
813
+ $MetaFields = $wcomUci_admin->getMetaFieldsOfWcom();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
814
  }
815
  if($module === 'WooCommerceVariations'){
816
  $MetaFields = array(
1450
  return $WPMemberFields;
1451
  }
1452
 
1453
+ // public function billing_information_for_users () {
1454
+ // $billing_and_shipping_info = array();
1455
+ // if(in_array( 'marketpress/marketpress.php', $this->get_active_plugins() ) || in_array( 'wordpress-ecommerce/marketpress.php', $this->get_active_plugins() )) {
1456
+ // foreach($this->def_mpCols as $mp_key => $mp_val) {
1457
+ // $billing_and_shipping_info['BSI'][$mp_val]['label'] = $mp_key;
1458
+ // $billing_and_shipping_info['BSI'][$mp_val]['name'] = $mp_val;
1459
+ // }
1460
+ // }
1461
+ // if(in_array( 'woocommerce/woocommerce.php', $this->get_active_plugins() )) {
1462
+ // foreach($this->def_wcCols as $woo_key => $woo_val) {
1463
+ // $billing_and_shipping_info['BSI'][$woo_val]['label'] = $woo_key;
1464
+ // $billing_and_shipping_info['BSI'][$woo_val]['name'] = $woo_val;
1465
+ // }
1466
+ // }
1467
+ // return $billing_and_shipping_info;
1468
+ // }
1469
 
1470
  public function terms_and_taxonomies($type, $optionalType = null, $mode = null) {
1471
  $term_taxonomies = array();
1640
  'action' => isset($screen_data['import_config']['handle_duplicate']) ? $screen_data['import_config']['handle_duplicate'] : '',
1641
  'media_handling' => isset($mediaConfig) ? $mediaConfig : ''
1642
  );
1643
+ $active_plugins = get_option("active_plugins");
1644
+ // print_r($uci_admin->getRowMapping());
1645
+ // die();
1646
  foreach ($uci_admin->getRowMapping() as $groupName => $groupValue) {
1647
  #$this->groupName = $groupName;
1648
  //$this->groupMapping = $groupMapping;
1690
  }
1691
  break;
1692
  case 'ECOMMETA':
1693
+ if(in_array('import-woocommerce/index.php', $active_plugins)){
1694
+ global $wcomUci_admin;
1695
+ $wcomUci_admin->importDataOfWcomMeta($groupValue, $this->getLastImportId());
1696
+ }
1697
  break;
1698
  case 'CORECUSTFIELDS':
1699
  $this->importDataForWPMetaFields($groupValue, $this->getLastImportId(), $importType);
1738
  $this->importTermsAndTaxonomies($groupValue, $this->getLastImportId(), $importType);
1739
  break;
1740
  case 'WPMEMBERS':
1741
+ if(in_array('import-users/index.php', $active_plugins)){
1742
+ global $userUci_admin;
1743
+ $returnArr = $userUci_admin->importDataOfusersWPMem($groupValue, $this->getLastImportId());
1744
+ }
1745
  break;
1746
  case 'BSI':
1747
+ if(in_array('import-users/index.php', $active_plugins)){
1748
+ global $userUci_admin;
1749
+ $returnArr = $userUci_admin->importDataOfusersBS($groupValue, $this->getLastImportId());
1750
+ }
1751
  break;
1752
  }
1753
  }
1757
  $returnArr = array();
1758
  global $wpdb, $uci_admin;
1759
  $mode_of_affect = 'Inserted';
1760
+
1761
  if(!$data_array['post_format'])
1762
  {
1763
  if($data_array['post_format_option'])
1770
  if($importType != 'ticket') {
1771
  switch ($importType) {
1772
  case 'Users':
1773
+ $active_plugins = get_option("active_plugins");
1774
+ if(in_array('import-users/index.php', $active_plugins)){
1775
+ global $userUci_admin;
1776
+ $returnArr = $userUci_admin->importDataOfusers($data_array, $mode, $eventKey, $duplicateHandling);
1777
+ }
1778
  break;
1779
  case 'CustomerReviews':
1780
  require_once "class-uci-customer-reviews-data-import.php";
1815
  return $returnArr;
1816
  break;
1817
  case 'WooCommerce':
1818
+ if(in_array('import-woocommerce/index.php', $this->getActivePlugins() ) ){
1819
+ global $wcomUci_admin;
1820
+ $returnArr = $wcomUci_admin->importDataOfWcommerceProduct($data_array, $importType, $mode, $eventKey, $duplicateHandling);
1821
+ }
1822
+ break;
1823
  case 'WooCommerceVariations':
1824
  case 'WooCommerceOrders':
1825
  case 'WooCommerceCoupons':
2543
 
2544
  public function get_mapping_screendata($module,$post_values){
2545
  global $uci_admin;
2546
+ $available_group = $uci_admin->available_widgets($module, '');
2547
  foreach ($available_group as $groupname => $groupvalue) {
2548
  foreach ($post_values as $mapping_key => $mapping_value) {
2549
  $current_mapped_group_mapkey = explode($groupvalue . '__mapping', $mapping_key);
includes/class-uci-media-scheduler.php CHANGED
@@ -186,17 +186,14 @@ class SmackUCIMediaScheduler {
186
  }
187
 
188
  public static function get_img_from_URL($f_img, $fimg_path, $fimg_name) {
189
- $f_img = str_replace(" ", "%20", $f_img);
190
  if ($fimg_path != "" && $fimg_path) {
191
  $fimg_path = $fimg_path . "/" . $fimg_name;
192
  }
193
- $ch = curl_init($f_img);
194
- curl_setopt( $ch, CURLOPT_HEADER, 0 );
195
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
196
- curl_setopt( $ch, CURLOPT_BINARYTRANSFER, 1 );
197
- curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
198
- $rawdata = curl_exec( $ch );
199
- $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
200
  if ( $http_code != 200 && strpos( $rawdata, 'Not Found' ) != 0 ) {
201
  $rawdata = false;
202
  }
@@ -210,7 +207,6 @@ class SmackUCIMediaScheduler {
210
  fwrite( $fp, $rawdata );
211
  fclose( $fp );
212
  }
213
- curl_close($ch);
214
  }
215
 
216
  public static function active_plugins() {
186
  }
187
 
188
  public static function get_img_from_URL($f_img, $fimg_path, $fimg_name) {
189
+ //$f_img = str_replace(" ", "%20", $f_img);
190
  if ($fimg_path != "" && $fimg_path) {
191
  $fimg_path = $fimg_path . "/" . $fimg_name;
192
  }
193
+ // curl removed and used wordpress api for https image support
194
+ $response = wp_remote_get($f_img);
195
+ $rawdata = wp_remote_retrieve_body($response);
196
+ $http_code = wp_remote_retrieve_response_code($response);
 
 
 
197
  if ( $http_code != 200 && strpos( $rawdata, 'Not Found' ) != 0 ) {
198
  $rawdata = false;
199
  }
207
  fwrite( $fp, $rawdata );
208
  fclose( $fp );
209
  }
 
210
  }
211
 
212
  public static function active_plugins() {
includes/class-uci-user-data-import.php DELETED
@@ -1,210 +0,0 @@
1
- <?php
2
- /*********************************************************************************
3
- * WP Ultimate CSV Importer is a Tool for importing CSV for the Wordpress
4
- * plugin developed by Smackcoders. Copyright (C) 2016 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. 2016. All rights reserved".
36
- ********************************************************************************/
37
-
38
- if ( ! defined( 'ABSPATH' ) )
39
- exit; // Exit if accessed directly
40
-
41
- class SmackUCIUserDataImport {
42
-
43
- public function importUserInformation ($data_array, $mode, $eventKey) {
44
- global $uci_admin;
45
- #$data_array = trim($data_array);
46
- if ( isset( $data_array['role'] ) && $data_array['role'] != '') {
47
- $user_capability = '';
48
- if ( !is_numeric( $data_array['role'] ) ) {
49
- $roles = $uci_admin->getRoles();
50
- if(array_key_exists($data_array['role'], $roles)) {
51
- $user_capability = $data_array['role'];
52
- }
53
- } else {
54
- for ( $i = 0; $i <= $data_array['role']; $i ++ ) {
55
- $user_capability .= $i . ",";
56
- }
57
- $roles = $uci_admin->getRoles('cap');
58
- if(in_array( $user_capability, $roles )) {
59
- foreach ( $roles as $rkey => $rval ) {
60
- if ( $rval == $user_capability ) {
61
- $user_capability = $rkey;
62
- }
63
- }
64
- } else {
65
- $user_capability = ''; #TODO: Add log message for assigning the default role
66
- }
67
- }
68
- if($user_capability != '')
69
- $data_array['role'] = $user_capability;
70
- else
71
- $data_array['role'] = 'subscriber'; #TODO: Add log message for assigning the default role
72
- } else {
73
- $data_array['role'] = 'subscriber'; #TODO: Add log message for assigning the default role
74
- }
75
-
76
- $user_email = $data_array['user_email'];
77
- if ( empty( $data_array['user_pass'] ) ) {
78
- $data_array['user_pass'] = wp_generate_password( 12, false );
79
- $additional_meta_info = array(
80
- 'user_login' => $data_array['user_login'],
81
- 'user_pass' => $data_array['user_pass'],
82
- 'user_email' => $data_array['user_email'],
83
- 'role' => $data_array['role']
84
- );
85
- $data_array['smack_uci_import'] = $additional_meta_info;
86
- }
87
-
88
- if ( $mode == 'Insert' ) {
89
- $retID = wp_insert_user( $data_array );
90
-
91
- $mode_of_affect = 'Inserted';
92
- if ( is_wp_error( $retID ) ) {
93
- #echo $retID->get_error_message();
94
- $uci_admin->detailed_log[$uci_admin->processing_row_id]['Message'] = "Skipped, Due to duplicate User found with same email!.";
95
- return array('MODE' => $mode, 'ERROR_MSG' => $retID->get_error_message());
96
- #TODO Exception
97
- }
98
- $uci_admin->setAffectedRecords($retID);
99
- #$_SESSION[$eventKey]['summary']['inserted'][] = $retID;
100
- $uci_admin->setInsertedRowCount( $uci_admin->getInsertedRowCount() + 1 );
101
- $uci_admin->detailed_log[$uci_admin->processing_row_id]['Message'] = 'Inserted User ID: ' . $retID;
102
- } else {
103
- if ( ( $mode == 'Update' ) || ( $mode == 'Schedule' ) ) {
104
- global $wpdb;
105
- //$update_query = "select ID from $wpdb->users where user_email = '{$user_email}' order by ID DESC";
106
- $update_query = $wpdb->prepare( "select ID from $wpdb->users where user_email = %s order by ID DESC", $user_email );
107
- $ID_result = $wpdb->get_results( $update_query );
108
- if ( is_array( $ID_result ) && ! empty( $ID_result ) ) {
109
- $retID = $ID_result[0]->ID;
110
- $data_array['ID'] = $retID;
111
- wp_update_user( $data_array );
112
- $mode_of_affect = 'Updated';
113
- $uci_admin->setUpdatedRowCount( $uci_admin->getUpdatedRowCount() + 1 );
114
- $uci_admin->detailed_log[$uci_admin->processing_row_id]['Message'] = 'Updated User ID: ' . $retID;
115
- $uci_admin->setAffectedRecords($retID);
116
- #$_SESSION[$eventKey]['summary']['updated'][] = $retID;
117
- } else {
118
- $retID = wp_insert_user( $data_array );
119
- if ( is_wp_error( $retID ) ) {
120
- #echo $retID->get_error_message();
121
- $uci_admin->detailed_log[$uci_admin->processing_row_id]['Message'] = "Skipped, Due to duplicate User found with same email!.";
122
- return array('MODE' => $mode, 'ERROR_MSG' => $retID->get_error_message());
123
- #TODO Exception
124
- }
125
- $mode_of_affect = 'Inserted';
126
- $uci_admin->setAffectedRecords($retID);
127
- #$_SESSION[$eventKey]['summary']['inserted'][] = $retID;
128
- $uci_admin->setInsertedRowCount( $uci_admin->getInsertedRowCount() + 1 );
129
- $uci_admin->detailed_log[$uci_admin->processing_row_id]['Message'] = 'Inserted User ID: ' . $retID;
130
- }
131
- } else {
132
- $retID = wp_insert_user( $data_array );
133
- if ( is_wp_error( $retID ) ) {
134
- #echo $retID->get_error_message();
135
- $uci_admin->detailed_log[$uci_admin->processing_row_id]['Message'] = "Skipped, Due to duplicate User found with same email!.";
136
- return array('MODE' => $mode, 'ERROR_MSG' => $retID->get_error_message());
137
- #TODO Exception
138
- }
139
- $mode_of_affect = 'Inserted';
140
- $uci_admin->setAffectedRecords($retID);
141
- #$_SESSION[$eventKey]['summary']['inserted'][] = $retID;
142
- $uci_admin->setInsertedRowCount( $uci_admin->getInsertedRowCount() + 1 );
143
- $uci_admin->detailed_log[$uci_admin->processing_row_id]['Message'] = 'Inserted User ID: ' . $retID;
144
- }
145
- }
146
- $metaData = array();
147
- foreach ( $data_array as $daKey => $daVal ) {
148
- switch ( $daKey ) {
149
- case 'biographical_info' :
150
- $metaData['description'] = $data_array[ $daKey ];
151
- break;
152
- case 'disable_visual_editor' :
153
- $metaData['rich_editing'] = $data_array[ $daKey ];
154
- break;
155
- case 'enable_keyboard_shortcuts':
156
- $metaData['comment_shortcuts'] = $data_array[ $daKey ];
157
- break;
158
- case 'admin_color':
159
- $metaData['admin_color'] = $data_array[ $daKey ];
160
- break;
161
- case 'show_toolbar':
162
- $metaData['show_admin_bar_front'] = $data_array[ $daKey ];
163
- break;
164
- case 'smack_uci_import':
165
- $metaData['smack_uci_import'] = $data_array[ $daKey ];
166
- }
167
- }
168
- if ( ! empty ( $metaData ) ) {
169
- foreach ( $metaData as $meta_key => $meta_value ) {
170
- update_user_meta( $retID, $meta_key, $meta_value );
171
- }
172
- }
173
- $uci_admin->detailed_log[$uci_admin->processing_row_id]['Email'] = $data_array['user_email'];
174
- $uci_admin->detailed_log[$uci_admin->processing_row_id]['Role'] = $data_array['role'];
175
- return array('ID' => $retID, 'MODE' => $mode_of_affect);
176
- }
177
-
178
- public function importDataForUsers_BillingShipping($data_array, $uID){
179
- foreach( $data_array as $daKey => $daVal ) {
180
- if(strpos($daKey, 'msi_') === 0) {
181
- $msi_custom_key = substr($daKey, 4);
182
- $msi_shipping_array[$msi_custom_key] = $daVal;
183
- } elseif(strpos($daKey, 'mbi_') === 0) {
184
- $mbi_custom_key = substr($daKey, 4);
185
- $mbi_billing_array[$mbi_custom_key] = $daVal;
186
- } else {
187
- update_user_meta($uID, $daKey, $daVal);
188
- }
189
- }
190
- //Import MarketPress Shipping Info
191
- if (!empty ($msi_shipping_array)) {
192
- $custom_key = 'mp_shipping_info';
193
- update_user_meta($uID, $custom_key, $msi_shipping_array);
194
- }
195
- //Import MarketPress Billing Info
196
- if (!empty ($mbi_billing_array)) {
197
- $custom_key = 'mp_billing_info';
198
- update_user_meta($uID, $custom_key, $mbi_billing_array);
199
- }
200
- }
201
-
202
- public function importDataForUsers_WPMembers($data_array, $uID) {
203
- #$createdFields = array();
204
- if(!empty($data_array)) {
205
- foreach ($data_array as $custom_key => $custom_value) {
206
- update_user_meta($uID, $custom_key, $custom_value);
207
- }
208
- }
209
- }
210
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
index.php CHANGED
@@ -2,9 +2,8 @@
2
  /******************************
3
  * Plugin Name: WP Ultimate CSV Importer
4
  * Description: Seamlessly create posts, custom posts, pages, media, SEO and more from your CSV data with ease.
5
- * Version: 5.3.1
6
  * Author: smackcoders
7
- * Plugin URI: http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html?utm_source=plugin&utm_campaign=csv_importer_pro&utm_medium=wordpress
8
  * Author URI: http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html?utm_source=plugin&utm_campaign=csv_importer_pro&utm_medium=wordpress
9
  * Text Domain: wp-ultimate-csv-importer
10
  * Domain Path: /languages/
@@ -57,7 +56,7 @@ if ( ! class_exists( 'SM_WPUltimateCSVImporter' ) ) :
57
  */
58
  class SM_WPUltimateCSVImporter {
59
 
60
- public $version = '5.3';
61
 
62
  /**
63
  * The single instance of the class.
@@ -128,7 +127,7 @@ if ( ! class_exists( 'SM_WPUltimateCSVImporter' ) ) :
128
  }
129
  } ); */
130
  add_action('wp_dashboard_setup', array($this,'uci_pro_add_dashboard_widgets'));
131
- add_action('smack_uci_email_scheduler', array('SmackUCIEmailScheduler', 'send_login_credentials_to_users'));
132
  add_action('smack_uci_image_scheduler', array('SmackUCIMediaScheduler', 'populateFeatureImages'));
133
  register_deactivation_hook( __FILE__, array( 'SmackUCIUnInstall', 'uninstall' ) );
134
  }
@@ -183,14 +182,14 @@ if ( ! class_exists( 'SM_WPUltimateCSVImporter' ) ) :
183
  include_once ( 'includes/class-uci-admin-ajax.php' );
184
  include_once ( 'includes/class-uci-event-logging.php' );
185
  include_once ( 'admin/class-uci-admin.php' );
186
- include_once ( 'includes/class-uci-email-scheduler.php' );
187
  include_once ( 'includes/class-uci-media-scheduler.php' );
188
  #SmackUCIMediaScheduler::populateFeatureImages();
189
  }
190
 
191
  public function smack_uci_enqueue_scripts() {
192
  // Register / Enqueue the plugin scripts & style
193
- $uciPages = array('sm-uci-dashboard', 'sm-uci-import', 'sm-uci-managers', 'sm-uci-export', 'sm-uci-settings', 'sm-uci-support');
194
  if (isset($_REQUEST['page']) && in_array(sanitize_text_field($_REQUEST['page']), $uciPages)) {
195
  // Ultimate CSV Importer Styles
196
  wp_enqueue_style( 'ultimate-css', plugins_url( 'assets/css/ultimate-importer.css', __FILE__ ) );
2
  /******************************
3
  * Plugin Name: WP Ultimate CSV Importer
4
  * Description: Seamlessly create posts, custom posts, pages, media, SEO and more from your CSV data with ease.
5
+ * Version: 5.3.2
6
  * Author: smackcoders
 
7
  * Author URI: http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html?utm_source=plugin&utm_campaign=csv_importer_pro&utm_medium=wordpress
8
  * Text Domain: wp-ultimate-csv-importer
9
  * Domain Path: /languages/
56
  */
57
  class SM_WPUltimateCSVImporter {
58
 
59
+ public $version = '5.3.2';
60
 
61
  /**
62
  * The single instance of the class.
127
  }
128
  } ); */
129
  add_action('wp_dashboard_setup', array($this,'uci_pro_add_dashboard_widgets'));
130
+ // add_action('smack_uci_email_scheduler', array('SmackUCIEmailScheduler', 'send_login_credentials_to_users'));
131
  add_action('smack_uci_image_scheduler', array('SmackUCIMediaScheduler', 'populateFeatureImages'));
132
  register_deactivation_hook( __FILE__, array( 'SmackUCIUnInstall', 'uninstall' ) );
133
  }
182
  include_once ( 'includes/class-uci-admin-ajax.php' );
183
  include_once ( 'includes/class-uci-event-logging.php' );
184
  include_once ( 'admin/class-uci-admin.php' );
185
+ //include_once ( 'includes/class-uci-email-scheduler.php' );
186
  include_once ( 'includes/class-uci-media-scheduler.php' );
187
  #SmackUCIMediaScheduler::populateFeatureImages();
188
  }
189
 
190
  public function smack_uci_enqueue_scripts() {
191
  // Register / Enqueue the plugin scripts & style
192
+ $uciPages = array('sm-uci-dashboard', 'sm-uci-import', 'sm-uci-managers', 'sm-uci-export', 'sm-uci-settings', 'sm-uci-support', 'sm-uci-addons');
193
  if (isset($_REQUEST['page']) && in_array(sanitize_text_field($_REQUEST['page']), $uciPages)) {
194
  // Ultimate CSV Importer Styles
195
  wp_enqueue_style( 'ultimate-css', plugins_url( 'assets/css/ultimate-importer.css', __FILE__ ) );
screenshot-2.png CHANGED
Binary file
screenshot-8.png DELETED
Binary file