Import any XML or CSV File to WordPress - Version 3.0.1

Version Description

Download this release

Release Info

Developer soflyy
Plugin Icon 128x128 Import any XML or CSV File to WordPress
Version 3.0.1
Comparing to
See all releases

Code changes from version 3.0 to 3.0.1

actions/admin_menu.php CHANGED
@@ -14,8 +14,7 @@ function pmxi_admin_menu() {
14
  add_submenu_page('pmxi-admin-home', __('Import XML', 'pmxi_plugin') . ' ‹ ' . __('WP All Import', 'pmxi_plugin'), __('New Import', 'pmxi_plugin'), 'manage_options', 'pmxi-admin-import', array(PMXI_Plugin::getInstance(), 'adminDispatcher'));
15
  add_submenu_page('pmxi-admin-home', __('Manage Previous Imports', 'pmxi_plugin') . ' ‹ ' . __('WP All Import', 'pmxi_plugin'), __('Manage Imports', 'pmxi_plugin'), 'manage_options', 'pmxi-admin-manage', array(PMXI_Plugin::getInstance(), 'adminDispatcher'));
16
  add_submenu_page('pmxi-admin-home', __('Settings', 'pmxi_plugin') . ' ‹ ' . __('WP All Import', 'pmxi_plugin'), __('Settings', 'pmxi_plugin'), 'manage_options', 'pmxi-admin-settings', array(PMXI_Plugin::getInstance(), 'adminDispatcher'));
17
- // add_submenu_page('pmxi-admin-home', __('WP All Import', 'pmxi_plugin'), __('About', 'pmxi_plugin'), 'manage_options', 'pmxi-admin-home', array(PMXI_Plugin::getInstance(), 'adminDispatcher'));
18
- // add_submenu_page('pmxi-admin-home', __('Help', 'pmxi_plugin') . ' ‹ ' . __('WP All Import', 'pmxi_plugin'), __('Help', 'pmxi_plugin'), 'manage_options', 'pmxi-admin-help', array(PMXI_Plugin::getInstance(), 'adminDispatcher'));
19
 
20
  }
21
  }
14
  add_submenu_page('pmxi-admin-home', __('Import XML', 'pmxi_plugin') . ' ‹ ' . __('WP All Import', 'pmxi_plugin'), __('New Import', 'pmxi_plugin'), 'manage_options', 'pmxi-admin-import', array(PMXI_Plugin::getInstance(), 'adminDispatcher'));
15
  add_submenu_page('pmxi-admin-home', __('Manage Previous Imports', 'pmxi_plugin') . ' ‹ ' . __('WP All Import', 'pmxi_plugin'), __('Manage Imports', 'pmxi_plugin'), 'manage_options', 'pmxi-admin-manage', array(PMXI_Plugin::getInstance(), 'adminDispatcher'));
16
  add_submenu_page('pmxi-admin-home', __('Settings', 'pmxi_plugin') . ' ‹ ' . __('WP All Import', 'pmxi_plugin'), __('Settings', 'pmxi_plugin'), 'manage_options', 'pmxi-admin-settings', array(PMXI_Plugin::getInstance(), 'adminDispatcher'));
17
+ add_submenu_page('pmxi-admin-home', __('Support', 'pmxi_plugin') . ' ‹ ' . __('WP All Import', 'pmxi_plugin'), __('Support', 'pmxi_plugin'), 'manage_options', 'pmxi-admin-help', array(PMXI_Plugin::getInstance(), 'adminDispatcher'));
 
18
 
19
  }
20
  }
