One Click Demo Import - Version 3.1.2

Version Description

Release Date - 8th July 2022

  • Fixed missing terms count update (fixes missing menu items after WP 6.0 update).
Download this release

Release Info

Developer capuderg
Plugin Icon 128x128 One Click Demo Import
Version 3.1.2
Comparing to
See all releases

Code changes from version 3.1.1 to 3.1.2

inc/OneClickDemoImport.php CHANGED
@@ -88,6 +88,13 @@ class OneClickDemoImport {
88
  */
89
  private $plugin_page_setup = array();
90
 
 
 
 
 
 
 
 
91
  /**
92
  * Returns the *Singleton* instance of this class.
93
  *
@@ -120,6 +127,7 @@ class OneClickDemoImport {
120
  add_action( 'admin_notices', array( $this, 'start_notice_output_capturing' ), 0 );
121
  add_action( 'all_admin_notices', array( $this, 'finish_notice_output_capturing' ), PHP_INT_MAX );
122
  add_action( 'admin_init', array( $this, 'redirect_from_old_default_admin_page' ) );
 
123
  }
124
 
125
 
@@ -390,6 +398,9 @@ class OneClickDemoImport {
390
  wp_send_json( array( 'status' => 'afterAllImportAJAX' ) );
391
  }
392
 
 
 
 
393
  // Send a JSON response with final report.
394
  $this->final_response();
395
  }
@@ -444,6 +455,9 @@ class OneClickDemoImport {
444
  Helpers::do_action( 'ocdi/after_all_import_execution', $this->selected_import_files, $this->import_files, $this->selected_index );
445
  }
446
 
 
 
 
447
  // Send a JSON response with final report.
448
  $this->final_response();
449
  }
@@ -498,6 +512,7 @@ class OneClickDemoImport {
498
  $this->selected_import_files = empty( $data['selected_import_files'] ) ? array() : $data['selected_import_files'];
499
  $this->import_files = empty( $data['import_files'] ) ? array() : $data['import_files'];
500
  $this->before_import_executed = empty( $data['before_import_executed'] ) ? false : $data['before_import_executed'];
 
501
  $this->importer->set_importer_data( $data );
502
 
503
  return true;
@@ -519,6 +534,7 @@ class OneClickDemoImport {
519
  'selected_import_files' => $this->selected_import_files,
520
  'import_files' => $this->import_files,
521
  'before_import_executed' => $this->before_import_executed,
 
522
  );
523
  }
524
 
@@ -691,4 +707,30 @@ class OneClickDemoImport {
691
  exit;
692
  }
693
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
694
  }
88
  */
89
  private $plugin_page_setup = array();
90
 
91
+ /**
92
+ * Imported terms.
93
+ *
94
+ * @var array
95
+ */
96
+ private $imported_terms = array();
97
+
98
  /**
99
  * Returns the *Singleton* instance of this class.
100
  *
127
  add_action( 'admin_notices', array( $this, 'start_notice_output_capturing' ), 0 );
128
  add_action( 'all_admin_notices', array( $this, 'finish_notice_output_capturing' ), PHP_INT_MAX );
129
  add_action( 'admin_init', array( $this, 'redirect_from_old_default_admin_page' ) );
130
+ add_action( 'set_object_terms', array( $this, 'add_imported_terms' ), 10, 6 );
131
  }
132
 
133
 
398
  wp_send_json( array( 'status' => 'afterAllImportAJAX' ) );
399
  }
400
 
401
+ // Update terms count.
402
+ $this->update_terms_count();
403
+
404
  // Send a JSON response with final report.
405
  $this->final_response();
406
  }
455
  Helpers::do_action( 'ocdi/after_all_import_execution', $this->selected_import_files, $this->import_files, $this->selected_index );
456
  }
457
 
458
+ // Update terms count.
459
+ $this->update_terms_count();
460
+
461
  // Send a JSON response with final report.
462
  $this->final_response();
463
  }
512
  $this->selected_import_files = empty( $data['selected_import_files'] ) ? array() : $data['selected_import_files'];
513
  $this->import_files = empty( $data['import_files'] ) ? array() : $data['import_files'];
514
  $this->before_import_executed = empty( $data['before_import_executed'] ) ? false : $data['before_import_executed'];
515
+ $this->imported_terms = empty( $data['imported_terms'] ) ? [] : $data['imported_terms'];
516
  $this->importer->set_importer_data( $data );
517
 
518
  return true;
534
  'selected_import_files' => $this->selected_import_files,
535
  'import_files' => $this->import_files,
536
  'before_import_executed' => $this->before_import_executed,
537
+ 'imported_terms' => $this->imported_terms,
538
  );
539
  }
540
 
707
  exit;
708
  }
709
  }
710
+
711
+ /**
712
+ * Add imported terms.
713
+ *
714
+ * Mainly it's needed for saving all imported terms and trigger terms count updates.
715
+ * WP core term defer counting is not working, since import split to chunks and we are losing `$_deffered` array
716
+ * items between ajax calls.
717
+ */
718
+ public function add_imported_terms( $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids ){
719
+
720
+ if ( ! isset( $this->imported_terms[ $taxonomy ] ) ) {
721
+ $this->imported_terms[ $taxonomy ] = array();
722
+ }
723
+
724
+ $this->imported_terms[ $taxonomy ] = array_unique( array_merge( $this->imported_terms[ $taxonomy ], $tt_ids ) );
725
+ }
726
+
727
+ /**
728
+ * Update imported terms count.
729
+ */
730
+ private function update_terms_count() {
731
+
732
+ foreach ( $this->imported_terms as $tax => $terms ) {
733
+ wp_update_term_count_now( $terms, $tax );
734
+ }
735
+ }
736
  }
