Ultimate CSV Importer - Version 3.6.3

Version Description

Download this release

Release Info

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

Code changes from version 3.6.2 to 3.6.3

Readme.txt CHANGED
@@ -1,428 +1,435 @@
1
- === WP Ultimate CSV Importer Plugin ===
2
- Contributors: smackcoders
3
- Donate link: http://www.smackcoders.com/donate.html
4
- Tags: batch, csv, excel, import, spreadsheet, autoblog, Autoblogger, csvimporter, data, dataimport, importer, wpcsvimporter, wpimporter, acf, auto blog, csv import, csv to post, data import, Easy CSV Importer, eci, import plugin, admin, user, users, Advanced CSV Import, Advanced CSV Importer, affiliate, amazon, author, automatic, blog, buddypress, bulk, bulk edit, bulk editor, categories, comments, content, csv file, csv format, csv importer, custom post, e-commerce, free, images, language, manage, media, meta, multisite, News, page, photos, pictures, plugin, Post, seo, shop, shortcode, tags, Taxonomy, text, title, video, woocommerce, wordpress, xml, youtube
5
- Requires at least: 3.6.0
6
- Tested up to: 3.9.2
7
- Stable tag: 3.6.2
8
- Version: 3.6.2
9
- Author: smackcoders
10
- Author URI: http://profiles.wordpress.org/smackcoders/
11
-
12
- License: GPLv2 or later
13
-
14
- Advanced CSV Importer plugin to import posts, pages, custom posts with custom fields with few simple clicks
15
-
16
- == Description ==
17
-
18
- **Version 3.6 is now available with new users much requested features like auto UTF-8 handling, auto mapping, auto delimiter and more. Visit [www.wpultimatecsvimporter.com](http://www.wpultimatecsvimporter.com) for more news and future plans.
19
-
20
- WP Ultimate CSV Importer Plugin proven much effective advanced CSV File Importer With Ultimate User Friendly Features. It is much easy now even for newbies to import any csv file as any wordpress post type and associated fields by simple mapping feature. Now import any CSV file as thousands of post, page and custom post types. This is admin side free plugin helps you in bulk edit, create and import posts type for your blog or site.
21
-
22
- = Video Walkthrough =
23
-
24
- <p>http://www.youtube.com/watch?v=OwKdt_NlT2U&list=PL2k3Ck1bFtbQqFhOK7g08kxENI4qQkmC</p>
25
-
26
- = Highlights =
27
- * Auto delimiter
28
- * Auto UTF-8 handling
29
- * All-in-SEO import support.
30
- * Drag drop import
31
- * Define any type of post
32
- * Control post status (Publish, Private, Pending, Draft, Sticky and Protected)
33
- * Simple yet Powerful mapping feature
34
- * Convert any csv import as perfect posts and fields
35
- * Scheduled Publishing
36
- * Duplicate Title and content handling
37
- * Multi Lingual import (CSV format must be UTF-8 without BOM)
38
- * Mutisite and Buddypress also supported now
39
- * Compatible to wordpress themes
40
- * Better alternative for xml
41
- * Post Format option added
42
- * Page template attribute feature
43
-
44
- = Power Import Features to Control your csv import =
45
- * Post title, content and even excerpt
46
- * Text, WYSIWYG/HTML, in line CSS in post content
47
- * Images, Youtube, Videos in post content
48
- * Featured image by Url
49
- * Multi authors
50
- * Multiple tags and categories
51
- * Non existing tags and categories are created automatically
52
- * Any Short Codes in post content
53
- * Assign sidebar widget, slider, slide show as short codes
54
- * Manual slug feature for SEO friendly urls
55
- * Different post status for each post in CSV file.
56
- * Custom fields support for WP standard
57
- * Map custom fields by adding new on the fly.
58
-
59
- The csv importer supports almost every wordpress modules and plugin fields as follows. Import data feed periodically from csv file as
60
-
61
- = Supported Core Modules and Attributes =
62
- * Post
63
- * Page
64
- * Standard WP Custom Post types
65
- * Wordpress themes custom posts
66
- * Custom post type UI plugin Post types
67
- * Users with roles
68
- * Comments
69
- * Custom Fields
70
- * Author
71
- * Tags
72
- * Categories
73
-
74
- It is more easy to convert any off line database maintained in Excel xls or spread sheets into valuable content for your web site without missing any. It is possible now to schedule a periodical content update, maintenance, prices, offers, coupons and inventory etc.
75
-
76
- Much improved User interface with most flexible jquery plugin features and bootstrap UI design makes csv import more simple, easy, fast and even more flexible for better user experience. With improved Multi site, buddy press compatibility (except user import module) works well for most of the best wordpress themes available online. Now manage multi site & buddy press, amazon data import, affiliates blog, product inventory, ecommerce store, multi author blog, automatic news import, photo blog etc periodically with simple click import.
77
-
78
- = Common Issues =
79
-
80
- How to solve auto_prepend_file and auto_append_file error?
81
-
82
- Check your phpinfo.php. Ensure that auto_prepend_file and auto_append_file options are disabled. If not you can disable it in php.ini settings file your self. You can also do it by a .htaccess file
83
-
84
- Create an .htaccess file in root and set the following values.
85
- php_value auto_prepend_file none
86
- php_value auto_append_file none
87
-
88
- This will solve your issue or get support from hosting if you dint have sufficient permission.
89
-
90
- = Extended Pro Power Features in Wp Ultimate CSV Importer =
91
- * Types Plugin support
92
- * Woocommerce CSV importer with product variation
93
- * Marketpress Lite Importer
94
- * WP Members Importer
95
- * WP Customer Reviews Importer
96
- * Auto Schedule all your Imports
97
- * Save mapping as Templates for reuse
98
- * Auto Mapping Feature
99
- * Strict UTF-8 auto conversion
100
- * All In One SEO Fields Import
101
- * Wordpress SEO by Yoast Fields Import
102
- * Custom Post Type UI plugin import
103
- * Advanced Custom Fields Import
104
- * CCTM Posts and Fields Import
105
- * Woocommerce CSV Importer,
106
- * eshop CSV Importer
107
- * wp ecommerce Products CSV Importer with WP e-Commerce Custom Fields
108
- * Categories & tags Import with Category icons plugin support
109
- * Custom Taxonomy import
110
- * [Get Complete List of supported 3rd party plugins here](http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html)
111
-
112
-
113
- [Read More about Pro>>](http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html) or [Test Drive Our Live Demo](http://demo.smackcoders.com/demowpthree/wp-admin/admin.php?page=wp-ultimate-csv-importer-pro/index.php&__module=dashboard)
114
-
115
- = Imp. Notes =
116
- * All CSV files should be should be strictly UTF-8 CSV format. Now this can be handled by plugin.
117
- * All wordpress supported languages can imported with csv format as UTF-8 without BOM (See FAQ for instructions).
118
- * User import option is disabled for multi site mode.
119
- * To Schedule posts for publishing provide future date and time in date column in CSV File.
120
-
121
- Featured Image Support
122
- Your wordpress theme should support featured image. If not, please add the following code to where you need to display E.g. wp-contents/themes/header.php
123
- `<?php add_theme_support( 'post-thumbnails' ); ?>`
124
-
125
- Also you can follow the instructions as given here
126
-
127
- * [http://codex.wordpress.org/Function_Reference/the_post_thumbnail](http://codex.wordpress.org/Function_Reference/the_post_thumbnail)
128
- * [http://codex.wordpress.org/Post_Thumbnails](http://codex.wordpress.org/Post_Thumbnails)
129
- * [http://wordpress.org/support/topic/featured-image-not-showing-7?replies=5](http://wordpress.org/support/topic/featured-image-not-showing-7?replies=5)
130
-
131
- Need More Help, Cool. Browse Below Links
132
-
133
- * [Get Pro Power Features, check here](http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html)
134
- * [Wiki and Documentation](http://wiki.smackcoders.com/WP_Ultimate_CSV_Importer)
135
- * [Tutorials, Guides, Blog News and Updates](http://blog.smackcoders.com/category/free-wordpress-plugins/wordpress-ultimate-csv-importer-plugin/)
136
- * [Video Walkthrough](http://wiki.smackcoders.com/WP_Ultimate_CSV_Importer_Videos)
137
- * [Get the Sample CSV Files Here](http://blog.smackcoders.com/wordpress-ultimate-csv-importer-csv-sample-files-and-updates.html)
138
- * [Download CSV Format Cheat Sheets Here](http://blog.smackcoders.com/how-to-make-one-click-easy-csv-import-in-wordpress-free-cheat-sheet-downloads.html)
139
-
140
- == Installation ==
141
-
142
- * [Step By Step Installation Wiki with Snaps](http://wiki.smackcoders.com/WP_Ultimate_CSV_Importer_Free_Version_1.1.1_Installation_and_Configuration)
143
-
144
-
145
- == Screenshots ==
146
-
147
- 1. New Interactive Dashboard with Chart and Graph
148
- 2. Advanced CSV Importer With Ultimate User Friendly Features with drag and drop etc.
149
- 3. User friendly easy mapping for any csv file data to wordpress field attributes with sampling.
150
- 4. Advanced duplicate post name and content check with server request control for high performance factor.
151
- 5. Detailed real time log to know pinpoint status.
152
- 6. Module based environment for easy and reduced interface to enable most required modules and when ever needed.
153
- 7. Inbuilt support form for easy feedback, support, feature request with all useful links for easy and better csv import.
154
- 8. New export module for posts, page, users, comments and all custom posts type plugins.
155
-
156
-
157
- == Frequently Asked Questions ==
158
-
159
- = Common Issues =
160
-
161
- How to solve auto_prepend_file and auto_append_file error?
162
-
163
- Check your phpinfo.php. Ensure that auto_prepend_file and auto_append_file options are disabled. If not you can disable it in php.ini settings file your self. You can also do it by a .htaccess file
164
-
165
- Create an .htaccess file in root and set the following values.
166
- php_value auto_prepend_file none
167
- php_value auto_append_file none
168
-
169
- This will solve your issue or get support from hosting if you dint have sufficient permission.
170
-
171
- [Click Here for Detailed FAQs](http://wiki.smackcoders.com/WP_Ultimate_CSV_Importer_FAQ)
172
- [CSV File and Format Related](http://wiki.smackcoders.com/WP_Ultimate_CSV_Importer_FAQ#CSV_File_and_Format_Related)
173
-
174
-
175
- == Changelog ==
176
-
177
- = 3.6.2 =
178
- * Hot security fix added.
179
-
180
- = 3.6.1 =
181
- * Multi-site support issue fixed
182
- * Duplicate import issue fixed
183
- * Security issue fixed
184
-
185
- = 3.6 =
186
- * New interactive graphs and charts in plugin dashboard
187
- * New Admin dashboard widgets
188
- * Added Users and comments export feature
189
- * Auto delimiter handling
190
- * Auto mapping feature
191
- * Now allow authors to access import features
192
-
193
- = 3.5.5 =
194
- * post_format attribute support added
195
- * page_template attribute added
196
- * update_post_meta added for duplicate meta issue (Thanks to @alantygel)
197
- * Type error issue in jQuery fixed
198
-
199
- = 3.5.4 =
200
- * Added: All-in-SEO import support.
201
- * WordPress 3.9.1 compatibility added.
202
-
203
- = 3.5.3 =
204
- * Added: Compatible up to WordPress 3.9.
205
- * Added: Export feature added for posts, page, custom posts type plugins.
206
- * Improved: Removed all warnings.
207
- * Fixed reported bugs
208
-
209
- = 3.5.2 =
210
- * Import posts with author names as numerical apart from User ID
211
- * Added menu_order attribute import
212
- * Added Auto image rename option
213
- * Option to cancel an partial import at middle
214
- * Improved image handling even special characters in Url
215
- * Import can handle image urls without any extensions
216
- * User reported bugs fixed
217
-
218
- = 3.5.1 =
219
- * User reported issue fixes
220
- * Activation and other plugin conflict issue solved like Jet pack
221
- * Admin UI freezing issues - screen option, Help links issues fixed.
222
- * WYSIWIG editor UI issue fixed.
223
-
224
- = 3.5.0 =
225
- * Combined major release version of 3.5 and 3.4
226
- * Improved MVC structure.
227
- * Improved User interface with drag and drop feature.
228
- * Improved: WordPress 3.8.1 compatibility added.
229
- * Module based system allows simplify UI
230
- * Added: Detailed log feature added.
231
- * Added: Support and Useful links added.
232
- * Added: Support made easy now from plugin.
233
-
234
- = 3.3.1 =
235
- * Added: Multi site compatibility except User import.
236
- * Added: Comments, Users modules mandatory fields validation added.
237
- * Improved: Removed unwanted warnings.
238
-
239
- = 3.3.0 =
240
- * Added: WordPress 3.8 compatibility.
241
- * Added: Bulk users with role import feature.
242
- * Added: Comments import feature with relevant post ids.
243
-
244
- = 3.2.3 =
245
- * Added: WordPress 3.7.1 compatibility added.
246
- * Added: Different media path support added.
247
- * Added: Sub folder installations support added.
248
- * Improved: Updated plugin directory path.
249
- * Improved: Removed unwanted warnings.
250
- * Improved: Performance check.
251
-
252
- = 3.2.2 =
253
- * Added: WordPress 3.6.1 compatibility added.
254
- * Added: Mapping UI improved with on select dynamic update feature
255
- * Added: Help content added
256
- * Fixed: Post slug issue fixed and tested for 3.6 and 3.6.1
257
-
258
- = 3.2.1 =
259
- * Improved: Performance improvements on SQL and CSV parsing
260
- * Fixed: Plugin deactivation issue fixed and updated the code.
261
- * Fixed: Links in the cells makes problems with the "quote"
262
- * Fixed: Loading content from more than one column
263
- * Fixed: Custom Post type issues fixed
264
-
265
- = 3.2.0 =
266
- * Improved: User interface improvements
267
- * Improved:WordPress 3.6 compatibility added, Much Improved UI.
268
- * Fixed: Featured image issues fixed for WordPress-3.6.
269
-
270
- = 3.1.0 =
271
- * Improved: Much Improved Featured Image feature
272
- * Fixed: Image url for featured image issues fixed
273
- * Fixed: PHP 5.4 upgrade fix
274
-
275
- = 3.0.0 =
276
- * Added: Category in numericals are restricted and skipped to Uncategorized
277
- * Added: Now password should be mentioned as {password}
278
- * Added: Post authors can be User ID or name
279
- * Improved: Much improved work flow
280
- * Improved: Add custom field option improved.
281
- * Improved: Date format handling improved
282
- * Improved: Any Date format is supported now
283
- * Improved: Future scheduling and status improved
284
- * Improved: Can apply post status for individual post via csv itself
285
- * Improved: Featured image handling improved and fixed. More improvement are scheduled.
286
- * Improved: Duplicate check options improved for both title and content option.
287
- * Improved: Post author issue fixed and improved
288
- * Improved: Wrong user id or name are automatically assigned under admin
289
- * Improved: Multi category and tags improved
290
- * Fixed: Custom Field mapping and import fixed
291
- * Fixed: Overall Status option improved and issue fixed
292
- * Fixed: Password field fixed for Protected
293
- * Fixed: Status as in CSV option improved and fixed
294
-
295
- = 2.7.0 =
296
- * Added: Added more post status options
297
- * Added: Publish, Sticky, Private, Draft and Pending Status for whole import
298
- * Added: Protected status with a common password option added
299
- * Added: "Status as in CSV" to assign status for individual post through CSV as ID or Field Tag
300
- * Added: User ID and User Name support for Post author feature added
301
- * Added: In case of missing or false IDs post assigned to admin as draft
302
- * Added: Add Custom Field Text box auto-filled with CSV header tag.
303
- * Added: Duplicate detection for post content and post title added as options.
304
- * Added: User can choose either one or both to avoid duplicate issues.
305
- * Improved: 6 Standard date format added as drop down to choose.
306
- * Improved: Renamed post_name as post_slug to avoid confusion
307
- * Improved: Mapping Fields
308
- * Improved: Field tags are formatted to support auto mapping option (next milestone)
309
- * Improved: Listed custom fields with prefix as CF: Name for easy identification.
310
- * Fixed: Date format conflict at import fixed.
311
-
312
-
313
- = 2.6.0 =
314
- * Fixed: Major Bug fixed
315
- * Fixed: Added UTF-8 support.
316
- * Fixed: Fixed Html tag conflicts.
317
-
318
- = 2.5.0 =
319
- * Major issues fixed and updated to WordPress-3.5.1 compatibility.
320
-
321
- = 2.0.1 =
322
- * Update to WordPress-3.5 compatibility.
323
-
324
- = 2.0.0 =
325
- * WPDEBUG errors fixed. CSV import folder changed to WP native uploads folder.
326
-
327
- = 1.1.1 =
328
- * Renamed the mapping field attachment as featured_image and category as post_category.
329
-
330
- = 1.1.0 =
331
- * Added featured image import feature along with post/page/custom post.
332
-
333
- = 1.0.2 =
334
- * Bug fixed to recognize the trimmed trailing space in the CSV file
335
- * Added validation for the duplicate field mapping.
336
-
337
- = 1.0.1 =
338
- * Added features to import multiple tags and categories with different delimiters.
339
-
340
- = 1.0.0 =
341
- * Initial release version. Tested and found works well without any issues.
342
-
343
-
344
-
345
- == Upgrade Notice ==
346
-
347
- = 3.6.2 =
348
- * Important Security Update
349
-
350
- = 3.6.1 =
351
- * Important issue fixes update
352
-
353
- = 3.6 =
354
- * Must upgrade with major values added features
355
-
356
- = 3.5.5 =
357
- * Upgrade for minor bug fix, conflicts and new attribute support.
358
-
359
- = 3.5.4 =
360
- * Upgrade now for All-in-SEO import support.
361
-
362
- = 3.5.3 =
363
- * Upgrade for added export feature and bug fixes
364
-
365
- = 3.5.2 =
366
- * Upgrade for bug free version and improved image handling
367
-
368
- = 3.5.1 =
369
- * Must upgrade now for 3.5 bug fixes
370
-
371
- = 3.5.0 =
372
- * Upgrade now for major release 3.5. Note - Old version files need to be deleted.
373
-
374
- = 3.3.1 =
375
- * Upgrade now for multi site compatibility.
376
-
377
- = 3.3.0 =
378
- * Upgrade now for WP 3.8 compatibility and added bulk user,comments feature.
379
-
380
- = 3.2.3 =
381
- * Upgrade for WordPress 3.7.1 compatibility and minor bug fixes
382
-
383
- = 3.2.2 =
384
- * WordPress 3.6.1 compatible, bug fix and UI improvements
385
-
386
- = 3.2.1 =
387
- * Performance improvements on SQL and CSV parsing
388
-
389
- = 3.2.0 =
390
- * Now compatible with 3.6 and improved featured image
391
-
392
- = 3.1.0 =
393
- * Now Much Improved Featured Image and url handling
394
-
395
- = 3.0.0 =
396
- * Must upgrade to have Major improvements, performance fixes and issue fixes
397
-
398
- = 2.7.0 =
399
- * Major improvements and feature changes.
400
-
401
- = 2.6.0 =
402
- * Bug fixed and should upgrade.
403
-
404
- = 2.5.0 =
405
- * Duplicate detection added.
406
- * Added more information in success message.
407
- * Import memory issues solved.
408
-
409
- = 2.0.1 =
410
- * Update to WordPress-3.5 compatibility.
411
-
412
- = 2.0.0 =
413
- * Major Bug fixed and should upgrade. WPDEBUG errors fixed. CSV import folder changed to WP native uploads folder.
414
-
415
- = 1.1.1 =
416
- * Minor correction and fix applied.
417
-
418
- = 1.1.0 =
419
- * A major new feature added in this version. Update needed.
420
-
421
- = 1.0.2 =
422
- * This version have important bug fixes and newly added features. Must be upgrade immediately.
423
-
424
- = 1.0.1 =
425
- * Added features to import multiple tags and categories with different delimiters.
426
-
427
- = 1.0.0 =
428
- * Initial release of plugin.
 
 
 
 
 
 
 
1
+ === WP Ultimate CSV Importer Plugin ===
2
+ Contributors: smackcoders
3
+ Donate link: http://www.smackcoders.com/donate.html
4
+ Tags: batch, csv, excel, import, spreadsheet, autoblog, Autoblogger, csvimporter, data, dataimport, importer, wpcsvimporter, wpimporter, acf, auto blog, csv import, csv to post, data import, Easy CSV Importer, eci, import plugin, admin, user, users, Advanced CSV Import, Advanced CSV Importer, affiliate, amazon, author, automatic, blog, buddypress, bulk, bulk edit, bulk editor, categories, comments, content, csv file, csv format, csv importer, custom post, e-commerce, free, images, language, manage, media, meta, multisite, News, page, photos, pictures, plugin, Post, seo, shop, shortcode, tags, Taxonomy, text, title, video, eshop, woocommerce, wordpress, xml, youtube
5
+ Requires at least: 3.8
6
+ Tested up to: 4.0
7
+ Stable tag: 3.6.3
8
+ Version: 3.6.3
9
+ Author: smackcoders
10
+ Author URI: http://profiles.wordpress.org/smackcoders/
11
+
12
+ License: GPLv2 or later
13
+
14
+ Advanced CSV Importer plugin to import posts, pages, eshop products, custom posts with custom fields with few simple clicks
15
+
16
+ == Description ==
17
+
18
+ **Version 3.6.3 is now available with eshop(ecommerce) products import feature. Visit [www.wpultimatecsvimporter.com](http://www.wpultimatecsvimporter.com) for more news and future plans.
19
+
20
+ WP Ultimate CSV Importer Plugin proven much effective advanced CSV File Importer With Ultimate User Friendly Features. It is much easy now even for newbies to import any csv file as any wordpress post type and associated fields by simple mapping feature. Now import any CSV file as thousands of post, page and custom post types. This is admin side free plugin helps you in bulk edit, create and import posts type for your blog or site.
21
+
22
+ = Video Walkthrough =
23
+
24
+ <p>http://www.youtube.com/watch?v=OwKdt_NlT2U&list=PL2k3Ck1bFtbQqFhOK7g08kxENI4qQkmC</p>
25
+
26
+ = Highlights =
27
+ * Auto delimiter
28
+ * Auto UTF-8 handling
29
+ * All-in-SEO import support.
30
+ * Drag drop import
31
+ * Define any type of post
32
+ * Control post status (Publish, Private, Pending, Draft, Sticky and Protected)
33
+ * Simple yet Powerful mapping feature
34
+ * Convert any csv import as perfect posts and fields
35
+ * Scheduled Publishing
36
+ * Duplicate Title and content handling
37
+ * Multi Lingual import (CSV format must be UTF-8 without BOM)
38
+ * Mutisite and Buddypress also supported now
39
+ * Compatible to wordpress themes
40
+ * Better alternative for xml
41
+ * Post Format option added
42
+ * Page template attribute feature
43
+ * EShop Proucts import (included from V3.6.3)
44
+ = Power Import Features to Control your csv import =
45
+ * Post title, content and even excerpt
46
+ * Text, WYSIWYG/HTML, in line CSS in post content
47
+ * Images, Youtube, Videos in post content
48
+ * Featured image by Url
49
+ * Multi authors
50
+ * Multiple tags and categories
51
+ * Non existing tags and categories are created automatically
52
+ * Any Short Codes in post content
53
+ * Assign sidebar widget, slider, slide show as short codes
54
+ * Manual slug feature for SEO friendly urls
55
+ * Different post status for each post in CSV file.
56
+ * Custom fields support for WP standard
57
+ * Map custom fields by adding new on the fly.
58
+
59
+ The csv importer supports almost every wordpress modules and plugin fields as follows. Import data feed periodically from csv file as
60
+
61
+ = Supported Core Modules and Attributes =
62
+ * Post
63
+ * Page
64
+ * Standard WP Custom Post types
65
+ * Wordpress themes custom posts
66
+ * Custom post type UI plugin Post types
67
+ * Users with roles
68
+ * Comments
69
+ * Custom Fields
70
+ * Author
71
+ * Tags
72
+ * Categories
73
+ * Eshop
74
+
75
+ It is more easy to convert any off line database maintained in Excel xls or spread sheets into valuable content for your web site without missing any. It is possible now to schedule a periodical content update, maintenance, prices, offers, coupons and inventory etc.
76
+
77
+ Much improved User interface with most flexible jquery plugin features and bootstrap UI design makes csv import more simple, easy, fast and even more flexible for better user experience. With improved Multi site, buddy press compatibility (except user import module) works well for most of the best wordpress themes available online. Now manage multi site & buddy press, Amazon data import, affiliates blog, product inventory, ecommerce store, multi author blog, automatic news import, photo blog etc periodically with simple click import.
78
+
79
+ = Common Issues =
80
+
81
+ How to solve auto_prepend_file and auto_append_file error?
82
+
83
+ Check your phpinfo.php. Ensure that auto_prepend_file and auto_append_file options are disabled. If not you can disable it in php.ini settings file your self. You can also do it by a .htaccess file
84
+
85
+ Create an .htaccess file in root and set the following values.
86
+ php_value auto_prepend_file none
87
+ php_value auto_append_file none
88
+
89
+ This will solve your issue or get support from hosting if you dint have sufficient permission.
90
+
91
+ = Extended Pro Power Features in Wp Ultimate CSV Importer =
92
+ * Types Plugin support
93
+ * Woocommerce CSV importer with product variation
94
+ * Marketpress Lite Importer
95
+ * WP Members Importer
96
+ * WP Customer Reviews Importer
97
+ * Auto Schedule all your Imports
98
+ * Save mapping as Templates for reuse
99
+ * Auto Mapping Feature
100
+ * Strict UTF-8 auto conversion
101
+ * All In One SEO Fields Import
102
+ * Wordpress SEO by Yoast Fields Import
103
+ * Custom Post Type UI plugin import
104
+ * Advanced Custom Fields Import
105
+ * CCTM Posts and Fields Import
106
+ * Woocommerce CSV Importer,
107
+ * wp ecommerce Products CSV Importer with WP e-Commerce Custom Fields
108
+ * Categories & tags Import with Category icons plugin support
109
+ * Custom Taxonomy import
110
+ * [Get Complete List of supported 3rd party plugins here](http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html)
111
+
112
+
113
+ [Read More about Pro>>](http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html) or [Test Drive Our Live Demo](http://demo.smackcoders.com/demowpthree/wp-admin/admin.php?page=wp-ultimate-csv-importer-pro/index.php&__module=dashboard)
114
+
115
+ = Imp. Notes =
116
+ * All CSV files should be should be strictly UTF-8 CSV format. Now this can be handled by plugin.
117
+ * All wordpress supported languages can imported with csv format as UTF-8 without BOM (See FAQ for instructions).
118
+ * User import option is disabled for multi site mode.
119
+ * To Schedule posts for publishing provide future date and time in date column in CSV File.
120
+
121
+ Featured Image Support
122
+ Your wordpress theme should support featured image. If not, please add the following code to where you need to display E.g. wp-contents/themes/header.php
123
+ `<?php add_theme_support( 'post-thumbnails' ); ?>`
124
+
125
+ Also you can follow the instructions as given here
126
+
127
+ * [http://codex.wordpress.org/Function_Reference/the_post_thumbnail](http://codex.wordpress.org/Function_Reference/the_post_thumbnail)
128
+ * [http://codex.wordpress.org/Post_Thumbnails](http://codex.wordpress.org/Post_Thumbnails)
129
+ * [http://wordpress.org/support/topic/featured-image-not-showing-7?replies=5](http://wordpress.org/support/topic/featured-image-not-showing-7?replies=5)
130
+
131
+ Need More Help, Cool. Browse Below Links
132
+
133
+ * [Get Pro Power Features, check here](http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html)
134
+ * [Wiki and Documentation](http://wiki.smackcoders.com/WP_Ultimate_CSV_Importer)
135
+ * [Tutorials, Guides, Blog News and Updates](http://blog.smackcoders.com/category/free-wordpress-plugins/wordpress-ultimate-csv-importer-plugin/)
136
+ * [Video Walkthrough](http://wiki.smackcoders.com/WP_Ultimate_CSV_Importer_Videos)
137
+ * [Get the Sample CSV Files Here](http://blog.smackcoders.com/wordpress-ultimate-csv-importer-csv-sample-files-and-updates.html)
138
+ * [Download CSV Format Cheat Sheets Here](http://blog.smackcoders.com/how-to-make-one-click-easy-csv-import-in-wordpress-free-cheat-sheet-downloads.html)
139
+
140
+ == Installation ==
141
+
142
+ * [Step By Step Installation Wiki with Snaps](http://wiki.smackcoders.com/WP_Ultimate_CSV_Importer_Free_Version_1.1.1_Installation_and_Configuration)
143
+
144
+
145
+ == Screenshots ==
146
+
147
+ 1. New Interactive Dashboard with Chart and Graph
148
+ 2. Advanced CSV Importer With Ultimate User Friendly Features with drag and drop etc.
149
+ 3. User friendly easy mapping for any csv file data to wordpress field attributes with sampling.
150
+ 4. Advanced duplicate post name and content check with server request control for high performance factor.
151
+ 5. Detailed real time log to know pinpoint status.
152
+ 6. Module based environment for easy and reduced interface to enable most required modules and when ever needed.
153
+ 7. Inbuilt support form for easy feedback, support, feature request with all useful links for easy and better csv import.
154
+ 8. New export module for posts, page, users, comments and all custom posts type plugins.
155
+
156
+
157
+ == Frequently Asked Questions ==
158
+
159
+ = Common Issues =
160
+
161
+ How to solve auto_prepend_file and auto_append_file error?
162
+
163
+ Check your phpinfo.php. Ensure that auto_prepend_file and auto_append_file options are disabled. If not you can disable it in php.ini settings file your self. You can also do it by a .htaccess file
164
+
165
+ Create an .htaccess file in root and set the following values.
166
+ php_value auto_prepend_file none
167
+ php_value auto_append_file none
168
+
169
+ This will solve your issue or get support from hosting if you dint have sufficient permission.
170
+
171
+ [Click Here for Detailed FAQs](http://wiki.smackcoders.com/WP_Ultimate_CSV_Importer_FAQ)
172
+ [CSV File and Format Related](http://wiki.smackcoders.com/WP_Ultimate_CSV_Importer_FAQ#CSV_File_and_Format_Related)
173
+
174
+
175
+ == Changelog ==
176
+ = 3.6.3 =
177
+ * Added: Eshop import support.
178
+ * Fixed reported conflicts with other plugins.
179
+ * WordPress 3.9.2 compatibility checked.
180
+
181
+ = 3.6.2 =
182
+ * Hot security fix added.
183
+
184
+ = 3.6.1 =
185
+ * Multi-site support issue fixed
186
+ * Duplicate import issue fixed
187
+ * Security issue fixed
188
+
189
+ = 3.6 =
190
+ * New interactive graphs and charts in plugin dashboard
191
+ * New Admin dashboard widgets
192
+ * Added Users and comments export feature
193
+ * Auto delimiter handling
194
+ * Auto mapping feature
195
+ * Now allow authors to access import features
196
+
197
+ = 3.5.5 =
198
+ * post_format attribute support added
199
+ * page_template attribute added
200
+ * update_post_meta added for duplicate meta issue (Thanks to @alantygel)
201
+ * Type error issue in jQuery fixed
202
+
203
+ = 3.5.4 =
204
+ * Added: All-in-SEO import support.
205
+ * WordPress 3.9.1 compatibility added.
206
+
207
+ = 3.5.3 =
208
+ * Added: Compatible up to WordPress 3.9.
209
+ * Added: Export feature added for posts, page, custom posts type plugins.
210
+ * Improved: Removed all warnings.
211
+ * Fixed reported bugs
212
+
213
+ = 3.5.2 =
214
+ * Import posts with author names as numerical apart from User ID
215
+ * Added menu_order attribute import
216
+ * Added Auto image rename option
217
+ * Option to cancel an partial import at middle
218
+ * Improved image handling even special characters in Url
219
+ * Import can handle image urls without any extensions
220
+ * User reported bugs fixed
221
+
222
+ = 3.5.1 =
223
+ * User reported issue fixes
224
+ * Activation and other plugin conflict issue solved like Jet pack
225
+ * Admin UI freezing issues - screen option, Help links issues fixed.
226
+ * WYSIWIG editor UI issue fixed.
227
+
228
+ = 3.5.0 =
229
+ * Combined major release version of 3.5 and 3.4
230
+ * Improved MVC structure.
231
+ * Improved User interface with drag and drop feature.
232
+ * Improved: WordPress 3.8.1 compatibility added.
233
+ * Module based system allows simplify UI
234
+ * Added: Detailed log feature added.
235
+ * Added: Support and Useful links added.
236
+ * Added: Support made easy now from plugin.
237
+
238
+ = 3.3.1 =
239
+ * Added: Multi site compatibility except User import.
240
+ * Added: Comments, Users modules mandatory fields validation added.
241
+ * Improved: Removed unwanted warnings.
242
+
243
+ = 3.3.0 =
244
+ * Added: WordPress 3.8 compatibility.
245
+ * Added: Bulk users with role import feature.
246
+ * Added: Comments import feature with relevant post ids.
247
+
248
+ = 3.2.3 =
249
+ * Added: WordPress 3.7.1 compatibility added.
250
+ * Added: Different media path support added.
251
+ * Added: Sub folder installations support added.
252
+ * Improved: Updated plugin directory path.
253
+ * Improved: Removed unwanted warnings.
254
+ * Improved: Performance check.
255
+
256
+ = 3.2.2 =
257
+ * Added: WordPress 3.6.1 compatibility added.
258
+ * Added: Mapping UI improved with on select dynamic update feature
259
+ * Added: Help content added
260
+ * Fixed: Post slug issue fixed and tested for 3.6 and 3.6.1
261
+
262
+ = 3.2.1 =
263
+ * Improved: Performance improvements on SQL and CSV parsing
264
+ * Fixed: Plugin deactivation issue fixed and updated the code.
265
+ * Fixed: Links in the cells makes problems with the "quote"
266
+ * Fixed: Loading content from more than one column
267
+ * Fixed: Custom Post type issues fixed
268
+
269
+ = 3.2.0 =
270
+ * Improved: User interface improvements
271
+ * Improved:WordPress 3.6 compatibility added, Much Improved UI.
272
+ * Fixed: Featured image issues fixed for WordPress-3.6.
273
+
274
+ = 3.1.0 =
275
+ * Improved: Much Improved Featured Image feature
276
+ * Fixed: Image url for featured image issues fixed
277
+ * Fixed: PHP 5.4 upgrade fix
278
+
279
+ = 3.0.0 =
280
+ * Added: Category in numericals are restricted and skipped to Uncategorized
281
+ * Added: Now password should be mentioned as {password}
282
+ * Added: Post authors can be User ID or name
283
+ * Improved: Much improved work flow
284
+ * Improved: Add custom field option improved.
285
+ * Improved: Date format handling improved
286
+ * Improved: Any Date format is supported now
287
+ * Improved: Future scheduling and status improved
288
+ * Improved: Can apply post status for individual post via csv itself
289
+ * Improved: Featured image handling improved and fixed. More improvement are scheduled.
290
+ * Improved: Duplicate check options improved for both title and content option.
291
+ * Improved: Post author issue fixed and improved
292
+ * Improved: Wrong user id or name are automatically assigned under admin
293
+ * Improved: Multi category and tags improved
294
+ * Fixed: Custom Field mapping and import fixed
295
+ * Fixed: Overall Status option improved and issue fixed
296
+ * Fixed: Password field fixed for Protected
297
+ * Fixed: Status as in CSV option improved and fixed
298
+
299
+ = 2.7.0 =
300
+ * Added: Added more post status options
301
+ * Added: Publish, Sticky, Private, Draft and Pending Status for whole import
302
+ * Added: Protected status with a common password option added
303
+ * Added: "Status as in CSV" to assign status for individual post through CSV as ID or Field Tag
304
+ * Added: User ID and User Name support for Post author feature added
305
+ * Added: In case of missing or false IDs post assigned to admin as draft
306
+ * Added: Add Custom Field Text box auto-filled with CSV header tag.
307
+ * Added: Duplicate detection for post content and post title added as options.
308
+ * Added: User can choose either one or both to avoid duplicate issues.
309
+ * Improved: 6 Standard date format added as drop down to choose.
310
+ * Improved: Renamed post_name as post_slug to avoid confusion
311
+ * Improved: Mapping Fields
312
+ * Improved: Field tags are formatted to support auto mapping option (next milestone)
313
+ * Improved: Listed custom fields with prefix as CF: Name for easy identification.
314
+ * Fixed: Date format conflict at import fixed.
315
+
316
+
317
+ = 2.6.0 =
318
+ * Fixed: Major Bug fixed
319
+ * Fixed: Added UTF-8 support.
320
+ * Fixed: Fixed Html tag conflicts.
321
+
322
+ = 2.5.0 =
323
+ * Major issues fixed and updated to WordPress-3.5.1 compatibility.
324
+
325
+ = 2.0.1 =
326
+ * Update to WordPress-3.5 compatibility.
327
+
328
+ = 2.0.0 =
329
+ * WPDEBUG errors fixed. CSV import folder changed to WP native uploads folder.
330
+
331
+ = 1.1.1 =
332
+ * Renamed the mapping field attachment as featured_image and category as post_category.
333
+
334
+ = 1.1.0 =
335
+ * Added featured image import feature along with post/page/custom post.
336
+
337
+ = 1.0.2 =
338
+ * Bug fixed to recognize the trimmed trailing space in the CSV file
339
+ * Added validation for the duplicate field mapping.
340
+
341
+ = 1.0.1 =
342
+ * Added features to import multiple tags and categories with different delimiters.
343
+
344
+ = 1.0.0 =
345
+ * Initial release version. Tested and found works well without any issues.
346
+
347
+
348
+
349
+ == Upgrade Notice ==
350
+
351
+ = 3.6.3 =
352
+ * Upgrade now for Eshop product import feature.
353
+
354
+ = 3.6.2 =
355
+ * Important Security Update
356
+
357
+ = 3.6.1 =
358
+ * Important issue fixes update
359
+
360
+ = 3.6 =
361
+ * Must upgrade with major values added features
362
+
363
+ = 3.5.5 =
364
+ * Upgrade for minor bug fix, conflicts and new attribute support.
365
+
366
+ = 3.5.4 =
367
+ * Upgrade now for All-in-SEO import support.
368
+
369
+ = 3.5.3 =
370
+ * Upgrade for added export feature and bug fixes
371
+
372
+ = 3.5.2 =
373
+ * Upgrade for bug free version and improved image handling
374
+
375
+ = 3.5.1 =
376
+ * Must upgrade now for 3.5 bug fixes
377
+
378
+ = 3.5.0 =
379
+ * Upgrade now for major release 3.5. Note - Old version files need to be deleted.
380
+
381
+ = 3.3.1 =
382
+ * Upgrade now for multi site compatibility.
383
+
384
+ = 3.3.0 =
385
+ * Upgrade now for WP 3.8 compatibility and added bulk user,comments feature.
386
+
387
+ = 3.2.3 =
388
+ * Upgrade for WordPress 3.7.1 compatibility and minor bug fixes
389
+
390
+ = 3.2.2 =
391
+ * WordPress 3.6.1 compatible, bug fix and UI improvements
392
+
393
+ = 3.2.1 =
394
+ * Performance improvements on SQL and CSV parsing
395
+
396
+ = 3.2.0 =
397
+ * Now compatible with 3.6 and improved featured image
398
+
399
+ = 3.1.0 =
400
+ * Now Much Improved Featured Image and url handling
401
+
402
+ = 3.0.0 =
403
+ * Must upgrade to have Major improvements, performance fixes and issue fixes
404
+
405
+ = 2.7.0 =
406
+ * Major improvements and feature changes.
407
+
408
+ = 2.6.0 =
409
+ * Bug fixed and should upgrade.
410
+
411
+ = 2.5.0 =
412
+ * Duplicate detection added.
413
+ * Added more information in success message.
414
+ * Import memory issues solved.
415
+
416
+ = 2.0.1 =
417
+ * Update to WordPress-3.5 compatibility.
418
+
419
+ = 2.0.0 =
420
+ * Major Bug fixed and should upgrade. WPDEBUG errors fixed. CSV import folder changed to WP native uploads folder.
421
+
422
+ = 1.1.1 =
423
+ * Minor correction and fix applied.
424
+
425
+ = 1.1.0 =
426
+ * A major new feature added in this version. Update needed.
427
+
428
+ = 1.0.2 =
429
+ * This version have important bug fixes and newly added features. Must be upgrade immediately.
430
+
431
+ = 1.0.1 =
432
+ * Added features to import multiple tags and categories with different delimiters.
433
+
434
+ = 1.0.0 =
435
+ * Initial release of plugin.
images/csv_importer_dashboard_v3.5.png DELETED
Binary file
includes/Importer.php ADDED
@@ -0,0 +1,493 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class ImporterLib {
3
+ var $rzfejj_23 = true;
4
+ var $lfxszn_24 = array();
5
+ var $aerjwu_25 = null;
6
+ var $huepva_26 = false;
7
+ var $qnghcy_27 = null;
8
+ var $nplcju_28 = ',';
9
+ var $ezvruf_29 = '"';
10
+ var $hhtsch_30 = null;
11
+ var $rtkfzr_31 = null;
12
+ var $urccim_32 = null;
13
+ var $ppbenb_38 = 15;
14
+ var $gpxabp_40 = "a-zA-Z0-9\n\r";
15
+ var $qyllow_39 = ",;\t.:|";
16
+ var $fybktu_41 = false;
17
+ var $bmalcx_42 = 'ISO-8859-1';
18
+ var $foevdt_43 = 'ISO-8859-1';
19
+ var $bzcrxk_44 = "\r\n";
20
+ var $huzgna_45 = ',';
21
+ var $gbuviv_33 = 'data.csv';
22
+ var $bhujwy_34 = false;
23
+ var $iigiqu_63;
24
+ var $nftvhw_20;
25
+ var $jybluc_21 = 0;
26
+ var $gtxpcj_22 = array();
27
+ var $mpkaqs_35 = array();
28
+ var $data = array();
29
+
30
+
31
+ function akhrnw_2 ($dsmiub_46 = null, $rtkfzr_31 = null, $urccim_32 = null, $hhtsch_30 = null) {
32
+ if ( $rtkfzr_31 !== null ) $this->rtkfzr_31 = $rtkfzr_31;
33
+ if ( $urccim_32 !== null ) $this->urccim_32 = $urccim_32;
34
+ if ( count($hhtsch_30) > 0 ) $this->hhtsch_30 = $hhtsch_30;
35
+ if ( !empty($dsmiub_46) ) $this->ruscjv_15($dsmiub_46);
36
+ }
37
+
38
+
39
+ function ruscjv_15 ($dsmiub_46 = null, $rtkfzr_31 = null, $urccim_32 = null, $hhtsch_30 = null) {
40
+ if ( $dsmiub_46 === null ) $dsmiub_46 = $this->iigiqu_63;
41
+ if ( !empty($dsmiub_46) ) {
42
+ if ( $rtkfzr_31 !== null ) $this->rtkfzr_31 = $rtkfzr_31;
43
+ if ( $urccim_32 !== null ) $this->urccim_32 = $urccim_32;
44
+ if ( count($hhtsch_30) > 0 ) $this->hhtsch_30 = $hhtsch_30;
45
+ if ( is_readable($dsmiub_46) ) {
46
+ $this->data = $this->ghloqy_7($dsmiub_46);
47
+ } else {
48
+ $this->nftvhw_20 = &$dsmiub_46;
49
+ $this->data = $this->ytcfme_6();
50
+ }
51
+ if ( $this->data === false ) return false;
52
+ }
53
+ return true;
54
+ }
55
+
56
+ function vsxpii_16 ($iigiqu_63 = null, $huzgna_45 = array(), $bkarne_52 = false, $lfxszn_24 = array()) {
57
+ if ( empty($iigiqu_63) ) $iigiqu_63 = &$this->iigiqu_63;
58
+ $mode = ( $bkarne_52 ) ? 'at' : 'wt' ;
59
+ $is_php = ( preg_match('/\.php$/i', $iigiqu_63) ) ? true : false ;
60
+ return $this->jvyhik_14($iigiqu_63, $this->krlkbv_0($huzgna_45, $lfxszn_24, $bkarne_52, $is_php), $mode);
61
+ }
62
+
63
+ function wmyuyn_3 ($filename = null, $huzgna_45 = array(), $lfxszn_24 = array(), $delimiter = null) {
64
+ if ( empty($filename) ) $filename = $this->gbuviv_33;
65
+ if ( $delimiter === null ) $delimiter = $this->huzgna_45;
66
+ $huzgna_45 = $this->krlkbv_0($huzgna_45, $lfxszn_24, null, null, $delimiter);
67
+ if ( $filename !== null ) {
68
+ header('Content-type: application/csv');
69
+ header('Content-Disposition: attachment; filename="'.$filename.'"');
70
+ echo $huzgna_45;
71
+ }
72
+ return $huzgna_45;
73
+ }
74
+
75
+ function fidfvc_4 ($dsmiub_46 = null, $wmrey_p8 = null) {
76
+ $this->fybktu_41 = true;
77
+ if ( $dsmiub_46 !== null ) $this->bmalcx_42 = $dsmiub_46;
78
+ if ( $wmrey_p8 !== null ) $this->foevdt_43 = $wmrey_p8;
79
+ }
80
+
81
+ function delim ($iigiqu_63 = null, $parse = true, $search_depth = null, $preferred = null, $ezvruf_29 = null) {
82
+
83
+ if ( $iigiqu_63 === null ) $iigiqu_63 = $this->iigiqu_63;
84
+ if ( empty($search_depth) ) $search_depth = $this->ppbenb_38;
85
+ if ( $ezvruf_29 === null ) $ezvruf_29 = $this->ezvruf_29;
86
+
87
+ if ( $preferred === null ) $preferred = $this->qyllow_39;
88
+
89
+ if ( empty($this->nftvhw_20) ) {
90
+ if ( $this->totraw_9($iigiqu_63) ) {
91
+ $huzgna_45 = &$this->nftvhw_20;
92
+ } else return false;
93
+ } else {
94
+ $huzgna_45 = &$this->nftvhw_20;
95
+ }
96
+
97
+ $chars = array();
98
+ $strlen = strlen($huzgna_45);
99
+ $fqlsha_68 = false;
100
+ $n = 1;
101
+ $to_end = true;
102
+
103
+ for ( $i=0; $i < $strlen; $i++ ) {
104
+ $ch = $huzgna_45{$i};
105
+ $nch = ( isset($huzgna_45{$i+1}) ) ? $huzgna_45{$i+1} : false ;
106
+ $pch = ( isset($huzgna_45{$i-1}) ) ? $huzgna_45{$i-1} : false ;
107
+
108
+ if ( $ch == $ezvruf_29 ) {
109
+ if ( !$fqlsha_68 || $nch != $ezvruf_29 ) {
110
+ $fqlsha_68 = ( $fqlsha_68 ) ? false : true ;
111
+ } elseif ( $fqlsha_68 ) {
112
+ $i++;
113
+ }
114
+
115
+ } elseif ( ($ch == "\n" && $pch != "\r" || $ch == "\r") && !$fqlsha_68 ) {
116
+ if ( $n >= $search_depth ) {
117
+ $strlen = 0;
118
+ $to_end = false;
119
+ } else {
120
+ $n++;
121
+ }
122
+
123
+ } elseif (!$fqlsha_68) {
124
+ if ( !preg_match('/['.preg_quote($this->gpxabp_40, '/').']/i', $ch) ) {
125
+ if ( !isset($chars[$ch][$n]) ) {
126
+ $chars[$ch][$n] = 1;
127
+ } else {
128
+ $chars[$ch][$n]++;
129
+ }
130
+ }
131
+ }
132
+ }
133
+
134
+ $depth = ( $to_end ) ? $n-1 : $n ;
135
+ $filtered = array();
136
+ foreach( $chars as $char => $value ) {
137
+ if ( $match = $this->klpqct_10($char, $value, $depth, $preferred) ) {
138
+ $filtered[$match] = $char;
139
+ }
140
+ }
141
+
142
+ ksort($filtered);
143
+ $this->delimiter = reset($filtered);
144
+
145
+ if ( $parse ) $this->data = $this->ytcfme_6();
146
+
147
+ return $this->delimiter;
148
+
149
+ }
150
+
151
+
152
+ function vh100 ($iigiqu_63 = null) {
153
+ if ( $iigiqu_63 === null ) $iigiqu_63 = $this->iigiqu_63;
154
+ if ( empty($this->nftvhw_20) ) $this->fmilrp_13($iigiqu_63);
155
+ return ( !empty($this->nftvhw_20) ) ? $this->ytcfme_6() : false ;
156
+ }
157
+
158
+ function ytcfme_6 ($huzgna_45 = null) {
159
+ if ( empty($huzgna_45) ) {
160
+ if ( $this->totraw_9() ) {
161
+ $huzgna_45 = &$this->nftvhw_20;
162
+ } else return false;
163
+ }
164
+
165
+ $white_spaces = str_replace($this->delimiter, '', " \t\x0B\0");
166
+
167
+ $jlesjs_83 = array();
168
+ $mbswxn_84 = array();
169
+ $cdgpzw_85 = 0;
170
+ $ewhrie_86 = '';
171
+ $head = ( !empty($this->lfxszn_24) ) ? $this->lfxszn_24 : array() ;
172
+ $eylwks_89 = 0;
173
+ $fqlsha_68 = false;
174
+ $qobixt_90 = false;
175
+ $strlen = strlen($huzgna_45);
176
+
177
+ for ( $i=0; $i < $strlen; $i++ ) {
178
+ $ch = $huzgna_45{$i};
179
+ $nch = ( isset($huzgna_45{$i+1}) ) ? $huzgna_45{$i+1} : false ;
180
+ $pch = ( isset($huzgna_45{$i-1}) ) ? $huzgna_45{$i-1} : false ;
181
+
182
+ if ( $ch == $this->ezvruf_29 ) {
183
+ if ( !$fqlsha_68 ) {
184
+ if ( ltrim($ewhrie_86, $white_spaces) == '' ) {
185
+ $fqlsha_68 = true;
186
+ $qobixt_90 = true;
187
+ } else {
188
+ $this->jybluc_21 = 2;
189
+ $error_row = count($jlesjs_83) + 1;
190
+ $error_col = $eylwks_89 + 1;
191
+ if ( !isset($this->gtxpcj_22[$error_row.'-'.$error_col]) ) {
192
+ $this->gtxpcj_22[$error_row.'-'.$error_col] = array(
193
+ 'type' => 2,
194
+ 'info' => 'Syntax error found on row '.$error_row.'. Non-enclosed lfxszn_24 can not contain double-quotes.',
195
+ 'row' => $error_row,
196
+ 'field' => $error_col,
197
+ 'field_name' => (!empty($head[$eylwks_89])) ? $head[$eylwks_89] : null,
198
+ );
199
+ }
200
+ $ewhrie_86 .= $ch;
201
+ }
202
+ } elseif ($nch == $this->ezvruf_29) {
203
+ $ewhrie_86 .= $ch;
204
+ $i++;
205
+ } elseif ( $nch != $this->delimiter && $nch != "\r" && $nch != "\n" ) {
206
+ for ( $x=($i+1); isset($huzgna_45{$x}) && ltrim($huzgna_45{$x}, $white_spaces) == ''; $x++ ) {}
207
+ if ( $huzgna_45{$x} == $this->delimiter ) {
208
+ $fqlsha_68 = false;
209
+ $i = $x;
210
+ } else {
211
+ if ( $this->jybluc_21 < 1 ) {
212
+ $this->jybluc_21 = 1;
213
+ }
214
+ $error_row = count($jlesjs_83) + 1;
215
+ $error_col = $eylwks_89 + 1;
216
+ if ( !isset($this->gtxpcj_22[$error_row.'-'.$error_col]) ) {
217
+ $this->gtxpcj_22[$error_row.'-'.$error_col] = array(
218
+ 'type' => 1,
219
+ 'info' =>
220
+ 'Syntax error found on row '.(count($jlesjs_83) + 1).'. '.
221
+ 'A single double-quote was found within an enclosed string. '.
222
+ 'Enclosed double-quotes must be escaped with a second double-quote.',
223
+ 'row' => count($jlesjs_83) + 1,
224
+ 'field' => $eylwks_89 + 1,
225
+ 'field_name' => (!empty($head[$eylwks_89])) ? $head[$eylwks_89] : null,
226
+ );
227
+ }
228
+ $ewhrie_86 .= $ch;
229
+ $fqlsha_68 = false;
230
+ }
231
+ } else {
232
+ $fqlsha_68 = false;
233
+ }
234
+
235
+ // end of field/row
236
+ } elseif ( ($ch == $this->delimiter || $ch == "\n" || $ch == "\r") && !$fqlsha_68 ) {
237
+ $key = ( !empty($head[$eylwks_89]) ) ? $head[$eylwks_89] : $eylwks_89 ;
238
+ $mbswxn_84[$key] = ( $qobixt_90 ) ? $ewhrie_86 : trim($ewhrie_86) ;
239
+ $ewhrie_86 = '';
240
+ $qobixt_90 = false;
241
+ $eylwks_89++;
242
+
243
+ // end of row
244
+ if ( $ch == "\n" || $ch == "\r" ) {
245
+ if ( $this->blhlef_1($cdgpzw_85) && $this->qnoiuh_17s($mbswxn_84, $this->hhtsch_30) ) {
246
+ if ( $this->rzfejj_23 && empty($head) ) {
247
+ $head = $mbswxn_84;
248
+ } elseif ( empty($this->lfxszn_24) || (!empty($this->lfxszn_24) && (($this->rzfejj_23 && $cdgpzw_85 > 0) || !$this->rzfejj_23)) ) {
249
+ if ( !empty($this->aerjwu_25) && !empty($mbswxn_84[$this->aerjwu_25]) ) {
250
+ if ( isset($jlesjs_83[$mbswxn_84[$this->aerjwu_25]]) ) {
251
+ $jlesjs_83[$mbswxn_84[$this->aerjwu_25].'_0'] = &$jlesjs_83[$mbswxn_84[$this->aerjwu_25]];
252
+ unset($jlesjs_83[$mbswxn_84[$this->aerjwu_25]]);
253
+ for ( $sn=1; isset($jlesjs_83[$mbswxn_84[$this->aerjwu_25].'_'.$sn]); $sn++ ) {}
254
+ $jlesjs_83[$mbswxn_84[$this->aerjwu_25].'_'.$sn] = $mbswxn_84;
255
+ } else $jlesjs_83[$mbswxn_84[$this->aerjwu_25]] = $mbswxn_84;
256
+ } else $jlesjs_83[] = $mbswxn_84;
257
+ }
258
+ }
259
+ $mbswxn_84 = array();
260
+ $eylwks_89 = 0;
261
+ $cdgpzw_85++;
262
+ if ( $this->aerjwu_25 === null && $this->urccim_32 !== null && count($jlesjs_83) == $this->urccim_32 ) {
263
+ $i = $strlen;
264
+ }
265
+ if ( $ch == "\r" && $nch == "\n" ) $i++;
266
+ }
267
+
268
+ } else {
269
+ $ewhrie_86 .= $ch;
270
+ }
271
+ }
272
+ $this->mpkaqs_35 = $head;
273
+ if ( !empty($this->aerjwu_25) ) {
274
+ $qnghcy_27 = SORT_REGULAR;
275
+ if ( $this->qnghcy_27 == 'numeric' ) {
276
+ $qnghcy_27 = SORT_NUMERIC;
277
+ } elseif ( $this->qnghcy_27 == 'string' ) {
278
+ $qnghcy_27 = SORT_STRING;
279
+ }
280
+ ( $this->huepva_26 ) ? krsort($jlesjs_83, $qnghcy_27) : ksort($jlesjs_83, $qnghcy_27) ;
281
+ if ( $this->rtkfzr_31 !== null || $this->urccim_32 !== null ) {
282
+ $jlesjs_83 = array_slice($jlesjs_83, ($this->rtkfzr_31 === null ? 0 : $this->rtkfzr_31) , $this->urccim_32, true);
283
+ }
284
+ }
285
+ if ( !$this->bhujwy_34 ) {
286
+ $this->nftvhw_20 = null;
287
+ }
288
+ return $jlesjs_83;
289
+ }
290
+
291
+ function krlkbv_0 ( $huzgna_45 = array(), $lfxszn_24 = array(), $bkarne_52 = false , $is_php = false, $delimiter = null) {
292
+ if ( !is_array($huzgna_45) || empty($huzgna_45) ) $huzgna_45 = &$this->data;
293
+ if ( !is_array($lfxszn_24) || empty($lfxszn_24) ) $lfxszn_24 = &$this->mpkaqs_35;
294
+ if ( $delimiter === null ) $delimiter = $this->delimiter;
295
+
296
+ $string = ( $is_php ) ? "<?php header('Status: 403'); die(' '); ?>".$this->bzcrxk_44 : '' ;
297
+ $entry = array();
298
+
299
+ if ( $this->rzfejj_23 && !$bkarne_52 && !empty($lfxszn_24) ) {
300
+ foreach( $lfxszn_24 as $key => $value ) {
301
+ $entry[] = $this->sxzpwt_8($value);
302
+ }
303
+ $string .= implode($delimiter, $entry).$this->bzcrxk_44;
304
+ $entry = array();
305
+ }
306
+
307
+ foreach( $huzgna_45 as $key => $mbswxn_84 ) {
308
+ foreach( $mbswxn_84 as $field => $value ) {
309
+ $entry[] = $this->sxzpwt_8($value);
310
+ }
311
+ $string .= implode($delimiter, $entry).$this->bzcrxk_44;
312
+ $entry = array();
313
+ }
314
+
315
+ return $string;
316
+ }
317
+
318
+ function fmilrp_13 ($dsmiub_46 = null) {
319
+ $huzgna_45 = null;
320
+ $iigiqu_63 = null;
321
+ if ( $dsmiub_46 === null ) {
322
+ $iigiqu_63 = $this->iigiqu_63;
323
+ } elseif ( file_exists($dsmiub_46) ) {
324
+ $iigiqu_63 = $dsmiub_46;
325
+ } else {
326
+ $huzgna_45 = $dsmiub_46;
327
+ }
328
+ if ( !empty($huzgna_45) || $huzgna_45 = $this->rqauqn_12($iigiqu_63) ) {
329
+ if ( $this->iigiqu_63 != $iigiqu_63 ) $this->iigiqu_63 = $iigiqu_63;
330
+ if ( preg_match('/\.php$/i', $iigiqu_63) && preg_match('/<\?.*?\?>(.*)/ims', $huzgna_45, $strip) ) {
331
+ $huzgna_45 = ltrim($strip[1]);
332
+ }
333
+ if ( $this->fybktu_41 ) $huzgna_45 = iconv($this->bmalcx_42, $this->foevdt_43, $huzgna_45);
334
+ if ( substr($huzgna_45, -1) != "\n" ) $huzgna_45 .= "\n";
335
+ $this->nftvhw_20 = &$huzgna_45;
336
+ return true;
337
+ }
338
+ return false;
339
+ }
340
+
341
+
342
+ function qnoiuh_17s ($mbswxn_84 = array(), $hhtsch_30 = null) {
343
+ if ( !empty($mbswxn_84) ) {
344
+ if ( !empty($hhtsch_30) ) {
345
+ $hhtsch_30 = (strpos($hhtsch_30, ' OR ') !== false) ? explode(' OR ', $hhtsch_30) : array($hhtsch_30);
346
+ $or = '';
347
+ foreach( $hhtsch_30 as $key => $value ) {
348
+ if ( strpos($value, ' AND ') !== false ) {
349
+ $value = explode(' AND ', $value);
350
+ $and = '';
351
+ foreach( $value as $k => $v ) {
352
+ $and .= $this->qnoiuh_17($mbswxn_84, $v);
353
+ }
354
+ $or .= (strpos($and, '0') !== false) ? '0' : '1' ;
355
+ } else {
356
+ $or .= $this->qnoiuh_17($mbswxn_84, $value);
357
+ }
358
+ }
359
+ return (strpos($or, '1') !== false) ? true : false ;
360
+ }
361
+ return true;
362
+ }
363
+ return false;
364
+ }
365
+
366
+ function qnoiuh_17 ($mbswxn_84, $condition) {
367
+ $operators = array(
368
+ '=', 'equals', 'is',
369
+ '!=', 'is not',
370
+ '<', 'is less than',
371
+ '>', 'is greater than',
372
+ '<=', 'is less than or equals',
373
+ '>=', 'is greater than or equals',
374
+ 'contains',
375
+ 'does not contain',
376
+ );
377
+ $operators_regex = array();
378
+ foreach( $operators as $value ) {
379
+ $operators_regex[] = preg_quote($value, '/');
380
+ }
381
+ $operators_regex = implode('|', $operators_regex);
382
+ if ( preg_match('/^(.+) ('.$operators_regex.') (.+)$/i', trim($condition), $capture) ) {
383
+ $field = $capture[1];
384
+ $op = $capture[2];
385
+ $value = $capture[3];
386
+ if ( preg_match('/^([\'\"]{1})(.*)([\'\"]{1})$/i', $value, $capture) ) {
387
+ if ( $capture[1] == $capture[3] ) {
388
+ $value = $capture[2];
389
+ $value = str_replace("\\n", "\n", $value);
390
+ $value = str_replace("\\r", "\r", $value);
391
+ $value = str_replace("\\t", "\t", $value);
392
+ $value = stripslashes($value);
393
+ }
394
+ }
395
+ if ( array_key_exists($field, $mbswxn_84) ) {
396
+ if ( ($op == '=' || $op == 'equals' || $op == 'is') && $mbswxn_84[$field] == $value ) {
397
+ return '1';
398
+ } elseif ( ($op == '!=' || $op == 'is not') && $mbswxn_84[$field] != $value ) {
399
+ return '1';
400
+ } elseif ( ($op == '<' || $op == 'is less than' ) && $mbswxn_84[$field] < $value ) {
401
+ return '1';
402
+ } elseif ( ($op == '>' || $op == 'is greater than') && $mbswxn_84[$field] > $value ) {
403
+ return '1';
404
+ } elseif ( ($op == '<=' || $op == 'is less than or equals' ) && $mbswxn_84[$field] <= $value ) {
405
+ return '1';
406
+ } elseif ( ($op == '>=' || $op == 'is greater than or equals') && $mbswxn_84[$field] >= $value ) {
407
+ return '1';
408
+ } elseif ( $op == 'contains' && preg_match('/'.preg_quote($value, '/').'/i', $mbswxn_84[$field]) ) {
409
+ return '1';
410
+ } elseif ( $op == 'does not contain' && !preg_match('/'.preg_quote($value, '/').'/i', $mbswxn_84[$field]) ) {
411
+ return '1';
412
+ } else {
413
+ return '0';
414
+ }
415
+ }
416
+ }
417
+ return '1';
418
+ }
419
+
420
+ function blhlef_1 ($ewhrie_86_row) {
421
+ if ( $this->aerjwu_25 === null && $this->rtkfzr_31 !== null && $ewhrie_86_row < $this->rtkfzr_31 ) return false;
422
+ return true;
423
+ }
424
+
425
+ function sxzpwt_8 ($value = null) {
426
+ if ( $value !== null && $value != '' ) {
427
+ $delimiter = preg_quote($this->delimiter, '/');
428
+ $ezvruf_29 = preg_quote($this->ezvruf_29, '/');
429
+ if ( preg_match("/".$delimiter."|".$ezvruf_29."|\n|\r/i", $value) || ($value{0} == ' ' || substr($value, -1) == ' ') ) {
430
+ $value = str_replace($this->ezvruf_29, $this->ezvruf_29.$this->ezvruf_29, $value);
431
+ $value = $this->ezvruf_29.$value.$this->ezvruf_29;
432
+ }
433
+ }
434
+ return $value;
435
+ }
436
+
437
+ function totraw_9 ($iigiqu_63 = null) {
438
+ if ( empty($this->nftvhw_20) ) {
439
+ if ( $iigiqu_63 === null ) $iigiqu_63 = $this->iigiqu_63;
440
+ return $this->fmilrp_13($iigiqu_63);
441
+ }
442
+ return true;
443
+ }
444
+
445
+
446
+ function klpqct_10 ($char, $array, $depth, $preferred) {
447
+ if ( $depth == count($array) ) {
448
+ $first = null;
449
+ $equal = null;
450
+ $almost = false;
451
+ foreach( $array as $key => $value ) {
452
+ if ( $first == null ) {
453
+ $first = $value;
454
+ } elseif ( $value == $first && $equal !== false) {
455
+ $equal = true;
456
+ } elseif ( $value == $first+1 && $equal !== false ) {
457
+ $equal = true;
458
+ $almost = true;
459
+ } else {
460
+ $equal = false;
461
+ }
462
+ }
463
+ if ( $equal ) {
464
+ $match = ( $almost ) ? 2 : 1 ;
465
+ $pref = strpos($preferred, $char);
466
+ $pref = ( $pref !== false ) ? str_pad($pref, 3, '0', STR_PAD_LEFT) : '999' ;
467
+ return $pref.$match.'.'.(99999 - str_pad($first, 5, '0', STR_PAD_LEFT));
468
+ } else return false;
469
+ }
470
+ }
471
+
472
+ function rqauqn_12 ($iigiqu_63 = null) {
473
+ if ( is_readable($iigiqu_63) ) {
474
+ if ( !($fh = fopen($iigiqu_63, 'r')) ) return false;
475
+ $huzgna_45 = fread($fh, filesize($iigiqu_63));
476
+ fclose($fh);
477
+ return $huzgna_45;
478
+ }
479
+ return false;
480
+ }
481
+
482
+ function jvyhik_14 ($iigiqu_63, $string = '', $mode = 'wb', $lock = 2) {
483
+ if ( $fp = fopen($iigiqu_63, $mode) ) {
484
+ flock($fp, $lock);
485
+ $re = fwrite($fp, $string);
486
+ $re2 = fclose($fp);
487
+ if ( $re != false && $re2 != false ) return true;
488
+ }
489
+ return false;
490
+ }
491
+
492
+ }
493
+ ?>
includes/WPImporter_includes_helper.php CHANGED
@@ -277,26 +277,23 @@ class WPImporter_includes_helper {
277
 
278
  /**
279
  * Function converts CSV data to formatted array.
280
- *
281
- * @param $file CSV
282
- * input filename
283
- * @param $delim delimiter
284
- * for the CSV
285
  * @return array formatted CSV output as array
286
  */
287
  function csv_file_data($file)
288
  {
289
  $file = $this->getUploadDirectory().'/'.$file;
290
- $csv = new parseCSV();
291
- #$csv->encoding(null, 'UTF-8');
292
- $csv->auto($file);
293
  foreach($csv->data as $hkey => $hval) {
294
  foreach($hval as $hk => $hv) {
295
  $this->headers[] = $hk;
296
  }
297
  break;
298
  }
299
- return $csv->data;
300
  }
301
 
302
 
@@ -796,7 +793,7 @@ class WPImporter_includes_helper {
796
  ) ENGINE=InnoDB;";
797
  $wpdb->query($sql1);
798
  $wpdb->query($sql2);
799
- $importedTypes = array('Post','Page','Custom Post','Comments','Users');
800
  foreach($importedTypes as $importedType){
801
  $querycheck = $wpdb->get_results("select *from smackcsv_pie_log where type = \"{$importedType}\"");
802
  if (count($querycheck) == 0){
@@ -1021,771 +1018,4 @@ class CallWPImporterObj extends WPImporter_includes_helper
1021
  }
1022
 
1023
 
1024
- class parseCSV {
1025
-
1026
- /*
1027
-
1028
- Class: parseCSV v0.4.3 beta
1029
- http://code.google.com/p/parsecsv-for-php/
1030
-
1031
-
1032
- Fully conforms to the specifications lined out on wikipedia:
1033
- - http://en.wikipedia.org/wiki/Comma-separated_values
1034
-
1035
- Based on the concept of Ming Hong Ng's CsvFileParser class:
1036
- - http://minghong.blogspot.com/2006/07/csv-parser-for-php.html
1037
-
1038
-
1039
-
1040
- Copyright (c) 2007 Jim Myhrberg (jim@zydev.info).
1041
-
1042
- Permission is hereby granted, free of charge, to any person obtaining a copy
1043
- of this software and associated documentation files (the "Software"), to deal
1044
- in the Software without restriction, including without limitation the rights
1045
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1046
- copies of the Software, and to permit persons to whom the Software is
1047
- furnished to do so, subject to the following conditions:
1048
-
1049
- The above copyright notice and this permission notice shall be included in
1050
- all copies or substantial portions of the Software.
1051
-
1052
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1053
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1054
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1055
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1056
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1057
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1058
- THE SOFTWARE.
1059
-
1060
-
1061
-
1062
- Code Examples
1063
- ----------------
1064
- # general usage
1065
- $csv = new parseCSV('data.csv');
1066
- print_r($csv->data);
1067
- ----------------
1068
- # tab delimited, and encoding conversion
1069
- $csv = new parseCSV();
1070
- $csv->encoding('UTF-16', 'UTF-8');
1071
- $csv->delimiter = "\t";
1072
- $csv->parse('data.tsv');
1073
- print_r($csv->data);
1074
- ----------------
1075
- # auto-detect delimiter character
1076
- $csv = new parseCSV();
1077
- $csv->auto('data.csv');
1078
- print_r($csv->data);
1079
- ----------------
1080
- # modify data in a csv file
1081
- $csv = new parseCSV();
1082
- $csv->sort_by = 'id';
1083
- $csv->parse('data.csv');
1084
- # "4" is the value of the "id" column of the CSV row
1085
- $csv->data[4] = array('firstname' => 'John', 'lastname' => 'Doe', 'email' => 'john@doe.com');
1086
- $csv->save();
1087
- ----------------
1088
- # add row/entry to end of CSV file
1089
- # - only recommended when you know the extact sctructure of the file
1090
- $csv = new parseCSV();
1091
- $csv->save('data.csv', array(array('1986', 'Home', 'Nowhere', '')), true);
1092
- ----------------
1093
- # convert 2D array to csv data and send headers
1094
- # to browser to treat output as a file and download it
1095
- $csv = new parseCSV();
1096
- $csv->output (true, 'movies.csv', $array);
1097
- ----------------
1098
-
1099
-
1100
- */
1101
-
1102
-
1103
- /**
1104
- * Configuration
1105
- * - set these options with $object->var_name = 'value';
1106
- */
1107
-
1108
- # use first line/entry as field names
1109
- var $heading = true;
1110
-
1111
- # override field names
1112
- var $fields = array();
1113
-
1114
- # sort entries by this field
1115
- var $sort_by = null;
1116
- var $sort_reverse = false;
1117
-
1118
- # sort behavior passed to ksort/krsort functions
1119
- # regular = SORT_REGULAR
1120
- # numeric = SORT_NUMERIC
1121
- # string = SORT_STRING
1122
- var $sort_type = null;
1123
-
1124
- # delimiter (comma) and enclosure (double quote)
1125
- var $delimiter = ',';
1126
- var $enclosure = '"';
1127
-
1128
- # basic SQL-like conditions for row matching
1129
- var $conditions = null;
1130
-
1131
- # number of rows to ignore from beginning of data
1132
- var $offset = null;
1133
-
1134
- # limits the number of returned rows to specified amount
1135
- var $limit = null;
1136
-
1137
- # number of rows to analyze when attempting to auto-detect delimiter
1138
- var $auto_depth = 15;
1139
-
1140
- # characters to ignore when attempting to auto-detect delimiter
1141
- var $auto_non_chars = "a-zA-Z0-9\n\r";
1142
-
1143
- # preferred delimiter characters, only used when all filtering method
1144
- # returns multiple possible delimiters (happens very rarely)
1145
- var $auto_preferred = ",;\t.:|";
1146
-
1147
- # character encoding options
1148
- var $convert_encoding = false;
1149
- var $input_encoding = 'ISO-8859-1';
1150
- var $output_encoding = 'ISO-8859-1';
1151
-
1152
- # used by unparse(), save(), and output() functions
1153
- var $linefeed = "\r\n";
1154
-
1155
- # only used by output() function
1156
- var $output_delimiter = ',';
1157
- var $output_filename = 'data.csv';
1158
-
1159
- # keep raw file data in memory after successful parsing (useful for debugging)
1160
- var $keep_file_data = false;
1161
-
1162
- /**
1163
- * Internal variables
1164
- */
1165
-
1166
- # current file
1167
- var $file;
1168
-
1169
- # loaded file contents
1170
- var $file_data;
1171
-
1172
- # error while parsing input data
1173
- # 0 = No errors found. Everything should be fine :)
1174
- # 1 = Hopefully correctable syntax error was found.
1175
- # 2 = Enclosure character (double quote by default)
1176
- # was found in non-enclosed field. This means
1177
- # the file is either corrupt, or does not
1178
- # standard CSV formatting. Please validate
1179
- # the parsed data yourself.
1180
- var $error = 0;
1181
-
1182
- # detailed error info
1183
- var $error_info = array();
1184
-
1185
- # array of field values in data parsed
1186
- var $titles = array();
1187
-
1188
- # two dimentional array of CSV data
1189
- var $data = array();
1190
-
1191
-
1192
- /**
1193
- * Constructor
1194
- * @param input CSV file or string
1195
- * @return nothing
1196
- */
1197
- function parseCSV ($input = null, $offset = null, $limit = null, $conditions = null) {
1198
- if ( $offset !== null ) $this->offset = $offset;
1199
- if ( $limit !== null ) $this->limit = $limit;
1200
- if ( count($conditions) > 0 ) $this->conditions = $conditions;
1201
- if ( !empty($input) ) $this->parse($input);
1202
- }
1203
-
1204
-
1205
- // ==============================================
1206
- // ----- [ Main Functions ] ---------------------
1207
- // ==============================================
1208
-
1209
- /**
1210
- * Parse CSV file or string
1211
- * @param input CSV file or string
1212
- * @return nothing
1213
- */
1214
- function parse ($input = null, $offset = null, $limit = null, $conditions = null) {
1215
- if ( $input === null ) $input = $this->file;
1216
- if ( !empty($input) ) {
1217
- if ( $offset !== null ) $this->offset = $offset;
1218
- if ( $limit !== null ) $this->limit = $limit;
1219
- if ( count($conditions) > 0 ) $this->conditions = $conditions;
1220
- if ( is_readable($input) ) {
1221
- $this->data = $this->parse_file($input);
1222
- } else {
1223
- $this->file_data = &$input;
1224
- $this->data = $this->parse_string();
1225
- }
1226
- if ( $this->data === false ) return false;
1227
- }
1228
- return true;
1229
- }
1230
-
1231
- /**
1232
- * Save changes, or new file and/or data
1233
- * @param file file to save to
1234
- * @param data 2D array with data
1235
- * @param append append current data to end of target CSV if exists
1236
- * @param fields field names
1237
- * @return true or false
1238
- */
1239
- function save ($file = null, $data = array(), $append = false, $fields = array()) {
1240
- if ( empty($file) ) $file = &$this->file;
1241
- $mode = ( $append ) ? 'at' : 'wt' ;
1242
- $is_php = ( preg_match('/\.php$/i', $file) ) ? true : false ;
1243
- return $this->_wfile($file, $this->unparse($data, $fields, $append, $is_php), $mode);
1244
- }
1245
-
1246
- /**
1247
- * Generate CSV based string for output
1248
- * @param filename if specified, headers and data will be output directly to browser as a downloable file
1249
- * @param data 2D array with data
1250
- * @param fields field names
1251
- * @param delimiter delimiter used to separate data
1252
- * @return CSV data using delimiter of choice, or default
1253
- */
1254
- function output ($filename = null, $data = array(), $fields = array(), $delimiter = null) {
1255
- if ( empty($filename) ) $filename = $this->output_filename;
1256
- if ( $delimiter === null ) $delimiter = $this->output_delimiter;
1257
- $data = $this->unparse($data, $fields, null, null, $delimiter);
1258
- if ( $filename !== null ) {
1259
- header('Content-type: application/csv');
1260
- header('Content-Disposition: attachment; filename="'.$filename.'"');
1261
- echo $data;
1262
- }
1263
- return $data;
1264
- }
1265
-
1266
- /**
1267
- * Convert character encoding
1268
- * @param input input character encoding, uses default if left blank
1269
- * @param output output character encoding, uses default if left blank
1270
- * @return nothing
1271
- */
1272
- function encoding ($input = null, $output = null) {
1273
- $this->convert_encoding = true;
1274
- if ( $input !== null ) $this->input_encoding = $input;
1275
- if ( $output !== null ) $this->output_encoding = $output;
1276
- }
1277
-
1278
- /**
1279
- * Auto-Detect Delimiter: Find delimiter by analyzing a specific number of
1280
- * rows to determine most probable delimiter character
1281
- * @param file local CSV file
1282
- * @param parse true/false parse file directly
1283
- * @param search_depth number of rows to analyze
1284
- * @param preferred preferred delimiter characters
1285
- * @param enclosure enclosure character, default is double quote (").
1286
- * @return delimiter character
1287
- */
1288
- function auto ($file = null, $parse = true, $search_depth = null, $preferred = null, $enclosure = null) {
1289
-
1290
- if ( $file === null ) $file = $this->file;
1291
- if ( empty($search_depth) ) $search_depth = $this->auto_depth;
1292
- if ( $enclosure === null ) $enclosure = $this->enclosure;
1293
-
1294
- if ( $preferred === null ) $preferred = $this->auto_preferred;
1295
-
1296
- if ( empty($this->file_data) ) {
1297
- if ( $this->_check_data($file) ) {
1298
- $data = &$this->file_data;
1299
- } else return false;
1300
- } else {
1301
- $data = &$this->file_data;
1302
- }
1303
-
1304
- $chars = array();
1305
- $strlen = strlen($data);
1306
- $enclosed = false;
1307
- $n = 1;
1308
- $to_end = true;
1309
-
1310
- // walk specific depth finding posssible delimiter characters
1311
- for ( $i=0; $i < $strlen; $i++ ) {
1312
- $ch = $data{$i};
1313
- $nch = ( isset($data{$i+1}) ) ? $data{$i+1} : false ;
1314
- $pch = ( isset($data{$i-1}) ) ? $data{$i-1} : false ;
1315
-
1316
- // open and closing quotes
1317
- if ( $ch == $enclosure ) {
1318
- if ( !$enclosed || $nch != $enclosure ) {
1319
- $enclosed = ( $enclosed ) ? false : true ;
1320
- } elseif ( $enclosed ) {
1321
- $i++;
1322
- }
1323
-
1324
- // end of row
1325
- } elseif ( ($ch == "\n" && $pch != "\r" || $ch == "\r") && !$enclosed ) {
1326
- if ( $n >= $search_depth ) {
1327
- $strlen = 0;
1328
- $to_end = false;
1329
- } else {
1330
- $n++;
1331
- }
1332
-
1333
- // count character
1334
- } elseif (!$enclosed) {
1335
- if ( !preg_match('/['.preg_quote($this->auto_non_chars, '/').']/i', $ch) ) {
1336
- if ( !isset($chars[$ch][$n]) ) {
1337
- $chars[$ch][$n] = 1;
1338
- } else {
1339
- $chars[$ch][$n]++;
1340
- }
1341
- }
1342
- }
1343
- }
1344
-
1345
- // filtering
1346
- $depth = ( $to_end ) ? $n-1 : $n ;
1347
- $filtered = array();
1348
- foreach( $chars as $char => $value ) {
1349
- if ( $match = $this->_check_count($char, $value, $depth, $preferred) ) {
1350
- $filtered[$match] = $char;
1351
- }
1352
- }
1353
-
1354
- // capture most probable delimiter
1355
- ksort($filtered);
1356
- $this->delimiter = reset($filtered);
1357
-
1358
- // parse data
1359
- if ( $parse ) $this->data = $this->parse_string();
1360
-
1361
- return $this->delimiter;
1362
-
1363
- }
1364
-
1365
-
1366
- // ==============================================
1367
- // ----- [ Core Functions ] ---------------------
1368
- // ==============================================
1369
-
1370
- /**
1371
- * Read file to string and call parse_string()
1372
- * @param file local CSV file
1373
- * @return 2D array with CSV data, or false on failure
1374
- */
1375
- function parse_file ($file = null) {
1376
- if ( $file === null ) $file = $this->file;
1377
- if ( empty($this->file_data) ) $this->load_data($file);
1378
- return ( !empty($this->file_data) ) ? $this->parse_string() : false ;
1379
- }
1380
-
1381
- /**
1382
- * Parse CSV strings to arrays
1383
- * @param data CSV string
1384
- * @return 2D array with CSV data, or false on failure
1385
- */
1386
- function parse_string ($data = null) {
1387
- if ( empty($data) ) {
1388
- if ( $this->_check_data() ) {
1389
- $data = &$this->file_data;
1390
- } else return false;
1391
- }
1392
-
1393
- $white_spaces = str_replace($this->delimiter, '', " \t\x0B\0");
1394
-
1395
- $rows = array();
1396
- $row = array();
1397
- $row_count = 0;
1398
- $current = '';
1399
- $head = ( !empty($this->fields) ) ? $this->fields : array() ;
1400
- $col = 0;
1401
- $enclosed = false;
1402
- $was_enclosed = false;
1403
- $strlen = strlen($data);
1404
-
1405
- // walk through each character
1406
- for ( $i=0; $i < $strlen; $i++ ) {
1407
- $ch = $data{$i};
1408
- $nch = ( isset($data{$i+1}) ) ? $data{$i+1} : false ;
1409
- $pch = ( isset($data{$i-1}) ) ? $data{$i-1} : false ;
1410
-
1411
- // open/close quotes, and inline quotes
1412
- if ( $ch == $this->enclosure ) {
1413
- if ( !$enclosed ) {
1414
- if ( ltrim($current, $white_spaces) == '' ) {
1415
- $enclosed = true;
1416
- $was_enclosed = true;
1417
- } else {
1418
- $this->error = 2;
1419
- $error_row = count($rows) + 1;
1420
- $error_col = $col + 1;
1421
- if ( !isset($this->error_info[$error_row.'-'.$error_col]) ) {
1422
- $this->error_info[$error_row.'-'.$error_col] = array(
1423
- 'type' => 2,
1424
- 'info' => 'Syntax error found on row '.$error_row.'. Non-enclosed fields can not contain double-quotes.',
1425
- 'row' => $error_row,
1426
- 'field' => $error_col,
1427
- 'field_name' => (!empty($head[$col])) ? $head[$col] : null,
1428
- );
1429
- }
1430
- $current .= $ch;
1431
- }
1432
- } elseif ($nch == $this->enclosure) {
1433
- $current .= $ch;
1434
- $i++;
1435
- } elseif ( $nch != $this->delimiter && $nch != "\r" && $nch != "\n" ) {
1436
- for ( $x=($i+1); isset($data{$x}) && ltrim($data{$x}, $white_spaces) == ''; $x++ ) {}
1437
- if ( $data{$x} == $this->delimiter ) {
1438
- $enclosed = false;
1439
- $i = $x;
1440
- } else {
1441
- if ( $this->error < 1 ) {
1442
- $this->error = 1;
1443
- }
1444
- $error_row = count($rows) + 1;
1445
- $error_col = $col + 1;
1446
- if ( !isset($this->error_info[$error_row.'-'.$error_col]) ) {
1447
- $this->error_info[$error_row.'-'.$error_col] = array(
1448
- 'type' => 1,
1449
- 'info' =>
1450
- 'Syntax error found on row '.(count($rows) + 1).'. '.
1451
- 'A single double-quote was found within an enclosed string. '.
1452
- 'Enclosed double-quotes must be escaped with a second double-quote.',
1453
- 'row' => count($rows) + 1,
1454
- 'field' => $col + 1,
1455
- 'field_name' => (!empty($head[$col])) ? $head[$col] : null,
1456
- );
1457
- }
1458
- $current .= $ch;
1459
- $enclosed = false;
1460
- }
1461
- } else {
1462
- $enclosed = false;
1463
- }
1464
-
1465
- // end of field/row
1466
- } elseif ( ($ch == $this->delimiter || $ch == "\n" || $ch == "\r") && !$enclosed ) {
1467
- $key = ( !empty($head[$col]) ) ? $head[$col] : $col ;
1468
- $row[$key] = ( $was_enclosed ) ? $current : trim($current) ;
1469
- $current = '';
1470
- $was_enclosed = false;
1471
- $col++;
1472
-
1473
- // end of row
1474
- if ( $ch == "\n" || $ch == "\r" ) {
1475
- if ( $this->_validate_offset($row_count) && $this->_validate_row_conditions($row, $this->conditions) ) {
1476
- if ( $this->heading && empty($head) ) {
1477
- $head = $row;
1478
- } elseif ( empty($this->fields) || (!empty($this->fields) && (($this->heading && $row_count > 0) || !$this->heading)) ) {
1479
- if ( !empty($this->sort_by) && !empty($row[$this->sort_by]) ) {
1480
- if ( isset($rows[$row[$this->sort_by]]) ) {
1481
- $rows[$row[$this->sort_by].'_0'] = &$rows[$row[$this->sort_by]];
1482
- unset($rows[$row[$this->sort_by]]);
1483
- for ( $sn=1; isset($rows[$row[$this->sort_by].'_'.$sn]); $sn++ ) {}
1484
- $rows[$row[$this->sort_by].'_'.$sn] = $row;
1485
- } else $rows[$row[$this->sort_by]] = $row;
1486
- } else $rows[] = $row;
1487
- }
1488
- }
1489
- $row = array();
1490
- $col = 0;
1491
- $row_count++;
1492
- if ( $this->sort_by === null && $this->limit !== null && count($rows) == $this->limit ) {
1493
- $i = $strlen;
1494
- }
1495
- if ( $ch == "\r" && $nch == "\n" ) $i++;
1496
- }
1497
-
1498
- // append character to current field
1499
- } else {
1500
- $current .= $ch;
1501
- }
1502
- }
1503
- $this->titles = $head;
1504
- if ( !empty($this->sort_by) ) {
1505
- $sort_type = SORT_REGULAR;
1506
- if ( $this->sort_type == 'numeric' ) {
1507
- $sort_type = SORT_NUMERIC;
1508
- } elseif ( $this->sort_type == 'string' ) {
1509
- $sort_type = SORT_STRING;
1510
- }
1511
- ( $this->sort_reverse ) ? krsort($rows, $sort_type) : ksort($rows, $sort_type) ;
1512
- if ( $this->offset !== null || $this->limit !== null ) {
1513
- $rows = array_slice($rows, ($this->offset === null ? 0 : $this->offset) , $this->limit, true);
1514
- }
1515
- }
1516
- if ( !$this->keep_file_data ) {
1517
- $this->file_data = null;
1518
- }
1519
- return $rows;
1520
- }
1521
-
1522
- /**
1523
- * Create CSV data from array
1524
- * @param data 2D array with data
1525
- * @param fields field names
1526
- * @param append if true, field names will not be output
1527
- * @param is_php if a php die() call should be put on the first
1528
- * line of the file, this is later ignored when read.
1529
- * @param delimiter field delimiter to use
1530
- * @return CSV data (text string)
1531
- */
1532
- function unparse ( $data = array(), $fields = array(), $append = false , $is_php = false, $delimiter = null) {
1533
- if ( !is_array($data) || empty($data) ) $data = &$this->data;
1534
- if ( !is_array($fields) || empty($fields) ) $fields = &$this->titles;
1535
- if ( $delimiter === null ) $delimiter = $this->delimiter;
1536
-
1537
- $string = ( $is_php ) ? "<?php header('Status: 403'); die(' '); ?>".$this->linefeed : '' ;
1538
- $entry = array();
1539
-
1540
- // create heading
1541
- if ( $this->heading && !$append && !empty($fields) ) {
1542
- foreach( $fields as $key => $value ) {
1543
- $entry[] = $this->_enclose_value($value);
1544
- }
1545
- $string .= implode($delimiter, $entry).$this->linefeed;
1546
- $entry = array();
1547
- }
1548
-
1549
- // create data
1550
- foreach( $data as $key => $row ) {
1551
- foreach( $row as $field => $value ) {
1552
- $entry[] = $this->_enclose_value($value);
1553
- }
1554
- $string .= implode($delimiter, $entry).$this->linefeed;
1555
- $entry = array();
1556
- }
1557
-
1558
- return $string;
1559
- }
1560
-
1561
- /**
1562
- * Load local file or string
1563
- * @param input local CSV file
1564
- * @return true or false
1565
- */
1566
- function load_data ($input = null) {
1567
- $data = null;
1568
- $file = null;
1569
- if ( $input === null ) {
1570
- $file = $this->file;
1571
- } elseif ( file_exists($input) ) {
1572
- $file = $input;
1573
- } else {
1574
- $data = $input;
1575
- }
1576
- if ( !empty($data) || $data = $this->_rfile($file) ) {
1577
- if ( $this->file != $file ) $this->file = $file;
1578
- if ( preg_match('/\.php$/i', $file) && preg_match('/<\?.*?\?>(.*)/ims', $data, $strip) ) {
1579
- $data = ltrim($strip[1]);
1580
- }
1581
- if ( $this->convert_encoding ) $data = iconv($this->input_encoding, $this->output_encoding, $data);
1582
- if ( substr($data, -1) != "\n" ) $data .= "\n";
1583
- $this->file_data = &$data;
1584
- return true;
1585
- }
1586
- return false;
1587
- }
1588
-
1589
-
1590
- // ==============================================
1591
- // ----- [ Internal Functions ] -----------------
1592
- // ==============================================
1593
-
1594
- /**
1595
- * Validate a row against specified conditions
1596
- * @param row array with values from a row
1597
- * @param conditions specified conditions that the row must match
1598
- * @return true of false
1599
- */
1600
- function _validate_row_conditions ($row = array(), $conditions = null) {
1601
- if ( !empty($row) ) {
1602
- if ( !empty($conditions) ) {
1603
- $conditions = (strpos($conditions, ' OR ') !== false) ? explode(' OR ', $conditions) : array($conditions) ;
1604
- $or = '';
1605
- foreach( $conditions as $key => $value ) {
1606
- if ( strpos($value, ' AND ') !== false ) {
1607
- $value = explode(' AND ', $value);
1608
- $and = '';
1609
- foreach( $value as $k => $v ) {
1610
- $and .= $this->_validate_row_condition($row, $v);
1611
- }
1612
- $or .= (strpos($and, '0') !== false) ? '0' : '1' ;
1613
- } else {
1614
- $or .= $this->_validate_row_condition($row, $value);
1615
- }
1616
- }
1617
- return (strpos($or, '1') !== false) ? true : false ;
1618
- }
1619
- return true;
1620
- }
1621
- return false;
1622
- }
1623
-
1624
- /**
1625
- * Validate a row against a single condition
1626
- * @param row array with values from a row
1627
- * @param condition specified condition that the row must match
1628
- * @return true of false
1629
- */
1630
- function _validate_row_condition ($row, $condition) {
1631
- $operators = array(
1632
- '=', 'equals', 'is',
1633
- '!=', 'is not',
1634
- '<', 'is less than',
1635
- '>', 'is greater than',
1636
- '<=', 'is less than or equals',
1637
- '>=', 'is greater than or equals',
1638
- 'contains',
1639
- 'does not contain',
1640
- );
1641
- $operators_regex = array();
1642
- foreach( $operators as $value ) {
1643
- $operators_regex[] = preg_quote($value, '/');
1644
- }
1645
- $operators_regex = implode('|', $operators_regex);
1646
- if ( preg_match('/^(.+) ('.$operators_regex.') (.+)$/i', trim($condition), $capture) ) {
1647
- $field = $capture[1];
1648
- $op = $capture[2];
1649
- $value = $capture[3];
1650
- if ( preg_match('/^([\'\"]{1})(.*)([\'\"]{1})$/i', $value, $capture) ) {
1651
- if ( $capture[1] == $capture[3] ) {
1652
- $value = $capture[2];
1653
- $value = str_replace("\\n", "\n", $value);
1654
- $value = str_replace("\\r", "\r", $value);
1655
- $value = str_replace("\\t", "\t", $value);
1656
- $value = stripslashes($value);
1657
- }
1658
- }
1659
- if ( array_key_exists($field, $row) ) {
1660
- if ( ($op == '=' || $op == 'equals' || $op == 'is') && $row[$field] == $value ) {
1661
- return '1';
1662
- } elseif ( ($op == '!=' || $op == 'is not') && $row[$field] != $value ) {
1663
- return '1';
1664
- } elseif ( ($op == '<' || $op == 'is less than' ) && $row[$field] < $value ) {
1665
- return '1';
1666
- } elseif ( ($op == '>' || $op == 'is greater than') && $row[$field] > $value ) {
1667
- return '1';
1668
- } elseif ( ($op == '<=' || $op == 'is less than or equals' ) && $row[$field] <= $value ) {
1669
- return '1';
1670
- } elseif ( ($op == '>=' || $op == 'is greater than or equals') && $row[$field] >= $value ) {
1671
- return '1';
1672
- } elseif ( $op == 'contains' && preg_match('/'.preg_quote($value, '/').'/i', $row[$field]) ) {
1673
- return '1';
1674
- } elseif ( $op == 'does not contain' && !preg_match('/'.preg_quote($value, '/').'/i', $row[$field]) ) {
1675
- return '1';
1676
- } else {
1677
- return '0';
1678
- }
1679
- }
1680
- }
1681
- return '1';
1682
- }
1683
-
1684
- /**
1685
- * Validates if the row is within the offset or not if sorting is disabled
1686
- * @param current_row the current row number being processed
1687
- * @return true of false
1688
- */
1689
- function _validate_offset ($current_row) {
1690
- if ( $this->sort_by === null && $this->offset !== null && $current_row < $this->offset ) return false;
1691
- return true;
1692
- }
1693
-
1694
- /**
1695
- * Enclose values if needed
1696
- * - only used by unparse()
1697
- * @param value string to process
1698
- * @return Processed value
1699
- */
1700
- function _enclose_value ($value = null) {
1701
- if ( $value !== null && $value != '' ) {
1702
- $delimiter = preg_quote($this->delimiter, '/');
1703
- $enclosure = preg_quote($this->enclosure, '/');
1704
- if ( preg_match("/".$delimiter."|".$enclosure."|\n|\r/i", $value) || ($value{0} == ' ' || substr($value, -1) == ' ') ) {
1705
- $value = str_replace($this->enclosure, $this->enclosure.$this->enclosure, $value);
1706
- $value = $this->enclosure.$value.$this->enclosure;
1707
- }
1708
- }
1709
- return $value;
1710
- }
1711
-
1712
- /**
1713
- * Check file data
1714
- * @param file local filename
1715
- * @return true or false
1716
- */
1717
- function _check_data ($file = null) {
1718
- if ( empty($this->file_data) ) {
1719
- if ( $file === null ) $file = $this->file;
1720
- return $this->load_data($file);
1721
- }
1722
- return true;
1723
- }
1724
-
1725
-
1726
- /**
1727
- * Check if passed info might be delimiter
1728
- * - only used by find_delimiter()
1729
- * @return special string used for delimiter selection, or false
1730
- */
1731
- function _check_count ($char, $array, $depth, $preferred) {
1732
- if ( $depth == count($array) ) {
1733
- $first = null;
1734
- $equal = null;
1735
- $almost = false;
1736
- foreach( $array as $key => $value ) {
1737
- if ( $first == null ) {
1738
- $first = $value;
1739
- } elseif ( $value == $first && $equal !== false) {
1740
- $equal = true;
1741
- } elseif ( $value == $first+1 && $equal !== false ) {
1742
- $equal = true;
1743
- $almost = true;
1744
- } else {
1745
- $equal = false;
1746
- }
1747
- }
1748
- if ( $equal ) {
1749
- $match = ( $almost ) ? 2 : 1 ;
1750
- $pref = strpos($preferred, $char);
1751
- $pref = ( $pref !== false ) ? str_pad($pref, 3, '0', STR_PAD_LEFT) : '999' ;
1752
- return $pref.$match.'.'.(99999 - str_pad($first, 5, '0', STR_PAD_LEFT));
1753
- } else return false;
1754
- }
1755
- }
1756
-
1757
- /**
1758
- * Read local file
1759
- * @param file local filename
1760
- * @return Data from file, or false on failure
1761
- */
1762
- function _rfile ($file = null) {
1763
- if ( is_readable($file) ) {
1764
- if ( !($fh = fopen($file, 'r')) ) return false;
1765
- $data = fread($fh, filesize($file));
1766
- fclose($fh);
1767
- return $data;
1768
- }
1769
- return false;
1770
- }
1771
-
1772
- /**
1773
- * Write to local file
1774
- * @param file local filename
1775
- * @param string data to write to file
1776
- * @param mode fopen() mode
1777
- * @param lock flock() mode
1778
- * @return true or false
1779
- */
1780
- function _wfile ($file, $string = '', $mode = 'wb', $lock = 2) {
1781
- if ( $fp = fopen($file, $mode) ) {
1782
- flock($fp, $lock);
1783
- $re = fwrite($fp, $string);
1784
- $re2 = fclose($fp);
1785
- if ( $re != false && $re2 != false ) return true;
1786
- }
1787
- return false;
1788
- }
1789
-
1790
- }
1791
 
277
 
278
  /**
279
  * Function converts CSV data to formatted array.
280
+ * @param $file CSV input filename
281
+ * @param $delim delimiter for the CSV
 
 
 
282
  * @return array formatted CSV output as array
283
  */
284
  function csv_file_data($file)
285
  {
286
  $file = $this->getUploadDirectory().'/'.$file;
287
+ require_once(WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY.'includes/Importer.php');
288
+ $csv = new ImporterLib();
289
+ $csv->delim($file);
290
  foreach($csv->data as $hkey => $hval) {
291
  foreach($hval as $hk => $hv) {
292
  $this->headers[] = $hk;
293
  }
294
  break;
295
  }
296
+ return $csv->data;
297
  }
298
 
299
 
793
  ) ENGINE=InnoDB;";
794
  $wpdb->query($sql1);
795
  $wpdb->query($sql2);
796
+ $importedTypes = array('Post','Page','Custom Post','Comments','Users','Eshop');
797
  foreach($importedTypes as $importedType){
798
  $querycheck = $wpdb->get_results("select *from smackcsv_pie_log where type = \"{$importedType}\"");
799
  if (count($querycheck) == 0){
1018
  }
1019
 
1020
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1021
 
index.php CHANGED
@@ -2,7 +2,7 @@
2
  /******************************
3
  * Plugin Name: WP Ultimate CSV Importer
4
  * Description: A plugin that helps to import the data's from a CSV file.
5
- * Version: 3.6.2
6
  * Author: smackcoders.com
7
  * Plugin URI: http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html
8
  * Author URI: http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html
2
  /******************************
3
  * Plugin Name: WP Ultimate CSV Importer
4
  * Description: A plugin that helps to import the data's from a CSV file.
5
+ * Version: 3.6.3
6
  * Author: smackcoders.com
7
  * Plugin URI: http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html
8
  * Author URI: http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html
js/dashchart.js CHANGED
@@ -16,7 +16,6 @@ jQuery.ajax({
16
  success: function(data) {
17
 
18
  var browser = JSON.parse(data);
19
- // alert(browser['label']);
20
  if (browser['label'] == 'No Imports Yet') {
21
  document.getElementById('pieStats').innerHTML = "<h2 style='color: red;text-align: center;padding-top: 100px;' >No Imports Yet</h2>";
22
  }
@@ -71,18 +70,7 @@ jQuery.ajax({
71
  cache: false,
72
  success: function(data) {
73
  var val = JSON.parse(data);
74
- //var get_cat = val['cat'];
75
- var line = [val[0],val[1],val[2],val[3],val[4]];//,val[5],val[6],val[7],val[8],val[9]];
76
- /*{
77
- name: 'New York',
78
- data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5]
79
- }, {
80
- name: 'Berlin',
81
- data: [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0]
82
- }, {
83
- name: 'London',
84
- data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
85
- }]; */
86
  jQuery('#lineStats').highcharts({
87
  title: {
88
  text: '',
@@ -93,8 +81,7 @@ jQuery.ajax({
93
  x: -5
94
  },
95
  xAxis: {
96
- categories:val.cat /* ["Jan", "Feb", 'Mar', 'Apr', 'May', 'Jun',
97
- 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] */
98
  },
99
  yAxis: {
100
  title: {
16
  success: function(data) {
17
 
18
  var browser = JSON.parse(data);
 
19
  if (browser['label'] == 'No Imports Yet') {
20
  document.getElementById('pieStats').innerHTML = "<h2 style='color: red;text-align: center;padding-top: 100px;' >No Imports Yet</h2>";
21
  }
70
  cache: false,
71
  success: function(data) {
72
  var val = JSON.parse(data);
73
+ var line = [val[0],val[1],val[2],val[3],val[4],val[5]];
 
 
 
 
 
 
 
 
 
 
 
74
  jQuery('#lineStats').highcharts({
75
  title: {
76
  text: '',
81
  x: -5
82
  },
83
  xAxis: {
84
+ categories:val.cat
 
85
  },
86
  yAxis: {
87
  title: {
js/ultimate-importer-pro.js CHANGED
@@ -682,133 +682,6 @@ function sendemail2smackers(){
682
  jQuery("#showMsg").fadeOut(10000);
683
  return false;
684
  }
685
- // Charts js function start here
686
-
687
- //line chart
688
- function lineStats()
689
- {
690
- jQuery.ajax({
691
- type: 'POST',
692
- url: ajaxurl,
693
- data: {
694
- 'action' : 'secondchart',
695
- 'postdata' : 'secondchartdata',
696
- },
697
- dataType: 'json',
698
- cache: false,
699
- success: function(data) {
700
-
701
- var val = JSON.parse(data);
702
- // var get_cat = val['cat'];
703
- var line = [val[0],val[1],val[2],val[3],val[4]];
704
- alert(line);
705
- /*{
706
- name: 'New York',
707
- data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5]
708
- }, {
709
- name: 'Berlin',
710
- data: [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0]
711
- }, {
712
- name: 'London',
713
- data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
714
- }]; */
715
- jQuery('#lineStats').highcharts({
716
- title: {
717
- text: '',
718
- x: -5 //center
719
- },
720
- subtitle: {
721
- text: '',
722
- x: -5
723
- },
724
- xAxis: {
725
- categories:val.cat /* ["Jan", "Feb", 'Mar', 'Apr', 'May', 'Jun',
726
- 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] */
727
- },
728
- yAxis: {
729
- title: {
730
- text: 'Import (Nos)'
731
- },
732
- plotLines: [{
733
- value: 0,
734
- width: 1,
735
- color: '#808080'
736
- }]
737
- },
738
- tooltip: {
739
- valueSuffix: ' Nos'
740
- },
741
- legend: {
742
- layout: 'vertical',
743
- align: 'right',
744
- verticalAlign: 'middle',
745
- borderWidth: 0
746
- },
747
- series:line });
748
- }
749
- });
750
- }
751
-
752
- // pie chart js
753
- function pieStats()
754
- {
755
- jQuery.ajax({
756
- type: 'POST',
757
- url: ajaxurl,
758
- data: {
759
- 'action' : 'firstchart',
760
- 'postdata' : 'firstchartdata',
761
- },
762
- dataType: 'json',
763
- cache: false,
764
- success: function(data) {
765
- var browser = JSON.parse(data);
766
- // alert(browser);
767
- if(browser.length == 0) {
768
- document.getElementById('pieStats').innerHTML = "<h2 style='color: red;text-align: center;padding-top: 100px;' >No Imports Yet</h2>";
769
- }
770
-
771
-
772
- else {
773
- jQuery('#pieStats').highcharts({
774
- chart: {
775
- type: 'pie',
776
- options3d: {
777
- enabled: true,
778
- alpha: 45,
779
- beta: 0
780
- }
781
- },
782
- title: {
783
- text: ''
784
- },
785
- tooltip: {
786
- pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
787
- },
788
- plotOptions: {
789
- pie: {
790
- allowPointSelect: true,
791
- cursor: 'pointer',
792
- depth: 35,
793
- dataLabels: {
794
- enabled: true,
795
- format: '{point.name}'
796
- }
797
- }
798
- },
799
- series: [{
800
- type: 'pie',
801
- name: 'overall statistics',
802
- // data: JSON.parse(data),
803
- data: browser
804
- }]
805
- });
806
- }
807
- }
808
- });
809
- }
810
-
811
-
812
 
813
 
814
  function check_allnumeric(inputtxt)
@@ -849,7 +722,7 @@ function export_module(){
849
  return false;
850
  }
851
  function export_check(value) {
852
- if(value == 'eshop' || value == 'woocommerce' || value == 'wpcommerce' || value == 'marketpress' || value == 'users' || value == 'category' || value == 'tags' || value == 'customtaxonomy') {
853
  document.getElementById(value).checked = false;
854
  document.getElementById('ShowMsg').style.display = "";
855
  value = value.toUpperCase();
682
  jQuery("#showMsg").fadeOut(10000);
683
  return false;
684
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
685
 
686
 
687
  function check_allnumeric(inputtxt)
722
  return false;
723
  }
724
  function export_check(value) {
725
+ if( value == 'woocommerce' || value == 'wpcommerce' || value == 'marketpress' || value == 'users' || value == 'category' || value == 'tags' || value == 'customtaxonomy') {
726
  document.getElementById(value).checked = false;
727
  document.getElementById('ShowMsg').style.display = "";
728
  value = value.toUpperCase();
lib/jquery-plugins/index.php DELETED
File without changes
modules/dashboard/actions/actions.php CHANGED
@@ -80,7 +80,7 @@ class DashboardActions extends SkinnyActions {
80
  }
81
 
82
  $j=0;
83
- $get_imptype = array('Post','Page','Comments','Custom Post','Users');
84
  foreach($get_imptype as $imp_type)
85
  {
86
  $lid = $wpdb->get_results("select inserted from smackcsv_line_log where imported_type = '{$imp_type}' and imported_on >= DATE_SUB(NOW(),INTERVAL 1 YEAR)");
@@ -162,15 +162,14 @@ class DashboardActions extends SkinnyActions {
162
  global $wpdb;
163
  $blog_id = 1;
164
  $returnArray = array();
165
- $imptype = array('Post','Page','Comments','Custom Post','Users');
166
  $i = 0;
167
  foreach($imptype as $imp) {
168
  $OverviewDetails = $wpdb->get_results("select * from smackcsv_pie_log where type = '{$imp}' and value != 0");
169
  foreach($OverviewDetails as $overview){
170
  $returnArray[$i][0] = $overview->type;
171
  $returnArray[$i][1] = (int)$overview->value;
172
-
173
- $i++;
174
  }
175
 
176
  }
80
  }
81
 
82
  $j=0;
83
+ $get_imptype = array('Post','Page','Comments','Custom Post','Users','Eshop');
84
  foreach($get_imptype as $imp_type)
85
  {
86
  $lid = $wpdb->get_results("select inserted from smackcsv_line_log where imported_type = '{$imp_type}' and imported_on >= DATE_SUB(NOW(),INTERVAL 1 YEAR)");
162
  global $wpdb;
163
  $blog_id = 1;
164
  $returnArray = array();
165
+ $imptype = array('Post','Page','Comments','Custom Post','Users','Eshop');
166
  $i = 0;
167
  foreach($imptype as $imp) {
168
  $OverviewDetails = $wpdb->get_results("select * from smackcsv_pie_log where type = '{$imp}' and value != 0");
169
  foreach($OverviewDetails as $overview){
170
  $returnArray[$i][0] = $overview->type;
171
  $returnArray[$i][1] = (int)$overview->value;
172
+ $i++;
 
173
  }
174
 
175
  }
modules/eshop/actions/actions.php CHANGED
@@ -50,7 +50,681 @@ class EshopActions extends SkinnyActions {
50
  {
51
  // return an array of name value pairs to send data to the template
52
  $data = array();
53
- return $data;
 
 
 
 
 
 
 
54
  }
 
 
55
 
56
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  {
51
  // return an array of name value pairs to send data to the template
52
  $data = array();
53
+ $get_importer_settings = get_option('wpcsvfreesettings');
54
+ if (in_array('eshop', $get_importer_settings)) {
55
+ $data['is_enable'] = 'on';
56
+ } else {
57
+ $data['is_enable'] = 'off';
58
+ }
59
+ return $data;
60
+
61
  }
62
+ // @var boolean post title check
63
+ public $titleDupCheck = false;
64
 
65
+ // @var boolean content title check
66
+ public $conDupCheck = false;
67
+
68
+ // @var boolean for post flag
69
+ public $postFlag = true;
70
+
71
+ // @var int duplicate post count
72
+ public $dupPostCount = 0;
73
+
74
+ // @var int inserted post count
75
+ public $insPostCount = 0;
76
+
77
+ // @var int no post author count
78
+ public $noPostAuthCount = 0;
79
+
80
+ // @var int updated post count
81
+ public $updatedPostCount = 0;
82
+
83
+ // @var array wp field keys
84
+ public $keys = array();
85
+
86
+ public $detailedLog = array();
87
+
88
+ /**
89
+ * Mapping fields
90
+ */
91
+ public $defCols = array('post_title' => null, 'post_content' => null, 'post_excerpt' => null, 'post_date' => null, 'post_name' => null, 'post_status' => null, 'post_author' => null, 'post_parent' => 0, 'comment_status' => 'open', 'ping_status' => 'open', 'SKU' => null, 'products_option' => null, 'sale_price' => 0, 'regular_price' => 0, 'description' => null, 'shiprate' => 'no', 'optset' => null, 'featured_product' => 'no', 'product_in_sale' => 'no', 'stock_available' => 'no', 'cart_option' => 'null', 'category' => null, 'tags' => null, 'featured_image' => null,);
92
+
93
+ /**
94
+ * Manage duplicates
95
+ *
96
+ * @param string type = (title|content), string content
97
+ * @return boolean
98
+ */
99
+ function duplicateChecks($type = 'title', $text, $gettype)
100
+ {
101
+ global $wpdb;
102
+ $gettype = 'post';
103
+ if ($type == 'content') {
104
+ $htmlDecode = html_entity_decode($text);
105
+ $strippedText = strip_tags($htmlDecode);
106
+ $contentLength = strlen($strippedText);
107
+ $allPosts_count = $wpdb->get_results("SELECT COUNT(ID) as count FROM $wpdb->posts WHERE post_type = \"{$gettype}\" and post_status IN('publish','future','draft','pending','private')");
108
+ $allPosts_count = $allPosts_count[0]->count;
109
+ $allPosts = $wpdb->get_results("SELECT ID,post_title,post_date,post_content FROM $wpdb->posts WHERE post_type = \"{$gettype}\" and post_status IN('publish','future','draft','pending','private')");
110
+ foreach ($allPosts as $allPost) {
111
+ $htmlDecodePCont = html_entity_decode($allPost->post_content);
112
+ $strippedTextPCont = strip_tags($htmlDecodePCont);
113
+ similar_text($strippedTextPCont, $strippedText, $p);
114
+ if ($p == 100) {
115
+ $this->dupPostCount++;
116
+ return false;
117
+ }
118
+ }
119
+ return true;
120
+ } else if ($type == 'title') {
121
+ $post_exist = $wpdb->get_results("select ID from " . $wpdb->posts . " where post_title = \"{$text}\" and post_type = \"{$gettype}\" and post_status in('publish','future','draft','pending','private')");
122
+ if (count($post_exist) == 0 && ($text != null || $text != ''))
123
+ return true;
124
+ }
125
+ $this->dupPostCount++;
126
+ return false;
127
+ }
128
+
129
+ /**
130
+ * Get field colum keys
131
+ */
132
+ function getKeyVals()
133
+ {
134
+ $cust_fields='';
135
+ $acf_field=array();
136
+ $wpcsvfreesettings = array();
137
+ global $wpdb;
138
+ $active_plugins = get_option('active_plugins');
139
+ $limit = ( int )apply_filters('postmeta_form_limit', 150);
140
+ $this->keys = $wpdb->get_col("SELECT meta_key FROM $wpdb->postmeta
141
+ GROUP BY meta_key
142
+ HAVING meta_key NOT LIKE '\_%' and meta_key NOT LIKE 'field_%'
143
+ ORDER BY meta_key
144
+ LIMIT $limit");
145
+
146
+ foreach ($this->keys as $val) {
147
+ $this->defCols ["CF: " . $val] = $val;
148
+ }
149
+ $wpcsvfreesettings = get_option('wpcsvfreesettings');
150
+ if($wpcsvfreesettings)
151
+ if(in_array('aioseo',$wpcsvfreesettings)){
152
+ if(in_array('all-in-one-seo-pack/all_in_one_seo_pack.php', $active_plugins)){
153
+ $seo_custoFields =array('SEO: keywords','SEO: description','SEO: title','SEO: noindex','SEO: nofollow','SEO: titleatr','SEO: menulabel','SEO: disable','SEO: disable_analytics','SEO: noodp','SEO: noydir');
154
+ foreach($seo_custoFields as $val)
155
+ $this->defCols[$val]=$val;
156
+ }
157
+ }
158
+ }
159
+ /**
160
+ * Function for import wp-ecommerce meta-data's
161
+ * @param $new_post
162
+ * @param $post_id
163
+ * @return mixed
164
+ */
165
+ public function eshopMetaData($new_post, $post_id) {
166
+ global $wpdb;
167
+ $eshopoptions = get_option('eshop_plugin_settings');
168
+ foreach ($new_post as $ckey => $cval) {
169
+ $taxo = get_taxonomies();
170
+ foreach ($taxo as $taxokey => $taxovalue) {
171
+ if ($taxokey != 'category' && $taxokey != 'link_category' && $taxokey != 'post_tag' && $taxokey != 'nav_menu' && $taxokey != 'post_format') {
172
+ if ($taxokey == $ckey) {
173
+ $smack_taxo[$ckey] = $new_post[$ckey];
174
+ }
175
+
176
+ }
177
+ }
178
+ switch ($ckey) {
179
+ case 'featured_product' :
180
+ $isFeatured = strtolower($new_post[$ckey]);
181
+ $metaDatas['featured'] = $isFeatured;
182
+ if ($isFeatured == 'yes') {
183
+ update_post_meta($post_id, '_eshop_featured', 'Yes');
184
+ $metaDatas['featured'] = 'Yes';
185
+ }
186
+ break;
187
+ case 'product_in_sale' :
188
+ $inSale = strtolower($new_post[$ckey]);
189
+ $metaDatas['sale'] = $inSale;
190
+ if ($inSale == 'yes') {
191
+ update_post_meta($post_id, '_eshop_sale', 'yes');
192
+ }
193
+ break;
194
+ case 'stock_available' :
195
+ $cval = strtolower($cval);
196
+ if ($cval == 'yes' || $cval == 1) {
197
+ update_post_meta($post_id, '_eshop_stock', 1);
198
+ }
199
+ break;
200
+ case 'cart-option' :
201
+ $cartOption = strtolower($new_post[$ckey]);
202
+ if ($cartOption == 'yes' || $cartOption == 'no') {
203
+ $cartOption = 0;
204
+ } else {
205
+ $cartOption = $cartOption;
206
+ }
207
+ $metaDatas['cart_radio'] = $cartOption;
208
+ break;
209
+ case 'description' :
210
+ $metaDatas['description'] = $new_post[$ckey];
211
+ break;
212
+ case 'shiprate' :
213
+ $shipRate = strtoupper($new_post[$ckey]);
214
+ $metaDatas['shiprate'] = $shipRate;
215
+ break;
216
+ case 'SKU' :
217
+ $metaDatas['sku'] = $new_post[$ckey];
218
+ break;
219
+ case 'products_option':
220
+ $productOptions = $new_post[$ckey];
221
+ break;
222
+ case 'regular_price':
223
+ $regularPrice = $new_post[$ckey];
224
+ break;
225
+ case 'sale_price':
226
+ $salePrice = $new_post[$ckey];
227
+ break;
228
+ case 'tags':
229
+ $tags['post_tag'] = $new_post[$ckey];
230
+ break;
231
+ case 'category':
232
+ $categories['category'] = $new_post[$ckey];
233
+ break;
234
+ }
235
+ }
236
+ if (!empty($productOptions)) {
237
+ $get_product_option = explode(',', $productOptions);
238
+ }
239
+ if (!empty($regularPrice)) {
240
+ $get_regular_price = explode(',', $regularPrice);
241
+ }
242
+ if (!empty($salePrice)) {
243
+ $get_sale_price = explode(',', $salePrice);
244
+ }
245
+
246
+
247
+ for ($x = 0; $x <= 2; $x++) {
248
+ if (!isset($get_product_option[$x])) {
249
+ $get_product_option[$x] = null;
250
+ }
251
+ }
252
+
253
+ for ($y = 0; $y <= 2; $y++) {
254
+ if (!isset($get_regular_price[$y])) {
255
+ $get_regular_price[$y] = null;
256
+ }
257
+ }
258
+
259
+ for ($z = 0; $z <= 2; $z++) {
260
+ if (!isset($get_sale_price[$z])) {
261
+ $get_sale_price[$z] = null;
262
+ }
263
+ }
264
+
265
+ $Products[1]['option'] = $get_product_option[0];
266
+ $Products[2]['option'] = $get_product_option[1];
267
+ $Products[3]['option'] = $get_product_option[2];
268
+ $Products[1]['price'] = $get_regular_price[0];
269
+ $Products[2]['price'] = $get_regular_price[1];
270
+ $Products[3]['price'] = $get_regular_price[2];
271
+ $Products[1]['saleprice'] = $get_sale_price[0];
272
+ $Products[2]['saleprice'] = $get_sale_price[1];
273
+ $Products[3]['saleprice'] = $get_sale_price[2];
274
+ $metaDatas['products'] = $Products;
275
+ if (!empty($metaDatas)) {
276
+ update_post_meta($post_id, '_eshop_product', $metaDatas);
277
+ }
278
+ if (!empty($tags)) {
279
+ foreach ($tags as $tag_key => $tag_value) {
280
+ $split_line = explode(',', $tag_value);
281
+ $term_taxonomy_id_t = wp_set_object_terms($post_id, $split_line, "post_tag");
282
+ }
283
+ }
284
+ if (!empty($categories)) {
285
+ foreach ($categories as $cat_key => $cat_value) {
286
+ $split_line = explode('|', $cat_value);
287
+ $term_taxonomy_id_c = wp_set_object_terms($post_id, $split_line, "category");
288
+ }
289
+ }
290
+ #TODO: $term_taxonomy_id_c, $term_taxonomy_id_t not used in this function / overwritten immediately
291
+ return $metaDatas;
292
+ }
293
+
294
+ /**
295
+ * function to map the csv file and process it
296
+ *
297
+ * @return boolean
298
+ */
299
+ function processDataInWP($data_rows,$ret_array,$session_arr)
300
+ {
301
+ global $wpdb;
302
+ $post_id = '';
303
+ $new_post = array();
304
+ $smack_taxo = array();
305
+ $custom_array = array();
306
+ $seo_custom_array= array();
307
+ $imported_feature_img = array();
308
+ $headr_count = $ret_array['h2'];
309
+ for ($i = 0; $i < count($data_rows); $i++) {
310
+ if (array_key_exists('mapping' . $i, $ret_array)) {
311
+ if($ret_array ['mapping' . $i] != '-- Select --'){
312
+ if ($ret_array ['mapping' . $i] != 'add_custom' . $i) {
313
+ $strip_CF = strpos($ret_array['mapping' . $i], 'CF: ');
314
+ $strip_SEO = strpos($ret_array['mapping'.$i],'SEO: ');
315
+ if ($strip_CF === 0) {
316
+ $custom_key = substr($ret_array['mapping' . $i], 4);
317
+ $custom_array[$custom_key] = $data_rows[$i];
318
+ }
319
+ elseif($strip_SEO === 0){
320
+ $seo_key = substr($ret_array['mapping'.$i], 5);
321
+ $seo_custom_array[$seo_key] = $data_rows[$i];
322
+ }
323
+ else {
324
+ $new_post[$ret_array['mapping' . $i]] = $data_rows[$i];
325
+ }
326
+ } else {
327
+ $new_post [$ret_array ['textbox' . $i]] = $data_rows [$i];
328
+ $custom_array [$ret_array ['textbox' . $i]] = $data_rows [$i];
329
+ }
330
+ }
331
+ }
332
+ }
333
+ for ($inc = 0; $inc < count($data_rows); $inc++) {
334
+ foreach ($this->keys as $k => $v) {
335
+ if (array_key_exists($v, $new_post)) {
336
+ $custom_array [$v] = $new_post [$v];
337
+ }
338
+ }
339
+ }
340
+ if(is_array( $new_post )){
341
+ foreach ($new_post as $ckey => $cval) {
342
+ $this->postFlag = true;
343
+ $taxo = get_taxonomies();
344
+ foreach ($taxo as $taxokey => $taxovalue) {
345
+ if ($taxokey != 'category' && $taxokey != 'link_category' && $taxokey != 'post_tag' && $taxokey != 'nav_menu' && $taxokey != 'post_format') {
346
+ if ($taxokey == $ckey) {
347
+ $smack_taxo [$ckey] = $new_post [$ckey];
348
+ }
349
+ }
350
+ }
351
+
352
+ $taxo_check = 0;
353
+ if (!isset($smack_taxo[$ckey])) {
354
+ $smack_taxo [$ckey] = null;
355
+ $taxo_check = 1;
356
+ }
357
+ if ($ckey != 'post_category' && $ckey != 'post_tag' && $ckey != 'featured_image' && $ckey != $smack_taxo [$ckey] && $ckey != 'wp_page_template') {
358
+ if ($taxo_check == 1) {
359
+ unset($smack_taxo[$ckey]);
360
+ $taxo_check = 0;
361
+ }
362
+ if (array_key_exists($ckey, $custom_array)) {
363
+ $darray [$ckey] = $new_post [$ckey];
364
+ } else {
365
+ if (array_key_exists($ckey, $smack_taxo)) {
366
+ $data_array[$ckey] = null;
367
+ } else {
368
+ $data_array[$ckey] = $new_post [$ckey];
369
+ }
370
+ }
371
+ } else {
372
+ switch ($ckey) {
373
+ case 'post_tag' :
374
+ $tags [$ckey] = $new_post [$ckey];
375
+ break;
376
+ case 'post_category' :
377
+ $categories [$ckey] = $new_post [$ckey];
378
+ break;
379
+ case 'wp_page_template' :
380
+ $custom_array['_wp_page_template'] = $new_post [$ckey];
381
+ break;
382
+ case 'featured_image' :
383
+ require_once(ABSPATH . "wp-includes/pluggable.php");
384
+ require_once(ABSPATH . 'wp-admin/includes/image.php');
385
+ $dir = wp_upload_dir();
386
+ $get_media_settings = get_option('uploads_use_yearmonth_folders');
387
+ if($get_media_settings == 1){
388
+ $dirname = date('Y') . '/' . date('m');
389
+ $full_path = $dir ['basedir'] . '/' . $dirname;
390
+ $baseurl = $dir ['baseurl'] . '/' . $dirname;
391
+ }else{
392
+ $full_path = $dir ['basedir'];
393
+ $baseurl = $dir ['baseurl'];
394
+ }
395
+
396
+ $f_img = $new_post [$ckey];
397
+ $fimg_path = $full_path;
398
+
399
+ $fimg_name = @basename($f_img);
400
+ $fimg_name = preg_replace("/[^a-zA-Z0-9._\s]/", "", $fimg_name);
401
+ $fimg_name = preg_replace('/\s/', '-', $fimg_name);
402
+ $fimg_name = urlencode($fimg_name);
403
+
404
+ $parseURL = parse_url($f_img);
405
+ $path_parts = pathinfo($f_img);
406
+ if(!isset($path_parts['extension']))
407
+ $fimg_name = $fimg_name . '.jpg';
408
+
409
+ $f_img_slug = preg_replace("/[^a-zA-Z0-9._\s]/", "", $new_post['post_title']);
410
+ $f_img_slug = preg_replace('/\s/', '-', $f_img_slug);
411
+
412
+ $post_slug_value = strtolower($f_img_slug);
413
+ require_once(WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY.'/includes/WPImporter_includes_helper.php');
414
+ $impCE = new WPImporter_includes_helper();
415
+
416
+ $impCE->get_fimg_from_URL($f_img,$fimg_path,$fimg_name,$post_slug_value);
417
+ $filepath = $fimg_path."/" . $post_slug_value . "-" . $fimg_name;
418
+
419
+ if(@getimagesize($filepath)){
420
+ $img = wp_get_image_editor($filepath);
421
+ if (!is_wp_error($img)) {
422
+ $sizes_array = array(
423
+ // #1 - resizes to 1024x768 pixel, square-cropped image
424
+ array('width' => 1024, 'height' => 768, 'crop' => true),
425
+ // #2 - resizes to 100px max width/height, non-cropped image
426
+ array('width' => 100, 'height' => 100, 'crop' => false),
427
+ // #3 - resizes to 100 pixel max height, non-cropped image
428
+ array('width' => 300, 'height' => 100, 'crop' => false),
429
+ // #3 - resizes to 624x468 pixel max width, non-cropped image
430
+ array('width' => 624, 'height' => 468, 'crop' => false)
431
+ );
432
+ $resize = $img->multi_resize($sizes_array);
433
+ }
434
+ $file ['guid'] = $baseurl."/".$fimg_name;
435
+ $file ['post_title'] = $fimg_name;
436
+ $file ['post_content'] = '';
437
+ $file ['post_status'] = 'attachment';
438
+ }
439
+ else {
440
+ $file = false;
441
+ }
442
+ break;
443
+ }
444
+ }
445
+ }
446
+ }
447
+
448
+
449
+ if($_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['selectedImporter'] != 'custompost'){
450
+ $data_array['post_type'] = $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['selectedImporter'];
451
+ }else{
452
+ $data_array['post_type'] = $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['custompostlist'];
453
+ }
454
+ if ($this->titleDupCheck == 'true')
455
+ $this->postFlag = $this->duplicateChecks('title', $data_array ['post_title'], $data_array ['post_type']);
456
+
457
+ if ($this->conDupCheck == 'true' && $this->postFlag)
458
+ $this->postFlag = $this->duplicateChecks('content', $data_array ['post_content'], $data_array ['post_type']);
459
+
460
+ if ($this->postFlag) {
461
+ unset ($sticky);
462
+ if (empty($data_array['post_status']))
463
+ $data_array['post_status'] = null;
464
+ $data_array['post_type'] = "post";
465
+
466
+ if ($_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['importallwithps'] != 0)
467
+ $data_array['post_status'] = $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['importallwithps'];
468
+
469
+ switch ($data_array ['post_status']) {
470
+ case 1 :
471
+ $data_array['post_status'] = 'publish';
472
+ break;
473
+ case 2 :
474
+ $data_array['post_status'] = 'publish';
475
+ $sticky = true;
476
+ break;
477
+ case 3 :
478
+ $data_array['post_status'] = 'publish';
479
+ $data_array ['post_password'] = $_POST ['postsPassword'];
480
+ break;
481
+ case 4 :
482
+ $data_array ['post_status'] = 'private';
483
+ break;
484
+ case 5 :
485
+ $data_array ['post_status'] = 'draft';
486
+ break;
487
+ case 6 :
488
+ $data_array ['post_status'] = 'pending';
489
+ break;
490
+ default :
491
+ $poststatus = $data_array['post_status'] = strtolower($data_array['post_status']);
492
+ if ($data_array['post_status'] != 'publish' && $data_array['post_status'] != 'private' && $data_array['post_status'] != 'draft' && $data_array['post_status'] != 'pending' && $data_array['post_status'] != 'sticky') {
493
+ $stripPSF = strpos($data_array['post_status'], '{');
494
+ if ($stripPSF === 0) {
495
+ $poststatus = substr($data_array['post_status'], 1);
496
+ $stripPSL = substr($poststatus, -1);
497
+ if ($stripPSL == '}') {
498
+ $postpwd = substr($poststatus, 0, -1);
499
+ $data_array['post_status'] = 'publish';
500
+ $data_array ['post_password'] = $postpwd;
501
+ } else {
502
+ $data_array['post_status'] = 'publish';
503
+ $data_array ['post_password'] = $poststatus;
504
+ }
505
+ } else {
506
+ $data_array['post_status'] = 'publish';
507
+ }
508
+ }
509
+ if ($data_array['post_status'] == 'sticky') {
510
+ $data_array['post_status'] = 'publish';
511
+ $sticky = true;
512
+ }
513
+
514
+ }
515
+
516
+ // Author name/id update
517
+ if(isset($data_array ['post_author'])){
518
+ $authorLen = strlen($data_array ['post_author']);
519
+ $postuserid = $data_array ['post_author'];
520
+ $checkpostuserid = intval($data_array ['post_author']);
521
+ $postAuthorLen = strlen($checkpostuserid);
522
+ $postauthor = array();
523
+
524
+ if ($authorLen == $postAuthorLen) {
525
+ $postauthor = $wpdb->get_results("select ID from $wpdb->users where ID = \"{$postuserid}\"");
526
+ if(empty($postauthor) || !$postauthor[0]->ID) { // If user name are numeric Ex: 1300001
527
+ $postauthor = $wpdb->get_results("select ID from $wpdb->users where user_login = \"{$postuserid}\"");
528
+ }
529
+ } else {
530
+ $postauthor = $wpdb->get_results("select ID from $wpdb->users where user_login = \"{$postuserid}\"");
531
+ }
532
+
533
+ if (empty($postauthor) || !$postauthor[0]->ID) {
534
+ $data_array ['post_author'] = 1;
535
+ $this->noPostAuthCount++;
536
+ } else {
537
+ $data_array ['post_author'] = $postauthor [0]->ID;
538
+ }
539
+ }
540
+ else{
541
+ $data_array ['post_author'] = 1;
542
+ $this->noPostAuthCount++;
543
+ }
544
+
545
+ // Date format post
546
+ if (!isset($data_array ['post_date'])){
547
+ $data_array ['post_date'] = date('Y-m-d H:i:s');
548
+ }else{
549
+ $data_array ['post_date'] = date('Y-m-d H:i:s', strtotime($data_array ['post_date']));
550
+ }
551
+ if(isset($data_array ['post_slug'])){
552
+ $data_array ['post_name'] = $data_array ['post_slug'];
553
+ }
554
+
555
+ //add global password
556
+ if($data_array){
557
+ if($ret_array['importallwithps'] == 3){
558
+ $data_array['post_password'] = $ret_array['globalpassword_txt'];
559
+
560
+ }
561
+ }
562
+ if ($data_array)
563
+ $post_id = wp_insert_post($data_array);
564
+
565
+ unset($postauthor);
566
+ if ($post_id) {
567
+ $custom_array = $this->eshopMetaData($new_post, $post_id);
568
+ $uploaded_file_name=$session_arr['uploadedFile'];
569
+ $real_file_name = $session_arr['uploaded_csv_name'];
570
+ // $version = $session_arr['currentfileversion'];
571
+ $action = $data_array['post_type'];
572
+ /* $version_arr=array();
573
+ $version_arr=explode("(",$uploaded_file_name);
574
+ $version_arr=explode(")",$version_arr[1]);
575
+ $version=$version_arr[0]; */
576
+ $get_imported_feature_image = array();
577
+ $get_imported_feature_image = get_option('IMPORTED_FEATURE_IMAGES');
578
+ if(is_array($get_imported_feature_image)){
579
+ $imported_feature_img = array_merge($get_imported_feature_image, $imported_feature_img);
580
+ }
581
+ else{
582
+ $imported_feature_img = $imported_feature_img;
583
+ }
584
+ update_option('IMPORTED_FEATURE_IMAGES', $imported_feature_img);
585
+ $created_records[$action][] = $post_id;
586
+ if($action == 'eshop'){
587
+ $imported_as = 'eshop-product';
588
+ }
589
+ $keyword = $action;
590
+ $this->insPostCount++;
591
+ if (isset($sticky) && $sticky)
592
+ stick_post($post_id);
593
+
594
+ if (!empty ($custom_array)) {
595
+ foreach ($custom_array as $custom_key => $custom_value) {
596
+ update_post_meta($post_id, $custom_key, $custom_value);
597
+ }
598
+ }
599
+
600
+
601
+ //Import SEO Values
602
+ if(!empty($seo_custom_array)){
603
+ $this->importSEOfields($seo_custom_array,$post_id);
604
+ }
605
+
606
+ // Create custom taxonomy to post
607
+ if (!empty ($smack_taxo)) {
608
+ foreach ($smack_taxo as $taxo_key => $taxo_value) {
609
+ if (!empty($taxo_value)) {
610
+ $split_line = explode('|', $taxo_value);
611
+ wp_set_object_terms($post_id, $split_line, $taxo_key);
612
+ }
613
+ }
614
+ }
615
+
616
+ // Create/Add tags to post
617
+ if (!empty ($tags)) {
618
+ foreach ($tags as $tag_key => $tag_value) {
619
+ wp_set_post_tags($post_id, $tag_value);
620
+ }
621
+ }
622
+
623
+ // Create/Add category to post
624
+ if (!empty ($categories)) {
625
+ $split_cate = explode('|', $categories ['post_category']);
626
+ foreach ($split_cate as $key => $val) {
627
+ if (is_numeric($val))
628
+ $split_cate[$key] = 'uncategorized';
629
+ }
630
+ wp_set_object_terms($post_id, $split_cate, 'category');
631
+ }
632
+ // Add featured image
633
+ if (!empty ($file)) {
634
+ //$wp_filetype = wp_check_filetype(@basename($file ['guid']), null);
635
+ $wp_upload_dir = wp_upload_dir();
636
+ $attachment = array(
637
+ 'guid' => $file ['guid'],
638
+ 'post_mime_type' => 'image/jpeg',
639
+ 'post_title' => preg_replace('/\.[^.]+$/', '', @basename($file ['guid'])),
640
+ 'post_content' => '',
641
+ 'post_status' => 'inherit'
642
+ );
643
+ if($get_media_settings == 1){
644
+ $generate_attachment = $dirname . '/' . $post_slug_value . '-' . $fimg_name;
645
+ }else{
646
+ $generate_attachment = $fimg_name;
647
+ }
648
+ $uploadedImage = $wp_upload_dir['path'] . '/' . $post_slug_value . '-' . $fimg_name;
649
+ $attach_id = wp_insert_attachment($attachment, $generate_attachment, $post_id);
650
+ $attach_data = wp_generate_attachment_metadata($attach_id, $uploadedImage);
651
+ wp_update_attachment_metadata($attach_id, $attach_data);
652
+ set_post_thumbnail($post_id, $attach_id);
653
+ }
654
+ }
655
+ else{
656
+ $skippedRecords[] = $_SESSION['SMACK_SKIPPED_RECORDS'];
657
+ }
658
+ }
659
+ unset($data_array);
660
+ }
661
+ /**
662
+ * Function for importing the all in seo data
663
+ * Feature added by Fredrick on version3.5.4
664
+ */
665
+ function importSEOfields($array,$postId)
666
+ {
667
+ $seo_opt = get_option('wpcsvfreesettings');
668
+ if(in_array('aioseo',$seo_opt)){
669
+ if(isset($array['keywords'])) { $custom_array['_aioseop_keywords'] = $array['keywords']; }
670
+ if(isset($array['description'])) { $custom_array['_aioseop_description'] = $array['description']; }
671
+ if(isset($array['title'])) { $custom_array['_aioseop_title'] = $array['title']; }
672
+ if(isset($array['noindex'])) { $custom_array['_aioseop_noindex'] = $array['noindex']; }
673
+ if(isset($array['nofollow'])) { $custom_array['_aioseop_nofollow'] = $array['nofollow']; }
674
+ if(isset($array['titleatr'])) { $custom_array['_aioseop_titleatr'] = $array['titleatr']; }
675
+ if(isset($array['menulabel'])) { $custom_array['_aioseop_menulabel'] = $array['menulabel']; }
676
+ if(isset($array['disable'])) { $custom_array['_aioseop_disable'] = $array['disable']; }
677
+ if(isset($array['disable_analytics'])) { $custom_array['_aioseop_disable_analytics'] = $array['disable_analytics']; }
678
+ if(isset($array['noodp'])) { $custom_array['_aioseop_noodp'] = $array['noodp']; }
679
+ if(isset($array['noydir'])) { $custom_array['_aioseop_noydir'] = $array['noydir']; }
680
+ }
681
+ if (! empty ( $custom_array )) {
682
+ foreach ( $custom_array as $custom_key => $custom_value ) {
683
+ update_post_meta ( $postId, $custom_key, $custom_value );
684
+ }
685
+ }
686
+
687
+ }//importSEOfields ends
688
+ public function addPieChartEntry($imported_as, $count) {
689
+ //add total counts
690
+ global $wpdb;
691
+ $getTypeID = $wpdb->get_results("select * from smackcsv_pie_log where type = '$imported_as'");
692
+ if(count($getTypeID) == 0)
693
+ $wpdb->insert('smackcsv_pie_log',array('type'=>$imported_as,'value'=>$count));
694
+ else
695
+ $wpdb->update('smackcsv_pie_log', array('value' =>$getTypeID[0]->value+$count), array('id'=>$getTypeID[0]->id));
696
+ }
697
+ function addStatusLog($inserted,$imported_as){
698
+ global $wpdb;
699
+ $today = date('Y-m-d h:i:s');
700
+ $mon = date("M",strtotime($today));
701
+ $year = date("Y",strtotime($today));
702
+ $wpdb->insert('smackcsv_line_log', array('month'=>$mon,'year'=>$year,'imported_type'=>$imported_as,'imported_on'=>date('Y-m-d h:i:s'), 'inserted'=>$inserted ));
703
+ }
704
+
705
+ public function isplugin() {
706
+ $allplugins = get_plugins();
707
+ $allpluginskey = array();
708
+ foreach ($allplugins as $key => $value) {
709
+ $allpluginskey[] = $key;
710
+ }
711
+
712
+ if ((!in_array('eshop/eshop.php', $allpluginskey))) {
713
+ $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['isplugin_avail'] = 'not_avail';
714
+ } else {
715
+ $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['isplugin_avail'] = 'avail';
716
+ }
717
+ $allactiveplugins = get_option('active_plugins');
718
+ $allactiveplugins_value = array();
719
+ foreach ($allactiveplugins as $key => $value) {
720
+ $allactiveplugins_value[] = $value;
721
+ }
722
+ if ((!in_array('eshop/eshop.php', $allactiveplugins_value))) {
723
+ $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['isplugin_activ'] = 'not_activ';
724
+ } else {
725
+ $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['isplugin_activ'] = 'activ';
726
+ }
727
+ }
728
+
729
+
730
+ }
modules/eshop/templates/index.php CHANGED
@@ -34,5 +34,523 @@
34
  * Notices must display the words
35
  * "Copyright Smackcoders. 2014. All rights reserved".
36
  ********************************************************************************/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
- echo "<div align='center' style='width:100%;'> <p class='warnings' style='width:50%;text-align:center;color:red;'>This feature is only available in PRO!.</p></div>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  * Notices must display the words
35
  * "Copyright Smackcoders. 2014. All rights reserved".
36
  ********************************************************************************/
37
+ require_once(WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY.'/includes/WPImporter_includes_helper.php');
38
+ $impCE = new WPImporter_includes_helper();
39
+ $eshopObj = new EshopActions();
40
+ $eshopObj->isplugin();
41
+ ?>
42
+ <div style="width:100%;">
43
+ <div id="accordion">
44
+ <table class="table-importer">
45
+ <tr>
46
+ <td>
47
+ <h3>CSV Import Options</h3>
48
+ <div id='sec-one' <?php if($_REQUEST['step']!= 'uploadfile') {?> style='display:none;' <?php } ?>>
49
+ <?php if(is_dir($impCE->getUploadDirectory('default'))){ ?>
50
+ <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='found' />
51
+ <?php } else { ?>
52
+ <input type='hidden' id='is_uploadfound' name='is_uploadfound' value='notfound' />
53
+ <?php } ?>
54
+ <div class="warning" id="warning" name="warning" style="display:none;margin: 4% 0 4% 22%;"></div>
55
+ <form action='<?php echo admin_url().'admin.php?page='.WP_CONST_ULTIMATE_CSV_IMP_SLUG.'/index.php&__module='.$_REQUEST['__module'].'&step=mapping_settings'?>' id='browsefile' method='post' name='browsefile'>
56
+ <div class="importfile" align='center'>
57
+ <div align=center>
58
+ <div id="noPlugin" class="warnings" style="display:none"></div>
59
+ </div>
60
+ <?php
61
+ if ($_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['isplugin_avail'] == 'not_avail') {
62
+ ?>
63
+ <script> var warnings = document.getElementById("noPlugin");
64
+ warnings.innerHTML = '<strong><font size="4" color="red">There is no Eshop plugin. Please install Eshop plugin.</font></strong>';
65
+ jQuery('#noPlugin').css('display', 'block');
66
+ </script>
67
+ <?php
68
+ }
69
+ else {
70
+ if ($_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['isplugin_activ'] == 'not_activ')
71
+ {
72
+ ?>
73
+ <script> var warnings = document.getElementById("noPlugin");
74
+ warnings.innerHTML = '<strong><font size="4" color="red">Please activate Eshop plugin.</font></strong>';
75
+ jQuery('#noPlugin').css('display', 'block');
76
+ </script>
77
+ <?php
78
+ }
79
+ else {
80
+ if ($skinnyData['is_enable'] == 'off'){ ?>
81
+ <script> var warnings = document.getElementById("noPlugin");
82
+ warnings.innerHTML = '<strong><font size="4" color="red">Please enable Eshop plugin in settings.</font></strong>';
83
+ jQuery('#noPlugin').css('display', 'block');
84
+ </script>
85
+ <?php
86
+ }
87
+ }
88
+ }
89
+ if ($_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['isplugin_avail'] != 'not_avail' && $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['isplugin_activ'] != 'not_activ' && $skinnyData['is_enable'] == 'on'){ ?>
90
+ <div id='filenamedisplay'></div><!--<form class="add:the-list: validate" style="clear:both;" method="post" enctype="multipart/form-data" onsubmit="return file_exist();">-->
91
 
92
+ <div class="container">
93
+ <?php echo $impCE->smack_csv_import_method(); ?>
94
+
95
+ <input type ='hidden' id="pluginurl"value="<?php echo WP_CONTENT_URL;?>">
96
+ <?php $uploadDir = wp_upload_dir(); ?>
97
+ <input type="hidden" id="uploaddir" value="<?php if(isset($uploadDir)) { echo $uploadDir['basedir']; } ?>">
98
+ <input type="hidden" id="uploadFileName" name="uploadfilename" value="">
99
+ <input type = 'hidden' id = 'uploadedfilename' name = 'uploadedfilename' value = ''>
100
+ <input type = 'hidden' id = 'upload_csv_realname' name = 'upload_csv_realname' value =''>
101
+ <input type = 'hidden' id = 'current_file_version' name = 'current_file_version' value = ''>
102
+ <input type = 'hidden' id = 'current_module' name = 'current_module' value = '<?php if(isset($_REQUEST['__module'])) { echo $_REQUEST['__module']; } ?>' >
103
+ </span>
104
+ <!-- The global progress bar -->
105
+ <div class="form-group" style="padding-bottom:20px;">
106
+ <table>
107
+ <tr>
108
+ <div id='showmappingtemplate' style='float:left;padding-left:10px;padding-top:8px'>
109
+ <select disabled/>
110
+ <option value ='select template' > select template </option>
111
+ </select>
112
+ </div>
113
+ <!-- code ends here -->
114
+ </div>
115
+
116
+ </div>
117
+
118
+ <div style="float:right;">
119
+ <input type='button' name='clearform' id='clearform' value='<?php echo __("Clear"); ?>' onclick="Reload();" class='btn btn-warning'/>
120
+
121
+ <input type='submit' name='importfile' id='importfile' value='<?php echo __("Next >>");?>' disabled class='btn btn-primary'/>
122
+ </div>
123
+ </tr>
124
+ </table>
125
+ <!--<div class="warning" id="warning" name="warning" style="display:none;"></div>-->
126
+ <!-- The container for the uploaded files -->
127
+ <div id="files" class="files"></div>
128
+ <br>
129
+ </div>
130
+ <script>
131
+ var check_upload_dir = document.getElementById('is_uploadfound').value;
132
+ if(check_upload_dir == 'notfound'){
133
+ document.getElementById('browsefile').style.display = 'none';
134
+ jQuery('#defaultpanel').css('visibility','hidden');
135
+ jQuery('<p/>').text("").appendTo('#warning');
136
+ jQuery( "#warning" ).empty();
137
+ jQuery('#warning').css('display','inline');
138
+ jQuery('<p/>').text("Warning: Sorry. There is no uploads directory Please create it with write permission.").appendTo('#warning');
139
+ jQuery('#warning').css('color','red');
140
+ jQuery('#warning').css('font-weight','bold');
141
+ jQuery('#progress .progress-bar').css('visibility','hidden');
142
+ }
143
+ else{
144
+ jQuery(function () {
145
+ 'use strict';
146
+ var uploadPath = document.getElementById('uploaddir').value;
147
+ var url = (document.getElementById('pluginurl').value+'/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG;?>/lib/jquery-plugins/uploader.php')+'?uploadPath='+uploadPath+'&curr_action=<?php echo $_REQUEST['__module']; ?>';
148
+ jQuery('#fileupload').fileupload({
149
+ url: url,
150
+ dataType: 'json',
151
+ done: function (e, data) {
152
+ jQuery.each(data.result.files, function (index, file) {
153
+ document.getElementById('uploadFileName').value=file.name;
154
+ var filewithmodule = file.uploadedname.split(".csv");
155
+ file.uploadedname = filewithmodule[0]+"-<?php echo $_REQUEST['__module']; ?>"+".csv";
156
+ document.getElementById('upload_csv_realname').value = file.uploadedname;
157
+ var get_version1 = file.name.split("-<?php echo $_REQUEST['__module']; ?>");
158
+ var get_version2 = get_version1[1].split(".csv");
159
+ var get_version3 = get_version2[0].split("-");
160
+ document.getElementById('current_file_version').value = get_version3[1];
161
+ jQuery('#uploadedfilename').val(file.uploadedname);
162
+ jQuery( "#filenamedisplay" ).empty();
163
+ if(file.size>1024 && file.size<(1024*1024))
164
+ {
165
+ var fileSize =(file.size/1024).toFixed(2)+' kb';
166
+ }
167
+ else if(file.size>(1024*1024))
168
+ {
169
+ var fileSize =(file.size/(1024*1024)).toFixed(2)+' mb';
170
+ }
171
+ else
172
+ {
173
+ var fileSize= (file.size)+' byte';
174
+ }
175
+ jQuery('<p/>').text((file.name)+' - '+fileSize).appendTo('#filenamedisplay');
176
+ jQuery('#importfile').attr('disabled', false);
177
+ });
178
+ },progressall: function (e, data) {
179
+ var progress = parseInt(data.loaded / data.total * 100, 10);
180
+ jQuery('#progress .progress-bar').css('width', progress + '%' );
181
+ }
182
+ }).prop('disabled', !jQuery.support.fileInput)
183
+ .parent().addClass(jQuery.support.fileInput ? undefined : 'disabled');
184
+ });
185
+ }
186
+ </script>
187
+ <input type = 'hidden' name = 'importid' id = 'importid' >
188
+ <!-- <div class='section-one' align='center'>
189
+ <input type = 'button' name='clearform' id='clearform' value='Clear' onclick="Reload();" class = 'btn btn-warning' />
190
+ <input type = 'submit' name='importfile' id='importfile' value='Next>>' disabled class = 'btn btn-primary' />
191
+ <input type = 'hidden' name = 'importid' id = 'importid' >
192
+ </div> -->
193
+ </form>
194
+ </div>
195
+ </div>
196
+ <?php } ?>
197
+ </td>
198
+ </tr>
199
+ <tr>
200
+ <td>
201
+ <form name='mappingConfig' action="<?php echo admin_url(); ?>admin.php?page=<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG;?>/index.php&__module=<?php echo $_REQUEST['__module']?>&step=importoptions" method="post" onsubmit="return import_csv();" >
202
+ <div class='msg' id = 'showMsg' style = 'display:none;'></div>
203
+ <?php $_SESSION['SMACK_MAPPING_SETTINGS_VALUES'] = $_POST;
204
+ if (isset($_POST['mydelimeter'])) {
205
+ $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['delim'] = $_POST['mydelimeter'];
206
+ }
207
+ $wpcsvsettings=array();
208
+ $custom_key = array();
209
+ $wpcsvsettings=get_option('wpcsvfreesettings');
210
+ ?>
211
+ <h3>Map CSV to WP fields/attributes</h3>
212
+ <?php if(isset($_REQUEST['step']) && $_REQUEST['step'] == 'mapping_settings') { ?>
213
+ <div id='sec-two' <?php if($_REQUEST['step']!= 'mapping_settings'){ ?> style='display:none;' <?php } ?> >
214
+ <div class='mappingsection'>
215
+ <h2><div class="secondformheader">Import Data Configuration</div></h2>
216
+ <?php if(isset($_REQUEST['__module']) && $_REQUEST['__module']=='custompost'){ ?>
217
+ <div class='importstatus' style='display:true;'>
218
+ <input type="hidden" id="customposts" name="customposts" value="">
219
+ <div style = 'float:left'> <label> Select Post Type </label> <span class="mandatory"> * </span> </div>
220
+ <div style = 'float:left'>
221
+ <select name='custompostlist' id='custompostlist'>
222
+ <option value='select'>---Select---</option>
223
+ <?php
224
+ foreach (get_post_types() as $key => $value) {
225
+ 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')) {?>
226
+ <option id="<?php echo($value); ?>"> <?php echo($value);?> </option>
227
+ <?php }
228
+ } ?>
229
+ </select>
230
+ </div>
231
+ <div style = 'float:left'>
232
+ <a href="#" class="tooltip">
233
+ <img src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/help.png" />
234
+ <span class="tooltipCustompost">
235
+ <img class="callout" src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/callout.gif" />
236
+ <strong>Select your custompost type</strong>
237
+ <img src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/help.png" style="margin-top: 6px;float:right;" />
238
+ </span>
239
+ </a>
240
+ </div>
241
+ </div>
242
+ <?php } ?>
243
+ <?php echo $impCE->getImportDataConfiguration(); ?>
244
+ </div>
245
+ <div id='mappingheader' class='mappingheader' >
246
+ <?php
247
+ // $impCE = CallSkinnyObj::getInstance();
248
+ $allcustomposts='';
249
+ $mFieldsArr='';
250
+ $delimeter='';
251
+ $mappingFields_arr =array();
252
+ $filename='';
253
+ $records = '';
254
+ if(isset($_POST['uploadfilename']) && $_POST['uploadfilename'] != ''){
255
+ $file_name = $_POST['uploadfilename'];
256
+ $filename = $impCE->convert_string2hash_key($file_name);
257
+ }
258
+ if (isset($_POST['mydelimeter'])) {
259
+ $delimeter= $_POST['mydelimeter'];
260
+ }
261
+ if(isset($_POST['upload_csv_realname']) && $_POST['upload_csv_realname'] != '') {
262
+ $uploaded_csv_name = $_POST['upload_csv_realname'];
263
+ }
264
+
265
+ $getrecords = $impCE->csv_file_data($filename);
266
+ $getcustomposts=get_post_types();
267
+ foreach($getcustomposts as $keys => $value)
268
+ {
269
+ 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')) {
270
+ $allcustomposts.=$value.',';
271
+ }
272
+ }
273
+ ?>
274
+ <table style="font-size: 12px;" class = "table table-striped">
275
+ <tr>
276
+ <td colspan='4'>
277
+ <div align='center' style='float:right;'>
278
+ <?php $cnt = count($impCE->defCols) + 2;
279
+ $cnt1 = count($impCE->headers);
280
+ $records = count($getrecords);
281
+ $imploaded_array = implode(',', $impCE->headers); ?>
282
+ <input type = 'hidden' id = 'imploded_header' name = 'imploded_array' value = '<?php if(isset($imploaded_array)) { echo $imploaded_array; } ?>'>
283
+ <input type='hidden' id='h1' name='h1' value="<?php if(isset($cnt)) { echo $cnt; } ?>"/>
284
+ <input type='hidden' id='h2' name='h2' value="<?php if(isset($cnt1)) { echo $cnt1; } ?>"/>
285
+ <input type='hidden' name='selectedImporter' id='selectedImporter' value="<?php if(isset($_REQUEST['__module'])) { echo $_REQUEST['__module']; } ?>"/>
286
+ <input type="hidden" id="prevoptionindex" name="prevoptionindex" value=""/>
287
+ <input type="hidden" id="prevoptionvalue" name="prevoptionvalue" value=""/>
288
+ <input type='hidden' id='current_record' name='current_record' value='0' />
289
+ <input type='hidden' id='totRecords' name='totRecords' value='<?php if(isset($records)) { echo $records; } ?>' />
290
+ <input type='hidden' id='tmpLoc' name='tmpLoc' value='<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>' />
291
+ <input type='hidden' id='uploadedFile' name='uploadedFile' value="<?php if(isset($filename)) { echo $filename; } ?>" />
292
+ <!-- real uploaded filename -->
293
+ <input type='hidden' id='uploaded_csv_name' name='uploaded_csv_name' value="<?php if(isset($uploaded_csv_name)) { echo $uploaded_csv_name; } ?>" />
294
+ <input type='hidden' id='select_delimeter' name='select_delimeter' value="<?php if(isset($delimeter)) { echo $delimeter; } ?>" />
295
+ <input type='hidden' id='stepstatus' name='stepstatus' value='<?php if(isset($_REQUEST['step'])){ echo $_REQUEST['step']; } ?>' />
296
+ <input type='hidden' id='mappingArr' name='mappingArr' value='' />
297
+ <input type='button' id='prev_record' name='prev_record' class="btn btn-primary" value='<<' onclick='gotoelement(this.id);' />
298
+ <label style="padding-right:10px;" id='preview_of_row'>Showing preview of row # 1 </label>
299
+ <input type='button' id='next_record' name='next_record' class="btn btn-primary" value='>>' onclick='gotoelement(this.id);' />
300
+ Go To Row #<input type='text' id='goto_element' name='goto_element' />
301
+ <input type='button' id='apply_element' name='apply_element' class="btn btn-success" value='Show' onclick='gotoelement(this.id);' />
302
+ </div>
303
+ </td>
304
+ </tr>
305
+ <?php
306
+ $count = 0;
307
+ if (isset($_REQUEST['__module']) && $_REQUEST['__module'] == 'page') {
308
+ unset($impCE->defCols['post_category']);
309
+ unset($impCE->defCols['post_tag']);
310
+ }
311
+ if (isset($_REQUEST['__module']) && $_REQUEST['__module'] != 'page') {
312
+ unset($impCE->defCols['menu_order']);
313
+ unset($impCE->defCols['wp_page_template']);
314
+ }
315
+ ?>
316
+ <tr><td class="left_align"> <b>CSV HEADER</b> </td><td> <b>WP FIELDS</b> </td><td> <b>CSV ROW</b> </td><td></td></tr>
317
+ <?php
318
+ $eshopObj = new EshopActions();
319
+ foreach ($impCE->headers as $key => $value)
320
+ { ?>
321
+ <tr>
322
+ <td class="left_align"> <label> <?php print($value);?> </label> </td>
323
+ <td class="left_align"> <select name="mapping<?php print($count); ?>" id="mapping<?php print($count); ?>" class="uiButton" onchange="addcustomfield(this.value,<?php echo $count; ?>);">
324
+ <option id = "select"> -- Select -- </option>
325
+ <?php
326
+ foreach ($eshopObj->defCols as $key1 => $value1)
327
+ {
328
+ if ($key1 == 'post_name')
329
+ $key1 = 'post_slug';
330
+ if ($value == 'post_name')
331
+ $value = 'post_slug';
332
+
333
+
334
+ ?>
335
+ <option value = "<?php print($key1); ?>"> <?php
336
+
337
+ if ($key1 != 'post_name')
338
+ {
339
+ print ($key1);
340
+ $mappingFields_arr[$key1] = $key1;
341
+ }
342
+ else
343
+ {
344
+ print 'post_slug';
345
+ $mappingFields_arr['post_slug'] = 'post_slug';
346
+ }
347
+ ?>
348
+ </option>
349
+ <?php
350
+ }
351
+
352
+ foreach (get_taxonomies() as $taxokey => $taxovalue)
353
+ {
354
+ if ($taxokey != 'category' && $taxokey != 'link_category' && $taxokey != 'post_tag' && $taxokey != 'nav_menu' && $taxokey != 'post_format')
355
+ { ?>
356
+ <option value="<?php print($taxokey); ?>"> <?php print($taxovalue);?> </option>
357
+ <?php $mappingFields_arr[$taxovalue] = $taxovalue;
358
+ }
359
+ }
360
+ ?>
361
+ <option value="add_custom<?php print($count); ?>">Add Custom Field</option>
362
+ </select>
363
+ <script type="text/javascript">
364
+ jQuery("select#mapping<?php print($count); ?>").find('option').each(function() {
365
+ if(jQuery(this).val() == "<?php print($value);?>") {
366
+ jQuery(this).prop('selected', true);
367
+ }
368
+ });
369
+ </script>
370
+ </td>
371
+ <td class="left_align">
372
+ <?php
373
+ $getrecords[0][$value] = htmlspecialchars($getrecords[0][$value], ENT_COMPAT, "UTF-8");
374
+ if(strlen($getrecords[0][$value])>32)
375
+ {
376
+ $getrecords[0][$value] = substr($getrecords[0][$value], 0, 28).'...';
377
+ } ?>
378
+ <span id='elementVal_<?php echo $key; ?>' > <?php echo ($getrecords[0][$value]); ?> </span>
379
+ </td>
380
+ <td width = "180px;">
381
+ <input class="customfieldtext" type="text" id="textbox<?php print($count); ?>" name="textbox<?php print($count); ?>" TITLE="Replace the default value" style="display: none;float:left;width:160px;" value="<?php echo $value ?>"/>
382
+ <span style="display: none;float:left" id="customspan<?php echo $count ?>">
383
+ <a href="#" class="tooltip">
384
+ <img src="../wp-content/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG;?>/images/help.png" />
385
+ <span class="tooltipPostStatus">
386
+ <img class="callout" src="../wp-content/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG;?>/images/callout.gif" />
387
+ <strong>Give a name for your new custom field</strong>
388
+ <img src="../wp-content/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG;?>/images/help.png" style="margin-top: 6px;float:right;" />
389
+ </span>
390
+ </a>
391
+ </span>
392
+ <span style="display: none; color: red; margin-left: 5px;" id="customspan<?php echo $count ?>">Replace the custom value</span>
393
+ </td>
394
+ </tr>
395
+ <?php
396
+ $count++;
397
+ }
398
+ foreach($mappingFields_arr as $mkey => $mval){
399
+ $mFieldsArr .= $mkey.',';
400
+ }
401
+ $mFieldsArr = substr($mFieldsArr, 0, -1);
402
+ ?>
403
+ </table>
404
+ <input type="hidden" id="mapping_fields_array" name="mapping_fields_array" value="<?php if(isset($mFieldsArr)) { print_r($mFieldsArr); } ?>"/>
405
+ <div>
406
+ <div class="goto_import_options" align=center>
407
+ <div class="mappingactions" >
408
+ <input type='button' id='clear_mapping' class='clear_mapping btn btn-warning' name='clear_mapping' value='Clear Mapping' onclick='clearMapping();' style = 'float:left'/>
409
+ <span style = ''>
410
+ <a href="#" class="tooltip tooltip_smack" style = ''>
411
+ <img src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/help.png" />
412
+ <span class="tooltipClearMapping">
413
+ <img class="callout" src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/callout.gif" />
414
+ <strong>Refresh to re-map fields</strong>
415
+ <img src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/help.png" style="margin-top: 6px;float:right;" />
416
+ </span>
417
+ </a>
418
+ </span>
419
+ </div>
420
+ <div class="mappingactions" >
421
+ <input type='submit' id='goto_importer_setting' class='goto_importer_setting btn btn-info' name='goto_importer_setting' value='Next >>' />
422
+ </div>
423
+ </div>
424
+ </div>
425
+ </div>
426
+ <?php } ?>
427
+ </div>
428
+ </form>
429
+ </td>
430
+ </tr>
431
+ <tr>
432
+ <td>
433
+ <h3>Settings and Performance</h3>
434
+ <?php if(isset($_REQUEST['step']) && $_REQUEST['step'] == 'importoptions') { ?>
435
+ <div id='sec-three' <?php if($_REQUEST['step']!= 'importoptions'){ ?> style='display:none;' <?php } ?> >
436
+ <?php //$prevoptionindex='';?>
437
+ <input type="hidden" id="prevoptionindex" name="prevoptionindex" value="<?php
438
+ if (isset($_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['prevoptionindex']))
439
+ {
440
+ echo $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['prevoptionindex'];
441
+ }
442
+ ?>"/>
443
+ <?php if(isset($_SESSION['SMACK_MAPPING_SETTINGS_VALUES'])) { ?>
444
+ <input type="hidden" id="prevoptionvalue" name="prevoptionvalue" value="<?php echo $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['prevoptionvalue']; ?>"/>
445
+ <input type='hidden' id='current_record' name='current_record' value='<?php echo $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['current_record']; ?>' />
446
+ <input type='hidden' id='tot_records' name='tot_records' value='<?php echo $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['totRecords']; ?>' />
447
+ <input type='hidden' id='checktotal' name='checktotal' value='<?php echo $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['totRecords']; ?>' />
448
+ <input type='hidden' id='stepstatus' name='stepstatus' value='<?php echo $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['stepstatus']; ?>' />
449
+ <input type='hidden' id='selectedImporter' name='selectedImporter' value='<?php echo $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['selectedImporter']; ?>' />
450
+ <?php } ?>
451
+ <input type='hidden' id='tmpLoc' name='tmpLoc' value='<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>' />
452
+ <?php if(isset($_POST)) { ?>
453
+ <input type='hidden' id='checkfile' name='checkfile' value='<?php echo $_POST['uploadedFile']; ?>' />
454
+ <input type='hidden' id='select_delim' name='select_delim' value='<?php echo $_POST['select_delimeter']; ?>' />
455
+ <input type='hidden' id='uploadedFile' name='uploadedFile1' value='<?php echo $_POST['uploadedFile']; ?>' />
456
+ <input type='hidden' id='mappingArr' name='mappingArr' value='' />
457
+ <?php } ?>
458
+ <!-- Import settings options -->
459
+ <div class="postbox" id="options" style=" margin-bottom:0px;">
460
+ <!-- <h4 class="hndle">Search settings</h4>-->
461
+ <div class="inside">
462
+ <label><input type ='radio' id='importNow' name='importMode' value='' onclick='choose_import_mode(this.id);' checked/> <?php echo __("Import right away"); ?> </label>
463
+ <label><input type ='radio' id='scheduleNow' name='importMode' value='' onclick='choose_import_mode(this.id);' disabled/> <?php echo __("Schedule now"); ?> </label>
464
+ <div id='schedule' style='display:none'>
465
+ <input type ='hidden' id='select_templatename' name='#select_templatename' value = '<?php if(isset($_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['templateid'])) { echo $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['templateid'] ; } ?>'>
466
+ <?php //echo WPImporter_includes_schedulehelper::generatescheduleHTML(); ?>
467
+ </div>
468
+ <div id='importrightaway' style='display:block'>
469
+
470
+ <form method="POST" >
471
+ <ul id="settings">
472
+ <li>
473
+ <!--Get all posts with an <strong>content-similarity</strong> of more than: <strong><span id="similarity_amount">80</span>%</strong>
474
+ <div id="similarity" class="ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all" aria-disabled="false"><a class="ui-slider-handle ui-state-default ui-corner-all" href="#" style="left: 60%;"></a></div>
475
+ </li>
476
+ <input type="hidden" value="80" name="similarity">
477
+ <li id="statuses">Include these <strong>statuses</strong>: <br>
478
+ <input name="status[]" type="checkbox" value="draft"> Draft<br><input name="status[]" type="checkbox" value="pending"> Pending Review<br><input name="status[]" type="checkbox" value="private"> Private<br><input name="status[]" type="checkbox" value="publish" checked=""> Published<br> </li>
479
+ <li id="dates">Limit by <strong>post date</strong>:<br>
480
+ from <input id="datefrom" name="datefrom" class="datepicker hasDatepicker" type="text" value="" readonly="readonly"><img class="ui-datepicker-trigger" src="images/date-button.gif" alt="..." title="..."> until <input id="dateto" name="dateto" class="datepicker hasDatepicker" type="text" value="" readonly="readonly"><img class="ui-datepicker-trigger" src="images/date-button.gif" alt="..." title="...">
481
+ </li>
482
+ <li>
483
+ Compare <select name="search_field" id="search_field">
484
+ <option value="0" selected="selected">
485
+ content (post_content) </option>
486
+ <option value="1">
487
+ title (post_title) </option>
488
+ <option value="2">
489
+ content and title </option>
490
+ </select><br>
491
+ <input name="filterhtml" id="filterhtml" type="checkbox" value="1"> Filter out HTML-Tags while comparing <br>
492
+ <input name="filterhtmlentities" id="filterhtmlentities" type="checkbox" value="1"> Decode HTML-Entities before comparing <br>-->
493
+ <label><input name='duplicatecontent' id='duplicatecontent' type="checkbox" value=""> Detect duplicate post content</label> <br>
494
+ <label><input name='duplicatetitle' id='duplicatetitle' type="checkbox" value="" > Detect duplicate post title</label> <br>
495
+ No. of posts/rows per server request <span class="mandatory">*</span> <input name="importlimit" id="importlimit" type="text" value="" placeholder="10" onblur="check_allnumeric(this.value);"></label> <br> <span class='msg' id='server_request_warning' style="display:none;color:red;margin-left:-10px;">You can set upto <?php echo $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['totRecords']; ?> per request.</span>
496
+ <input type="hidden" id="currentlimit" name="currentlimit" value="0"/>
497
+ <input type="hidden" id="tmpcount" name="tmpcount" value="0" />
498
+ <input type="hidden" id="terminateaction" name="terminateaction" value="continue" />
499
+ </li>
500
+ <!-- <li>
501
+ Ignore these words while comparing <input name="filterwords" id="filterwords" type="text" value="">
502
+ </li>-->
503
+ </ul>
504
+ <!-- <input id="goto_back" name="goto_back" class="btn btn-warning" type="button" value="<< Back" onclick="gotoback();" /> -->
505
+ <input id="startbutton" class="btn btn-primary" type="button" value="Import Now" style="color: #ffffff;background:#2E9AFE;" onclick="importRecordsbySettings('<?php echo site_url(); ?>');" >
506
+ <input id="terminatenow" class="btn btn-danger btn-sm" type="button" value="Terminate Now" style="display:none;" onclick="terminateProcess();" />
507
+ <input class="btn btn-warning" type="button" value="Reload" id="importagain" style="display:none" onclick="import_again();" />
508
+ <!--<input id="continuebutton" class="button" type="button" value="Continue old search" style="color: #ffffff;background:#2E9AFE;">-->
509
+ <div id="ajaxloader" style="display:none"><img src="<?php echo WP_CONST_ULTIMATE_CSV_IMP_DIR; ?>images/ajax-loader.gif"> Processing...</div>
510
+
511
+ <div class="clear"></div>
512
+ </form>
513
+ </div>
514
+ <div class="clear"></div>
515
+ <br>
516
+ <!-- Compared <span id="done">0</span> of <span id="count">6</span> posts<br>Found <span id="found">0</span> duplicates <br><input id="deletebutton" style="display: none" class="button" type="button" value="Move selected posts to trash">-->
517
+ </div>
518
+ </div>
519
+ <?php } ?>
520
+ <!-- Code Ends Here-->
521
+ </div>
522
+ </td>
523
+ </tr>
524
+ </table>
525
+ </div>
526
+ <div style="width:100%;">
527
+ <div id="accordion">
528
+ <table class="table-importer">
529
+ <tr>
530
+ <td>
531
+ <h3><?php echo __("Summary"); ?></h3>
532
+ <div id='reportLog' class='postbox' style='display:none;'>
533
+ <input type='hidden' name = 'csv_version' id = 'csv_version' value = "<?php if(isset($_POST['uploaded_csv_name'])) { echo $_POST['uploaded_csv_name']; } ?>">
534
+ <div id="logtabs" class="logcontainer">
535
+ <div id="log" class='log'>
536
+ </div>
537
+ </div>
538
+ </div>
539
+ </td>
540
+ </tr>
541
+ </table>
542
+ </div>
543
+ </div>
544
+
545
+ <!-- Promotion footer for other useful plugins -->
546
+ <div class= "promobox" id="pluginpromo" style="width:98%;">
547
+ <div class="accordion-group" >
548
+ <div class="accordion-body in collapse">
549
+ <div>
550
+ <?php //$impCE->common_footer_for_other_plugin_promotions(); ?>
551
+ <?php $impCE->common_footer(); ?>
552
+ </div>
553
+ </div>
554
+ </div>
555
+ </div>
556
+ </div>
modules/export/templates/export.php CHANGED
@@ -360,6 +360,251 @@ if ($exporttype == 'post' || $exporttype == 'page' || $exporttype == 'custompost
360
  }
361
  }
362
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
363
  elseif($exporttype=='users')
364
  {
365
  $uId = '';
360
  }
361
  }
362
  }
363
+ elseif($exporttype=='eshop')
364
+ {
365
+ $exporttype='post';
366
+ //$csv_file_name='eshop_exported.csv';
367
+ $header_query1 = "SELECT wp.* FROM $wpdb->posts wp where post_type = '$exporttype'";
368
+ $header_query2 = "SELECT post_id, meta_key, meta_value FROM $wpdb->posts wp JOIN $wpdb->postmeta wpm ON wpm.post_id = wp.ID where meta_key NOT IN ('_edit_lock','_edit_last')";
369
+ $result_header_query1 = $wpdb->get_results($header_query1);
370
+ $result_header_query2 = $wpdb->get_results($header_query2);
371
+ foreach ($result_header_query1 as $rhq1_key) {
372
+ foreach ($rhq1_key as $rhq1_headkey => $rhq1_headval) {
373
+ if (!in_array($rhq1_headkey, $Header))
374
+ if($rhq1_headkey != 'to_ping' && $rhq1_headkey != 'pinged' && $rhq1_headkey != 'post_mime_type')
375
+ $Header[] = $rhq1_headkey;
376
+ }
377
+ }
378
+ foreach ($result_header_query2 as $rhq2_headkey) {
379
+ if (!in_array($rhq2_headkey->meta_key, $Header)) {
380
+ if ($rhq2_headkey->meta_key != '_eshop_product' && $rhq2_headkey->meta_key != '_wp_attached_file' && $rhq2_headkey->meta_key != 'products' && $rhq2_headkey->meta_key != '_eshop_sale' && $rhq2_headkey->meta_key != 'post_mime_type' && $rhq2_headkey->meta_key != '_thumbnail_id' && $rhq2_headkey->meta_key != '_wp_attachment_metadata' && $rhq2_headkey->meta_key != '_eshop_featured')
381
+ $Header[] = $rhq2_headkey->meta_key;
382
+ }
383
+ }
384
+ $Header[] = 'products_option';
385
+ $Header[] = 'regular_price';
386
+ $Header[] = 'sale_price';
387
+ $Header[] = 'featured_image';
388
+ $Header[] = 'post_tag';
389
+ $Header[] = 'post_category';
390
+ $get_post_ids = "select DISTINCT ID from $wpdb->posts p join $wpdb->postmeta pm on pm.post_id = p.ID where post_type = '$exporttype' and post_status in ('publish','draft','future','private','pending') and pm.meta_key = 'sku'";
391
+
392
+ $result = $wpdb->get_col($get_post_ids);
393
+ $fieldsCount = count($result);
394
+ if ($result) {
395
+ foreach ($result as $postID) {
396
+ $pId = $pId . ',' . $postID;
397
+ $query1 = "SELECT wp.* FROM $wpdb->posts wp where ID=$postID";
398
+ $result_query1 = $wpdb->get_results($query1);
399
+ if (!empty($result_query1)) {
400
+ foreach ($result_query1 as $posts) {
401
+ foreach ($posts as $post_key => $post_value) {
402
+ if ($post_key == 'post_status') {
403
+ if (is_sticky($postID)) {
404
+ $PostData[$postID][$post_key] = 'Sticky';
405
+ $post_status = 'Sticky';
406
+ } else {
407
+ $PostData[$postID][$post_key] = $post_value;
408
+ $post_status = $post_value;
409
+ }
410
+ } else {
411
+ $PostData[$postID][$post_key] = $post_value;
412
+ }
413
+ if ($post_key == 'post_password') {
414
+ if ($post_value) {
415
+ $PostData[$postID]['post_status'] = "{" . $post_value . "}";
416
+ } else {
417
+ $PostData[$postID]['post_status'] = $post_status;
418
+ }
419
+ }
420
+ }
421
+ }
422
+ }
423
+ $query2 = "SELECT post_id, meta_key, meta_value FROM $wpdb->posts wp JOIN $wpdb->postmeta wpm ON wpm.post_id = wp.ID where meta_key NOT IN ('_edit_lock','_edit_last') AND ID=$postID";
424
+ $result_query2 = $wpdb->get_results($query2);
425
+ $possible_values = array('s:', 'a:', ':{');
426
+ if (!empty($result_query2)) {
427
+ foreach ($result_query2 as $postmeta) {
428
+ $typesFserialized = 0;
429
+ $isFound = explode('wpcf-',$postmeta->meta_key);
430
+ if(count($isFound) == 2){
431
+ foreach($wptypesfields as $typesKey => $typesVal){
432
+ if($postmeta->meta_key == 'wpcf-'.$typesKey){
433
+ foreach($possible_values as $posval){
434
+ if(strpos($postmeta->meta_value,$posval)){
435
+ $typesFserialized = 1;
436
+ } else {
437
+ $typesFserialized = 0;
438
+ }
439
+ }
440
+ if($typesFserialized == 1){
441
+ $getMetaData = get_post_meta($postID, $postmeta->meta_key);
442
+ if(!is_array($getMetaData[0])){
443
+ $get_all_values = unserialize($getMetaData[0]);
444
+ $get_values = $get_all_values[0];
445
+ } else {
446
+ $get_values = $getMetaData[0];
447
+ }
448
+ $typesFVal = null;
449
+ if($typesVal['type'] == 'checkboxes'){
450
+ foreach($get_values as $authorKey => $authorVal) {
451
+ foreach($typesVal['data']['options'] as $doKey => $doVal){
452
+ if($doKey == $authorKey)
453
+ $typesFVal .= $doVal['title'].',';
454
+ }
455
+ }
456
+ $typesFVal = substr($typesFVal, 0, -1);
457
+ } elseif($typesVal['type'] == 'skype') {
458
+ $typesFVal = $get_values['skypename'];
459
+ }
460
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $typesFVal;
461
+ } else {
462
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $postmeta->meta_value;
463
+ }
464
+ }
465
+ }
466
+ } else {
467
+ if ($postmeta->meta_key != '_eshop_product' && $postmeta->meta_key != '_thumbnail_id') {
468
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $postmeta->meta_value;
469
+ }
470
+ $eshop_products = $postmeta->meta_value;
471
+ if ($postmeta->meta_key == 'products') {
472
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = '';
473
+ $eshop_products = unserialize($eshop_products);
474
+ $PostMetaData[$postmeta->post_id]['products_option']='';
475
+ $PostMetaData[$postmeta->post_id]['sale_price']='';
476
+ $PostMetaData[$postmeta->post_id]['regular_price']='';
477
+ foreach ($eshop_products as $key) {
478
+ $PostMetaData[$postmeta->post_id]['products_option'] .= $key['option'] . ',';
479
+ $PostMetaData[$postmeta->post_id]['sale_price'] .= $key['saleprice'] . ',';
480
+ $PostMetaData[$postmeta->post_id]['regular_price'] .= $key['price'] . ',';
481
+ }
482
+ $PostMetaData[$postmeta->post_id]['products_option'] = substr($PostMetaData[$postmeta->post_id]['products_option'], 0, -1);
483
+ $PostMetaData[$postmeta->post_id]['sale_price'] = substr($PostMetaData[$postmeta->post_id]['sale_price'], 0, -1);
484
+ $PostMetaData[$postmeta->post_id]['regular_price'] = substr($PostMetaData[$postmeta->post_id]['regular_price'], 0, -1);
485
+ }
486
+ if ($postmeta->meta_key == '_thumbnail_id') {
487
+ $attachment_file = '';
488
+ $get_attachement = "select guid from $wpdb->posts where ID = $postmeta->meta_value AND post_type = 'attachment'";
489
+ $attachment = $wpdb->get_results($get_attachement);
490
+ $attachment_file = $attachment[0]->guid;
491
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = '';
492
+ $postmeta->meta_key = 'featured_image';
493
+ $PostMetaData[$postmeta->post_id][$postmeta->meta_key] = $attachment_file;
494
+ }
495
+ }
496
+ }
497
+ }
498
+ // Tags & Categories
499
+ $get_tags = wp_get_post_tags($postID, array('fields' => 'names'));
500
+ $postTags = $postCategory = '';
501
+ foreach ($get_tags as $tags) {
502
+ $postTags .= $tags . ',';
503
+ }
504
+ $postTags = substr($postTags, 0, -1);
505
+ $TermsData[$postID]['post_tag'] = $postTags;
506
+ $get_categotries = wp_get_post_categories($postID, array('fields' => 'names'));
507
+ foreach ($get_categotries as $category) {
508
+ $postCategory .= $category . '|';
509
+ }
510
+ $postCategory = substr($postCategory, 0, -1);
511
+ $TermsData[$postID]['post_category'] = $postCategory;
512
+ }
513
+
514
+ $ExportData = array();
515
+ // Merge all arrays
516
+ foreach ($PostData as $pd_key => $pd_val) {
517
+ if (array_key_exists($pd_key, $PostMetaData)) {
518
+ $ExportData[$pd_key] = array_merge($PostData[$pd_key], $PostMetaData[$pd_key]);
519
+ }
520
+ if (array_key_exists($pd_key, $TermsData)) {
521
+ $ExportData[$pd_key] = array_merge($ExportData[$pd_key], $TermsData[$pd_key]);
522
+ }
523
+ }
524
+ foreach ($Header as $header_key) {
525
+ foreach ($ExportData as $ED_key) {
526
+ if (array_key_exists($header_key, $ED_key))
527
+ $CSVContent[$header_key][] = $ED_key[$header_key];
528
+ else
529
+ $CSVContent[$header_key][] = '';
530
+ }
531
+ }
532
+ }
533
+ for ($j = 0; $j < $fieldsCount; $j++) {
534
+ foreach ($Header as $value) {
535
+ if ( ! isset($CSVDATA[$j])) {
536
+ $CSVDATA[$j]= null;
537
+ }
538
+ $CSVDATA[$j] .= '"' . $CSVContent[$value][$j] . '"' . $export_delimiter;
539
+ }
540
+ }
541
+ foreach ($Header as $csv_header) {
542
+ if ($csv_header == '_eshop_stock')
543
+ $csv_header = 'stock_available';
544
+ if ($csv_header == 'cart_radio')
545
+ $csv_header = 'cart_option';
546
+ if ($csv_header == 'sale')
547
+ $csv_header = 'product_in_sale';
548
+ if ($csv_header == 'featured')
549
+ $csv_header = 'featured_product';
550
+ if ($csv_header == 'sku')
551
+ $csv_header = 'SKU';
552
+ if ($csv_header == '_aioseop_keywords')
553
+ $csv_header = 'seo_keywords';
554
+ if ($csv_header == '_aioseop_description')
555
+ $csv_header = 'seo_description';
556
+ if ($csv_header == '_aioseop_title')
557
+ $csv_header = 'seo_title';
558
+ if ($csv_header == '_aioseop_noindex')
559
+ $csv_header = 'seo_noindex';
560
+ if ($csv_header == '_aioseop_nofollow')
561
+ $csv_header = 'seo_nofollow';
562
+ if ($csv_header == '_aioseop_disable')
563
+ $csv_header = 'seo_disable';
564
+ if ($csv_header == '_aioseop_disable_analytics')
565
+ $csv_header = 'seo_disable_analytics';
566
+ if ($csv_header == '_yoast_wpseo_focuskw')
567
+ $csv_header = 'focus_keyword';
568
+ if ($csv_header == '_yoast_wpseo_title')
569
+ $csv_header = 'title';
570
+ if ($csv_header == '_yoast_wpseo_metadesc')
571
+ $csv_header = 'meta_desc';
572
+ if ($csv_header == '_yoast_wpseo_meta-robots-noindex')
573
+ $csv_header = 'meta-robots-noindex';
574
+ if ($csv_header == '_yoast_wpseo_meta-robots-nofollow')
575
+ $csv_header = 'meta-robots-nofollow';
576
+ if ($csv_header == '_yoast_wpseo_meta-robots-adv')
577
+ $csv_header = 'meta-robots-adv';
578
+ if ($csv_header == '_yoast_wpseo_sitemap-include')
579
+ $csv_header = 'sitemap-include';
580
+ if ($csv_header == '_yoast_wpseo_sitemap-prio')
581
+ $csv_header = 'sitemap-prio';
582
+ if ($csv_header == '_yoast_wpseo_canonical')
583
+ $csv_header = 'canonical';
584
+ if ($csv_header == '_yoast_wpseo_redirect')
585
+ $csv_header = 'redirect';
586
+ if ($csv_header == '_yoast_wpseo_opengraph-description')
587
+ $csv_header = 'opengraph-description';
588
+ if ($csv_header == '_yoast_wpseo_google-plus-description')
589
+ $csv_header = 'google-plus-description';
590
+
591
+ if ($csv_header == 'post_tag')
592
+ $csv_header = 'tags';
593
+ if ($csv_header == 'post_category')
594
+ $csv_header = 'category';
595
+ if($csv_header == 'ID')
596
+ $csv_header = 'Id';
597
+ $CSV_FILE_CONTENT .= $csv_header . "$export_delimiter";
598
+ }
599
+ $CSV_FILE_CONTENT = substr($CSV_FILE_CONTENT, 0, -1);
600
+ $CSV_FILE_CONTENT .= "\n";
601
+ if ($CSVDATA) {
602
+ foreach ($CSVDATA as $csv_content) {
603
+ $csv_content = substr($csv_content, 0, -1);
604
+ $CSV_FILE_CONTENT .= $csv_content . "\n";
605
+ }
606
+ }
607
+ }
608
  elseif($exporttype=='users')
609
  {
610
  $uId = '';
modules/export/templates/index.php CHANGED
@@ -55,6 +55,7 @@
55
  </div>
56
  <div class = 'form-group'> <div class = 'col-sm-3 export_action'> <label> <input type="radio" name="export" value="users" id='users' > Users <span class="mandatory"></span></label> </div> </div>
57
  <div class='form-group'><div class='col-sm-3 export_action'><label><input type='radio' name='export' value='comments' id='comments' onclick="export_check(this.value)">Comments </label> </div> </div>
 
58
  <div class = 'form-group'> <div class = 'col-sm-3 export_action'> <label> <input type="radio" name="export" value="category" id='category' onclick="export_check(this.value)"> Category <span class="mandatory">*</span></label> </div> </div>
59
  <div class = 'form-group'> <div class = 'col-sm-3 export_action'> <label> <input type="radio" name="export" value="tags" id='tags' onclick="export_check(this.value)"> Tags <span class="mandatory">*</span></label> </div> </div>
60
  <div class = 'form-group'> <div class = 'col-sm-3 export_action'> <label> <input type="radio" name="export" value="customtaxonomy" id='customtaxonomy' onclick="export_check(this.value)" > Custom Taxonomy <span class="mandatory">*</span></label>
@@ -62,7 +63,6 @@
62
  <option>--Select--</option>
63
  </select> </div>
64
  </div>
65
- <div class = 'form-group'> <div class = 'col-sm-3 export_action'> <label > <input type='radio' name='export' value='eshop' id='eshop' onclick="export_check(this.value)"> Eshop <span class="mandatory">*</span></label> </div> </div>
66
  <div class = 'form-group'> <div class = 'col-sm-3 export_action'> <label> <input type="radio" name="export" id='wpcommerce'value="wpcommerce" onclick="export_check(this.value)" > Wp-Commerce <span class="mandatory">*</span></label> </div> </div>
67
  <div class = 'form-group'> <div class = 'col-sm-3 export_action'> <label> <input type="radio" name="export" id='woocommerce'value="woocommerce" onclick="export_check(this.value)"> Woo-Commerce <span class="mandatory">*</span></label> </div> </div>
68
  <div class = 'form-group'> <div class = 'col-sm-3 export_action'> <label> <input type="radio" name="export" id='marketpress' value="marketpress" onclick="export_check(this.value)"> Marketpress <span class="mandatory">*</span></label> </div> </div>
55
  </div>
56
  <div class = 'form-group'> <div class = 'col-sm-3 export_action'> <label> <input type="radio" name="export" value="users" id='users' > Users <span class="mandatory"></span></label> </div> </div>
57
  <div class='form-group'><div class='col-sm-3 export_action'><label><input type='radio' name='export' value='comments' id='comments' onclick="export_check(this.value)">Comments </label> </div> </div>
58
+ <div class = 'form-group'> <div class = 'col-sm-3 export_action'> <label > <input type='radio' name='export' value='eshop' id='eshop' onclick="export_check(this.value)"> Eshop </label> </div> </div>
59
  <div class = 'form-group'> <div class = 'col-sm-3 export_action'> <label> <input type="radio" name="export" value="category" id='category' onclick="export_check(this.value)"> Category <span class="mandatory">*</span></label> </div> </div>
60
  <div class = 'form-group'> <div class = 'col-sm-3 export_action'> <label> <input type="radio" name="export" value="tags" id='tags' onclick="export_check(this.value)"> Tags <span class="mandatory">*</span></label> </div> </div>
61
  <div class = 'form-group'> <div class = 'col-sm-3 export_action'> <label> <input type="radio" name="export" value="customtaxonomy" id='customtaxonomy' onclick="export_check(this.value)" > Custom Taxonomy <span class="mandatory">*</span></label>
63
  <option>--Select--</option>
64
  </select> </div>
65
  </div>
 
66
  <div class = 'form-group'> <div class = 'col-sm-3 export_action'> <label> <input type="radio" name="export" id='wpcommerce'value="wpcommerce" onclick="export_check(this.value)" > Wp-Commerce <span class="mandatory">*</span></label> </div> </div>
67
  <div class = 'form-group'> <div class = 'col-sm-3 export_action'> <label> <input type="radio" name="export" id='woocommerce'value="woocommerce" onclick="export_check(this.value)"> Woo-Commerce <span class="mandatory">*</span></label> </div> </div>
68
  <div class = 'form-group'> <div class = 'col-sm-3 export_action'> <label> <input type="radio" name="export" id='marketpress' value="marketpress" onclick="export_check(this.value)"> Marketpress <span class="mandatory">*</span></label> </div> </div>
modules/settings/templates/index.php CHANGED
@@ -111,7 +111,7 @@
111
  </td>
112
  <td>
113
  <label class="<?php echo $skinnyData['eshoptd'].' '.$skinnyData['eshop']; ?>">
114
- <input type='radio' name='recommerce' id='eshop' value='eshop' <?php echo $skinnyData['eshop']; ?> class='ecommerce' onclick='check_if_avail(this.id);'> Eshop
115
  </label>
116
  </td>
117
  <td>
111
  </td>
112
  <td>
113
  <label class="<?php echo $skinnyData['eshoptd'].' '.$skinnyData['eshop']; ?>">
114
+ <input type='radio' name='recommerce' id='eshop' value='eshop' <?php echo $skinnyData['eshop']; ?> class='ecommerce' > Eshop
115
  </label>
116
  </td>
117
  <td>
templates/import.php CHANGED
@@ -59,6 +59,7 @@ if ($curr_action == 'post' || $curr_action == 'page' || $curr_action == 'customp
59
 
60
  } elseif ($curr_action == 'eshop') {
61
  $importObj = new EshopActions();
 
62
  } elseif ($curr_action == 'wpcommerce') {
63
  $importObj = new WpcommerceActions();
64
  } elseif ($curr_action == 'woocommerce') {
@@ -245,6 +246,17 @@ if ($curr_action == 'users') {
245
 
246
  }
247
  echo "</div>";
 
 
 
 
 
 
 
 
 
 
 
248
  }
249
  foreach ($_SESSION['SMACK_MAPPING_SETTINGS_VALUES'] as $key => $value) {
250
  for ($j = 0; $j < $csv_rec_count; $j++) {
59
 
60
  } elseif ($curr_action == 'eshop') {
61
  $importObj = new EshopActions();
62
+ $importedAs = 'Eshop';
63
  } elseif ($curr_action == 'wpcommerce') {
64
  $importObj = new WpcommerceActions();
65
  } elseif ($curr_action == 'woocommerce') {
246
 
247
  }
248
  echo "</div>";
249
+ }elseif ($curr_action == 'eshop') {
250
+ echo "<div style='margin-left:7px;'>";
251
+ if (($limit == $requested_limit) && ($limit <= $count)) {
252
+ echo "<div style='margin-left:3px;'>Chosen server request is " . $count . " .</div><br>";
253
+ }
254
+ echo "[" . date('h:m:s') . "] - No of products(s) Skipped - " . $importObj->dupPostCount . '.<br>';
255
+ echo "[" . date('h:m:s') . "] - No of products(s) Inserted - " . $importObj->insPostCount . ".<br>";
256
+ if ($limit == $totRecords) {
257
+ echo "<br><div style='margin-left:3px;'>Import successfully completed!.</div>";
258
+ }
259
+ echo "</div>";
260
  }
261
  foreach ($_SESSION['SMACK_MAPPING_SETTINGS_VALUES'] as $key => $value) {
262
  for ($j = 0; $j < $csv_rec_count; $j++) {
templates/menu.php CHANGED
@@ -71,6 +71,9 @@ $menuHTML .= "<li class = '{$comments}'><a href='admin.php?page=" . WP_CONST_ULT
71
  if($users) {
72
  $menuHTML .= "<li class = '{$users}'><a href='admin.php?page=" . WP_CONST_ULTIMATE_CSV_IMP_SLUG . "/index.php&__module=users&step=uploadfile'>Users</a></li>";
73
  }
 
 
 
74
  $menuHTML .= "</ul>
75
  </li>
76
  <li class='dropdown {$manager}'>
71
  if($users) {
72
  $menuHTML .= "<li class = '{$users}'><a href='admin.php?page=" . WP_CONST_ULTIMATE_CSV_IMP_SLUG . "/index.php&__module=users&step=uploadfile'>Users</a></li>";
73
  }
74
+ if($eshop) {
75
+ $menuHTML .= "<li class = '{$eshop}'><a href='admin.php?page=" . WP_CONST_ULTIMATE_CSV_IMP_SLUG . "/index.php&__module=eshop&step=uploadfile'>Eshop</a></li>";
76
+ }
77
  $menuHTML .= "</ul>
78
  </li>
79
  <li class='dropdown {$manager}'>