Version Description
- fixed Apply mapping rules before splitting via separator symbol for manual hierarchy
- fixed path equal or less than
- fixed changing unique key when moving back from confirm screen
- fixed override page template
- updated wp_all_import_is_post_to_update filter with second argument XML node as array
- added a second argument to pmxi_saved_post action ( SimpleXML object ) of current record
Download this release
Release Info
Developer | soflyy |
Plugin | Import any XML or CSV File to WordPress |
Version | 3.2.8 |
Comparing to | |
See all releases |
Code changes from version 3.2.7 to 3.2.8
- actions/admin_head.php +1 -0
- actions/admin_notices.php +12 -7
- actions/delete_post.php +4 -2
- actions/wp_loaded.php +0 -5
- classes/chunk.php +7 -5
- classes/input.php +1 -1
- classes/upload.php +4 -1
- controllers/admin/history.php +6 -6
- controllers/admin/import.php +187 -64
- controllers/controller/admin.php +1 -1
- helpers/get_file_curl.php +3 -1
- helpers/import_custom_meta_box.php +28 -0
- helpers/pmxi_findDuplicates.php +1 -1
- helpers/pmxi_insert_attachment.php +0 -157
- helpers/pmxi_insert_post.php +0 -178
- helpers/pmxi_recursion_taxes.php +2 -2
- helpers/wp_all_import_get_feed_type.php +1 -1
- helpers/wp_all_import_get_gz.php +2 -2
- helpers/wp_all_import_is_update_cf.php +14 -0
- helpers/wp_all_import_xml2array.php +10 -0
- libraries/XmlImportCsvParse.php +1 -1
- models/import/record.php +161 -77
- plugin.php +19 -11
- readme.txt +10 -2
- static/css/admin.css +8 -3
- static/js/admin.js +17 -7
- views/admin/import/confirm.php +4 -2
- views/admin/import/index.php +5 -0
- views/admin/import/options/_reimport_options.php +4 -1
- views/admin/import/options/_reimport_template.php +25 -7
- views/admin/import/options/_settings_template.php +1 -0
- views/admin/import/template.php +7 -6
- views/admin/import/template/_featured_template.php +6 -3
- views/admin/import/template/_other_template.php +68 -18
- views/admin/manage/delete.php +9 -0
- views/admin/manage/index.php +8 -3
actions/admin_head.php
CHANGED
@@ -32,6 +32,7 @@ function pmxi_admin_head(){
|
|
32 |
|
33 |
?>
|
34 |
<script type="text/javascript">
|
|
|
35 |
var import_action = '<?php echo $get_params["action"]; ?>';
|
36 |
var wp_all_import_security = '<?php echo $wp_all_import_ajax_nonce; ?>';
|
37 |
</script>
|
32 |
|
33 |
?>
|
34 |
<script type="text/javascript">
|
35 |
+
var ajaxurl = '<?php echo admin_url( "admin-ajax.php" ); ?>';
|
36 |
var import_action = '<?php echo $get_params["action"]; ?>';
|
37 |
var wp_all_import_security = '<?php echo $wp_all_import_ajax_nonce; ?>';
|
38 |
</script>
|
actions/admin_notices.php
CHANGED
@@ -5,7 +5,7 @@ function pmxi_admin_notices() {
|
|
5 |
$uploads = wp_upload_dir();
|
6 |
|
7 |
// compare woocommerce add-on version
|
8 |
-
if ( class_exists( 'PMWI_Plugin' ) and ( defined('PMWI_VERSION') and version_compare(PMWI_VERSION, '2.
|
9 |
?>
|
10 |
<div class="error"><p>
|
11 |
<?php printf(
|
@@ -17,11 +17,16 @@ function pmxi_admin_notices() {
|
|
17 |
|
18 |
if (defined('PMWI_EDITION') and PMWI_EDITION == 'paid')
|
19 |
{
|
20 |
-
deactivate_plugins( PMWI_ROOT_DIR . '/
|
21 |
}
|
22 |
-
else
|
23 |
{
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
25 |
}
|
26 |
|
27 |
}
|
@@ -39,7 +44,7 @@ function pmxi_admin_notices() {
|
|
39 |
|
40 |
if (defined('PMAI_EDITION') and PMAI_EDITION == 'paid')
|
41 |
{
|
42 |
-
deactivate_plugins( PMAI_ROOT_DIR . '/
|
43 |
}
|
44 |
}
|
45 |
|
@@ -56,7 +61,7 @@ function pmxi_admin_notices() {
|
|
56 |
|
57 |
if (defined('PMLCA_EDITION') and PMLCA_EDITION == 'paid')
|
58 |
{
|
59 |
-
deactivate_plugins( PMLCA_ROOT_DIR . '/
|
60 |
}
|
61 |
}
|
62 |
|
@@ -73,7 +78,7 @@ function pmxi_admin_notices() {
|
|
73 |
|
74 |
if (defined('PMUI_EDITION') and PMUI_EDITION == 'paid')
|
75 |
{
|
76 |
-
deactivate_plugins( PMUI_ROOT_DIR . '/
|
77 |
}
|
78 |
}
|
79 |
|
5 |
$uploads = wp_upload_dir();
|
6 |
|
7 |
// compare woocommerce add-on version
|
8 |
+
if ( class_exists( 'PMWI_Plugin' ) and ( defined('PMWI_VERSION') and version_compare(PMWI_VERSION, '2.1.4') < 0 and PMWI_EDITION == 'paid' or defined('PMWI_FREE_VERSION') and version_compare(PMWI_FREE_VERSION, '1.2.2') < 0 and PMWI_EDITION == 'free') ) {
|
9 |
?>
|
10 |
<div class="error"><p>
|
11 |
<?php printf(
|
17 |
|
18 |
if (defined('PMWI_EDITION') and PMWI_EDITION == 'paid')
|
19 |
{
|
20 |
+
deactivate_plugins( PMWI_ROOT_DIR . '/wpai-woocommerce-add-on.php');
|
21 |
}
|
22 |
+
else
|
23 |
{
|
24 |
+
if (defined('PMWI_FREE_ROOT_DIR')){
|
25 |
+
deactivate_plugins( PMWI_FREE_ROOT_DIR . '/plugin.php');
|
26 |
+
}
|
27 |
+
else{
|
28 |
+
deactivate_plugins( PMWI_ROOT_DIR . '/plugin.php');
|
29 |
+
}
|
30 |
}
|
31 |
|
32 |
}
|
44 |
|
45 |
if (defined('PMAI_EDITION') and PMAI_EDITION == 'paid')
|
46 |
{
|
47 |
+
deactivate_plugins( PMAI_ROOT_DIR . '/wpai-acf-add-on.php');
|
48 |
}
|
49 |
}
|
50 |
|
61 |
|
62 |
if (defined('PMLCA_EDITION') and PMLCA_EDITION == 'paid')
|
63 |
{
|
64 |
+
deactivate_plugins( PMLCA_ROOT_DIR . '/wpai-linkcloak-add-on.php');
|
65 |
}
|
66 |
}
|
67 |
|
78 |
|
79 |
if (defined('PMUI_EDITION') and PMUI_EDITION == 'paid')
|
80 |
{
|
81 |
+
deactivate_plugins( PMUI_ROOT_DIR . '/wpai-user-add-on.php');
|
82 |
}
|
83 |
}
|
84 |
|
actions/delete_post.php
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
<?php
|
2 |
|
3 |
function pmxi_delete_post($post_id) {
|
4 |
-
|
5 |
-
|
|
|
|
|
6 |
}
|
1 |
<?php
|
2 |
|
3 |
function pmxi_delete_post($post_id) {
|
4 |
+
if (is_numeric($post_id)){
|
5 |
+
$post = new PMXI_Post_Record();
|
6 |
+
$post->getBy('post_id', $post_id)->isEmpty() or $post->delete();
|
7 |
+
}
|
8 |
}
|
actions/wp_loaded.php
CHANGED
@@ -2,9 +2,4 @@
|
|
2 |
|
3 |
function pmxi_wp_loaded() {
|
4 |
|
5 |
-
@ini_set("max_input_time", PMXI_Plugin::getInstance()->getOption('max_input_time'));
|
6 |
-
@ini_set("max_execution_time", PMXI_Plugin::getInstance()->getOption('max_execution_time'));
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
}
|
2 |
|
3 |
function pmxi_wp_loaded() {
|
4 |
|
|
|
|
|
|
|
|
|
|
|
5 |
}
|
classes/chunk.php
CHANGED
@@ -21,7 +21,9 @@ class PMXI_Chunk {
|
|
21 |
'type' => 'upload',
|
22 |
'encoding' => 'UTF-8',
|
23 |
'pointer' => 1,
|
24 |
-
'chunkSize' => 1024
|
|
|
|
|
25 |
);
|
26 |
|
27 |
/**
|
@@ -86,10 +88,10 @@ class PMXI_Chunk {
|
|
86 |
|
87 |
if ($is_html) return;
|
88 |
|
89 |
-
if (empty($this->options['element'])){
|
90 |
//$founded_tags = array();
|
91 |
|
92 |
-
if (function_exists('stream_filter_register')){
|
93 |
stream_filter_register('preprocessxml', 'preprocessXml_filter');
|
94 |
$path = 'php://filter/read=preprocessxml/resource=' . $this->file;
|
95 |
}
|
@@ -126,7 +128,7 @@ class PMXI_Chunk {
|
|
126 |
}
|
127 |
} */
|
128 |
|
129 |
-
if (!empty($this->cloud)){
|
130 |
|
131 |
arsort($this->cloud);
|
132 |
|
@@ -148,7 +150,7 @@ class PMXI_Chunk {
|
|
148 |
}
|
149 |
}
|
150 |
|
151 |
-
if (function_exists('stream_filter_register')){
|
152 |
stream_filter_register('preprocessxml', 'preprocessXml_filter');
|
153 |
$path = 'php://filter/read=preprocessxml/resource=' . $this->file;
|
154 |
}
|
21 |
'type' => 'upload',
|
22 |
'encoding' => 'UTF-8',
|
23 |
'pointer' => 1,
|
24 |
+
'chunkSize' => 1024,
|
25 |
+
'filter' => true,
|
26 |
+
'get_cloud' => false
|
27 |
);
|
28 |
|
29 |
/**
|
88 |
|
89 |
if ($is_html) return;
|
90 |
|
91 |
+
if (empty($this->options['element']) or $this->options['get_cloud']){
|
92 |
//$founded_tags = array();
|
93 |
|
94 |
+
if (function_exists('stream_filter_register') and $this->options['filter']){
|
95 |
stream_filter_register('preprocessxml', 'preprocessXml_filter');
|
96 |
$path = 'php://filter/read=preprocessxml/resource=' . $this->file;
|
97 |
}
|
128 |
}
|
129 |
} */
|
130 |
|
131 |
+
if ( ! empty($this->cloud) and empty($this->options['element']) ){
|
132 |
|
133 |
arsort($this->cloud);
|
134 |
|
150 |
}
|
151 |
}
|
152 |
|
153 |
+
if (function_exists('stream_filter_register') and $this->options['filter']){
|
154 |
stream_filter_register('preprocessxml', 'preprocessXml_filter');
|
155 |
$path = 'php://filter/read=preprocessxml/resource=' . $this->file;
|
156 |
}
|
classes/input.php
CHANGED
@@ -73,7 +73,7 @@ class PMXI_Input {
|
|
73 |
foreach ($this->filters as $filter) {
|
74 |
$val = call_user_func($filter, $val);
|
75 |
}
|
76 |
-
}
|
77 |
return $val;
|
78 |
}
|
79 |
}
|
73 |
foreach ($this->filters as $filter) {
|
74 |
$val = call_user_func($filter, $val);
|
75 |
}
|
76 |
+
}
|
77 |
return $val;
|
78 |
}
|
79 |
}
|
classes/upload.php
CHANGED
@@ -243,6 +243,9 @@ if ( ! class_exists('PMXI_Upload')){
|
|
243 |
'root_element' => $this->root_element,
|
244 |
'is_csv' => $this->is_csv
|
245 |
);
|
246 |
-
}
|
|
|
|
|
247 |
}
|
|
|
248 |
}
|
243 |
'root_element' => $this->root_element,
|
244 |
'is_csv' => $this->is_csv
|
245 |
);
|
246 |
+
}
|
247 |
+
|
248 |
+
|
249 |
}
|
250 |
+
|
251 |
}
|
controllers/admin/history.php
CHANGED
@@ -27,6 +27,10 @@ class PMXI_Admin_History extends PMXI_Controller_Admin {
|
|
27 |
$get['pagenum'] = absint($get['pagenum']);
|
28 |
$get['id'] = absint($get['id']);
|
29 |
extract($get);
|
|
|
|
|
|
|
|
|
30 |
|
31 |
if ( ! in_array($order_by, array('date', 'id', 'run_time', 'type'))){
|
32 |
$order_by = 'date';
|
@@ -34,12 +38,8 @@ class PMXI_Admin_History extends PMXI_Controller_Admin {
|
|
34 |
|
35 |
if ( ! in_array($order, array('DESC', 'ASC'))){
|
36 |
$order = 'DESC';
|
37 |
-
}
|
38 |
|
39 |
-
if (empty($id)){
|
40 |
-
wp_redirect(add_query_arg(array('page' => 'pmxi-admin-manage', 'pmxi_nt' => urlencode(__('Import is not specified.', 'wp_all_import_plugin'))), $this->baseUrl)); die();
|
41 |
-
}
|
42 |
-
$this->data += $get;
|
43 |
$by = array('import_id' => $id);
|
44 |
|
45 |
$this->data['import'] = new PMXI_Import_Record();
|
@@ -136,7 +136,7 @@ class PMXI_Admin_History extends PMXI_Controller_Admin {
|
|
136 |
|
137 |
$id = $this->input->get('id');
|
138 |
|
139 |
-
wp_redirect(add_query_arg(array('id' => $id, 'pmxi_nt' => urlencode(sprintf(__('
|
140 |
|
141 |
}
|
142 |
}
|
27 |
$get['pagenum'] = absint($get['pagenum']);
|
28 |
$get['id'] = absint($get['id']);
|
29 |
extract($get);
|
30 |
+
if (empty($id)){
|
31 |
+
wp_redirect(add_query_arg(array('page' => 'pmxi-admin-manage', 'pmxi_nt' => urlencode(__('Import is not specified.', 'wp_all_import_plugin'))), $this->baseUrl)); die();
|
32 |
+
}
|
33 |
+
$this->data += $get;
|
34 |
|
35 |
if ( ! in_array($order_by, array('date', 'id', 'run_time', 'type'))){
|
36 |
$order_by = 'date';
|
38 |
|
39 |
if ( ! in_array($order, array('DESC', 'ASC'))){
|
40 |
$order = 'DESC';
|
41 |
+
}
|
42 |
|
|
|
|
|
|
|
|
|
43 |
$by = array('import_id' => $id);
|
44 |
|
45 |
$this->data['import'] = new PMXI_Import_Record();
|
136 |
|
137 |
$id = $this->input->get('id');
|
138 |
|
139 |
+
wp_redirect(add_query_arg(array('id' => $id, 'pmxi_nt' => urlencode(sprintf(__('%d %s deleted', 'wp_all_import_plugin'), $items->count(), _n('history', 'histories', $items->count(), 'wp_all_import_plugin')))), $this->baseUrl)); die();
|
140 |
|
141 |
}
|
142 |
}
|
controllers/admin/import.php
CHANGED
@@ -94,7 +94,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
94 |
}
|
95 |
|
96 |
if ('template' == $action or 'preview' == $action or 'tag' == $action) return true;
|
97 |
-
|
98 |
// step #4: options
|
99 |
if ( empty( PMXI_Plugin::$session->options ) ) {
|
100 |
wp_redirect_or_javascript(add_query_arg('action', 'template', $this->baseUrl)); die();
|
@@ -119,7 +119,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
119 |
$parent_import_record = new PMXI_Import_Record();
|
120 |
|
121 |
$default = array(
|
122 |
-
'type' => 'upload',
|
123 |
'wizard_type' => 'new',
|
124 |
'custom_type' => 'post',
|
125 |
'show_hidden_cpt' => 0,
|
@@ -140,24 +140,40 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
140 |
$default['custom_type'] = $parent_import_record->options['custom_type'];
|
141 |
}
|
142 |
|
143 |
-
if ($id
|
144 |
-
|
145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
|
147 |
$this->data['post'] = $post = $this->input->post( $default );
|
148 |
|
149 |
if ( ! class_exists('DOMDocument') or ! class_exists('XMLReader') ) {
|
150 |
-
$this->errors->add('form-validation', __('Required PHP components are missing.<br/><br/>WP All Import requires DOMDocument and
|
151 |
}
|
152 |
|
153 |
if ($this->input->post('is_submitted') and ! $this->errors->get_error_codes()) {
|
154 |
|
155 |
check_admin_referer('choose-file', '_wpnonce_choose-file');
|
156 |
|
157 |
-
if ('upload' == $this->input->post('type')) {
|
158 |
|
159 |
$uploader = new PMXI_Upload($post['filepath'], $this->errors, rtrim(str_replace(basename($post['filepath']), '', $post['filepath']), '/'));
|
160 |
$upload_result = $uploader->upload();
|
|
|
161 |
if ($upload_result instanceof WP_Error){
|
162 |
$this->errors = $upload_result;
|
163 |
}
|
@@ -167,7 +183,8 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
167 |
PMXI_Plugin::$is_csv = $upload_result['is_csv'];
|
168 |
if ( ! empty($upload_result['root_element']))
|
169 |
$post['root_element'] = $upload_result['root_element'];
|
170 |
-
}
|
|
|
171 |
}
|
172 |
|
173 |
if ($this->input->post('is_submitted') and '' == $this->input->post('custom_type')) {
|
@@ -182,7 +199,54 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
182 |
|
183 |
$elements_cloud = array();
|
184 |
|
185 |
-
@set_time_limit(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
|
187 |
$local_paths = !empty($local_paths) ? $local_paths : array($filePath);
|
188 |
|
@@ -190,17 +254,56 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
190 |
|
191 |
if ( @file_exists($path) ){
|
192 |
|
193 |
-
$file = new PMXI_Chunk($path, array('element' => $post['root_element']));
|
194 |
|
195 |
if ( ! empty($file->options['element']) ) {
|
196 |
$xpath = "/" . $file->options['element'];
|
197 |
$elements_cloud = $file->cloud;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
break;
|
199 |
}
|
200 |
|
201 |
}
|
202 |
else $this->errors->add('form-validation', __('Unable to download feed resource.', 'wp_all_import_plugin'));
|
203 |
-
}
|
204 |
|
205 |
if ( ! $this->errors->get_error_codes() ) {
|
206 |
|
@@ -233,7 +336,8 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
233 |
'csv_paths' => array(PMXI_Plugin::$csv_path), // ftp import local copies of remote CSV files
|
234 |
'action' => 'import',
|
235 |
'elements_cloud' => (!empty($elements_cloud)) ? $elements_cloud : array(),
|
236 |
-
'pointer' => 1
|
|
|
237 |
);
|
238 |
|
239 |
foreach ($session_data as $key => $value) {
|
@@ -241,10 +345,10 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
241 |
}
|
242 |
|
243 |
$update_previous = new PMXI_Import_Record();
|
244 |
-
if ($post['is_update_previous'] and ! $update_previous->getById($post['update_previous'])->isEmpty()) {
|
245 |
PMXI_Plugin::$session->set('update_previous', $update_previous->id);
|
246 |
PMXI_Plugin::$session->set('xpath', $update_previous->xpath);
|
247 |
-
PMXI_Plugin::$session->set('template', $update_previous->template);
|
248 |
PMXI_Plugin::$session->set('options', $update_previous->options);
|
249 |
} else {
|
250 |
PMXI_Plugin::$session->set('update_previous', '');
|
@@ -258,9 +362,14 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
258 |
{
|
259 |
$this->errors->add('form-validation', __('Please confirm you are importing a valid feed.<br/> Often, feed providers distribute feeds with invalid data, improperly wrapped HTML, line breaks where they should not be, faulty character encodings, syntax errors in the XML, and other issues.<br/><br/>WP All Import has checks in place to automatically fix some of the most common problems, but we can’t catch every single one.<br/><br/>It is also possible that there is a bug in WP All Import, and the problem is not with the feed.<br/><br/>If you need assistance, please contact support – <a href="mailto:support@wpallimport.com">support@wpallimport.com</a> – with your XML/CSV file. We will identify the problem and release a bug fix if necessary.', 'wp_all_import_plugin'));
|
260 |
}
|
261 |
-
|
|
|
|
|
|
|
|
|
|
|
262 |
wp_redirect(add_query_arg('action', 'element', $this->baseUrl)); die();
|
263 |
-
}
|
264 |
|
265 |
} else if ('url' == $this->input->post('type') and !empty($this->errors)){
|
266 |
$this->errors->add('form-validation', __('WP All Import unable to detect file type.<br/><br/>WP All Import not able to determine what type of file you are importing. Make sure your file extension is correct for the file type you are importing.<br/> Please choose the correct file type from the dropdown below, or try adding &type=xml or &type=csv to the end of the URL, for example http://example.com/export-products.php?&type=xml', 'wp_all_import_plugin'));
|
@@ -322,7 +431,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
322 |
$post['xpath'] = PMXI_Plugin::$session->xpath;
|
323 |
$this->data['elements'] = $elements = $xpath->query($post['xpath']);
|
324 |
if ( ! $elements->length and ! empty( PMXI_Plugin::$session->update_previous ) ) {
|
325 |
-
$_GET['pmxi_nt'] = __('
|
326 |
}
|
327 |
} else {
|
328 |
// suggest 1st repeating element as default selection
|
@@ -1212,15 +1321,16 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1212 |
'root_element' => $this->data['import']->root_element,
|
1213 |
);
|
1214 |
|
1215 |
-
PMXI_Plugin::$session->set('source', $source);
|
1216 |
-
|
1217 |
$post = $this->input->post( apply_filters( 'pmxi_options_options', $DefaultOptions, $this->isWizard) );
|
1218 |
|
1219 |
}
|
1220 |
|
1221 |
$this->data['post'] =& $post;
|
1222 |
|
1223 |
-
PMXI_Plugin::$session->set('options', $post);
|
|
|
1224 |
|
1225 |
if (($load_template = $this->input->post('load_template'))) { // init form with template selected
|
1226 |
if ( ! $template->getById($load_template)->isEmpty()) {
|
@@ -1229,7 +1339,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1229 |
$template_options['type'] = $post['type'];
|
1230 |
$template_options['custom_type'] = $post['custom_type'];
|
1231 |
$template_options['wizard_type'] = $post['wizard_type'];
|
1232 |
-
$template_options['delimiter'] = $post['delimiter'];
|
1233 |
|
1234 |
if ($this->isWizard and $post['wizard_type'] == 'new') {
|
1235 |
$template_options['create_new_records'] = 1;
|
@@ -1260,7 +1370,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1260 |
|
1261 |
if ( ! $this->errors->get_error_codes()) {
|
1262 |
|
1263 |
-
if ( ! empty($post['name'])) { // save template in database
|
1264 |
$template->getByName($post['name'])->set(array(
|
1265 |
'name' => $post['name'],
|
1266 |
'is_keep_linebreaks' => $post['is_keep_linebreaks'],
|
@@ -1418,6 +1528,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1418 |
add_thickbox();
|
1419 |
wp_enqueue_script('media-upload');
|
1420 |
wp_enqueue_script('quicktags');
|
|
|
1421 |
$this->render();
|
1422 |
}
|
1423 |
|
@@ -1452,37 +1563,43 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1452 |
if (empty(PMXI_Plugin::$session->options['title']))
|
1453 |
$this->warnings->add('form-validation', __('<strong>Warning:</strong> your title is blank.'));
|
1454 |
if (empty(PMXI_Plugin::$session->options['content']))
|
1455 |
-
$this->warnings->add('form-validation', __('<strong>Warning:</strong> your content is blank.'));
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
foreach ($this->_unique_key as $key) {
|
1475 |
-
if (stripos($key, 'url') !== false or stripos($key, 'sku') !== false or stripos($key, 'ref') !== false) {
|
1476 |
-
if ( ! in_array($key, $keys_black_list) ){
|
1477 |
-
$DefaultOptions['unique_key'] .= ' - {'.$key.'[1]}';
|
1478 |
break;
|
1479 |
-
}
|
1480 |
-
}
|
1481 |
-
|
1482 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1483 |
}
|
1484 |
-
|
1485 |
-
$DefaultOptions['unique_key'] = apply_filters('pmxi_unique_key', $DefaultOptions['unique_key'], PMXI_Plugin::$session->options);
|
1486 |
|
1487 |
if ($DefaultOptions['custom_type'] == "product" and class_exists('PMWI_Plugin') and $DefaultOptions['wizard_type'] != 'new'){
|
1488 |
$DefaultOptions['duplicate_indicator'] = 'custom field';
|
@@ -1548,18 +1665,18 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1548 |
}
|
1549 |
|
1550 |
// Categories/taxonomies logic
|
1551 |
-
if ($post['update_categories_logic'] == 'only'){
|
1552 |
$post['taxonomies_list'] = explode(",", $post['taxonomies_only_list']);
|
1553 |
}
|
1554 |
-
elseif ($post['update_categories_logic'] == 'all_except'){
|
1555 |
$post['taxonomies_list'] = explode(",", $post['taxonomies_except_list']);
|
1556 |
}
|
1557 |
|
1558 |
// Custom fields logic
|
1559 |
-
if ($post['update_custom_fields_logic'] == 'only'){
|
1560 |
$post['custom_fields_list'] = explode(",", $post['custom_fields_only_list']);
|
1561 |
}
|
1562 |
-
elseif ($post['update_custom_fields_logic'] == 'all_except'){
|
1563 |
$post['custom_fields_list'] = explode(",", $post['custom_fields_except_list']);
|
1564 |
}
|
1565 |
|
@@ -1577,8 +1694,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1577 |
$upload_result = $uploader->upload();
|
1578 |
}
|
1579 |
|
1580 |
-
break;
|
1581 |
-
|
1582 |
default:
|
1583 |
|
1584 |
$this->errors->add('form-validation', __('WP All Import doesn\'t support this import type.', 'wp_all_import_plugin'));
|
@@ -1886,7 +2002,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1886 |
wp_redirect(add_query_arg('action', 'process', $this->baseUrl)); die();
|
1887 |
}
|
1888 |
|
1889 |
-
}
|
1890 |
|
1891 |
$this->render();
|
1892 |
}
|
@@ -1899,15 +2015,15 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1899 |
|
1900 |
$wp_uploads = wp_upload_dir();
|
1901 |
|
1902 |
-
$import = $this->data['update_previous'];
|
1903 |
-
|
1904 |
$history_log = new PMXI_History_Record();
|
1905 |
|
1906 |
$input = new PMXI_Input();
|
1907 |
|
1908 |
if ( ! empty(PMXI_Plugin::$session->history_id) ) $history_log->getById(PMXI_Plugin::$session->history_id);
|
1909 |
|
1910 |
-
$log_storage = (int) PMXI_Plugin::getInstance()->getOption('log_storage');
|
1911 |
|
1912 |
if ( ! PMXI_Plugin::is_ajax() ) {
|
1913 |
|
@@ -2084,7 +2200,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
2084 |
|
2085 |
$import_id = $input->get('id', 0);
|
2086 |
|
2087 |
-
if ( "ajax" == $import->options['import_processing'] and ! $import_id){
|
2088 |
PMXI_Plugin::$session->convertData($import->id);
|
2089 |
//die();
|
2090 |
}
|
@@ -2173,14 +2289,21 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
2173 |
break;
|
2174 |
}
|
2175 |
|
2176 |
-
$file = new PMXI_Chunk($path, array(
|
|
|
|
|
|
|
|
|
|
|
2177 |
|
2178 |
// loop through the file until all lines are read
|
2179 |
while ($xml = $file->read() and empty($import->canceled) ) {
|
2180 |
|
2181 |
if ( ! empty($xml) )
|
2182 |
{
|
2183 |
-
|
|
|
|
|
2184 |
$chunk = "<?xml version=\"1.0\" encoding=\"". $import->options['encoding'] ."\"?>" . "\n" . $xml;
|
2185 |
|
2186 |
$dom = new DOMDocument('1.0', $import->options['encoding']);
|
94 |
}
|
95 |
|
96 |
if ('template' == $action or 'preview' == $action or 'tag' == $action) return true;
|
97 |
+
|
98 |
// step #4: options
|
99 |
if ( empty( PMXI_Plugin::$session->options ) ) {
|
100 |
wp_redirect_or_javascript(add_query_arg('action', 'template', $this->baseUrl)); die();
|
119 |
$parent_import_record = new PMXI_Import_Record();
|
120 |
|
121 |
$default = array(
|
122 |
+
'type' => 'upload',
|
123 |
'wizard_type' => 'new',
|
124 |
'custom_type' => 'post',
|
125 |
'show_hidden_cpt' => 0,
|
140 |
$default['custom_type'] = $parent_import_record->options['custom_type'];
|
141 |
}
|
142 |
|
143 |
+
if ($id) { // update requested but corresponding import is not found
|
144 |
+
if ($import->getById($id)->isEmpty()){
|
145 |
+
|
146 |
+
if (!empty($_GET['deligate']) and $_GET['deligate'] == 'wpallexport'){
|
147 |
+
|
148 |
+
wp_redirect(add_query_arg('pmxi_nt', array('error' => urlencode(__('The import associated with this export has been deleted.', 'wp_all_import_plugin')), 'updated' => urlencode(__('Please re-run your export by clicking Run Export on the All Export -> Manage Exports page. Then try your import again.', 'wp_all_import_plugin'))), remove_query_arg('id', $this->baseUrl))); die();
|
149 |
+
|
150 |
+
}
|
151 |
+
else{
|
152 |
+
|
153 |
+
wp_redirect(add_query_arg('pmxi_nt', array('error' => urlencode(__('This import has been deleted.', 'wp_all_import_plugin'))), remove_query_arg('id', $this->baseUrl))); die();
|
154 |
+
}
|
155 |
+
|
156 |
+
}
|
157 |
+
else{
|
158 |
+
$default['custom_type'] = $import->options['custom_type'];
|
159 |
+
}
|
160 |
+
}
|
161 |
|
162 |
$this->data['post'] = $post = $this->input->post( $default );
|
163 |
|
164 |
if ( ! class_exists('DOMDocument') or ! class_exists('XMLReader') ) {
|
165 |
+
$this->errors->add('form-validation', __('Required PHP components are missing.<br/><br/>WP All Import requires DOMDocument, XMLReader, and XMLWriter PHP modules to be installed.<br/>These are standard features of PHP, and are necessary for WP All Import to read the files you are trying to import.<br/>Please contact your web hosting provider and ask them to install and activate the DOMDocument, XMLReader, and XMLWriter PHP modules.', 'wp_all_import_plugin'));
|
166 |
}
|
167 |
|
168 |
if ($this->input->post('is_submitted') and ! $this->errors->get_error_codes()) {
|
169 |
|
170 |
check_admin_referer('choose-file', '_wpnonce_choose-file');
|
171 |
|
172 |
+
if ('upload' == $this->input->post('type')) {
|
173 |
|
174 |
$uploader = new PMXI_Upload($post['filepath'], $this->errors, rtrim(str_replace(basename($post['filepath']), '', $post['filepath']), '/'));
|
175 |
$upload_result = $uploader->upload();
|
176 |
+
|
177 |
if ($upload_result instanceof WP_Error){
|
178 |
$this->errors = $upload_result;
|
179 |
}
|
183 |
PMXI_Plugin::$is_csv = $upload_result['is_csv'];
|
184 |
if ( ! empty($upload_result['root_element']))
|
185 |
$post['root_element'] = $upload_result['root_element'];
|
186 |
+
}
|
187 |
+
|
188 |
}
|
189 |
|
190 |
if ($this->input->post('is_submitted') and '' == $this->input->post('custom_type')) {
|
199 |
|
200 |
$elements_cloud = array();
|
201 |
|
202 |
+
@set_time_limit(0);
|
203 |
+
|
204 |
+
$table = PMXI_Plugin::getInstance()->getTablePrefix() . 'imports';
|
205 |
+
|
206 |
+
$deligate = $this->input->get('deligate', false);
|
207 |
+
|
208 |
+
$redirect_to_template = false;
|
209 |
+
|
210 |
+
$importRecord = new PMXI_Import_Record();
|
211 |
+
|
212 |
+
switch ( $deligate ) {
|
213 |
+
|
214 |
+
case 'wpallexport':
|
215 |
+
|
216 |
+
global $wpdb;
|
217 |
+
|
218 |
+
$import_id = $this->input->get('id', 0);
|
219 |
+
|
220 |
+
$importRecord->clear();
|
221 |
+
$importRecord->getById($import_id);
|
222 |
+
|
223 |
+
if ( ! $importRecord->isEmpty() and ! empty($importRecord->options['unique_key']))
|
224 |
+
{
|
225 |
+
$importRecord->set(array(
|
226 |
+
'path' => $filePath,
|
227 |
+
'parent_import_id' => 0
|
228 |
+
))->save();
|
229 |
+
|
230 |
+
$post['is_update_previous'] = 1;
|
231 |
+
$post['update_previous'] = $importRecord->id;
|
232 |
+
//$chunks = $importRecord->count;
|
233 |
+
|
234 |
+
$redirect_to_template = true;
|
235 |
+
}
|
236 |
+
|
237 |
+
if ( $importRecord->isEmpty() ){
|
238 |
+
$this->errors->add('form-validation', __('File is no longer in the correct format', 'wp_all_import_plugin'));
|
239 |
+
}
|
240 |
+
elseif (empty($importRecord->options['unique_key'])) {
|
241 |
+
$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'));
|
242 |
+
}
|
243 |
+
|
244 |
+
break;
|
245 |
+
|
246 |
+
default:
|
247 |
+
# code...
|
248 |
+
break;
|
249 |
+
}
|
250 |
|
251 |
$local_paths = !empty($local_paths) ? $local_paths : array($filePath);
|
252 |
|
254 |
|
255 |
if ( @file_exists($path) ){
|
256 |
|
257 |
+
$file = new PMXI_Chunk($path, array('element' => $post['root_element'], 'get_cloud' => true));
|
258 |
|
259 |
if ( ! empty($file->options['element']) ) {
|
260 |
$xpath = "/" . $file->options['element'];
|
261 |
$elements_cloud = $file->cloud;
|
262 |
+
|
263 |
+
if ( ! empty($elements_cloud) and class_exists('PMXE_Plugin') and ! $importRecord->isEmpty() ){
|
264 |
+
|
265 |
+
$is_file_valid = apply_filters('wp_all_import_is_exported_file_valid', true, $importRecord->options['export_id'], $elements_cloud);
|
266 |
+
|
267 |
+
if ( ! $is_file_valid )
|
268 |
+
{
|
269 |
+
$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'));
|
270 |
+
}
|
271 |
+
|
272 |
+
}
|
273 |
+
|
274 |
+
if ( $redirect_to_template and ! $this->errors->get_error_codes() ){
|
275 |
+
|
276 |
+
// loop through the file until all lines are read
|
277 |
+
while ($xml = $file->read()) {
|
278 |
+
|
279 |
+
if ( ! empty($xml) )
|
280 |
+
{
|
281 |
+
PMXI_Import_Record::preprocessXml($xml);
|
282 |
+
$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" . "\n" . $xml;
|
283 |
+
|
284 |
+
$dom = new DOMDocument('1.0', 'UTF-8');
|
285 |
+
$old = libxml_use_internal_errors(true);
|
286 |
+
$dom->loadXML($xml);
|
287 |
+
libxml_use_internal_errors($old);
|
288 |
+
$dxpath = new DOMXPath($dom);
|
289 |
+
|
290 |
+
if (($elements = @$dxpath->query($xpath)) and $elements->length){
|
291 |
+
|
292 |
+
$chunks += $elements->length;
|
293 |
+
unset($dom, $dxpath, $elements);
|
294 |
+
|
295 |
+
}
|
296 |
+
}
|
297 |
+
}
|
298 |
+
//unset($file);
|
299 |
+
}
|
300 |
+
|
301 |
break;
|
302 |
}
|
303 |
|
304 |
}
|
305 |
else $this->errors->add('form-validation', __('Unable to download feed resource.', 'wp_all_import_plugin'));
|
306 |
+
}
|
307 |
|
308 |
if ( ! $this->errors->get_error_codes() ) {
|
309 |
|
336 |
'csv_paths' => array(PMXI_Plugin::$csv_path), // ftp import local copies of remote CSV files
|
337 |
'action' => 'import',
|
338 |
'elements_cloud' => (!empty($elements_cloud)) ? $elements_cloud : array(),
|
339 |
+
'pointer' => 1,
|
340 |
+
'deligate' => $deligate
|
341 |
);
|
342 |
|
343 |
foreach ($session_data as $key => $value) {
|
345 |
}
|
346 |
|
347 |
$update_previous = new PMXI_Import_Record();
|
348 |
+
if ($post['is_update_previous'] and ! $update_previous->getById($post['update_previous'])->isEmpty()) {
|
349 |
PMXI_Plugin::$session->set('update_previous', $update_previous->id);
|
350 |
PMXI_Plugin::$session->set('xpath', $update_previous->xpath);
|
351 |
+
//PMXI_Plugin::$session->set('template', $update_previous->template);
|
352 |
PMXI_Plugin::$session->set('options', $update_previous->options);
|
353 |
} else {
|
354 |
PMXI_Plugin::$session->set('update_previous', '');
|
362 |
{
|
363 |
$this->errors->add('form-validation', __('Please confirm you are importing a valid feed.<br/> Often, feed providers distribute feeds with invalid data, improperly wrapped HTML, line breaks where they should not be, faulty character encodings, syntax errors in the XML, and other issues.<br/><br/>WP All Import has checks in place to automatically fix some of the most common problems, but we can’t catch every single one.<br/><br/>It is also possible that there is a bug in WP All Import, and the problem is not with the feed.<br/><br/>If you need assistance, please contact support – <a href="mailto:support@wpallimport.com">support@wpallimport.com</a> – with your XML/CSV file. We will identify the problem and release a bug fix if necessary.', 'wp_all_import_plugin'));
|
364 |
}
|
365 |
+
elseif( $redirect_to_template )
|
366 |
+
{
|
367 |
+
wp_redirect(add_query_arg('action', 'template', $this->baseUrl)); die();
|
368 |
+
}
|
369 |
+
else
|
370 |
+
{
|
371 |
wp_redirect(add_query_arg('action', 'element', $this->baseUrl)); die();
|
372 |
+
}
|
373 |
|
374 |
} else if ('url' == $this->input->post('type') and !empty($this->errors)){
|
375 |
$this->errors->add('form-validation', __('WP All Import unable to detect file type.<br/><br/>WP All Import not able to determine what type of file you are importing. Make sure your file extension is correct for the file type you are importing.<br/> Please choose the correct file type from the dropdown below, or try adding &type=xml or &type=csv to the end of the URL, for example http://example.com/export-products.php?&type=xml', 'wp_all_import_plugin'));
|
431 |
$post['xpath'] = PMXI_Plugin::$session->xpath;
|
432 |
$this->data['elements'] = $elements = $xpath->query($post['xpath']);
|
433 |
if ( ! $elements->length and ! empty( PMXI_Plugin::$session->update_previous ) ) {
|
434 |
+
$_GET['pmxi_nt'] = __('Warning: No matching elements found for XPath expression from the import being updated. It probably means that new XML file has different format. Though you can update XPath, procceed only if you sure about update operation being valid.', 'wp_all_import_plugin');
|
435 |
}
|
436 |
} else {
|
437 |
// suggest 1st repeating element as default selection
|
1321 |
'root_element' => $this->data['import']->root_element,
|
1322 |
);
|
1323 |
|
1324 |
+
PMXI_Plugin::$session->set('source', $source);
|
1325 |
+
|
1326 |
$post = $this->input->post( apply_filters( 'pmxi_options_options', $DefaultOptions, $this->isWizard) );
|
1327 |
|
1328 |
}
|
1329 |
|
1330 |
$this->data['post'] =& $post;
|
1331 |
|
1332 |
+
PMXI_Plugin::$session->set('options', $post);
|
1333 |
+
PMXI_Plugin::$session->set('is_loaded_template', '');
|
1334 |
|
1335 |
if (($load_template = $this->input->post('load_template'))) { // init form with template selected
|
1336 |
if ( ! $template->getById($load_template)->isEmpty()) {
|
1339 |
$template_options['type'] = $post['type'];
|
1340 |
$template_options['custom_type'] = $post['custom_type'];
|
1341 |
$template_options['wizard_type'] = $post['wizard_type'];
|
1342 |
+
$template_options['delimiter'] = $post['delimiter'];
|
1343 |
|
1344 |
if ($this->isWizard and $post['wizard_type'] == 'new') {
|
1345 |
$template_options['create_new_records'] = 1;
|
1370 |
|
1371 |
if ( ! $this->errors->get_error_codes()) {
|
1372 |
|
1373 |
+
if ( ! empty($post['name']) and !empty($post['save_template_as']) ) { // save template in database
|
1374 |
$template->getByName($post['name'])->set(array(
|
1375 |
'name' => $post['name'],
|
1376 |
'is_keep_linebreaks' => $post['is_keep_linebreaks'],
|
1528 |
add_thickbox();
|
1529 |
wp_enqueue_script('media-upload');
|
1530 |
wp_enqueue_script('quicktags');
|
1531 |
+
|
1532 |
$this->render();
|
1533 |
}
|
1534 |
|
1563 |
if (empty(PMXI_Plugin::$session->options['title']))
|
1564 |
$this->warnings->add('form-validation', __('<strong>Warning:</strong> your title is blank.'));
|
1565 |
if (empty(PMXI_Plugin::$session->options['content']))
|
1566 |
+
$this->warnings->add('form-validation', __('<strong>Warning:</strong> your content is blank.'));
|
1567 |
+
|
1568 |
+
if (empty(PMXI_Plugin::$session->options['unique_key'])){
|
1569 |
+
|
1570 |
+
$keys_black_list = array('programurl');
|
1571 |
+
|
1572 |
+
if ( empty(PMXI_Plugin::$session->deligate) )
|
1573 |
+
$DefaultOptions['unique_key'] = PMXI_Plugin::$session->options['title'];
|
1574 |
+
|
1575 |
+
// auto searching ID element
|
1576 |
+
if ( ! empty($this->data['dom']) and empty(PMXI_Plugin::$session->deligate) ){
|
1577 |
+
$this->find_unique_key($this->data['dom']->documentElement);
|
1578 |
+
if (!empty($this->_unique_key)){
|
1579 |
+
foreach ($keys_black_list as $key => $value) {
|
1580 |
+
$DefaultOptions['unique_key'] = str_replace('{' . $value . '[1]}', "", $DefaultOptions['unique_key']);
|
1581 |
+
}
|
1582 |
+
foreach ($this->_unique_key as $key) {
|
1583 |
+
if (stripos($key, 'id') !== false) {
|
1584 |
+
$DefaultOptions['unique_key'] .= ' - {'.$key.'[1]}';
|
|
|
|
|
|
|
|
|
1585 |
break;
|
1586 |
+
}
|
1587 |
+
}
|
1588 |
+
foreach ($this->_unique_key as $key) {
|
1589 |
+
if (stripos($key, 'url') !== false or stripos($key, 'sku') !== false or stripos($key, 'ref') !== false) {
|
1590 |
+
if ( ! in_array($key, $keys_black_list) ){
|
1591 |
+
$DefaultOptions['unique_key'] .= ' - {'.$key.'[1]}';
|
1592 |
+
break;
|
1593 |
+
}
|
1594 |
+
}
|
1595 |
+
}
|
1596 |
+
}
|
1597 |
+
$DefaultOptions['unique_key'] = apply_filters('pmxi_unique_key', $DefaultOptions['unique_key'], PMXI_Plugin::$session->options);
|
1598 |
+
}
|
1599 |
+
}
|
1600 |
+
else{
|
1601 |
+
$DefaultOptions['unique_key'] = PMXI_Plugin::$session->options['unique_key'];
|
1602 |
}
|
|
|
|
|
1603 |
|
1604 |
if ($DefaultOptions['custom_type'] == "product" and class_exists('PMWI_Plugin') and $DefaultOptions['wizard_type'] != 'new'){
|
1605 |
$DefaultOptions['duplicate_indicator'] = 'custom field';
|
1665 |
}
|
1666 |
|
1667 |
// Categories/taxonomies logic
|
1668 |
+
if ($post['update_categories_logic'] == 'only' and ! empty($post['taxonomies_only_list'])){
|
1669 |
$post['taxonomies_list'] = explode(",", $post['taxonomies_only_list']);
|
1670 |
}
|
1671 |
+
elseif ($post['update_categories_logic'] == 'all_except' and ! empty($post['taxonomies_except_list'])){
|
1672 |
$post['taxonomies_list'] = explode(",", $post['taxonomies_except_list']);
|
1673 |
}
|
1674 |
|
1675 |
// Custom fields logic
|
1676 |
+
if ($post['update_custom_fields_logic'] == 'only' and ! empty($post['custom_fields_only_list'])){
|
1677 |
$post['custom_fields_list'] = explode(",", $post['custom_fields_only_list']);
|
1678 |
}
|
1679 |
+
elseif ($post['update_custom_fields_logic'] == 'all_except' and ! empty($post['custom_fields_except_list']) ){
|
1680 |
$post['custom_fields_list'] = explode(",", $post['custom_fields_except_list']);
|
1681 |
}
|
1682 |
|
1694 |
$upload_result = $uploader->upload();
|
1695 |
}
|
1696 |
|
1697 |
+
break;
|
|
|
1698 |
default:
|
1699 |
|
1700 |
$this->errors->add('form-validation', __('WP All Import doesn\'t support this import type.', 'wp_all_import_plugin'));
|
2002 |
wp_redirect(add_query_arg('action', 'process', $this->baseUrl)); die();
|
2003 |
}
|
2004 |
|
2005 |
+
}
|
2006 |
|
2007 |
$this->render();
|
2008 |
}
|
2015 |
|
2016 |
$wp_uploads = wp_upload_dir();
|
2017 |
|
2018 |
+
$import = $this->data['update_previous'];
|
2019 |
+
|
2020 |
$history_log = new PMXI_History_Record();
|
2021 |
|
2022 |
$input = new PMXI_Input();
|
2023 |
|
2024 |
if ( ! empty(PMXI_Plugin::$session->history_id) ) $history_log->getById(PMXI_Plugin::$session->history_id);
|
2025 |
|
2026 |
+
$log_storage = (int) PMXI_Plugin::getInstance()->getOption('log_storage');
|
2027 |
|
2028 |
if ( ! PMXI_Plugin::is_ajax() ) {
|
2029 |
|
2200 |
|
2201 |
$import_id = $input->get('id', 0);
|
2202 |
|
2203 |
+
if ( "ajax" == $import->options['import_processing'] and ! $import_id){
|
2204 |
PMXI_Plugin::$session->convertData($import->id);
|
2205 |
//die();
|
2206 |
}
|
2289 |
break;
|
2290 |
}
|
2291 |
|
2292 |
+
$file = new PMXI_Chunk($path, array(
|
2293 |
+
'element' => $import->root_element,
|
2294 |
+
'encoding' => $import->options['encoding'],
|
2295 |
+
'pointer' => PMXI_Plugin::$session->pointer,
|
2296 |
+
'filter' => true //$import->options['chuncking'] ? false : true
|
2297 |
+
));
|
2298 |
|
2299 |
// loop through the file until all lines are read
|
2300 |
while ($xml = $file->read() and empty($import->canceled) ) {
|
2301 |
|
2302 |
if ( ! empty($xml) )
|
2303 |
{
|
2304 |
+
if ( ! $import->options['chuncking'] )
|
2305 |
+
PMXI_Import_Record::preprocessXml($xml);
|
2306 |
+
|
2307 |
$chunk = "<?xml version=\"1.0\" encoding=\"". $import->options['encoding'] ."\"?>" . "\n" . $xml;
|
2308 |
|
2309 |
$dom = new DOMDocument('1.0', $import->options['encoding']);
|
controllers/controller/admin.php
CHANGED
@@ -93,7 +93,7 @@ abstract class PMXI_Controller_Admin extends PMXI_Controller {
|
|
93 |
/* load plupload scripts */
|
94 |
wp_deregister_script('swfupload-all');
|
95 |
wp_deregister_script('swfupload-handlers');
|
96 |
-
wp_enqueue_script('swfupload-handlers',
|
97 |
|
98 |
wp_enqueue_script('jquery-browserplus-min', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/browserplus-min.js', array('jquery'));
|
99 |
wp_enqueue_script('full-plupload', WP_ALL_IMPORT_ROOT_URL . '/static/js/plupload/plupload.full.js', array('jquery-browserplus-min'));
|
93 |
/* load plupload scripts */
|
94 |
wp_deregister_script('swfupload-all');
|
95 |
wp_deregister_script('swfupload-handlers');
|
96 |
+
wp_enqueue_script('swfupload-handlers', site_url() . "/wp-includes/js/swfupload/handlers.js", array('jquery'), '2201-20100523');
|
97 |
|
98 |
wp_enqueue_script('jquery-browserplus-min', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/browserplus-min.js', array('jquery'));
|
99 |
wp_enqueue_script('full-plupload', WP_ALL_IMPORT_ROOT_URL . '/static/js/plupload/plupload.full.js', array('jquery-browserplus-min'));
|
helpers/get_file_curl.php
CHANGED
@@ -2,8 +2,10 @@
|
|
2 |
|
3 |
if ( ! function_exists('get_file_curl') ):
|
4 |
|
5 |
-
function get_file_curl($url, $fullpath, $to_variable = false, $iteration = 0) {
|
6 |
|
|
|
|
|
7 |
$request = wp_remote_get($url);
|
8 |
|
9 |
if ( ! is_wp_error($request) ){
|
2 |
|
3 |
if ( ! function_exists('get_file_curl') ):
|
4 |
|
5 |
+
function get_file_curl($url, $fullpath, $to_variable = false, $iteration = 0) {
|
6 |
|
7 |
+
if ( ! preg_match('%^(http|ftp)s?://%i', $url) ) return;
|
8 |
+
|
9 |
$request = wp_remote_get($url);
|
10 |
|
11 |
if ( ! is_wp_error($request) ){
|
helpers/import_custom_meta_box.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (!function_exists('import_custom_meta_box')){
|
3 |
+
function import_custom_meta_box($edit_post) {
|
4 |
+
?>
|
5 |
+
<div id="postcustomstuff">
|
6 |
+
<table id="list-table">
|
7 |
+
<tbody class="list:meta" id="the-list">
|
8 |
+
<?php if (!empty(PMXI_Plugin::$session->data['pmxi_import']['options']['custom_name'])): foreach (PMXI_Plugin::$session->data['pmxi_import']['options']['custom_name'] as $i => $name): ?>
|
9 |
+
<tr>
|
10 |
+
<td class="left">
|
11 |
+
<label class="screen-reader-text">Key</label>
|
12 |
+
<input type="text" value="<?php echo esc_attr($name) ?>" name="custom_name[]" size="20">
|
13 |
+
<div class="submit"><input type="submit" class="delete deletemeta" value="Delete"></div>
|
14 |
+
</td>
|
15 |
+
<td>
|
16 |
+
<label class="screen-reader-text">Value</label>
|
17 |
+
<textarea name="custom_value[]" rows="2" cols="30" class="widefat"><?php echo esc_html(PMXI_Plugin::$session->data['pmxi_import']['options']['custom_value'][$i]) ?></textarea>
|
18 |
+
</td>
|
19 |
+
</tr>
|
20 |
+
<?php endforeach; endif; ?>
|
21 |
+
</tbody>
|
22 |
+
</table>
|
23 |
+
<?php meta_form(); ?>
|
24 |
+
</div>
|
25 |
+
<p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
|
26 |
+
<?php
|
27 |
+
}
|
28 |
+
}
|
helpers/pmxi_findDuplicates.php
CHANGED
@@ -16,7 +16,7 @@ function pmxi_findDuplicates($articleData, $custom_duplicate_name = '', $custom_
|
|
16 |
|
17 |
$args = array(
|
18 |
'post_type' => $post_types,
|
19 |
-
'post_status' => array('
|
20 |
'meta_query' => array(
|
21 |
array(
|
22 |
'key' => trim($custom_duplicate_name),
|
16 |
|
17 |
$args = array(
|
18 |
'post_type' => $post_types,
|
19 |
+
'post_status' => array('any'),
|
20 |
'meta_query' => array(
|
21 |
array(
|
22 |
'key' => trim($custom_duplicate_name),
|
helpers/pmxi_insert_attachment.php
DELETED
@@ -1,157 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
function pmxi_insert_attachment($object, $file = false, $parent = 0) {
|
3 |
-
global $wpdb;
|
4 |
-
|
5 |
-
$user_id = get_current_user_id();
|
6 |
-
|
7 |
-
$defaults = array('post_status' => 'inherit', 'post_type' => 'post', 'post_author' => $user_id,
|
8 |
-
'ping_status' => get_option('default_ping_status'), 'post_parent' => 0, 'post_title' => '',
|
9 |
-
'menu_order' => 0, 'to_ping' => '', 'pinged' => '', 'post_password' => '', 'post_content' => '',
|
10 |
-
'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => '', 'import_id' => 0, 'context' => '');
|
11 |
-
|
12 |
-
$object = wp_parse_args($object, $defaults);
|
13 |
-
if ( !empty($parent) )
|
14 |
-
$object['post_parent'] = $parent;
|
15 |
-
|
16 |
-
unset( $object[ 'filter' ] );
|
17 |
-
|
18 |
-
$object = sanitize_post($object, 'db');
|
19 |
-
|
20 |
-
// export array as variables
|
21 |
-
extract($object, EXTR_SKIP);
|
22 |
-
|
23 |
-
if ( empty($post_author) )
|
24 |
-
$post_author = $user_id;
|
25 |
-
|
26 |
-
$post_type = 'attachment';
|
27 |
-
|
28 |
-
if ( ! in_array( $post_status, array( 'inherit', 'private' ) ) )
|
29 |
-
$post_status = 'inherit';
|
30 |
-
|
31 |
-
if ( !empty($post_category) )
|
32 |
-
$post_category = array_filter($post_category); // Filter out empty terms
|
33 |
-
|
34 |
-
// Make sure we set a valid category.
|
35 |
-
if ( empty($post_category) || 0 == count($post_category) || !is_array($post_category) ) {
|
36 |
-
$post_category = array();
|
37 |
-
}
|
38 |
-
|
39 |
-
// Are we updating or creating?
|
40 |
-
if ( !empty($ID) ) {
|
41 |
-
$update = true;
|
42 |
-
$post_ID = (int) $ID;
|
43 |
-
} else {
|
44 |
-
$update = false;
|
45 |
-
$post_ID = 0;
|
46 |
-
}
|
47 |
-
|
48 |
-
// Create a valid post name.
|
49 |
-
if ( empty($post_name) )
|
50 |
-
$post_name = sanitize_title($post_title);
|
51 |
-
else
|
52 |
-
$post_name = sanitize_title($post_name);
|
53 |
-
|
54 |
-
// expected_slashed ($post_name)
|
55 |
-
$post_name = wp_unique_post_slug($post_name, $post_ID, $post_status, $post_type, $post_parent);
|
56 |
-
|
57 |
-
if ( empty($post_date) )
|
58 |
-
$post_date = current_time('mysql');
|
59 |
-
if ( empty($post_date_gmt) )
|
60 |
-
$post_date_gmt = current_time('mysql', 1);
|
61 |
-
|
62 |
-
if ( empty($post_modified) )
|
63 |
-
$post_modified = $post_date;
|
64 |
-
if ( empty($post_modified_gmt) )
|
65 |
-
$post_modified_gmt = $post_date_gmt;
|
66 |
-
|
67 |
-
if ( empty($comment_status) ) {
|
68 |
-
if ( $update )
|
69 |
-
$comment_status = 'closed';
|
70 |
-
else
|
71 |
-
$comment_status = get_option('default_comment_status');
|
72 |
-
}
|
73 |
-
if ( empty($ping_status) )
|
74 |
-
$ping_status = get_option('default_ping_status');
|
75 |
-
|
76 |
-
if ( isset($to_ping) )
|
77 |
-
$to_ping = preg_replace('|\s+|', "\n", $to_ping);
|
78 |
-
else
|
79 |
-
$to_ping = '';
|
80 |
-
|
81 |
-
if ( isset($post_parent) )
|
82 |
-
$post_parent = (int) $post_parent;
|
83 |
-
else
|
84 |
-
$post_parent = 0;
|
85 |
-
|
86 |
-
if ( isset($menu_order) )
|
87 |
-
$menu_order = (int) $menu_order;
|
88 |
-
else
|
89 |
-
$menu_order = 0;
|
90 |
-
|
91 |
-
if ( !isset($post_password) )
|
92 |
-
$post_password = '';
|
93 |
-
|
94 |
-
if ( ! isset($pinged) )
|
95 |
-
$pinged = '';
|
96 |
-
|
97 |
-
// expected_slashed (everything!)
|
98 |
-
$data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'post_mime_type', 'guid' ) );
|
99 |
-
/**
|
100 |
-
* Filter attachment post data before it is updated in or added
|
101 |
-
* to the database.
|
102 |
-
*
|
103 |
-
* @since 3.9.0
|
104 |
-
*
|
105 |
-
* @param array $data Array of sanitized attachment post data.
|
106 |
-
* @param array $object Array of un-sanitized attachment post data.
|
107 |
-
*/
|
108 |
-
$data = apply_filters( 'wp_insert_attachment_data', $data, $object );
|
109 |
-
$data = wp_unslash( $data );
|
110 |
-
|
111 |
-
if ( $update ) {
|
112 |
-
$wpdb->update( $wpdb->posts, $data, array( 'ID' => $post_ID ) );
|
113 |
-
} else {
|
114 |
-
// If there is a suggested ID, use it if not already present
|
115 |
-
if ( !empty($import_id) ) {
|
116 |
-
$import_id = (int) $import_id;
|
117 |
-
if ( ! $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE ID = %d", $import_id) ) ) {
|
118 |
-
$data['ID'] = $import_id;
|
119 |
-
}
|
120 |
-
}
|
121 |
-
|
122 |
-
$wpdb->insert( $wpdb->posts, $data );
|
123 |
-
$post_ID = (int) $wpdb->insert_id;
|
124 |
-
}
|
125 |
-
|
126 |
-
if ( empty($post_name) ) {
|
127 |
-
$post_name = sanitize_title($post_title, $post_ID);
|
128 |
-
$wpdb->update( $wpdb->posts, compact("post_name"), array( 'ID' => $post_ID ) );
|
129 |
-
}
|
130 |
-
|
131 |
-
if ( is_object_in_taxonomy($post_type, 'category') )
|
132 |
-
wp_set_post_categories( $post_ID, $post_category );
|
133 |
-
|
134 |
-
if ( isset( $tags_input ) && is_object_in_taxonomy($post_type, 'post_tag') )
|
135 |
-
wp_set_post_tags( $post_ID, $tags_input );
|
136 |
-
|
137 |
-
// support for all custom taxonomies
|
138 |
-
if ( !empty($tax_input) ) {
|
139 |
-
foreach ( $tax_input as $taxonomy => $tags ) {
|
140 |
-
$taxonomy_obj = get_taxonomy($taxonomy);
|
141 |
-
if ( is_array($tags) ) // array = hierarchical, string = non-hierarchical.
|
142 |
-
$tags = array_filter($tags);
|
143 |
-
if ( current_user_can($taxonomy_obj->cap->assign_terms) )
|
144 |
-
wp_set_post_terms( $post_ID, $tags, $taxonomy );
|
145 |
-
}
|
146 |
-
}
|
147 |
-
|
148 |
-
if ( $file )
|
149 |
-
update_attached_file( $post_ID, $file );
|
150 |
-
|
151 |
-
clean_post_cache( $post_ID );
|
152 |
-
|
153 |
-
if ( ! empty( $context ) )
|
154 |
-
add_post_meta( $post_ID, '_wp_attachment_context', $context, true );
|
155 |
-
|
156 |
-
return $post_ID;
|
157 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
helpers/pmxi_insert_post.php
DELETED
@@ -1,178 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
function pmxi_insert_post($postarr, $wp_error = false){
|
4 |
-
global $wpdb;
|
5 |
-
|
6 |
-
$user_id = get_current_user_id();
|
7 |
-
|
8 |
-
$defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_id,
|
9 |
-
'ping_status' => get_option('default_ping_status'), 'post_parent' => 0,
|
10 |
-
'menu_order' => 0, 'to_ping' => '', 'pinged' => '', 'post_password' => '',
|
11 |
-
'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => '', 'import_id' => 0,
|
12 |
-
'post_content' => '', 'post_title' => '');
|
13 |
-
|
14 |
-
$postarr = wp_parse_args($postarr, $defaults);
|
15 |
-
|
16 |
-
$postarr = sanitize_post($postarr, 'db');
|
17 |
-
|
18 |
-
// export array as variables
|
19 |
-
extract($postarr, EXTR_SKIP);
|
20 |
-
|
21 |
-
// Are we updating or creating?
|
22 |
-
$post_ID = 0;
|
23 |
-
$update = false;
|
24 |
-
if ( ! empty( $ID ) ) {
|
25 |
-
$update = true;
|
26 |
-
|
27 |
-
// Get the post ID and GUID
|
28 |
-
$post_ID = $ID;
|
29 |
-
|
30 |
-
} else {
|
31 |
-
$previous_status = 'new';
|
32 |
-
}
|
33 |
-
|
34 |
-
if ( empty($post_type) )
|
35 |
-
$post_type = 'post';
|
36 |
-
|
37 |
-
if ( empty($post_status) )
|
38 |
-
$post_status = 'draft';
|
39 |
-
|
40 |
-
// Make sure we set a valid category.
|
41 |
-
if ( empty($post_category) || 0 == count($post_category) || !is_array($post_category) ) {
|
42 |
-
// 'post' requires at least one category.
|
43 |
-
if ( 'post' == $post_type && 'auto-draft' != $post_status )
|
44 |
-
$post_category = array( get_option('default_category') );
|
45 |
-
else
|
46 |
-
$post_category = array();
|
47 |
-
}
|
48 |
-
|
49 |
-
if ( empty($post_author) )
|
50 |
-
$post_author = $user_id;
|
51 |
-
|
52 |
-
// Create a valid post name. Drafts and pending posts are allowed to have an empty
|
53 |
-
// post name.
|
54 |
-
if ( empty($post_name) ) {
|
55 |
-
if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
|
56 |
-
$post_name = sanitize_title($post_title);
|
57 |
-
else
|
58 |
-
$post_name = '';
|
59 |
-
} else {
|
60 |
-
// On updates, we need to check to see if it's using the old, fixed sanitization context.
|
61 |
-
$check_name = sanitize_title( $post_name, '', 'old-save' );
|
62 |
-
if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $ID ) == $check_name )
|
63 |
-
$post_name = $check_name;
|
64 |
-
else // new post, or slug has changed.
|
65 |
-
$post_name = sanitize_title($post_name);
|
66 |
-
}
|
67 |
-
|
68 |
-
// If the post date is empty (due to having been new or a draft) and status is not 'draft' or 'pending', set date to now
|
69 |
-
if ( empty($post_date) || '0000-00-00 00:00:00' == $post_date )
|
70 |
-
$post_date = current_time('mysql');
|
71 |
-
|
72 |
-
// validate the date
|
73 |
-
$mm = substr( $post_date, 5, 2 );
|
74 |
-
$jj = substr( $post_date, 8, 2 );
|
75 |
-
$aa = substr( $post_date, 0, 4 );
|
76 |
-
$valid_date = wp_checkdate( $mm, $jj, $aa, $post_date );
|
77 |
-
if ( !$valid_date ) {
|
78 |
-
if ( $wp_error )
|
79 |
-
return new WP_Error( 'invalid_date', __( 'Whoops, the provided date is invalid.' ) );
|
80 |
-
else
|
81 |
-
return 0;
|
82 |
-
}
|
83 |
-
|
84 |
-
if ( empty($post_date_gmt) || '0000-00-00 00:00:00' == $post_date_gmt ) {
|
85 |
-
if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
|
86 |
-
$post_date_gmt = get_gmt_from_date($post_date);
|
87 |
-
else
|
88 |
-
$post_date_gmt = '0000-00-00 00:00:00';
|
89 |
-
}
|
90 |
-
|
91 |
-
if ( $update || '0000-00-00 00:00:00' == $post_date ) {
|
92 |
-
$post_modified = current_time( 'mysql' );
|
93 |
-
$post_modified_gmt = current_time( 'mysql', 1 );
|
94 |
-
} else {
|
95 |
-
$post_modified = $post_date;
|
96 |
-
$post_modified_gmt = $post_date_gmt;
|
97 |
-
}
|
98 |
-
|
99 |
-
if ( 'publish' == $post_status ) {
|
100 |
-
$now = gmdate('Y-m-d H:i:59');
|
101 |
-
if ( mysql2date('U', $post_date_gmt, false) > mysql2date('U', $now, false) )
|
102 |
-
$post_status = 'future';
|
103 |
-
} elseif( 'future' == $post_status ) {
|
104 |
-
$now = gmdate('Y-m-d H:i:59');
|
105 |
-
if ( mysql2date('U', $post_date_gmt, false) <= mysql2date('U', $now, false) )
|
106 |
-
$post_status = 'publish';
|
107 |
-
}
|
108 |
-
|
109 |
-
if ( empty($comment_status) ) {
|
110 |
-
if ( $update )
|
111 |
-
$comment_status = 'closed';
|
112 |
-
else
|
113 |
-
$comment_status = get_option('default_comment_status');
|
114 |
-
}
|
115 |
-
if ( empty($ping_status) )
|
116 |
-
$ping_status = get_option('default_ping_status');
|
117 |
-
|
118 |
-
if ( isset($to_ping) )
|
119 |
-
$to_ping = sanitize_trackback_urls( $to_ping );
|
120 |
-
else
|
121 |
-
$to_ping = '';
|
122 |
-
|
123 |
-
if ( ! isset($pinged) )
|
124 |
-
$pinged = '';
|
125 |
-
|
126 |
-
if ( isset($post_parent) )
|
127 |
-
$post_parent = (int) $post_parent;
|
128 |
-
else
|
129 |
-
$post_parent = 0;
|
130 |
-
|
131 |
-
// Check the post_parent to see if it will cause a hierarchy loop
|
132 |
-
$post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, compact( array_keys( $postarr ) ), $postarr );
|
133 |
-
|
134 |
-
if ( isset($menu_order) )
|
135 |
-
$menu_order = (int) $menu_order;
|
136 |
-
else
|
137 |
-
$menu_order = 0;
|
138 |
-
|
139 |
-
$post_name = wp_unique_post_slug($post_name, $post_ID, $post_status, $post_type, $post_parent);
|
140 |
-
|
141 |
-
// expected_slashed (everything!)
|
142 |
-
$data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'guid' ) );
|
143 |
-
$data = wp_unslash( $data );
|
144 |
-
$where = array( 'ID' => $post_ID );
|
145 |
-
|
146 |
-
if ( $update ) {
|
147 |
-
if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) {
|
148 |
-
if ( $wp_error )
|
149 |
-
return new WP_Error('db_update_error', __('Could not update post in the database'), $wpdb->last_error);
|
150 |
-
else
|
151 |
-
return 0;
|
152 |
-
}
|
153 |
-
} else {
|
154 |
-
if ( isset($post_mime_type) )
|
155 |
-
$data['post_mime_type'] = wp_unslash( $post_mime_type ); // This isn't in the update
|
156 |
-
if ( false === $wpdb->insert( $wpdb->posts, $data ) ) {
|
157 |
-
if ( $wp_error )
|
158 |
-
return new WP_Error('db_insert_error', __('Could not insert post into the database'), $wpdb->last_error);
|
159 |
-
else
|
160 |
-
return 0;
|
161 |
-
}
|
162 |
-
$post_ID = (int) $wpdb->insert_id;
|
163 |
-
|
164 |
-
// use the newly generated $post_ID
|
165 |
-
$where = array( 'ID' => $post_ID );
|
166 |
-
}
|
167 |
-
|
168 |
-
if ( isset( $tags_input ) && is_object_in_taxonomy($post_type, 'post_tag') )
|
169 |
-
wp_set_post_tags( $post_ID, $tags_input );
|
170 |
-
|
171 |
-
$current_guid = get_post_field( 'guid', $post_ID );
|
172 |
-
|
173 |
-
// Set GUID
|
174 |
-
if ( !$update && '' == $current_guid )
|
175 |
-
$wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ID ) ), $where );
|
176 |
-
|
177 |
-
return $post_ID;
|
178 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
helpers/pmxi_recursion_taxes.php
CHANGED
@@ -5,11 +5,11 @@ function pmxi_recursion_taxes($parent, $tx_name, $txes, $key){
|
|
5 |
|
6 |
if ( empty($parent['parent']) ){
|
7 |
|
8 |
-
$term = term_exists($parent['name'], $tx_name);
|
9 |
|
10 |
if ( empty($term) and !is_wp_error($term) ){
|
11 |
|
12 |
-
$term = term_exists(htmlspecialchars($parent['name']), $tx_name);
|
13 |
if ( empty($term) and !is_wp_error($term) ){
|
14 |
$term = wp_insert_term(
|
15 |
$parent['name'], // the term
|
5 |
|
6 |
if ( empty($parent['parent']) ){
|
7 |
|
8 |
+
$term = term_exists($parent['name'], $tx_name, 0);
|
9 |
|
10 |
if ( empty($term) and !is_wp_error($term) ){
|
11 |
|
12 |
+
$term = term_exists(htmlspecialchars($parent['name']), $tx_name, 0);
|
13 |
if ( empty($term) and !is_wp_error($term) ){
|
14 |
$term = wp_insert_term(
|
15 |
$parent['name'], // the term
|
helpers/wp_all_import_get_feed_type.php
CHANGED
@@ -14,7 +14,7 @@ if ( ! function_exists('wp_all_import_get_feed_type')){
|
|
14 |
|
15 |
}
|
16 |
|
17 |
-
$headers = get_headers($url, 1);
|
18 |
$extensions = array('gzip', 'gz', 'xml', 'csv', 'json', 'sql');
|
19 |
$type = false;
|
20 |
|
14 |
|
15 |
}
|
16 |
|
17 |
+
$headers = @get_headers($url, 1);
|
18 |
$extensions = array('gzip', 'gz', 'xml', 'csv', 'json', 'sql');
|
19 |
$type = false;
|
20 |
|
helpers/wp_all_import_get_gz.php
CHANGED
@@ -16,7 +16,7 @@ if ( ! function_exists('wp_all_import_get_gz')){
|
|
16 |
$first_chunk = true;
|
17 |
while (!gzeof($file)) {
|
18 |
$chunk = gzread($file, 1024);
|
19 |
-
if ($first_chunk and strpos($chunk, "<?") !== false) { $type = 'xml'; $first_chunk = false; } // if it's a 1st chunk, then chunk <? symbols to detect XML file
|
20 |
@fwrite($fp, $chunk);
|
21 |
}
|
22 |
gzclose($file);
|
@@ -35,7 +35,7 @@ if ( ! function_exists('wp_all_import_get_gz')){
|
|
35 |
$first_chunk = true;
|
36 |
while (!gzeof($file)) {
|
37 |
$chunk = gzread($file, 1024);
|
38 |
-
if ($first_chunk and strpos($chunk, "<?") !== false) { $type = 'xml'; $first_chunk = false; } // if it's a 1st chunk, then chunk <? symbols to detect XML file
|
39 |
@fwrite($fp, $chunk);
|
40 |
}
|
41 |
gzclose($file);
|
16 |
$first_chunk = true;
|
17 |
while (!gzeof($file)) {
|
18 |
$chunk = gzread($file, 1024);
|
19 |
+
if ($first_chunk and strpos($chunk, "<?") !== false and strpos($chunk, "</") !== false) { $type = 'xml'; $first_chunk = false; } // if it's a 1st chunk, then chunk <? symbols to detect XML file
|
20 |
@fwrite($fp, $chunk);
|
21 |
}
|
22 |
gzclose($file);
|
35 |
$first_chunk = true;
|
36 |
while (!gzeof($file)) {
|
37 |
$chunk = gzread($file, 1024);
|
38 |
+
if ($first_chunk and strpos($chunk, "<?") !== false and strpos($chunk, "</") !== false) { $type = 'xml'; $first_chunk = false; } // if it's a 1st chunk, then chunk <? symbols to detect XML file
|
39 |
@fwrite($fp, $chunk);
|
40 |
}
|
41 |
gzclose($file);
|
helpers/wp_all_import_is_update_cf.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wp_all_import_is_update_cf( $met_key, $options ){
|
4 |
+
|
5 |
+
if ( $options['update_all_data'] == 'yes') return true;
|
6 |
+
|
7 |
+
if ( ! $options['is_update_custom_fields'] ) return false;
|
8 |
+
|
9 |
+
if ( $options['update_custom_fields_logic'] == "full_update" ) return true;
|
10 |
+
if ( $options['update_custom_fields_logic'] == "only" and ! empty($options['custom_fields_list']) and is_array($options['custom_fields_list']) and in_array($meta_key, $options['custom_fields_list']) ) return true;
|
11 |
+
if ( $options['update_custom_fields_logic'] == "all_except" and ( empty($options['custom_fields_list']) or ! in_array($meta_key, $options['custom_fields_list']) )) return true;
|
12 |
+
|
13 |
+
return false;
|
14 |
+
}
|
helpers/wp_all_import_xml2array.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! function_exists('wp_all_import_xml2array')){
|
4 |
+
function wp_all_import_xml2array( $xmlObject, $out = array () ) {
|
5 |
+
foreach ( (array) $xmlObject as $index => $node )
|
6 |
+
$out[$index] = ( is_object ( $node ) ) ? wp_all_import_xml2array ( $node ) : $node;
|
7 |
+
|
8 |
+
return $out;
|
9 |
+
}
|
10 |
+
}
|
libraries/XmlImportCsvParse.php
CHANGED
@@ -976,7 +976,7 @@ class PMXI_CsvParser
|
|
976 |
$buf_keys = $keys;
|
977 |
foreach ($keys as $key => $value) {
|
978 |
if (!$create_new_headers and (preg_match('%\W(http:|https:|ftp:)$%i', $value) or is_numeric($value))) $create_new_headers = true;
|
979 |
-
$value = trim(strtolower(preg_replace('/^[0-9]{1}/','el_', preg_replace('/[^a-z0-9_]/i', '', $value))));
|
980 |
$keys[$key] = (!empty($value)) ? $value : 'undefined' . $key;
|
981 |
}
|
982 |
$this->headers = $keys;
|
976 |
$buf_keys = $keys;
|
977 |
foreach ($keys as $key => $value) {
|
978 |
if (!$create_new_headers and (preg_match('%\W(http:|https:|ftp:)$%i', $value) or is_numeric($value))) $create_new_headers = true;
|
979 |
+
$value = trim(strtolower(preg_replace('/^[0-9]{1}/','el_', preg_replace('/[^a-z0-9_]/i', '', $value))));
|
980 |
$keys[$key] = (!empty($value)) ? $value : 'undefined' . $key;
|
981 |
}
|
982 |
$this->headers = $keys;
|
models/import/record.php
CHANGED
@@ -18,8 +18,8 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
18 |
|
19 |
$xml = preg_replace_callback('/<!\[CDATA\[[^\]\]>]*\]\]>/s', 'wp_all_import_cdata_filter', $xml );
|
20 |
|
21 |
-
$xml = str_replace("&", "&", str_replace("&","&", $xml));
|
22 |
-
|
23 |
if ( ! empty(self::$cdata) ){
|
24 |
foreach (self::$cdata as $key => $val) {
|
25 |
$xml = str_replace('{{CPLACE_' . ($key + 1) . '}}', $val, $xml);
|
@@ -174,6 +174,20 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
174 |
else{
|
175 |
count($titles) and $page_template = array_fill(0, count($titles), 'default');
|
176 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
}
|
178 |
|
179 |
if ( "no" == $this->options['is_multiple_page_parent'] ){
|
@@ -182,8 +196,54 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
182 |
if (!empty($this->options['single_page_parent'])){
|
183 |
$page_parent = XmlImportParser::factory($xml, $cxpath, $this->options['single_page_parent'], $file)->parse($records); $tmp_files[] = $file;
|
184 |
foreach ($page_parent as $key => $identity) {
|
185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
$page_parent[$key] = (!empty($page)) ? $page->ID : 0;
|
|
|
|
|
187 |
}
|
188 |
}
|
189 |
else{
|
@@ -284,7 +344,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
284 |
$tx_name = $ctx->name;
|
285 |
$mapping_rules = ( ! empty($this->options['tax_mapping'][$tx_name])) ? json_decode($this->options['tax_mapping'][$tx_name], true) : false;
|
286 |
$taxonomies[$tx_name] = array();
|
287 |
-
if ( ! empty($this->options['tax_logic'][$tx_name]) ){
|
288 |
switch ($this->options['tax_logic'][$tx_name]){
|
289 |
case 'single':
|
290 |
if ( ! empty($this->options['tax_single_xpath'][$tx_name]) ){
|
@@ -407,9 +467,9 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
407 |
), $mapping_rules, $tx_name);
|
408 |
$iterator[$i]++;
|
409 |
}
|
410 |
-
}
|
411 |
}
|
412 |
-
}
|
413 |
}
|
414 |
}
|
415 |
if ( ! empty($this->options['tax_hierarchical_logic_manual'][$tx_name])){
|
@@ -422,8 +482,21 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
422 |
|
423 |
foreach ($txes_raw as $i => $cc) {
|
424 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
if ( ! empty($this->options['tax_manualhierarchy_delim'][$tx_name])){
|
426 |
-
$delimeted_taxonomies = explode($this->options['tax_manualhierarchy_delim'][$tx_name], $
|
427 |
}
|
428 |
|
429 |
if ( empty($delimeted_taxonomies) ) continue;
|
@@ -442,7 +515,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
442 |
'name' => trim($dc),
|
443 |
'parent' => $parent,
|
444 |
'assign' => (isset($taxonomy['assign'])) ? $taxonomy['assign'] : true,
|
445 |
-
'is_mapping' => (!empty($this->options['tax_enable_mapping'][$tx_name])),
|
446 |
'hierarchy_level' => 1,
|
447 |
'max_hierarchy_level' => 1
|
448 |
), $mapping_rules, $tx_name);
|
@@ -455,7 +528,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
455 |
'name' => trim($dc),
|
456 |
'parent' => false,
|
457 |
'assign' => (isset($taxonomy['assign'])) ? $taxonomy['assign'] : true,
|
458 |
-
'is_mapping' => (!empty($this->options['tax_enable_mapping'][$tx_name])),
|
459 |
'hierarchy_level' => 1,
|
460 |
'max_hierarchy_level' => 1
|
461 |
), $mapping_rules, $tx_name);
|
@@ -476,7 +549,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
476 |
}
|
477 |
endforeach;
|
478 |
endif;
|
479 |
-
// [/custom taxonomies]
|
480 |
|
481 |
// Composing featured images
|
482 |
if ( ! (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
|
@@ -612,15 +685,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
612 |
count($titles) and $unique_keys = array_fill(0, count($titles), '');
|
613 |
}
|
614 |
|
615 |
-
$chunk == 1 and $logger and call_user_func($logger, __('Processing posts...', 'wp_all_import_plugin'));
|
616 |
-
|
617 |
-
if ('post' == $this->options['type'] and '' != $this->options['custom_type']) {
|
618 |
-
$post_type = $this->options['custom_type'];
|
619 |
-
} else {
|
620 |
-
$post_type = $this->options['type'];
|
621 |
-
}
|
622 |
-
|
623 |
-
$custom_type_details = get_post_type_object( $post_type );
|
624 |
|
625 |
$addons = array();
|
626 |
$addons_data = array();
|
@@ -633,8 +698,8 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
633 |
'xml' => $xml,
|
634 |
'logger' => $logger,
|
635 |
'chunk' => $chunk,
|
636 |
-
'xpath_prefix' => $xpath_prefix
|
637 |
-
);
|
638 |
|
639 |
$parse_functions = apply_filters('wp_all_import_addon_parse', array());
|
640 |
|
@@ -644,7 +709,8 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
644 |
$addons[$class] = new $model_class();
|
645 |
$addons_data[$class] = ( method_exists($addons[$class], 'parse') ) ? $addons[$class]->parse($parsingData) : false;
|
646 |
}
|
647 |
-
else
|
|
|
648 |
if ( ! empty($parse_functions[$class]) ){
|
649 |
|
650 |
if ( is_array($parse_functions[$class]) and is_callable($parse_functions[$class]) or ! is_array($parse_functions[$class]) and function_exists($parse_functions[$class]) ){
|
@@ -673,10 +739,16 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
673 |
}
|
674 |
}
|
675 |
|
676 |
-
}
|
|
|
|
|
|
|
|
|
677 |
|
678 |
foreach ($titles as $i => $void) {
|
679 |
|
|
|
|
|
680 |
if ($is_cron and $cron_sleep) sleep($cron_sleep);
|
681 |
|
682 |
$logger and call_user_func($logger, __('---', 'wp_all_import_plugin'));
|
@@ -716,7 +788,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
716 |
}
|
717 |
else {
|
718 |
$articleData = array(
|
719 |
-
'post_type' => $post_type,
|
720 |
'post_status' => ("xpath" == $this->options['status']) ? $post_status[$i] : $this->options['status'],
|
721 |
'comment_status' => ("xpath" == $this->options['comment_status']) ? $comment_status[$i] : $this->options['comment_status'],
|
722 |
'ping_status' => ("xpath" == $this->options['ping_status']) ? $ping_status[$i] : $this->options['ping_status'],
|
@@ -809,7 +881,8 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
809 |
if ($post_to_update){
|
810 |
|
811 |
$continue_import = true;
|
812 |
-
|
|
|
813 |
|
814 |
if ( ! $continue_import ){
|
815 |
|
@@ -847,7 +920,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
847 |
if ( ! in_array($this->options['custom_type'], array('import_users'))){
|
848 |
|
849 |
// preserve date of already existing article when duplicate is found
|
850 |
-
if ( ! $this->options['is_update_categories'] or ($this->options['is_update_categories'] and $this->options['update_categories_logic'] != "full_update")) {
|
851 |
$logger and call_user_func($logger, sprintf(__('Preserve taxonomies of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
852 |
$existing_taxonomies = array();
|
853 |
foreach (array_keys($taxonomies) as $tx_name) {
|
@@ -934,7 +1007,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
934 |
// handle obsolete attachments (i.e. delete or keep) according to import settings
|
935 |
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")){
|
936 |
$logger and call_user_func($logger, sprintf(__('Deleting images for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
937 |
-
wp_delete_attachments($articleData['ID'],
|
938 |
}
|
939 |
|
940 |
}
|
@@ -944,10 +1017,10 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
944 |
// existing post not found though it's track was found... clear the leftover, plugin will continue to treat record as new
|
945 |
$postRecord->clear();
|
946 |
|
947 |
-
}
|
948 |
|
949 |
// no new records are created. it will only update posts it finds matching duplicates for
|
950 |
-
if (
|
951 |
|
952 |
if ( ! $postRecord->isEmpty() ) $postRecord->set(array('iteration' => $this->iteration))->update();
|
953 |
|
@@ -1038,7 +1111,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1038 |
|
1039 |
// insert article being imported
|
1040 |
if ($this->options['is_fast_mode']){
|
1041 |
-
foreach (array('save_post', 'pre_post_update', 'add_attachment', 'edit_attachment', 'edit_post', 'post_updated', 'wp_insert_post', 'save_post_' . $post_type) as $act) {
|
1042 |
remove_all_actions($act);
|
1043 |
}
|
1044 |
}
|
@@ -1069,7 +1142,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1069 |
'post_id' => $pid,
|
1070 |
'import_id' => $this->id,
|
1071 |
'unique_key' => $unique_keys[$i],
|
1072 |
-
'product_key' => (($post_type == "product" and PMXI_Admin_Addons::get_addon('PMWI_Plugin')) ? $addons_data['PMWI_Plugin']['single_product_ID'][$i] : '')
|
1073 |
))->insert();
|
1074 |
|
1075 |
$postRecord->set(array('iteration' => $this->iteration))->update();
|
@@ -1078,12 +1151,11 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1078 |
}
|
1079 |
|
1080 |
// [post format]
|
1081 |
-
if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ){
|
1082 |
set_post_format($pid, $this->options['post_format'] );
|
1083 |
$logger and call_user_func($logger, sprintf(__('Associate post `%s` with post format %s ...', 'wp_all_import_plugin'), $articleData['post_title'], (!empty($this->options['post_format'])) ? $this->options['post_format'] : 'Standart'));
|
1084 |
}
|
1085 |
-
// [/post format]
|
1086 |
-
|
1087 |
|
1088 |
// [addons import]
|
1089 |
|
@@ -1096,7 +1168,8 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1096 |
'xml' => $xml,
|
1097 |
'is_cron' => $is_cron,
|
1098 |
'logger' => $logger,
|
1099 |
-
'xpath_prefix' => $xpath_prefix
|
|
|
1100 |
);
|
1101 |
|
1102 |
$import_functions = apply_filters('wp_all_import_addon_import', array());
|
@@ -1106,29 +1179,27 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1106 |
if (class_exists($class)){
|
1107 |
if ( method_exists($addons[$class], 'import') ) $addons[$class]->import($importData);
|
1108 |
}
|
1109 |
-
else
|
1110 |
-
|
1111 |
if ( ! empty($import_functions[$class]) ){
|
1112 |
|
1113 |
if ( is_array($import_functions[$class]) and is_callable($import_functions[$class]) or ! is_array($import_functions[$class]) and function_exists($import_functions[$class]) ){
|
1114 |
|
1115 |
call_user_func($import_functions[$class], $importData, $addons_data[$class]);
|
1116 |
-
}
|
1117 |
-
|
1118 |
}
|
1119 |
-
|
1120 |
}
|
1121 |
}
|
1122 |
|
1123 |
// [/addons import]
|
1124 |
|
1125 |
// Page Template
|
1126 |
-
if ('page' == $articleData['post_type'] and ( !empty($this->options['page_template']) or "no" == $this->options['is_multiple_page_template']) ){
|
1127 |
update_post_meta($pid, '_wp_page_template', ("no" == $this->options['is_multiple_page_template']) ? $page_template[$i] : $this->options['page_template']);
|
1128 |
}
|
1129 |
|
1130 |
// [featured image]
|
1131 |
-
if ( ! empty($uploads) and false === $uploads['error'] and
|
1132 |
|
1133 |
if (!empty($featured_images[$i])){
|
1134 |
|
@@ -1164,7 +1235,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1164 |
|
1165 |
$attachment_imgs = get_attached_media( 'image', $pid );
|
1166 |
|
1167 |
-
if ( $post_type == "product" )
|
1168 |
$gallery_attachment_ids = array_filter(explode(",", get_post_meta($pid, '_product_image_gallery', true)));
|
1169 |
|
1170 |
if ( $attachment_imgs ) {
|
@@ -1224,10 +1295,12 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1224 |
|
1225 |
foreach ($imgs as $k => $img_url) { if (empty($img_url)) continue;
|
1226 |
|
1227 |
-
$attid = false;
|
|
|
|
|
1228 |
|
1229 |
$url = str_replace(" ", "%20", trim($img_url));
|
1230 |
-
$bn =
|
1231 |
|
1232 |
if ( "yes" == $this->options['download_images'] and ! empty($auto_extensions[$i]) and preg_match('%^(jpg|jpeg|png|gif)$%i', $auto_extensions[$i])){
|
1233 |
$img_ext = $auto_extensions[$i];
|
@@ -1268,9 +1341,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1268 |
else {
|
1269 |
|
1270 |
$image_filename = wp_unique_filename($targetDir, $image_name);
|
1271 |
-
$image_filepath = $targetDir . '/' . $image_filename;
|
1272 |
-
|
1273 |
-
$logger and call_user_func($logger, sprintf(__('- Image `%s` will be saved with name `%s` ...', 'wp_all_import_plugin'), $img_url, $image_filename));
|
1274 |
|
1275 |
// keep existing and add newest images
|
1276 |
if ( ! empty($articleData['ID']) and $this->options['is_update_images'] and $this->options['update_images_logic'] == "add_new" and $this->options['update_all_data'] == "no"){
|
@@ -1424,6 +1495,15 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1424 |
|
1425 |
if ($attid){
|
1426 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1427 |
$logger and call_user_func($logger, __('- <b>ACTION</b>: pmxi_gallery_image', 'wp_all_import_plugin'));
|
1428 |
do_action( 'pmxi_gallery_image', $pid, $attid, $image_filepath);
|
1429 |
|
@@ -1443,7 +1523,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1443 |
}
|
1444 |
}
|
1445 |
// Set product gallery images
|
1446 |
-
if ( $post_type == "product" )
|
1447 |
update_post_meta($pid, '_product_image_gallery', (!empty($gallery_attachment_ids)) ? implode(',', $gallery_attachment_ids) : '');
|
1448 |
// Create entry as Draft if no images are downloaded successfully
|
1449 |
if ( ! $success_images and "yes" == $this->options['create_draft'] ) {
|
@@ -1561,9 +1641,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1561 |
// [custom taxonomies]
|
1562 |
if ( ! empty($taxonomies) ){
|
1563 |
|
1564 |
-
$logger and call_user_func($logger, __('<b>TAXONOMIES:</b>', 'wp_all_import_plugin'));
|
1565 |
-
|
1566 |
-
$custom_type = get_post_type_object( $this->options['custom_type'] );
|
1567 |
|
1568 |
foreach ($taxonomies as $tx_name => $txes) {
|
1569 |
|
@@ -1581,12 +1659,12 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1581 |
if (!empty($articleData['ID'])){
|
1582 |
if ($this->options['update_all_data'] == "no" and $this->options['update_categories_logic'] == "all_except" and !empty($this->options['taxonomies_list'])
|
1583 |
and is_array($this->options['taxonomies_list']) and in_array($tx_name, $this->options['taxonomies_list'])){
|
1584 |
-
$logger and call_user_func($logger, sprintf(__('- %s %s `%s` has been skipped attempted to `Leave these taxonomies alone, update all others`...', 'wp_all_import_plugin'), $
|
1585 |
continue;
|
1586 |
}
|
1587 |
if ($this->options['update_all_data'] == "no" and $this->options['update_categories_logic'] == "only" and ((!empty($this->options['taxonomies_list'])
|
1588 |
and is_array($this->options['taxonomies_list']) and ! in_array($tx_name, $this->options['taxonomies_list'])) or empty($this->options['taxonomies_list']))){
|
1589 |
-
$logger and call_user_func($logger, sprintf(__('- %s %s `%s` has been skipped attempted to `Update only these taxonomies, leave the rest alone`...', 'wp_all_import_plugin'), $
|
1590 |
continue;
|
1591 |
}
|
1592 |
}
|
@@ -1623,10 +1701,10 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1623 |
if ( ! is_wp_error($term) ){
|
1624 |
$is_created_term = true;
|
1625 |
if ( empty($parent_id) ){
|
1626 |
-
$logger and call_user_func($logger, sprintf(__('- Creating parent %s %s `%s` ...', 'wp_all_import_plugin'), $
|
1627 |
}
|
1628 |
else{
|
1629 |
-
$logger and call_user_func($logger, sprintf(__('- Creating child %s %s for %s named `%s` ...', 'wp_all_import_plugin'), $
|
1630 |
}
|
1631 |
}
|
1632 |
}
|
@@ -1644,10 +1722,10 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1644 |
if (!in_array($term->slug, $assign_taxes)) $assign_taxes[] = $term->term_taxonomy_id;
|
1645 |
if (!$is_created_term){
|
1646 |
if ( empty($parent_id) ){
|
1647 |
-
$logger and call_user_func($logger, sprintf(__('- Attempted to create parent %s %s `%s`, duplicate detected. Importing %s to existing `%s` %s, ID %d, slug `%s` ...', 'wp_all_import_plugin'), $
|
1648 |
}
|
1649 |
else{
|
1650 |
-
$logger and call_user_func($logger, sprintf(__('- Attempted to create child %s %s `%s`, duplicate detected. Importing %s to existing `%s` %s, ID %d, slug `%s` ...', 'wp_all_import_plugin'), $
|
1651 |
}
|
1652 |
}
|
1653 |
}
|
@@ -1660,15 +1738,21 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1660 |
$this->associate_terms($pid, ( empty($assign_taxes) ? false : $assign_taxes ), $tx_name, $logger, $is_cron);
|
1661 |
|
1662 |
}
|
|
|
|
|
|
|
|
|
1663 |
}
|
1664 |
-
if (
|
1665 |
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
|
|
1669 |
|
1670 |
-
|
1671 |
-
|
|
|
1672 |
}
|
1673 |
}
|
1674 |
}
|
@@ -1686,7 +1770,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1686 |
$importData = array(
|
1687 |
'pid' => $pid,
|
1688 |
'import' => $this,
|
1689 |
-
'logger' => $logger
|
1690 |
);
|
1691 |
|
1692 |
$saved_functions = apply_filters('wp_all_import_addon_saved_post', array());
|
@@ -1696,23 +1780,21 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1696 |
if (class_exists($class)){
|
1697 |
if ( method_exists($addons[$class], 'saved_post') ) $addons[$class]->saved_post($importData);
|
1698 |
}
|
1699 |
-
else
|
1700 |
-
|
1701 |
if ( ! empty($saved_functions[$class]) ){
|
1702 |
|
1703 |
if ( is_array($saved_functions[$class]) and is_callable($saved_functions[$class]) or ! is_array($saved_functions[$class]) and function_exists($saved_functions[$class]) ){
|
1704 |
|
1705 |
call_user_func($saved_functions[$class], $importData);
|
1706 |
-
}
|
1707 |
-
|
1708 |
-
}
|
1709 |
-
|
1710 |
}
|
1711 |
}
|
1712 |
|
1713 |
// [/addons import]
|
1714 |
$logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_saved_post', 'wp_all_import_plugin'));
|
1715 |
-
do_action( 'pmxi_saved_post', $pid); // hook that was triggered immediately after post saved
|
1716 |
|
1717 |
if (empty($articleData['ID'])) $created++; else $updated++;
|
1718 |
|
@@ -1799,10 +1881,10 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1799 |
// Remove attachments
|
1800 |
empty($this->options['is_keep_attachments']) and wp_delete_attachments($id, true, 'files');
|
1801 |
// Remove images
|
1802 |
-
empty($this->options['is_keep_imgs']) and wp_delete_attachments($id,
|
1803 |
|
1804 |
// Clear post's relationships
|
1805 |
-
if ( $post_type != "import_users" ) wp_delete_object_term_relationships($id, get_object_taxonomies('' != $this->options['custom_type'] ? $this->options['custom_type'] : 'post'));
|
1806 |
|
1807 |
}
|
1808 |
else{
|
@@ -1845,7 +1927,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1845 |
}
|
1846 |
|
1847 |
// Set out of stock status for missing records [Woocommerce add-on option]
|
1848 |
-
if ( $is_import_complete and empty($this->options['is_delete_missing']) and $post_type == "product" and class_exists('PMWI_Plugin') and !empty($this->options['missing_records_stock_status'])) {
|
1849 |
|
1850 |
$logger and call_user_func($logger, __('Update stock status previously imported posts which are no longer actual...', 'wp_all_import_plugin'));
|
1851 |
$postList = new PMXI_Post_List();
|
@@ -1962,7 +2044,9 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1962 |
protected function associate_terms($pid, $assign_taxes, $tx_name, $logger, $is_cron = false){
|
1963 |
|
1964 |
$terms = wp_get_object_terms( $pid, $tx_name );
|
1965 |
-
$term_ids = array();
|
|
|
|
|
1966 |
|
1967 |
if ( ! empty($terms) ){
|
1968 |
if ( ! is_wp_error( $terms ) ) {
|
@@ -2011,7 +2095,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2011 |
// Remove attachments
|
2012 |
empty($this->options['is_keep_attachments']) and wp_delete_attachments($p->post_id, true, 'files');
|
2013 |
// Remove images
|
2014 |
-
empty($this->options['is_keep_imgs']) and wp_delete_attachments($p->post_id,
|
2015 |
$ids[] = $p->post_id;
|
2016 |
}
|
2017 |
|
18 |
|
19 |
$xml = preg_replace_callback('/<!\[CDATA\[[^\]\]>]*\]\]>/s', 'wp_all_import_cdata_filter', $xml );
|
20 |
|
21 |
+
$xml = str_replace("&", "&", str_replace("&","&", $xml));
|
22 |
+
|
23 |
if ( ! empty(self::$cdata) ){
|
24 |
foreach (self::$cdata as $key => $val) {
|
25 |
$xml = str_replace('{{CPLACE_' . ($key + 1) . '}}', $val, $xml);
|
174 |
else{
|
175 |
count($titles) and $page_template = array_fill(0, count($titles), 'default');
|
176 |
}
|
177 |
+
}
|
178 |
+
|
179 |
+
if ( $this->options['is_override_post_type'] and ! empty($this->options['post_type_xpath']) ){
|
180 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing post types...', 'wp_all_import_plugin'));
|
181 |
+
$post_type = array();
|
182 |
+
$post_type = XmlImportParser::factory($xml, $cxpath, $this->options['post_type_xpath'], $file)->parse($records); $tmp_files[] = $file;
|
183 |
+
}
|
184 |
+
else{
|
185 |
+
if ('post' == $this->options['type'] and '' != $this->options['custom_type']) {
|
186 |
+
$pType = $this->options['custom_type'];
|
187 |
+
} else {
|
188 |
+
$pType = $this->options['type'];
|
189 |
+
}
|
190 |
+
count($titles) and $post_type = array_fill(0, count($titles), $pType);
|
191 |
}
|
192 |
|
193 |
if ( "no" == $this->options['is_multiple_page_parent'] ){
|
196 |
if (!empty($this->options['single_page_parent'])){
|
197 |
$page_parent = XmlImportParser::factory($xml, $cxpath, $this->options['single_page_parent'], $file)->parse($records); $tmp_files[] = $file;
|
198 |
foreach ($page_parent as $key => $identity) {
|
199 |
+
|
200 |
+
$page = 0;
|
201 |
+
switch ($this->options['type']) {
|
202 |
+
|
203 |
+
case 'post':
|
204 |
+
|
205 |
+
if ( ! empty($identity) ){
|
206 |
+
|
207 |
+
if (ctype_digit($identity)){
|
208 |
+
$page = get_post($identity);
|
209 |
+
}
|
210 |
+
else
|
211 |
+
{
|
212 |
+
$page = get_page_by_title($identity, OBJECT, $post_type[$key]);
|
213 |
+
|
214 |
+
if ( empty($page) ){
|
215 |
+
$args = array(
|
216 |
+
'name' => $identity,
|
217 |
+
'post_type' => $post_type[$key],
|
218 |
+
'post_status' => 'any',
|
219 |
+
'numberposts' => 1
|
220 |
+
);
|
221 |
+
$my_posts = get_posts($args);
|
222 |
+
if ( $my_posts ) {
|
223 |
+
$page = $my_posts[0];
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
}
|
228 |
+
|
229 |
+
}
|
230 |
+
|
231 |
+
break;
|
232 |
+
|
233 |
+
case 'page':
|
234 |
+
|
235 |
+
$page = get_page_by_title($identity) or $page = get_page_by_path($identity) or ctype_digit($identity) and $page = get_post($identity);
|
236 |
+
|
237 |
+
break;
|
238 |
+
|
239 |
+
default:
|
240 |
+
# code...
|
241 |
+
break;
|
242 |
+
}
|
243 |
+
|
244 |
$page_parent[$key] = (!empty($page)) ? $page->ID : 0;
|
245 |
+
|
246 |
+
|
247 |
}
|
248 |
}
|
249 |
else{
|
344 |
$tx_name = $ctx->name;
|
345 |
$mapping_rules = ( ! empty($this->options['tax_mapping'][$tx_name])) ? json_decode($this->options['tax_mapping'][$tx_name], true) : false;
|
346 |
$taxonomies[$tx_name] = array();
|
347 |
+
if ( ! empty($this->options['tax_logic'][$tx_name]) and ! empty($this->options['tax_assing'][$tx_name]) ){
|
348 |
switch ($this->options['tax_logic'][$tx_name]){
|
349 |
case 'single':
|
350 |
if ( ! empty($this->options['tax_single_xpath'][$tx_name]) ){
|
467 |
), $mapping_rules, $tx_name);
|
468 |
$iterator[$i]++;
|
469 |
}
|
470 |
+
}
|
471 |
}
|
472 |
+
}
|
473 |
}
|
474 |
}
|
475 |
if ( ! empty($this->options['tax_hierarchical_logic_manual'][$tx_name])){
|
482 |
|
483 |
foreach ($txes_raw as $i => $cc) {
|
484 |
|
485 |
+
$_tx = $cc;
|
486 |
+
// apply mapping rules before splitting via separator symbol
|
487 |
+
if ( ! empty($this->options['tax_enable_mapping'][$tx_name]) and ! empty($this->options['tax_logic_mapping'][$tx_name]) ){
|
488 |
+
if ( ! empty( $mapping_rules) ){
|
489 |
+
foreach ($mapping_rules as $rule) {
|
490 |
+
if ( ! empty($rule[trim($_tx)])){
|
491 |
+
$_tx = trim($rule[trim($_tx)]);
|
492 |
+
break;
|
493 |
+
}
|
494 |
+
}
|
495 |
+
}
|
496 |
+
}
|
497 |
+
|
498 |
if ( ! empty($this->options['tax_manualhierarchy_delim'][$tx_name])){
|
499 |
+
$delimeted_taxonomies = explode($this->options['tax_manualhierarchy_delim'][$tx_name], $_tx);
|
500 |
}
|
501 |
|
502 |
if ( empty($delimeted_taxonomies) ) continue;
|
515 |
'name' => trim($dc),
|
516 |
'parent' => $parent,
|
517 |
'assign' => (isset($taxonomy['assign'])) ? $taxonomy['assign'] : true,
|
518 |
+
'is_mapping' => (!empty($this->options['tax_enable_mapping'][$tx_name]) and empty($this->options['tax_logic_mapping'][$tx_name])),
|
519 |
'hierarchy_level' => 1,
|
520 |
'max_hierarchy_level' => 1
|
521 |
), $mapping_rules, $tx_name);
|
528 |
'name' => trim($dc),
|
529 |
'parent' => false,
|
530 |
'assign' => (isset($taxonomy['assign'])) ? $taxonomy['assign'] : true,
|
531 |
+
'is_mapping' => (!empty($this->options['tax_enable_mapping'][$tx_name]) and empty($this->options['tax_logic_mapping'][$tx_name])),
|
532 |
'hierarchy_level' => 1,
|
533 |
'max_hierarchy_level' => 1
|
534 |
), $mapping_rules, $tx_name);
|
549 |
}
|
550 |
endforeach;
|
551 |
endif;
|
552 |
+
// [/custom taxonomies]
|
553 |
|
554 |
// Composing featured images
|
555 |
if ( ! (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
|
685 |
count($titles) and $unique_keys = array_fill(0, count($titles), '');
|
686 |
}
|
687 |
|
688 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Processing posts...', 'wp_all_import_plugin'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
689 |
|
690 |
$addons = array();
|
691 |
$addons_data = array();
|
698 |
'xml' => $xml,
|
699 |
'logger' => $logger,
|
700 |
'chunk' => $chunk,
|
701 |
+
'xpath_prefix' => $xpath_prefix
|
702 |
+
);
|
703 |
|
704 |
$parse_functions = apply_filters('wp_all_import_addon_parse', array());
|
705 |
|
709 |
$addons[$class] = new $model_class();
|
710 |
$addons_data[$class] = ( method_exists($addons[$class], 'parse') ) ? $addons[$class]->parse($parsingData) : false;
|
711 |
}
|
712 |
+
else
|
713 |
+
{
|
714 |
if ( ! empty($parse_functions[$class]) ){
|
715 |
|
716 |
if ( is_array($parse_functions[$class]) and is_callable($parse_functions[$class]) or ! is_array($parse_functions[$class]) and function_exists($parse_functions[$class]) ){
|
739 |
}
|
740 |
}
|
741 |
|
742 |
+
}
|
743 |
+
|
744 |
+
$simpleXml = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
|
745 |
+
|
746 |
+
$rootNodes = $simpleXml->xpath($cxpath);
|
747 |
|
748 |
foreach ($titles as $i => $void) {
|
749 |
|
750 |
+
$custom_type_details = get_post_type_object( $post_type[$i] );
|
751 |
+
|
752 |
if ($is_cron and $cron_sleep) sleep($cron_sleep);
|
753 |
|
754 |
$logger and call_user_func($logger, __('---', 'wp_all_import_plugin'));
|
788 |
}
|
789 |
else {
|
790 |
$articleData = array(
|
791 |
+
'post_type' => $post_type[$i],
|
792 |
'post_status' => ("xpath" == $this->options['status']) ? $post_status[$i] : $this->options['status'],
|
793 |
'comment_status' => ("xpath" == $this->options['comment_status']) ? $comment_status[$i] : $this->options['comment_status'],
|
794 |
'ping_status' => ("xpath" == $this->options['ping_status']) ? $ping_status[$i] : $this->options['ping_status'],
|
881 |
if ($post_to_update){
|
882 |
|
883 |
$continue_import = true;
|
884 |
+
|
885 |
+
$continue_import = apply_filters('wp_all_import_is_post_to_update', $post_to_update_id, wp_all_import_xml2array($rootNodes[$i]));
|
886 |
|
887 |
if ( ! $continue_import ){
|
888 |
|
920 |
if ( ! in_array($this->options['custom_type'], array('import_users'))){
|
921 |
|
922 |
// preserve date of already existing article when duplicate is found
|
923 |
+
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")) {
|
924 |
$logger and call_user_func($logger, sprintf(__('Preserve taxonomies of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
925 |
$existing_taxonomies = array();
|
926 |
foreach (array_keys($taxonomies) as $tx_name) {
|
1007 |
// handle obsolete attachments (i.e. delete or keep) according to import settings
|
1008 |
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")){
|
1009 |
$logger and call_user_func($logger, sprintf(__('Deleting images for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
1010 |
+
wp_delete_attachments($articleData['ID'], true, 'images');
|
1011 |
}
|
1012 |
|
1013 |
}
|
1017 |
// existing post not found though it's track was found... clear the leftover, plugin will continue to treat record as new
|
1018 |
$postRecord->clear();
|
1019 |
|
1020 |
+
}
|
1021 |
|
1022 |
// no new records are created. it will only update posts it finds matching duplicates for
|
1023 |
+
if ( ! $this->options['create_new_records'] and empty($articleData['ID']) ){
|
1024 |
|
1025 |
if ( ! $postRecord->isEmpty() ) $postRecord->set(array('iteration' => $this->iteration))->update();
|
1026 |
|
1111 |
|
1112 |
// insert article being imported
|
1113 |
if ($this->options['is_fast_mode']){
|
1114 |
+
foreach (array('transition_post_status', 'save_post', 'pre_post_update', 'add_attachment', 'edit_attachment', 'edit_post', 'post_updated', 'wp_insert_post', 'save_post_' . $post_type[$i]) as $act) {
|
1115 |
remove_all_actions($act);
|
1116 |
}
|
1117 |
}
|
1142 |
'post_id' => $pid,
|
1143 |
'import_id' => $this->id,
|
1144 |
'unique_key' => $unique_keys[$i],
|
1145 |
+
'product_key' => (($post_type[$i] == "product" and PMXI_Admin_Addons::get_addon('PMWI_Plugin')) ? $addons_data['PMWI_Plugin']['single_product_ID'][$i] : '')
|
1146 |
))->insert();
|
1147 |
|
1148 |
$postRecord->set(array('iteration' => $this->iteration))->update();
|
1151 |
}
|
1152 |
|
1153 |
// [post format]
|
1154 |
+
if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type[$i], 'post-formats' ) ){
|
1155 |
set_post_format($pid, $this->options['post_format'] );
|
1156 |
$logger and call_user_func($logger, sprintf(__('Associate post `%s` with post format %s ...', 'wp_all_import_plugin'), $articleData['post_title'], (!empty($this->options['post_format'])) ? $this->options['post_format'] : 'Standart'));
|
1157 |
}
|
1158 |
+
// [/post format]
|
|
|
1159 |
|
1160 |
// [addons import]
|
1161 |
|
1168 |
'xml' => $xml,
|
1169 |
'is_cron' => $is_cron,
|
1170 |
'logger' => $logger,
|
1171 |
+
'xpath_prefix' => $xpath_prefix,
|
1172 |
+
'post_type' => $post_type[$i]
|
1173 |
);
|
1174 |
|
1175 |
$import_functions = apply_filters('wp_all_import_addon_import', array());
|
1179 |
if (class_exists($class)){
|
1180 |
if ( method_exists($addons[$class], 'import') ) $addons[$class]->import($importData);
|
1181 |
}
|
1182 |
+
else
|
1183 |
+
{
|
1184 |
if ( ! empty($import_functions[$class]) ){
|
1185 |
|
1186 |
if ( is_array($import_functions[$class]) and is_callable($import_functions[$class]) or ! is_array($import_functions[$class]) and function_exists($import_functions[$class]) ){
|
1187 |
|
1188 |
call_user_func($import_functions[$class], $importData, $addons_data[$class]);
|
1189 |
+
}
|
|
|
1190 |
}
|
|
|
1191 |
}
|
1192 |
}
|
1193 |
|
1194 |
// [/addons import]
|
1195 |
|
1196 |
// Page Template
|
1197 |
+
if ('page' == $articleData['post_type'] and wp_all_import_is_update_cf('_wp_page_template', $this->options) and ( !empty($this->options['page_template']) or "no" == $this->options['is_multiple_page_template']) ){
|
1198 |
update_post_meta($pid, '_wp_page_template', ("no" == $this->options['is_multiple_page_template']) ? $page_template[$i] : $this->options['page_template']);
|
1199 |
}
|
1200 |
|
1201 |
// [featured image]
|
1202 |
+
if ( ! empty($uploads) and false === $uploads['error'] and (empty($articleData['ID']) or $this->options['update_all_data'] == "yes" or ( $this->options['update_all_data'] == "no" and $this->options['is_update_images']))) {
|
1203 |
|
1204 |
if (!empty($featured_images[$i])){
|
1205 |
|
1235 |
|
1236 |
$attachment_imgs = get_attached_media( 'image', $pid );
|
1237 |
|
1238 |
+
if ( $post_type[$i] == "product" )
|
1239 |
$gallery_attachment_ids = array_filter(explode(",", get_post_meta($pid, '_product_image_gallery', true)));
|
1240 |
|
1241 |
if ( $attachment_imgs ) {
|
1295 |
|
1296 |
foreach ($imgs as $k => $img_url) { if (empty($img_url)) continue;
|
1297 |
|
1298 |
+
$attid = false;
|
1299 |
+
|
1300 |
+
$attch = null;
|
1301 |
|
1302 |
$url = str_replace(" ", "%20", trim($img_url));
|
1303 |
+
$bn = basename($url);
|
1304 |
|
1305 |
if ( "yes" == $this->options['download_images'] and ! empty($auto_extensions[$i]) and preg_match('%^(jpg|jpeg|png|gif)$%i', $auto_extensions[$i])){
|
1306 |
$img_ext = $auto_extensions[$i];
|
1341 |
else {
|
1342 |
|
1343 |
$image_filename = wp_unique_filename($targetDir, $image_name);
|
1344 |
+
$image_filepath = $targetDir . '/' . $image_filename;
|
|
|
|
|
1345 |
|
1346 |
// keep existing and add newest images
|
1347 |
if ( ! empty($articleData['ID']) and $this->options['is_update_images'] and $this->options['update_images_logic'] == "add_new" and $this->options['update_all_data'] == "no"){
|
1495 |
|
1496 |
if ($attid){
|
1497 |
|
1498 |
+
if ($attch != null and empty($attch->post_parent)){
|
1499 |
+
wp_update_post(
|
1500 |
+
array(
|
1501 |
+
'ID' => $attch->ID,
|
1502 |
+
'post_parent' => $pid
|
1503 |
+
)
|
1504 |
+
);
|
1505 |
+
}
|
1506 |
+
|
1507 |
$logger and call_user_func($logger, __('- <b>ACTION</b>: pmxi_gallery_image', 'wp_all_import_plugin'));
|
1508 |
do_action( 'pmxi_gallery_image', $pid, $attid, $image_filepath);
|
1509 |
|
1523 |
}
|
1524 |
}
|
1525 |
// Set product gallery images
|
1526 |
+
if ( $post_type[$i] == "product" )
|
1527 |
update_post_meta($pid, '_product_image_gallery', (!empty($gallery_attachment_ids)) ? implode(',', $gallery_attachment_ids) : '');
|
1528 |
// Create entry as Draft if no images are downloaded successfully
|
1529 |
if ( ! $success_images and "yes" == $this->options['create_draft'] ) {
|
1641 |
// [custom taxonomies]
|
1642 |
if ( ! empty($taxonomies) ){
|
1643 |
|
1644 |
+
$logger and call_user_func($logger, __('<b>TAXONOMIES:</b>', 'wp_all_import_plugin'));
|
|
|
|
|
1645 |
|
1646 |
foreach ($taxonomies as $tx_name => $txes) {
|
1647 |
|
1659 |
if (!empty($articleData['ID'])){
|
1660 |
if ($this->options['update_all_data'] == "no" and $this->options['update_categories_logic'] == "all_except" and !empty($this->options['taxonomies_list'])
|
1661 |
and is_array($this->options['taxonomies_list']) and in_array($tx_name, $this->options['taxonomies_list'])){
|
1662 |
+
$logger and call_user_func($logger, sprintf(__('- %s %s `%s` has been skipped attempted to `Leave these taxonomies alone, update all others`...', 'wp_all_import_plugin'), $custom_type_details->labels->singular_name, $tx_name, $single_tax['name']));
|
1663 |
continue;
|
1664 |
}
|
1665 |
if ($this->options['update_all_data'] == "no" and $this->options['update_categories_logic'] == "only" and ((!empty($this->options['taxonomies_list'])
|
1666 |
and is_array($this->options['taxonomies_list']) and ! in_array($tx_name, $this->options['taxonomies_list'])) or empty($this->options['taxonomies_list']))){
|
1667 |
+
$logger and call_user_func($logger, sprintf(__('- %s %s `%s` has been skipped attempted to `Update only these taxonomies, leave the rest alone`...', 'wp_all_import_plugin'), $custom_type_details->labels->singular_name, $tx_name, $single_tax['name']));
|
1668 |
continue;
|
1669 |
}
|
1670 |
}
|
1701 |
if ( ! is_wp_error($term) ){
|
1702 |
$is_created_term = true;
|
1703 |
if ( empty($parent_id) ){
|
1704 |
+
$logger and call_user_func($logger, sprintf(__('- Creating parent %s %s `%s` ...', 'wp_all_import_plugin'), $custom_type_details->labels->singular_name, $tx_name, $single_tax['name']));
|
1705 |
}
|
1706 |
else{
|
1707 |
+
$logger and call_user_func($logger, sprintf(__('- Creating child %s %s for %s named `%s` ...', 'wp_all_import_plugin'), $custom_type_details->labels->singular_name, $tx_name, (is_array($single_tax['parent']) ? $single_tax['parent']['name'] : $single_tax['parent']), $single_tax['name']));
|
1708 |
}
|
1709 |
}
|
1710 |
}
|
1722 |
if (!in_array($term->slug, $assign_taxes)) $assign_taxes[] = $term->term_taxonomy_id;
|
1723 |
if (!$is_created_term){
|
1724 |
if ( empty($parent_id) ){
|
1725 |
+
$logger and call_user_func($logger, sprintf(__('- Attempted to create parent %s %s `%s`, duplicate detected. Importing %s to existing `%s` %s, ID %d, slug `%s` ...', 'wp_all_import_plugin'), $custom_type_details->labels->singular_name, $tx_name, $single_tax['name'], $custom_type_details->labels->singular_name, $term->name, $tx_name, $term->term_id, $term->slug));
|
1726 |
}
|
1727 |
else{
|
1728 |
+
$logger and call_user_func($logger, sprintf(__('- Attempted to create child %s %s `%s`, duplicate detected. Importing %s to existing `%s` %s, ID %d, slug `%s` ...', 'wp_all_import_plugin'), $custom_type_details->labels->singular_name, $tx_name, $single_tax['name'], $custom_type_details->labels->singular_name, $term->name, $tx_name, $term->term_id, $term->slug));
|
1729 |
}
|
1730 |
}
|
1731 |
}
|
1738 |
$this->associate_terms($pid, ( empty($assign_taxes) ? false : $assign_taxes ), $tx_name, $logger, $is_cron);
|
1739 |
|
1740 |
}
|
1741 |
+
else
|
1742 |
+
{
|
1743 |
+
$logger and call_user_func($logger, sprintf(__('- %s %s `%s` has been skipped attempted to `Do not update Taxonomies (incl. Categories and Tags)`...', 'wp_all_import_plugin'), $custom_type_details->labels->singular_name, $tx_name, $single_tax['name']));
|
1744 |
+
}
|
1745 |
}
|
1746 |
+
if ( $this->options['update_all_data'] == "no" and ( ($this->options['is_update_categories'] and $this->options['update_categories_logic'] != 'full_update') or ( ! $this->options['is_update_categories'] and ( is_object_in_taxonomy( $post_type[$i], 'category' ) or is_object_in_taxonomy( $post_type[$i], 'post_tag' ) ) ) ) ) {
|
1747 |
|
1748 |
+
if ( ! empty($existing_taxonomies) ){
|
1749 |
+
foreach ($existing_taxonomies as $tx_name => $txes) {
|
1750 |
+
// Skip updating product attributes
|
1751 |
+
if ( PMXI_Admin_Addons::get_addon('PMWI_Plugin') and strpos($tx_name, "pa_") === 0 ) continue;
|
1752 |
|
1753 |
+
if (!empty($txes[$i]))
|
1754 |
+
$this->associate_terms($pid, $txes[$i], $tx_name, $logger, $is_cron);
|
1755 |
+
}
|
1756 |
}
|
1757 |
}
|
1758 |
}
|
1770 |
$importData = array(
|
1771 |
'pid' => $pid,
|
1772 |
'import' => $this,
|
1773 |
+
'logger' => $logger
|
1774 |
);
|
1775 |
|
1776 |
$saved_functions = apply_filters('wp_all_import_addon_saved_post', array());
|
1780 |
if (class_exists($class)){
|
1781 |
if ( method_exists($addons[$class], 'saved_post') ) $addons[$class]->saved_post($importData);
|
1782 |
}
|
1783 |
+
else
|
1784 |
+
{
|
1785 |
if ( ! empty($saved_functions[$class]) ){
|
1786 |
|
1787 |
if ( is_array($saved_functions[$class]) and is_callable($saved_functions[$class]) or ! is_array($saved_functions[$class]) and function_exists($saved_functions[$class]) ){
|
1788 |
|
1789 |
call_user_func($saved_functions[$class], $importData);
|
1790 |
+
}
|
1791 |
+
}
|
|
|
|
|
1792 |
}
|
1793 |
}
|
1794 |
|
1795 |
// [/addons import]
|
1796 |
$logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_saved_post', 'wp_all_import_plugin'));
|
1797 |
+
do_action( 'pmxi_saved_post', $pid, $rootNodes[$i]); // hook that was triggered immediately after post saved
|
1798 |
|
1799 |
if (empty($articleData['ID'])) $created++; else $updated++;
|
1800 |
|
1881 |
// Remove attachments
|
1882 |
empty($this->options['is_keep_attachments']) and wp_delete_attachments($id, true, 'files');
|
1883 |
// Remove images
|
1884 |
+
empty($this->options['is_keep_imgs']) and wp_delete_attachments($id, true);
|
1885 |
|
1886 |
// Clear post's relationships
|
1887 |
+
if ( $post_type[$i] != "import_users" ) wp_delete_object_term_relationships($id, get_object_taxonomies('' != $this->options['custom_type'] ? $this->options['custom_type'] : 'post'));
|
1888 |
|
1889 |
}
|
1890 |
else{
|
1927 |
}
|
1928 |
|
1929 |
// Set out of stock status for missing records [Woocommerce add-on option]
|
1930 |
+
if ( $is_import_complete and empty($this->options['is_delete_missing']) and $post_type[$i] == "product" and class_exists('PMWI_Plugin') and !empty($this->options['missing_records_stock_status'])) {
|
1931 |
|
1932 |
$logger and call_user_func($logger, __('Update stock status previously imported posts which are no longer actual...', 'wp_all_import_plugin'));
|
1933 |
$postList = new PMXI_Post_List();
|
2044 |
protected function associate_terms($pid, $assign_taxes, $tx_name, $logger, $is_cron = false){
|
2045 |
|
2046 |
$terms = wp_get_object_terms( $pid, $tx_name );
|
2047 |
+
$term_ids = array();
|
2048 |
+
|
2049 |
+
$assign_taxes = (is_array($assign_taxes)) ? array_filter($assign_taxes) : false;
|
2050 |
|
2051 |
if ( ! empty($terms) ){
|
2052 |
if ( ! is_wp_error( $terms ) ) {
|
2095 |
// Remove attachments
|
2096 |
empty($this->options['is_keep_attachments']) and wp_delete_attachments($p->post_id, true, 'files');
|
2097 |
// Remove images
|
2098 |
+
empty($this->options['is_keep_imgs']) and wp_delete_attachments($p->post_id, true);
|
2099 |
$ids[] = $p->post_id;
|
2100 |
}
|
2101 |
|
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.2.
|
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.2.
|
29 |
|
30 |
define('PMXI_EDITION', 'free');
|
31 |
|
@@ -328,7 +328,7 @@ final class PMXI_Plugin {
|
|
328 |
|
329 |
$commit_migration = true;
|
330 |
|
331 |
-
if ( empty($is_migrated) ){ // plugin version less than
|
332 |
|
333 |
wp_all_import_rmdir($uploads['basedir'] . '/wpallimport_history');
|
334 |
wp_all_import_rmdir($uploads['basedir'] . '/wpallimport_logs');
|
@@ -381,7 +381,7 @@ final class PMXI_Plugin {
|
|
381 |
|
382 |
}
|
383 |
|
384 |
-
$commit_migration = $this->__fix_db_schema(); // feature to version
|
385 |
|
386 |
}
|
387 |
else {
|
@@ -389,10 +389,13 @@ final class PMXI_Plugin {
|
|
389 |
// migration fixes for vesions
|
390 |
switch ($is_migrated) {
|
391 |
|
392 |
-
case '
|
393 |
-
case '
|
|
|
|
|
|
|
394 |
|
395 |
-
$commit_migration = $this->__fix_db_schema(); // feature to version
|
396 |
|
397 |
break;
|
398 |
|
@@ -446,7 +449,7 @@ final class PMXI_Plugin {
|
|
446 |
}
|
447 |
|
448 |
public function __ver_4_transition_fix( &$options ){
|
449 |
-
|
450 |
$options['wizard_type'] = ($options['duplicate_matching'] == 'auto') ? 'new' : 'matching';
|
451 |
|
452 |
if ($options['download_images']){
|
@@ -570,6 +573,9 @@ final class PMXI_Plugin {
|
|
570 |
$actionName = str_replace('-', '_', $action);
|
571 |
if (method_exists($controllerName, $actionName)) {
|
572 |
|
|
|
|
|
|
|
573 |
if ( ! get_current_user_id() or ! current_user_can('manage_options')) {
|
574 |
// This nonce is not valid.
|
575 |
die( 'Security check' );
|
@@ -612,8 +618,6 @@ final class PMXI_Plugin {
|
|
612 |
|
613 |
}
|
614 |
|
615 |
-
add_filter('plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
|
616 |
-
|
617 |
}
|
618 |
|
619 |
/**
|
@@ -860,7 +864,7 @@ final class PMXI_Plugin {
|
|
860 |
|
861 |
if ( ! empty($fields_to_alter) ){
|
862 |
|
863 |
-
if (empty($grands)) return false;
|
864 |
|
865 |
foreach ($fields_to_alter as $field) {
|
866 |
switch ($field) {
|
@@ -956,6 +960,9 @@ final class PMXI_Plugin {
|
|
956 |
public static function get_default_import_options() {
|
957 |
return array(
|
958 |
'type' => 'post',
|
|
|
|
|
|
|
959 |
'wizard_type' => 'new',
|
960 |
'custom_type' => '',
|
961 |
'featured_delim' => ',',
|
@@ -1063,6 +1070,7 @@ final class PMXI_Plugin {
|
|
1063 |
'is_fast_mode' => 0,
|
1064 |
'chuncking' => 1,
|
1065 |
'import_processing' => 'ajax',
|
|
|
1066 |
|
1067 |
'title' => '',
|
1068 |
'content' => '',
|
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.2.8
|
7 |
Author: Soflyy
|
8 |
*/
|
9 |
|
25 |
*/
|
26 |
define('WP_ALL_IMPORT_PREFIX', 'pmxi_');
|
27 |
|
28 |
+
define('PMXI_VERSION', '3.2.8');
|
29 |
|
30 |
define('PMXI_EDITION', 'free');
|
31 |
|
328 |
|
329 |
$commit_migration = true;
|
330 |
|
331 |
+
if ( empty($is_migrated) ){ // plugin version less than 4.0.0
|
332 |
|
333 |
wp_all_import_rmdir($uploads['basedir'] . '/wpallimport_history');
|
334 |
wp_all_import_rmdir($uploads['basedir'] . '/wpallimport_logs');
|
381 |
|
382 |
}
|
383 |
|
384 |
+
$commit_migration = $this->__fix_db_schema(); // feature to version 4.0.0
|
385 |
|
386 |
}
|
387 |
else {
|
389 |
// migration fixes for vesions
|
390 |
switch ($is_migrated) {
|
391 |
|
392 |
+
case '4.0.0-beta1':
|
393 |
+
case '4.0.0-beta2':
|
394 |
+
case '4.0.0 RC1':
|
395 |
+
case '4.0.0':
|
396 |
+
case '4.0.1':
|
397 |
|
398 |
+
$commit_migration = $this->__fix_db_schema(); // feature to version 4.0.0
|
399 |
|
400 |
break;
|
401 |
|
449 |
}
|
450 |
|
451 |
public function __ver_4_transition_fix( &$options ){
|
452 |
+
|
453 |
$options['wizard_type'] = ($options['duplicate_matching'] == 'auto') ? 'new' : 'matching';
|
454 |
|
455 |
if ($options['download_images']){
|
573 |
$actionName = str_replace('-', '_', $action);
|
574 |
if (method_exists($controllerName, $actionName)) {
|
575 |
|
576 |
+
@ini_set("max_input_time", PMXI_Plugin::getInstance()->getOption('max_input_time'));
|
577 |
+
@ini_set("max_execution_time", PMXI_Plugin::getInstance()->getOption('max_execution_time'));
|
578 |
+
|
579 |
if ( ! get_current_user_id() or ! current_user_can('manage_options')) {
|
580 |
// This nonce is not valid.
|
581 |
die( 'Security check' );
|
618 |
|
619 |
}
|
620 |
|
|
|
|
|
621 |
}
|
622 |
|
623 |
/**
|
864 |
|
865 |
if ( ! empty($fields_to_alter) ){
|
866 |
|
867 |
+
if (empty($grands)) return false;
|
868 |
|
869 |
foreach ($fields_to_alter as $field) {
|
870 |
switch ($field) {
|
960 |
public static function get_default_import_options() {
|
961 |
return array(
|
962 |
'type' => 'post',
|
963 |
+
'is_override_post_type' => 0,
|
964 |
+
'post_type_xpath' => '',
|
965 |
+
'deligate' => '',
|
966 |
'wizard_type' => 'new',
|
967 |
'custom_type' => '',
|
968 |
'featured_delim' => ',',
|
1070 |
'is_fast_mode' => 0,
|
1071 |
'chuncking' => 1,
|
1072 |
'import_processing' => 'ajax',
|
1073 |
+
'save_template_as' => 0,
|
1074 |
|
1075 |
'title' => '',
|
1076 |
'content' => '',
|
readme.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
=== Import any XML or CSV File to WordPress ===
|
2 |
Contributors: soflyy, wpallimport
|
3 |
Requires at least: 3.6.1
|
4 |
-
Tested up to: 4.
|
5 |
-
Stable tag: 3.2.
|
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.
|
@@ -103,6 +103,14 @@ Does it work with special character encoding like Hebrew, Arabic, Chinese, etc?
|
|
103 |
|
104 |
== Changelog ==
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
= 3.2.7 =
|
107 |
* fixed enum fields mapping rules feature
|
108 |
|
1 |
=== Import any XML or CSV File to WordPress ===
|
2 |
Contributors: soflyy, wpallimport
|
3 |
Requires at least: 3.6.1
|
4 |
+
Tested up to: 4.2.2
|
5 |
+
Stable tag: 3.2.8
|
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.
|
103 |
|
104 |
== Changelog ==
|
105 |
|
106 |
+
= 3.2.8 =
|
107 |
+
* fixed Apply mapping rules before splitting via separator symbol for manual hierarchy
|
108 |
+
* fixed path equal or less than
|
109 |
+
* fixed changing unique key when moving back from confirm screen
|
110 |
+
* fixed override page template
|
111 |
+
* updated wp_all_import_is_post_to_update filter with second argument XML node as array
|
112 |
+
* added a second argument to pmxi_saved_post action ( SimpleXML object ) of current record
|
113 |
+
|
114 |
= 3.2.7 =
|
115 |
* fixed enum fields mapping rules feature
|
116 |
|
static/css/admin.css
CHANGED
@@ -532,6 +532,9 @@
|
|
532 |
font-size: 1.3em;
|
533 |
text-decoration: underline !important;
|
534 |
}
|
|
|
|
|
|
|
535 |
/*--------------------------------------------------------------------------
|
536 |
*
|
537 |
* Helpers
|
@@ -1885,7 +1888,8 @@
|
|
1885 |
line-height: 25px;
|
1886 |
width: 68% !important;
|
1887 |
}
|
1888 |
-
.wpallimport-plugin .wpallimport-custom-fields .wpallimport-custom-fields-actions
|
|
|
1889 |
float: right;
|
1890 |
right: 30px;
|
1891 |
position: relative;
|
@@ -2058,6 +2062,7 @@
|
|
2058 |
.wpallimport-plugin .post_taxonomy{
|
2059 |
/*margin-bottom: 15px;*/
|
2060 |
overflow: hidden;
|
|
|
2061 |
/*padding-bottom: 15px;*/
|
2062 |
}
|
2063 |
.wpallimport-plugin .post_taxonomy .delim{
|
@@ -2196,8 +2201,8 @@
|
|
2196 |
border: 0px;
|
2197 |
}
|
2198 |
.wpallimport-plugin .wpallimport-not-empty{
|
2199 |
-
display: block;
|
2200 |
-
padding: 5px
|
2201 |
}
|
2202 |
/*--------------------------------------------------------------------------
|
2203 |
*
|
532 |
font-size: 1.3em;
|
533 |
text-decoration: underline !important;
|
534 |
}
|
535 |
+
.wpallimport-plugin .wpallimport-delete-posts-warning{
|
536 |
+
display: none;
|
537 |
+
}
|
538 |
/*--------------------------------------------------------------------------
|
539 |
*
|
540 |
* Helpers
|
1888 |
line-height: 25px;
|
1889 |
width: 68% !important;
|
1890 |
}
|
1891 |
+
.wpallimport-plugin .wpallimport-custom-fields .wpallimport-custom-fields-actions,
|
1892 |
+
.wpallimport-plugin .wpallimport-real-estate .wpallimport-custom-fields-actions{
|
1893 |
float: right;
|
1894 |
right: 30px;
|
1895 |
position: relative;
|
2062 |
.wpallimport-plugin .post_taxonomy{
|
2063 |
/*margin-bottom: 15px;*/
|
2064 |
overflow: hidden;
|
2065 |
+
padding-left: 5px;
|
2066 |
/*padding-bottom: 15px;*/
|
2067 |
}
|
2068 |
.wpallimport-plugin .post_taxonomy .delim{
|
2201 |
border: 0px;
|
2202 |
}
|
2203 |
.wpallimport-plugin .wpallimport-not-empty{
|
2204 |
+
/*display: block;
|
2205 |
+
padding: 5px;*/
|
2206 |
}
|
2207 |
/*--------------------------------------------------------------------------
|
2208 |
*
|
static/js/admin.js
CHANGED
@@ -53,19 +53,20 @@
|
|
53 |
|
54 |
// swither show/hide logic
|
55 |
$('input.switcher-horizontal').live('change', function (e) {
|
56 |
-
|
57 |
-
if ($(this).is(':
|
58 |
-
$(this).parents('form').find('input.switcher-horizontal
|
59 |
}
|
60 |
var $targets = $('.switcher-target-' + $(this).attr('id'));
|
61 |
|
62 |
var is_show = $(this).is(':checked'); if ($(this).is('.switcher-reversed')) is_show = ! is_show;
|
|
|
63 |
if (is_show) {
|
64 |
-
$targets.animate({width:'
|
65 |
} else {
|
66 |
-
$targets.animate({width:'
|
67 |
}
|
68 |
-
}).change();
|
69 |
|
70 |
// autoselect input content on click
|
71 |
$('input.selectable').live('click', function () {
|
@@ -1130,7 +1131,7 @@
|
|
1130 |
filter += ' < %s';
|
1131 |
break;
|
1132 |
case 'equals_or_less':
|
1133 |
-
filter += '
|
1134 |
break;
|
1135 |
case 'contains':
|
1136 |
filter += '[contains(.,"%s")]';
|
@@ -1673,6 +1674,15 @@
|
|
1673 |
}
|
1674 |
});
|
1675 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1676 |
var fix_tag_position = function(){
|
1677 |
if ($('.wpallimport-layout').length && $('.tag').length){
|
1678 |
var offset = $('.wpallimport-layout').offset();
|
53 |
|
54 |
// swither show/hide logic
|
55 |
$('input.switcher-horizontal').live('change', function (e) {
|
56 |
+
|
57 |
+
if ($(this).is(':checked')) {
|
58 |
+
$(this).parents('form').find('input.switcher-horizontal[name="' + $(this).attr('name') + '"]').not(this).change();
|
59 |
}
|
60 |
var $targets = $('.switcher-target-' + $(this).attr('id'));
|
61 |
|
62 |
var is_show = $(this).is(':checked'); if ($(this).is('.switcher-reversed')) is_show = ! is_show;
|
63 |
+
|
64 |
if (is_show) {
|
65 |
+
$targets.animate({width:'205px'}, 350);
|
66 |
} else {
|
67 |
+
$targets.animate({width:'0px'}, 1000).find('.clear-on-switch').add($targets.filter('.clear-on-switch')).val('');
|
68 |
}
|
69 |
+
}).change();
|
70 |
|
71 |
// autoselect input content on click
|
72 |
$('input.selectable').live('click', function () {
|
1131 |
filter += ' < %s';
|
1132 |
break;
|
1133 |
case 'equals_or_less':
|
1134 |
+
filter += ' <= %s';
|
1135 |
break;
|
1136 |
case 'contains':
|
1137 |
filter += '[contains(.,"%s")]';
|
1674 |
}
|
1675 |
});
|
1676 |
|
1677 |
+
$('#is_delete_posts').change(function(){
|
1678 |
+
if ($(this).is(':checked')){
|
1679 |
+
$('.wpallimport-delete-posts-warning').show();
|
1680 |
+
}
|
1681 |
+
else{
|
1682 |
+
$('.wpallimport-delete-posts-warning').hide();
|
1683 |
+
}
|
1684 |
+
});
|
1685 |
+
|
1686 |
var fix_tag_position = function(){
|
1687 |
if ($('.wpallimport-layout').length && $('.tag').length){
|
1688 |
var offset = $('.wpallimport-layout').offset();
|
views/admin/import/confirm.php
CHANGED
@@ -100,7 +100,7 @@
|
|
100 |
<?php
|
101 |
$path = $source['path'];
|
102 |
$import_type = (!empty($source['type'])) ? $source['type'] : $import['type'];
|
103 |
-
if ( in_array($import_type, array('upload')))
|
104 |
$path_parts = pathinfo($source['path']);
|
105 |
if ( ! empty($path_parts['dirname'])){
|
106 |
$path_all_parts = explode('/', $path_parts['dirname']);
|
@@ -109,7 +109,9 @@
|
|
109 |
$path = str_replace($dirname, preg_replace('%^(.{3}).*(.{3})$%', '$1***$2', $dirname), str_replace('temp/', '', $source['path']));
|
110 |
}
|
111 |
}
|
112 |
-
|
|
|
|
|
113 |
?>
|
114 |
<p><?php printf(__('WP All Import will import the file <span style="color:#40acad;">%s</span>, which is <span style="color:#000; font-weight:bold;">%s</span>', 'wp_all_import_plugin'), $path, (isset($locfilePath)) ? human_filesize(filesize($locfilePath)) : __('undefined', 'wp_all_import_plugin')); ?></p>
|
115 |
|
100 |
<?php
|
101 |
$path = $source['path'];
|
102 |
$import_type = (!empty($source['type'])) ? $source['type'] : $import['type'];
|
103 |
+
if ( in_array($import_type, array('upload'))){
|
104 |
$path_parts = pathinfo($source['path']);
|
105 |
if ( ! empty($path_parts['dirname'])){
|
106 |
$path_all_parts = explode('/', $path_parts['dirname']);
|
109 |
$path = str_replace($dirname, preg_replace('%^(.{3}).*(.{3})$%', '$1***$2', $dirname), str_replace('temp/', '', $source['path']));
|
110 |
}
|
111 |
}
|
112 |
+
} else{
|
113 |
+
$path = str_replace("\\", '/', preg_replace('%^(\w+://[^:]+:)[^@]+@%', '$1*****@', $path));
|
114 |
+
}
|
115 |
?>
|
116 |
<p><?php printf(__('WP All Import will import the file <span style="color:#40acad;">%s</span>, which is <span style="color:#000; font-weight:bold;">%s</span>', 'wp_all_import_plugin'), $path, (isset($locfilePath)) ? human_filesize(filesize($locfilePath)) : __('undefined', 'wp_all_import_plugin')); ?></p>
|
117 |
|
views/admin/import/index.php
CHANGED
@@ -76,7 +76,12 @@ $l10n = array(
|
|
76 |
<div class="clear"></div>
|
77 |
|
78 |
<div class="wpallimport-import-types">
|
|
|
79 |
<h2><?php _e('First, specify how you want to import your data', 'wp_all_import_plugin'); ?></h2>
|
|
|
|
|
|
|
|
|
80 |
<a class="wpallimport-import-from wpallimport-upload-type <?php echo ('upload' == $post['type'] and ! empty($_POST)) ? 'selected' : '' ?>" rel="upload_type" href="javascript:void(0);">
|
81 |
<span class="wpallimport-icon"></span>
|
82 |
<span class="wpallimport-icon-label"><?php _e('Upload a file', 'wp_all_import_plugin'); ?></span>
|
76 |
<div class="clear"></div>
|
77 |
|
78 |
<div class="wpallimport-import-types">
|
79 |
+
<?php if (empty($_GET['deligate'])): ?>
|
80 |
<h2><?php _e('First, specify how you want to import your data', 'wp_all_import_plugin'); ?></h2>
|
81 |
+
<?php else: ?>
|
82 |
+
<h2 style="margin-bottom: 10px;"><?php _e('First, specify previously exported file', 'wp_all_import_plugin'); ?></h2>
|
83 |
+
<h2 class="wp_all_import_subheadline"><?php _e('The data in this file can be modified, but the structure of the file (column/element names) should not change.', 'wp_all_import_plugin'); ?></h2>
|
84 |
+
<?php endif; ?>
|
85 |
<a class="wpallimport-import-from wpallimport-upload-type <?php echo ('upload' == $post['type'] and ! empty($_POST)) ? 'selected' : '' ?>" rel="upload_type" href="javascript:void(0);">
|
86 |
<span class="wpallimport-icon"></span>
|
87 |
<span class="wpallimport-icon-label"><?php _e('Upload a file', 'wp_all_import_plugin'); ?></span>
|
views/admin/import/options/_reimport_options.php
CHANGED
@@ -3,6 +3,9 @@
|
|
3 |
<input type="hidden" name="create_new_records" value="0" />
|
4 |
<input type="checkbox" id="create_new_records" name="create_new_records" value="1" <?php echo $post['create_new_records'] ? 'checked="checked"' : '' ?> />
|
5 |
<label for="create_new_records"><?php _e('Create new posts from records newly present in your file', 'wp_all_import_plugin') ?></label>
|
|
|
|
|
|
|
6 |
</div>
|
7 |
<?php if ( "new" == $post['wizard_type']): ?>
|
8 |
<div class="switcher-target-auto_matching">
|
@@ -169,7 +172,7 @@
|
|
169 |
<?php
|
170 |
$existing_taxonomies = array();
|
171 |
$hide_taxonomies = (class_exists('PMWI_Plugin')) ? array('product_type') : array();
|
172 |
-
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($post_type), 'object'), array_flip($hide_taxonomies));
|
173 |
if (!empty($post_taxonomies)):
|
174 |
foreach ($post_taxonomies as $ctx): if ("" == $ctx->labels->name or (class_exists('PMWI_Plugin') and $post_type == "product" and strpos($ctx->name, "pa_") === 0)) continue;
|
175 |
$existing_taxonomies[] = $ctx->name;
|
3 |
<input type="hidden" name="create_new_records" value="0" />
|
4 |
<input type="checkbox" id="create_new_records" name="create_new_records" value="1" <?php echo $post['create_new_records'] ? 'checked="checked"' : '' ?> />
|
5 |
<label for="create_new_records"><?php _e('Create new posts from records newly present in your file', 'wp_all_import_plugin') ?></label>
|
6 |
+
<?php if ( ! empty(PMXI_Plugin::$session->deligate) and PMXI_Plugin::$session->deligate == 'wpallexport' ): ?>
|
7 |
+
<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>
|
8 |
+
<?php endif; ?>
|
9 |
</div>
|
10 |
<?php if ( "new" == $post['wizard_type']): ?>
|
11 |
<div class="switcher-target-auto_matching">
|
172 |
<?php
|
173 |
$existing_taxonomies = array();
|
174 |
$hide_taxonomies = (class_exists('PMWI_Plugin')) ? array('product_type') : array();
|
175 |
+
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type($post['is_override_post_type'] ? array_keys(get_post_types( '', 'names' )) : array($post_type), 'object'), array_flip($hide_taxonomies));
|
176 |
if (!empty($post_taxonomies)):
|
177 |
foreach ($post_taxonomies as $ctx): if ("" == $ctx->labels->name or (class_exists('PMWI_Plugin') and $post_type == "product" and strpos($ctx->name, "pa_") === 0)) continue;
|
178 |
$existing_taxonomies[] = $ctx->name;
|
views/admin/import/options/_reimport_template.php
CHANGED
@@ -6,11 +6,29 @@
|
|
6 |
<div class="wpallimport-content-section">
|
7 |
<div class="wpallimport-collapsed-header">
|
8 |
<?php if ( "new" == $post['wizard_type']): ?>
|
9 |
-
<?php
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
</div>
|
15 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
16 |
<div class="wpallimport-collapsed-content-inner">
|
@@ -21,7 +39,7 @@
|
|
21 |
<?php if ( ! $this->isWizard ):?>
|
22 |
<h4><?php printf(__('WP All Import will associate records in your file with %s it has already created from previous runs of this import based on the Unique Identifier.','wp_all_import_plugin'), $custom_type->labels->name);?></h4>
|
23 |
<?php endif; ?>
|
24 |
-
<div class="wpallimport-unique-key-wrapper"
|
25 |
<label style="font-weight: bold;"><?php _e("Unique Identifier", "pmxi_plugin"); ?></label>
|
26 |
|
27 |
<input type="text" class="smaller-text" name="unique_key" style="width:300px;" value="<?php if ( ! $this->isWizard ) echo esc_attr($post['unique_key']); elseif ($post['tmp_unique_key']) echo esc_attr($post['unique_key']); ?>" <?php echo ( ! $isWizard ) ? 'disabled="disabled"' : '' ?>/>
|
@@ -44,7 +62,7 @@
|
|
44 |
<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>
|
45 |
<?php endif; ?>
|
46 |
</div>
|
47 |
-
<?php if ( ! $this->isWizard ):?>
|
48 |
|
49 |
<?php include( '_reimport_options.php' ); ?>
|
50 |
|
6 |
<div class="wpallimport-content-section">
|
7 |
<div class="wpallimport-collapsed-header">
|
8 |
<?php if ( "new" == $post['wizard_type']): ?>
|
9 |
+
<?php
|
10 |
+
if ( ! $this->isWizard )
|
11 |
+
{
|
12 |
+
?>
|
13 |
+
<h3><?php _e('Record Matching', 'wp_all_import_plugin'); ?></h3>
|
14 |
+
<?php
|
15 |
+
}
|
16 |
+
else
|
17 |
+
{
|
18 |
+
if ( ! empty(PMXI_Plugin::$session->deligate) and PMXI_Plugin::$session->deligate == 'wpallexport' )
|
19 |
+
{
|
20 |
+
?>
|
21 |
+
<h3 style="padding-left:0;"><?php _e('Choose how exported data will be re-imported.','wp_all_import_plugin');?></h3>
|
22 |
+
<?php
|
23 |
+
}
|
24 |
+
else
|
25 |
+
{
|
26 |
+
?>
|
27 |
+
<h3 style="padding-left:0;"><?php printf(__('WP All Import will create new %s for each unique record in your file.','wp_all_import_plugin'), $custom_type->labels->name);?></h3>
|
28 |
+
<?php
|
29 |
+
}
|
30 |
+
}
|
31 |
+
?>
|
32 |
</div>
|
33 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
34 |
<div class="wpallimport-collapsed-content-inner">
|
39 |
<?php if ( ! $this->isWizard ):?>
|
40 |
<h4><?php printf(__('WP All Import will associate records in your file with %s it has already created from previous runs of this import based on the Unique Identifier.','wp_all_import_plugin'), $custom_type->labels->name);?></h4>
|
41 |
<?php endif; ?>
|
42 |
+
<div class="wpallimport-unique-key-wrapper" <?php if (!empty(PMXI_Plugin::$session->deligate)):?>style="display:none;"<?php endif; ?>>
|
43 |
<label style="font-weight: bold;"><?php _e("Unique Identifier", "pmxi_plugin"); ?></label>
|
44 |
|
45 |
<input type="text" class="smaller-text" name="unique_key" style="width:300px;" value="<?php if ( ! $this->isWizard ) echo esc_attr($post['unique_key']); elseif ($post['tmp_unique_key']) echo esc_attr($post['unique_key']); ?>" <?php echo ( ! $isWizard ) ? 'disabled="disabled"' : '' ?>/>
|
62 |
<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>
|
63 |
<?php endif; ?>
|
64 |
</div>
|
65 |
+
<?php if ( ! $this->isWizard or ! empty(PMXI_Plugin::$session->deligate) and PMXI_Plugin::$session->deligate == 'wpallexport'):?>
|
66 |
|
67 |
<?php include( '_reimport_options.php' ); ?>
|
68 |
|
views/admin/import/options/_settings_template.php
CHANGED
@@ -35,6 +35,7 @@
|
|
35 |
<input type="hidden" name="is_fast_mode" value="0" />
|
36 |
<input type="checkbox" id="is_fast_mode" name="is_fast_mode" value="1" class="fix_checkbox" <?php echo $post['is_fast_mode'] ? 'checked="checked"': '' ?>/>
|
37 |
<label for="is_fast_mode"><?php _e('Increase speed by disabling do_action calls in wp_insert_post during import.', 'wp_all_import_plugin') ?> <a href="#help" class="wpallimport-help" style="position: relative; top: -2px;" title="<?php _e('This option is for advanced users with knowledge of WordPress development. Your theme or plugins may require these calls when posts are created. Verify your created posts work properly if you check this box.', 'wp_all_import_plugin') ?>">?</a></label>
|
|
|
38 |
</div>
|
39 |
<?php if ( ! $this->isWizard ): ?>
|
40 |
|
35 |
<input type="hidden" name="is_fast_mode" value="0" />
|
36 |
<input type="checkbox" id="is_fast_mode" name="is_fast_mode" value="1" class="fix_checkbox" <?php echo $post['is_fast_mode'] ? 'checked="checked"': '' ?>/>
|
37 |
<label for="is_fast_mode"><?php _e('Increase speed by disabling do_action calls in wp_insert_post during import.', 'wp_all_import_plugin') ?> <a href="#help" class="wpallimport-help" style="position: relative; top: -2px;" title="<?php _e('This option is for advanced users with knowledge of WordPress development. Your theme or plugins may require these calls when posts are created. Verify your created posts work properly if you check this box.', 'wp_all_import_plugin') ?>">?</a></label>
|
38 |
+
<a href="#help" class="wpallimport-help" style="position: relative; top: -2px;" title="<?php _e('This option is for advanced users with knowledge of WordPress development. Your theme or plugins may require these calls when posts are created. Next action will be disabled: \'transition_post_status\', \'save_post\', \'pre_post_update\', \'add_attachment\', \'edit_attachment\', \'edit_post\', \'post_updated\', \'wp_insert_post\'. Verify your created posts work properly if you check this box.', 'wp_all_import_plugin') ?>">?</a></label>
|
39 |
</div>
|
40 |
<?php if ( ! $this->isWizard ): ?>
|
41 |
|
views/admin/import/template.php
CHANGED
@@ -104,26 +104,26 @@
|
|
104 |
|
105 |
<?php
|
106 |
|
107 |
-
if ( in_array('main', $visible_sections) ) do_action('pmxi_extend_options_main', $post_type);
|
108 |
|
109 |
if ( in_array('featured', $visible_sections) ) {
|
110 |
include( 'template/_featured_template.php' );
|
111 |
-
do_action('pmxi_extend_options_featured', $post_type);
|
112 |
}
|
113 |
|
114 |
if ( in_array('cf', $visible_sections) ){
|
115 |
include( 'template/_custom_fields_template.php' );
|
116 |
-
do_action('pmxi_extend_options_custom_fields', $post_type);
|
117 |
}
|
118 |
|
119 |
if ( in_array('taxonomies', $visible_sections) ) {
|
120 |
include( 'template/_taxonomies_template.php' );
|
121 |
-
do_action('pmxi_extend_options_taxonomies', $post_type);
|
122 |
}
|
123 |
|
124 |
if ( in_array('other', $visible_sections) ){
|
125 |
include( 'template/_other_template.php' );
|
126 |
-
do_action('pmxi_extend_options_other', $post_type);
|
127 |
}
|
128 |
|
129 |
/*if ( in_array('nested', $visible_sections) ){
|
@@ -138,10 +138,11 @@
|
|
138 |
<div class="input wpallimport-section" style="padding-bottom: 8px; padding-left: 8px;">
|
139 |
|
140 |
<p style="margin: 11px; float: left;">
|
|
|
141 |
<input type="checkbox" id="save_template_as" name="save_template_as" class="switcher-horizontal fix_checkbox" value="1" <?php echo ( ! empty($post['save_template_as'])) ? 'checked="checked"' : '' ?> />
|
142 |
<label for="save_template_as"><?php _e('Save settings as a template','wp_all_import_plugin');?></label>
|
143 |
</p>
|
144 |
-
<div class="switcher-target-save_template_as" style="float: left;">
|
145 |
<input type="text" name="name" placeholder="<?php _e('Template name...', 'wp_all_import_plugin') ?>" style="vertical-align:middle; line-height: 26px;" value="<?php echo esc_attr($post['name']) ?>" />
|
146 |
</div>
|
147 |
<?php $templates = new PMXI_Template_List(); ?>
|
104 |
|
105 |
<?php
|
106 |
|
107 |
+
if ( in_array('main', $visible_sections) ) do_action('pmxi_extend_options_main', $post_type, $post);
|
108 |
|
109 |
if ( in_array('featured', $visible_sections) ) {
|
110 |
include( 'template/_featured_template.php' );
|
111 |
+
do_action('pmxi_extend_options_featured', $post_type, $post);
|
112 |
}
|
113 |
|
114 |
if ( in_array('cf', $visible_sections) ){
|
115 |
include( 'template/_custom_fields_template.php' );
|
116 |
+
do_action('pmxi_extend_options_custom_fields', $post_type, $post);
|
117 |
}
|
118 |
|
119 |
if ( in_array('taxonomies', $visible_sections) ) {
|
120 |
include( 'template/_taxonomies_template.php' );
|
121 |
+
do_action('pmxi_extend_options_taxonomies', $post_type, $post);
|
122 |
}
|
123 |
|
124 |
if ( in_array('other', $visible_sections) ){
|
125 |
include( 'template/_other_template.php' );
|
126 |
+
do_action('pmxi_extend_options_other', $post_type, $post);
|
127 |
}
|
128 |
|
129 |
/*if ( in_array('nested', $visible_sections) ){
|
138 |
<div class="input wpallimport-section" style="padding-bottom: 8px; padding-left: 8px;">
|
139 |
|
140 |
<p style="margin: 11px; float: left;">
|
141 |
+
<input type="hidden" name="save_template_as" value="0" />
|
142 |
<input type="checkbox" id="save_template_as" name="save_template_as" class="switcher-horizontal fix_checkbox" value="1" <?php echo ( ! empty($post['save_template_as'])) ? 'checked="checked"' : '' ?> />
|
143 |
<label for="save_template_as"><?php _e('Save settings as a template','wp_all_import_plugin');?></label>
|
144 |
</p>
|
145 |
+
<div class="switcher-target-save_template_as" style="float: left; overflow: hidden;">
|
146 |
<input type="text" name="name" placeholder="<?php _e('Template name...', 'wp_all_import_plugin') ?>" style="vertical-align:middle; line-height: 26px;" value="<?php echo esc_attr($post['name']) ?>" />
|
147 |
</div>
|
148 |
<?php $templates = new PMXI_Template_List(); ?>
|
views/admin/import/template/_featured_template.php
CHANGED
@@ -35,13 +35,16 @@
|
|
35 |
<label for="featured_delim"><?php _e('Enter image filenames one per line, or separate them with a ', 'wp_all_import_plugin');?></label>
|
36 |
<input type="text" class="small" id="featured_delim" name="featured_delim" value="<?php echo esc_attr($post['featured_delim']) ?>" style="width:5%; text-align:center;"/>
|
37 |
<textarea name="featured_image" class="newline rad4" style="clear: both; display:block; "><?php echo esc_attr($post['featured_image']) ?></textarea>
|
38 |
-
</div>
|
39 |
-
<a class="preview_images" href="javascript:void(0);" rel="preview_images"><?php _e('Preview & Test', 'wp_all_import_plugin'); ?></a>
|
40 |
</div>
|
41 |
<div class="input" style="margin:3px;">
|
42 |
<input type="hidden" name="search_existing_images" value="0" />
|
43 |
<input type="checkbox" id="search_existing_images" name="search_existing_images" value="1" <?php echo $post['search_existing_images'] ? 'checked="checked"' : '' ?> class="fix_checkbox"/>
|
44 |
-
<label for="search_existing_images"><?php _e('Search for existing images
|
|
|
|
|
|
|
|
|
45 |
</div>
|
46 |
<h4><?php _e('Featured Image', 'wp_all_import_plugin'); ?></h4>
|
47 |
<div class="input" style="margin:3px 0px;">
|
35 |
<label for="featured_delim"><?php _e('Enter image filenames one per line, or separate them with a ', 'wp_all_import_plugin');?></label>
|
36 |
<input type="text" class="small" id="featured_delim" name="featured_delim" value="<?php echo esc_attr($post['featured_delim']) ?>" style="width:5%; text-align:center;"/>
|
37 |
<textarea name="featured_image" class="newline rad4" style="clear: both; display:block; "><?php echo esc_attr($post['featured_image']) ?></textarea>
|
38 |
+
</div>
|
|
|
39 |
</div>
|
40 |
<div class="input" style="margin:3px;">
|
41 |
<input type="hidden" name="search_existing_images" value="0" />
|
42 |
<input type="checkbox" id="search_existing_images" name="search_existing_images" value="1" <?php echo $post['search_existing_images'] ? 'checked="checked"' : '' ?> class="fix_checkbox"/>
|
43 |
+
<label for="search_existing_images"><?php _e('Search through the Media Library for existing images before importing new images','wp_all_import_plugin');?> </label>
|
44 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('If an image with the same file name is found in the Media Library then that image will be attached to this record instead of importing a new image. Disable this setting if your import has different images with the same file name.', 'wp_all_import_plugin') ?>" style="position: relative; top: -2px;">?</a>
|
45 |
+
</div>
|
46 |
+
<div class="input">
|
47 |
+
<a class="preview_images" href="javascript:void(0);" rel="preview_images"><?php _e('Preview & Test', 'wp_all_import_plugin'); ?></a>
|
48 |
</div>
|
49 |
<h4><?php _e('Featured Image', 'wp_all_import_plugin'); ?></h4>
|
50 |
<div class="input" style="margin:3px 0px;">
|
views/admin/import/template/_other_template.php
CHANGED
@@ -194,31 +194,63 @@
|
|
194 |
</div>
|
195 |
</td>
|
196 |
</tr>
|
|
|
197 |
<tr>
|
198 |
<td>
|
199 |
-
|
200 |
|
201 |
-
|
202 |
-
|
203 |
-
<
|
204 |
-
|
205 |
-
<
|
206 |
-
|
|
|
|
|
|
|
207 |
</div>
|
208 |
</div>
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
</div>
|
217 |
</div>
|
218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
</td>
|
220 |
-
</tr>
|
221 |
-
<?php endif; ?>
|
222 |
<tr>
|
223 |
<td>
|
224 |
<h4><?php _e('Menu Order', 'wp_all_import_plugin') ?></h4>
|
@@ -226,7 +258,25 @@
|
|
226 |
<input type="text" class="" name="order" value="<?php echo esc_attr($post['order']) ?>" />
|
227 |
</div>
|
228 |
</td>
|
229 |
-
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
</table>
|
231 |
</div>
|
232 |
</div>
|
194 |
</div>
|
195 |
</td>
|
196 |
</tr>
|
197 |
+
<?php endif; ?>
|
198 |
<tr>
|
199 |
<td>
|
200 |
+
<?php if ( 'page' == $post_type ):?>
|
201 |
|
202 |
+
<h4><?php _e('Page Parent', 'wp_all_import_plugin') ?></h4>
|
203 |
+
|
204 |
+
<div class="input">
|
205 |
+
<input type="radio" id="is_multiple_page_parent_yes" name="is_multiple_page_parent" value="yes" <?php echo 'yes' == $post['is_multiple_page_parent'] ? 'checked="checked"' : '' ?> class="switcher" style="margin-left:0;"/>
|
206 |
+
<label for="is_multiple_page_parent_yes"><?php _e('Select page parent', 'wp_all_import_plugin') ?></label>
|
207 |
+
<div class="switcher-target-is_multiple_page_parent_yes">
|
208 |
+
<div class="input">
|
209 |
+
<?php wp_dropdown_pages(array('post_type' => 'page', 'selected' => $post['parent'], 'name' => 'parent', 'show_option_none' => __('(no parent)', 'wp_all_import_plugin'), 'sort_column'=> 'menu_order, post_title',)) ?>
|
210 |
+
</div>
|
211 |
</div>
|
212 |
</div>
|
213 |
+
|
214 |
+
<div class="input fleft" style="position:relative;width:220px; margin-bottom:15px; margin-top: 5px;">
|
215 |
+
<input type="radio" id="is_multiple_page_parent_no" class="switcher" name="is_multiple_page_parent" value="no" <?php echo 'no' == $post['is_multiple_page_parent'] ? 'checked="checked"': '' ?> style="margin-left:0;"/>
|
216 |
+
<label for="is_multiple_page_parent_no"><?php _e('Set with XPath', 'wp_all_import_plugin' )?></label> <br>
|
217 |
+
<div class="switcher-target-is_multiple_page_parent_no">
|
218 |
+
<div class="input">
|
219 |
+
<input type="text" class="smaller-text" name="single_page_parent" style="width:190px;" value="<?php echo esc_attr($post['single_page_parent']) ?>"/>
|
220 |
+
</div>
|
221 |
+
</div>
|
222 |
+
</div>
|
223 |
+
|
224 |
+
<?php endif;?>
|
225 |
+
|
226 |
+
<?php if ( 'page' != $post_type && $custom_type->hierarchical ): ?>
|
227 |
+
|
228 |
+
<h4><?php _e('Post Parent', 'wp_all_import_plugin') ?><a href="#help" class="wpallimport-help" title="<?php _e('Enter the slug of the desired post parent. If adding the child and parent posts in the same import, set \'Records per Iteration\' to 1, run the import twice, or run separate imports for child and parent posts.', 'wp_all_import_plugin') ?>" style="position:relative; top:-1px;">?</a></h4>
|
229 |
+
|
230 |
+
<div class="input">
|
231 |
+
<input type="radio" id="is_multiple_page_parent_yes" name="is_multiple_page_parent" value="yes" <?php echo 'yes' == $post['is_multiple_page_parent'] ? 'checked="checked"' : '' ?> class="switcher" style="margin-left:0;"/>
|
232 |
+
<label for="is_multiple_page_parent_yes"><?php _e('Select page parent', 'wp_all_import_plugin') ?></label>
|
233 |
+
<div class="switcher-target-is_multiple_page_parent_yes">
|
234 |
+
<div class="input">
|
235 |
+
<input type="text" class="" name="parent" value="<?php echo esc_attr($post['parent']) ?>" />
|
236 |
+
</div>
|
237 |
</div>
|
238 |
</div>
|
239 |
+
|
240 |
+
<div class="input fleft" style="position:relative;width:220px; margin-bottom:15px; margin-top: 5px;">
|
241 |
+
<input type="radio" id="is_multiple_page_parent_no" class="switcher" name="is_multiple_page_parent" value="no" <?php echo 'no' == $post['is_multiple_page_parent'] ? 'checked="checked"': '' ?> style="margin-left:0;"/>
|
242 |
+
<label for="is_multiple_page_parent_no"><?php _e('Set with XPath', 'wp_all_import_plugin' )?></label> <br>
|
243 |
+
<div class="switcher-target-is_multiple_page_parent_no">
|
244 |
+
<div class="input">
|
245 |
+
<input type="text" class="smaller-text" name="single_page_parent" style="width:190px;" value="<?php echo esc_attr($post['single_page_parent']) ?>"/>
|
246 |
+
</div>
|
247 |
+
</div>
|
248 |
+
</div>
|
249 |
+
|
250 |
+
<?php endif; ?>
|
251 |
+
|
252 |
</td>
|
253 |
+
</tr>
|
|
|
254 |
<tr>
|
255 |
<td>
|
256 |
<h4><?php _e('Menu Order', 'wp_all_import_plugin') ?></h4>
|
258 |
<input type="text" class="" name="order" value="<?php echo esc_attr($post['order']) ?>" />
|
259 |
</div>
|
260 |
</td>
|
261 |
+
</tr>
|
262 |
+
<?php if ( ! empty($post['deligate']) and $post['deligate'] == 'wpallexport' ): ?>
|
263 |
+
<tr>
|
264 |
+
<td>
|
265 |
+
<h4><?php _e('Override Post Type', 'wp_all_import_plugin') ?></h4>
|
266 |
+
<div class="input">
|
267 |
+
<div style="margin: 11px; float: left;">
|
268 |
+
<input type="hidden" name="is_override_post_type" value="0"/>
|
269 |
+
<input type="checkbox" value="1" class="switcher-horizontal fix_checkbox" name="is_override_post_type" id="is_override_post_type" <?php echo ( ! empty($post['is_override_post_type'])) ? 'checked="checked"' : '' ?>>
|
270 |
+
<label for="is_override_post_type"><?php _e('Override','wp_all_import_plugin');?></label>
|
271 |
+
</div>
|
272 |
+
<div class="switcher-target-is_override_post_type" style="float: left; overflow: hidden;">
|
273 |
+
<input type="text" name="post_type_xpath" style="vertical-align:middle; line-height: 26px;" value="<?php echo esc_attr($post['post_type_xpath']) ?>" />
|
274 |
+
</div>
|
275 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Slug for the post type.', 'wp_all_import_plugin') ?>" style="position:relative; top:12px;">?</a>
|
276 |
+
</div>
|
277 |
+
</td>
|
278 |
+
</tr>
|
279 |
+
<?php endif; ?>
|
280 |
</table>
|
281 |
</div>
|
282 |
</div>
|
views/admin/manage/delete.php
CHANGED
@@ -4,6 +4,15 @@
|
|
4 |
<p><?php printf(__('Are you sure you want to delete <strong>%s</strong> import?', 'wp_all_import_plugin'), $item->name) ?></p>
|
5 |
<div class="input">
|
6 |
<input type="checkbox" id="is_delete_posts" name="is_delete_posts" /> <label for="is_delete_posts">Delete associated posts as well</label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
</div>
|
8 |
<p class="submit">
|
9 |
<?php wp_nonce_field('delete-import', '_wpnonce_delete-import') ?>
|
4 |
<p><?php printf(__('Are you sure you want to delete <strong>%s</strong> import?', 'wp_all_import_plugin'), $item->name) ?></p>
|
5 |
<div class="input">
|
6 |
<input type="checkbox" id="is_delete_posts" name="is_delete_posts" /> <label for="is_delete_posts">Delete associated posts as well</label>
|
7 |
+
<?php if ( ! empty($item->options['deligate']) and $item->options['deligate'] == 'wpallexport' and class_exists('PMXE_Plugin')): ?>
|
8 |
+
<?php
|
9 |
+
$export = new PMXE_Export_Record();
|
10 |
+
$export->getById($item->options['export_id']);
|
11 |
+
if ( ! $export->isEmpty() ){
|
12 |
+
printf(__('<p class="wpallimport-delete-posts-warning"><strong>Important</strong>: this import was created automatically by WP All Export. All posts exported by the "%s" export job have been automatically associated with this import.</p>', 'wp_all_export_plugin'), $export->friendly_name );
|
13 |
+
}
|
14 |
+
?>
|
15 |
+
<?php endif; ?>
|
16 |
</div>
|
17 |
<p class="submit">
|
18 |
<?php wp_nonce_field('delete-import', '_wpnonce_delete-import') ?>
|
views/admin/manage/index.php
CHANGED
@@ -272,10 +272,15 @@ $columns = apply_filters('pmxi_manage_imports_columns', $columns);
|
|
272 |
_e('Import failed, please check logs', 'wp_all_import_plugin');
|
273 |
}
|
274 |
else{
|
275 |
-
|
276 |
-
|
|
|
|
|
|
|
|
|
|
|
277 |
printf(__('Last run: %s', 'wp_all_import_plugin'), ($item['registered_on'] == '0000-00-00 00:00:00') ? __('never', 'wp_all_import_plugin') : get_date_from_gmt($item['registered_on'], "m/d/Y g:i a")); echo '<br/>';
|
278 |
-
printf(__('%d %
|
279 |
printf(__('%d updated, %d skipped, %d deleted'), $item['updated'], $item['skipped'], $item['deleted']);
|
280 |
//printf(__('%d records', 'wp_all_import_plugin'), $item['post_count']);
|
281 |
}
|
272 |
_e('Import failed, please check logs', 'wp_all_import_plugin');
|
273 |
}
|
274 |
else{
|
275 |
+
if (!empty($item['options']['custom_type'])){
|
276 |
+
$custom_type = get_post_type_object( $item['options']['custom_type'] );
|
277 |
+
$cpt_name = ( ! empty($custom_type)) ? $custom_type->label : '';
|
278 |
+
}
|
279 |
+
else{
|
280 |
+
$cpt_name = '';
|
281 |
+
}
|
282 |
printf(__('Last run: %s', 'wp_all_import_plugin'), ($item['registered_on'] == '0000-00-00 00:00:00') ? __('never', 'wp_all_import_plugin') : get_date_from_gmt($item['registered_on'], "m/d/Y g:i a")); echo '<br/>';
|
283 |
+
printf(__('%d %s created', 'wp_all_import_plugin'), $item['created'], $cpt_name); echo '<br/>';
|
284 |
printf(__('%d updated, %d skipped, %d deleted'), $item['updated'], $item['skipped'], $item['deleted']);
|
285 |
//printf(__('%d records', 'wp_all_import_plugin'), $item['post_count']);
|
286 |
}
|