languages/one-click-demo-import.pot CHANGED
@@ -1,13 +1,13 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: One Click Demo Import 3.1.1\n"
4
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/one-click-demo-import\n"
5
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
6
  "Language-Team: LANGUAGE <LL@li.org>\n"
7
  "MIME-Version: 1.0\n"
8
  "Content-Type: text/plain; charset=UTF-8\n"
9
  "Content-Transfer-Encoding: 8bit\n"
10
- "POT-Creation-Date: 2022-03-22T06:17:28+00:00\n"
11
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
  "X-Generator: WP-CLI 2.4.0\n"
13
  "X-Domain: one-click-demo-import\n"
@@ -310,121 +310,121 @@ msgstr ""
310
  msgid "New AJAX call!"
311
  msgstr ""
312
 
313
- #: inc/OneClickDemoImport.php:221
314
  msgid "No preview image defined for this import."
315
  msgstr ""
316
 
317
- #: inc/OneClickDemoImport.php:222
318
  msgid "Are you sure?"
319
  msgstr ""
320
 
321
- #: inc/OneClickDemoImport.php:223
322
  #: views/plugin-page.php:276
323
  msgid "Cancel"
324
  msgstr ""
325
 
326
- #: inc/OneClickDemoImport.php:224
327
  msgid "Yes, import!"
328
  msgstr ""
329
 
330
- #: inc/OneClickDemoImport.php:225
331
  msgid "Selected demo import:"
332
  msgstr ""
333
 
334
- #: inc/OneClickDemoImport.php:226
335
  msgid "Installing..."
336
  msgstr ""
337
 
338
- #: inc/OneClickDemoImport.php:227
339
  #: inc/WPCLICommands.php:153
340
  msgid "Importing..."
341
  msgstr ""
342
 
343
- #: inc/OneClickDemoImport.php:228
344
  msgid "Successfully Imported!"
345
  msgstr ""
346
 
347
- #: inc/OneClickDemoImport.php:229
348
  #: views/plugin-page.php:270
349
  msgid "Install Plugin"
350
  msgstr ""
351
 
352
- #: inc/OneClickDemoImport.php:230
353
  #: views/plugin-page.php:270
354
  msgid "Installed"
355
  msgstr ""
356
 
357
- #: inc/OneClickDemoImport.php:231
358
  msgid "Import Failed"
359
  msgstr ""
360
 
361
- #: inc/OneClickDemoImport.php:232
362
  msgid "Whoops, there was a problem importing your content."
363
  msgstr ""
364
 
365
- #: inc/OneClickDemoImport.php:233
366
  msgid "Looks like some of the plugins failed to install. Please try again. If this issue persists, please manually install the failing plugins and come back to this step to import the theme demo data."
367
  msgstr ""
368
 
369
- #: inc/OneClickDemoImport.php:234
370
  msgid "Invalid file type detected! Please select an XML file for the Content Import."
371
  msgstr ""
372
 
373
- #: inc/OneClickDemoImport.php:235
374
  msgid "Invalid file type detected! Please select a JSON or WIE file for the Widgets Import."
375
  msgstr ""
376
 
377
- #: inc/OneClickDemoImport.php:236
378
  msgid "Invalid file type detected! Please select a DAT file for the Customizer Import."
379
  msgstr ""
380
 
381
- #: inc/OneClickDemoImport.php:237
382
  msgid "Invalid file type detected! Please select a JSON file for the Redux Import."
383
  msgstr ""
384
 