actions/admin_notices.php CHANGED
@@ -4,7 +4,7 @@ function pmxi_admin_notices() {
4
  // notify user if history folder is not writable
5
  $uploads = wp_upload_dir();
6
 
7
- if ( ! is_dir($uploads['basedir'] . '/wpallimport_history') or ! is_writable($uploads['basedir'] . '/wpallimport_history')) {
8
  ?>
9
  <div class="error"><p>
10
  <?php printf(
@@ -14,6 +14,17 @@ function pmxi_admin_notices() {
14
  ) ?>
15
  </p></div>
16
  <?php
 
 
 
 
 
 
 
 
 
 
 
17
  }
18
 
19
  $input = new PMXI_Input();
4
  // notify user if history folder is not writable
5
  $uploads = wp_upload_dir();
6
 
7
+ if ( ! @is_dir($uploads['basedir'] . '/wpallimport_history') or ! @is_writable($uploads['basedir'] . '/wpallimport_history')) {
8
  ?>
9
  <div class="error"><p>
10
  <?php printf(
14
  ) ?>
15
  </p></div>
16
  <?php
17
+ }
18
+
19
+ // notify user
20
+ if (!PMXI_Plugin::getInstance()->getOption('dismiss') and strpos($_SERVER['REQUEST_URI'], 'plugins.php') !== false and strpos($_SERVER['REQUEST_URI'], 'pmxi-admin') === false) {
21
+ ?>
22
+ <div class="updated"><p>
23
+ <?php printf(
24
+ __('Welcome to WP All Import. We hope you like it. Please send all support requests and feedback to <a href="mailto:support@soflyy.com">support@soflyy.com</a>.<br/><br/><a href="javascript:void(0);" id="dismiss">dismiss</a>', 'pmxi_plugin')
25
+ ) ?>
26
+ </p></div>
27
+ <?php
28
  }
29
 
30
  $input = new PMXI_Input();
actions/wp_loaded.php CHANGED
@@ -2,6 +2,6 @@
2
 
3
  function pmxi_wp_loaded() {
4
 
5
-
6
 
7
  }
2
 
3
  function pmxi_wp_loaded() {
4
 
5
+ wp_enqueue_script('pmxi-script', PMXI_ROOT_URL . '/static/js/pmxi.js', array('jquery'));
6
 
7
  }
banner-772x250.png ADDED
Binary file
classes/chunk.php CHANGED
@@ -36,7 +36,7 @@ class PMXI_Chunk {
36
  public $options = array(
37
  'path' => './', // string The path to check for $file in
38
  'element' => '', // string The XML element to return
39
- 'chunkSize' => 4096, // integer The amount of bytes to retrieve in each chunk
40
  'type' => 'upload'
41
  );
42
 
@@ -54,8 +54,16 @@ class PMXI_Chunk {
54
  * @access public
55
  */
56
  public $pointer = 0;
57
-
58
  public $cloud = array();
 
 
 
 
 
 
 
 
59
 
60
  /**
61
  * handle
@@ -89,10 +97,10 @@ class PMXI_Chunk {
89
  * @author Dom Hastings
90
  * @access public
91
  */
92
- public function __construct($file, $options = array(), $pointer = 0) {
93
  // merge the options together
94
  $this->options = array_merge($this->options, (is_array($options) ? $options : array()));
95
-
96
  // check that the path ends with a /
97
  if (substr($this->options['path'], -1) != '/') {
98
  $this->options['path'] .= '/';
@@ -108,11 +116,13 @@ class PMXI_Chunk {
108
  if ($this->options['chunkSize'] < 64) {
109
  $this->options['chunkSize'] = 1024;
110
  }
 
 
111
 
112
  $this->pointer = $pointer;
113
 
114
  // set the filename
115
- $this->file = ($this->options['path'] != './') ? realpath($this->options['path'].$file_base) : $file;
116
 
117
  // check the file exists
118
  if (!file_exists($this->file)){
@@ -163,54 +173,77 @@ class PMXI_Chunk {
163
  }
164
 
165
  // initialize the buffer
166
- $buffer = false;
167
-
168
  // if the element is empty, then start auto detect root element tag name
169
  if (empty($element)) {
170
  // let the script know we're reading
171
  $this->reading = true;
172
  $founded_tags = array();
173
- // read in the whole doc, cos we don't know what's wanted
174
- while ($this->reading) {
175
- $c = fread($this->handle, $this->options['chunkSize']);
176
- if ( preg_match_all("/<\\w+\\s*[^<]*\\s*\/?>/i", $c, $matches, PREG_PATTERN_ORDER) ){
 
 
 
177
  foreach ($matches[0] as $tag) {
178
- $tag = explode(" ",trim(str_replace(array('<','>','/'), '', $tag)));
179
  array_push($founded_tags, $tag[0]);
180
- }
181
  }
182
  $this->reading = (!feof($this->handle));
183
- }
184
 
185
  // we must be looking for a specific element
186
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
 
188
  if (empty($element) and !empty($founded_tags)) {
189
 
190
- $element_counts = array_count_values($founded_tags);
191
-
192
  if (!empty($element_counts)){
193
 
194
- $this->cloud = array_slice($element_counts, 0, 2);
195
 
196
  foreach ($element_counts as $tag => $count) {
197
- if ($count > 1 and empty($this->options['element'])) {
198
- $this->options['element'] = $element = $tag;
199
- }
200
- elseif ($count > 1){
201
- $this->cloud[$tag] = $count;
 
 
202
  }
203
  }
204
  }
205
 
206
- }
207
-
208
  // return it all if element doesn't founded
209
- if (empty($element))
210
- return false;
211
-
212
- // we must be looking for a specific element
213
- //}
 
 
 
214
 
215
  // initialize the buffer
216
  $buffer = false;
@@ -226,40 +259,45 @@ class PMXI_Chunk {
226
  $this->readBuffer = '';
227
 
228
  // this is used to ensure all data is read, and to make sure we don't send the start data again by mistake
229
- $store = false;
 
 
230
 
231
  // seek to the position we need in the file
232
  fseek($this->handle, $this->pointer);
233
 
234
  // start reading
235
- while ($this->reading && !feof($this->handle)) {
236
 
237
  // store the chunk in a temporary variable
238
- $tmp = fread($this->handle, $this->options['chunkSize']);
239
-
240
  // update the global buffer
241
  $this->readBuffer .= $tmp;
242
 
243
- // check for the open string
244
- $checkOpen = strpos($tmp, $open." ");
245
- if (!$checkOpen) $checkOpen = strpos($tmp, $open.">");
 
246
 
247
- // if it wasn't in the new buffer
248
- if (!$checkOpen && !($store)) {
249
- // check the full buffer (in case it was only half in this buffer)
250
- $checkOpen = strpos($this->readBuffer, $open." ");
251
- if (!$checkOpen) $checkOpen = strpos($this->readBuffer, $open.">");
252
 
253
- // if it was in there
254
- if ($checkOpen) {
255
- // set it to the remainder
256
- $checkOpen = $checkOpen % $this->options['chunkSize'];
 
257
  }
258
- }
259
-
260
  // check for the close string
261
- $checkClose = strpos($tmp, $close);
262
- $withoutcloseelement = false;
 
263
  if (!$checkClose){
264
  $checkClose = (preg_match_all("/\/>\s*".$open."\s*/", $this->readBuffer, $matches)) ? strpos($this->readBuffer, $matches[0][0]) : false;
265
  if ($checkClose)
@@ -269,7 +307,31 @@ class PMXI_Chunk {
269
  if ($checkClose)
270
  $withoutcloseelement = true;*/
271
  }
272
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
 
274
  // if it wasn't in the new buffer
275
  if (!$checkClose && ($store)) {
@@ -304,7 +366,7 @@ class PMXI_Chunk {
304
  $checkClose += strlen($close);
305
  else
306
  $checkClose += strlen("/>"); // "/>" symbols
307
- }
308
 
309
  // if we've found the opening string and we're not already reading another element
310
  if ($checkOpen !== false && !($store)) {
@@ -326,8 +388,9 @@ class PMXI_Chunk {
326
  // update the pointer
327
  $this->pointer += $this->options['chunkSize'];
328
 
329
- // let the script know we're gonna be storing all the data until we find the close element
330
- $store = true;
 
331
  }
332
 
333
  // if we've found the closing element
@@ -345,10 +408,12 @@ class PMXI_Chunk {
345
  } elseif ($store) {
346
  // update the buffer
347
  $buffer .= $tmp;
 
 
348
 
349
  // and the pointer
350
  $this->pointer += $this->options['chunkSize'];
351
- }
352
 
353
  }
354
 
36
  public $options = array(
37
  'path' => './', // string The path to check for $file in
38
  'element' => '', // string The XML element to return
39
+ 'chunkSize' => 1024, // integer The amount of bytes to retrieve in each chunk
40
  'type' => 'upload'
41
  );
42
 
54
  * @access public
55
  */
56
  public $pointer = 0;
57
+
58
  public $cloud = array();
59
+
60
+ public $is_validate = true;
61
+
62
+ public $open_counter = 0;
63
+
64
+ public $encoding = "";
65
+
66
+ public $return_with_encoding = true;
67
 
68
  /**
69
  * handle
97
  * @author Dom Hastings
98
  * @access public
99
  */
100
+ public function __construct($file, $options = array(), $pointer = 0, $return_with_encoding = true) {
101
  // merge the options together
102
  $this->options = array_merge($this->options, (is_array($options) ? $options : array()));
103
+ $this->return_with_encoding = $return_with_encoding;
104
  // check that the path ends with a /
105
  if (substr($this->options['path'], -1) != '/') {
106
  $this->options['path'] .= '/';
116
  if ($this->options['chunkSize'] < 64) {
117
  $this->options['chunkSize'] = 1024;
118
  }
119
+
120
+ $this->options['chunkSize'] *= PMXI_Plugin::getInstance()->getOption('chunk_size');
121
 
122
  $this->pointer = $pointer;
123
 
124
  // set the filename
125
+ $this->file = $file;
126
 
127
  // check the file exists
128
  if (!file_exists($this->file)){
173
  }
174
 
175
  // initialize the buffer
176
+ $buffer = false;
177
+
178
  // if the element is empty, then start auto detect root element tag name
179
  if (empty($element)) {
180
  // let the script know we're reading
181
  $this->reading = true;
182
  $founded_tags = array();
183
+ // read in the whole doc, cos we don't know what's wanted
184
+ while ($this->reading and (count($founded_tags) < 500)) {
185
+ $c = fread($this->handle, $this->options['chunkSize']);
186
+ if ($this->is_validate) {
187
+ if (stripos($c, "xmlns") !== false) $this->is_validate = false;
188
+ }
189
+ if ( preg_match_all("/<\\w+\\s*[^<|^\n]*\\s*\/?>/i", $c, $matches, PREG_PATTERN_ORDER) ){
190
  foreach ($matches[0] as $tag) {
191
+ $tag = explode(" ", trim(str_replace(array('<','>','/'), '', $tag)));
192
  array_push($founded_tags, $tag[0]);
193
+ }
194
  }
195
  $this->reading = (!feof($this->handle));
196
+ }
197
 
198
  // we must be looking for a specific element
199
  }
200
+
201
+ if (empty($this->encoding)) {
202
+ fseek($this->handle, 0);
203
+ $this->reading = true;
204
+ // read in the whole doc, cos we don't know what's wanted
205
+ while ($this->reading) {
206
+ $c = fread($this->handle, $this->options['chunkSize']);
207
+ $enc = preg_match("/<\?xml.*\?>/i", $c, $enc_matches);
208
+ if ($enc)
209
+ $this->encoding = $enc_matches[0];
210
+ $this->reading = false;
211
+ }
212
+ }
213
+
214
+ if (empty($this->encoding)) $this->encoding = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
215
 
216
  if (empty($element) and !empty($founded_tags)) {
217
 
218
+ $element_counts = array_count_values($founded_tags);
219
+
220
  if (!empty($element_counts)){
221
 
222
+ //$this->cloud = array_slice($element_counts, 0, 2);
223
 
224
  foreach ($element_counts as $tag => $count) {
225
+ if (strpos($tag, ":") === false){
226
+ if ($count > 1 and empty($this->options['element'])) {
227
+ $this->options['element'] = $element = $tag;
228
+ }
229
+ else{
230
+ $this->cloud[$tag] = $count;
231
+ }
232
  }
233
  }
234
  }
235
 
236
+ }
237
+
238
  // return it all if element doesn't founded
239
+ if (empty($element)){
240
+ if (!empty($element_counts)){
241
+ $this->options['element'] = $element = array_shift(array_keys($element_counts));
242
+ }
243
+ else return false;
244
+ }
245
+
246
+ // we must be looking for a specific element
247
 
248
  // initialize the buffer
249
  $buffer = false;
259
  $this->readBuffer = '';
260
 
261
  // this is used to ensure all data is read, and to make sure we don't send the start data again by mistake
262
+ $store = false;
263
+
264
+ $checkOpen = false;
265
 
266
  // seek to the position we need in the file
267
  fseek($this->handle, $this->pointer);
268
 
269
  // start reading
270
+ while ($this->reading && !feof($this->handle)) {
271
 
272
  // store the chunk in a temporary variable
273
+ $tmp = fread($this->handle, $this->options['chunkSize']);
274
+
275
  // update the global buffer
276
  $this->readBuffer .= $tmp;
277
 
278
+ if (!$checkOpen){
279
+ // check for the open string
280
+ $checkOpen = strpos($tmp, $open." ");
281
+ if (!$checkOpen) $checkOpen = strpos($tmp, $open.">");
282
 
283
+ // if it wasn't in the new buffer
284
+ if (!$checkOpen && !($store)) {
285
+ // check the full buffer (in case it was only half in this buffer)
286
+ $checkOpen = strpos($this->readBuffer, $open." ");
287
+ if (!$checkOpen) $checkOpen = strpos($this->readBuffer, $open.">");
288
 
289
+ // if it was in there
290
+ if ($checkOpen) {
291
+ // set it to the remainder
292
+ $checkOpen = $checkOpen % $this->options['chunkSize'];
293
+ }
294
  }
295
+ }
296
+
297
  // check for the close string
298
+ $checkClose = preg_match_all("/<\/".$element.">/i", $tmp, $closematches, PREG_OFFSET_CAPTURE);
299
+ $withoutcloseelement = false;
300
+
301
  if (!$checkClose){
302
  $checkClose = (preg_match_all("/\/>\s*".$open."\s*/", $this->readBuffer, $matches)) ? strpos($this->readBuffer, $matches[0][0]) : false;
303
  if ($checkClose)
307
  if ($checkClose)
308
  $withoutcloseelement = true;*/
309
  }
310
+ }
311
+ else{
312
+
313
+ $close_finded = false;
314
+ $search_pointer = $closematches[0][0][1] - $checkOpen;
315
+ $checkDuplicateOpen = preg_match_all("/".$open."[ |>]/i", substr($this->readBuffer, $checkOpen, $search_pointer), $matches, PREG_OFFSET_CAPTURE);
316
+
317
+ while (!$close_finded){
318
+ if ($checkDuplicateOpen > 1 and !empty($closematches[0][$checkDuplicateOpen - 1])){
319
+ $secondcheckDuplicateOpen = preg_match_all("/".$open."[ |>]/i", substr($this->readBuffer, $checkOpen, $closematches[0][$checkDuplicateOpen - 1][1] - $checkOpen), $matches, PREG_OFFSET_CAPTURE);
320
+ if ($secondcheckDuplicateOpen == $checkDuplicateOpen){
321
+ $checkClose = $closematches[0][$checkDuplicateOpen - 1][1];
322
+ $close_finded = true;
323
+ }
324
+ else{
325
+ $checkClose = false;
326
+ $checkDuplicateOpen = $secondcheckDuplicateOpen;
327
+ }
328
+ }
329
+ else{
330
+ $checkClose = $closematches[0][0][1];
331
+ $close_finded = true;
332
+ }
333
+ }
334
+ }
335
 
336
  // if it wasn't in the new buffer
337
  if (!$checkClose && ($store)) {
366
  $checkClose += strlen($close);
367
  else
368
  $checkClose += strlen("/>"); // "/>" symbols
369
+ }
370
 
371
  // if we've found the opening string and we're not already reading another element
372
  if ($checkOpen !== false && !($store)) {
388
  // update the pointer
389
  $this->pointer += $this->options['chunkSize'];
390
 
391
+ // let the script know we're gonna be storing all the data until we find the close element
392
+ $store = true;
393
+
394
  }
395
 
396
  // if we've found the closing element
408
  } elseif ($store) {
409
  // update the buffer
410
  $buffer .= $tmp;
411
+
412
+ $this->open_counter = 0;
413
 
414
  // and the pointer
415
  $this->pointer += $this->options['chunkSize'];
416
+ }
417
 
418
  }
419
 
config/options.php CHANGED
@@ -13,7 +13,10 @@ $config = array(
13
  "max_input_time" => -1,
14
  "max_execution_time" => -1,
15
  "dismiss" => 0,
 
 
16
  "html_entities" => 0,
17
  "utf8_decode" => 0,
18
- "cron_job_key" => url_title(rand_char(12))
 
19
  );
13
  "max_input_time" => -1,
14
  "max_execution_time" => -1,
15
  "dismiss" => 0,
16
+ "dismiss_manage_top" => 0,
17
+ "dismiss_manage_bottom" => 0,
18
  "html_entities" => 0,
19
  "utf8_decode" => 0,
20
+ "cron_job_key" => url_title(rand_char(12)),
21
+ "chunk_size" => 64
22
  );
controllers/admin/import.php CHANGED
@@ -14,7 +14,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
14
 
15
  try{
16
  $path = session_save_path();
17
- if ( ! is_dir($path) or ! is_writable($path)){
18
  @ini_set("session.save_handler", "files");
19
  session_save_path(sys_get_temp_dir());
20
  }
@@ -122,22 +122,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
122
  'large_file' => '',
123
  'filepath' => '',
124
  'root_element' => ''
125
- ));
126
-
127
- $this->data['history'] = $history = new PMXI_File_List();
128
- $history->setColumns('id', 'name', 'registered_on', 'path')->getBy(NULL, 'id DESC');
129
-
130
- if ($history->count())
131
- {
132
- $uploads = wp_upload_dir();
133
- foreach ($history as $file){
134
- if (file_exists(PMXI_Plugin::ROOT_DIR . '/history/' . $file['id']) and !file_exists($uploads['basedir'] . '/wpallimport_history/' . $file['id']))
135
- {
136
- $fdata = @file_get_contents(PMXI_Plugin::ROOT_DIR . '/history/' . $file['id']);
137
- @file_put_contents($uploads['basedir'] . '/wpallimport_history/' . $file['id'], $fdata);
138
- }
139
- }
140
- }
141
 
142
  if ($this->input->post('is_submitted_continue')) {
143
  if ( ! empty($_SESSION['pmxi_import']['xml'])) {
@@ -291,9 +276,11 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
291
 
292
  if ($this->input->post('is_submitted') and ! $this->errors->get_error_codes()) {
293
 
294
- check_admin_referer('choose-file', '_wpnonce_choose-file');
 
 
295
 
296
- $elements_cloud = array();
297
 
298
  if (empty($xml)){
299
 
@@ -320,9 +307,9 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
320
  PMXI_Import_Record::preprocessXml($chunk_xml);
321
  if ( ! $chunks ){ // save first chunk to the file
322
  $chunk_path = $wp_uploads['path'] .'/'. wp_unique_filename($wp_uploads['path'], "chunk_".basename($path));
323
- if (file_exists($chunk_path)) unlink($chunk_path);
324
- file_put_contents($chunk_path, '<?xml version="1.0" encoding="utf-8"?>'."\n".$chunk_xml);
325
- chmod($chunk_path, 0755);
326
  }
327
  $chunks++;
328
  }
@@ -359,7 +346,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
359
  }
360
  }
361
 
362
- if ((empty($post['large_file']) and PMXI_Import_Record::validateXml($xml, $this->errors)) or (!empty($post['large_file']) and !empty($chunks))) {
363
  // xml is valid
364
  if (!empty($post['large_file'])){
365
  $source['large_import'] = 'Yes';
@@ -375,6 +362,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
375
  $_SESSION['pmxi_import'] = array(
376
  'xml' => $xml,
377
  'filePath' => $filePath,
 
378
  'source' => $source,
379
  'large_file' => (!empty($post['large_file'])) ? true : false,
380
  'chunk_number' => 1,
@@ -410,7 +398,10 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
410
  wp_redirect(add_query_arg('action', 'element', $this->baseUrl)); die();
411
 
412
  }
413
- }
 
 
 
414
 
415
  $this->render();
416
  }
@@ -450,10 +441,11 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
450
  }
451
 
452
  if ( ! $this->errors->get_error_codes()) {
 
453
  $_SESSION['pmxi_import']['xpath'] = $post['xpath'];
454
  // counting element selected by xPath
455
- if ($_SESSION['pmxi_import']['large_file']){
456
-
457
  $_SESSION['pmxi_import']['count'] = 0;
458
 
459
  $this->data['node_list_count'] = 0;
@@ -468,7 +460,8 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
468
  while ($xml = $file->read()) {
469
 
470
  if (!empty($xml))
471
- {
 
472
  PMXI_Import_Record::preprocessXml($xml);
473
 
474
  $dom = new DOMDocument('1.0', 'UTF-8');
@@ -497,10 +490,8 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
497
  wp_redirect(add_query_arg('action', 'template', $this->baseUrl)); die();
498
  }
499
  } else {
500
-
501
- //$this->shrink_xml_element($this->data['dom']->documentElement);
502
-
503
- if (isset($_SESSION['pmxi_import']['xpath'])) {
504
  $post['xpath'] = $_SESSION['pmxi_import']['xpath'];
505
  $this->data['elements'] = $elements = $xpath->query($post['xpath']);
506
  if ( ! $elements->length and ! empty($_SESSION['pmxi_import']['update_previous'])) {
@@ -542,17 +533,20 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
542
  $this->errors->add('form-validation', __('No elements selected', 'pmxi_plugin'));
543
  } else {
544
  // counting selected elements
545
- if ($_SESSION['pmxi_import']['large_file']){ // in large mode
546
-
547
- $this->data['node_list_count'] = 0;
548
-
549
- $_SESSION['pmxi_import']['count'] = 0;
550
 
 
 
 
 
 
 
 
551
  $xpath_elements = explode('[', $post['xpath']);
552
  $xpath_parts = explode('/', $xpath_elements[0]);
553
 
554
  $_SESSION['pmxi_import']['source']['root_element'] = $xpath_parts[count($xpath_parts) - 1];
555
-
556
  $loop = 1;
557
 
558
  foreach ($_SESSION['pmxi_import']['local_paths'] as $key => $path) {
@@ -560,28 +554,35 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
560
  $file = new PMXI_Chunk($path, array('element' => $_SESSION['pmxi_import']['source']['root_element'], 'path' => $wp_uploads['path']));
561
  // loop through the file until all lines are read
562
  while ($xml = $file->read()) {
563
-
564
  if (!empty($xml))
565
- {
566
- PMXI_Import_Record::preprocessXml($xml);
 
567
 
568
- $dom = new DOMDocument('1.0', 'UTF-8');
569
  $old = libxml_use_internal_errors(true);
570
- $dom->loadXML(preg_replace('%xmlns\s*=\s*([\'"]).*\1%sU', '', $xml)); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
571
  libxml_use_internal_errors($old);
572
  $xpath = new DOMXPath($dom);
573
- if (($this->data['elements'] = $elements = @$xpath->query($post['xpath'])) and $elements->length){
574
- $_SESSION['pmxi_import']['count']++;
575
- $this->data['node_list_count']++;
576
- if ($loop == $post['show_element'] ){
577
- $_SESSION['pmxi_import']['xml'] = $xml;
578
- $this->data['dom'] = $dom;
 
 
 
 
 
 
579
  }
580
  else unset($dom, $xpath, $elements);
581
  $loop++;
582
- }
583
  }
584
- }
585
  unset($file);
586
  }
587
  if ( ! $this->data['node_list_count']) {
@@ -637,7 +638,8 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
637
  'content' => '',
638
  'name' => '',
639
  'is_keep_linebreaks' => 0,
640
- 'is_leave_html' => 0
 
641
  );
642
  if ($this->isWizard) {
643
  $this->data['post'] = $post = $this->input->post(
@@ -657,7 +659,8 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
657
  'title' => $template->title,
658
  'content' => $template->content,
659
  'is_keep_linebreaks' => $template->is_keep_linebreaks,
660
- 'is_leave_html' => $template->is_leave_html,
 
661
  'name' => '', // template is always empty
662
  );
663
  $_SESSION['pmxi_import']['is_loaded_template'] = $load_template;
@@ -740,8 +743,9 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
740
  $history_file = new PMXI_File_Record();
741
  $history_file->getBy('id', $history[0]['id']);
742
 
743
- if ($update_previous->large_import == 'Yes'){
744
  $_SESSION['pmxi_import']['filePath'] = $history_file->path;
 
745
  $_SESSION['pmxi_import']['source']['root_element'] = $update_previous->root_element;
746
  $_SESSION['pmxi_import']['large_file'] = true;
747
  $_SESSION['pmxi_import']['count'] = $update_previous->count;
@@ -768,28 +772,31 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
768
  $loop = 1;
769
  $_SESSION['pmxi_import']['local_paths'] = (!empty($_SESSION['pmxi_import']['local_paths'])) ? $_SESSION['pmxi_import']['local_paths'] : array($_SESSION['pmxi_import']['filePath']);
770
  foreach ($_SESSION['pmxi_import']['local_paths'] as $key => $path) {
771
- $file = new PMXI_Chunk($path, array('element' => $_SESSION['pmxi_import']['source']['root_element']));
772
- // loop through the file until all lines are read
773
- while ($xml = $file->read()) {
774
- if (!empty($xml))
775
- {
776
- PMXI_Import_Record::preprocessXml($xml);
777
-
778
- $dom = new DOMDocument('1.0', 'UTF-8');
779
- $old = libxml_use_internal_errors(true);
780
- $dom->loadXML(preg_replace('%xmlns\s*=\s*([\'"]).*\1%sU', '', $xml)); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
781
- libxml_use_internal_errors($old);
782
- $xpath = new DOMXPath($dom);
783
- if (($this->data['elements'] = $elements = @$xpath->query($_SESSION['pmxi_import']['xpath'])) and $elements->length){
784
- if ($loop == $this->data['tagno']){
785
- $_SESSION['pmxi_import']['xml'] = $xml;
786
- break;
787
- } else unset($dom, $xpath, $elements);
788
- $loop++;
789
- }
790
- }
791
- }
792
- unset($file);
 
 
 
793
  }
794
  }
795
 
@@ -805,7 +812,8 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
805
  'title' => '',
806
  'content' => '',
807
  'is_keep_linebreaks' => 0,
808
- 'is_leave_html' => 0
 
809
  ));
810
  $wp_uploads = wp_upload_dir();
811
 
@@ -817,7 +825,8 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
817
  // loop through the file until all lines are read
818
  while ($xml = $file->read()) {
819
  if (!empty($xml))
820
- {
 
821
  PMXI_Import_Record::preprocessXml($xml);
822
 
823
  $dom = new DOMDocument('1.0', 'UTF-8');
@@ -849,7 +858,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
849
  if ( ! isset($this->data['title']) or '' == strval(trim(strip_tags($this->data['title'], '<img><input><textarea><iframe><object><embed>')))) {
850
  $this->errors->add('xml-parsing', __('<strong>Warning</strong>: resulting post title is empty', 'pmxi_plugin'));
851
  }
852
- else $this->data['title'] = ($post['is_leave_html']) ? utf8_encode(html_entity_decode($this->data['title'])) : $this->data['title'];
853
  }
854
  } catch (XmlImportException $e) {
855
  $this->errors->add('form-validation', sprintf(__('Error parsing title: %s', 'pmxi_plugin'), $e->getMessage()));
@@ -862,7 +871,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
862
  if ( ! isset($this->data['content']) or '' == strval(trim(strip_tags($this->data['content'], '<img><input><textarea><iframe><object><embed>')))) {
863
  $this->errors->add('xml-parsing', __('<strong>Warning</strong>: resulting post content is empty', 'pmxi_plugin'));
864
  }
865
- else $this->data['content'] = ($post['is_leave_html']) ? utf8_encode(html_entity_decode($this->data['content'])) : $this->data['content'];
866
  }
867
  } catch (XmlImportException $e) {
868
  $this->errors->add('form-validation', sprintf(__('Error parsing content: %s', 'pmxi_plugin'), $e->getMessage()));
@@ -1096,18 +1105,34 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1096
  )
1097
  );
1098
 
1099
- if ( ! PMXI_Plugin::is_ajax()) {
1100
-
1101
- $this->render();
1102
- wp_ob_end_flush_all(); flush();
1103
 
1104
  // Save import history
1105
  if ( $_SESSION['pmxi_import']['chunk_number'] === 1 ){
1106
  // store import info in database
1107
- $import->save();
 
 
 
 
 
1108
 
 
 
1109
  if ($_SESSION['pmxi_import']['large_file']) $_SESSION['pmxi_import']['update_previous'] = $import->id;
1110
 
 
 
 
 
 
 
 
 
 
 
 
 
1111
  if ($save_history){
1112
  $history_file = new PMXI_File_Record();
1113
  $history_file->set(array(
@@ -1117,8 +1142,11 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1117
  'contents' => $_SESSION['pmxi_import']['xml'],
1118
  'registered_on' => date('Y-m-d H:i:s'),
1119
  ))->save();
1120
- }
1121
  }
 
 
 
1122
  }
1123
 
1124
  // create chunks
@@ -1150,7 +1178,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1150
  if ($new_chunk){
1151
  $tmpname = $wp_uploads['path'] .'/'. wp_unique_filename($wp_uploads['path'], basename($path));
1152
  $c = fopen($tmpname, 'w');
1153
- fwrite($c, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<".$_SESSION['pmxi_import']['source']['root_element'] ."s>\n");
1154
  }
1155
 
1156
  fwrite($c, $xml . "\n");
@@ -1203,6 +1231,8 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1203
 
1204
  if ($_SESSION['pmxi_import']['options']['create_chunks'] and $_SESSION['pmxi_import']['action'] != 'continue'){
1205
 
 
 
1206
  ob_start();
1207
 
1208
  $xml = file_get_contents($path);
@@ -1233,6 +1263,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1233
 
1234
  if (!empty($xml))
1235
  {
 
1236
  PMXI_Import_Record::preprocessXml($xml);
1237
 
1238
  $dom = new DOMDocument('1.0', 'UTF-8');
@@ -1248,23 +1279,26 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1248
  if ( $loop == $_SESSION['pmxi_import']['options']['records_per_request'] - 1 ) exit(ob_get_clean());
1249
  $loop++;
1250
  }
1251
- }
1252
-
1253
- if ($_SESSION['pmxi_import']['created_records'] + $_SESSION['pmxi_import']['updated_records'] == $_SESSION['pmxi_import']['count']){
1254
- array_shift($_SESSION['pmxi_import']['local_paths']);
1255
- exit(ob_get_clean());
1256
- }
1257
 
1258
- $_SESSION['pmxi_import']['pointer'] = 0;
1259
-
1260
- in_array($import->type,array('ftp')) and !empty($_SESSION['pmxi_import']['local_paths']) and $logger and call_user_func($logger, sprintf(__('Importing %s', 'pmxi_plugin'), $_SESSION['pmxi_import']['local_paths'][0]));
1261
-
1262
- }
 
 
 
 
 
 
 
 
 
 
1263
  }
1264
  }
1265
- }
1266
-
1267
- do_action( 'pmxi_after_xml_import' );
1268
 
1269
  if (! $_SESSION['pmxi_import']['large_file'] or PMXI_Plugin::is_ajax()){
1270
 
@@ -1273,12 +1307,16 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1273
  if (file_exists($log_file)) unlink($log_file);
1274
  @file_put_contents($log_file, $_SESSION['pmxi_import']['log']);
1275
 
 
 
1276
  // clear import session
1277
  unset($_SESSION['pmxi_import']); // clear session data (prevent from reimporting the same data on page refresh)
1278
 
1279
  // [indicate in header process is complete]
1280
  $msg = addcslashes(__('Complete', 'pmxi_plugin'), "'\n\r");
1281
 
 
 
1282
  ob_start();
1283
 
1284
  echo '<a id="download_pmxi_log" class="update" href="'.esc_url(add_query_arg(array('id' => $import->id, 'action' => 'log', 'page' => 'pmxi-admin-manage'), $this->baseUrl)).'">Download log</a>';
@@ -1300,9 +1338,11 @@ echo <<<COMPLETE
1300
  COMPLETE;
1301
  // [/indicate in header process is complete]
1302
 
1303
- echo ob_get_clean(); die;
1304
 
1305
- }
 
 
1306
  }
1307
 
1308
  protected $_sibling_limit = 20;
14
 
15
  try{
16
  $path = session_save_path();
17
+ if ( ! @is_dir($path) or ! @is_writable($path)){
18
  @ini_set("session.save_handler", "files");
19
  session_save_path(sys_get_temp_dir());
20
  }
122
  'large_file' => '',
123
  'filepath' => '',
124
  'root_element' => ''
125
+ ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
 
127
  if ($this->input->post('is_submitted_continue')) {
128
  if ( ! empty($_SESSION['pmxi_import']['xml'])) {
276
 
277
  if ($this->input->post('is_submitted') and ! $this->errors->get_error_codes()) {
278
 
279
+ check_admin_referer('choose-file', '_wpnonce_choose-file');
280
+
281
+ $elements_cloud = array();
282
 
283
+ $is_validate = true;
284
 
285
  if (empty($xml)){
286
 
307
  PMXI_Import_Record::preprocessXml($chunk_xml);
308
  if ( ! $chunks ){ // save first chunk to the file
309
  $chunk_path = $wp_uploads['path'] .'/'. wp_unique_filename($wp_uploads['path'], "chunk_".basename($path));
310
+ file_put_contents($chunk_path, $file->encoding . "\n" . $chunk_xml);
311
+ chmod($chunk_path, 0755);
312
+ $is_validate = $file->is_validate;
313
  }
314
  $chunks++;
315
  }
346
  }
347
  }
348
 
349
+ if ((!$is_validate or PMXI_Import_Record::validateXml($xml, $this->errors)) and (empty($post['large_file']) or (!empty($post['large_file']) and !empty($chunks)))) {
350
  // xml is valid
351
  if (!empty($post['large_file'])){
352
  $source['large_import'] = 'Yes';
362
  $_SESSION['pmxi_import'] = array(
363
  'xml' => $xml,
364
  'filePath' => $filePath,
365
+ 'xpath' => (!empty($xpath)) ? $xpath : '',
366
  'source' => $source,
367
  'large_file' => (!empty($post['large_file'])) ? true : false,
368
  'chunk_number' => 1,
398
  wp_redirect(add_query_arg('action', 'element', $this->baseUrl)); die();
399
 
400
  }
401
+ else {
402
+ $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@soflyy.com">support@soflyy.com</a> – with your XML/CSV file. We will identify the problem and release a bug fix if necessary.', 'pmxi_plugin'));
403
+ }
404
+ }
405
 
406
  $this->render();
407
  }
441
  }
442
 
443
  if ( ! $this->errors->get_error_codes()) {
444
+
445
  $_SESSION['pmxi_import']['xpath'] = $post['xpath'];
446
  // counting element selected by xPath
447
+ if ($_SESSION['pmxi_import']['large_file']){
448
+
449
  $_SESSION['pmxi_import']['count'] = 0;
450
 
451
  $this->data['node_list_count'] = 0;
460
  while ($xml = $file->read()) {
461
 
462
  if (!empty($xml))
463
+ {
464
+ $xml = $file->encoding . "\n" . $xml;
465
  PMXI_Import_Record::preprocessXml($xml);
466
 
467
  $dom = new DOMDocument('1.0', 'UTF-8');
490
  wp_redirect(add_query_arg('action', 'template', $this->baseUrl)); die();
491
  }
492
  } else {
493
+
494
+ if (isset($_SESSION['pmxi_import']['xpath']) and $_SESSION['pmxi_import']['large_file']) {
 
 
495
  $post['xpath'] = $_SESSION['pmxi_import']['xpath'];
496
  $this->data['elements'] = $elements = $xpath->query($post['xpath']);
497
  if ( ! $elements->length and ! empty($_SESSION['pmxi_import']['update_previous'])) {
533
  $this->errors->add('form-validation', __('No elements selected', 'pmxi_plugin'));
534
  } else {
535
  // counting selected elements
536
+ if ($_SESSION['pmxi_import']['large_file']){ // in large mode
 
 
 
 
537
 
538
+ if ($post['show_element'] == 1) {
539
+ $_SESSION['pmxi_import']['count'] = $this->data['node_list_count'] = 0;
540
+ }
541
+ else
542
+ $this->data['node_list_count'] = $_SESSION['pmxi_import']['count'];
543
+
544
+
545
  $xpath_elements = explode('[', $post['xpath']);
546
  $xpath_parts = explode('/', $xpath_elements[0]);
547
 
548
  $_SESSION['pmxi_import']['source']['root_element'] = $xpath_parts[count($xpath_parts) - 1];
549
+
550
  $loop = 1;
551
 
552
  foreach ($_SESSION['pmxi_import']['local_paths'] as $key => $path) {
554
  $file = new PMXI_Chunk($path, array('element' => $_SESSION['pmxi_import']['source']['root_element'], 'path' => $wp_uploads['path']));
555
  // loop through the file until all lines are read
556
  while ($xml = $file->read()) {
557
+
558
  if (!empty($xml))
559
+ {
560
+ $xml = $file->encoding . "\n" . $xml;
561
+ PMXI_Import_Record::preprocessXml($xml);
562
 
563
+ $dom = new DOMDocument('1.0', 'UTF-8');
564
  $old = libxml_use_internal_errors(true);
565
+ $dom->loadXML(preg_replace('%xmlns\s*=\s*([\'"]).*\1%sU', '', $xml)); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
566
  libxml_use_internal_errors($old);
567
  $xpath = new DOMXPath($dom);
568
+ if (($this->data['elements'] = $elements = @$xpath->query($post['xpath'])) and $elements->length){
569
+
570
+ if ($post['show_element'] == 1){
571
+ $_SESSION['pmxi_import']['count']++;
572
+ $this->data['node_list_count']++;
573
+ }
574
+
575
+ if ($loop == $post['show_element'] ){
576
+ $_SESSION['pmxi_import']['xml'] = $xml;
577
+ $this->data['dom'] = $dom;
578
+ if ($post['show_element'] > 1)
579
+ break;
580
  }
581
  else unset($dom, $xpath, $elements);
582
  $loop++;
583
+ }
584
  }
585
+ }
586
  unset($file);
587
  }
588
  if ( ! $this->data['node_list_count']) {
638
  'content' => '',
639
  'name' => '',
640
  'is_keep_linebreaks' => 0,
641
+ 'is_leave_html' => 0,
642
+ 'fix_characters' => 0
643
  );
644
  if ($this->isWizard) {
645
  $this->data['post'] = $post = $this->input->post(
659
  'title' => $template->title,
660
  'content' => $template->content,
661
  'is_keep_linebreaks' => $template->is_keep_linebreaks,
662
+ 'is_leave_html' => $template->is_leave_html,
663
+ 'fix_characters' => $template->fix_characters,
664
  'name' => '', // template is always empty
665
  );
666
  $_SESSION['pmxi_import']['is_loaded_template'] = $load_template;
743
  $history_file = new PMXI_File_Record();
744
  $history_file->getBy('id', $history[0]['id']);
745
 
746
+ if ($update_previous->large_import == 'Yes'){
747
  $_SESSION['pmxi_import']['filePath'] = $history_file->path;
748
+ if (!@file_exists($_SESSION['pmxi_import']['filePath'])) $_SESSION['pmxi_import']['filePath'] = $wp_uploads['basedir'] . '/wpallimport_history/' . $history_file->id;
749
  $_SESSION['pmxi_import']['source']['root_element'] = $update_previous->root_element;
750
  $_SESSION['pmxi_import']['large_file'] = true;
751
  $_SESSION['pmxi_import']['count'] = $update_previous->count;
772
  $loop = 1;
773
  $_SESSION['pmxi_import']['local_paths'] = (!empty($_SESSION['pmxi_import']['local_paths'])) ? $_SESSION['pmxi_import']['local_paths'] : array($_SESSION['pmxi_import']['filePath']);
774
  foreach ($_SESSION['pmxi_import']['local_paths'] as $key => $path) {
775
+ if (file_exists($path)){
776
+ $file = new PMXI_Chunk($path, array('element' => $_SESSION['pmxi_import']['source']['root_element']));
777
+ // loop through the file until all lines are read
778
+ while ($xml = $file->read()) {
779
+ if (!empty($xml))
780
+ {
781
+ $xml = $file->encoding . "\n" . $xml;
782
+ PMXI_Import_Record::preprocessXml($xml);
783
+
784
+ $dom = new DOMDocument('1.0', 'UTF-8');
785
+ $old = libxml_use_internal_errors(true);
786
+ $dom->loadXML(preg_replace('%xmlns\s*=\s*([\'"]).*\1%sU', '', $xml)); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
787
+ libxml_use_internal_errors($old);
788
+ $xpath = new DOMXPath($dom);
789
+ if (($this->data['elements'] = $elements = @$xpath->query($_SESSION['pmxi_import']['xpath'])) and $elements->length){
790
+ if ($loop == $this->data['tagno']){
791
+ $_SESSION['pmxi_import']['xml'] = $xml;
792
+ break;
793
+ } else unset($dom, $xpath, $elements);
794
+ $loop++;
795
+ }
796
+ }
797
+ }
798
+ unset($file);
799
+ }
800
  }
801
  }
802
 
812
  'title' => '',
813
  'content' => '',
814
  'is_keep_linebreaks' => 0,
815
+ 'is_leave_html' => 0,
816
+ 'fix_characters' => 0
817
  ));
818
  $wp_uploads = wp_upload_dir();
819
 
825
  // loop through the file until all lines are read
826
  while ($xml = $file->read()) {
827
  if (!empty($xml))
828
+ {
829
+ $xml = $file->encoding . "\n" . $xml;
830
  PMXI_Import_Record::preprocessXml($xml);
831
 
832
  $dom = new DOMDocument('1.0', 'UTF-8');
858
  if ( ! isset($this->data['title']) or '' == strval(trim(strip_tags($this->data['title'], '<img><input><textarea><iframe><object><embed>')))) {
859
  $this->errors->add('xml-parsing', __('<strong>Warning</strong>: resulting post title is empty', 'pmxi_plugin'));
860
  }
861
+ else $this->data['title'] = ($post['fix_characters']) ? utf8_encode(html_entity_decode($this->data['title'])) : (($post['is_leave_html']) ? html_entity_decode($this->data['title']) : $this->data['title']);
862
  }
863
  } catch (XmlImportException $e) {
864
  $this->errors->add('form-validation', sprintf(__('Error parsing title: %s', 'pmxi_plugin'), $e->getMessage()));
871
  if ( ! isset($this->data['content']) or '' == strval(trim(strip_tags($this->data['content'], '<img><input><textarea><iframe><object><embed>')))) {
872
  $this->errors->add('xml-parsing', __('<strong>Warning</strong>: resulting post content is empty', 'pmxi_plugin'));
873
  }
874
+ else $this->data['content'] = ($post['fix_characters']) ? utf8_encode(html_entity_decode($this->data['content'])) : (($post['is_leave_html']) ? html_entity_decode($this->data['content']) : $this->data['content']);
875
  }
876
  } catch (XmlImportException $e) {
877
  $this->errors->add('form-validation', sprintf(__('Error parsing content: %s', 'pmxi_plugin'), $e->getMessage()));
1105
  )
1106
  );
1107
 
1108
+ if ( ! PMXI_Plugin::is_ajax()) {
 
 
 
1109
 
1110
  // Save import history
1111
  if ( $_SESSION['pmxi_import']['chunk_number'] === 1 ){
1112
  // store import info in database
1113
+ $import->set(array(
1114
+ 'imported' => 0,
1115
+ 'created' => 0,
1116
+ 'updated' => 0,
1117
+ 'skipped' => 0
1118
+ ))->save();
1119
 
1120
+ do_action( 'pmxi_before_xml_import', $import->id );
1121
+
1122
  if ($_SESSION['pmxi_import']['large_file']) $_SESSION['pmxi_import']['update_previous'] = $import->id;
1123
 
1124
+ // unlick previous files
1125
+ $history = new PMXI_File_List();
1126
+ $history->setColumns('id', 'name', 'registered_on', 'path')->getBy(array('import_id' => $import->id), 'id DESC');
1127
+ if ($history->count()){
1128
+ foreach ($history as $file){
1129
+ if (@file_exists($file['path']) and $file['path'] != $_SESSION['pmxi_import']['filePath']) @unlink($file['path']);
1130
+ $history_file = new PMXI_File_Record();
1131
+ $history_file->getBy('id', $file['id']);
1132
+ if ( ! $history_file->isEmpty()) $history_file->delete();
1133
+ }
1134
+ }
1135
+
1136
  if ($save_history){
1137
  $history_file = new PMXI_File_Record();
1138
  $history_file->set(array(
1142
  'contents' => $_SESSION['pmxi_import']['xml'],
1143
  'registered_on' => date('Y-m-d H:i:s'),
1144
  ))->save();
1145
+ }
1146
  }
1147
+
1148
+ $this->render();
1149
+ wp_ob_end_flush_all(); flush();
1150
  }
1151
 
1152
  // create chunks
1178
  if ($new_chunk){
1179
  $tmpname = $wp_uploads['path'] .'/'. wp_unique_filename($wp_uploads['path'], basename($path));
1180
  $c = fopen($tmpname, 'w');
1181
+ fwrite($c, $file->encoding . "\n" . "<".$_SESSION['pmxi_import']['source']['root_element'] ."s>\n");
1182
  }
1183
 
1184
  fwrite($c, $xml . "\n");
1231
 
1232
  if ($_SESSION['pmxi_import']['options']['create_chunks'] and $_SESSION['pmxi_import']['action'] != 'continue'){
1233
 
1234
+ if ($_SESSION['pmxi_import']['created_records'] + $_SESSION['pmxi_import']['updated_records'] == $_SESSION['pmxi_import']['count']) break;
1235
+
1236
  ob_start();
1237
 
1238
  $xml = file_get_contents($path);
1263
 
1264
  if (!empty($xml))
1265
  {
1266
+ $xml = $file->encoding . "\n" . $xml;
1267
  PMXI_Import_Record::preprocessXml($xml);
1268
 
1269
  $dom = new DOMDocument('1.0', 'UTF-8');
1279
  if ( $loop == $_SESSION['pmxi_import']['options']['records_per_request'] - 1 ) exit(ob_get_clean());
1280
  $loop++;
1281
  }
1282
+ }
 
 
 
 
 
1283
 
1284
+ if (($_SESSION['pmxi_import']['created_records'] + $_SESSION['pmxi_import']['updated_records'] == $_SESSION['pmxi_import']['count']) and !in_array($import->type, array('ftp'))){
1285
+ $_SESSION['pmxi_import']['pointer'] = 0;
1286
+ array_shift($_SESSION['pmxi_import']['local_paths']);
1287
+ exit(ob_get_clean());
1288
+ }
1289
+ }
1290
+
1291
+ if (in_array($import->type, array('ftp'))) {
1292
+ $_SESSION['pmxi_import']['pointer'] = 0;
1293
+ array_shift($_SESSION['pmxi_import']['local_paths']);
1294
+ if (!empty($_SESSION['pmxi_import']['local_paths'])) {
1295
+ $logger and call_user_func($logger, sprintf(__('Importing %s', 'pmxi_plugin'), $_SESSION['pmxi_import']['local_paths'][0]));
1296
+ }
1297
+ exit(ob_get_clean());
1298
+ }
1299
  }
1300
  }
1301
+ }
 
 
1302
 
1303
  if (! $_SESSION['pmxi_import']['large_file'] or PMXI_Plugin::is_ajax()){
1304
 
1307
  if (file_exists($log_file)) unlink($log_file);
1308
  @file_put_contents($log_file, $_SESSION['pmxi_import']['log']);
1309
 
1310
+ if (!empty($_SESSION['pmxi_import'])) do_action( 'pmxi_after_xml_import', $import->id );
1311
+
1312
  // clear import session
1313
  unset($_SESSION['pmxi_import']); // clear session data (prevent from reimporting the same data on page refresh)
1314
 
1315
  // [indicate in header process is complete]
1316
  $msg = addcslashes(__('Complete', 'pmxi_plugin'), "'\n\r");
1317
 
1318
+ delete_option('category_children');
1319
+
1320
  ob_start();
1321
 
1322
  echo '<a id="download_pmxi_log" class="update" href="'.esc_url(add_query_arg(array('id' => $import->id, 'action' => 'log', 'page' => 'pmxi-admin-manage'), $this->baseUrl)).'">Download log</a>';
1338
  COMPLETE;
1339
  // [/indicate in header process is complete]
1340
 
1341
+ echo ob_get_clean();
1342
 
1343
+ die;
1344
+
1345
+ }
1346
  }
1347
 
1348
  protected $_sibling_limit = 20;
controllers/admin/manage.php CHANGED
@@ -209,6 +209,8 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
209
 
210
  $local_paths = !empty($local_paths) ? $local_paths : array($filePath);
211
 
 
 
212
  foreach ($local_paths as $key => $path) {
213
 
214
  $file = new PMXI_Chunk($path, array('element' => $item->root_element, 'path' => $uploads['path']));
@@ -217,30 +219,54 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
217
 
218
  if (!empty($xml))
219
  {
220
- PMXI_Import_Record::preprocessXml($xml);
221
-
222
- $dom = new DOMDocument('1.0', 'UTF-8');
223
- $old = libxml_use_internal_errors(true);
224
- $dom->loadXML(preg_replace('%xmlns\s*=\s*([\'"]).*\1%sU', '', $xml)); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
225
- libxml_use_internal_errors($old);
226
- $xpath = new DOMXPath($dom);
227
- if (($this->data['elements'] = $elements = @$xpath->query($item->xpath)) and $elements->length) {
228
- if ( !$chunks) {
229
- $chunk_path = $uploads['path'] .'/'. wp_unique_filename($uploads['path'], "chunk_".basename($path));
230
- if (file_exists($chunk_path)) unlink($chunk_path);
231
- file_put_contents($chunk_path, '<?xml version="1.0" encoding="utf-8"?>'."\n".$xml);
232
- chmod($chunk_path, 0755);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  }
234
- $chunks++;
235
-
236
- if (!empty($action_type) and $action_type == 'continue' and $chunks == $item->imported) $pointer = $file->pointer;
237
-
238
  }
239
- unset($dom, $xpath, $elements);
240
  }
241
  }
242
  unset($file);
243
-
244
  !$key and $filePath = $path;
245
  }
246
 
@@ -268,43 +294,55 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
268
 
269
  if ($item->large_import == 'Yes' or PMXI_Import_Record::validateXml($xml, $this->errors)) { // xml is valid
270
 
271
- $item->set(array(
272
- 'processing' => 0,
273
- 'queue_chunk_number' => 0,
274
- 'current_post_ids' => ''
275
- ))->save();
276
-
277
- // compose data to look like result of wizard steps
278
- $_SESSION['pmxi_import'] = (empty($_SESSION['pmxi_import']['chunk_number'])) ? array(
279
- 'xml' => (isset($xml)) ? $xml : '',
280
- 'filePath' => $filePath,
281
- 'source' => array(
282
- 'name' => $item->name,
283
- 'type' => $item->type,
284
- 'path' => $item->path,
285
- 'root_element' => $item->root_element,
286
- ),
287
- 'update_previous' => $item->id,
288
- 'xpath' => $item->xpath,
289
- 'template' => $item->template,
290
- 'options' => $item->options,
291
- 'scheduled' => $item->scheduled,
292
- 'current_post_ids' => '',
293
- 'large_file' => ($item->large_import == 'Yes') ? true : false,
294
- 'chunk_number' => (!empty($action_type) and $action_type == 'continue') ? $item->imported : 1,
295
- 'pointer' => $pointer,
296
- 'log' => '',
297
- 'created_records' => (!empty($action_type) and $action_type == 'continue') ? $item->created : 0,
298
- 'updated_records' => (!empty($action_type) and $action_type == 'continue') ? $item->updated : 0,
299
- 'skipped_records' => (!empty($action_type) and $action_type == 'continue') ? $item->skipped : 0,
300
- 'warnings' => 0,
301
- 'errors' => 0,
302
- 'start_time' => 0,
303
- 'count' => (isset($chunks)) ? $chunks : 0,
304
- 'local_paths' => (!empty($local_paths)) ? $local_paths : array(), // ftp import local copies of remote files
305
- 'action' => (!empty($action_type) and $action_type == 'continue') ? 'continue' : 'update',
306
- ) : $_SESSION['pmxi_import'];
307
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  // deligate operation to other controller
309
  $controller = new PMXI_Admin_Import();
310
  $controller->data['update_previous'] = $item;
209
 
210
  $local_paths = !empty($local_paths) ? $local_paths : array($filePath);
211
 
212
+ $chunk_founded = false;
213
+
214
  foreach ($local_paths as $key => $path) {
215
 
216
  $file = new PMXI_Chunk($path, array('element' => $item->root_element, 'path' => $uploads['path']));
219
 
220
  if (!empty($xml))
221
  {
222
+ if (!empty($action_type) and $action_type == 'continue'){
223
+ if ( !$chunk_founded) {
224
+ $xml = $file->encoding . "\n" . $xml;
225
+ PMXI_Import_Record::preprocessXml($xml);
226
+
227
+ $dom = new DOMDocument('1.0', 'UTF-8');
228
+ $old = libxml_use_internal_errors(true);
229
+ $dom->loadXML(preg_replace('%xmlns\s*=\s*([\'"]).*\1%sU', '', $xml)); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
230
+ libxml_use_internal_errors($old);
231
+ $xpath = new DOMXPath($dom);
232
+ if (($elements = @$xpath->query($item->xpath)) and !empty($elements) and !empty($elements->length)) {
233
+ $chunk_path = $uploads['path'] .'/'. wp_unique_filename($uploads['path'], "chunk_".basename($path));
234
+ file_put_contents($chunk_path, $xml);
235
+ chmod($chunk_path, 0755);
236
+ $chunk_founded = true;
237
+ }
238
+ unset($dom, $xpath, $elements);
239
+ }
240
+ $chunks++;
241
+ if ($chunks == $item->imported){
242
+ $pointer = $file->pointer;
243
+ $chunks = $item->count;
244
+ break;
245
+ }
246
+ }
247
+ else{
248
+ $xml = $file->encoding . "\n" . $xml;
249
+ PMXI_Import_Record::preprocessXml($xml);
250
+
251
+ $dom = new DOMDocument('1.0', 'UTF-8');
252
+ $old = libxml_use_internal_errors(true);
253
+ $dom->loadXML(preg_replace('%xmlns\s*=\s*([\'"]).*\1%sU', '', $xml)); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
254
+ libxml_use_internal_errors($old);
255
+ $xpath = new DOMXPath($dom);
256
+ if (($elements = @$xpath->query($item->xpath)) and !empty($elements) and !empty($elements->length)) {
257
+ if ( !$chunks) {
258
+ $chunk_path = $uploads['path'] .'/'. wp_unique_filename($uploads['path'], "chunk_".basename($path));
259
+ file_put_contents($chunk_path, $xml);
260
+ chmod($chunk_path, 0755);
261
+ }
262
+ $chunks++;
263
  }
264
+ unset($dom, $xpath, $elements);
 
 
 
265
  }
 
266
  }
267
  }
268
  unset($file);
269
+
270
  !$key and $filePath = $path;
271
  }
272
 
294
 
295
  if ($item->large_import == 'Yes' or PMXI_Import_Record::validateXml($xml, $this->errors)) { // xml is valid
296
 
297
+ if ( ! PMXI_Plugin::is_ajax() and empty($_SESSION['pmxi_import']['chunk_number'])){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
 
299
+ $item->set(array(
300
+ 'processing' => 0,
301
+ 'queue_chunk_number' => 0,
302
+ 'current_post_ids' => ''
303
+ ))->save();
304
+
305
+ if (empty($action_type)){
306
+ $item->set(array(
307
+ 'imported' => 0,
308
+ 'created' => 0,
309
+ 'updated' => 0,
310
+ 'skipped' => 0
311
+ ))->save();
312
+ }
313
+
314
+ // compose data to look like result of wizard steps
315
+ $_SESSION['pmxi_import'] = array(
316
+ 'xml' => (isset($xml)) ? $xml : '',
317
+ 'filePath' => $filePath,
318
+ 'source' => array(
319
+ 'name' => $item->name,
320
+ 'type' => $item->type,
321
+ 'path' => $item->path,
322
+ 'root_element' => $item->root_element,
323
+ ),
324
+ 'update_previous' => $item->id,
325
+ 'xpath' => $item->xpath,
326
+ 'template' => $item->template,
327
+ 'options' => $item->options,
328
+ 'scheduled' => $item->scheduled,
329
+ 'current_post_ids' => '',
330
+ 'large_file' => ($item->large_import == 'Yes') ? true : false,
331
+ 'chunk_number' => (!empty($action_type) and $action_type == 'continue') ? $item->imported : 1,
332
+ 'pointer' => $pointer,
333
+ 'log' => '',
334
+ 'created_records' => (!empty($action_type) and $action_type == 'continue') ? $item->created : 0,
335
+ 'updated_records' => (!empty($action_type) and $action_type == 'continue') ? $item->updated : 0,
336
+ 'skipped_records' => (!empty($action_type) and $action_type == 'continue') ? $item->skipped : 0,
337
+ 'warnings' => 0,
338
+ 'errors' => 0,
339
+ 'start_time' => 0,
340
+ 'count' => (isset($chunks)) ? $chunks : 0,
341
+ 'local_paths' => (!empty($local_paths)) ? $local_paths : array(), // ftp import local copies of remote files
342
+ 'action' => (!empty($action_type) and $action_type == 'continue') ? 'continue' : 'update',
343
+ );
344
+ }
345
+
346
  // deligate operation to other controller
347
  $controller = new PMXI_Admin_Import();
348
  $controller->data['update_previous'] = $item;
controllers/admin/settings.php CHANGED
@@ -46,6 +46,27 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
46
 
47
  $this->render();
48
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
  /**
51
  * upload.php
46
 
47
  $this->render();
48
  }
49
+
50
+ public function dismiss(){
51
+
52
+ PMXI_Plugin::getInstance()->updateOption("dismiss", 1);
53
+
54
+ exit('OK');
55
+ }
56
+
57
+ public function dismiss_manage_top(){
58
+
59
+ PMXI_Plugin::getInstance()->updateOption("dismiss_manage_top", 1);
60
+
61
+ exit('OK');
62
+ }
63
+
64
+ public function dismiss_manage_bottom(){
65
+
66
+ PMXI_Plugin::getInstance()->updateOption("dismiss_manage_bottom", 1);
67
+
68
+ exit('OK');
69
+ }
70
 
71
  /**
72
  * upload.php
controllers/controller/admin.php CHANGED
@@ -65,8 +65,7 @@ abstract class PMXI_Controller_Admin extends PMXI_Controller {
65
  wp_enqueue_script('jquery-browserplus-min', 'http://bp.yahooapis.com/2.4.21/browserplus-min.js', array('jquery'));
66
  wp_enqueue_script('full-plupload', PMXI_ROOT_URL . '/static/js/plupload/plupload.full.js', array('jquery-browserplus-min'));
67
  wp_enqueue_script('jquery-plupload', PMXI_ROOT_URL . '/static/js/plupload/wplupload.js', array('full-plupload', 'jquery'));
68
-
69
- wp_enqueue_script('pmxi-script', PMXI_ROOT_URL . '/static/js/pmxi.js', array('jquery'));
70
  wp_enqueue_script('pmxi-admin-script', PMXI_ROOT_URL . '/static/js/admin.js', array('jquery', 'jquery-ui-dialog', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable'));
71
 
72
  }
65
  wp_enqueue_script('jquery-browserplus-min', 'http://bp.yahooapis.com/2.4.21/browserplus-min.js', array('jquery'));
66
  wp_enqueue_script('full-plupload', PMXI_ROOT_URL . '/static/js/plupload/plupload.full.js', array('jquery-browserplus-min'));
67
  wp_enqueue_script('jquery-plupload', PMXI_ROOT_URL . '/static/js/plupload/wplupload.js', array('full-plupload', 'jquery'));
68
+
 
69
  wp_enqueue_script('pmxi-admin-script', PMXI_ROOT_URL . '/static/js/admin.js', array('jquery', 'jquery-ui-dialog', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable'));
70
 
71
  }
helpers/pmxi_functions.php CHANGED
@@ -154,39 +154,42 @@
154
  stream_context_set_params($ctx, array("notification" => "stream_notification_callback"));*/
155
 
156
  $type = (preg_match('%\W(csv)$%i', basename($filePath))) ? 'csv' : false;
157
- $type = (preg_match('%\W(xml)$%i', basename($filePath))) ? 'xml' : false;
158
 
159
  $uploads = wp_upload_dir();
160
  $tmpname = wp_unique_filename($uploads['path'], basename($filePath));
161
  $localPath = $uploads['path'] .'/'. $tmpname;
162
 
163
- get_file_curl($filePath, $localPath);
164
 
165
- if (file_exists($localPath)) {
 
 
 
 
 
 
 
 
 
 
 
 
 
166
 
 
 
167
  if (!$type){
168
  $file = @fopen($localPath, "rb");
169
  while (!feof($file)) {
170
  $chunk = @fread($file, 1024);
171
- if (strpos($chunk, "<") !== false) $type = 'xml'; else $type = 'csv'; // if it's a 1st chunk, then chunk <? symbols to detect XML file
172
  break;
173
  }
174
  @fclose($file);
175
  }
176
 
177
- } else {
178
- $file = @fopen($filePath, "rb");
179
- $fp = @fopen($localPath, 'w');
180
- $first_chunk = true;
181
- while (!feof($file)) {
182
- $chunk = @fread($file, 1024);
183
- if (!$type and $first_chunk and strpos($chunk, "<") !== false) $type = 'xml'; elseif (!$type and $first_chunk) $type = 'csv'; // if it's a 1st chunk, then chunk <? symbols to detect XML file
184
- $first_chunk = false;
185
- @fwrite($fp, $chunk);
186
- }
187
- @fclose($file);
188
- @fclose($fp);
189
- }
190
 
191
  return ($detect) ? array('type' => $type, 'localPath' => $localPath) : $localPath;
192
  }
@@ -203,7 +206,7 @@
203
  $first_chunk = true;
204
  while (!gzeof($file)) {
205
  $chunk = gzread($file, 1024);
206
- 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
207
  @fwrite($fp, $chunk);
208
  }
209
  gzclose($file);
@@ -211,58 +214,7 @@
211
  @fclose($fp);
212
  $localPath = $uploads['path'] .'/'. $tmpname;
213
  return array('type' => $type, 'localPath' => $localPath);
214
- }
215
-
216
- function stream_notification_callback($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max) {
217
- static $filesize = null;
218
-
219
- $msg = '';
220
- switch($notification_code) {
221
- case STREAM_NOTIFY_RESOLVE:
222
- case STREAM_NOTIFY_AUTH_REQUIRED:
223
- case STREAM_NOTIFY_COMPLETED:
224
- case STREAM_NOTIFY_FAILURE:
225
- case STREAM_NOTIFY_AUTH_RESULT:
226
- /* Ignore */
227
- break;
228
-
229
- case STREAM_NOTIFY_REDIRECTED:
230
- //$msg = "Being redirected to: ". $message;
231
- break;
232
-
233
- case STREAM_NOTIFY_CONNECT:
234
- //$msg = "Connected...";
235
- break;
236
-
237
- case STREAM_NOTIFY_FILE_SIZE_IS:
238
- $filesize = $bytes_max;
239
- //$msg = "Filesize: ". $filesize;
240
- break;
241
-
242
- case STREAM_NOTIFY_MIME_TYPE_IS:
243
- //$msg = "Mime-type: ". $message;
244
- break;
245
-
246
- case STREAM_NOTIFY_PROGRESS:
247
- if ($bytes_transferred > 0) {
248
- echo "<script type='text/javascript'>";
249
- if (!isset($filesize)) {
250
- printf("document.getElementById('url_progressbar').innerHTML('Unknown filesize.. %2d kb done..');", $bytes_transferred/1024);
251
- } else {
252
- $length = (int)(($bytes_transferred/$filesize)*100);
253
- echo "document.getElementById('url_upload_value').style.width = ".$length."%";
254
- printf("document.getElementById('url_progressbar').innerHTML('%02d%% (%0".strlen($filesize/1024)."d/%2d kb)');", $length, ($bytes_transferred/1024), $filesize/1024);
255
- }
256
- echo "</script>";
257
- echo(str_repeat(' ', 256));
258
- if (@ob_get_contents()) {
259
- @ob_end_flush();
260
- }
261
- flush();
262
- }
263
- break;
264
- }
265
- }
266
 
267
  function pmxi_strip_tags_content($text, $tags = '', $invert = FALSE) {
268
 
154
  stream_context_set_params($ctx, array("notification" => "stream_notification_callback"));*/
155
 
156
  $type = (preg_match('%\W(csv)$%i', basename($filePath))) ? 'csv' : false;
157
+ if (!$type) $type = (preg_match('%\W(xml)$%i', basename($filePath))) ? 'xml' : false;
158
 
159
  $uploads = wp_upload_dir();
160
  $tmpname = wp_unique_filename($uploads['path'], basename($filePath));
161
  $localPath = $uploads['path'] .'/'. $tmpname;
162
 
163
+ $file = @fopen($filePath, "rb");
164
 
165
+ if (is_resource($file)){
166
+ $fp = @fopen($localPath, 'w');
167
+ $first_chunk = true;
168
+ while (!feof($file)) {
169
+ $chunk = @fread($file, 1024);
170
+ if (!$type and $first_chunk and strpos($chunk, "<") !== false) $type = 'xml'; elseif (!$type and $first_chunk) $type = 'csv'; // if it's a 1st chunk, then chunk <? symbols to detect XML file
171
+ $first_chunk = false;
172
+ @fwrite($fp, $chunk);
173
+ }
174
+ @fclose($file);
175
+ @fclose($fp);
176
+ }
177
+
178
+ if (!file_exists($localPath)) {
179
 
180
+ get_file_curl($filePath, $localPath);
181
+
182
  if (!$type){
183
  $file = @fopen($localPath, "rb");
184
  while (!feof($file)) {
185
  $chunk = @fread($file, 1024);
186
+ if (strpos($chunk, "<?") !== false) $type = 'xml'; else $type = 'csv'; // if it's a 1st chunk, then chunk <? symbols to detect XML file
187
  break;
188
  }
189
  @fclose($file);
190
  }
191
 
192
+ }
 
 
 
 
 
 
 
 
 
 
 
 
193
 
194
  return ($detect) ? array('type' => $type, 'localPath' => $localPath) : $localPath;
195
  }
206
  $first_chunk = true;
207
  while (!gzeof($file)) {
208
  $chunk = gzread($file, 1024);
209
+ 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
210
  @fwrite($fp, $chunk);
211
  }
212
  gzclose($file);
214
  @fclose($fp);
215
  $localPath = $uploads['path'] .'/'. $tmpname;
216
  return array('type' => $type, 'localPath' => $localPath);
217
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
 
219
  function pmxi_strip_tags_content($text, $tags = '', $invert = FALSE) {
220
 
libraries/XmlImportCsvParse.php CHANGED
@@ -79,7 +79,11 @@ class PMXI_CsvParser
79
 
80
  $large_import = false,
81
 
82
- $xml_path = '';
 
 
 
 
83
 
84
  protected
85
 
@@ -125,7 +129,7 @@ class PMXI_CsvParser
125
  ini_set( "display_errors", 0);
126
  ini_set('auto_detect_line_endings', true);
127
 
128
- $file_params = self::analyse_file($filename, 10);
129
 
130
  $this->set_settings(array('delimiter' => $file_params['delimiter']['value'], 'eol' => $file_params['line_ending']['value']));
131
 
@@ -851,11 +855,16 @@ class PMXI_CsvParser
851
  // Fixes the encoding to uf8
852
  function fixEncoding($in_str)
853
  {
854
- $cur_encoding = mb_detect_encoding($in_str) ;
855
- if($cur_encoding == "UTF-8" && mb_check_encoding($in_str,"UTF-8"))
 
 
 
 
 
 
856
  return $in_str;
857
- else
858
- return utf8_encode($in_str);
859
  } // fixEncoding
860
 
861
  /**
@@ -943,44 +952,40 @@ class PMXI_CsvParser
943
  $tmpname = wp_unique_filename($wp_uploads['path'], str_replace("csv", "xml", basename($this->_filename)));
944
  $this->xml_path = $wp_uploads['path'] .'/'. $tmpname;
945
  $fp = fopen($this->xml_path, 'w');
946
- fwrite($fp, '<?xml version="1.0" encoding="utf-8"?><data>');
947
  }
948
  $create_new_headers = false;
949
-
950
  while ($keys = fgetcsv($res, $l, $d, $e)) {
951
 
952
  if ($c == 0) {
 
953
  foreach ($keys as $key => $value) {
 
954
  $value = trim(strtolower(preg_replace('/^[0-9]{1}/','el_', preg_replace('/[^a-z0-9_]/i', '', $value))));
955
- $keys[$key] = (!empty($value)) ? $value : 'undefined'.$key;
956
- if (preg_match('%\W(http:|https:|ftp:)$%i', $value) or is_numeric($value)) {
957
- $create_new_headers = true;
958
- break;
959
- }
960
  }
961
- $this->headers = $keys;
962
-
963
  if ($create_new_headers) $this->createHeaders('column');
964
 
965
- } else {
966
-
967
  if (!$this->large_import and empty($_POST['large_file'])) {
968
  array_push($this->rows, $keys);
969
  }
970
- else if (!empty($keys[0])){
971
 
972
  $chunk = array();
973
-
974
- foreach ($this->headers as $key => $header) {
975
- $chunk[$header] = $this->fixEncoding($keys[$key]);
976
- }
977
 
 
 
 
 
978
  if (!empty($chunk))
979
- {
980
  fwrite($fp, "<node>");
981
  foreach ($chunk as $header => $value) fwrite($fp, "<".$header.">".$value."</".$header.">");
982
- fwrite($fp, "</node>");
983
- }
984
  }
985
  }
986
 
@@ -989,9 +994,25 @@ class PMXI_CsvParser
989
  fwrite($fp, '</data>');
990
  fclose($fp);
991
  fclose($res);
992
- $this->removeEmpty();
993
 
994
- return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
995
  }
996
 
997
  /**
@@ -1106,14 +1127,15 @@ class PMXI_CsvParser
1106
 
1107
  // read in file
1108
  $fh = fopen($file, 'r');
1109
- $contents = fread($fh, ($capture_limit_in_kb * 1024)); // in KB
1110
  fclose($fh);
1111
 
1112
  // specify allowed field delimiters
1113
  $delimiters = array(
1114
  'comma' => ',',
1115
  'semicolon' => ';',
1116
- 'pipe' => '|'
 
1117
  );
1118
 
1119
  // specify allowed line endings
79
 
80
  $large_import = false,
81
 
82
+ $htmlentities = false,
83
+
84
+ $xml_path = '',
85
+
86
+ $iteration = 0;
87
 
88
  protected
89
 
129
  ini_set( "display_errors", 0);
130
  ini_set('auto_detect_line_endings', true);
131
 
132
+ $file_params = self::analyse_file($filename, 1);
133
 
134
  $this->set_settings(array('delimiter' => $file_params['delimiter']['value'], 'eol' => $file_params['line_ending']['value']));
135
 
855
  // Fixes the encoding to uf8
856
  function fixEncoding($in_str)
857
  {
858
+ if (function_exists('mb_detect_encoding') and function_exists('mb_check_encoding')){
859
+ $cur_encoding = mb_detect_encoding($in_str) ;
860
+ if($cur_encoding == "UTF-8" && mb_check_encoding($in_str,"UTF-8"))
861
+ return $in_str;
862
+ else
863
+ return utf8_encode($in_str);
864
+ }
865
+
866
  return $in_str;
867
+
 
868
  } // fixEncoding
869
 
870
  /**
952
  $tmpname = wp_unique_filename($wp_uploads['path'], str_replace("csv", "xml", basename($this->_filename)));
953
  $this->xml_path = $wp_uploads['path'] .'/'. $tmpname;
954
  $fp = fopen($this->xml_path, 'w');
955
+ fwrite($fp, "<?xml version=\"1.0\" encoding=\"utf-8\"?><data>");
956
  }
957
  $create_new_headers = false;
958
+
959
  while ($keys = fgetcsv($res, $l, $d, $e)) {
960
 
961
  if ($c == 0) {
962
+
963
  foreach ($keys as $key => $value) {
964
+ if (!$create_new_headers and (preg_match('%\W(http:|https:|ftp:)$%i', $value) or is_numeric($value))) $create_new_headers = true;
965
  $value = trim(strtolower(preg_replace('/^[0-9]{1}/','el_', preg_replace('/[^a-z0-9_]/i', '', $value))));
966
+ $keys[$key] = (!empty($value)) ? $value : 'undefined'.$key;
 
 
 
 
967
  }
968
+ $this->headers = $keys;
 
969
  if ($create_new_headers) $this->createHeaders('column');
970
 
971
+ } else {
 
972
  if (!$this->large_import and empty($_POST['large_file'])) {
973
  array_push($this->rows, $keys);
974
  }
975
+ else if (!empty($keys)){
976
 
977
  $chunk = array();
 
 
 
 
978
 
979
+ foreach ($this->headers as $key => $header) {
980
+ $chunk[$header] = $this->fixEncoding(htmlentities($keys[$key]));
981
+ }
982
+
983
  if (!empty($chunk))
984
+ {
985
  fwrite($fp, "<node>");
986
  foreach ($chunk as $header => $value) fwrite($fp, "<".$header.">".$value."</".$header.">");
987
+ fwrite($fp, "</node>");
988
+ }
989
  }
990
  }
991
 
994
  fwrite($fp, '</data>');
995
  fclose($fp);
996
  fclose($res);
997
+ $this->removeEmpty();
998
 
999
+ /*$errors = array();
1000
+ $xml = file_get_contents($this->xml_path);
1001
+
1002
+ PMXI_Import_Record::preprocessXml($xml);
1003
+
1004
+ if (PMXI_Import_Record::validateXml($xml, $errors)){
1005
+ return true;
1006
+ }
1007
+ else{
1008
+ $this->htmlentities = true;
1009
+ $this->rows = array();
1010
+ $this->iteration++;
1011
+ if ($this->iteration > 1) return true;
1012
+ return $this->parse();
1013
+ } */
1014
+
1015
+ return true;
1016
  }
1017
 
1018
  /**
1127
 
1128
  // read in file
1129
  $fh = fopen($file, 'r');
1130
+ $contents = fgets($fh);
1131
  fclose($fh);
1132
 
1133
  // specify allowed field delimiters
1134
  $delimiters = array(
1135
  'comma' => ',',
1136
  'semicolon' => ';',
1137
+ 'pipe' => '|',
1138
+ 'tabulation' => "\t"
1139
  );
1140
 
1141
  // specify allowed line endings
models/import/record.php CHANGED
@@ -92,7 +92,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
92
 
93
  $_SESSION['pmxi_import']['count'] = count($records);
94
 
95
- $records_count = $_SESSION['pmxi_import']['created_records'] + $_SESSION['pmxi_import']['updated_records'] + $_SESSION['pmxi_import']['skipped_records'] + $_SESSION['pmxi_import']['errors'];;
96
 
97
  if (!in_array($chunk, $records) and (!$this->options['create_chunks'] or $is_cron)){
98
  $logger and call_user_func($logger, __('<b>SKIPPED</b>: by specified records option', 'pmxi_plugin'));
@@ -136,7 +136,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
136
  }
137
  else{
138
  count($titles) and $post_author = array_fill(0, count($titles), $current_user->ID);
139
- }
140
 
141
  ($chunk == 1 or (empty($this->large_import) or $this->large_import == 'No')) and $logger and call_user_func($logger, __('Composing slugs...', 'pmxi_plugin'));
142
  $post_slug = array();
@@ -201,6 +201,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
201
  count($titles) and $tags = array_fill(0, count($titles), '');
202
  }
203
 
 
204
  require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
205
 
206
  if ('post' == $this->options['type']) {
@@ -214,110 +215,69 @@ class PMXI_Import_Record extends PMXI_Model_Record {
214
  ($chunk == 1 or (empty($this->large_import) or $this->large_import == 'No')) and $logger and call_user_func($logger, __('Composing categories...', 'pmxi_plugin'));
215
  $categories = array();
216
 
217
- foreach ($categories_hierarchy as $k => $category): if ("" == $category->xpath) continue;
218
  $cats_raw = XmlImportParser::factory($xml, $this->xpath, str_replace('\'','"',$category->xpath), $file)->parse($records); $tmp_files[] = $file;
219
  $warned = array(); // used to prevent the same notice displaying several times
220
  foreach ($cats_raw as $i => $c_raw) {
221
  if (empty($categories_hierarchy[$k]->cat_ids[$i])) $categories_hierarchy[$k]->cat_ids[$i] = array();
222
  if (empty($cats[$i])) $cats[$i] = array();
223
- if ('' != $c_raw) foreach (str_getcsv($c_raw, ',') as $c_cell) if ('' != $c_cell) {
224
- foreach (str_getcsv($c_cell, $this->options['categories_delim']) as $j => $cc) if ('' != $cc) {
225
- $cat = get_term_by('name', trim($cc), 'category') or $cat = get_term_by('slug', trim($cc), 'category') or ctype_digit($cc) and $cat = get_term_by('id', trim($cc), 'category');
226
- if ( !empty($categories_hierarchy[$k]->parent_id) ) {
227
- foreach ($categories_hierarchy as $key => $value){
228
- if ($value->item_id == $categories_hierarchy[$k]->parent_id and !empty($value->cat_ids[$i])){
229
- foreach ($value->cat_ids[$i] as $parent) {
230
- $cats[$i][] = array(
231
- 'name' => trim($cc),
232
- 'parent' => (is_array($parent)) ? $parent['name'] : $parent, // if parent taxonomy exists then return ID else return TITLE
233
- 'assign' => $category->assign
234
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  }
236
  }
237
  }
238
- }
239
- else {
240
- if ( !$cat ){
241
- $cats[$i][] = array(
242
- 'name' => trim($cc),
243
- 'parent' => false,
244
- 'assign' => $category->assign
245
- );
246
- }
247
- else if ( $category->assign ){
248
- $cats[$i][] = $cat->term_id;
 
 
 
 
 
249
  }
250
  }
251
- }
252
  }
253
- $categories_hierarchy[$k]->cat_ids[$i] = $cats[$i];
254
- }
255
  endforeach;
256
  } else{
257
  count($titles) and $cats = array_fill(0, count($titles), '');
258
- }
259
- }
260
- // [custom taxonomies]
261
- $taxonomies = array();
262
- $taxonomies_param = $this->options['type'].'_taxonomies';
263
- if ('page' == $this->options['type']) {
264
- $taxonomies_object_type = 'page';
265
- } elseif ('' != $this->options['custom_type']) {
266
- $taxonomies_object_type = $this->options['custom_type'];
267
- } else {
268
- $taxonomies_object_type = 'post';
269
- }
270
-
271
- if (!empty($this->options[$taxonomies_param]) and is_array($this->options[$taxonomies_param])): foreach ($this->options[$taxonomies_param] as $tx_name => $tx_template) if ('' != $tx_template) {
272
- $tx = get_taxonomy($tx_name);
273
- if (in_array($taxonomies_object_type, $tx->object_type)) {
274
- ($chunk == 1 or (empty($this->large_import) or $this->large_import == 'No')) and $logger and call_user_func($logger, sprintf(__('Composing terms for `%s` taxonomy...', 'pmxi_plugin'), $tx->labels->name));
275
- $txes = array();
276
-
277
- $taxonomies_hierarchy = json_decode($tx_template);
278
- foreach ($taxonomies_hierarchy as $k => $taxonomy){ if ("" == $taxonomy->xpath) continue;
279
- $txes_raw = XmlImportParser::factory($xml, $this->xpath, str_replace('\'','"',$taxonomy->xpath), $file)->parse($records); $tmp_files[] = $file;
280
- $warned = array();
281
- foreach ($txes_raw as $i => $tx_raw) {
282
- if (empty($taxonomies_hierarchy[$k]->txn_names[$i])) $taxonomies_hierarchy[$k]->txn_names[$i] = array();
283
- if (empty($taxonomies[$tx_name][$i])) $taxonomies[$tx_name][$i] = array();
284
- if ('' != $tx_raw) foreach (str_getcsv($tx_raw, ',') as $tx_cell) if ('' != $tx_cell) {
285
- foreach (str_getcsv($tx_cell, (!empty($taxonomy->delim)) ? $taxonomy->delim : ',') as $j => $cc) if ('' != $cc) {
286
- $cat = get_term_by('name', trim($cc), $tx_name) or $cat = get_term_by('slug', trim($cc), $tx_name) or ctype_digit($cc) and $cat = get_term_by('id', $cc, $tx_name);
287
- if (!empty($taxonomies_hierarchy[$k]->parent_id)) {
288
- foreach ($taxonomies_hierarchy as $key => $value){
289
- if ($value->item_id == $taxonomies_hierarchy[$k]->parent_id and !empty($value->txn_names[$i])){
290
- foreach ($value->txn_names[$i] as $parent) {
291
- $taxonomies[$tx_name][$i][] = array(
292
- 'name' => trim($cc),
293
- 'parent' => (is_array($parent)) ? $parent['name'] : $parent,
294
- 'assign' => $taxonomy->assign
295
- );
296
- }
297
- }
298
- }
299
-
300
- }
301
- else {
302
- if ( ! $cat ) {
303
- $taxonomies[$tx_name][$i][] = array(
304
- 'name' => trim($cc),
305
- 'parent' => false,
306
- 'assign' => $taxonomy->assign
307
- );
308
- }
309
- elseif ($taxonomy->assign) {
310
- $taxonomies[$tx_name][$i][] = $cc;
311
- }
312
- }
313
- }
314
- }
315
- $taxonomies_hierarchy[$k]->txn_names[$i] = $taxonomies[$tx_name][$i];
316
- }
317
- }
318
  }
319
- }; endif;
320
- // [/custom taxonomies]
 
321
 
322
  // serialized attachments
323
  if ( ! (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
@@ -351,7 +311,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
351
  } else {
352
  count($titles) and $attachments = array_fill(0, count($titles), '');
353
  }
354
- }
355
 
356
  ($chunk == 1 or (empty($this->large_import) or $this->large_import == 'No')) and $logger and call_user_func($logger, __('Composing unique keys...', 'pmxi_plugin'));
357
  $unique_keys = XmlImportParser::factory($xml, $this->xpath, $this->options['unique_key'], $file)->parse($records); $tmp_files[] = $file;
@@ -359,10 +319,10 @@ class PMXI_Import_Record extends PMXI_Model_Record {
359
  ($chunk == 1 or (empty($this->large_import) or $this->large_import == 'No')) and $logger and call_user_func($logger, __('Processing posts...', 'pmxi_plugin'));
360
 
361
  if ('post' == $this->options['type'] and '' != $this->options['custom_type']) {
362
- $post_type = $this->options['custom_type'];
363
  } else {
364
  $post_type = $this->options['type'];
365
- }
366
 
367
  $current_post_ids = array();
368
  foreach ($titles as $i => $void) {
@@ -379,24 +339,41 @@ class PMXI_Import_Record extends PMXI_Model_Record {
379
  $progress_msg = '<p class="import_process_bar"> Created ' . $_SESSION['pmxi_import']['created_records'] . ' / Updated ' . $_SESSION['pmxi_import']['updated_records'] . ' of '. $_SESSION['pmxi_import']['count'].' records.</p><span class="import_percent">' . ceil(($records_count/$_SESSION['pmxi_import']['count']) * 100) . '</span><span class="warnings_count">' . $_SESSION['pmxi_import']['warnings'] . '</span><span class="errors_count">' . $_SESSION['pmxi_import']['errors'] . '</span>';
380
  $logger and call_user_func($logger, $progress_msg);
381
  }
382
-
 
 
 
 
383
  continue;
384
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
385
 
386
  $articleData = array(
387
  'post_type' => $post_type,
388
  'post_status' => $this->options['status'],
389
  'comment_status' => $this->options['comment_status'],
390
  'ping_status' => $this->options['ping_status'],
391
- 'post_title' => ($this->template['is_leave_html']) ? utf8_encode(html_entity_decode($titles[$i])) : $titles[$i],
392
- 'post_excerpt' => ($this->template['is_leave_html']) ? utf8_encode(html_entity_decode($post_excerpt[$i])) : $post_excerpt[$i],
393
- 'post_slug' => $post_slug[$i],
394
- 'post_content' => ($this->template['is_leave_html']) ? utf8_encode(html_entity_decode($contents[$i])) : $contents[$i],
395
  'post_date' => $dates[$i],
396
  'post_date_gmt' => get_gmt_from_date($dates[$i]),
397
  'post_author' => $post_author[$i] ,
398
  'tags_input' => $tags[$i]
399
- );
400
 
401
  if ('post' != $articleData['post_type']){
402
  $articleData += array(
@@ -456,7 +433,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
456
  $tmp_array[] = $post_to_update_id;
457
  $this->set(array(
458
  'current_post_ids' => json_encode($tmp_array)
459
- ))->save;
460
  }
461
  $_SESSION['pmxi_import']['skipped_records']++;
462
  $logger and call_user_func($logger, sprintf(__('<b>SKIPPED</b>: Previously imported record found for `%s`', 'pmxi_plugin'), $articleData['post_title']));
@@ -631,13 +608,13 @@ class PMXI_Import_Record extends PMXI_Model_Record {
631
  }
632
  }
633
  }
634
- }
635
 
636
  // insert article being imported
637
  $pid = wp_insert_post($articleData, true);
638
 
639
  if (is_wp_error($pid)) {
640
- $logger and call_user_func($logger, __('<b>ERROR</b>', 'pmxi_plugin') . ': ' . $pid->get_error_message());
641
  $_SESSION['pmxi_import']['errors']++;
642
  } else {
643
 
@@ -651,16 +628,16 @@ class PMXI_Import_Record extends PMXI_Model_Record {
651
  'current_post_ids' => json_encode($tmp_array)
652
  ))->save();
653
  }
654
- if ("manual" != $this->options['duplicate_matching'] or empty($articleData['ID'])){
655
  // associate post with import
656
  $postRecord->isEmpty() and $postRecord->set(array(
657
  'post_id' => $pid,
658
  'import_id' => $this->id,
659
- 'unique_key' => $unique_keys[$i],
660
  ))->insert();
661
- }
662
 
663
- if ('post' != $articleData['post_type'] and !empty($this->options['page_template'])) update_post_meta($pid, '_wp_page_template', $this->options['page_template']);
664
 
665
  // [attachments]
666
  if ( ! empty($uploads) and false === $uploads['error'] and !empty($attachments[$i])) {
@@ -682,7 +659,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
682
  $attachment_filepath = $uploads['path'] . '/' . url_title($attachment_filename);
683
 
684
  if ( ! file_put_contents($attachment_filepath, @file_get_contents(trim($atch_url))) and ! get_file_curl(trim($atch_url), $attachment_filepath)) {
685
- $logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: Attachment file %s cannot be saved locally as %s', 'pmxi_plugin'), trim($atch_url), $attachment_filepath));
686
  $_SESSION['pmxi_import']['warnings']++;
687
  unlink($attachment_filepath); // delete file since failed upload may result in empty file created
688
  } elseif( ! $wp_filetype = wp_check_filetype(basename($attachment_filename), null )) {
@@ -710,50 +687,13 @@ class PMXI_Import_Record extends PMXI_Model_Record {
710
  }
711
  }
712
  }
713
- // [/attachments]
714
-
715
- // [custom taxonomies]
716
- foreach ($taxonomies as $tx_name => $txes) {
717
- // create term if not exists
718
- foreach ($txes[$i] as $key => $single_tax) {
719
- if (is_array($single_tax)){
720
- $term = term_exists( $single_tax['name'], $tx_name, (!empty($single_tax['parent'])) ? $single_tax['parent'] : '' );
721
- if ( empty($term) ){
722
- $term_attr = (!empty($single_tax['parent'])) ? $term_attr = array('parent'=> $single_tax['parent']) : '';
723
-
724
- $term = wp_insert_term(
725
- $single_tax['name'], // the term
726
- $tx_name, // the taxonomy
727
- $term_attr
728
- );
729
- }
730
-
731
- if ( empty($term) or is_wp_error($term) ){
732
- unset($txes[$i][$key]);
733
- $logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: `%s`', 'pmxi_plugin'), $term->get_error_message()));
734
- $_SESSION['pmxi_import']['warnings']++;
735
- }
736
- else{
737
- $cat_id = $term['term_id'];
738
- if ($cat_id and $single_tax['assign'])
739
- $txes[$i][$key] = $single_tax['name'];
740
- else
741
- unset($txes[$i][$key]);
742
- }
743
- }
744
- }
745
-
746
- // associate taxes with post
747
- $term_ids = wp_set_object_terms($pid, $txes[$i], $tx_name);
748
- if (is_wp_error($term_ids)) {
749
- $logger and call_user_func($logger, __('<b>WARNING</b>', 'pmxi_plugin') . ': '.$term_ids->get_error_message());
750
- $_SESSION['pmxi_import']['warnings']++;
751
- }
752
- }
753
- // [/custom taxonomies]
754
 
755
  // [categories]
756
  if (!empty($cats[$i])){
 
 
 
757
  // create categories if it's doesn't exists
758
  foreach ($cats[$i] as $key => $single_cat) {
759
  if (is_array($single_cat)){
@@ -765,9 +705,11 @@ class PMXI_Import_Record extends PMXI_Model_Record {
765
  else $cat_id = wp_create_category($single_cat['name']);
766
 
767
  if ($cat_id and $single_cat['assign'])
768
- $cats[$i][$key] = $cat_id;
 
 
769
  }
770
- }
771
  // associate categories with post
772
  $cats_ids = wp_set_post_terms($pid, $cats[$i], 'category');
773
  if (is_wp_error($cats_ids)) {
@@ -807,7 +749,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
807
  'updated' => $_SESSION['pmxi_import']['updated_records']
808
  ))->save();
809
  $_SESSION['pmxi_import']['chunk_number']++;
810
- }
811
 
812
  wp_cache_flush();
813
  }
@@ -815,10 +757,32 @@ class PMXI_Import_Record extends PMXI_Model_Record {
815
  $logger and call_user_func($logger, 'Removing previously imported posts which are no longer actual...');
816
  $postList = new PMXI_Post_List();
817
 
 
818
  foreach ($postList->getBy(array('import_id' => $this->id, 'post_id NOT IN' => $_SESSION['pmxi_import']['current_post_ids'])) as $missingPost) {
819
  empty($this->options['is_keep_attachments']) and wp_delete_attachments($missingPost['post_id']);
820
- wp_delete_post($missingPost['post_id'], true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
821
  }
 
822
  }
823
 
824
  } catch (XmlImportException $e) {
@@ -844,7 +808,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
844
  remove_filter('user_has_cap', array($this, '_filter_has_cap_unfiltered_html')); kses_init(); // return any filtering rules back if they has been disabled for import procedure
845
 
846
  return $this;
847
- }
848
 
849
  public function _filter_has_cap_unfiltered_html($caps)
850
  {
@@ -926,7 +890,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
926
  WHERE a.ID IN (".implode(',', $ids).");";
927
 
928
  $this->wpdb->query(
929
- $this->wpdb->prepare($sql)
930
  );
931
  }
932
  }
92
 
93
  $_SESSION['pmxi_import']['count'] = count($records);
94
 
95
+ $records_count = $_SESSION['pmxi_import']['created_records'] + $_SESSION['pmxi_import']['updated_records'] + $_SESSION['pmxi_import']['skipped_records'] + $_SESSION['pmxi_import']['errors'];
96
 
97
  if (!in_array($chunk, $records) and (!$this->options['create_chunks'] or $is_cron)){
98
  $logger and call_user_func($logger, __('<b>SKIPPED</b>: by specified records option', 'pmxi_plugin'));
136
  }
137
  else{
138
  count($titles) and $post_author = array_fill(0, count($titles), $current_user->ID);
139
+ }
140
 
141
  ($chunk == 1 or (empty($this->large_import) or $this->large_import == 'No')) and $logger and call_user_func($logger, __('Composing slugs...', 'pmxi_plugin'));
142
  $post_slug = array();
201
  count($titles) and $tags = array_fill(0, count($titles), '');
202
  }
203
 
204
+ // [posts categories]
205
  require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
206
 
207
  if ('post' == $this->options['type']) {
215
  ($chunk == 1 or (empty($this->large_import) or $this->large_import == 'No')) and $logger and call_user_func($logger, __('Composing categories...', 'pmxi_plugin'));
216
  $categories = array();
217
 
218
+ foreach ($categories_hierarchy as $k => $category): if ("" == $category->xpath) continue;
219
  $cats_raw = XmlImportParser::factory($xml, $this->xpath, str_replace('\'','"',$category->xpath), $file)->parse($records); $tmp_files[] = $file;
220
  $warned = array(); // used to prevent the same notice displaying several times
221
  foreach ($cats_raw as $i => $c_raw) {
222
  if (empty($categories_hierarchy[$k]->cat_ids[$i])) $categories_hierarchy[$k]->cat_ids[$i] = array();
223
  if (empty($cats[$i])) $cats[$i] = array();
224
+ $count_cats = count($cats[$i]);
225
+ if ('' != $c_raw) foreach (str_getcsv($c_raw, html_entity_decode($this->options['categories_delim'])) as $c_cell) if ('' != $c_cell) {
226
+ $delimeted_categories = explode(html_entity_decode($this->options['categories_delim']), html_entity_decode($c_raw));
227
+ if (!empty($delimeted_categories)){
228
+ foreach ($delimeted_categories as $j => $cc) if ('' != $cc) {
229
+ $cat = get_term_by('name', trim($cc), 'category') or $cat = get_term_by('slug', trim($cc), 'category') or ctype_digit($cc) and $cat = get_term_by('id', trim($cc), 'category');
230
+ if ( !empty($category->parent_id) ) {
231
+ foreach ($categories_hierarchy as $key => $value){
232
+ if ($value->item_id == $category->parent_id and !empty($value->cat_ids[$i])){
233
+ foreach ($value->cat_ids[$i] as $parent) {
234
+ if (!$j or !$this->options['categories_auto_nested']){
235
+ $cats[$i][] = array(
236
+ 'name' => trim($cc),
237
+ 'parent' => (is_array($parent)) ? $parent['name'] : $parent, // if parent taxonomy exists then return ID else return TITLE
238
+ 'assign' => $category->assign
239
+ );
240
+ }
241
+ elseif($this->options['categories_auto_nested']){
242
+ $cats[$i][] = array(
243
+ 'name' => trim($cc),
244
+ 'parent' => $delimeted_categories[$j - 1], // if parent taxonomy exists then return ID else return TITLE
245
+ 'assign' => $category->assign
246
+ );
247
+ }
248
+ }
249
  }
250
  }
251
  }
252
+ else {
253
+ if (!$j or !$this->options['categories_auto_nested']){
254
+ $cats[$i][] = array(
255
+ 'name' => trim($cc),
256
+ 'parent' => false,
257
+ 'assign' => $category->assign
258
+ );
259
+ }
260
+ elseif ($this->options['categories_auto_nested']){
261
+ $cats[$i][] = array(
262
+ 'name' => trim($cc),
263
+ 'parent' => $delimeted_categories[$j - 1],
264
+ 'assign' => $category->assign
265
+ );
266
+ }
267
+
268
  }
269
  }
270
+ }
271
  }
272
+ if ($count_cats < count($cats[$i])) $categories_hierarchy[$k]->cat_ids[$i][] = $cats[$i][count($cats[$i]) - 1];
273
+ }
274
  endforeach;
275
  } else{
276
  count($titles) and $cats = array_fill(0, count($titles), '');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  }
278
+
279
+ }
280
+ // [/posts categories]
281
 
282
  // serialized attachments
283
  if ( ! (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
311
  } else {
312
  count($titles) and $attachments = array_fill(0, count($titles), '');
313
  }
314
+ }
315
 
316
  ($chunk == 1 or (empty($this->large_import) or $this->large_import == 'No')) and $logger and call_user_func($logger, __('Composing unique keys...', 'pmxi_plugin'));
317
  $unique_keys = XmlImportParser::factory($xml, $this->xpath, $this->options['unique_key'], $file)->parse($records); $tmp_files[] = $file;
319
  ($chunk == 1 or (empty($this->large_import) or $this->large_import == 'No')) and $logger and call_user_func($logger, __('Processing posts...', 'pmxi_plugin'));
320
 
321
  if ('post' == $this->options['type'] and '' != $this->options['custom_type']) {
322
+ $post_type = $this->options['type'];
323
  } else {
324
  $post_type = $this->options['type'];
325
+ }
326
 
327
  $current_post_ids = array();
328
  foreach ($titles as $i => $void) {
339
  $progress_msg = '<p class="import_process_bar"> Created ' . $_SESSION['pmxi_import']['created_records'] . ' / Updated ' . $_SESSION['pmxi_import']['updated_records'] . ' of '. $_SESSION['pmxi_import']['count'].' records.</p><span class="import_percent">' . ceil(($records_count/$_SESSION['pmxi_import']['count']) * 100) . '</span><span class="warnings_count">' . $_SESSION['pmxi_import']['warnings'] . '</span><span class="errors_count">' . $_SESSION['pmxi_import']['errors'] . '</span>';
340
  $logger and call_user_func($logger, $progress_msg);
341
  }
342
+ $this->set(array(
343
+ 'imported' => $this->imported + 1,
344
+ 'created' => $_SESSION['pmxi_import']['created_records'],
345
+ 'updated' => $_SESSION['pmxi_import']['updated_records']
346
+ ))->save();
347
  continue;
348
+ }
349
+
350
+ if (empty($titles[$i])) {
351
+ $logger and call_user_func($logger, __('<b>SKIPPED</b>: by empty title', 'pmxi_plugin'));
352
+ $_SESSION['pmxi_import']['skipped_records']++;
353
+ $_SESSION['pmxi_import']['chunk_number']++;
354
+ $_SESSION['pmxi_import']['warnings']++;
355
+ $this->set(array(
356
+ 'imported' => $this->imported + 1,
357
+ 'created' => $_SESSION['pmxi_import']['created_records'],
358
+ 'updated' => $_SESSION['pmxi_import']['updated_records']
359
+ ))->save();
360
+ continue;
361
+ }
362
 
363
  $articleData = array(
364
  'post_type' => $post_type,
365
  'post_status' => $this->options['status'],
366
  'comment_status' => $this->options['comment_status'],
367
  'ping_status' => $this->options['ping_status'],
368
+ 'post_title' => ($this->template['fix_characters']) ? utf8_encode(html_entity_decode($titles[$i])) : (($this->template['is_leave_html']) ? html_entity_decode($titles[$i]) : $titles[$i]),
369
+ 'post_excerpt' => ($this->template['fix_characters']) ? utf8_encode(html_entity_decode($post_excerpt[$i])) : (($this->template['is_leave_html']) ? html_entity_decode($post_excerpt[$i]) : $post_excerpt[$i]),
370
+ 'post_name' => $post_slug[$i],
371
+ 'post_content' => ($this->template['fix_characters']) ? utf8_encode(html_entity_decode($contents[$i])) : (($this->template['is_leave_html']) ? html_entity_decode($contents[$i]) : $contents[$i]),
372
  'post_date' => $dates[$i],
373
  'post_date_gmt' => get_gmt_from_date($dates[$i]),
374
  'post_author' => $post_author[$i] ,
375
  'tags_input' => $tags[$i]
376
+ );
377
 
378
  if ('post' != $articleData['post_type']){
379
  $articleData += array(
433
  $tmp_array[] = $post_to_update_id;
434
  $this->set(array(
435
  'current_post_ids' => json_encode($tmp_array)
436
+ ))->save();
437
  }
438
  $_SESSION['pmxi_import']['skipped_records']++;
439
  $logger and call_user_func($logger, sprintf(__('<b>SKIPPED</b>: Previously imported record found for `%s`', 'pmxi_plugin'), $articleData['post_title']));
608
  }
609
  }
610
  }
611
+ }
612
 
613
  // insert article being imported
614
  $pid = wp_insert_post($articleData, true);
615
 
616
  if (is_wp_error($pid)) {
617
+ $logger and call_user_func($logger, __('<b>ERROR</b>', 'pmxi_plugin') . ': ' . $pid->get_error_message());
618
  $_SESSION['pmxi_import']['errors']++;
619
  } else {
620
 
628
  'current_post_ids' => json_encode($tmp_array)
629
  ))->save();
630
  }
631
+ if ("manual" != $this->options['duplicate_matching'] or empty($articleData['ID'])){
632
  // associate post with import
633
  $postRecord->isEmpty() and $postRecord->set(array(
634
  'post_id' => $pid,
635
  'import_id' => $this->id,
636
+ 'unique_key' => $unique_keys[$i]
637
  ))->insert();
638
+ }
639
 
640
+ if ('post' != $articleData['post_type'] and !empty($this->options['page_template'])) update_post_meta($pid, '_wp_page_template', $this->options['page_template']);
641
 
642
  // [attachments]
643
  if ( ! empty($uploads) and false === $uploads['error'] and !empty($attachments[$i])) {
659
  $attachment_filepath = $uploads['path'] . '/' . url_title($attachment_filename);
660
 
661
  if ( ! file_put_contents($attachment_filepath, @file_get_contents(trim($atch_url))) and ! get_file_curl(trim($atch_url), $attachment_filepath)) {
662
+ $logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: Attachment file %s cannot be saved locally as %s', 'pmxi_plugin'), trim($atch_url), $attachment_filepath));
663
  $_SESSION['pmxi_import']['warnings']++;
664
  unlink($attachment_filepath); // delete file since failed upload may result in empty file created
665
  } elseif( ! $wp_filetype = wp_check_filetype(basename($attachment_filename), null )) {
687
  }
688
  }
689
  }
690
+ // [/attachments]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
691
 
692
  // [categories]
693
  if (!empty($cats[$i])){
694
+
695
+ if ( ! $this->options['is_keep_categories']) wp_set_object_terms( $pid, NULL, 'category' );
696
+
697
  // create categories if it's doesn't exists
698
  foreach ($cats[$i] as $key => $single_cat) {
699
  if (is_array($single_cat)){
705
  else $cat_id = wp_create_category($single_cat['name']);
706
 
707
  if ($cat_id and $single_cat['assign'])
708
+ $cats[$i][$key] = $cat_id;
709
+ else
710
+ unset($cats[$i][$key]);
711
  }
712
+ }
713
  // associate categories with post
714
  $cats_ids = wp_set_post_terms($pid, $cats[$i], 'category');
715
  if (is_wp_error($cats_ids)) {
749
  'updated' => $_SESSION['pmxi_import']['updated_records']
750
  ))->save();
751
  $_SESSION['pmxi_import']['chunk_number']++;
752
+ }
753
 
754
  wp_cache_flush();
755
  }
757
  $logger and call_user_func($logger, 'Removing previously imported posts which are no longer actual...');
758
  $postList = new PMXI_Post_List();
759
 
760
+ $missing_ids = array();
761
  foreach ($postList->getBy(array('import_id' => $this->id, 'post_id NOT IN' => $_SESSION['pmxi_import']['current_post_ids'])) as $missingPost) {
762
  empty($this->options['is_keep_attachments']) and wp_delete_attachments($missingPost['post_id']);
763
+ $missing_ids[] = $missingPost['post_id'];
764
+
765
+ $sql = "delete a
766
+ FROM ".PMXI_Plugin::getInstance()->getTablePrefix()."posts a
767
+ WHERE a.id=%d";
768
+
769
+ $this->wpdb->query(
770
+ $this->wpdb->prepare($sql, $missingPost['id'])
771
+ );
772
+ }
773
+
774
+ if (!empty($missing_ids)){
775
+ $sql = "delete a,b,c
776
+ FROM ".$this->wpdb->posts." a
777
+ LEFT JOIN ".$this->wpdb->term_relationships." b ON ( a.ID = b.object_id )
778
+ LEFT JOIN ".$this->wpdb->postmeta." c ON ( a.ID = c.post_id )
779
+ WHERE a.ID IN (".implode(',', $missing_ids).");";
780
+
781
+ $this->wpdb->query(
782
+ $this->wpdb->prepare($sql, '')
783
+ );
784
  }
785
+
786
  }
787
 
788
  } catch (XmlImportException $e) {
808
  remove_filter('user_has_cap', array($this, '_filter_has_cap_unfiltered_html')); kses_init(); // return any filtering rules back if they has been disabled for import procedure
809
 
810
  return $this;
811
+ }
812
 
813
  public function _filter_has_cap_unfiltered_html($caps)
814
  {
890
  WHERE a.ID IN (".implode(',', $ids).");";
891
 
892
  $this->wpdb->query(
893
+ $this->wpdb->prepare($sql, '')
894
  );
895
  }
896
  }
plugin.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
- Plugin Name: WP All Import Lite
4
- Plugin URI: http://www.wpallimport.com/
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. Perform scheduled updates and overwrite of existing import jobs. Free lite edition.
6
- Version: 3.0
7
  Author: Soflyy
8
  */
9
  /**
@@ -496,11 +496,14 @@ final class PMXI_Plugin {
496
  global $wpdb;
497
  $tablefields = $wpdb->get_results("DESCRIBE {$table};");
498
  $is_leave_html = false;
 
499
  // Check if field exists
500
  foreach ($tablefields as $tablefield) {
501
  if ('is_leave_html' == $tablefield->Field) $is_leave_html = true;
 
502
  }
503
  if (!$is_leave_html) $wpdb->query("ALTER TABLE {$table} ADD `is_leave_html` TINYINT( 1 ) NOT NULL DEFAULT '0';");
 
504
 
505
  }
506
 
@@ -516,6 +519,7 @@ final class PMXI_Plugin {
516
  'tags' => '',
517
  'tags_delim' => ',',
518
  'categories_delim' => ',',
 
519
  'featured_delim' => ',',
520
  'atch_delim' => ',',
521
  'post_taxonomies' => array(),
1
  <?php
2
  /*
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. Perform scheduled updates and overwrite of existing import jobs. Free lite edition.
6
+ Version: 3.0.1
7
  Author: Soflyy
8
  */
9
  /**
496
  global $wpdb;
497
  $tablefields = $wpdb->get_results("DESCRIBE {$table};");
498
  $is_leave_html = false;
499
+ $fix_characters = false;
500
  // Check if field exists
501
  foreach ($tablefields as $tablefield) {
502
  if ('is_leave_html' == $tablefield->Field) $is_leave_html = true;
503
+ if ('fix_characters' == $tablefield->Field) $fix_characters = true;
504
  }
505
  if (!$is_leave_html) $wpdb->query("ALTER TABLE {$table} ADD `is_leave_html` TINYINT( 1 ) NOT NULL DEFAULT '0';");
506
+ if (!$fix_characters) $wpdb->query("ALTER TABLE {$table} ADD `fix_characters` TINYINT( 1 ) NOT NULL DEFAULT '0';");
507
 
508
  }
509
 
519
  'tags' => '',
520
  'tags_delim' => ',',
521
  'categories_delim' => ',',
522
+ 'categories_auto_nested' => 0,
523
  'featured_delim' => ',',
524
  'atch_delim' => ',',
525
  'post_taxonomies' => array(),
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: soflyy
3
  Tags: wordpress, xml, csv, datafeed, import
4
  Requires at least: 3.5
5
  Tested up to: 3.5.1
6
- Stable tag: 3.0
7
 
8
  WP All Import is an extremely powerful plugin that makes it easy to import any XML or CSV file to WordPress.
9
 
@@ -18,9 +18,9 @@ There are no special requirements that the elements in your file must be laid ou
18
  WP All Import can be used for everything from building a store with an affiliate datafeed to displaying live stock quotes or sports scores to building a real estate portal.
19
 
20
  = WP All Import Professional Edition =
21
- [youtube http://www.youtube.com/watch?v=5YYZyYmX3yg /]
22
 
23
- *WP All Import Pro* is a $99 upgrade that adds the following features to the free version of WP All Import:
24
 
25
  * Import to Custom Post Types - commonly used to import to Automotiv, OpenHouse, Listings, and WooCommerce, as well as any other theme or plugin that makes use of Custom Post Types.
26
 
3
  Tags: wordpress, xml, csv, datafeed, import
4
  Requires at least: 3.5
5
  Tested up to: 3.5.1
6
+ Stable tag: 3.0.1
7
 
8
  WP All Import is an extremely powerful plugin that makes it easy to import any XML or CSV file to WordPress.
9
 
18
  WP All Import can be used for everything from building a store with an affiliate datafeed to displaying live stock quotes or sports scores to building a real estate portal.
19
 
20
  = WP All Import Professional Edition =
21
+ [youtube http://www.youtube.com/watch?v=3LfbN7uWcTA /]
22
 
23
+ *WP All Import Pro* is a $199 upgrade that adds the following features to the free version of WP All Import:
24
 
25
  * Import to Custom Post Types - commonly used to import to Automotiv, OpenHouse, Listings, and WooCommerce, as well as any other theme or plugin that makes use of Custom Post Types.
26
 
schema.php CHANGED
@@ -34,6 +34,7 @@ CREATE TABLE {$table_prefix}templates (
34
  content LONGTEXT,
35
  is_keep_linebreaks TINYINT(1) NOT NULL DEFAULT 0,
36
  is_leave_html TINYINT(1) NOT NULL DEFAULT 0,
 
37
  PRIMARY KEY (id)
38
  ) $charset_collate;
39
  CREATE TABLE {$table_prefix}imports (
34
  content LONGTEXT,
35
  is_keep_linebreaks TINYINT(1) NOT NULL DEFAULT 0,
36
  is_leave_html TINYINT(1) NOT NULL DEFAULT 0,
37
+ fix_characters TINYINT(1) NOT NULL DEFAULT 0,
38
  PRIMARY KEY (id)
39
  ) $charset_collate;
40
  CREATE TABLE {$table_prefix}imports (
static/css/admin.css CHANGED
@@ -962,4 +962,22 @@ table.xml table {
962
  }
963
  .pmxi_plugin .upgrade_link{
964
  color: #21759B;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
965
  }
962
  }
963
  .pmxi_plugin .upgrade_link{
964
  color: #21759B;
965
+ }
966
+ .pmxi_stars{
967
+ display: inline-block;
968
+ background: url("../img/stars.png") no-repeat;
969
+ width: 125px;
970
+ height: 24px;
971
+ position: relative;
972
+ top:10px;
973
+ }
974
+ .updated_bottom{
975
+ background-color: #FFFFE0;
976
+ border-color: #E6DB55;
977
+ margin: 5px 0 15px;
978
+ padding: 0 0.6em;
979
+ -moz-border-radius: 3px 3px 3px 3px;
980
+ border-radius: 3px;
981
+ border-style: solid;
982
+ border-width: 1px;
983
  }
static/img/stars.png ADDED
Binary file
static/img/xmlicon.png CHANGED
Binary file
static/js/admin.js CHANGED
@@ -419,6 +419,11 @@
419
  if ($(this).parents('td:first').find('input:first').val() == '') $(this).parents('td:first').find('.hierarhy-output').val('');
420
  });
421
 
 
 
 
 
 
422
  $('.sortable').find('.remove-ico').live('click', function(){
423
 
424
  var parent_td = $(this).parents('td:first');
419
  if ($(this).parents('td:first').find('input:first').val() == '') $(this).parents('td:first').find('.hierarhy-output').val('');
420
  });
421
 
422
+ $('.taxonomy_auto_nested').live('click', function(){
423
+ $(this).parents('td:first').find('.hierarhy-output').val(window.JSON.stringify($(this).parents('td:first').find('.sortable:first').nestedSortable('toArray', {startDepthCount: 0})));
424
+ if ($(this).parents('td:first').find('input:first').val() == '') $(this).parents('td:first').find('.hierarhy-output').val('');
425
+ });
426
+
427
  $('.sortable').find('.remove-ico').live('click', function(){
428
 
429
  var parent_td = $(this).parents('td:first');
static/js/jquery/jquery.mjs.nestedSortable.js CHANGED
@@ -345,7 +345,7 @@
345
  }
346
 
347
  if (id) {
348
- ret.push({"item_id": id[2], "parent_id": pid, "delim": $(item).parents('.post_taxonomy:first').find('input.tax_delim').val(), "left": left, "right": right, "xpath":$(item).find('input.widefat').val(), "assign":$(item).find('input.assign_post').is(':checked')});
349
  }
350
 
351
  left = right + 1;
345
  }
346
 
347
  if (id) {
348
+ ret.push({"item_id": id[2], "parent_id": pid, "delim": $(item).parents('.post_taxonomy:first').find('input.tax_delim').val(), "left": left, "right": right, "xpath":$(item).find('input.widefat').val(), "assign":$(item).find('input.assign_post:first').is(':checked'), "auto_nested":$(item).parents('.post_taxonomy:first').find('input.taxonomy_auto_nested').is(':checked')});
349
  }
350
 
351
  left = right + 1;
static/js/pmxi.js CHANGED
@@ -3,5 +3,31 @@
3
  */
4
  (function($){$(function () {
5
 
6
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  });})(jQuery);
3
  */
4
  (function($){$(function () {
5
 
6
+ $('#dismiss').click(function(){
7
+
8
+ $(this).parents('div.updated:first').slideUp();
9
+ $.post('admin.php?page=pmxi-admin-settings&action=dismiss', {dismiss: true}, function (data) {
10
+
11
+ }, 'html');
12
+
13
+ });
14
+
15
+ $('#dismiss_manage_top').click(function(){
16
+
17
+ $(this).parents('div.updated:first').slideUp();
18
+ $.post('admin.php?page=pmxi-admin-settings&action=dismiss_manage_top', {dismiss: true}, function (data) {
19
+
20
+ }, 'html');
21
+
22
+ });
23
+
24
+ $('#dismiss_manage_bottom').click(function(){
25
+
26
+ $(this).parents('div.updated_bottom:first').slideUp();
27
+ $.post('admin.php?page=pmxi-admin-settings&action=dismiss_manage_bottom', {dismiss: true}, function (data) {
28
+
29
+ }, 'html');
30
+
31
+ });
32
+
33
  });})(jQuery);
views/admin/help/index.php CHANGED
@@ -1,2 +1,23 @@
1
- <h2><?php _e('WP All Import Help', 'pmxi_plugin') ?></h2>
2
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h2><?php _e('WP All Import Support', 'pmxi_plugin') ?></h2>
2
+
3
+ <table class="layout">
4
+ <tr>
5
+ <td class="left">
6
+ <p style='font-size: 1.3em;'>
7
+ <b>E-mail</b> - <a href='mailto:support@soflyy.com'>support@soflyy.com</a><br />
8
+ <b>Support page</b> - <a href='http://www.wpallimport.com/support?utm_source=wordpress.org&utm_medium=support&utm_campaign=free+plugin' target='_blank'>http://www.wpallimport.com/support</a>
9
+ </p>
10
+
11
+ <p style='font-size: 1.3em;'>Thanks for installing the free version of WP All Import.</p>
12
+
13
+ <p style='font-size: 1.3em;'>We are able to provide limited technical support to free version users. Support is not guaranteed, and is based on availability</p>
14
+
15
+ <p style='font-size: 1.3em;'><b>Please note we are unable to provide technical support via the WordPress.org community forums.</b></p>
16
+
17
+ <p style='font-size: 1.3em;'><a href='http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=support&utm_campaign=free+plugin' target='_blank'>For premium support, please upgrade to the professional edition of WP All Import.</a></p>
18
+
19
+
20
+ </td>
21
+ <td class="right">&nbsp;</td>
22
+ </tr>
23
+ </table>
views/admin/import/index.php CHANGED
@@ -73,7 +73,7 @@ $l10n = array(
73
  </h3>
74
  <div class="file-type-options">
75
  <input type="text" class="regular-text" name="url" value="" disabled="disabled" />
76
- <a href="http://www.wpallimport.com/upgrade-to-pro?from=upi" target="_blank" class="upgrade_link">Upgrade to the paid edition of WP All Import to use this feature.</a>
77
  </div>
78
  </div>
79
  <div class="file-type-container">
@@ -85,7 +85,7 @@ $l10n = array(
85
  <input type="text" class="regular-text" name="ftp[url]" value="<?php echo esc_attr($post['ftp']['url']) ?>" disabled="disabled" /><br />
86
  <input type="text" name="ftp[user]" title="username" style='width: 150px;' disabled="disabled"/><strong>:</strong><input type="password" name="ftp[pass]" title="passowrd" style='width: 150px;' disabled="disabled"/>
87
  <div class="note"><?php _e('You may use an asterisk to load multiple files. For example, ftp://example.com/datafeeds/*.xml', 'pmxi_plugin') ?></div>
88
- <a href="http://www.wpallimport.com/upgrade-to-pro?from=upi" target="_blank" class="upgrade_link">Upgrade to the paid edition of WP All Import to use this feature.</a>
89
  </div>
90
  </div>
91
  <div class="file-type-container">
@@ -108,7 +108,7 @@ $l10n = array(
108
  __FILE_SOURCE = <?php echo json_encode($local_files) ?>;
109
  </script>
110
  <div class="note"><?php printf(__('Upload files to <strong>%s</strong> and they will appear in this list', 'pmxi_plugin'), PMXI_Plugin::ROOT_DIR . '/upload/') ?></div>
111
- <a href="http://www.wpallimport.com/upgrade-to-pro?from=upi" target="_blank" class="upgrade_link">Upgrade to the paid edition of WP All Import to use this feature.</a>
112
  </div>
113
  </div>
114
  <div id="url_upload_status"></div>
73
  </h3>
74
  <div class="file-type-options">
75
  <input type="text" class="regular-text" name="url" value="" disabled="disabled" />
76
+ <a href="http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=step-1&utm_campaign=free+plugin" target="_blank" class="upgrade_link">Upgrade to the professional edition of WP All Import to use this feature.</a>
77
  </div>
78
  </div>
79
  <div class="file-type-container">
85
  <input type="text" class="regular-text" name="ftp[url]" value="<?php echo esc_attr($post['ftp']['url']) ?>" disabled="disabled" /><br />
86
  <input type="text" name="ftp[user]" title="username" style='width: 150px;' disabled="disabled"/><strong>:</strong><input type="password" name="ftp[pass]" title="passowrd" style='width: 150px;' disabled="disabled"/>
87
  <div class="note"><?php _e('You may use an asterisk to load multiple files. For example, ftp://example.com/datafeeds/*.xml', 'pmxi_plugin') ?></div>
88
+ <a href="http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=step-1&utm_campaign=free+plugin" target="_blank" class="upgrade_link">Upgrade to the professional edition of WP All Import to use this feature.</a>
89
  </div>
90
  </div>
91
  <div class="file-type-container">
108
  __FILE_SOURCE = <?php echo json_encode($local_files) ?>;
109
  </script>
110
  <div class="note"><?php printf(__('Upload files to <strong>%s</strong> and they will appear in this list', 'pmxi_plugin'), PMXI_Plugin::ROOT_DIR . '/upload/') ?></div>
111
+ <a href="http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=step-1&utm_campaign=free+plugin" target="_blank" class="upgrade_link">Upgrade to the professional edition of WP All Import to use this feature.</a>
112
  </div>
113
  </div>
114
  <div id="url_upload_status"></div>
views/admin/import/options.php CHANGED
@@ -13,7 +13,11 @@
13
  $i++;
14
  ?>
15
  <li id="item_<?php echo $i; ?>">
16
- <div class="drag-element"><input type="checkbox" class="assign_post" <?php if ($child_cat->assign): ?>checked="checked"<?php endif; ?>/><input class="widefat" type="text" value="<?php echo $child_cat->xpath; ?>"/></div><a href="javascript:void(0);" class="icon-item remove-ico"></a>
 
 
 
 
17
  <?php echo reverse_taxonomies_html($post_taxonomies, $child_cat->item_id, $i); ?>
18
  </li>
19
  <?php
@@ -86,7 +90,7 @@
86
  include( 'options/_custom_fields_template.php' );
87
  include( 'options/_featured_template.php' );
88
  include( 'options/_author_template.php' );
89
- include( 'options/_reimport_template.php' );
90
  ?>
91
  </table>
92
  </div>
@@ -129,7 +133,7 @@
129
  $entry = 'page';
130
  include( 'options/_taxonomies_template.php' );
131
  include( 'options/_featured_template.php' );
132
- include( 'options/_reimport_template.php' );
133
  ?>
134
  </table>
135
  </div>
@@ -144,8 +148,41 @@
144
  <?php if (count($custom_types)): ?>
145
  <?php foreach ($custom_types as $key => $ct): ?>
146
  <div id="tabs-<?php echo $key;?>">
147
-
148
- <p><a href="http://www.wpallimport.com/upgrade-to-pro?from=upi" target="_blank" class="upgrade_link">Upgrade to the paid edition of WP All Import to use this feature.</a></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
 
150
  </div>
151
  <?php endforeach ?>
13
  $i++;
14
  ?>
15
  <li id="item_<?php echo $i; ?>">
16
+ <div class="drag-element">
17
+ <input type="checkbox" class="assign_post" <?php if ($child_cat->assign): ?>checked="checked"<?php endif; ?> title="<?php _e('Assign post to the taxonomy.','pmxi_plugin');?>"/>
18
+ <input class="widefat" type="text" value="<?php echo esc_attr($child_cat->xpath); ?>"/>
19
+ </div>
20
+ <a href="javascript:void(0);" class="icon-item remove-ico"></a>
21
  <?php echo reverse_taxonomies_html($post_taxonomies, $child_cat->item_id, $i); ?>
22
  </li>
23
  <?php
90
  include( 'options/_custom_fields_template.php' );
91
  include( 'options/_featured_template.php' );
92
  include( 'options/_author_template.php' );
93
+ include( 'options/_reimport_template.php' );
94
  ?>
95
  </table>
96
  </div>
133
  $entry = 'page';
134
  include( 'options/_taxonomies_template.php' );
135
  include( 'options/_featured_template.php' );
136
+ include( 'options/_reimport_template.php' );
137
  ?>
138
  </table>
139
  </div>
148
  <?php if (count($custom_types)): ?>
149
  <?php foreach ($custom_types as $key => $ct): ?>
150
  <div id="tabs-<?php echo $key;?>">
151
+
152
+ <center>
153
+
154
+ <h3>Please upgrade to the professional edition of WP All Import to import to Custom Post Types.</h3>
155
+
156
+ <p style='font-size: 1.3em; font-weight: bold;'><a href="http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=custom-post-types&utm_campaign=free+plugin" target="_blank" class="upgrade_link">Upgrade Now</a></p>
157
+
158
+ <hr />
159
+
160
+ </center>
161
+
162
+
163
+ <form class="options <?php echo ! $this->isWizard ? 'edit' : '' ?>" method="post">
164
+ <input type="hidden" name="custom_type" value="post"/>
165
+ <input type="hidden" name="type" value="post"/>
166
+ <div class="post-type-options">
167
+ <table class="form-table" style="max-width:none;">
168
+ <?php
169
+ $post_type = $entry = $key;
170
+
171
+ include( 'options/_main_options_template.php' );
172
+ include( 'options/_taxonomies_template.php' );
173
+ include( 'options/_categories_template.php' );
174
+ include( 'options/_custom_fields_template.php' );
175
+ include( 'options/_featured_template.php' );
176
+ include( 'options/_author_template.php' );
177
+ include( 'options/_reimport_template.php' );
178
+ include( 'options/_scheduling_template.php' );
179
+ ?>
180
+ </table>
181
+ </div>
182
+
183
+ <?php include( 'options/_buttons_template.php' ); ?>
184
+
185
+ </form>
186
 
187
  </div>
188
  <?php endforeach ?>
views/admin/import/options/_author_template.php CHANGED
@@ -2,7 +2,7 @@
2
  <td colspan="3">
3
  <h3><?php _e('Post Author', 'pmxi_plugin') ?></h3>
4
  <div>
5
- <input type="text" name="author" value="<?php echo esc_attr($post['author']) ?>"/> <a href="#help" class="help" title="<?php _e('Value that contains user ID, login, slug or email.', 'pmxi_plugin') ?>">?</a>
6
  </div>
7
  </td>
8
  </tr>
@@ -10,11 +10,11 @@
10
  <td colspan="3">
11
  <h3><?php _e('Post Excerpt', 'pmxi_plugin') ?></h3>
12
  <div>
13
- <input type="text" name="post_excerpt" style="width:100%;" value="<?php echo esc_attr($post['post_excerpt']) ?>" />
14
  </div>
15
  <h3><?php _e('Post Slug', 'pmxi_plugin') ?></h3>
16
  <div>
17
- <input type="text" name="post_slug" style="width:100%;" value="<?php echo esc_attr($post['post_slug']) ?>" />
18
  </div> <br><br>
19
  </td>
20
  </tr>
2
  <td colspan="3">
3
  <h3><?php _e('Post Author', 'pmxi_plugin') ?></h3>
4
  <div>
5
+ <input type="text" name="author" value="<?php echo esc_attr($post['author']) ?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/> <a href="#help" class="help" title="<?php _e('Value that contains user ID, login, slug or email.', 'pmxi_plugin') ?>">?</a>
6
  </div>
7
  </td>
8
  </tr>
10
  <td colspan="3">
11
  <h3><?php _e('Post Excerpt', 'pmxi_plugin') ?></h3>
12
  <div>
13
+ <input type="text" name="post_excerpt" style="width:100%;" value="<?php echo esc_attr($post['post_excerpt']) ?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
14
  </div>
15
  <h3><?php _e('Post Slug', 'pmxi_plugin') ?></h3>
16
  <div>
17
+ <input type="text" name="post_slug" style="width:100%;" value="<?php echo esc_attr($post['post_slug']) ?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
18
  </div> <br><br>
19
  </td>
20
  </tr>
views/admin/import/options/_buttons_template.php CHANGED
@@ -1,41 +1,41 @@
1
  <br>
2
  <div class="input">
3
- <label for="save_import_as">Friendly Name</label> <input type="text" name="friendly_name" title="<?php _e('Save friendly name...', 'pmxi_plugin') ?>" style="vertical-align:middle; font-size:11px; background:#fff !important;" value="<?php echo esc_attr($post['friendly_name']) ?>" />
4
  </div>
5
  <br>
6
  <?php if ($_SESSION['pmxi_import']['large_file'] or (!empty($import) and $import->large_import == 'Yes')):?>
7
  <div class="input">
8
- <label for="records_per_request">Records Per Iteration</label> <input type="text" name="records_per_request" style="vertical-align:middle; font-size:11px; background:#fff !important; width: 40px;" value="<?php echo esc_attr($post['records_per_request']) ?>" />
9
  <a href="#help" class="help" title="<?php _e('Your feed was detected as a &quot;large&quot; file. The import process will be executed via AJAX requests. To make import process faster you can increase the number of records imported per iteration. Higher numbers put more strain on your server but make the import process take less time. 10 is a very safe number. To speed up the process, try 100 or more, especially if your import settings are simple and you are not downloading images.', 'pmxi_plugin') ?>">?</a>
10
  </div>
11
  <div class="input">
12
  <input type="hidden" name="create_chunks" value="0" />
13
- <input type="checkbox" id="create_chunks_<?php echo $entry; ?>" name="create_chunks" value="1" <?php echo $post['create_chunks'] ? 'checked="checked"': '' ?>/>
14
  <label for="create_chunks_<?php echo $entry; ?>"><?php _e('create chunks', 'pmxi_plugin') ?> <a href="#help" class="help" title="<?php _e('This setting will split importing feed to chunks with 100 records per chunk.', 'pmxi_plugin') ?>">?</a></label>
15
  </div>
16
  <br>
17
  <?php endif; ?>
18
  <div class="input">
19
  <input type="hidden" name="is_import_specified" value="0" />
20
- <input type="checkbox" id="is_import_specified_<?php echo $entry; ?>" class="switcher" name="is_import_specified" value="1" <?php echo $post['is_import_specified'] ? 'checked="checked"': '' ?>/>
21
  <label for="is_import_specified_<?php echo $entry; ?>"><?php _e('Import only specified records', 'pmxi_plugin') ?> <a href="#help" class="help" title="<?php _e('Enter records or record ranges separated by commas, e.g. <b>1,5,7-10</b> would import the first, the fifth, and the seventh to tenth.', 'pmxi_plugin') ?>">?</a></label>
22
  <span class="switcher-target-is_import_specified_<?php echo $entry; ?>" style="vertical-align:middle">
23
  <div class="input" style="display:inline;">
24
- <input type="text" name="import_specified" value="<?php echo esc_attr($post['import_specified']) ?>" style="width:50%;"/>
25
  </div>
26
  </span>
27
  </div>
28
  <?php if (in_array($source_type, array('ftp', 'file'))): ?>
29
  <div class="input">
30
  <input type="hidden" name="is_delete_source" value="0" />
31
- <input type="checkbox" id="is_delete_source_<?php echo $entry; ?>" name="is_delete_source" value="1" <?php echo $post['is_delete_source'] ? 'checked="checked"': '' ?>/>
32
  <label for="is_delete_source_<?php echo $entry; ?>"><?php _e('Delete source XML file after importing', 'pmxi_plugin') ?> <a href="#help" class="help" title="<?php _e('This setting takes effect only when script has access rights to perform the action, e.g. file is not deleted when pulled via HTTP or delete permission is not granted to the user that script is executed under.', 'pmxi_plugin') ?>">?</a></label>
33
  </div>
34
  <?php endif; ?>
35
  <?php if (class_exists('PMLC_Plugin')): // option is only valid when `WP Wizard Cloak` pluign is enabled ?>
36
  <div class="input">
37
  <input type="hidden" name="is_cloak" value="0" />
38
- <input type="checkbox" id="is_cloak_<?php echo $entry; ?>" name="is_cloak" value="1" <?php echo $post['is_cloak'] ? 'checked="checked"': '' ?>/>
39
  <label for="is_cloak_<?php echo $entry; ?>"><?php _e('Auto-Cloak Links', 'pmxi_plugin') ?> <a href="#help" class="help" title="<?php printf(__('Automatically process all links present in body of created post or page with <b>%s</b> plugin', 'pmxi_plugin'), PMLC_Plugin::getInstance()->getName()) ?>">?</a></label>
40
  </div> <br>
41
  <?php endif; ?>
@@ -52,10 +52,10 @@
52
  <span style="font-size:16px;">or</span> <input type="submit" name="btn_save_only" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only large_button" value="<?php _e('Save Only', 'pmxi_plugin') ?>" />
53
  <?php endif ?>
54
 
55
- <input type="submit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only large_button" value="<?php _e('Finish', 'pmxi_plugin') ?>" />
56
 
57
  <?php else: ?>
58
  <a href="<?php echo remove_query_arg('id', remove_query_arg('action', $this->baseUrl)); ?>" class="back"><?php _e('Back', 'pmxi_plugin') ?></a>
59
- <input type="submit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only large_button" value="<?php _e('Save', 'pmxi_plugin') ?>" />
60
  <?php endif ?>
61
  </p>
1
  <br>
2
  <div class="input">
3
+ <label for="save_import_as">Friendly Name</label> <input type="text" name="friendly_name" title="<?php _e('Save friendly name...', 'pmxi_plugin') ?>" style="vertical-align:middle; font-size:11px; background:#fff !important;" value="<?php echo esc_attr($post['friendly_name']) ?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
4
  </div>
5
  <br>
6
  <?php if ($_SESSION['pmxi_import']['large_file'] or (!empty($import) and $import->large_import == 'Yes')):?>
7
  <div class="input">
8
+ <label for="records_per_request">Records Per Iteration</label> <input type="text" name="records_per_request" style="vertical-align:middle; font-size:11px; background:#fff !important; width: 40px;" value="<?php echo esc_attr($post['records_per_request']) ?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
9
  <a href="#help" class="help" title="<?php _e('Your feed was detected as a &quot;large&quot; file. The import process will be executed via AJAX requests. To make import process faster you can increase the number of records imported per iteration. Higher numbers put more strain on your server but make the import process take less time. 10 is a very safe number. To speed up the process, try 100 or more, especially if your import settings are simple and you are not downloading images.', 'pmxi_plugin') ?>">?</a>
10
  </div>
11
  <div class="input">
12
  <input type="hidden" name="create_chunks" value="0" />
13
+ <input type="checkbox" id="create_chunks_<?php echo $entry; ?>" name="create_chunks" value="1" <?php echo $post['create_chunks'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
14
  <label for="create_chunks_<?php echo $entry; ?>"><?php _e('create chunks', 'pmxi_plugin') ?> <a href="#help" class="help" title="<?php _e('This setting will split importing feed to chunks with 100 records per chunk.', 'pmxi_plugin') ?>">?</a></label>
15
  </div>
16
  <br>
17
  <?php endif; ?>
18
  <div class="input">
19
  <input type="hidden" name="is_import_specified" value="0" />
20
+ <input type="checkbox" id="is_import_specified_<?php echo $entry; ?>" class="switcher" name="is_import_specified" value="1" <?php echo $post['is_import_specified'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
21
  <label for="is_import_specified_<?php echo $entry; ?>"><?php _e('Import only specified records', 'pmxi_plugin') ?> <a href="#help" class="help" title="<?php _e('Enter records or record ranges separated by commas, e.g. <b>1,5,7-10</b> would import the first, the fifth, and the seventh to tenth.', 'pmxi_plugin') ?>">?</a></label>
22
  <span class="switcher-target-is_import_specified_<?php echo $entry; ?>" style="vertical-align:middle">
23
  <div class="input" style="display:inline;">
24
+ <input type="text" name="import_specified" value="<?php echo esc_attr($post['import_specified']) ?>" style="width:50%;" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
25
  </div>
26
  </span>
27
  </div>
28
  <?php if (in_array($source_type, array('ftp', 'file'))): ?>
29
  <div class="input">
30
  <input type="hidden" name="is_delete_source" value="0" />
31
+ <input type="checkbox" id="is_delete_source_<?php echo $entry; ?>" name="is_delete_source" value="1" <?php echo $post['is_delete_source'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
32
  <label for="is_delete_source_<?php echo $entry; ?>"><?php _e('Delete source XML file after importing', 'pmxi_plugin') ?> <a href="#help" class="help" title="<?php _e('This setting takes effect only when script has access rights to perform the action, e.g. file is not deleted when pulled via HTTP or delete permission is not granted to the user that script is executed under.', 'pmxi_plugin') ?>">?</a></label>
33
  </div>
34
  <?php endif; ?>
35
  <?php if (class_exists('PMLC_Plugin')): // option is only valid when `WP Wizard Cloak` pluign is enabled ?>
36
  <div class="input">
37
  <input type="hidden" name="is_cloak" value="0" />
38
+ <input type="checkbox" id="is_cloak_<?php echo $entry; ?>" name="is_cloak" value="1" <?php echo $post['is_cloak'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
39
  <label for="is_cloak_<?php echo $entry; ?>"><?php _e('Auto-Cloak Links', 'pmxi_plugin') ?> <a href="#help" class="help" title="<?php printf(__('Automatically process all links present in body of created post or page with <b>%s</b> plugin', 'pmxi_plugin'), PMLC_Plugin::getInstance()->getName()) ?>">?</a></label>
40
  </div> <br>
41
  <?php endif; ?>
52
  <span style="font-size:16px;">or</span> <input type="submit" name="btn_save_only" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only large_button" value="<?php _e('Save Only', 'pmxi_plugin') ?>" />
53
  <?php endif ?>
54
 
55
+ <input type="submit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only large_button" value="<?php _e('Finish', 'pmxi_plugin') ?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
56
 
57
  <?php else: ?>
58
  <a href="<?php echo remove_query_arg('id', remove_query_arg('action', $this->baseUrl)); ?>" class="back"><?php _e('Back', 'pmxi_plugin') ?></a>
59
+ <input type="submit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only large_button" value="<?php _e('Save', 'pmxi_plugin') ?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
60
  <?php endif ?>
61
  </p>
views/admin/import/options/_categories_template.php CHANGED
@@ -15,37 +15,51 @@
15
  {
16
  ?>
17
  <li id="item_<?php echo $i; ?>">
18
- <div class="drag-element"><input type="checkbox" class="assign_post" <?php if ($cat->assign): ?>checked="checked"<?php endif; ?>/><input type="text" class="widefat" value="<?php echo (is_object($cat)) ? $cat->xpath : $cat; ?>"/></div><?php if ($i>1):?><a href="javascript:void(0);" class="icon-item remove-ico"></a><?php endif;?>
 
 
 
 
19
  <?php if (is_object($cat)) echo reverse_taxonomies_html($categories, $cat->item_id, $i); ?>
20
  </li>
21
  <?php
22
  }
23
  }; else: ?>
24
- <li id="item_1"><div class="drag-element"><input type="checkbox" class="assign_post" checked="checked"/><input type="text" class="widefat" value=""/></div></li>
 
 
 
 
 
25
  <?php endif;?>
26
  <?php else: ?>
27
- <li id="item_1"><div class="drag-element"><input type="checkbox" class="assign_post" checked="checked"/><input type="text" class="widefat" value=""/></div></li>
 
 
 
 
 
28
  <?php endif; ?>
29
  </ol>
30
- <a href="javascript:void(0);" class="icon-item add-new-ico">Add more</a> <br><br>
31
  <input type="hidden" class="hierarhy-output" name="categories" value="<?php echo esc_attr($post['categories']) ?>"/>
32
- <div class="hidden" id="dialog-confirm-category-removing" title="Delete categories?">Remove only current category or current category with subcategories?</div>
33
  <div class="delim">
34
  <label><?php _e('Separated by', 'pmxi_plugin'); ?></label>
35
- <input type="text" class="small" name="categories_delim" maxlength="1" value="<?php echo esc_attr($post['categories_delim']) ?>" />
36
- <!--a href="#help" class="help" title="<?php _e('Delimiter used for tag list', 'pmxi_plugin') ?>">?</a-->
 
 
37
  </div>
38
  </fieldset>
39
  </div>
40
  <div class="col2">
41
  <fieldset style="padding:5px; margin-right:0px;">
42
- <legend><?php _e('Tags', 'pmxi_plugin') ?> </legend>
43
- <!--a href="#help" class="help" title="<?php _e('Enter tags separated by commas.', 'pmxi_plugin') ?>">?</a-->
44
- <input type="text" name="tags" class="widefat" value="<?php echo esc_attr($post['tags']) ?>" /> <br> <br>
45
  <div class="delim">
46
  <label><?php _e('Separated by', 'pmxi_plugin'); ?></label>
47
- <input type="text" class="small" name="tags_delim" maxlength="1" value="<?php echo esc_attr($post['tags_delim']) ?>" />
48
- <!--a href="#help" class="help" title="<?php _e('Delimiter used for tag list', 'pmxi_plugin') ?>">?</a-->
49
  </div>
50
  </fieldset>
51
  </div>
15
  {
16
  ?>
17
  <li id="item_<?php echo $i; ?>">
18
+ <div class="drag-element">
19
+ <input type="checkbox" class="assign_post" <?php if ($cat->assign): ?>checked="checked"<?php endif; ?> title="<?php _e('Assign post to the taxonomy.','pmxi_plugin');?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
20
+ <input type="text" class="widefat" value="<?php echo (is_object($cat)) ? esc_attr($cat->xpath) : esc_attr($cat); ?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
21
+ </div>
22
+ <?php if ($i>1):?><a href="javascript:void(0);" class="icon-item remove-ico"></a><?php endif;?>
23
  <?php if (is_object($cat)) echo reverse_taxonomies_html($categories, $cat->item_id, $i); ?>
24
  </li>
25
  <?php
26
  }
27
  }; else: ?>
28
+ <li id="item_1">
29
+ <div class="drag-element">
30
+ <input type="checkbox" class="assign_post" checked="checked" title="<?php _e('Assign post to the taxonomy.','pmxi_plugin');?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
31
+ <input type="text" class="widefat" value="" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
32
+ </div>
33
+ </li>
34
  <?php endif;?>
35
  <?php else: ?>
36
+ <li id="item_1">
37
+ <div class="drag-element">
38
+ <input type="checkbox" class="assign_post" checked="checked" title="<?php _e('Assign post to the taxonomy.','pmxi_plugin');?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
39
+ <input type="text" class="widefat" value="" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
40
+ </div>
41
+ </li>
42
  <?php endif; ?>
43
  </ol>
44
+ <?php if ($post_type == "post"):?><a href="javascript:void(0);" class="icon-item add-new-ico"><?php _e('Add more', 'pmxi_plugin');?></a><?php endif; ?> <br><br>
45
  <input type="hidden" class="hierarhy-output" name="categories" value="<?php echo esc_attr($post['categories']) ?>"/>
46
+ <div class="hidden" id="dialog-confirm-category-removing" title="Delete categories?"><?php _e('Remove only current category or current category with subcategories?', 'pmxi_plugin');?></div>
47
  <div class="delim">
48
  <label><?php _e('Separated by', 'pmxi_plugin'); ?></label>
49
+ <input type="text" class="small" name="categories_delim" value="<?php echo esc_attr($post['categories_delim']) ?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
50
+ <label for="categories_auto_nested"><?php _e('Enable Auto Nest', 'pmxi_plugin');?></label>
51
+ <input type="checkbox" id="categories_auto_nested" name="categories_auto_nested" <?php if ($post['categories_auto_nested']):?>checked="checked"<?php endif; ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
52
+ <a href="#help" class="help" title="<?php _e('If this box is checked, a category hierarchy will be created. For example, if your <code>{category}</code> value is <code>Mens > Shoes > Diesel</code>, enter <code>&gt;</code> as the separator and enable <code>Auto Nest</code> to create <code>Diesel</code> as a child category of <code>Shoes</code> and <code>Shoes</code> as a child category of <code>Mens.</code>', 'pmxi_plugin') ?>">?</a>
53
  </div>
54
  </fieldset>
55
  </div>
56
  <div class="col2">
57
  <fieldset style="padding:5px; margin-right:0px;">
58
+ <legend><?php _e('Tags', 'pmxi_plugin') ?> </legend>
59
+ <input type="text" name="tags" class="widefat" value="<?php echo esc_attr($post['tags']) ?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/> <br> <br>
 
60
  <div class="delim">
61
  <label><?php _e('Separated by', 'pmxi_plugin'); ?></label>
62
+ <input type="text" class="small" name="tags_delim" value="<?php echo esc_attr($post['tags_delim']) ?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
 
63
  </div>
64
  </fieldset>
65
  </div>
views/admin/import/options/_custom_fields_template.php CHANGED
@@ -1,7 +1,19 @@
1
  <tr>
2
  <td colspan="3" style="border-bottom:1px solid #ccc;">
3
  <fieldset class="optionsset" style="text-align:center;">
4
- <legend>Custom Fields</legend>
 
 
 
 
 
 
 
 
 
 
 
 
5
  <table class="form-table custom-params" style="max-width:none; border:none;">
6
  <thead>
7
  <tr>
@@ -10,21 +22,21 @@
10
  <td></td>
11
  </tr>
12
  </thead>
13
- <tbody>
14
  <tr class="form-field">
15
  <td><input type="text" name="custom_name[]" value="" disabled="disabled" /></td>
16
  <td class="action remove">
17
- <textarea name="custom_value[]" disabled="disabled"></textarea>
18
- </td>
19
- </tr>
20
  <tr>
21
- <td colspan="3"><a href="#add" title="<?php _e('add', 'pmxi_plugin')?>" class="action add-new-custom"><?php _e('Add more', 'pmxi_plugin') ?></a></td>
22
  </tr>
23
  </tbody>
24
  </table>
25
  <select class="existing_meta_keys">
26
  <option value="">Existing Custom Fields...</option>
27
- <?php
28
  $hide_fields = array('_wp_page_template', '_edit_lock', '_edit_last', '_wp_trash_meta_status', '_wp_trash_meta_time');
29
  if (!empty($meta_keys) and $meta_keys->count()):
30
  foreach ($meta_keys as $meta_key) { if (in_array($meta_key['meta_key'], $hide_fields) or strpos($meta_key['meta_key'], '_wp') === 0) continue;
@@ -35,8 +47,7 @@
35
  endif;
36
  ?>
37
  </select>
38
- <br><br>
39
- <a href="http://www.wpallimport.com/upgrade-to-pro?from=upi" target="_blank" class="upgrade_link">Upgrade to the paid edition of WP All Import to use this feature.</a>
40
  </fieldset>
41
  <br>
42
  </td>
1
  <tr>
2
  <td colspan="3" style="border-bottom:1px solid #ccc;">
3
  <fieldset class="optionsset" style="text-align:center;">
4
+ <legend>Custom Fields</legend>
5
+
6
+ <center>
7
+
8
+ <h3>Please upgrade to the professional edition of WP All Import to import data to Custom Fields.</h3>
9
+
10
+ <p style='font-size: 1.3em; font-weight: bold;'><a href="http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=custom-fields&utm_campaign=free+plugin" target="_blank" class="upgrade_link">Upgrade Now</a></p>
11
+
12
+ <hr />
13
+
14
+ </center>
15
+
16
+
17
  <table class="form-table custom-params" style="max-width:none; border:none;">
18
  <thead>
19
  <tr>
22
  <td></td>
23
  </tr>
24
  </thead>
25
+ <tbody>
26
  <tr class="form-field">
27
  <td><input type="text" name="custom_name[]" value="" disabled="disabled" /></td>
28
  <td class="action remove">
29
+ <textarea name="custom_value[]" disabled="disabled"></textarea>
30
+ </td>
31
+ </tr>
32
  <tr>
33
+ <td colspan="3"><a href="#add" title="<?php _e('add', 'pmxi_plugin')?>" class="action add-new-custom"><?php _e('Add more', 'pmxi_plugin') ?></a></td>
34
  </tr>
35
  </tbody>
36
  </table>
37
  <select class="existing_meta_keys">
38
  <option value="">Existing Custom Fields...</option>
39
+ <?php
40
  $hide_fields = array('_wp_page_template', '_edit_lock', '_edit_last', '_wp_trash_meta_status', '_wp_trash_meta_time');
41
  if (!empty($meta_keys) and $meta_keys->count()):
42
  foreach ($meta_keys as $meta_key) { if (in_array($meta_key['meta_key'], $hide_fields) or strpos($meta_key['meta_key'], '_wp') === 0) continue;
47
  endif;
48
  ?>
49
  </select>
50
+
 
51
  </fieldset>
52
  <br>
53
  </td>
views/admin/import/options/_featured_template.php CHANGED
@@ -13,14 +13,24 @@
13
  <input type="checkbox" id="create_draft_<?php echo $entry; ?>" name="create_draft" value="yes" <?php echo 'yes' == $post['create_draft'] ? 'checked="checked"' : '' ?> disabled="disabled"/>
14
  <label for="create_draft_<?php echo $entry; ?>"><?php _e('<small>If no images are downloaded successfully, create entry as Draft.</small>', 'pmxi_plugin') ?></label>
15
  </div>
16
- <a href="http://www.wpallimport.com/upgrade-to-pro?from=upi" target="_blank" class="upgrade_link">Upgrade to the paid edition of WP All Import to use this feature.</a>
 
 
 
 
 
 
 
 
 
 
17
  <h3>
18
  <?php _e('Download & Import Attachments', 'pmxi_plugin') ?>
19
  <span class="separated_by">Separated by</span>
20
  </h3>
21
  <div>
22
- <input type="text" name="attachments" style="width:92%;" value="<?php echo esc_attr($post['attachments']) ?>" />
23
- <input type="text" class="small" name="atch_delim" maxlength="1" value="<?php echo esc_attr($post['atch_delim']) ?>" style="width:5%; text-align:center;"/>
24
  </div>
25
  <br>
26
  </td>
13
  <input type="checkbox" id="create_draft_<?php echo $entry; ?>" name="create_draft" value="yes" <?php echo 'yes' == $post['create_draft'] ? 'checked="checked"' : '' ?> disabled="disabled"/>
14
  <label for="create_draft_<?php echo $entry; ?>"><?php _e('<small>If no images are downloaded successfully, create entry as Draft.</small>', 'pmxi_plugin') ?></label>
15
  </div>
16
+
17
+ <center>
18
+
19
+ <hr />
20
+
21
+ <b>Please upgrade to the professional edition of WP All Import to download and import images to the post media gallery.</b>
22
+
23
+ <p style='font-size: 1.1em; font-weight: bold;'><a href="http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=featured-images&utm_campaign=free+plugin" target="_blank" class="upgrade_link">Upgrade Now</a></p>
24
+
25
+ </center>
26
+
27
  <h3>
28
  <?php _e('Download & Import Attachments', 'pmxi_plugin') ?>
29
  <span class="separated_by">Separated by</span>
30
  </h3>
31
  <div>
32
+ <input type="text" name="attachments" style="width:92%;" value="<?php echo esc_attr($post['attachments']) ?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
33
+ <input type="text" class="small" name="atch_delim" maxlength="1" value="<?php echo esc_attr($post['atch_delim']) ?>" style="width:5%; text-align:center;" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
34
  </div>
35
  <br>
36
  </td>
views/admin/import/options/_main_options_template.php CHANGED
@@ -4,22 +4,22 @@
4
  <h3><?php _e('Post Status', 'pmxi_plugin') ?></h3>
5
  <div>
6
  <div class="input">
7
- <input type="radio" id="status_publish_<?php echo $entry; ?>" name="status" value="publish" <?php echo 'publish' == $post['status'] ? 'checked="checked"' : '' ?> />
8
  <label for="status_publish_<?php echo $entry; ?>"><?php _e('Published', 'pmxi_plugin') ?></label>
9
  </div>
10
  <div class="input">
11
- <input type="radio" id="status_draft_<?php echo $entry; ?>" name="status" value="draft" <?php echo 'draft' == $post['status'] ? 'checked="checked"' : '' ?> />
12
  <label for="status_draft_<?php echo $entry; ?>"><?php _e('Draft', 'pmxi_plugin') ?></label>
13
  </div>
14
  <br>
15
  <div class="input">
16
  <input type="hidden" name="comment_status" value="closed" />
17
- <input type="checkbox" id="comment_status_<?php echo $entry; ?>" name="comment_status" value="open" <?php echo 'open' == $post['comment_status'] ? 'checked="checked"' : '' ?> />
18
  <label for="comment_status_<?php echo $entry; ?>"><?php _e('Allow Comments', 'pmxi_plugin') ?></label>
19
  </div>
20
  <div class="input">
21
  <input type="hidden" name="ping_status" value="closed" />
22
- <input type="checkbox" id="ping_status_<?php echo $entry; ?>" name="ping_status" value="open" <?php echo 'open' == $post['ping_status'] ? 'checked="checked"' : '' ?> />
23
  <label for="ping_status_<?php echo $entry; ?>"><?php _e('Allow Trackbacks and Pingbacks', 'pmxi_plugin') ?></label>
24
  </div>
25
  </div>
@@ -27,66 +27,26 @@
27
  <div class="col2">
28
  <h3><?php _e('Post Dates', 'pmxi_plugin') ?> <a href="#help" class="help" title="<?php _e('Use any format supported by the PHP <b>strtotime</b> function. That means pretty much any human-readable date will work.', 'pmxi_plugin') ?>">?</a></h3>
29
  <div class="input">
30
- <input type="radio" id="date_type_specific_<?php echo $entry; ?>" class="switcher" name="date_type" value="specific" <?php echo 'random' != $post['date_type'] ? 'checked="checked"' : '' ?> />
31
  <label for="date_type_specific_<?php echo $entry; ?>">
32
  <?php _e('As specified', 'pmxi_plugin') ?>
33
  </label>
34
  <span class="switcher-target-date_type_specific_<?php echo $entry; ?>" style="vertical-align:middle">
35
- <input type="text" class="datepicker" name="date" value="<?php echo esc_attr($post['date']) ?>" style="width:40%;"/>
36
  </span>
37
  </div>
38
  <div class="input">
39
- <input type="radio" id="date_type_random_<?php echo $entry; ?>" class="switcher" name="date_type" value="random" <?php echo 'random' == $post['date_type'] ? 'checked="checked"' : '' ?> />
40
  <label for="date_type_random_<?php echo $entry; ?>">
41
  <?php _e('Random dates', 'pmxi_plugin') ?><a href="#help" class="help" title="<?php _e('Posts will be randomly assigned dates in this range. WordPress ensures posts with dates in the future will not appear until their date has been reached.', 'pmxi_plugin') ?>">?</a>
42
  </label> <br>
43
  <span class="switcher-target-date_type_random_<?php echo $entry; ?>" style="vertical-align:middle">
44
- <input type="text" class="datepicker" name="date_start" value="<?php echo esc_attr($post['date_start']) ?>" />
45
  <?php _e('and', 'pmxi_plugin') ?>
46
- <input type="text" class="datepicker" name="date_end" value="<?php echo esc_attr($post['date_end']) ?>" />
47
  </span>
48
  </div>
49
- </div>
50
- <!--div class="col3 last">
51
- <div class="input">
52
- <input type="hidden" name="is_duplicates" value="0" />
53
- <input type="checkbox" id="is_duplicates_<?php echo $entry; ?>" class="switcher" name="is_duplicates" value="1" <?php echo $post['is_duplicates'] ? 'checked="checked"': '' ?>/>
54
- <label for="is_duplicates_<?php echo $entry; ?>"><?php _e('Check for duplicates', 'pmxi_plugin') ?> <a href="#help" class="help" title="<?php _e('This option allows you to specify action for articles being imported which have duplicates in WordPress database.<br /><br /><b>Important</b>: This option applies only to pages or posts not associated with current import. To manage overwrite rules for records previously created by import operation currently being updated please see `Reimport / Update Options` section below.', 'pmxi_plugin') ?>">?</a></label>
55
- <div class="switcher-target-is_duplicates_<?php echo $entry; ?>">
56
- <div class="input">
57
- <span style="vertical-align:middle"><?php _e('Determine duplicates by', 'pmxi_plugin') ?></span><br>
58
- <input type="radio" id="duplicate_indicator_title_<?php echo $entry; ?>" class="switcher" name="duplicate_indicator" value="title" <?php echo 'title' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
59
- <label for="duplicate_indicator_title_<?php echo $entry; ?>"><?php _e('title', 'pmxi_plugin' )?></label><br>
60
- <input type="radio" id="duplicate_indicator_content_<?php echo $entry; ?>" class="switcher" name="duplicate_indicator" value="content" <?php echo 'content' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
61
- <label for="duplicate_indicator_content_<?php echo $entry; ?>"><?php _e('content', 'pmxi_plugin' )?></label><br>
62
- <input type="radio" id="duplicate_indicator_custom_field_<?php echo $entry; ?>" class="switcher" name="duplicate_indicator" value="custom field" <?php echo 'custom field' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
63
- <label for="duplicate_indicator_custom_field_<?php echo $entry; ?>"><?php _e('custom field', 'pmxi_plugin' )?></label><br>
64
- <span class="switcher-target-duplicate_indicator_custom_field_<?php echo $entry; ?>" style="vertical-align:middle">
65
- <?php _e('Name', 'pmxi_plugin') ?>
66
- <input type="text" name="custom_duplicate_name" value="<?php echo esc_attr($post['custom_duplicate_name']) ?>" /><br>
67
- <?php _e('Value', 'pmxi_plugin') ?>
68
- <input type="text" name="custom_duplicate_value" value="<?php echo esc_attr($post['custom_duplicate_value']) ?>" />
69
- </span>
70
- </div>
71
- <div class="input">
72
- <span style="vertical-align:middle"><?php _e('When found:', 'pmxi_plugin') ?></span> <br>
73
- <input type="radio" id="duplicate_action_keep_<?php echo $entry; ?>" name="duplicate_action" value="keep" <?php echo 'keep' == $post['duplicate_action'] ? 'checked="checked"': '' ?> class="switcher"/>
74
- <label for="duplicate_action_keep_<?php echo $entry; ?>"><?php _e('keep existing and skip new', 'pmxi_plugin' )?></label> <br>
75
- <input type="radio" id="duplicate_action_rewrite_<?php echo $entry; ?>" name="duplicate_action" value="rewrite" <?php echo 'rewrite' == $post['duplicate_action'] ? 'checked="checked"': '' ?> class="switcher"/>
76
- <label for="duplicate_action_rewrite_<?php echo $entry; ?>"><?php _e('remove existing and add new', 'pmxi_plugin' )?></label> <br>
77
- <input type="radio" id="duplicate_action_update_<?php echo $entry; ?>" name="duplicate_action" value="update" <?php echo 'update' == $post['duplicate_action'] ? 'checked="checked"': '' ?> class="switcher"/>
78
- <label for="duplicate_action_update_<?php echo $entry; ?>"><?php _e('update existing', 'pmxi_plugin' )?></label>
79
- <span class="switcher-target-duplicate_action_update_<?php echo $entry; ?>" style="vertical-align:middle">
80
- <div class="input" style="padding-left:20px;">
81
- <input type="hidden" name="not_create_records" value="0" />
82
- <input type="checkbox" id="not_create_records_<?php echo $entry; ?>" name="not_create_records" value="1" <?php echo $post['not_create_records'] ? 'checked="checked"' : '' ?> />
83
- <label for="not_create_records_<?php echo $entry; ?>"><?php _e('NOT create new records', 'pmxi_plugin') ?></label>
84
- </div>
85
- </span>
86
- </div>
87
- </div>
88
- </div>
89
- </div-->
90
  </td>
91
  </tr>
92
  <tr>
4
  <h3><?php _e('Post Status', 'pmxi_plugin') ?></h3>
5
  <div>
6
  <div class="input">
7
+ <input type="radio" id="status_publish_<?php echo $entry; ?>" name="status" value="publish" <?php echo 'publish' == $post['status'] ? 'checked="checked"' : '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?> />
8
  <label for="status_publish_<?php echo $entry; ?>"><?php _e('Published', 'pmxi_plugin') ?></label>
9
  </div>
10
  <div class="input">
11
+ <input type="radio" id="status_draft_<?php echo $entry; ?>" name="status" value="draft" <?php echo 'draft' == $post['status'] ? 'checked="checked"' : '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
12
  <label for="status_draft_<?php echo $entry; ?>"><?php _e('Draft', 'pmxi_plugin') ?></label>
13
  </div>
14
  <br>
15
  <div class="input">
16
  <input type="hidden" name="comment_status" value="closed" />
17
+ <input type="checkbox" id="comment_status_<?php echo $entry; ?>" name="comment_status" value="open" <?php echo 'open' == $post['comment_status'] ? 'checked="checked"' : '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
18
  <label for="comment_status_<?php echo $entry; ?>"><?php _e('Allow Comments', 'pmxi_plugin') ?></label>
19
  </div>
20
  <div class="input">
21
  <input type="hidden" name="ping_status" value="closed" />
22
+ <input type="checkbox" id="ping_status_<?php echo $entry; ?>" name="ping_status" value="open" <?php echo 'open' == $post['ping_status'] ? 'checked="checked"' : '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
23
  <label for="ping_status_<?php echo $entry; ?>"><?php _e('Allow Trackbacks and Pingbacks', 'pmxi_plugin') ?></label>
24
  </div>
25
  </div>
27
  <div class="col2">
28
  <h3><?php _e('Post Dates', 'pmxi_plugin') ?> <a href="#help" class="help" title="<?php _e('Use any format supported by the PHP <b>strtotime</b> function. That means pretty much any human-readable date will work.', 'pmxi_plugin') ?>">?</a></h3>
29
  <div class="input">
30
+ <input type="radio" id="date_type_specific_<?php echo $entry; ?>" class="switcher" name="date_type" value="specific" <?php echo 'random' != $post['date_type'] ? 'checked="checked"' : '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
31
  <label for="date_type_specific_<?php echo $entry; ?>">
32
  <?php _e('As specified', 'pmxi_plugin') ?>
33
  </label>
34
  <span class="switcher-target-date_type_specific_<?php echo $entry; ?>" style="vertical-align:middle">
35
+ <input type="text" class="datepicker" name="date" value="<?php echo esc_attr($post['date']) ?>" style="width:40%;" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
36
  </span>
37
  </div>
38
  <div class="input">
39
+ <input type="radio" id="date_type_random_<?php echo $entry; ?>" class="switcher" name="date_type" value="random" <?php echo 'random' == $post['date_type'] ? 'checked="checked"' : '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
40
  <label for="date_type_random_<?php echo $entry; ?>">
41
  <?php _e('Random dates', 'pmxi_plugin') ?><a href="#help" class="help" title="<?php _e('Posts will be randomly assigned dates in this range. WordPress ensures posts with dates in the future will not appear until their date has been reached.', 'pmxi_plugin') ?>">?</a>
42
  </label> <br>
43
  <span class="switcher-target-date_type_random_<?php echo $entry; ?>" style="vertical-align:middle">
44
+ <input type="text" class="datepicker" name="date_start" value="<?php echo esc_attr($post['date_start']) ?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
45
  <?php _e('and', 'pmxi_plugin') ?>
46
+ <input type="text" class="datepicker" name="date_end" value="<?php echo esc_attr($post['date_end']) ?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
47
  </span>
48
  </div>
49
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  </td>
51
  </tr>
52
  <tr>
views/admin/import/options/_reimport_template.php CHANGED
@@ -3,32 +3,32 @@
3
  <fieldset class="optionsset">
4
  <legend>Record Matching</legend>
5
  <div class="input" style="margin-bottom:15px;">
6
- <input type="radio" id="auto_matching_<?php echo $entry; ?>" class="switcher" name="duplicate_matching" value="auto" <?php echo 'manual' != $post['duplicate_matching'] ? 'checked="checked"': '' ?>/>
7
  <label for="auto_matching_<?php echo $entry; ?>"><?php _e('Automatic Record Matching', 'pmxi_plugin' )?></label><br>
8
  <div class="switcher-target-auto_matching_<?php echo $entry; ?>" style="padding-left:17px;">
9
  <div class="input">
10
  <label><?php _e("Unique key"); ?></label>
11
- <input type="text" class="smaller-text" name="unique_key" style="width:300px;" value="<?php echo esc_attr($post['unique_key']) ?>" <?php echo ! ($this->isWizard && $update_previous->isEmpty()) ? 'disabled="disabled"' : '' ?>/>
12
  <a href="#help" class="help" title="<?php _e('Specify something that is unique for all records. If posts are being updated and not just created during a brand new import, the problem is that the value of the unique key is not unique.', 'pmxi_plugin') ?>">?</a>
13
  </div>
14
  </div>
15
- <input type="radio" id="manual_matching_<?php echo $entry; ?>" class="switcher" name="duplicate_matching" value="manual" <?php echo 'manual' == $post['duplicate_matching'] ? 'checked="checked"': '' ?>/>
16
  <label for="manual_matching_<?php echo $entry; ?>"><?php _e('Manual Record Matching', 'pmxi_plugin' )?></label>
17
  <a href="#help" class="help" title="<?php _e('This allows you to match records by something other than Unique Key.', 'pmxi_plugin') ?>">?</a>
18
  <div class="switcher-target-manual_matching_<?php echo $entry; ?>" style="padding-left:17px;">
19
  <div class="input">
20
  <span style="vertical-align:middle"><?php _e('Match records based on...', 'pmxi_plugin') ?></span><br>
21
- <input type="radio" id="duplicate_indicator_title_<?php echo $entry; ?>" class="switcher" name="duplicate_indicator" value="title" <?php echo 'title' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
22
  <label for="duplicate_indicator_title_<?php echo $entry; ?>"><?php _e('title', 'pmxi_plugin' )?></label><br>
23
- <input type="radio" id="duplicate_indicator_content_<?php echo $entry; ?>" class="switcher" name="duplicate_indicator" value="content" <?php echo 'content' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
24
  <label for="duplicate_indicator_content_<?php echo $entry; ?>"><?php _e('content', 'pmxi_plugin' )?></label><br>
25
- <input type="radio" id="duplicate_indicator_custom_field_<?php echo $entry; ?>" class="switcher" name="duplicate_indicator" value="custom field" <?php echo 'custom field' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
26
  <label for="duplicate_indicator_custom_field_<?php echo $entry; ?>"><?php _e('custom field', 'pmxi_plugin' )?></label><br>
27
  <span class="switcher-target-duplicate_indicator_custom_field_<?php echo $entry; ?>" style="vertical-align:middle" style="padding-left:17px;">
28
  <?php _e('Name', 'pmxi_plugin') ?>
29
- <input type="text" name="custom_duplicate_name" value="<?php echo esc_attr($post['custom_duplicate_name']) ?>" /><br>
30
  <?php _e('Value', 'pmxi_plugin') ?>
31
- <input type="text" name="custom_duplicate_value" value="<?php echo esc_attr($post['custom_duplicate_value']) ?>" />
32
  </span>
33
  </div>
34
  </div>
@@ -36,93 +36,93 @@
36
  <hr>
37
  <div class="input">
38
  <input type="hidden" name="not_create_records" value="0" />
39
- <input type="checkbox" id="not_create_records_<?php echo $entry; ?>" name="not_create_records" value="1" <?php echo $post['not_create_records'] ? 'checked="checked"' : '' ?> />
40
  <label for="not_create_records_<?php echo $entry; ?>"><?php _e('Do Not Add New Records', 'pmxi_plugin') ?></label>
41
  </div>
42
  <div class="input">
43
  <input type="hidden" name="is_delete_missing" value="0" />
44
- <input type="checkbox" id="is_delete_missing_<?php echo $entry; ?>" name="is_delete_missing" value="1" <?php echo $post['is_delete_missing'] ? 'checked="checked"': '' ?> class="switcher"/>
45
  <label for="is_delete_missing_<?php echo $entry; ?>"><?php _e('Delete missing records', 'pmxi_plugin') ?></label>
46
  <a href="#help" class="help" title="<?php _e('Check this option if you want to delete posts from previous import operation which are not found among newly impoprted set.', 'pmxi_plugin') ?>">?</a>
47
  </div>
48
  <div class="switcher-target-is_delete_missing_<?php echo $entry; ?>" style="padding-left:17px;">
49
  <div class="input">
50
  <input type="hidden" name="is_keep_attachments" value="0" />
51
- <input type="checkbox" id="is_keep_attachments_<?php echo $entry; ?>" name="is_keep_attachments" value="1" <?php echo $post['is_keep_attachments'] ? 'checked="checked"': '' ?> />
52
  <label for="is_keep_attachments_<?php echo $entry; ?>"><?php _e('Keep attachments when records removed', 'pmxi_plugin') ?></label>
53
  <a href="#help" class="help" title="<?php _e('Check this option if you want attachments like featured image to be kept in media library after parent post or page is removed or replaced during reimport operation.', 'pmxi_plugin') ?>">?</a>
54
  </div>
55
  </div>
56
  <div class="input">
57
- <input type="radio" id="is_keep_former_posts_<?php echo $entry; ?>" name="is_keep_former_posts" value="yes" <?php echo "yes" == $post['is_keep_former_posts'] ? 'checked="checked"': '' ?> class="switcher" />
58
  <label for="is_keep_former_posts_<?php echo $entry; ?>"><?php _e('Do not update already existing records', 'pmxi_plugin') ?></label> <br>
59
- <input type="radio" id="is_not_keep_former_posts_<?php echo $entry; ?>" name="is_keep_former_posts" value="no" <?php echo "yes" != $post['is_keep_former_posts'] ? 'checked="checked"': '' ?> class="switcher" />
60
  <label for="is_not_keep_former_posts_<?php echo $entry; ?>"><?php _e('Update existing records', 'pmxi_plugin') ?></label>
61
  <div class="switcher-target-is_not_keep_former_posts_<?php echo $entry; ?>" style="padding-left:17px;">
62
  <div class="input">
63
  <input type="hidden" name="is_keep_status" value="0" />
64
- <input type="checkbox" id="is_keep_status_<?php echo $entry; ?>" name="is_keep_status" value="1" <?php echo $post['is_keep_status'] ? 'checked="checked"': '' ?> />
65
  <label for="is_keep_status_<?php echo $entry; ?>"><?php _e('Keep status', 'pmxi_plugin') ?></label>
66
  <a href="#help" class="help" title="<?php _e('Check this option if you do not want previously imported posts to change their publish status or being restored from Trash.', 'pmxi_plugin') ?>">?</a>
67
  </div>
68
  <div class="input">
69
  <input type="hidden" name="is_keep_title" value="0" />
70
- <input type="checkbox" id="is_keep_title_<?php echo $entry; ?>" name="is_keep_title" value="1" <?php echo $post['is_keep_title'] ? 'checked="checked"': '' ?> />
71
  <label for="is_keep_title_<?php echo $entry; ?>"><?php _e('Keep title', 'pmxi_plugin') ?></label>
72
  <a href="#help" class="help" title="<?php _e('Check this option if you do not want previously imported posts to change their titles.', 'pmxi_plugin') ?>">?</a>
73
  </div>
74
  <div class="input">
75
  <input type="hidden" name="is_keep_excerpt" value="0" />
76
- <input type="checkbox" id="is_keep_excerpt_<?php echo $entry; ?>" name="is_keep_excerpt" value="1" <?php echo $post['is_keep_excerpt'] ? 'checked="checked"': '' ?> />
77
  <label for="is_keep_excerpt_<?php echo $entry; ?>"><?php _e('Keep excerpt', 'pmxi_plugin') ?></label>
78
  <a href="#help" class="help" title="<?php _e('Check this option if you do not want previously imported posts to change their excerpts.', 'pmxi_plugin') ?>">?</a>
79
  </div>
80
  <div class="input">
81
  <input type="hidden" name="is_keep_dates" value="0" />
82
- <input type="checkbox" id="is_keep_dates_<?php echo $entry; ?>" name="is_keep_dates" value="1" <?php echo $post['is_keep_dates'] ? 'checked="checked"': '' ?> />
83
  <label for="is_keep_dates_<?php echo $entry; ?>"><?php _e('Keep dates', 'pmxi_plugin') ?></label>
84
  <a href="#help" class="help" title="<?php _e('Check this option if you do not want previously imported posts to change their publish dates.', 'pmxi_plugin') ?>">?</a>
85
  </div>
86
  <div class="input">
87
  <input type="hidden" name="is_keep_menu_order" value="0" />
88
- <input type="checkbox" id="is_keep_menu_order_<?php echo $entry; ?>" name="is_keep_menu_order" value="1" <?php echo $post['is_keep_menu_order'] ? 'checked="checked"': '' ?> />
89
  <label for="is_keep_menu_order_<?php echo $entry; ?>"><?php _e('Keep menu order', 'pmxi_plugin') ?></label>
90
  <a href="#help" class="help" title="<?php _e('Check this option if you do not want previously imported posts to change their menu order.', 'pmxi_plugin') ?>">?</a>
91
  </div>
92
  <div class="input">
93
  <input type="hidden" name="is_keep_content" value="0" />
94
- <input type="checkbox" id="is_keep_content_<?php echo $entry; ?>" name="is_keep_content" value="1" <?php echo $post['is_keep_content'] ? 'checked="checked"': '' ?> />
95
  <label for="is_keep_content_<?php echo $entry; ?>"><?php _e('Keep content', 'pmxi_plugin') ?></label>
96
  <a href="#help" class="help" title="<?php _e('Check this option if you do not want previously imported posts to change their content.', 'pmxi_plugin') ?>">?</a>
97
  </div>
98
  <div class="input">
99
  <input type="hidden" name="is_keep_categories" value="0" />
100
- <input type="checkbox" id="is_keep_categories_<?php echo $entry; ?>" name="is_keep_categories" value="1" <?php echo $post['is_keep_categories'] ? 'checked="checked"': '' ?> />
101
  <label for="is_keep_categories_<?php echo $entry; ?>"><?php _e('Keep categories, tags and taxonomies', 'pmxi_plugin') ?></label>
102
  <a href="#help" class="help" title="<?php _e('Check this option if you do not want previously imported posts to change their category, tag and custom taxonomies associations upon reimport.', 'pmxi_plugin') ?>">?</a>
103
  </div>
104
  <div class="input">
105
  <input type="hidden" name="is_keep_images" value="0" />
106
- <input type="checkbox" id="is_keep_images_<?php echo $entry; ?>" name="is_keep_images" value="1" <?php echo $post['is_keep_images'] ? 'checked="checked"': '' ?> />
107
  <label for="is_keep_images_<?php echo $entry; ?>"><?php _e('Do not import images', 'pmxi_plugin') ?></label>
108
  <a href="#help" class="help" title="<?php _e('This will keep the featured image if it exists, so you could modify the post image manually, and then do a reimport, and it would not overwrite the manually modified post image.', 'pmxi_plugin') ?>">?</a>
109
  </div>
110
  <div class="input">
111
  <input type="hidden" name="no_create_featured_image" value="0" />
112
- <input type="checkbox" id="no_create_featured_image_<?php echo $entry; ?>" name="no_create_featured_image" value="1" <?php echo $post['no_create_featured_image'] ? 'checked="checked"': '' ?> />
113
  <label for="no_create_featured_image_<?php echo $entry; ?>"><?php _e('Only keep images for posts that already have images.', 'pmxi_plugin') ?></label>
114
  <a href="#help" class="help" title="<?php _e('This option will keep images for posts that already have images, and import images for posts that do not already have images.', 'pmxi_plugin') ?>">?</a>
115
  </div>
116
  <div class="input">
117
  <input type="hidden" name="keep_custom_fields" value="0" />
118
- <input type="checkbox" id="keep_custom_fields_<?php echo $entry; ?>" name="keep_custom_fields" value="1" <?php echo $post['keep_custom_fields'] ? 'checked="checked"': '' ?> class="switcher switcher-reversed"/>
119
  <label for="keep_custom_fields_<?php echo $entry; ?>"><?php _e('Keep custom fields', 'pmxi_plugin') ?></label>
120
  <a href="#help" class="help" title="<?php _e('If Keep Custom Fields box is checked, it will keep all Custom Fields, and add any new Custom Fields specified in Custom Fields section, as long as they do not overwrite existing fields. If \'Only keep this Custom Fields\' is specified, it will only keep the specified fields.', 'pmxi_plugin') ?>">?</a>
121
  </div>
122
  <div class="switcher-target-keep_custom_fields_<?php echo $entry; ?>" style="padding-left:17px;">
123
  <div class="input">
124
  <label for="keep_custom_fields_specific"><?php _e('Only Keep These Custom Fields <small>(separate field names with commas)</small>', 'pmxi_plugin') ?></label>
125
- <input type="text" id="keep_custom_fields_specific" name="keep_custom_fields_specific" style="width:100%;" value="<?php echo esc_attr($post['keep_custom_fields_specific']) ?>" />
126
  </div>
127
  </div>
128
  </div>
3
  <fieldset class="optionsset">
4
  <legend>Record Matching</legend>
5
  <div class="input" style="margin-bottom:15px;">
6
+ <input type="radio" id="auto_matching_<?php echo $entry; ?>" class="switcher" name="duplicate_matching" value="auto" <?php echo 'manual' != $post['duplicate_matching'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
7
  <label for="auto_matching_<?php echo $entry; ?>"><?php _e('Automatic Record Matching', 'pmxi_plugin' )?></label><br>
8
  <div class="switcher-target-auto_matching_<?php echo $entry; ?>" style="padding-left:17px;">
9
  <div class="input">
10
  <label><?php _e("Unique key"); ?></label>
11
+ <input type="text" class="smaller-text" name="unique_key" style="width:300px;" value="<?php echo esc_attr($post['unique_key']) ?>" <?php echo ! ($this->isWizard && $update_previous->isEmpty()) ? 'disabled="disabled"' : '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
12
  <a href="#help" class="help" title="<?php _e('Specify something that is unique for all records. If posts are being updated and not just created during a brand new import, the problem is that the value of the unique key is not unique.', 'pmxi_plugin') ?>">?</a>
13
  </div>
14
  </div>
15
+ <input type="radio" id="manual_matching_<?php echo $entry; ?>" class="switcher" name="duplicate_matching" value="manual" <?php echo 'manual' == $post['duplicate_matching'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
16
  <label for="manual_matching_<?php echo $entry; ?>"><?php _e('Manual Record Matching', 'pmxi_plugin' )?></label>
17
  <a href="#help" class="help" title="<?php _e('This allows you to match records by something other than Unique Key.', 'pmxi_plugin') ?>">?</a>
18
  <div class="switcher-target-manual_matching_<?php echo $entry; ?>" style="padding-left:17px;">
19
  <div class="input">
20
  <span style="vertical-align:middle"><?php _e('Match records based on...', 'pmxi_plugin') ?></span><br>
21
+ <input type="radio" id="duplicate_indicator_title_<?php echo $entry; ?>" class="switcher" name="duplicate_indicator" value="title" <?php echo 'title' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
22
  <label for="duplicate_indicator_title_<?php echo $entry; ?>"><?php _e('title', 'pmxi_plugin' )?></label><br>
23
+ <input type="radio" id="duplicate_indicator_content_<?php echo $entry; ?>" class="switcher" name="duplicate_indicator" value="content" <?php echo 'content' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
24
  <label for="duplicate_indicator_content_<?php echo $entry; ?>"><?php _e('content', 'pmxi_plugin' )?></label><br>
25
+ <input type="radio" id="duplicate_indicator_custom_field_<?php echo $entry; ?>" class="switcher" name="duplicate_indicator" value="custom field" <?php echo 'custom field' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
26
  <label for="duplicate_indicator_custom_field_<?php echo $entry; ?>"><?php _e('custom field', 'pmxi_plugin' )?></label><br>
27
  <span class="switcher-target-duplicate_indicator_custom_field_<?php echo $entry; ?>" style="vertical-align:middle" style="padding-left:17px;">
28
  <?php _e('Name', 'pmxi_plugin') ?>
29
+ <input type="text" name="custom_duplicate_name" value="<?php echo esc_attr($post['custom_duplicate_name']) ?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/><br>
30
  <?php _e('Value', 'pmxi_plugin') ?>
31
+ <input type="text" name="custom_duplicate_value" value="<?php echo esc_attr($post['custom_duplicate_value']) ?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
32
  </span>
33
  </div>
34
  </div>
36
  <hr>
37
  <div class="input">
38
  <input type="hidden" name="not_create_records" value="0" />
39
+ <input type="checkbox" id="not_create_records_<?php echo $entry; ?>" name="not_create_records" value="1" <?php echo $post['not_create_records'] ? 'checked="checked"' : '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
40
  <label for="not_create_records_<?php echo $entry; ?>"><?php _e('Do Not Add New Records', 'pmxi_plugin') ?></label>
41
  </div>
42
  <div class="input">
43
  <input type="hidden" name="is_delete_missing" value="0" />
44
+ <input type="checkbox" id="is_delete_missing_<?php echo $entry; ?>" name="is_delete_missing" value="1" <?php echo $post['is_delete_missing'] ? 'checked="checked"': '' ?> class="switcher" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
45
  <label for="is_delete_missing_<?php echo $entry; ?>"><?php _e('Delete missing records', 'pmxi_plugin') ?></label>
46
  <a href="#help" class="help" title="<?php _e('Check this option if you want to delete posts from previous import operation which are not found among newly impoprted set.', 'pmxi_plugin') ?>">?</a>
47
  </div>
48
  <div class="switcher-target-is_delete_missing_<?php echo $entry; ?>" style="padding-left:17px;">
49
  <div class="input">
50
  <input type="hidden" name="is_keep_attachments" value="0" />
51
+ <input type="checkbox" id="is_keep_attachments_<?php echo $entry; ?>" name="is_keep_attachments" value="1" <?php echo $post['is_keep_attachments'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
52
  <label for="is_keep_attachments_<?php echo $entry; ?>"><?php _e('Keep attachments when records removed', 'pmxi_plugin') ?></label>
53
  <a href="#help" class="help" title="<?php _e('Check this option if you want attachments like featured image to be kept in media library after parent post or page is removed or replaced during reimport operation.', 'pmxi_plugin') ?>">?</a>
54
  </div>
55
  </div>
56
  <div class="input">
57
+ <input type="radio" id="is_keep_former_posts_<?php echo $entry; ?>" name="is_keep_former_posts" value="yes" <?php echo "yes" == $post['is_keep_former_posts'] ? 'checked="checked"': '' ?> class="switcher" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
58
  <label for="is_keep_former_posts_<?php echo $entry; ?>"><?php _e('Do not update already existing records', 'pmxi_plugin') ?></label> <br>
59
+ <input type="radio" id="is_not_keep_former_posts_<?php echo $entry; ?>" name="is_keep_former_posts" value="no" <?php echo "yes" != $post['is_keep_former_posts'] ? 'checked="checked"': '' ?> class="switcher" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
60
  <label for="is_not_keep_former_posts_<?php echo $entry; ?>"><?php _e('Update existing records', 'pmxi_plugin') ?></label>
61
  <div class="switcher-target-is_not_keep_former_posts_<?php echo $entry; ?>" style="padding-left:17px;">
62
  <div class="input">
63
  <input type="hidden" name="is_keep_status" value="0" />
64
+ <input type="checkbox" id="is_keep_status_<?php echo $entry; ?>" name="is_keep_status" value="1" <?php echo $post['is_keep_status'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
65
  <label for="is_keep_status_<?php echo $entry; ?>"><?php _e('Keep status', 'pmxi_plugin') ?></label>
66
  <a href="#help" class="help" title="<?php _e('Check this option if you do not want previously imported posts to change their publish status or being restored from Trash.', 'pmxi_plugin') ?>">?</a>
67
  </div>
68
  <div class="input">
69
  <input type="hidden" name="is_keep_title" value="0" />
70
+ <input type="checkbox" id="is_keep_title_<?php echo $entry; ?>" name="is_keep_title" value="1" <?php echo $post['is_keep_title'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
71
  <label for="is_keep_title_<?php echo $entry; ?>"><?php _e('Keep title', 'pmxi_plugin') ?></label>
72
  <a href="#help" class="help" title="<?php _e('Check this option if you do not want previously imported posts to change their titles.', 'pmxi_plugin') ?>">?</a>
73
  </div>
74
  <div class="input">
75
  <input type="hidden" name="is_keep_excerpt" value="0" />
76
+ <input type="checkbox" id="is_keep_excerpt_<?php echo $entry; ?>" name="is_keep_excerpt" value="1" <?php echo $post['is_keep_excerpt'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
77
  <label for="is_keep_excerpt_<?php echo $entry; ?>"><?php _e('Keep excerpt', 'pmxi_plugin') ?></label>
78
  <a href="#help" class="help" title="<?php _e('Check this option if you do not want previously imported posts to change their excerpts.', 'pmxi_plugin') ?>">?</a>
79
  </div>
80
  <div class="input">
81
  <input type="hidden" name="is_keep_dates" value="0" />
82
+ <input type="checkbox" id="is_keep_dates_<?php echo $entry; ?>" name="is_keep_dates" value="1" <?php echo $post['is_keep_dates'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
83
  <label for="is_keep_dates_<?php echo $entry; ?>"><?php _e('Keep dates', 'pmxi_plugin') ?></label>
84
  <a href="#help" class="help" title="<?php _e('Check this option if you do not want previously imported posts to change their publish dates.', 'pmxi_plugin') ?>">?</a>
85
  </div>
86
  <div class="input">
87
  <input type="hidden" name="is_keep_menu_order" value="0" />
88
+ <input type="checkbox" id="is_keep_menu_order_<?php echo $entry; ?>" name="is_keep_menu_order" value="1" <?php echo $post['is_keep_menu_order'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
89
  <label for="is_keep_menu_order_<?php echo $entry; ?>"><?php _e('Keep menu order', 'pmxi_plugin') ?></label>
90
  <a href="#help" class="help" title="<?php _e('Check this option if you do not want previously imported posts to change their menu order.', 'pmxi_plugin') ?>">?</a>
91
  </div>
92
  <div class="input">
93
  <input type="hidden" name="is_keep_content" value="0" />
94
+ <input type="checkbox" id="is_keep_content_<?php echo $entry; ?>" name="is_keep_content" value="1" <?php echo $post['is_keep_content'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
95
  <label for="is_keep_content_<?php echo $entry; ?>"><?php _e('Keep content', 'pmxi_plugin') ?></label>
96
  <a href="#help" class="help" title="<?php _e('Check this option if you do not want previously imported posts to change their content.', 'pmxi_plugin') ?>">?</a>
97
  </div>
98
  <div class="input">
99
  <input type="hidden" name="is_keep_categories" value="0" />
100
+ <input type="checkbox" id="is_keep_categories_<?php echo $entry; ?>" name="is_keep_categories" value="1" <?php echo $post['is_keep_categories'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
101
  <label for="is_keep_categories_<?php echo $entry; ?>"><?php _e('Keep categories, tags and taxonomies', 'pmxi_plugin') ?></label>
102
  <a href="#help" class="help" title="<?php _e('Check this option if you do not want previously imported posts to change their category, tag and custom taxonomies associations upon reimport.', 'pmxi_plugin') ?>">?</a>
103
  </div>
104
  <div class="input">
105
  <input type="hidden" name="is_keep_images" value="0" />
106
+ <input type="checkbox" id="is_keep_images_<?php echo $entry; ?>" name="is_keep_images" value="1" <?php echo $post['is_keep_images'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
107
  <label for="is_keep_images_<?php echo $entry; ?>"><?php _e('Do not import images', 'pmxi_plugin') ?></label>
108
  <a href="#help" class="help" title="<?php _e('This will keep the featured image if it exists, so you could modify the post image manually, and then do a reimport, and it would not overwrite the manually modified post image.', 'pmxi_plugin') ?>">?</a>
109
  </div>
110
  <div class="input">
111
  <input type="hidden" name="no_create_featured_image" value="0" />
112
+ <input type="checkbox" id="no_create_featured_image_<?php echo $entry; ?>" name="no_create_featured_image" value="1" <?php echo $post['no_create_featured_image'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
113
  <label for="no_create_featured_image_<?php echo $entry; ?>"><?php _e('Only keep images for posts that already have images.', 'pmxi_plugin') ?></label>
114
  <a href="#help" class="help" title="<?php _e('This option will keep images for posts that already have images, and import images for posts that do not already have images.', 'pmxi_plugin') ?>">?</a>
115
  </div>
116
  <div class="input">
117
  <input type="hidden" name="keep_custom_fields" value="0" />
118
+ <input type="checkbox" id="keep_custom_fields_<?php echo $entry; ?>" name="keep_custom_fields" value="1" <?php echo $post['keep_custom_fields'] ? 'checked="checked"': '' ?> class="switcher switcher-reversed" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
119
  <label for="keep_custom_fields_<?php echo $entry; ?>"><?php _e('Keep custom fields', 'pmxi_plugin') ?></label>
120
  <a href="#help" class="help" title="<?php _e('If Keep Custom Fields box is checked, it will keep all Custom Fields, and add any new Custom Fields specified in Custom Fields section, as long as they do not overwrite existing fields. If \'Only keep this Custom Fields\' is specified, it will only keep the specified fields.', 'pmxi_plugin') ?>">?</a>
121
  </div>
122
  <div class="switcher-target-keep_custom_fields_<?php echo $entry; ?>" style="padding-left:17px;">
123
  <div class="input">
124
  <label for="keep_custom_fields_specific"><?php _e('Only Keep These Custom Fields <small>(separate field names with commas)</small>', 'pmxi_plugin') ?></label>
125
+ <input type="text" id="keep_custom_fields_specific" name="keep_custom_fields_specific" style="width:100%;" value="<?php echo esc_attr($post['keep_custom_fields_specific']) ?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
126
  </div>
127
  </div>
128
  </div>
views/admin/import/options/_scheduling_template.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (in_array($source_type, array('url', 'ftp'))): ?>
2
+ <tr>
3
+ <td colspan="3">
4
+ <fieldset class="optionsset">
5
+ <legend>Scheduling</legend>
6
+ <div class="input">
7
+ <input type="hidden" name="is_scheduled" value="0" />
8
+ <input type="checkbox" id="is_scheduled_<?php echo $entry; ?>" class="switcher" name="is_scheduled" value="1" <?php echo $scheduled['is_scheduled'] ? 'checked="checked"': '' ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
9
+ <label for="is_scheduled_<?php echo $entry; ?>"><?php _e('Schedule import using WordPress Scheduling Logic', 'pmxi_plugin') ?> <a href="#help" class="help" title="<?php _e('Using this is not recommended. Unless you are importing a very small file, use cron jobs instead.', 'pmxi_plugin') ?>">?</a></label>
10
+ <span class="switcher-target-is_scheduled_<?php echo $entry; ?>" style="vertical-align:middle">
11
+ <select name="scheduled_period" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>>
12
+ <?php foreach (array(
13
+ '*/5 * * * *' => __('every 5 min'),
14
+ '*/10 * * * *' => __('every 10 min'),
15
+ '*/30 * * * *' => __('half-hourly'),
16
+ '0 * * * *' => __('hourly'),
17
+ '0 */4 * * *' => __('every 4 hours'),
18
+ '0 */12 * * *' => __('half-daily'),
19
+ '0 0 * * *' => __('daily'),
20
+ '0 0 * * 1' => __('weekly'),
21
+ '0 0 1 * 1' => __('monthly'),
22
+ ) as $key => $title): ?>
23
+ <option value="<?php echo $key ?>" <?php echo $key == $scheduled['scheduled_period'] ? 'selected="selected"' : '' ?>><?php echo esc_html($title) ?></option>
24
+ <?php endforeach ?>
25
+ </select>
26
+ <a href="#help" class="help" title="<?php _e('<b>Warning</b>: Execution periods are not guaranteed due to internal WordPress scheduling logic. Scheduled tasks are only triggered upon a user request/visit to the site. On sites with low user activity, when time span between requests exceeds scheduled periods, those scheduling periods cannot be kept. In most cases though, such behavior achives the goal since delayed tasks are run right when a request is registered and user sees the content after the task has been executed. ', 'pmxi_plugin') ?>">?</a>
27
+ </span>
28
+
29
+ <br /><br />
30
+
31
+ <p>
32
+ <b>This import can be also be scheduled using cron jobs.</b> Save the import, visit the <i>Manage Imports</i> page, and click the <i>Cron Scheduling</i> link to set up cron scheduling. Using WordPress scheduling logic is not recommended for large files.
33
+ </p>
34
+
35
+ </div>
36
+ </fieldset>
37
+ </td>
38
+ </tr>
39
+ <?php endif;?>
views/admin/import/options/_taxonomies_template.php CHANGED
@@ -12,40 +12,58 @@
12
  <div class="post_taxonomy">
13
  <div class="col2" style="width:35%;">
14
  <nobr><?php echo $ctx->labels->name ?></nobr>
15
- </div>
16
  <div class="col2" style="width:65%;">
17
  <ol class="sortable no-margin">
18
- <?php if (!empty($post['post_taxonomies'][$ctx->name])):
19
- $taxonomies_hierarchy = json_decode($post['post_taxonomies'][$ctx->name]);
 
20
  if (!empty($taxonomies_hierarchy) and is_array($taxonomies_hierarchy)): $i = 0; foreach ($taxonomies_hierarchy as $cat) { $i++;
21
  if (is_null($cat->parent_id) or empty($cat->parent_id))
22
  {
23
  ?>
24
  <li id="item_<?php echo $i; ?>">
25
- <div class="drag-element"><input type="checkbox" class="assign_post" <?php if ($cat->assign): ?>checked="checked"<?php endif; ?>/><input type="text" class="widefat" value="<?php echo $cat->xpath; ?>"/></div><?php if ($i>1):?><a href="javascript:void(0);" class="icon-item remove-ico"></a><?php endif;?>
 
 
 
 
26
  <?php echo reverse_taxonomies_html($taxonomies_hierarchy, $cat->item_id, $i); ?>
27
- </li>
28
  <?php
29
  }
30
  }; else:?>
31
- <li id="item_1"><div class="drag-element"><input type="checkbox" class="assign_post" checked="checked"/><input type="text" class="widefat" value=""/></div></li>
 
 
 
 
 
32
  <?php endif;
33
  else: ?>
34
- <li id="item_1"><div class="drag-element"><input type="checkbox" class="assign_post" checked="checked"/><input type="text" class="widefat" value=""/></div></li>
35
- <?php endif; ?>
36
- </ol>
37
- <input type="hidden" class="hierarhy-output" name="post_taxonomies[<?php echo $ctx->name ?>]" value="<?php echo esc_attr($post['post_taxonomies'][$ctx->name]) ?>"/>
38
- <div class="delim">
39
- <label><?php _e('Separated by', 'pmxi_plugin'); ?></label>
40
- <input type="text" class="small tax_delim" maxlength="1" value="<?php echo (!empty($ctx->delim)) ? $ctx->delim : ',' ?>" />
41
- <a href="javascript:void(0);" class="icon-item add-new-ico">Add more</a>
 
 
 
 
 
 
 
 
42
  </div>
43
- </div>
44
  </div>
45
  </td>
46
  </tr>
47
  </table>
48
- <?php endforeach; ?>
49
  </fieldset>
50
  </td>
51
  </tr>
12
  <div class="post_taxonomy">
13
  <div class="col2" style="width:35%;">
14
  <nobr><?php echo $ctx->labels->name ?></nobr>
15
+ </div>
16
  <div class="col2" style="width:65%;">
17
  <ol class="sortable no-margin">
18
+ <?php
19
+ if (!empty($post['post_taxonomies'][$ctx->name])):
20
+ $taxonomies_hierarchy = json_decode($post['post_taxonomies'][$ctx->name]);
21
  if (!empty($taxonomies_hierarchy) and is_array($taxonomies_hierarchy)): $i = 0; foreach ($taxonomies_hierarchy as $cat) { $i++;
22
  if (is_null($cat->parent_id) or empty($cat->parent_id))
23
  {
24
  ?>
25
  <li id="item_<?php echo $i; ?>">
26
+ <div class="drag-element">
27
+ <input type="checkbox" class="assign_post" <?php if ($cat->assign): ?>checked="checked"<?php endif; ?> title="<?php _e('Assign post to the taxonomy.','pmxi_plugin');?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
28
+ <input type="text" class="widefat" value="<?php echo esc_attr($cat->xpath); ?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
29
+ </div>
30
+ <?php if ($i>1):?><a href="javascript:void(0);" class="icon-item remove-ico"></a><?php endif;?>
31
  <?php echo reverse_taxonomies_html($taxonomies_hierarchy, $cat->item_id, $i); ?>
32
+ </li>
33
  <?php
34
  }
35
  }; else:?>
36
+ <li id="item_1">
37
+ <div class="drag-element">
38
+ <input type="checkbox" class="assign_post" checked="checked" title="<?php _e('Assign post to the taxonomy.','pmxi_plugin');?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
39
+ <input type="text" class="widefat" value="" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
40
+ </div>
41
+ </li>
42
  <?php endif;
43
  else: ?>
44
+ <li id="item_1">
45
+ <div class="drag-element">
46
+ <input type="checkbox" class="assign_post" checked="checked" title="<?php _e('Assign post to the taxonomy.','pmxi_plugin');?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
47
+ <input type="text" class="widefat" value="" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
48
+ </div>
49
+ </li>
50
+ <?php endif;?>
51
+ </ol>
52
+ <input type="hidden" class="hierarhy-output" name="post_taxonomies[<?php echo $ctx->name ?>]" value="<?php echo esc_attr($post['post_taxonomies'][$ctx->name]) ?>"/>
53
+ <div class="delim">
54
+ <label><?php _e('Separated by', 'pmxi_plugin'); ?></label>
55
+ <input type="text" class="small tax_delim" value="<?php echo (!empty($taxonomies_hierarchy) and $taxonomies_hierarchy[0]->delim) ? $taxonomies_hierarchy[0]->delim : ',' ?>" <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
56
+ <label for="nested_<?php echo $ctx->name;?>"><?php _e('Enable Auto Nest', 'pmxi_plugin');?></label>
57
+ <input id="nested_<?php echo $ctx->name;?>" type="checkbox" class="taxonomy_auto_nested" <?php if (!empty($taxonomies_hierarchy) and $taxonomies_hierarchy[0]->auto_nested):?>checked="checked"<?php endif; ?> <?php echo ($post_type != "post") ? 'disabled="disabled"' : '';?>/>
58
+ <a href="#help" class="help" title="<?php _e('If this box is checked, a category hierarchy will be created. For example, if your <code>{category}</code> value is <code>Mens > Shoes > Diesel</code>, enter <code>&gt;</code> as the separator and enable <code>Auto Nest</code> to create <code>Diesel</code> as a child category of <code>Shoes</code> and <code>Shoes</code> as a child category of <code>Mens.</code>', 'pmxi_plugin') ?>">?</a>
59
+ <!--a href="javascript:void(0);" class="icon-item add-new-ico"><?php _e('Add more','pmxi_plugin');?></a-->
60
  </div>
61
+ </div>
62
  </div>
63
  </td>
64
  </tr>
65
  </table>
66
+ <?php endforeach; ?>
67
  </fieldset>
68
  </td>
69
  </tr>
views/admin/import/tag.php CHANGED
@@ -1,4 +1,5 @@
1
- <div class="tag">
 
2
  <input type="hidden" name="tagno" value="<?php echo $tagno ?>" />
3
  <div class="title">
4
  <?php printf(__('Record #<strong>%s</strong> out of <strong>%s</strong>', 'pmxi_plugin'), $tagno, ( ! $_SESSION['pmxi_import']['large_file']) ? $elements->length : $_SESSION['pmxi_import']['count']); ?>
@@ -11,5 +12,10 @@
11
  <div class="xml resetable"> <?php if (!empty($elements->length)) $this->render_xml_element(( ! $_SESSION['pmxi_import']['large_file']) ? $elements->item($tagno - 1) : $elements->item(0), true); ?></div>
12
  <p class="xpath_help">
13
  <?php _e('Operate on elements using your own PHP functions, use FOREACH loops, and more.<br />Read the <a href="http://www.wpallimport.com/portal/" target="_blank">documentation</a> to learn how.', 'pmxi_plugin') ?>
14
- </p>
15
  </div>
 
 
 
 
 
1
+ <?php if (!empty($elements->length)):?>
2
+ <div class="tag">
3
  <input type="hidden" name="tagno" value="<?php echo $tagno ?>" />
4
  <div class="title">
5
  <?php printf(__('Record #<strong>%s</strong> out of <strong>%s</strong>', 'pmxi_plugin'), $tagno, ( ! $_SESSION['pmxi_import']['large_file']) ? $elements->length : $_SESSION['pmxi_import']['count']); ?>
12
  <div class="xml resetable"> <?php if (!empty($elements->length)) $this->render_xml_element(( ! $_SESSION['pmxi_import']['large_file']) ? $elements->item($tagno - 1) : $elements->item(0), true); ?></div>
13
  <p class="xpath_help">
14
  <?php _e('Operate on elements using your own PHP functions, use FOREACH loops, and more.<br />Read the <a href="http://www.wpallimport.com/portal/" target="_blank">documentation</a> to learn how.', 'pmxi_plugin') ?>
15
+ </p>
16
  </div>
17
+ <?php else: ?>
18
+ <div class="error inline below-h2" style="padding:10px; margin-top:45px;">
19
+ <?php printf(__('History file not found.', 'pmxi_plugin')); ?>
20
+ </div>
21
+ <?php endif; ?>
views/admin/import/template.php CHANGED
@@ -46,8 +46,13 @@
46
  <input type="checkbox" id="is_keep_linebreaks" name="is_keep_linebreaks" value="1" <?php echo $post['is_keep_linebreaks'] ? 'checked="checked"' : '' ?> style="position:relative; top:-3px;"/>
47
  <label for="is_keep_linebreaks"><?php _e('Keep line breaks from XML', 'pmxi_plugin') ?></label> <br>
48
  <input type="hidden" name="is_leave_html" value="0" />
49
- <input type="checkbox" id="is_leave_html" name="is_leave_html" value="1" <?php echo $post['is_leave_html'] ? 'checked="checked"' : '' ?> style="position:relative; top:-3px;"/>
50
  <label for="is_leave_html"><?php _e('Decode HTML entities with <b>html_entity_decode</b>', 'pmxi_plugin') ?></label><a class="help" href="#help" original-title="If HTML code is showing up in your posts, use this option. You can also use <br /><br /><i>[html_entity_decode({my/xpath})]</i><br /><br /> or <br /><br /><i>[htmlentities({my/xpath})]</i><br /><br /> to decode or encode HTML in your file.">?</a>
 
 
 
 
 
51
  </span>
52
  </p>
53
  <hr>
46
  <input type="checkbox" id="is_keep_linebreaks" name="is_keep_linebreaks" value="1" <?php echo $post['is_keep_linebreaks'] ? 'checked="checked"' : '' ?> style="position:relative; top:-3px;"/>
47
  <label for="is_keep_linebreaks"><?php _e('Keep line breaks from XML', 'pmxi_plugin') ?></label> <br>
48
  <input type="hidden" name="is_leave_html" value="0" />
49
+ <input type="checkbox" id="is_leave_html" name="is_leave_html" value="1" <?php echo $post['is_leave_html'] ? 'checked="checked"' : '' ?> style="position:relative; top:-3px;" class="switcher"/>
50
  <label for="is_leave_html"><?php _e('Decode HTML entities with <b>html_entity_decode</b>', 'pmxi_plugin') ?></label><a class="help" href="#help" original-title="If HTML code is showing up in your posts, use this option. You can also use <br /><br /><i>[html_entity_decode({my/xpath})]</i><br /><br /> or <br /><br /><i>[htmlentities({my/xpath})]</i><br /><br /> to decode or encode HTML in your file.">?</a>
51
+ <div class="switcher-target-is_leave_html" style="padding-left:17px;">
52
+ <input type="hidden" name="fix_characters" value="0" />
53
+ <input type="checkbox" id="fix_characters" name="fix_characters" value="1" <?php echo $post['fix_characters'] ? 'checked="checked"' : '' ?> style="position:relative; top:-3px;"/>
54
+ <label for="fix_characters"><?php _e('Auto-fix broken special characters', 'pmxi_plugin') ?></label>
55
+ </div>
56
  </span>
57
  </p>
58
  <hr>
views/admin/manage/index.php CHANGED
@@ -4,6 +4,19 @@
4
  <a href="<?php echo esc_url(add_query_arg(array('page' => 'pmxi-admin-import'), admin_url('admin.php'))) ?>" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" style="font-size:15px; padding:10px 20px; text-decoration:none;"><?php echo esc_html_x('New Import', 'pmxi_plugin'); ?></a>
5
  </h2>
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  <?php if ($this->errors->get_error_codes()): ?>
8
  <?php $this->error() ?>
9
  <?php endif ?>
@@ -26,7 +39,7 @@ $columns = array(
26
  'post_count' => __('Records', 'pmxi_plugin'),
27
  'first_import' => __('First Import', 'pmxi_plugin'),
28
  'registered_on' => __('Last Import', 'pmxi_plugin'),
29
- /*'scheduled' => __('Reimport Schedule', 'pmxi_plugin'),
30
  'next_import' => __('Next Import', 'pmxi_plugin'),*/
31
  );
32
  ?>
@@ -92,7 +105,7 @@ $columns = array(
92
  <tr>
93
  <td colspan="<?php echo count($columns) + 1 ?>"><?php _e('No previous imports found.', 'pmxi_plugin') ?></td>
94
  </tr>
95
- <?php else: ?>
96
  <?php $class = ''; foreach ($list as $item): ?>
97
  <?php $class = ('alternate' == $class) ? '' : 'alternate'; ?>
98
  <tr class="<?php echo $class; ?>" valign="middle">
@@ -108,7 +121,7 @@ $columns = array(
108
  <?php echo $item['id'] ?>
109
  </th>
110
  <?php
111
- break;
112
  case 'first_import':
113
  ?>
114
  <td>
@@ -157,7 +170,7 @@ $columns = array(
157
 
158
  <span class="edit"><a class="edit" href="<?php echo esc_url(add_query_arg(array('id' => $item['id'], 'action' => 'edit'), $this->baseUrl)) ?>"><?php _e('Edit Template', 'pmxi_plugin') ?></a></span> |
159
  <span class="edit"><a class="edit" href="<?php echo esc_url(add_query_arg(array('id' => $item['id'], 'action' => 'options'), $this->baseUrl)) ?>"><?php _e('Edit Options', 'pmxi_plugin') ?></a></span> |
160
- <span class="update"><a class="update" href="<?php echo esc_url(add_query_arg(array('id' => $item['id'], 'action' => 'update'), $this->baseUrl)) ?>"><?php _e('Update', 'pmxi_plugin') ?></a></span> |
161
  <span class="update"><a class="update" href="<?php echo esc_url(add_query_arg(array('page' => 'pmxi-admin-import', 'id' => $item['id']), admin_url('admin.php'))) ?>"><?php _e('Use New File', 'pmxi_plugin') ?></a></span> |
162
  <span class="update"><a class="update" href="<?php echo esc_url(add_query_arg(array('id' => $item['id'], 'action' => 'log'), $this->baseUrl)) ?>"><?php _e('Download Log', 'pmxi_plugin') ?></a></span> |
163
  <span class="delete"><a class="delete" href="<?php echo esc_url(add_query_arg(array('id' => $item['id'], 'action' => 'delete'), $this->baseUrl)) ?>"><?php _e('Delete', 'pmxi_plugin') ?></a></span>
@@ -215,5 +228,22 @@ $columns = array(
215
  </div>
216
  </div>
217
  <div class="clear"></div>
218
- <a href="http://www.wpallimport.com/upgrade-to-pro?from=upi" target="_blank" class="upgrade_link">Upgrade to the paid edition of WP All Import to use this feature.</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  </form>
4
  <a href="<?php echo esc_url(add_query_arg(array('page' => 'pmxi-admin-import'), admin_url('admin.php'))) ?>" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" style="font-size:15px; padding:10px 20px; text-decoration:none;"><?php echo esc_html_x('New Import', 'pmxi_plugin'); ?></a>
5
  </h2>
6
 
7
+ <?php
8
+ // notify user
9
+ if (!PMXI_Plugin::getInstance()->getOption('dismiss_manage_top')) {
10
+ ?>
11
+ <div class="updated"><p>
12
+ <?php printf(
13
+ __('Need help with WP All Import? Please visit <a href="http://www.wpallimport.com/support">http://www.wpallimport.com/support</a> or send an e-mail to <a href="mailto:support@soflyy.com">support@soflyy.com</a>. We give priority to professional edition customers, but we respond to most inquiries from free version users within 24 hours during business days.<br/><br/>Please note that we are unable to handle technical support requests in the WordPress.org community forums. <br/><br/><a href="javascript:void(0);" id="dismiss_manage_top"><u>dismiss</u></a>', 'pmxi_plugin')
14
+ ) ?>
15
+ </p></div>
16
+ <?php
17
+ }
18
+ ?>
19
+
20
  <?php if ($this->errors->get_error_codes()): ?>
21
  <?php $this->error() ?>
22
  <?php endif ?>
39
  'post_count' => __('Records', 'pmxi_plugin'),
40
  'first_import' => __('First Import', 'pmxi_plugin'),
41
  'registered_on' => __('Last Import', 'pmxi_plugin'),
42
+ /*'scheduled' => __('Reimport Schedule', 'pmxi_plugin'),
43
  'next_import' => __('Next Import', 'pmxi_plugin'),*/
44
  );
45
  ?>
105
  <tr>
106
  <td colspan="<?php echo count($columns) + 1 ?>"><?php _e('No previous imports found.', 'pmxi_plugin') ?></td>
107
  </tr>
108
+ <?php else: ?>
109
  <?php $class = ''; foreach ($list as $item): ?>
110
  <?php $class = ('alternate' == $class) ? '' : 'alternate'; ?>
111
  <tr class="<?php echo $class; ?>" valign="middle">
121
  <?php echo $item['id'] ?>
122
  </th>
123
  <?php
124
+ break;
125
  case 'first_import':
126
  ?>
127
  <td>
170
 
171
  <span class="edit"><a class="edit" href="<?php echo esc_url(add_query_arg(array('id' => $item['id'], 'action' => 'edit'), $this->baseUrl)) ?>"><?php _e('Edit Template', 'pmxi_plugin') ?></a></span> |
172
  <span class="edit"><a class="edit" href="<?php echo esc_url(add_query_arg(array('id' => $item['id'], 'action' => 'options'), $this->baseUrl)) ?>"><?php _e('Edit Options', 'pmxi_plugin') ?></a></span> |
173
+ <span class="update"><a class="update" href="<?php echo esc_url(add_query_arg(array('id' => $item['id'], 'action' => 'update'), $this->baseUrl)) ?>"><?php _e('Update', 'pmxi_plugin') ?></a></span> |
174
  <span class="update"><a class="update" href="<?php echo esc_url(add_query_arg(array('page' => 'pmxi-admin-import', 'id' => $item['id']), admin_url('admin.php'))) ?>"><?php _e('Use New File', 'pmxi_plugin') ?></a></span> |
175
  <span class="update"><a class="update" href="<?php echo esc_url(add_query_arg(array('id' => $item['id'], 'action' => 'log'), $this->baseUrl)) ?>"><?php _e('Download Log', 'pmxi_plugin') ?></a></span> |
176
  <span class="delete"><a class="delete" href="<?php echo esc_url(add_query_arg(array('id' => $item['id'], 'action' => 'delete'), $this->baseUrl)) ?>"><?php _e('Delete', 'pmxi_plugin') ?></a></span>
228
  </div>
229
  </div>
230
  <div class="clear"></div>
231
+ <?php
232
+ // notify user
233
+ if (!PMXI_Plugin::getInstance()->getOption('dismiss_manage_bottom')) {
234
+ ?>
235
+ <div class="updated_bottom"><p>
236
+ <?php printf(
237
+ __('<a href="http://wordpress.org/extend/plugins/wp-all-import" target="_blank">If you like WPAllImport, please rate us five stars on WordPress.org!</a> <a href="http://wordpress.org/extend/plugins/wp-all-import" class="pmxi_stars" target="_blank"></a> <br/><br/><a href="javascript:void(0);" id="dismiss_manage_bottom">dismiss</a>', 'pmxi_plugin')
238
+ ) ?>
239
+ </p></div>
240
+ <?php
241
+ }
242
+ ?>
243
+
244
+
245
+
246
+ <p style='font-size: 1.3em; font-weight: bold;'><a href="http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=manage&utm_campaign=free+plugin" target="_blank" class="upgrade_link">Find out more about the professional edition of WP All Import.</a></p>
247
+
248
+
249
  </form>
views/admin/settings/index.php CHANGED
@@ -5,7 +5,7 @@
5
  <?php if ($this->errors->get_error_codes()): ?>
6
  <?php $this->error() ?>
7
  <?php endif ?>
8
-
9
  <h3><?php _e('Saved Templates', 'pmxi_plugin') ?></h3>
10
  <?php $templates = new PMXI_Template_List(); $templates->getBy()->convertRecords() ?>
11
  <?php if ($templates->total()): ?>
@@ -39,7 +39,25 @@
39
  <div><?php printf(__('max_input_time %s', 'pmxi_plugin'), ini_get('max_input_time')) ?></div>
40
 
41
  <h3><?php _e('Recurring & Scheduled Imports', 'pmxi_plugin') ?></h3>
42
- <a href="http://www.wpallimport.com/upgrade-to-pro?from=upi" target="_blank" class="upgrade_link">Upgrade to the paid edition of WP All Import to use this feature.</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  <p class="submit-buttons">
44
  <?php wp_nonce_field('edit-settings', '_wpnonce_edit-settings') ?>
45
  <input type="hidden" name="is_settings_submitted" value="1" />
5
  <?php if ($this->errors->get_error_codes()): ?>
6
  <?php $this->error() ?>
7
  <?php endif ?>
8
+
9
  <h3><?php _e('Saved Templates', 'pmxi_plugin') ?></h3>
10
  <?php $templates = new PMXI_Template_List(); $templates->getBy()->convertRecords() ?>
11
  <?php if ($templates->total()): ?>
39
  <div><?php printf(__('max_input_time %s', 'pmxi_plugin'), ini_get('max_input_time')) ?></div>
40
 
41
  <h3><?php _e('Recurring & Scheduled Imports', 'pmxi_plugin') ?></h3>
42
+
43
+
44
+ <hr />
45
+
46
+ <h3>Please upgrade to the professional edition of WP All Import to perform recurring and scheduled imports.</h3>
47
+
48
+ <p>WP All Import can periodically check your XML/CSV for updates on the schedule you define, and overwrite your existing import with new data. New posts will be made for new entries in the XML/CSV. Entries that haven't changed will be left alone. WP All Import can even delete "expired" posts (if their data is no longer in the updated XML/CSV).</p>
49
+
50
+ <p>You can configure recurring imports from within WP All Import, or by setting up a cron job in your web hosting control panel.</p>
51
+
52
+ <p>WP All Import can perform recurring imports with a file online at an http:// URL, or a file on an FTP server.</p>
53
+
54
+ <p style='font-size: 1.3em; font-weight: bold;'><a href="http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=recurring&utm_campaign=free+plugin" target="_blank" class="upgrade_link">Upgrade Now</a></p>
55
+
56
+ <hr />
57
+
58
+
59
+ <h3><?php _e('Import Settings', 'pmxi_plugin') ?></h3>
60
+ <div><?php printf(__('Chunk maximum size %s (Kb)', 'pmxi_plugin'), '<input type="text" name="chunk_size" value="' . esc_attr($post['chunk_size']) . '"/>') ?></div>
61
  <p class="submit-buttons">
62
  <?php wp_nonce_field('edit-settings', '_wpnonce_edit-settings') ?>
63
  <input type="hidden" name="is_settings_submitted" value="1" />