Version Description
- improvement: add support for .tsv format
- API: add current XML variable to pmxi_article_data filter
- bug fix: post terms incorrect after import complete, must be recounted
- bug fix: empty attachments created when attachment import fails
- bug fix: matching posts by ID matches and imports into attachments with the same ID
Download this release
Release Info
Developer | soflyy |
Plugin | Import any XML or CSV File to WordPress |
Version | 3.5.0 |
Comparing to | |
See all releases |
Code changes from version 3.4.9 to 3.5.0
- actions/admin_init.php +0 -4
- actions/delete_post.php +9 -10
- actions/pmxi_after_xml_import.php +10 -5
- actions/wp_ajax_auto_detect_cf.php +2 -0
- actions/wp_ajax_auto_detect_sf.php +19 -15
- actions/wp_ajax_delete_import.php +31 -2
- actions/wp_ajax_import_failed.php +2 -0
- classes/PHPExcel/locale/cs/config +3 -3
- classes/PHPExcel/locale/cs/functions +1 -1
- classes/PHPExcel/locale/da/config +3 -3
- classes/PHPExcel/locale/da/functions +1 -1
- classes/PHPExcel/locale/de/config +2 -2
- classes/PHPExcel/locale/de/functions +1 -1
- classes/PHPExcel/locale/en/uk/config +1 -1
- classes/PHPExcel/locale/es/config +3 -2
- classes/PHPExcel/locale/es/functions +1 -1
- classes/PHPExcel/locale/fi/config +2 -2
- classes/PHPExcel/locale/fi/functions +1 -1
- classes/PHPExcel/locale/fr/config +2 -2
- classes/PHPExcel/locale/fr/functions +1 -1
- classes/PHPExcel/locale/hu/config +1 -1
- classes/PHPExcel/locale/hu/functions +1 -1
- classes/PHPExcel/locale/it/config +2 -2
- classes/PHPExcel/locale/it/functions +1 -1
- classes/PHPExcel/locale/nl/config +2 -2
- classes/PHPExcel/locale/nl/functions +1 -1
- classes/PHPExcel/locale/no/config +2 -2
- classes/PHPExcel/locale/no/functions +1 -1
- classes/PHPExcel/locale/pl/config +2 -2
- classes/PHPExcel/locale/pl/functions +1 -1
- classes/PHPExcel/locale/pt/br/config +3 -2
- classes/PHPExcel/locale/pt/config +2 -2
- classes/PHPExcel/locale/ru/config +2 -2
- classes/PHPExcel/locale/ru/functions +1 -1
- classes/PHPExcel/locale/sv/config +2 -2
- classes/PHPExcel/locale/tr/config +2 -2
- classes/PHPExcel/locale/tr/functions +1 -1
- classes/api.php +51 -46
- classes/config.php +2 -2
- classes/input.php +4 -2
- classes/upload.php +362 -4
- controllers/admin/history.php +1 -1
- controllers/admin/home.php +0 -12
- controllers/admin/import.php +38 -14
- controllers/admin/manage.php +18 -4
- controllers/admin/settings.php +25 -11
- helpers/functions.php +1 -1
- helpers/get_file_curl.php +2 -3
- helpers/wp_all_import_addon_notifications.php +2 -1
- helpers/wp_all_import_get_image_from_gallery.php +11 -24
- helpers/wp_all_import_template_notifications.php +8 -1
- i18n/languages/wp_all_import_plugin-de_CH.po +8 -8
- i18n/languages/wp_all_import_plugin-de_DE.po +8 -8
- i18n/languages/wp_all_import_plugin-es_ES.po +9 -9
- i18n/languages/wp_all_import_plugin-hu_HU.po +7 -7
- i18n/languages/wp_all_import_plugin-ja.po +7 -7
- i18n/languages/wp_all_import_plugin-pt_BR.po +12 -12
- i18n/languages/wp_all_import_pro_plugin.pot +7 -7
- libraries/XmlImportCsvParse.php +29 -40
- libraries/XmlImportTemplateScanner.php +1 -1
- models/image/list.php +18 -8
- models/import/record.php +515 -338
- plugin.php +210 -136
- readme.txt +9 -2
- schema.php +1 -3
- static/css/admin.css +86 -22
- static/js/admin.js +98 -9
- static/js/jquery/jquery.tipsy.js +8 -3
- static/js/jquery/jquery.ui-contextmenu.min.js +0 -0
- views/admin/home/index.php +0 -16
- views/admin/import/confirm.php +8 -3
- views/admin/import/evaluate.php +1 -1
- views/admin/import/index.php +89 -41
- views/admin/import/options/_reimport_options.php +15 -4
- views/admin/import/options/_reimport_template.php +1 -1
- views/admin/import/options/_settings_template.php +80 -37
- views/admin/import/process.php +1 -2
- views/admin/manage/delete.php +26 -2
actions/admin_init.php
CHANGED
@@ -7,8 +7,4 @@ function pmxi_admin_init(){
|
|
7 |
@ini_set('mysql.connect_timeout', 300);
|
8 |
@ini_set('default_socket_timeout', 300);
|
9 |
|
10 |
-
// if (isset($_GET['addon_notice_ignore']) && '1' == $_GET['addon_notice_ignore'] && isset($_GET['addon_slug']) ) {
|
11 |
-
// update_option($_GET['addon_slug'] . '_notice_ignore', 'true');
|
12 |
-
// }
|
13 |
-
|
14 |
}
|
7 |
@ini_set('mysql.connect_timeout', 300);
|
8 |
@ini_set('default_socket_timeout', 300);
|
9 |
|
|
|
|
|
|
|
|
|
10 |
}
|
actions/delete_post.php
CHANGED
@@ -2,14 +2,13 @@
|
|
2 |
|
3 |
function pmxi_delete_post($post_id) {
|
4 |
if (!empty($post_id) && is_numeric($post_id)){
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
}
|
15 |
}
|
2 |
|
3 |
function pmxi_delete_post($post_id) {
|
4 |
if (!empty($post_id) && is_numeric($post_id)){
|
5 |
+
$post = new PMXI_Post_Record();
|
6 |
+
$is_post = ! $post->getBy( 'post_id', $post_id )->isEmpty();
|
7 |
+
if ( $is_post ) {
|
8 |
+
$post->delete();
|
9 |
+
} else {
|
10 |
+
$image = new PMXI_Image_Record();
|
11 |
+
$image->getBy( 'attachment_id', $post_id )->isEmpty() or $image->delete();
|
12 |
+
}
|
13 |
+
}
|
|
|
14 |
}
|
actions/pmxi_after_xml_import.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
function pmxi_pmxi_after_xml_import( $import_id, $import )
|
3 |
{
|
4 |
-
if ( ! in_array($import->options['custom_type'], array('taxonomies', 'import_users')) ) {
|
5 |
$custom_type = get_post_type_object( $import->options['custom_type'] );
|
6 |
if ( ! empty($custom_type) && $custom_type->hierarchical ){
|
7 |
$parent_posts = get_option('wp_all_import_posts_hierarchy_' . $import_id);
|
@@ -17,9 +17,12 @@ function pmxi_pmxi_after_xml_import( $import_id, $import )
|
|
17 |
}
|
18 |
}
|
19 |
delete_option('wp_all_import_posts_hierarchy_' . $import_id);
|
|
|
20 |
|
21 |
-
|
22 |
-
|
|
|
|
|
23 |
$term_ids = get_terms(
|
24 |
array(
|
25 |
'taxonomy' => $taxonomy,
|
@@ -27,11 +30,13 @@ function pmxi_pmxi_after_xml_import( $import_id, $import )
|
|
27 |
'fields' => 'ids',
|
28 |
)
|
29 |
);
|
30 |
-
|
|
|
|
|
31 |
}
|
32 |
}
|
33 |
|
34 |
-
|
35 |
wp_all_import_update_post_count();
|
36 |
}
|
37 |
|
1 |
<?php
|
2 |
function pmxi_pmxi_after_xml_import( $import_id, $import )
|
3 |
{
|
4 |
+
if ( ! in_array($import->options['custom_type'], array('taxonomies', 'import_users', 'shop_customer')) ) {
|
5 |
$custom_type = get_post_type_object( $import->options['custom_type'] );
|
6 |
if ( ! empty($custom_type) && $custom_type->hierarchical ){
|
7 |
$parent_posts = get_option('wp_all_import_posts_hierarchy_' . $import_id);
|
17 |
}
|
18 |
}
|
19 |
delete_option('wp_all_import_posts_hierarchy_' . $import_id);
|
20 |
+
}
|
21 |
|
22 |
+
// Update term count after import process is complete.
|
23 |
+
$taxonomies = get_object_taxonomies( $import->options['custom_type'] );
|
24 |
+
if (!empty($taxonomies)) {
|
25 |
+
foreach ( (array) $taxonomies as $taxonomy ) {
|
26 |
$term_ids = get_terms(
|
27 |
array(
|
28 |
'taxonomy' => $taxonomy,
|
30 |
'fields' => 'ids',
|
31 |
)
|
32 |
);
|
33 |
+
if ( ! empty( $term_ids ) ) {
|
34 |
+
wp_update_term_count_now( $term_ids, $taxonomy );
|
35 |
+
}
|
36 |
}
|
37 |
}
|
38 |
|
39 |
+
// Update post count only once after import process is completed.
|
40 |
wp_all_import_update_post_count();
|
41 |
}
|
42 |
|
actions/wp_ajax_auto_detect_cf.php
CHANGED
@@ -17,6 +17,7 @@ function pmxi_wp_ajax_auto_detect_cf(){
|
|
17 |
$fields = array();
|
18 |
switch ($post_type) {
|
19 |
case 'import_users':
|
|
|
20 |
case 'taxonomies':
|
21 |
$fields = $input->post('fields', array());
|
22 |
break;
|
@@ -43,6 +44,7 @@ function pmxi_wp_ajax_auto_detect_cf(){
|
|
43 |
foreach ($fields as $field) {
|
44 |
switch ($post_type){
|
45 |
case 'import_users':
|
|
|
46 |
$values = $wpdb->get_results("
|
47 |
SELECT DISTINCT usermeta.meta_value
|
48 |
FROM ".$wpdb->usermeta." as usermeta
|
17 |
$fields = array();
|
18 |
switch ($post_type) {
|
19 |
case 'import_users':
|
20 |
+
case 'shop_customer':
|
21 |
case 'taxonomies':
|
22 |
$fields = $input->post('fields', array());
|
23 |
break;
|
44 |
foreach ($fields as $field) {
|
45 |
switch ($post_type){
|
46 |
case 'import_users':
|
47 |
+
case 'shop_customer':
|
48 |
$values = $wpdb->get_results("
|
49 |
SELECT DISTINCT usermeta.meta_value
|
50 |
FROM ".$wpdb->usermeta." as usermeta
|
actions/wp_ajax_auto_detect_sf.php
CHANGED
@@ -8,7 +8,7 @@ function pmxi_wp_ajax_auto_detect_sf(){
|
|
8 |
if ( ! current_user_can( PMXI_Plugin::$capabilities ) ){
|
9 |
exit( json_encode(array('result' => array(), 'msg' => __('Security check', 'wp_all_import_plugin'))) );
|
10 |
}
|
11 |
-
|
12 |
$input = new PMXI_Input();
|
13 |
$fieldName = $input->post('name', '');
|
14 |
$post_type = $input->post('post_type', 'post');
|
@@ -18,20 +18,24 @@ function pmxi_wp_ajax_auto_detect_sf(){
|
|
18 |
|
19 |
if ($fieldName) {
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
35 |
|
36 |
if ( ! empty($values) ){
|
37 |
foreach ($values as $key => $value) {
|
8 |
if ( ! current_user_can( PMXI_Plugin::$capabilities ) ){
|
9 |
exit( json_encode(array('result' => array(), 'msg' => __('Security check', 'wp_all_import_plugin'))) );
|
10 |
}
|
11 |
+
|
12 |
$input = new PMXI_Input();
|
13 |
$fieldName = $input->post('name', '');
|
14 |
$post_type = $input->post('post_type', 'post');
|
18 |
|
19 |
if ($fieldName) {
|
20 |
|
21 |
+
switch ($post_type){
|
22 |
+
case 'import_users':
|
23 |
+
case 'shop_customer':
|
24 |
+
$values = $wpdb->get_results("
|
25 |
+
SELECT DISTINCT usermeta.meta_value
|
26 |
+
FROM ".$wpdb->usermeta." as usermeta
|
27 |
+
WHERE usermeta.meta_key='".$fieldName."'
|
28 |
+
", ARRAY_A);
|
29 |
+
break;
|
30 |
+
|
31 |
+
default:
|
32 |
+
$values = $wpdb->get_results("
|
33 |
+
SELECT DISTINCT postmeta.meta_value
|
34 |
+
FROM ".$wpdb->postmeta." as postmeta
|
35 |
+
WHERE postmeta.meta_key='".$fieldName."'
|
36 |
+
", ARRAY_A);
|
37 |
+
break;
|
38 |
+
}
|
39 |
|
40 |
if ( ! empty($values) ){
|
41 |
foreach ($values as $key => $value) {
|
actions/wp_ajax_delete_import.php
CHANGED
@@ -28,17 +28,46 @@ function pmxi_wp_ajax_delete_import(){
|
|
28 |
'msg' => ''
|
29 |
);
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
if ( $params['is_delete_import'] and ! $params['is_delete_posts'] )
|
32 |
{
|
33 |
$response['redirect'] = add_query_arg('pmxi_nt', urlencode(__('Import deleted', 'wp_all_import_plugin')), $params['base_url']);
|
34 |
}
|
35 |
elseif( ! $params['is_delete_import'] and $params['is_delete_posts'])
|
36 |
{
|
37 |
-
$response['redirect'] = add_query_arg('pmxi_nt', urlencode(__('All associated
|
38 |
}
|
39 |
elseif( $params['is_delete_import'] and $params['is_delete_posts'])
|
40 |
{
|
41 |
-
$response['redirect'] = add_query_arg('pmxi_nt', urlencode(__('Import and all associated
|
42 |
}
|
43 |
else
|
44 |
{
|
28 |
'msg' => ''
|
29 |
);
|
30 |
|
31 |
+
$get_import_id = $params['import_ids'][0];
|
32 |
+
|
33 |
+
$import = new PMXI_Import_Record();
|
34 |
+
$import->getById($get_import_id);
|
35 |
+
|
36 |
+
if ( ! $import->isEmpty() )
|
37 |
+
{
|
38 |
+
if (!empty($import['options']['custom_type'])){
|
39 |
+
switch ($import['options']['custom_type']){
|
40 |
+
|
41 |
+
case 'import_users':
|
42 |
+
$custom_type = new stdClass();
|
43 |
+
$custom_type->label = __('Users', 'wp_all_import_plugin');
|
44 |
+
break;
|
45 |
+
case 'shop_customer':
|
46 |
+
$custom_type = new stdClass();
|
47 |
+
$custom_type->label = __('Customers', 'wp_all_import_plugin');
|
48 |
+
break;
|
49 |
+
default:
|
50 |
+
$custom_type = get_post_type_object( $import['options']['custom_type'] );
|
51 |
+
break;
|
52 |
+
}
|
53 |
+
$cpt_name = ( ! empty($custom_type)) ? strtolower($custom_type->label) : '';
|
54 |
+
}
|
55 |
+
else{
|
56 |
+
$cpt_name = '';
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
if ( $params['is_delete_import'] and ! $params['is_delete_posts'] )
|
61 |
{
|
62 |
$response['redirect'] = add_query_arg('pmxi_nt', urlencode(__('Import deleted', 'wp_all_import_plugin')), $params['base_url']);
|
63 |
}
|
64 |
elseif( ! $params['is_delete_import'] and $params['is_delete_posts'])
|
65 |
{
|
66 |
+
$response['redirect'] = add_query_arg('pmxi_nt', urlencode(sprintf(__('All associated %s deleted.', 'wp_all_import_plugin'), $cpt_name)), $params['base_url']);
|
67 |
}
|
68 |
elseif( $params['is_delete_import'] and $params['is_delete_posts'])
|
69 |
{
|
70 |
+
$response['redirect'] = add_query_arg('pmxi_nt', urlencode(sprintf(__('Import and all associated %s deleted.', 'wp_all_import_plugin'), $cpt_name)), $params['base_url']);
|
71 |
}
|
72 |
else
|
73 |
{
|
actions/wp_ajax_import_failed.php
CHANGED
@@ -21,6 +21,8 @@ function pmxi_wp_ajax_import_failed(){
|
|
21 |
'failed_on' => date('Y-m-d H:i:s')
|
22 |
))->save();
|
23 |
$result = true;
|
|
|
24 |
}
|
|
|
25 |
exit( json_encode( array('result' => $result)));
|
26 |
}
|
21 |
'failed_on' => date('Y-m-d H:i:s')
|
22 |
))->save();
|
23 |
$result = true;
|
24 |
+
do_action('pmxi_import_failed', $id);
|
25 |
}
|
26 |
+
|
27 |
exit( json_encode( array('result' => $result)));
|
28 |
}
|
classes/PHPExcel/locale/cs/config
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
|
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
@@ -34,7 +35,6 @@ ArgumentSeparator = ;
|
|
34 |
##
|
35 |
currencySymbol = Kč
|
36 |
|
37 |
-
|
38 |
##
|
39 |
## Excel Error Codes (For future use)
|
40 |
##
|
@@ -44,4 +44,4 @@ VALUE = #HODNOTA!
|
|
44 |
REF = #REF!
|
45 |
NAME = #NÁZEV?
|
46 |
NUM = #NUM!
|
47 |
-
NA = #N/A
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
+
|
5 |
## Copyright (c) 2006 - 2013 PHPExcel
|
6 |
##
|
7 |
## This library is free software; you can redistribute it and/or
|
35 |
##
|
36 |
currencySymbol = Kč
|
37 |
|
|
|
38 |
##
|
39 |
## Excel Error Codes (For future use)
|
40 |
##
|
44 |
REF = #REF!
|
45 |
NAME = #NÁZEV?
|
46 |
NUM = #NUM!
|
47 |
+
NA = #N/A
|
classes/PHPExcel/locale/cs/functions
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
classes/PHPExcel/locale/da/config
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
@@ -32,12 +32,12 @@ ArgumentSeparator = ;
|
|
32 |
##
|
33 |
## (For future use)
|
34 |
##
|
35 |
-
currencySymbol = kr
|
36 |
|
37 |
|
38 |
|
39 |
##
|
40 |
-
## Excel Error Codes (For future use)
|
41 |
##
|
42 |
NULL = #NUL!
|
43 |
DIV0 = #DIVISION/0!
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
32 |
##
|
33 |
## (For future use)
|
34 |
##
|
35 |
+
currencySymbol = kr
|
36 |
|
37 |
|
38 |
|
39 |
##
|
40 |
+
## Excel Error Codes (For future use)
|
41 |
##
|
42 |
NULL = #NUL!
|
43 |
DIV0 = #DIVISION/0!
|
classes/PHPExcel/locale/da/functions
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
classes/PHPExcel/locale/de/config
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
@@ -36,7 +36,7 @@ currencySymbol = €
|
|
36 |
|
37 |
|
38 |
##
|
39 |
-
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #NULL!
|
42 |
DIV0 = #DIV/0!
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
36 |
|
37 |
|
38 |
##
|
39 |
+
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #NULL!
|
42 |
DIV0 = #DIV/0!
|
classes/PHPExcel/locale/de/functions
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
classes/PHPExcel/locale/en/uk/config
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
classes/PHPExcel/locale/es/config
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
@@ -36,7 +36,8 @@ currencySymbol = $ ## I'm surprised that the Excel Documentation suggests $ rath
|
|
36 |
|
37 |
|
38 |
##
|
39 |
-
## Excel Error Codes (For future use)
|
|
|
40 |
##
|
41 |
NULL = #¡NULO!
|
42 |
DIV0 = #¡DIV/0!
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
36 |
|
37 |
|
38 |
##
|
39 |
+
## Excel Error Codes (For future use)
|
40 |
+
|
41 |
##
|
42 |
NULL = #¡NULO!
|
43 |
DIV0 = #¡DIV/0!
|
classes/PHPExcel/locale/es/functions
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
classes/PHPExcel/locale/fi/config
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
@@ -36,7 +36,7 @@ currencySymbol = $ # Symbol not known, should it be a € (Euro)?
|
|
36 |
|
37 |
|
38 |
##
|
39 |
-
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #TYHJÄ!
|
42 |
DIV0 = #JAKO/0!
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
36 |
|
37 |
|
38 |
##
|
39 |
+
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #TYHJÄ!
|
42 |
DIV0 = #JAKO/0!
|
classes/PHPExcel/locale/fi/functions
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
classes/PHPExcel/locale/fr/config
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
@@ -36,7 +36,7 @@ currencySymbol = €
|
|
36 |
|
37 |
|
38 |
##
|
39 |
-
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #NUL!
|
42 |
DIV0 = #DIV/0!
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
36 |
|
37 |
|
38 |
##
|
39 |
+
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #NUL!
|
42 |
DIV0 = #DIV/0!
|
classes/PHPExcel/locale/fr/functions
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
classes/PHPExcel/locale/hu/config
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
classes/PHPExcel/locale/hu/functions
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
classes/PHPExcel/locale/it/config
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
@@ -36,7 +36,7 @@ currencySymbol = €
|
|
36 |
|
37 |
|
38 |
##
|
39 |
-
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #NULLO!
|
42 |
DIV0 = #DIV/0!
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
36 |
|
37 |
|
38 |
##
|
39 |
+
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #NULLO!
|
42 |
DIV0 = #DIV/0!
|
classes/PHPExcel/locale/it/functions
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
classes/PHPExcel/locale/nl/config
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
@@ -36,7 +36,7 @@ currencySymbol = €
|
|
36 |
|
37 |
|
38 |
##
|
39 |
-
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #LEEG!
|
42 |
DIV0 = #DEEL/0!
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
36 |
|
37 |
|
38 |
##
|
39 |
+
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #LEEG!
|
42 |
DIV0 = #DEEL/0!
|
classes/PHPExcel/locale/nl/functions
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
classes/PHPExcel/locale/no/config
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
@@ -36,7 +36,7 @@ currencySymbol = kr
|
|
36 |
|
37 |
|
38 |
##
|
39 |
-
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #NULL!
|
42 |
DIV0 = #DIV/0!
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
36 |
|
37 |
|
38 |
##
|
39 |
+
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #NULL!
|
42 |
DIV0 = #DIV/0!
|
classes/PHPExcel/locale/no/functions
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
classes/PHPExcel/locale/pl/config
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
@@ -36,7 +36,7 @@ currencySymbol = zł
|
|
36 |
|
37 |
|
38 |
##
|
39 |
-
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #ZERO!
|
42 |
DIV0 = #DZIEL/0!
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
36 |
|
37 |
|
38 |
##
|
39 |
+
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #ZERO!
|
42 |
DIV0 = #DZIEL/0!
|
classes/PHPExcel/locale/pl/functions
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
classes/PHPExcel/locale/pt/br/config
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
@@ -36,7 +36,8 @@ currencySymbol = R$
|
|
36 |
|
37 |
|
38 |
##
|
39 |
-
## Excel Error Codes (For future use)
|
|
|
40 |
##
|
41 |
NULL = #NULO!
|
42 |
DIV0 = #DIV/0!
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
36 |
|
37 |
|
38 |
##
|
39 |
+
## Excel Error Codes (For future use)
|
40 |
+
|
41 |
##
|
42 |
NULL = #NULO!
|
43 |
DIV0 = #DIV/0!
|
classes/PHPExcel/locale/pt/config
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
@@ -36,7 +36,7 @@ currencySymbol = €
|
|
36 |
|
37 |
|
38 |
##
|
39 |
-
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #NULO!
|
42 |
DIV0 = #DIV/0!
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
36 |
|
37 |
|
38 |
##
|
39 |
+
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #NULO!
|
42 |
DIV0 = #DIV/0!
|
classes/PHPExcel/locale/ru/config
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
@@ -36,7 +36,7 @@ currencySymbol = р
|
|
36 |
|
37 |
|
38 |
##
|
39 |
-
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #ПУСТО!
|
42 |
DIV0 = #ДЕЛ/0!
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
36 |
|
37 |
|
38 |
##
|
39 |
+
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #ПУСТО!
|
42 |
DIV0 = #ДЕЛ/0!
|
classes/PHPExcel/locale/ru/functions
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
classes/PHPExcel/locale/sv/config
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
@@ -36,7 +36,7 @@ currencySymbol = kr
|
|
36 |
|
37 |
|
38 |
##
|
39 |
-
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #Skärning!
|
42 |
DIV0 = #Division/0!
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
36 |
|
37 |
|
38 |
##
|
39 |
+
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #Skärning!
|
42 |
DIV0 = #Division/0!
|
classes/PHPExcel/locale/tr/config
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
@@ -36,7 +36,7 @@ currencySymbol = YTL
|
|
36 |
|
37 |
|
38 |
##
|
39 |
-
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #BOŞ!
|
42 |
DIV0 = #SAYI/0!
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
36 |
|
37 |
|
38 |
##
|
39 |
+
## Excel Error Codes (For future use)
|
40 |
##
|
41 |
NULL = #BOŞ!
|
42 |
DIV0 = #SAYI/0!
|
classes/PHPExcel/locale/tr/functions
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
##
|
2 |
## PHPExcel
|
3 |
-
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
1 |
##
|
2 |
## PHPExcel
|
3 |
+
##
|
4 |
## Copyright (c) 2006 - 2013 PHPExcel
|
5 |
##
|
6 |
## This library is free software; you can redistribute it and/or
|
classes/api.php
CHANGED
@@ -360,7 +360,7 @@ class PMXI_API
|
|
360 |
|
361 |
}
|
362 |
|
363 |
-
public static function upload_image($pid, $img_url, $download_images, $logger, $create_image = false, $image_name = "", $file_type = 'images'){
|
364 |
|
365 |
if (empty($img_url)) return false;
|
366 |
|
@@ -372,13 +372,13 @@ class PMXI_API
|
|
372 |
if ($img_ext == "") $img_ext = pmxi_get_remote_image_ext($img_url);
|
373 |
|
374 |
// generate local file name
|
375 |
-
$image_name = apply_filters("
|
376 |
|
377 |
}
|
378 |
|
379 |
$uploads = wp_upload_dir();
|
380 |
|
381 |
-
$uploads = apply_filters('wp_all_import_images_uploads_dir', $uploads,
|
382 |
|
383 |
$targetDir = $uploads['path'];
|
384 |
$targetUrl = $uploads['url'];
|
@@ -387,41 +387,43 @@ class PMXI_API
|
|
387 |
$wp_filetype = false;
|
388 |
$attch = false;
|
389 |
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
|
|
|
|
421 |
$image_filename = wp_unique_filename($targetDir, $image_name);
|
422 |
$image_filepath = $targetDir . '/' . $image_filename;
|
423 |
|
424 |
-
$url = str_replace(" ", "%20", trim(
|
425 |
|
426 |
$is_base64_images_allowed = apply_filters("wp_all_import_is_base64_images_allowed", true, $url, false);
|
427 |
|
@@ -432,12 +434,10 @@ class PMXI_API
|
|
432 |
// search existing attachment
|
433 |
$attch = wp_all_import_get_image_from_gallery($image_name, $targetDir, $file_type);
|
434 |
|
435 |
-
if (empty($attch))
|
436 |
-
{
|
437 |
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: Image %s not found in media gallery.', 'wp_all_import_plugin'), trim($image_name)));
|
438 |
}
|
439 |
-
else
|
440 |
-
{
|
441 |
$logger and call_user_func($logger, sprintf(__('- Using existing image `%s`...', 'wp_all_import_plugin'), trim($image_name)));
|
442 |
return $attch->ID;
|
443 |
}
|
@@ -463,8 +463,8 @@ class PMXI_API
|
|
463 |
// do not download images
|
464 |
if ( "yes" != $download_images ){
|
465 |
|
466 |
-
$image_filename = $image_name;
|
467 |
-
$image_filepath = $targetDir . '/' . $image_filename;
|
468 |
|
469 |
$wpai_uploads = $uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::FILES_DIRECTORY . DIRECTORY_SEPARATOR;
|
470 |
$wpai_image_path = $wpai_uploads . str_replace('%20', ' ', $url);
|
@@ -506,6 +506,11 @@ class PMXI_API
|
|
506 |
$logger and call_user_func($logger, sprintf(__('- Downloading file from `%s`', 'wp_all_import_plugin'), $url));
|
507 |
}
|
508 |
|
|
|
|
|
|
|
|
|
|
|
509 |
$request = get_file_curl($url, $image_filepath);
|
510 |
|
511 |
if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($image_filepath, @file_get_contents($url))) {
|
@@ -566,16 +571,16 @@ class PMXI_API
|
|
566 |
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
567 |
|
568 |
if($file_type == 'images'){
|
569 |
-
$logger and call_user_func($logger, sprintf(__('- Creating an attachment for image `%s`', 'wp_all_import_plugin'), $targetUrl . '/' . $image_filename));
|
570 |
}
|
571 |
else{
|
572 |
-
$logger and call_user_func($logger, sprintf(__('- Creating an attachment for file `%s`', 'wp_all_import_plugin'), $targetUrl . '/' . $image_filename));
|
573 |
}
|
574 |
|
575 |
$attachment = array(
|
576 |
'post_mime_type' => ($file_type == 'images') ? image_type_to_mime_type($image_info[2]) : $wp_filetype['type'],
|
577 |
-
'guid' => $targetUrl . '/' . $image_filename,
|
578 |
-
'post_title' => $image_filename,
|
579 |
'post_content' => '',
|
580 |
);
|
581 |
if ($file_type == 'images' and ($image_meta = wp_read_image_metadata($image_filepath))) {
|
@@ -603,7 +608,7 @@ class PMXI_API
|
|
603 |
'image_url' => $img_url,
|
604 |
'image_filename' => $image_filename
|
605 |
))->insert();
|
606 |
-
$logger and call_user_func($logger, sprintf(__('- Attachment has been successfully created for image `%s`', 'wp_all_import_plugin'), $targetUrl . '/' . $image_filename));
|
607 |
return $attid;
|
608 |
}
|
609 |
|
360 |
|
361 |
}
|
362 |
|
363 |
+
public static function upload_image($pid, $img_url, $download_images, $logger, $create_image = false, $image_name = "", $file_type = 'images', $check_existing = true, $articleData = false){
|
364 |
|
365 |
if (empty($img_url)) return false;
|
366 |
|
372 |
if ($img_ext == "") $img_ext = pmxi_get_remote_image_ext($img_url);
|
373 |
|
374 |
// generate local file name
|
375 |
+
$image_name = apply_filters("wp_all_import_api_image_filename", urldecode(sanitize_file_name((($img_ext) ? str_replace("." . $default_extension, "", $bn) : $bn))) . (("" != $img_ext) ? '.' . $img_ext : ''), $img_url, $pid);
|
376 |
|
377 |
}
|
378 |
|
379 |
$uploads = wp_upload_dir();
|
380 |
|
381 |
+
$uploads = apply_filters('wp_all_import_images_uploads_dir', $uploads, $articleData, false, false);
|
382 |
|
383 |
$targetDir = $uploads['path'];
|
384 |
$targetUrl = $uploads['url'];
|
387 |
$wp_filetype = false;
|
388 |
$attch = false;
|
389 |
|
390 |
+
if($check_existing) {
|
391 |
+
// trying to find existing image in hash table
|
392 |
+
if ("yes" == $download_images) {
|
393 |
+
$logger and call_user_func($logger, sprintf(__('- Searching for existing image `%s` by URL...', 'wp_all_import_plugin'), rawurldecode($img_url)));
|
394 |
+
$imageList = new PMXI_Image_List();
|
395 |
+
$attch = $imageList->getExistingImageByUrl($img_url);
|
396 |
+
if ($attch) {
|
397 |
+
$logger and call_user_func($logger, sprintf(__('Existing image was found by URL `%s`...', 'wp_all_import_plugin'), $img_url));
|
398 |
+
return $attch->ID;
|
399 |
+
}
|
400 |
+
}
|
401 |
+
|
402 |
+
if (empty($attch)) {
|
403 |
+
$logger and call_user_func($logger, sprintf(__('- Searching for existing image `%s` by `_wp_attached_file` `%s`...', 'wp_all_import_plugin'), $img_url, $image_name));
|
404 |
+
$attch = wp_all_import_get_image_from_gallery($image_name, $targetDir, $file_type);
|
405 |
+
}
|
406 |
+
|
407 |
+
if (!empty($attch)) {
|
408 |
+
$logger and call_user_func($logger, sprintf(__('- Existing image was found by `_wp_attached_file` ...', 'wp_all_import_plugin'), $img_url));
|
409 |
+
$imageRecord = new PMXI_Image_Record();
|
410 |
+
$imageRecord->getBy(array(
|
411 |
+
'attachment_id' => $attch->ID
|
412 |
+
));
|
413 |
+
$imageRecord->isEmpty() and $imageRecord->set(array(
|
414 |
+
'attachment_id' => $attch->ID,
|
415 |
+
'image_url' => $img_url,
|
416 |
+
'image_filename' => $image_name
|
417 |
+
))->insert();
|
418 |
+
|
419 |
+
return $attch->ID;
|
420 |
+
}
|
421 |
+
}
|
422 |
+
|
423 |
$image_filename = wp_unique_filename($targetDir, $image_name);
|
424 |
$image_filepath = $targetDir . '/' . $image_filename;
|
425 |
|
426 |
+
$url = str_replace(" ", "%20", trim($img_url));
|
427 |
|
428 |
$is_base64_images_allowed = apply_filters("wp_all_import_is_base64_images_allowed", true, $url, false);
|
429 |
|
434 |
// search existing attachment
|
435 |
$attch = wp_all_import_get_image_from_gallery($image_name, $targetDir, $file_type);
|
436 |
|
437 |
+
if (empty($attch)) {
|
|
|
438 |
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: Image %s not found in media gallery.', 'wp_all_import_plugin'), trim($image_name)));
|
439 |
}
|
440 |
+
else {
|
|
|
441 |
$logger and call_user_func($logger, sprintf(__('- Using existing image `%s`...', 'wp_all_import_plugin'), trim($image_name)));
|
442 |
return $attch->ID;
|
443 |
}
|
463 |
// do not download images
|
464 |
if ( "yes" != $download_images ){
|
465 |
|
466 |
+
$image_filename = wp_unique_filename($targetDir, basename($image_name));
|
467 |
+
$image_filepath = $targetDir . '/' . basename($image_filename);
|
468 |
|
469 |
$wpai_uploads = $uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::FILES_DIRECTORY . DIRECTORY_SEPARATOR;
|
470 |
$wpai_image_path = $wpai_uploads . str_replace('%20', ' ', $url);
|
506 |
$logger and call_user_func($logger, sprintf(__('- Downloading file from `%s`', 'wp_all_import_plugin'), $url));
|
507 |
}
|
508 |
|
509 |
+
if ( ! preg_match('%^(http|ftp)s?://%i', $url) ) {
|
510 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s cannot be saved locally as %s', 'wp_all_import_plugin'), $url, $image_filepath));
|
511 |
+
return false;
|
512 |
+
}
|
513 |
+
|
514 |
$request = get_file_curl($url, $image_filepath);
|
515 |
|
516 |
if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($image_filepath, @file_get_contents($url))) {
|
571 |
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
572 |
|
573 |
if($file_type == 'images'){
|
574 |
+
$logger and call_user_func($logger, sprintf(__('- Creating an attachment for image `%s`', 'wp_all_import_plugin'), $targetUrl . '/' . basename($image_filename)));
|
575 |
}
|
576 |
else{
|
577 |
+
$logger and call_user_func($logger, sprintf(__('- Creating an attachment for file `%s`', 'wp_all_import_plugin'), $targetUrl . '/' . basename($image_filename)));
|
578 |
}
|
579 |
|
580 |
$attachment = array(
|
581 |
'post_mime_type' => ($file_type == 'images') ? image_type_to_mime_type($image_info[2]) : $wp_filetype['type'],
|
582 |
+
'guid' => $targetUrl . '/' . basename($image_filename),
|
583 |
+
'post_title' => basename($image_filename),
|
584 |
'post_content' => '',
|
585 |
);
|
586 |
if ($file_type == 'images' and ($image_meta = wp_read_image_metadata($image_filepath))) {
|
608 |
'image_url' => $img_url,
|
609 |
'image_filename' => $image_filename
|
610 |
))->insert();
|
611 |
+
$logger and call_user_func($logger, sprintf(__('- Attachment has been successfully created for image `%s`', 'wp_all_import_plugin'), $targetUrl . '/' . basename($image_filename)));
|
612 |
return $attid;
|
613 |
}
|
614 |
|
classes/config.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Class to load config files
|
4 |
-
*
|
5 |
-
* @author
|
6 |
*/
|
7 |
class PMXI_Config implements IteratorAggregate {
|
8 |
/**
|
1 |
<?php
|
2 |
/**
|
3 |
* Class to load config files
|
4 |
+
*
|
5 |
+
* @author Maksym Tsypliakov <maksym.tsypliakov@gmail.com>
|
6 |
*/
|
7 |
class PMXI_Config implements IteratorAggregate {
|
8 |
/**
|
classes/input.php
CHANGED
@@ -19,13 +19,15 @@ class PMXI_Input {
|
|
19 |
}
|
20 |
|
21 |
public function get($paramName, $default = NULL) {
|
22 |
-
|
23 |
$this->addFilter('htmlspecialchars');
|
24 |
-
$this->addFilter('esc_sql');
|
|
|
25 |
$result = $this->read($_GET, $paramName, $default);
|
26 |
$this->removeFilter('strip_tags');
|
27 |
$this->removeFilter('htmlspecialchars');
|
28 |
$this->removeFilter('esc_sql');
|
|
|
29 |
return $result;
|
30 |
}
|
31 |
|
19 |
}
|
20 |
|
21 |
public function get($paramName, $default = NULL) {
|
22 |
+
$this->addFilter('strip_tags');
|
23 |
$this->addFilter('htmlspecialchars');
|
24 |
+
$this->addFilter('esc_sql');
|
25 |
+
$this->addFilter('esc_js');
|
26 |
$result = $this->read($_GET, $paramName, $default);
|
27 |
$this->removeFilter('strip_tags');
|
28 |
$this->removeFilter('htmlspecialchars');
|
29 |
$this->removeFilter('esc_sql');
|
30 |
+
$this->removeFilter('esc_js');
|
31 |
return $result;
|
32 |
}
|
33 |
|
classes/upload.php
CHANGED
@@ -50,7 +50,7 @@ if ( ! class_exists('PMXI_Upload')){
|
|
50 |
$this->errors->add('form-validation', __('Please specify a file to import.<br/><br/>If you are uploading the file from your computer, please wait for it to finish uploading (progress bar at 100%), before trying to continue.', 'wp_all_import_plugin'));
|
51 |
} elseif (!is_file($this->file)) {
|
52 |
$this->errors->add('form-validation', __('Uploaded file is empty', 'wp_all_import_plugin'));
|
53 |
-
} elseif ( ! preg_match('%\W(xml|gzip|zip|csv|gz|json|txt|dat|psv|sql|xls|xlsx)$%i', trim(basename($this->file)))) {
|
54 |
$this->errors->add('form-validation', __('Uploaded file must be XML, CSV, ZIP, GZIP, GZ, JSON, SQL, TXT, DAT or PSV', 'wp_all_import_plugin'));
|
55 |
} elseif (preg_match('%\W(zip)$%i', trim(basename($this->file)))) {
|
56 |
|
@@ -70,7 +70,7 @@ if ( ! class_exists('PMXI_Upload')){
|
|
70 |
{
|
71 |
foreach ($v_result_list as $unzipped_file)
|
72 |
{
|
73 |
-
if ($unzipped_file['status'] == 'ok' and preg_match('%\W(xml|csv|txt|dat|psv|json|xls|xlsx|gz)$%i', trim($unzipped_file['stored_filename'])) and strpos($unzipped_file['stored_filename'], 'readme.txt') === false )
|
74 |
{
|
75 |
if ( strpos(basename($unzipped_file['stored_filename']), 'WP All Import Template') === 0 || strpos(basename($unzipped_file['stored_filename']), 'templates_') === 0 )
|
76 |
{
|
@@ -162,7 +162,7 @@ if ( ! class_exists('PMXI_Upload')){
|
|
162 |
|
163 |
}
|
164 |
|
165 |
-
} elseif ( preg_match('%\W(csv|txt|dat|psv)$%i', trim($this->file))) { // If CSV file uploaded
|
166 |
|
167 |
if ( $this->uploadsPath === false ){
|
168 |
$this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', 'wp_all_import_plugin'));
|
@@ -309,12 +309,343 @@ if ( ! class_exists('PMXI_Upload')){
|
|
309 |
'post_type' => (!empty($options)) ? $options['custom_type'] : false
|
310 |
);
|
311 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
|
313 |
protected function get_xml_file( $filePath )
|
314 |
{
|
315 |
$csv_path = '';
|
316 |
|
317 |
-
if (preg_match('%\W(csv|txt|dat|psv)$%i', trim($filePath))){ // If CSV file found in archieve
|
318 |
|
319 |
if($this->uploadsPath === false){
|
320 |
$this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', 'wp_all_import_plugin'));
|
@@ -371,6 +702,33 @@ if ( ! class_exists('PMXI_Upload')){
|
|
371 |
wp_all_import_remove_source($localXLSPath, false);
|
372 |
|
373 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
|
375 |
return array(
|
376 |
'csv' => $csv_path,
|
50 |
$this->errors->add('form-validation', __('Please specify a file to import.<br/><br/>If you are uploading the file from your computer, please wait for it to finish uploading (progress bar at 100%), before trying to continue.', 'wp_all_import_plugin'));
|
51 |
} elseif (!is_file($this->file)) {
|
52 |
$this->errors->add('form-validation', __('Uploaded file is empty', 'wp_all_import_plugin'));
|
53 |
+
} elseif ( ! preg_match('%\W(xml|gzip|zip|csv|tsv|gz|json|txt|dat|psv|sql|xls|xlsx)$%i', trim(basename($this->file)))) {
|
54 |
$this->errors->add('form-validation', __('Uploaded file must be XML, CSV, ZIP, GZIP, GZ, JSON, SQL, TXT, DAT or PSV', 'wp_all_import_plugin'));
|
55 |
} elseif (preg_match('%\W(zip)$%i', trim(basename($this->file)))) {
|
56 |
|
70 |
{
|
71 |
foreach ($v_result_list as $unzipped_file)
|
72 |
{
|
73 |
+
if ($unzipped_file['status'] == 'ok' and preg_match('%\W(xml|csv|txt|dat|psv|json|xls|xlsx|gz)$%i', trim($unzipped_file['stored_filename'])) and strpos($unzipped_file['stored_filename'], 'readme.txt') === false )
|
74 |
{
|
75 |
if ( strpos(basename($unzipped_file['stored_filename']), 'WP All Import Template') === 0 || strpos(basename($unzipped_file['stored_filename']), 'templates_') === 0 )
|
76 |
{
|
162 |
|
163 |
}
|
164 |
|
165 |
+
} elseif ( preg_match('%\W(csv|txt|dat|psv|tsv)$%i', trim($this->file))) { // If CSV file uploaded
|
166 |
|
167 |
if ( $this->uploadsPath === false ){
|
168 |
$this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', 'wp_all_import_plugin'));
|
309 |
'post_type' => (!empty($options)) ? $options['custom_type'] : false
|
310 |
);
|
311 |
}
|
312 |
+
|
313 |
+
public function url( $feed_type = '', $feed_xpath = '', $importTemplate = ''){
|
314 |
+
|
315 |
+
$uploads = wp_upload_dir();
|
316 |
+
|
317 |
+
$templates = false;
|
318 |
+
|
319 |
+
$bundle = array();
|
320 |
+
|
321 |
+
$bundleFiles = array();
|
322 |
+
|
323 |
+
if (empty($this->file)) {
|
324 |
+
$this->errors->add('form-validation', __('Please specify a file to import.', 'wp_all_import_plugin'));
|
325 |
+
} elseif ( ! preg_match('%^https?://%i', $this->file)) {
|
326 |
+
$this->errors->add('form-validation', __('The URL to your file is not valid.<br/><br/>Please make sure the URL starts with http:// or https://. To import from https://, your server must have OpenSSL installed.'), 'wp_all_import_plugin');
|
327 |
+
} elseif( ! is_writeable($this->uploadsPath)){
|
328 |
+
$this->errors->add('form-validation', __('Uploads folder '.$this->uploadsPath.' is not writable.'), 'wp_all_import_plugin');
|
329 |
+
}
|
330 |
+
|
331 |
+
$this->file = trim($this->file);
|
332 |
+
|
333 |
+
$csv_path = '';
|
334 |
+
|
335 |
+
if ( empty($this->errors->errors) ){
|
336 |
+
|
337 |
+
if( '' == $feed_type and ! preg_match('%\W(xml|csv|zip|gz|xls|xlsx)$%i', trim($this->file))) $feed_type = wp_all_import_get_remote_file_name(trim($this->file));
|
338 |
+
|
339 |
+
if ('zip' == $feed_type or empty($feed_type) and preg_match('%\W(zip)$%i', trim($this->file))) {
|
340 |
+
|
341 |
+
$tmpname = $this->uploadsPath . '/' . wp_unique_filename($this->uploadsPath, md5(basename($this->file)) . '.zip');
|
342 |
+
|
343 |
+
@copy($this->file, $tmpname);
|
344 |
+
|
345 |
+
if (!file_exists($tmpname)) {
|
346 |
+
$request = get_file_curl($this->file, $tmpname);
|
347 |
+
if (is_wp_error($request)) $this->errors->add('form-validation', $request->get_error_message());
|
348 |
+
if (!file_exists($tmpname)) $this->errors->add('form-validation', __('Failed upload ZIP archive', 'wp_all_import_plugin'));
|
349 |
+
}
|
350 |
+
|
351 |
+
if (!class_exists('PclZip')) include_once(PMXI_Plugin::ROOT_DIR.'/libraries/pclzip.lib.php');
|
352 |
+
|
353 |
+
$archive = new PclZip($tmpname);
|
354 |
+
if (($v_result_list = $archive->extract(PCLZIP_OPT_PATH, $this->uploadsPath, PCLZIP_OPT_REPLACE_NEWER)) == 0) {
|
355 |
+
$this->errors->add('form-validation', __('WP All Import couldn\'t find a file to import inside your ZIP.<br/><br/>Either the .ZIP file is broken, or doesn\'t contain a file with an extension of XML, CSV, PSV, DAT, or TXT. <br/>Please attempt to unzip your .ZIP file on your computer to ensure it is a valid .ZIP file which can actually be unzipped, and that it contains a file which WP All Import can import.', 'wp_all_import_plugin'));
|
356 |
+
}
|
357 |
+
else {
|
358 |
+
|
359 |
+
$filePath = '';
|
360 |
+
|
361 |
+
if (!empty($v_result_list)) {
|
362 |
+
foreach ($v_result_list as $unzipped_file) {
|
363 |
+
if ($unzipped_file['status'] == 'ok' and preg_match('%\W(xml|csv|txt|dat|psv|json|xls|xlsx|gz)$%i', trim($unzipped_file['stored_filename'])) and strpos($unzipped_file['stored_filename'], 'readme.txt') === false ) {
|
364 |
+
if ( strpos(basename($unzipped_file['stored_filename']), 'WP All Import Template') === 0 || strpos(basename($unzipped_file['stored_filename']), 'templates_') === 0) {
|
365 |
+
$templates = file_get_contents($unzipped_file['filename']);
|
366 |
+
$decodedTemplates = json_decode($templates, true);
|
367 |
+
$templateOptions = empty($decodedTemplates[0]) ? current($decodedTemplates) : $decodedTemplates;
|
368 |
+
}
|
369 |
+
else {
|
370 |
+
if ($filePath == '') {
|
371 |
+
$filePath = $unzipped_file['filename'];
|
372 |
+
}
|
373 |
+
if ( ! in_array($unzipped_file['filename'], $bundleFiles) ) {
|
374 |
+
$bundleFiles[basename($unzipped_file['filename'])] = $unzipped_file['filename'];
|
375 |
+
}
|
376 |
+
}
|
377 |
+
}
|
378 |
+
}
|
379 |
+
}
|
380 |
+
|
381 |
+
if ( count($bundleFiles) > 1 ) {
|
382 |
+
if ( ! empty($decodedTemplates) ) {
|
383 |
+
foreach ($decodedTemplates as $cpt => $tpl) {
|
384 |
+
$fileFormats = $this->get_xml_file( $bundleFiles[basename($tpl[0]['source_file_name'])] );
|
385 |
+
$bundle[$cpt] = $fileFormats['xml'];
|
386 |
+
}
|
387 |
+
}
|
388 |
+
if ( ! empty($bundle)) $filePath = current($bundle);
|
389 |
+
}
|
390 |
+
|
391 |
+
if($this->uploadsPath === false){
|
392 |
+
$this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', 'wp_all_import_plugin'));
|
393 |
+
}
|
394 |
+
|
395 |
+
if(empty($filePath)){
|
396 |
+
$zip = zip_open(trim($tmpname));
|
397 |
+
if (is_resource($zip)) {
|
398 |
+
while ($zip_entry = zip_read($zip)) {
|
399 |
+
$filePath = zip_entry_name($zip_entry);
|
400 |
+
$fp = fopen($this->uploadsPath."/".$filePath, "w");
|
401 |
+
if (zip_entry_open($zip, $zip_entry, "r")) {
|
402 |
+
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
|
403 |
+
fwrite($fp,"$buf");
|
404 |
+
zip_entry_close($zip_entry);
|
405 |
+
fclose($fp);
|
406 |
+
}
|
407 |
+
break;
|
408 |
+
}
|
409 |
+
zip_close($zip);
|
410 |
+
|
411 |
+
} else {
|
412 |
+
$this->errors->add('form-validation', __('WP All Import couldn\'t find a file to import inside your ZIP.<br/><br/>Either the .ZIP file is broken, or doesn\'t contain a file with an extension of XML, CSV, PSV, DAT, or TXT. <br/>Please attempt to unzip your .ZIP file on your computer to ensure it is a valid .ZIP file which can actually be unzipped, and that it contains a file which WP All Import can import.', 'wp_all_import_plugin'));
|
413 |
+
}
|
414 |
+
}
|
415 |
+
|
416 |
+
// Detect if file is very large
|
417 |
+
$source = array(
|
418 |
+
'name' => basename(parse_url($this->file, PHP_URL_PATH)),
|
419 |
+
'type' => 'url',
|
420 |
+
'path' => $feed_xpath,
|
421 |
+
);
|
422 |
+
|
423 |
+
$fileFormats = $this->get_xml_file( $filePath );
|
424 |
+
|
425 |
+
$csv_path = $fileFormats['csv'];
|
426 |
+
$filePath = $fileFormats['xml'];
|
427 |
+
}
|
428 |
+
|
429 |
+
if (file_exists($tmpname)) wp_all_import_remove_source($tmpname, false);
|
430 |
+
|
431 |
+
} elseif ('csv' == $feed_type or '' == $feed_type and preg_match('%\W(csv|txt|dat|psv|tsv)$%i', trim($this->file))) {
|
432 |
+
|
433 |
+
$source = array(
|
434 |
+
'name' => basename(parse_url($this->file, PHP_URL_PATH)),
|
435 |
+
'type' => 'url',
|
436 |
+
'path' => $feed_xpath,
|
437 |
+
);
|
438 |
+
|
439 |
+
// copy remote file in binary mode
|
440 |
+
$filePath = wp_all_import_get_url($this->file, $this->uploadsPath, 'csv');
|
441 |
+
|
442 |
+
if ( ! is_wp_error($filePath) ){
|
443 |
+
|
444 |
+
if ( ! file_exists($filePath)) {
|
445 |
+
$this->errors->add('form-validation', __('WP All Import was not able to download your file.<br/><br/>Please make sure the URL to your file is valid.<br/>You can test this by pasting it into your browser.<br/>Other reasons for this error can include some server setting on your host restricting access to this particular URL or external URLs in general, or some setting on the server hosting the file you are trying to access preventing your server from accessing it.', 'wp_all_import_plugin'));
|
446 |
+
}
|
447 |
+
|
448 |
+
// Detect if file is very large
|
449 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
450 |
+
$csv = new PMXI_CsvParser( array( 'filename' => $filePath, 'targetDir' => $this->uploadsPath ) ); // create chunks
|
451 |
+
//wp_all_import_remove_source($filePath, false);
|
452 |
+
|
453 |
+
$csv_path = $filePath;
|
454 |
+
|
455 |
+
$filePath = $csv->xml_path;
|
456 |
+
$this->is_csv = $csv->is_csv;
|
457 |
+
$this->root_element = 'node';
|
458 |
+
|
459 |
+
}
|
460 |
+
else $this->errors->add('form-validation', $filePath->get_error_message());
|
461 |
+
|
462 |
+
} elseif (preg_match('%\W(json)$%i', trim($this->file))){
|
463 |
+
|
464 |
+
$source = array(
|
465 |
+
'name' => basename(parse_url($this->file, PHP_URL_PATH)),
|
466 |
+
'type' => 'url',
|
467 |
+
'path' => $feed_xpath,
|
468 |
+
);
|
469 |
+
|
470 |
+
// copy remote file in binary mode
|
471 |
+
$filePath = wp_all_import_get_url($this->file, $this->uploadsPath, 'json');
|
472 |
+
|
473 |
+
$json_str = file_get_contents($filePath);
|
474 |
+
$is_json = wp_all_import_is_json($json_str);
|
475 |
+
|
476 |
+
if( is_wp_error($is_json)){
|
477 |
+
$this->errors->add('form-validation', $is_json->get_error_message(), 'wp_all_import_plugin');
|
478 |
+
}
|
479 |
+
else{
|
480 |
+
|
481 |
+
$xml_data = wp_all_import_json_to_xml( json_decode($json_str, true) );
|
482 |
+
|
483 |
+
if ( empty($xml_data) ){
|
484 |
+
$this->errors->add('form-validation', __('Can not import this file. JSON to XML convertation failed.', 'wp_all_import_plugin'));
|
485 |
+
}
|
486 |
+
else{
|
487 |
+
$tmpname = $this->uploadsPath .'/'. wp_all_import_url_title(wp_unique_filename($this->uploadsPath, str_replace("json", "xml", basename($filePath))));
|
488 |
+
file_put_contents($tmpname, $xml_data);
|
489 |
+
wp_all_import_remove_source($filePath, false);
|
490 |
+
$filePath = $tmpname;
|
491 |
+
}
|
492 |
+
}
|
493 |
+
|
494 |
+
} elseif (preg_match('%\W(sql)$%i', trim($this->file))){
|
495 |
+
|
496 |
+
$source = array(
|
497 |
+
'name' => basename($this->file),
|
498 |
+
'type' => 'url',
|
499 |
+
'path' => $feed_xpath,
|
500 |
+
);
|
501 |
+
|
502 |
+
// copy remote file in binary mode
|
503 |
+
$localSQLPath = wp_all_import_get_url($this->file, $this->uploadsPath, 'sql');
|
504 |
+
|
505 |
+
include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportSQLParse.php' );
|
506 |
+
|
507 |
+
$sql = new PMXI_SQLParser( $localSQLPath, $this->uploadsPath );
|
508 |
+
$filePath = $sql->parse();
|
509 |
+
wp_all_import_remove_source($localSQLPath, false);
|
510 |
+
|
511 |
+
} elseif (preg_match('%\W(xls|xlsx)$%i', strtok(trim($this->file), "?")) || preg_match('%\W(xls|xlsx)$%i', trim($this->file))) {
|
512 |
+
|
513 |
+
$source = array(
|
514 |
+
'name' => basename($this->file),
|
515 |
+
'type' => 'url',
|
516 |
+
'path' => $feed_xpath,
|
517 |
+
);
|
518 |
+
|
519 |
+
// copy remote file in binary mode
|
520 |
+
$localXLSPath = wp_all_import_get_url($this->file, $this->uploadsPath, 'xls');
|
521 |
+
|
522 |
+
include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportXLSParse.php' );
|
523 |
+
|
524 |
+
$xls = new PMXI_XLSParser( $localXLSPath, $this->uploadsPath );
|
525 |
+
$filePath = $xls->parse();
|
526 |
+
wp_all_import_remove_source($localXLSPath, false);
|
527 |
+
|
528 |
+
} else {
|
529 |
+
|
530 |
+
if ('gz' == $feed_type or '' == $feed_type and preg_match('%\W(gz|gzip)$%i', trim($this->file))){
|
531 |
+
$fileInfo = wp_all_import_get_gz($this->file, 0, $this->uploadsPath);
|
532 |
+
}
|
533 |
+
else{
|
534 |
+
$headers = wp_all_import_get_feed_type($this->file);
|
535 |
+
|
536 |
+
if ($headers['Content-Type'] and in_array($headers['Content-Type'], array('gz', 'gzip')) or $headers['Content-Encoding'] and in_array($headers['Content-Encoding'], array('gz', 'gzip'))){
|
537 |
+
$fileInfo = wp_all_import_get_gz($this->file, 0, $this->uploadsPath, $headers);
|
538 |
+
}
|
539 |
+
else{
|
540 |
+
$fileInfo = wp_all_import_get_url($this->file, $this->uploadsPath, $headers['Content-Type'], $headers['Content-Encoding'], true);
|
541 |
+
}
|
542 |
+
}
|
543 |
+
|
544 |
+
if ( ! is_wp_error($fileInfo) ){
|
545 |
+
|
546 |
+
$filePath = $fileInfo['localPath'];
|
547 |
+
|
548 |
+
if ( ! file_exists($filePath)) {
|
549 |
+
$this->errors->add('form-validation', __('WP All Import was not able to download your file.<br/><br/>Please make sure the URL to your file is valid.<br/>You can test this by pasting it into your browser.<br/>Other reasons for this error can include some server setting on your host restricting access to this particular URL or external URLs in general, or some setting on the server hosting the file you are trying to access preventing your server from accessing it.', 'wp_all_import_plugin'));
|
550 |
+
}
|
551 |
+
|
552 |
+
// Detect if file is very large
|
553 |
+
$source = array(
|
554 |
+
'name' => basename(parse_url($this->file, PHP_URL_PATH)),
|
555 |
+
'type' => 'url',
|
556 |
+
'path' => $feed_xpath,
|
557 |
+
);
|
558 |
+
|
559 |
+
$fileInfo['type'] = apply_filters('wp_all_import_feed_type', $fileInfo['type'], $this->file);
|
560 |
+
|
561 |
+
// detect CSV or XML
|
562 |
+
switch ($fileInfo['type']) {
|
563 |
+
case 'csv':
|
564 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
565 |
+
$csv = new PMXI_CsvParser( array( 'filename' => $filePath, 'targetDir' => $this->uploadsPath ) ); // create chunks
|
566 |
+
|
567 |
+
$csv_path = $filePath;
|
568 |
+
|
569 |
+
//wp_all_import_remove_source($filePath, false);
|
570 |
+
$filePath = $csv->xml_path;
|
571 |
+
$this->is_csv = $csv->is_csv;
|
572 |
+
$this->root_element = 'node';
|
573 |
+
break;
|
574 |
+
case 'json':
|
575 |
+
$json_str = file_get_contents($filePath);
|
576 |
+
$is_json = wp_all_import_is_json($json_str);
|
577 |
+
|
578 |
+
if( is_wp_error($is_json)){
|
579 |
+
$this->errors->add('form-validation', $is_json->get_error_message(), 'wp_all_import_plugin');
|
580 |
+
}
|
581 |
+
else{
|
582 |
+
|
583 |
+
$xml_data = wp_all_import_json_to_xml( json_decode($json_str, true) );
|
584 |
+
|
585 |
+
if ( empty($xml_data) ){
|
586 |
+
$this->errors->add('form-validation', __('Can not import this file. JSON to XML convertation failed.', 'wp_all_import_plugin'));
|
587 |
+
}
|
588 |
+
else{
|
589 |
+
$tmpname = $this->uploadsPath .'/'. wp_all_import_url_title(wp_unique_filename($this->uploadsPath, str_replace("json", "xml", basename($filePath))));
|
590 |
+
file_put_contents($tmpname, $xml_data);
|
591 |
+
wp_all_import_remove_source($filePath, false);
|
592 |
+
$filePath = $tmpname;
|
593 |
+
}
|
594 |
+
}
|
595 |
+
break;
|
596 |
+
case 'sql':
|
597 |
+
|
598 |
+
include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportSQLParse.php' );
|
599 |
+
|
600 |
+
$sql = new PMXI_SQLParser( $filePath, $this->uploadsPath );
|
601 |
+
$filePath = $sql->parse();
|
602 |
+
|
603 |
+
break;
|
604 |
+
default:
|
605 |
+
# code...
|
606 |
+
break;
|
607 |
+
}
|
608 |
+
|
609 |
+
}
|
610 |
+
else $this->errors->add('form-validation', $fileInfo->get_error_message());
|
611 |
+
}
|
612 |
+
}
|
613 |
+
|
614 |
+
if ( $this->errors->get_error_codes() ) return $this->errors;
|
615 |
+
|
616 |
+
$decodedTemplates = empty($templates) ? json_decode($importTemplate, true) : json_decode($templates, true);
|
617 |
+
|
618 |
+
$templateOptions = "";
|
619 |
+
|
620 |
+
if ( is_array($decodedTemplates) and ! empty($decodedTemplates))
|
621 |
+
{
|
622 |
+
$templateOptions = empty($decodedTemplates[0]) ? current($decodedTemplates) : $decodedTemplates;
|
623 |
+
}
|
624 |
+
|
625 |
+
$options = (empty($templateOptions[0]['options'])) ? false : maybe_unserialize($templateOptions[0]['options']);
|
626 |
+
|
627 |
+
if ( ! empty($options['root_element'])) $this->root_element = $options['root_element'];
|
628 |
+
|
629 |
+
return array(
|
630 |
+
'filePath' => $filePath,
|
631 |
+
'bundle' => $bundle,
|
632 |
+
'source' => $source,
|
633 |
+
'root_element' => $this->root_element,
|
634 |
+
'feed_type' => $feed_type,
|
635 |
+
'is_csv' => $this->is_csv,
|
636 |
+
'csv_path' => $csv_path,
|
637 |
+
'template' => empty($templateOptions) ? "" : json_encode($templateOptions),
|
638 |
+
'templates' => $templates,
|
639 |
+
'post_type' => (!empty($options)) ? $options['custom_type'] : false,
|
640 |
+
'taxonomy_type' => (!empty($options['taxonomy_type'])) ? $options['taxonomy_type'] : false,
|
641 |
+
);
|
642 |
+
}
|
643 |
|
644 |
protected function get_xml_file( $filePath )
|
645 |
{
|
646 |
$csv_path = '';
|
647 |
|
648 |
+
if (preg_match('%\W(csv|txt|dat|psv|tsv)$%i', trim($filePath))){ // If CSV file found in archieve
|
649 |
|
650 |
if($this->uploadsPath === false){
|
651 |
$this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', 'wp_all_import_plugin'));
|
702 |
wp_all_import_remove_source($localXLSPath, false);
|
703 |
|
704 |
}
|
705 |
+
elseif(preg_match('%\W(gz)$%i', trim($filePath))) { // If gz file uploaded
|
706 |
+
|
707 |
+
$fileInfo = wp_all_import_get_gz($filePath, 0, $this->uploadsPath);
|
708 |
+
|
709 |
+
if (!is_wp_error($fileInfo)) {
|
710 |
+
|
711 |
+
$filePath = $fileInfo['localPath'];
|
712 |
+
|
713 |
+
// detect CSV or XML
|
714 |
+
if ($fileInfo['type'] == 'csv') { // it is CSV file
|
715 |
+
|
716 |
+
include_once(PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportCsvParse.php');
|
717 |
+
$csv_path = $filePath;
|
718 |
+
$csv = new PMXI_CsvParser(array(
|
719 |
+
'filename' => $filePath,
|
720 |
+
'targeDir' => $this->uploadsPath
|
721 |
+
)); // create chunks
|
722 |
+
//@unlink($filePath);
|
723 |
+
$filePath = $csv->xml_path;
|
724 |
+
$this->is_csv = $csv->is_csv;
|
725 |
+
$this->root_element = 'node';
|
726 |
+
|
727 |
+
}
|
728 |
+
|
729 |
+
}
|
730 |
+
else $this->errors->add('form-validation', $fileInfo->get_error_message());
|
731 |
+
}
|
732 |
|
733 |
return array(
|
734 |
'csv' => $csv_path,
|
controllers/admin/history.php
CHANGED
@@ -89,7 +89,7 @@ class PMXI_Admin_History extends PMXI_Controller_Admin {
|
|
89 |
else
|
90 |
{
|
91 |
|
92 |
-
wp_redirect(add_query_arg(array('id' => $import_id, 'pmxi_nt' => urlencode(__('Log file does not
|
93 |
}
|
94 |
}
|
95 |
}
|
89 |
else
|
90 |
{
|
91 |
|
92 |
+
wp_redirect(add_query_arg(array('id' => $import_id, 'pmxi_nt' => urlencode(__('Log file does not exist.', 'wp_all_import_plugin'))), $this->baseUrl)); die();
|
93 |
}
|
94 |
}
|
95 |
}
|
controllers/admin/home.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Admin Home page
|
4 |
-
*
|
5 |
-
* @author Maksym Tsypliakov <maksym.tsypliakov@gmail.com>
|
6 |
-
*/
|
7 |
-
class PMXI_Admin_Home extends PMXI_Controller_Admin {
|
8 |
-
|
9 |
-
public function index() {
|
10 |
-
$this->render();
|
11 |
-
}
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
controllers/admin/import.php
CHANGED
@@ -254,8 +254,11 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
254 |
$this->errors->add('form-validation', __('Certain columns are required to be present in your file to enable it to be re-imported with WP All Import. These columns are missing. Re-export your file using WP All Export, and don\'t delete any of the columns when editing it. Then, re-import will work correctly.', 'wp_all_import_plugin'));
|
255 |
}
|
256 |
elseif($importRecord->options['custom_type'] == 'import_users' && ! class_exists('PMUI_Plugin')){
|
257 |
-
$this->errors->add('form-validation', __('<p>The import template you are using requires User
|
258 |
}
|
|
|
|
|
|
|
259 |
|
260 |
break;
|
261 |
|
@@ -316,8 +319,14 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
316 |
$dxpath = new DOMXPath($dom);
|
317 |
|
318 |
if (($elements = @$dxpath->query($xpath)) and $elements->length){
|
319 |
-
|
320 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
|
322 |
}
|
323 |
}
|
@@ -1088,7 +1097,13 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1088 |
$featured_image = $post[$get['slug'] . 'download_featured_image'];
|
1089 |
break;
|
1090 |
}
|
1091 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1092 |
}
|
1093 |
|
1094 |
} catch (XmlImportException $e) {
|
@@ -1468,14 +1483,14 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1468 |
if (!empty($post['title'])) {
|
1469 |
$this->_validate_template($post['title'], 'Post title');
|
1470 |
}
|
1471 |
-
elseif ($post['custom_type']
|
1472 |
$this->warnings->add('1', __('<strong>Warning:</strong> your title is blank.', 'wp_all_import_plugin'));
|
1473 |
}
|
1474 |
|
1475 |
if (!empty($post['content'])) {
|
1476 |
$this->_validate_template($post['content'], 'Post content');
|
1477 |
}
|
1478 |
-
elseif ($post['custom_type']
|
1479 |
$this->warnings->add('2', __('<strong>Warning:</strong> your content is blank.', 'wp_all_import_plugin'));
|
1480 |
}
|
1481 |
|
@@ -1602,7 +1617,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1602 |
|
1603 |
global $wpdb;
|
1604 |
|
1605 |
-
if ( ! in_array($post['custom_type'], array('import_users')) ){
|
1606 |
|
1607 |
// Get all meta keys for requested post type
|
1608 |
$this->data['meta_keys'] = array();
|
@@ -1784,12 +1799,14 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1784 |
} elseif (isset($mtch[3]) and intval($mtch[3]) > PMXI_Plugin::$session->count) {
|
1785 |
$this->errors->add('form-validation', __('One of the numbers in `Import only specified records` value exceeds record quantity in XML file', 'wp_all_import_plugin'));
|
1786 |
break;
|
1787 |
-
}
|
|
|
|
|
1788 |
}
|
1789 |
}
|
1790 |
}
|
1791 |
if ('manual' != $post['duplicate_matching'] and '' == $post['unique_key']) {
|
1792 |
-
$this->errors->add('form-validation', __('
|
1793 |
} elseif ('manual' != $post['duplicate_matching']) {
|
1794 |
$this->_validate_template($post['unique_key'], __('Post Unique Key', 'wp_all_import_plugin'));
|
1795 |
}
|
@@ -2086,7 +2103,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
2086 |
|
2087 |
$this->data['existing_meta_keys'] = array();
|
2088 |
|
2089 |
-
if ( ! in_array($post['custom_type'], array('import_users'))){
|
2090 |
|
2091 |
global $wpdb;
|
2092 |
|
@@ -2223,7 +2240,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
2223 |
|
2224 |
// unlink previous logs
|
2225 |
$by = array();
|
2226 |
-
$by[] = array(array('import_id' => $import->id
|
2227 |
$historyLogs = new PMXI_History_List();
|
2228 |
$historyLogs->setColumns('id', 'import_id', 'type', 'date')->getBy($by, 'id ASC');
|
2229 |
if ($historyLogs->count() and $historyLogs->count() >= $log_storage ){
|
@@ -2241,7 +2258,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
2241 |
'import_id' => $import->id,
|
2242 |
'date' => date('Y-m-d H:i:s'),
|
2243 |
'type' => ( PMXI_Plugin::$session->action != 'continue' ) ? 'manual' : 'continue',
|
2244 |
-
'summary' => sprintf(__("%d %
|
2245 |
))->save();
|
2246 |
|
2247 |
PMXI_Plugin::$session->set('history_id', $history_log->id);
|
@@ -2387,7 +2404,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
2387 |
|
2388 |
if ($ajax_processing)
|
2389 |
{
|
2390 |
-
$logger = function($m) {
|
2391 |
}
|
2392 |
else
|
2393 |
{
|
@@ -2825,8 +2842,15 @@ COMPLETE;
|
|
2825 |
|
2826 |
$keys_black_list = array('programurl');
|
2827 |
|
2828 |
-
|
|
|
|
|
|
|
|
|
|
|
2829 |
$uniqueKey = PMXI_Plugin::$session->options['title'];
|
|
|
|
|
2830 |
|
2831 |
// auto searching ID element
|
2832 |
if (!empty($this->data['dom']) and empty(PMXI_Plugin::$session->deligate)) {
|
254 |
$this->errors->add('form-validation', __('Certain columns are required to be present in your file to enable it to be re-imported with WP All Import. These columns are missing. Re-export your file using WP All Export, and don\'t delete any of the columns when editing it. Then, re-import will work correctly.', 'wp_all_import_plugin'));
|
255 |
}
|
256 |
elseif($importRecord->options['custom_type'] == 'import_users' && ! class_exists('PMUI_Plugin')){
|
257 |
+
$this->errors->add('form-validation', __('<p>The import template you are using requires the User Add-On.</p><a href="http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin" target="_blank">Purchase the User Add-On</a>', 'wp_all_import_plugin'));
|
258 |
}
|
259 |
+
elseif($importRecord->options['custom_type'] == 'shop_customer' && ! class_exists('PMUI_Plugin')){
|
260 |
+
$this->errors->add('form-validation', __('<p>The import template you are using requires the User Add-On.</p><a href="http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin" target="_blank">Purchase the User Add-On</a>', 'wp_all_import_plugin'));
|
261 |
+
}
|
262 |
|
263 |
break;
|
264 |
|
319 |
$dxpath = new DOMXPath($dom);
|
320 |
|
321 |
if (($elements = @$dxpath->query($xpath)) and $elements->length){
|
322 |
+
|
323 |
+
if ( empty($chunks) ) {
|
324 |
+
$chunks = 0;
|
325 |
+
}
|
326 |
+
|
327 |
+
$chunks += $elements->length;
|
328 |
+
|
329 |
+
unset($dom, $dxpath, $elements);
|
330 |
|
331 |
}
|
332 |
}
|
1097 |
$featured_image = $post[$get['slug'] . 'download_featured_image'];
|
1098 |
break;
|
1099 |
}
|
1100 |
+
|
1101 |
+
if (empty($featured_image)){
|
1102 |
+
$this->data['featured_images'] = '';
|
1103 |
+
}
|
1104 |
+
else{
|
1105 |
+
list($this->data['featured_images']) = XmlImportParser::factory($xml, $xpath, $featured_image, $file)->parse(); unlink($file);
|
1106 |
+
}
|
1107 |
}
|
1108 |
|
1109 |
} catch (XmlImportException $e) {
|
1483 |
if (!empty($post['title'])) {
|
1484 |
$this->_validate_template($post['title'], 'Post title');
|
1485 |
}
|
1486 |
+
elseif ( ! in_array($post['custom_type'], array('shop_order', 'import_users', 'shop_customer')) ){
|
1487 |
$this->warnings->add('1', __('<strong>Warning:</strong> your title is blank.', 'wp_all_import_plugin'));
|
1488 |
}
|
1489 |
|
1490 |
if (!empty($post['content'])) {
|
1491 |
$this->_validate_template($post['content'], 'Post content');
|
1492 |
}
|
1493 |
+
elseif ( ! in_array($post['custom_type'], array('shop_order', 'import_users', 'shop_customer')) ){
|
1494 |
$this->warnings->add('2', __('<strong>Warning:</strong> your content is blank.', 'wp_all_import_plugin'));
|
1495 |
}
|
1496 |
|
1617 |
|
1618 |
global $wpdb;
|
1619 |
|
1620 |
+
if ( ! in_array($post['custom_type'], array('import_users', 'shop_customer')) ){
|
1621 |
|
1622 |
// Get all meta keys for requested post type
|
1623 |
$this->data['meta_keys'] = array();
|
1799 |
} elseif (isset($mtch[3]) and intval($mtch[3]) > PMXI_Plugin::$session->count) {
|
1800 |
$this->errors->add('form-validation', __('One of the numbers in `Import only specified records` value exceeds record quantity in XML file', 'wp_all_import_plugin'));
|
1801 |
break;
|
1802 |
+
} elseif (preg_match('%^(\d+)-(\d+)$%', $chank, $mtch) && intval($mtch[1]) > intval($mtch[2])) {
|
1803 |
+
$this->errors->add('form-validation', __('Wrong format of `Import only specified records` value', 'wp_all_import_plugin'));
|
1804 |
+
}
|
1805 |
}
|
1806 |
}
|
1807 |
}
|
1808 |
if ('manual' != $post['duplicate_matching'] and '' == $post['unique_key']) {
|
1809 |
+
$this->errors->add('form-validation', __('Unique ID is currently empty and must be set. If you are not sure what to use as a Unique ID, click Auto-detect.', 'wp_all_import_plugin'));
|
1810 |
} elseif ('manual' != $post['duplicate_matching']) {
|
1811 |
$this->_validate_template($post['unique_key'], __('Post Unique Key', 'wp_all_import_plugin'));
|
1812 |
}
|
2103 |
|
2104 |
$this->data['existing_meta_keys'] = array();
|
2105 |
|
2106 |
+
if ( ! in_array($post['custom_type'], array('import_users', 'shop_customer'))){
|
2107 |
|
2108 |
global $wpdb;
|
2109 |
|
2240 |
|
2241 |
// unlink previous logs
|
2242 |
$by = array();
|
2243 |
+
$by[] = array(array('import_id' => $import->id), 'AND');
|
2244 |
$historyLogs = new PMXI_History_List();
|
2245 |
$historyLogs->setColumns('id', 'import_id', 'type', 'date')->getBy($by, 'id ASC');
|
2246 |
if ($historyLogs->count() and $historyLogs->count() >= $log_storage ){
|
2258 |
'import_id' => $import->id,
|
2259 |
'date' => date('Y-m-d H:i:s'),
|
2260 |
'type' => ( PMXI_Plugin::$session->action != 'continue' ) ? 'manual' : 'continue',
|
2261 |
+
'summary' => sprintf(__("%d %s created %d updated %d deleted %d skipped", "wp_all_import_plugin"), $import->created, ( ($import->created == 1) ? $custom_type->labels->singular_name : $custom_type->labels->name ), $import->updated, $import->deleted, $import->skipped)
|
2262 |
))->save();
|
2263 |
|
2264 |
PMXI_Plugin::$session->set('history_id', $history_log->id);
|
2404 |
|
2405 |
if ($ajax_processing)
|
2406 |
{
|
2407 |
+
$logger = function($m) {echo "<div class='progress-msg'>[". date("H:i:s") ."] $m</div>\n";flush();};
|
2408 |
}
|
2409 |
else
|
2410 |
{
|
2842 |
|
2843 |
$keys_black_list = array('programurl');
|
2844 |
|
2845 |
+
if ( empty(PMXI_Plugin::$session->deligate) ) {
|
2846 |
+
if (PMXI_Plugin::$session->options['custom_type'] == 'import_users') {
|
2847 |
+
$uniqueKey = PMXI_Plugin::$session->options['pmui']['login'];
|
2848 |
+
} elseif (PMXI_Plugin::$session->options['custom_type'] == 'shop_customer') {
|
2849 |
+
$uniqueKey = PMXI_Plugin::$session->options['pmsci_customer']['login'];
|
2850 |
+
} else {
|
2851 |
$uniqueKey = PMXI_Plugin::$session->options['title'];
|
2852 |
+
}
|
2853 |
+
}
|
2854 |
|
2855 |
// auto searching ID element
|
2856 |
if (!empty($this->data['dom']) and empty(PMXI_Plugin::$session->deligate)) {
|
controllers/admin/manage.php
CHANGED
@@ -83,7 +83,10 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
83 |
{
|
84 |
$import->deletePosts(false);
|
85 |
$options = $import->options;
|
|
|
|
|
86 |
$options['unique_key'] = '';
|
|
|
87 |
$import->set(array(
|
88 |
'options' => $options,
|
89 |
'imported' => 0,
|
@@ -94,9 +97,16 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
94 |
))->save();
|
95 |
}
|
96 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
wp_redirect(add_query_arg(array('id' => $import->id, 'action' => 'options'), $this->baseUrl)); die();
|
98 |
}
|
99 |
-
|
|
|
100 |
/**
|
101 |
* Edit Template
|
102 |
*/
|
@@ -407,7 +417,10 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
407 |
$dom->loadXML($xml); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
|
408 |
libxml_use_internal_errors($old);
|
409 |
$xpath = new DOMXPath($dom);
|
410 |
-
if (($elements = @$xpath->query($item->xpath)) and !empty($elements) and !empty($elements->length))
|
|
|
|
|
|
|
411 |
unset($dom, $xpath, $elements);
|
412 |
}
|
413 |
}
|
@@ -428,7 +441,8 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
428 |
$this->errors->add('root-element-validation', __('No matching elements found for Root element and XPath expression specified', 'wp_all_import_plugin'));
|
429 |
}
|
430 |
}
|
431 |
-
|
|
|
432 |
|
433 |
if ( $chunks ) { // xml is valid
|
434 |
|
@@ -520,7 +534,7 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
520 |
}
|
521 |
else
|
522 |
{
|
523 |
-
wp_redirect(add_query_arg(array('pmxi_nt' => urlencode(__('File does not
|
524 |
}
|
525 |
}
|
526 |
}
|
83 |
{
|
84 |
$import->deletePosts(false);
|
85 |
$options = $import->options;
|
86 |
+
if ( empty($import->options['custom_type']) || $import->options['custom_type'] != 'shop_order')
|
87 |
+
{
|
88 |
$options['unique_key'] = '';
|
89 |
+
}
|
90 |
$import->set(array(
|
91 |
'options' => $options,
|
92 |
'imported' => 0,
|
97 |
))->save();
|
98 |
}
|
99 |
}
|
100 |
+
if ( ! empty($import->options['custom_type']) && $import->options['custom_type'] == 'shop_order')
|
101 |
+
{
|
102 |
+
wp_redirect(add_query_arg(array('id' => $import->id, 'action' => 'edit'), $this->baseUrl)); die();
|
103 |
+
}
|
104 |
+
else
|
105 |
+
{
|
106 |
wp_redirect(add_query_arg(array('id' => $import->id, 'action' => 'options'), $this->baseUrl)); die();
|
107 |
}
|
108 |
+
}
|
109 |
+
|
110 |
/**
|
111 |
* Edit Template
|
112 |
*/
|
417 |
$dom->loadXML($xml); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
|
418 |
libxml_use_internal_errors($old);
|
419 |
$xpath = new DOMXPath($dom);
|
420 |
+
if (($elements = @$xpath->query($item->xpath)) and !empty($elements) and !empty($elements->length)){
|
421 |
+
$chunks += $elements->length;
|
422 |
+
}
|
423 |
+
|
424 |
unset($dom, $xpath, $elements);
|
425 |
}
|
426 |
}
|
441 |
$this->errors->add('root-element-validation', __('No matching elements found for Root element and XPath expression specified', 'wp_all_import_plugin'));
|
442 |
}
|
443 |
}
|
444 |
+
|
445 |
+
}
|
446 |
|
447 |
if ( $chunks ) { // xml is valid
|
448 |
|
534 |
}
|
535 |
else
|
536 |
{
|
537 |
+
wp_redirect(add_query_arg(array('pmxi_nt' => urlencode(__('File does not exist.', 'wp_all_import_plugin'))), $this->baseUrl)); die();
|
538 |
}
|
539 |
}
|
540 |
}
|
controllers/admin/settings.php
CHANGED
@@ -106,6 +106,7 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
106 |
else {
|
107 |
$import_data = @file_get_contents($tmp_name);
|
108 |
if (!empty($import_data)){
|
|
|
109 |
$templates_data = json_decode($import_data, true);
|
110 |
|
111 |
if ( ! empty($templates_data) ){
|
@@ -628,9 +629,9 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
628 |
$is_show_images_notice = false;
|
629 |
|
630 |
if ( $post_type != 'product' && (
|
631 |
-
$template[0]['options']['download_featured_image'] != '' ||
|
632 |
-
$template[0]['options']['gallery_featured_image'] != '' ||
|
633 |
-
$template[0]['options']['featured_image'] != ''))
|
634 |
{
|
635 |
$is_show_images_notice = true;
|
636 |
}
|
@@ -673,7 +674,19 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
673 |
case 'import_users':
|
674 |
|
675 |
if ( ! class_exists('PMUI_Plugin') ) {
|
676 |
-
$notice = __('<p class="wpallimport-bundle-notice">The import bundle you are using requires the User
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
677 |
}
|
678 |
|
679 |
break;
|
@@ -759,17 +772,18 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
759 |
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 102, "message" => $error_message), "is_valid" => false, "id" => "id")));
|
760 |
|
761 |
}
|
762 |
-
else
|
763 |
-
|
|
|
764 |
$wp_uploads = wp_upload_dir();
|
765 |
$uploads = $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::FILES_DIRECTORY . DIRECTORY_SEPARATOR;
|
766 |
-
|
767 |
-
|
|
|
768 |
}
|
769 |
-
}
|
770 |
-
|
771 |
}
|
772 |
-
|
773 |
}
|
774 |
|
775 |
// Return JSON-RPC response
|
106 |
else {
|
107 |
$import_data = @file_get_contents($tmp_name);
|
108 |
if (!empty($import_data)){
|
109 |
+
$import_data = str_replace("\xEF\xBB\xBF", '', $import_data);
|
110 |
$templates_data = json_decode($import_data, true);
|
111 |
|
112 |
if ( ! empty($templates_data) ){
|
629 |
$is_show_images_notice = false;
|
630 |
|
631 |
if ( $post_type != 'product' && (
|
632 |
+
isset($template[0]['options']['download_featured_image']) && $template[0]['options']['download_featured_image'] != '' ||
|
633 |
+
isset($template[0]['options']['gallery_featured_image']) && $template[0]['options']['gallery_featured_image'] != '' ||
|
634 |
+
isset($template[0]['options']['featured_image']) && $template[0]['options']['featured_image'] != ''))
|
635 |
{
|
636 |
$is_show_images_notice = true;
|
637 |
}
|
674 |
case 'import_users':
|
675 |
|
676 |
if ( ! class_exists('PMUI_Plugin') ) {
|
677 |
+
$notice = __('<p class="wpallimport-bundle-notice">The import bundle you are using requires the User Add-On.</p><a href="http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1" target="_blank" class="upgrade_link">Purchase the User Add-On</a>.', 'wp_all_import_plugin');
|
678 |
+
}
|
679 |
+
|
680 |
+
break;
|
681 |
+
|
682 |
+
|
683 |
+
case 'shop_customer':
|
684 |
+
|
685 |
+
if ( ! class_exists('WooCommerce') ) {
|
686 |
+
$notice = __('<p class="wpallimport-bundle-notice">The import bundle you are using requires WooCommerce.</p><a class="upgrade_link" href="https://wordpress.org/plugins/woocommerce/" target="_blank">Get WooCommerce</a>.', 'wp_all_import_plugin');
|
687 |
+
}
|
688 |
+
elseif ( ! class_exists('PMUI_Plugin') ) {
|
689 |
+
$notice = __('<p class="wpallimport-bundle-notice">The import bundle you are using requires the User Add-On.</p><p class="wpallimport-upgrade-links-container"><a href="http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1" target="_blank" class="upgrade_link">Purchase the User Add-On</a></p>', 'wp_all_import_plugin');
|
690 |
}
|
691 |
|
692 |
break;
|
772 |
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 102, "message" => $error_message), "is_valid" => false, "id" => "id")));
|
773 |
|
774 |
}
|
775 |
+
else {
|
776 |
+
$copyFileAllowed = apply_filters('wp_all_import_copy_uploaded_file_into_files_folder', true);
|
777 |
+
if ($copyFileAllowed) {
|
778 |
$wp_uploads = wp_upload_dir();
|
779 |
$uploads = $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::FILES_DIRECTORY . DIRECTORY_SEPARATOR;
|
780 |
+
if ( ! file_exists($uploads . basename($filePath))) {
|
781 |
+
@copy($filePath, $uploads . basename($filePath));
|
782 |
+
}
|
783 |
}
|
784 |
+
}
|
|
|
785 |
}
|
786 |
+
}
|
787 |
}
|
788 |
|
789 |
// Return JSON-RPC response
|
helpers/functions.php
CHANGED
@@ -103,7 +103,7 @@
|
|
103 |
$bn = wp_all_import_basename($filePath);
|
104 |
$type = (preg_match('%\W(csv|txt|dat|psv)$%i', $bn)) ? 'csv' : false;
|
105 |
if (!$type) $type = (preg_match('%\W(xml)$%i', $bn)) ? 'xml' : false;
|
106 |
-
|
107 |
if (!$type) $type = (preg_match('%\W(gz)$%i', $bn)) ? 'gz' : false;
|
108 |
|
109 |
if(!$type){
|
103 |
$bn = wp_all_import_basename($filePath);
|
104 |
$type = (preg_match('%\W(csv|txt|dat|psv)$%i', $bn)) ? 'csv' : false;
|
105 |
if (!$type) $type = (preg_match('%\W(xml)$%i', $bn)) ? 'xml' : false;
|
106 |
+
if (!$type) $type = (preg_match('%\W(zip)$%i', $bn)) || (preg_match('%\W(get_bundle)$%i', $bn) && strpos($bn, 'export_id') !== false && strpos($bn, 'security_token') !== false) ? 'zip' : false;
|
107 |
if (!$type) $type = (preg_match('%\W(gz)$%i', $bn)) ? 'gz' : false;
|
108 |
|
109 |
if(!$type){
|
helpers/get_file_curl.php
CHANGED
@@ -4,7 +4,7 @@ if ( ! function_exists('get_file_curl') ):
|
|
4 |
|
5 |
function get_file_curl($url, $fullpath, $to_variable = false, $iteration = false) {
|
6 |
|
7 |
-
if ( ! preg_match('%^(http|ftp)s?://%i', $url) ) return;
|
8 |
|
9 |
$response = wp_remote_get($url);
|
10 |
|
@@ -75,7 +75,6 @@ if ( ! function_exists('pmxi_curl_download') ) {
|
|
75 |
|
76 |
$ch = curl_init($url);
|
77 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
78 |
-
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
|
79 |
$rawdata = curl_exec_follow($ch);
|
80 |
|
81 |
$result = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
@@ -142,7 +141,7 @@ if ( ! function_exists('curl_exec_follow') ):
|
|
142 |
curl_setopt($rch, CURLOPT_HEADER, true);
|
143 |
curl_setopt($rch, CURLOPT_NOBODY, true);
|
144 |
curl_setopt($rch, CURLOPT_FORBID_REUSE, false);
|
145 |
-
|
146 |
do
|
147 |
{
|
148 |
curl_setopt($rch, CURLOPT_URL, $newurl);
|
4 |
|
5 |
function get_file_curl($url, $fullpath, $to_variable = false, $iteration = false) {
|
6 |
|
7 |
+
if ( ! preg_match('%^(http|ftp)s?://%i', $url) ) return false;
|
8 |
|
9 |
$response = wp_remote_get($url);
|
10 |
|
75 |
|
76 |
$ch = curl_init($url);
|
77 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
78 |
$rawdata = curl_exec_follow($ch);
|
79 |
|
80 |
$result = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
141 |
curl_setopt($rch, CURLOPT_HEADER, true);
|
142 |
curl_setopt($rch, CURLOPT_NOBODY, true);
|
143 |
curl_setopt($rch, CURLOPT_FORBID_REUSE, false);
|
144 |
+
|
145 |
do
|
146 |
{
|
147 |
curl_setopt($rch, CURLOPT_URL, $newurl);
|
helpers/wp_all_import_addon_notifications.php
CHANGED
@@ -38,7 +38,8 @@ if ( ! function_exists('wp_all_import_addon_notifications') ){
|
|
38 |
and is_wp_error(validate_plugin('wp-job-manager-xml-csv-listings-import/wp-job-manager-add-on.php'))
|
39 |
and ! in_array('Listify', $current_themes)
|
40 |
and ! in_array('Jobify', $current_themes)
|
41 |
-
and ! in_array('Listable', $current_themes)
|
|
|
42 |
{
|
43 |
$recommended_addons[] = array(
|
44 |
'title' => 'WP Job Manager',
|
38 |
and is_wp_error(validate_plugin('wp-job-manager-xml-csv-listings-import/wp-job-manager-add-on.php'))
|
39 |
and ! in_array('Listify', $current_themes)
|
40 |
and ! in_array('Jobify', $current_themes)
|
41 |
+
and ! in_array('Listable', $current_themes)
|
42 |
+
and ! in_array('My Listing', $current_themes) )
|
43 |
{
|
44 |
$recommended_addons[] = array(
|
45 |
'title' => 'WP Job Manager',
|
helpers/wp_all_import_get_image_from_gallery.php
CHANGED
@@ -2,6 +2,11 @@
|
|
2 |
|
3 |
function wp_all_import_get_image_from_gallery($image_name, $targetDir = FALSE, $bundle_type = 'images', $logger = false) {
|
4 |
|
|
|
|
|
|
|
|
|
|
|
5 |
global $wpdb;
|
6 |
|
7 |
$original_image_name = $image_name;
|
@@ -41,32 +46,14 @@ function wp_all_import_get_image_from_gallery($image_name, $targetDir = FALSE, $
|
|
41 |
}
|
42 |
|
43 |
if (empty($attch)) {
|
44 |
-
|
45 |
-
|
46 |
-
if (!empty($
|
47 |
-
|
48 |
-
$attch = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->posts . " WHERE (post_title = %s OR post_title = %s OR post_name = %s) AND post_type = %s AND post_mime_type = %s;", $image_name, preg_replace('/\\.[^.\\s]{3,4}$/', '', $image_name), sanitize_title($image_name), "attachment", $wp_filetype['type']));
|
49 |
-
}
|
50 |
-
|
51 |
-
if (!empty($attch)){
|
52 |
-
$logger and call_user_func($logger, sprintf(__('- Found existing image with ID `%s` by post_title or post_name equals to `%s`...', 'wp_all_import_plugin'), $attch->ID, preg_replace('/\\.[^.\\s]{3,4}$/', '', $image_name)));
|
53 |
-
}
|
54 |
-
|
55 |
-
// search attachment by file name without extension
|
56 |
-
if (empty($attch) and !empty($wp_filetype['type'])) {
|
57 |
-
$attachment_title = explode(".", $image_name);
|
58 |
-
if (is_array($attachment_title) and count($attachment_title) > 1) {
|
59 |
-
array_pop($attachment_title);
|
60 |
-
}
|
61 |
-
$image_name = implode(".", $attachment_title);
|
62 |
-
$attch = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->posts . " WHERE (post_title = %s OR post_title = %s OR post_name = %s) AND post_type = %s AND post_mime_type LIKE %s;", $image_name, preg_replace('/\\.[^.\\s]{3,4}$/', '', $image_name), sanitize_title($image_name), "attachment", $wp_filetype['type']));
|
63 |
-
if (!empty($attch)){
|
64 |
-
$logger and call_user_func($logger, sprintf(__('- Found existing image with ID `%s` by post_title or post_name equals to `%s`...', 'wp_all_import_plugin'), $attch->ID, preg_replace('/\\.[^.\\s]{3,4}$/', '', $image_name)));
|
65 |
-
}
|
66 |
}
|
67 |
}
|
68 |
|
69 |
-
//
|
70 |
if (empty($attch) and @file_exists($targetDir . DIRECTORY_SEPARATOR . $original_image_name)) {
|
71 |
if ($bundle_type == 'images' and ($img_meta = wp_read_image_metadata($targetDir . DIRECTORY_SEPARATOR . $original_image_name))) {
|
72 |
if (trim($img_meta['title']) && !is_numeric(sanitize_title($img_meta['title']))) {
|
@@ -77,7 +64,7 @@ function wp_all_import_get_image_from_gallery($image_name, $targetDir = FALSE, $
|
|
77 |
}
|
78 |
}
|
79 |
}
|
80 |
-
if (empty($attch)){
|
81 |
@unlink($targetDir . DIRECTORY_SEPARATOR . $original_image_name);
|
82 |
}
|
83 |
}
|
2 |
|
3 |
function wp_all_import_get_image_from_gallery($image_name, $targetDir = FALSE, $bundle_type = 'images', $logger = false) {
|
4 |
|
5 |
+
$search_image_by_wp_attached_file = apply_filters('wp_all_import_search_image_by_wp_attached_file', true);
|
6 |
+
if (!$search_image_by_wp_attached_file){
|
7 |
+
return false;
|
8 |
+
}
|
9 |
+
|
10 |
global $wpdb;
|
11 |
|
12 |
$original_image_name = $image_name;
|
46 |
}
|
47 |
|
48 |
if (empty($attch)) {
|
49 |
+
// Search attachment by file name with extension.
|
50 |
+
$attch = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->posts . " WHERE (post_title = %s OR post_name = %s) AND post_type = %s", $image_name, sanitize_title($image_name), "attachment") . " AND post_mime_type LIKE 'image%';");
|
51 |
+
if (!empty($attch)) {
|
52 |
+
$logger and call_user_func($logger, sprintf(__('- Found existing image with ID `%s` by post_title or post_name equals to `%s`...', 'wp_all_import_plugin'), $attch->ID, $image_name));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
}
|
54 |
}
|
55 |
|
56 |
+
// Search attachment by file headers.
|
57 |
if (empty($attch) and @file_exists($targetDir . DIRECTORY_SEPARATOR . $original_image_name)) {
|
58 |
if ($bundle_type == 'images' and ($img_meta = wp_read_image_metadata($targetDir . DIRECTORY_SEPARATOR . $original_image_name))) {
|
59 |
if (trim($img_meta['title']) && !is_numeric(sanitize_title($img_meta['title']))) {
|
64 |
}
|
65 |
}
|
66 |
}
|
67 |
+
if (empty($attch)) {
|
68 |
@unlink($targetDir . DIRECTORY_SEPARATOR . $original_image_name);
|
69 |
}
|
70 |
}
|
helpers/wp_all_import_template_notifications.php
CHANGED
@@ -20,8 +20,15 @@ if ( ! function_exists('wp_all_import_template_notifications') )
|
|
20 |
|
21 |
if ( $post['custom_type'] == 'import_users' && ! class_exists('PMUI_Plugin') )
|
22 |
{
|
23 |
-
$notifications[] = __('The import template you are using requires the User
|
24 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
elseif ( $post['custom_type'] == 'product' && ! class_exists('PMWI_Plugin') && class_exists( 'Woocommerce' ))
|
26 |
{
|
27 |
$notifications[] = __('The import template you are using requires the WooCommerce Import Add-On. If you continue without it your data may import incorrectly.<br/><br/><a href="http://www.wpallimport.com/woocommerce-product-import/" target="_blank">Purchase the WooCommerce Import Add-On</a>.', 'wp_all_import_plugin');
|
20 |
|
21 |
if ( $post['custom_type'] == 'import_users' && ! class_exists('PMUI_Plugin') )
|
22 |
{
|
23 |
+
$notifications[] = __('The import template you are using requires the User Add-On. If you continue without it your data may import incorrectly.<br/><br/><a href="http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin" target="_blank">Purchase the User Add-On</a>.', 'wp_all_import_plugin');
|
24 |
}
|
25 |
+
|
26 |
+
if ( $post['custom_type'] == 'shop_customer' && ! class_exists('PMUI_Plugin') )
|
27 |
+
{
|
28 |
+
$notifications[] = __('The import template you are using requires the User Add-On. If you continue without having this add-on active, your data may import incorrectly.<br/><br/><a href="http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin" target="_blank">Purchase the User Add-On</a>.', 'wp_all_import_plugin');
|
29 |
+
}
|
30 |
+
|
31 |
+
|
32 |
elseif ( $post['custom_type'] == 'product' && ! class_exists('PMWI_Plugin') && class_exists( 'Woocommerce' ))
|
33 |
{
|
34 |
$notifications[] = __('The import template you are using requires the WooCommerce Import Add-On. If you continue without it your data may import incorrectly.<br/><br/><a href="http://www.wpallimport.com/woocommerce-product-import/" target="_blank">Purchase the WooCommerce Import Add-On</a>.', 'wp_all_import_plugin');
|
i18n/languages/wp_all_import_plugin-de_CH.po
CHANGED
@@ -154,7 +154,7 @@ msgstr ""
|
|
154 |
|
155 |
#: actions/wp_ajax_get_bundle_post_type.php:94
|
156 |
#: actions/wp_ajax_upload_resource.php:162 controllers/admin/settings.php:631
|
157 |
-
msgid "<p class=\"wpallimport-bundle-notice\">The import bundle you are using requires the User
|
158 |
msgstr ""
|
159 |
|
160 |
#: actions/wp_ajax_nested_xpath.php:51
|
@@ -210,11 +210,11 @@ msgid "Image `%s` not found in media library."
|
|
210 |
msgstr "Das Bild `%s` wurde in der Medienbibliothek nicht gefunden."
|
211 |
|
212 |
#: actions/wp_ajax_test_images.php:102
|
213 |
-
msgid "%d image was successfully
|
214 |
msgstr "%d wurde erfolgreich in zur Galerie hinzu gefügt"
|
215 |
|
216 |
#: actions/wp_ajax_test_images.php:106
|
217 |
-
msgid "%d images were successfully
|
218 |
msgstr "%d Bilder wurden erfolgreich zur Galerie hinzu gefügt"
|
219 |
|
220 |
#: actions/wp_ajax_test_images.php:120
|
@@ -680,8 +680,8 @@ msgid "Certain columns are required to be present in your file to enable it to b
|
|
680 |
msgstr "Bestimmte Spalten werden benötigt um erneut importiert werden zu können mit WP All Import. Diese Spalten fehlen. Exportieren Sie Ihre Datei erneut mit WP All Export. Löschen Sie dabei keine Spalte, dann wird der erneute Import korrekt funktionieren."
|
681 |
|
682 |
#: controllers/admin/import.php:309
|
683 |
-
msgid "The import template you are using requires User
|
684 |
-
msgstr "Die Import Vorlage die Sie benutzen, benötigt das Benutzer Import Add-on.<br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">User
|
685 |
|
686 |
#: controllers/admin/import.php:384
|
687 |
msgid "Unable to download feed resource."
|
@@ -1108,7 +1108,7 @@ msgid "The import template you are using requires the %s. If you continue withou
|
|
1108 |
msgstr ""
|
1109 |
|
1110 |
#: helpers/wp_all_import_template_notifications.php:23
|
1111 |
-
msgid "The import template you are using requires the User
|
1112 |
msgstr "Die Import Vorlage die sie benutzen, benötigt das Benutzer Import Add-on. Wenn Sie ohne fortfahren, könnten Ihre Daten nicht korrekt importiert werden.<br/><br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Benutzer Import Add-On hier kaufen</a>."
|
1113 |
|
1114 |
#: helpers/wp_all_import_template_notifications.php:27
|
@@ -2416,12 +2416,12 @@ msgstr ""
|
|
2416 |
|
2417 |
#: views/admin/import/index.php:309
|
2418 |
#: views/admin/import/options/_settings_template.php:151
|
2419 |
-
msgid "The User
|
2420 |
msgstr ""
|
2421 |
|
2422 |
#: views/admin/import/index.php:310
|
2423 |
#: views/admin/import/options/_settings_template.php:152
|
2424 |
-
msgid "Purchase the User
|
2425 |
msgstr ""
|
2426 |
|
2427 |
#: views/admin/import/index.php:315
|
154 |
|
155 |
#: actions/wp_ajax_get_bundle_post_type.php:94
|
156 |
#: actions/wp_ajax_upload_resource.php:162 controllers/admin/settings.php:631
|
157 |
+
msgid "<p class=\"wpallimport-bundle-notice\">The import bundle you are using requires the User Add-On.</p><a href=\"http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1\" target=\"_blank\" class=\"upgrade_link\">Purchase the User Add-On</a>."
|
158 |
msgstr ""
|
159 |
|
160 |
#: actions/wp_ajax_nested_xpath.php:51
|
210 |
msgstr "Das Bild `%s` wurde in der Medienbibliothek nicht gefunden."
|
211 |
|
212 |
#: actions/wp_ajax_test_images.php:102
|
213 |
+
msgid "%d image was successfully found in media gallery"
|
214 |
msgstr "%d wurde erfolgreich in zur Galerie hinzu gefügt"
|
215 |
|
216 |
#: actions/wp_ajax_test_images.php:106
|
217 |
+
msgid "%d images were successfully found in media gallery"
|
218 |
msgstr "%d Bilder wurden erfolgreich zur Galerie hinzu gefügt"
|
219 |
|
220 |
#: actions/wp_ajax_test_images.php:120
|
680 |
msgstr "Bestimmte Spalten werden benötigt um erneut importiert werden zu können mit WP All Import. Diese Spalten fehlen. Exportieren Sie Ihre Datei erneut mit WP All Export. Löschen Sie dabei keine Spalte, dann wird der erneute Import korrekt funktionieren."
|
681 |
|
682 |
#: controllers/admin/import.php:309
|
683 |
+
msgid "The import template you are using requires the User Add-On.<br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Purchase the User Add-On</a>"
|
684 |
+
msgstr "Die Import Vorlage die Sie benutzen, benötigt das Benutzer Import Add-on.<br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Purchase the User Add-On kaufen</a>"
|
685 |
|
686 |
#: controllers/admin/import.php:384
|
687 |
msgid "Unable to download feed resource."
|
1108 |
msgstr ""
|
1109 |
|
1110 |
#: helpers/wp_all_import_template_notifications.php:23
|
1111 |
+
msgid "The import template you are using requires the User Add-On. If you continue without it your data may import incorrectly.<br/><br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Purchase the User Add-On</a>."
|
1112 |
msgstr "Die Import Vorlage die sie benutzen, benötigt das Benutzer Import Add-on. Wenn Sie ohne fortfahren, könnten Ihre Daten nicht korrekt importiert werden.<br/><br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Benutzer Import Add-On hier kaufen</a>."
|
1113 |
|
1114 |
#: helpers/wp_all_import_template_notifications.php:27
|
2416 |
|
2417 |
#: views/admin/import/index.php:309
|
2418 |
#: views/admin/import/options/_settings_template.php:151
|
2419 |
+
msgid "The User Add-On is Required to Import Users"
|
2420 |
msgstr ""
|
2421 |
|
2422 |
#: views/admin/import/index.php:310
|
2423 |
#: views/admin/import/options/_settings_template.php:152
|
2424 |
+
msgid "Purchase the User Add-On"
|
2425 |
msgstr ""
|
2426 |
|
2427 |
#: views/admin/import/index.php:315
|
i18n/languages/wp_all_import_plugin-de_DE.po
CHANGED
@@ -154,7 +154,7 @@ msgstr ""
|
|
154 |
|
155 |
#: actions/wp_ajax_get_bundle_post_type.php:94
|
156 |
#: actions/wp_ajax_upload_resource.php:162 controllers/admin/settings.php:631
|
157 |
-
msgid "<p class=\"wpallimport-bundle-notice\">The import bundle you are using requires the User
|
158 |
msgstr ""
|
159 |
|
160 |
#: actions/wp_ajax_nested_xpath.php:51
|
@@ -210,11 +210,11 @@ msgid "Image `%s` not found in media library."
|
|
210 |
msgstr ""
|
211 |
|
212 |
#: actions/wp_ajax_test_images.php:102
|
213 |
-
msgid "%d image was successfully
|
214 |
msgstr ""
|
215 |
|
216 |
#: actions/wp_ajax_test_images.php:106
|
217 |
-
msgid "%d images were successfully
|
218 |
msgstr ""
|
219 |
|
220 |
#: actions/wp_ajax_test_images.php:120
|
@@ -680,8 +680,8 @@ msgid "Certain columns are required to be present in your file to enable it to b
|
|
680 |
msgstr "Bestimmte Spalten werden benötigt um erneut importiert werden zu können mit WP All Import. Diese Spalten fehlen. Exportieren Sie Ihre Datei erneut mit WP All Export. Löschen Sie dabei keine Spalte, dann wird der erneute Import korrekt funktionieren."
|
681 |
|
682 |
#: controllers/admin/import.php:309
|
683 |
-
msgid "The import template you are using requires User
|
684 |
-
msgstr "Die Import Vorlage die Sie benutzen, benötigt das Benutzer Import Add-on.<br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">User
|
685 |
|
686 |
#: controllers/admin/import.php:384
|
687 |
msgid "Unable to download feed resource."
|
@@ -1106,7 +1106,7 @@ msgid "The import template you are using requires the %s. If you continue withou
|
|
1106 |
msgstr ""
|
1107 |
|
1108 |
#: helpers/wp_all_import_template_notifications.php:23
|
1109 |
-
msgid "The import template you are using requires the User
|
1110 |
msgstr "Die Import Vorlage die sie benutzen, benötigt das Benutzer Import Add-on. Wenn Sie ohne fortfahren, könnten Ihre Daten nicht korrekt importiert werden.<br/><br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Benutzer Import Add-On hier kaufen</a>."
|
1111 |
|
1112 |
#: helpers/wp_all_import_template_notifications.php:27
|
@@ -2414,12 +2414,12 @@ msgstr ""
|
|
2414 |
|
2415 |
#: views/admin/import/index.php:309
|
2416 |
#: views/admin/import/options/_settings_template.php:151
|
2417 |
-
msgid "The User
|
2418 |
msgstr ""
|
2419 |
|
2420 |
#: views/admin/import/index.php:310
|
2421 |
#: views/admin/import/options/_settings_template.php:152
|
2422 |
-
msgid "Purchase the User
|
2423 |
msgstr ""
|
2424 |
|
2425 |
#: views/admin/import/index.php:315
|
154 |
|
155 |
#: actions/wp_ajax_get_bundle_post_type.php:94
|
156 |
#: actions/wp_ajax_upload_resource.php:162 controllers/admin/settings.php:631
|
157 |
+
msgid "<p class=\"wpallimport-bundle-notice\">The import bundle you are using requires the User Add-On.</p><a href=\"http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1\" target=\"_blank\" class=\"upgrade_link\">Purchase the User Add-On</a>."
|
158 |
msgstr ""
|
159 |
|
160 |
#: actions/wp_ajax_nested_xpath.php:51
|
210 |
msgstr ""
|
211 |
|
212 |
#: actions/wp_ajax_test_images.php:102
|
213 |
+
msgid "%d image was successfully found in media gallery"
|
214 |
msgstr ""
|
215 |
|
216 |
#: actions/wp_ajax_test_images.php:106
|
217 |
+
msgid "%d images were successfully found in media gallery"
|
218 |
msgstr ""
|
219 |
|
220 |
#: actions/wp_ajax_test_images.php:120
|
680 |
msgstr "Bestimmte Spalten werden benötigt um erneut importiert werden zu können mit WP All Import. Diese Spalten fehlen. Exportieren Sie Ihre Datei erneut mit WP All Export. Löschen Sie dabei keine Spalte, dann wird der erneute Import korrekt funktionieren."
|
681 |
|
682 |
#: controllers/admin/import.php:309
|
683 |
+
msgid "The import template you are using requires the User Add-On.<br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Purchase the User Add-On</a>"
|
684 |
+
msgstr "Die Import Vorlage die Sie benutzen, benötigt das Benutzer Import Add-on.<br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Purchase the User Add-On kaufen</a>"
|
685 |
|
686 |
#: controllers/admin/import.php:384
|
687 |
msgid "Unable to download feed resource."
|
1106 |
msgstr ""
|
1107 |
|
1108 |
#: helpers/wp_all_import_template_notifications.php:23
|
1109 |
+
msgid "The import template you are using requires the User Add-On. If you continue without it your data may import incorrectly.<br/><br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Purchase the User Add-On</a>."
|
1110 |
msgstr "Die Import Vorlage die sie benutzen, benötigt das Benutzer Import Add-on. Wenn Sie ohne fortfahren, könnten Ihre Daten nicht korrekt importiert werden.<br/><br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Benutzer Import Add-On hier kaufen</a>."
|
1111 |
|
1112 |
#: helpers/wp_all_import_template_notifications.php:27
|
2414 |
|
2415 |
#: views/admin/import/index.php:309
|
2416 |
#: views/admin/import/options/_settings_template.php:151
|
2417 |
+
msgid "The User Add-On is Required to Import Users"
|
2418 |
msgstr ""
|
2419 |
|
2420 |
#: views/admin/import/index.php:310
|
2421 |
#: views/admin/import/options/_settings_template.php:152
|
2422 |
+
msgid "Purchase the User Add-On"
|
2423 |
msgstr ""
|
2424 |
|
2425 |
#: views/admin/import/index.php:315
|
i18n/languages/wp_all_import_plugin-es_ES.po
CHANGED
@@ -154,7 +154,7 @@ msgstr ""
|
|
154 |
|
155 |
#: actions/wp_ajax_get_bundle_post_type.php:94
|
156 |
#: actions/wp_ajax_upload_resource.php:162 controllers/admin/settings.php:631
|
157 |
-
msgid "<p class=\"wpallimport-bundle-notice\">The import bundle you are using requires the User
|
158 |
msgstr ""
|
159 |
|
160 |
#: actions/wp_ajax_nested_xpath.php:51
|
@@ -210,11 +210,11 @@ msgid "Image `%s` not found in media library."
|
|
210 |
msgstr ""
|
211 |
|
212 |
#: actions/wp_ajax_test_images.php:102
|
213 |
-
msgid "%d image was successfully
|
214 |
msgstr ""
|
215 |
|
216 |
#: actions/wp_ajax_test_images.php:106
|
217 |
-
msgid "%d images were successfully
|
218 |
msgstr ""
|
219 |
|
220 |
#: actions/wp_ajax_test_images.php:120
|
@@ -680,8 +680,8 @@ msgid "Certain columns are required to be present in your file to enable it to b
|
|
680 |
msgstr "Ciertas columnas requieren de estar presentes en su archivo para habilitar la re-importación con WP All Import. Estas columnas están faltantes. Re-exporte su archivo utilizando WP All Export y no elimine ninguna de las columnas mientras lo esta editando. Entonces el re-importe funcionara correctamente."
|
681 |
|
682 |
#: controllers/admin/import.php:309
|
683 |
-
msgid "The import template you are using requires User
|
684 |
-
msgstr "La plantilla de importación que esta utilizando requiere el User
|
685 |
|
686 |
#: controllers/admin/import.php:384
|
687 |
msgid "Unable to download feed resource."
|
@@ -1106,8 +1106,8 @@ msgid "The import template you are using requires the %s. If you continue withou
|
|
1106 |
msgstr ""
|
1107 |
|
1108 |
#: helpers/wp_all_import_template_notifications.php:23
|
1109 |
-
msgid "The import template you are using requires the User
|
1110 |
-
msgstr "La plantilla de importación que esta utilizando requiere el User
|
1111 |
|
1112 |
#: helpers/wp_all_import_template_notifications.php:27
|
1113 |
msgid "The import template you are using requires the WooCommerce Import Add-On. If you continue without it your data may import incorrectly.<br/><br/><a href=\"http://www.wpallimport.com/woocommerce-product-import/\" target=\"_blank\">Purchase the WooCommerce Import Add-On</a>."
|
@@ -2414,12 +2414,12 @@ msgstr ""
|
|
2414 |
|
2415 |
#: views/admin/import/index.php:309
|
2416 |
#: views/admin/import/options/_settings_template.php:151
|
2417 |
-
msgid "The User
|
2418 |
msgstr ""
|
2419 |
|
2420 |
#: views/admin/import/index.php:310
|
2421 |
#: views/admin/import/options/_settings_template.php:152
|
2422 |
-
msgid "Purchase the User
|
2423 |
msgstr ""
|
2424 |
|
2425 |
#: views/admin/import/index.php:315
|
154 |
|
155 |
#: actions/wp_ajax_get_bundle_post_type.php:94
|
156 |
#: actions/wp_ajax_upload_resource.php:162 controllers/admin/settings.php:631
|
157 |
+
msgid "<p class=\"wpallimport-bundle-notice\">The import bundle you are using requires the User Add-On.</p><a href=\"http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1\" target=\"_blank\" class=\"upgrade_link\">Purchase the User Add-On</a>."
|
158 |
msgstr ""
|
159 |
|
160 |
#: actions/wp_ajax_nested_xpath.php:51
|
210 |
msgstr ""
|
211 |
|
212 |
#: actions/wp_ajax_test_images.php:102
|
213 |
+
msgid "%d image was successfully found in media gallery"
|
214 |
msgstr ""
|
215 |
|
216 |
#: actions/wp_ajax_test_images.php:106
|
217 |
+
msgid "%d images were successfully found in media gallery"
|
218 |
msgstr ""
|
219 |
|
220 |
#: actions/wp_ajax_test_images.php:120
|
680 |
msgstr "Ciertas columnas requieren de estar presentes en su archivo para habilitar la re-importación con WP All Import. Estas columnas están faltantes. Re-exporte su archivo utilizando WP All Export y no elimine ninguna de las columnas mientras lo esta editando. Entonces el re-importe funcionara correctamente."
|
681 |
|
682 |
#: controllers/admin/import.php:309
|
683 |
+
msgid "The import template you are using requires the User Add-On.<br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Purchase the User Add-On</a>"
|
684 |
+
msgstr "La plantilla de importación que esta utilizando requiere el User Add-On.<br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Compre el User Add-On</a>"
|
685 |
|
686 |
#: controllers/admin/import.php:384
|
687 |
msgid "Unable to download feed resource."
|
1106 |
msgstr ""
|
1107 |
|
1108 |
#: helpers/wp_all_import_template_notifications.php:23
|
1109 |
+
msgid "The import template you are using requires the User Add-On. If you continue without it your data may import incorrectly.<br/><br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Purchase the User Add-On</a>."
|
1110 |
+
msgstr "La plantilla de importación que esta utilizando requiere el User Add-On. Si continua sin el, su información puede importarse incorrectamente.<br/><br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Comprar el User Add-On</a>."
|
1111 |
|
1112 |
#: helpers/wp_all_import_template_notifications.php:27
|
1113 |
msgid "The import template you are using requires the WooCommerce Import Add-On. If you continue without it your data may import incorrectly.<br/><br/><a href=\"http://www.wpallimport.com/woocommerce-product-import/\" target=\"_blank\">Purchase the WooCommerce Import Add-On</a>."
|
2414 |
|
2415 |
#: views/admin/import/index.php:309
|
2416 |
#: views/admin/import/options/_settings_template.php:151
|
2417 |
+
msgid "The User Add-On is Required to Import Users"
|
2418 |
msgstr ""
|
2419 |
|
2420 |
#: views/admin/import/index.php:310
|
2421 |
#: views/admin/import/options/_settings_template.php:152
|
2422 |
+
msgid "Purchase the User Add-On"
|
2423 |
msgstr ""
|
2424 |
|
2425 |
#: views/admin/import/index.php:315
|
i18n/languages/wp_all_import_plugin-hu_HU.po
CHANGED
@@ -161,7 +161,7 @@ msgstr "<p class=\"wpallimport-bundle-notice\">Az import köteg használata megk
|
|
161 |
|
162 |
#: actions/wp_ajax_get_bundle_post_type.php:94
|
163 |
#: actions/wp_ajax_upload_resource.php:162 controllers/admin/settings.php:631
|
164 |
-
msgid "<p class=\"wpallimport-bundle-notice\">The import bundle you are using requires the User
|
165 |
msgstr "<p class=\"wpallimport-bundle-notice\">Az import köteg használata megköveteli, a Import Add-On felhasználó használatát.</p><a href=\"http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1\" target=\"_blank\" class=\"upgrade_link\">A felhasználó Import Add-On megvásárlása</a>. "
|
166 |
|
167 |
#: actions/wp_ajax_nested_xpath.php:51
|
@@ -219,11 +219,11 @@ msgid "Image `%s` not found in media library."
|
|
219 |
msgstr "Kép %-a nem található a média könyvtárban!"
|
220 |
|
221 |
#: actions/wp_ajax_test_images.php:102
|
222 |
-
msgid "%d image was successfully
|
223 |
msgstr "%d képet sikeresen megtalálta a médiagalériában"
|
224 |
|
225 |
#: actions/wp_ajax_test_images.php:106
|
226 |
-
msgid "%d images were successfully
|
227 |
msgstr "%d képeket sikeresen megtalálta a médiagalériában"
|
228 |
|
229 |
#: actions/wp_ajax_test_images.php:120
|
@@ -700,7 +700,7 @@ msgid "Certain columns are required to be present in your file to enable it to b
|
|
700 |
msgstr "Egyes oszlopok szükségesek, hogy jelen legyenek a fájlban, amely lehetővé teszi, hogy újra importálják a WP Minden Importtal. Ezek az oszlopok hiányoznak. Az újra exportált fájlt használja a WP Minden Exportot, és ne törölje az oszlopokat szerkesztése során. Ez után újra importálás helyesen fog működni."
|
701 |
|
702 |
#: controllers/admin/import.php:309
|
703 |
-
msgid "The import template you are using requires User
|
704 |
msgstr "Az import sablon használata megköveteli Felhasználó Import Add-On használatát.<br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Vásároljon a Felhasználó Import Add-On-t</a> "
|
705 |
|
706 |
#: controllers/admin/import.php:384
|
@@ -1132,7 +1132,7 @@ msgid "The import template you are using requires the %s. If you continue withou
|
|
1132 |
msgstr "Az import sablon használatát megköveteli a %s. Ha enélkül folytatja, az adatait helytelenül importálja. <br/> <a Href=\"%s\" target=\"_blank\">"
|
1133 |
|
1134 |
#: helpers/wp_all_import_template_notifications.php:23
|
1135 |
-
msgid "The import template you are using requires the User
|
1136 |
msgstr "Az import sablon használatát megköveteli a felhasználó Import Add-On. Ha enélkül folytatja, az adatait helytelenül importálja. <br/><br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Vásároljon Felhasználó Import Add-On-t</a>. "
|
1137 |
|
1138 |
#: helpers/wp_all_import_template_notifications.php:27
|
@@ -2447,12 +2447,12 @@ msgstr "Taxonómia kiválasztása"
|
|
2447 |
|
2448 |
#: views/admin/import/index.php:309
|
2449 |
#: views/admin/import/options/_settings_template.php:151
|
2450 |
-
msgid "The User
|
2451 |
msgstr "A felhasználó Import Add-On megköveteli a felhasználók importálását"
|
2452 |
|
2453 |
#: views/admin/import/index.php:310
|
2454 |
#: views/admin/import/options/_settings_template.php:152
|
2455 |
-
msgid "Purchase the User
|
2456 |
msgstr "Vedd meg a felhasználó Import Add-On-t"
|
2457 |
|
2458 |
#: views/admin/import/index.php:315
|
161 |
|
162 |
#: actions/wp_ajax_get_bundle_post_type.php:94
|
163 |
#: actions/wp_ajax_upload_resource.php:162 controllers/admin/settings.php:631
|
164 |
+
msgid "<p class=\"wpallimport-bundle-notice\">The import bundle you are using requires the User Add-On.</p><a href=\"http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1\" target=\"_blank\" class=\"upgrade_link\">Purchase the User Add-On</a>."
|
165 |
msgstr "<p class=\"wpallimport-bundle-notice\">Az import köteg használata megköveteli, a Import Add-On felhasználó használatát.</p><a href=\"http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1\" target=\"_blank\" class=\"upgrade_link\">A felhasználó Import Add-On megvásárlása</a>. "
|
166 |
|
167 |
#: actions/wp_ajax_nested_xpath.php:51
|
219 |
msgstr "Kép %-a nem található a média könyvtárban!"
|
220 |
|
221 |
#: actions/wp_ajax_test_images.php:102
|
222 |
+
msgid "%d image was successfully found in media gallery"
|
223 |
msgstr "%d képet sikeresen megtalálta a médiagalériában"
|
224 |
|
225 |
#: actions/wp_ajax_test_images.php:106
|
226 |
+
msgid "%d images were successfully found in media gallery"
|
227 |
msgstr "%d képeket sikeresen megtalálta a médiagalériában"
|
228 |
|
229 |
#: actions/wp_ajax_test_images.php:120
|
700 |
msgstr "Egyes oszlopok szükségesek, hogy jelen legyenek a fájlban, amely lehetővé teszi, hogy újra importálják a WP Minden Importtal. Ezek az oszlopok hiányoznak. Az újra exportált fájlt használja a WP Minden Exportot, és ne törölje az oszlopokat szerkesztése során. Ez után újra importálás helyesen fog működni."
|
701 |
|
702 |
#: controllers/admin/import.php:309
|
703 |
+
msgid "The import template you are using requires the User Add-On.<br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Purchase the User Add-On</a>"
|
704 |
msgstr "Az import sablon használata megköveteli Felhasználó Import Add-On használatát.<br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Vásároljon a Felhasználó Import Add-On-t</a> "
|
705 |
|
706 |
#: controllers/admin/import.php:384
|
1132 |
msgstr "Az import sablon használatát megköveteli a %s. Ha enélkül folytatja, az adatait helytelenül importálja. <br/> <a Href=\"%s\" target=\"_blank\">"
|
1133 |
|
1134 |
#: helpers/wp_all_import_template_notifications.php:23
|
1135 |
+
msgid "The import template you are using requires the User Add-On. If you continue without it your data may import incorrectly.<br/><br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Purchase the User Add-On</a>."
|
1136 |
msgstr "Az import sablon használatát megköveteli a felhasználó Import Add-On. Ha enélkül folytatja, az adatait helytelenül importálja. <br/><br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Vásároljon Felhasználó Import Add-On-t</a>. "
|
1137 |
|
1138 |
#: helpers/wp_all_import_template_notifications.php:27
|
2447 |
|
2448 |
#: views/admin/import/index.php:309
|
2449 |
#: views/admin/import/options/_settings_template.php:151
|
2450 |
+
msgid "The User Add-On is Required to Import Users"
|
2451 |
msgstr "A felhasználó Import Add-On megköveteli a felhasználók importálását"
|
2452 |
|
2453 |
#: views/admin/import/index.php:310
|
2454 |
#: views/admin/import/options/_settings_template.php:152
|
2455 |
+
msgid "Purchase the User Add-On"
|
2456 |
msgstr "Vedd meg a felhasználó Import Add-On-t"
|
2457 |
|
2458 |
#: views/admin/import/index.php:315
|
i18n/languages/wp_all_import_plugin-ja.po
CHANGED
@@ -154,7 +154,7 @@ msgstr "<p class=\"wpallimport-bundle-notice\">使用しているインポート
|
|
154 |
|
155 |
#: actions/wp_ajax_get_bundle_post_type.php:94
|
156 |
#: actions/wp_ajax_upload_resource.php:162 controllers/admin/settings.php:631
|
157 |
-
msgid "<p class=\"wpallimport-bundle-notice\">The import bundle you are using requires the User
|
158 |
msgstr "<p class=\"wpallimport-bundle-notice\">使用しているインポート バンドル ユーザー インポート アドオンが必要です。</p><a href=\"http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1\" target=\"_blank\" class=\"upgrade_link\">ユーザー インポートのアドオンを購入します。</a>"
|
159 |
|
160 |
#: actions/wp_ajax_nested_xpath.php:51
|
@@ -210,11 +210,11 @@ msgid "Image `%s` not found in media library."
|
|
210 |
msgstr "イメージ '%s' がメディア ・ ライブラリ内に見つかりません。"
|
211 |
|
212 |
#: actions/wp_ajax_test_images.php:102
|
213 |
-
msgid "%d image was successfully
|
214 |
msgstr "%d のイメージはメディア ギャラリーに設立され正常に"
|
215 |
|
216 |
#: actions/wp_ajax_test_images.php:106
|
217 |
-
msgid "%d images were successfully
|
218 |
msgstr "メディア ギャラリーに正常に設立された %d 画像"
|
219 |
|
220 |
#: actions/wp_ajax_test_images.php:120
|
@@ -678,7 +678,7 @@ msgid "Certain columns are required to be present in your file to enable it to b
|
|
678 |
msgstr "特定の列は、WPすべてのインポートで再インポートすることを可能にするために、あなたのファイルに存在することが必要とされています。これらの列は表示されません。 WPすべてのエクスポートを使用してファイルを再エクスポートし、それを編集するときに任意の列を削除しないでください。その後、再インポートが正常に動作します。"
|
679 |
|
680 |
#: controllers/admin/import.php:309
|
681 |
-
msgid "The import template you are using requires User
|
682 |
msgstr "あなたが使用しているインポートテンプレートは、ユーザーのインポートアドオンが必要です。 <br/> <a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free wp all export plugin\" target=\"_blank\">ユーザーのインポートアドオンを購入</a>"
|
683 |
|
684 |
#: controllers/admin/import.php:384
|
@@ -1103,7 +1103,7 @@ msgid "The import template you are using requires the %s. If you continue withou
|
|
1103 |
msgstr "使用しているテンプレートのインポートには、%s が必要です。それせずに続行した場合、データが正しくインポート可能性があります。<br><br><a href=\"%s\" target=\"_blank\"></a>"
|
1104 |
|
1105 |
#: helpers/wp_all_import_template_notifications.php:23
|
1106 |
-
msgid "The import template you are using requires the User
|
1107 |
msgstr "使用しているインポートテンプレートには、ユーザーインポートアドオンが必要です。あなたがそれなしで続けると、あなたのデータは間違ってインポートされる可能性があります。<br/> <br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">ユーザーインポートアドオンを購入してください</a>。"
|
1108 |
|
1109 |
#: helpers/wp_all_import_template_notifications.php:27
|
@@ -2410,12 +2410,12 @@ msgstr "分類選択"
|
|
2410 |
|
2411 |
#: views/admin/import/index.php:309
|
2412 |
#: views/admin/import/options/_settings_template.php:151
|
2413 |
-
msgid "The User
|
2414 |
msgstr "ユーザー インポートのアドオンはユーザーのインポートに必要です"
|
2415 |
|
2416 |
#: views/admin/import/index.php:310
|
2417 |
#: views/admin/import/options/_settings_template.php:152
|
2418 |
-
msgid "Purchase the User
|
2419 |
msgstr "ユーザーインポートアドオンの購入"
|
2420 |
|
2421 |
#: views/admin/import/index.php:315
|
154 |
|
155 |
#: actions/wp_ajax_get_bundle_post_type.php:94
|
156 |
#: actions/wp_ajax_upload_resource.php:162 controllers/admin/settings.php:631
|
157 |
+
msgid "<p class=\"wpallimport-bundle-notice\">The import bundle you are using requires the User Add-On.</p><a href=\"http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1\" target=\"_blank\" class=\"upgrade_link\">Purchase the User Add-On</a>."
|
158 |
msgstr "<p class=\"wpallimport-bundle-notice\">使用しているインポート バンドル ユーザー インポート アドオンが必要です。</p><a href=\"http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1\" target=\"_blank\" class=\"upgrade_link\">ユーザー インポートのアドオンを購入します。</a>"
|
159 |
|
160 |
#: actions/wp_ajax_nested_xpath.php:51
|
210 |
msgstr "イメージ '%s' がメディア ・ ライブラリ内に見つかりません。"
|
211 |
|
212 |
#: actions/wp_ajax_test_images.php:102
|
213 |
+
msgid "%d image was successfully found in media gallery"
|
214 |
msgstr "%d のイメージはメディア ギャラリーに設立され正常に"
|
215 |
|
216 |
#: actions/wp_ajax_test_images.php:106
|
217 |
+
msgid "%d images were successfully found in media gallery"
|
218 |
msgstr "メディア ギャラリーに正常に設立された %d 画像"
|
219 |
|
220 |
#: actions/wp_ajax_test_images.php:120
|
678 |
msgstr "特定の列は、WPすべてのインポートで再インポートすることを可能にするために、あなたのファイルに存在することが必要とされています。これらの列は表示されません。 WPすべてのエクスポートを使用してファイルを再エクスポートし、それを編集するときに任意の列を削除しないでください。その後、再インポートが正常に動作します。"
|
679 |
|
680 |
#: controllers/admin/import.php:309
|
681 |
+
msgid "The import template you are using requires the User Add-On.<br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Purchase the User Add-On</a>"
|
682 |
msgstr "あなたが使用しているインポートテンプレートは、ユーザーのインポートアドオンが必要です。 <br/> <a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free wp all export plugin\" target=\"_blank\">ユーザーのインポートアドオンを購入</a>"
|
683 |
|
684 |
#: controllers/admin/import.php:384
|
1103 |
msgstr "使用しているテンプレートのインポートには、%s が必要です。それせずに続行した場合、データが正しくインポート可能性があります。<br><br><a href=\"%s\" target=\"_blank\"></a>"
|
1104 |
|
1105 |
#: helpers/wp_all_import_template_notifications.php:23
|
1106 |
+
msgid "The import template you are using requires the User Add-On. If you continue without it your data may import incorrectly.<br/><br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Purchase the User Add-On</a>."
|
1107 |
msgstr "使用しているインポートテンプレートには、ユーザーインポートアドオンが必要です。あなたがそれなしで続けると、あなたのデータは間違ってインポートされる可能性があります。<br/> <br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">ユーザーインポートアドオンを購入してください</a>。"
|
1108 |
|
1109 |
#: helpers/wp_all_import_template_notifications.php:27
|
2410 |
|
2411 |
#: views/admin/import/index.php:309
|
2412 |
#: views/admin/import/options/_settings_template.php:151
|
2413 |
+
msgid "The User Add-On is Required to Import Users"
|
2414 |
msgstr "ユーザー インポートのアドオンはユーザーのインポートに必要です"
|
2415 |
|
2416 |
#: views/admin/import/index.php:310
|
2417 |
#: views/admin/import/options/_settings_template.php:152
|
2418 |
+
msgid "Purchase the User Add-On"
|
2419 |
msgstr "ユーザーインポートアドオンの購入"
|
2420 |
|
2421 |
#: views/admin/import/index.php:315
|
i18n/languages/wp_all_import_plugin-pt_BR.po
CHANGED
@@ -154,8 +154,8 @@ msgstr "<p class=\"wpallimport-bundle-notice\">O pacote de importação que voc
|
|
154 |
|
155 |
#: actions/wp_ajax_get_bundle_post_type.php:94
|
156 |
#: actions/wp_ajax_upload_resource.php:162 controllers/admin/settings.php:631
|
157 |
-
msgid "<p class=\"wpallimport-bundle-notice\">The import bundle you are using requires the User
|
158 |
-
msgstr "<p class=\"wpallimport-bundle-notice\">O pacote de importação que você está usando requer o User
|
159 |
|
160 |
#: actions/wp_ajax_nested_xpath.php:51
|
161 |
msgid "XPath is required"
|
@@ -210,11 +210,11 @@ msgid "Image `%s` not found in media library."
|
|
210 |
msgstr "A imagem `%s` não encontrada na biblioteca de mídia."
|
211 |
|
212 |
#: actions/wp_ajax_test_images.php:102
|
213 |
-
msgid "%d image was successfully
|
214 |
msgstr "%d imagem encontrada na galeria"
|
215 |
|
216 |
#: actions/wp_ajax_test_images.php:106
|
217 |
-
msgid "%d images were successfully
|
218 |
msgstr "%d imagens encontradas na galeria"
|
219 |
|
220 |
#: actions/wp_ajax_test_images.php:120
|
@@ -680,8 +680,8 @@ msgid "Certain columns are required to be present in your file to enable it to b
|
|
680 |
msgstr "Certas colunas são necessárias estar presente no arquivo para permitir que ele seja reimportado com WP All Import. Essas colunas estão faltando. Para reexportar o arquivo usando WP All Export, não exclua nenhuma das colunas quando editá-lo. Em seguida, a reimportação funcionará corretamente."
|
681 |
|
682 |
#: controllers/admin/import.php:309
|
683 |
-
msgid "The import template you are using requires User
|
684 |
-
msgstr "O modelo de importação que você está usando requer o User
|
685 |
|
686 |
#: controllers/admin/import.php:384
|
687 |
msgid "Unable to download feed resource."
|
@@ -1109,8 +1109,8 @@ msgid "The import template you are using requires the %s. If you continue withou
|
|
1109 |
msgstr "O modelo de importação que você está usando requer o %s. Se você continuar sem ele, seus dados podem ser importados incorretamente.<br/><br/><a href=\"%s\" target=\"_blank\">"
|
1110 |
|
1111 |
#: helpers/wp_all_import_template_notifications.php:23
|
1112 |
-
msgid "The import template you are using requires the User
|
1113 |
-
msgstr "O modelo de importação que você está usando requer o User
|
1114 |
|
1115 |
#: helpers/wp_all_import_template_notifications.php:27
|
1116 |
msgid "The import template you are using requires the WooCommerce Import Add-On. If you continue without it your data may import incorrectly.<br/><br/><a href=\"http://www.wpallimport.com/woocommerce-product-import/\" target=\"_blank\">Purchase the WooCommerce Import Add-On</a>."
|
@@ -2417,13 +2417,13 @@ msgstr "Selecionar Taxonomia"
|
|
2417 |
|
2418 |
#: views/admin/import/index.php:309
|
2419 |
#: views/admin/import/options/_settings_template.php:151
|
2420 |
-
msgid "The User
|
2421 |
-
msgstr "O User
|
2422 |
|
2423 |
#: views/admin/import/index.php:310
|
2424 |
#: views/admin/import/options/_settings_template.php:152
|
2425 |
-
msgid "Purchase the User
|
2426 |
-
msgstr "Comprar o User
|
2427 |
|
2428 |
#: views/admin/import/index.php:315
|
2429 |
#: views/admin/import/options/_settings_template.php:157
|
154 |
|
155 |
#: actions/wp_ajax_get_bundle_post_type.php:94
|
156 |
#: actions/wp_ajax_upload_resource.php:162 controllers/admin/settings.php:631
|
157 |
+
msgid "<p class=\"wpallimport-bundle-notice\">The import bundle you are using requires the User Add-On.</p><a href=\"http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1\" target=\"_blank\" class=\"upgrade_link\">Purchase the User Add-On</a>."
|
158 |
+
msgstr "<p class=\"wpallimport-bundle-notice\">O pacote de importação que você está usando requer o User Add-On.</p><a href=\"http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1\" target=\"_blank\" class=\"upgrade_link\">Comprar User Add-On</a>."
|
159 |
|
160 |
#: actions/wp_ajax_nested_xpath.php:51
|
161 |
msgid "XPath is required"
|
210 |
msgstr "A imagem `%s` não encontrada na biblioteca de mídia."
|
211 |
|
212 |
#: actions/wp_ajax_test_images.php:102
|
213 |
+
msgid "%d image was successfully found in media gallery"
|
214 |
msgstr "%d imagem encontrada na galeria"
|
215 |
|
216 |
#: actions/wp_ajax_test_images.php:106
|
217 |
+
msgid "%d images were successfully found in media gallery"
|
218 |
msgstr "%d imagens encontradas na galeria"
|
219 |
|
220 |
#: actions/wp_ajax_test_images.php:120
|
680 |
msgstr "Certas colunas são necessárias estar presente no arquivo para permitir que ele seja reimportado com WP All Import. Essas colunas estão faltando. Para reexportar o arquivo usando WP All Export, não exclua nenhuma das colunas quando editá-lo. Em seguida, a reimportação funcionará corretamente."
|
681 |
|
682 |
#: controllers/admin/import.php:309
|
683 |
+
msgid "The import template you are using requires the User Add-On.<br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Purchase the User Add-On</a>"
|
684 |
+
msgstr "O modelo de importação que você está usando requer o User Add-On.<br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Comprar User Add-On</a>"
|
685 |
|
686 |
#: controllers/admin/import.php:384
|
687 |
msgid "Unable to download feed resource."
|
1109 |
msgstr "O modelo de importação que você está usando requer o %s. Se você continuar sem ele, seus dados podem ser importados incorretamente.<br/><br/><a href=\"%s\" target=\"_blank\">"
|
1110 |
|
1111 |
#: helpers/wp_all_import_template_notifications.php:23
|
1112 |
+
msgid "The import template you are using requires the User Add-On. If you continue without it your data may import incorrectly.<br/><br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Purchase the User Add-On</a>."
|
1113 |
+
msgstr "O modelo de importação que você está usando requer o User Add-On. Se você continuar sem ele, seus dados podem ser importados incorretamente.<br/><br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Comprar User Add-On</a>."
|
1114 |
|
1115 |
#: helpers/wp_all_import_template_notifications.php:27
|
1116 |
msgid "The import template you are using requires the WooCommerce Import Add-On. If you continue without it your data may import incorrectly.<br/><br/><a href=\"http://www.wpallimport.com/woocommerce-product-import/\" target=\"_blank\">Purchase the WooCommerce Import Add-On</a>."
|
2417 |
|
2418 |
#: views/admin/import/index.php:309
|
2419 |
#: views/admin/import/options/_settings_template.php:151
|
2420 |
+
msgid "The User Add-On is Required to Import Users"
|
2421 |
+
msgstr "O User Add-On é requerido para importar usuários"
|
2422 |
|
2423 |
#: views/admin/import/index.php:310
|
2424 |
#: views/admin/import/options/_settings_template.php:152
|
2425 |
+
msgid "Purchase the User Add-On"
|
2426 |
+
msgstr "Comprar o User Add-On"
|
2427 |
|
2428 |
#: views/admin/import/index.php:315
|
2429 |
#: views/admin/import/options/_settings_template.php:157
|
i18n/languages/wp_all_import_pro_plugin.pot
CHANGED
@@ -154,7 +154,7 @@ msgstr ""
|
|
154 |
|
155 |
#: actions/wp_ajax_get_bundle_post_type.php:94
|
156 |
#: actions/wp_ajax_upload_resource.php:162 controllers/admin/settings.php:631
|
157 |
-
msgid "<p class=\"wpallimport-bundle-notice\">The import bundle you are using requires the User
|
158 |
msgstr ""
|
159 |
|
160 |
#: actions/wp_ajax_nested_xpath.php:51
|
@@ -210,11 +210,11 @@ msgid "Image `%s` not found in media library."
|
|
210 |
msgstr ""
|
211 |
|
212 |
#: actions/wp_ajax_test_images.php:102
|
213 |
-
msgid "%d image was successfully
|
214 |
msgstr ""
|
215 |
|
216 |
#: actions/wp_ajax_test_images.php:106
|
217 |
-
msgid "%d images were successfully
|
218 |
msgstr ""
|
219 |
|
220 |
#: actions/wp_ajax_test_images.php:120
|
@@ -680,7 +680,7 @@ msgid "Certain columns are required to be present in your file to enable it to b
|
|
680 |
msgstr ""
|
681 |
|
682 |
#: controllers/admin/import.php:309
|
683 |
-
msgid "The import template you are using requires User
|
684 |
msgstr ""
|
685 |
|
686 |
#: controllers/admin/import.php:384
|
@@ -1106,7 +1106,7 @@ msgid "The import template you are using requires the %s. If you continue withou
|
|
1106 |
msgstr ""
|
1107 |
|
1108 |
#: helpers/wp_all_import_template_notifications.php:23
|
1109 |
-
msgid "The import template you are using requires the User
|
1110 |
msgstr ""
|
1111 |
|
1112 |
#: helpers/wp_all_import_template_notifications.php:27
|
@@ -2414,12 +2414,12 @@ msgstr ""
|
|
2414 |
|
2415 |
#: views/admin/import/index.php:309
|
2416 |
#: views/admin/import/options/_settings_template.php:151
|
2417 |
-
msgid "The User
|
2418 |
msgstr ""
|
2419 |
|
2420 |
#: views/admin/import/index.php:310
|
2421 |
#: views/admin/import/options/_settings_template.php:152
|
2422 |
-
msgid "Purchase the User
|
2423 |
msgstr ""
|
2424 |
|
2425 |
#: views/admin/import/index.php:315
|
154 |
|
155 |
#: actions/wp_ajax_get_bundle_post_type.php:94
|
156 |
#: actions/wp_ajax_upload_resource.php:162 controllers/admin/settings.php:631
|
157 |
+
msgid "<p class=\"wpallimport-bundle-notice\">The import bundle you are using requires the User Add-On.</p><a href=\"http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1\" target=\"_blank\" class=\"upgrade_link\">Purchase the User Add-On</a>."
|
158 |
msgstr ""
|
159 |
|
160 |
#: actions/wp_ajax_nested_xpath.php:51
|
210 |
msgstr ""
|
211 |
|
212 |
#: actions/wp_ajax_test_images.php:102
|
213 |
+
msgid "%d image was successfully found in media gallery"
|
214 |
msgstr ""
|
215 |
|
216 |
#: actions/wp_ajax_test_images.php:106
|
217 |
+
msgid "%d images were successfully found in media gallery"
|
218 |
msgstr ""
|
219 |
|
220 |
#: actions/wp_ajax_test_images.php:120
|
680 |
msgstr ""
|
681 |
|
682 |
#: controllers/admin/import.php:309
|
683 |
+
msgid "The import template you are using requires the User Add-On.<br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Purchase the User Add-On</a>"
|
684 |
msgstr ""
|
685 |
|
686 |
#: controllers/admin/import.php:384
|
1106 |
msgstr ""
|
1107 |
|
1108 |
#: helpers/wp_all_import_template_notifications.php:23
|
1109 |
+
msgid "The import template you are using requires the User Add-On. If you continue without it your data may import incorrectly.<br/><br/><a href=\"http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin\" target=\"_blank\">Purchase the User Add-On</a>."
|
1110 |
msgstr ""
|
1111 |
|
1112 |
#: helpers/wp_all_import_template_notifications.php:27
|
2414 |
|
2415 |
#: views/admin/import/index.php:309
|
2416 |
#: views/admin/import/options/_settings_template.php:151
|
2417 |
+
msgid "The User Add-On is Required to Import Users"
|
2418 |
msgstr ""
|
2419 |
|
2420 |
#: views/admin/import/index.php:310
|
2421 |
#: views/admin/import/options/_settings_template.php:152
|
2422 |
+
msgid "Purchase the User Add-On"
|
2423 |
msgstr ""
|
2424 |
|
2425 |
#: views/admin/import/index.php:315
|
libraries/XmlImportCsvParse.php
CHANGED
@@ -979,67 +979,67 @@ class PMXI_CsvParser
|
|
979 |
$headers = array();
|
980 |
while ($keys = fgetcsv($res, $l, $d, $e)) {
|
981 |
|
982 |
-
if ($skip_x_rows !== false && $skip_x_rows > $c){
|
983 |
$c++;
|
984 |
continue;
|
985 |
}
|
986 |
-
if ($skip_x_rows !== false && $skip_x_rows <= $c){
|
987 |
$skip_x_rows = false;
|
988 |
$c = 0;
|
989 |
}
|
990 |
$empty_columns = 0;
|
991 |
foreach ($keys as $key) {
|
992 |
-
if ($key == '') $empty_columns++;
|
993 |
}
|
994 |
-
//
|
995 |
if ($empty_columns == count($keys)) continue;
|
996 |
|
997 |
if ($c == 0) {
|
998 |
$buf_keys = $keys;
|
999 |
foreach ($keys as $key => $value) {
|
1000 |
|
1001 |
-
if (!$create_new_headers and (preg_match('%\W(http:|https:|ftp:)$%i', $value) or is_numeric($value)))
|
|
|
|
|
1002 |
|
1003 |
$value = trim(strtolower(preg_replace('/[^a-z0-9_]/i', '', $value)));
|
1004 |
-
if (preg_match('/^[0-9]{1}/', $value)){
|
1005 |
$value = 'el_' . trim(strtolower($value));
|
1006 |
}
|
1007 |
$value = (!empty($value)) ? $value : 'undefined' . $key;
|
1008 |
|
1009 |
-
if (empty($headers[$value]))
|
1010 |
$headers[$value] = 1;
|
1011 |
-
|
|
|
1012 |
$headers[$value]++;
|
|
|
1013 |
|
1014 |
$keys[$key] = ($headers[$value] === 1) ? $value : $value . '_' . $headers[$value];
|
1015 |
}
|
1016 |
$this->headers = $keys;
|
1017 |
$create_new_headers = apply_filters('wp_all_import_auto_create_csv_headers', $create_new_headers, $import_id);
|
1018 |
-
if ($create_new_headers){
|
1019 |
$this->createHeaders('column');
|
1020 |
$keys = $buf_keys;
|
1021 |
}
|
1022 |
}
|
1023 |
if ( $c or $create_new_headers ) {
|
1024 |
-
|
1025 |
-
if (!empty($keys)){
|
1026 |
-
|
1027 |
$chunk = array();
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
if ( ! empty($chunk) )
|
1032 |
-
{
|
1033 |
$xmlWriter->startElement('node');
|
1034 |
-
foreach ($chunk as $header => $value)
|
1035 |
-
{
|
1036 |
$xmlWriter->startElement($header);
|
1037 |
$value = preg_replace('/\]\]>/s', '', preg_replace('/<!\[CDATA\[/s', '', $value ));
|
1038 |
-
if ($fixBrokenSymbols){
|
1039 |
-
// Remove non ASCII symbols and write CDATA
|
1040 |
$xmlWriter->writeCData(preg_replace('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', ' ', $value));
|
1041 |
}
|
1042 |
-
else{
|
1043 |
$xmlWriter->writeCData($value);
|
1044 |
}
|
1045 |
$xmlWriter->endElement();
|
@@ -1048,24 +1048,18 @@ class PMXI_CsvParser
|
|
1048 |
}
|
1049 |
}
|
1050 |
}
|
1051 |
-
|
1052 |
-
$c ++;
|
1053 |
}
|
1054 |
|
1055 |
-
if($c === 1)
|
1056 |
-
{
|
1057 |
$xmlWriter->startElement('node');
|
1058 |
$xmlWriter->endElement();
|
1059 |
}
|
1060 |
-
|
1061 |
fclose($res);
|
1062 |
-
|
1063 |
$xmlWriter->endElement();
|
|
|
1064 |
|
1065 |
-
|
1066 |
-
|
1067 |
-
return true;
|
1068 |
-
|
1069 |
}
|
1070 |
|
1071 |
/**
|
@@ -1076,8 +1070,7 @@ class PMXI_CsvParser
|
|
1076 |
* @access protected
|
1077 |
* @return array containing only the rows that have data
|
1078 |
*/
|
1079 |
-
protected function removeEmpty()
|
1080 |
-
{
|
1081 |
$ret_arr = array();
|
1082 |
foreach ($this->rows as $row) {
|
1083 |
$line = trim(join('', $row));
|
@@ -1096,18 +1089,15 @@ class PMXI_CsvParser
|
|
1096 |
* @access protected
|
1097 |
* @return boolean
|
1098 |
*/
|
1099 |
-
protected function validates()
|
1100 |
-
{
|
1101 |
// file existance
|
1102 |
if (!file_exists($this->_filename)) {
|
1103 |
return false;
|
1104 |
}
|
1105 |
-
|
1106 |
// file readability
|
1107 |
if (!is_readable($this->_filename)) {
|
1108 |
return false;
|
1109 |
}
|
1110 |
-
|
1111 |
return true;
|
1112 |
}
|
1113 |
|
@@ -1117,8 +1107,7 @@ class PMXI_CsvParser
|
|
1117 |
* @access protected
|
1118 |
* @return void
|
1119 |
*/
|
1120 |
-
protected function moveHeadersToRows()
|
1121 |
-
{
|
1122 |
$arr = array();
|
1123 |
$arr[] = $this->headers;
|
1124 |
foreach ($this->rows as $row) {
|
979 |
$headers = array();
|
980 |
while ($keys = fgetcsv($res, $l, $d, $e)) {
|
981 |
|
982 |
+
if ($skip_x_rows !== false && $skip_x_rows > $c) {
|
983 |
$c++;
|
984 |
continue;
|
985 |
}
|
986 |
+
if ($skip_x_rows !== false && $skip_x_rows <= $c) {
|
987 |
$skip_x_rows = false;
|
988 |
$c = 0;
|
989 |
}
|
990 |
$empty_columns = 0;
|
991 |
foreach ($keys as $key) {
|
992 |
+
if (preg_replace("%\s%", "", $key) == '') $empty_columns++;
|
993 |
}
|
994 |
+
// Skip empty lines.
|
995 |
if ($empty_columns == count($keys)) continue;
|
996 |
|
997 |
if ($c == 0) {
|
998 |
$buf_keys = $keys;
|
999 |
foreach ($keys as $key => $value) {
|
1000 |
|
1001 |
+
if (!$create_new_headers and (preg_match('%\W(http:|https:|ftp:)$%i', $value) or is_numeric($value))) {
|
1002 |
+
$create_new_headers = true;
|
1003 |
+
}
|
1004 |
|
1005 |
$value = trim(strtolower(preg_replace('/[^a-z0-9_]/i', '', $value)));
|
1006 |
+
if (preg_match('/^[0-9]{1}/', $value)) {
|
1007 |
$value = 'el_' . trim(strtolower($value));
|
1008 |
}
|
1009 |
$value = (!empty($value)) ? $value : 'undefined' . $key;
|
1010 |
|
1011 |
+
if (empty($headers[$value])) {
|
1012 |
$headers[$value] = 1;
|
1013 |
+
}
|
1014 |
+
else {
|
1015 |
$headers[$value]++;
|
1016 |
+
}
|
1017 |
|
1018 |
$keys[$key] = ($headers[$value] === 1) ? $value : $value . '_' . $headers[$value];
|
1019 |
}
|
1020 |
$this->headers = $keys;
|
1021 |
$create_new_headers = apply_filters('wp_all_import_auto_create_csv_headers', $create_new_headers, $import_id);
|
1022 |
+
if ($create_new_headers) {
|
1023 |
$this->createHeaders('column');
|
1024 |
$keys = $buf_keys;
|
1025 |
}
|
1026 |
}
|
1027 |
if ( $c or $create_new_headers ) {
|
1028 |
+
if (!empty($keys)) {
|
|
|
|
|
1029 |
$chunk = array();
|
1030 |
+
foreach ($this->headers as $key => $header) {
|
1031 |
+
$chunk[$header] = $this->fixEncoding( $keys[$key] );
|
1032 |
+
}
|
1033 |
+
if ( ! empty($chunk) ) {
|
|
|
1034 |
$xmlWriter->startElement('node');
|
1035 |
+
foreach ($chunk as $header => $value) {
|
|
|
1036 |
$xmlWriter->startElement($header);
|
1037 |
$value = preg_replace('/\]\]>/s', '', preg_replace('/<!\[CDATA\[/s', '', $value ));
|
1038 |
+
if ($fixBrokenSymbols) {
|
1039 |
+
// Remove non ASCII symbols and write CDATA.
|
1040 |
$xmlWriter->writeCData(preg_replace('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', ' ', $value));
|
1041 |
}
|
1042 |
+
else {
|
1043 |
$xmlWriter->writeCData($value);
|
1044 |
}
|
1045 |
$xmlWriter->endElement();
|
1048 |
}
|
1049 |
}
|
1050 |
}
|
1051 |
+
$c++;
|
|
|
1052 |
}
|
1053 |
|
1054 |
+
if ($c === 1 && !$create_new_headers) {
|
|
|
1055 |
$xmlWriter->startElement('node');
|
1056 |
$xmlWriter->endElement();
|
1057 |
}
|
|
|
1058 |
fclose($res);
|
|
|
1059 |
$xmlWriter->endElement();
|
1060 |
+
$xmlWriter->flush(TRUE);
|
1061 |
|
1062 |
+
return TRUE;
|
|
|
|
|
|
|
1063 |
}
|
1064 |
|
1065 |
/**
|
1070 |
* @access protected
|
1071 |
* @return array containing only the rows that have data
|
1072 |
*/
|
1073 |
+
protected function removeEmpty() {
|
|
|
1074 |
$ret_arr = array();
|
1075 |
foreach ($this->rows as $row) {
|
1076 |
$line = trim(join('', $row));
|
1089 |
* @access protected
|
1090 |
* @return boolean
|
1091 |
*/
|
1092 |
+
protected function validates(){
|
|
|
1093 |
// file existance
|
1094 |
if (!file_exists($this->_filename)) {
|
1095 |
return false;
|
1096 |
}
|
|
|
1097 |
// file readability
|
1098 |
if (!is_readable($this->_filename)) {
|
1099 |
return false;
|
1100 |
}
|
|
|
1101 |
return true;
|
1102 |
}
|
1103 |
|
1107 |
* @access protected
|
1108 |
* @return void
|
1109 |
*/
|
1110 |
+
protected function moveHeadersToRows() {
|
|
|
1111 |
$arr = array();
|
1112 |
$arr[] = $this->headers;
|
1113 |
foreach ($this->rows as $row) {
|
libraries/XmlImportTemplateScanner.php
CHANGED
@@ -26,7 +26,7 @@ final class XmlImportTemplateScanner
|
|
26 |
'ENDFOREACH',
|
27 |
'WITH',
|
28 |
'ENDWITH',
|
29 |
-
|
30 |
'SPINTAX'
|
31 |
);
|
32 |
|
26 |
'ENDFOREACH',
|
27 |
'WITH',
|
28 |
'ENDWITH',
|
29 |
+
'MATH',
|
30 |
'SPINTAX'
|
31 |
);
|
32 |
|
models/image/list.php
CHANGED
@@ -19,7 +19,7 @@ class PMXI_Image_List extends PMXI_Model_List {
|
|
19 |
*/
|
20 |
public function getExistingImageByUrl($url) {
|
21 |
$args = array(
|
22 |
-
'image_url' => $url,
|
23 |
);
|
24 |
return $this->getExistingImage($args);
|
25 |
}
|
@@ -30,23 +30,33 @@ class PMXI_Image_List extends PMXI_Model_List {
|
|
30 |
*/
|
31 |
public function getExistingImageByFilename($image) {
|
32 |
$args = array(
|
33 |
-
'image_filename' => $image,
|
34 |
);
|
35 |
-
return $this->getExistingImage($args);
|
36 |
}
|
37 |
|
38 |
/**
|
39 |
* @param $args
|
40 |
* @return array|bool|null|\WP_Post
|
41 |
*/
|
42 |
-
|
43 |
-
|
|
|
44 |
foreach($this->getBy($args)->convertRecords() as $imageRecord) {
|
45 |
if ( ! $imageRecord->isEmpty() ) {
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
}
|
49 |
}
|
50 |
-
|
|
|
51 |
}
|
52 |
}
|
19 |
*/
|
20 |
public function getExistingImageByUrl($url) {
|
21 |
$args = array(
|
22 |
+
'image_url' => trim($url),
|
23 |
);
|
24 |
return $this->getExistingImage($args);
|
25 |
}
|
30 |
*/
|
31 |
public function getExistingImageByFilename($image) {
|
32 |
$args = array(
|
33 |
+
'image_filename' => trim($image),
|
34 |
);
|
35 |
+
return $this->getExistingImage($args, false);
|
36 |
}
|
37 |
|
38 |
/**
|
39 |
* @param $args
|
40 |
* @return array|bool|null|\WP_Post
|
41 |
*/
|
42 |
+
|
43 |
+
public function getExistingImage($args, $allow_filter = true){
|
44 |
+
$attch = false;
|
45 |
foreach($this->getBy($args)->convertRecords() as $imageRecord) {
|
46 |
if ( ! $imageRecord->isEmpty() ) {
|
47 |
+
// only allow the filter if not matching by Filename
|
48 |
+
$attid = ($allow_filter) ? apply_filters('wp_all_import_get_existing_image', $imageRecord->attachment_id) : $imageRecord->attachment_id;
|
49 |
+
|
50 |
+
$attch = get_post($attid);
|
51 |
+
if ($attch) {
|
52 |
+
break;
|
53 |
+
}
|
54 |
+
else{
|
55 |
+
$imageRecord->delete();
|
56 |
+
}
|
57 |
}
|
58 |
}
|
59 |
+
|
60 |
+
return $attch;
|
61 |
}
|
62 |
}
|
models/import/record.php
CHANGED
@@ -131,7 +131,13 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
131 |
$records = array();
|
132 |
|
133 |
$is_import_complete = false;
|
134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
try {
|
136 |
|
137 |
//$errorHandler = new PMXI_Error();
|
@@ -406,7 +412,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
406 |
$taxonomies = array();
|
407 |
$exclude_taxonomies = apply_filters('pmxi_exclude_taxonomies', (class_exists('PMWI_Plugin')) ? array('post_format', 'product_type', 'product_shipping_class', 'product_visibility') : array('post_format'));
|
408 |
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($this->options['custom_type']), 'object'), array_flip($exclude_taxonomies));
|
409 |
-
if ( $this->is_parsing_required('is_update_categories') && ! empty($post_taxonomies) && ! in_array($this->options['custom_type'], array('import_users', 'taxonomies')) ):
|
410 |
foreach ($post_taxonomies as $ctx): if ("" == $ctx->labels->name or (class_exists('PMWI_Plugin') and strpos($ctx->name, "pa_") === 0 and $this->options['custom_type'] == "product")) continue;
|
411 |
$chunk == 1 and $logger and call_user_func($logger, sprintf(__('Composing terms for `%s` taxonomy...', 'wp_all_import_plugin'), $ctx->labels->name));
|
412 |
$tx_name = $ctx->name;
|
@@ -862,11 +868,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
862 |
//set_error_handler( array($errorHandler, 'import_data_handler'), E_ALL | E_STRICT | E_WARNING );
|
863 |
|
864 |
switch ($this->options['custom_type']) {
|
865 |
-
|
866 |
-
$custom_type_details = new stdClass();
|
867 |
-
$custom_type_details->labels = new stdClass();
|
868 |
-
$custom_type_details->labels->singular_name = __('Taxonomy Term', 'wp_all_import_plugin');
|
869 |
-
break;
|
870 |
default:
|
871 |
$custom_type_details = get_post_type_object($post_type[$i]);
|
872 |
break;
|
@@ -897,7 +899,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
897 |
do_action( "pmxi_before_post_import_{$addon}", $data, $i, $this->id );
|
898 |
}
|
899 |
|
900 |
-
if ( empty($titles[$i]) && $this->options['custom_type']
|
901 |
if ( ! empty($addons_data['PMWI_Plugin']) and !empty($addons_data['PMWI_Plugin']['single_product_parent_ID'][$i]) ){
|
902 |
$titles[$i] = $addons_data['PMWI_Plugin']['single_product_parent_ID'][$i] . ' Product Variation';
|
903 |
}
|
@@ -924,27 +926,63 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
924 |
'role' => ('' == $addons_data['PMUI_Plugin']['pmui_role'][$i]) ? 'subscriber' : $addons_data['PMUI_Plugin']['pmui_role'][$i],
|
925 |
), $this->options['custom_type'], $this->id, $i);
|
926 |
$logger and call_user_func($logger, sprintf(__('Combine all data for user %s...', 'wp_all_import_plugin'), $articleData['user_login']));
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
$parent_term = get_term_by('slug', $taxonomy_parent[$i], $this->options['taxonomy_type']) or $parent_term = get_term_by('name', $taxonomy_parent[$i], $this->options['taxonomy_type']) or ctype_digit($taxonomy_parent[$i]) and $parent_term = get_term_by('id', $taxonomy_parent[$i], $this->options['taxonomy_type']);
|
933 |
-
if (!empty($parent_term) && !is_wp_error($parent_term)){
|
934 |
-
$parent_term_id = $parent_term->term_id;
|
935 |
-
}
|
936 |
-
}
|
937 |
$articleData = apply_filters('wp_all_import_combine_article_data', array(
|
938 |
-
'
|
939 |
-
'
|
940 |
-
'
|
941 |
-
'
|
942 |
-
'
|
943 |
-
'
|
944 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
945 |
), $this->options['custom_type'], $this->id, $i);
|
946 |
-
$logger and call_user_func($logger, sprintf(__('Combine
|
947 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
948 |
default:
|
949 |
$articleData = apply_filters('wp_all_import_combine_article_data', array(
|
950 |
'post_type' => $post_type[$i],
|
@@ -1004,12 +1042,11 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1004 |
foreach($postList->getBy($args)->convertRecords() as $postRecord) {
|
1005 |
if ( ! $postRecord->isEmpty() ) {
|
1006 |
switch ($this->options['custom_type']){
|
1007 |
-
|
|
|
1008 |
$post_to_update = get_user_by('id', $post_to_update_id = $postRecord->post_id);
|
1009 |
break;
|
1010 |
-
|
1011 |
-
$post_to_update = get_term_by('id', $post_to_update_id = $postRecord->post_id, $this->options['taxonomy_type']);
|
1012 |
-
break;
|
1013 |
default:
|
1014 |
$post_to_update = get_post($post_to_update_id = $postRecord->post_id);
|
1015 |
break;
|
@@ -1042,15 +1079,21 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1042 |
$logger and call_user_func($logger, sprintf(__('Find corresponding article among database for post `%s`...', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
|
1043 |
|
1044 |
$duplicates = array();
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1054 |
|
1055 |
if ( ! empty($duplicate_id)) {
|
1056 |
$duplicate_id = apply_filters('wp_all_import_manual_matching_duplicate_id', $duplicate_id, $duplicates, $articleData, $this->id);
|
@@ -1060,13 +1103,16 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1060 |
}
|
1061 |
$logger and call_user_func($logger, sprintf(__('Duplicate post was found for post `%s`...', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
|
1062 |
switch ($this->options['custom_type']){
|
1063 |
-
|
|
|
1064 |
$post_to_update = get_user_by('id', $post_to_update_id = $duplicate_id);
|
1065 |
break;
|
1066 |
-
|
1067 |
-
$post_to_update = get_term_by('id', $post_to_update_id = $duplicate_id, $this->options['taxonomy_type']);
|
1068 |
-
break;
|
1069 |
default:
|
|
|
|
|
|
|
|
|
1070 |
$post_to_update = get_post($post_to_update_id = $duplicate_id);
|
1071 |
break;
|
1072 |
}
|
@@ -1077,10 +1123,13 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1077 |
}
|
1078 |
}
|
1079 |
|
1080 |
-
$is_post_to_skip = apply_filters('wp_all_import_is_post_to_skip', false, $this->id, $current_xml_node, $i, $post_to_update_id);
|
1081 |
|
1082 |
if ( $is_post_to_skip ) {
|
1083 |
-
|
|
|
|
|
|
|
1084 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1085 |
$logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
|
1086 |
$logger and !$is_cron and PMXI_Plugin::$session->save_data();
|
@@ -1088,11 +1137,10 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1088 |
}
|
1089 |
|
1090 |
if ( ! empty($specified_records) ) {
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
$skipped++;
|
1097 |
$logger and call_user_func($logger, __('<b>SKIPPED</b>: by specified records option', 'wp_all_import_plugin'));
|
1098 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
@@ -1108,7 +1156,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1108 |
|
1109 |
$continue_import = true;
|
1110 |
|
1111 |
-
$continue_import = apply_filters('wp_all_import_is_post_to_update', $continue_import, $post_to_update_id, $current_xml_node, $this->id);
|
1112 |
|
1113 |
if ( ! $continue_import ){
|
1114 |
|
@@ -1152,36 +1200,60 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1152 |
if ( ! $this->options['is_update_role'] ) unset($articleData['role']);
|
1153 |
if ( ! $this->options['is_update_nickname'] ) $articleData['nickname'] = get_user_meta($post_to_update->ID, 'nickname', true);
|
1154 |
if ( ! $this->options['is_update_description'] ) $articleData['description'] = get_user_meta($post_to_update->ID, 'description', true);
|
1155 |
-
|
1156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1157 |
if ( ! $this->options['is_update_nicename'] ) $articleData['user_nicename'] = $post_to_update->user_nicename;
|
1158 |
-
|
1159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1160 |
if ( ! $this->options['is_update_display_name'] ) $articleData['display_name'] = $post_to_update->display_name;
|
1161 |
if ( ! $this->options['is_update_url'] ) $articleData['user_url'] = $post_to_update->user_url;
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
if ( ! $this->options['
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1185 |
default:
|
1186 |
// preserve date of already existing article when duplicate is found
|
1187 |
if ( ( ! $this->options['is_update_categories'] and ( is_object_in_taxonomy( $post_type[$i], 'category' ) or is_object_in_taxonomy( $post_type[$i], 'post_tag' ) ) ) or ($this->options['is_update_categories'] and $this->options['update_categories_logic'] != "full_update")) {
|
@@ -1270,30 +1342,43 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1270 |
}
|
1271 |
break;
|
1272 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1273 |
}
|
1274 |
|
1275 |
$is_images_to_delete = apply_filters('pmxi_delete_images', true, $articleData, $current_xml_node);
|
1276 |
if ( $is_images_to_delete ) {
|
1277 |
switch ($this->options['custom_type']) {
|
1278 |
case 'import_users':
|
|
|
1279 |
|
1280 |
break;
|
1281 |
-
case 'taxonomies':
|
1282 |
-
|
1283 |
-
// handle obsolete attachments (i.e. delete or keep) according to import settings
|
1284 |
-
if ($this->options['update_all_data'] == 'yes' or ($this->options['update_all_data'] == 'no' and $this->options['is_update_images'] and $this->options['update_images_logic'] == "full_update")) {
|
1285 |
-
$logger and call_user_func($logger, sprintf(__('Deleting images for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
1286 |
-
$term_thumbnail_id = get_term_meta($articleData['ID'], 'thumbnail_id', TRUE);
|
1287 |
-
if (!empty($term_thumbnail_id)) {
|
1288 |
-
delete_term_meta($articleData['ID'], 'thumbnail_id');
|
1289 |
-
$remove_images = ($this->options['download_images'] == 'gallery' or $this->options['do_not_remove_images']) ? FALSE : TRUE;
|
1290 |
-
if ($remove_images){
|
1291 |
-
wp_delete_attachment($term_thumbnail_id, true);
|
1292 |
-
}
|
1293 |
-
}
|
1294 |
-
}
|
1295 |
|
1296 |
-
break;
|
1297 |
default:
|
1298 |
if ($this->options['update_all_data'] == 'yes' or ($this->options['update_all_data'] == 'no' and $this->options['is_update_attachments'])) {
|
1299 |
$logger and call_user_func($logger, sprintf(__('Deleting attachments for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
@@ -1325,7 +1410,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1325 |
}
|
1326 |
|
1327 |
$logger and call_user_func($logger, sprintf(__('Applying filter `pmxi_article_data` for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
|
1328 |
-
$articleData = apply_filters('pmxi_article_data', $articleData, $this, $post_to_update);
|
1329 |
|
1330 |
// no new records are created. it will only update posts it finds matching duplicates for
|
1331 |
if ( ! $this->options['create_new_records'] and empty($articleData['ID']) ){
|
@@ -1457,37 +1542,132 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1457 |
$this->wpdb->update($this->wpdb->users, array('user_login' => $articleData['user_login']), array('ID' => $articleData['ID']));
|
1458 |
}
|
1459 |
$articleData['post_title'] = $articleData['user_login'];
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
$logger and
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
'description' => $articleData['post_content']
|
1472 |
-
)) : wp_update_term($articleData['ID'], $this->options['taxonomy_type'], array(
|
1473 |
-
'name' => $articleData['post_title'],
|
1474 |
-
'parent' => empty($articleData['post_parent']) ? 0 : $articleData['post_parent'],
|
1475 |
-
'slug' => $articleData['slug'],
|
1476 |
-
'description' => $articleData['post_content']
|
1477 |
-
));
|
1478 |
-
if (is_wp_error($term)){
|
1479 |
-
$logger and call_user_func($logger, __('<b>ERROR</b>', 'wp_all_import_plugin') . ': ' . $term->get_error_message());
|
1480 |
-
}
|
1481 |
-
else{
|
1482 |
-
$pid = $term['term_id'];
|
1483 |
-
if (empty($articleData['post_parent']) && !empty($taxonomy_parent[$i])){
|
1484 |
-
$parent_terms = get_option('wp_all_import_taxonomies_hierarchy_' . $this->id);
|
1485 |
-
if (empty($parent_terms)) $parent_terms = array();
|
1486 |
-
$parent_terms[$pid] = $taxonomy_parent[$i];
|
1487 |
-
update_option('wp_all_import_taxonomies_hierarchy_' . $this->id, $parent_terms);
|
1488 |
-
}
|
1489 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1490 |
break;
|
|
|
1491 |
default:
|
1492 |
if (empty($articleData['ID'])){
|
1493 |
$logger and call_user_func($logger, sprintf(__('<b>CREATING</b> `%s` `%s`', 'wp_all_import_plugin'), $articleData['post_title'], $custom_type_details->labels->singular_name));
|
@@ -1596,6 +1776,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1596 |
|
1597 |
// [featured image]
|
1598 |
|
|
|
1599 |
$is_allow_import_images = apply_filters('wp_all_import_is_allow_import_images', false, empty($articleData['post_type']) ? '' : $articleData['post_type']);
|
1600 |
$images_uploads = apply_filters('wp_all_import_images_uploads_dir', $uploads, $articleData, $current_xml_node, $this->id);
|
1601 |
|
@@ -1607,7 +1788,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1607 |
|
1608 |
// search for images in galleries
|
1609 |
$galleries = array();
|
1610 |
-
if (preg_match_all('%\[gallery[^\]]*ids="([^\]]*)"[^\]]*\]%is', $articleData['post_content'], $matches, PREG_PATTERN_ORDER)) {
|
1611 |
$galleries = array_unique(array_filter($matches[1]));
|
1612 |
}
|
1613 |
$gallery_images = array();
|
@@ -1663,16 +1844,18 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1663 |
|
1664 |
$attid = false;
|
1665 |
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
|
|
|
|
1676 |
}
|
1677 |
|
1678 |
// exisitng image founded
|
@@ -1682,9 +1865,11 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1682 |
}
|
1683 |
else {
|
1684 |
|
1685 |
-
|
|
|
|
|
1686 |
|
1687 |
-
// Download remote image and save it in images table
|
1688 |
$url = html_entity_decode(trim($image), ENT_QUOTES);
|
1689 |
|
1690 |
if (empty($url)) continue;
|
@@ -1695,7 +1880,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1695 |
$default_extension = pmxi_getExtension($bn);
|
1696 |
if ($img_ext == "") $img_ext = pmxi_get_remote_image_ext($url);
|
1697 |
|
1698 |
-
//
|
1699 |
$image_name = urldecode(("" != $img_ext) ? str_replace("." . $default_extension, "", $bn) : $bn) . (("" != $img_ext) ? '.' . $img_ext : '');
|
1700 |
|
1701 |
$image_filename = wp_unique_filename($targetDir, $image_name);
|
@@ -1703,22 +1888,18 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1703 |
|
1704 |
$image_info = $this->downloadFile($url, $image_filepath, $is_cron, $logger);
|
1705 |
|
1706 |
-
if ($image_info){
|
1707 |
-
//
|
1708 |
$file_mime_type = '';
|
1709 |
-
|
1710 |
-
if ( ! empty($image_info) )
|
1711 |
-
{
|
1712 |
$file_mime_type = image_type_to_mime_type($image_info[2]);
|
1713 |
}
|
1714 |
$file_mime_type = apply_filters('wp_all_import_image_mime_type', $file_mime_type, $image_filepath);
|
1715 |
-
|
1716 |
$handle_image = array(
|
1717 |
'file' => $image_filepath,
|
1718 |
'url' => $targetUrl . '/' . $image_filename,
|
1719 |
'type' => $file_mime_type
|
1720 |
);
|
1721 |
-
|
1722 |
$attid = $this->createAttachment($pid, $handle_image, $image_name, $post_author[$i], $post_type[$i], $is_cron, $logger, $bundle_data['type']);
|
1723 |
}
|
1724 |
}
|
@@ -1773,6 +1954,9 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1773 |
update_post_meta($attid, '_wp_attachment_image_alt', trim($image_alt));
|
1774 |
$this->wpdb->update( $this->wpdb->posts, $update_attachment_meta, array('ID' => $attid) );
|
1775 |
}
|
|
|
|
|
|
|
1776 |
}
|
1777 |
}
|
1778 |
// Update post content
|
@@ -1782,7 +1966,9 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1782 |
|
1783 |
$is_images_to_update = apply_filters('pmxi_is_images_to_update', true, $articleData, $current_xml_node);
|
1784 |
|
1785 |
-
|
|
|
|
|
1786 |
|
1787 |
if ( $is_images_to_update and ! empty($images_uploads) and false === $images_uploads['error'] and ( ! empty($articleData['post_type']) and $articleData['post_type'] == "product" and class_exists('PMWI_Plugin') or $is_allow_import_images) and (empty($articleData['ID']) or $this->options['update_all_data'] == "yes" or ( $this->options['update_all_data'] == "no" and $this->options['is_update_images'])) ) {
|
1788 |
|
@@ -1873,7 +2059,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1873 |
$line_img_titles = explode("\n", $image_meta_titles_bundle[$slug][$i]);
|
1874 |
if ( ! empty($line_img_titles) )
|
1875 |
foreach ($line_img_titles as $line_img_title)
|
1876 |
-
$img_titles = array_merge($img_titles, ( ! empty($this->options[$option_slug . 'image_meta_title_delim']) ) ?
|
1877 |
|
1878 |
}
|
1879 |
if ( $this->options[$option_slug . 'set_image_meta_caption'] and !empty($image_meta_captions_bundle[$slug])){
|
@@ -1881,7 +2067,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1881 |
$line_img_captions = explode("\n", $image_meta_captions_bundle[$slug][$i]);
|
1882 |
if ( ! empty($line_img_captions) )
|
1883 |
foreach ($line_img_captions as $line_img_caption)
|
1884 |
-
$img_captions = array_merge($img_captions, ( ! empty($this->options[$option_slug . 'image_meta_caption_delim']) ) ?
|
1885 |
|
1886 |
}
|
1887 |
if ( $this->options[$option_slug . 'set_image_meta_alt'] and !empty($image_meta_alts_bundle[$slug])){
|
@@ -1889,7 +2075,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1889 |
$line_img_alts = explode("\n", $image_meta_alts_bundle[$slug][$i]);
|
1890 |
if ( ! empty($line_img_alts) )
|
1891 |
foreach ($line_img_alts as $line_img_alt)
|
1892 |
-
$img_alts = array_merge($img_alts, ( ! empty($this->options[$option_slug . 'image_meta_alt_delim']) ) ?
|
1893 |
|
1894 |
}
|
1895 |
if ( $this->options[$option_slug . 'set_image_meta_description'] and !empty($image_meta_descriptions_bundle[$slug])){
|
@@ -1897,7 +2083,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1897 |
$line_img_descriptions = ($this->options[$option_slug . 'image_meta_description_delim_logic'] == 'line' or empty($this->options[$option_slug . 'image_meta_description_delim'])) ? explode("\n", $image_meta_descriptions_bundle[$slug][$i]) : array($image_meta_descriptions_bundle[$slug][$i]);
|
1898 |
if ( ! empty($line_img_descriptions) )
|
1899 |
foreach ($line_img_descriptions as $line_img_description)
|
1900 |
-
$img_descriptions = array_merge($img_descriptions, ($this->options[$option_slug . 'image_meta_description_delim_logic'] == 'separate' and ! empty($this->options[$option_slug . 'image_meta_description_delim']) ) ?
|
1901 |
|
1902 |
}
|
1903 |
|
@@ -1915,13 +2101,14 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1915 |
if (empty($url)) continue;
|
1916 |
|
1917 |
$bn = wp_all_import_sanitize_filename(urldecode(wp_all_import_basename($url)));
|
1918 |
-
|
|
|
1919 |
if ( "yes" == $this->options[$option_slug . 'download_images'] and ! empty($auto_extensions_bundle[$slug][$i]) and preg_match('%^(jpg|jpeg|png|gif)$%i', $auto_extensions_bundle[$slug][$i])){
|
1920 |
$img_ext = $auto_extensions_bundle[$slug][$i];
|
1921 |
}
|
1922 |
else {
|
1923 |
-
$img_ext = pmxi_getExtensionFromStr($url);
|
1924 |
-
|
1925 |
if ($img_ext == "") $img_ext = pmxi_get_remote_image_ext($url);
|
1926 |
}
|
1927 |
|
@@ -1968,7 +2155,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1968 |
{
|
1969 |
$logger and call_user_func($logger, __('- found base64_encoded image', 'wp_all_import_plugin'));
|
1970 |
|
1971 |
-
|
1972 |
$image_filepath = $targetDir . '/' . $image_filename;
|
1973 |
imagejpeg($img, $image_filepath);
|
1974 |
if( ! ($image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP))) {
|
@@ -1990,30 +2177,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1990 |
}
|
1991 |
|
1992 |
$image_filename = wp_unique_filename($targetDir, $image_name);
|
1993 |
-
$image_filepath = $targetDir . '/' . $image_filename;
|
1994 |
-
|
1995 |
-
// keep existing and add newest images
|
1996 |
-
if ( $is_keep_existing_images ){
|
1997 |
-
|
1998 |
-
$attch = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM " . $this->wpdb->posts . " WHERE (post_title = %s OR post_title = %s OR post_name = %s) AND post_type = %s AND post_parent = %d;", $image_name, preg_replace('/\\.[^.\\s]{3,4}$/', '', $image_name), sanitize_title($image_name), "attachment", $pid ) );
|
1999 |
-
|
2000 |
-
if ( $attch != null ){
|
2001 |
-
$post_thumbnail_id = get_post_thumbnail_id( $pid );
|
2002 |
-
if ( $post_thumbnail_id == $attch->ID or in_array($attch->ID, $gallery_attachment_ids) ) continue;
|
2003 |
-
}
|
2004 |
-
elseif (file_exists($targetDir . '/' . $image_name)){
|
2005 |
-
if ($bundle_data['type'] == 'images' and ($img_meta = wp_read_image_metadata($targetDir . '/' . $image_name))) {
|
2006 |
-
if (trim($img_meta['title']) && ! is_numeric(sanitize_title($img_meta['title']))){
|
2007 |
-
$img_title = $img_meta['title'];
|
2008 |
-
$attch = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM " . $this->wpdb->posts . " WHERE post_title = %s AND post_type = %s AND post_parent = %d;", $img_title, "attachment", $pid ) );
|
2009 |
-
if ( $attch != null ){
|
2010 |
-
$post_thumbnail_id = get_post_thumbnail_id( $pid );
|
2011 |
-
if ( $post_thumbnail_id == $attch->ID or in_array($attch->ID, $gallery_attachment_ids) ) continue;
|
2012 |
-
}
|
2013 |
-
}
|
2014 |
-
}
|
2015 |
-
}
|
2016 |
-
}
|
2017 |
|
2018 |
// search existing attachment
|
2019 |
if ($this->options[$option_slug . 'search_existing_images'] or "gallery" == $this->options[$option_slug . 'download_images']){
|
@@ -2023,7 +2187,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2023 |
// trying to find existing image in images table
|
2024 |
if ($this->options[$option_slug . 'download_images'] === "yes"){
|
2025 |
$imageList = new PMXI_Image_List();
|
2026 |
-
switch ($this->options['search_existing_images_logic']){
|
2027 |
case 'by_url':
|
2028 |
$attch = $imageList->getExistingImageByUrl($url);
|
2029 |
$logger and call_user_func($logger, sprintf(__('- Searching for existing image `%s` by URL...', 'wp_all_import_plugin'), rawurldecode($url)));
|
@@ -2037,8 +2201,8 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2037 |
|
2038 |
if ("gallery" == $this->options[$option_slug . 'download_images']) $download_image = false;
|
2039 |
|
2040 |
-
//
|
2041 |
-
if (
|
2042 |
|
2043 |
$logger and call_user_func($logger, sprintf(__('- Search for existing image `%s` by `_wp_attached_file` ...', 'wp_all_import_plugin'), rawurldecode($image_name)));
|
2044 |
|
@@ -2062,17 +2226,17 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2062 |
if ($imageRecord->isEmpty()){
|
2063 |
$imageRecord->set(array(
|
2064 |
'attachment_id' => $attid,
|
2065 |
-
'image_url' => $url,
|
2066 |
'image_filename' => $image_name
|
2067 |
))->insert();
|
2068 |
}
|
2069 |
else{
|
2070 |
-
switch ($this->options['search_existing_images_logic']){
|
2071 |
case 'by_url':
|
2072 |
// update image URL if it was not set
|
2073 |
if (empty($imageRecord->image_url)){
|
2074 |
$imageRecord->set(array(
|
2075 |
-
'image_url' => $url
|
2076 |
))->update();
|
2077 |
}
|
2078 |
break;
|
@@ -2162,7 +2326,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2162 |
$file_mime_type = apply_filters('wp_all_import_image_mime_type', $file_mime_type, $image_filepath);
|
2163 |
}
|
2164 |
else {
|
2165 |
-
$file_mime_type = $
|
2166 |
}
|
2167 |
|
2168 |
$handle_image = apply_filters( 'wp_all_import_handle_upload', array(
|
@@ -2182,18 +2346,18 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2182 |
if ($imageRecord->isEmpty()){
|
2183 |
$imageRecord->set(array(
|
2184 |
'attachment_id' => $attid,
|
2185 |
-
'image_url' => $url,
|
2186 |
'image_filename' => $image_name
|
2187 |
))->insert();
|
2188 |
}
|
2189 |
else{
|
2190 |
// image already in image table, but was not founded, so updating it with new data
|
2191 |
-
switch ($this->options['search_existing_images_logic']){
|
2192 |
case 'by_url':
|
2193 |
// update image URL if it was not set
|
2194 |
if (empty($imageRecord->image_url)){
|
2195 |
$imageRecord->set(array(
|
2196 |
-
'image_url' => $url
|
2197 |
))->update();
|
2198 |
}
|
2199 |
break;
|
@@ -2235,15 +2399,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2235 |
$success_images = true;
|
2236 |
|
2237 |
switch ($post_type[$i]){
|
2238 |
-
|
2239 |
-
$post_thumbnail_id = get_term_meta( $pid, 'thumbnail_id', true );
|
2240 |
-
if ($bundle_data['type'] == 'images' and empty($post_thumbnail_id) and ($this->options[$option_slug . 'is_featured'] or !empty($is_image_featured[$i])) ) {
|
2241 |
-
update_term_meta($pid, 'thumbnail_id', $attid);
|
2242 |
-
}
|
2243 |
-
elseif(!in_array($attid, $gallery_attachment_ids) and $post_thumbnail_id != $attid){
|
2244 |
-
$gallery_attachment_ids[] = $attid;
|
2245 |
-
}
|
2246 |
-
break;
|
2247 |
default:
|
2248 |
$post_thumbnail_id = get_post_thumbnail_id( $pid );
|
2249 |
|
@@ -2321,112 +2477,149 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2321 |
}
|
2322 |
}
|
2323 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2324 |
if ( ! $is_images_to_update )
|
2325 |
{
|
2326 |
$logger and call_user_func($logger, sprintf(__('Images import skipped for post `%s` according to \'pmxi_is_images_to_update\' filter...', 'wp_all_import_plugin'), $articleData['post_title']));
|
2327 |
}
|
2328 |
// [/featured image]
|
2329 |
|
2330 |
-
|
2331 |
-
|
2332 |
|
2333 |
$attachments_uploads = apply_filters('wp_all_import_attachments_uploads_dir', $uploads, $articleData, $current_xml_node, $this->id);
|
2334 |
|
2335 |
-
|
2336 |
|
2337 |
-
|
2338 |
-
|
2339 |
|
2340 |
-
|
2341 |
|
2342 |
-
|
2343 |
-
|
2344 |
-
|
2345 |
-
|
2346 |
-
|
2347 |
-
|
2348 |
-
|
2349 |
|
2350 |
-
|
2351 |
|
2352 |
-
|
2353 |
|
2354 |
-
|
2355 |
-
|
2356 |
-
$atchs = str_getcsv($attachment, $this->options['atch_delim']);
|
2357 |
|
2358 |
-
|
2359 |
|
2360 |
-
|
2361 |
|
2362 |
-
|
2363 |
|
2364 |
-
|
|
|
|
|
2365 |
|
2366 |
-
|
2367 |
-
$attachment_filepath = $targetDir . '/' . sanitize_file_name($attachment_filename);
|
2368 |
|
2369 |
-
|
|
|
|
|
|
|
2370 |
|
2371 |
// search existing attachment
|
2372 |
$attch = wp_all_import_get_image_from_gallery($attachment_filename, $targetDir, 'files', $logger);
|
2373 |
|
2374 |
-
|
2375 |
-
|
2376 |
-
|
|
|
2377 |
$logger and call_user_func($logger, sprintf(__('- Using existing file `%s` for post `%s` ...', 'wp_all_import_plugin'), trim($attachment_filename), $articleData['post_title']));
|
2378 |
-
|
2379 |
-
}
|
2380 |
-
|
2381 |
-
if ($download_file){
|
2382 |
|
2383 |
-
|
2384 |
-
|
2385 |
|
2386 |
-
|
2387 |
-
|
2388 |
-
$request = get_file_curl(trim($atch_url), $attachment_filepath);
|
2389 |
|
2390 |
-
|
2391 |
-
|
2392 |
-
|
2393 |
-
|
2394 |
-
|
2395 |
-
|
2396 |
-
|
2397 |
-
|
2398 |
-
|
2399 |
-
|
2400 |
-
|
2401 |
-
|
2402 |
-
|
2403 |
-
|
2404 |
-
|
2405 |
-
|
2406 |
-
|
2407 |
-
|
2408 |
-
|
2409 |
-
|
2410 |
-
|
2411 |
-
|
2412 |
-
|
2413 |
-
|
2414 |
-
|
2415 |
-
|
2416 |
-
|
2417 |
-
|
2418 |
-
|
2419 |
-
|
2420 |
-
|
2421 |
-
|
2422 |
-
|
2423 |
-
|
2424 |
-
|
2425 |
-
|
2426 |
-
|
2427 |
-
|
2428 |
-
|
2429 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2430 |
|
2431 |
if ($attach_id && ! is_wp_error($attach_id))
|
2432 |
{
|
@@ -2450,17 +2643,17 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2450 |
$logger and call_user_func($logger, __('- <b>ACTION</b>: pmxi_attachment_uploaded', 'wp_all_import_plugin'));
|
2451 |
do_action( 'pmxi_attachment_uploaded', $pid, $attach_id, $attachment_filepath);
|
2452 |
}
|
2453 |
-
|
2454 |
-
|
2455 |
-
|
2456 |
-
|
2457 |
-
|
2458 |
|
2459 |
-
|
2460 |
-
|
2461 |
-
|
2462 |
-
|
2463 |
-
|
2464 |
|
2465 |
// [custom taxonomies]
|
2466 |
if ( ! empty($taxonomies) ){
|
@@ -2503,7 +2696,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2503 |
unset($existing_taxonomies[$tx_name][$i]);
|
2504 |
}
|
2505 |
|
2506 |
-
// create term if not exists
|
2507 |
if ( ! empty($txes[$i]) ):
|
2508 |
foreach ($txes[$i] as $key => $single_tax) {
|
2509 |
$is_created_term = false;
|
@@ -2549,12 +2742,9 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2549 |
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: `%s`', 'wp_all_import_plugin'), $term->get_error_message()));
|
2550 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
2551 |
}
|
2552 |
-
elseif ( ! empty($term)) {
|
2553 |
-
|
2554 |
-
$cat_id
|
2555 |
-
|
2556 |
-
if ($cat_id and $single_tax['assign'])
|
2557 |
-
{
|
2558 |
$term = get_term_by('id', $cat_id, $tx_name);
|
2559 |
if ( $term->parent != '0' and ! empty($this->options['tax_is_full_search_' . $this->options['tax_logic'][$tx_name]][$tx_name]) and empty($this->options['tax_assign_to_one_term_' . $this->options['tax_logic'][$tx_name]][$tx_name])){
|
2560 |
$parent_ids = wp_all_import_get_parent_terms($cat_id, $tx_name);
|
@@ -2614,7 +2804,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2614 |
$is_update = ! empty($articleData['ID']);
|
2615 |
|
2616 |
// fire important hooks after custom fields are added
|
2617 |
-
if ( ! $this->options['is_fast_mode'] and ! in_array($this->options['custom_type'], array('import_users', 'taxonomies'))){
|
2618 |
$_post = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM {$this->wpdb->posts} WHERE ID = %d LIMIT 1", $pid ) );
|
2619 |
$_post = sanitize_post( $_post, 'raw' );
|
2620 |
$post_object = new WP_Post( $_post );
|
@@ -2737,7 +2927,8 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2737 |
|
2738 |
private function getRecordTitle($articleData){
|
2739 |
switch ($this->options['custom_type']){
|
2740 |
-
|
|
|
2741 |
$title = $articleData['user_login'];
|
2742 |
break;
|
2743 |
default:
|
@@ -2751,7 +2942,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2751 |
|
2752 |
$downloaded = false;
|
2753 |
|
2754 |
-
$
|
2755 |
|
2756 |
$logger and call_user_func($logger, sprintf(__('- Downloading image from `%s`', 'wp_all_import_plugin'), $url));
|
2757 |
|
@@ -2760,12 +2951,16 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2760 |
$get_ctx = stream_context_create(array('http' => array('timeout' => 5)));
|
2761 |
|
2762 |
if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($image_filepath, @file_get_contents($url, false, $get_ctx))) {
|
|
|
2763 |
@unlink($image_filepath); // delete file since failed upload may result in empty file created
|
2764 |
} else{
|
2765 |
|
2766 |
if($type == 'images'){
|
2767 |
-
if( preg_match('%\W(svg)$%i', wp_all_import_basename($image_filepath)) or $
|
2768 |
$downloaded = true;
|
|
|
|
|
|
|
2769 |
$logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
|
2770 |
}
|
2771 |
else
|
@@ -2775,14 +2970,14 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2775 |
}
|
2776 |
}
|
2777 |
elseif($type == 'files'){
|
2778 |
-
if( $
|
2779 |
$downloaded = true;
|
2780 |
$logger and call_user_func($logger, sprintf(__('- File `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
|
2781 |
}
|
2782 |
}
|
2783 |
}
|
2784 |
|
2785 |
-
return $downloaded ? $
|
2786 |
}
|
2787 |
|
2788 |
public function createAttachment($pid, $handle_image, $image_name, $post_author, $post_type, $is_cron, $logger, $type = 'images'){
|
@@ -2912,10 +3107,11 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2912 |
update_user_meta( $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value'] );
|
2913 |
$logger and call_user_func($logger, sprintf(__('Instead of deletion user with ID `%s`, set Custom Field `%s` to value `%s`', 'wp_all_import_plugin'), $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value']));
|
2914 |
break;
|
2915 |
-
|
2916 |
-
|
2917 |
-
$logger and call_user_func($logger, sprintf(__('Instead of deletion
|
2918 |
break;
|
|
|
2919 |
default:
|
2920 |
update_post_meta( $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value'] );
|
2921 |
$logger and call_user_func($logger, sprintf(__('Instead of deletion post with ID `%s`, set Custom Field `%s` to value `%s`', 'wp_all_import_plugin'), $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value']));
|
@@ -2939,7 +3135,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2939 |
$to_delete = apply_filters('wp_all_import_is_post_to_delete', $to_delete, $missingPostRecord['post_id'], $this);
|
2940 |
|
2941 |
if ($to_delete){
|
2942 |
-
if ( ! in_array($this->options['custom_type'], array("import_users", "taxonomies")) ){
|
2943 |
// Remove attachments
|
2944 |
empty($this->options['is_keep_attachments']) and wp_delete_attachments($missingPostRecord['post_id'], true, 'files');
|
2945 |
// Remove images
|
@@ -2984,7 +3180,8 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2984 |
}
|
2985 |
|
2986 |
switch ($this->options['custom_type']){
|
2987 |
-
|
|
|
2988 |
do_action('pmxi_delete_post', $ids, $this);
|
2989 |
// delete_user action
|
2990 |
foreach( $ids as $id) {
|
@@ -2998,26 +3195,16 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2998 |
foreach( $ids as $id) {
|
2999 |
do_action( 'deleted_user', $id, $reassign = null );
|
3000 |
}
|
3001 |
-
|
3002 |
break;
|
3003 |
-
case 'taxonomies':
|
3004 |
-
do_action('pmxi_delete_taxonomy_term', $ids, $this);
|
3005 |
-
foreach ($ids as $term_id){
|
3006 |
-
wp_delete_term( $term_id, $this->options['taxonomy_type'] );
|
3007 |
-
}
|
3008 |
|
3009 |
-
break;
|
3010 |
default:
|
3011 |
do_action('pmxi_delete_post', $ids, $this);
|
3012 |
-
$
|
3013 |
-
|
3014 |
-
|
3015 |
-
LEFT JOIN ".$this->wpdb->postmeta." c ON ( a.ID = c.post_id )
|
3016 |
-
WHERE a.ID IN (" . implode(',', $ids) . ");";
|
3017 |
break;
|
3018 |
}
|
3019 |
-
|
3020 |
-
$this->wpdb->query( $sql );
|
3021 |
|
3022 |
// Delete record form pmxi_posts
|
3023 |
$sql = "DELETE FROM " . PMXI_Plugin::getInstance()->getTablePrefix() . "posts WHERE post_id IN (".implode(',', $ids).") AND import_id = %d";
|
@@ -3057,7 +3244,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
3057 |
|
3058 |
protected function executeSQL(){
|
3059 |
|
3060 |
-
$import_entry = ( $this->options['custom_type']
|
3061 |
|
3062 |
// prepare bulk SQL query
|
3063 |
$meta_table = _get_meta_table( $import_entry );
|
@@ -3226,7 +3413,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
3226 |
{
|
3227 |
foreach ( $ids as $k => $id ) {
|
3228 |
|
3229 |
-
if ( ! in_array($this->options['custom_type'], array('import_users', 'taxonomies')) ){
|
3230 |
// Remove attachments
|
3231 |
if ($is_delete_attachments == 'yes' or $is_delete_attachments == 'auto' and empty($this->options['is_keep_attachments']))
|
3232 |
{
|
@@ -3245,13 +3432,14 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
3245 |
{
|
3246 |
wp_delete_attachments($id, false, 'images');
|
3247 |
}
|
3248 |
-
}
|
3249 |
|
3250 |
-
|
3251 |
-
|
3252 |
|
3253 |
switch ($this->options['custom_type']){
|
3254 |
-
|
|
|
3255 |
do_action('pmxi_delete_post', $ids, $this);
|
3256 |
// delete_user action
|
3257 |
foreach( $ids as $id) {
|
@@ -3265,27 +3453,16 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
3265 |
foreach( $ids as $id) {
|
3266 |
do_action( 'deleted_user', $id, $reassign = null );
|
3267 |
}
|
|
|
3268 |
break;
|
3269 |
-
|
3270 |
-
do_action('pmxi_delete_taxonomies', $ids);
|
3271 |
-
foreach ($ids as $term_id){
|
3272 |
-
wp_delete_term( $term_id, $this->options['taxonomy_type'] );
|
3273 |
-
}
|
3274 |
-
break;
|
3275 |
default:
|
3276 |
do_action('pmxi_delete_post', $ids, $this);
|
3277 |
-
$
|
3278 |
-
|
3279 |
-
|
3280 |
-
LEFT JOIN ".$this->wpdb->postmeta." c ON ( a.ID = c.post_id )
|
3281 |
-
LEFT JOIN ".$this->wpdb->posts." d ON ( a.ID = d.post_parent )
|
3282 |
-
WHERE a.ID IN (".implode(',', $ids).");";
|
3283 |
break;
|
3284 |
}
|
3285 |
-
|
3286 |
-
$this->wpdb->query(
|
3287 |
-
$sql
|
3288 |
-
);
|
3289 |
}
|
3290 |
|
3291 |
/**
|
131 |
$records = array();
|
132 |
|
133 |
$is_import_complete = false;
|
134 |
+
|
135 |
+
// Set current import ID
|
136 |
+
if (!empty(PMXI_Plugin::$session)) {
|
137 |
+
PMXI_Plugin::$session->import_id = $this->id;
|
138 |
+
PMXI_Plugin::$session->save_data();
|
139 |
+
}
|
140 |
+
|
141 |
try {
|
142 |
|
143 |
//$errorHandler = new PMXI_Error();
|
412 |
$taxonomies = array();
|
413 |
$exclude_taxonomies = apply_filters('pmxi_exclude_taxonomies', (class_exists('PMWI_Plugin')) ? array('post_format', 'product_type', 'product_shipping_class', 'product_visibility') : array('post_format'));
|
414 |
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($this->options['custom_type']), 'object'), array_flip($exclude_taxonomies));
|
415 |
+
if ( $this->is_parsing_required('is_update_categories') && ! empty($post_taxonomies) && ! in_array($this->options['custom_type'], array('import_users', 'taxonomies', 'shop_customer')) ):
|
416 |
foreach ($post_taxonomies as $ctx): if ("" == $ctx->labels->name or (class_exists('PMWI_Plugin') and strpos($ctx->name, "pa_") === 0 and $this->options['custom_type'] == "product")) continue;
|
417 |
$chunk == 1 and $logger and call_user_func($logger, sprintf(__('Composing terms for `%s` taxonomy...', 'wp_all_import_plugin'), $ctx->labels->name));
|
418 |
$tx_name = $ctx->name;
|
868 |
//set_error_handler( array($errorHandler, 'import_data_handler'), E_ALL | E_STRICT | E_WARNING );
|
869 |
|
870 |
switch ($this->options['custom_type']) {
|
871 |
+
|
|
|
|
|
|
|
|
|
872 |
default:
|
873 |
$custom_type_details = get_post_type_object($post_type[$i]);
|
874 |
break;
|
899 |
do_action( "pmxi_before_post_import_{$addon}", $data, $i, $this->id );
|
900 |
}
|
901 |
|
902 |
+
if ( empty($titles[$i]) && !in_array($this->options['custom_type'], array('shop_order', 'import_users', 'shop_customer')) ) {
|
903 |
if ( ! empty($addons_data['PMWI_Plugin']) and !empty($addons_data['PMWI_Plugin']['single_product_parent_ID'][$i]) ){
|
904 |
$titles[$i] = $addons_data['PMWI_Plugin']['single_product_parent_ID'][$i] . ' Product Variation';
|
905 |
}
|
926 |
'role' => ('' == $addons_data['PMUI_Plugin']['pmui_role'][$i]) ? 'subscriber' : $addons_data['PMUI_Plugin']['pmui_role'][$i],
|
927 |
), $this->options['custom_type'], $this->id, $i);
|
928 |
$logger and call_user_func($logger, sprintf(__('Combine all data for user %s...', 'wp_all_import_plugin'), $articleData['user_login']));
|
929 |
+
|
930 |
+
break;
|
931 |
+
|
932 |
+
case 'shop_customer':
|
933 |
+
|
|
|
|
|
|
|
|
|
|
|
934 |
$articleData = apply_filters('wp_all_import_combine_article_data', array(
|
935 |
+
'user_pass' => $addons_data['PMUI_Plugin']['pmsci_customer_pass'][$i],
|
936 |
+
'user_login' => $addons_data['PMUI_Plugin']['pmsci_customer_logins'][$i],
|
937 |
+
'user_nicename' => $addons_data['PMUI_Plugin']['pmsci_customer_nicename'][$i],
|
938 |
+
'user_url' => $addons_data['PMUI_Plugin']['pmsci_customer_url'][$i],
|
939 |
+
'user_email' => $addons_data['PMUI_Plugin']['pmsci_customer_email'][$i],
|
940 |
+
'display_name' => $addons_data['PMUI_Plugin']['pmsci_customer_display_name'][$i],
|
941 |
+
'user_registered' => $addons_data['PMUI_Plugin']['pmsci_customer_registered'][$i],
|
942 |
+
'first_name' => $addons_data['PMUI_Plugin']['pmsci_customer_first_name'][$i],
|
943 |
+
'last_name' => $addons_data['PMUI_Plugin']['pmsci_customer_last_name'][$i],
|
944 |
+
'description' => $addons_data['PMUI_Plugin']['pmsci_customer_description'][$i],
|
945 |
+
'nickname' => $addons_data['PMUI_Plugin']['pmsci_customer_nickname'][$i],
|
946 |
+
'role' => $addons_data['PMUI_Plugin']['pmsci_customer_role'][$i],
|
947 |
+
|
948 |
), $this->options['custom_type'], $this->id, $i);
|
949 |
+
$logger and call_user_func($logger, sprintf(__('Combine account data for customer %s...', 'wp_all_import_plugin'), $articleData['user_login']));
|
950 |
+
|
951 |
+
$billing_data = array(
|
952 |
+
|
953 |
+
'billing_first_name' => $addons_data['PMUI_Plugin']['pmsci_customer_billing_first_name'][$i],
|
954 |
+
'billing_last_name' => $addons_data['PMUI_Plugin']['pmsci_customer_billing_last_name'][$i],
|
955 |
+
'billing_company' => $addons_data['PMUI_Plugin']['pmsci_customer_billing_company'][$i],
|
956 |
+
'billing_address_1' => $addons_data['PMUI_Plugin']['pmsci_customer_billing_address_1'][$i],
|
957 |
+
'billing_address_2' => $addons_data['PMUI_Plugin']['pmsci_customer_billing_address_2'][$i],
|
958 |
+
'billing_city' => $addons_data['PMUI_Plugin']['pmsci_customer_billing_city'][$i],
|
959 |
+
'billing_postcode' => $addons_data['PMUI_Plugin']['pmsci_customer_billing_postcode'][$i],
|
960 |
+
'billing_country' => $addons_data['PMUI_Plugin']['pmsci_customer_billing_country'][$i],
|
961 |
+
'billing_state' => $addons_data['PMUI_Plugin']['pmsci_customer_billing_state'][$i],
|
962 |
+
'billing_phone' => $addons_data['PMUI_Plugin']['pmsci_customer_billing_phone'][$i],
|
963 |
+
'billing_email' => $addons_data['PMUI_Plugin']['pmsci_customer_billing_email'][$i],
|
964 |
+
|
965 |
+
);
|
966 |
+
$logger and call_user_func($logger, sprintf(__('Combine billing data for customer %s...', 'wp_all_import_plugin'), $articleData['user_login']));
|
967 |
+
|
968 |
+
$shipping_data = array(
|
969 |
+
|
970 |
+
'shipping_first_name' => $addons_data['PMUI_Plugin']['pmsci_customer_shipping_first_name'][$i],
|
971 |
+
'shipping_last_name' => $addons_data['PMUI_Plugin']['pmsci_customer_shipping_last_name'][$i],
|
972 |
+
'shipping_company' => $addons_data['PMUI_Plugin']['pmsci_customer_shipping_company'][$i],
|
973 |
+
'shipping_address_1' => $addons_data['PMUI_Plugin']['pmsci_customer_shipping_address_1'][$i],
|
974 |
+
'shipping_address_2' => $addons_data['PMUI_Plugin']['pmsci_customer_shipping_address_2'][$i],
|
975 |
+
'shipping_city' => $addons_data['PMUI_Plugin']['pmsci_customer_shipping_city'][$i],
|
976 |
+
'shipping_postcode' => $addons_data['PMUI_Plugin']['pmsci_customer_shipping_postcode'][$i],
|
977 |
+
'shipping_country' => $addons_data['PMUI_Plugin']['pmsci_customer_shipping_country'][$i],
|
978 |
+
'shipping_state' => $addons_data['PMUI_Plugin']['pmsci_customer_shipping_state'][$i],
|
979 |
+
|
980 |
+
);
|
981 |
+
$logger and call_user_func($logger, sprintf(__('Combine shipping data for customer %s...', 'wp_all_import_plugin'), $articleData['user_login']));
|
982 |
+
|
983 |
+
break;
|
984 |
+
|
985 |
+
|
986 |
default:
|
987 |
$articleData = apply_filters('wp_all_import_combine_article_data', array(
|
988 |
'post_type' => $post_type[$i],
|
1042 |
foreach($postList->getBy($args)->convertRecords() as $postRecord) {
|
1043 |
if ( ! $postRecord->isEmpty() ) {
|
1044 |
switch ($this->options['custom_type']){
|
1045 |
+
case 'import_users':
|
1046 |
+
case 'shop_customer':
|
1047 |
$post_to_update = get_user_by('id', $post_to_update_id = $postRecord->post_id);
|
1048 |
break;
|
1049 |
+
|
|
|
|
|
1050 |
default:
|
1051 |
$post_to_update = get_post($post_to_update_id = $postRecord->post_id);
|
1052 |
break;
|
1079 |
$logger and call_user_func($logger, sprintf(__('Find corresponding article among database for post `%s`...', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
|
1080 |
|
1081 |
$duplicates = array();
|
1082 |
+
if ('pid' == $this->options['duplicate_indicator']) {
|
1083 |
+
$duplicate_id = $duplicate_indicator_values[$i];
|
1084 |
+
if ($duplicate_id && !in_array($articleData['post_type'], array('import_users', 'shop_customer', 'taxonomies'))) {
|
1085 |
+
$duplicate_post_type = get_post_type($duplicate_id);
|
1086 |
+
if ($duplicate_post_type !== $articleData['post_type']) {
|
1087 |
+
$duplicate_id = false;
|
1088 |
+
}
|
1089 |
+
}
|
1090 |
+
}
|
1091 |
+
// handle duplicates according to import settings
|
1092 |
+
else
|
1093 |
+
{
|
1094 |
+
$duplicates = pmxi_findDuplicates($articleData, $custom_duplicate_name[$i], $custom_duplicate_value[$i], $this->options['duplicate_indicator'], $duplicate_indicator_values[$i]);
|
1095 |
+
$duplicate_id = ( ! empty($duplicates)) ? array_shift($duplicates) : false;
|
1096 |
+
}
|
1097 |
|
1098 |
if ( ! empty($duplicate_id)) {
|
1099 |
$duplicate_id = apply_filters('wp_all_import_manual_matching_duplicate_id', $duplicate_id, $duplicates, $articleData, $this->id);
|
1103 |
}
|
1104 |
$logger and call_user_func($logger, sprintf(__('Duplicate post was found for post `%s`...', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
|
1105 |
switch ($this->options['custom_type']){
|
1106 |
+
case 'import_users':
|
1107 |
+
case 'shop_customer':
|
1108 |
$post_to_update = get_user_by('id', $post_to_update_id = $duplicate_id);
|
1109 |
break;
|
1110 |
+
|
|
|
|
|
1111 |
default:
|
1112 |
+
if (class_exists('WPAI_WPML') && ! empty($this->options['wpml_addon']['lng'])){
|
1113 |
+
// trying to find needed translation for update
|
1114 |
+
$duplicate_id = apply_filters('wpml_object_id', $duplicate_id, get_post_type($duplicate_id), true, $this->options['wpml_addon']['lng']);
|
1115 |
+
}
|
1116 |
$post_to_update = get_post($post_to_update_id = $duplicate_id);
|
1117 |
break;
|
1118 |
}
|
1123 |
}
|
1124 |
}
|
1125 |
|
1126 |
+
$is_post_to_skip = apply_filters('wp_all_import_is_post_to_skip', false, $this->id, $current_xml_node, $i, $post_to_update_id, $simpleXml);
|
1127 |
|
1128 |
if ( $is_post_to_skip ) {
|
1129 |
+
if ( ! $postRecord->isEmpty() ) {
|
1130 |
+
$postRecord->set(array('iteration' => $this->iteration))->update();
|
1131 |
+
}
|
1132 |
+
$skipped++;
|
1133 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1134 |
$logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
|
1135 |
$logger and !$is_cron and PMXI_Plugin::$session->save_data();
|
1137 |
}
|
1138 |
|
1139 |
if ( ! empty($specified_records) ) {
|
1140 |
+
if ( ! in_array($created + $updated + $skipped + 1, $specified_records) ) {
|
1141 |
+
if ( ! $postRecord->isEmpty() ) {
|
1142 |
+
$postRecord->set(array('iteration' => $this->iteration))->update();
|
1143 |
+
}
|
|
|
1144 |
$skipped++;
|
1145 |
$logger and call_user_func($logger, __('<b>SKIPPED</b>: by specified records option', 'wp_all_import_plugin'));
|
1146 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1156 |
|
1157 |
$continue_import = true;
|
1158 |
|
1159 |
+
$continue_import = apply_filters('wp_all_import_is_post_to_update', $continue_import, $post_to_update_id, $current_xml_node, $this->id, $simpleXml);
|
1160 |
|
1161 |
if ( ! $continue_import ){
|
1162 |
|
1200 |
if ( ! $this->options['is_update_role'] ) unset($articleData['role']);
|
1201 |
if ( ! $this->options['is_update_nickname'] ) $articleData['nickname'] = get_user_meta($post_to_update->ID, 'nickname', true);
|
1202 |
if ( ! $this->options['is_update_description'] ) $articleData['description'] = get_user_meta($post_to_update->ID, 'description', true);
|
1203 |
+
|
1204 |
+
if ( ! $this->options['is_update_login'] ) {
|
1205 |
+
$articleData['user_login'] = $post_to_update->user_login;
|
1206 |
+
} elseif( empty($articleData['user_login']) ) {
|
1207 |
+
$articleData['user_login'] = $post_to_update->user_login;
|
1208 |
+
$logger and call_user_func($logger, sprintf(__('No username provided for user ID `%s`, preserve existing username for user.', 'wp_all_import_plugin'), $articleData['ID']));
|
1209 |
+
}
|
1210 |
+
|
1211 |
+
if ( ! $this->options['is_update_password'] ) unset($articleData['user_pass']);
|
1212 |
if ( ! $this->options['is_update_nicename'] ) $articleData['user_nicename'] = $post_to_update->user_nicename;
|
1213 |
+
|
1214 |
+
if ( ! $this->options['is_update_email'] ) {
|
1215 |
+
$articleData['user_email'] = $post_to_update->user_email;
|
1216 |
+
} elseif( empty($articleData['user_email']) ) {
|
1217 |
+
$articleData['user_email'] = $post_to_update->user_email;
|
1218 |
+
$logger and call_user_func($logger, sprintf(__('No email provided for user ID `%s`, preserve existing email for user.', 'wp_all_import_plugin'), $articleData['ID']));
|
1219 |
+
}
|
1220 |
+
|
1221 |
+
if ( ! $this->options['is_update_registered'] ) $articleData['user_registered'] = $post_to_update->user_registered;
|
1222 |
if ( ! $this->options['is_update_display_name'] ) $articleData['display_name'] = $post_to_update->display_name;
|
1223 |
if ( ! $this->options['is_update_url'] ) $articleData['user_url'] = $post_to_update->user_url;
|
1224 |
+
|
1225 |
+
break;
|
1226 |
+
case 'shop_customer':
|
1227 |
+
if ( ! $this->options['is_update_first_name'] ) $articleData['first_name'] = $post_to_update->first_name;
|
1228 |
+
if ( ! $this->options['is_update_last_name'] ) $articleData['last_name'] = $post_to_update->last_name;
|
1229 |
+
if ( ! $this->options['is_update_role'] ) unset($articleData['role']);
|
1230 |
+
if ( ! $this->options['is_update_nickname'] ) $articleData['nickname'] = get_user_meta($post_to_update->ID, 'nickname', true);
|
1231 |
+
if ( ! $this->options['is_update_description'] ) $articleData['description'] = get_user_meta($post_to_update->ID, 'description', true);
|
1232 |
+
|
1233 |
+
if ( ! $this->options['is_update_login'] ) {
|
1234 |
+
$articleData['user_login'] = $post_to_update->user_login;
|
1235 |
+
} elseif( empty($articleData['user_login']) ) {
|
1236 |
+
$articleData['user_login'] = $post_to_update->user_login;
|
1237 |
+
$logger and call_user_func($logger, sprintf(__('No username provided for customer ID `%s`, preserve existing username for customer.', 'wp_all_import_plugin'), $articleData['ID']));
|
1238 |
+
}
|
1239 |
+
|
1240 |
+
if ( ! $this->options['is_update_password'] ) unset($articleData['user_pass']);
|
1241 |
+
if ( ! $this->options['is_update_nicename'] ) $articleData['user_nicename'] = $post_to_update->user_nicename;
|
1242 |
+
|
1243 |
+
if ( ! $this->options['is_update_email'] ) {
|
1244 |
+
$articleData['user_email'] = $post_to_update->user_email;
|
1245 |
+
} elseif( empty($articleData['user_email']) ) {
|
1246 |
+
$articleData['user_email'] = $post_to_update->user_email;
|
1247 |
+
$logger and call_user_func($logger, sprintf(__('No email provided for customer ID `%s`, preserve existing email for customer.', 'wp_all_import_plugin'), $articleData['ID']));
|
1248 |
+
}
|
1249 |
+
|
1250 |
+
if ( ! $this->options['is_update_registered'] ) $articleData['user_registered'] = $post_to_update->user_registered;
|
1251 |
+
if ( ! $this->options['is_update_display_name'] ) $articleData['display_name'] = $post_to_update->display_name;
|
1252 |
+
if ( ! $this->options['is_update_url'] ) $articleData['user_url'] = $post_to_update->user_url;
|
1253 |
+
|
1254 |
+
break;
|
1255 |
+
|
1256 |
+
|
1257 |
default:
|
1258 |
// preserve date of already existing article when duplicate is found
|
1259 |
if ( ( ! $this->options['is_update_categories'] and ( is_object_in_taxonomy( $post_type[$i], 'category' ) or is_object_in_taxonomy( $post_type[$i], 'post_tag' ) ) ) or ($this->options['is_update_categories'] and $this->options['update_categories_logic'] != "full_update")) {
|
1342 |
}
|
1343 |
break;
|
1344 |
}
|
1345 |
+
} else {
|
1346 |
+
// When "Update all data" is chosen, and the import doesn't contain username or email address data for User & WooCommerce Customer imports
|
1347 |
+
switch ($this->options['custom_type']){
|
1348 |
+
case 'import_users':
|
1349 |
+
if ( empty($articleData['user_login']) ) {
|
1350 |
+
$articleData['user_login'] = $post_to_update->user_login;
|
1351 |
+
$logger and call_user_func($logger, sprintf(__('No username provided for user ID `%s`, preserve existing username for user.', 'wp_all_import_plugin'), $articleData['ID']));
|
1352 |
+
}
|
1353 |
+
if ( empty($articleData['user_email']) ) {
|
1354 |
+
$articleData['user_email'] = $post_to_update->user_email;
|
1355 |
+
$logger and call_user_func($logger, sprintf(__('No email provided for user ID `%s`, preserve existing email for user.', 'wp_all_import_plugin'), $articleData['ID']));
|
1356 |
+
}
|
1357 |
+
break;
|
1358 |
+
case 'shop_customer':
|
1359 |
+
if ( empty($articleData['user_login']) ) {
|
1360 |
+
$articleData['user_login'] = $post_to_update->user_login;
|
1361 |
+
$logger and call_user_func($logger, sprintf(__('No username provided for customer ID `%s`, preserve existing username for customer.', 'wp_all_import_plugin'), $articleData['ID']));
|
1362 |
+
}
|
1363 |
+
if ( empty($articleData['user_email']) ) {
|
1364 |
+
$articleData['user_email'] = $post_to_update->user_email;
|
1365 |
+
$logger and call_user_func($logger, sprintf(__('No email provided for customer ID `%s`, preserve existing email for customer.', 'wp_all_import_plugin'), $articleData['ID']));
|
1366 |
+
}
|
1367 |
+
break;
|
1368 |
+
default:
|
1369 |
+
break;
|
1370 |
+
}
|
1371 |
+
|
1372 |
}
|
1373 |
|
1374 |
$is_images_to_delete = apply_filters('pmxi_delete_images', true, $articleData, $current_xml_node);
|
1375 |
if ( $is_images_to_delete ) {
|
1376 |
switch ($this->options['custom_type']) {
|
1377 |
case 'import_users':
|
1378 |
+
case 'shop_customer':
|
1379 |
|
1380 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1381 |
|
|
|
1382 |
default:
|
1383 |
if ($this->options['update_all_data'] == 'yes' or ($this->options['update_all_data'] == 'no' and $this->options['is_update_attachments'])) {
|
1384 |
$logger and call_user_func($logger, sprintf(__('Deleting attachments for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
1410 |
}
|
1411 |
|
1412 |
$logger and call_user_func($logger, sprintf(__('Applying filter `pmxi_article_data` for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
|
1413 |
+
$articleData = apply_filters('pmxi_article_data', $articleData, $this, $post_to_update, $current_xml_node);
|
1414 |
|
1415 |
// no new records are created. it will only update posts it finds matching duplicates for
|
1416 |
if ( ! $this->options['create_new_records'] and empty($articleData['ID']) ){
|
1542 |
$this->wpdb->update($this->wpdb->users, array('user_login' => $articleData['user_login']), array('ID' => $articleData['ID']));
|
1543 |
}
|
1544 |
$articleData['post_title'] = $articleData['user_login'];
|
1545 |
+
|
1546 |
+
break;
|
1547 |
+
|
1548 |
+
case 'shop_customer':
|
1549 |
+
if (empty($articleData['ID']) && email_exists( $articleData['user_email'] )){
|
1550 |
+
$logger and call_user_func($logger, sprintf(__('<b>WARNING</b> Sorry, that email address `%s` is already used!', 'wp_all_import_plugin'), $articleData['user_email']));
|
1551 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1552 |
+
$logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
|
1553 |
+
$logger and !$is_cron and PMXI_Plugin::$session->save_data();
|
1554 |
+
$skipped++;
|
1555 |
+
continue 2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1556 |
}
|
1557 |
+
$pid = (empty($articleData['ID'])) ? wp_insert_user( $articleData ) : wp_update_user( $articleData );
|
1558 |
+
// update user login using direct sql query
|
1559 |
+
if (!empty($articleData['ID'])){
|
1560 |
+
$this->wpdb->update($this->wpdb->users, array('user_login' => $articleData['user_login']), array('ID' => $articleData['ID']));
|
1561 |
+
}
|
1562 |
+
|
1563 |
+
// Update billing details for customer
|
1564 |
+
if ( empty($articleData['ID']) or $this->options['update_all_data'] == 'yes' or $this->options['pmsci_is_update_billing_fields'] )
|
1565 |
+
{
|
1566 |
+
|
1567 |
+
$logger and call_user_func($logger, sprintf(__('- Importing billing data...', 'wp_all_import_plugin')));
|
1568 |
+
|
1569 |
+
if (!empty($billing_data)) {
|
1570 |
+
|
1571 |
+
foreach($billing_data as $key => $value) {
|
1572 |
+
|
1573 |
+
if (
|
1574 |
+
// Update all Billing Fields
|
1575 |
+
( $this->options['pmsci_update_billing_fields_logic'] == 'full_update' )
|
1576 |
+
or
|
1577 |
+
// Update only these Billing Fields, leave the rest alone
|
1578 |
+
( $this->options['pmsci_update_billing_fields_logic'] == 'only' and in_array( $key, $this->options['pmsci_billing_fields_list'] ) )
|
1579 |
+
or
|
1580 |
+
// Leave these fields alone, update all other Billing Fields
|
1581 |
+
|
1582 |
+
( $this->options['pmsci_update_billing_fields_logic'] == 'all_except' and !in_array( $key, $this->options['pmsci_billing_fields_list'] ) )
|
1583 |
+
|
1584 |
+
){
|
1585 |
+
|
1586 |
+
update_user_meta($pid, $key, $value);
|
1587 |
+
$logger and call_user_func($logger, sprintf(__('- Billing field `%s` has been updated with value `%s` for customer `%s` ...', 'wp_all_import_plugin'), $key, $value, $articleData['user_login']));
|
1588 |
+
|
1589 |
+
}
|
1590 |
+
|
1591 |
+
}
|
1592 |
+
|
1593 |
+
}
|
1594 |
+
|
1595 |
+
}
|
1596 |
+
|
1597 |
+
// Update shipping details for customer
|
1598 |
+
if ( empty($articleData['ID']) or $this->options['update_all_data'] == 'yes' or $this->options['pmsci_is_update_shipping_fields'] )
|
1599 |
+
{
|
1600 |
+
switch ($this->options['pmsci_customer']['shipping_source'])
|
1601 |
+
{
|
1602 |
+
// Copy from billing
|
1603 |
+
case 'copy':
|
1604 |
+
|
1605 |
+
$logger and call_user_func($logger, sprintf(__('- Copying billing information to shipping fields...', 'wp_all_import_plugin')));
|
1606 |
+
|
1607 |
+
if ( ! empty( $billing_data )){
|
1608 |
+
foreach ($billing_data as $key => $value) {
|
1609 |
+
$shipping_field = str_replace('billing', 'shipping', $key);
|
1610 |
+
|
1611 |
+
if ( in_array($shipping_field, array('shipping_phone','shipping_email') ) ) continue;
|
1612 |
+
|
1613 |
+
if (
|
1614 |
+
// Update all Shipping Fields
|
1615 |
+
( $this->options['pmsci_update_shipping_fields_logic'] == 'full_update' )
|
1616 |
+
or
|
1617 |
+
// Update only these Shipping Fields, leave the rest alone
|
1618 |
+
( $this->options['pmsci_update_shipping_fields_logic'] == 'only' and in_array( $shipping_field, $this->options['pmsci_shipping_fields_list'] ) )
|
1619 |
+
or
|
1620 |
+
// Leave these fields alone, update all other Shipping Fields
|
1621 |
+
|
1622 |
+
( $this->options['pmsci_update_shipping_fields_logic'] == 'all_except' and !in_array( $shipping_field, $this->options['pmsci_shipping_fields_list'] ) )
|
1623 |
+
|
1624 |
+
){
|
1625 |
+
|
1626 |
+
update_user_meta( $pid, $shipping_field, $value );
|
1627 |
+
$logger and call_user_func($logger, sprintf(__('- Shipping field `%s` has been updated with value `%s` for customer `%s` ...', 'wp_all_import_plugin'), $shipping_field, $value, $articleData['user_login']));
|
1628 |
+
|
1629 |
+
}
|
1630 |
+
}
|
1631 |
+
}
|
1632 |
+
|
1633 |
+
break;
|
1634 |
+
|
1635 |
+
// Import shipping address
|
1636 |
+
default:
|
1637 |
+
|
1638 |
+
$logger and call_user_func($logger, sprintf(__('- Importing shipping data separately...', 'wp_all_import_plugin')));
|
1639 |
+
|
1640 |
+
foreach ($shipping_data as $key => $value) {
|
1641 |
+
|
1642 |
+
$shipping_field = $key;
|
1643 |
+
|
1644 |
+
if (
|
1645 |
+
// Update all Shipping Fields
|
1646 |
+
( $this->options['pmsci_update_shipping_fields_logic'] == 'full_update' )
|
1647 |
+
or
|
1648 |
+
// Update only these Shipping Fields, leave the rest alone
|
1649 |
+
( $this->options['pmsci_update_shipping_fields_logic'] == 'only' and in_array( $shipping_field, $this->options['pmsci_shipping_fields_list'] ) )
|
1650 |
+
or
|
1651 |
+
// Leave these fields alone, update all other Shipping Fields
|
1652 |
+
|
1653 |
+
( $this->options['pmsci_update_shipping_fields_logic'] == 'all_except' and !in_array( $shipping_field, $this->options['pmsci_shipping_fields_list'] ) )
|
1654 |
+
|
1655 |
+
){
|
1656 |
+
|
1657 |
+
update_user_meta( $pid, $key, $value);
|
1658 |
+
$logger and call_user_func($logger, sprintf(__('- Shipping field `%s` has been updated with value `%s` for customer `%s` ...', 'wp_all_import_plugin'), $key, $value, $articleData['user_login']));
|
1659 |
+
|
1660 |
+
}
|
1661 |
+
}
|
1662 |
+
|
1663 |
+
break;
|
1664 |
+
}
|
1665 |
+
}
|
1666 |
+
|
1667 |
+
$articleData['post_title'] = $articleData['user_login'];
|
1668 |
+
|
1669 |
break;
|
1670 |
+
|
1671 |
default:
|
1672 |
if (empty($articleData['ID'])){
|
1673 |
$logger and call_user_func($logger, sprintf(__('<b>CREATING</b> `%s` `%s`', 'wp_all_import_plugin'), $articleData['post_title'], $custom_type_details->labels->singular_name));
|
1776 |
|
1777 |
// [featured image]
|
1778 |
|
1779 |
+
$featuredImage = false;
|
1780 |
$is_allow_import_images = apply_filters('wp_all_import_is_allow_import_images', false, empty($articleData['post_type']) ? '' : $articleData['post_type']);
|
1781 |
$images_uploads = apply_filters('wp_all_import_images_uploads_dir', $uploads, $articleData, $current_xml_node, $this->id);
|
1782 |
|
1788 |
|
1789 |
// search for images in galleries
|
1790 |
$galleries = array();
|
1791 |
+
if (preg_match_all('%\[gallery[^\]]*ids="([^\]^"]*)"[^\]]*\]%is', $articleData['post_content'], $matches, PREG_PATTERN_ORDER)) {
|
1792 |
$galleries = array_unique(array_filter($matches[1]));
|
1793 |
}
|
1794 |
$gallery_images = array();
|
1844 |
|
1845 |
$attid = false;
|
1846 |
|
1847 |
+
if ($this->options['search_existing_images']) {
|
1848 |
+
// trying to find existing image in images table
|
1849 |
+
$logger and call_user_func($logger, sprintf(__('- Searching for existing image `%s` by URL...', 'wp_all_import_plugin'), rawurldecode($image)));
|
1850 |
+
$imageList = new PMXI_Image_List();
|
1851 |
+
$attch = $imageList->getExistingImageByUrl($image);
|
1852 |
+
|
1853 |
+
// trying to find existing image in media library using old logic
|
1854 |
+
if (empty($attch)){
|
1855 |
+
$image_name = wp_all_import_sanitize_filename(urldecode(wp_all_import_basename($image)));
|
1856 |
+
$logger and call_user_func($logger, sprintf(__('- Searching for existing image `%s` by `_wp_attached_file` `%s`...', 'wp_all_import_plugin'), $image, $image_name));
|
1857 |
+
$attch = wp_all_import_get_image_from_gallery($image_name, $targetDir, 'images', $logger);
|
1858 |
+
}
|
1859 |
}
|
1860 |
|
1861 |
// exisitng image founded
|
1865 |
}
|
1866 |
else {
|
1867 |
|
1868 |
+
if ($this->options['search_existing_images']) {
|
1869 |
+
$logger and call_user_func($logger, sprintf(__('- Image `%s` was not found...', 'wp_all_import_plugin'), rawurldecode($image)));
|
1870 |
+
}
|
1871 |
|
1872 |
+
// Download remote image and save it in images table.
|
1873 |
$url = html_entity_decode(trim($image), ENT_QUOTES);
|
1874 |
|
1875 |
if (empty($url)) continue;
|
1880 |
$default_extension = pmxi_getExtension($bn);
|
1881 |
if ($img_ext == "") $img_ext = pmxi_get_remote_image_ext($url);
|
1882 |
|
1883 |
+
// Generate local file name.
|
1884 |
$image_name = urldecode(("" != $img_ext) ? str_replace("." . $default_extension, "", $bn) : $bn) . (("" != $img_ext) ? '.' . $img_ext : '');
|
1885 |
|
1886 |
$image_filename = wp_unique_filename($targetDir, $image_name);
|
1888 |
|
1889 |
$image_info = $this->downloadFile($url, $image_filepath, $is_cron, $logger);
|
1890 |
|
1891 |
+
if ($image_info) {
|
1892 |
+
// Create an attachment.
|
1893 |
$file_mime_type = '';
|
1894 |
+
if (!empty($image_info)) {
|
|
|
|
|
1895 |
$file_mime_type = image_type_to_mime_type($image_info[2]);
|
1896 |
}
|
1897 |
$file_mime_type = apply_filters('wp_all_import_image_mime_type', $file_mime_type, $image_filepath);
|
|
|
1898 |
$handle_image = array(
|
1899 |
'file' => $image_filepath,
|
1900 |
'url' => $targetUrl . '/' . $image_filename,
|
1901 |
'type' => $file_mime_type
|
1902 |
);
|
|
|
1903 |
$attid = $this->createAttachment($pid, $handle_image, $image_name, $post_author[$i], $post_type[$i], $is_cron, $logger, $bundle_data['type']);
|
1904 |
}
|
1905 |
}
|
1954 |
update_post_meta($attid, '_wp_attachment_image_alt', trim($image_alt));
|
1955 |
$this->wpdb->update( $this->wpdb->posts, $update_attachment_meta, array('ID' => $attid) );
|
1956 |
}
|
1957 |
+
if (empty($featuredImage)) {
|
1958 |
+
$featuredImage = $attid;
|
1959 |
+
}
|
1960 |
}
|
1961 |
}
|
1962 |
// Update post content
|
1966 |
|
1967 |
$is_images_to_update = apply_filters('pmxi_is_images_to_update', true, $articleData, $current_xml_node);
|
1968 |
|
1969 |
+
if ( ! in_array($this->options['custom_type'], array('shop_order', 'import_users', 'shop_customer')) ) {
|
1970 |
+
$logger and call_user_func($logger, __('<b>IMAGES:</b>', 'wp_all_import_plugin'));
|
1971 |
+
}
|
1972 |
|
1973 |
if ( $is_images_to_update and ! empty($images_uploads) and false === $images_uploads['error'] and ( ! empty($articleData['post_type']) and $articleData['post_type'] == "product" and class_exists('PMWI_Plugin') or $is_allow_import_images) and (empty($articleData['ID']) or $this->options['update_all_data'] == "yes" or ( $this->options['update_all_data'] == "no" and $this->options['is_update_images'])) ) {
|
1974 |
|
2059 |
$line_img_titles = explode("\n", $image_meta_titles_bundle[$slug][$i]);
|
2060 |
if ( ! empty($line_img_titles) )
|
2061 |
foreach ($line_img_titles as $line_img_title)
|
2062 |
+
$img_titles = array_merge($img_titles, ( ! empty($this->options[$option_slug . 'image_meta_title_delim']) ) ? explode($this->options[$option_slug . 'image_meta_title_delim'], $line_img_title) : array($line_img_title) );
|
2063 |
|
2064 |
}
|
2065 |
if ( $this->options[$option_slug . 'set_image_meta_caption'] and !empty($image_meta_captions_bundle[$slug])){
|
2067 |
$line_img_captions = explode("\n", $image_meta_captions_bundle[$slug][$i]);
|
2068 |
if ( ! empty($line_img_captions) )
|
2069 |
foreach ($line_img_captions as $line_img_caption)
|
2070 |
+
$img_captions = array_merge($img_captions, ( ! empty($this->options[$option_slug . 'image_meta_caption_delim']) ) ? explode($this->options[$option_slug . 'image_meta_caption_delim'], $line_img_caption) : array($line_img_caption) );
|
2071 |
|
2072 |
}
|
2073 |
if ( $this->options[$option_slug . 'set_image_meta_alt'] and !empty($image_meta_alts_bundle[$slug])){
|
2075 |
$line_img_alts = explode("\n", $image_meta_alts_bundle[$slug][$i]);
|
2076 |
if ( ! empty($line_img_alts) )
|
2077 |
foreach ($line_img_alts as $line_img_alt)
|
2078 |
+
$img_alts = array_merge($img_alts, ( ! empty($this->options[$option_slug . 'image_meta_alt_delim']) ) ? explode($this->options[$option_slug . 'image_meta_alt_delim'], $line_img_alt) : array($line_img_alt) );
|
2079 |
|
2080 |
}
|
2081 |
if ( $this->options[$option_slug . 'set_image_meta_description'] and !empty($image_meta_descriptions_bundle[$slug])){
|
2083 |
$line_img_descriptions = ($this->options[$option_slug . 'image_meta_description_delim_logic'] == 'line' or empty($this->options[$option_slug . 'image_meta_description_delim'])) ? explode("\n", $image_meta_descriptions_bundle[$slug][$i]) : array($image_meta_descriptions_bundle[$slug][$i]);
|
2084 |
if ( ! empty($line_img_descriptions) )
|
2085 |
foreach ($line_img_descriptions as $line_img_description)
|
2086 |
+
$img_descriptions = array_merge($img_descriptions, ($this->options[$option_slug . 'image_meta_description_delim_logic'] == 'separate' and ! empty($this->options[$option_slug . 'image_meta_description_delim']) ) ? explode($this->options[$option_slug . 'image_meta_description_delim'], $line_img_description) : array($line_img_description) );
|
2087 |
|
2088 |
}
|
2089 |
|
2101 |
if (empty($url)) continue;
|
2102 |
|
2103 |
$bn = wp_all_import_sanitize_filename(urldecode(wp_all_import_basename($url)));
|
2104 |
+
$default_extension = pmxi_getExtension($bn);
|
2105 |
+
|
2106 |
if ( "yes" == $this->options[$option_slug . 'download_images'] and ! empty($auto_extensions_bundle[$slug][$i]) and preg_match('%^(jpg|jpeg|png|gif)$%i', $auto_extensions_bundle[$slug][$i])){
|
2107 |
$img_ext = $auto_extensions_bundle[$slug][$i];
|
2108 |
}
|
2109 |
else {
|
2110 |
+
$img_ext = pmxi_getExtensionFromStr($url);
|
2111 |
+
|
2112 |
if ($img_ext == "") $img_ext = pmxi_get_remote_image_ext($url);
|
2113 |
}
|
2114 |
|
2155 |
{
|
2156 |
$logger and call_user_func($logger, __('- found base64_encoded image', 'wp_all_import_plugin'));
|
2157 |
|
2158 |
+
$image_filename = wp_unique_filename($targetDir, $image_filename);
|
2159 |
$image_filepath = $targetDir . '/' . $image_filename;
|
2160 |
imagejpeg($img, $image_filepath);
|
2161 |
if( ! ($image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP))) {
|
2177 |
}
|
2178 |
|
2179 |
$image_filename = wp_unique_filename($targetDir, $image_name);
|
2180 |
+
$image_filepath = $targetDir . '/' . $image_filename;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2181 |
|
2182 |
// search existing attachment
|
2183 |
if ($this->options[$option_slug . 'search_existing_images'] or "gallery" == $this->options[$option_slug . 'download_images']){
|
2187 |
// trying to find existing image in images table
|
2188 |
if ($this->options[$option_slug . 'download_images'] === "yes"){
|
2189 |
$imageList = new PMXI_Image_List();
|
2190 |
+
switch ($this->options[$option_slug . 'search_existing_images_logic']){
|
2191 |
case 'by_url':
|
2192 |
$attch = $imageList->getExistingImageByUrl($url);
|
2193 |
$logger and call_user_func($logger, sprintf(__('- Searching for existing image `%s` by URL...', 'wp_all_import_plugin'), rawurldecode($url)));
|
2201 |
|
2202 |
if ("gallery" == $this->options[$option_slug . 'download_images']) $download_image = false;
|
2203 |
|
2204 |
+
// Search for existing images for new imports only using old logic.
|
2205 |
+
if (empty($attch)) {
|
2206 |
|
2207 |
$logger and call_user_func($logger, sprintf(__('- Search for existing image `%s` by `_wp_attached_file` ...', 'wp_all_import_plugin'), rawurldecode($image_name)));
|
2208 |
|
2226 |
if ($imageRecord->isEmpty()){
|
2227 |
$imageRecord->set(array(
|
2228 |
'attachment_id' => $attid,
|
2229 |
+
'image_url' => (base64_encode(base64_decode($url)) == $url && $is_base64_images_allowed) ? '' : $url,
|
2230 |
'image_filename' => $image_name
|
2231 |
))->insert();
|
2232 |
}
|
2233 |
else{
|
2234 |
+
switch ($this->options[$option_slug . 'search_existing_images_logic']){
|
2235 |
case 'by_url':
|
2236 |
// update image URL if it was not set
|
2237 |
if (empty($imageRecord->image_url)){
|
2238 |
$imageRecord->set(array(
|
2239 |
+
'image_url' => (base64_encode(base64_decode($url)) == $url && $is_base64_images_allowed) ? '' : $url,
|
2240 |
))->update();
|
2241 |
}
|
2242 |
break;
|
2326 |
$file_mime_type = apply_filters('wp_all_import_image_mime_type', $file_mime_type, $image_filepath);
|
2327 |
}
|
2328 |
else {
|
2329 |
+
$file_mime_type = $image_info['type'];
|
2330 |
}
|
2331 |
|
2332 |
$handle_image = apply_filters( 'wp_all_import_handle_upload', array(
|
2346 |
if ($imageRecord->isEmpty()){
|
2347 |
$imageRecord->set(array(
|
2348 |
'attachment_id' => $attid,
|
2349 |
+
'image_url' => (base64_encode(base64_decode($url)) == $url && $is_base64_images_allowed) ? '' : $url,
|
2350 |
'image_filename' => $image_name
|
2351 |
))->insert();
|
2352 |
}
|
2353 |
else{
|
2354 |
// image already in image table, but was not founded, so updating it with new data
|
2355 |
+
switch ($this->options[$option_slug . 'search_existing_images_logic']){
|
2356 |
case 'by_url':
|
2357 |
// update image URL if it was not set
|
2358 |
if (empty($imageRecord->image_url)){
|
2359 |
$imageRecord->set(array(
|
2360 |
+
'image_url' => (base64_encode(base64_decode($url)) == $url && $is_base64_images_allowed) ? '' : $url
|
2361 |
))->update();
|
2362 |
}
|
2363 |
break;
|
2399 |
$success_images = true;
|
2400 |
|
2401 |
switch ($post_type[$i]){
|
2402 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2403 |
default:
|
2404 |
$post_thumbnail_id = get_post_thumbnail_id( $pid );
|
2405 |
|
2477 |
}
|
2478 |
}
|
2479 |
|
2480 |
+
// Set first image as featured in case when Images section nor defined in import template.
|
2481 |
+
if (!empty($featuredImage)) {
|
2482 |
+
$post_thumbnail_id = get_post_thumbnail_id( $pid );
|
2483 |
+
if (empty($post_thumbnail_id) and ($this->options['is_featured'] or !empty($is_image_featured[$i])) ) {
|
2484 |
+
set_post_thumbnail($pid, $featuredImage);
|
2485 |
+
}
|
2486 |
+
}
|
2487 |
+
|
2488 |
if ( ! $is_images_to_update )
|
2489 |
{
|
2490 |
$logger and call_user_func($logger, sprintf(__('Images import skipped for post `%s` according to \'pmxi_is_images_to_update\' filter...', 'wp_all_import_plugin'), $articleData['post_title']));
|
2491 |
}
|
2492 |
// [/featured image]
|
2493 |
|
2494 |
+
// [attachments]
|
2495 |
+
$is_attachments_to_update = apply_filters('pmxi_is_attachments_to_update', true, $articleData, $current_xml_node);
|
2496 |
|
2497 |
$attachments_uploads = apply_filters('wp_all_import_attachments_uploads_dir', $uploads, $articleData, $current_xml_node, $this->id);
|
2498 |
|
2499 |
+
if ( $is_attachments_to_update and ! empty($attachments_uploads) and false === $attachments_uploads['error'] and !empty($attachments[$i]) and (empty($articleData['ID']) or $this->options['update_all_data'] == "yes" or ($this->options['update_all_data'] == "no" and $this->options['is_update_attachments']))) {
|
2500 |
|
2501 |
+
$targetDir = $attachments_uploads['path'];
|
2502 |
+
$targetUrl = $attachments_uploads['url'];
|
2503 |
|
2504 |
+
$logger and call_user_func($logger, __('<b>ATTACHMENTS:</b>', 'wp_all_import_plugin'));
|
2505 |
|
2506 |
+
if ( ! @is_writable($targetDir) ){
|
2507 |
+
$logger and call_user_func($logger, sprintf(__('- <b>ERROR</b>: Target directory %s is not writable', 'wp_all_import_plugin'), trim($targetDir)));
|
2508 |
+
}
|
2509 |
+
else{
|
2510 |
+
// you must first include the image.php file
|
2511 |
+
// for the function wp_generate_attachment_metadata() to work
|
2512 |
+
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
2513 |
|
2514 |
+
if ( ! is_array($attachments[$i]) ) $attachments[$i] = array($attachments[$i]);
|
2515 |
|
2516 |
+
$logger and call_user_func($logger, sprintf(__('- Importing attachments for `%s` ...', 'wp_all_import_plugin'), $articleData['post_title']));
|
2517 |
|
2518 |
+
foreach ($attachments[$i] as $attachment) { if ("" == $attachment) continue;
|
|
|
|
|
2519 |
|
2520 |
+
$atchs = str_getcsv($attachment, $this->options['atch_delim']);
|
2521 |
|
2522 |
+
if ( ! empty($atchs) ) {
|
2523 |
|
2524 |
+
foreach ($atchs as $atch_url) { if (empty($atch_url)) continue;
|
2525 |
|
2526 |
+
$download_file = true;
|
2527 |
+
$create_file = false;
|
2528 |
+
$attach_id = false;
|
2529 |
|
2530 |
+
$atch_url = str_replace(" ", "%20", trim($atch_url));
|
|
|
2531 |
|
2532 |
+
$attachment_filename = urldecode(wp_all_import_basename(parse_url(trim($atch_url), PHP_URL_PATH)));
|
2533 |
+
$attachment_filepath = $targetDir . '/' . sanitize_file_name($attachment_filename);
|
2534 |
+
|
2535 |
+
if ($this->options['is_search_existing_attach']){
|
2536 |
|
2537 |
// search existing attachment
|
2538 |
$attch = wp_all_import_get_image_from_gallery($attachment_filename, $targetDir, 'files', $logger);
|
2539 |
|
2540 |
+
if ( $attch != null ){
|
2541 |
+
$download_file = false;
|
2542 |
+
$create_file = false;
|
2543 |
+
$attach_id = $attch->ID;
|
2544 |
$logger and call_user_func($logger, sprintf(__('- Using existing file `%s` for post `%s` ...', 'wp_all_import_plugin'), trim($attachment_filename), $articleData['post_title']));
|
2545 |
+
}
|
|
|
|
|
|
|
2546 |
|
2547 |
+
// search existing attachment in files folder
|
2548 |
+
if (empty($attach_id)){
|
2549 |
|
2550 |
+
$wpai_uploads = $uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::FILES_DIRECTORY . DIRECTORY_SEPARATOR;
|
2551 |
+
$wpai_file_path = $wpai_uploads . str_replace('%20', ' ', $atch_url);
|
|
|
2552 |
|
2553 |
+
$logger and call_user_func($logger, sprintf(__('- Searching for existing file `%s`', 'wp_all_import_plugin'), $wpai_file_path));
|
2554 |
+
|
2555 |
+
if ( @file_exists($wpai_file_path) and @copy( $wpai_file_path, $attachment_filepath )){
|
2556 |
+
// validate import attachments
|
2557 |
+
if( ! $wp_filetype = wp_check_filetype(wp_all_import_basename($attachment_filepath), null )) {
|
2558 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: Can\'t detect attachment file type %s', 'wp_all_import_plugin'), trim($attachment_filepath)));
|
2559 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
2560 |
+
@unlink($attachment_filepath);
|
2561 |
+
}
|
2562 |
+
else {
|
2563 |
+
$create_file = true;
|
2564 |
+
$download_file = false;
|
2565 |
+
$logger and call_user_func($logger, sprintf(__('- File `%s` has been successfully found', 'wp_all_import_plugin'), $wpai_file_path));
|
2566 |
+
}
|
2567 |
+
}
|
2568 |
+
}
|
2569 |
+
}
|
2570 |
+
|
2571 |
+
if ($download_file && preg_match('%^(http|ftp)s?://%i', $atch_url)){
|
2572 |
+
|
2573 |
+
$attachment_filename = wp_unique_filename($targetDir, $attachment_filename);
|
2574 |
+
$attachment_filepath = $targetDir . '/' . sanitize_file_name($attachment_filename);
|
2575 |
+
|
2576 |
+
$logger and call_user_func($logger, sprintf(__('- Filename for attachment was generated as %s', 'wp_all_import_plugin'), $attachment_filename));
|
2577 |
+
|
2578 |
+
$request = get_file_curl(trim($atch_url), $attachment_filepath);
|
2579 |
+
|
2580 |
+
$get_ctx = stream_context_create(array('http' => array('timeout' => 5)));
|
2581 |
+
|
2582 |
+
if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($attachment_filepath, @file_get_contents(trim($atch_url), false, $get_ctx))) {
|
2583 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: Attachment file %s cannot be saved locally as %s', 'wp_all_import_plugin'), trim($atch_url), $attachment_filepath));
|
2584 |
+
is_wp_error($request) and $logger and call_user_func($logger, sprintf(__('- <b>WP Error</b>: %s', 'wp_all_import_plugin'), $request->get_error_message()));
|
2585 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
2586 |
+
unlink($attachment_filepath); // delete file since failed upload may result in empty file created
|
2587 |
+
} elseif( ! $wp_filetype = wp_check_filetype(wp_all_import_basename($attachment_filename), null )) {
|
2588 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: Can\'t detect attachment file type %s', 'wp_all_import_plugin'), trim($atch_url)));
|
2589 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
2590 |
+
} else {
|
2591 |
+
$create_file = true;
|
2592 |
+
}
|
2593 |
+
}
|
2594 |
+
|
2595 |
+
if ($create_file){
|
2596 |
+
$handle_attachment = apply_filters( 'wp_all_import_handle_upload', array(
|
2597 |
+
'file' => $attachment_filepath,
|
2598 |
+
'url' => $targetUrl . '/' . wp_all_import_basename($attachment_filepath),
|
2599 |
+
'type' => $wp_filetype['type']
|
2600 |
+
));
|
2601 |
+
|
2602 |
+
$logger and call_user_func($logger, sprintf(__('- File %s has been successfully downloaded', 'wp_all_import_plugin'), $atch_url));
|
2603 |
+
$attachment_data = array(
|
2604 |
+
'guid' => $handle_attachment['url'],
|
2605 |
+
'post_mime_type' => $handle_attachment['type'],
|
2606 |
+
'post_title' => preg_replace('/\.[^.]+$/', '', wp_all_import_basename($handle_attachment['file'])),
|
2607 |
+
'post_content' => '',
|
2608 |
+
'post_status' => 'inherit',
|
2609 |
+
'post_author' => $post_author[$i],
|
2610 |
+
);
|
2611 |
+
$attach_id = wp_insert_attachment( $attachment_data, $handle_attachment['file'], $pid );
|
2612 |
+
|
2613 |
+
if (is_wp_error($attach_id)) {
|
2614 |
+
$logger and call_user_func($logger, __('- <b>WARNING</b>', 'wp_all_import_plugin') . ': ' . $pid->get_error_message());
|
2615 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
2616 |
+
} else {
|
2617 |
+
wp_update_attachment_metadata($attach_id, wp_generate_attachment_metadata($attach_id, $handle_attachment['file']));
|
2618 |
+
$logger and call_user_func($logger, sprintf(__('- Attachment has been successfully created for post `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
2619 |
+
$logger and call_user_func($logger, __('- <b>ACTION</b>: pmxi_attachment_uploaded', 'wp_all_import_plugin'));
|
2620 |
+
do_action( 'pmxi_attachment_uploaded', $pid, $attach_id, $handle_attachment['file']);
|
2621 |
+
}
|
2622 |
+
}
|
2623 |
|
2624 |
if ($attach_id && ! is_wp_error($attach_id))
|
2625 |
{
|
2643 |
$logger and call_user_func($logger, __('- <b>ACTION</b>: pmxi_attachment_uploaded', 'wp_all_import_plugin'));
|
2644 |
do_action( 'pmxi_attachment_uploaded', $pid, $attach_id, $attachment_filepath);
|
2645 |
}
|
2646 |
+
}
|
2647 |
+
}
|
2648 |
+
}
|
2649 |
+
}
|
2650 |
+
}
|
2651 |
|
2652 |
+
if ( ! $is_attachments_to_update )
|
2653 |
+
{
|
2654 |
+
$logger and call_user_func($logger, sprintf(__('Attachments import skipped for post `%s` according to \'pmxi_is_attachments_to_update\' filter...', 'wp_all_import_plugin'), $articleData['post_title']));
|
2655 |
+
}
|
2656 |
+
// [/attachments]
|
2657 |
|
2658 |
// [custom taxonomies]
|
2659 |
if ( ! empty($taxonomies) ){
|
2696 |
unset($existing_taxonomies[$tx_name][$i]);
|
2697 |
}
|
2698 |
|
2699 |
+
// create term if not exists
|
2700 |
if ( ! empty($txes[$i]) ):
|
2701 |
foreach ($txes[$i] as $key => $single_tax) {
|
2702 |
$is_created_term = false;
|
2742 |
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: `%s`', 'wp_all_import_plugin'), $term->get_error_message()));
|
2743 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
2744 |
}
|
2745 |
+
elseif ( ! empty($term)) {
|
2746 |
+
$cat_id = $term['term_id'];
|
2747 |
+
if ($cat_id and $single_tax['assign']) {
|
|
|
|
|
|
|
2748 |
$term = get_term_by('id', $cat_id, $tx_name);
|
2749 |
if ( $term->parent != '0' and ! empty($this->options['tax_is_full_search_' . $this->options['tax_logic'][$tx_name]][$tx_name]) and empty($this->options['tax_assign_to_one_term_' . $this->options['tax_logic'][$tx_name]][$tx_name])){
|
2750 |
$parent_ids = wp_all_import_get_parent_terms($cat_id, $tx_name);
|
2804 |
$is_update = ! empty($articleData['ID']);
|
2805 |
|
2806 |
// fire important hooks after custom fields are added
|
2807 |
+
if ( ! $this->options['is_fast_mode'] and ! in_array($this->options['custom_type'], array('import_users', 'shop_customer', 'taxonomies'))){
|
2808 |
$_post = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM {$this->wpdb->posts} WHERE ID = %d LIMIT 1", $pid ) );
|
2809 |
$_post = sanitize_post( $_post, 'raw' );
|
2810 |
$post_object = new WP_Post( $_post );
|
2927 |
|
2928 |
private function getRecordTitle($articleData){
|
2929 |
switch ($this->options['custom_type']){
|
2930 |
+
case 'import_users':
|
2931 |
+
case 'shop_customer':
|
2932 |
$title = $articleData['user_login'];
|
2933 |
break;
|
2934 |
default:
|
2942 |
|
2943 |
$downloaded = false;
|
2944 |
|
2945 |
+
$file_info = false;
|
2946 |
|
2947 |
$logger and call_user_func($logger, sprintf(__('- Downloading image from `%s`', 'wp_all_import_plugin'), $url));
|
2948 |
|
2951 |
$get_ctx = stream_context_create(array('http' => array('timeout' => 5)));
|
2952 |
|
2953 |
if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($image_filepath, @file_get_contents($url, false, $get_ctx))) {
|
2954 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s can not be downloaded, response %s', 'wp_all_import_plugin'), $url, maybe_serialize($request)));
|
2955 |
@unlink($image_filepath); // delete file since failed upload may result in empty file created
|
2956 |
} else{
|
2957 |
|
2958 |
if($type == 'images'){
|
2959 |
+
if( preg_match('%\W(svg)$%i', wp_all_import_basename($image_filepath)) or $file_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath) and in_array($file_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
2960 |
$downloaded = true;
|
2961 |
+
if (preg_match('%\W(svg)$%i', wp_all_import_basename($image_filepath))){
|
2962 |
+
$file_info = true;
|
2963 |
+
}
|
2964 |
$logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
|
2965 |
}
|
2966 |
else
|
2970 |
}
|
2971 |
}
|
2972 |
elseif($type == 'files'){
|
2973 |
+
if( $file_info = wp_check_filetype(wp_all_import_basename($image_filepath), null )) {
|
2974 |
$downloaded = true;
|
2975 |
$logger and call_user_func($logger, sprintf(__('- File `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
|
2976 |
}
|
2977 |
}
|
2978 |
}
|
2979 |
|
2980 |
+
return $downloaded ? $file_info : false;
|
2981 |
}
|
2982 |
|
2983 |
public function createAttachment($pid, $handle_image, $image_name, $post_author, $post_type, $is_cron, $logger, $type = 'images'){
|
3107 |
update_user_meta( $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value'] );
|
3108 |
$logger and call_user_func($logger, sprintf(__('Instead of deletion user with ID `%s`, set Custom Field `%s` to value `%s`', 'wp_all_import_plugin'), $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value']));
|
3109 |
break;
|
3110 |
+
case 'shop_customer':
|
3111 |
+
update_user_meta( $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value'] );
|
3112 |
+
$logger and call_user_func($logger, sprintf(__('Instead of deletion customer with ID `%s`, set Custom Field `%s` to value `%s`', 'wp_all_import_plugin'), $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value']));
|
3113 |
break;
|
3114 |
+
|
3115 |
default:
|
3116 |
update_post_meta( $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value'] );
|
3117 |
$logger and call_user_func($logger, sprintf(__('Instead of deletion post with ID `%s`, set Custom Field `%s` to value `%s`', 'wp_all_import_plugin'), $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value']));
|
3135 |
$to_delete = apply_filters('wp_all_import_is_post_to_delete', $to_delete, $missingPostRecord['post_id'], $this);
|
3136 |
|
3137 |
if ($to_delete){
|
3138 |
+
if ( ! in_array($this->options['custom_type'], array("import_users", "taxonomies", "shop_customer")) ){
|
3139 |
// Remove attachments
|
3140 |
empty($this->options['is_keep_attachments']) and wp_delete_attachments($missingPostRecord['post_id'], true, 'files');
|
3141 |
// Remove images
|
3180 |
}
|
3181 |
|
3182 |
switch ($this->options['custom_type']){
|
3183 |
+
case 'import_users':
|
3184 |
+
case 'shop_customer':
|
3185 |
do_action('pmxi_delete_post', $ids, $this);
|
3186 |
// delete_user action
|
3187 |
foreach( $ids as $id) {
|
3195 |
foreach( $ids as $id) {
|
3196 |
do_action( 'deleted_user', $id, $reassign = null );
|
3197 |
}
|
3198 |
+
$this->wpdb->query( $sql );
|
3199 |
break;
|
|
|
|
|
|
|
|
|
|
|
3200 |
|
|
|
3201 |
default:
|
3202 |
do_action('pmxi_delete_post', $ids, $this);
|
3203 |
+
foreach ($ids as $post_id){
|
3204 |
+
wp_delete_post( $post_id, TRUE );
|
3205 |
+
}
|
|
|
|
|
3206 |
break;
|
3207 |
}
|
|
|
|
|
3208 |
|
3209 |
// Delete record form pmxi_posts
|
3210 |
$sql = "DELETE FROM " . PMXI_Plugin::getInstance()->getTablePrefix() . "posts WHERE post_id IN (".implode(',', $ids).") AND import_id = %d";
|
3244 |
|
3245 |
protected function executeSQL(){
|
3246 |
|
3247 |
+
$import_entry = ( in_array( $this->options['custom_type'], array('import_users', 'shop_customer') ) ) ? 'user' : 'post';
|
3248 |
|
3249 |
// prepare bulk SQL query
|
3250 |
$meta_table = _get_meta_table( $import_entry );
|
3413 |
{
|
3414 |
foreach ( $ids as $k => $id ) {
|
3415 |
|
3416 |
+
if ( ! in_array($this->options['custom_type'], array('import_users', 'taxonomies', 'shop_customer')) ){
|
3417 |
// Remove attachments
|
3418 |
if ($is_delete_attachments == 'yes' or $is_delete_attachments == 'auto' and empty($this->options['is_keep_attachments']))
|
3419 |
{
|
3432 |
{
|
3433 |
wp_delete_attachments($id, false, 'images');
|
3434 |
}
|
3435 |
+
}
|
3436 |
|
3437 |
+
if ( ! in_array($this->options['custom_type'], array('import_users', 'taxonomies', 'shop_customer')) ) wp_delete_object_term_relationships($id, get_object_taxonomies('' != $this->options['custom_type'] ? $this->options['custom_type'] : 'post'));
|
3438 |
+
}
|
3439 |
|
3440 |
switch ($this->options['custom_type']){
|
3441 |
+
case 'import_users':
|
3442 |
+
case 'shop_customer':
|
3443 |
do_action('pmxi_delete_post', $ids, $this);
|
3444 |
// delete_user action
|
3445 |
foreach( $ids as $id) {
|
3453 |
foreach( $ids as $id) {
|
3454 |
do_action( 'deleted_user', $id, $reassign = null );
|
3455 |
}
|
3456 |
+
$this->wpdb->query($sql);
|
3457 |
break;
|
3458 |
+
|
|
|
|
|
|
|
|
|
|
|
3459 |
default:
|
3460 |
do_action('pmxi_delete_post', $ids, $this);
|
3461 |
+
foreach ($ids as $id) {
|
3462 |
+
wp_delete_post($id, TRUE);
|
3463 |
+
}
|
|
|
|
|
|
|
3464 |
break;
|
3465 |
}
|
|
|
|
|
|
|
|
|
3466 |
}
|
3467 |
|
3468 |
/**
|
plugin.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP All Import
|
4 |
Plugin URI: http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=plugins-page&utm_campaign=free+plugin
|
5 |
Description: The most powerful solution for importing XML and CSV files to WordPress. Create Posts and Pages with content from any XML or CSV file. A paid upgrade to WP All Import Pro is available for support and additional features.
|
6 |
-
Version: 3.
|
7 |
Author: Soflyy
|
8 |
*/
|
9 |
|
@@ -25,7 +25,7 @@ define('WP_ALL_IMPORT_ROOT_URL', rtrim(plugin_dir_url(__FILE__), '/'));
|
|
25 |
*/
|
26 |
define('WP_ALL_IMPORT_PREFIX', 'pmxi_');
|
27 |
|
28 |
-
define('PMXI_VERSION', '3.
|
29 |
|
30 |
define('PMXI_EDITION', 'free');
|
31 |
|
@@ -58,7 +58,7 @@ define('WP_ALL_IMPORT_HISTORY_DIRECTORY', WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY .
|
|
58 |
* Plugin temp folder name
|
59 |
* @var string
|
60 |
*/
|
61 |
-
define('WP_ALL_IMPORT_TEMP_DIRECTORY', WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'temp');
|
62 |
|
63 |
/**
|
64 |
* Main plugin file, Introduces MVC pattern
|
@@ -93,7 +93,7 @@ final class PMXI_Plugin {
|
|
93 |
* Prefix used for names of shortcodes, action handlers, filter functions etc.
|
94 |
* @var string
|
95 |
*/
|
96 |
-
const PREFIX = WP_ALL_IMPORT_PREFIX;
|
97 |
/**
|
98 |
* Plugin file path
|
99 |
* @var string
|
@@ -103,13 +103,13 @@ final class PMXI_Plugin {
|
|
103 |
* Max allowed file size (bytes) to import in default mode
|
104 |
* @var int
|
105 |
*/
|
106 |
-
const LARGE_SIZE = 0; // all files will importing in large import mode
|
107 |
|
108 |
-
public static $session = null;
|
109 |
|
110 |
public static $is_csv = false;
|
111 |
|
112 |
-
public static $csv_path = false;
|
113 |
|
114 |
public static $capabilities = 'manage_options';
|
115 |
|
@@ -141,7 +141,7 @@ final class PMXI_Plugin {
|
|
141 |
const HISTORY_DIRECTORY = WP_ALL_IMPORT_HISTORY_DIRECTORY;
|
142 |
|
143 |
const LANGUAGE_DOMAIN = 'wp_all_import_plugin';
|
144 |
-
|
145 |
/**
|
146 |
* Return singletone instance
|
147 |
* @return PMXI_Plugin
|
@@ -211,7 +211,7 @@ final class PMXI_Plugin {
|
|
211 |
*/
|
212 |
public function getTablePrefix() {
|
213 |
global $wpdb;
|
214 |
-
|
215 |
//return ($this->isNetwork() ? $wpdb->base_prefix : $wpdb->prefix) . self::PREFIX;
|
216 |
return $wpdb->prefix . self::PREFIX;
|
217 |
}
|
@@ -230,7 +230,7 @@ final class PMXI_Plugin {
|
|
230 |
* @param string $rootDir Plugin root dir
|
231 |
* @param string $pluginFilePath Plugin main file
|
232 |
*/
|
233 |
-
protected function __construct() {
|
234 |
|
235 |
// register autoloading method
|
236 |
spl_autoload_register(array($this, 'autoload'));
|
@@ -238,21 +238,25 @@ final class PMXI_Plugin {
|
|
238 |
// register helpers
|
239 |
if (is_dir(self::ROOT_DIR . '/helpers')) foreach (PMXI_Helper::safe_glob(self::ROOT_DIR . '/helpers/*.php', PMXI_Helper::GLOB_RECURSE | PMXI_Helper::GLOB_PATH) as $filePath) {
|
240 |
require_once $filePath;
|
241 |
-
}
|
242 |
-
|
243 |
// init plugin options
|
244 |
$option_name = get_class($this) . '_Options';
|
245 |
$options_default = PMXI_Config::createFromFile(self::ROOT_DIR . '/config/options.php')->toArray();
|
246 |
-
|
247 |
$current_options = get_option($option_name, array());
|
248 |
-
if (empty($current_options))
|
|
|
|
|
249 |
|
250 |
$this->options = array_intersect_key($current_options, $options_default) + $options_default;
|
251 |
$this->options = array_intersect_key($options_default, array_flip(array('info_api_url'))) + $this->options; // make sure hidden options apply upon plugin reactivation
|
252 |
-
if ('' == $this->options['cron_job_key'])
|
|
|
|
|
253 |
|
254 |
-
|
255 |
-
|
|
|
256 |
|
257 |
register_activation_hook(self::FILE, array($this, 'activation'));
|
258 |
|
@@ -267,7 +271,7 @@ final class PMXI_Plugin {
|
|
267 |
$priority = 10;
|
268 |
}
|
269 |
add_action($actionName, self::PREFIX . str_replace('-', '_', $function), $priority, 99); // since we don't know at this point how many parameters each plugin expects, we make sure they will be provided with all of them (it's unlikely any developer will specify more than 99 parameters in a function)
|
270 |
-
}
|
271 |
|
272 |
// register filter handlers
|
273 |
if (is_dir(self::ROOT_DIR . '/filters')) foreach (PMXI_Helper::safe_glob(self::ROOT_DIR . '/filters/*.php', PMXI_Helper::GLOB_RECURSE | PMXI_Helper::GLOB_PATH) as $filePath) {
|
@@ -280,7 +284,7 @@ final class PMXI_Plugin {
|
|
280 |
$priority = 10;
|
281 |
}
|
282 |
add_filter($actionName, self::PREFIX . str_replace('-', '_', $function), $priority, 99); // since we don't know at this point how many parameters each plugin expects, we make sure they will be provided with all of them (it's unlikely any developer will specify more than 99 parameters in a function)
|
283 |
-
}
|
284 |
|
285 |
// register admin page pre-dispatcher
|
286 |
add_action('admin_init', array($this, 'adminInit'));
|
@@ -288,8 +292,8 @@ final class PMXI_Plugin {
|
|
288 |
add_action('init', array($this, 'init'));
|
289 |
|
290 |
add_action( 'plugins_loaded', array( $this, 'setup_allimport_dir' ) );
|
291 |
-
|
292 |
-
}
|
293 |
|
294 |
/**
|
295 |
* Setup required directory.
|
@@ -319,7 +323,7 @@ final class PMXI_Plugin {
|
|
319 |
{
|
320 |
if ( $file == plugin_basename( __FILE__ ) ) {
|
321 |
$row_meta = array(
|
322 |
-
'pro' => '<a href="http://www.wpallimport.com" target="_blank" title="' . esc_attr( __( 'WP All Import Pro Version', 'wp_all_import_plugin' ) ) . '">' . __( 'Pro Version', 'wp_all_import_plugin' ) . '</a>',
|
323 |
);
|
324 |
|
325 |
return array_merge( $links, $row_meta );
|
@@ -336,7 +340,7 @@ final class PMXI_Plugin {
|
|
336 |
public function fix_options(){
|
337 |
|
338 |
global $wpdb;
|
339 |
-
|
340 |
$imports = new PMXI_Import_List();
|
341 |
$post = new PMXI_Post_Record();
|
342 |
|
@@ -346,44 +350,48 @@ final class PMXI_Plugin {
|
|
346 |
$is_migrated = get_option('pmxi_is_migrated');
|
347 |
|
348 |
$uploads = wp_upload_dir();
|
349 |
-
|
350 |
if ( empty($is_migrated) or version_compare($is_migrated, PMXI_VERSION) < 0 ){ //PMXI_VERSION
|
351 |
|
352 |
$commit_migration = true;
|
353 |
|
354 |
if ( empty($is_migrated) ){ // plugin version less than 4.0.0
|
355 |
|
356 |
-
|
357 |
-
|
|
|
|
|
|
|
|
|
358 |
|
359 |
foreach ($imports->setColumns($imports->getTable() . '.*')->getBy(array('id !=' => ''))->convertRecords() as $imp){
|
360 |
-
|
361 |
-
$imp->getById($imp->id);
|
362 |
-
|
363 |
if ( ! $imp->isEmpty() and ! empty($imp->template)){
|
364 |
|
365 |
$options = array_merge($imp->options, $imp->template);
|
366 |
|
367 |
$this->ver_4_transition_fix($options);
|
368 |
-
|
369 |
$imp->set(array(
|
370 |
'options' => $options
|
371 |
))->update();
|
372 |
-
|
373 |
-
if ($imp->type == 'file'){
|
374 |
$imp->set(array(
|
375 |
'path' => $uploads['basedir'] . DIRECTORY_SEPARATOR . self::FILES_DIRECTORY . DIRECTORY_SEPARATOR . basename($imp->path)
|
376 |
))->update();
|
377 |
}
|
378 |
}
|
379 |
-
}
|
380 |
|
381 |
foreach ($templates->setColumns($templates->getTable() . '.*')->getBy(array('id !=' => ''))->convertRecords() as $tpl){
|
382 |
-
|
383 |
-
$tpl->getById($tpl->id);
|
384 |
-
|
385 |
if ( ! $tpl->isEmpty() and ! empty($tpl->title) ) {
|
386 |
-
|
387 |
$opt = ( empty($tpl->options) ) ? array() : $tpl->options;
|
388 |
|
389 |
$options = array_merge($opt, array(
|
@@ -402,38 +410,38 @@ final class PMXI_Plugin {
|
|
402 |
|
403 |
}
|
404 |
|
405 |
-
}
|
406 |
|
407 |
$commit_migration = $this->fix_db_schema(); // feature to version 4.0.0
|
408 |
-
|
409 |
}
|
410 |
else {
|
411 |
|
412 |
$commit_migration = $this->fix_db_schema();
|
413 |
-
|
414 |
foreach ($imports->setColumns($imports->getTable() . '.*')->getBy(array('id !=' => ''))->convertRecords() as $imp){
|
415 |
-
|
416 |
-
$imp->getById($imp->id);
|
417 |
-
|
418 |
if ( ! $imp->isEmpty() ){
|
419 |
|
420 |
$options = $imp->options;
|
421 |
|
422 |
$this->ver_4x_transition_fix($options, $is_migrated);
|
423 |
-
|
424 |
$imp->set(array(
|
425 |
'options' => $options
|
426 |
-
))->update();
|
427 |
}
|
428 |
-
}
|
429 |
|
430 |
foreach ($templates->setColumns($templates->getTable() . '.*')->getBy(array('id !=' => ''))->convertRecords() as $tpl){
|
431 |
-
|
432 |
-
$tpl->getById($tpl->id);
|
433 |
-
|
434 |
if ( ! $tpl->isEmpty() ) {
|
435 |
-
|
436 |
-
$options = ( empty($tpl->options) ) ? array() : $tpl->options;
|
437 |
|
438 |
$this->ver_4x_transition_fix($options, $is_migrated);
|
439 |
|
@@ -446,11 +454,11 @@ final class PMXI_Plugin {
|
|
446 |
}
|
447 |
}
|
448 |
if ($commit_migration) update_option('pmxi_is_migrated', PMXI_VERSION);
|
449 |
-
}
|
450 |
}
|
451 |
|
452 |
public function ver_4_transition_fix( &$options ){
|
453 |
-
|
454 |
$options['wizard_type'] = ($options['duplicate_matching'] == 'auto') ? 'new' : 'matching';
|
455 |
|
456 |
if ($options['download_images']){
|
@@ -470,7 +478,7 @@ final class PMXI_Plugin {
|
|
470 |
|
471 |
if ("" == $options['custom_type']) $options['custom_type'] = $options['type'];
|
472 |
|
473 |
-
$exclude_taxonomies = (class_exists('PMWI_Plugin')) ? array('post_format', 'product_type') : array('post_format');
|
474 |
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($options['custom_type']), 'object'), array_flip($exclude_taxonomies));
|
475 |
|
476 |
$options['tax_logic'] = array();
|
@@ -481,44 +489,44 @@ final class PMXI_Plugin {
|
|
481 |
$options['tax_hierarchical_logic_manual'] = array();
|
482 |
|
483 |
if ( ! empty($post_taxonomies)):
|
484 |
-
foreach ($post_taxonomies as $ctx):
|
485 |
|
486 |
$options['tax_logic'][$ctx->name] = ($ctx->hierarchical) ? 'hierarchical' : 'multiple';
|
487 |
-
|
488 |
if ($ctx->name == 'category'){
|
489 |
$options['post_taxonomies']['category'] = $options['categories'];
|
490 |
}
|
491 |
elseif ($ctx->name == 'post_tag' ){
|
492 |
-
$options['tax_assing']['post_tag'] = 1;
|
493 |
$options['tax_multiple_xpath']['post_tag'] = $options['tags'];
|
494 |
$options['tax_multiple_delim']['post_tag'] = $options['tags_delim'];
|
495 |
}
|
496 |
-
|
497 |
if ( ! empty($options['post_taxonomies'][$ctx->name])){
|
498 |
|
499 |
-
$taxonomies_hierarchy = json_decode($options['post_taxonomies'][$ctx->name], true);
|
500 |
-
$options['tax_assing'][$ctx->name] = (!empty($taxonomies_hierarchy[0]['assign'])) ? 1 : 0;
|
501 |
-
|
502 |
if ($options['tax_logic'][$ctx->name] == 'multiple') {
|
503 |
-
$options['tax_multiple_xpath'][$ctx->name] = (!empty($taxonomies_hierarchy[0]['xpath'])) ? $taxonomies_hierarchy[0]['xpath'] : '';
|
504 |
-
$options['tax_multiple_delim'][$ctx->name] = (!empty($taxonomies_hierarchy[0]['delim'])) ? $taxonomies_hierarchy[0]['delim'] : '';
|
505 |
}
|
506 |
-
else{
|
507 |
-
$options['tax_hierarchical_logic_manual'][$ctx->name] = 1;
|
508 |
}
|
509 |
-
}
|
510 |
|
511 |
-
endforeach;
|
512 |
-
endif;
|
513 |
}
|
514 |
|
515 |
public function ver_4x_transition_fix(&$options, $version){
|
516 |
-
if ( version_compare($version, '4.0.5') < 0 ){
|
517 |
if ( ! empty($options['tax_hierarchical_logic']) and is_array($options['tax_hierarchical_logic']) ){
|
518 |
foreach ($options['tax_hierarchical_logic'] as $tx => $type) {
|
519 |
switch ($type){
|
520 |
case 'entire':
|
521 |
-
$options['tax_hierarchical_logic_entire'][$tx] = 1;
|
522 |
break;
|
523 |
case 'manual':
|
524 |
$options['tax_hierarchical_logic_manual'][$tx] = 1;
|
@@ -537,19 +545,19 @@ final class PMXI_Plugin {
|
|
537 |
/**
|
538 |
* pre-dispatching logic for admin page controllers
|
539 |
*/
|
540 |
-
public function adminInit() {
|
541 |
-
|
542 |
-
self::$session = new PMXI_Handler();
|
543 |
|
544 |
$input = new PMXI_Input();
|
545 |
-
$page = strtolower($input->getpost('page', ''));
|
546 |
|
547 |
if (preg_match('%^' . preg_quote(str_replace('_', '-', self::PREFIX), '%') . '([\w-]+)$%', $page)) {
|
548 |
//$this->adminDispatcher($page, strtolower($input->getpost('action', 'index')));
|
549 |
|
550 |
$action = strtolower($input->getpost('action', 'index'));
|
551 |
|
552 |
-
// capitalize prefix and first letters of class name parts
|
553 |
$controllerName = preg_replace_callback('%(^' . preg_quote(self::PREFIX, '%') . '|_).%', array($this, "replace_callback"),str_replace('-', '_', $page));
|
554 |
$actionName = str_replace('-', '_', $action);
|
555 |
if (method_exists($controllerName, $actionName)) {
|
@@ -559,7 +567,7 @@ final class PMXI_Plugin {
|
|
559 |
|
560 |
if ( ! get_current_user_id() or ! current_user_can( self::$capabilities )) {
|
561 |
// This nonce is not valid.
|
562 |
-
die( 'Security check' );
|
563 |
|
564 |
} else {
|
565 |
|
@@ -579,24 +587,24 @@ final class PMXI_Plugin {
|
|
579 |
throw new Exception("Administration page `$page` matches to a wrong controller type.");
|
580 |
}
|
581 |
|
582 |
-
if ($this->_admin_current_screen->is_ajax) { // ajax request
|
583 |
$controller->$action();
|
584 |
do_action('pmxi_action_after');
|
585 |
die(); // stop processing since we want to output only what controller is randered, nothing in addition
|
586 |
-
} elseif ( ! $controller->isInline) {
|
587 |
@ob_start();
|
588 |
$controller->$action();
|
589 |
-
self::$buffer = @ob_get_clean();
|
590 |
} else {
|
591 |
self::$buffer_callback = array($controller, $action);
|
592 |
}
|
593 |
|
594 |
}
|
595 |
-
|
596 |
} else { // redirect to dashboard if requested page and/or action don't exist
|
597 |
wp_redirect(admin_url()); die();
|
598 |
}
|
599 |
-
}
|
600 |
}
|
601 |
|
602 |
public function getAdminBodyClass($class){
|
@@ -630,9 +638,9 @@ final class PMXI_Plugin {
|
|
630 |
* The method is called twice: 1st time as handler `parse_header` action and then as admin menu item handler
|
631 |
* @param string[optional] $page When $page set to empty string ealier buffered content is outputted, otherwise controller is called based on $page value
|
632 |
*/
|
633 |
-
public function adminDispatcher($page = '', $action = 'index') {
|
634 |
|
635 |
-
if ('' === $page) {
|
636 |
if ( ! is_null(self::$buffer)) {
|
637 |
echo '<div class="wrap">';
|
638 |
echo self::$buffer;
|
@@ -646,8 +654,8 @@ final class PMXI_Plugin {
|
|
646 |
} else {
|
647 |
throw new Exception('There is no previousely buffered content to display.');
|
648 |
}
|
649 |
-
}
|
650 |
-
|
651 |
}
|
652 |
|
653 |
public function replace_callback($matches){
|
@@ -689,7 +697,7 @@ final class PMXI_Plugin {
|
|
689 |
return TRUE;
|
690 |
}
|
691 |
}
|
692 |
-
}
|
693 |
|
694 |
return FALSE;
|
695 |
}
|
@@ -753,7 +761,7 @@ final class PMXI_Plugin {
|
|
753 |
global $wpdb;
|
754 |
|
755 |
if (function_exists('is_multisite') && is_multisite()) {
|
756 |
-
// check if it is a network activation - if so, run the activation function for each blog id
|
757 |
if (isset($_GET['networkwide']) && ($_GET['networkwide'] == 1)) {
|
758 |
$old_blog = $wpdb->blogid;
|
759 |
// Get all blog ids
|
@@ -761,24 +769,92 @@ final class PMXI_Plugin {
|
|
761 |
foreach ($blogids as $blog_id) {
|
762 |
switch_to_blog($blog_id);
|
763 |
require self::ROOT_DIR . '/schema.php';
|
764 |
-
dbDelta($plugin_queries);
|
765 |
|
766 |
// sync data between plugin tables and wordpress (mostly for the case when plugin is reactivated)
|
767 |
-
|
768 |
-
|
769 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
770 |
}
|
771 |
switch_to_blog($old_blog);
|
772 |
-
return;
|
773 |
-
}
|
774 |
}
|
775 |
|
776 |
-
dbDelta($plugin_queries);
|
777 |
|
778 |
// sync data between plugin tables and wordpress (mostly for the case when plugin is reactivated)
|
779 |
-
|
780 |
-
|
781 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
782 |
|
783 |
}
|
784 |
|
@@ -791,14 +867,14 @@ final class PMXI_Plugin {
|
|
791 |
* @return void
|
792 |
*/
|
793 |
public function load_plugin_textdomain() {
|
794 |
-
$locale = apply_filters( 'plugin_locale', get_locale(), 'wp_all_import_plugin' );
|
795 |
-
|
796 |
load_plugin_textdomain( 'wp_all_import_plugin', false, dirname( plugin_basename( __FILE__ ) ) . "/i18n/languages" );
|
797 |
-
}
|
798 |
|
799 |
public function fix_db_schema(){
|
800 |
|
801 |
-
$uploads = wp_upload_dir();
|
802 |
|
803 |
if ( ! is_dir($uploads['basedir'] . DIRECTORY_SEPARATOR . self::LOGS_DIRECTORY) or ! is_writable($uploads['basedir'] . DIRECTORY_SEPARATOR . self::LOGS_DIRECTORY)) {
|
804 |
die(sprintf(__('Uploads folder %s must be writable', 'wp_all_import_plugin'), $uploads['basedir'] . DIRECTORY_SEPARATOR . self::LOGS_DIRECTORY));
|
@@ -827,7 +903,7 @@ final class PMXI_Plugin {
|
|
827 |
// sync data between plugin tables and wordpress (mostly for the case when plugin is reactivated)
|
828 |
|
829 |
$post = new PMXI_Post_Record();
|
830 |
-
|
831 |
}
|
832 |
switch_to_blog($old_blog);
|
833 |
return;
|
@@ -835,12 +911,12 @@ final class PMXI_Plugin {
|
|
835 |
}
|
836 |
|
837 |
dbDelta($plugin_queries);
|
838 |
-
|
839 |
// do not execute ALTER TABLE queries if sql user doesn't have ALTER privileges
|
840 |
$grands = $wpdb->get_results("SELECT * FROM information_schema.user_privileges WHERE grantee LIKE \"'" . DB_USER . "'%\" AND PRIVILEGE_TYPE = 'ALTER' AND IS_GRANTABLE = 'YES';");
|
841 |
-
|
842 |
$table = $table = $this->getTablePrefix() . 'files';
|
843 |
-
|
844 |
$tablefields = $wpdb->get_results("DESCRIBE {$table};");
|
845 |
// For every field in the table
|
846 |
foreach ($tablefields as $tablefield) {
|
@@ -893,7 +969,6 @@ final class PMXI_Plugin {
|
|
893 |
}
|
894 |
|
895 |
$table = $this->getTablePrefix() . 'imports';
|
896 |
-
|
897 |
$tablefields = $wpdb->get_results("DESCRIBE {$table};");
|
898 |
$fields_to_alter = array(
|
899 |
'parent_import_id',
|
@@ -906,58 +981,58 @@ final class PMXI_Plugin {
|
|
906 |
'failed_on',
|
907 |
'settings_update_on',
|
908 |
'last_activity'
|
909 |
-
);
|
910 |
|
911 |
// Check if field exists
|
912 |
foreach ($tablefields as $tablefield) {
|
913 |
if (in_array($tablefield->Field, $fields_to_alter)){
|
914 |
$fields_to_alter = array_diff($fields_to_alter, array($tablefield->Field));
|
915 |
-
}
|
916 |
}
|
917 |
-
|
918 |
-
if ( ! empty($fields_to_alter) ){
|
919 |
|
920 |
-
|
921 |
-
|
|
|
|
|
922 |
foreach ($fields_to_alter as $field) {
|
923 |
switch ($field) {
|
924 |
case 'parent_import_id':
|
925 |
-
$wpdb->query("ALTER TABLE {$table} ADD `parent_import_id` BIGINT(20) NOT NULL DEFAULT 0;");
|
926 |
break;
|
927 |
case 'iteration':
|
928 |
-
$wpdb->query("ALTER TABLE {$table} ADD `iteration` BIGINT(20) NOT NULL DEFAULT 0;");
|
929 |
break;
|
930 |
case 'deleted':
|
931 |
-
$wpdb->query("ALTER TABLE {$table} ADD `deleted` BIGINT(20) NOT NULL DEFAULT 0;");
|
932 |
break;
|
933 |
case 'executing':
|
934 |
-
$wpdb->query("ALTER TABLE {$table} ADD `executing` BOOL NOT NULL DEFAULT 0;");
|
935 |
break;
|
936 |
case 'canceled':
|
937 |
-
$wpdb->query("ALTER TABLE {$table} ADD `canceled` BOOL NOT NULL DEFAULT 0;");
|
938 |
break;
|
939 |
case 'canceled_on':
|
940 |
-
$wpdb->query("ALTER TABLE {$table} ADD `canceled_on` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';");
|
941 |
break;
|
942 |
case 'failed':
|
943 |
-
$wpdb->query("ALTER TABLE {$table} ADD `failed` BOOL NOT NULL DEFAULT 0;");
|
944 |
break;
|
945 |
case 'failed_on':
|
946 |
-
$wpdb->query("ALTER TABLE {$table} ADD `failed_on` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';");
|
947 |
break;
|
948 |
case 'settings_update_on':
|
949 |
-
$wpdb->query("ALTER TABLE {$table} ADD `settings_update_on` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';");
|
950 |
break;
|
951 |
case 'last_activity':
|
952 |
-
$wpdb->query("ALTER TABLE {$table} ADD `last_activity` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';");
|
953 |
break;
|
954 |
|
955 |
default:
|
956 |
# code...
|
957 |
break;
|
958 |
}
|
959 |
-
}
|
960 |
-
}
|
961 |
|
962 |
$table = $this->getTablePrefix() . 'posts';
|
963 |
$tablefields = $wpdb->get_results("DESCRIBE {$table};");
|
@@ -965,14 +1040,14 @@ final class PMXI_Plugin {
|
|
965 |
$specified = false;
|
966 |
|
967 |
// Check if field exists
|
968 |
-
foreach ($tablefields as $tablefield) {
|
969 |
-
if ('iteration' == $tablefield->Field) $iteration = true;
|
970 |
-
if ('specified' == $tablefield->Field) $specified = true;
|
971 |
}
|
972 |
|
973 |
-
if (!$iteration){
|
974 |
-
|
975 |
-
if (empty($grands)) {
|
976 |
?>
|
977 |
<div class="error"><p>
|
978 |
<?php printf(
|
@@ -983,12 +1058,12 @@ final class PMXI_Plugin {
|
|
983 |
<?php
|
984 |
return false;
|
985 |
}
|
986 |
-
|
987 |
$wpdb->query("ALTER TABLE {$table} ADD `iteration` BIGINT(20) NOT NULL DEFAULT 0;");
|
988 |
|
989 |
// Add indexing to pmxi_posts.post_id and pmxi_posts.import_id fields.
|
990 |
$wpdb->query("ALTER TABLE {$table} ADD INDEX `post_id`(`post_id`);");
|
991 |
-
$wpdb->query("ALTER TABLE {$table} ADD INDEX `import_id`(`import_id`)");
|
992 |
}
|
993 |
|
994 |
if (!$specified and !empty($grands))
|
@@ -1000,7 +1075,7 @@ final class PMXI_Plugin {
|
|
1000 |
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
|
1001 |
if ( ! empty($wpdb->collate))
|
1002 |
$charset_collate .= " COLLATE $wpdb->collate";
|
1003 |
-
|
1004 |
$table_prefix = $this->getTablePrefix();
|
1005 |
|
1006 |
$wpdb->query("CREATE TABLE IF NOT EXISTS {$table_prefix}history (
|
@@ -1014,7 +1089,7 @@ final class PMXI_Plugin {
|
|
1014 |
) $charset_collate;");
|
1015 |
|
1016 |
return true;
|
1017 |
-
}
|
1018 |
|
1019 |
/**
|
1020 |
* Method returns default import options, main utility of the method is to avoid warnings when new
|
@@ -1214,5 +1289,4 @@ final class PMXI_Plugin {
|
|
1214 |
|
1215 |
}
|
1216 |
|
1217 |
-
PMXI_Plugin::getInstance();
|
1218 |
-
|
3 |
Plugin Name: WP All Import
|
4 |
Plugin URI: http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=plugins-page&utm_campaign=free+plugin
|
5 |
Description: The most powerful solution for importing XML and CSV files to WordPress. Create Posts and Pages with content from any XML or CSV file. A paid upgrade to WP All Import Pro is available for support and additional features.
|
6 |
+
Version: 3.5.0
|
7 |
Author: Soflyy
|
8 |
*/
|
9 |
|
25 |
*/
|
26 |
define('WP_ALL_IMPORT_PREFIX', 'pmxi_');
|
27 |
|
28 |
+
define('PMXI_VERSION', '3.5.0');
|
29 |
|
30 |
define('PMXI_EDITION', 'free');
|
31 |
|
58 |
* Plugin temp folder name
|
59 |
* @var string
|
60 |
*/
|
61 |
+
define('WP_ALL_IMPORT_TEMP_DIRECTORY', WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'temp');
|
62 |
|
63 |
/**
|
64 |
* Main plugin file, Introduces MVC pattern
|
93 |
* Prefix used for names of shortcodes, action handlers, filter functions etc.
|
94 |
* @var string
|
95 |
*/
|
96 |
+
const PREFIX = WP_ALL_IMPORT_PREFIX;
|
97 |
/**
|
98 |
* Plugin file path
|
99 |
* @var string
|
103 |
* Max allowed file size (bytes) to import in default mode
|
104 |
* @var int
|
105 |
*/
|
106 |
+
const LARGE_SIZE = 0; // all files will importing in large import mode
|
107 |
|
108 |
+
public static $session = null;
|
109 |
|
110 |
public static $is_csv = false;
|
111 |
|
112 |
+
public static $csv_path = false;
|
113 |
|
114 |
public static $capabilities = 'manage_options';
|
115 |
|
141 |
const HISTORY_DIRECTORY = WP_ALL_IMPORT_HISTORY_DIRECTORY;
|
142 |
|
143 |
const LANGUAGE_DOMAIN = 'wp_all_import_plugin';
|
144 |
+
|
145 |
/**
|
146 |
* Return singletone instance
|
147 |
* @return PMXI_Plugin
|
211 |
*/
|
212 |
public function getTablePrefix() {
|
213 |
global $wpdb;
|
214 |
+
|
215 |
//return ($this->isNetwork() ? $wpdb->base_prefix : $wpdb->prefix) . self::PREFIX;
|
216 |
return $wpdb->prefix . self::PREFIX;
|
217 |
}
|
230 |
* @param string $rootDir Plugin root dir
|
231 |
* @param string $pluginFilePath Plugin main file
|
232 |
*/
|
233 |
+
protected function __construct() {
|
234 |
|
235 |
// register autoloading method
|
236 |
spl_autoload_register(array($this, 'autoload'));
|
238 |
// register helpers
|
239 |
if (is_dir(self::ROOT_DIR . '/helpers')) foreach (PMXI_Helper::safe_glob(self::ROOT_DIR . '/helpers/*.php', PMXI_Helper::GLOB_RECURSE | PMXI_Helper::GLOB_PATH) as $filePath) {
|
240 |
require_once $filePath;
|
241 |
+
}
|
242 |
+
|
243 |
// init plugin options
|
244 |
$option_name = get_class($this) . '_Options';
|
245 |
$options_default = PMXI_Config::createFromFile(self::ROOT_DIR . '/config/options.php')->toArray();
|
|
|
246 |
$current_options = get_option($option_name, array());
|
247 |
+
if (empty($current_options)) {
|
248 |
+
$current_options = array();
|
249 |
+
}
|
250 |
|
251 |
$this->options = array_intersect_key($current_options, $options_default) + $options_default;
|
252 |
$this->options = array_intersect_key($options_default, array_flip(array('info_api_url'))) + $this->options; // make sure hidden options apply upon plugin reactivation
|
253 |
+
if ('' == $this->options['cron_job_key']) {
|
254 |
+
$this->options['cron_job_key'] = wp_all_import_url_title(wp_all_import_rand_char(12));
|
255 |
+
}
|
256 |
|
257 |
+
if ($current_options !== $this->options) {
|
258 |
+
update_option($option_name, $this->options);
|
259 |
+
}
|
260 |
|
261 |
register_activation_hook(self::FILE, array($this, 'activation'));
|
262 |
|
271 |
$priority = 10;
|
272 |
}
|
273 |
add_action($actionName, self::PREFIX . str_replace('-', '_', $function), $priority, 99); // since we don't know at this point how many parameters each plugin expects, we make sure they will be provided with all of them (it's unlikely any developer will specify more than 99 parameters in a function)
|
274 |
+
}
|
275 |
|
276 |
// register filter handlers
|
277 |
if (is_dir(self::ROOT_DIR . '/filters')) foreach (PMXI_Helper::safe_glob(self::ROOT_DIR . '/filters/*.php', PMXI_Helper::GLOB_RECURSE | PMXI_Helper::GLOB_PATH) as $filePath) {
|
284 |
$priority = 10;
|
285 |
}
|
286 |
add_filter($actionName, self::PREFIX . str_replace('-', '_', $function), $priority, 99); // since we don't know at this point how many parameters each plugin expects, we make sure they will be provided with all of them (it's unlikely any developer will specify more than 99 parameters in a function)
|
287 |
+
}
|
288 |
|
289 |
// register admin page pre-dispatcher
|
290 |
add_action('admin_init', array($this, 'adminInit'));
|
292 |
add_action('init', array($this, 'init'));
|
293 |
|
294 |
add_action( 'plugins_loaded', array( $this, 'setup_allimport_dir' ) );
|
295 |
+
|
296 |
+
}
|
297 |
|
298 |
/**
|
299 |
* Setup required directory.
|
323 |
{
|
324 |
if ( $file == plugin_basename( __FILE__ ) ) {
|
325 |
$row_meta = array(
|
326 |
+
'pro' => '<a href="http://www.wpallimport.com" target="_blank" title="' . esc_attr( __( 'WP All Import Pro Version', 'wp_all_import_plugin' ) ) . '">' . __( 'Pro Version', 'wp_all_import_plugin' ) . '</a>',
|
327 |
);
|
328 |
|
329 |
return array_merge( $links, $row_meta );
|
340 |
public function fix_options(){
|
341 |
|
342 |
global $wpdb;
|
343 |
+
|
344 |
$imports = new PMXI_Import_List();
|
345 |
$post = new PMXI_Post_Record();
|
346 |
|
350 |
$is_migrated = get_option('pmxi_is_migrated');
|
351 |
|
352 |
$uploads = wp_upload_dir();
|
353 |
+
|
354 |
if ( empty($is_migrated) or version_compare($is_migrated, PMXI_VERSION) < 0 ){ //PMXI_VERSION
|
355 |
|
356 |
$commit_migration = true;
|
357 |
|
358 |
if ( empty($is_migrated) ){ // plugin version less than 4.0.0
|
359 |
|
360 |
+
if ( is_dir($uploads['basedir'] . '/wpallimport_history') ) {
|
361 |
+
wp_all_import_rmdir($uploads['basedir'] . '/wpallimport_history');
|
362 |
+
}
|
363 |
+
if ( is_dir($uploads['basedir'] . '/wpallimport_logs') ) {
|
364 |
+
wp_all_import_rmdir($uploads['basedir'] . '/wpallimport_logs');
|
365 |
+
}
|
366 |
|
367 |
foreach ($imports->setColumns($imports->getTable() . '.*')->getBy(array('id !=' => ''))->convertRecords() as $imp){
|
368 |
+
|
369 |
+
$imp->getById($imp->id);
|
370 |
+
|
371 |
if ( ! $imp->isEmpty() and ! empty($imp->template)){
|
372 |
|
373 |
$options = array_merge($imp->options, $imp->template);
|
374 |
|
375 |
$this->ver_4_transition_fix($options);
|
376 |
+
|
377 |
$imp->set(array(
|
378 |
'options' => $options
|
379 |
))->update();
|
380 |
+
|
381 |
+
if ($imp->type == 'file'){
|
382 |
$imp->set(array(
|
383 |
'path' => $uploads['basedir'] . DIRECTORY_SEPARATOR . self::FILES_DIRECTORY . DIRECTORY_SEPARATOR . basename($imp->path)
|
384 |
))->update();
|
385 |
}
|
386 |
}
|
387 |
+
}
|
388 |
|
389 |
foreach ($templates->setColumns($templates->getTable() . '.*')->getBy(array('id !=' => ''))->convertRecords() as $tpl){
|
390 |
+
|
391 |
+
$tpl->getById($tpl->id);
|
392 |
+
|
393 |
if ( ! $tpl->isEmpty() and ! empty($tpl->title) ) {
|
394 |
+
|
395 |
$opt = ( empty($tpl->options) ) ? array() : $tpl->options;
|
396 |
|
397 |
$options = array_merge($opt, array(
|
410 |
|
411 |
}
|
412 |
|
413 |
+
}
|
414 |
|
415 |
$commit_migration = $this->fix_db_schema(); // feature to version 4.0.0
|
416 |
+
|
417 |
}
|
418 |
else {
|
419 |
|
420 |
$commit_migration = $this->fix_db_schema();
|
421 |
+
|
422 |
foreach ($imports->setColumns($imports->getTable() . '.*')->getBy(array('id !=' => ''))->convertRecords() as $imp){
|
423 |
+
|
424 |
+
$imp->getById($imp->id);
|
425 |
+
|
426 |
if ( ! $imp->isEmpty() ){
|
427 |
|
428 |
$options = $imp->options;
|
429 |
|
430 |
$this->ver_4x_transition_fix($options, $is_migrated);
|
431 |
+
|
432 |
$imp->set(array(
|
433 |
'options' => $options
|
434 |
+
))->update();
|
435 |
}
|
436 |
+
}
|
437 |
|
438 |
foreach ($templates->setColumns($templates->getTable() . '.*')->getBy(array('id !=' => ''))->convertRecords() as $tpl){
|
439 |
+
|
440 |
+
$tpl->getById($tpl->id);
|
441 |
+
|
442 |
if ( ! $tpl->isEmpty() ) {
|
443 |
+
|
444 |
+
$options = ( empty($tpl->options) ) ? array() : $tpl->options;
|
445 |
|
446 |
$this->ver_4x_transition_fix($options, $is_migrated);
|
447 |
|
454 |
}
|
455 |
}
|
456 |
if ($commit_migration) update_option('pmxi_is_migrated', PMXI_VERSION);
|
457 |
+
}
|
458 |
}
|
459 |
|
460 |
public function ver_4_transition_fix( &$options ){
|
461 |
+
|
462 |
$options['wizard_type'] = ($options['duplicate_matching'] == 'auto') ? 'new' : 'matching';
|
463 |
|
464 |
if ($options['download_images']){
|
478 |
|
479 |
if ("" == $options['custom_type']) $options['custom_type'] = $options['type'];
|
480 |
|
481 |
+
$exclude_taxonomies = (class_exists('PMWI_Plugin')) ? array('post_format', 'product_type') : array('post_format');
|
482 |
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($options['custom_type']), 'object'), array_flip($exclude_taxonomies));
|
483 |
|
484 |
$options['tax_logic'] = array();
|
489 |
$options['tax_hierarchical_logic_manual'] = array();
|
490 |
|
491 |
if ( ! empty($post_taxonomies)):
|
492 |
+
foreach ($post_taxonomies as $ctx):
|
493 |
|
494 |
$options['tax_logic'][$ctx->name] = ($ctx->hierarchical) ? 'hierarchical' : 'multiple';
|
495 |
+
|
496 |
if ($ctx->name == 'category'){
|
497 |
$options['post_taxonomies']['category'] = $options['categories'];
|
498 |
}
|
499 |
elseif ($ctx->name == 'post_tag' ){
|
500 |
+
$options['tax_assing']['post_tag'] = 1;
|
501 |
$options['tax_multiple_xpath']['post_tag'] = $options['tags'];
|
502 |
$options['tax_multiple_delim']['post_tag'] = $options['tags_delim'];
|
503 |
}
|
504 |
+
|
505 |
if ( ! empty($options['post_taxonomies'][$ctx->name])){
|
506 |
|
507 |
+
$taxonomies_hierarchy = json_decode($options['post_taxonomies'][$ctx->name], true);
|
508 |
+
$options['tax_assing'][$ctx->name] = (!empty($taxonomies_hierarchy[0]['assign'])) ? 1 : 0;
|
509 |
+
|
510 |
if ($options['tax_logic'][$ctx->name] == 'multiple') {
|
511 |
+
$options['tax_multiple_xpath'][$ctx->name] = (!empty($taxonomies_hierarchy[0]['xpath'])) ? $taxonomies_hierarchy[0]['xpath'] : '';
|
512 |
+
$options['tax_multiple_delim'][$ctx->name] = (!empty($taxonomies_hierarchy[0]['delim'])) ? $taxonomies_hierarchy[0]['delim'] : '';
|
513 |
}
|
514 |
+
else{
|
515 |
+
$options['tax_hierarchical_logic_manual'][$ctx->name] = 1;
|
516 |
}
|
517 |
+
}
|
518 |
|
519 |
+
endforeach;
|
520 |
+
endif;
|
521 |
}
|
522 |
|
523 |
public function ver_4x_transition_fix(&$options, $version){
|
524 |
+
if ( version_compare($version, '4.0.5') < 0 ){
|
525 |
if ( ! empty($options['tax_hierarchical_logic']) and is_array($options['tax_hierarchical_logic']) ){
|
526 |
foreach ($options['tax_hierarchical_logic'] as $tx => $type) {
|
527 |
switch ($type){
|
528 |
case 'entire':
|
529 |
+
$options['tax_hierarchical_logic_entire'][$tx] = 1;
|
530 |
break;
|
531 |
case 'manual':
|
532 |
$options['tax_hierarchical_logic_manual'][$tx] = 1;
|
545 |
/**
|
546 |
* pre-dispatching logic for admin page controllers
|
547 |
*/
|
548 |
+
public function adminInit() {
|
549 |
+
|
550 |
+
self::$session = new PMXI_Handler();
|
551 |
|
552 |
$input = new PMXI_Input();
|
553 |
+
$page = strtolower($input->getpost('page', ''));
|
554 |
|
555 |
if (preg_match('%^' . preg_quote(str_replace('_', '-', self::PREFIX), '%') . '([\w-]+)$%', $page)) {
|
556 |
//$this->adminDispatcher($page, strtolower($input->getpost('action', 'index')));
|
557 |
|
558 |
$action = strtolower($input->getpost('action', 'index'));
|
559 |
|
560 |
+
// capitalize prefix and first letters of class name parts
|
561 |
$controllerName = preg_replace_callback('%(^' . preg_quote(self::PREFIX, '%') . '|_).%', array($this, "replace_callback"),str_replace('-', '_', $page));
|
562 |
$actionName = str_replace('-', '_', $action);
|
563 |
if (method_exists($controllerName, $actionName)) {
|
567 |
|
568 |
if ( ! get_current_user_id() or ! current_user_can( self::$capabilities )) {
|
569 |
// This nonce is not valid.
|
570 |
+
die( 'Security check' );
|
571 |
|
572 |
} else {
|
573 |
|
587 |
throw new Exception("Administration page `$page` matches to a wrong controller type.");
|
588 |
}
|
589 |
|
590 |
+
if ($this->_admin_current_screen->is_ajax) { // ajax request
|
591 |
$controller->$action();
|
592 |
do_action('pmxi_action_after');
|
593 |
die(); // stop processing since we want to output only what controller is randered, nothing in addition
|
594 |
+
} elseif ( ! $controller->isInline) {
|
595 |
@ob_start();
|
596 |
$controller->$action();
|
597 |
+
self::$buffer = @ob_get_clean();
|
598 |
} else {
|
599 |
self::$buffer_callback = array($controller, $action);
|
600 |
}
|
601 |
|
602 |
}
|
603 |
+
|
604 |
} else { // redirect to dashboard if requested page and/or action don't exist
|
605 |
wp_redirect(admin_url()); die();
|
606 |
}
|
607 |
+
}
|
608 |
}
|
609 |
|
610 |
public function getAdminBodyClass($class){
|
638 |
* The method is called twice: 1st time as handler `parse_header` action and then as admin menu item handler
|
639 |
* @param string[optional] $page When $page set to empty string ealier buffered content is outputted, otherwise controller is called based on $page value
|
640 |
*/
|
641 |
+
public function adminDispatcher($page = '', $action = 'index') {
|
642 |
|
643 |
+
if ('' === $page) {
|
644 |
if ( ! is_null(self::$buffer)) {
|
645 |
echo '<div class="wrap">';
|
646 |
echo self::$buffer;
|
654 |
} else {
|
655 |
throw new Exception('There is no previousely buffered content to display.');
|
656 |
}
|
657 |
+
}
|
658 |
+
|
659 |
}
|
660 |
|
661 |
public function replace_callback($matches){
|
697 |
return TRUE;
|
698 |
}
|
699 |
}
|
700 |
+
}
|
701 |
|
702 |
return FALSE;
|
703 |
}
|
761 |
global $wpdb;
|
762 |
|
763 |
if (function_exists('is_multisite') && is_multisite()) {
|
764 |
+
// check if it is a network activation - if so, run the activation function for each blog id
|
765 |
if (isset($_GET['networkwide']) && ($_GET['networkwide'] == 1)) {
|
766 |
$old_blog = $wpdb->blogid;
|
767 |
// Get all blog ids
|
769 |
foreach ($blogids as $blog_id) {
|
770 |
switch_to_blog($blog_id);
|
771 |
require self::ROOT_DIR . '/schema.php';
|
772 |
+
dbDelta($plugin_queries);
|
773 |
|
774 |
// sync data between plugin tables and wordpress (mostly for the case when plugin is reactivated)
|
775 |
+
|
776 |
+
//$post = new PMXI_Post_Record();
|
777 |
+
//$wpdb->query('DELETE FROM ' . $post->getTable() . ' WHERE post_id NOT IN (SELECT ID FROM ' . $wpdb->posts . ')');
|
778 |
+
$post = new PMXI_Post_Record();
|
779 |
+
$import = new PMXI_Import_Record();
|
780 |
+
$imports_list = $wpdb->get_results('SELECT id FROM ' . $import->getTable() . '');
|
781 |
+
|
782 |
+
if ( ! empty($imports_list) ) {
|
783 |
+
|
784 |
+
$user_imports = array();
|
785 |
+
$post_imports = array();
|
786 |
+
|
787 |
+
foreach ($imports_list as $import_entry) {
|
788 |
+
$import_id = $import_entry->id;
|
789 |
+
$import = $import->getById($import_id);
|
790 |
+
$import_options = maybe_unserialize($import->options);
|
791 |
+
$import_type = $import_options['custom_type'];
|
792 |
+
if ( in_array($import_type, array('import_users', 'shop_customer')) ) {
|
793 |
+
$user_imports[] = $import_id;
|
794 |
+
} else {
|
795 |
+
$post_imports[] = $import_id;
|
796 |
+
}
|
797 |
+
}
|
798 |
+
|
799 |
+
if ( ! empty($user_imports) ) {
|
800 |
+
$user_table = $wpdb->base_prefix . 'users';
|
801 |
+
$user_query = 'DELETE FROM ' . $post->getTable() . ' WHERE import_id IN (' . implode(',', $user_imports) . ') AND post_id NOT IN (SELECT ID FROM ' . $user_table . ')';
|
802 |
+
$wpdb->query($user_query);
|
803 |
+
}
|
804 |
+
|
805 |
+
if ( ! empty($post_imports) ) {
|
806 |
+
$post_query = 'DELETE FROM ' . $post->getTable() . ' WHERE import_id IN (' . implode(',', $post_imports) . ') AND post_id NOT IN (SELECT ID FROM ' . $wpdb->posts . ')';
|
807 |
+
$wpdb->query($post_query);
|
808 |
+
}
|
809 |
+
|
810 |
+
}
|
811 |
+
|
812 |
}
|
813 |
switch_to_blog($old_blog);
|
814 |
+
return;
|
815 |
+
}
|
816 |
}
|
817 |
|
818 |
+
dbDelta($plugin_queries);
|
819 |
|
820 |
// sync data between plugin tables and wordpress (mostly for the case when plugin is reactivated)
|
821 |
+
|
822 |
+
//$post = new PMXI_Post_Record();
|
823 |
+
//$wpdb->query('DELETE FROM ' . $post->getTable() . ' WHERE post_id NOT IN (SELECT ID FROM ' . $wpdb->posts . ')');
|
824 |
+
|
825 |
+
$post = new PMXI_Post_Record();
|
826 |
+
$import = new PMXI_Import_Record();
|
827 |
+
$imports_list = $wpdb->get_results('SELECT id FROM ' . $import->getTable() . '');
|
828 |
+
|
829 |
+
if ( ! empty($imports_list) ) {
|
830 |
+
|
831 |
+
$user_imports = array();
|
832 |
+
$post_imports = array();
|
833 |
+
|
834 |
+
foreach ($imports_list as $import_entry) {
|
835 |
+
$import_id = $import_entry->id;
|
836 |
+
$import = $import->getById($import_id);
|
837 |
+
$import_options = maybe_unserialize($import->options);
|
838 |
+
$import_type = $import_options['custom_type'];
|
839 |
+
if ( in_array($import_type, array('import_users', 'shop_customer')) ) {
|
840 |
+
$user_imports[] = $import_id;
|
841 |
+
} else {
|
842 |
+
$post_imports[] = $import_id;
|
843 |
+
}
|
844 |
+
}
|
845 |
+
|
846 |
+
if ( ! empty($user_imports) ) {
|
847 |
+
$user_table = $wpdb->base_prefix . 'users';
|
848 |
+
$user_query = 'DELETE FROM ' . $post->getTable() . ' WHERE import_id IN (' . implode(',', $user_imports) . ') AND post_id NOT IN (SELECT ID FROM ' . $user_table . ')';
|
849 |
+
$wpdb->query($user_query);
|
850 |
+
}
|
851 |
+
|
852 |
+
if ( ! empty($post_imports) ) {
|
853 |
+
$post_query = 'DELETE FROM ' . $post->getTable() . ' WHERE import_id IN (' . implode(',', $post_imports) . ') AND post_id NOT IN (SELECT ID FROM ' . $wpdb->posts . ')';
|
854 |
+
$wpdb->query($post_query);
|
855 |
+
}
|
856 |
+
|
857 |
+
}
|
858 |
|
859 |
}
|
860 |
|
867 |
* @return void
|
868 |
*/
|
869 |
public function load_plugin_textdomain() {
|
870 |
+
$locale = apply_filters( 'plugin_locale', get_locale(), 'wp_all_import_plugin' );
|
871 |
+
|
872 |
load_plugin_textdomain( 'wp_all_import_plugin', false, dirname( plugin_basename( __FILE__ ) ) . "/i18n/languages" );
|
873 |
+
}
|
874 |
|
875 |
public function fix_db_schema(){
|
876 |
|
877 |
+
$uploads = wp_upload_dir();
|
878 |
|
879 |
if ( ! is_dir($uploads['basedir'] . DIRECTORY_SEPARATOR . self::LOGS_DIRECTORY) or ! is_writable($uploads['basedir'] . DIRECTORY_SEPARATOR . self::LOGS_DIRECTORY)) {
|
880 |
die(sprintf(__('Uploads folder %s must be writable', 'wp_all_import_plugin'), $uploads['basedir'] . DIRECTORY_SEPARATOR . self::LOGS_DIRECTORY));
|
903 |
// sync data between plugin tables and wordpress (mostly for the case when plugin is reactivated)
|
904 |
|
905 |
$post = new PMXI_Post_Record();
|
906 |
+
$wpdb->query('DELETE FROM ' . $post->getTable() . ' WHERE post_id NOT IN (SELECT ID FROM ' . $wpdb->posts .') AND post_id NOT IN ( SELECT ID FROM ' . $wpdb->users . ') AND post_id NOT IN ( SELECT term_taxonomy_id FROM ' . $wpdb->term_taxonomy . ')');
|
907 |
}
|
908 |
switch_to_blog($old_blog);
|
909 |
return;
|
911 |
}
|
912 |
|
913 |
dbDelta($plugin_queries);
|
914 |
+
|
915 |
// do not execute ALTER TABLE queries if sql user doesn't have ALTER privileges
|
916 |
$grands = $wpdb->get_results("SELECT * FROM information_schema.user_privileges WHERE grantee LIKE \"'" . DB_USER . "'%\" AND PRIVILEGE_TYPE = 'ALTER' AND IS_GRANTABLE = 'YES';");
|
917 |
+
|
918 |
$table = $table = $this->getTablePrefix() . 'files';
|
919 |
+
|
920 |
$tablefields = $wpdb->get_results("DESCRIBE {$table};");
|
921 |
// For every field in the table
|
922 |
foreach ($tablefields as $tablefield) {
|
969 |
}
|
970 |
|
971 |
$table = $this->getTablePrefix() . 'imports';
|
|
|
972 |
$tablefields = $wpdb->get_results("DESCRIBE {$table};");
|
973 |
$fields_to_alter = array(
|
974 |
'parent_import_id',
|
981 |
'failed_on',
|
982 |
'settings_update_on',
|
983 |
'last_activity'
|
984 |
+
);
|
985 |
|
986 |
// Check if field exists
|
987 |
foreach ($tablefields as $tablefield) {
|
988 |
if (in_array($tablefield->Field, $fields_to_alter)){
|
989 |
$fields_to_alter = array_diff($fields_to_alter, array($tablefield->Field));
|
990 |
+
}
|
991 |
}
|
|
|
|
|
992 |
|
993 |
+
if ( ! empty($fields_to_alter) ){
|
994 |
+
|
995 |
+
if (empty($grands)) return false;
|
996 |
+
|
997 |
foreach ($fields_to_alter as $field) {
|
998 |
switch ($field) {
|
999 |
case 'parent_import_id':
|
1000 |
+
$wpdb->query("ALTER TABLE {$table} ADD `parent_import_id` BIGINT(20) NOT NULL DEFAULT 0;");
|
1001 |
break;
|
1002 |
case 'iteration':
|
1003 |
+
$wpdb->query("ALTER TABLE {$table} ADD `iteration` BIGINT(20) NOT NULL DEFAULT 0;");
|
1004 |
break;
|
1005 |
case 'deleted':
|
1006 |
+
$wpdb->query("ALTER TABLE {$table} ADD `deleted` BIGINT(20) NOT NULL DEFAULT 0;");
|
1007 |
break;
|
1008 |
case 'executing':
|
1009 |
+
$wpdb->query("ALTER TABLE {$table} ADD `executing` BOOL NOT NULL DEFAULT 0;");
|
1010 |
break;
|
1011 |
case 'canceled':
|
1012 |
+
$wpdb->query("ALTER TABLE {$table} ADD `canceled` BOOL NOT NULL DEFAULT 0;");
|
1013 |
break;
|
1014 |
case 'canceled_on':
|
1015 |
+
$wpdb->query("ALTER TABLE {$table} ADD `canceled_on` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';");
|
1016 |
break;
|
1017 |
case 'failed':
|
1018 |
+
$wpdb->query("ALTER TABLE {$table} ADD `failed` BOOL NOT NULL DEFAULT 0;");
|
1019 |
break;
|
1020 |
case 'failed_on':
|
1021 |
+
$wpdb->query("ALTER TABLE {$table} ADD `failed_on` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';");
|
1022 |
break;
|
1023 |
case 'settings_update_on':
|
1024 |
+
$wpdb->query("ALTER TABLE {$table} ADD `settings_update_on` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';");
|
1025 |
break;
|
1026 |
case 'last_activity':
|
1027 |
+
$wpdb->query("ALTER TABLE {$table} ADD `last_activity` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';");
|
1028 |
break;
|
1029 |
|
1030 |
default:
|
1031 |
# code...
|
1032 |
break;
|
1033 |
}
|
1034 |
+
}
|
1035 |
+
}
|
1036 |
|
1037 |
$table = $this->getTablePrefix() . 'posts';
|
1038 |
$tablefields = $wpdb->get_results("DESCRIBE {$table};");
|
1040 |
$specified = false;
|
1041 |
|
1042 |
// Check if field exists
|
1043 |
+
foreach ($tablefields as $tablefield) {
|
1044 |
+
if ('iteration' == $tablefield->Field) $iteration = true;
|
1045 |
+
if ('specified' == $tablefield->Field) $specified = true;
|
1046 |
}
|
1047 |
|
1048 |
+
if (!$iteration){
|
1049 |
+
|
1050 |
+
if (empty($grands)) {
|
1051 |
?>
|
1052 |
<div class="error"><p>
|
1053 |
<?php printf(
|
1058 |
<?php
|
1059 |
return false;
|
1060 |
}
|
1061 |
+
|
1062 |
$wpdb->query("ALTER TABLE {$table} ADD `iteration` BIGINT(20) NOT NULL DEFAULT 0;");
|
1063 |
|
1064 |
// Add indexing to pmxi_posts.post_id and pmxi_posts.import_id fields.
|
1065 |
$wpdb->query("ALTER TABLE {$table} ADD INDEX `post_id`(`post_id`);");
|
1066 |
+
$wpdb->query("ALTER TABLE {$table} ADD INDEX `import_id`(`import_id`)");
|
1067 |
}
|
1068 |
|
1069 |
if (!$specified and !empty($grands))
|
1075 |
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
|
1076 |
if ( ! empty($wpdb->collate))
|
1077 |
$charset_collate .= " COLLATE $wpdb->collate";
|
1078 |
+
|
1079 |
$table_prefix = $this->getTablePrefix();
|
1080 |
|
1081 |
$wpdb->query("CREATE TABLE IF NOT EXISTS {$table_prefix}history (
|
1089 |
) $charset_collate;");
|
1090 |
|
1091 |
return true;
|
1092 |
+
}
|
1093 |
|
1094 |
/**
|
1095 |
* Method returns default import options, main utility of the method is to avoid warnings when new
|
1289 |
|
1290 |
}
|
1291 |
|
1292 |
+
PMXI_Plugin::getInstance();
|
|
readme.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
=== Import any XML or CSV File to WordPress ===
|
2 |
Contributors: soflyy, wpallimport
|
3 |
Requires at least: 4.1
|
4 |
-
Tested up to:
|
5 |
-
Stable tag: 3.
|
6 |
Tags: wordpress csv import, wordpress xml import, xml, csv, datafeed, import, migrate, import csv to wordpress, import xml to wordpress, advanced xml import, advanced csv import, bulk csv import, bulk xml import, bulk data import, xml to custom post type, csv to custom post type, woocommerce csv import, woocommerce xml import, csv import, import csv, xml import, import xml, csv importer
|
7 |
|
8 |
WP All Import is an extremely powerful importer that makes it easy to import any XML or CSV file to WordPress.
|
@@ -105,6 +105,13 @@ Does it work with special character encoding like Hebrew, Arabic, Chinese, etc?
|
|
105 |
|
106 |
== Changelog ==
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
= 3.4.9 =
|
109 |
* bug fix: import using stream reader
|
110 |
* bug fix: generation temporary files in system temporary folder
|
1 |
=== Import any XML or CSV File to WordPress ===
|
2 |
Contributors: soflyy, wpallimport
|
3 |
Requires at least: 4.1
|
4 |
+
Tested up to: 5.2
|
5 |
+
Stable tag: 3.5.0
|
6 |
Tags: wordpress csv import, wordpress xml import, xml, csv, datafeed, import, migrate, import csv to wordpress, import xml to wordpress, advanced xml import, advanced csv import, bulk csv import, bulk xml import, bulk data import, xml to custom post type, csv to custom post type, woocommerce csv import, woocommerce xml import, csv import, import csv, xml import, import xml, csv importer
|
7 |
|
8 |
WP All Import is an extremely powerful importer that makes it easy to import any XML or CSV file to WordPress.
|
105 |
|
106 |
== Changelog ==
|
107 |
|
108 |
+
= 3.5.0 =
|
109 |
+
* improvement: add support for .tsv format
|
110 |
+
* API: add current XML variable to pmxi_article_data filter
|
111 |
+
* bug fix: post terms incorrect after import complete, must be recounted
|
112 |
+
* bug fix: empty attachments created when attachment import fails
|
113 |
+
* bug fix: matching posts by ID matches and imports into attachments with the same ID
|
114 |
+
|
115 |
= 3.4.9 =
|
116 |
* bug fix: import using stream reader
|
117 |
* bug fix: generation temporary files in system temporary folder
|
schema.php
CHANGED
@@ -80,9 +80,7 @@ CREATE TABLE {$table_prefix}posts (
|
|
80 |
product_key TEXT,
|
81 |
iteration BIGINT(20) NOT NULL DEFAULT 0,
|
82 |
specified BOOL NOT NULL DEFAULT 0,
|
83 |
-
PRIMARY KEY (id)
|
84 |
-
KEY import_id (import_id),
|
85 |
-
KEY post_id (post_id)
|
86 |
) $charset_collate;
|
87 |
CREATE TABLE {$table_prefix}files (
|
88 |
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
80 |
product_key TEXT,
|
81 |
iteration BIGINT(20) NOT NULL DEFAULT 0,
|
82 |
specified BOOL NOT NULL DEFAULT 0,
|
83 |
+
PRIMARY KEY (id)
|
|
|
|
|
84 |
) $charset_collate;
|
85 |
CREATE TABLE {$table_prefix}files (
|
86 |
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
static/css/admin.css
CHANGED
@@ -25,8 +25,9 @@
|
|
25 |
vertical-align: middle;
|
26 |
margin-left: 5px;
|
27 |
position: relative;
|
28 |
-
top: 4px;
|
29 |
background-size: cover;
|
|
|
30 |
}
|
31 |
.wpallimport-plugin input.datepicker {
|
32 |
width: 8em;
|
@@ -263,7 +264,8 @@
|
|
263 |
padding-left: 30px;
|
264 |
cursor: pointer;
|
265 |
}
|
266 |
-
.wpallimport-plugin .wpallimport-collapsed .wpallimport-collapsed-header h3
|
|
|
267 |
line-height: 30px;
|
268 |
color:#425e99;
|
269 |
-webkit-touch-callout: none;
|
@@ -273,6 +275,17 @@
|
|
273 |
-ms-user-select: none;
|
274 |
user-select: none;
|
275 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
.wpallimport-plugin .wpallimport-collapsed.closed .wpallimport-collapsed-header{
|
277 |
background: url('../img/ui_4.0/collapser.png') no-repeat 98% -30px;
|
278 |
}
|
@@ -479,7 +492,7 @@
|
|
479 |
.wpallimport-plugin #footer-upgrade{
|
480 |
/*float: left !important;*/
|
481 |
}
|
482 |
-
.wpallimport-plugin .wpallimport-overlay {
|
483 |
display:none;
|
484 |
position:fixed;
|
485 |
z-index:99999;
|
@@ -567,6 +580,15 @@ p.upgrade_link {
|
|
567 |
position: relative;
|
568 |
float: right;
|
569 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
570 |
.wpallimport-plugin .wp-all-import-sure-to-delete{
|
571 |
display: none;
|
572 |
}
|
@@ -649,6 +671,22 @@ p.upgrade_link {
|
|
649 |
font-size: 1.3em !important;
|
650 |
text-decoration: underline;
|
651 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
652 |
/*--------------------------------------------------------------------------
|
653 |
*
|
654 |
* Helpers
|
@@ -1287,7 +1325,8 @@ p.upgrade_link {
|
|
1287 |
border: 1px solid #ddd;
|
1288 |
}
|
1289 |
.wpallimport-plugin #custom_type_selector,
|
1290 |
-
.wpallimport-plugin #file_selector
|
|
|
1291 |
margin: 0 auto;
|
1292 |
margin-bottom: 20px;
|
1293 |
text-align: left;
|
@@ -1301,15 +1340,21 @@ p.upgrade_link {
|
|
1301 |
.wpallimport-plugin .wpallimport-change-custom-type #custom_type_selector .dd-select{
|
1302 |
padding: 5px 0 0;
|
1303 |
}
|
1304 |
-
.wpallimport-plugin #file_selector
|
|
|
1305 |
margin-top: 30px;
|
1306 |
}
|
|
|
|
|
|
|
1307 |
.wpallimport-plugin #custom_type_selector .dd-options li,
|
1308 |
-
.wpallimport-plugin #file_selector .dd-options li
|
|
|
1309 |
margin-bottom: 0;
|
1310 |
}
|
1311 |
.wpallimport-plugin #custom_type_selector .dd-options li .dd-option,
|
1312 |
-
.wpallimport-plugin #file_selector .dd-options li .dd-option
|
|
|
1313 |
font-size: 18px;
|
1314 |
color: #555;
|
1315 |
border: none;
|
@@ -1322,7 +1367,9 @@ p.upgrade_link {
|
|
1322 |
.wpallimport-plugin #custom_type_selector .dd-options li .dd-option:hover,
|
1323 |
.wpallimport-plugin #custom_type_selector .dd-options li .dd-option-selected,
|
1324 |
.wpallimport-plugin #file_selector .dd-options li .dd-option:hover,
|
1325 |
-
.wpallimport-plugin #file_selector .dd-options li .dd-option-selected
|
|
|
|
|
1326 |
background: #eee;
|
1327 |
color: #555;
|
1328 |
}
|
@@ -1332,13 +1379,15 @@ p.upgrade_link {
|
|
1332 |
color: #fff;
|
1333 |
}*/
|
1334 |
.wpallimport-plugin #custom_type_selector .dd-select,
|
1335 |
-
.wpallimport-plugin #file_selector .dd-select
|
|
|
1336 |
background: #fff !important;
|
1337 |
padding: 10px 0;
|
1338 |
margin-left: -5px;
|
1339 |
}
|
1340 |
.wpallimport-plugin #custom_type_selector .dd-selected,
|
1341 |
-
.wpallimport-plugin #file_selector .dd-selected
|
|
|
1342 |
color: #000;
|
1343 |
font-weight: normal;
|
1344 |
font-size: 18px;
|
@@ -1346,10 +1395,12 @@ p.upgrade_link {
|
|
1346 |
padding: 0 10px;
|
1347 |
line-height: 24px;
|
1348 |
}
|
1349 |
-
.wpallimport-plugin .change_file #file_selector .dd-select
|
|
|
1350 |
padding: 5px 0 0;
|
1351 |
}
|
1352 |
-
.wpallimport-plugin .change_file #file_selector .dd-options .dd-option
|
|
|
1353 |
padding: 0 10px;
|
1354 |
}
|
1355 |
.wpallimport-plugin .dd-options{
|
@@ -1420,6 +1471,7 @@ p.upgrade_link {
|
|
1420 |
}
|
1421 |
.wpallimport-plugin #custom_type_selector .dd-option .dashicon:before,
|
1422 |
.wpallimport-plugin #custom_type_selector .dd-selected .dashicon:before {
|
|
|
1423 |
font-size: 24px;
|
1424 |
float: left;
|
1425 |
margin: 2px 5px 2px 2px;
|
@@ -1446,7 +1498,9 @@ p.upgrade_link {
|
|
1446 |
.wpallimport-plugin #custom_type_selector .dd-option .dashicon-shop_coupon:before,
|
1447 |
.wpallimport-plugin #custom_type_selector .dd-selected .dashicon-shop_coupon:before,
|
1448 |
.wpallimport-plugin #custom_type_selector .dd-option .dashicon-shop_order:before,
|
1449 |
-
.wpallimport-plugin #custom_type_selector .dd-selected .dashicon-shop_order:before
|
|
|
|
|
1450 |
font-family: "WooCommerce";
|
1451 |
content: "\e03d";
|
1452 |
color: #555;
|
@@ -1457,6 +1511,7 @@ p.upgrade_link {
|
|
1457 |
font-family: "dashicons";
|
1458 |
content: "\f111";
|
1459 |
color: #555;
|
|
|
1460 |
}
|
1461 |
.wpallimport-plugin #custom_type_selector .dd-option .dashicon-import_users:before,
|
1462 |
.wpallimport-plugin #custom_type_selector .dd-selected .dashicon-import_users:before{
|
@@ -2475,7 +2530,9 @@ p.upgrade_link {
|
|
2475 |
.wpallimport-plugin .options .wpallimport-submit-buttons{
|
2476 |
position: relative;
|
2477 |
text-align: center;
|
2478 |
-
top: 10px;
|
|
|
|
|
2479 |
}
|
2480 |
.wpallimport-plugin form.options{
|
2481 |
position: relative;
|
@@ -2700,6 +2757,9 @@ p.upgrade_link {
|
|
2700 |
display: inline-block;
|
2701 |
height: 25px;
|
2702 |
}
|
|
|
|
|
|
|
2703 |
.wpallimport-plugin #process{ display:none; }
|
2704 |
.wpallimport-plugin .ui-widget-header{
|
2705 |
-moz-border-radius: 4px;
|
@@ -2776,6 +2836,7 @@ p.upgrade_link {
|
|
2776 |
left: 0;
|
2777 |
color: #ccc;
|
2778 |
}
|
|
|
2779 |
/*--------------------------------------------------------------------------
|
2780 |
*
|
2781 |
* XML & CSV
|
@@ -3120,14 +3181,16 @@ p.upgrade_link {
|
|
3120 |
color: #777;
|
3121 |
margin-top: 2px;
|
3122 |
}
|
3123 |
-
.wpallimport-plugin .wpallimport-complete-warning
|
|
|
3124 |
display: none;
|
3125 |
background: url('../img/ui_4.0/exclamation.png') #fff 25px 40px no-repeat;
|
3126 |
padding: 30px 20px 10px 25px;
|
3127 |
margin: 40px 0;
|
3128 |
text-align: left;
|
3129 |
}
|
3130 |
-
.wpallimport-plugin .wpallimport-complete-warning h3
|
|
|
3131 |
{
|
3132 |
color: #425f9a;
|
3133 |
font-size: 22px;
|
@@ -3136,7 +3199,8 @@ p.upgrade_link {
|
|
3136 |
padding-left: 65px;
|
3137 |
margin-top: 20px;
|
3138 |
}
|
3139 |
-
.wpallimport-plugin .wpallimport-complete-warning h4
|
|
|
3140 |
{
|
3141 |
color: #777;
|
3142 |
font-size: 19px;
|
@@ -3440,9 +3504,9 @@ body.rtl.wpallimport-plugin .show_hints
|
|
3440 |
.wpallimport-plugin span.wp_all_import_restart_import{
|
3441 |
bottom: 50px;
|
3442 |
}
|
3443 |
-
|
3444 |
font-size: 18px;
|
3445 |
-
}
|
3446 |
}
|
3447 |
@media screen and (max-width: 1049px) {
|
3448 |
.wpallimport-plugin .wpallimport-wrapper{
|
@@ -3543,7 +3607,7 @@ body.rtl.wpallimport-plugin .show_hints
|
|
3543 |
.wpallimport-plugin span.wp_all_import_restart_import{
|
3544 |
bottom: 50px;
|
3545 |
}
|
3546 |
-
|
3547 |
font-size: 16px;
|
3548 |
-
}
|
3549 |
-
}
|
25 |
vertical-align: middle;
|
26 |
margin-left: 5px;
|
27 |
position: relative;
|
28 |
+
top: -4px;
|
29 |
background-size: cover;
|
30 |
+
|
31 |
}
|
32 |
.wpallimport-plugin input.datepicker {
|
33 |
width: 8em;
|
264 |
padding-left: 30px;
|
265 |
cursor: pointer;
|
266 |
}
|
267 |
+
.wpallimport-plugin .wpallimport-collapsed .wpallimport-collapsed-header h3,
|
268 |
+
.wpallimport-plugin .template_input h3{
|
269 |
line-height: 30px;
|
270 |
color:#425e99;
|
271 |
-webkit-touch-callout: none;
|
275 |
-ms-user-select: none;
|
276 |
user-select: none;
|
277 |
}
|
278 |
+
.wpallimport-plugin .template_input h3{
|
279 |
+
/*margin-bottom: -15px;*/
|
280 |
+
}
|
281 |
+
.wpallimport-plugin .template_input .post_excerpt_edit_mode{
|
282 |
+
font-size: 14px;
|
283 |
+
border-bottom: 1px dotted #CCCCCC;
|
284 |
+
}
|
285 |
+
.wpallimport-plugin .template_input .collapse_mode_title,
|
286 |
+
.wpallimport-plugin .template_input .post_excerpt_edit_mode_expand{
|
287 |
+
display: none;
|
288 |
+
}
|
289 |
.wpallimport-plugin .wpallimport-collapsed.closed .wpallimport-collapsed-header{
|
290 |
background: url('../img/ui_4.0/collapser.png') no-repeat 98% -30px;
|
291 |
}
|
492 |
.wpallimport-plugin #footer-upgrade{
|
493 |
/*float: left !important;*/
|
494 |
}
|
495 |
+
.wpallimport-plugin .wpallimport-overlay, .wpallimport-plugin .wpallimport-super-overlay {
|
496 |
display:none;
|
497 |
position:fixed;
|
498 |
z-index:99999;
|
580 |
position: relative;
|
581 |
float: right;
|
582 |
}
|
583 |
+
.wpallimport-plugin .wpallimport-free-edition-notice p{
|
584 |
+
color: #000 !important;
|
585 |
+
font-size: 1.3em !important;
|
586 |
+
margin-bottom: 0;
|
587 |
+
}
|
588 |
+
.wpallimport-plugin .upgrade_link{
|
589 |
+
color: #000 !important;
|
590 |
+
font-size: 1.3em !important;
|
591 |
+
}
|
592 |
.wpallimport-plugin .wp-all-import-sure-to-delete{
|
593 |
display: none;
|
594 |
}
|
671 |
font-size: 1.3em !important;
|
672 |
text-decoration: underline;
|
673 |
}
|
674 |
+
|
675 |
+
.wpallimport-plugin .taxonomy_to_import_wrapper{
|
676 |
+
display: none;
|
677 |
+
}
|
678 |
+
.wpallimport-plugin .wp_all_import_change_taxonomy_type{
|
679 |
+
display: table;
|
680 |
+
}
|
681 |
+
.wpallimport-plugin .wp_all_import_change_taxonomy_type #taxonomy_to_import{
|
682 |
+
margin: 0;
|
683 |
+
}
|
684 |
+
.wpallimport-plugin .wp_all_import_change_taxonomy_type #taxonomy_to_import .dd-select{
|
685 |
+
padding: 5px 0;
|
686 |
+
}
|
687 |
+
.wpallimport-plugin .wp_all_import_change_taxonomy_type #taxonomy_to_import .dd-options li a{
|
688 |
+
padding: 5px;
|
689 |
+
}
|
690 |
/*--------------------------------------------------------------------------
|
691 |
*
|
692 |
* Helpers
|
1325 |
border: 1px solid #ddd;
|
1326 |
}
|
1327 |
.wpallimport-plugin #custom_type_selector,
|
1328 |
+
.wpallimport-plugin #file_selector,
|
1329 |
+
.wpallimport-plugin #taxonomy_to_import{
|
1330 |
margin: 0 auto;
|
1331 |
margin-bottom: 20px;
|
1332 |
text-align: left;
|
1340 |
.wpallimport-plugin .wpallimport-change-custom-type #custom_type_selector .dd-select{
|
1341 |
padding: 5px 0 0;
|
1342 |
}
|
1343 |
+
.wpallimport-plugin #file_selector,
|
1344 |
+
.wpallimport-plugin #taxonomy_to_import{
|
1345 |
margin-top: 30px;
|
1346 |
}
|
1347 |
+
.wpallimport-plugin #taxonomy_to_import .dd-options{
|
1348 |
+
max-height: 300px;
|
1349 |
+
}
|
1350 |
.wpallimport-plugin #custom_type_selector .dd-options li,
|
1351 |
+
.wpallimport-plugin #file_selector .dd-options li,
|
1352 |
+
.wpallimport-plugin #taxonomy_to_import .dd-options li{
|
1353 |
margin-bottom: 0;
|
1354 |
}
|
1355 |
.wpallimport-plugin #custom_type_selector .dd-options li .dd-option,
|
1356 |
+
.wpallimport-plugin #file_selector .dd-options li .dd-option,
|
1357 |
+
.wpallimport-plugin #taxonomy_to_import .dd-options li .dd-option{
|
1358 |
font-size: 18px;
|
1359 |
color: #555;
|
1360 |
border: none;
|
1367 |
.wpallimport-plugin #custom_type_selector .dd-options li .dd-option:hover,
|
1368 |
.wpallimport-plugin #custom_type_selector .dd-options li .dd-option-selected,
|
1369 |
.wpallimport-plugin #file_selector .dd-options li .dd-option:hover,
|
1370 |
+
.wpallimport-plugin #file_selector .dd-options li .dd-option-selected,
|
1371 |
+
.wpallimport-plugin #taxonomy_to_import .dd-options li .dd-option:hover,
|
1372 |
+
.wpallimport-plugin #taxonomy_to_import .dd-options li .dd-option-selected{
|
1373 |
background: #eee;
|
1374 |
color: #555;
|
1375 |
}
|
1379 |
color: #fff;
|
1380 |
}*/
|
1381 |
.wpallimport-plugin #custom_type_selector .dd-select,
|
1382 |
+
.wpallimport-plugin #file_selector .dd-select,
|
1383 |
+
.wpallimport-plugin #taxonomy_to_import .dd-select{
|
1384 |
background: #fff !important;
|
1385 |
padding: 10px 0;
|
1386 |
margin-left: -5px;
|
1387 |
}
|
1388 |
.wpallimport-plugin #custom_type_selector .dd-selected,
|
1389 |
+
.wpallimport-plugin #file_selector .dd-selected,
|
1390 |
+
.wpallimport-plugin #taxonomy_to_import .dd-selected{
|
1391 |
color: #000;
|
1392 |
font-weight: normal;
|
1393 |
font-size: 18px;
|
1395 |
padding: 0 10px;
|
1396 |
line-height: 24px;
|
1397 |
}
|
1398 |
+
.wpallimport-plugin .change_file #file_selector .dd-select,
|
1399 |
+
.wpallimport-plugin .change_file #taxonomy_to_import .dd-select{
|
1400 |
padding: 5px 0 0;
|
1401 |
}
|
1402 |
+
.wpallimport-plugin .change_file #file_selector .dd-options .dd-option,
|
1403 |
+
.wpallimport-plugin .change_file #taxonomy_to_import .dd-options .dd-option{
|
1404 |
padding: 0 10px;
|
1405 |
}
|
1406 |
.wpallimport-plugin .dd-options{
|
1471 |
}
|
1472 |
.wpallimport-plugin #custom_type_selector .dd-option .dashicon:before,
|
1473 |
.wpallimport-plugin #custom_type_selector .dd-selected .dashicon:before {
|
1474 |
+
font-family: "dashicons";
|
1475 |
font-size: 24px;
|
1476 |
float: left;
|
1477 |
margin: 2px 5px 2px 2px;
|
1498 |
.wpallimport-plugin #custom_type_selector .dd-option .dashicon-shop_coupon:before,
|
1499 |
.wpallimport-plugin #custom_type_selector .dd-selected .dashicon-shop_coupon:before,
|
1500 |
.wpallimport-plugin #custom_type_selector .dd-option .dashicon-shop_order:before,
|
1501 |
+
.wpallimport-plugin #custom_type_selector .dd-selected .dashicon-shop_order:before,
|
1502 |
+
.wpallimport-plugin #custom_type_selector .dd-option .dashicon-shop_customer:before,
|
1503 |
+
.wpallimport-plugin #custom_type_selector .dd-selected .dashicon-shop_customer:before{
|
1504 |
font-family: "WooCommerce";
|
1505 |
content: "\e03d";
|
1506 |
color: #555;
|
1511 |
font-family: "dashicons";
|
1512 |
content: "\f111";
|
1513 |
color: #555;
|
1514 |
+
margin-top: 0;
|
1515 |
}
|
1516 |
.wpallimport-plugin #custom_type_selector .dd-option .dashicon-import_users:before,
|
1517 |
.wpallimport-plugin #custom_type_selector .dd-selected .dashicon-import_users:before{
|
2530 |
.wpallimport-plugin .options .wpallimport-submit-buttons{
|
2531 |
position: relative;
|
2532 |
text-align: center;
|
2533 |
+
top: 10px;
|
2534 |
+
height: 60px;
|
2535 |
+
|
2536 |
}
|
2537 |
.wpallimport-plugin form.options{
|
2538 |
position: relative;
|
2757 |
display: inline-block;
|
2758 |
height: 25px;
|
2759 |
}
|
2760 |
+
.wpallimport-plugin #import_finished a.wpallimport-help {
|
2761 |
+
width: 25px;
|
2762 |
+
}
|
2763 |
.wpallimport-plugin #process{ display:none; }
|
2764 |
.wpallimport-plugin .ui-widget-header{
|
2765 |
-moz-border-radius: 4px;
|
2836 |
left: 0;
|
2837 |
color: #ccc;
|
2838 |
}
|
2839 |
+
|
2840 |
/*--------------------------------------------------------------------------
|
2841 |
*
|
2842 |
* XML & CSV
|
3181 |
color: #777;
|
3182 |
margin-top: 2px;
|
3183 |
}
|
3184 |
+
.wpallimport-plugin .wpallimport-complete-warning,
|
3185 |
+
.wpallimport-plugin .wpallimport-orders-complete-warning{
|
3186 |
display: none;
|
3187 |
background: url('../img/ui_4.0/exclamation.png') #fff 25px 40px no-repeat;
|
3188 |
padding: 30px 20px 10px 25px;
|
3189 |
margin: 40px 0;
|
3190 |
text-align: left;
|
3191 |
}
|
3192 |
+
.wpallimport-plugin .wpallimport-complete-warning h3,
|
3193 |
+
.wpallimport-plugin .wpallimport-orders-complete-warning h3
|
3194 |
{
|
3195 |
color: #425f9a;
|
3196 |
font-size: 22px;
|
3199 |
padding-left: 65px;
|
3200 |
margin-top: 20px;
|
3201 |
}
|
3202 |
+
.wpallimport-plugin .wpallimport-complete-warning h4,
|
3203 |
+
.wpallimport-plugin .wpallimport-orders-complete-warning h4
|
3204 |
{
|
3205 |
color: #777;
|
3206 |
font-size: 19px;
|
3504 |
.wpallimport-plugin span.wp_all_import_restart_import{
|
3505 |
bottom: 50px;
|
3506 |
}
|
3507 |
+
/*.wpallimport-plugin .wpallimport-notify-wrapper .error-headers h4{
|
3508 |
font-size: 18px;
|
3509 |
+
}*/
|
3510 |
}
|
3511 |
@media screen and (max-width: 1049px) {
|
3512 |
.wpallimport-plugin .wpallimport-wrapper{
|
3607 |
.wpallimport-plugin span.wp_all_import_restart_import{
|
3608 |
bottom: 50px;
|
3609 |
}
|
3610 |
+
/*.wpallimport-plugin .wpallimport-notify-wrapper .error-headers h4{
|
3611 |
font-size: 16px;
|
3612 |
+
}*/
|
3613 |
+
}
|
static/js/admin.js
CHANGED
@@ -5,6 +5,68 @@
|
|
5 |
|
6 |
if ( ! $('body.wpallimport-plugin').length) return; // do not execute any code if we are not on plugin page
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
// fix wpallimport-layout position
|
9 |
setTimeout(function () {
|
10 |
$('table.wpallimport-layout').length && $('table.wpallimport-layout td.left h2:first-child').css('margin-top', $('.wrap').offset().top - $('table.wpallimport-layout').offset().top);
|
@@ -230,7 +292,12 @@
|
|
230 |
else{
|
231 |
$('.wpallimport-submit-buttons').slideDown();
|
232 |
}
|
233 |
-
|
|
|
|
|
|
|
|
|
|
|
234 |
});
|
235 |
|
236 |
$('.wpallimport-import-from').click(function(){
|
@@ -270,6 +337,21 @@
|
|
270 |
$(this).val('Enter a web address to download the file from...');
|
271 |
});
|
272 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
273 |
// enter-submit form on step 1
|
274 |
$('.wpallimport-step-1').each(function(){
|
275 |
|
@@ -324,7 +406,9 @@
|
|
324 |
$('.wpallimport-choose-file').find('.wpallimport-upload-resource-step-two').slideDown();
|
325 |
$('.wpallimport-choose-file').find('.wpallimport-submit-buttons').show();
|
326 |
}
|
|
|
327 |
});
|
|
|
328 |
$('.wpallimport-import-from.selected').click();
|
329 |
|
330 |
$('.wpallimport-download-from-url').click(function(){
|
@@ -339,17 +423,19 @@
|
|
339 |
$('#custom_type_selector').ddslick({
|
340 |
width: 300,
|
341 |
onSlideDownOptions: function(o){
|
342 |
-
formHeight = $
|
343 |
$wrap.css({'height': formHeight + $('#custom_type_selector').find('.dd-options').height() + 'px'});
|
344 |
},
|
345 |
onSlideUpOptions: function(o){
|
346 |
-
$wrap.css({'height':
|
347 |
},
|
348 |
onSelected: function(selectedData){
|
349 |
-
if (fixWrapHeight)
|
350 |
-
$wrap.css({'height':
|
351 |
-
|
352 |
-
|
|
|
|
|
353 |
|
354 |
$('#custom_type_selector').find('.dd-selected').css({'color':'#555'});
|
355 |
|
@@ -380,7 +466,10 @@
|
|
380 |
{
|
381 |
$('.wpallimport-choose-file').find('.wpallimport-submit-buttons').hide();
|
382 |
}
|
383 |
-
}
|
|
|
|
|
|
|
384 |
}
|
385 |
});
|
386 |
|
@@ -673,7 +762,7 @@
|
|
673 |
$(this).parents('.wpallimport-collapsed-content:first').find('.advanced_options_files').find('p:first').hide();
|
674 |
$(this).parents('.wpallimport-collapsed-content:first').find('.advanced_options_files').find('input').removeAttr('disabled');
|
675 |
}
|
676 |
-
|
677 |
});
|
678 |
|
679 |
// Auto-detect custom fields
|
5 |
|
6 |
if ( ! $('body.wpallimport-plugin').length) return; // do not execute any code if we are not on plugin page
|
7 |
|
8 |
+
function wpai_set_custom_select_image() {
|
9 |
+
// The class name to add to the element.
|
10 |
+
var class_name = jQuery('[class^="dd-selected-text dashicon"]').text().toLowerCase();
|
11 |
+
class_name = class_name.replace( /\s+/g, '' );
|
12 |
+
|
13 |
+
// This gets the image URL out of the class.
|
14 |
+
var class_check = jQuery('[class^="dd-selected-text dashicon"]').attr( 'class' );
|
15 |
+
class_check = class_check.replace( "dd-selected-text dashicon ", "" );
|
16 |
+
|
17 |
+
// String of allowed images.
|
18 |
+
var imgs = ['jpg','jpeg','jpe','gif','png','bmp'], length = imgs.length;
|
19 |
+
while( length-- ) {
|
20 |
+
if ( class_check.indexOf( imgs[ length ] ) != -1 ) {
|
21 |
+
|
22 |
+
// They have defined an image URL, which means it's a custom image and we need to add the class.
|
23 |
+
jQuery('[class^="dd-selected-text dashicon"]').addClass("wpaiimgfor" + class_name);
|
24 |
+
jQuery('[class^="dd-selected-text dashicon"]').removeClass( class_check );
|
25 |
+
|
26 |
+
}
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
// Rapid Add-On API Images
|
31 |
+
$(document).ready(function($){
|
32 |
+
var class_check;
|
33 |
+
var original_class;
|
34 |
+
var new_class_name;
|
35 |
+
var allstyles = "<style type='text/css'>";
|
36 |
+
|
37 |
+
$.each($('[class^="dd-option-text"]'), function(key, value) {
|
38 |
+
class_check = $(this).attr('class');
|
39 |
+
if ( class_check.includes( 'dashicon' ) ) {
|
40 |
+
|
41 |
+
// Grab the URL to the image by removing the other classes out of the string.
|
42 |
+
class_check = class_check.replace( "dd-option-text dashicon ", "" );
|
43 |
+
|
44 |
+
// Build the class name that we need to append to head.
|
45 |
+
new_class_name = $(this).text().toLowerCase();
|
46 |
+
new_class_name = new_class_name.replace( /\s+/g, '' );
|
47 |
+
|
48 |
+
var imgs = ['jpg','jpeg','jpe','gif','png','bmp'],
|
49 |
+
length = imgs.length;
|
50 |
+
while( length-- ) {
|
51 |
+
if ( class_check.indexOf( imgs[ length ] ) != -1 ) {
|
52 |
+
|
53 |
+
// They've defined a custom image URL, so we need to append the class to the head and add it to the list item.
|
54 |
+
allstyles = allstyles + ".wpaiimgfor" + new_class_name + ":before { font-family: 'dashicons'; font-size: 24px; float: left; margin: 2px 5px 2px 2px;background-image: url(" + class_check + "); background-repeat: no-repeat; background-position: center center; content:'';height: 25px;width:24px; }";
|
55 |
+
allstyles = allstyles + "label.dd-option-text.dashicon.wpaiimgfor" + new_class_name + " { top: 2px !important; }";
|
56 |
+
$(this).addClass("wpaiimgfor" + new_class_name);
|
57 |
+
$(this).removeClass( class_check );
|
58 |
+
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
});
|
63 |
+
|
64 |
+
// Append all of the classes to head.
|
65 |
+
allstyles = allstyles + "</style>";
|
66 |
+
$( allstyles ).appendTo("head");
|
67 |
+
|
68 |
+
});
|
69 |
+
|
70 |
// fix wpallimport-layout position
|
71 |
setTimeout(function () {
|
72 |
$('table.wpallimport-layout').length && $('table.wpallimport-layout td.left h2:first-child').css('margin-top', $('.wrap').offset().top - $('table.wpallimport-layout').offset().top);
|
292 |
else{
|
293 |
$('.wpallimport-submit-buttons').slideDown();
|
294 |
}
|
295 |
+
|
296 |
+
// Rapid Add-On API Images
|
297 |
+
wpai_set_custom_select_image();
|
298 |
+
|
299 |
+
|
300 |
+
}
|
301 |
});
|
302 |
|
303 |
$('.wpallimport-import-from').click(function(){
|
337 |
$(this).val('Enter a web address to download the file from...');
|
338 |
});
|
339 |
|
340 |
+
$('#taxonomy_to_import').ddslick({
|
341 |
+
width: 300,
|
342 |
+
onSelected: function(selectedData){
|
343 |
+
if (selectedData.selectedData.value != ""){
|
344 |
+
$('#taxonomy_to_import').find('.dd-selected').css({'color':'#555'});
|
345 |
+
$('.wpallimport-choose-file').find('.wpallimport-submit-buttons').show();
|
346 |
+
}
|
347 |
+
else{
|
348 |
+
$('#taxonomy_to_import').find('.dd-selected').css({'color':'#cfceca'});
|
349 |
+
$('.wpallimport-choose-file').find('.wpallimport-submit-buttons').hide();
|
350 |
+
}
|
351 |
+
$('input[name=taxonomy_type]').val(selectedData.selectedData.value);
|
352 |
+
}
|
353 |
+
});
|
354 |
+
|
355 |
// enter-submit form on step 1
|
356 |
$('.wpallimport-step-1').each(function(){
|
357 |
|
406 |
$('.wpallimport-choose-file').find('.wpallimport-upload-resource-step-two').slideDown();
|
407 |
$('.wpallimport-choose-file').find('.wpallimport-submit-buttons').show();
|
408 |
}
|
409 |
+
|
410 |
});
|
411 |
+
|
412 |
$('.wpallimport-import-from.selected').click();
|
413 |
|
414 |
$('.wpallimport-download-from-url').click(function(){
|
423 |
$('#custom_type_selector').ddslick({
|
424 |
width: 300,
|
425 |
onSlideDownOptions: function(o){
|
426 |
+
formHeight = ($('.wpallimport-layout').height() < 730) ? 730 : $('.wpallimport-layout').height();
|
427 |
$wrap.css({'height': formHeight + $('#custom_type_selector').find('.dd-options').height() + 'px'});
|
428 |
},
|
429 |
onSlideUpOptions: function(o){
|
430 |
+
$wrap.css({'height' : 'auto'});
|
431 |
},
|
432 |
onSelected: function(selectedData){
|
433 |
+
if (fixWrapHeight){
|
434 |
+
$wrap.css({'height': 'auto'});
|
435 |
+
}
|
436 |
+
else {
|
437 |
+
fixWrapHeight = true;
|
438 |
+
}
|
439 |
|
440 |
$('#custom_type_selector').find('.dd-selected').css({'color':'#555'});
|
441 |
|
466 |
{
|
467 |
$('.wpallimport-choose-file').find('.wpallimport-submit-buttons').hide();
|
468 |
}
|
469 |
+
}
|
470 |
+
|
471 |
+
// Rapid Add-On API Images
|
472 |
+
wpai_set_custom_select_image();
|
473 |
}
|
474 |
});
|
475 |
|
762 |
$(this).parents('.wpallimport-collapsed-content:first').find('.advanced_options_files').find('p:first').hide();
|
763 |
$(this).parents('.wpallimport-collapsed-content:first').find('.advanced_options_files').find('input').removeAttr('disabled');
|
764 |
}
|
765 |
+
|
766 |
});
|
767 |
|
768 |
// Auto-detect custom fields
|
static/js/jquery/jquery.tipsy.js
CHANGED
@@ -132,7 +132,8 @@
|
|
132 |
return tipsy;
|
133 |
}
|
134 |
|
135 |
-
function enter() {
|
|
|
136 |
var tipsy = get(this);
|
137 |
tipsy.hoverState = 'in';
|
138 |
if (options.delayIn == 0) {
|
@@ -140,6 +141,10 @@
|
|
140 |
} else {
|
141 |
setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
|
142 |
}
|
|
|
|
|
|
|
|
|
143 |
};
|
144 |
|
145 |
function leave() {
|
@@ -156,8 +161,8 @@
|
|
156 |
|
157 |
if (options.trigger != 'manual') {
|
158 |
var binder = options.live ? 'live' : 'bind',
|
159 |
-
eventIn = options.trigger == 'hover' ? 'mouseenter' : '
|
160 |
-
eventOut = options.trigger == 'hover' ? 'mouseleave' : '
|
161 |
this[binder](eventIn, enter)[binder](eventOut, leave);
|
162 |
}
|
163 |
|
132 |
return tipsy;
|
133 |
}
|
134 |
|
135 |
+
function enter(event) {
|
136 |
+
|
137 |
var tipsy = get(this);
|
138 |
tipsy.hoverState = 'in';
|
139 |
if (options.delayIn == 0) {
|
141 |
} else {
|
142 |
setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
|
143 |
}
|
144 |
+
if(event.type== 'click') {
|
145 |
+
event.preventDefault();
|
146 |
+
return false;
|
147 |
+
}
|
148 |
};
|
149 |
|
150 |
function leave() {
|
161 |
|
162 |
if (options.trigger != 'manual') {
|
163 |
var binder = options.live ? 'live' : 'bind',
|
164 |
+
eventIn = options.trigger == 'hover' ? 'mouseenter' : 'click',
|
165 |
+
eventOut = options.trigger == 'hover' ? 'mouseleave' : 'mouseleave';
|
166 |
this[binder](eventIn, enter)[binder](eventOut, leave);
|
167 |
}
|
168 |
|
static/js/jquery/jquery.ui-contextmenu.min.js
CHANGED
File without changes
|
views/admin/home/index.php
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
<div class="wrap">
|
2 |
-
<?php
|
3 |
-
$homeurl = "http://www.wpallimport.com/adminpanel/index.php?v=".urlencode(PMXI_Plugin::getInstance()->getVersion());
|
4 |
-
$contents = @file_get_contents($homeurl);
|
5 |
-
if ( ! $contents) {
|
6 |
-
?>
|
7 |
-
<iframe src='<?php echo $homeurl; ?>' width='600'></iframe><br />
|
8 |
-
<?php
|
9 |
-
} else {
|
10 |
-
echo $contents;
|
11 |
-
}
|
12 |
-
?>
|
13 |
-
</div>
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/admin/import/confirm.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php $is_new_import = ($isWizard or $import->imported + $import->skipped == $import->count or $import->imported + $import->skipped == 0 or $import->options['is_import_specified'] or $import->triggered); ?>
|
2 |
-
|
3 |
<h2 class="wpallimport-wp-notices"></h2>
|
4 |
|
5 |
<div class="wpallimport-wrapper wpallimport-step-5">
|
@@ -105,7 +105,7 @@
|
|
105 |
|
106 |
<?php $max_execution_time = ini_get('max_execution_time');?>
|
107 |
|
108 |
-
<div class="wpallimport-section">
|
109 |
<div class="wpallimport-content-section">
|
110 |
<div class="wpallimport-collapsed-header" style="padding-left: 30px;">
|
111 |
<h3 style="color: #425e99;"><?php _e('Import Summary', 'wp_all_import_plugin'); ?> <?php if (!$isWizard):?><span style="color:#000;"><?php printf(__(" - ID: %s - %s"), $import->id, empty($import->friendly_name) ? $import->name : $import->friendly_name);?></span><?php endif;?></h3>
|
@@ -185,6 +185,7 @@
|
|
185 |
if ( 'title' == $post['duplicate_indicator']){
|
186 |
switch ($post['custom_type']){
|
187 |
case 'import_users':
|
|
|
188 |
$criteria = 'has the same Login';
|
189 |
break;
|
190 |
default:
|
@@ -195,6 +196,7 @@
|
|
195 |
if ( 'content' == $post['duplicate_indicator']){
|
196 |
switch ($post['custom_type']){
|
197 |
case 'import_users':
|
|
|
198 |
$criteria = 'has the same Email';
|
199 |
break;
|
200 |
default:
|
@@ -211,6 +213,7 @@
|
|
211 |
<?php } elseif ("no" == $post['is_keep_former_posts'] and "no" == $post['update_all_data']){?>
|
212 |
<div>
|
213 |
<p><?php printf(__('Next %s data will be updated, <strong>all other data will be left alone</strong>', 'wp_all_import_plugin'), $custom_type->labels->singular_name); ?></p>
|
|
|
214 |
<ul style="padding-left: 35px;">
|
215 |
<?php if ( $post['is_update_status']): ?>
|
216 |
<li> <?php _e('status', 'wp_all_import_plugin'); ?></li>
|
@@ -310,6 +313,8 @@
|
|
310 |
</li>
|
311 |
<?php endif; ?>
|
312 |
</ul>
|
|
|
|
|
313 |
</div>
|
314 |
<?php } ?>
|
315 |
<?php if ( $post['create_new_records']): ?>
|
@@ -342,7 +347,7 @@
|
|
342 |
</tr>
|
343 |
</table>
|
344 |
<?php if ($is_new_import):?>
|
345 |
-
<form class="confirm <?php echo ! $isWizard ? 'edit' : '' ?>" method="post">
|
346 |
<?php wp_nonce_field('confirm', '_wpnonce_confirm') ?>
|
347 |
<input type="hidden" name="is_confirmed" value="1" />
|
348 |
<input type="submit" class="rad10" value="<?php _e('Confirm & Run Import', 'wp_all_import_plugin') ?>" />
|
1 |
<?php $is_new_import = ($isWizard or $import->imported + $import->skipped == $import->count or $import->imported + $import->skipped == 0 or $import->options['is_import_specified'] or $import->triggered); ?>
|
2 |
+
<?php $visible_sections = apply_filters('pmxi_visible_confirm_sections', array('data_to_import'), $post['custom_type']); ?>
|
3 |
<h2 class="wpallimport-wp-notices"></h2>
|
4 |
|
5 |
<div class="wpallimport-wrapper wpallimport-step-5">
|
105 |
|
106 |
<?php $max_execution_time = ini_get('max_execution_time');?>
|
107 |
|
108 |
+
<div class="wpallimport-section" style="margin-top: -20px;">
|
109 |
<div class="wpallimport-content-section">
|
110 |
<div class="wpallimport-collapsed-header" style="padding-left: 30px;">
|
111 |
<h3 style="color: #425e99;"><?php _e('Import Summary', 'wp_all_import_plugin'); ?> <?php if (!$isWizard):?><span style="color:#000;"><?php printf(__(" - ID: %s - %s"), $import->id, empty($import->friendly_name) ? $import->name : $import->friendly_name);?></span><?php endif;?></h3>
|
185 |
if ( 'title' == $post['duplicate_indicator']){
|
186 |
switch ($post['custom_type']){
|
187 |
case 'import_users':
|
188 |
+
case 'shop_customer':
|
189 |
$criteria = 'has the same Login';
|
190 |
break;
|
191 |
default:
|
196 |
if ( 'content' == $post['duplicate_indicator']){
|
197 |
switch ($post['custom_type']){
|
198 |
case 'import_users':
|
199 |
+
case 'shop_customer':
|
200 |
$criteria = 'has the same Email';
|
201 |
break;
|
202 |
default:
|
213 |
<?php } elseif ("no" == $post['is_keep_former_posts'] and "no" == $post['update_all_data']){?>
|
214 |
<div>
|
215 |
<p><?php printf(__('Next %s data will be updated, <strong>all other data will be left alone</strong>', 'wp_all_import_plugin'), $custom_type->labels->singular_name); ?></p>
|
216 |
+
<?php if ( in_array('data_to_import', $visible_sections)):?>
|
217 |
<ul style="padding-left: 35px;">
|
218 |
<?php if ( $post['is_update_status']): ?>
|
219 |
<li> <?php _e('status', 'wp_all_import_plugin'); ?></li>
|
313 |
</li>
|
314 |
<?php endif; ?>
|
315 |
</ul>
|
316 |
+
<?php endif; ?>
|
317 |
+
<?php do_action('pmxi_confirm_data_to_import', $isWizard, $post);?>
|
318 |
</div>
|
319 |
<?php } ?>
|
320 |
<?php if ( $post['create_new_records']): ?>
|
347 |
</tr>
|
348 |
</table>
|
349 |
<?php if ($is_new_import):?>
|
350 |
+
<form id="wpai-submit-confirm-form" class="confirm <?php echo ! $isWizard ? 'edit' : '' ?>" method="post">
|
351 |
<?php wp_nonce_field('confirm', '_wpnonce_confirm') ?>
|
352 |
<input type="hidden" name="is_confirmed" value="1" />
|
353 |
<input type="submit" class="rad10" value="<?php _e('Confirm & Run Import', 'wp_all_import_plugin') ?>" />
|
views/admin/import/evaluate.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
</div>
|
12 |
<div id="current_xml">
|
13 |
<?php if ($is_csv): ?>
|
14 |
-
<?php PMXI_Render::render_csv_element($elements->item(0), false, '//'); ?>
|
15 |
<?php else:?>
|
16 |
<?php PMXI_Render::render_xml_element($elements->item($elements->length > 1 ? $show_element : 0), false, '//'); ?>
|
17 |
<?php endif;?>
|
11 |
</div>
|
12 |
<div id="current_xml">
|
13 |
<?php if ($is_csv): ?>
|
14 |
+
<?php PMXI_Render::render_csv_element($elements->item($elements->length > 1 ? $show_element : 0), false, '//'); ?>
|
15 |
<?php else:?>
|
16 |
<?php PMXI_Render::render_xml_element($elements->item($elements->length > 1 ? $show_element : 0), false, '//'); ?>
|
17 |
<?php endif;?>
|
views/admin/import/index.php
CHANGED
@@ -147,6 +147,10 @@
|
|
147 |
</div>
|
148 |
|
149 |
<?php
|
|
|
|
|
|
|
|
|
150 |
$hiddenPosts = array(
|
151 |
'attachment',
|
152 |
'revision',
|
@@ -162,11 +166,13 @@
|
|
162 |
'customize_changeset',
|
163 |
'oembed_cache'
|
164 |
);
|
165 |
-
|
|
|
166 |
foreach ($custom_types as $key => $ct) {
|
167 |
if (in_array($key, $hiddenPosts)) unset($custom_types[$key]);
|
168 |
}
|
169 |
-
|
|
|
170 |
|
171 |
$sorted_cpt = array();
|
172 |
foreach ($custom_types as $key => $cpt){
|
@@ -183,6 +189,13 @@
|
|
183 |
$sorted_cpt['import_users'] = new stdClass();
|
184 |
$sorted_cpt['import_users']->labels = new stdClass();
|
185 |
$sorted_cpt['import_users']->labels->name = __('Users','wp_all_export_plugin');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
break;
|
187 |
}
|
188 |
}
|
@@ -203,7 +216,7 @@
|
|
203 |
foreach ($hidden_post_types as $key => $ct) {
|
204 |
if (in_array($key, $hiddenPosts)) unset($hidden_post_types[$key]);
|
205 |
}
|
206 |
-
|
207 |
|
208 |
?>
|
209 |
<div class="wpallimport-choose-import-direction">
|
@@ -220,53 +233,79 @@
|
|
220 |
</div>
|
221 |
</div>
|
222 |
<select name="custom_type_selector" id="custom_type_selector" class="wpallimport-post-types">
|
223 |
-
|
224 |
-
<?php foreach ($sorted_cpt as $key => $ct) :?>
|
225 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
$image_src = 'dashicon-cpt';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
}
|
235 |
-
else
|
236 |
-
{
|
237 |
-
$unknown_cpt[$key] = $ct;
|
238 |
-
continue;
|
239 |
}
|
|
|
240 |
?>
|
241 |
-
|
242 |
-
|
243 |
-
<?php if ( ! empty($unknown_cpt)): ?>
|
244 |
-
<?php foreach ($unknown_cpt as $key => $ct):?>
|
245 |
<?php
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
if ( in_array($key, array('post', 'page', 'product') ) )
|
259 |
-
$image_src = 'dashicon-' . $key;
|
260 |
-
?>
|
261 |
-
<option value="<?php echo $key; ?>" data-imagesrc="dashicon <?php echo $image_src; ?>"><?php echo $cpt->labels->name; ?></option>
|
262 |
-
<?php endforeach; ?>
|
263 |
-
<?php endif; ?>
|
264 |
-
</select>
|
265 |
|
266 |
<?php if ( ! class_exists('PMUI_Plugin') ): ?>
|
267 |
<div class="wpallimport-upgrade-notice" rel="import_users">
|
268 |
-
<p><?php _e('The User
|
269 |
-
<a href="http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1" target="_blank" class="upgrade_link"><?php _e('Purchase the User
|
270 |
</div>
|
271 |
<?php endif; ?>
|
272 |
<?php if ( class_exists('WooCommerce') && ! class_exists('PMWI_Plugin') ): ?>
|
@@ -298,6 +337,14 @@
|
|
298 |
<a href="http://www.wpallimport.com/order-now/?utm_source=free-plugin&utm_campaign=taxonomies&utm_medium=in-plugin" target="_blank" class="upgrade_link"><?php _e('Purchase WP All Import Pro', 'wp_all_import_plugin');?></a>
|
299 |
</div>
|
300 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
</div>
|
302 |
<div class="clear wpallimport-extra-text-below">
|
303 |
<!--div class="wpallimport-existing-records">
|
@@ -336,6 +383,7 @@
|
|
336 |
</div>
|
337 |
<a class="button button-primary button-hero wpallimport-large-button wpallimport-notify-read-more" href="http://www.wpallimport.com/documentation/troubleshooting/problems-with-import-files/#invalid" target="_blank"><?php _e('Read More', 'wp_all_import_plugin');?></a>
|
338 |
</div>
|
|
|
339 |
<p class="wpallimport-submit-buttons">
|
340 |
<input type="hidden" name="custom_type" value="<?php echo $post['custom_type'];?>">
|
341 |
<input type="hidden" name="is_submitted" value="1" />
|
147 |
</div>
|
148 |
|
149 |
<?php
|
150 |
+
|
151 |
+
$all_types = array();
|
152 |
+
$sort_order = array();
|
153 |
+
|
154 |
$hiddenPosts = array(
|
155 |
'attachment',
|
156 |
'revision',
|
166 |
'customize_changeset',
|
167 |
'oembed_cache'
|
168 |
);
|
169 |
+
|
170 |
+
$custom_types = get_post_types(array('_builtin' => true), 'objects') + get_post_types(array('_builtin' => false, 'show_ui' => true), 'objects');
|
171 |
foreach ($custom_types as $key => $ct) {
|
172 |
if (in_array($key, $hiddenPosts)) unset($custom_types[$key]);
|
173 |
}
|
174 |
+
|
175 |
+
$custom_types = apply_filters( 'pmxi_custom_types', $custom_types, 'custom_types' );
|
176 |
|
177 |
$sorted_cpt = array();
|
178 |
foreach ($custom_types as $key => $cpt){
|
189 |
$sorted_cpt['import_users'] = new stdClass();
|
190 |
$sorted_cpt['import_users']->labels = new stdClass();
|
191 |
$sorted_cpt['import_users']->labels->name = __('Users','wp_all_export_plugin');
|
192 |
+
|
193 |
+
if ( class_exists('WooCommerce') ) {
|
194 |
+
$sorted_cpt['shop_customer'] = new stdClass();
|
195 |
+
$sorted_cpt['shop_customer']->labels = new stdClass();
|
196 |
+
$sorted_cpt['shop_customer']->labels->name = __('WooCommerce Customers','wp_all_export_plugin');
|
197 |
+
}
|
198 |
+
|
199 |
break;
|
200 |
}
|
201 |
}
|
216 |
foreach ($hidden_post_types as $key => $ct) {
|
217 |
if (in_array($key, $hiddenPosts)) unset($hidden_post_types[$key]);
|
218 |
}
|
219 |
+
$hidden_post_types = apply_filters( 'pmxi_custom_types', $hidden_post_types, 'hidden_post_types' );
|
220 |
|
221 |
?>
|
222 |
<div class="wpallimport-choose-import-direction">
|
233 |
</div>
|
234 |
</div>
|
235 |
<select name="custom_type_selector" id="custom_type_selector" class="wpallimport-post-types">
|
236 |
+
|
|
|
237 |
<?php
|
238 |
+
// *****************************************************
|
239 |
+
// **************** START CPT LOOP *********************
|
240 |
+
// *****************************************************
|
241 |
+
?>
|
242 |
+
|
243 |
+
|
244 |
+
<?php
|
245 |
+
$known_imgs = array( 'post', 'page', 'product', 'import_users', 'shop_order', 'shop_coupon', 'shop_customer', 'users', 'comments', 'taxonomies' );
|
246 |
+
$all_posts = array_merge( $sorted_cpt, $hidden_post_types );
|
247 |
+
$all_posts = apply_filters( 'pmxi_custom_types', $all_posts, 'all_types' );
|
248 |
+
$ordered_posts = array( 0 => 'post', 1 => 'page', 2 => 'taxonomies', 3 => 'import_users', 4 => 'shop_order', 5 => 'shop_coupon', 6 => 'product', 7 => 'shop_customer' );
|
249 |
+
|
250 |
+
foreach ( $all_posts as $key => $post_obj ) {
|
251 |
+
if ( ! in_array( $key, $ordered_posts ) ) {
|
252 |
+
array_push( $ordered_posts, $key );
|
253 |
+
}
|
254 |
+
}
|
255 |
+
|
256 |
+
$order_arr = apply_filters( 'pmxi_post_list_order', $ordered_posts );
|
257 |
+
$image_data = apply_filters( 'wp_all_import_post_type_image', array() );
|
258 |
+
|
259 |
+
foreach ( $order_arr as $key => $post_name ) {
|
260 |
+
if ( array_key_exists( $post_name, $all_posts ) ) {
|
261 |
+
$post_obj = $all_posts[ $post_name ];
|
262 |
+
|
263 |
+
if ( in_array( $post_name, $known_imgs ) ) {
|
264 |
+
$image_src = 'dashicon-' . $post_name;
|
265 |
+
} else {
|
266 |
$image_src = 'dashicon-cpt';
|
267 |
+
}
|
268 |
+
if ( ! empty( $image_data ) && array_key_exists( $post_name, $image_data ) ) {
|
269 |
+
$custom_img_defined = true;
|
270 |
+
} else {
|
271 |
+
$custom_img_defined = false;
|
272 |
+
}
|
273 |
+
|
274 |
+
$original_image_src = $image_src;
|
275 |
+
$cpt = $post_name;
|
276 |
+
$cpt_label = $post_obj->labels->name;
|
277 |
+
|
278 |
+
$custom_selected_post = apply_filters( 'wpai_custom_selected_post', false, $post, $cpt, 'step1' );
|
279 |
|
280 |
+
$img_to_echo = 'dashicon ';
|
281 |
+
|
282 |
+
if ( $custom_img_defined === true ) {
|
283 |
+
$img_to_echo .= $image_data[ $cpt ]['image'];
|
284 |
+
} else {
|
285 |
+
$img_to_echo .= $image_src;
|
|
|
|
|
|
|
|
|
|
|
286 |
}
|
287 |
+
|
288 |
?>
|
289 |
+
|
290 |
+
<option value="<?php echo $cpt; ?>" data-imagesrc="<?php echo $img_to_echo; ?>" <?php if ( $custom_selected_post === true ):?>selected="selected"<?php else: if ( $cpt == $post['custom_type'] ):?>selected="selected"<?php endif; endif; ?>><?php echo $cpt_label; ?></option>
|
|
|
|
|
291 |
<?php
|
292 |
+
}
|
293 |
+
|
294 |
+
}
|
295 |
+
?>
|
296 |
+
|
297 |
+
</select>
|
298 |
+
|
299 |
+
<?php
|
300 |
+
// *****************************************************
|
301 |
+
// **************** FINISH CPT LOOP ********************
|
302 |
+
// *****************************************************
|
303 |
+
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
|
305 |
<?php if ( ! class_exists('PMUI_Plugin') ): ?>
|
306 |
<div class="wpallimport-upgrade-notice" rel="import_users">
|
307 |
+
<p><?php _e('The User Add-On is Required to Import Users', 'wp_all_import_plugin'); ?></p>
|
308 |
+
<a href="http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1" target="_blank" class="upgrade_link"><?php _e('Purchase the User Add-On', 'wp_all_import_plugin');?></a>
|
309 |
</div>
|
310 |
<?php endif; ?>
|
311 |
<?php if ( class_exists('WooCommerce') && ! class_exists('PMWI_Plugin') ): ?>
|
337 |
<a href="http://www.wpallimport.com/order-now/?utm_source=free-plugin&utm_campaign=taxonomies&utm_medium=in-plugin" target="_blank" class="upgrade_link"><?php _e('Purchase WP All Import Pro', 'wp_all_import_plugin');?></a>
|
338 |
</div>
|
339 |
|
340 |
+
<?php if ( class_exists('WooCommerce') && ! class_exists('PMUI_Plugin') ): ?>
|
341 |
+
<div class="wpallimport-upgrade-notice" rel="shop_customer">
|
342 |
+
<p><?php _e('The User Add-On is Required to Import Customers', 'wp_all_import_plugin'); ?></p>
|
343 |
+
<a href="http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1" target="_blank" class="upgrade_link"><?php _e('Purchase the User Add-On', 'wp_all_import_plugin');?></a>
|
344 |
+
</div>
|
345 |
+
<?php endif; ?>
|
346 |
+
|
347 |
+
|
348 |
</div>
|
349 |
<div class="clear wpallimport-extra-text-below">
|
350 |
<!--div class="wpallimport-existing-records">
|
383 |
</div>
|
384 |
<a class="button button-primary button-hero wpallimport-large-button wpallimport-notify-read-more" href="http://www.wpallimport.com/documentation/troubleshooting/problems-with-import-files/#invalid" target="_blank"><?php _e('Read More', 'wp_all_import_plugin');?></a>
|
385 |
</div>
|
386 |
+
|
387 |
<p class="wpallimport-submit-buttons">
|
388 |
<input type="hidden" name="custom_type" value="<?php echo $post['custom_type'];?>">
|
389 |
<input type="hidden" name="is_submitted" value="1" />
|
views/admin/import/options/_reimport_options.php
CHANGED
@@ -3,10 +3,21 @@
|
|
3 |
<?php else: ?>
|
4 |
<h4><?php _e('If this import is run again and WP All Import finds new or changed data...', 'wp_all_import_plugin'); ?></h4>
|
5 |
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
<div class="input">
|
7 |
<input type="hidden" name="create_new_records" value="0" />
|
8 |
<input type="checkbox" id="create_new_records" name="create_new_records" value="1" <?php echo $post['create_new_records'] ? 'checked="checked"' : '' ?> />
|
9 |
-
<label for="create_new_records"><?php
|
10 |
<?php if ( ! empty(PMXI_Plugin::$session->deligate) and PMXI_Plugin::$session->deligate == 'wpallexport' ): ?>
|
11 |
<a href="#help" class="wpallimport-help" title="<?php _e('New posts will only be created when ID column is present and value in ID column is unique.', 'wp_all_import_plugin') ?>" style="top: -1px;">?</a>
|
12 |
<?php endif; ?>
|
@@ -15,7 +26,7 @@
|
|
15 |
<div class="input">
|
16 |
<input type="hidden" name="is_delete_missing" value="0" />
|
17 |
<input type="checkbox" id="is_delete_missing" name="is_delete_missing" value="1" <?php echo $post['is_delete_missing'] ? 'checked="checked"': '' ?> class="switcher" <?php if ( "new" != $post['wizard_type']): ?>disabled="disabled"<?php endif; ?>/>
|
18 |
-
<label for="is_delete_missing" <?php if ( "new" != $post['wizard_type']): ?>style="color:#ccc;"<?php endif; ?>><?php
|
19 |
<?php if ( "new" != $post['wizard_type']): ?>
|
20 |
<a href="#help" class="wpallimport-help" title="<?php _e('Records removed from the import file can only be deleted when importing into New Items. This feature cannot be enabled when importing into Existing Items.', 'wp_all_import_plugin') ?>" style="position:relative; top: -1px;">?</a>
|
21 |
<?php endif; ?>
|
@@ -54,9 +65,9 @@
|
|
54 |
<div class="input">
|
55 |
<input type="hidden" id="is_keep_former_posts" name="is_keep_former_posts" value="yes" />
|
56 |
<input type="checkbox" id="is_not_keep_former_posts" name="is_keep_former_posts" value="no" <?php echo "yes" != $post['is_keep_former_posts'] ? 'checked="checked"': '' ?> class="switcher" />
|
57 |
-
<label for="is_not_keep_former_posts"><?php
|
58 |
<?php if ( $this->isWizard and "new" == $post['wizard_type'] and empty(PMXI_Plugin::$session->deligate)): ?>
|
59 |
-
<a href="#help" class="wpallimport-help" style="position: relative; top: -2px;" title="<?php
|
60 |
<?php endif; ?>
|
61 |
<div class="switcher-target-is_not_keep_former_posts" style="padding-left:17px;">
|
62 |
<input type="radio" id="update_all_data" class="switcher" name="update_all_data" value="yes" <?php echo 'no' != $post['update_all_data'] ? 'checked="checked"': '' ?>/>
|
3 |
<?php else: ?>
|
4 |
<h4><?php _e('If this import is run again and WP All Import finds new or changed data...', 'wp_all_import_plugin'); ?></h4>
|
5 |
<?php endif; ?>
|
6 |
+
<?php
|
7 |
+
|
8 |
+
if (!empty($post['custom_type'])){
|
9 |
+
$custom_type = get_post_type_object( $post['custom_type'] );
|
10 |
+
$cpt_name = ( ! empty($custom_type)) ? strtolower($custom_type->label) : '';
|
11 |
+
}
|
12 |
+
else{
|
13 |
+
$cpt_name = '';
|
14 |
+
}
|
15 |
+
|
16 |
+
?>
|
17 |
<div class="input">
|
18 |
<input type="hidden" name="create_new_records" value="0" />
|
19 |
<input type="checkbox" id="create_new_records" name="create_new_records" value="1" <?php echo $post['create_new_records'] ? 'checked="checked"' : '' ?> />
|
20 |
+
<label for="create_new_records"><?php printf(__('Create new %s from records newly present in your file', 'wp_all_import_plugin'), $cpt_name) ?></label>
|
21 |
<?php if ( ! empty(PMXI_Plugin::$session->deligate) and PMXI_Plugin::$session->deligate == 'wpallexport' ): ?>
|
22 |
<a href="#help" class="wpallimport-help" title="<?php _e('New posts will only be created when ID column is present and value in ID column is unique.', 'wp_all_import_plugin') ?>" style="top: -1px;">?</a>
|
23 |
<?php endif; ?>
|
26 |
<div class="input">
|
27 |
<input type="hidden" name="is_delete_missing" value="0" />
|
28 |
<input type="checkbox" id="is_delete_missing" name="is_delete_missing" value="1" <?php echo $post['is_delete_missing'] ? 'checked="checked"': '' ?> class="switcher" <?php if ( "new" != $post['wizard_type']): ?>disabled="disabled"<?php endif; ?>/>
|
29 |
+
<label for="is_delete_missing" <?php if ( "new" != $post['wizard_type']): ?>style="color:#ccc;"<?php endif; ?>><?php printf(__('Delete %s that are no longer present in your file', 'wp_all_import_plugin'), $cpt_name) ?></label>
|
30 |
<?php if ( "new" != $post['wizard_type']): ?>
|
31 |
<a href="#help" class="wpallimport-help" title="<?php _e('Records removed from the import file can only be deleted when importing into New Items. This feature cannot be enabled when importing into Existing Items.', 'wp_all_import_plugin') ?>" style="position:relative; top: -1px;">?</a>
|
32 |
<?php endif; ?>
|
65 |
<div class="input">
|
66 |
<input type="hidden" id="is_keep_former_posts" name="is_keep_former_posts" value="yes" />
|
67 |
<input type="checkbox" id="is_not_keep_former_posts" name="is_keep_former_posts" value="no" <?php echo "yes" != $post['is_keep_former_posts'] ? 'checked="checked"': '' ?> class="switcher" />
|
68 |
+
<label for="is_not_keep_former_posts"><?php printf(__('Update existing %s with changed data in your file', 'wp_all_import_plugin'), $cpt_name) ?></label>
|
69 |
<?php if ( $this->isWizard and "new" == $post['wizard_type'] and empty(PMXI_Plugin::$session->deligate)): ?>
|
70 |
+
<a href="#help" class="wpallimport-help" style="position: relative; top: -2px;" title="<?php printf(__('These options will only be used if you run this import again later. All data is imported the first time you run an import.<br/><br/>Note that WP All Import will only update/remove %s created by this import. If you want to match to %s that already exist on this site, use Existing Items in Step 1.', 'wp_all_import_plugin'), $cpt_name, $cpt_name) ?>">?</a>
|
71 |
<?php endif; ?>
|
72 |
<div class="switcher-target-is_not_keep_former_posts" style="padding-left:17px;">
|
73 |
<input type="radio" id="update_all_data" class="switcher" name="update_all_data" value="yes" <?php echo 'no' != $post['update_all_data'] ? 'checked="checked"': '' ?>/>
|
views/admin/import/options/_reimport_template.php
CHANGED
@@ -66,7 +66,7 @@
|
|
66 |
<?php if ( $this->isWizard ):?>
|
67 |
<p class="drag_an_element_ico"><?php _e('Drag an element, or combo of elements, to the box above. The Unique Identifier should be unique for each record in your file, and should stay the same even if your file is updated. Things like product IDs, titles, and SKUs are good Unique Identifiers because they probably won\'t change. Don\'t use a description or price, since that might be changed.', 'wp_all_import_plugin'); ?></p>
|
68 |
<p class="info_ico"><?php printf(__('If you run this import again with an updated file, the Unique Identifier allows WP All Import to correctly link the records in your updated file with the %s it will create right now. If multiple records in this file have the same Unique Identifier, only the first will be created. The others will be detected as duplicates.', 'wp_all_import_plugin'), $custom_type->labels->name); ?></p>
|
69 |
-
<p class="new_element_ico"><?php
|
70 |
<?php endif; ?>
|
71 |
</div>
|
72 |
|
66 |
<?php if ( $this->isWizard ):?>
|
67 |
<p class="drag_an_element_ico"><?php _e('Drag an element, or combo of elements, to the box above. The Unique Identifier should be unique for each record in your file, and should stay the same even if your file is updated. Things like product IDs, titles, and SKUs are good Unique Identifiers because they probably won\'t change. Don\'t use a description or price, since that might be changed.', 'wp_all_import_plugin'); ?></p>
|
68 |
<p class="info_ico"><?php printf(__('If you run this import again with an updated file, the Unique Identifier allows WP All Import to correctly link the records in your updated file with the %s it will create right now. If multiple records in this file have the same Unique Identifier, only the first will be created. The others will be detected as duplicates.', 'wp_all_import_plugin'), $custom_type->labels->name); ?></p>
|
69 |
+
<p class="new_element_ico"><?php printf(__('In Step 1 you selected New Items. So, if you run this import again WP All Import will only try to update records that were created by this import. It will never update, modify, or remove %s that were not created by this import. If you want to match records in your file to records that already exist on this site, select Existing Items in Step 1.', 'wp_all_import_plugin'), $custom_type->labels->name); ?></p>
|
70 |
<?php endif; ?>
|
71 |
</div>
|
72 |
|
views/admin/import/options/_settings_template.php
CHANGED
@@ -77,6 +77,13 @@
|
|
77 |
$sorted_cpt['import_users'] = new stdClass();
|
78 |
$sorted_cpt['import_users']->labels = new stdClass();
|
79 |
$sorted_cpt['import_users']->labels->name = __('Users','wp_all_export_plugin');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
break;
|
81 |
}
|
82 |
}
|
@@ -97,59 +104,95 @@
|
|
97 |
foreach ($hidden_post_types as $key => $ct) {
|
98 |
if (in_array($key, $hiddenPosts)) unset($hidden_post_types[$key]);
|
99 |
}
|
100 |
-
$hidden_post_types = apply_filters( 'pmxi_custom_types', $hidden_post_types );
|
101 |
|
102 |
?>
|
103 |
<div class="wpallimport-change-custom-type">
|
104 |
<select name="custom_type_selector" id="custom_type_selector" class="wpallimport-post-types">
|
105 |
-
|
106 |
-
|
107 |
<?php
|
108 |
-
|
|
|
|
|
|
|
109 |
|
110 |
-
$cpt = $key;
|
111 |
-
$cpt_label = $ct->labels->name;
|
112 |
-
|
113 |
-
if ( in_array($cpt, array('post', 'page', 'product', 'import_users', 'shop_order', 'shop_coupon', 'shop_customer', 'users', 'comments', 'taxonomies') ) )
|
114 |
-
{
|
115 |
-
$image_src = 'dashicon-' . $cpt;
|
116 |
-
}
|
117 |
-
else
|
118 |
-
{
|
119 |
-
$unknown_cpt[$key] = $ct;
|
120 |
-
continue;
|
121 |
-
}
|
122 |
-
?>
|
123 |
-
<option value="<?php echo $cpt; ?>" data-imagesrc="dashicon <?php echo $image_src; ?>" <?php if ( $cpt == $post['custom_type'] ) echo 'selected="selected"';?>><?php echo $cpt_label; ?></option>
|
124 |
-
<?php endforeach; ?>
|
125 |
-
<?php if ( ! empty($unknown_cpt)): ?>
|
126 |
-
<?php foreach ($unknown_cpt as $key => $ct):?>
|
127 |
<?php
|
128 |
-
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
?>
|
131 |
-
|
132 |
-
<?php endforeach ?>
|
133 |
-
<?php endif;?>
|
134 |
-
<?php endif; ?>
|
135 |
-
<?php if ( ! empty($hidden_post_types)): ?>
|
136 |
-
<?php foreach ($hidden_post_types as $key => $cpt) :?>
|
137 |
<?php
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
?>
|
142 |
-
<option value="<?php echo $key; ?>" data-imagesrc="dashicon <?php echo $image_src; ?>" <?php if ( $key == $post['custom_type'] ) echo 'selected="selected"';?>><?php echo $cpt->labels->name; ?></option>
|
143 |
-
<?php endforeach; ?>
|
144 |
-
<?php endif; ?>
|
145 |
</select>
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
<?php if ( ! class_exists('PMUI_Plugin') ): ?>
|
148 |
<div class="wpallimport-upgrade-notice" rel="import_users">
|
149 |
-
<p><?php _e('The User
|
150 |
-
<a href="http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1" target="_blank" class="upgrade_link"><?php _e('Purchase the User
|
151 |
</div>
|
152 |
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
<?php if ( class_exists('WooCommerce') && ! class_exists('PMWI_Plugin') ): ?>
|
154 |
<div class="wpallimport-upgrade-notice" rel="product">
|
155 |
<p><?php _e('The WooCommerce Add-On is Required to Import Products', 'wp_all_import_plugin'); ?></p>
|
77 |
$sorted_cpt['import_users'] = new stdClass();
|
78 |
$sorted_cpt['import_users']->labels = new stdClass();
|
79 |
$sorted_cpt['import_users']->labels->name = __('Users','wp_all_export_plugin');
|
80 |
+
|
81 |
+
if ( class_exists('WooCommerce') ) {
|
82 |
+
$sorted_cpt['shop_customer'] = new stdClass();
|
83 |
+
$sorted_cpt['shop_customer']->labels = new stdClass();
|
84 |
+
$sorted_cpt['shop_customer']->labels->name = __('WooCommerce Customers','wp_all_export_plugin');
|
85 |
+
}
|
86 |
+
|
87 |
break;
|
88 |
}
|
89 |
}
|
104 |
foreach ($hidden_post_types as $key => $ct) {
|
105 |
if (in_array($key, $hiddenPosts)) unset($hidden_post_types[$key]);
|
106 |
}
|
107 |
+
$hidden_post_types = apply_filters( 'pmxi_custom_types', $hidden_post_types, 'hidden_post_types' );
|
108 |
|
109 |
?>
|
110 |
<div class="wpallimport-change-custom-type">
|
111 |
<select name="custom_type_selector" id="custom_type_selector" class="wpallimport-post-types">
|
112 |
+
|
113 |
+
|
114 |
<?php
|
115 |
+
// *****************************************************
|
116 |
+
// **************** START CPT LOOP *********************
|
117 |
+
// *****************************************************
|
118 |
+
?>
|
119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
<?php
|
121 |
+
$known_imgs = array( 'post', 'page', 'product', 'import_users', 'shop_order', 'shop_coupon', 'shop_customer', 'users', 'comments', 'taxonomies' );
|
122 |
+
$all_posts = array_merge( $sorted_cpt, $hidden_post_types );
|
123 |
+
$all_posts = apply_filters( 'pmxi_custom_types', $all_posts, 'all_types' );
|
124 |
+
$ordered_posts = array( 0 => 'post', 1 => 'page', 2 => 'taxonomies', 3 => 'import_users', 4 => 'shop_order', 5 => 'shop_coupon', 6 => 'product', 7 => 'shop_customer' );
|
125 |
+
|
126 |
+
foreach ( $all_posts as $key => $post_obj ) {
|
127 |
+
if ( ! in_array( $key, $ordered_posts ) ) {
|
128 |
+
array_push( $ordered_posts, $key );
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
$order_arr = apply_filters( 'pmxi_post_list_order', $ordered_posts );
|
133 |
+
$image_data = apply_filters( 'wp_all_import_post_type_image', array() );
|
134 |
+
|
135 |
+
foreach ( $order_arr as $key => $post_name ) {
|
136 |
+
if ( array_key_exists( $post_name, $all_posts ) ) {
|
137 |
+
$post_obj = $all_posts[ $post_name ];
|
138 |
+
|
139 |
+
if ( in_array( $post_name, $known_imgs ) ) {
|
140 |
+
$image_src = 'dashicon-' . $post_name;
|
141 |
+
} else {
|
142 |
+
$image_src = 'dashicon-cpt';
|
143 |
+
}
|
144 |
+
if ( ! empty( $image_data ) && array_key_exists( $post_name, $image_data ) ) {
|
145 |
+
$custom_img_defined = true;
|
146 |
+
} else {
|
147 |
+
$custom_img_defined = false;
|
148 |
+
}
|
149 |
+
|
150 |
+
$original_image_src = $image_src;
|
151 |
+
$cpt = $post_name;
|
152 |
+
$cpt_label = $post_obj->labels->name;
|
153 |
+
|
154 |
+
// Allows the MyListing add-on to select the listing type that was imported.
|
155 |
+
$custom_selected_post = apply_filters( 'wpai_custom_selected_post', false, $post, $cpt, 'settings' );
|
156 |
+
|
157 |
+
$img_to_echo = 'dashicon ';
|
158 |
+
|
159 |
+
if ( $custom_img_defined === true ) {
|
160 |
+
$img_to_echo .= $image_data[ $cpt ]['image'];
|
161 |
+
} else {
|
162 |
+
$img_to_echo .= $image_src;
|
163 |
+
}
|
164 |
+
|
165 |
?>
|
166 |
+
<option value="<?php echo $cpt; ?>" data-imagesrc="<?php echo $img_to_echo; ?>" <?php if ( $custom_selected_post === true ):?>selected="selected"<?php else: if ( $cpt == $post['custom_type'] ):?>selected="selected"<?php endif; endif; ?>><?php echo $cpt_label; ?></option>
|
|
|
|
|
|
|
|
|
|
|
167 |
<?php
|
168 |
+
}
|
169 |
+
|
170 |
+
}
|
171 |
?>
|
|
|
|
|
|
|
172 |
</select>
|
173 |
|
174 |
+
<?php
|
175 |
+
// *****************************************************
|
176 |
+
// **************** FINISH CPT LOOP ********************
|
177 |
+
// *****************************************************
|
178 |
+
?>
|
179 |
+
|
180 |
<?php if ( ! class_exists('PMUI_Plugin') ): ?>
|
181 |
<div class="wpallimport-upgrade-notice" rel="import_users">
|
182 |
+
<p><?php _e('The User Add-On is Required to Import Users', 'wp_all_import_plugin'); ?></p>
|
183 |
+
<a href="http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1" target="_blank" class="upgrade_link"><?php _e('Purchase the User Add-On', 'wp_all_import_plugin');?></a>
|
184 |
</div>
|
185 |
<?php endif; ?>
|
186 |
+
|
187 |
+
|
188 |
+
<?php if ( class_exists('WooCommerce') && ! class_exists('PMUI_Plugin') ): ?>
|
189 |
+
<div class="wpallimport-upgrade-notice" rel="shop_customer">
|
190 |
+
<p><?php _e('The User Add-On is Required to Import Customers', 'wp_all_import_plugin'); ?></p>
|
191 |
+
<a href="http://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1921&edd_options%5Bprice_id%5D=1" target="_blank" class="upgrade_link"><?php _e('Purchase the User Add-On', 'wp_all_import_plugin');?></a>
|
192 |
+
</div>
|
193 |
+
<?php endif; ?>
|
194 |
+
|
195 |
+
|
196 |
<?php if ( class_exists('WooCommerce') && ! class_exists('PMWI_Plugin') ): ?>
|
197 |
<div class="wpallimport-upgrade-notice" rel="product">
|
198 |
<p><?php _e('The WooCommerce Add-On is Required to Import Products', 'wp_all_import_plugin'); ?></p>
|
views/admin/import/process.php
CHANGED
@@ -209,7 +209,7 @@
|
|
209 |
|
210 |
$.get('admin.php?page=pmxi-admin-import&action=process&id=' + import_id + '&failures=' + failures + '&_wpnonce=' + wp_all_import_security, {}, function (data) {
|
211 |
|
212 |
-
//
|
213 |
if (data != null && typeof data.created != "undefined"){
|
214 |
|
215 |
$('.wpallimport-modal-message').hide();
|
@@ -249,7 +249,6 @@
|
|
249 |
}
|
250 |
<?php endif; ?>
|
251 |
|
252 |
-
|
253 |
$('#import_finished').fadeIn();
|
254 |
|
255 |
if ( parseInt(data.errors) || parseInt(data.warnings)){
|
209 |
|
210 |
$.get('admin.php?page=pmxi-admin-import&action=process&id=' + import_id + '&failures=' + failures + '&_wpnonce=' + wp_all_import_security, {}, function (data) {
|
211 |
|
212 |
+
// response with error
|
213 |
if (data != null && typeof data.created != "undefined"){
|
214 |
|
215 |
$('.wpallimport-modal-message').hide();
|
249 |
}
|
250 |
<?php endif; ?>
|
251 |
|
|
|
252 |
$('#import_finished').fadeIn();
|
253 |
|
254 |
if ( parseInt(data.errors) || parseInt(data.warnings)){
|
views/admin/manage/delete.php
CHANGED
@@ -1,5 +1,29 @@
|
|
1 |
<h2><?php _e('Delete Import', 'wp_all_import_plugin') ?></h2>
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
<form method="post">
|
4 |
<div class="input">
|
5 |
<div class="input">
|
@@ -9,8 +33,8 @@
|
|
9 |
</div>
|
10 |
<div class="input">
|
11 |
<input type="hidden" name="is_delete_posts" value="0"/>
|
12 |
-
<input type="checkbox" id="is_delete_posts" name="is_delete_posts" class="switcher" style="position: relative; top: 2px;" value="1"/>
|
13 |
-
<label for="is_delete_posts"><?php printf(__('Delete
|
14 |
</div>
|
15 |
<div class="switcher-target-is_delete_posts" style="padding: 5px 17px;">
|
16 |
<div class="input">
|
1 |
<h2><?php _e('Delete Import', 'wp_all_import_plugin') ?></h2>
|
2 |
|
3 |
+
<?php
|
4 |
+
|
5 |
+
if (!empty($item->options['custom_type'])){
|
6 |
+
switch ($item->options['custom_type']){
|
7 |
+
|
8 |
+
default:
|
9 |
+
$custom_type = get_post_type_object( $item->options['custom_type'] );
|
10 |
+
if ( ! empty($custom_type) ) {
|
11 |
+
$custom_type->label = $custom_type->labels->name;
|
12 |
+
$custom_type->singular_label = $custom_type->labels->singular_name;
|
13 |
+
}
|
14 |
+
break;
|
15 |
+
}
|
16 |
+
$cpt_name = ( ! empty($custom_type)) ? ( ($associated_posts == 1) ? $custom_type->singular_label : $custom_type->label) : '';
|
17 |
+
// Remove mention of WooCommerce from post type string
|
18 |
+
$cpt_del_name = str_replace("WooCommerce", "", $cpt_name);
|
19 |
+
}
|
20 |
+
else{
|
21 |
+
$cpt_name = '';
|
22 |
+
$cpt_del_name = '';
|
23 |
+
}
|
24 |
+
|
25 |
+
?>
|
26 |
+
|
27 |
<form method="post">
|
28 |
<div class="input">
|
29 |
<div class="input">
|
33 |
</div>
|
34 |
<div class="input">
|
35 |
<input type="hidden" name="is_delete_posts" value="0"/>
|
36 |
+
<input type="checkbox" id="is_delete_posts" name="is_delete_posts" class="switcher" style="position: relative; top: 2px;" value="1"/>
|
37 |
+
<label for="is_delete_posts"><?php printf(__('Delete %s created by %s','wp_all_import_plugin'), strtolower($cpt_del_name), empty($item->friendly_name) ? $item->name : $item->friendly_name );?> </label>
|
38 |
</div>
|
39 |
<div class="switcher-target-is_delete_posts" style="padding: 5px 17px;">
|
40 |
<div class="input">
|