385
- #: inc/OneClickDemoImport.php:254
386
  msgid "Manual import files are missing! Please select the import files and try again."
387
  msgstr ""
388
 
389
- #: inc/OneClickDemoImport.php:269
390
- #: inc/OneClickDemoImport.php:314
391
  msgid "Manually uploaded files"
392
  msgstr ""
393
 
394
- #: inc/OneClickDemoImport.php:327
395
- #: inc/OneClickDemoImport.php:338
396
  msgid "Downloaded files"
397
  msgstr ""
398
 
399
  #. translators: %s - the name of the selected import.
400
- #: inc/OneClickDemoImport.php:334
401
  msgid "The import files for: %s were successfully downloaded!"
402
  msgstr ""
403
 
404
- #: inc/OneClickDemoImport.php:343
405
  msgid "No import files specified!"
406
  msgstr ""
407
 
408
- #: inc/OneClickDemoImport.php:460
409
  #: views/import.php:118
410
  msgid "Import Complete!"
411
  msgstr ""
412
 
413
- #: inc/OneClickDemoImport.php:461
414
  #: views/import.php:121
415
  msgid "Congrats, your demo was imported successfully. You can now begin editing your site."
416
  msgstr ""
417
 
418
- #: inc/OneClickDemoImport.php:462
419
  msgid "Successful Import"
420
  msgstr ""
421
 
422
- #: inc/OneClickDemoImport.php:465
423
  msgid "Your import completed, but some things may not have imported properly."
424
  msgstr ""
425
 
426
  #. translators: %s - link to the log file.
427
- #: inc/OneClickDemoImport.php:469
428
  msgid "<p><a href=\"%s\" target=\"_blank\">View error log</a> for more information.</p>"
429
  msgstr ""
430
 
1
  msgid ""
2
  msgstr ""
3
+ "Project-Id-Version: One Click Demo Import 3.1.2\n"
4
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/one-click-demo-import\n"
5
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
6
  "Language-Team: LANGUAGE <LL@li.org>\n"
7
  "MIME-Version: 1.0\n"
8
  "Content-Type: text/plain; charset=UTF-8\n"
9
  "Content-Transfer-Encoding: 8bit\n"
10
+ "POT-Creation-Date: 2022-07-08T11:47:50+00:00\n"
11
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
  "X-Generator: WP-CLI 2.4.0\n"
13
  "X-Domain: one-click-demo-import\n"
310
  msgid "New AJAX call!"
311
  msgstr ""
312
 
313
+ #: inc/OneClickDemoImport.php:229
314
  msgid "No preview image defined for this import."
315
  msgstr ""
316
 
317
+ #: inc/OneClickDemoImport.php:230
318
  msgid "Are you sure?"
319
  msgstr ""
320
 
321
+ #: inc/OneClickDemoImport.php:231
322
  #: views/plugin-page.php:276
323
  msgid "Cancel"
324
  msgstr ""
325
 
326
+ #: inc/OneClickDemoImport.php:232
327
  msgid "Yes, import!"
328
  msgstr ""
329
 
330
+ #: inc/OneClickDemoImport.php:233
331
  msgid "Selected demo import:"
332
  msgstr ""
333
 
334
+ #: inc/OneClickDemoImport.php:234
335
  msgid "Installing..."
336
  msgstr ""
337
 
338
+ #: inc/OneClickDemoImport.php:235
339
  #: inc/WPCLICommands.php:153
340
  msgid "Importing..."
341
  msgstr ""
342
 
343
+ #: inc/OneClickDemoImport.php:236
344
  msgid "Successfully Imported!"
345
  msgstr ""
346
 
347
+ #: inc/OneClickDemoImport.php:237
348
  #: views/plugin-page.php:270
349
  msgid "Install Plugin"
350
  msgstr ""
351
 
352
+ #: inc/OneClickDemoImport.php:238
353
  #: views/plugin-page.php:270
354
  msgid "Installed"
355
  msgstr ""
356
 
357
+ #: inc/OneClickDemoImport.php:239
358
  msgid "Import Failed"
359
  msgstr ""
360
 
361
+ #: inc/OneClickDemoImport.php:240
362
  msgid "Whoops, there was a problem importing your content."
363
  msgstr ""
364
 
365
+ #: inc/OneClickDemoImport.php:241
366
  msgid "Looks like some of the plugins failed to install. Please try again. If this issue persists, please manually install the failing plugins and come back to this step to import the theme demo data."
367
  msgstr ""
368
 
369
+ #: inc/OneClickDemoImport.php:242
370
  msgid "Invalid file type detected! Please select an XML file for the Content Import."
371
  msgstr ""
372
 
373
+ #: inc/OneClickDemoImport.php:243
374
  msgid "Invalid file type detected! Please select a JSON or WIE file for the Widgets Import."
375
  msgstr ""
376
 
377
+ #: inc/OneClickDemoImport.php:244
378
  msgid "Invalid file type detected! Please select a DAT file for the Customizer Import."
379
  msgstr ""
380
 
381
+ #: inc/OneClickDemoImport.php:245
382
  msgid "Invalid file type detected! Please select a JSON file for the Redux Import."
383
  msgstr ""
384
 
385
+ #: inc/OneClickDemoImport.php:262
386
  msgid "Manual import files are missing! Please select the import files and try again."
387
  msgstr ""
388
 
389
+ #: inc/OneClickDemoImport.php:277
390
+ #: inc/OneClickDemoImport.php:322
391
  msgid "Manually uploaded files"
392
  msgstr ""
393
 
394
+ #: inc/OneClickDemoImport.php:335
395
+ #: inc/OneClickDemoImport.php:346
396
  msgid "Downloaded files"
397
  msgstr ""
398
 
399
  #. translators: %s - the name of the selected import.
400
+ #: inc/OneClickDemoImport.php:342
401
  msgid "The import files for: %s were successfully downloaded!"
402
  msgstr ""
403
 
404
+ #: inc/OneClickDemoImport.php:351
405
  msgid "No import files specified!"
406
  msgstr ""
407
 
408
+ #: inc/OneClickDemoImport.php:474
409
  #: views/import.php:118
410
  msgid "Import Complete!"
411
  msgstr ""
412
 
413
+ #: inc/OneClickDemoImport.php:475
414
  #: views/import.php:121
415
  msgid "Congrats, your demo was imported successfully. You can now begin editing your site."
416
  msgstr ""
417
 
418
+ #: inc/OneClickDemoImport.php:476
419
  msgid "Successful Import"
420
  msgstr ""
421
 
422
+ #: inc/OneClickDemoImport.php:479
423
  msgid "Your import completed, but some things may not have imported properly."
424
  msgstr ""
425
 
426
  #. translators: %s - link to the log file.
427
+ #: inc/OneClickDemoImport.php:483
428
  msgid "<p><a href=\"%s\" target=\"_blank\">View error log</a> for more information.</p>"
429
  msgstr ""
430
 
one-click-demo-import.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: One Click Demo Import
5
  Plugin URI: https://wordpress.org/plugins/one-click-demo-import/
6
  Description: Import your content, widgets and theme settings with one click. Theme authors! Enable simple demo import for your theme demo data.
7
- Version: 3.1.1
8
  Author: OCDI
9
  Author URI: https://ocdi.com
10
  License: GPL3
4
  Plugin Name: One Click Demo Import
5
  Plugin URI: https://wordpress.org/plugins/one-click-demo-import/
6
  Description: Import your content, widgets and theme settings with one click. Theme authors! Enable simple demo import for your theme demo data.
7
+ Version: 3.1.2
8
  Author: OCDI
9
  Author URI: https://ocdi.com
10
  License: GPL3
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: ocdi, smub, jaredatch, capuderg
3
  Tags: import, content, demo, data, widgets, settings, redux, theme options
4
  Requires at least: 5.2
5
- Tested up to: 5.9
6
  Requires PHP: 5.6
7
- Stable tag: 3.1.1
8
  License: GPLv3 or later
9
 
10
  Import your demo content, widgets and theme settings with one click. Theme authors! Enable simple theme demo import for your users.
@@ -359,6 +359,12 @@ Please visit this [docs page](https://github.com/awesomemotive/one-click-demo-im
359
 
360
  == Changelog ==
361
 
 
 
 
 
 
 
362
  = 3.1.1 =
363
 
364
  *Release Date - 22nd March 2022*
2
  Contributors: ocdi, smub, jaredatch, capuderg
3
  Tags: import, content, demo, data, widgets, settings, redux, theme options
4
  Requires at least: 5.2
5
+ Tested up to: 6.0
6
  Requires PHP: 5.6
7
+ Stable tag: 3.1.2
8
  License: GPLv3 or later
9
 
10
  Import your demo content, widgets and theme settings with one click. Theme authors! Enable simple theme demo import for your users.
359
 
360
  == Changelog ==
361
 
362
+ = 3.1.2 =
363
+
364
+ *Release Date - 8th July 2022*
365
+
366
+ * Fixed missing terms count update (fixes missing menu items after WP 6.0 update).
367
+
368
  = 3.1.1 =
369
 
370
  *Release Date - 22nd March 2022*